:root {
  --paper: #f6ead6;
  --paper-deep: #edd9b8;
  --ink: #3b2a1c;
  --ink-soft: #6b5340;
  --on-sun: #3b2a1c;
  --coral: #e85d4c;
  --coral-deep: #c94436;
  --sun: #f3c04b;
  --sun-deep: #d7a227;
  --sky: #4eb3e3;
  --mint: #5cbc8e;
  --grape: #a97ad4;
  --peach: #f3a27a;
  --cream: #fff8ee;
  --card-top: #fffdf8;
  --foil: #9aa3ad;
  --shadow: 0 14px 34px rgba(80, 42, 20, 0.16);
  --radius: 22px;
  --bg-glow-a: #ffe7c2;
  --bg-glow-b: #ffd0c4;
  --bg-from: #f8d9a8;
  --bg-to: #e8b07a;
  --cover-from: #f06a56;
  --cover-mid: #e85d4c;
  --cover-to: #d94b3d;
  --cover-spine-a: #9a3328;
  --cover-spine-b: #d85a48;
  --orb-a: #4eb3e3aa;
  --orb-b: #a97ad4aa;
  --orb-c: #5cbc8eaa;
  --theme-bar: #e85d4c;
}

[data-theme="ocean"] {
  --paper: #d8eef8;
  --paper-deep: #b5d9ec;
  --ink: #16324a;
  --ink-soft: #3a6480;
  --coral: #2f8fd4;
  --coral-deep: #1d6fa8;
  --sun: #f4d056;
  --sun-deep: #d4a81c;
  --sky: #3aa0de;
  --mint: #3ec1b0;
  --grape: #5b8fd4;
  --peach: #7ec8e8;
  --cream: #f3fbff;
  --card-top: #ffffff;
  --shadow: 0 14px 34px rgba(20, 70, 110, 0.16);
  --bg-glow-a: #c8ecff;
  --bg-glow-b: #9ad4f5;
  --bg-from: #8fd0f0;
  --bg-to: #3a9ad4;
  --cover-from: #5ec4ef;
  --cover-mid: #2f8fd4;
  --cover-to: #1c6eae;
  --cover-spine-a: #155888;
  --cover-spine-b: #3aa0de;
  --orb-a: #7ee0ffaa;
  --orb-b: #3a9ad4aa;
  --orb-c: #3ec1b0aa;
  --theme-bar: #2f8fd4;
}

[data-theme="forest"] {
  --paper: #e4f0d4;
  --paper-deep: #c5db9e;
  --ink: #24351a;
  --ink-soft: #4a6840;
  --coral: #4f9a4a;
  --coral-deep: #347034;
  --sun: #e8c04a;
  --sun-deep: #c49a1c;
  --sky: #7eb86a;
  --mint: #5cbc8e;
  --grape: #6a9a4a;
  --peach: #c4d86a;
  --cream: #f6fbee;
  --card-top: #fcfff6;
  --shadow: 0 14px 34px rgba(40, 70, 20, 0.16);
  --bg-glow-a: #e4f5c4;
  --bg-glow-b: #b8e08a;
  --bg-from: #c6e48a;
  --bg-to: #5a9a48;
  --cover-from: #7ec45a;
  --cover-mid: #4f9a4a;
  --cover-to: #2f7034;
  --cover-spine-a: #245028;
  --cover-spine-b: #6db34d;
  --orb-a: #8fd06aaa;
  --orb-b: #e8c04aaa;
  --orb-c: #5cbc8eaa;
  --theme-bar: #4f9a4a;
}

[data-theme="grape"] {
  --paper: #efe4f8;
  --paper-deep: #d4bcec;
  --ink: #3a2458;
  --ink-soft: #6a5088;
  --coral: #9b6ad8;
  --coral-deep: #7040b0;
  --sun: #f0b8e0;
  --sun-deep: #d48cc4;
  --sky: #8a7ae0;
  --mint: #80c4c0;
  --grape: #a97ad4;
  --peach: #d4a0e8;
  --cream: #fbf6ff;
  --card-top: #fffaff;
  --shadow: 0 14px 34px rgba(80, 40, 120, 0.16);
  --bg-glow-a: #f0d8ff;
  --bg-glow-b: #d4b0f0;
  --bg-from: #d8b8f0;
  --bg-to: #8a58c4;
  --cover-from: #c08aee;
  --cover-mid: #9b6ad8;
  --cover-to: #7040b0;
  --cover-spine-a: #502888;
  --cover-spine-b: #b080e0;
  --orb-a: #d4a0e8aa;
  --orb-b: #8a7ae0aa;
  --orb-c: #f0b8e0aa;
  --theme-bar: #9b6ad8;
}

[data-theme="sunshine"] {
  --paper: #fff3c4;
  --paper-deep: #f0d878;
  --ink: #4a3408;
  --ink-soft: #7a5c18;
  --coral: #f0a020;
  --coral-deep: #d07a10;
  --sun: #ffe14a;
  --sun-deep: #e0b410;
  --sky: #f0c040;
  --mint: #c4d84a;
  --grape: #f08040;
  --peach: #ffc878;
  --cream: #fffbeb;
  --card-top: #fffdf2;
  --shadow: 0 14px 34px rgba(120, 80, 10, 0.16);
  --bg-glow-a: #fff3a0;
  --bg-glow-b: #ffd060;
  --bg-from: #ffe878;
  --bg-to: #f0a020;
  --cover-from: #ffd24a;
  --cover-mid: #f0a020;
  --cover-to: #e07810;
  --cover-spine-a: #b85808;
  --cover-spine-b: #f4b830;
  --orb-a: #ffe14aaa;
  --orb-b: #f08040aa;
  --orb-c: #ffc878aa;
  --theme-bar: #f0a020;
}

[data-theme="berry"] {
  --paper: #fce4ee;
  --paper-deep: #f4b8d0;
  --ink: #5a1838;
  --ink-soft: #8a4060;
  --coral: #e85a8c;
  --coral-deep: #c03068;
  --sun: #f4b0d0;
  --sun-deep: #d888b0;
  --sky: #f080a8;
  --mint: #e890b8;
  --grape: #d060a0;
  --peach: #f8a0c0;
  --cream: #fff6fa;
  --card-top: #fffafc;
  --shadow: 0 14px 34px rgba(140, 30, 70, 0.14);
  --bg-glow-a: #ffd0e4;
  --bg-glow-b: #f8a0c8;
  --bg-from: #f8b8d4;
  --bg-to: #e85a8c;
  --cover-from: #f878a8;
  --cover-mid: #e85a8c;
  --cover-to: #c03068;
  --cover-spine-a: #881848;
  --cover-spine-b: #f080a8;
  --orb-a: #f8a0c0aa;
  --orb-b: #e85a8caa;
  --orb-c: #d060a0aa;
  --theme-bar: #e85a8c;
}

[data-theme="night"] {
  --paper: #1a2340;
  --paper-deep: #2a3558;
  --ink: #f6efe6;
  --ink-soft: #c9b9a8;
  --coral: #ff8a7a;
  --coral-deep: #e85d4c;
  --sun: #f3c04b;
  --sun-deep: #c4921a;
  --sky: #5eb6e8;
  --mint: #5cbc8e;
  --grape: #c49ae8;
  --peach: #f3a27a;
  --cream: #243056;
  --card-top: #2e3c68;
  --foil: #8a93a8;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  --bg-glow-a: #3a2a6a;
  --bg-glow-b: #1a3a6a;
  --bg-from: #151b33;
  --bg-to: #0d1226;
  --cover-from: #6a58d0;
  --cover-mid: #3d2f8a;
  --cover-to: #241c5c;
  --cover-spine-a: #161040;
  --cover-spine-b: #5a4cb0;
  --orb-a: #5eb6e8aa;
  --orb-b: #c49ae8aa;
  --orb-c: #f3c04baa;
  --theme-bar: #3d2f8a;
}

