/* Riya's learning games — shared styles */
:root {
  --pink: #FFC8DD;
  --lavender: #CDB4DB;
  --sky: #BDE0FE;
  --mint: #B9FBC0;
  --lemon: #FDFFB6;
  --peach: #FFD6A5;
  --coral: #FF6B8B;
  --violet: #8E7DFF;
  --teal: #2EC4B6;
  --sunshine: #FFC93C;
  --plum: #3D2C5E;
  --plum-soft: rgba(61, 44, 94, 0.72);
  --white: #FFFFFF;
  --shadow: 0 8px 24px rgba(61, 44, 94, 0.18);
  --shadow-soft: 0 4px 14px rgba(61, 44, 94, 0.12);
  --radius: 28px;
  --tap-min: 56px;
  --bar-h: 56px;
  --font: "Nunito", "Fredoka", "Comic Sans MS", "Chalkboard SE", "Segoe UI Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-h: 100vh;
  --app-h: 100dvh;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: var(--app-h);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--plum);
  background: linear-gradient(180deg, #A8D8FF 0%, #E8F4FF 42%, #FFF6E8 100%);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
/* Home is the only page allowed to scroll vertically */
html.page-home, body.page-home {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: var(--app-h);
}
body.page-home .app {
  height: auto;
  min-height: var(--app-h);
  overflow: visible;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  color: inherit;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

img, svg { display: block; max-width: 100%; pointer-events: none; }

.app {
  position: relative;
  height: var(--app-h);
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.cloud {
  position: absolute;
  opacity: 0.85;
  animation: drift 48s linear infinite;
}
.cloud:nth-child(1) { top: 8%; left: -10%; width: 140px; animation-duration: 55s; }
.cloud:nth-child(2) { top: 22%; left: 40%; width: 110px; animation-duration: 70s; animation-delay: -20s; }
.cloud:nth-child(3) { top: 55%; left: 70%; width: 160px; animation-duration: 62s; animation-delay: -35s; }
.cloud:nth-child(4) { top: 70%; left: 10%; width: 100px; animation-duration: 80s; animation-delay: -10s; }

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(40vw); }
}

/* Top bar — fixed height, baseline aligned */
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: calc(var(--bar-h) + var(--safe-top));
  min-height: calc(var(--bar-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  flex-shrink: 0;
  width: 100%;
}
.topbar-btn {
  width: var(--bar-h);
  height: var(--bar-h);
  min-width: var(--bar-h);
  min-height: var(--bar-h);
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
  border: 3px solid rgba(61, 44, 94, 0.12);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.topbar-btn:active { transform: scale(0.92); }
.topbar-btn svg { width: 30px; height: 30px; }
.topbar-btn.listening {
  box-shadow: 0 0 0 4px rgba(142, 125, 255, 0.35), var(--shadow-soft);
}
.star-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border-radius: 999px;
  padding: 0 16px 0 8px;
  box-shadow: var(--shadow-soft);
  border: 3px solid rgba(61, 44, 94, 0.1);
  font-weight: 800;
  font-size: clamp(18px, 4.5vw, 26px);
  height: var(--bar-h);
  min-height: var(--bar-h);
}
.star-pill .star-icon { width: 32px; height: 32px; flex-shrink: 0; }
#star-count { min-width: 1.5ch; text-align: center; }
.topbar-spacer { width: var(--bar-h); min-width: var(--bar-h); flex-shrink: 0; }

/* Start overlay */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: linear-gradient(180deg, rgba(168, 216, 255, 0.96), rgba(255, 246, 232, 0.98));
  transition: opacity 0.3s ease;
}
.start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}
.start-play {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--coral), #FF8FAB);
  box-shadow: 0 12px 32px rgba(255, 107, 139, 0.45), inset 0 -6px 0 rgba(0,0,0,0.08);
  display: grid;
  place-items: center;
  animation: pulse-play 1.6s ease-in-out infinite;
  border: 6px solid rgba(255,255,255,0.7);
}
.start-play svg { width: 48%; height: 48%; margin-left: 8%; }
.start-label {
  font-size: clamp(22px, 6vw, 36px);
  font-weight: 800;
  color: var(--plum);
}
@keyframes pulse-play {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Home */
.home-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 14px calc(20px + var(--safe-bottom));
  gap: clamp(10px, 2.5vh, 22px);
  min-height: 0;
  width: 100%;
  overflow: visible;
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  flex-shrink: 0;
}
.mascot {
  width: clamp(88px, 22vw, 160px);
  height: clamp(88px, 22vw, 160px);
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 9vw, 64px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--plum);
  text-shadow: 0 3px 0 rgba(255,255,255,0.6);
}
.hero p {
  margin: 0;
  font-size: clamp(15px, 3.8vw, 22px);
  font-weight: 700;
  color: var(--plum-soft);
}

/* Home game grid: tile size from available width; centred; auto-fit collapses empty cols */
.game-grid,
.game-grid--scroll {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: min(100%, calc(2 * 190px + 14px));
  min-height: 0;
  padding: 4px 0 12px;
  justify-content: center;
  justify-items: stretch;
  margin-inline: auto;
}
@media (min-width: 600px) {
  .game-grid,
  .game-grid--scroll {
    grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
    gap: 16px;
    max-width: min(100%, calc(3 * 240px + 2 * 16px));
  }
}
@media (min-width: 900px) {
  .game-grid,
  .game-grid--scroll {
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    gap: 16px;
    max-width: min(100%, calc(5 * 260px + 4 * 16px));
  }
}
.game-tile {
  position: relative;
  border-radius: var(--radius);
  width: 100%;
  max-width: none;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow);
  border: 4px solid rgba(255,255,255,0.65);
  padding: 10px;
  transition: transform 0.18s ease;
  overflow: hidden;
}
.game-tile:active { transform: scale(0.96); }
.game-tile .tile-art {
  width: 68%;
  height: 68%;
}
.game-tile .tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.game-tile .tile-label {
  font-size: clamp(13px, 3.4vw, 20px);
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
}

/* Game screens */
.game-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  padding: 0 10px calc(8px + var(--safe-bottom));
  gap: 6px;
  overflow: hidden;
}

