/* Reading Quest — modern design system. iPad-first, kid-friendly but premium.
   Animated gradient-mesh background · glassmorphic chrome · vibrant gradient accents. */
:root {
  --bg-0: #0b0a1f;
  --ink: #1b1830;
  --ink-soft: #4a4566;
  --muted: #8480a0;
  --surface: #ffffff;
  --surface-2: #f6f4fe;
  --line: #ece8fb;

  --indigo: #6366f1;
  --violet: #8b5cf6;
  --fuchsia: #d946ef;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --gold: #fbbf24;
  --amber: #f59e0b;
  --good: #10b981;
  --bad: #f43f5e;

  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #d946ef 100%);
  --grad-soft: linear-gradient(135deg, #818cf8, #c084fc);
  --grad-gold: linear-gradient(135deg, #fbbf24, #f97316);

  --radius: 24px;
  --radius-sm: 16px;
  --shadow-sm: 0 2px 8px rgba(23, 16, 54, .06);
  --shadow: 0 18px 44px -12px rgba(30, 12, 70, .28), 0 4px 14px -6px rgba(30, 12, 70, .14);
  --shadow-glow: 0 12px 30px -8px rgba(139, 92, 246, .55);

  --font-display: "Fredoka", system-ui, sans-serif;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100dvh;
  color: var(--ink);
  background: #161038;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  overflow-x: hidden;
}
/* one cohesive illustrated world behind every screen (iOS-safe fixed layers) */
body::after { /* the illustration */
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: url("img/bg-game.png") center top / cover no-repeat;
}
body::before { /* dimming scrim so cards & text stay crisp */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(13,10,42,.78), rgba(16,12,46,.88));
}
@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(8vmax,6vmax) scale(1.15); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1.05); } to { transform: translate(-7vmax,-5vmax) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
  .card, .profile-card, .dash-card, .badge.pop, .btn, .story-card { animation: none !important; }
}

#app { max-width: 880px; margin: 0 auto; padding: 20px 16px 64px; position: relative; }

/* ============ HOME — "Choose Your Reading Hero" ============ */
body.home-bg::before { /* lighter scrim on home so the vibrant world shines */
  background: linear-gradient(180deg, rgba(13,10,42,.34), rgba(13,10,42,.05) 36%, rgba(13,10,42,.5));
}
body.home-bg #app { max-width: 1080px; padding-top: 14px; }

