@import url("https://fonts.googleapis.com/css2?family=Fredoka:wdth,wght@75..125,300..700&display=swap");

/* ==== Setup ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  color: #2e2e2e;
  background: #f0f0f0;
  font-family: "Fredoka", "Gill Sans", sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  text-align: center;
}

.content-wrapper {
  flex-grow: 1;
  width: 100%;
}

.home {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.how-to-play {
  height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

button {
  margin: 2rem;
  padding: 0.5rem 1rem;
  font-size: 1.5rem;
  font-family: inherit;
  font-weight: 600;
  color: #f0f0f0;
  background: #1f8ef1;
  border: 2px solid #1f8ef1;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background: white;
  color: #1f8ef1;
  font-size: 1.7rem;
}
/* ==== Canvas ==== */
canvas {
  width: 100%;
  height: 100vh;
  display: block;
  background: #e0f0ff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100vh;
  z-index: -10;
  opacity: 0.9;
}

/* ==== Toast Notification ==== */
.check-sol-div,
.check-sol-div-not-win {
  padding: 1rem;
  background: #fff;
  border-radius: 14px;
  text-align: center;
  z-index: 1000;
  width: 90%;
  max-width: 450px;
  margin: 1rem;
  -webkit-box-shadow: 0px 0px 10px -4px #000000;
  box-shadow: 0px 0px 10px -4px #000000;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.check-sol-div p,
.check-sol-div-not-win p {
  font-weight: 600;
}

.check-sol-div button,
.check-sol-div-not-win button {
  font-size: 1.3rem;
}

.notification {
  padding: 1rem;
  background: #fff;
  border-radius: 14px;
  text-align: center;
  z-index: 1000;
  max-width: 450px;
  margin: 1rem;
  -webkit-box-shadow: 0px 0px 10px -4px #000000;
  box-shadow: 0px 0px 10px -4px #000000;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -100%);
  transition: transform 10s ease, opacity 0.3s ease;
}

.notification.shown {
  display: block;
  transform: translate(-50%, 0);
}

.notification button {
  margin: 0.8rem;
  font-size: 1.1rem;
}

#error-diffi,
#error-size,
#warning-color {
  display: none;
}

/* ==== Stop Animation Button ==== */
#move {
  border-radius: 50%;
  padding-block: 12px;
  padding-inline: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 15px;
  right: 18px;
  margin: 0;
}

#move:hover svg path {
  fill: #1f8ef1;
  stroke: #1f8ef1;
}
/* ==== HOME PAGE ==== */
#title {
  text-align: center;
  font-size: 9em;
  margin: 20px;
  color: #1f8ef1;
  -webkit-text-stroke: 2px #095190;
  transition: all 0.1s ease;
}

#title:hover {
  transform: scale(1.0375);
  cursor: pointer;
}

#title a {
  text-decoration: none;
  color: #1f8ef1;
}

#description {
  font-size: 24px;
  font-weight: 500;
  margin: 10px;
}

#description img {
  transform: translateY(5px);
  opacity: 0.8;
}

#hint {
  text-decoration: underline;
  cursor: pointer;
  position: absolute;
  font-size: 0.9rem;
  right: 10px;
  top: 80%;
  transform: rotate(-15deg);
  display: inline;
}

#hint a {
  text-decoration: none;
  color: inherit;
}

#hint a:visited {
  color: inherit;
}

#hint a:hover,
#hint:hover {
  text-decoration: wavy underline;
  text-decoration-color: #1f8ef1;
  color: #1f8ef1;
}

/* ==== SUDOKU PUZZLES PAGE ==== */
.sudokus {
  height: 100vh;
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
}

.sudokus h2 {
  margin: 2rem;
}

.sudokus #back-to-settings {
  position: fixed;
  bottom: 0.7rem;
  left: 1rem;
}

.sudokus-container {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, 6.3rem);
  grid-template-rows: repeat(auto-fill, 6.3rem);
  gap: 2rem;
  width: 70%;
}

button.sudokus-levels {
  font-size: 2rem;
  color: #f0f0f0;
  background: #1f8ef1;
  padding: 3rem 3rem;
  margin: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100px;
  height: 100px;
}

button.sudokus-levels:hover {
  transform: scale(1.1);
  font-size: 2rem;
}

/* ==== PLAY PAGE ==== */
.playPage {
  display: none;
  justify-content: space-evenly;
  height: 100vh;
  width: 100%;
  flex-wrap: wrap;
}

#board {
  display: grid;
  margin: 2rem;
  gap: 0;
  width: fit-content;
  height: fit-content;
  border: 2px solid #333;
  display: grid;
  width: 90vmin;
  height: 90vmin;
  max-width: 500px;
  max-height: 500px;
}

.buttons-container {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(4, 100px);
  margin: 1.3rem;
}
.buttons-container button {
  margin: 1rem;
  cursor: pointer;
}

#check-sol {
  grid-column: 1/ -1;
  height: 70px;
}

.cell {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  width: 100%;
  height: 100%;
}

.puzzle-cell {
  box-sizing: border-box;
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.puzzle-cell.notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);

  font-size: 0.8rem;
  color: #ccc;
  text-align: center;
}

/* ==== ABOUT PAGE ==== */
.about {
  height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==== SETTINGS PAGE ==== */
.settings {
  height: 100vh;
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-evenly;
  width: 100%;
  flex-direction: row;
}

.settings h3 {
  font-size: 2.2rem;
  font-family: "Trebuchet MS", sans-serif;
  margin: 1rem;
}

li span {
  color: #1f8ef1;
  font-weight: 500;
}

.settings div .options {
  display: grid;
  grid-template-columns: repeat(4, 160px);
  grid-template-rows: repeat(2, 65px);
  width: 50%;
}

.settings .board-container {
  margin: 0rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-direction: column;
}

.settings .options-container {
  display: flex;
  justify-content: center;
  flex-direction: column;
  margin-right: 7rem;
}

#preview-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 90vmin;
  height: 90vmin;
  max-width: 500px;
  max-height: 500px;
}