[data-theme="mint"] {
  --paper: #d8f4ea;
  --paper-deep: #a8e0cc;
  --ink: #184438;
  --ink-soft: #3a7060;
  --coral: #2eb89a;
  --coral-deep: #1a8870;
  --sun: #8ee0c4;
  --sun-deep: #4cbc98;
  --sky: #4ec8c0;
  --mint: #3ec4a0;
  --grape: #40b0a0;
  --peach: #a0e8d0;
  --cream: #f3fffb;
  --card-top: #fbfffe;
  --shadow: 0 14px 34px rgba(20, 90, 70, 0.14);
  --bg-glow-a: #c8f8e8;
  --bg-glow-b: #8ae8d0;
  --bg-from: #9ae8d0;
  --bg-to: #2eb89a;
  --cover-from: #5ed4b8;
  --cover-mid: #2eb89a;
  --cover-to: #1a8870;
  --cover-spine-a: #126858;
  --cover-spine-b: #4ec8c0;
  --orb-a: #8ee0c4aa;
  --orb-b: #4ec8c0aa;
  --orb-c: #f3c04baa;
  --theme-bar: #2eb89a;
}

[data-theme="lava"] {
  --paper: #ffe0c8;
  --paper-deep: #f4b888;
  --ink: #4a1808;
  --ink-soft: #8a4030;
  --coral: #f06030;
  --coral-deep: #c83810;
  --sun: #ffb040;
  --sun-deep: #e07810;
  --sky: #ff8040;
  --mint: #f09050;
  --grape: #e04828;
  --peach: #ff9860;
  --cream: #fff6ee;
  --card-top: #fffaf4;
  --shadow: 0 14px 34px rgba(140, 40, 10, 0.16);
  --bg-glow-a: #ffd0a0;
  --bg-glow-b: #ff8060;
  --bg-from: #ffb070;
  --bg-to: #e04828;
  --cover-from: #ff8040;
  --cover-mid: #f06030;
  --cover-to: #c83810;
  --cover-spine-a: #881808;
  --cover-spine-b: #ff7040;
  --orb-a: #ffb040aa;
  --orb-b: #f06030aa;
  --orb-c: #ff8040aa;
  --theme-bar: #f06030;
}

[data-theme="cocoa"] {
  --paper: #efe0cc;
  --paper-deep: #d4b894;
  --ink: #3a2414;
  --ink-soft: #6a4c34;
  --coral: #a06838;
  --coral-deep: #784820;
  --sun: #e0b060;
  --sun-deep: #b88830;
  --sky: #c48850;
  --mint: #8a7048;
  --grape: #8a5a38;
  --peach: #d4a070;
  --cream: #fff8ee;
  --card-top: #fffaf4;
  --shadow: 0 14px 34px rgba(80, 42, 20, 0.18);
  --bg-glow-a: #f0d8b0;
  --bg-glow-b: #d4a070;
  --bg-from: #e0c090;
  --bg-to: #8a5a38;
  --cover-from: #c48850;
  --cover-mid: #a06838;
  --cover-to: #784820;
  --cover-spine-a: #4a2810;
  --cover-spine-b: #c48850;
  --orb-a: #e0b060aa;
  --orb-b: #d4a070aa;
  --orb-c: #8a5a38aa;
  --theme-bar: #a06838;
}

[data-theme="rainbow"] {
  --paper: #fff3d8;
  --paper-deep: #ffd0a8;
  --ink: #3b2a1c;
  --ink-soft: #6b5340;
  --coral: #ff6b6b;
  --coral-deep: #e04848;
  --sun: #ffe14a;
  --sun-deep: #e0b410;
  --sky: #4eb3e3;
  --mint: #5cbc8e;
  --grape: #a97ad4;
  --peach: #ff9ad4;
  --cream: #fffaf4;
  --card-top: #fffdf8;
  --shadow: 0 14px 34px rgba(80, 42, 20, 0.14);
  --bg-glow-a: #ffe14a;
  --bg-glow-b: #ff9ad4;
  --bg-from: #ffb3e0;
  --bg-to: #7ec8ff;
  --cover-from: #ff5a5a;
  --cover-mid: #5cbc8e;
  --cover-to: #a97ad4;
  --cover-spine-a: #c03880;
  --cover-spine-b: #4eb3e3;
  --orb-a: #ff5a5aaa;
  --orb-b: #ffe14aaa;
  --orb-c: #4eb3e3aa;
  --theme-bar: #ff6b6b;
}

[data-theme="flowers"] {
  --paper: #fce8f0;
  --paper-deep: #f4c4d8;
  --ink: #4a2840;
  --ink-soft: #7a5068;
  --coral: #e878a8;
  --coral-deep: #c05080;
  --sun: #f3c04b;
  --sun-deep: #d4a020;
  --sky: #7ec45a;
  --mint: #8fd06a;
  --grape: #e890b8;
  --peach: #ffb3c8;
  --cream: #fff7fb;
  --card-top: #fffafc;
  --shadow: 0 14px 34px rgba(140, 50, 80, 0.12);
  --bg-glow-a: #ffe0f0;
  --bg-glow-b: #d4f0b8;
  --bg-from: #f8c8dc;
  --bg-to: #8fd06a;
  --cover-from: #ffa0c4;
  --cover-mid: #e878a8;
  --cover-to: #7ec45a;
  --cover-spine-a: #4a8840;
  --cover-spine-b: #f0a0c0;
  --orb-a: #ff8ab8aa;
  --orb-b: #f3c04baa;
  --orb-c: #7ec45aaa;
  --theme-bar: #e878a8;
}

[data-theme="unicorn"] {
  --paper: #f6e8ff;
  --paper-deep: #e0c8f8;
  --ink: #4a2868;
  --ink-soft: #7a5898;
  --coral: #d4a0e8;
  --coral-deep: #b070d0;
  --sun: #ffd6f0;
  --sun-deep: #e8a8d0;
  --sky: #a8e0f8;
  --mint: #a8f0e0;
  --grape: #c49ae8;
  --peach: #ffb3e0;
  --cream: #fff8ff;
  --card-top: #fffaff;
  --shadow: 0 14px 34px rgba(120, 60, 160, 0.12);
  --bg-glow-a: #ffd6f0;
  --bg-glow-b: #c8e8ff;
  --bg-from: #f0c8ff;
  --bg-to: #a8f0e0;
  --cover-from: #ffb3e0;
  --cover-mid: #d4b8ff;
  --cover-to: #a8f0e0;
  --cover-spine-a: #8860c0;
  --cover-spine-b: #ffb3e0;
  --orb-a: #ffb3e0aa;
  --orb-b: #d4b8ffaa;
  --orb-c: #a8f0e0aa;
  --theme-bar: #d4a0e8;
}

[data-theme="dino"] {
  --paper: #e6f0c8;
  --paper-deep: #c4d88a;
  --ink: #2a3818;
  --ink-soft: #4a6840;
  --coral: #6db34d;
  --coral-deep: #4a8834;
  --sun: #f0b040;
  --sun-deep: #c88818;
  --sky: #8fd06a;
  --mint: #5cbc8e;
  --grape: #c88840;
  --peach: #d4e878;
  --cream: #f6fbee;
  --card-top: #fcfff4;
  --shadow: 0 14px 34px rgba(50, 80, 20, 0.16);
  --bg-glow-a: #e0f0a0;
  --bg-glow-b: #f0c878;
  --bg-from: #c8e878;
  --bg-to: #5a9a40;
  --cover-from: #8fd06a;
  --cover-mid: #6db34d;
  --cover-to: #c88840;
  --cover-spine-a: #3a6020;
  --cover-spine-b: #8fd06a;
  --orb-a: #8fd06aaa;
  --orb-b: #f0b040aa;
  --orb-c: #c88840aa;
  --theme-bar: #6db34d;
}

[data-theme="candy"] {
  --paper: #ffe8f4;
  --paper-deep: #ffc0e0;
  --ink: #5a1848;
  --ink-soft: #8a4068;
  --coral: #ff7ab8;
  --coral-deep: #e04890;
  --sun: #ffd24a;
  --sun-deep: #e0b010;
  --sky: #7ed0ff;
  --mint: #ff9ad4;
  --grape: #ff80c0;
  --peach: #ffb0d8;
  --cream: #fff7fb;
  --card-top: #fffafc;
  --shadow: 0 14px 34px rgba(160, 40, 100, 0.12);
  --bg-glow-a: #ffd6f0;
  --bg-glow-b: #ffe080;
  --bg-from: #ffb0d8;
  --bg-to: #7ed0ff;
  --cover-from: #ff7ab8;
  --cover-mid: #ffd24a;
  --cover-to: #7ed0ff;
  --cover-spine-a: #d03880;
  --cover-spine-b: #ffd24a;
  --orb-a: #ff7ab8aa;
  --orb-b: #ffd24aaa;
  --orb-c: #7ed0ffaa;
  --theme-bar: #ff7ab8;
}

