/* Kidswalla Maths — shared theme (home, grade hubs, games) */
:root {
  --kw-pink: #ff6b9d;
  --kw-yellow: #ffd93d;
  --kw-green: #6bcb77;
  --kw-teal: #4ecdc4;
  --kw-purple: #a29bfe;
  --kw-orange: #ff8c42;
  --kw-cream: #fffef7;
  --kw-dark: #2d3436;
  --kw-shadow: rgba(0, 0, 0, 0.22);
}

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

html {
  scroll-behavior: smooth;
  max-width: 100vw;
}

body {
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  font-family: "Nunito", "Segoe UI Emoji", system-ui, sans-serif;
  color: var(--kw-dark);
}

h1,
h2,
h3,
.category-label,
.kw-card__title,
.kw-section-label span,
.kw-badge,
.hub-game-card__title,
.question-badge {
  font-family: "Fredoka One", cursive;
}

body.kw-home {
  background: linear-gradient(145deg, #6d28d9 0%, #a78bfa 22%, #fcd34d 48%, #14b8a6 100%);
  padding: 2rem 1.25rem 3rem;
  position: relative;
}

body.kw-hub {
  background: linear-gradient(165deg, #7c3aed 0%, #f59e0b 38%, #06b6d4 55%, #0891b2 100%);
  padding: 1.5rem 1rem 3rem;
}

body.page-game {
  background: linear-gradient(145deg, #6d28d9 0%, #a78bfa 22%, #fcd34d 48%, #14b8a6 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 0.65rem 1rem 1.25rem;
  position: relative;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  z-index: 9999;
  font-weight: 700;
}
.skip-link:focus {
  left: 0.5rem;
}

/* Fixed sound preference (placeholder — no audio yet) */
.kw-sound-toggle {
  position: fixed;
  top: max(0.5rem, env(safe-area-inset-top, 0px));
  right: max(0.5rem, env(safe-area-inset-right, 0px));
  z-index: 10002;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}

.kw-sound-toggle:hover {
  transform: scale(1.05);
}

.kw-sound-toggle:active {
  transform: scale(0.97);
}

.kw-sound-toggle:focus-visible {
  outline: 3px solid #fcd34d;
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.kw-bubble,
.kw-star {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  animation: kwFloat 10s ease-in-out infinite alternate;
}

.kw-bubble {
  background: radial-gradient(circle, rgba(255, 255, 210, 0.35), rgba(255, 215, 130, 0.12));
}

.kw-star {
  background: radial-gradient(circle, #fff9c4, #ffe082);
}

@keyframes kwFloat {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(12px, -28px) rotate(6deg);
  }
}

.kw-wrap {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.kw-brand {
  background: #ffffff;
  border-radius: 56px;
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.kw-brand h1 {
  font-size: clamp(1.75rem, 5vw, 3.1rem);
  font-weight: 400;
  color: #d45f00;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.15;
}

.kw-tagline {
  margin-top: 0.75rem;
  display: inline-block;
  background: #fff3cf;
  color: #2c4b3e;
  font-weight: 600;
  padding: 0.45rem 1.35rem;
  border-radius: 999px;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.kw-desc {
  max-width: 640px;
  margin: 1rem auto 0;
  background: rgba(238, 243, 230, 0.85);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.98rem;
  color: #2d3e36;
}

.kw-badge {
  display: inline-block;
  background: #ffd966;
  color: #2f2a1f;
  font-weight: 800;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  padding: 0.45rem 1.5rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
  box-shadow: 0 5px 0 #b47c2e;
}

.kw-section-label {
  text-align: center;
  margin: 2rem 0 1rem;
}

.kw-section-label span {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  color: #fff8dc;
  padding: 0.35rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
  gap: 1.35rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.kw-card {
  background: #ffffff;
  border-radius: 36px;
  padding: 1.25rem 0.85rem 1.35rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: block;
  cursor: pointer;
  border: none;
  font: inherit;
  min-height: 200px;
}

.kw-card:hover:not(.kw-card--soon) {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  animation: kwWiggle 0.5s ease-in-out;
}

.kw-card:active:not(.kw-card--soon) {
  transform: translateY(-2px);
}

.kw-card--soon {
  opacity: 0.72;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.kw-card__emoji {
  font-size: 3.2rem;
  width: 76px;
  height: 76px;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fce9c4;
  border-radius: 50%;
  box-shadow: inset 0 -3px 0 #cb9e62, 0 8px 14px rgba(0, 0, 0, 0.1);
}

.kw-card__title {
  font-size: 1.55rem;
  font-weight: 400;
  color: #d45f00;
  margin-bottom: 0.35rem;
}

.kw-card__desc {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b5a3e;
  background: #fbefcf;
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
}

.kw-card__hint {
  margin-top: 0.65rem;
  font-size: 1.35rem;
  opacity: 0.75;
}

.kw-pill-soon {
  margin-top: 0.5rem;
  display: inline-block;
  background: #e0e0e0;
  color: #555;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
}

.kw-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
  background: rgba(255, 255, 225, 0.72);
  border-radius: 48px;
  padding: 1.2rem 1rem;
}

.kw-features span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  color: #1a4e3f;
  font-size: 0.95rem;
}

.kw-footer {
  text-align: center;
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: rgba(255, 251, 220, 0.92);
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.kw-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  color: #fff8dc;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}
.kw-back:hover {
  text-decoration: underline;
}

.page-game-stack {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kw-game-seo-head {
  background: #ffffff;
  border-radius: clamp(20px, 4vw, 32px);
  padding: 0.75rem 1rem 0.85rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.quiz-container {
  background: #ffffff;
  backdrop-filter: none;
  border-radius: clamp(36px, 8vw, 72px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  padding: 0.75rem 1rem 1rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.kw-game-h1 {
  font-family: "Fredoka One", cursive;
  font-size: clamp(1.15rem, 4.2vw, 1.65rem);
  font-weight: 400;
  color: #1f3a6b;
  line-height: 1.25;
}

.kw-game-crumb {
  margin: 0.4rem 0 0.65rem;
}

.kw-game-crumb a {
  color: #1565a8;
  font-weight: 700;
}

.kw-game-h2 {
  font-family: "Fredoka One", cursive;
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  font-weight: 400;
  color: #6b21a8;
  margin: 0;
}

.kw-game-learn {
  margin: 0.35rem 0 0;
  font-weight: 600;
  font-size: 0.93rem;
  color: #374151;
  line-height: 1.4;
}

.kw-related-games {
  background: #ffffff;
  border-radius: clamp(20px, 4vw, 32px);
  padding: 1rem 1rem 1.15rem;
  text-align: center;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.5rem;
}

.kw-related-games ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.kw-related-games li a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  color: #1f3a6b;
  text-decoration: none;
  border: 2px solid #f4c542;
  box-shadow: 0 4px 0 #cb8b42;
  font-size: 0.92rem;
  min-height: 56px;
}

.kw-related-games li a:hover {
  transform: translateY(-2px);
}

.kw-stars-bar {
  text-align: center;
  margin: 0 auto 1rem;
  max-width: 420px;
  background: #ffffff;
  color: #28341c;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.2rem);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: none;
}

.kw-section-label span {
  letter-spacing: 0.02em;
}

.kw-hero-mascot-wrap {
  display: flex;
  justify-content: center;
  margin: 0.5rem auto 1rem;
  max-width: min(100%, 440px);
}

.kw-hero-mascot {
  width: min(100%, 360px);
  height: auto;
  display: block;
  animation: kwMascotBounce 2s ease-in-out infinite;
}

@keyframes kwMascotBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

.kw-continue-banner {
  text-align: center;
  margin-top: 1.25rem;
}

.kw-btn-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.2rem);
  text-decoration: none;
  background: linear-gradient(145deg, #f472b6, #c084fc);
  color: #fff;
  box-shadow: 0 8px 0 #7c3aed;
  border: none;
}

.kw-btn-continue:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #7c3aed;
}

@keyframes kwWiggle {
  0%,
  100% {
    transform: rotate(-1deg) translateY(0);
  }
  25% {
    transform: rotate(1.5deg) translateY(-3px);
  }
  75% {
    transform: rotate(-1.5deg) translateY(-5px);
  }
}



.top-bar-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.home-icon.home-icon--hub {
  background: #61b15a;
  box-shadow: 0 5px 0 #2e6b2a;
}

.home-icon.home-icon--hub:active {
  box-shadow: 0 2px 0 #2e6b2a;
}

.kidswalla-celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 26, 63, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.kidswalla-celebrate-overlay[hidden] {
  display: none !important;
}

.kidswalla-celebrate-overlay__card {
  background: #ffffff;
  border-radius: 32px;
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  max-width: min(100%, 400px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 4px solid #f4c542;
}

.kidswalla-celebrate-overlay__title {
  font-family: "Fredoka One", cursive;
  font-size: clamp(1.85rem, 6vw, 2.5rem);
  font-weight: 400;
  color: #d45f00;
  margin: 0;
}

.kidswalla-celebrate-overlay__score {
  margin: 0.75rem 0 1rem;
  font-weight: 700;
  color: #374151;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
}

.kidswalla-celebrate-overlay__btn {
  font: inherit;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #a78bfa, #f59e0b, #4ade80);
  color: #1f2937;
  box-shadow: 0 8px 0 #d45f00;
}

.kidswalla-celebrate-overlay__btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2e6b2a;
}

.soon-notify {
  margin-top: 1.25rem;
  text-align: left;
}
.soon-notify label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1f3a6b;
  margin-bottom: 0.35rem;
}
.soon-notify input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  font: inherit;
  margin-bottom: 0.6rem;
}
.soon-notify button {
  width: 100%;
  font: inherit;
  font-weight: 800;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: none;
  background: #7c3aed;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 #5b21b6;
}
.soon-notify button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5b21b6;
}

/* Game shell */
#game-root {
  width: 100%;
  max-width: 680px;
  position: relative;
  z-index: 2;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.top-bar a.home-icon,
.home-icon {
  font-size: 1.6rem;
  background: #ff9e5e;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 5px 0 #b4622a;
  transition: transform 0.12s ease;
}
.top-bar a.home-icon:active,
.home-icon:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b4622a;
}

.score-area {
  background: linear-gradient(180deg, #fb923c 0%, #f97316 100%);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  font-size: clamp(1rem, 3.5vw, 1.45rem);
  box-shadow: 0 4px 0 rgba(194, 65, 12, 0.55);
}
.score-area span {
  color: #fffbeb;
  margin-left: 0.35rem;
  font-size: 1.15em;
}

.question-badge {
  background: #f4c542;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-weight: 400;
  font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  color: #2d2b1f;
  margin-bottom: 0.35rem;
  box-shadow: 0 5px 0 #b16224;
}

.question-text {
  font-size: clamp(1.8rem, 8.4vw, 4.32rem);
  font-weight: 800;
  color: #1f3a6b;
  background: #fff7e8;
  border: 2px solid #ffd966;
  display: inline-block;
  padding: 0.78rem 1.32rem;
  border-radius: 28px;
  margin: 0.25rem 0 0.4rem;
  box-shadow: 0 8px 0 #c7b28b;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

/* Multiple-choice prompts: bigger emoji / symbols (especially on desktop) */
.question-text.kw-q-mc {
  font-size: clamp(1.8rem, 9.6vw, 5.1rem);
  line-height: 1.28;
  letter-spacing: 0.02em;
}

.question-text.kw-q-arith {
  font-size: clamp(1.8rem, 9vw, 4.8rem);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .question-text.kw-q-mc {
    font-size: clamp(3.6rem, 5.04vw, 6rem);
    padding: 1.2rem 1.8rem;
  }
  .question-text.kw-q-arith {
    font-size: clamp(3.3rem, 4.56vw, 5.1rem);
  }
  .kw-choice-btn--emoji {
    font-size: clamp(3.25rem, 4vw, 5.25rem);
    min-height: 5.25rem;
    padding: 1rem 0.5rem;
  }
  .kw-choice-btn--cluster {
    font-size: clamp(1.85rem, 2.5vw, 2.65rem);
    min-height: 4.25rem;
  }
  .feedback {
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    min-height: 3.25rem;
  }
  .next-hint {
    font-size: 1.05rem;
  }
}

.answer-area {
  margin-top: 0.35rem;
}

.answer-input {
  width: min(100%, 280px);
  padding: 0.85rem 1rem;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 800;
  text-align: center;
  border-radius: 999px;
  border: 4px solid #ffbc6e;
  background: #fef5e0;
  outline: none;
  font-family: inherit;
}

.answer-input:focus {
  border-color: #ff9626;
  background: #fff;
}

/* Text + numeric input avoids spinner UI that can look like a "broken" emoji on some devices */
.answer-input.kw-answer-text {
  appearance: textfield;
  -moz-appearance: textfield;
}
.answer-input.kw-answer-text::-webkit-outer-spin-button,
.answer-input.kw-answer-text::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.kw-choice-btn--emoji {
  font-size: clamp(2rem, 10vw, 3.25rem);
  line-height: 1.15;
  padding: 0.75rem 0.35rem;
  min-height: max(60px, 4rem);
}

.kw-choice-btn--cluster {
  font-size: clamp(1.2rem, 4.5vw, 1.85rem);
  line-height: 1.2;
  min-height: max(60px, 3.8rem);
}

.check-btn {
  margin-top: 0.75rem;
  background: #61b15a;
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: clamp(1.1rem, 4vw, 1.65rem);
  padding: 0.6rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 7px 0 #2e6b2a;
  font-family: inherit;
  min-height: 56px;
}

@keyframes kwArithFlashCorrect {
  0%,
  100% {
    background-color: #61b15a;
  }
  25%,
  75% {
    background-color: #4caf50;
  }
}

@keyframes kwArithFlashWrong {
  0%,
  100% {
    background-color: #61b15a;
  }
  25%,
  75% {
    background-color: #f44336;
  }
}

.check-btn.kw-arith-flash-correct {
  animation: kwArithFlashCorrect 0.6s ease forwards;
}

.check-btn.kw-arith-flash-wrong {
  animation: kwArithFlashWrong 0.6s ease forwards;
}
.check-btn:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #2e6b2a;
}
.check-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback.kw-feedback-below-prompt {
  margin: 0.2rem auto 0.6rem;
}

.kw-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0.05rem auto 0;
  max-width: 420px;
  position: relative;
}

/* Three options: one full-width column so every choice has the same width */
.kw-choices.kw-choices--opts-3 {
  grid-template-columns: 1fr;
}

.kw-choice-btn {
  --kw-btn-face: #ffffff;
  font-family: inherit;
  font-size: clamp(1.35rem, 4.5vw, 1.9rem);
  font-weight: 800;
  padding: 0.75rem 0.5rem;
  border-radius: 20px;
  border: 3px solid #ffbc6e;
  background: var(--kw-btn-face);
  color: #1a1a1a;
  cursor: pointer;
  box-shadow: 0 6px 0 #cb8b42;
  transition: transform 0.1s ease;
  min-height: max(60px, 3.2rem);
  position: relative;
  overflow: visible;
}

.kw-choices .kw-choice-btn:nth-child(1) {
  --kw-btn-face: #e0f0ff;
  background: #e0f0ff;
}
.kw-choices .kw-choice-btn:nth-child(2) {
  --kw-btn-face: #e0f9e0;
  background: #e0f9e0;
}
.kw-choices .kw-choice-btn:nth-child(3) {
  --kw-btn-face: #fff9e0;
  background: #fff9e0;
}
.kw-choices .kw-choice-btn:nth-child(4) {
  --kw-btn-face: #ffe0f0;
  background: #ffe0f0;
}

@keyframes kwMcFlashCorrect {
  0%,
  100% {
    background-color: var(--kw-btn-face);
  }
  20%,
  80% {
    background-color: #4caf50;
    color: #fff;
  }
}

@keyframes kwMcFlashWrong {
  0%,
  100% {
    background-color: var(--kw-btn-face);
    color: #1a1a1a;
  }
  20%,
  80% {
    background-color: #f44336;
    color: #fff;
  }
}

.kw-choice-btn.kw-mc-flash-correct {
  animation: kwMcFlashCorrect 0.6s ease forwards;
}

.kw-choice-btn.kw-mc-flash-wrong {
  animation: kwMcFlashWrong 0.6s ease forwards;
}

.kw-choice-burst {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -0.5rem);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1;
  pointer-events: none;
  z-index: 3;
  animation: kwEmojiBurstPop 0.55s ease-out forwards;
}

@keyframes kwEmojiBurstPop {
  0% {
    opacity: 1;
    transform: translate(-50%, -0.5rem) scale(0.4);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, -2.25rem) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -3.5rem) scale(1);
  }
}

.kw-choice-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #cb8b42;
}
.kw-choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.feedback {
  margin: 1rem auto 0.35rem;
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.35rem);
  background: #f0e7cf;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
}

