* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Kanit", sans-serif;
  background:
    radial-gradient(circle at top left, #fff2a8 0, transparent 30%),
    radial-gradient(circle at bottom right, #bdefff 0, transparent 35%),
    #f7f9ff;
  color: #25304a;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.app {
  max-width: 1100px;
  margin: auto;
  padding: 25px 20px 50px;
}

/* HEADER */

.header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 25px;
}

.logo {
  width: 65px;
  height: 65px;
  background: #ffcf33;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
  color: #513c00;
  box-shadow: 0 8px 0 #e5ae12;
  transform: rotate(-4deg);
}

.header h1 {
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
}

.header p {
  color: #75809a;
  margin-top: 4px;
}

/* PROGRESS */

.progress-box {
  background: white;
  padding: 18px 22px;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(53, 65, 100, .08);
  margin-bottom: 25px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #68728b;
}

.progress-info strong {
  color: #3d4c74;
}

.progress-bar {
  height: 12px;
  background: #edf0f7;
  border-radius: 20px;
  overflow: hidden;
}

#progress {
  width: 2.27%;
  height: 100%;
  background: linear-gradient(90deg, #ffbd2e, #ff6f61);
  border-radius: 20px;
  transition: .4s;
}

/* CARD */

.card-wrapper {
  perspective: 1200px;
  max-width: 650px;
  margin: 0 auto;
}

.flashcard {
  width: 100%;
  height: 430px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2,.7,.2,1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-front {
  background: linear-gradient(135deg, #ffcf33, #ff9f43);
  box-shadow: 0 20px 40px rgba(244, 163, 49, .25);
}

.card-front::before,
.card-front::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
}

.card-front::before {
  width: 180px;
  height: 180px;
  top: -70px;
  right: -50px;
}

.card-front::after {
  width: 120px;
  height: 120px;
  bottom: -40px;
  left: -30px;
}

.card-back {
  background: white;
  transform: rotateY(180deg);
  box-shadow: 0 20px 40px rgba(53, 65, 100, .15);
}

.card-label {
  font-size: 18px;
  color: rgba(70, 50, 0, .7);
}

.thai-letter {
  font-size: 180px;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 8px 0 rgba(180, 100, 0, .18);
  margin: 15px 0;
}

.sound-button {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 25px;
  box-shadow: 0 5px 15px rgba(0,0,0,.12);
}

.hint {
  position: absolute;
  bottom: 25px;
  font-size: 15px;
  color: rgba(70,50,0,.6);
}

.animal-icon {
  font-size: 90px;
  margin-bottom: 5px;
}

.word {
  font-size: 65px;
  font-weight: 700;
  color: #ff705f;
}

.word-detail {
  font-size: 27px;
  margin-top: 5px;
  color: #5f6982;
}

.word-detail span {
  font-size: 40px;
  font-weight: 700;
  color: #ffbd2e;
}

.speak-word {
  margin-top: 20px;
  padding: 12px 24px;
  background: #eef4ff;
  color: #40588e;
  border-radius: 30px;
  font-size: 16px;
}

/* CONTROLS */

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 22px 0 30px;
}

.control-btn,
.shuffle-btn {
  padding: 13px 22px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 500;
  transition: .2s;
}

.control-btn {
  background: white;
  color: #53617d;
  box-shadow: 0 5px 15px rgba(40,50,90,.08);
}

.control-btn:hover,
.shuffle-btn:hover {
  transform: translateY(-2px);
}

.control-btn.primary {
  background: #ff7062;
  color: white;
  box-shadow: 0 6px 15px rgba(255,112,98,.25);
}

.shuffle-btn {
  background: #536ee8;
  color: white;
}

/* QUIZ */

.quiz {
  max-width: 650px;
  margin: 0 auto 40px;
  background: white;
  padding: 25px;
  border-radius: 25px;
  box-shadow: 0 8px 25px rgba(53,65,100,.08);
}

.quiz-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
}

.quiz p {
  color: #68728b;
  margin-bottom: 18px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.answer {
  background: #f5f7fc;
  padding: 13px;
  border-radius: 13px;
  font-size: 18px;
  color: #43506d;
  transition: .2s;
}

.answer:hover {
  background: #e9edff;
  transform: translateY(-2px);
}

.answer.correct {
  background: #c9f4d8;
  color: #16713a;
}

.answer.wrong {
  background: #ffd4d0;
  color: #a53b31;
}

.score-box {
  text-align: center;
  margin-top: 20px;
  color: #727d95;
}

.score-box strong {
  color: #536ee8;
  font-size: 22px;
}

/* ALL LETTERS */

.all-letters {
  text-align: center;
}

.all-letters h2 {
  font-size: 28px;
}

.all-letters p {
  color: #8991a4;
  margin-bottom: 20px;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
}

.letter-item {
  aspect-ratio: 1;
  background: white;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 27px;
  font-weight: 600;
  color: #53617d;
  box-shadow: 0 4px 12px rgba(40,50,90,.06);
  transition: .2s;
}

.letter-item:hover {
  transform: translateY(-3px) rotate(-3deg);
  background: #ffcf33;
  color: #513c00;
}

.letter-item.active {
  background: #ff7062;
  color: white;
}

/* FOOTER */

footer {
  text-align: center;
  margin-top: 45px;
  color: #9ba2b2;
}

/* MOBILE */

@media (max-width: 700px) {

  .app {
    padding: 18px 14px 40px;
  }

  .header h1 {
    font-size: 25px;
  }

  .logo {
    width: 55px;
    height: 55px;
    font-size: 34px;
  }

  .flashcard {
    height: 380px;
  }

  .thai-letter {
    font-size: 145px;
  }

  .word {
    font-size: 55px;
  }

  .controls {
    flex-wrap: wrap;
  }

  .letter-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .letter-item {
    font-size: 23px;
  }
}

@media (max-width: 420px) {

  .flashcard {
    height: 350px;
  }

  .thai-letter {
    font-size: 125px;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .letter-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}