/* ==========================================================================
   AURORA'S SUMMER ADVENTURE — STYLESHEET
   A magical, cosy, game-like interface for a 6-year-old learning explorer.

   DESIGN SYSTEM
   Colour   : Sky #BFE8FF -> Dawn Lilac #F1E3FF (background), Sun Gold #FFC94A
              (primary/CTA), Petal Pink #FF9EC4 (secondary/heart accents),
              Meadow Mint #7FE0C0 (success), Plum Ink #4A3F6B (text).
   Type     : one rounded, friendly system font stack used for everything —
              display vs body vs label roles are carried by weight, size,
              spacing and a soft "sticker" text-shadow, not by mixing
              families (keeps the app 100% offline-safe, no web fonts).
   Signature: the "Adventure Path" — a dotted trail with little paw/footprints
              that appears mini on Home, full-size linking quest cards on
              Today's Adventure, and stretched across the whole summer on
              the Treasure Map. One motif, three scales.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Palette */
  --sky: #BFE8FF;
  --sky-deep: #9ED8FF;
  --dawn-lilac: #F1E3FF;
  --sun-gold: #FFC94A;
  --sun-gold-deep: #FFB020;
  --petal-pink: #FF9EC4;
  --petal-pink-deep: #FF6FAE;
  --meadow-mint: #7FE0C0;
  --meadow-mint-deep: #4FCBA3;
  --lilac-deep: #C6A8FF;
  --plum-ink: #4A3F6B;
  --plum-ink-soft: #6E6291;
  --card-white: #FFFDF9;
  --card-white-soft: #FFF6EA;
  --amber-soft: #FFE7B0;
  --shadow-color: 260 40% 40%;

  /* Radii */
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-pill: 999px;

  /* Spacing */
  --sp-1: 0.4rem;
  --sp-2: 0.8rem;
  --sp-3: 1.2rem;
  --sp-4: 1.8rem;
  --sp-5: 2.6rem;

  /* Type */
  --font-main: ui-rounded, "Segoe UI Rounded", "SF Pro Rounded", "Baloo 2",
               "Comic Sans MS", "Trebuchet MS", "Verdana", sans-serif;

  /* Motion */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--plum-ink);
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 28%, var(--dawn-lilac) 68%, #FBEFFF 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  font-size: 18px;
  line-height: 1.5;
}
h1, h2, h3, p, ul, figure { margin: 0; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }
textarea, input { font-family: inherit; }

/* Skip link (keyboard accessibility) */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--plum-ink); color: #fff; padding: 0.8rem 1.2rem;
  border-radius: 0 0 var(--r-sm) 0; z-index: 999;
}
.skip-link:focus { left: 0; }