[data-theme="butterfly"] {
  --paper: #fff0d8;
  --paper-deep: #f0d0a0;
  --ink: #3a2458;
  --ink-soft: #6a5080;
  --coral: #c49ae8;
  --coral-deep: #9868c8;
  --sun: #ffb060;
  --sun-deep: #e08830;
  --sky: #7ec8ea;
  --mint: #e8b070;
  --grape: #c49ae8;
  --peach: #ffc890;
  --cream: #fff8f0;
  --card-top: #fffaf6;
  --shadow: 0 14px 34px rgba(100, 50, 120, 0.12);
  --bg-glow-a: #ffe0b0;
  --bg-glow-b: #e0c8ff;
  --bg-from: #ffd8a8;
  --bg-to: #c49ae8;
  --cover-from: #ffb060;
  --cover-mid: #c49ae8;
  --cover-to: #7ec8ea;
  --cover-spine-a: #7048a0;
  --cover-spine-b: #ffb060;
  --orb-a: #ffb060aa;
  --orb-b: #c49ae8aa;
  --orb-c: #7ec8eaaa;
  --theme-bar: #c49ae8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-a), transparent 50%),
    radial-gradient(900px 500px at 110% 10%, var(--bg-glow-b), transparent 46%),
    linear-gradient(180deg, var(--bg-from) 0%, var(--bg-to) 100%);
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  transition: background 0.35s ease, color 0.25s ease;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  touch-action: manipulation;
}

h1,
h2,
h3,
.eyebrow,
.big-btn,
.game-card h3 {
  font-family: "Fredoka", "Nunito", sans-serif;
}

button,
input {
  font: inherit;
}

#app {
  position: relative;
  min-height: 100dvh;
  perspective: 1200px;
}

.world-3d {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

html[data-theme="rainbow"] .world-3d::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -28%;
  width: 150%;
  height: 72%;
  transform: translateX(-50%);
  border-radius: 50%;
  box-shadow:
    0 0 0 12px #ff5a5a44,
    0 0 0 24px #ff9a3c44,
    0 0 0 36px #ffe14a44,
    0 0 0 48px #5cbc8e44,
    0 0 0 60px #4eb3e344,
    0 0 0 72px #a97ad444;
}