.kw-feedback-main {
  border-radius: 22px;
  min-height: 3.25rem;
  padding: 0.65rem 1rem;
  line-height: 1.35;
  max-width: 100%;
}

.next-hint {
  margin-top: 0.5rem;
  display: inline-block;
  background: #fed287;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
}

.reset-btn {
  margin-top: 0.85rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 420px;
  display: block;
  background: #ffa047;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 5px 0 #a55317;
  font-size: 1rem;
  min-height: 56px;
}
.reset-btn[hidden] {
  display: none !important;
}
.reset-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a55317;
}

@keyframes bouncePop {
  0% {
    transform: scale(0.88);
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}
.correct-pop {
  animation: bouncePop 0.35s ease;
}
@keyframes shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.wrong-shake {
  animation: shake 0.28s ease-in-out 2;
}


.hub-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.hub-game-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 0.9rem 0.65rem 1rem;
  text-decoration: none;
  color: inherit;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease;
  border: none;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hub-game-card:hover {
  animation: kwWiggle 0.48s ease-in-out;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.26);
}

.hub-game-card__emoji {
  font-size: 2rem;
  line-height: 1.2;
}
.hub-game-card__title {
  font-family: "Fredoka One", cursive;
  font-weight: 400;
  font-size: 0.95rem;
  margin-top: 0.35rem;
  color: #1f3a6b;
}