/* Visible focus ring everywhere (accessibility) */
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--plum-ink);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* The `hidden` attribute must always win, even over classes that set their
   own `display` (e.g. .celebration-overlay, .btn-cta-huge, .parent-panel
   all use display:flex, which — being an author rule — would otherwise beat
   the browser's default [hidden]{display:none} user-agent rule). */
[hidden] { display: none !important; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   AMBIENT SKY BACKGROUND (decorative, aria-hidden)
   ========================================================================== */
.sky-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.star-layer { position: absolute; inset: 0; }
.twinkle {
  position: absolute;
  color: #fff;
  text-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: twinkle 3.4s ease-in-out infinite;
  font-size: 1.1rem;
}
.t1 { top: 6%;  left: 10%; animation-delay: 0s; }
.t2 { top: 12%; left: 82%; animation-delay: .6s; font-size: 0.8rem; }
.t3 { top: 20%; left: 45%; animation-delay: 1.1s; }
.t4 { top: 4%;  left: 60%; animation-delay: 1.6s; font-size: 0.7rem; }
.t5 { top: 28%; left: 20%; animation-delay: 2.0s; font-size: 0.8rem; }
.t6 { top: 9%;  left: 30%; animation-delay: .3s; font-size: 0.7rem; }
.t7 { top: 24%; left: 70%; animation-delay: 1.4s; }
.t8 { top: 16%; left: 92%; animation-delay: 2.3s; font-size: 0.7rem; }
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

.cloud {
  position: absolute;
  font-size: 3rem;
  opacity: 0.85;
  filter: drop-shadow(0 6px 8px rgba(120,140,180,0.25));
  animation: driftCloud linear infinite;
}
.cloud-1 { top: 8%;  font-size: 3.6rem; animation-duration: 62s; }
.cloud-2 { top: 18%; font-size: 2.4rem; animation-duration: 48s; animation-delay: -12s; }
.cloud-3 { top: 5%;  font-size: 2.8rem; animation-duration: 75s; animation-delay: -30s; }
.cloud-4 { top: 26%; font-size: 2rem;   animation-duration: 54s; animation-delay: -6s; }
@keyframes driftCloud {
  from { transform: translateX(-15vw); }
  to   { transform: translateX(115vw); }
}

.rainbow-arc {
  position: absolute;
  bottom: 8%;
  left: 50%;
  width: 140vw;
  max-width: 900px;
  transform: translateX(-50%);
  opacity: 0.9;
}

.butterfly {
  position: absolute;
  font-size: 1.6rem;
  animation: flutter 9s ease-in-out infinite;
}
.b1 { top: 34%; left: 15%; animation-duration: 10s; }
.b2 { top: 40%; left: 78%; animation-duration: 12s; animation-delay: -4s; }
@keyframes flutter {
  0%   { transform: translate(0,0) rotate(0deg); }
  25%  { transform: translate(30px,-18px) rotate(8deg); }
  50%  { transform: translate(60px,4px) rotate(-6deg); }
  75%  { transform: translate(28px,20px) rotate(4deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}

.meadow-hill {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 12vh;
  min-height: 90px;
}
.flower {
  position: absolute;
  bottom: 1%;
  font-size: 1.6rem;
  animation: swayFlower 5s ease-in-out infinite;
}
.f1 { left: 6%;  animation-delay: 0s; }
.f2 { left: 22%; animation-delay: .8s; font-size: 1.3rem; }
.f3 { right: 18%; animation-delay: .4s; }
.f4 { right: 5%; animation-delay: 1.2s; font-size: 1.4rem; }
@keyframes swayFlower {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

/* ---------- Screen "mood": how much ambient decoration shows ---------- */
/* mood-full (Home, Stickers, Treasure Map, Sight Words, Stats, Onboarding):
   the full magical scene, unchanged. */

/* mood-calm (every learning task): keep gentle clouds & stars for atmosphere,
   but remove the two most eye-catching, motion-heavy elements (the rainbow
   arc and the flitting butterflies) so they don't compete with a question
   card while a child is concentrating. */
body.mood-calm .rainbow-arc { opacity: 0.25; }
body.mood-calm .butterfly { display: none; }
body.mood-calm .flower { opacity: 0.4; }
body.mood-calm .cloud { opacity: 0.5; }
body.mood-calm .twinkle { opacity: 0.4; }

/* mood-minimal (Parent PIN / Dashboard): a calm, professional backdrop —
   grown-ups doing admin don't need floating butterflies. */
body.mood-minimal .rainbow-arc,
body.mood-minimal .butterfly,
body.mood-minimal .flower { display: none; }
body.mood-minimal .cloud { opacity: 0.3; }
body.mood-minimal .twinkle { opacity: 0.2; }
body.mood-minimal .meadow-hill { opacity: 0.5; }

.sky-bg, body.mood-calm .rainbow-arc, body.mood-calm .cloud, body.mood-calm .twinkle,
body.mood-minimal .cloud, body.mood-minimal .twinkle, body.mood-minimal .meadow-hill {
  transition: opacity 0.4s ease;
}

/* ==========================================================================
   LAYOUT PRIMITIVES
   ========================================================================== */
#main { position: relative; z-index: 1; }

.screen {
  display: none;
  min-height: 100vh;
  padding: 5.5rem 1.2rem 6.5rem;
  max-width: 640px;
  margin: 0 auto;
  animation: screenIn 0.45s var(--ease-soft);
}
.screen.active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel {
  background: var(--card-white);
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  box-shadow: 0 14px 30px -10px hsl(var(--shadow-color) / 0.2);
}
.panel-center { text-align: center; }
.onboarding-panel { margin-top: 2rem; }

.screen-heading {
  font-size: 1.7rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.3rem;
  text-shadow: 0 2px 0 rgba(255,255,255,0.6);
}
.parent-heading { color: var(--plum-ink-soft); }
.screen-sub {
  text-align: center;
  color: var(--plum-ink-soft);
  font-weight: 600;
  margin-bottom: 1.4rem;
}

.btn-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }

/* ==========================================================================
   TITLES
   ========================================================================== */
.app-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: var(--plum-ink);
  text-shadow: 0 2px 0 #fff, 0 6px 14px rgba(120,90,180,0.25);
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}
.app-title-home { font-size: 1.85rem; margin-top: 0.4rem; }
.onboarding-sub, .home-welcome {
  text-align: center;
  font-weight: 600;
  color: var(--plum-ink-soft);
  margin-bottom: 1.4rem;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
button { border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.btn-primary, .btn-secondary {
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--r-pill);
  min-height: 52px;
  transition: transform 0.15s var(--ease-bounce), box-shadow 0.15s ease;
  box-shadow: 0 6px 0 0 rgba(0,0,0,0.12);
}
.btn-primary {
  background: linear-gradient(180deg, var(--sun-gold) 0%, var(--sun-gold-deep) 100%);
  color: #5A3B00;
}
.btn-secondary {
  background: var(--card-white);
  color: var(--plum-ink);
  border: 2px solid #EADCFF;
}
.btn-primary:active, .btn-secondary:active { transform: translateY(4px); box-shadow: 0 2px 0 0 rgba(0,0,0,0.12); }
.btn-primary:hover, .btn-secondary:hover { transform: translateY(-2px); }
.btn-big { min-height: 60px; font-size: 1.15rem; padding: 1rem 2rem; }

.btn-cta-huge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  background: linear-gradient(180deg, var(--sun-gold) 0%, var(--petal-pink-deep) 130%);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.18);
  padding: 1.3rem 1.5rem;
  border-radius: var(--r-xl);
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 10px 0 0 #E08B3E, 0 18px 26px -8px hsl(var(--shadow-color) / 0.28);
  margin: 1.6rem 0;
  animation: ctaPulse 2.6s ease-in-out infinite;
}
.btn-cta-huge:active { transform: translateY(6px); box-shadow: 0 4px 0 0 #E08B3E; }
.btn-cta-sub { font-size: 0.95rem; font-weight: 600; opacity: 0.95; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 10px 0 0 #E08B3E, 0 18px 26px -8px hsl(var(--shadow-color) / 0.28); }
  50%      { box-shadow: 0 10px 0 0 #E08B3E, 0 22px 38px -6px hsl(var(--shadow-color) / 0.39); }
}
.btn-finish-today { background: linear-gradient(180deg, #FFE07A 0%, var(--sun-gold-deep) 130%); }

.btn-back {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  background: var(--card-white);
  color: var(--plum-ink);
  font-weight: 800;
  padding: 0.6rem 1.1rem;
  border-radius: var(--r-pill);
  box-shadow: 0 5px 0 0 rgba(0,0,0,0.1);
}
.btn-back:active { transform: translateY(3px); box-shadow: 0 2px 0 0 rgba(0,0,0,0.1); }

.parent-gate-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  color: var(--plum-ink-soft);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.7;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.text-input {
  width: 100%;
  border: 3px solid #EADCFF;
  border-radius: var(--r-md);
  padding: 0.9rem 1.1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--plum-ink);
  background: var(--card-white);
  margin-bottom: 1rem;
}
.text-input:focus { border-color: var(--sun-gold-deep); outline: none; }
.textarea-input { resize: vertical; min-height: 110px; line-height: 1.6; }
.big-input { text-align: center; }
.pin-input { letter-spacing: 0.5em; font-size: 1.6rem; }
.form-error { color: #C4487A; font-weight: 700; text-align: center; margin: -0.4rem 0 1rem; }
.word-count { text-align: center; color: var(--plum-ink-soft); font-weight: 700; margin: -0.5rem 0 1rem; }

/* ==========================================================================
   PET WIDGET (persistent)
   ========================================================================== */
.pet-widget {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}
.pet-button {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--card-white-soft));
  box-shadow: 0 8px 18px -6px hsl(var(--shadow-color) / 0.28), 0 0 0 4px rgba(255,255,255,0.6);
  font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  animation: petBob 3.2s ease-in-out infinite;
}
.pet-emoji { display: inline-block; }
.pet-hearts { position: absolute; top: -10px; right: -6px; font-size: 0.9rem; }
@keyframes petBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-6px) rotate(-4deg); }
}
.pet-speech-bubble {
  max-width: 210px;
  background: #fff;
  color: var(--plum-ink);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  box-shadow: 0 8px 20px -6px hsl(var(--shadow-color) / 0.24);
  animation: bubbleIn 0.3s var(--ease-bounce);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pet-stage {
  position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  height: 130px;
  margin: 0.6rem 0 0.2rem;
}
.pet-stage-emoji { font-size: 4.6rem; animation: petBob 3.6s ease-in-out infinite; filter: drop-shadow(0 10px 8px rgba(90,70,140,0.28)); }
.pet-stage-shadow {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 70px; height: 16px; background: rgba(90,70,140,0.18); border-radius: 50%;
  filter: blur(2px);
}

/* Onboarding pet choice grid */
.pet-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 1rem; }
.pet-choice-card {
  background: var(--card-white-soft);
  border-radius: var(--r-lg);
  padding: 1.2rem 0.6rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  font-weight: 800;
  border: 3px solid transparent;
  transition: transform 0.15s var(--ease-bounce), border-color 0.15s;
}
.pet-choice-card:hover { transform: translateY(-3px) scale(1.03); border-color: var(--sun-gold); }
.pet-choice-emoji { font-size: 2.6rem; }
.text-input.big-input#input-child-name { text-align: center; }

/* ==========================================================================
   HOME SCREEN
   ========================================================================== */
.home-wrap { padding-bottom: 1rem; }

.stat-chip-row {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding: 0.3rem 0.1rem 0.8rem;
  scrollbar-width: none;
}
.stat-chip-row::-webkit-scrollbar { display: none; }
.stat-chip {
  flex: 0 0 auto;
  background: var(--card-white);
  border-radius: var(--r-pill);
  padding: 0.55rem 1.1rem;
  display: flex; align-items: center; gap: 0.4rem;
  box-shadow: 0 6px 14px -6px hsl(var(--shadow-color) / 0.21);
  font-weight: 800;
  white-space: nowrap;
}
.stat-chip-icon { font-size: 1.15rem; }
.stat-chip-value { font-size: 1.05rem; }
.stat-chip-label { font-weight: 600; color: var(--plum-ink-soft); font-size: 0.85rem; }

.treasure-progress-mini { margin: 0.4rem 0 1rem; }
.treasure-progress-track {
  height: 14px;
  background: rgba(255,255,255,0.6);
  border-radius: var(--r-pill);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(90,70,140,0.15);
}
.treasure-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--meadow-mint), var(--sun-gold));
  border-radius: var(--r-pill);
  transition: width 0.6s var(--ease-soft);
}
.treasure-progress-text { display: block; text-align: center; font-weight: 700; font-size: 0.85rem; color: var(--plum-ink-soft); margin-top: 0.35rem; }

