/* Little Learners — early years, ages 2–5. Touch-first, no trackers. */
:root {
  --sky: #dff3ff;
  --sky-deep: #bfe6ff;
  --paper: #fffaf1;
  --ink: #2a2748;
  --muted: #5c5678;
  --coral: #ff6b6b;
  --sun: #ffd166;
  --leaf: #3dba74;
  --aqua: #3ec6c6;
  --grape: #7b5cdb;
  --pink: #ff7eb6;
  --orange: #ff9f43;
  --brown: #b07d4f;
  --white: #ffffff;
  --black: #2a2748;
  --shadow: 0 10px 24px rgba(42, 39, 72, 0.12);
  --radius: 28px;
  --btn: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 8%, #fff 0 18px, transparent 19px),
    radial-gradient(circle at 88% 12%, #ffe8a3 0 14px, transparent 15px),
    radial-gradient(circle at 80% 92%, #ffd0e6 0 22px, transparent 23px),
    linear-gradient(180deg, var(--sky) 0%, #cfefff 40%, #e7fff2 100%);
  color: var(--ink);
  font-family: ui-rounded, "Nunito", "Avenir Next", "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}
body { padding: calc(12px + var(--safe-top)) 12px calc(16px + var(--safe-bottom)); }
button, a.btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  text-decoration: none;
}
button:focus-visible, a:focus-visible { outline: 4px solid var(--grape); outline-offset: 3px; }

.wrap { max-width: 880px; margin: 0 auto; }
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.top.is-sticky {
  position: sticky;
  top: 0;
  z-index: 25;
  margin: -12px -12px 12px;
  padding: 10px 12px calc(10px + 2px);
  background: rgba(223, 243, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-height: var(--btn);
  flex: 1;
  min-width: 0;
}
.logo-mark {
  width: 56px; height: 56px; flex: 0 0 56px;
  border-radius: 18px;
  background: var(--sun);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  font-size: 32px;
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 5.5vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.brand p { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.icon-btn {
  width: var(--btn);
  height: var(--btn);
  min-width: var(--btn);
  min-height: var(--btn);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  font-size: 28px;
  touch-action: manipulation;
  color: inherit;
}
.icon-btn[aria-pressed="true"] { background: #eee6ff; }
.nav-home {
  width: auto;
  min-width: var(--btn);
  padding: 4px 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 26px;
  line-height: 1;
}
.nav-home .nav-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  margin: 0 0 12px;
  min-height: 72px;
}
.prompt button.speak {
  width: var(--btn); height: var(--btn); min-width: var(--btn);
  border-radius: 20px;
  background: #fff3c4;
  font-size: 28px;
  touch-action: manipulation;
}
.prompt .words {
  flex: 1;
  font-size: clamp(1.25rem, 5.2vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
}

.grid-games {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.game-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 16px 10px;
  border-radius: 28px;
  background: var(--white);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  touch-action: manipulation;
  transition: transform 0.12s ease;
}
.game-tile:active { transform: scale(0.97); }
.game-tile .emoji { font-size: 56px; line-height: 1; }
.game-tile .name { font-size: 1.15rem; font-weight: 800; text-align: center; }
.game-tile[data-i="0"] { background: #ffe8e8; }
.game-tile[data-i="1"] { background: #fff3c4; }
.game-tile[data-i="2"] { background: #e4f8ea; }
.game-tile[data-i="3"] { background: #e7eeff; }
.game-tile[data-i="4"] { background: #ffe6f3; }
.game-tile[data-i="5"] { background: #e6fbff; }

.stage {
  background: var(--paper);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 12px;
  min-height: 320px;
}
body[data-game="colouring"] .stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px 10px 10px;
}
body[data-game="colouring"] .prompt { min-height: 64px; padding: 8px 10px; margin-bottom: 8px; }
body[data-game="colouring"] .thumbs { margin-bottom: 4px; }
body[data-game="colouring"] .tools { flex-wrap: nowrap; gap: 6px; }
body[data-game="colouring"] .tool.done { min-width: 88px; padding: 0 10px; font-size: 1.05rem; }
body[data-game="colouring"] .palette { margin-top: 8px; gap: 6px; }
body[data-game="colouring"] .swatch { width: 56px; height: 56px; }

.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.swatch, .num-btn, .choice, .shape-btn, .card, .shadow-choice, .pic-thumb, .tool, .pic-nav {
  min-width: 56px;
  min-height: 56px;
  border-radius: 20px;
  touch-action: manipulation;
  box-shadow: 0 6px 0 rgba(42, 39, 72, 0.12);
}
.swatch {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: 0 4px 0 rgba(42, 39, 72, 0.18);
}
.swatch[aria-pressed="true"] { transform: scale(1.1); box-shadow: 0 0 0 5px var(--ink); }

.thumbs {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}
.thumbs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  flex: 1;
  min-width: 0;
  padding: 4px 2px 8px;
}
.pic-thumb {
  width: 56px; height: 56px;
  flex: 0 0 56px;
  background: #fff;
  font-size: 28px;
  display: grid; place-items: center;
  scroll-snap-align: start;
}
.pic-thumb[aria-current="true"] { box-shadow: 0 0 0 4px var(--grape); }
.pic-nav {
  width: 56px; height: 56px;
  flex: 0 0 56px;
  background: #fff;
  font-size: 28px;
  font-weight: 800;
  display: grid; place-items: center;
  border-radius: 18px;
}

.picture-wrap { display: grid; place-items: center; min-height: 220px; flex: 1; }
.pic-frame {
  position: relative;
  width: min(100%, 560px);
}
.pic-frame svg.pic,
.picture-wrap svg {
  width: 100%;
  height: auto;
  max-height: min(36vh, 420px);
  display: block;
  touch-action: manipulation;
}
.pic-frame canvas.paint-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  pointer-events: none;
}
.pic-frame.is-paint canvas.paint-layer { pointer-events: auto; cursor: crosshair; }

.fillable {
  cursor: pointer;
  stroke: #2a2748;
  stroke-width: 7;
  stroke-linejoin: round;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 0.08s ease;
}
.fillable.is-pop { animation: fill-pop 0.32s ease; }

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}
.tool {
  width: 56px;
  height: 56px;
  background: #fff;
  font-size: 26px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--ink);
}
.tool.is-on { box-shadow: 0 0 0 4px var(--ink); background: #fff3c4; }
.tool.done {
  width: auto;
  min-width: 108px;
  padding: 0 16px;
  background: var(--leaf);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 6px 0 #2a8a52;
}
.tool.done:active { transform: translateY(3px); box-shadow: 0 3px 0 #2a8a52; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
a.btn.big, .big {
  min-width: 160px;
  min-height: var(--btn);
  padding: 12px 22px;
  border-radius: 24px;
  background: var(--leaf);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 6px 0 #2a8a52;
  touch-action: manipulation;
}
a.btn.big.secondary, .big.secondary { background: var(--grape); box-shadow: 0 6px 0 #5a3db0; }
a.btn.big.ghost, .big.ghost { background: #fff; color: var(--ink); box-shadow: 0 6px 0 #d9d3c6; }
.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #2a8a52; }
a.btn.big.secondary:active, .big.secondary:active { box-shadow: 0 3px 0 #5a3db0; }
a.btn.big.ghost:active, .big.ghost:active { box-shadow: 0 3px 0 #d9d3c6; }

.board { display: grid; gap: 12px; justify-content: center; }
.board.cards { grid-template-columns: repeat(4, minmax(72px, 1fr)); max-width: 560px; margin: 0 auto; }
.card {
  aspect-ratio: 1;
  width: 100%;
  background: linear-gradient(180deg, #7b5cdb, #5b3cc0);
  color: #fff;
  font-size: 48px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  position: relative;
  transform-style: preserve-3d;
}
.card .face { display: none; }
.card.is-up, .card.is-match { background: #fff; color: var(--ink); }
.card.is-up .face, .card.is-match .face { display: block; }
.card.is-up .back, .card.is-match .back { display: none; }
.card.is-match { box-shadow: 0 0 0 4px var(--leaf); }
.card .back { font-size: 36px; }

.shapes-play, .shadows-play {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 6px 0;
}
.tray, .targets { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.shape-btn, .shadow-choice, .choice {
  width: 110px; height: 110px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 8px;
}
.shape-btn svg, .shadow-choice svg, .choice svg, .pic-thumb svg { width: 86px; height: 86px; }
.shape-btn.is-picked, .choice.is-picked { box-shadow: 0 0 0 5px var(--grape); }
.target-slot {
  width: 112px; height: 112px;
  min-width: 72px; min-height: 72px;
  border: 4px dashed #9aa0c3;
  border-radius: 22px;
  background: rgba(255,255,255,0.6);
  display: grid; place-items: center;
  touch-action: manipulation;
}
.target-slot svg { width: 86px; height: 86px; }
.target-slot.is-filled { border-style: solid; border-color: var(--leaf); background: #fff; }
.target-slot.is-wrong { animation: wiggle 0.4s ease; }

.shadows-play .hero-pic {
  width: 180px;
  height: 180px;
  min-width: 180px;
  min-height: 180px;
  border-radius: 32px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 0 rgba(42, 39, 72, 0.12);
  padding: 12px;
}
.shadows-play .hero-pic svg { width: 150px; height: 150px; }
.shadow-choice { width: 120px; height: 120px; }
.shadow-choice svg { width: 96px; height: 96px; }

.colour-choices { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 16px 0; }
.colour-choices .choice { width: 140px; height: 140px; border-radius: 32px; background: #fff; }
.choice .blob { width: 100px; height: 100px; border-radius: 50%; box-shadow: inset 0 -8px 0 rgba(0,0,0,0.12); }

.objects { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 12px 0 18px; min-height: 160px; align-items: center; }
.objects span { font-size: 64px; line-height: 1; }
.nums { display: grid; grid-template-columns: repeat(3, minmax(72px, 1fr)); gap: 12px; max-width: 440px; margin: 0 auto; }
.nums .num-btn:last-child { grid-column: 2; }
.num-btn {
  background: #fff;
  font-size: 2rem;
  font-weight: 800;
  border-radius: 22px;
  min-height: 72px;
}
.num-btn.is-wrong { animation: wiggle 0.4s ease; background: #ffe0e0; }

.parent {
  margin: 18px 8px 8px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.parent strong { color: var(--ink); }
.fine { margin: 8px; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.fine a { color: var(--grape); font-weight: 700; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 39, 72, 0.45);
  display: none;
  place-items: center;
  padding: 16px;
  z-index: 40;
}
.overlay.is-on { display: grid; }
.panel {
  background: var(--paper);
  border-radius: 32px;
  padding: 24px 18px 20px;
  width: min(440px, 100%);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}
.panel h2 { margin: 8px 0 6px; font-size: 2rem; }
.panel .actions { flex-direction: column; align-items: stretch; margin-top: 18px; }
.panel .actions .big { width: 100%; }
.stars { font-size: 52px; letter-spacing: 6px; animation: pop 0.5s ease; }
.sticker {
  position: absolute;
  font-size: 42px;
  animation: float-in 0.6s ease both;
  pointer-events: none;
}
#fx {
  position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden;
}
#fx .star {
  position: absolute;
  font-size: 28px;
  animation: burst 0.9s ease-out forwards;
}

@keyframes burst {
  0% { transform: translate(0,0) scale(0.4) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(140deg); opacity: 0; }
}
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }
@keyframes float-in { from { transform: translateY(20px) scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
@keyframes fill-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

@media (min-width: 720px) {
  .grid-games { grid-template-columns: repeat(3, 1fr); }
  .game-tile { min-height: 180px; }
  .board.cards { grid-template-columns: repeat(4, 120px); }
  .swatch { width: 68px; height: 68px; }
  .logo-mark { width: 64px; height: 64px; flex-basis: 64px; font-size: 36px; }
}
@media (max-width: 420px) {
  .board.cards { grid-template-columns: repeat(3, minmax(88px, 1fr)); }
  .nums { grid-template-columns: repeat(3, minmax(72px, 1fr)); }
  .shape-btn, .target-slot { width: 104px; height: 104px; }
  .shadow-choice { width: 108px; height: 108px; }
  .colour-choices .choice { width: 128px; height: 128px; }
  .choice .blob { width: 92px; height: 92px; }
  .objects span { font-size: 58px; }
  .pic-frame svg.pic { max-height: min(34vh, 300px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@page { margin: 12mm; }
@media print {
  body { background: #fff; padding: 0; }
  .top .icon-btn, .actions, .palette, .thumbs, .tools, .parent, .fine, .overlay, #fx, .prompt button { display: none !important; }
  .stage, .prompt, .picture-wrap { box-shadow: none; background: #fff; }
  .picture-wrap svg, .pic-frame svg { width: 100%; }
}