.mode-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  height: var(--bar-h);
  min-height: var(--bar-h);
  width: 100%;
}
.mode-toggle, .replay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--bar-h);
  min-height: var(--bar-h);
  min-width: var(--bar-h);
  padding: 0 16px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  border: 3px solid rgba(61, 44, 94, 0.1);
  font-weight: 800;
  font-size: clamp(14px, 3.5vw, 17px);
  flex-shrink: 0;
}
.mode-toggle.active {
  background: linear-gradient(145deg, var(--violet), #A78BFA);
  color: white;
  border-color: transparent;
}
.mode-toggle svg, .replay-btn svg { width: 26px; height: 26px; flex-shrink: 0; }
.replay-btn {
  background: linear-gradient(145deg, var(--sunshine), #FFB703);
  border-color: rgba(255,255,255,0.5);
}
.replay-btn.hidden { display: none; }

/* Animal explore grid */
.animal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(6px, 1.2vw, 12px);
  min-height: 0;
  width: 100%;
  max-width: min(100%, 980px);
  margin: 0 auto;
  height: 100%;
  align-content: stretch;
}
.animal-grid.quiz-mode {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2.5vw, 18px);
  max-width: 100%;
  padding: 4px;
  overflow: hidden;
}
.animal-grid.quiz-mode .animal-card {
  flex: 0 0 auto;
  /* size set by JS from available area */
}

.animal-card {
  position: relative;
  border-radius: clamp(14px, 3vw, 22px);
  box-shadow: var(--shadow-soft);
  /* Thin coloured rim = card background peeking around the photo */
  border: none;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}
.animal-card:active { transform: scale(0.94); }
.animal-card img.animal-photo {
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  max-width: none;
  object-fit: cover;
  border-radius: clamp(10px, 2.2vw, 16px);
  display: block;
  pointer-events: none;
}
.animal-card.wiggle { animation: wiggle 0.45s ease; }
.animal-card.correct { animation: jump-glow 0.7s ease; box-shadow: 0 0 0 6px rgba(126, 217, 87, 0.55), var(--shadow); }
.animal-card.hint { animation: hint-pulse 1.2s ease-in-out infinite; }
.animal-card.wrong-wobble { animation: soft-wobble 0.5s ease; }

html.kid-busy .animal-card,
html.kid-busy .bubble {
  filter: saturate(0.72) brightness(0.96);
}
html.kid-busy .bubble:active,
html.kid-busy .animal-card:active {
  animation: soft-wobble 0.35s ease;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg) scale(1.04); }
  75% { transform: rotate(8deg) scale(1.04); }
}
@keyframes jump-glow {
  0% { transform: scale(1); }
  40% { transform: scale(1.08) translateY(-6px); }
  100% { transform: scale(1); }
}
@keyframes soft-wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 201, 60, 0.5), var(--shadow-soft); }
  50% { box-shadow: 0 0 0 10px rgba(255, 201, 60, 0.35), var(--shadow); }
}

.note-particle {
  position: absolute;
  pointer-events: none;
  font-size: 22px;
  font-weight: 900;
  color: var(--violet);
  animation: note-float 0.9s ease-out forwards;
  z-index: 5;
}
@keyframes note-float {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), -60px) scale(1.3); }
}

/* Letters */
.bubble-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
  touch-action: none;
}
.bubble {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--plum);
  cursor: pointer;
  box-shadow: inset -8px -10px 18px rgba(255,255,255,0.55), inset 6px 8px 16px rgba(61,44,94,0.12), 0 8px 20px rgba(61,44,94,0.15);
  border: 3px solid rgba(255,255,255,0.55);
  will-change: transform;
  touch-action: manipulation;
  max-width: 42vw;
  max-height: 42vw;
}
.bubble::before {
  content: "";
  position: absolute;
  top: 14%;
  left: 18%;
  width: 28%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255,255,255,0.65);
  transform: rotate(-25deg);
  pointer-events: none;
}
.bubble .bubble-letter {
  font-size: inherit;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(255,255,255,0.4);
}
.bubble.popping { animation: bubble-pop 0.35s ease-out forwards; pointer-events: none; }
.bubble.wobble { animation: soft-wobble 0.45s ease; }
.bubble.hint {
  box-shadow: 0 0 0 8px rgba(255, 201, 60, 0.55), inset -8px -10px 18px rgba(255,255,255,0.55), 0 8px 20px rgba(61,44,94,0.15);
}
@keyframes bubble-pop {
  0% { transform: scale(1); opacity: 1; }
  60% { transform: scale(1.35); opacity: 0.7; }
  100% { transform: scale(0); opacity: 0; }
}

.letter-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 30;
  background: var(--white);
  border-radius: 28px;
  padding: clamp(14px, 3vw, 24px);
  box-shadow: var(--shadow);
  border: 4px solid rgba(61, 44, 94, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(80vw, 280px);
}
.letter-reveal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.letter-reveal .big-letter {
  font-size: clamp(48px, 14vw, 80px);
  font-weight: 900;
  line-height: 1;
  color: var(--coral);
}
.letter-reveal .word-art {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  border-radius: 18px;
  overflow: hidden;
}
.letter-reveal .word-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.letter-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}

/* Colours game */
.colour-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 4px;
}
.colour-stage.explore-mode {
  flex-direction: row;
  flex-wrap: wrap;
  align-content: center;
}
.colour-blob {
  position: relative;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
  filter: drop-shadow(0 6px 12px rgba(61, 44, 94, 0.18));
}
.colour-blob:active { transform: scale(0.94); }
.colour-blob.squish { animation: colour-squish 0.35s ease; }
.colour-blob.wobble { animation: soft-wobble 0.45s ease; }
.colour-blob.correct { animation: jump-glow 0.7s ease; }
.colour-blob.hint {
  filter: drop-shadow(0 0 0 rgba(255, 201, 60, 0.9)) drop-shadow(0 0 12px rgba(255, 201, 60, 0.85));
}
.colour-blob-svg { display: block; width: 100%; height: 100%; pointer-events: none; }
@keyframes colour-squish {
  0% { transform: scale(1); }
  40% { transform: scale(1.12, 0.88); }
  70% { transform: scale(0.94, 1.08); }
  100% { transform: scale(1); }
}
.colour-prompt {
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 4px solid rgba(255,255,255,0.75);
  flex-shrink: 0;
  background: var(--white);
  /* Hard caps so a late/failed layout never lets the photo cover blobs */
  width: min(88vw, 48vh, 280px);
  height: min(88vw, 48vh, 280px);
  max-width: min(88vw, 280px);
  max-height: min(50vh, 280px);
  position: relative;
}
.colour-prompt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
  /* Never contribute intrinsic size to layout */
  max-width: 100%;
  max-height: 100%;
}
.colour-prompt.loaded img {
  opacity: 1;
}
.colour-choice-row {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  align-items: center;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}
/* "What colour?" — photo + blobs share the stage without overlap */
.colour-stage.quiz-mode.what-mode {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
}
@media (orientation: landscape) {
  .colour-stage.quiz-mode.what-mode {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
  }
  .colour-stage.quiz-mode.what-mode .colour-prompt {
    width: min(42vh, 36vw, 220px);
    height: min(42vh, 36vw, 220px);
    max-width: min(36vw, 220px);
    max-height: min(42vh, 220px);
  }
  .colour-stage.quiz-mode.what-mode .colour-choice-row {
    width: auto;
    flex: 1 1 0;
    max-width: calc(100% - min(42vh, 36vw, 220px) - 20px);
  }
}
.colour-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 30;
  background: var(--white);
  border-radius: 28px;
  padding: clamp(14px, 3vw, 24px);
  box-shadow: var(--shadow);
  border: 4px solid rgba(61, 44, 94, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(80vw, 280px);
}
.colour-reveal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.colour-reveal .colour-swatch {
  width: clamp(36px, 10vw, 52px);
  height: clamp(36px, 10vw, 52px);
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.08);
}
.colour-reveal .word-art {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  border-radius: 18px;
  overflow: hidden;
}
.colour-reveal .word-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.colour-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .colour-blob {
  filter: saturate(0.72) brightness(0.96) drop-shadow(0 6px 12px rgba(61, 44, 94, 0.18));
}

