/* ==========================================================================
   Little Explorers (ages 4-6): big, bright, no reading required
   ========================================================================== */
body.little-page {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.65) 0 50px, transparent 51px),
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.55) 0 44px, transparent 45px),
    linear-gradient(180deg, #ffe58a, #ffc7dd);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.little-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  padding-top: max(0.6rem, env(safe-area-inset-top));
}
.big-icon {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  font-size: 1.8rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.big-icon:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.stars { flex: 1; text-align: center; font-size: 2rem; letter-spacing: 0.15em; color: #c9b27a; }
.stars .on { display: inline-block; animation: pop 0.5s ease; }
.char-pick { display: flex; gap: 0.4rem; }
.char-btn {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.7rem;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #fff;
  cursor: pointer;
}
.char-btn[aria-pressed='true'] { background: var(--yellow); box-shadow: 0 0 0 4px #fff; }

/* Start + finish screens */
.intro { text-align: center; padding: 2rem 1rem; }
.intro h1 { font-size: clamp(2.6rem, 9vw, 4rem); margin-bottom: 0.2em; }
.intro p { font-size: 1.4rem; font-weight: 800; margin: 0.4rem 0 1.4rem; }
.play-btn { font-size: 2.2rem; padding: 0.6em 1.6em 0.5em; animation: breathe 1.8s ease-in-out infinite; }
.grownup-tip { font-size: 1rem !important; font-weight: 700 !important; color: var(--ink-soft); }
.trophy { font-size: 6rem; animation: bob 2s ease-in-out infinite; }
.finish-stars { font-size: 3.5rem !important; }
.finish-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------------- Finger Math ---------------- */
.math-game {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem 1.5rem;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
}
.stage-box {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 8px 0 rgba(43, 29, 92, 0.2);
  padding: 0.4rem;
}
.stage-svg { display: block; width: 100%; height: auto; max-height: 46vh; margin: 0 auto; overflow: visible; }
.stage-svg .finger { cursor: pointer; }
.stage-svg .finger rect:first-child { transition: fill 0.2s; }
.stage-svg .finger.counted rect:first-child { fill: #b9f3c9; }
.stage-svg .hand-label circle { stroke: var(--ink); stroke-width: 4; }
.stage-svg .hand-label.left circle { fill: var(--purple); }
.stage-svg .hand-label.right circle { fill: var(--teal); }
.stage-svg .hand-label text, .stage-svg .badge text {
  fill: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  text-anchor: middle;
}
.stage-svg .badge circle { fill: var(--coral); stroke: #fff; stroke-width: 3; }
.stage-svg .badge text { font-size: 18px; }
.stage-svg .badge { animation: pop 0.35s ease; transform-box: fill-box; transform-origin: center; }
.stage-svg .eyes { animation: blink 4s infinite; transform-box: fill-box; transform-origin: center; }
.stage-svg .character.jump { animation: jump 0.55s ease 2; transform-box: view-box; }

.equation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 10vw, 4rem);
  line-height: 1;
}
.eq-num {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.4em;
  padding: 0.12em 0.2em 0;
  border: 4px solid var(--ink);
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 5px 0 var(--ink);
}
.eq-num.left { background: var(--purple); }
.eq-num.right { background: var(--teal); }
.eq-num.answer { background: #fff; color: var(--ink); }
.eq-num.answer.solved { background: var(--green); color: #fff; animation: pop 0.5s ease; }
.eq-op { color: var(--ink); }

.feedback { min-height: 1.6em; margin: 0; font-size: 1.35rem; font-weight: 800; text-align: center; }

.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; width: 100%; max-width: 560px; }
.choice {
  font-family: var(--font-display);
  background: #fff;
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 0.4rem 0.2rem 0.5rem;
  cursor: pointer;
  display: grid;
  justify-items: center;
}
.choice b { font-size: 3rem; line-height: 1.1; }
.choice .dots { font-size: 0.95rem; color: var(--coral); letter-spacing: 0.08em; max-width: 6.5em; line-height: 1.1; word-break: break-all; }
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.choice.right { background: var(--green); color: #fff; animation: pop 0.5s ease; }
.choice.right .dots { color: #fff; }
.choice.wrong { animation: shake 0.45s ease; opacity: 0.4; }

.helpers { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.task-num { font-weight: 800; color: var(--ink-soft); }
.next-btn { font-size: 2rem; animation: breathe 1.5s ease-in-out infinite; }

/* Tablets in landscape: picture on the left, question on the right */
@media (min-width: 820px) and (orientation: landscape) {
  .math-game {
    grid-template-columns: 1.1fr 1fr;
    grid-template-areas: 'stage eq' 'stage feedback' 'stage choices' 'stage helpers' 'stage next';
    align-items: center;
  }
  .math-game .stage-box { grid-area: stage; }
  .math-game .stage-svg { max-height: 72vh; }
  .math-game .equation { grid-area: eq; }
  .math-game .feedback { grid-area: feedback; }
  .math-game .choices { grid-area: choices; }
  .math-game .helpers { grid-area: helpers; }
  .math-game .next-btn { grid-area: next; }
}

/* ---------------- Confetti + animations ---------------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 100; }
.confetti-layer i {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  animation-name: fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes fall { to { top: 110%; transform: rotate(720deg) translateX(40px); } }
@keyframes pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }

/* ---------------- Color Fun ---------------- */
.picture-pick { flex: 1; display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; }
.pic-btn {
  width: 3.3rem;
  height: 3.3rem;
  font-size: 1.8rem;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.pic-btn[aria-pressed='true'] { background: var(--yellow); transform: translateY(-3px) scale(1.06); }

.paint-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.3rem 1rem 1.5rem;
  display: grid;
  gap: 1rem;
}
.canvas-box {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 8px 0 rgba(43, 29, 92, 0.2);
  padding: 0.5rem;
}
#canvas { display: block; width: 100%; height: auto; max-height: 60vh; touch-action: manipulation; }
#canvas .f { cursor: pointer; transition: fill 0.15s; }
#canvas .f.splash { animation: splash 0.35s ease; transform-box: fill-box; transform-origin: center; }
@keyframes splash { 50% { transform: scale(1.06); } }

.paint-tools { display: grid; gap: 0.8rem; }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem; }
.swatch {
  aspect-ratio: 1;
  min-width: 44px;
  border-radius: 50%;
  border: 4px solid var(--ink);
  background: var(--c);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.1s;
}
.swatch[aria-checked='true'] { transform: scale(1.15); box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--ink); }
.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.tool {
  font-size: 2rem;
  padding: 0.35rem 0;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.tool:active, .swatch:active, .pic-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tool[aria-pressed='true'] { background: linear-gradient(90deg, #ff9a9a, #ffe08a, #9af0b0, #9ad4ff, #d3a9ff); }
.tool-new { display: flex; align-items: center; justify-content: center; gap: 0.2rem; font-size: 1.6rem; background: var(--yellow); }
.tool-new span { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.tool.nudge { animation: breathe 1.2s ease-in-out infinite; box-shadow: 0 0 0 5px #fff, 0 4px 0 var(--ink); }

@media (min-width: 820px) and (orientation: landscape) {
  .paint-layout { grid-template-columns: 1fr 300px; align-items: start; }
  #canvas { max-height: 78vh; }
  .palette { grid-template-columns: repeat(3, 1fr); }
  .tool-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Little Explorers home ---------------- */
.little-home { max-width: 980px; margin: 0 auto; padding: 0.5rem 1rem 2rem; text-align: center; }
.little-home h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); margin-bottom: 0.1em; }
.little-home .sub { font-size: 1.3rem; font-weight: 800; margin: 0 0 1.5rem; }
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.activity {
  display: block;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 1.4rem 1rem 1.2rem;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s;
}
.activity:hover { transform: translateY(-4px) rotate(-1deg); }
.activity:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--ink); }
.activity .art { font-size: 3.6rem; line-height: 1.1; }
.group-title { font-size: 1.6rem; margin: 1.4rem 0 0.7rem; text-align: left; }
.activity h2 { font-size: 2rem; margin: 0.3rem 0 0.2rem; }
.activity p { margin: 0; font-weight: 700; color: var(--ink-soft); }
.grownups-box { margin-top: 2rem; display: flex; gap: 1.2rem; align-items: center; text-align: left; padding: 1rem 1.2rem; }
.grownups-box img, .grownups-box .qr-box { width: 130px; height: 130px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; flex: 0 0 auto; overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.grownups-box h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.grownups-box ul { margin: 0; padding-left: 1.1rem; line-height: 1.5; }
@media (max-width: 560px) { .grownups-box { flex-direction: column; text-align: center; } .grownups-box ul { text-align: left; } }