.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.home-top .logo { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.home-top .logo .spark { color: var(--gold); }
.home-top .mute { cursor: pointer; }

.hero-title { font-family: var(--font-display); font-weight: 800; text-align: center;
  font-size: clamp(30px, 5.2vw, 50px); margin: 6px 0 4px; line-height: 1.02;
  color: #ffd34d; -webkit-text-stroke: 3px #3a1466; paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(36,12,80,.55), 0 11px 26px rgba(0,0,0,.55); letter-spacing: .5px; }
.hero-sub { text-align: center; color: #f3edff; font-weight: 700; margin: 2px 0 22px; font-size: clamp(14px,2.2vw,17px); text-shadow: 0 2px 10px rgba(0,0,0,.55); }

.hero-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 720px) { .hero-cards { grid-template-columns: 1fr; gap: 16px; } }

.hero-card {
  --c1: #ec4899; --c2: #7c3aed; /* foundational = warm pink → purple */
  background: linear-gradient(165deg, var(--c1), var(--c2)); border: 3px solid rgba(255,255,255,.55); border-radius: 26px;
  padding: 22px 22px 20px; cursor: pointer; color: #fff;
  box-shadow: 0 24px 54px -18px rgba(8,6,30,.85), 0 0 40px -8px var(--c1), inset 0 2px 0 rgba(255,255,255,.4);
  transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s; animation: cardIn .45s ease both;
}
.hero-card.track-comprehension { --c1: #3b82f6; --c2: #06b6d4; } /* reading = cool blue → cyan */
.hero-card:hover { transform: translateY(-5px); box-shadow: 0 34px 66px -18px rgba(8,6,30,.9), 0 0 52px -6px var(--c1); }
.hero-card:active { transform: translateY(-1px) scale(.995); }

.hc-head { display: flex; align-items: center; gap: 16px; }
.hc-avwrap { position: relative; flex: none; }
.hc-avatar { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 44px;
  background: rgba(255,255,255,.18);
  box-shadow: 0 0 0 4px #fff, 0 0 0 9px rgba(255,255,255,.45), 0 0 26px 2px rgba(255,255,255,.5), 0 8px 18px -6px rgba(0,0,0,.45); }
.hc-lvl { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-family: var(--font-display);
  font-weight: 800; font-size: 11px; color: #fff; background: linear-gradient(180deg, #ff5d5d, #d62f2f);
  padding: 3px 10px; border-radius: 999px; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.4); white-space: nowrap; }
.hc-id { min-width: 0; }
.hc-name { font-family: var(--font-display); font-weight: 800; font-size: 29px; color: #fff; line-height: 1.1; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.hc-meta { color: rgba(255,255,255,.85); font-weight: 600; font-size: 14px; margin-top: 1px; }
.hc-band { display: inline-block; margin-top: 8px; font-family: var(--font-display); font-weight: 700; font-size: 13px;
  color: #fff; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); padding: 4px 12px; border-radius: 999px; }

.hc-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 2px 6px; }
.hc-sp { line-height: 1.1; }
.hc-sp .sp-num { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: #fff; }
.hc-sp .sp-label { color: rgba(255,255,255,.85); font-weight: 700; font-size: 13px; }
.hc-ring { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(#fff calc(var(--pct) * 1%), rgba(255,255,255,.28) 0); }
.hc-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: rgba(0,0,0,.2); }
.hc-ring span { position: relative; font-family: var(--font-display); font-weight: 800; font-size: 14px; color: #fff; }

.hc-status { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff; margin: 8px 2px 14px; }
.hero-card .hc-start { background: linear-gradient(180deg, #ffd24d, #f59300); background-size: 100% 100%; color: #4a2700;
  font-size: 20px; font-weight: 800; letter-spacing: .3px; padding: 16px; border-radius: 18px;
  border-bottom: 0; text-shadow: 0 1px 0 rgba(255,255,255,.4);
  box-shadow: 0 7px 0 -1px rgba(120,60,0,.5), 0 18px 30px -12px rgba(245,147,0,.8), inset 0 3px 0 rgba(255,255,255,.6), inset 0 -4px 10px rgba(0,0,0,.14);
  transition: transform .1s, box-shadow .1s; }
.hero-card .hc-start:hover { filter: brightness(1.04); }
.hero-card .hc-start:active { transform: translateY(5px); box-shadow: 0 2px 0 -1px rgba(120,60,0,.5), 0 10px 18px -12px rgba(245,147,0,.7), inset 0 3px 0 rgba(255,255,255,.55); }

/* bottom utility nav */
.home-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 22px 0 18px;
  background: rgba(20,16,52,.5); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 10px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (max-width: 620px) { .home-nav { grid-template-columns: repeat(2, 1fr); } }
.navi { display: flex; align-items: center; gap: 11px; background: transparent; border: none; cursor: pointer; color: #fff;
  padding: 10px 12px; border-radius: 14px; text-align: left; transition: background .12s, transform .12s; width: 100%; }
.navi:hover { background: rgba(255,255,255,.1); }
.navi:active { transform: scale(.97); }
.navi .ni { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px;
  background: linear-gradient(135deg, #7c3aed, #22d3ee); box-shadow: 0 6px 14px -6px rgba(124,58,237,.8); }
.navi .nx { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.navi .nt { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.navi .ns { font-size: 11.5px; color: #c8c0ec; font-weight: 600; }

/* today's adventure */
.home-goals { background: rgba(20,16,52,.5); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 14px 16px 16px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.goals-title { text-align: center; font-family: var(--font-display); font-weight: 800; color: #fff; font-size: 17px; margin-bottom: 12px; }
.goals-row { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.goal-mini { --accent: #ec4899; flex: 1 1 240px; display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.96); border-radius: 16px; padding: 11px 13px; box-shadow: 0 10px 24px -14px rgba(0,0,0,.6); }
.goal-mini.track-comprehension { --accent: #6366f1; }
.goal-mini .gm-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), #fbbf24); box-shadow: 0 0 0 3px rgba(255,255,255,.6); }
.goal-mini .gm-body { flex: 1; min-width: 0; }
.gm-name { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.gm-star { color: var(--accent); font-size: 13px; white-space: nowrap; }
.gm-bar { height: 8px; background: rgba(0,0,0,.08); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.gm-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #fbbf24); transition: width .5s cubic-bezier(.3,.8,.3,1); }
.gm-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.gm-num { flex: none; font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--accent); }
.goal-book { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24); border-radius: 16px; font-size: 24px; color: #3a1d03;
  box-shadow: 0 10px 22px -10px rgba(245,158,11,.8); }
.goal-book span { font-family: var(--font-display); font-weight: 800; font-size: 9.5px; }

/* ============ AVATARS (illustrated skins) ============ */
.av-img { width: 1.5em; height: 1.5em; border-radius: 50%; object-fit: cover; vertical-align: middle; display: inline-block; }
.av-emoji { display: inline; }
/* fill the round avatar frames when it's a skin */
.hc-avatar .av-img, .avatar .av-img, .gm-avatar .av-img { width: 100%; height: 100%; display: block; }
.hc-avatar, .avatar, .gm-avatar { overflow: hidden; }

/* character picker modal */
.modal-ov { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px;
  background: rgba(8,6,26,.68); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); animation: ovIn .18s ease both; }
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: min(640px, 96vw); max-height: 86vh; overflow: auto; background: var(--surface); color: var(--ink);
  border-radius: 24px; padding: 18px 18px 20px; box-shadow: 0 36px 80px -22px rgba(0,0,0,.85); animation: badgePop .35s cubic-bezier(.2,1.4,.4,1) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-family: var(--font-display); font-size: 19px; margin: 0; }
.modal-x { flex: none; border: none; background: var(--surface-2); width: 36px; height: 36px; border-radius: 50%; font-weight: 800; font-size: 15px; color: var(--muted); cursor: pointer; }
.modal-x:hover { background: #ece8fb; }
.pickav-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 540px) { .pickav-grid { grid-template-columns: repeat(4, 1fr); } }
.pickav { aspect-ratio: 1; border-radius: 16px; border: 3px solid transparent; background: var(--surface-2); cursor: pointer;
  padding: 0; display: grid; place-items: center; font-size: 34px; overflow: hidden; transition: transform .1s, border-color .1s, box-shadow .1s; }
.pickav:hover { transform: scale(1.07); }
.pickav.sel { border-color: var(--brand, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,.3); }
.pickav .av-img { width: 100%; height: 100%; border-radius: 13px; display: block; }
.pickav .av-emoji { font-size: 34px; }

/* ---------- HUD ---------- */
.hud { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 18px; flex-wrap: wrap; }
.hud .logo {
  font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: .2px;
  background: linear-gradient(90deg, #fff, #e9d5ff 60%, #a5f3fc);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hud .logo .spark { -webkit-text-fill-color: initial; color: var(--gold); filter: drop-shadow(0 0 6px rgba(251,191,36,.7)); }
.hud .spacer { flex: 1; }
.chip {
  background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.16);
  padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.chip.sp { background: var(--grad-gold); border: none; box-shadow: 0 6px 16px -4px rgba(245,158,11,.6); color: #3a1d03; }
.chip.band { background: rgba(255,255,255,.12); }
.chip.mute { cursor: pointer; padding: 8px 12px; }
.chip.mute:active { transform: scale(.92); }

/* ---------- fast-track daily goal ---------- */
.goal-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; font-family: var(--font-display); font-weight: 600; color: var(--ink); flex-wrap: wrap; }
.goal-dots { display: inline-flex; gap: 6px; }
.gdot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.gdot.on { background: var(--grad-gold); box-shadow: 0 0 8px rgba(245,158,11,.6); }
.goal-num { color: var(--muted); font-size: 14px; }

/* ---------- benchmark result breakdown ---------- */
.breakdown { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 16px; margin: 14px 0; }
.bd-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; font-weight: 700; border-bottom: 1px solid var(--line); }
.bd-row:last-child { border-bottom: none; }

/* ---------- coins + celebration (dopamine) ---------- */
.burst .coin { position: absolute; font-size: 30px; animation: coinUp 1.5s ease-out forwards; }
@keyframes coinUp { 0% { transform: translateY(20px) scale(.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-230px) scale(1.15) rotate(25deg); opacity: 0; } }
.celebrate-flash { position: fixed; inset: 0; z-index: 49; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(217,70,239,.28), transparent 60%); animation: cflash .7s ease-out forwards; }
@keyframes cflash { from { opacity: 1; } to { opacity: 0; } }
.levelup-banner { text-align: center; margin: 14px 0; font-family: var(--font-display); font-weight: 700; font-size: 21px; color: #fff; background: var(--grad); padding: 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-glow); animation: badgePop .6s cubic-bezier(.2,1.5,.4,1) both; }
.justright-pill { text-align: center; margin: 12px auto 4px; max-width: 92%; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #065f46; background: linear-gradient(135deg, #d1fae5, #a7f3d0); border: 1px solid rgba(16,163,74,.35); padding: 10px 14px; border-radius: 999px; animation: badgePop .5s cubic-bezier(.2,1.5,.4,1) both; }
.series-next { display: flex; flex-direction: column; gap: 3px; align-items: center; margin: 14px auto 2px; max-width: 96%; padding: 13px 16px; border-radius: var(--radius-sm); cursor: pointer; color: #fff; background: linear-gradient(135deg, #6366f1, #22d3ee); box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; }
.series-next:active { transform: scale(.98); }
.series-next:hover { box-shadow: 0 10px 24px -10px rgba(99,102,241,.7); }
.series-tag { font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; opacity: .85; }
.series-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.2; text-align: center; }

/* ---------- collectibles ---------- */
.new-collectible { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px 0; }
.collection-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 420px) { .collection-grid { grid-template-columns: repeat(2, 1fr); } }
.ctk { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.ctk .ci { font-size: 40px; }
.ctk .cname { font-size: 12px; font-weight: 800; color: var(--ink); text-align: center; }
.ctk.locked { opacity: .65; }
.ctk.locked .ci { filter: grayscale(1); opacity: .5; }
.ctk.rare { box-shadow: inset 0 0 0 2px #38bdf8; background: linear-gradient(135deg, #fff, #e0f2fe); }
.ctk.epic { box-shadow: inset 0 0 0 2px #a855f7; background: linear-gradient(135deg, #fff, #f3e8ff); }
.ctk.legendary { box-shadow: 0 0 0 2px #f59e0b, 0 8px 20px -6px rgba(245,158,11,.55); background: linear-gradient(135deg, #fffbeb, #fde68a); }
.new-collectible .ctk { width: 120px; }
.new-collectible .ctk .ci { font-size: 56px; }

/* ---------- streak heatmap ---------- */
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 6px; }
.hcell { aspect-ratio: 1; border-radius: 5px; background: var(--line); }
.hcell.on { background: linear-gradient(135deg, var(--good), var(--cyan)); box-shadow: 0 2px 6px -2px rgba(16,185,129,.6); }

/* ---------- budget meter ---------- */
.budget-bar { height: 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.budget-bar > div { height: 100%; background: linear-gradient(90deg, var(--good), var(--amber)); transition: width .5s; }

/* ---------- oral reading benchmark ---------- */
.word-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 18px 0; }
.word-list span { font-family: var(--font-display); font-weight: 700; font-size: 26px; background: var(--surface-2); padding: 8px 16px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.passage-text { font-size: 22px; line-height: 1.6; margin: 16px 0; color: var(--ink); font-family: var(--font-display); font-weight: 500; }

/* ---------- story library ---------- */
.story-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 6px; }
@media (max-width: 520px) { .story-grid { grid-template-columns: repeat(2, 1fr); } }
.story-card { cursor: pointer; transition: transform .12s; }
.story-card:active { transform: scale(.97); }
.story-card { animation: cardIn .4s ease both; }
.story-grid .story-card:nth-child(2) { animation-delay: .05s; }
.story-grid .story-card:nth-child(3) { animation-delay: .10s; }
.story-grid .story-card:nth-child(4) { animation-delay: .15s; }
.story-grid .story-card:nth-child(5) { animation-delay: .20s; }
.story-grid .story-card:nth-child(n+6) { animation-delay: .24s; }
.story-cover { aspect-ratio: 1; border-radius: 14px; background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; font-size: 38px; position: relative; box-shadow: var(--shadow-sm); }
.story-cover.theme-gaming { background: linear-gradient(135deg, #6366f1, #22d3ee); }
.story-cover.theme-adventure { background: linear-gradient(135deg, #f59e0b, #16a34a); }
.story-cover.theme-scary { background: linear-gradient(135deg, #1f1147, #7c3aed); }
.story-cover.theme-fun { background: linear-gradient(135deg, #ec4899, #fbbf24); }
.story-cover { overflow: hidden; }
.story-cover .story-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; }
.story-cover .story-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.story-cover .read-badge { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.story-cover .series-badge { position: absolute; left: 6px; bottom: 6px; font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: .2px; color: #fff; background: rgba(15,12,41,.78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: 3px 8px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.story-title { font-weight: 800; font-size: 13px; margin-top: 6px; line-height: 1.2; color: var(--ink); }
.daily-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); margin: 2px 0 12px; }
.all-stories { margin-top: 16px; border-top: 1px solid var(--surface-2); }
.all-stories > summary { cursor: pointer; list-style: none; padding: 14px 2px 4px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--muted); }
.all-stories > summary::-webkit-details-marker { display: none; }
.all-stories > summary::after { content: " ›"; display: inline-block; transition: transform .15s; }
.all-stories[open] > summary::after { transform: rotate(90deg); }
.reader-cover { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); }
.reader-text { font-family: "Literata", Georgia, serif; line-height: 1.7; color: var(--ink); letter-spacing: .01em; }
.reader-text .w { border-radius: 5px; padding: 0 1px; transition: background .1s, color .1s; }
.reader-text .w.on { background: var(--gold); color: #3a1d03; box-shadow: 0 0 0 3px rgba(251,191,36,.4); }
.read-early { font-size: 27px; line-height: 1.95; letter-spacing: .03em; word-spacing: .14em; }
.read-building { font-size: 22px; line-height: 1.8; }
.read-confident { font-size: 20px; line-height: 1.72; }

/* ---------- cards / headings ---------- */
.card {
  position: relative; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,.6); animation: cardIn .4s cubic-bezier(.2,.7,.3,1) both;
}
.card::before { /* top sheen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.6), transparent 40%); opacity: .5;
}
.card.alert { border: 1px solid rgba(245,158,11,.5); box-shadow: var(--shadow), 0 0 0 3px rgba(251,191,36,.12); }
h1.title {
  font-family: var(--font-display); color: #fff; font-size: 32px; font-weight: 700;
  margin: 6px 0 4px; letter-spacing: .2px; text-shadow: 0 4px 24px rgba(0,0,0,.35); line-height: 1.1;
}
.sub { color: rgba(255,255,255,.82); margin: 0 0 18px; font-size: 16px; font-weight: 600; }
.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }

/* ---------- profile picker ---------- */
.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px){ .profiles { grid-template-columns: 1fr; } }
.profile-card {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 22px; text-align: center; cursor: pointer; border: 1px solid rgba(255,255,255,.6);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s; animation: cardIn .4s ease both;
  overflow: hidden;
}
.profile-card::after { /* glow halo */
  content: ""; position: absolute; top: -40%; left: 50%; width: 70%; height: 70%; transform: translateX(-50%);
  background: var(--grad); filter: blur(60px); opacity: .22; pointer-events: none;
}
.profile-card:hover { transform: translateY(-4px); box-shadow: var(--shadow), var(--shadow-glow); }
.profile-card:active { transform: scale(.98); }
.profile-card .avatar { position: relative; z-index: 1; }
.avatar {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 46px;
  background: var(--grad); box-shadow: 0 10px 26px -8px rgba(139,92,246,.7), inset 0 2px 6px rgba(255,255,255,.4);
}
.profile-card .name { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.profile-card .meta { color: var(--muted); font-size: 14px; margin-top: 3px; font-weight: 700; }
.profile-card .stats { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pill { background: var(--surface-2); color: var(--violet); border-radius: 999px; padding: 6px 13px; font-weight: 800; font-size: 13px; }
.pill.gold { background: #fff6e3; color: #b45309; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer; font-family: var(--font-display); font-weight: 600;
  font-size: 18px; padding: 16px 22px; border-radius: var(--radius-sm); color: #fff; width: 100%;
  background: var(--grad); background-size: 160% 160%;
  box-shadow: 0 12px 26px -8px rgba(124,58,237,.6), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .12s, filter .12s;
  letter-spacing: .2px;
}
.btn:hover { box-shadow: 0 16px 34px -8px rgba(124,58,237,.7), inset 0 1px 0 rgba(255,255,255,.35); }
.btn:active { transform: translateY(2px) scale(.99); filter: brightness(.98); }
.btn.secondary { background: var(--surface-2); color: var(--violet); box-shadow: inset 0 0 0 1px var(--line); }
.btn.secondary:hover { box-shadow: inset 0 0 0 1px rgba(139,92,246,.4); }
.btn.ghost { background: rgba(255,255,255,.08); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn.small { width: auto; font-size: 15px; padding: 11px 16px; }
.btn.good { background: linear-gradient(135deg, #10b981, #22d3ee); box-shadow: 0 12px 26px -8px rgba(16,185,129,.55), inset 0 1px 0 rgba(255,255,255,.35); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
/* gentle "tap me" breathing glow on the main daily-quest CTA */
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 12px 26px -8px rgba(124,58,237,.55), inset 0 1px 0 rgba(255,255,255,.35); transform: translateY(0); }
  50% { box-shadow: 0 18px 42px -6px rgba(217,70,239,.85), inset 0 1px 0 rgba(255,255,255,.45); transform: translateY(-2px); }
}
#startBtn { animation: ctaGlow 2.6s ease-in-out infinite; }
#startBtn:hover, #startBtn:active { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { #startBtn { animation: none; } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------- session / questions ---------- */
.progress-track { height: 12px; background: rgba(255,255,255,.16); border-radius: 999px; overflow: hidden; margin-bottom: 18px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--fuchsia)); border-radius: 999px; transition: width .4s cubic-bezier(.3,.8,.3,1); box-shadow: 0 0 12px rgba(217,70,239,.6); }

.activity-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; }
.activity-badge { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; padding: 7px 14px; border-radius: 999px; background: linear-gradient(135deg, var(--violet), var(--cyan)); box-shadow: var(--shadow-sm); }
.activity-badge.act-quiz { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #3a1d03; }
.activity-badge.act-rhyme { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.activity-badge.act-blend, .activity-badge.act-vowel { background: linear-gradient(135deg, #16a34a, #22d3ee); }
.activity-badge.act-letter { background: linear-gradient(135deg, #6366f1, #ec4899); }
.activity-badge.act-decode, .activity-badge.act-vocab { background: linear-gradient(135deg, #7c3aed, #22d3ee); }
.activity-badge.act-read, .activity-badge.act-passage { background: linear-gradient(135deg, #f59e0b, #16a34a); }
.activity-round { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--muted); white-space: nowrap; }
.activity-hint { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.q-prompt { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 4px 0 8px; line-height: 1.25; }
.sounds { display: flex; gap: 10px; justify-content: center; margin: 16px 0 22px; flex-wrap: wrap; }
.sound-chip {
  font-family: var(--font-display); background: linear-gradient(135deg, #22d3ee, #3b82f6); color: #fff; font-weight: 700;
  font-size: 30px; min-width: 64px; padding: 14px 18px; border-radius: 18px; text-transform: lowercase;
  box-shadow: 0 10px 22px -8px rgba(34,211,238,.7), inset 0 2px 4px rgba(255,255,255,.4);
}
.build-card { text-align: center; }
.build-slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0 22px; min-height: 64px; }
.build-slots .slot {
  font-family: var(--font-display); font-weight: 800; font-size: 30px; min-width: 60px; height: 64px;
  display: grid; place-items: center; border-radius: 16px; text-transform: lowercase; color: var(--ink);
  border: 3px dashed var(--line); background: var(--surface-2); transition: transform .12s, background .15s, border-color .15s;
}
.build-slots .slot.filled { border-style: solid; border-color: var(--violet); background: #fff; transform: scale(1.04); }
.build-slots .slot.good { border-color: var(--good); background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.build-slots .slot.show { border-color: var(--gold); background: #fff7e6; color: #7c5a02; }
.build-chips { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.sound-chip.tap { cursor: pointer; border: none; transition: transform .1s, opacity .15s, box-shadow .12s; }
.sound-chip.tap:active { transform: scale(.92); }
.sound-chip.tap.used { opacity: .28; transform: scale(.9); box-shadow: none; pointer-events: none; }
#buildReset { margin-top: 10px; }
/* word-level variant (Sentence Builder) — wider chips/slots, normal text */
.build-slots.words .slot { font-size: 17px; min-width: 0; height: auto; min-height: 48px; padding: 8px 14px; text-transform: none; }
.build-chips.words { gap: 9px; }
.build-chips.words .sound-chip.tap { font-size: 18px; min-width: 0; padding: 11px 16px; border-radius: 14px; text-transform: none; background: linear-gradient(135deg, #7c3aed, #3b82f6); }
.options { display: grid; gap: 12px; }
.option {
  background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 19px;
  font-size: 21px; font-weight: 800; cursor: pointer; text-align: center; color: var(--ink);
  transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.option:hover { border-color: rgba(139,92,246,.45); box-shadow: 0 8px 20px -10px rgba(139,92,246,.5); }
.option:active { transform: scale(.98); }
.option.correct { background: linear-gradient(135deg, #d1fae5, #a7f3d0); border-color: var(--good); color: #065f46; }
.option.wrong { background: #ffe4e6; border-color: var(--bad); color: #9f1239; }
.option.dim { opacity: .5; }

.passage { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; font-size: 19px; line-height: 1.65; margin-bottom: 10px; color: #2a2147; }
.passage .lvl { display: inline-block; font-family: var(--font-display); font-size: 12px; font-weight: 600; color: #fff; background: var(--grad); padding: 4px 11px; border-radius: 999px; margin-bottom: 8px; }
.passage h3 { font-family: var(--font-display); margin: 0 0 8px; font-size: 22px; font-weight: 600; }

.feedback { font-size: 18px; font-weight: 800; margin-top: 14px; text-align: center; min-height: 24px; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.read-aloud { text-align: center; }
.read-aloud .big-text { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.5; margin: 10px 0 20px; color: var(--ink); }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 10px 0 4px; }
.result-hero .emoji { font-size: 66px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.18)); }
.result-hero .big { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin: 6px 0; }
.reward-line { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 17px; font-weight: 700; }
.reward-line:last-child { border-bottom: none; }
.reward-line .amt { font-family: var(--font-display); font-weight: 700; color: var(--amber); }
.masterbar { height: 16px; background: var(--surface-2); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.masterbar > div { height: 100%; background: var(--grad); transition: width .6s cubic-bezier(.3,.8,.3,1); }

/* ---------- store ---------- */
.store-tier { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 16px 0 8px; }
.reward-card { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; transition: transform .12s, box-shadow .12s; }
.reward-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(30,12,70,.4); }
.reward-card .ic { font-size: 32px; }
.reward-card .grow { flex: 1; }
.reward-card .rlabel { font-weight: 800; font-size: 17px; }
.reward-card .rcost { color: var(--muted); font-weight: 800; font-size: 14px; }

/* ---------- parent / inputs ---------- */
.pending { background: linear-gradient(135deg, #fff7ed, #fff1f2); border: 1px solid #fed7aa; border-radius: var(--radius-sm); padding: 16px; margin-bottom: 10px; }
.input { width: 100%; padding: 14px; font-size: 18px; border-radius: 12px; border: 2px solid var(--line); font-family: inherit; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.pin-dots .d { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.25); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.pin-dots .d.on { background: var(--grad); box-shadow: 0 0 12px rgba(168,85,247,.7); }
.keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.key { font-family: var(--font-display); background: var(--surface-2); border: none; border-radius: 16px; padding: 18px; font-size: 24px; font-weight: 600; cursor: pointer; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .1s; }
.key:active { transform: scale(.95); }

.back { color: rgba(255,255,255,.9); cursor: pointer; font-weight: 800; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 15px; }
.back:hover { color: #fff; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- kid header avatar ---------- */
.kid-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 4px; }
.avatar.sm { width: 60px; height: 60px; font-size: 32px; margin: 0; }
.avatar.tap { cursor: pointer; transition: transform .14s; }
.avatar.tap:active { transform: scale(.9) rotate(-8deg); }

/* ---------- badges ---------- */
.badge-shelf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width:420px){ .badge-shelf { grid-template-columns: repeat(3, 1fr); } }
.badge { aspect-ratio: 1; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, #fff6e3, #ffe2b8); box-shadow: 0 6px 16px -8px rgba(245,158,11,.6), inset 0 1px 0 rgba(255,255,255,.6); }
.badge .bi { font-size: 30px; }
.badge.locked { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.badge.locked .bi { filter: grayscale(1); opacity: .3; }
.new-badges { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0; }
.new-badges .badge { width: 72px; }
.badge.pop { animation: badgePop .65s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes badgePop { 0%{ transform: scale(0) rotate(-25deg);} 70%{ transform: scale(1.25) rotate(8deg);} 100%{ transform: scale(1) rotate(0);} }

/* ---------- progress dashboard ---------- */
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.dash-card { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid rgba(255,255,255,.6); animation: cardIn .4s ease both; }
.dash-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dash-head .grow { flex: 1; }
.dash-name { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.dash-sp { font-family: var(--font-display); font-weight: 600; color: #b45309; background: #fff6e3; padding: 6px 13px; border-radius: 999px; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(245,158,11,.2); }
.dash-card .k, .stat .sl, .wd .wl { color: var(--muted); font-weight: 800; }
.dash-card .k { font-size: 13px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 10px 6px; text-align: center; }
.stat .sv { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); }
.stat .sl { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.ladder { display: flex; gap: 4px; margin-top: 6px; }
.ladder .seg { flex: 1; height: 10px; border-radius: 4px; background: var(--line); }
.ladder .seg.done { background: var(--grad); }
.ladder .seg.cur { background: var(--grad-gold); box-shadow: 0 0 0 3px rgba(251,191,36,.28); }
.week { display: flex; gap: 6px; margin-top: 6px; }
.wd { flex: 1; text-align: center; }
.wd .dot { display: block; width: 22px; height: 22px; border-radius: 50%; margin: 0 auto 3px; background: var(--line); }
.wd .dot.on { background: linear-gradient(135deg, var(--good), var(--cyan)); box-shadow: 0 3px 10px -2px rgba(16,185,129,.6); }
.wd .wl { font-size: 11px; }
.badge-shelf.mini { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.badge-shelf.mini .badge { border-radius: 12px; }
.badge-shelf.mini .badge .bi { font-size: 20px; }
details.manage { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
details.manage summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; color: var(--violet); font-size: 14px; list-style: none; }
details.manage summary::-webkit-details-marker { display: none; }
details.manage summary::before { content: "▸ "; }
details.manage[open] summary::before { content: "▾ "; }

/* ---------- how-it-works ---------- */
.card.how h3 { font-family: var(--font-display); margin: 0 0 8px; font-size: 19px; font-weight: 600; }
.card.how p { margin: 0 0 6px; line-height: 1.6; color: var(--ink-soft); font-weight: 600; }
.card.how ul { margin: 6px 0; padding-left: 20px; line-height: 1.65; color: var(--ink-soft); font-weight: 600; }
.card.how li { margin-bottom: 4px; }
.card.how .act-group { font-family: var(--font-display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--brand, #7c3aed); margin: 18px 0 8px; }
.card.how .act-group span { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.act-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.act-item:first-of-type { border-top: none; }
.act-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 21px;
  background: linear-gradient(135deg, #efe9ff, #e6f7ff); box-shadow: inset 0 0 0 1px rgba(124,58,237,.12); }
.act-tx { font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); font-weight: 600; }
.act-tx b { color: var(--ink); font-weight: 800; }

/* cross-device sync */
.sync-code { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); background: linear-gradient(135deg, #eef0ff, #e6f7ff);
  border: 1px dashed rgba(124,58,237,.4); border-radius: 12px; padding: 10px 14px; display: inline-block; }
.sync-code b { font-size: 22px; letter-spacing: 3px; color: var(--brand, #7c3aed); margin-left: 6px; }
.sync-input { width: 100%; max-width: 280px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 2px; text-transform: uppercase;
  padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); }
.sync-input:focus { outline: none; border-color: var(--brand, #7c3aed); }
.card.how.evidence { background: linear-gradient(160deg, #f4efff, #e9fbff); border: 1px solid rgba(124,58,237,.30); }
.ev-item { display: block; padding: 12px 0; border-top: 1px solid var(--line); }
.ev-item:first-of-type { border-top: none; }
.ev-find { display: block; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 3px; }
.ev-find::before { content: "✓ "; color: var(--good); font-weight: 900; }
.ev-do { display: block; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); font-weight: 600; }

/* ---------- entrance + confetti ---------- */
@keyframes cardIn { from { transform: translateY(15px) scale(.985); } to { transform: translateY(0) scale(1); } }
.profile-card:nth-child(2) { animation-delay: .07s; }
.burst { position: fixed; inset: 0; pointer-events: none; display: grid; place-items: center; z-index: 50; }
.burst .star { position: absolute; font-size: 34px; animation: floatUp .9s ease-out forwards; }
@keyframes floatUp { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(-170px) rotate(40deg); opacity: 0; } }