@media (max-width: 520px) {
  .kw-choices {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 768px) {
  body.page-game {
    padding: 0.45rem 0.75rem 0.75rem;
  }

  .page-game-stack {
    gap: 0.35rem;
  }

  .kw-game-seo-head {
    padding: 0.5rem 0.75rem 0.55rem;
  }

  .quiz-container {
    padding: 0.55rem 0.85rem 0.65rem;
    border-radius: clamp(28px, 6vw, 56px);
  }

  .question-text {
    margin: 0.15rem 0 0.25rem;
    padding: 0.5rem 0.85rem;
  }

  .top-bar {
    margin-bottom: 0.35rem;
    padding: 0.4rem 0.65rem;
  }

  .question-badge {
    margin-bottom: 0.2rem;
    padding: 0.35rem 1rem;
  }

  .answer-area {
    margin-top: 0.2rem;
  }

  .kw-choices {
    gap: 0.4rem;
  }

  .feedback {
    margin-top: 0.45rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.75rem;
  }
}

/* ── PWA install banner (same flow as legacy Kidswalla: beforeinstallprompt + custom bar) ── */
@keyframes kwInstallSlide {
  from {
    transform: translateY(100%);
    opacity: 0.85;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.kw-install-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(0.85rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.85rem, env(safe-area-inset-right, 0px));
  background: linear-gradient(135deg, #ff9e5e 0%, #f4c542 45%, #ffb36b 100%);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.28);
  font-family: inherit;
  border-top: 3px solid rgba(255, 255, 255, 0.55);
  animation: kwInstallSlide 0.42s ease;
}

.kw-install-banner.kw-install-banner--visible {
  display: flex;
}

.kw-install-banner__emoji {
  font-size: 1.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.kw-install-banner__text {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.kw-install-banner__title {
  font-weight: 800;
  font-size: clamp(0.95rem, 3.2vw, 1.08rem);
  color: #2d1f0f;
  line-height: 1.25;
  margin: 0;
}

.kw-install-banner__sub {
  font-weight: 700;
  font-size: clamp(0.78rem, 2.6vw, 0.88rem);
  color: rgba(45, 31, 15, 0.85);
  line-height: 1.3;
  margin: 0.15rem 0 0;
}

.kw-install-banner__install {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: #fffef8;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 800;
  font-size: clamp(0.88rem, 2.8vw, 1rem);
  color: #1f3a6b;
  cursor: pointer;
  box-shadow: 0 5px 0 #c7b28b, 0 8px 16px rgba(30, 43, 110, 0.2);
  font-family: inherit;
  touch-action: manipulation;
  white-space: nowrap;
}

.kw-install-banner__install:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #c7b28b;
}

.kw-install-banner__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: rgba(30, 43, 110, 0.18);
  color: #1f3a6b;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
  touch-action: manipulation;
}

.kw-install-banner__close:active {
  transform: scale(0.95);
}