/* Mode bar with more buttons (Shapes) — must fit 4 buttons at 360px */
.mode-bar--shapes {
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  box-sizing: border-box;
}
.mode-bar--shapes .mode-toggle,
.mode-bar--shapes .replay-btn {
  padding: 0 10px;
  font-size: clamp(12px, 2.8vw, 15px);
  gap: 4px;
  flex: 0 0 auto;
}
.mode-bar--shapes .mode-toggle span,
.mode-bar--shapes .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--shapes {
    gap: 5px;
  }
  .mode-bar--shapes .mode-toggle,
  .mode-bar--shapes .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--shapes .mode-toggle span,
  .mode-bar--shapes .replay-btn span {
    display: none;
  }
  .mode-bar--shapes .mode-toggle svg,
  .mode-bar--shapes .replay-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* Shapes stage */
.shape-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}
.shape-card {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 14px rgba(61, 44, 94, 0.18));
  transition: transform 0.15s ease;
}
.shape-card:active { transform: scale(0.94); }
.shape-card.bounce { animation: shape-bounce 0.5s ease; }
.shape-card.wobble { animation: soft-wobble 0.45s ease; }
.shape-card.correct { animation: jump-glow 0.7s ease; }
.shape-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
  border-radius: 18px;
}
.shape-svg { display: block; width: 100%; height: 100%; pointer-events: none; }
@keyframes shape-bounce {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.12) rotate(-8deg); }
  70% { transform: scale(0.96) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.shape-home {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.55);
  border-radius: 24px;
  border: 3px dashed rgba(61,44,94,0.22);
  box-sizing: border-box;
}
.shape-home .shape-svg {
  width: 100%;
  height: 100%;
}
.shape-home.filled {
  border-style: solid;
  border-color: rgba(126, 217, 87, 0.55);
  background: rgba(185, 251, 192, 0.45);
}
.shape-choice-row {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.shape-stage.outline-mode {
  gap: 12px;
}
@media (orientation: landscape) {
  .shape-stage.outline-mode {
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
  .shape-stage.outline-mode .shape-choice-row {
    width: auto;
    flex: 1 1 0;
  }
}
.shape-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.shape-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.shape-reveal .word-art {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  border-radius: 18px;
  overflow: hidden;
}
.shape-reveal .word-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shape-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .shape-card {
  filter: saturate(0.85) brightness(0.97) drop-shadow(0 6px 12px rgba(61, 44, 94, 0.16));
}

/* Numbers stage */
.num-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}
.num-card {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 14px rgba(61, 44, 94, 0.18));
  transition: transform 0.15s ease;
}
.num-card:active { transform: scale(0.94); }
.num-card.wobble { animation: soft-wobble 0.45s ease; }
.num-card.correct { animation: jump-glow 0.7s ease; }
.num-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
  border-radius: 22px;
}
.num-face {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12), inset 0 3px 0 rgba(255, 255, 255, 0.25);
}
.num-digit {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(28px, 12vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
  user-select: none;
}
.num-obj-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.num-obj {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  flex: 0 0 auto;
  /* Side sized by JS — small counts up to ~280px */
  max-width: none;
  max-height: none;
}
.num-obj:active { transform: scale(0.94); }
.num-obj img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.num-obj.counted {
  box-shadow: 0 0 0 3px #FFC93C, var(--shadow-soft);
}
.num-obj.pop { animation: shape-bounce 0.45s ease; }
.num-obj.wobble { animation: soft-wobble 0.45s ease; }
.num-obj-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #FFC93C;
  color: #3D2C5E;
  font-weight: 900;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(61, 44, 94, 0.25);
}
.num-obj-tick {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #7ED957;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(61, 44, 94, 0.2);
}
.num-choice-row {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
}
.num-choice-row .num-card {
  flex: 0 0 auto;
}
.num-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.num-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.num-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .num-card,
html.kid-busy .num-obj {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--numbers .mode-toggle span,
.mode-bar--numbers .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 420px) {
  .mode-bar--numbers {
    gap: 4px;
  }
  .mode-bar--numbers .mode-toggle,
  .mode-bar--numbers .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--numbers .mode-toggle span,
  .mode-bar--numbers .replay-btn span {
    display: none;
  }
  .mode-bar--numbers .mode-toggle svg,
  .mode-bar--numbers .replay-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* Fruits & Vegetables */
.fv-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}
.fv-card {
  appearance: none;
  border: none;
  background: #fff;
  padding: 0;
  margin: 0;
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(61, 44, 94, 0.16);
  transition: transform 0.15s ease;
}
.fv-card:active { transform: scale(0.94); }
.fv-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.fv-card.bounce { animation: shape-bounce 0.5s ease; }
.fv-card.wobble { animation: soft-wobble 0.45s ease; }
.fv-card.correct { animation: jump-glow 0.7s ease; }
.fv-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.fv-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(61, 44, 94, 0.18);
  pointer-events: none;
}
.fv-tag--fruit { background: #FFC8DD; }
.fv-tag--veg { background: #B9FBC0; }
.fv-sort-item {
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 20px rgba(61, 44, 94, 0.18);
  flex-shrink: 0;
}
.fv-sort-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.fv-basket-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.fv-basket {
  appearance: none;
  border: 3px solid rgba(61, 44, 94, 0.12);
  background: var(--basket-bg, #FFE5EC);
  border-radius: 22px;
  padding: 6px;
  margin: 0;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(61, 44, 94, 0.14);
  transition: transform 0.15s ease;
}
.fv-basket:active { transform: scale(0.94); }
.fv-basket-art {
  width: 82%;
  height: 82%;
  display: block;
  pointer-events: none;
}
.fv-basket-count {
  position: absolute;
  bottom: 8px;
  right: 10px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(61, 44, 94, 0.88);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(61, 44, 94, 0.25);
}
@media (max-width: 430px) {
  .fv-basket-count {
    min-width: 32px;
    height: 32px;
    font-size: 17px;
    bottom: 10px;
    right: 12px;
  }
}
.fv-basket.wiggle { animation: shape-bounce 0.5s ease; }
.fv-basket.wobble { animation: soft-wobble 0.45s ease; }
.fv-basket.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.fv-explore-grid {
  display: grid;
  justify-content: center;
  align-content: center;
  flex: 0 0 auto;
  width: 100%;
}
.fv-explore-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 2px 0 4px;
}
.fv-page-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
  transition: transform 0.12s ease;
}
.fv-page-btn:active:not(:disabled) { transform: scale(0.92); }
.fv-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.fv-page-dots {
  font-weight: 800;
  font-size: 16px;
  color: #3D2C5E;
  min-width: 3.5em;
  text-align: center;
}
.fv-fly {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(61, 44, 94, 0.2);
}
.fv-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.fv-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.fv-reveal .word-art {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  border-radius: 18px;
  overflow: hidden;
}
.fv-reveal .word-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fv-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .fv-card,
html.kid-busy .fv-basket {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--fruits .mode-toggle span,
.mode-bar--fruits .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--fruits {
    gap: 5px;
  }
  .mode-bar--fruits .mode-toggle,
  .mode-bar--fruits .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--fruits .mode-toggle span,
  .mode-bar--fruits .replay-btn span {
    display: none;
  }
  .mode-bar--fruits .mode-toggle svg,
  .mode-bar--fruits .replay-btn svg {
    width: 24px;
    height: 24px;
  }
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}
.fly-star {
  position: fixed;
  z-index: 950;
  width: 40px;
  height: 40px;
  pointer-events: none;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.7s ease;
}
.big-reward {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.big-reward.show { opacity: 1; }
.big-reward .sticker {
  width: min(50vw, 200px);
  height: min(50vw, 200px);
  animation: reward-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes reward-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Landscape phone */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --bar-h: 48px; }
  .hero { flex-direction: row; gap: 10px; }
  .hero h1 { font-size: clamp(24px, 5vw, 34px); }
  .mascot { width: min(16vh, 64px); height: min(16vh, 64px); }
  .home-main {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
  }
  .game-grid,
  .game-grid--scroll {
    grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
    max-width: min(100%, calc(5 * 180px + 4 * 12px));
    gap: 12px;
    width: 100%;
  }
  .animal-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

@media (min-width: 700px) and (orientation: portrait) {
  .animal-grid { max-width: min(100%, 860px); gap: 12px; }
}

@media (min-width: 900px) {
  .animal-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    max-width: min(100%, 1100px);
    gap: 14px;
  }
  .mascot { width: min(16vw, 140px); height: min(16vw, 140px); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .mascot, .start-play { animation: none !important; }
  .animal-card.wiggle,
  .animal-card.correct,
  .animal-card.hint,
  .animal-card.wrong-wobble,
  .bubble.popping,
  .bubble.wobble { animation-duration: 0.01ms !important; }
  .fly-star { transition-duration: 0.2s !important; }
  .big-reward .sticker { animation: none; }
}

/* ---- Body Parts & Feelings ---- */
.body-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
}
.body-stage--fill {
  padding: 2px 4px;
}
.body-figure-wrap {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.body-figure-svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  pointer-events: auto;
  overflow: visible;
}
.body-hit-pad {
  pointer-events: auto;
  cursor: pointer;
  fill: transparent;
}
.body-hit-pad.hint,
.body-hit-pad.hint-glow {
  fill: rgba(255, 201, 60, 0.28);
  stroke: #FFC93C;
  stroke-width: 3;
}
[data-part-art].glow {
  filter: drop-shadow(0 0 6px #FFC93C) drop-shadow(0 0 10px #FF6FB5);
}
[data-part-art].wiggle {
  animation: soft-wobble 0.45s ease;
}
[data-part-art].hint-art {
  filter: drop-shadow(0 0 5px #FFC93C);
}
.body-view-toggle {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  z-index: 5;
}
.body-view-toggle--overlay {
  position: absolute;
  top: 4px;
  right: 6px;
  min-height: 44px;
  gap: 8px;
}
.body-view-toggle--overlay .body-view-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(255,255,255,0.95);
}
.teeth-art {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.teeth-art.show-teeth,
.teeth-art.glow {
  opacity: 1 !important;
}
.body-view-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
}
.body-view-btn svg {
  width: 28px;
  height: 28px;
  pointer-events: none;
}
.body-view-btn.active {
  background: #CDB4DB;
  border-color: rgba(61,44,94,0.25);
}
.feel-card {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 3px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.feel-card:active { transform: scale(0.94); }
.feel-card .feel-face-svg {
  width: 92%;
  height: 92%;
  pointer-events: none;
  display: block;
}
.feel-card.bounce { animation: shape-bounce 0.5s ease; }
.feel-card.wobble { animation: soft-wobble 0.45s ease; }
.feel-card.correct { animation: jump-glow 0.7s ease; }
.feel-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.feel-card.feel-sleepy .feel-face-svg { animation: feel-float 1.2s ease; }
.feel-card.feel-happy .feel-face-svg { animation: shape-bounce 0.55s ease; }
.feel-card.feel-sad .tear { animation: tear-drop 0.8s ease; }
.feel-card.feel-surprised .feel-face-svg { animation: feel-pop 0.45s ease; }
.feel-card.feel-angry .feel-face-svg { animation: soft-wobble 0.4s ease; }
.feel-card.feel-scared .feel-face-svg { animation: soft-wobble 0.5s ease; }
@keyframes feel-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes tear-drop {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(8px); opacity: 0.4; }
}
@keyframes feel-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.body-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.body-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.body-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .feel-card,
html.kid-busy .body-hit-pad {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--body .mode-toggle span,
.mode-bar--body .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--body {
    gap: 5px;
  }
  .mode-bar--body .mode-toggle,
  .mode-bar--body .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--body .mode-toggle span,
  .mode-bar--body .replay-btn span {
    display: none;
  }
  .mode-bar--body .mode-toggle svg,
  .mode-bar--body .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .feel-card.bounce,
  .feel-card.wobble,
  .feel-card.correct,
  [data-part-art].wiggle,
  .feel-card.feel-sleepy .feel-face-svg,
  .feel-card.feel-happy .feel-face-svg,
  .feel-card.feel-surprised .feel-face-svg,
  .feel-card.feel-angry .feel-face-svg,
  .feel-card.feel-scared .feel-face-svg { animation-duration: 0.01ms !important; }
}

/* ---- Piano & Drums ---- */
.music-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.piano-key {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.18);
  border-radius: 14px 14px 10px 10px;
  margin: 0;
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  box-shadow: 0 8px 0 rgba(61,44,94,0.18), 0 10px 18px rgba(61,44,94,0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  color: #fff;
  position: relative;
  overflow: hidden;
  touch-action: none;
}
.piano-key .piano-icon {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.9;
  pointer-events: none;
}
.piano-key .piano-icon svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(61,44,94,0.25));
}
.piano-key .piano-label {
  font-size: clamp(16px, 4.5vw, 26px);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(61,44,94,0.25);
  pointer-events: none;
  letter-spacing: 0.02em;
}
.piano-key.pressed {
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 2px 0 rgba(61,44,94,0.18), 0 4px 10px rgba(61,44,94,0.15);
  filter: brightness(1.08);
}
.piano-key.glow {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
  filter: brightness(1.1) drop-shadow(0 0 10px #FFC93C);
  z-index: 2;
}
.piano-key.bounce-key {
  animation: mus-key-bounce 0.7s ease infinite;
}
@keyframes mus-key-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.mus-note-particle {
  position: absolute;
  font-size: 22px;
  font-weight: 900;
  pointer-events: none;
  z-index: 20;
  animation: mus-float-note 0.7s ease forwards;
  text-shadow: 0 1px 2px rgba(61,44,94,0.3);
}
@keyframes mus-float-note {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-48px) scale(1.3); }
}
.drum-pad {
  appearance: none;
  border: 4px solid rgba(61,44,94,0.15);
  border-radius: 50%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 0 rgba(61,44,94,0.16), 0 12px 20px rgba(61,44,94,0.14);
  position: relative;
  overflow: hidden;
  touch-action: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.drum-pad svg {
  width: 48%;
  height: 48%;
  pointer-events: none;
}
.drum-pad.hit {
  animation: drum-bounce 0.28s ease;
}
@keyframes drum-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(0.88); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.drum-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.85);
  pointer-events: none;
  animation: drum-ring-out 0.45s ease forwards;
}
@keyframes drum-ring-out {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}
.music-progress {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom, 0px));
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.9);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  z-index: 25;
  pointer-events: none;
}
.music-progress.show {
  display: flex;
}
.music-progress .mus-star {
  font-size: 16px;
  color: rgba(61,44,94,0.2);
  line-height: 1;
}
.music-progress .mus-star.filled {
  color: #FFC93C;
}
.mode-bar--music .mode-toggle span,
.mode-bar--music .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--music {
    gap: 5px;
  }
  .mode-bar--music .mode-toggle,
  .mode-bar--music .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--music .mode-toggle span,
  .mode-bar--music .replay-btn span {
    display: none;
  }
  .mode-bar--music .mode-toggle svg,
  .mode-bar--music .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .piano-key.bounce-key,
  .drum-pad.hit,
  .mus-note-particle,
  .drum-ring { animation-duration: 0.01ms !important; }
}