html[data-theme="flowers"] .world-3d::after,
html[data-theme="unicorn"] .world-3d::after,
html[data-theme="candy"] .world-3d::after,
html[data-theme="butterfly"] .world-3d::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background:
    radial-gradient(circle at 12% 18%, #fff8 0 10px, transparent 11px),
    radial-gradient(circle at 78% 12%, #fff7 0 8px, transparent 9px),
    radial-gradient(circle at 88% 70%, #fff6 0 12px, transparent 13px),
    radial-gradient(circle at 16% 78%, #fff6 0 9px, transparent 10px);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: floaty 8s ease-in-out infinite;
}

.orb-a { width: 180px; height: 180px; left: 6%; top: 12%; background: radial-gradient(circle at 30% 30%, #fff7, var(--orb-a)); }
.orb-b { width: 140px; height: 140px; right: 8%; top: 22%; background: radial-gradient(circle at 30% 30%, #fff7, var(--orb-b)); animation-delay: -2s; }
.orb-c { width: 110px; height: 110px; left: 18%; bottom: 12%; background: radial-gradient(circle at 30% 30%, #fff7, var(--orb-c)); animation-delay: -4s; }

.float-toy {
  position: absolute;
  font-size: 2rem;
  animation: spin-float 9s linear infinite;
  filter: drop-shadow(0 10px 0 rgba(80, 40, 20, 0.12));
}
.t1 { left: 10%; top: 40%; }
.t2 { right: 12%; top: 16%; animation-delay: -2s; }
.t3 { right: 18%; bottom: 18%; animation-delay: -4s; }
.t4 { left: 22%; top: 18%; animation-delay: -6s; }

@keyframes floaty {
  50% { transform: translateY(-18px) scale(1.06); }
}

@keyframes spin-float {
  0% { transform: translateY(0) rotateY(0deg); }
  50% { transform: translateY(-16px) rotateY(180deg); }
  100% { transform: translateY(0) rotateY(360deg); }
}

.stage-3d {
  perspective: 900px;
  transform-style: preserve-3d;
}

.paper-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(90, 50, 20, 0.12) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 80%, rgba(90, 50, 20, 0.1) 0 1px, transparent 1.5px);
  background-size: 7px 7px, 11px 11px;
  z-index: 0;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: clamp(16px, 3vw, 32px);
  padding-top: calc(clamp(16px, 3vw, 32px) + env(safe-area-inset-top));
  padding-bottom: calc(clamp(16px, 3vw, 32px) + env(safe-area-inset-bottom));
}

.ghost-btn {
  appearance: none;
  display: block;
  margin: 14px auto 0;
  border: 2px solid rgba(255, 248, 238, 0.7);
  background: transparent;
  color: #fffaf4;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.cover-book {
  width: min(420px, 100%);
  margin: 6vh auto 0;
  display: flex;
  filter: drop-shadow(0 22px 36px rgba(90, 40, 16, 0.28));
}

.book-3d {
  transform: rotateY(-12deg) rotateX(6deg);
  animation: book-sway 6s ease-in-out infinite;
  transform-style: preserve-3d;
}

@keyframes book-sway {
  50% { transform: rotateY(10deg) rotateX(4deg) translateY(-8px); }
}

.cover-spine {
  width: 22px;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(90deg, var(--cover-spine-a), var(--coral-deep) 40%, var(--cover-spine-b));
  box-shadow: inset -4px 0 8px rgba(0, 0, 0, 0.18);
}

.cover-front {
  flex: 1;
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(165deg, var(--cover-from), var(--cover-mid) 45%, var(--cover-to));
  color: #fffaf4;
  border-radius: 0 26px 26px 0;
  padding: 36px 28px 28px;
  text-align: center;
  border: 3px solid rgba(255, 236, 210, 0.28);
}

html[data-theme="rainbow"] .cover-front {
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(165deg, #ff5a5a 0%, #ff9a3c 18%, #ffe14a 36%, #5cbc8e 54%, #4eb3e3 72%, #a97ad4 100%);
}

html[data-theme="flowers"] .cover-front {
  background:
    radial-gradient(circle at 18% 22%, #fff6 0 18px, transparent 19px),
    radial-gradient(circle at 82% 28%, #fff5 0 14px, transparent 15px),
    radial-gradient(circle at 70% 78%, #fff4 0 16px, transparent 17px),
    linear-gradient(165deg, #ffa0c4, #e878a8 50%, #7ec45a);
}

html[data-theme="unicorn"] .cover-front {
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.45), transparent 28%),
    linear-gradient(165deg, #ffb3e0, #d4b8ff 48%, #a8f0e0);
}

html[data-theme="candy"] .cover-front {
  background:
    repeating-linear-gradient(128deg, #ff7ab822 0 14px, #ffd24a22 14px 28px),
    linear-gradient(165deg, #ff7ab8, #ffd24a 50%, #7ed0ff);
}

html[data-theme="butterfly"] .cover-front {
  background:
    radial-gradient(circle at 22% 40%, #ffb06088 0 18%, transparent 19%),
    radial-gradient(circle at 78% 40%, #c49ae888 0 18%, transparent 19%),
    linear-gradient(165deg, #ffb060, #c49ae8 55%, #7ec8ea);
}

html[data-theme="dino"] .cover-front {
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.28), transparent 28%),
    linear-gradient(165deg, #8fd06a, #6db34d 48%, #c88840);
}

.cover-stars {
  letter-spacing: 0.4em;
  opacity: 0.85;
  margin: 0;
}

.cover-kicker,
.cover-ages {
  margin: 8px 0 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  opacity: 0.86;
}

.cover-front h1 {
  margin: 10px 0 0;
  font-size: clamp(2.3rem, 8vw, 3.3rem);
  line-height: 0.95;
  text-shadow: 0 4px 0 rgba(140, 30, 20, 0.2);
}

.cover-sub {
  margin: 12px 0 0;
  font-size: 1.05rem;
}

.fox-3d {
  width: 120px;
  height: 110px;
  margin: 16px auto 10px;
  position: relative;
  transform-style: preserve-3d;
  animation: fox-bob 2.4s ease-in-out infinite;
}

.fox-head {
  width: 88px;
  height: 80px;
  margin: 22px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffc29a, #f3a27a 55%, #d97b52);
  box-shadow: 10px 14px 0 rgba(140, 30, 20, 0.18), inset -8px -10px 0 rgba(180, 70, 40, 0.15);
  position: relative;
}

.fox-ear {
  position: absolute;
  top: 4px;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 34px solid #f3a27a;
  filter: drop-shadow(4px 6px 0 rgba(140, 30, 20, 0.12));
}
.fox-ear.left { left: 14px; transform: rotate(-18deg); }
.fox-ear.right { right: 14px; transform: rotate(18deg); }

.fox-eye {
  position: absolute;
  top: 30px;
  width: 10px;
  height: 12px;
  background: #3b2a1c;
  border-radius: 50%;
}
.fox-eye:first-child { left: 22px; }
.fox-eye:last-of-type { right: 22px; }

.fox-nose {
  position: absolute;
  left: 50%;
  top: 48px;
  width: 14px;
  height: 10px;
  margin-left: -7px;
  background: #3b2a1c;
  border-radius: 50%;
}

@keyframes fox-bob {
  50% { transform: translateY(-8px) rotateY(16deg); }
}

.big-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--sun);
  color: var(--on-sun);
  border-radius: 999px;
  padding: 14px 28px;
  min-height: 48px;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 6px 0 var(--sun-deep);
  transition: transform 0.12s ease;
}

.big-btn:hover {
  transform: translateY(-1px);
}

.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--sun-deep);
}

.page-top,
.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(1040px, 100%);
  margin: 0 auto 18px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.page-top h2,
.stage-titles h2 {
  margin: 2px 0 0;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
}

.star-bank {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  font-size: 1.2rem;
}

.star-bank.compact {
  padding: 6px 10px;
  font-size: 1rem;
}

.banks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.who-btn {
  appearance: none;
  border: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
  cursor: pointer;
}

#who-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12ch;
}

.menu-caret {
  font-size: 0.95rem;
  opacity: 0.7;
}

.celebrate.look-overlay {
  place-items: start;
  justify-items: center;
  overflow: auto;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
}

.look-card {
  width: min(720px, calc(100vw - 24px));
  max-height: min(92dvh, 820px);
  margin: 0;
}

.look-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  background: var(--cream);
  z-index: 1;
  padding-bottom: 4px;
}

.look-top h3 {
  margin: 0;
}

.look-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--cream);
  padding-top: 10px;
}

.look-card .name-input {
  width: 100%;
  margin: 0 0 12px;
}

.look-card .kid-select {
  appearance: auto;
  cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='12' viewBox='0 0 20 12'%3E%3Cpath fill='%233b2a1c' d='M2 2l8 8 8-8'/%3E%3C/svg%3E") no-repeat right 14px center;
  background-size: 14px;
  padding-right: 40px;
}

.look-card .age-picks {
  justify-content: flex-start;
  margin: 0 0 12px;
}

.look-card .theme-picks.compact {
  width: 100%;
  margin: 0 0 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 560px) {
  .look-card .theme-picks.compact {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .look-card .theme-picks.compact {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .look-card .voice-picks.compact {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

.look-card .theme-pick {
  min-height: 48px;
}

.look-card .voice-picks.compact,
.look-card .voice-api-box {
  width: 100%;
  margin: 0 0 12px;
}

.tts-more {
  margin: 10px 0;
}

.tts-more summary {
  cursor: pointer;
  list-style: revert;
}

.tts-pick-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tts-pick-row .name-input {
  flex: 1;
}

.tts-pick-row .small-btn {
  flex: 0 0 auto;
}

.contents-intro {
  width: min(1040px, 100%);
  margin: 0 auto 6px;
}

#contents.all-menu .contents-intro {
  margin-bottom: 2px;
}

#contents.all-menu .contents-intro .eyebrow {
  display: none;
}

#contents.all-menu .contents-intro h2 {
  font-size: clamp(1.15rem, 3.4vw, 1.45rem);
}

#contents.all-menu .level-note {
  display: none;
}

#contents.all-menu .page-top {
  margin-bottom: 8px;
}

#contents.all-menu .level-bar {
  margin-bottom: 6px;
}

.account-card,
.profile-card,
.reward-card {
  width: min(560px, 100%);
  margin: 0 auto 16px;
  background: var(--cream);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

#pick-kid-label,
#pick-kid-hint {
  width: min(720px, 100%);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.profile-list {
  width: min(720px, 100%);
  margin: 0 auto 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.profile-chip {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--cream);
  border-radius: 20px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  font-weight: 800;
  cursor: pointer;
  min-width: min(220px, 100%);
  font-size: 1.15rem;
}

.profile-chip.active {
  outline: 3px solid var(--ink);
  background: var(--sun);
  color: var(--on-sun);
}

.profile-chip .kid-name {
  font-size: 1.2rem;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-delete {
  appearance: none;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f3d2c8;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 4px 0 rgba(80, 40, 20, 0.12);
}

.small-btn.danger {
  background: #e85d4c;
  color: #fff;
}

.reset-all-btn {
  display: block;
  margin: 0 auto 14px;
}

#grownup-pass-btn {
  display: block;
  margin: 12px auto 0;
}

.profile-chip .theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px #fff;
}

.field-label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 800;
}

.name-input {
  width: 100%;
  border: 3px solid var(--paper-deep);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 1.1rem;
  background: #fff;
  color: #3b2a1c;
}

#add-another-kid {
  display: block;
  margin: 10px auto 0;
}

select.name-input {
  appearance: auto;
}

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.theme-picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.theme-picks.compact {
  width: min(1040px, 100%);
  margin: 0 auto 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .theme-picks.compact {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.theme-pick {
  appearance: none;
  border: 0;
  border-radius: 16px;
  min-height: 68px;
  padding: 8px 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 4px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--paper-deep);
  font-weight: 800;
  font-size: 0.7rem;
  color: var(--ink);
}

.theme-pick .swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 rgba(80, 40, 20, 0.15);
}

.theme-pick.active {
  outline: 3px solid var(--ink);
  background: var(--sun);
  color: var(--on-sun);
}

.theme-picks.compact .theme-pick {
  min-height: 54px;
  font-size: 0.62rem;
}

.avatar-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.avatar-pick {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--paper-deep);
}

.avatar-pick.active {
  outline: 3px solid var(--ink);
  background: var(--sun);
  color: var(--on-sun);
}

.reward-grid {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.reward-card {
  width: auto;
  margin: 0;
  text-align: left;
}

.reward-card h3 {
  margin: 8px 0 4px;
}

.reward-card .cost {
  font-weight: 800;
  color: var(--coral-deep);
}

.shop-sub {
  width: min(1040px, 100%);
  margin: 22px auto 10px;
}

.my-rewards {
  width: min(1040px, 100%);
  margin: 0 auto 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owned-chip {
  background: var(--cream);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.prize-card {
  width: min(440px, 100%);
}

.prize-name {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.8rem;
  margin: 8px 0 16px;
}

.prize-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.album-grid {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.album-thumb {
  appearance: none;
  border: 0;
  background: var(--cream);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}

.album-thumb img,
.album-card img {
  width: 100%;
  border-radius: 12px;
  display: block;
  background: #fff;
}

.album-thumb strong,
.album-thumb span {
  display: block;
  margin-top: 6px;
}

.album-card {
  width: min(520px, 100%);
}

.feed-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: min(58vh, 560px);
}

.feed-wrap .field-label {
  margin: 4px 0 0;
}

.feed-friend {
  appearance: none;
  border: 0;
  width: min(260px, 92%);
  min-height: 210px;
  padding: 18px 8px 28px;
  border-radius: 32px;
  background: linear-gradient(180deg, #fff, #f6ead6);
  box-shadow: var(--shadow);
  position: relative;
  cursor: default;
  display: grid;
  place-items: center;
}

.feed-face {
  font-size: clamp(5rem, 18vw, 7rem);
  display: block;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.feed-marks {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 1.4em;
  pointer-events: none;
}

.feed-mouth {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 52px;
  height: 28px;
  margin-left: -26px;
  border-radius: 50%;
  background: rgba(70, 28, 18, 0.42);
  box-shadow: inset 0 6px 0 rgba(30, 8, 8, 0.28);
  z-index: 2;
}

.feed-friend.hot .feed-mouth,
.feed-friend.eating .feed-mouth {
  transform: scale(1.25);
  background: rgba(232, 93, 76, 0.62);
}

.feed-bite {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%) scale(0);
  font-size: 1.7rem;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.feed-bite.show {
  animation: bite-in 0.45s ease forwards;
}

.feed-ghost {
  font-size: 2.6rem;
}

.feed-ghost.feeding {
  transition: left 0.28s ease, top 0.28s ease, transform 0.28s ease;
}

.feed-friend.sad .feed-face {
  animation: cry-shake 0.35s ease-in-out infinite;
}

.feed-friend.happy {
  background: linear-gradient(180deg, #e6f8ef, #fff8ee);
}

.feed-friend.happy .feed-face {
  animation: happy-bounce 0.45s ease;
}

.feed-friend.mad {
  background: linear-gradient(180deg, #ffd4c8, #fff8ee);
}

.feed-friend.mad .feed-face {
  animation: mad-stomp 0.28s ease-in-out 3;
  filter: saturate(1.3) contrast(1.08);
}

.feed-tears {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  letter-spacing: 1.2em;
  pointer-events: none;
}

.feed-ask {
  max-width: 520px;
  text-align: center;
  font-weight: 800;
  color: var(--ink-soft);
  margin: 0 12px;
}

.feed-foods {
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
}

.food-tile {
  display: grid;
  place-items: center;
  gap: 2px;
  height: auto;
  min-height: 92px;
  padding: 8px 6px;
  font-size: 2.2rem;
}

.food-tile strong {
  font-size: 0.78rem;
  line-height: 1.1;
}

@keyframes cry-shake {
  50% { transform: translateX(5px) rotate(-4deg); }
}

@keyframes mad-stomp {
  40% { transform: scale(1.08) rotate(-8deg); }
  80% { transform: scale(1.08) rotate(8deg); }
}

@keyframes happy-bounce {
  40% { transform: translateY(-8px) scale(1.06); }
}

@keyframes bite-in {
  0% { opacity: 1; transform: translateX(-50%) scale(0.9); }
  70% { opacity: 1; transform: translateX(-50%) scale(0.55); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.2); }
}

.puzzle-wrap {
  display: grid;
  gap: 12px;
}

.jig-guide-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 12px;
  background: var(--cream);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.jig-guide-row p {
  margin: 0;
  font-weight: 800;
}

.jig-thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 3px 0 var(--paper-deep);
}

.jig-frame {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
}

.jig-ghost-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
  pointer-events: none;
  border-radius: 16px;
}

.jig-board,
.jig-tray,
.cube-board {
  position: relative;
  display: grid;
  gap: 6px;
  max-width: 420px;
  margin: 0 auto;
}

.jig-slot,
.cube-tile,
.jig-piece {
  aspect-ratio: 1;
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.42);
  border: 2px dashed rgba(80, 50, 20, 0.28);
  overflow: hidden;
  padding: 0;
}

.jig-slot.filled,
.jig-piece.locked {
  border-style: solid;
  border-color: var(--mint);
}

.jig-piece {
  appearance: none;
  cursor: grab;
  box-shadow: 0 4px 0 var(--paper-deep);
  background: #fff;
}

.jig-piece.picked,
.piece.picked {
  outline: 4px solid var(--sun);
  transform: translateY(-3px);
}

.jig-piece canvas,
.cube-tile canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.jig-ghost {
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(50, 24, 10, 0.28);
}

.cube-tile {
  border-style: solid;
  cursor: pointer;
  background: #fff;
}

.cube-tile.empty {
  background: rgba(80, 50, 20, 0.12);
  cursor: default;
}

.map-stage {
  position: relative;
  height: min(46vh, 380px);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 30%, #7bc45a, transparent 36%),
    linear-gradient(#87d0f0 0 42%, #4eb3e3 42% 58%, #6db34d 58%);
}

.map-slot {
  position: absolute;
  width: 78px;
  min-height: 72px;
  margin-left: -39px;
  margin-top: -36px;
  border-radius: 18px;
  border: 3px dashed rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.42);
  display: grid;
  place-items: center;
  gap: 0;
  padding: 4px;
  font-size: 1.5rem;
  appearance: none;
  color: inherit;
}

.map-label {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.map-slot.filled {
  border-style: solid;
  background: #fff8ee;
}

.prize-card.cert {
  background:
    radial-gradient(circle at 12% 18%, #f3c04b55, transparent 28%),
    linear-gradient(#fffdf8, #f6ead6);
  border: 6px solid var(--sun-deep);
}

@media print {
  body * { visibility: hidden; }
  #prize, #prize * { visibility: visible; }
  #prize { position: static; background: white; }
}

.game-grid {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.game-grid.all-menu {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.game-grid.all-menu .game-card {
  padding: 6px 4px 5px;
  border-radius: 14px;
  border-bottom-width: 3px;
  box-shadow: var(--shadow);
}

.game-grid.all-menu .game-card .badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 1.1rem;
  margin-bottom: 3px;
}

.game-grid.all-menu .game-card h3 {
  font-size: 0.68rem;
  line-height: 1.15;
}

.subject-head {
  grid-column: 1 / -1;
  margin: 18px 0 0;
  font-size: 1.35rem;
}

.subject-head:first-child {
  margin-top: 4px;
}

.word-stage {
  max-width: 520px;
  margin: 0 auto 12px;
  background: var(--cream);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.word-pic {
  margin: 0;
  font-size: 5rem;
  line-height: 1;
}

.word-stage h3 {
  margin: 8px 0 0;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-width: 720px;
  margin: 12px auto 0;
}

.word-card {
  appearance: none;
  border: 0;
  border-radius: 18px;
  min-height: 120px;
  padding: 10px 8px;
  background: var(--cream);
  box-shadow: 0 6px 0 var(--paper-deep);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--ink);
}

.word-card .pic {
  font-size: 2.4rem;
  line-height: 1;
}

.word-card strong {
  font-size: 0.95rem;
}

.word-card .extra {
  font-size: 1.2rem;
}

.letter-card .pic.letter {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
}

.word-card.active {
  background: var(--sun);
  color: var(--on-sun);
  outline: 3px solid var(--ink);
}

.word-stage.number-mode {
  display: none;
}

.voice-picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.voice-picks.compact {
  width: min(1040px, 100%);
  margin: 0 auto 10px;
}

.voice-api-box {
  width: min(560px, 100%);
  margin: 0 auto 16px;
  padding: 12px 14px;
  background: var(--sun);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.voice-api-box .name-input {
  min-height: 48px;
  font-size: 1rem;
}

.voice-api-box .field-label {
  margin-top: 0;
}

.voice-pick {
  appearance: none;
  border: 0;
  border-radius: 16px;
  min-height: 64px;
  padding: 8px 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--paper-deep);
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--ink);
}

.voice-pick .icon {
  font-size: 1.5rem;
  line-height: 1;
}

.voice-pick.active {
  outline: 3px solid var(--ink);
  background: var(--sun);
  color: var(--on-sun);
}

.gender-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 14px;
}

.gender-pick {
  appearance: none;
  border: 0;
  border-radius: 16px;
  min-width: 88px;
  min-height: 64px;
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.78rem;
  box-shadow: 0 4px 0 var(--paper-deep);
}

.gender-pick .icon {
  font-size: 1.5rem;
  line-height: 1;
}

.gender-pick.active {
  outline: 3px solid var(--ink);
  background: var(--sun);
  color: var(--on-sun);
}

.look-card .gender-picks {
  justify-content: flex-start;
  margin: 0 0 12px;
}

.age-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 14px;
}

.age-pick {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 4px 0 var(--paper-deep);
  cursor: pointer;
}

.age-pick.active {
  background: var(--sun);
  color: var(--on-sun);
  outline: 3px solid var(--ink);
}

.age-tag {
  font-size: 0.75rem;
  opacity: 0.7;
}

.number-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0;
}

.number-big {
  appearance: none;
  border: 0;
  min-width: min(70vw, 280px);
  min-height: 88px;
  border-radius: 24px;
  background: var(--cream);
  color: var(--ink);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.num-step {
  appearance: none;
  border: 0;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--sun);
  color: var(--on-sun);
  font-size: 2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--sun-deep);
}

.number-words {
  text-align: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 12px;
  text-transform: lowercase;
}

.number-steps,
.number-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 10px;
}

.jump-chip {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 3px 0 var(--paper-deep);
  cursor: pointer;
}

.jump-chip.active {
  background: var(--sun);
  color: var(--on-sun);
}

.num-card .pic {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.4rem;
}

.story-scene {
  position: relative;
  max-width: 640px;
  min-height: 220px;
  margin: 0 auto 12px;
  border-radius: 28px;
  overflow: hidden;
  padding: 16px 16px 20px;
  box-shadow: var(--shadow);
}

.story-scene.fruit-scene {
  background: linear-gradient(180deg, #b8e8ff 0 42%, #8fd06a 42%);
}

.story-scene.safe-scene {
  background: linear-gradient(180deg, #ffe8c8 0 40%, #e8c090 40%);
}

.story-scene.snack-scene {
  background: linear-gradient(180deg, #fff0d0 0 40%, #f0c8a0 40%);
}

.story-scene.school-scene {
  background: linear-gradient(180deg, #d8ecff 0 42%, #d2c2a4 42%);
}

.story-scene.park-scene {
  background: linear-gradient(180deg, #b8e8ff 0 42%, #7ec86a 42%);
}

.story-scene.water-scene {
  background: linear-gradient(180deg, #9ad8f0 0 38%, #4a9fd4 38%);
}

.story-scene.night-scene {
  background: linear-gradient(180deg, #1a2848 0 55%, #2a3860 55%);
}

.story-scene.home-scene {
  background: linear-gradient(180deg, #ffe8d8 0 40%, #e8d0b8 40%);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.story-place {
  position: relative;
  z-index: 1;
}

.story-people {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.story-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 52px;
}

.story-item {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.story-item.pop-in {
  animation: story-pop 0.28s ease;
}

.story-item.incoming {
  opacity: 0;
  transform: translate(70px, -24px) scale(0.2);
}

.story-item.taken {
  animation: story-take 0.55s ease forwards;
  pointer-events: none;
}

.story-item.counted {
  transform: scale(1.18);
  filter: drop-shadow(0 0 6px #f3c04b);
}

.story-actor {
  position: absolute;
  right: -20%;
  bottom: 18px;
  font-size: 4rem;
  line-height: 1;
  transition: right 0.45s ease;
  z-index: 2;
}

.story-actor.in {
  right: 10px;
}

.story-line,
.story-count {
  text-align: center;
  font-weight: 800;
  margin: 0 12px 8px;
}

.story-line {
  appearance: none;
  display: block;
  width: calc(100% - 24px);
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  font-weight: 800;
  font-family: inherit;
  padding: 0;
}

.story-count {
  color: var(--ink-soft);
}

.read-passage {
  line-height: 1.75;
}

.read-word {
  border-radius: 7px;
  padding: 0 3px;
  cursor: pointer;
}

.read-word.read {
  background: rgba(243, 192, 75, 0.28);
}

.read-word.reading {
  background: var(--sun);
  color: var(--on-sun);
}

.read-word.say-now,
#book-word.say-now,
#word-text.say-now {
  outline: 3px solid var(--sun);
  background: #fff4c8;
}

.read-word.say-good,
#book-word.say-good,
#word-text.say-good {
  background: #c8f0d8;
  color: #1a7a4c;
}

.read-word.say-bad,
#book-word.say-bad,
#word-text.say-bad {
  background: #f8c8c4;
  color: #9a2f24;
}

.say-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.say-bar .hint-line {
  width: 100%;
  text-align: center;
  margin: 0;
}

.say-compare-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(59, 42, 28, 0.08);
}

.say-compare-panel.hidden {
  display: none;
}

.say-compare {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.say-compare-key {
  margin: 0;
  display: grid;
  gap: 6px;
}

.say-compare-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: start;
  padding: 6px 8px;
  border-radius: 12px;
  background: #eef2f5;
}

.say-compare-row dt {
  margin: 0;
  font-weight: 800;
  font-size: 0.74rem;
}

.say-compare-row dd {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #425466;
}

.say-compare-row.great {
  background: #e4f7ea;
}

.say-compare-row.great dd {
  color: #1a7a4c;
}

.say-compare-row.close {
  background: #fff6df;
}

.say-compare-row.close dd {
  color: #8a5a00;
}

.say-compare-row.try {
  background: #fdecea;
}

.say-compare-row.try dd {
  color: #9a2f24;
}

.say-compare-chip {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  background: #eef2f5;
  color: #425466;
}

.say-compare-chip.great {
  background: #c8f0d8;
  color: #1a7a4c;
}

.say-compare-chip.close {
  background: #fff0c8;
  color: #8a5a00;
}

.say-compare-chip.try {
  background: #f8d8d4;
  color: #9a2f24;
}

.say-wave {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.say-wave.hidden {
  display: none;
}

.say-wave-canvas {
  width: min(100%, 420px);
  height: 56px;
  display: block;
  border-radius: 18px;
}

.say-wave-label {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.say-wave[data-tone="quiet"] .say-wave-label {
  color: #8a6a12;
}

.say-wave[data-tone="good"] .say-wave-label {
  color: #1a7a4c;
}

.say-wave[data-tone="loud"] .say-wave-label {
  color: #0d6a3c;
}

.small-btn.listening {
  background: #4eb3e3;
  color: #fff;
}

.small-btn.muted {
  background: #c5cdd3;
  color: #445;
  cursor: default;
}

.speak-btn {
  appearance: none;
  width: 104px;
  height: 104px;
  border: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.08);
}

.speak-btn .speak-face {
  font-size: 2rem;
}

.speak-btn .speak-label {
  font-size: 0.85rem;
}

.say-countdown {
  width: 100%;
  text-align: center;
  margin: 0;
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 800;
  color: var(--sun);
  line-height: 1;
}

.say-countdown.hidden {
  display: none;
}

.speak-btn.countdown {
  background: var(--sun);
  color: #123;
  cursor: default;
}

.speak-btn.playback {
  background: #a97ad4;
  color: #fff;
  cursor: default;
  box-shadow: 0 0 0 10px rgba(169, 122, 212, 0.28);
}

.speak-btn.ready {
  background: var(--mint);
  color: #123;
}

.speak-btn.listening {
  background: #4eb3e3;
  color: #fff;
  box-shadow: 0 0 0 10px rgba(78, 179, 227, 0.28);
}

.speak-btn.muted {
  background: #c5cdd3;
  color: #445;
  cursor: default;
  box-shadow: none;
}

.speak-btn.hidden {
  display: none;
}

.write-out {
  margin: 8px 0 0;
  text-align: center;
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  min-height: 1.2em;
}

.write-pick {
  white-space: normal;
}

.story-next {
  appearance: none;
  display: block;
  margin: 8px auto 0;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  background: var(--sun);
  color: var(--on-sun);
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--sun-deep);
}

@keyframes story-pop {
  0% { transform: scale(0); }
  80% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes story-take {
  to {
    transform: translate(90px, -36px) scale(0.15);
    opacity: 0;
  }
}

.game-card {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-align: center;
  background: linear-gradient(180deg, var(--card-top), var(--cream));
  border-radius: 20px;
  padding: 12px 8px 10px;
  box-shadow: var(--shadow), 0 10px 0 rgba(80, 40, 16, 0.06);
  border-bottom: 4px solid var(--paper-deep);
  transition: transform 0.16s ease;
  transform-style: preserve-3d;
  min-height: 0;
}

.game-card:hover {
  transform: translateY(-6px) rotateX(6deg) rotateY(-5deg);
}

.game-card .rank {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--grape);
  border-radius: 999px;
  padding: 3px 8px;
}

.game-card .rank.easy { background: var(--mint); }
.game-card .rank.medium { background: var(--sky); }
.game-card .rank.hard { background: var(--coral); }

.level-bar {
  width: min(1040px, 100%);
  margin: 0 auto 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.level-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  font-weight: 800;
  cursor: pointer;
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.level-btn.active {
  background: var(--sun);
  color: var(--on-sun);
  box-shadow: 0 4px 0 var(--sun-deep);
}

.level-note {
  width: min(1040px, 100%);
  margin: 0 auto 16px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
}

.echo-grid,
.odd-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 420px;
  margin: 12px auto 0;
}

.echo-grid:has(.echo-pad:nth-child(5)) {
  grid-template-columns: repeat(3, 1fr);
}

.echo-pad,
.odd-cell {
  min-height: 92px;
  border: 0;
  border-radius: 22px;
  font-size: 2.2rem;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(80, 40, 20, 0.12);
  transform: rotateX(8deg);
}

.echo-pad.lit,
.odd-cell.caught {
  filter: brightness(1.35);
  transform: scale(0.96) rotateX(0);
}

.seq-line {
  text-align: center;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  margin: 18px 0;
}

.blank-wrap {
  display: grid;
  gap: 12px;
}

.prompt-pic {
  margin: 8px 0 0;
  text-align: center;
  font-size: 4rem;
}

.rhyme-prompt {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 2px;
}

.rhyme-prompt .prompt-pic {
  margin: 12px 0 0;
}

.rhyme-word {
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 800;
}

.blank-line,
.math-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 110px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
}

.blank-letter,
.math-num,
.math-op {
  min-width: 48px;
  text-align: center;
}

.math-sum.big-digits {
  font-size: clamp(1.15rem, 4.2vw, 2.1rem);
}

.blank-slot.math-wide {
  min-width: 148px;
}

.blank-slot {
  min-width: 76px;
  min-height: 76px;
  padding: 8px 14px;
  border: 4px dashed rgba(80, 50, 20, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}

.blank-slot.wide {
  min-width: 120px;
}

.blank-slot.filled {
  border-style: solid;
  border-color: var(--mint);
  background: #e6f8ef;
  color: var(--ink);
}

.choice-tile {
  min-width: 92px;
}

.rhyme-picks,
#rhyme-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

#rhyme-choices button,
.rhyme-pick {
  position: relative;
  width: auto;
  height: auto;
  min-width: 11ch;
  min-height: 5.5rem;
  padding: 1.15rem 1.7rem;
  border: 0;
  border-radius: 24px;
  background: #fff;
  font-family: inherit;
  font-size: clamp(1.6rem, 5.2vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--paper-deep);
  white-space: nowrap;
  overflow: visible;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.rhyme-pick.wrong {
  background: #fde8e6;
  box-shadow: 0 5px 0 #c44a3c;
  color: #9a2f24;
}

.rhyme-pick.right {
  background: #e6f8ef;
  box-shadow: 0 5px 0 var(--mint);
  color: #1a7a4c;
}

#write-picks .rhyme-pick,
.rhyme-pick.write-pick {
  width: min(100%, 22rem);
  min-width: 0;
  min-height: 4.2rem;
  padding: 0.85rem 1.1rem;
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.rhyme-mark {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  box-shadow: 0 2px 0 rgba(80, 50, 20, 0.18);
}

.rhyme-pick.wrong .rhyme-mark {
  background: #e85d4c;
}

.rhyme-pick.right .rhyme-mark {
  background: #5cbc8e;
}

.board-page {
  appearance: none;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(420px, 100%);
  margin: 8px auto 0;
  padding: 28px 20px 24px;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: inherit;
}

.board-page .word-pic {
  font-size: 6.5rem;
}

.abc-song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  max-width: 640px;
  margin: 8px auto 0;
}

.abc-note {
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--paper-deep);
  cursor: pointer;
}

.abc-note.active {
  background: var(--sun);
  color: var(--on-sun);
  transform: translateY(-3px);
}

.word-card.right-card {
  background: #e6f8ef;
  box-shadow: 0 6px 0 #5cbc8e;
}

.word-card.wrong-card {
  background: #fde8e6;
  box-shadow: 0 6px 0 #c44a3c;
}

.memory-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.game-card:active {
  transform: translateY(2px);
}

.game-card .badge {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  margin: 0 auto 8px;
}

.game-card h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 800;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--cream);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.25rem;
}

.icon-btn.back-arrow {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
  background: var(--sun);
  box-shadow: 0 5px 0 var(--sun-deep);
}

.stage-titles {
  flex: 1;
  min-width: 0;
}

.stage-titles p {
  margin: 0;
  color: var(--ink-soft);
}

.stage-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.game-root {
  width: min(1040px, 100%);
  margin: 0 auto;
  background: var(--cream);
  border-radius: 28px;
  min-height: min(68vh, 720px);
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative;
  overflow: auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chip,
.small-btn {
  appearance: none;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
}

.small-btn.primary {
  background: var(--mint);
  color: #123;
}

.small-btn.sun {
  background: var(--sun);
}

.hint-line {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.canvas-frame {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  touch-action: none;
  box-shadow: inset 0 0 0 3px rgba(80, 50, 20, 0.08);
}

.canvas-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.scratch-stack {
  position: relative;
}

.scratch-stack canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scratch-stack .base {
  position: relative;
}

.palette,
.brush-row,
.art-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.brush-row {
  margin: 8px 0 10px;
}

.art-tools {
  margin: 4px 0 10px;
}

.art-tool,
.art-size {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 3px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--paper-deep);
  font-weight: 800;
}

.art-tool {
  min-width: 72px;
  border-radius: 16px;
  padding: 8px 10px;
  font-size: 0.72rem;
}

.art-tool .icon {
  font-size: 1.45rem;
  line-height: 1;
}

.art-tool.active,
.art-size.active {
  background: var(--sun);
  color: var(--on-sun);
  outline: 3px solid var(--ink);
}

.art-size {
  min-width: 58px;
  min-height: 58px;
  border-radius: 16px;
  padding: 6px 8px;
  font-size: 0.68rem;
}

.art-size .dot {
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
}

.palette .swatch {
  appearance: none;
  width: auto;
  min-width: 46px;
  height: auto;
  border: 0;
  border-radius: 14px;
  padding: 4px 4px 3px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
}

.palette .swatch .dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(80, 50, 20, 0.15), 0 0 0 1px rgba(80, 50, 20, 0.12);
}

.palette .swatch .name {
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}

.palette .swatch.active {
  outline: 3px solid var(--ink);
  transform: scale(1.06);
  background: var(--cream);
}

.color-svg {
  width: min(100%, 460px);
  height: auto;
  display: block;
  margin: 8px auto 0;
  cursor: pointer;
}

.color-svg .region {
  stroke: #3b2a1c;
  stroke-width: 4;
  stroke-linejoin: round;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}

.mem-card {
  aspect-ratio: 1;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(160deg, #57b7e6, #3a8fc4);
  color: #fff;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  cursor: pointer;
  box-shadow: 0 5px 0 #2d6f99;
  transition: transform 0.15s ease;
}

.mem-card.face {
  background: #fff8ee;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--paper-deep);
}

.mem-card.matched {
  background: #d9f5e7;
  box-shadow: 0 5px 0 #8fd0b0;
}

.dots-wrap,
.maze-wrap,
.count-wrap,
.shape-wrap,
.sticker-wrap,
.trace-wrap {
  display: grid;
  gap: 12px;
}

.trace-cats,
.trace-items {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.trace-items {
  justify-content: flex-start;
  max-height: 118px;
  overflow: auto;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

.trace-cat,
.trace-item {
  appearance: none;
  border: 0;
  flex: 0 0 auto;
  min-width: 52px;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.trace-item {
  min-width: 50px;
  height: 50px;
  border-radius: 16px;
  font-size: 1.15rem;
}

.trace-cat.active,
.trace-item.active {
  background: var(--sun);
  box-shadow: 0 4px 0 var(--sun-deep);
}

.trace-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}

.trace-word {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.35rem;
}

.trace-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
  max-width: 720px;
  margin: 0 auto;
}

.trace-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mint);
  transition: width 0.15s ease;
}

.dpad {
  display: grid;
  grid-template-columns: 70px 70px 70px;
  grid-template-rows: 70px 70px 70px;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.dpad button {
  border: 0;
  border-radius: 18px;
  background: var(--sky);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #2f86b3;
}

.dpad .up { grid-column: 2; grid-row: 1; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 3; }

.scene {
  position: relative;
  height: min(52vh, 440px);
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(#8ec8f0, #d7f0ff 42%, #8fce6d 42%, #6db34d);
}

.scene.ocean {
  background: linear-gradient(#87d0f0, #2f88c4 55%, #1f6ea3);
}

.scene.space {
  background: radial-gradient(circle at 20% 20%, #fff 0 1px, transparent 2px),
    linear-gradient(#1b1144, #3b1d6e 50%, #120826);
}

.scene .placed {
  position: absolute;
  font-size: 2.2rem;
  user-select: none;
  pointer-events: none;
}

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

body.scratchbook-dragging {
  touch-action: none;
  overflow: hidden;
}

.sticker,
.piece,
.scene,
.tray,
.shape-board,
.puzzle-wrap,
.blank-wrap,
.feed-wrap .feed-foods {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.sticker {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  font-size: 1.8rem;
  cursor: grab;
  box-shadow: 0 4px 0 var(--paper-deep);
}

.sticker.ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.count-items {
  min-height: 180px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-content: center;
  font-size: 3rem;
}

.count-pic {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: inherit;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.num-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

.num-pad button {
  height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--grape);
  color: white;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
}

.num-pad button.wrong {
  background: var(--coral);
}

.num-pad button.right {
  background: var(--mint);
}

.shape-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  min-height: 180px;
}

.bin {
  width: 110px;
  height: 110px;
  border: 4px dashed rgba(80, 50, 20, 0.28);
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 3rem;
  background: rgba(255, 255, 255, 0.45);
}

.bin.filled {
  border-style: solid;
  border-color: var(--mint);
  background: #e6f8ef;
}

.pieces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.piece {
  width: 92px;
  height: 92px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  font-size: 3rem;
  cursor: grab;
  box-shadow: 0 5px 0 var(--paper-deep);
}

.piece.dragging,
.sticker.dragging {
  opacity: 0.35;
}

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(50, 24, 10, 0.35);
  display: grid;
  place-items: center;
  padding: 20px;
}

.settings-card {
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  text-align: left;
}

.settings-card h3 {
  text-align: center;
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0;
  font-weight: 700;
}

.tts-fields {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.tts-fields .field-label {
  margin: 0;
}

.celebrate-card {
  background: var(--cream);
  border-radius: 28px;
  padding: 28px 24px;
  text-align: center;
  width: min(380px, 100%);
  box-shadow: var(--shadow);
}

.celebrate-emoji {
  font-size: 4rem;
  margin: 0;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall 1.1s ease-out forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(320deg);
    opacity: 0.2;
  }
}

@media (max-width: 900px) {
  .screen {
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .cover-book {
    width: min(380px, 100%);
    margin: 4vh auto 0;
  }

  .book-3d {
    transform: rotateY(-6deg) rotateX(3deg);
  }

  .cover-front {
    padding: 28px 20px 22px;
  }

  .page-top,
  .stage-top {
    margin-bottom: 12px;
    gap: 8px;
  }

  .stage-titles h2,
  .page-top h2 {
    font-size: clamp(1.25rem, 5vw, 1.8rem);
  }

  .stage-titles p {
    font-size: 0.88rem;
  }

  .banks {
    gap: 6px;
  }

  .who-btn {
    padding: 6px 10px 6px 6px;
    font-size: 0.95rem;
  }

  #who-name {
    max-width: 8ch;
  }

  .star-bank.compact {
    padding: 6px 8px;
    font-size: 0.9rem;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.15rem;
  }

  .icon-btn.back-arrow {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 1.8rem;
  }

  .level-btn {
    padding: 8px 12px;
    font-size: 0.92rem;
  }

  .level-note {
    margin-bottom: 12px;
    font-size: 0.88rem;
  }

  .game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .game-grid.all-menu {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .game-card {
    padding: 10px 6px 8px;
    border-radius: 16px;
    border-bottom-width: 3px;
  }

  .game-card .badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 1.35rem;
    margin-bottom: 6px;
  }

  .game-card h3 {
    font-size: 0.82rem;
  }

  .subject-head {
    font-size: 1.15rem;
    margin-top: 14px;
  }

  .reward-grid,
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .account-card,
  .profile-card,
  .reward-card {
    padding: 16px;
    border-radius: 20px;
  }

  .look-card {
    width: min(820px, calc(100vw - 32px));
    max-height: min(90dvh, 860px);
  }

  .look-card .theme-picks.compact {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .look-actions {
    gap: 8px;
  }

  .look-actions .big-btn,
  .look-actions .small-btn {
    flex: 1 1 140px;
  }

  .game-root {
    min-height: min(62vh, 640px);
    padding: 12px;
    border-radius: 20px;
  }

  .chip,
  .small-btn {
    min-height: 44px;
    padding: 8px 14px;
  }

  .celebrate {
    padding: 12px;
  }

  .celebrate-card {
    width: min(380px, 100%);
    padding: 22px 16px;
  }

  .settings-card {
    width: min(520px, 100%);
    max-height: min(88dvh, 760px);
  }
}

@media (max-width: 640px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .game-grid.all-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .game-card {
    padding: 8px 4px 7px;
  }

  .game-card .badge {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }

  .game-card h3 {
    font-size: 0.76rem;
    line-height: 1.15;
  }

  .cover-book {
    width: 100%;
    margin-top: 2vh;
  }

  .book-3d {
    transform: none;
    animation: none;
  }

  .cover-spine {
    width: 14px;
  }

  .cover-front {
    padding: 24px 16px 18px;
    border-radius: 0 20px 20px 0;
  }

  .cover-front h1 {
    font-size: clamp(2rem, 10vw, 2.6rem);
  }

  .cover-sub {
    font-size: 0.95rem;
  }

  .fox-3d {
    width: 96px;
    height: 88px;
    margin: 10px auto 6px;
  }

  .big-btn {
    width: 100%;
    max-width: 320px;
    font-size: 1.05rem;
    padding: 12px 20px;
  }

  .ghost-btn {
    width: 100%;
    max-width: 320px;
  }

  .page-top {
    align-items: stretch;
  }

  .banks {
    margin-left: auto;
  }

  .contents-intro h2 {
    font-size: clamp(1.35rem, 6vw, 1.7rem);
  }

  .reward-grid,
  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .theme-picks,
  .theme-picks.compact,
  .look-card .theme-picks.compact,
  .voice-picks {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .theme-pick,
  .look-card .theme-pick {
    min-height: 52px;
    font-size: 0.62rem;
  }

  .avatar-pick {
    width: 48px;
    height: 48px;
  }

  .profile-chip {
    min-width: 0;
    flex: 1 1 140px;
    padding: 10px 12px;
  }

  .tts-pick-row {
    flex-wrap: wrap;
  }

  .tts-pick-row .small-btn {
    flex: 1 1 auto;
  }

  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .num-pad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .echo-grid,
  .odd-grid {
    max-width: 100%;
    gap: 8px;
  }

  .echo-pad,
  .odd-cell {
    min-height: 72px;
    font-size: 1.8rem;
  }

  .word-card .pic {
    font-size: 1.8rem;
  }
}

@media (max-width: 400px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .game-grid.all-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .level-btn {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .star-bank.compact strong {
    font-size: 0.85rem;
  }
}

@media (min-width: 901px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
  }

  .game-grid.all-menu {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }
}

.pick-app-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.pick-app-card {
  text-align: center;
}

.pick-app-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin: 18px 0 8px;
}

a.pick-app-btn {
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  max-width: 320px;
  width: 100%;
}

.pick-app-ages {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.92;
  margin-top: 4px;
}

.pick-app-btn-big {
  background: linear-gradient(180deg, #5cbcf0, #4eb3e3);
}

.graduate-banner {
  width: min(640px, 100%);
  margin: 0 auto 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  text-align: center;
}

.graduate-banner.hidden {
  display: none;
}

.graduate-banner .hint-line {
  margin: 6px 0 10px;
}

a.ghost-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.app-little .game-grid.all-menu {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 720px) {
  body.app-little .game-grid.all-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (hover: none) {
  .game-card:hover,
  .big-btn:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .big-btn,
  .game-card,
  .confetti,
  .book-3d,
  .fox-3d,
  .orb,
  .float-toy,
  .story-item,
  .story-actor {
    transition: none;
    animation: none;
  }
}