.cell-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  font-size: 1.2rem;
  font-weight: bold;
  border: 1px solid #ccc;
  box-sizing: border-box;
  background-color: #fff;
}

#start {
  font-size: 2rem;
  border-radius: 15px;
}

#start:hover {
  font-size: 2.2rem;
}

label {
  font-size: 1.5rem;
  margin: 0rem 0.3rem 0rem 2rem;
}

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px #333 solid;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
  background: #fff;
  margin-right: 0.3rem;
  margin-left: 1rem;
}

input[type="radio"]:checked {
  background: #1f8ef1;
  border-color: #1f8ef1;
}

input[value="red"] {
  grid-row-start: 2;
}
input[value="pink"] {
  grid-row-start: 2;
}
input[value="purple"] {
  grid-row-start: 2;
}

#back {
  position: fixed;
  bottom: 15px;
  left: 15px;
  display: block;
  margin: 0;
  font-weight: 500;
  font-size: 1.2rem;
  color: hsla(209, 100%, 94%, 0.9);
  background: hsla(208, 88%, 53%, 0.7);
}

#back:hover {
  color: #e0f0ff;
  background: #1f8ef1;
  font-size: 1.3rem;
}

/* ==== LOADING PAGE ==== */
#loading-page {
  display: flex;
  justify-content: center;
  align-content: center;
  background: #e0f0ff;
  min-height: 100vh;
  width: 100%;
  z-index: 10000;
  display: none;
}

#loading {
  font-size: 3.5rem;
  height: 80px;
  margin-bottom: 1rem;
  font-weight: 500;
  font-family: "Gill S,ans", "Gill Sans MT", sans-serif;
  color: #1f8ef1;
}

#x {
  font-size: 1.5rem;
  font-weight: 500;
  min-height: 2rem;
  margin-top: 1rem;
  color: #1f8ef1;
  transition: all 0.3s ease;
}

#gen {
  font-size: 2rem;
  margin: 1.5rem;
  font-weight: 700;
  color: #1f8ef1;
}

/* ==== HOW TO PLAY PAGE ==== */
.instructions img {
  opacity: 0.8;
}

ul > li {
  margin: 1rem;
  list-style: none;
}

h2 {
  text-align: center;
  font-size: 5rem;
  font-weight: 600;
  margin: 20px;
  letter-spacing: 3px;
  color: #1f8ef1;
  text-shadow: 2px 2px 0 #095190, 2px -2px 0 #095190, -2px 2px 0 #095190,
    -2px -2px 0 #095190, 2px 0px 0 #095190, 0px 2px 0 #095190,
    -2px 0px 0 #095190, 0px -2px 0 #095190;
}

p {
  font-size: 1.2rem;
  margin: 10px 20px;
}

/* ==== FOOTER ==== */
footer p {
  margin: 1rem;
}
/* ==== MEDIA QUERIES ==== */

/* -------- Small phones (≤376px) -------- */
@media (max-width: 376px) {
  #title {
    font-size: 7rem;
  }

  #description {
    font-size: 1.2rem;
  }

  #play {
    font-size: 1.3rem;
  }

  .cell-preview {
    font-size: 0.6rem;
  }
}

/* -------- Phones (≤450px) -------- */
@media (max-width: 450px) {
  #description {
    width: 85%;
  }

  #hint {
    display: none;
  }

  h2 {
    font-size: 3.3rem;
    font-weight: 600;
  }

  .cell-preview {
    font-size: 0.7rem;
  }
}

/* -------- Tablets & small devices (≤768px) -------- */
@media (max-width: 768px) {
  .settings {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem;
    height: auto;
  }

  .settings div .options {
    grid-template-columns: repeat(2, 160px);
    grid-template-rows: repeat(2, 65px);
  }

  .settings div .options:nth-of-type(1) {
    grid-template-columns: repeat(2, 160px);
    grid-template-rows: repeat(4, 65px);
  }

  .settings .options-container {
    margin-right: 0;
    margin-bottom: 2rem;
    width: 100%;
  }

  .cell-preview {
    font-size: 0.9rem;
  }

  #start {
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
  }

  #start:hover {
    font-size: 1.6rem;
  }

  label {
    font-size: 1rem;
  }

  input[type="radio"] {
    width: 0.8rem;
    height: 0.8rem;
  }

  #back {
    font-size: 1rem;
    padding: 0.3rem 0.8rem;
  }
}

/* -------- Medium tablets (490px–768px) -------- */
@media (min-width: 490px) and (max-width: 768px) {
  .settings div .options {
    grid-template-columns: repeat(3, 160px);
    grid-template-rows: repeat(2, 65px);
  }

  .settings div .options:nth-of-type(1) {
    grid-template-columns: repeat(3, 160px);
    grid-template-rows: repeat(3, 65px);
  }

  .cell-preview {
    font-size: 1rem;
  }
}

/* -------- Large tablets (620px–768px) -------- */
@media (min-width: 620px) and (max-width: 768px) {
  .settings div .options {
    grid-template-columns: repeat(4, 160px);
    grid-template-rows: repeat(1, 65px);
  }

  .settings div .options:nth-of-type(1) {
    grid-template-columns: repeat(4, 160px);
    grid-template-rows: repeat(2, 65px);
  }

  .cell-preview {
    font-size: 1.1rem;
  }
}