.home-nav-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 1.4rem 0;
}
.home-nav-btn {
  background: var(--card-white);
  border-radius: var(--r-md);
  padding: 0.7rem 0.3rem;
  font-weight: 800;
  font-size: 0.78rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  box-shadow: 0 5px 12px -6px hsl(var(--shadow-color) / 0.21);
  color: var(--plum-ink-soft);
}
.home-nav-btn:active { transform: translateY(2px); }
.home-nav-icon { font-size: 1.5rem; }

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  background: var(--card-white);
  border-radius: var(--r-lg);
  padding: 1rem 0.7rem;
  box-shadow: 0 6px 16px -8px hsl(var(--shadow-color) / 0.21);
}
.mini-cal-daylabel { text-align: center; font-size: 0.65rem; font-weight: 800; color: var(--plum-ink-soft); margin-bottom: 0.2rem; }
.mini-cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800;
  background: #F3EEFF;
  color: var(--plum-ink-soft);
}
.mini-cal-day.is-weekend { background: #FFE9F3; color: #C4487A; }
.mini-cal-day.is-today { background: var(--sun-gold); color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sun-gold-deep); }
.mini-cal-day.is-complete { background: linear-gradient(160deg, var(--meadow-mint), var(--meadow-mint-deep)); color: #fff; }
.mini-cal-day.is-outside { opacity: 0.25; }

/* ==========================================================================
   TODAY'S ADVENTURE — QUEST PATH (signature motif, full size)
   ========================================================================== */
.quest-path {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 2.2rem;
  margin-top: 1rem;
}
.quest-path::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 2.2rem;
  bottom: 2.2rem;
  width: 4px;
  background-image: linear-gradient(var(--plum-ink-soft) 55%, transparent 45%);
  background-size: 4px 16px;
  opacity: 0.28;
  border-radius: 2px;
}
.quest-card {
  position: relative;
  width: 100%;
  text-align: left;
  background: var(--card-white);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 8px 18px -8px hsl(var(--shadow-color) / 0.22);
  transition: transform 0.15s var(--ease-bounce);
}
.quest-card::before {
  content: "";
  position: absolute;
  left: -2.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--card-white);
  border: 4px solid #E4D6FF;
}
.quest-card.is-complete::before { border-color: var(--meadow-mint-deep); background: var(--meadow-mint); }
.quest-card:active { transform: scale(0.98); }
.quest-card.is-complete { background: linear-gradient(180deg, #F3FFF9, #fff); }
.quest-icon {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: var(--amber-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}
.quest-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.quest-title { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.quest-blurb { font-size: 0.82rem; color: var(--plum-ink-soft); font-weight: 600; }
.quest-check {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #F3EEFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: transparent;
  transition: all 0.2s var(--ease-bounce);
}
.quest-card.is-complete .quest-check {
  background: linear-gradient(160deg, var(--meadow-mint), var(--meadow-mint-deep));
  color: #fff;
}

/* ==========================================================================
   READING
   ========================================================================== */
.reading-duration-picker { display: flex; gap: 0.8rem; justify-content: center; margin-bottom: 1.6rem; }
.duration-btn {
  background: var(--card-white);
  min-width: 130px;
  border: 3px solid #EADCFF;
  border-radius: var(--r-pill);
  padding: 0.7rem 1.4rem;
  font-weight: 800;
  font-size: 1rem;
}
.duration-btn.is-selected { background: var(--sun-gold); border-color: var(--sun-gold-deep); color: #fff; }

.reading-timer-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 1.6rem; }
.reading-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: #EFE6FF; stroke-width: 14; }
.ring-progress {
  fill: none;
  stroke: url(#ringGradFallback);
  stroke: var(--sun-gold);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 603.19;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.reading-timer-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.reading-time-display { font-size: 2.6rem; font-weight: 800; }
.reading-time-label { font-weight: 700; color: var(--plum-ink-soft); font-size: 0.85rem; }
.reading-controls { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   WRITING
   ========================================================================== */
.prompt-card {
  background: linear-gradient(160deg, #FFF6E0, #FFE9C6);
  border-radius: var(--r-lg);
  padding: 1.2rem 1.3rem;
  display: flex; align-items: flex-start; gap: 0.8rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 8px 18px -8px hsl(var(--shadow-color) / 0.21);
}
.prompt-card-icon { font-size: 1.8rem; }
.prompt-card-text { font-weight: 700; font-size: 1.1rem; line-height: 1.45; }

/* ==========================================================================
   QUESTION CARD (shared: maths + phonics)
   ========================================================================== */
.progress-dots { display: flex; gap: 0.4rem; justify-content: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.progress-dot { width: 12px; height: 12px; border-radius: 50%; background: #E4D6FF; }
.progress-dot.is-current { background: var(--sun-gold); transform: scale(1.3); }
.progress-dot.is-done { background: var(--meadow-mint-deep); }

.question-card {
  background: var(--card-white);
  border-radius: var(--r-xl);
  padding: 1.5rem 1.3rem;
  box-shadow: 0 10px 24px -10px hsl(var(--shadow-color) / 0.24);
  text-align: center;
}
.question-prompt { font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.4; }
.question-visual { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.2rem; font-size: 2rem; min-height: 2.4rem; }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.options-grid.options-col1 { grid-template-columns: 1fr; }
.options-grid.options-col3 { grid-template-columns: repeat(3, 1fr); }
.option-btn {
  width: 100%;
  background: var(--card-white-soft);
  border: 3px solid #EADCFF;
  border-radius: var(--r-md);
  padding: 0.85rem 0.7rem;
  font-weight: 800;
  font-size: 1.15rem;
  min-height: 58px;
  transition: transform 0.15s var(--ease-bounce);
}
.option-btn:active { transform: scale(0.96); }
.option-btn.is-correct { background: linear-gradient(160deg, var(--meadow-mint), var(--meadow-mint-deep)); color: #fff; border-color: var(--meadow-mint-deep); animation: correctPop 0.4s var(--ease-bounce); }
.option-btn.is-try-again { animation: shakeSoft 0.4s; border-color: var(--sun-gold-deep); background: var(--amber-soft); }
@keyframes correctPop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shakeSoft { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback-banner {
  margin-top: 1rem;
  font-weight: 800;
  color: var(--meadow-mint-deep);
  min-height: 1.4rem;
}

/* Ten-frame visual (number bonds) */
.ten-frame { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem; width: 220px; margin: 0 auto 1.2rem; }
.ten-frame-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 3px solid #EADCFF;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.ten-frame-cell.is-filled { background: var(--petal-pink); border-color: var(--petal-pink-deep); }

.next-question-btn { margin-top: 1.2rem; }

/* ==========================================================================
   CLOCK CHALLENGE
   ========================================================================== */
.clock-face-wrap { width: 230px; margin: 0 auto 1rem; }
.clock-svg { width: 100%; height: auto; }
.clock-face-circle { fill: #fff; stroke: #EADCFF; stroke-width: 5; }
.clock-tick { stroke: #D7C6FF; stroke-width: 2.5; }
.clock-number { font-size: 13px; font-weight: 800; fill: var(--plum-ink); text-anchor: middle; dominant-baseline: middle; }
.clock-hand { stroke-linecap: round; transition: transform 0.5s var(--ease-bounce); transform-origin: 100px 100px; }
.clock-hand-hour { stroke: var(--plum-ink); stroke-width: 7; }
.clock-hand-minute { stroke: var(--petal-pink-deep); stroke-width: 5; }
.clock-center-dot { fill: var(--sun-gold-deep); }
.clock-question-text { text-align: center; font-weight: 800; font-size: 1.1rem; margin-bottom: 0.9rem; }
.clock-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

/* ==========================================================================
   SPELLING
   ========================================================================== */
.spelling-word-list { display: flex; flex-direction: column; gap: 1rem; }
.spelling-word-card {
  background: var(--card-white);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 8px 18px -8px hsl(var(--shadow-color) / 0.21);
}
.spelling-word-card.is-mastered { background: linear-gradient(180deg, #F3FFF9, #fff); }
.spelling-word-top { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
.spelling-word-number {
  width: 30px; height: 30px; border-radius: 50%;
  background: #F3EEFF; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; flex: 0 0 auto;
}
.spelling-word-buttons { display: flex; gap: 0.5rem; margin-left: auto; }
.icon-btn {
  background: var(--amber-soft);
  border-radius: var(--r-pill);
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.icon-btn.icon-btn-slow { background: #E4D6FF; }
.spelling-practice-input { margin-bottom: 0; }
.spelling-word-feedback { font-weight: 700; font-size: 0.88rem; min-height: 1.2rem; color: var(--plum-ink-soft); }
.spelling-word-feedback.is-correct { color: var(--meadow-mint-deep); }

/* ==========================================================================
   FLASHCARDS (sight words)
   ========================================================================== */
.flashcard-nav { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 1rem 0; }
.flashcard-nav-btn {
  background: var(--card-white);
  border-radius: 50%;
  width: 46px; height: 46px;
  font-size: 1.2rem; font-weight: 800;
  box-shadow: 0 5px 12px -6px hsl(var(--shadow-color) / 0.21);
  flex: 0 0 auto;
}
.flashcard-wrap { width: 240px; height: 170px; perspective: 1000px; }
.flashcard {
  width: 100%; height: 100%;
  background: var(--card-white);
  border-radius: var(--r-lg);
  box-shadow: 0 10px 24px -10px hsl(var(--shadow-color) / 0.24);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800;
  padding: 1rem;
  text-align: center;
}
.flashcard.is-mastered { background: linear-gradient(160deg, #FFF9E5, var(--amber-soft)); }
.flashcard-back { font-size: 1.05rem; font-weight: 700; line-height: 1.4; }

/* ==========================================================================
   STICKER ALBUM
   ========================================================================== */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}
.sticker-cell {
  aspect-ratio: 1;
  width: 100%;
  background: var(--card-white);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.3rem;
  box-shadow: 0 8px 16px -8px hsl(var(--shadow-color) / 0.21);
  font-size: 2.1rem;
}
.sticker-cell-name { font-size: 0.65rem; font-weight: 800; color: var(--plum-ink-soft); }
.sticker-cell.is-locked { filter: grayscale(1) brightness(1.5); opacity: 0.55; }
.sticker-cell.is-new { animation: stickerPop 0.5s var(--ease-bounce); }
@keyframes stickerPop {
  0%   { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

/* ==========================================================================
   TREASURE MAP (signature motif, largest scale)
   ========================================================================== */
.treasure-map-wrap {
  background: linear-gradient(160deg, #FFF3D6, #FFE6B8);
  border-radius: var(--r-xl);
  padding: 1.6rem 1rem 1.8rem;
  box-shadow: 0 10px 24px -10px hsl(var(--shadow-color) / 0.24);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  justify-content: center;
  position: relative;
}
.treasure-tile {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 3px dashed #E3C98A;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex: 0 0 auto;
}
.treasure-tile:nth-child(3n+1) { transform: translateY(-8px); }
.treasure-tile:nth-child(3n) { transform: translateY(8px); }
.treasure-tile.is-revealed { background: linear-gradient(160deg, var(--meadow-mint), var(--meadow-mint-deep)); border-style: solid; border-color: var(--meadow-mint-deep); }
.treasure-tile.is-weekend { opacity: 0.5; border-style: dotted; }
.treasure-tile-castle {
  width: 74px; height: 74px;
  font-size: 2.4rem;
  border-width: 4px;
}
.treasure-tile-castle.is-revealed { animation: castleGlow 1.8s ease-in-out infinite; }
@keyframes castleGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,201,74,0.6); }
  50%      { box-shadow: 0 0 0 14px rgba(255,201,74,0); }
}

/* ==========================================================================
   STATISTICS
   ========================================================================== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.stat-card {
  background: var(--card-white);
  border-radius: var(--r-lg);
  padding: 1.1rem 0.9rem;
  box-shadow: 0 8px 16px -8px hsl(var(--shadow-color) / 0.21);
  text-align: center;
}
.stat-card-icon { font-size: 1.6rem; margin-bottom: 0.3rem; }
.stat-card-value { font-size: 1.4rem; font-weight: 800; }
.stat-card-label { font-size: 0.75rem; font-weight: 700; color: var(--plum-ink-soft); }

/* ==========================================================================
   PARENT DASHBOARD
   ========================================================================== */
.parent-tabs { display: flex; gap: 0.4rem; overflow-x: auto; margin-bottom: 1.2rem; scrollbar-width: none; }
.parent-tabs::-webkit-scrollbar { display: none; }
.parent-tab {
  flex: 0 0 auto;
  background: var(--card-white);
  border-radius: var(--r-pill);
  padding: 0.55rem 1rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--plum-ink-soft);
}
.parent-tab.active { background: var(--plum-ink); color: #fff; }
.parent-panel { display: flex; flex-direction: column; gap: 1rem; }

.dash-card {
  background: var(--card-white);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 6px 16px -8px hsl(var(--shadow-color) / 0.17);
}
.dash-card h3 { font-size: 1rem; margin-bottom: 0.7rem; }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid #F1E9FF; font-size: 0.92rem; }
.dash-row:last-child { border-bottom: none; }
.dash-label { font-weight: 700; color: var(--plum-ink-soft); }
.dash-value { font-weight: 800; }

.list-editor-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid #F1E9FF; }
.list-editor-row:last-child { border-bottom: none; }
.list-editor-text { flex: 1 1 auto; font-weight: 600; font-size: 0.92rem; }
.list-editor-del {
  flex: 0 0 auto; background: #FFE1EC; color: #C4487A;
  width: 34px; height: 34px; border-radius: 50%; font-weight: 800;
}
.add-row { display: flex; gap: 0.5rem; margin-top: 0.7rem; }
.add-row input { margin: 0; }
.add-row button { flex: 0 0 auto; background: var(--meadow-mint); border-radius: var(--r-md); padding: 0 1.1rem; font-weight: 800; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; }
.toggle-switch { position: relative; width: 52px; height: 30px; background: #E4D6FF; border-radius: var(--r-pill); flex: 0 0 auto; }
.toggle-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  background: #fff; border-radius: 50%; transition: transform 0.2s var(--ease-bounce);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch.is-on { background: var(--meadow-mint-deep); }
.toggle-switch.is-on::after { transform: translateX(22px); }

.select-input {
  width: 100%; padding: 0.7rem 0.9rem; border-radius: var(--r-md);
  border: 3px solid #EADCFF; font-weight: 700; background: #fff; margin-bottom: 0;
}
.danger-btn { background: #FFE1EC; color: #C4487A; }
.small-note { font-size: 0.78rem; color: var(--plum-ink-soft); font-weight: 600; line-height: 1.5; }

.sync-code-display {
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0.25em; text-align: center;
  background: #F1E9FF; color: var(--plum-ink); border-radius: var(--r-md);
  padding: 0.7rem 0.5rem; margin: 0.6rem 0;
}
.btn-link-plain {
  background: none; border: none; box-shadow: none; text-decoration: underline;
  font-weight: 700; font-size: 0.85rem; color: var(--plum-ink-soft); padding: 0.3rem;
  min-height: 0;
}
.btn-link-plain:active, .btn-link-plain:hover { transform: none; box-shadow: none; }

/* ==========================================================================
   CELEBRATION OVERLAY, CONFETTI, TOAST
   ========================================================================== */
#fx-canvas {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none; width: 100vw; height: 100vh;
}

.celebration-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(74, 63, 107, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.celebration-card {
  background: var(--card-white);
  border-radius: var(--r-xl);
  padding: 2rem 1.6rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px -12px rgba(40,20,70,0.5);
  animation: celebrateIn 0.45s var(--ease-bounce);
}
@keyframes celebrateIn {
  0%   { transform: scale(0.6) translateY(30px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.celebration-emoji { font-size: 4rem; margin-bottom: 0.4rem; animation: petBob 1.6s ease-in-out infinite; }
.celebration-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.5rem; }
.celebration-text { font-weight: 600; color: var(--plum-ink-soft); line-height: 1.5; margin-bottom: 0.8rem; }
.celebration-extra { margin-bottom: 1rem; }
.celebration-sticker-reveal { font-size: 3.5rem; animation: stickerPop 0.6s var(--ease-bounce); }
.celebration-medal { font-size: 3.5rem; }
.certificate-box {
  border: 3px dashed var(--sun-gold-deep);
  border-radius: var(--r-md);
  padding: 1rem;
  background: #FFFBF0;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  bottom: 6.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  background: var(--plum-ink);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1.3rem;
  border-radius: var(--r-pill);
  box-shadow: 0 10px 20px -8px rgba(0,0,0,0.35);
  animation: toastIn 0.3s var(--ease-bounce);
  max-width: 88vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ==========================================================================
   RESPONSIVE ENHANCEMENTS (tablet / desktop)
   ========================================================================== */
@media (min-width: 640px) {
  .screen { padding-top: 6rem; }
  .options-grid { grid-template-columns: repeat(3, 1fr); }
  .pet-choice-grid { grid-template-columns: repeat(4, 1fr); }
  .home-nav-row { gap: 1rem; }
}
@media (min-width: 900px) {
  body { font-size: 19px; }
  .app-title { font-size: 2.4rem; }
}
@media (max-width: 380px) {
  .stat-chip-label { display: none; }
  .clock-options, .options-grid { grid-template-columns: 1fr 1fr; }
}

/* Touch target safety floor */
button, .option-btn, .duration-btn, .icon-btn { min-width: 44px; }

/* Colour-blind friendly correctness cues: icons/borders, never colour alone */
.option-btn.is-correct::after { content: " ✓"; }
.option-btn.is-try-again::after { content: " ↻"; }