/* ---- Matching Cards ---- */
.match-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
}
.match-card {
  appearance: none;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 800px;
  position: relative;
  border-radius: 16px;
}
.match-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
  border-radius: 16px;
}
.match-card.flipped .match-inner,
.match-card.matched .match-inner {
  transform: rotateY(180deg);
}
.match-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(61,44,94,0.16);
}
.match-face--back {
  background: linear-gradient(145deg, #CDB4DB 0%, #BDE0FE 45%, #FFC8DD 100%);
  border: 3px solid rgba(61,44,94,0.12);
}
.match-face--front {
  background: #fff;
  border: 3px solid rgba(61,44,94,0.1);
  transform: rotateY(180deg);
  padding: 6px;
}
.match-face--front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  pointer-events: none;
  display: block;
}
.match-back-art {
  width: 78%;
  height: 78%;
  pointer-events: none;
}
.match-card.matched .match-face--front {
  outline: 3px solid #FFC93C;
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(255,201,60,0.45), 0 8px 16px rgba(61,44,94,0.16);
}
.match-card.bounce .match-inner {
  animation: match-bounce 0.55s ease;
}
@keyframes match-bounce {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  40% { transform: rotateY(180deg) scale(1.08); }
  70% { transform: rotateY(180deg) scale(0.97); }
}
.match-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFC93C;
  pointer-events: none;
  z-index: 5;
  animation: match-spark 0.65s ease forwards;
}
@keyframes match-spark {
  0% { opacity: 1; transform: scale(0.4) translateY(0); }
  100% { opacity: 0; transform: scale(1.4) translateY(-18px); }
}
.match-levels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.match-level-dot {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: 3px solid rgba(61,44,94,0.12);
  box-shadow: var(--shadow-soft);
  padding: 0;
  cursor: pointer;
}
.match-level-dot.active {
  background: #CDB4DB;
  border-color: rgba(61,44,94,0.28);
  transform: scale(1.12);
}
.match-level-dot.done {
  background: #FFC93C;
}
.match-next {
  position: absolute;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  justify-content: center;
}
.match-next.hidden { display: none; }
.match-next-btn {
  appearance: none;
  border: none;
  background: #FFC93C;
  color: #3D2C5E;
  font-weight: 900;
  font-size: clamp(18px, 4.5vw, 24px);
  padding: 14px 28px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(61,44,94,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.match-next-btn svg {
  width: 28px;
  height: 28px;
}
.mode-bar--match {
  gap: 8px;
}
.mode-bar--match .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--match .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--match .replay-btn span { display: none; }
  .mode-bar--match .replay-btn svg { width: 28px; height: 28px; }
  .match-level-dot {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .match-inner {
    transition: opacity 0.25s ease;
    transform: none !important;
  }
  .match-card.flipped .match-face--back,
  .match-card.matched .match-face--back { opacity: 0; }
  .match-card:not(.flipped):not(.matched) .match-face--front { opacity: 0; }
  .match-card.flipped .match-face--front,
  .match-card.matched .match-face--front {
    opacity: 1;
    transform: none;
  }
  .match-card.bounce .match-inner,
  .match-sparkle { animation-duration: 0.01ms !important; }
}

/* ---- Missing Numbers (train) ---- */
.mn-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 4px 8px;
}
.mn-train {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px;
}
.mn-train--wrap {
  flex-wrap: wrap;
  align-content: center;
}
.mn-engine {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.mn-engine-art {
  width: 100%;
  height: 100%;
  display: block;
}
.mn-wagon {
  flex: 0 0 auto;
  position: relative;
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mn-wagon-body {
  width: 100%;
  height: calc(100% - 10px);
  border-radius: 12px;
  background: var(--wagon, #FF6FB5);
  border: 3px solid rgba(61,44,94,0.12);
  box-shadow: 0 6px 12px rgba(61,44,94,0.14);
  display: grid;
  place-items: center;
}
.mn-wagon-num {
  font-size: clamp(22px, 8vw, 42px);
  font-weight: 900;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
.mn-wagon-wheels {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.mn-wagon-wheels span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3D2C5E;
  box-shadow: inset 0 0 0 3px #FFC93C;
}
.mn-wagon--gap .mn-wagon-body {
  background: repeating-linear-gradient(
    -45deg,
    #fff 0 8px,
    #F3E8FF 8px 16px
  );
  border: 3px dashed #CDB4DB;
  animation: mn-gap-pulse 1.2s ease-in-out infinite;
}
.mn-gap-mark {
  font-size: clamp(26px, 9vw, 48px);
  font-weight: 900;
  color: #8E7DFF;
  line-height: 1;
}
@keyframes mn-gap-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(142,125,255,0.35); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(142,125,255,0); }
}
.mn-wagon.lit .mn-wagon-body {
  outline: 3px solid #FFC93C;
  outline-offset: 2px;
  transform: scale(1.06);
}
.mn-wagon--filled.bounce .mn-wagon-body {
  animation: mn-fill-bounce 0.55s ease;
}
@keyframes mn-fill-bounce {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.12); }
  70% { transform: scale(0.96); }
}
.mn-wagon.hint .mn-wagon-body,
.mn-choice.hint {
  animation: hint-pulse 1.2s ease-in-out infinite;
}
.mn-choice-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.mn-choice {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
  flex: 0 0 auto;
}
.mn-choice .num-face {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(61,44,94,0.16);
}
.mn-choice .num-digit {
  font-size: clamp(36px, 12vw, 64px);
  font-weight: 900;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
.mn-choice.wobble {
  animation: soft-wobble 0.45s ease;
}
.mn-choice.correct .num-face {
  outline: 3px solid #7ED957;
  outline-offset: 2px;
}
.mn-flyer {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
  border-radius: 16px;
}
.mn-chug-in {
  animation: mn-chug-in 0.45s ease-out;
}
.mn-chug-away {
  animation: mn-chug-away 0.7s ease-in forwards;
}
@keyframes mn-chug-in {
  from { transform: translateX(-40%); opacity: 0.3; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes mn-chug-away {
  to { transform: translateX(110%); opacity: 0; }
}
.mode-bar--missing {
  gap: 8px;
}
.mode-bar--missing .replay-btn span {
  white-space: nowrap;
}
.mn-levels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
@media (max-width: 380px) {
  .mode-bar--missing .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--missing .replay-btn span { display: none; }
  .mode-bar--missing .replay-btn svg { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .mn-wagon--gap .mn-wagon-body,
  .mn-wagon--filled.bounce .mn-wagon-body,
  .mn-chug-in,
  .mn-chug-away,
  .mn-choice.wobble,
  .mn-wagon.hint .mn-wagon-body,
  .mn-choice.hint { animation-duration: 0.01ms !important; }
}

/* ---- Letter & Number Order ---- */
.ord-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 4px 8px;
}
.ord-slots {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px;
}
.ord-slots--wrap {
  flex-wrap: wrap;
  align-content: center;
}
.ord-slot {
  flex: 0 0 auto;
  position: relative;
  border-radius: 50%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ord-slot-body {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 12px rgba(61,44,94,0.14);
  overflow: hidden;
}
.ord-slot--empty .ord-slot-body {
  background: repeating-linear-gradient(
    -45deg,
    #fff 0 8px,
    #F3E8FF 8px 16px
  );
  border: 3px dashed #CDB4DB;
}
.ord-slot--next .ord-slot-body {
  border-color: #FFC93C;
  animation: ord-next-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(255,201,60,0.35), 0 6px 12px rgba(61,44,94,0.14);
}
@keyframes ord-next-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.ord-slot-mark {
  font-size: clamp(18px, 6vw, 32px);
  font-weight: 900;
  color: #8E7DFF;
  line-height: 1;
  opacity: 0.55;
}
.ord-slot--filled .ord-slot-body {
  background: var(--stone, #FF6FB5);
  border: 3px solid rgba(61,44,94,0.1);
}
.ord-slot--filled .num-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: none;
}
.ord-slot--filled .num-digit {
  font-size: clamp(22px, 7vw, 40px);
}
.ord-slot.bounce .ord-slot-body {
  animation: mn-fill-bounce 0.55s ease;
}
.ord-slot.hint .ord-slot-body {
  animation: hint-pulse 1.2s ease-in-out infinite;
}
.ord-tile-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 12px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.ord-tile-row--wrap {
  flex-wrap: wrap;
}
.ord-tile {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
  flex: 0 0 auto;
}
.ord-tile .num-face {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(61,44,94,0.16);
}
.ord-tile .num-digit {
  font-size: clamp(36px, 12vw, 64px);
  font-weight: 900;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
.ord-tile.wobble {
  animation: soft-wobble 0.45s ease;
}
.ord-tile.correct .num-face {
  outline: 3px solid #7ED957;
  outline-offset: 2px;
}
.ord-tile.hint {
  animation: hint-pulse 1.2s ease-in-out infinite;
}
.ord-flyer {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
  border-radius: 16px;
}
.mode-bar--order {
  gap: 6px;
}
.mode-bar--order .replay-btn span,
.mode-bar--order .mode-toggle span {
  white-space: nowrap;
}
.ord-levels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
@media (max-width: 380px) {
  .mode-bar--order .mode-toggle,
  .mode-bar--order .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--order .mode-toggle span,
  .mode-bar--order .replay-btn span { display: none; }
  .mode-bar--order .mode-toggle svg,
  .mode-bar--order .replay-btn svg { width: 28px; height: 28px; }
  .ord-levels .match-level-dot {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ord-slot--next .ord-slot-body,
  .ord-slot.bounce .ord-slot-body,
  .ord-tile.wobble,
  .ord-slot.hint .ord-slot-body,
  .ord-tile.hint { animation-duration: 0.01ms !important; }
}

/* ---- Weather ---- */
.weather-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.weather-card {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.weather-card:active { transform: scale(0.94); }
.weather-card .weather-art-svg {
  width: 92%;
  height: 92%;
  pointer-events: none;
  display: block;
}
.weather-card.bounce { animation: shape-bounce 0.5s ease; }
.weather-card.wobble { animation: soft-wobble 0.45s ease; }
.weather-card.correct { animation: jump-glow 0.7s ease; }
.weather-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.weather-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.weather-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.weather-reveal .word-art {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.weather-reveal .word-art svg {
  width: 100%;
  height: 100%;
}
.weather-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .weather-card {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--weather .mode-toggle span,
.mode-bar--weather .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--weather {
    gap: 5px;
  }
  .mode-bar--weather .mode-toggle,
  .mode-bar--weather .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--weather .mode-toggle span,
  .mode-bar--weather .replay-btn span {
    display: none;
  }
  .mode-bar--weather .mode-toggle svg,
  .mode-bar--weather .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .weather-card.bounce,
  .weather-card.wobble,
  .weather-card.correct { animation-duration: 0.01ms !important; }
}

/* ---- Family ---- */
.family-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.family-card {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.family-card:active { transform: scale(0.94); }
.family-card .family-art-svg {
  width: 92%;
  height: 92%;
  pointer-events: none;
  display: block;
}
.family-card.bounce { animation: shape-bounce 0.5s ease; }
.family-card.wobble { animation: soft-wobble 0.45s ease; }
.family-card.correct { animation: jump-glow 0.7s ease; }
.family-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.family-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.family-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.family-reveal .word-art {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.family-reveal .word-art svg {
  width: 100%;
  height: 100%;
}
.family-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .family-card {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--family .mode-toggle span,
.mode-bar--family .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--family {
    gap: 5px;
  }
  .mode-bar--family .mode-toggle,
  .mode-bar--family .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--family .mode-toggle span,
  .mode-bar--family .replay-btn span {
    display: none;
  }
  .mode-bar--family .mode-toggle svg,
  .mode-bar--family .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-card.bounce,
  .family-card.wobble,
  .family-card.correct { animation-duration: 0.01ms !important; }
}

/* ---- Helpers ---- */
.helpers-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.helpers-card {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.helpers-card:active { transform: scale(0.94); }
.helpers-card .helpers-art-svg {
  width: 92%;
  height: 92%;
  pointer-events: none;
  display: block;
}
.helpers-card.bounce { animation: shape-bounce 0.5s ease; }
.helpers-card.wobble { animation: soft-wobble 0.45s ease; }
.helpers-card.correct { animation: jump-glow 0.7s ease; }
.helpers-card.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.helpers-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.helpers-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.helpers-reveal .word-art {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.helpers-reveal .word-art svg {
  width: 100%;
  height: 100%;
}
.helpers-reveal .word-label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .helpers-card {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--helpers .mode-toggle span,
.mode-bar--helpers .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--helpers {
    gap: 5px;
  }
  .mode-bar--helpers .mode-toggle,
  .mode-bar--helpers .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--helpers .mode-toggle span,
  .mode-bar--helpers .replay-btn span {
    display: none;
  }
  .mode-bar--helpers .mode-toggle svg,
  .mode-bar--helpers .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .helpers-card.bounce,
  .helpers-card.wobble,
  .helpers-card.correct { animation-duration: 0.01ms !important; }
}

/* ---- Animal Foods ---- */
.foods-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.foods-pair {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 6px 8px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.foods-pair:active { transform: scale(0.94); }
.foods-pair .foods-animal-img {
  width: 42%;
  height: 78%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 12px;
}
.foods-pair .foods-food-svg {
  width: 38%;
  height: 70%;
  pointer-events: none;
  display: block;
  flex-shrink: 0;
}
.foods-pair-plus {
  font-size: clamp(14px, 3.5vw, 22px);
  font-weight: 900;
  color: var(--plum-soft);
  opacity: 0.55;
  pointer-events: none;
  flex-shrink: 0;
}
.foods-pair.bounce { animation: shape-bounce 0.5s ease; }
.foods-pair.wobble { animation: soft-wobble 0.45s ease; }
.foods-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 22px;
  border: 3px solid rgba(61,44,94,0.12);
  box-shadow: 0 8px 16px rgba(61,44,94,0.12);
  overflow: hidden;
  flex-shrink: 0;
}
.foods-prompt .foods-animal-img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  pointer-events: none;
}
.foods-choices {
  flex: 0 0 auto;
}
.foods-choice {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.foods-choice:active { transform: scale(0.94); }
.foods-choice .foods-food-svg {
  width: 88%;
  height: 88%;
  pointer-events: none;
  display: block;
}
.foods-choice.wobble { animation: soft-wobble 0.45s ease; }
.foods-choice.correct { animation: jump-glow 0.7s ease; }
.foods-choice.hint {
  outline: 4px solid #FFC93C;
  outline-offset: 2px;
}
.foods-reveal {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.foods-reveal.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.foods-reveal .word-art {
  width: auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.foods-reveal .word-art img,
.foods-reveal .word-art svg {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.foods-reveal .word-label {
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 800;
  color: var(--plum-soft);
}
html.kid-busy .foods-pair,
html.kid-busy .foods-choice {
  filter: saturate(0.85) brightness(0.97);
}
.mode-bar--foods .mode-toggle span,
.mode-bar--foods .replay-btn span {
  white-space: nowrap;
}
@media (max-width: 380px) {
  .mode-bar--foods {
    gap: 5px;
  }
  .mode-bar--foods .mode-toggle,
  .mode-bar--foods .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--foods .mode-toggle span,
  .mode-bar--foods .replay-btn span {
    display: none;
  }
  .mode-bar--foods .mode-toggle svg,
  .mode-bar--foods .replay-btn svg {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .foods-pair.bounce,
  .foods-pair.wobble,
  .foods-choice.wobble,
  .foods-choice.correct { animation-duration: 0.01ms !important; }
}

/* ---- Shadow Match ---- */
.shadow-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.shadow-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 22px;
  border: 3px solid rgba(61,44,94,0.12);
  box-shadow: 0 8px 16px rgba(61,44,94,0.12);
  padding: 8px;
  flex-shrink: 0;
}
.shadow-prompt .shadow-sil {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0);
  pointer-events: none;
}
.shadow-choices {
  flex-shrink: 0;
}
.shadow-choice {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 6px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shadow-choice:active { transform: scale(0.94); }
.shadow-choice img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.shadow-choice.wobble { animation: soft-wobble 0.45s ease; }
.shadow-choice.correct { animation: jump-glow 0.7s ease; }
.shadow-choice.hint {
  box-shadow: 0 0 0 4px #FFC93C, 0 8px 16px rgba(61,44,94,0.14);
}
html.kid-busy .shadow-choice { pointer-events: none; }
.mode-bar--shadow .replay-btn span { font-size: 0.85rem; }
@media (max-width: 430px) {
  .mode-bar--shadow {
    gap: 6px;
  }
  .mode-bar--shadow .replay-btn {
    min-height: 44px;
    padding: 4px 10px;
  }
  .mode-bar--shadow .replay-btn span { font-size: 0.75rem; }
  .mode-bar--shadow .replay-btn svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .shadow-choice.wobble,
  .shadow-choice.correct { animation-duration: 0.01ms !important; }
}

/* ---- Add & Take Away ---- */
.maths-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.maths-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  background: rgba(255,255,255,0.72);
  border-radius: 20px;
  border: 3px solid rgba(61,44,94,0.1);
  padding: 8px 10px;
  flex-shrink: 0;
  max-width: 100%;
}
.maths-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 160px;
}
.maths-take-wrap .maths-group {
  max-width: 220px;
}
.maths-obj {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}
.maths-op {
  font-size: 1.8rem;
  font-weight: 900;
  color: #3D2C5E;
  line-height: 1;
  padding: 0 2px;
}
.maths-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #FDFFB6;
  border: 3px dashed rgba(61,44,94,0.35);
  font-size: 1.6rem;
  font-weight: 900;
  color: #3D2C5E;
}
.maths-choices { flex-shrink: 0; }
.maths-choice {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}
.maths-choice:active { transform: scale(0.94); }
.maths-digit {
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 900;
  color: #3D2C5E;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
.maths-choice.wobble { animation: soft-wobble 0.45s ease; }
.maths-choice.correct { animation: jump-glow 0.7s ease; }
.maths-choice.hint {
  box-shadow: 0 0 0 4px #FFC93C, 0 8px 16px rgba(61,44,94,0.14);
}
html.kid-busy .maths-choice { pointer-events: none; }
.mode-bar--maths .mode-toggle span,
.mode-bar--maths .replay-btn span { font-size: 0.85rem; }
@media (max-width: 430px) {
  .mode-bar--maths { gap: 6px; }
  .mode-bar--maths .mode-toggle,
  .mode-bar--maths .replay-btn {
    min-height: 44px;
    padding: 4px 8px;
  }
  .mode-bar--maths .mode-toggle span,
  .mode-bar--maths .replay-btn span { font-size: 0.72rem; }
  .mode-bar--maths .mode-toggle svg,
  .mode-bar--maths .replay-btn svg { width: 22px; height: 22px; }
  .maths-obj { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .maths-choice.wobble,
  .maths-choice.correct { animation-duration: 0.01ms !important; }
}

/* ---- Kind Choices ---- */
.kind-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}
.kind-choice {
  appearance: none;
  border: 3px solid rgba(61,44,94,0.1);
  border-radius: 22px;
  background: #fff;
  padding: 8px;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(61,44,94,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kind-choice:active { transform: scale(0.94); }
.kind-choice .kind-scene-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}
.kind-choice.wobble { animation: soft-wobble 0.45s ease; }
.kind-choice.correct { animation: jump-glow 0.7s ease; }
.kind-choice.hint {
  box-shadow: 0 0 0 4px #FFC93C, 0 8px 16px rgba(61,44,94,0.14);
}
html.kid-busy .kind-choice { pointer-events: none; }
.mode-bar--kind .replay-btn span { font-size: 0.85rem; }
@media (max-width: 430px) {
  .mode-bar--kind { gap: 6px; }
  .mode-bar--kind .replay-btn {
    min-height: 44px;
    padding: 4px 10px;
  }
  .mode-bar--kind .replay-btn span { font-size: 0.75rem; }
  .mode-bar--kind .replay-btn svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .kind-choice.wobble,
  .kind-choice.correct { animation-duration: 0.01ms !important; }
}

/* ---- Maze ---- */
.maze-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}
.maze-board {
  display: grid;
  margin: 0 auto;
  max-width: 100%;
  max-height: 100%;
}
.maze-cell {
  appearance: none;
  border: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #E8F8D8;
  box-shadow: inset 0 0 0 1px rgba(61,44,94,0.06);
}
.maze-cell--wall {
  background: linear-gradient(160deg, #C8EFB8, #9ED98A);
  cursor: default;
  box-shadow: 0 2px 4px rgba(61,44,94,0.1);
  border-radius: 12px;
}
.maze-cell--wall .maze-hedge {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.maze-cell--path {
  background: linear-gradient(180deg, #F3FBE8 0%, #E2F5C8 100%);
}
.maze-cell--visited {
  background: linear-gradient(180deg, #FFF6C8 0%, #FFE8A0 100%);
}
.maze-cell--bunny {
  outline: 3px solid #FFC93C;
  outline-offset: -2px;
  z-index: 2;
}
.maze-cell--goal {
  background: linear-gradient(180deg, #FFE8D6 0%, #FFD0A8 100%);
}
.maze-bunny,
.maze-goal {
  position: absolute;
  inset: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.maze-sprite {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}
.maze-goal--got {
  inset: 55% 8% 4% 55%;
  opacity: 0.95;
}
.maze-next { z-index: 40; }
.mode-bar--maze {
  gap: 8px;
}
.mode-bar--maze .replay-btn span {
  white-space: nowrap;
  font-size: 0.85rem;
}
@media (max-width: 380px) {
  .mode-bar--maze .replay-btn {
    padding: 0;
    width: var(--bar-h);
    min-width: var(--bar-h);
    max-width: var(--bar-h);
  }
  .mode-bar--maze .replay-btn span { display: none; }
  .mode-bar--maze .replay-btn svg { width: 28px; height: 28px; }
  .maze-levels .match-level-dot {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
  }
}
@media (max-width: 430px) {
  .mode-bar--maze { gap: 6px; }
  .mode-bar--maze .replay-btn {
    min-height: 44px;
    padding: 4px 10px;
  }
  .mode-bar--maze .replay-btn span { font-size: 0.75rem; }
  .mode-bar--maze .replay-btn svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .maze-cell--visited,
  .maze-bunny,
  .maze-goal {
    transition: none !important;
    animation: none !important;
  }
}
