/* Ascend — playful, kid-friendly UI. Mobile-first, works laptop → tablet → phone. */
:root {
  --bg: #f4f1fb; --card: #ffffff; --ink: #241c3b; --muted: #7a7391;
  --primary: #7048e8; --primary-d: #5a37c9; --good: #12b886; --warn: #f76707;
  --radius: 20px; --shadow: 0 8px 24px rgba(80,50,160,.10);
  --font: 'Baloo 2', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { min-height: 100vh; }
#app { max-width: 720px; margin: 0 auto; padding: 0 14px 96px; }
h1, h2, h3 { margin: 0 0 8px; }
button { font-family: inherit; cursor: pointer; border: none; }
.muted { color: var(--muted); font-size: 13px; }
.grow { flex: 1; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }
.page { padding-top: 8px; animation: rise .28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* buttons */
.btn { border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: 15px; background: #eee; color: var(--ink); transition: transform .08s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, #7048e8, #9775fa); color: #fff; box-shadow: 0 6px 16px rgba(112,72,232,.35); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.big { font-size: 17px; padding: 14px 26px; margin-top: 10px; }
.btn.wide { width: 100%; margin: 8px 0; }
.icon-btn { background: #fff; border-radius: 999px; width: 40px; height: 40px; font-size: 20px; box-shadow: var(--shadow); }
.chip-btn { background: #efe9fd; color: var(--primary-d); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; margin-left: 8px; }
.mini { background: #efe9fd; color: var(--primary-d); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 12px; }

/* topbar + nav */
.topbar { display: flex; align-items: center; padding: 14px 4px 4px; }
.brand { font-size: 20px; font-weight: 800; }
.navbar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; display: flex; justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(80,50,160,.10); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; border-radius: 22px 22px 0 0; }
.nav-item { background: none; color: var(--muted); font-size: 11px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 18px; }
.nav-item.on { color: var(--primary); }
.nav-ic { font-size: 22px; }

/* login */
.login { text-align: center; padding: 8vh 10px 40px; }
.login .logo { font-size: 64px; }
.login h1 { font-size: 40px; margin: 4px 0 0; }
.login .tag { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.demo-note { color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 12px; }
.profile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; font-weight: 700; }
.profile.parent { grid-column: span 2; }
.profile .avatar { font-size: 40px; }
.profile .role { color: var(--muted); font-size: 12px; font-weight: 600; }
.inp { display: block; width: 100%; padding: 13px 16px; border: 2px solid #e6e0f5; border-radius: 14px; font-size: 15px; margin: 8px 0; background: #fff; }
.inp:focus { outline: none; border-color: var(--primary); }
.msg { color: var(--warn); min-height: 18px; font-size: 13px; }

/* hero */
.hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero-txt { flex: 1; min-width: 200px; }
.hero-txt h2 { font-size: 24px; }
.ring { flex-shrink: 0; }
.ring-pct { font-size: 26px; font-weight: 800; fill: var(--ink); }
.ring-lbl { font-size: 11px; fill: var(--muted); }

/* badges */
.badge { display: inline-block; border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: 13px; margin: 4px 0; }
.badge.good { background: #e6fcf5; color: var(--good); }
.badge.warn { background: #fff4e6; color: var(--warn); }
.chip { display: inline-block; border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 12px; }

/* mission */
.mission { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mission-name { font-weight: 800; font-size: 17px; flex: 1; }

/* unit rows / bars */
.unit-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.unit-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; }
.unit-mid { flex: 1; }
.unit-name { font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.unit-count { font-weight: 800; color: var(--muted); }
.bar { height: 12px; background: #eee; border-radius: 999px; overflow: hidden; }
.bar.sm { height: 8px; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .5s; }
.unit-head { font-weight: 800; margin: 14px 0 6px; }
.skill-line { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.skill-nm { flex: 1; font-size: 14px; }
.skill-line .bar { width: 90px; }
.star { font-size: 16px; }

/* practice */
.practice .q { font-size: 22px; font-weight: 800; margin: 18px 0; line-height: 1.4; }
.smart { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-weight: 700; }
.smart .bar { flex: 1; }
.options { display: grid; gap: 10px; }
.option { background: #f6f3fe; border: 2px solid #eae3fb; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 700; text-align: left; transition: .12s; }
.option:hover { border-color: var(--primary); }
.answer-row { display: flex; gap: 10px; }
.answer-row .inp { margin: 0; }
.answer { font-size: 18px; }
.feedback { margin-top: 16px; font-weight: 800; font-size: 16px; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--warn); }
.feedback .expl { font-weight: 500; color: var(--ink); font-size: 14px; margin: 8px 0 12px; background: #f6f3fe; padding: 12px; border-radius: 12px; }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: #f6f3fe; border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat-big { font-size: 22px; font-weight: 800; color: var(--primary-d); }
.stat-lbl { font-size: 12px; font-weight: 700; }
.stat-sub { font-size: 10px; color: var(--muted); }
@media (max-width: 520px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* parent */
.ph { padding: 6px 4px; }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.child-card { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.child-name { font-weight: 800; }
.sub { color: var(--muted); font-size: 12px; }
.pace-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.pace-track { position: relative; height: 16px; background: #eee; border-radius: 999px; margin: 12px 0 4px; overflow: hidden; }
.pace-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg,#7048e8,#9775fa); border-radius: 999px; }
.pace-expected { position: absolute; top: -3px; bottom: -3px; width: 3px; background: #f76707; border-radius: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--primary-d); font-weight: 700; }
.seg { display: inline-flex; background: #efe9fd; border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.seg-btn { background: none; border-radius: 999px; padding: 7px 16px; font-weight: 800; font-size: 13px; color: var(--primary-d); }
.seg-btn.on { background: #fff; box-shadow: var(--shadow); }
.unit-report { margin: 10px 0; }
.ur-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 5px; gap: 8px; }

/* writing */
.wide-seg { display: flex; width: 100%; overflow-x: auto; }
.wide-seg .seg-btn { white-space: nowrap; }
.wprompt { font-size: 16px; font-weight: 600; margin: 8px 0 12px; }
.writing-area { width: 100%; resize: vertical; line-height: 1.5; font-size: 15px; min-height: 180px; }
.tiny-note { font-size: 11px; color: var(--muted); margin-top: 8px; }
.wresult { margin-top: 8px; }
.scorecard { margin-top: 14px; }
.sc-total { display: flex; align-items: baseline; gap: 8px; background: #f6f3fe; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.sc-num { font-size: 34px; font-weight: 800; color: var(--primary-d); }
.sc-den { font-weight: 700; color: var(--muted); }
.sc-ov { margin-left: auto; font-weight: 800; }
.sc-dim { margin: 12px 0; }
.sc-dim-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.sc-notes { margin: 8px 0 0; padding-left: 18px; }
.sc-notes li { font-size: 13px; color: var(--ink); margin: 3px 0; }
.sc-good { font-size: 13px; color: var(--good); font-weight: 700; margin-top: 6px; }
.draft-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid #f0ecf9; }
.draft-mid { flex: 1; min-width: 0; }
.draft-date { font-weight: 700; font-size: 13px; }
.draft-prev { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-score { font-weight: 800; border-radius: 999px; padding: 6px 12px; font-size: 13px; }

/* plan editor */
.flabel { display: block; font-weight: 700; font-size: 13px; margin: 12px 0 2px; }
.edit-plan { display: inline-block; margin: 6px 0; }

/* math sprint game */
.play-card { display: flex; align-items: center; gap: 14px; cursor: pointer; background: linear-gradient(135deg, #7048e8, #f76707); color: #fff; }
.play-emoji { font-size: 38px; }
.play-title { font-weight: 800; font-size: 18px; }
.play-sub { font-size: 12px; opacity: .9; }
.game-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }
.hud-timer { background: #fff; border-radius: 16px; padding: 10px 18px; box-shadow: var(--shadow); font-size: 15px; color: var(--muted); font-weight: 700; }
.hud-timer b { font-size: 24px; color: var(--ink); }
.hud-timer.low b { color: var(--warn); }
.hud-timer.low { animation: pulse .6s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.hud-score { background: #fff; border-radius: 16px; padding: 10px 18px; box-shadow: var(--shadow); font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }
.hud-score b { display: block; font-size: 22px; color: var(--primary-d); }
.hud-streak { background: #fff4e6; color: var(--warn); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 800; font-size: 18px; }
.game-card { min-height: 260px; }
.game-q { font-size: 24px; }
.game-opts .option { font-size: 18px; padding: 17px; text-align: center; }
.game-opts .option.right { background: #d3f9d8; border-color: var(--good); }
.game-opts .option.wrong { background: #ffe3e3; border-color: var(--warn); }
.game-splash { text-align: center; padding: 30px 18px; }
.game-logo { font-size: 60px; }
.game-best { background: #f6f3fe; border-radius: 14px; padding: 12px; font-weight: 700; margin: 12px 0; }
.game-score { font-size: 56px; font-weight: 800; color: var(--primary-d); margin: 6px 0; }

/* profile chip in topbar */
.me-chip { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 5px 10px 5px 6px; box-shadow: var(--shadow); font-size: 12px; font-weight: 800; margin-left: 8px; }
.me-av { font-size: 18px; }
.me-coin { color: var(--warn); }

/* daily strip + afternoon */
.daily-strip { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.ds-flame { font-size: 18px; font-weight: 800; color: var(--warn); }
.ds-mid { flex: 1; }
.ds-txt { font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.ds-coin { font-weight: 800; color: var(--warn); }
.afternoon { background: linear-gradient(135deg, #12b886, #20c997); color: #fff; font-weight: 800; text-align: center; }

/* play hub */
.hubbar { display: flex; align-items: center; justify-content: space-around; padding: 12px; }
.hub-lv { text-align: center; }
.hub-lv b { display: block; font-size: 18px; color: var(--primary-d); }
.hub-lv span { font-size: 11px; color: var(--muted); font-weight: 700; }
.hub-coin, .hub-streak { font-weight: 800; font-size: 16px; }
.hub-coin.big { font-size: 20px; }
.mode-grid { display: grid; gap: 14px; }
.mode-card { color: #fff; cursor: pointer; padding: 22px; }
.mode-card.locked { background: #e9e5f3 !important; color: var(--muted); cursor: default; }
.mode-emoji { font-size: 40px; }
.mode-nm { font-size: 20px; font-weight: 800; }
.mode-sub { font-size: 13px; opacity: .92; }

/* boss battle */
.boss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.boss-pick { text-align: center; cursor: pointer; }
.boss-face { font-size: 46px; }
.boss-face.big { font-size: 54px; }
.boss-nm { font-weight: 800; font-size: 14px; margin: 4px 0 8px; }
.boss-arena { background: linear-gradient(135deg, #2b2140, #4b2e83); color: #fff; }
.boss-hpwrap { display: flex; align-items: center; gap: 14px; }
.boss-mid { flex: 1; }
.boss-title { font-weight: 800; margin-bottom: 6px; }
.boss-sub { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.streak-count { font-weight: 800; font-size: 15px; }
.hearts { font-size: 17px; letter-spacing: 2px; }
.streak-meter { display: flex; gap: 4px; }
.streak-seg { flex: 1; height: 12px; border-radius: 4px; background: rgba(255,255,255,.22); transition: background .2s; }
.streak-seg.lit { box-shadow: 0 0 8px rgba(255,255,255,.5); }
.boss-timebar { height: 12px; background: rgba(255,255,255,.22); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.boss-timebar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #69db7c, #ffd43b); border-radius: 999px; }
.boss-timebar-fill.danger { background: #ff6b6b; }
.boss-timelabel { text-align: right; font-weight: 800; font-size: 13px; margin-top: 5px; color: rgba(255,255,255,.85); }

/* profile */
.profile-hero { display: flex; align-items: center; gap: 16px; }
.profile-av { font-size: 56px; }
.profile-mid { flex: 1; }
.profile-nm { font-size: 22px; font-weight: 800; }
.profile-title { color: var(--primary-d); font-weight: 700; margin-bottom: 6px; }
.quest-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.quest-mid { flex: 1; }
.quest-txt { font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.quest-r { font-weight: 800; color: var(--muted); font-size: 13px; }
.claim { background: #fff4e6; color: var(--warn); animation: pulse 1s infinite; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.badge-cell { text-align: center; background: #f6f3fe; border-radius: 14px; padding: 12px 6px; }
.badge-cell.locked { opacity: .45; filter: grayscale(1); }
.badge-em { font-size: 30px; }
.badge-nm { font-size: 11px; font-weight: 700; margin-top: 4px; }

/* shop */
.shopbar { display: flex; align-items: center; justify-content: space-between; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.shop-cell { background: #f6f3fe; border: 2px solid transparent; border-radius: 16px; padding: 12px 6px; text-align: center; cursor: pointer; }
.shop-cell.equipped { border-color: var(--primary); background: #efe9fd; }
.shop-em { font-size: 34px; }
.shop-tag { font-size: 11px; font-weight: 800; color: var(--primary-d); margin-top: 4px; }
.theme-swatch { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto; }
.theme-nm { font-size: 11px; font-weight: 700; margin-top: 2px; }

/* leaderboard */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #f0ecf9; }
.lb-row.me { background: #efe9fd; border-radius: 12px; padding: 10px; border-top: none; }
.lb-rank { font-size: 20px; font-weight: 800; width: 34px; text-align: center; }
.lb-av { font-size: 26px; }
.lb-nm { flex: 1; font-weight: 700; }
.lb-xp { font-weight: 800; color: var(--primary-d); }

/* lessons (teaching) */
.practice-top { display: flex; align-items: center; justify-content: space-between; }
.lesson-concept { font-size: 15px; line-height: 1.55; margin: 10px 0; }
.lesson-box { background: #f6f3fe; border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.lesson-box h4 { margin: 0 0 8px; }
.wstep { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; font-size: 14px; }
.wnum { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.vrow { font-size: 14px; margin: 4px 0; }
.lesson-warn { background: #fff4e6; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 8px 0; }
.lesson-why { background: #e6fcf5; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 8px 0 14px; }

/* animated + narrated lesson */
.mascot-row { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 6px; }
.mascot { font-size: 44px; line-height: 1; animation: mbounce .8s ease; flex-shrink: 0; }
.bubble { background: #f1ecfe; border-radius: 16px; border-top-left-radius: 4px; padding: 12px 14px; flex: 1; font-size: 15px; line-height: 1.55; animation: bubblein .5s ease .15s both; }
@keyframes mbounce { 0% { transform: translateY(-20px) scale(.6); opacity: 0; } 60% { transform: translateY(3px) scale(1.08); opacity: 1; } 100% { transform: none; } }
@keyframes bubblein { from { opacity: 0; transform: translateX(-10px) scale(.96); } to { opacity: 1; transform: none; } }
.voice-row { display: flex; gap: 8px; margin: 4px 0 2px; }
.wstep.reveal { animation: stepin .45s ease both; }
@keyframes stepin { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.wstep.now { background: #efe9fd; border-radius: 10px; padding: 6px 8px; margin: 6px -8px; }
.wstep.now .wnum { animation: numpop .4s ease; }
@keyframes numpop { 0% { transform: scale(.4); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.lesson-ctl { margin-top: 10px; }
.btn.pulse { animation: btnpulse 1.1s ease infinite; }
@keyframes btnpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.btn[disabled] { opacity: .55; box-shadow: none; animation: none; }

/* Level Ladder */
.ladder-rung { border-left: 6px solid #d6ccee; }
.ladder-rung.clear { border-left-color: var(--good); }
.ladder-rung.gold { border-left-color: #f59f00; background: linear-gradient(180deg, rgba(245,159,0,.07), var(--card)); }
.rung-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rung-name b { font-size: 17px; }
.rung-best { font-weight: 800; color: var(--muted); font-size: 13px; }
.ladder-prow { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.ladder-pmid { flex: 1; min-width: 140px; }
.ladder-prow .inp { flex: 1; min-width: 150px; }

/* assignments */
.assign-card { border: 2px solid var(--primary); }
.assign-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; border-top: 1px solid #f0ecf9; }
.assign-row:first-of-type { border-top: none; }
.assign-mid { flex: 1; }
.assign-nm { font-weight: 700; font-size: 14px; }

/* parent needs-review */
.action-row { display: flex; gap: 10px; }
.action-row .btn { flex: 1; }
.rev-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.miss { background: #f6f3fe; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.miss-q { font-weight: 700; font-size: 14px; }
.miss-a { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.wrongtag { background: #ffe3e3; color: #c92a2a; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.righttag { background: #d3f9d8; color: #2b8a3e; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.miss-ex { font-size: 12px; color: var(--muted); }

/* FAST readiness + heatmap */
.fast-head, .fade-alert, .sug-head, .fast-prog { }
.fast-head { display: flex; align-items: center; justify-content: space-between; }
.fast-band { background: var(--primary); color: #fff; border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: 13px; }
.heatmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 5px; margin: 6px 0; }
.hcell { aspect-ratio: 1; border-radius: 6px; background: #e9ecef; }
.hcell.h1 { background: #ffc9c9; } .hcell.h2 { background: #ffe066; } .hcell.h3 { background: #8ce99a; } .hcell.h4 { background: #2f9e44; }
.hcell.h0 { background: #e9ecef; }
.hcell.faded { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.14) 0 3px, transparent 3px 6px); }
.fade-alert { background: #fff4e6; color: #e8590c; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; margin: 8px 0; }
.sug-head { font-weight: 800; margin: 10px 0 4px; font-size: 14px; }
.sug-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.sug-nm { flex: 1; font-size: 14px; }
.fast-prog b { font-size: 14px; }
.fast-prog .bar { margin-top: 6px; }

/* dark mode */
:root[data-theme="dark"] {
  --bg: #16131f; --card: #211c30; --ink: #ece9f5; --muted: #9a92b5; --shadow: 0 8px 24px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .option { background: #2b2440; border-color: #3a3255; }
:root[data-theme="dark"] .stat, :root[data-theme="dark"] .lesson-box, :root[data-theme="dark"] .miss,
:root[data-theme="dark"] .badge-cell, :root[data-theme="dark"] .shop-cell, :root[data-theme="dark"] .seg,
:root[data-theme="dark"] .stat-sub, :root[data-theme="dark"] .smart { background: #2b2440; }
:root[data-theme="dark"] .inp { background: #2b2440; border-color: #3a3255; color: var(--ink); }
:root[data-theme="dark"] .icon-btn, :root[data-theme="dark"] .me-chip, :root[data-theme="dark"] .hud-timer,
:root[data-theme="dark"] .hud-score, :root[data-theme="dark"] .navbar { background: #211c30; }
:root[data-theme="dark"] .bar, :root[data-theme="dark"] .hcell.h0 { background: #362e4d; }
:root[data-theme="dark"] .lesson-warn, :root[data-theme="dark"] .fade-alert { background: #3a2a1a; }
:root[data-theme="dark"] .lesson-why { background: #12332a; }
:root[data-theme="dark"] .bubble, :root[data-theme="dark"] .wstep.now { background: #2b2440; }

/* confetti + celebrate toast */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti span { position: absolute; top: -30px; animation: fall 2.2s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }
#celebrateToast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-30px); background: linear-gradient(135deg, #7048e8, #f76707); color: #fff;
  padding: 12px 22px; border-radius: 999px; font-size: 15px; font-weight: 800; opacity: 0; pointer-events: none; transition: .3s; z-index: 101; box-shadow: var(--shadow); text-align: center; max-width: 90%; }
#celebrateToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* save toast */
#saveToast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; }
#saveToast.show { opacity: .95; transform: translateX(-50%) translateY(0); }

.build-stamp { font-size: 11px; color: var(--muted); margin: -14px 0 18px; opacity: .7; }

/* Coach's Report */
.coach-card { border: 2px solid var(--primary); background: linear-gradient(180deg, rgba(112,72,232,.06), var(--card)); }
.coach-head { display: flex; align-items: center; gap: 8px; }
.coach-ic { font-size: 22px; }
.coach-live { margin-left: auto; background: var(--good); color: #fff; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.coach-headline { font-weight: 800; font-size: 16px; margin: 8px 0 10px; }
.coach-lines { display: flex; flex-direction: column; gap: 7px; }
.coach-line { font-size: 14px; line-height: 1.45; background: rgba(112,72,232,.05); border-radius: 10px; padding: 8px 10px; }
:root[data-theme="dark"] .coach-line { background: #2b2440; }

/* family dashboard — child selection */
.family-head { text-align: center; padding: 12px 4px 2px; }
.family-head h2 { font-size: 24px; }
.child-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 340px)); gap: 18px; justify-content: center; margin-top: 14px; }
.child-tile { background: var(--card); border: none; border-radius: 26px; box-shadow: var(--shadow); padding: 26px 22px 22px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; overflow: hidden; width: 100%;
  transition: transform .14s ease, box-shadow .14s ease; }
.child-tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 84px; background: linear-gradient(135deg, var(--primary), #9775fa); opacity: .14; }
.child-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 36px rgba(80,50,160,.20); }
.child-tile:active { transform: scale(.985); }
.tile-top { display: flex; align-items: center; gap: 14px; width: 100%; position: relative; }
.tile-av { width: 58px; height: 58px; border-radius: 50%; background: #efe9fd; display: grid; place-items: center; font-size: 32px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(112,72,232,.18); }
:root[data-theme="dark"] .tile-av { background: #362e4d; }
.tile-id { text-align: left; min-width: 0; }
.tile-name { font-weight: 800; font-size: 22px; line-height: 1.1; }
.tile-sub { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-stats { display: flex; gap: 26px; justify-content: center; margin-top: 2px; }
.tile-stat { text-align: center; }
.tile-stat b { display: block; font-size: 19px; color: var(--primary-d); }
.tile-stat span { font-size: 11px; color: var(--muted); font-weight: 700; }
.tile-cta { font-weight: 800; color: var(--primary); font-size: 14px; margin-top: 4px; }

/* daily / weekly goal card */
.goal-card { border: 2px solid var(--good); }
.goal-card.goal-complete { background: linear-gradient(180deg, rgba(18,184,134,.10), var(--card)); }
.goal-head { font-weight: 800; font-size: 16px; margin-bottom: 10px; }
.goal-row { margin: 8px 0; }
.goal-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.goal-hit { color: var(--good); }
.data-card p { margin: 6px 0 12px; }

/* Build It! — interactive manipulatives */
.build-area { text-align: center; }
.build-prompt { font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.build-prompt b { color: var(--primary-d); font-size: 26px; }
.build-status { margin-top: 12px; font-weight: 700; color: var(--muted); font-size: 15px; }
.build-status.ok { color: var(--good); }
.build-status b { color: var(--ink); font-size: 20px; }
/* base-ten */
.tenmat { display: flex; justify-content: center; gap: 14px; align-items: flex-start; }
.ten-col { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ten-blocks { min-height: 80px; display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; align-content: flex-start; padding: 6px; background: #f6f3fe; border-radius: 12px; width: 100%; }
:root[data-theme="dark"] .ten-blocks { background: #2b2440; }
.blk { cursor: pointer; border-radius: 3px; transition: transform .08s; }
.blk:active { transform: scale(.9); }
.blk-h { width: 40px; height: 40px; background: #7048e8; background-image: repeating-linear-gradient(0deg,rgba(255,255,255,.35) 0 1px,transparent 1px 4px),repeating-linear-gradient(90deg,rgba(255,255,255,.35) 0 1px,transparent 1px 4px); }
.blk-t { width: 12px; height: 40px; background: #1c7ed6; background-image: repeating-linear-gradient(0deg,rgba(255,255,255,.4) 0 1px,transparent 1px 4px); }
.blk-o { width: 12px; height: 12px; background: #20c997; }
.ten-add { width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 22px; font-weight: 800; box-shadow: var(--shadow); }
.ten-lbl { font-size: 12px; font-weight: 700; color: var(--muted); }
/* fractions */
.frac-bar { display: flex; width: 100%; max-width: 420px; height: 90px; margin: 0 auto; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.frac-seg { flex: 1; border-right: 2px solid var(--ink); cursor: pointer; transition: background .12s; }
.frac-seg:last-child { border-right: none; }
.frac-seg.on { background: var(--primary); }
.frac-seg:active { opacity: .7; }

/* add-child form */
.field-lbl { display: block; font-weight: 800; font-size: 13px; margin: 12px 0 4px; color: var(--muted); }
.av-row { display: flex; flex-wrap: wrap; gap: 8px; }
.av-pick { width: 48px; height: 48px; border-radius: 14px; background: #f6f3fe; font-size: 26px; border: 2px solid transparent; }
.av-pick.on { border-color: var(--primary); background: #efe9fd; }
:root[data-theme="dark"] .av-pick { background: #2b2440; }
.grade-pick { flex: 1; min-width: 120px; padding: 12px; border-radius: 14px; background: #f6f3fe; font-weight: 800; border: 2px solid transparent; color: var(--ink); }
.grade-pick.on { border-color: var(--primary); background: #efe9fd; color: var(--primary-d); }
:root[data-theme="dark"] .grade-pick { background: #2b2440; }

/* Build It! — clock, coins, array */
.clock-face { display: flex; justify-content: center; margin: 6px 0; }
.clock-steppers { display: flex; gap: 16px; justify-content: center; margin: 10px 0; }
.stepper { display: flex; align-items: center; gap: 10px; background: #f6f3fe; border-radius: 14px; padding: 6px 10px; }
:root[data-theme="dark"] .stepper { background: #2b2440; }
.step-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 22px; font-weight: 800; }
.step-lbl { font-weight: 800; font-size: 13px; min-width: 58px; text-align: center; }
.coin-jar { min-height: 90px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: flex-start; padding: 10px; background: #f6f3fe; border-radius: 14px; }
:root[data-theme="dark"] .coin-jar { background: #2b2440; }
.coin { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; cursor: pointer; box-shadow: inset 0 -2px 4px rgba(0,0,0,.2); border: 2px solid rgba(0,0,0,.15); }
.coin-palette { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.coin-pick { width: 62px; height: 62px; border-radius: 50%; color: #fff; font-weight: 800; box-shadow: inset 0 -3px 5px rgba(0,0,0,.2); border: 2px solid rgba(0,0,0,.15); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.coin-pick small { font-size: 9px; opacity: .9; font-weight: 600; }
.array-box { display: inline-flex; flex-direction: column; gap: 6px; padding: 12px; background: #f6f3fe; border-radius: 14px; margin: 0 auto; }
:root[data-theme="dark"] .array-box { background: #2b2440; }
.array-row { display: flex; gap: 6px; }
.array-dot { width: 26px; height: 26px; border-radius: 6px; background: var(--primary); }

.build-tag { font-size: 11px; font-weight: 800; color: var(--muted); background: #efe9fd; border-radius: 999px; padding: 4px 9px; }
:root[data-theme="dark"] .build-tag { background: #2b2440; }

/* Advanced (Grade 6 stretch) mode */
.practice.advanced { background: linear-gradient(180deg, #fff4e6, var(--card)); border: 3px solid #f76707; box-shadow: 0 10px 30px rgba(247,103,7,.25); }
:root[data-theme="dark"] .practice.advanced { background: linear-gradient(180deg, #3a2a1a, var(--card)); }
.adv-banner { background: linear-gradient(135deg, #f76707, #e64980); color: #fff; font-weight: 800; text-align: center; border-radius: 14px; padding: 10px; margin-bottom: 12px; letter-spacing: .5px; animation: advpulse 1.4s ease-in-out infinite; }
@keyframes advpulse { 50% { filter: brightness(1.12); } }
.practice.advanced .q { color: #d9480f; }
:root[data-theme="dark"] .practice.advanced .q { color: #ffa94d; }
.stretch-btn { background: linear-gradient(135deg, #f76707, #e64980); color: #fff; box-shadow: 0 6px 16px rgba(247,103,7,.35); }

/* Ready-to-move-up card */
.moveup-card { text-align: center; border: 3px solid var(--good); background: linear-gradient(180deg, rgba(18,184,134,.12), var(--card)); }
.moveup-emoji { font-size: 46px; }

/* Number Runner arcade */
.runner-prompt { flex: 1; text-align: center; font-size: 22px; font-weight: 800; }
.runner-field { position: relative; overflow: hidden; background: linear-gradient(180deg, #e7f5ff, #d0ebff); border-radius: 18px; margin: 10px 0; box-shadow: inset 0 0 0 3px rgba(28,126,214,.25); }
:root[data-theme="dark"] .runner-field { background: linear-gradient(180deg, #1a2740, #12203a); }
.runner-field::before, .runner-field::after { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(28,126,214,.2); }
.runner-field::before { left: 33.333%; } .runner-field::after { left: 66.666%; }
.runner-gate { position: absolute; top: 0; left: 0; right: 0; height: 60px; will-change: transform; }
.runner-door { position: absolute; width: 33.333%; height: 60px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #7048e8, #9775fa); border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,.2); border: 2px solid rgba(255,255,255,.4); cursor: pointer; }
.runner-guy { position: absolute; bottom: 8px; transform: translateX(-50%); font-size: 40px; transition: left .1s ease; z-index: 2; }
.runner-controls { display: flex; gap: 14px; justify-content: center; }
.run-btn { font-size: 26px; width: 42%; padding: 16px; }
.runner-field.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.run-drop { background: linear-gradient(135deg, #f76707, #e64980); color: #fff; font-size: 18px; width: 30%; padding: 16px; box-shadow: 0 6px 16px rgba(247,103,7,.35); }

/* restore points */
.restore-head { font-weight: 800; font-size: 13px; margin: 14px 0 6px; }
.restore-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f0ecf9; }
.restore-mid { flex: 1; }
.restore-when { font-weight: 700; font-size: 13px; }
:root[data-theme="dark"] .restore-row { border-color: #2b2440; }

/* parent reward control */
.reward-card { border: 2px dashed var(--warn); }
.reward-top { display: flex; align-items: center; justify-content: space-between; }
.reward-coins { font-weight: 800; color: var(--warn); font-size: 16px; }
.reward-btns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.reward-btns .mini { padding: 10px 16px; font-size: 14px; }

/* real-world perks */
.perk-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #f0ecf9; }
:root[data-theme="dark"] .perk-row { border-color: #2b2440; }
.perk-e { font-size: 28px; }
.perk-mid { flex: 1; }
.perk-nm { font-weight: 700; font-size: 14px; }
.perk-honor-card { border: 2px solid #f59f00; background: linear-gradient(180deg, rgba(245,159,0,.10), var(--card)); }

/* coin ledger */
.coinlog-sum { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; padding: 3px 0; }
.coinlog-sum b { color: var(--warn); }
.coinlog-row { font-size: 11px; color: var(--muted); padding: 2px 0; }

/* focus meter + interests */
.focus-line { font-size: 12px; font-weight: 700; color: var(--good); margin: 4px 0 8px; }
.focus-line.slow { color: var(--warn); }
.interest-row { display: flex; flex-wrap: wrap; gap: 8px; }
.interest-chip { background: #efe9fd; color: var(--primary-d); border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 13px; }
.interest-chip.on { background: linear-gradient(135deg, #7048e8, #9775fa); color: #fff; box-shadow: 0 4px 12px rgba(112,72,232,.35); }
:root[data-theme="dark"] .interest-chip { background: #2b2440; color: #cabffa; }
:root[data-theme="dark"] .interest-chip.on { background: linear-gradient(135deg, #7048e8, #9775fa); color: #fff; }
.build-status.warn { color: var(--warn); }
.mis-tag { font-size: 13px; font-weight: 700; color: var(--warn); margin: 6px 0; }
.warmup-card { border-left: 6px solid var(--good); }
.ev-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }

/* comfort: reduced motion + bigger text + read-aloud */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
html[data-bigtext="1"] { font-size: 115%; }
.say-btn { margin-left: 8px; vertical-align: middle; }
