/* Paige Re-imagined: "Living Diorama" + "Studio" */
:root {
  --paper: #FBF7EF;
  --paper-2: #F3ECDF;
  --card: #FFFFFF;
  --ink: #1E2235;
  --ink-2: #565C74;
  --line: rgba(30, 34, 53, .09);
  --coral: #FF6B4A;
  --violet: #7A5CFF;
  --teal: #12B5A6;
  --gold: #FFC23D;
  --good: #0E9E8F;
  --c: var(--coral);
  --r-lg: 28px;
  --r: 22px;
  --r-sm: 16px;
  --sh-1: 0 1px 2px rgba(30, 34, 53, .06), 0 4px 14px rgba(30, 34, 53, .05);
  --sh-2: 0 2px 4px rgba(30, 34, 53, .04), 0 14px 34px -10px rgba(30, 34, 53, .18);
  --sh-3: 0 30px 70px -24px rgba(30, 34, 53, .35);
  --f-display: "Fredoka", "Baloo 2", ui-rounded, system-ui, sans-serif;
  --f-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .8, .3, 1);
  --top-h: 68px;
  /* Theme tokens (light). Dark values: html[data-theme="dark"] at the end of this file. */
  --mix: #fff; --dot: rgba(30, 34, 53, .045); --inv-bg: #1E2235; --inv-fg: #fff;
  --tint-gold: #FFF6DC; --tint-gold-line: #F2CF72; --gold-text: #8A5A00;
  --tint-teal: #E6F7F4; --tint-teal-2: #D3F2EE; --teal-text: #0B6E65;
  --tint-violet: #F3F0FF; --violet-line: #E0D9FF; --violet-text: #4C33C9;
  --tint-danger: #F4D6D2; --danger-text: #B23A2E;
  --tint-orange: #FFF1DF; --orange-text: #8A3A12;
  --tint-blue: #EAF2FF; --blue-text: #1F4E9A;
  --star-off: #E3DDD0; --switch-off: #D9D3C7; --stop-base: #E2DACB; --stop-line: #CFC6B4;
  --card-warm: #FFFDF6; --glow: #FFE3D8; --page-frame: transparent;
  color-scheme: light;
}
/* Derived subject tints are recomputed on every element so a local --c takes effect. */
*, ::before, ::after {
  --c-deep: color-mix(in srgb, var(--c) 64%, #1E2235);
  --c-text: var(--c-deep);
  --c-soft: color-mix(in srgb, var(--c) 14%, var(--mix));
  --c-wash: color-mix(in srgb, var(--c) 7%, var(--paper));
}
/* --c-strong: the brightest shade that still gives large white text 3:1 contrast */
:root, [data-subject="Math"] { --c: var(--coral); --c-strong: #E85A3A; }
[data-subject="ELA"] { --c: var(--violet); --c-strong: #7A5CFF; }
[data-subject="Science"] { --c: var(--teal); --c-strong: #0E9C8F; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 500 17px/1.5 var(--f-body);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
html.dyslexia body, html.dyslexia button, html.dyslexia input, html.dyslexia textarea,
html.dyslexia h1, html.dyslexia h2, html.dyslexia h3, html.dyslexia .q-text, html.dyslexia .btn { font-family: "Lexend", var(--f-body) !important; letter-spacing: .01em; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 3.4vw, 38px); }
h2 { font-size: clamp(22px, 2.4vw, 28px); }
h3 { font-size: 20px; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px solid #4AA8FF; outline-offset: 3px; border-radius: 10px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--inv-bg); color: var(--inv-fg); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; flex-wrap: nowrap; }
.kicker { display: block; font: 700 12.5px/1.2 var(--f-body); letter-spacing: .09em; text-transform: uppercase; color: var(--c-text); }
.ico { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.ico svg { width: 100%; height: 100%; }
.glyph { display: inline-flex; width: 44px; height: 44px; color: var(--c-text); flex: none; }
.glyph svg { width: 100%; height: 100%; }
.glyph.sm { width: 30px; height: 30px; }
.glyph.lg { width: 64px; height: 64px; }
.glyph.xl { width: 84px; height: 84px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh-2); padding: 22px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font: 700 13px var(--f-body); background: var(--paper-2); }
.pill.gold { background: var(--tint-gold); color: var(--gold-text); }
.meter { display: block; height: 10px; border-radius: 99px; background: rgba(30, 34, 53, .08); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .5s var(--ease); }
.meter.gold > span { background: linear-gradient(90deg, #FFB020, var(--gold)); }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--inv-bg); --bt: var(--inv-fg); --bs: #000;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: var(--r-sm);
  font: 600 17px/1 var(--f-display); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  background: var(--b); color: var(--bt);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 70%, var(--bs)), 0 8px 18px -8px color-mix(in srgb, var(--b) 60%, transparent);
  transition: transform .15s var(--spring), box-shadow .15s var(--ease), filter .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 70%, var(--bs)); }
.btn:disabled { cursor: default; filter: grayscale(.9) opacity(.45); transform: none; }
.btn.primary, .btn.subject { --b: var(--c-deep); --bt: #fff; }
.btn.gold { --b: var(--gold); --bt: #3D2A00; --bs: #8a5a00; }
.btn.danger { --b: #D9433A; --bt: #fff; }
.btn.ghost { --b: var(--card); --bt: var(--ink); --bs: #9aa; box-shadow: 0 0 0 2px var(--line) inset, 0 3px 0 rgba(30, 34, 53, .1); }
.btn.ghost:active { box-shadow: 0 0 0 2px var(--line) inset; }
.btn.glass { --b: rgba(255, 255, 255, .2); --bt: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); backdrop-filter: blur(6px); }
.btn.play { --b: #fff; --bt: var(--c-deep); --bs: #555; font-size: 20px; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 13px; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 19px; }
.btn.xl { min-height: 64px; padding: 0 34px; font-size: 22px; border-radius: 20px; }
.btn.xl .ico { width: 1.1em; height: 1.1em; }
.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; border: 0; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: var(--sh-1); text-decoration: none; transition: transform .15s var(--spring);
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ico { width: 24px; height: 24px; }
.icon-btn.sm { width: 40px; height: 40px; border-radius: 12px; }
.icon-btn.sm .ico { width: 20px; height: 20px; }
.icon-btn.on { background: var(--inv-bg); color: var(--inv-fg); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1180px; margin: 0 auto; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 max(20px, env(safe-area-inset-left)); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wm-mark { width: 42px; height: 42px; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px var(--card), var(--sh-1); transform: rotate(-4deg); flex: none; }
.wm-text { display: inline-flex; flex-direction: column; line-height: 1; }
.wm-text b { font: 700 24px/1 var(--f-display); letter-spacing: -.02em; }
.wm-text i { font: 700 11px/1 var(--f-body); font-style: normal; letter-spacing: .14em; text-transform: uppercase; color: var(--violet); margin-top: 3px; }
.wordmark.big .wm-text b { font-size: 40px; }
.wordmark.big .wm-text i { font-size: 13px; }
.bar-title { font: 600 18px var(--f-display); color: var(--ink-2); }
.grade-pill { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px 0 16px; border-radius: 14px; border: 0; background: var(--card); box-shadow: var(--sh-1); cursor: pointer; font: 600 15px var(--f-display); }
.grade-pill span { color: var(--ink-2); }
.grade-pill b { font-size: 19px; }
.grade-pill .rot { transform: rotate(90deg); width: 16px; height: 16px; color: var(--ink-2); }
.week { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: var(--card); border-radius: 14px; box-shadow: var(--sh-1); }
.week .dots { display: inline-flex; gap: 4px; }
.week .dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paper-2); color: var(--ink-2); font: 700 10px var(--f-body); }
.week .dot.on { background: var(--teal); color: #fff; }
.week .dot.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(18, 181, 166, .45); }
.week-count b { font: 600 15px var(--f-display); }
.star-total { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; background: var(--card); border-radius: 14px; box-shadow: var(--sh-1); font: 600 17px var(--f-display); }
.star-total .ico { color: var(--gold); width: 22px; height: 22px; filter: drop-shadow(0 1px 0 #d89400); }
.topbar.tinted { --c: var(--tint); }

/* ---------- Page ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 24px max(20px, env(safe-area-inset-left)) 64px; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin: 36px 0 14px; flex-wrap: wrap; }
.center-page { display: grid; place-items: center; min-height: 70vh; }
.empty { text-align: center; display: grid; gap: 12px; justify-items: center; max-width: 420px; }

/* ---------- Home: see "Home (redesign)" near the end of this file ---------- */
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.review-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r); padding: 14px 14px 14px 16px; box-shadow: var(--sh-1); }
.review-item .glyph { background: var(--c); border-radius: 12px; padding: 3px; width: 40px; height: 40px; }
.review-item b { display: block; line-height: 1.25; font-weight: 800; }
.review-item small { color: var(--ink-2); }

/* ---------- Map ---------- */
.map-banner { position: relative; overflow: hidden; border-radius: var(--r-lg); min-height: 210px; padding: 28px 32px 44px; color: #fff; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: linear-gradient(160deg, var(--c-strong) 0%, var(--c-deep) 100%); box-shadow: var(--sh-3); }
.banner-art, .banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-art svg { width: 100%; height: 100%; display: block; }
.map-banner.has-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--c-deep) 85%, transparent), transparent 70%); }
.banner-copy { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; flex: 1; min-width: 260px; }
.banner-copy .glyph { color: var(--c-text); background: rgba(255, 255, 255, .22); border-radius: 26px; padding: 10px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); }
.banner-copy .kicker { color: rgba(255, 255, 255, .85); }
.banner-copy h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.banner-copy p { font-weight: 700; opacity: .92; }
.banner-ring { position: relative; z-index: 1; display: grid; place-items: center; color: #fff; }
.banner-ring b { position: absolute; font: 600 20px var(--f-display); }
.banner-play { position: relative; z-index: 1; }
.regions { display: grid; gap: 26px; margin-top: 26px; }
.region { position: relative; border-radius: 34px; padding: 18px; background: var(--c-wash); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 12%, transparent); overflow: hidden; }
.region::before, .region::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.region::before { width: 260px; height: 260px; right: -90px; top: 160px; background: color-mix(in srgb, var(--c) 10%, transparent); }
.region::after { width: 180px; height: 180px; left: -70px; bottom: 80px; background: color-mix(in srgb, var(--gold) 16%, transparent); }
.region:nth-child(even) { background: color-mix(in srgb, var(--c) 4%, var(--mix)); }
.region-card { position: relative; z-index: 2; display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; background: var(--card); border-radius: 24px; padding: 14px; box-shadow: var(--sh-2); }
.region-thumb { position: relative; aspect-ratio: 16 / 9; border: 0; padding: 0; border-radius: 16px; overflow: hidden; cursor: pointer;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, var(--mix)), var(--c-deep)); }
.region-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.thumb-num { font: 700 64px/1 var(--f-display); color: rgba(255, 255, 255, .9); text-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.thumb-glyph { width: 70px; height: 70px; color: var(--c-text); opacity: .95; }
.thumb-play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--c-text); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); transition: transform .2s var(--spring); }
.thumb-play .ico { width: 22px; height: 22px; margin-left: 3px; }
.region-thumb:hover .thumb-play { transform: scale(1.1); }
.region-copy { display: grid; gap: 8px; justify-items: start; }
.region-copy h2 { font-size: clamp(20px, 2.2vw, 26px); }
.region-meta { display: flex; align-items: center; gap: 10px; width: min(280px, 100%); }
.region-meta .meter { flex: 1; }
.region-meta .meter > span { background: var(--c); }
.region-meta small { font-weight: 800; color: var(--ink-2); }
.path { position: relative; z-index: 1; margin: 34px 0 0; }
.trail { position: absolute; inset: 0; pointer-events: none; }
.trail svg { width: 100%; height: 100%; overflow: visible; }
.trail-bed { fill: none; stroke: color-mix(in srgb, var(--c) 22%, var(--mix)); stroke-width: 22; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trail-dash { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 2 14; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.stop-row { position: absolute; left: 0; right: 0; }
.stop {
  position: absolute; top: 50%; translate: -50% -50%; width: 74px; height: 74px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--card); color: var(--ink-2);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 25%, var(--stop-line)), 0 12px 20px -8px rgba(30, 34, 53, .3);
  transition: transform .2s var(--spring);
}
.stop:hover { transform: translateY(-3px) scale(1.04); }
.stop:active { transform: translateY(3px); }
.stop-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; font: 700 26px var(--f-display); }
.stop-face .ico { width: 30px; height: 30px; }
.stop.upcoming { background: var(--paper); color: var(--ink-2); box-shadow: 0 6px 0 var(--stop-base), 0 10px 16px -10px rgba(30, 34, 53, .25); }
.stop.upcoming .stop-face { outline: 2.5px dashed color-mix(in srgb, var(--c) 38%, var(--stop-line)); outline-offset: -9px; }
.stop.upcoming.soon { background: var(--card); color: var(--ink-2); }
.stop.upcoming.soon .stop-face { outline-color: color-mix(in srgb, var(--c) 60%, var(--stop-line)); }
.stop.done { background: var(--c); color: #fff; box-shadow: 0 6px 0 var(--c-deep), 0 12px 20px -8px rgba(30, 34, 53, .35); }
.stop.faded { background: #CFCAC0; color: #fff; filter: saturate(.2); box-shadow: 0 6px 0 #A9A397; }
.stop.suggested { width: 88px; height: 88px; background: var(--c-deep); color: #fff; box-shadow: 0 7px 0 color-mix(in srgb, var(--c-deep) 70%, #000), 0 0 0 8px color-mix(in srgb, var(--c) 25%, transparent); animation: pulse 2.2s ease-in-out infinite; }
.stop.suggested .stop-face { font-size: 32px; }
.stop.progress { color: var(--c-text); }
.stop-ring { position: absolute; inset: -5px; color: var(--c); }
.stop-ring .ring svg { width: 84px; height: 84px; }
.stop-stars { position: absolute; bottom: -14px; left: 50%; translate: -50% 0; display: inline-flex; gap: 0; background: var(--card); padding: 2px 6px; border-radius: 99px; box-shadow: var(--sh-1); }
.stars .ico { width: 18px; height: 18px; }
.stars .on { color: var(--gold); filter: drop-shadow(0 1px 0 #d89400); }
.stars .off { color: var(--star-off); }
.stop-stars .ico { width: 15px; height: 15px; }
.tag { position: absolute; white-space: nowrap; left: 50%; translate: -50% 0; font: 800 11.5px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 99px; }
.stop-label.next { box-shadow: 0 0 0 3px var(--gold), 0 8px 18px -8px rgba(140, 90, 0, .45); }
.stop-label.next small { color: var(--gold-text); }
.tag.review { top: -24px; background: var(--inv-bg); color: var(--inv-fg); }
.stop-label { position: absolute; top: 50%; translate: 0 -50%; max-width: calc(44% - 64px); display: grid; gap: 1px; line-height: 1.25; padding: 8px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 92%, transparent); box-shadow: 0 1px 0 rgba(30, 34, 53, .04), 0 6px 16px -8px rgba(30, 34, 53, .18); }
.stop-row.right .stop-label { text-align: right; }
.stop-label small { font: 800 11.5px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text); }
.stop-label span { font-weight: 800; font-size: 15.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.checkpoint {
  position: absolute; top: 50%; translate: -50% -50%; min-width: 120px; height: 92px; padding: 0 16px; border: 0; cursor: pointer; border-radius: 26px;
  display: grid; place-items: center; align-content: center; gap: 2px; color: #3D2A00; font: 700 15px var(--f-display);
  background: linear-gradient(180deg, #FFD875, var(--gold)); box-shadow: 0 7px 0 #D89400, 0 16px 24px -10px rgba(140, 90, 0, .5); transition: transform .2s var(--spring);
}
.checkpoint .ico { width: 30px; height: 30px; color: #B5462C; }
.checkpoint:hover { transform: translateY(-3px) rotate(-2deg); }
.checkpoint.done { background: linear-gradient(180deg, #FFE7A8, #FFD15C); }
.checkpoint .stop-stars { bottom: -16px; }

/* ---------- Player (Studio) ---------- */
[data-route="lesson"], [data-route="review"], [data-route="checkpoint"] { min-height: 100dvh; }
.player { height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.player-top { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: center; padding: 12px max(20px, env(safe-area-inset-left)); }
.player-title { display: grid; line-height: 1.2; min-width: 0; }
.player-title small { font: 800 12px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text); }
.player-title b { font: 600 19px var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segments { display: flex; gap: 6px; }
.seg { flex: 1; height: 12px; border-radius: 99px; background: rgba(30, 34, 53, .09); overflow: hidden; }
.seg i { display: block; height: 100%; width: 0; background: var(--c); border-radius: inherit; transition: width .45s var(--ease); }
.seg.done i { width: 100%; }
.seg.on i { width: 45%; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 60%, var(--mix))); }
.studio { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 20px; padding: 4px max(20px, env(safe-area-inset-left)) 20px; min-height: 0; }
.stage { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.stage-screen { background: var(--card); border-radius: var(--r-lg); padding: 12px; box-shadow: var(--sh-2); }
.pane { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #0f1220; isolation: isolate; }
.pane video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.stage.has-video .pane video { opacity: 1; }
.stage.has-video .portrait { opacity: 0; }
.portrait { position: absolute; inset: 0; transition: opacity .25s;
  background:
    radial-gradient(60% 70% at 50% 30%, color-mix(in srgb, var(--c) 18%, var(--mix)) 0%, transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, var(--mix)) 0%, color-mix(in srgb, var(--c) 48%, var(--mix)) 100%); }
.portrait::before { content: ""; position: absolute; left: 8%; top: 12%; width: 22%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.portrait::after { content: ""; position: absolute; right: 10%; top: 18%; width: 9%; aspect-ratio: 1; border-radius: 50%; background: var(--gold); opacity: .8; }
.set-floor { position: absolute; left: -10%; right: -10%; bottom: -30%; height: 58%; border-radius: 50%; background: color-mix(in srgb, var(--c) 62%, var(--mix)); box-shadow: inset 0 14px 0 rgba(255, 255, 255, .25); }
.portrait img { position: absolute; left: 50%; bottom: -14%; height: 112%; width: auto; max-width: none; translate: -50% 0; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .2)); animation: bob 3.6s ease-in-out infinite; z-index: 1; }
.portrait[data-who="smart"] img { bottom: -8%; height: 104%; }
.portrait.pop img { animation: popin .45s var(--spring), bob 3.6s ease-in-out .45s infinite; }
.sound-chip { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: none; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .95); color: #1E2235; font: 700 15px var(--f-body); box-shadow: var(--sh-2); cursor: pointer; z-index: 3; }
.sound-chip.show { display: inline-flex; }
.caption { display: none; margin: 10px 4px 0; font-weight: 700; font-size: 16px; line-height: 1.4; }
.stage.cc-on .caption { display: block; }
.stage-meta { display: flex; align-items: center; gap: 8px; padding: 10px 2px 0; }
.stage-meta .icon-btn { box-shadow: none; background: var(--paper); }
.stage-meta .icon-btn.on { background: var(--inv-bg); color: var(--inv-fg); }
.name-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 99px; background: color-mix(in srgb, var(--teal) 14%, var(--mix)); color: var(--teal-text); font: 600 15px var(--f-display); }
.name-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(18, 181, 166, .25); }
.name-chip.smart { background: var(--tint-orange); color: var(--orange-text); }
.name-chip.smart::before { background: #FF8A3D; box-shadow: 0 0 0 3px rgba(255, 138, 61, .25); }
.coach { display: flex; align-items: flex-end; gap: 12px; }
.coach-head { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: var(--tint-teal); box-shadow: 0 0 0 3px var(--card), var(--sh-1); flex: none; }
.coach[data-who="smart"] .coach-head { object-fit: contain; background: var(--tint-teal); padding: 4px; }
.coach .bubble { position: relative; flex: 1; background: var(--card); border-radius: 22px 22px 22px 6px; padding: 14px 18px; box-shadow: var(--sh-1); }
.coach-text { font: 700 17px/1.4 var(--f-body); }
.coach.pop .bubble { animation: bubble .35s var(--spring); }
.trip { display: grid; gap: 4px; padding: 16px 18px; border-radius: var(--r); background: color-mix(in srgb, var(--mix) 55%, transparent); box-shadow: inset 0 0 0 1.5px var(--line); }
.trip ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.trip li { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-weight: 800; font-size: 15.5px; color: var(--ink-2); }
.trip li i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper-2); color: transparent; flex: none; }
.trip li i .ico { width: 16px; height: 16px; }
.trip li.done i { background: var(--c); color: #fff; }
.trip li.on { color: var(--ink); }
.trip li.on i { background: var(--card); box-shadow: 0 0 0 3px var(--c); }
@media (max-height: 700px), (max-width: 1024px) and (orientation: portrait), (max-width: 860px) { .trip { display: none; } }

.board { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden; }
.board-scroll { flex: 1; overflow: auto; padding: 30px 34px; overscroll-behavior: contain; }
.board-content { max-width: 720px; margin: 0 auto; }
.board-content > .enter { animation: enter .35s var(--ease); }
.board-foot { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 50%, var(--mix)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.foot-left { flex: 1; display: flex; gap: 10px; }
.board-foot .btn.primary { min-width: 200px; }

/* Board content */
.hook { display: grid; gap: 18px; }
.hook-eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 800 14px var(--f-body); color: var(--c-text); }
.hook-eyebrow .glyph { background: var(--c); border-radius: 10px; padding: 3px; }
.hook-title { font-size: clamp(30px, 3.4vw, 42px); font-weight: 700; }
.big-q { position: relative; padding: 22px 24px 22px 26px; border-radius: 22px; background: var(--c-soft); }
.big-q::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 6px; border-radius: 0 6px 6px 0; background: var(--c); }
.big-q p { font: 600 clamp(20px, 2.2vw, 25px)/1.3 var(--f-display); margin-top: 6px; }
.learn-list ol { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: l; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.learn-list li { counter-increment: l; display: flex; gap: 12px; align-items: center; padding: 10px 12px; line-height: 1.25; background: var(--paper); border-radius: 16px; font-weight: 800; }
.learn-list li::before { content: counter(l); display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--c-deep); color: #fff; font: 600 16px var(--f-display); }
.terms { display: grid; gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.term-chip { min-height: 44px; padding: 0 16px; border-radius: 99px; border: 2px solid color-mix(in srgb, var(--c) 30%, var(--mix)); background: var(--card); font: 600 16px var(--f-display); cursor: pointer; color: var(--c-text); transition: transform .15s var(--spring); }
.term-chip:hover { transform: translateY(-1px); }
.term-chip.on { background: var(--c-deep); border-color: var(--c-text); color: #fff; }
.def-panel { padding: 14px 18px; border-radius: 16px; background: var(--tint-gold); border: 2px dashed var(--tint-gold-line); animation: enter .25s var(--ease); }
.def-panel b { font: 600 18px var(--f-display); }
.def-panel .ex { color: var(--ink-2); font-style: italic; margin-top: 4px; }
.idea-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.idea-dots { display: flex; gap: 6px; }
.idea-dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(30, 34, 53, .12); }
.idea-dots .done { background: var(--c); }
.idea-dots .on { width: 26px; border-radius: 99px; background: var(--c-deep); }
.concept { position: relative; display: grid; gap: 16px; padding: 26px 26px 28px; border-radius: 26px; background: linear-gradient(160deg, var(--c-soft), var(--card) 70%); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 16%, transparent); overflow: hidden; }
.concept::after { content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: color-mix(in srgb, var(--c) 10%, transparent); pointer-events: none; }
.concept .idea-head { margin-bottom: 0; }
.concept-title { font-size: clamp(26px, 3vw, 34px); font-weight: 700; }
.concept-text { font-size: 20px; line-height: 1.6; }
.concept .btn { justify-self: start; }
.example { padding: 18px 20px; border-radius: 18px; background: var(--tint-gold); border: 2px dashed var(--tint-gold-line); }
.example .kicker { color: var(--gold-text); }
.example p { font-size: 18px; line-height: 1.55; margin-top: 4px; }
.ask-bubble { display: flex; gap: 14px; align-items: flex-start; }
.ask-bubble img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 3px var(--card), var(--sh-1); }
.ask-bubble p { background: var(--c-soft); border-radius: 6px 22px 22px 22px; padding: 16px 20px; font: 600 clamp(20px, 2.2vw, 24px)/1.3 var(--f-display); }
.think { padding: 14px 18px; border-radius: 16px; background: var(--paper); }
.think p { color: var(--ink-2); font-weight: 700; margin-top: 4px; }
.explain { padding: 18px 20px; border-radius: 18px; background: color-mix(in srgb, var(--teal) 10%, var(--mix)); border: 2px solid color-mix(in srgb, var(--teal) 25%, var(--mix)); }
.explain .kicker { color: var(--teal-text); }
.explain p { font-size: 19px; line-height: 1.6; margin-top: 4px; }
.explain.enter, .example.enter, .reveal.enter { animation: enter .35s var(--ease); }

.q-card { display: grid; gap: 16px; }
.q-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.q-text { font: 700 clamp(22px, 2.5vw, 28px)/1.3 var(--f-body); letter-spacing: -.005em; }
.choices { display: grid; gap: 12px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 12px 16px; text-align: left; cursor: pointer;
  border-radius: 18px; border: 2px solid var(--line); background: var(--card); font: 700 18px/1.35 var(--f-body);
  box-shadow: 0 4px 0 rgba(30, 34, 53, .07); transition: transform .15s var(--spring), border-color .15s, background .15s;
}
.choice:hover:not(:disabled) { border-color: color-mix(in srgb, var(--c) 45%, var(--mix)); transform: translateY(-2px); }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.choice .key { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; background: var(--paper); font: 600 16px var(--f-display); color: var(--ink-2); }
.choice:disabled { cursor: default; }
.choice.correct { border-color: var(--good); background: color-mix(in srgb, var(--teal) 12%, var(--mix)); animation: pop .35s var(--spring); }
.choice.correct .key { background: var(--good); color: #fff; }
.choice.struck { opacity: .5; border-style: dashed; animation: shake .35s ease; }
.choice.struck .txt { text-decoration: line-through; text-decoration-thickness: 2px; }
.choice.struck .key { background: var(--tint-danger); color: var(--danger-text); }
.choice.reveal { border-color: var(--gold); background: var(--tint-gold); }
.choice.picked { border-color: var(--c-text); background: var(--c-soft); }
.hint-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 16px; background: var(--tint-gold); animation: enter .25s var(--ease); }
.hint-box .ico { color: var(--gold-text); width: 24px; height: 24px; }
.hint-box p { font-weight: 700; }
.feedback:empty { display: none; }
.feedback { border-radius: 20px; padding: 16px 20px; animation: enter .3s var(--ease); }
.feedback.good { display: flex; gap: 14px; align-items: flex-start; background: color-mix(in srgb, var(--teal) 12%, var(--mix)); }
.feedback.good b { font: 600 20px var(--f-display); color: var(--teal-text); }
.feedback.good p { margin-top: 2px; }
.fb-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--good); color: #fff; flex: none; }
.feedback.closer { background: var(--tint-violet); border: 2px solid var(--violet-line); }
.closer-head { display: grid; gap: 2px; margin-bottom: 8px; }
.closer-head b { font: 600 20px var(--f-display); color: var(--violet-text); }
.closer-head small { color: var(--ink-2); font-weight: 700; }
.closer-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.closer-steps li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; font-weight: 700; line-height: 1.45; }
.closer-steps li::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: #7A5CFF; color: #fff; font: 600 14px var(--f-display); margin-top: 1px; }
.closer-steps li.try { color: var(--violet-text); }
.climber { display: grid; gap: 6px; padding: 14px 18px 10px; border-radius: 20px; background: linear-gradient(180deg, var(--tint-teal), var(--mix)); }
.climber small { font-weight: 800; color: var(--ink-2); font-size: 13px; }
.climb-track { position: relative; height: 14px; border-radius: 99px; background: rgba(30, 34, 53, .08); margin: 26px 18px 4px; }
.climb-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #5FE0C9); transition: width .5s var(--ease); }
.climb-flag { position: absolute; top: 50%; width: 10px; height: 10px; translate: -50% -50%; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px rgba(30, 34, 53, .15); }
.climb-flag.on { background: var(--gold); box-shadow: 0 0 0 2px #D89400; }
.climb-bot { position: absolute; bottom: 4px; width: 40px; height: auto; translate: -50% 0; transition: left .5s var(--spring); filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .2)); }
.score-card { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 20px 0; }
.score-big { display: flex; align-items: baseline; gap: 8px; }
.score-big b { font: 700 84px/1 var(--f-display); color: var(--c-text); }
.score-big span { font: 600 26px var(--f-display); color: var(--ink-2); }
.score-card p { font: 600 20px var(--f-display); }
.stars.xl .ico { width: 54px; height: 54px; }
.stars.xxl .ico { width: 76px; height: 76px; }
.stars.lg .ico { width: 30px; height: 30px; }
.stars.pop-in .ico { animation: starIn .6s var(--spring) both; }
.stars.pop-in .ico:nth-child(2) { animation-delay: .15s; }
.stars.pop-in .ico:nth-child(3) { animation-delay: .3s; }

/* Reader */
.reader { display: grid; gap: 16px; }
.reader-head { display: flex; align-items: center; gap: 10px; }
.reader-head .btn { flex: none; white-space: nowrap; }
figure.reader-page { position: relative; margin: 0; border-radius: 20px; overflow: hidden; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
figure.reader-page img { width: 100%; height: auto; max-height: 56vh; object-fit: contain; background: var(--card); }
figure.reader-page figcaption { padding: 10px 16px; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.page-missing { display: none; }
figure.reader-page.missing img { display: none; }
figure.reader-page.missing .page-missing { display: flex; align-items: center; justify-content: center; gap: 10px; height: 150px; font: 600 18px var(--f-display); color: var(--ink-2); background: repeating-linear-gradient(-45deg, var(--paper), var(--paper) 12px, #F6F1E7 12px, #F6F1E7 24px); }
.reader h2 { font-size: clamp(24px, 2.8vw, 30px); }
.reader-text p { white-space: pre-line; font-size: 19px; line-height: 1.7; margin-bottom: 14px; }
.term { border: 0; padding: 0 3px; margin: 0 -1px; background: color-mix(in srgb, var(--c) 16%, var(--mix)); color: var(--c-text); border-radius: 6px; font: inherit; font-weight: 800; cursor: pointer; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--c) 45%, var(--mix)); }
.look-closer { padding: 14px 18px; border-radius: 16px; background: var(--paper); }
.look-closer p { font-weight: 700; margin-top: 4px; }
.credit { font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; }

/* Investigate */
.investigate { display: grid; gap: 16px; }
.banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 18px; }
.banner .ico { width: 30px; height: 30px; }
.banner b { display: block; font: 600 18px var(--f-display); }
.banner small { font-weight: 700; }
.banner.safety { background: var(--tint-orange); color: var(--orange-text); }
.banner.watch { background: var(--tint-blue); color: var(--blue-text); }
.inv-head h2 { margin-top: 4px; }
.materials ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0 0; }
.materials li { padding: 8px 14px; border-radius: 99px; background: var(--paper); font-weight: 700; font-size: 15px; }
.predict { display: grid; gap: 10px; }
.predict-q { font: 600 21px/1.35 var(--f-display); }
.predict-box, .text-input { width: 100%; border-radius: 16px; border: 2px solid var(--line); padding: 14px 16px; font: 700 18px var(--f-body); background: var(--paper); color: var(--ink); resize: vertical; }
.predict-box:focus, .text-input:focus { outline: none; border-color: var(--c); background: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check-row { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; line-height: 1.45; transition: background .15s, border-color .15s; }
.check-row .box { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px; border: 2px solid rgba(30, 34, 53, .2); color: transparent; }
.check-row .num { font: 600 15px var(--f-display); color: var(--ink-2); margin-top: 4px; }
.check-row .txt { margin-top: 3px; }
.check-row[aria-pressed="true"] { background: color-mix(in srgb, var(--teal) 9%, var(--mix)); border-color: color-mix(in srgb, var(--teal) 40%, var(--mix)); }
.check-row[aria-pressed="true"] .box { background: var(--good); border-color: var(--good); color: #fff; animation: pop .3s var(--spring); }
.check-row[aria-pressed="true"] .txt { color: var(--ink-2); }
.recap, .reveal { padding: 16px 20px; border-radius: 18px; background: var(--paper); }
.reveal { background: color-mix(in srgb, var(--c) 9%, var(--mix)); }
.reveal.why { background: color-mix(in srgb, var(--teal) 10%, var(--mix)); }
.recap p, .reveal p { font-size: 18px; line-height: 1.55; margin-top: 4px; font-weight: 600; }

/* Wrap */
.wrap { position: relative; display: grid; justify-items: center; text-align: center; gap: 14px; padding: 10px 0 20px; }
.wrap-burst { position: absolute; left: 50%; top: 120px; width: 520px; height: 520px; translate: -50% -50%; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--c) 12%, transparent) 0 10deg, transparent 10deg 20deg);
  mask: radial-gradient(circle, #000 25%, transparent 68%); -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); animation: spin 30s linear infinite; }
.wrap-title { font-size: clamp(34px, 4vw, 48px); font-weight: 700; }
.wrap-actions { margin-top: 6px; }
.reward { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; text-align: left; padding: 16px; border-radius: 24px; background: var(--paper); width: 100%; max-width: 560px; animation: enter .5s var(--ease) .4s both; }
.reward-copy { display: grid; gap: 4px; }
.reward-copy .kicker { color: var(--gold-text); }
.unlock { grid-column: 1 / -1; display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; background: var(--card); box-shadow: var(--sh-1); }
.unlock .smart-fig { height: 80px; }

/* ---------- Collectibles ---------- */
.collectible { --c2: color-mix(in srgb, var(--c) 60%, var(--mix)); position: relative; width: 150px; min-height: 196px; flex: none; border-radius: 20px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; overflow: hidden; box-shadow: var(--sh-2); isolation: isolate; }
.collectible.big { width: 170px; min-height: 220px; animation: cardIn .7s var(--spring) .3s both; }
.c-kind { font: 800 11px var(--f-body); letter-spacing: .1em; text-transform: uppercase; }
.c-name { font: 600 19px/1.15 var(--f-display); word-break: break-word; }
.c-rarity { align-self: flex-start; font: 800 11px var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; background: rgba(255, 255, 255, .85); color: #1E2235; }
.collectible.Math { background: #24345F; color: #fff; background-image: linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 14px 14px; }
.collectible.Math::after { content: ""; position: absolute; right: -18px; top: 46px; width: 96px; height: 96px; border-radius: 50%; border: 3px dashed var(--coral); opacity: .9; z-index: -1; }
.collectible.Math .c-kind { color: #FFB59F; }
.collectible.ELA { background: linear-gradient(160deg, #9B80FF, #5B3FE0); color: #fff; }
.collectible.ELA::after { content: ""; position: absolute; right: 14px; top: 40px; width: 70px; height: 70px; background: linear-gradient(135deg, #fff, #CFC2FF 50%, #A48CFF); clip-path: polygon(50% 0, 100% 35%, 80% 100%, 20% 100%, 0 35%); opacity: .9; z-index: -1; }
.collectible.ELA .c-kind { color: #E5DDFF; }
.collectible.Science { background: var(--card-warm); color: var(--ink); border-top: 34px solid var(--teal); padding-top: 10px; }
.collectible.Science .c-kind { position: absolute; top: -26px; left: 14px; color: #fff; }
.collectible.Science::after { content: ""; position: absolute; right: -10px; bottom: 30px; width: 80px; height: 80px; border-radius: 0 80% 0 80%; background: color-mix(in srgb, var(--teal) 25%, var(--mix)); z-index: -1; }
.collectible.Science .c-name { margin-top: 6px; }
.collectible.Science .c-rarity { background: color-mix(in srgb, var(--teal) 16%, var(--mix)); }
.collectible.lvl3 { box-shadow: 0 0 0 3px var(--gold), var(--sh-2); }
.collectible.lvl3 .c-rarity { background: var(--gold); color: #3D2A00; }
.collectible.lvl4 { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--gold), var(--sh-3); }
.collectible.lvl4 .c-rarity { background: linear-gradient(90deg, #FF6B4A, #FFC23D, #12B5A6, #7A5CFF); color: #fff; }
.collectible.empty-slot { background: transparent; box-shadow: none; border: 2.5px dashed color-mix(in srgb, var(--c) 35%, #ccc); color: var(--ink-2); width: 100%; max-width: 420px; min-height: 120px; justify-content: center; font-weight: 700; }

/* ---------- Collection ---------- */
.workshop { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); gap: 28px; align-items: center; background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh-2); }
.workshop-stage { position: relative; height: 380px; border-radius: 22px; overflow: hidden; display: grid; place-items: end center;
  background: linear-gradient(180deg, #E4F6F2 0%, #CDEEE8 64%, #F3E3C8 64%, #EAD4AF 100%); }
.pegboard { position: absolute; inset: 0 0 36% 0; background-image: radial-gradient(rgba(11, 110, 101, .22) 2.5px, transparent 3px); background-size: 26px 26px; }
.lamp { position: absolute; left: 50%; top: -60px; translate: -50% 0; width: 340px; height: 300px; background: radial-gradient(closest-side, rgba(255, 233, 160, .65), transparent); }
.workshop-stage .pedestal { position: absolute; bottom: 26px; left: 50%; translate: -50% 0; width: 230px; height: 46px; border-radius: 50%; background: #C9A877; box-shadow: inset 0 8px 0 #E2C696, 0 10px 18px rgba(0, 0, 0, .15); }
.workshop-stage .smart-fig { height: 330px; margin-bottom: 44px; animation: bob 4s ease-in-out infinite; }
.workshop-copy { display: grid; gap: 12px; }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.count { padding: 14px; border-radius: 18px; background: var(--c-wash); display: grid; gap: 2px; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 18%, transparent); }
.count b { font: 700 32px/1 var(--f-display); color: var(--c-text); }
.count small { font-weight: 800; color: var(--ink-2); }
.smart-fig { position: relative; aspect-ratio: 352 / 600; height: 200px; }
.smart-fig img, .smart-fig .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.smart-fig .layer svg { width: 100%; height: 100%; overflow: visible; }
.smart-fig .layer.back { z-index: 0; }
.smart-fig img { z-index: 1; }
.smart-fig .layer.front { z-index: 2; }
.upgrade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.upgrade { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 10px 14px; border-radius: 22px; border: 0; cursor: pointer; background: var(--card); box-shadow: var(--sh-1); text-align: center; transition: transform .2s var(--spring), box-shadow .2s; }
.upgrade:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--sh-2); }
.upgrade .smart-fig { height: 120px; margin-bottom: 4px; }
.upgrade b { font: 600 16px var(--f-display); }
.upgrade small { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.upgrade.on { box-shadow: 0 0 0 3px var(--c), var(--sh-2); }
.upgrade.on small { color: var(--c-text); }
.upgrade.locked { cursor: default; background: var(--paper-2); box-shadow: none; }
.upgrade.locked .smart-fig img { filter: grayscale(1) opacity(.3); }
.upgrade.locked .smart-fig .layer { opacity: .75; }
.lock-badge { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--card); color: var(--ink-2); }
.lock-badge .ico { width: 16px; height: 16px; }
.shelf-row { display: flex; gap: 16px; overflow-x: auto; padding: 6px 4px 16px; scroll-snap-type: x proximity; }
.shelf-row > * { scroll-snap-align: start; }

/* ---------- Settings ---------- */
.settings { max-width: 760px; display: grid; gap: 18px; }
.set-group { padding: 6px 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row b { display: block; font: 600 18px var(--f-display); }
.set-row small { color: var(--ink-2); font-weight: 600; }
.switch { position: relative; width: 64px; height: 38px; flex: none; border-radius: 99px; border: 0; background: var(--switch-off); cursor: pointer; transition: background .2s; }
.switch .knob { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: var(--card); box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .25s var(--spring); }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"] .knob { transform: translateX(26px); }
.privacy-note { display: flex; gap: 16px; align-items: flex-start; }
.privacy-note > .ico { width: 34px; height: 34px; color: var(--good); }
.privacy-note b { font: 600 18px var(--f-display); }
.privacy-note .links { margin-top: 8px; font-weight: 800; }

/* ---------- Opening + Welcome ---------- */
.opening { position: fixed; inset: 0; z-index: 30; overflow: hidden; }
.opening.film { background: #000; }
.opening-video { width: 100%; height: 100%; object-fit: cover; }
.opening .sound-chip { bottom: 40px; }
.opening-controls { position: absolute; top: max(18px, env(safe-area-inset-top)); right: 18px; display: flex; gap: 10px; z-index: 5; }
.opening.intro { background: radial-gradient(120% 90% at 50% 100%, var(--glow) 0%, var(--paper) 55%); display: flex; flex-direction: column; align-items: center; padding: 0 20px; }
.opening-controls .btn.glass { --b: rgba(30, 34, 53, .06); --bt: var(--ink); box-shadow: inset 0 0 0 2px rgba(30, 34, 53, .12); }
.opening.film .opening-controls .btn.glass { --b: rgba(255, 255, 255, .2); --bt: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }
.intro-shapes span { position: absolute; border-radius: 50%; animation: floaty 7s ease-in-out infinite; }
.intro-shapes .s1 { width: 200px; height: 200px; left: -40px; top: 10%; background: var(--violet); opacity: .9; }
.intro-shapes .s2 { width: 120px; height: 120px; right: 8%; top: 8%; background: var(--gold); animation-delay: -2s; }
.intro-shapes .s3 { width: 300px; height: 300px; right: -100px; bottom: 18%; background: var(--teal); opacity: .9; animation-delay: -4s; }
.intro-shapes .s4 { width: 70px; height: 70px; left: 18%; bottom: 30%; background: var(--coral); animation-delay: -1s; }
.intro-shapes .s5 { width: 34px; height: 34px; left: 40%; top: 14%; background: var(--coral); animation-delay: -3s; }
.intro-shapes .s6 { width: 50px; height: 50px; right: 30%; bottom: 12%; background: var(--violet); animation-delay: -5s; }
.intro-stage { position: relative; order: 1; margin-top: auto; width: min(680px, 100%); display: flex; align-items: flex-end; justify-content: center; gap: 4%; }
.intro-stage::after { content: ""; position: absolute; left: -20%; right: -20%; bottom: -60px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .5); z-index: -1; }
.intro-smart { height: min(38vh, 340px); width: auto; margin-bottom: 14px; animation: riseIn .9s var(--spring) .2s both, bob 4s ease-in-out 1.2s infinite; }
.intro-paige { height: min(50vh, 440px); width: auto; animation: riseIn .9s var(--spring) .05s both, bob 4.4s ease-in-out 1s infinite; }
.intro-bubble { position: absolute; top: -10px; left: 50%; translate: -50% -100%; width: min(440px, 90vw); background: var(--card); border-radius: 26px; padding: 18px 22px; box-shadow: var(--sh-3); font: 600 20px/1.35 var(--f-display); text-align: center; animation: bubble .5s var(--spring) .9s both; }
.intro-bubble::after { content: ""; position: absolute; bottom: -12px; left: 50%; width: 26px; height: 26px; background: var(--card); rotate: 45deg; translate: -50% 0; border-radius: 4px; }
.intro-title { position: relative; order: 0; display: grid; justify-items: center; gap: 22px; margin-top: max(76px, 9vh); animation: enter .6s var(--ease) .3s both; }
.intro-title h1 { display: grid; justify-items: center; line-height: 1; }
.intro-title h1 b { font: 700 clamp(48px, 8vw, 80px)/1 var(--f-display); letter-spacing: -.02em; }
.intro-title h1 i { font: 800 15px var(--f-body); font-style: normal; letter-spacing: .3em; text-transform: uppercase; color: var(--violet); margin-top: 6px; }
.welcome { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 24px; max-width: 1240px; margin: 0 auto; align-items: stretch; }
.welcome-art { position: relative; overflow: hidden; border-radius: 34px; min-height: 520px; display: flex; align-items: flex-end; justify-content: center; gap: 2%;
  background: radial-gradient(90% 70% at 30% 20%, #A592FF 0%, var(--violet) 55%, #5B3FE0 100%); box-shadow: var(--sh-3); }
.w-blob { position: absolute; border-radius: 50%; }
.w-blob.a { width: 300px; height: 300px; right: -80px; top: -60px; background: rgba(255, 255, 255, .14); }
.w-blob.b { width: 120px; height: 120px; left: 12%; top: 26%; background: var(--gold); }
.w-blob.c { width: 130%; height: 200px; left: -15%; bottom: -110px; background: rgba(255, 255, 255, .14); }
.w-paige { position: relative; height: 76%; max-height: 520px; width: auto; animation: bob 4.4s ease-in-out infinite; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .25)); }
.w-smart { position: relative; height: 50%; max-height: 330px; width: auto; margin-bottom: 20px; animation: bob 4s ease-in-out .5s infinite; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .25)); }
.w-bubble { position: absolute; top: 30px; left: 30px; right: 30px; max-width: 360px; background: var(--card); border-radius: 24px 24px 24px 6px; padding: 16px 20px; font: 600 19px/1.35 var(--f-display); box-shadow: var(--sh-2); }
.welcome-form { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 20px 10px; }
.welcome-form > .btn { align-self: flex-start; margin-top: 6px; }
.field { display: grid; gap: 10px; }
.field-label { font: 600 20px var(--f-display); }
.field-err { color: var(--danger-text); font-weight: 800; min-height: 0; }
.field-err:empty { display: none; }
.grade-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.grade-tile { display: grid; place-items: center; gap: 0; min-height: 80px; border-radius: 20px; border: 2px solid var(--line); background: var(--card); cursor: pointer; box-shadow: 0 4px 0 rgba(30, 34, 53, .07); transition: transform .15s var(--spring); }
.grade-tile small { font: 800 11px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.grade-tile b { font: 700 30px/1 var(--f-display); }
.grade-tile:hover { transform: translateY(-2px); }
.grade-tile.on { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 4px 0 #5B3FE0; }
.grade-tile.on small { color: rgba(255, 255, 255, .85); }
.grade-sheet { display: grid; gap: 18px; }
.grade-sheet .grade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Modal, toast, confetti ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(30, 34, 53, .38); backdrop-filter: blur(6px); animation: fade .2s ease; }
.modal.out { opacity: 0; transition: opacity .18s; }
.modal-card { width: min(560px, 100%); max-height: 90dvh; overflow: auto; background: var(--card); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-3); animation: rise .3s var(--spring); }
.modal-card:focus { outline: none; }
.film-modal { display: grid; gap: 14px; width: min(760px, 100%); }
.modal-card:has(.film-modal) { width: min(800px, 100%); }
.film-modal .stage { gap: 12px; }
.film-modal .stage-screen { box-shadow: none; padding: 0; }
.stop-sheet, .confirm { display: grid; gap: 14px; }
.toast { position: fixed; left: 50%; bottom: 28px; translate: -50% 20px; opacity: 0; z-index: 60; padding: 14px 22px; border-radius: 99px; background: var(--inv-bg); color: var(--inv-fg); font-weight: 800; box-shadow: var(--sh-3); transition: opacity .2s, translate .3s var(--spring); pointer-events: none; }
.toast.show { opacity: 1; translate: -50% 0; }
.confetti { position: fixed; z-index: 70; pointer-events: none; }
.confetti i { position: absolute; width: 9px; height: 13px; border-radius: 3px; animation: burst .9s cubic-bezier(.2, .7, .3, 1) forwards; }
.noscript { padding: 40px; text-align: center; }

/* ---------- Motion ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes popin { 0% { transform: translateY(30px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes bubble { 0% { transform: scale(.85); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes enter { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes rise { 0% { transform: translateY(30px) scale(.97); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes riseIn { 0% { transform: translateY(80px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 7px 0 color-mix(in srgb, var(--c-deep) 70%, #000), 0 0 0 8px color-mix(in srgb, var(--c) 25%, transparent); } 50% { box-shadow: 0 7px 0 color-mix(in srgb, var(--c-deep) 70%, #000), 0 0 0 16px color-mix(in srgb, var(--c) 8%, transparent); } }
@keyframes starIn { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes cardIn { 0% { transform: rotateY(90deg) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes burst { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--x), calc(var(--y) + 60px)) rotate(var(--r)); opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes twinkle { 0%, 100% { opacity: .3; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
@keyframes floaty { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(10px, -16px); } }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
}
/* Tablet portrait: Stage on top, Board below */
@media (max-width: 1024px) and (orientation: portrait), (max-width: 860px) {
  .studio { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 14px; }
  .stage { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 16px; }
  .stage-screen { padding: 10px; }
  .pane { aspect-ratio: auto; height: min(32vh, calc((100vw - 56px) * .6 * 9 / 16)); }
  .welcome { grid-template-columns: 1fr; }
  .welcome-art { min-height: 380px; }
}
@media (max-width: 760px) {
  .region-card { grid-template-columns: 128px 1fr; gap: 14px; padding: 12px; }
  .thumb-num { font-size: 40px; }
  .thumb-glyph { width: 40px; height: 40px; }
  .thumb-art { padding: 0 10px; }
  .thumb-play { width: 38px; height: 38px; }
}
/* Phone */
@media (max-width: 640px) {
  :root { --top-h: 60px; }
  body { font-size: 16px; }
  .topbar-in { gap: 8px; padding: 0 12px; }
  .wm-text i, .bar-title, .topbar .week .dots, .grade-pill span { display: none; }
  .blob.b1 { display: none; }
  .wm-mark { width: 36px; height: 36px; border-radius: 12px; }
  .wm-text b { font-size: 21px; }
  .grade-pill, .week, .star-total { height: 40px; padding: 0 10px; border-radius: 12px; }
  .topbar .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
  .page { padding: 16px 14px 48px; }
  .blob.b2 { width: 80px; height: 80px; right: 62%; top: 10%; }
  .section-head { margin: 28px 0 12px; }
  .map-banner { padding: 22px 20px 40px; gap: 14px; }
  .banner-copy .glyph.xl { width: 60px; height: 60px; border-radius: 20px; padding: 7px; }
  .banner-ring { display: none; }
  .banner-play { width: 100%; }
  .region { padding: 12px; border-radius: 26px; }
  .stop { width: 62px; height: 62px; }
  .stop.suggested { width: 74px; height: 74px; }
  .stop-face { font-size: 22px; }
  .stop-label { max-width: none; right: 8px !important; text-align: left !important; }
  .stop-label span { font-size: 14px; }
  .checkpoint { min-width: 100px; height: 80px; }
  .player-top { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; }
  .player-top .segments { grid-column: 1 / -1; }
  .studio { padding: 0 10px 0; gap: 10px; }
  .stage { display: grid; grid-template-columns: minmax(0, 1fr) 96px; align-items: end; gap: 10px; }
  .stage-screen { order: 2; padding: 0; background: none; box-shadow: none; }
  .stage .coach { order: 1; }
  .pane { width: 96px; height: 96px; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 4px var(--card), var(--sh-2); }
  .portrait img { height: 290%; bottom: auto; top: 4%; }
  .portrait[data-who="smart"] img { height: 290%; bottom: auto; top: 6%; }
  .portrait::before, .portrait::after { display: none; }
  .stage-meta, .caption { display: none !important; }
  .coach-head { display: none; }
  .coach .bubble { border-radius: 20px 20px 6px 20px; padding: 12px 14px; }
  .coach-text { font-size: 15px; }
  .player[data-mode="feature"] .stage, .stage.playing { grid-template-columns: 1fr; }
  .player[data-mode="feature"] .stage-screen, .stage.playing .stage-screen { order: 0; background: var(--card); padding: 8px; border-radius: 24px; box-shadow: var(--sh-2); }
  .player[data-mode="feature"] .pane, .stage.playing .pane { width: 100%; height: auto; max-height: 30vh; aspect-ratio: 16 / 9; border-radius: 18px; box-shadow: none; }
  .player[data-mode="feature"] .portrait img, .stage.playing .portrait img { height: 112%; bottom: -14%; top: auto; }
  .player[data-mode="feature"] .portrait[data-who="smart"] img, .stage.playing .portrait[data-who="smart"] img { height: 104%; bottom: -8%; top: auto; }
  .player[data-mode="feature"] .portrait::before, .player[data-mode="feature"] .portrait::after { display: block; }
  .board { border-radius: 24px 24px 0 0; }
  .board-scroll { padding: 20px 18px; }
  .board-foot { padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .board-foot .btn.primary { min-width: 0; flex: 1; }
  .foot-left:empty { display: none; }
  .foot-left { flex: none; }
  .concept-text { font-size: 18px; }
  .choice { min-height: 56px; font-size: 17px; }
  .reward { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .workshop { grid-template-columns: 1fr; }
  .workshop-stage { height: 300px; }
  .workshop-stage .smart-fig { height: 250px; }
  .counts .count b { font-size: 26px; }
  .upgrade-grid { grid-template-columns: repeat(2, 1fr); }
  .welcome { padding: 14px; gap: 18px; }
  .welcome-art { min-height: 300px; border-radius: 28px; }
  .w-bubble { font-size: 16px; top: 16px; left: 16px; right: 16px; }
  .grade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .welcome-form > .btn { align-self: stretch; }
  .intro-title { margin-top: 84px; gap: 16px; }
  .intro-bubble { font-size: 17px; padding: 14px 16px; }
  .wrap-burst { width: 380px; height: 380px; }
  .stars.xxl .ico { width: 60px; height: 60px; }
  figure.reader-page img { max-height: 40vh; }
}

/* ---------- Legal pages ---------- */
.legal { max-width: 780px; display: grid; gap: 18px; justify-items: start; }
.legal .card { padding: 32px; display: grid; gap: 12px; width: 100%; }
.legal h2 { font-size: 21px; margin-top: 12px; }
.legal p { line-height: 1.65; }

/* ---------- Text inputs (save code, grown-up check) ---------- */
.sc-input, .gate-input {
  min-height: 52px; padding: 0 16px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--paper);
  font: 600 19px var(--f-display); color: var(--ink); letter-spacing: .06em; min-width: 0; width: 100%;
  transition: border-color .15s, background .15s;
}
.sc-input::placeholder { color: var(--ink-2); letter-spacing: .08em; }
.sc-input:focus, .gate-input:focus { outline: none; border-color: var(--teal); background: var(--card); box-shadow: 0 0 0 4px rgba(18, 181, 166, .15); }

/* ---------- Save code ---------- */
.save-code { --c: var(--teal); display: grid; gap: 18px; padding: 24px; }
.sc-head { display: flex; gap: 16px; align-items: flex-start; }
.sc-head h2 { font-size: 22px; margin-bottom: 4px; }
.sc-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--c-soft); color: var(--c-text); }
.sc-icon .ico { width: 28px; height: 28px; }
.sc-have { display: grid; gap: 10px; padding: 18px; border-radius: 20px; background: var(--c-wash); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 18%, transparent); }
.sc-code-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sc-code { font: 700 clamp(26px, 4.4vw, 38px)/1.1 var(--f-display); letter-spacing: .08em; color: var(--ink); user-select: all; -webkit-user-select: all; word-break: break-all; }
.sc-status { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.sc-status.warn { color: var(--gold-text); }
.sc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex: none; }
.sc-dot.busy { background: var(--gold); animation: dotPulse 1.2s ease-in-out infinite; }
.sc-dot.wait { background: #E0A43A; }
@keyframes dotPulse { 50% { opacity: .35; } }
.sc-note { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.sc-delete { --bt: var(--danger-text); }
.sc-none { display: grid; gap: 10px; justify-items: start; }
.sc-restore { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.sc-restore label b { display: block; font: 600 18px var(--f-display); }
.sc-restore label small { color: var(--ink-2); font-weight: 600; }
.sc-restore-row { display: flex; gap: 10px; }
.sc-restore-row .sc-input { flex: 1; text-transform: uppercase; }
.sc-restore-row .btn { flex: none; min-height: 52px; }

/* ---------- Home footer link ---------- */

/* ---------- Grown-up check ---------- */
.gate { width: min(460px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 32px 28px; }
.gate .kicker { color: var(--good); }
.gate-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--tint-teal); color: var(--good); margin-bottom: 4px; }
.gate-icon .ico { width: 34px; height: 34px; }
.gate-q { font: 600 24px var(--f-display); margin-top: 8px; }
.gate-q b { font-weight: 700; color: var(--ink); white-space: nowrap; }
.gate-row { display: flex; gap: 10px; width: 100%; max-width: 320px; }
.gate-input { text-align: center; font-size: 24px; flex: 1; }
.gate .btn.ghost { margin-top: 8px; }

/* ---------- Parent view ---------- */
.parents { display: grid; gap: 0; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 22px; flex-wrap: wrap; }
.p-head > div { display: grid; gap: 6px; }
.p-head .kicker { color: var(--good); }
.p-overview { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.p-tile { background: var(--card); border-radius: var(--r); box-shadow: var(--sh-2); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.p-tile small { font: 700 12.5px/1.25 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.p-tile b { font: 700 34px/1.1 var(--f-display); margin-top: 4px; }
.p-tile .muted { font-size: 14px; font-weight: 600; line-height: 1.35; }
.p-dots { display: flex; gap: 4px; margin-top: 8px; }
.p-dots i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paper-2); color: var(--ink-2); font: 700 10px var(--f-body); font-style: normal; }
.p-dots i.on { background: var(--teal); color: #fff; }
.p-subjects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.p-subject { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden; display: flex; flex-direction: column; }
.p-subject-top { display: flex; align-items: center; gap: 14px; padding: 18px 20px; color: #fff; background: radial-gradient(140% 120% at 0% 0%, var(--c-strong), var(--c-deep)); }
.p-subject-top .glyph { color: var(--c-text); width: 52px; height: 52px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .1)); }
.p-subject-top > div { flex: 1; min-width: 0; }
.p-subject-top h3 { font-size: 22px; }
.p-subject-top small { font-weight: 700; opacity: .9; }
.p-facts { margin: 0; padding: 8px 20px 4px; display: grid; }
.p-facts > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; }
.p-facts > div + div { border-top: 1px solid var(--line); }
.p-facts dt { color: var(--ink-2); font-weight: 700; font-size: 15px; }
.p-facts dd { margin: 0; font: 600 17px var(--f-display); text-align: right; }
.p-stars { display: inline-flex; align-items: center; gap: 8px; }
.p-stars em { font-style: normal; }
.p-stars .stars .ico { width: 16px; height: 16px; }
.p-next { margin: auto 20px 18px; padding: 10px 14px; border-radius: 14px; background: var(--c-wash); display: grid; gap: 2px; }
.p-next small { font: 800 11px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text); }
.p-next span { font-weight: 700; font-size: 15px; line-height: 1.3; }
.p-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 36px; align-items: start; }
.p-list { display: grid; gap: 14px; }
.p-list-head { display: grid; gap: 4px; }
.p-list-head h2 { font-size: 22px; }
.p-list-head .muted { font-size: 15px; font-weight: 600; }
.p-rows { list-style: none; margin: 0; padding: 0; display: grid; }
.p-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.p-row + .p-row { border-top: 1px solid var(--line); }
.p-row > .glyph { width: 34px; height: 34px; }
.p-row-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.p-row-main b { font-weight: 800; line-height: 1.3; }
.p-row-main small { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.p-row .stars .ico { width: 16px; height: 16px; }
.p-date { flex: none; width: 92px; font: 700 13px var(--f-body); color: var(--ink-2); }
.p-empty { padding: 16px; border-radius: 16px; background: var(--paper); color: var(--ink-2); font-weight: 600; }
.parents .save-code { max-width: none; }
.p-foot { margin-top: 26px; font-size: 15px; font-weight: 600; text-align: center; }
.p-foot a { font-weight: 800; }
.settings .save-code h2 { font-size: 20px; }

@media (max-width: 1024px) {
  .p-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .p-subjects { grid-template-columns: 1fr; }
  .p-subject { display: grid; grid-template-columns: minmax(220px, .8fr) 1fr; }
  .p-subject-top { flex-direction: column; align-items: flex-start; justify-content: center; }
  .p-next { grid-column: 2; margin: 0 20px 16px; }
  .p-two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .p-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .p-overview .p-tile:first-child { grid-column: 1 / -1; }
  .p-tile { padding: 14px; }
  .p-tile b { font-size: 28px; }
  .p-subject { display: flex; }
  .p-subject-top { flex-direction: row; align-items: center; }
  .p-next { margin: 4px 20px 16px; }
  .p-two { margin-top: 28px; }
  .p-date { width: 70px; font-size: 12px; }
  .p-row .btn.sm { padding: 0 12px; }
  .save-code { padding: 18px; }
  .sc-head { gap: 12px; }
  .sc-icon { width: 44px; height: 44px; border-radius: 14px; }
  .sc-have { padding: 14px; }
  .sc-code { font-size: 25px; }
  .gate { padding: 26px 20px; }
}
.linkish { align-self: flex-start; border: 0; background: none; padding: 6px 0; cursor: pointer; font: 700 15px var(--f-body); color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(30, 34, 53, .25); }
.linkish:hover { color: var(--ink); }
.restore-dialog { display: grid; gap: 12px; }
.restore-dialog .sc-icon { --c: var(--teal); }
@media (max-width: 640px) { .linkish { align-self: center; text-align: center; } }
@media (max-width: 640px) {
  .sc-restore-row .sc-input { font-size: 16px; letter-spacing: 0; padding: 0 10px; }
  .sc-restore-row .btn { padding: 0 14px; }
}


/* ---------- Full-screen film gate (story films before / after the lesson) ---------- */
.film-gate { position: fixed; inset: 0; z-index: 55; display: grid; grid-template-rows: 1fr auto; background: #0B0D17; color: #fff; animation: fade .2s ease; }
.film-gate.out { opacity: 0; transition: opacity .18s ease; pointer-events: none; }
.fg-frame { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.fg-video { width: 100%; height: 100%; object-fit: contain; background: #0B0D17; }
.film-gate[data-state="loading"] .fg-video { opacity: .85; }
.fg-controls { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); display: flex; gap: 10px; z-index: 4; }
.film-gate .btn.glass { --b: rgba(255, 255, 255, .16); --bt: #fff; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); min-height: 48px; }
.fg-skip { font-size: 18px; padding-inline: 22px; }
.fg-chip { bottom: max(28px, env(safe-area-inset-bottom)); }
.fg-caption { position: absolute; left: 50%; bottom: max(84px, calc(env(safe-area-inset-bottom) + 70px)); translate: -50% 0; width: min(760px, calc(100% - 40px)); margin: 0; padding: 10px 16px; border-radius: 14px; background: rgba(0, 0, 0, .62); font: 700 18px/1.4 var(--f-body); text-align: center; z-index: 3; }
.fg-play { position: absolute; inset: 0; margin: auto; width: 132px; height: 132px; border-radius: 50%; border: 0; display: grid; place-content: center; gap: 2px; background: var(--card); color: var(--ink); box-shadow: 0 0 0 10px rgba(255, 255, 255, .22), var(--sh-3); cursor: pointer; z-index: 3; font: 700 17px var(--f-display); }
.fg-play .ico { width: 44px; height: 44px; margin: 0 auto; color: var(--c-deep, var(--coral)); }
.fg-play[hidden] { display: none; }
.fg-fallback { position: absolute; inset: 0; display: grid; grid-template-columns: auto minmax(0, 520px); align-items: center; justify-content: center; gap: 32px; padding: 40px; z-index: 2;
  background: radial-gradient(120% 90% at 50% 100%, color-mix(in srgb, var(--c) 30%, var(--mix)) 0%, var(--paper) 60%); color: var(--ink); }
.fg-fallback[hidden] { display: none; }
.fg-portrait { height: min(56vh, 460px); width: auto; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .2)); animation: bob 4.2s ease-in-out infinite; }
.fg-bubble { background: var(--card); border-radius: 26px; padding: 22px 26px; box-shadow: var(--sh-3); display: grid; gap: 6px; }
.fg-bubble p { font: 600 clamp(20px, 2.4vw, 26px)/1.35 var(--f-display); }
.fg-fallback .fg-continue { grid-column: 2; justify-self: start; }
.fg-fallback .fg-continue[hidden] { display: none; }
.film-gate[data-state="fallback"] .btn.glass, .film-gate.no-poster .btn.glass { --b: rgba(30, 34, 53, .06); --bt: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 2px rgba(30, 34, 53, .16); }
.film-gate.no-poster .fg-fallback .fg-bubble { margin-bottom: 150px; }
.film-gate.no-poster .fg-play { inset: auto 0 12vh 0; }
.player.gated .board-foot .btn.primary { opacity: .55; }
.fg-title { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
  .fg-title { display: grid; gap: 4px; position: absolute; left: 20px; right: 20px; top: calc(50% + 28vw + 24px); text-align: center; }
  .fg-title small { font: 800 12px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
  .fg-title b { font: 600 22px/1.25 var(--f-display); color: #fff; }
  .film-gate[data-state="fallback"] .fg-title { display: none; }
}
@media (max-width: 760px) {
  .fg-fallback { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 16px; padding: 80px 20px 30px; }
  .fg-portrait { height: 34vh; }
  .fg-fallback .fg-continue { grid-column: 1; justify-self: center; }
  .fg-skip { font-size: 16px; padding-inline: 16px; }
}

/* ---------- Opening: brand card ---------- */
.opening.brand { background: radial-gradient(120% 90% at 50% 100%, var(--glow) 0%, var(--paper) 58%); display: grid; place-items: center; padding: 20px; cursor: pointer; }
.opening.brand.behind .brand-card { opacity: 0; transition: opacity .3s; }
.brand-card { position: relative; display: grid; justify-items: center; gap: 12px; text-align: center; animation: enter .6s var(--ease) both; }
.brand-presents { font: 800 14px var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); animation: enter .6s var(--ease) .1s both; }
.brand-mark { display: grid; justify-items: center; line-height: 1; }
.brand-mark b { font: 700 clamp(56px, 10vw, 104px)/1 var(--f-display); letter-spacing: -.02em; }
.brand-mark i { font: 800 16px var(--f-body); font-style: normal; letter-spacing: .32em; text-transform: uppercase; color: var(--violet); margin-top: 8px; }
.brand-tag { font-weight: 700; font-size: 18px; color: var(--ink-2); text-wrap: balance; }
@media (max-width: 640px) {
  .brand-tag { font-size: 16px; }
  .opening.brand .intro-shapes .s1 { width: 120px; height: 120px; left: -50px; }
  .opening.brand .intro-shapes .s3 { width: 180px; height: 180px; right: -90px; bottom: 26%; }
  .opening.brand .intro-shapes .s2 { width: 80px; height: 80px; }
}
.brand-cast { display: flex; align-items: flex-end; justify-content: center; gap: 18px; height: min(34vh, 300px); margin-top: 6px; }
.brand-paige { height: 100%; width: auto; animation: riseIn .9s var(--spring) .25s both, bob 4.4s ease-in-out 1.2s infinite; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .18)); }
.brand-smart { height: 68%; width: auto; animation: riseIn .9s var(--spring) .4s both, bob 4s ease-in-out 1.4s infinite; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .18)); }
.brand-next { margin-top: 6px; }

/* ---------- Startup / screen problem ---------- */
.problem { min-height: 100dvh; padding: 24px; }
.problem-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 34px 30px 28px; max-width: 460px; }
.problem-bot { width: 132px; height: auto; animation: bob 4s ease-in-out infinite; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .15)); }
.problem-card h1 { font-size: clamp(26px, 3.2vw, 32px); }
.problem-card .small { font-size: 14px; min-height: 1.4em; }
.loading { display: flex; align-items: center; gap: 12px; font: 600 20px var(--f-display); color: var(--ink-2); }
.loading-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--coral); animation: dotPulse 1.2s ease-in-out infinite; }

/* ---------- Reading in parts ---------- */
.reader-section { display: grid; gap: 14px; }
.reader-section + .reader-section { padding-top: 18px; border-top: 2px dashed var(--line); }
.read-parts { display: flex; gap: 6px; }
.read-parts span { flex: 1; max-width: 64px; height: 8px; border-radius: 99px; background: var(--paper-2); }
.read-parts span.done { background: color-mix(in srgb, var(--c) 55%, var(--mix)); }
.read-parts span.on { background: var(--c); }
.lookback { margin-top: 16px; border-radius: var(--r-sm); background: var(--c-wash); box-shadow: inset 0 0 0 1.5px var(--line); }
.lookback summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 16px; font-weight: 800; cursor: pointer; color: var(--c-text); }
.lookback summary .ico { width: 20px; height: 20px; }
.lookback[open] summary { border-bottom: 1px solid var(--line); }
.lookback-body { max-height: 34vh; overflow: auto; }
.lookback-sec { padding: 12px 18px; }
.lookback-sec p { white-space: pre-line; font-size: 16px; line-height: 1.6; margin-bottom: 8px; }

/* ---------- Results ---------- */
.wrap-wait { min-height: 40vh; }
.wrap-score { font: 700 18px var(--f-body); color: var(--ink-2); }
.q-card.auto-advance .feedback.good { position: relative; overflow: hidden; }
.q-card.auto-advance .feedback.good::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: color-mix(in srgb, var(--teal) 60%, var(--mix)); transform-origin: left; animation: autoBar 1.2s linear forwards; }
@keyframes autoBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.stage.has-idle .pane .idle-loop { opacity: 1; }
.pane .idle-loop { opacity: 0; }
.stage.has-idle .portrait img { opacity: 0; }


/* ================= Dark mode =================
   Set on <html data-theme="dark"> by js/theme-boot.js (before first paint) and js/prefs.js.
   Every color token gets a dark value; brand accents stay the same hue. Text pairs meet WCAG AA. */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #11131C; --paper-2: #1B1F2D; --card: #1D2131; --mix: #1D2131;
  --ink: #ECEEF6; --ink-2: #B3B9CF; --line: rgba(236, 238, 246, .12);
  --good: #3FD6C4; --dot: rgba(236, 238, 246, .05); --inv-bg: #ECEEF6; --inv-fg: #141724;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .45), 0 4px 14px rgba(0, 0, 0, .25);
  --sh-2: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 34px -10px rgba(0, 0, 0, .6);
  --sh-3: 0 30px 70px -24px rgba(0, 0, 0, .8);
  --tint-gold: #2E2714; --tint-gold-line: #6E5A24; --gold-text: #F4C75E;
  --tint-teal: #14302E; --tint-teal-2: #183B38; --teal-text: #5FE0CF;
  --tint-violet: #241F40; --violet-line: #40367A; --violet-text: #BBAEFF;
  --tint-danger: #3A1F22; --danger-text: #FF9187;
  --tint-orange: #33231A; --orange-text: #FFB27E;
  --tint-blue: #172540; --blue-text: #9CC2FF;
  --star-off: #3A3F52; --switch-off: #444A60; --stop-base: #0B0D14; --stop-line: #5A6078;
  --card-warm: #232737; --glow: #2B1F27; --page-frame: rgba(236, 238, 246, .16); --band: #0A0C14;
}
html[data-theme="dark"] *, html[data-theme="dark"] ::before, html[data-theme="dark"] ::after {
  --c-text: color-mix(in srgb, var(--c) 58%, #fff);
}
html[data-theme="dark"] .btn.ghost { --bt: var(--ink); --bs: #000; box-shadow: 0 0 0 2px var(--line) inset, 0 3px 0 rgba(0, 0, 0, .5); }
html[data-theme="dark"] .btn.primary, html[data-theme="dark"] .btn.subject { --bs: #000; }
html[data-theme="dark"] .btn.play { --b: #F4F5FA; }
html[data-theme="dark"] .stars .on { filter: drop-shadow(0 1px 0 #8a5a00); }
html[data-theme="dark"] .stop { box-shadow: 0 6px 0 #0B0D14, 0 12px 20px -8px rgba(0, 0, 0, .6); }
html[data-theme="dark"] .stop.upcoming { background: var(--paper-2); }
html[data-theme="dark"] .stop.upcoming.soon { background: var(--card); }
html[data-theme="dark"] .stop.faded { background: #4A4D58; box-shadow: 0 6px 0 #2C2F38; }
html[data-theme="dark"] .trail-bed { stroke: color-mix(in srgb, var(--c) 30%, #1D2131); }
html[data-theme="dark"] .trail-dash { stroke: rgba(236, 238, 246, .35); }
html[data-theme="dark"] .checkpoint { box-shadow: 0 7px 0 #8A5A00, 0 16px 24px -10px rgba(0, 0, 0, .6); }
html[data-theme="dark"] .collectible.Science { color: var(--ink); }
html[data-theme="dark"] .workshop-stage { background: linear-gradient(180deg, #1B3533 0%, #17302D 64%, #2E2619 64%, #261F14 100%); }
html[data-theme="dark"] .teaser-fig { background: radial-gradient(circle at 50% 40%, #1E3C39, #14302E); }
html[data-theme="dark"] .modal { background: rgba(0, 0, 0, .6); }
html[data-theme="dark"] .toast { box-shadow: 0 0 0 1px var(--line), var(--sh-3); }
html[data-theme="dark"] input, html[data-theme="dark"] textarea { color: var(--ink); }
html[data-theme="dark"] .choice.correct { color: var(--ink); }
/* Reader pages are photos of printed pages: keep them as they are, with a soft frame and slight dimming. */
html[data-theme="dark"] figure.reader-page { background: #262A3A; box-shadow: 0 0 0 1px var(--page-frame), 0 10px 26px -12px rgba(0, 0, 0, .7); padding: 8px; }
html[data-theme="dark"] figure.reader-page img { border-radius: 12px; filter: brightness(.88) contrast(1.02); background: #262A3A; }
html[data-theme="dark"] figure.reader-page.missing .page-missing { background: repeating-linear-gradient(-45deg, #1B1F2D, #1B1F2D 12px, #20253A 12px, #20253A 24px); }

/* ---------- Appearance control ---------- */
.seg-ctl { display: inline-flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--line); flex: none; }
.seg-ctl button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; font-weight: 800; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg-ctl button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }
.seg-ctl .ico { width: 18px; height: 18px; }
@media (max-width: 560px) { .set-row.appearance { flex-direction: column; align-items: stretch; } .seg-ctl { width: 100%; } .seg-ctl button { flex: 1; justify-content: center; padding: 0 8px; } }
.p-head > .p-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
html[data-theme="dark"] .wm-text i, html[data-theme="dark"] .dash-head .kicker, html[data-theme="dark"] .intro-title h1 i, html[data-theme="dark"] .brand-mark i { color: #AE9CFF; }
html[data-theme="dark"] .choice.correct .key { color: #0A2B28; }

/* ================= Home (redesign) ================= */
.home { position: relative; }
.home-mesh { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 34% at 8% 10%, color-mix(in srgb, var(--coral) 13%, transparent), transparent 70%),
    radial-gradient(34% 30% at 92% 18%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 70%),
    radial-gradient(40% 36% at 70% 96%, color-mix(in srgb, var(--teal) 12%, transparent), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.13 0 0 0 0 0.2 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); }
html[data-theme="dark"] .home-mesh { opacity: .8; }

/* Greeting + live clock */
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 6px 0 22px; }
.greet-copy { display: grid; gap: 4px; }
.greet h1 { font-size: clamp(30px, 3.8vw, 42px); font-weight: 700; }
.clock { display: inline-flex; align-items: center; gap: 14px; padding: 8px 20px 8px 8px; border-radius: 24px; color: var(--ink);
  background: linear-gradient(135deg, #FFF6E0, #E3F3FF); box-shadow: var(--sh-1), inset 0 0 0 1px rgba(255, 255, 255, .7); }
.clock[data-part="afternoon"] { background: linear-gradient(135deg, #FFEBD2, #FFDCC6); }
.clock[data-part="evening"] { background: linear-gradient(135deg, #3E2A72, #6E3468); color: #fff; box-shadow: var(--sh-2), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.clock[data-part="night"] { background: linear-gradient(135deg, #18204A, #2A2260); color: #fff; box-shadow: var(--sh-2), inset 0 0 0 1px rgba(255, 255, 255, .1); }
html[data-theme="dark"] .clock[data-part="morning"], html[data-theme="dark"] .clock[data-part="afternoon"] { background: linear-gradient(135deg, #2A2A3A, #1F2A3C); color: var(--ink); box-shadow: var(--sh-1), inset 0 0 0 1px var(--line); }
.sky-art { width: 58px; height: 58px; border-radius: 18px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 4px 10px -4px rgba(30, 34, 53, .3);
  background: linear-gradient(180deg, #A9DEFF, #FFF0C9); }
.clock[data-part="afternoon"] .sky-art { background: linear-gradient(180deg, #8ECBFF, #FFD39E); }
.clock[data-part="evening"] .sky-art { background: linear-gradient(180deg, #5B3FA8, #FF9A7A); }
.clock[data-part="night"] .sky-art { background: linear-gradient(180deg, #0B1130, #28306A); }
.sky-art svg { width: 100%; height: 100%; display: block; }
.clock-text { display: grid; line-height: 1.15; }
.clock-date { font: 800 13px var(--f-body); letter-spacing: .04em; opacity: .9; }
.clock-time { font: 600 28px/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Hero: Next up */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 32px; color: #fff; min-height: 350px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  background: linear-gradient(115deg, color-mix(in srgb, var(--c-deep) 92%, #000) 0%, var(--c-deep) 38%, var(--c-strong) 100%);
  box-shadow: 0 26px 50px -24px color-mix(in srgb, var(--c-deep) 70%, transparent), inset 0 -6px 0 rgba(0, 0, 0, .1), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .3s var(--spring), box-shadow .3s var(--ease); }
.hero:hover { transform: translateY(-3px); box-shadow: 0 34px 60px -24px color-mix(in srgb, var(--c-deep) 80%, transparent), inset 0 -6px 0 rgba(0, 0, 0, .1), inset 0 1px 0 rgba(255, 255, 255, .2); }
.hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.bloom { position: absolute; border-radius: 50%; }
.bloom.b1 { width: 520px; height: 520px; right: -160px; top: -220px; background: radial-gradient(closest-side, rgba(255, 255, 255, .42), transparent); }
.bloom.b2 { width: 360px; height: 360px; right: 8%; bottom: -170px; background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 55%, transparent), transparent); }
.bloom.b3 { width: 420px; height: 420px; left: -200px; bottom: -240px; background: radial-gradient(closest-side, rgba(0, 0, 0, .22), transparent); }
.fl { position: absolute; width: calc(16px * var(--s, 1)); height: calc(16px * var(--s, 1)); opacity: .55; will-change: transform; }
.fl-dot { border-radius: 50%; background: rgba(255, 255, 255, .7); width: calc(9px * var(--s, 1)); height: calc(9px * var(--s, 1)); }
.fl-ring { border-radius: 50%; border: 3px solid rgba(255, 255, 255, .6); }
.fl-plus { background: linear-gradient(#fff, #fff) center / 100% 3px no-repeat, linear-gradient(#fff, #fff) center / 3px 100% no-repeat; opacity: .5; }
.fl-star { background: #FFE7A8; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: .85; }
.fl-tri { background: var(--gold); clip-path: polygon(50% 0, 100% 100%, 0 100%); opacity: .6; }
.hero-copy { position: relative; padding: 32px 8px 32px 34px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 5px 14px 5px 5px; border-radius: 99px; background: rgba(255, 255, 255, .16); font: 800 14px var(--f-body); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); backdrop-filter: blur(6px); }
.hero .eyebrow .glyph { background: #fff; border-radius: 50%; padding: 4px; color: var(--c-deep); }
.hero .eyebrow em { font-style: normal; opacity: .9; font-weight: 700; }
.hero-title { font-size: clamp(30px, 3.7vw, 44px); font-weight: 700; line-height: 1.08; text-shadow: 0 3px 0 rgba(0, 0, 0, .14); max-width: 15ch; text-wrap: balance; }
.hero-sub { font-weight: 700; opacity: .95; }
.hero-progress { display: flex; align-items: center; gap: 12px; }
.hp-ring { position: relative; display: grid; place-items: center; color: #fff; }
.hp-ring b { position: absolute; font: 700 12.5px var(--f-display); }
.hp-copy { display: grid; gap: 6px; min-width: 150px; }
.hp-copy small { font: 800 12px var(--f-body); letter-spacing: .08em; text-transform: uppercase; opacity: .92; }
.hp-bar { display: block; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.hp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FFE7A8, var(--gold)); transform-origin: left; transform: scaleX(max(var(--v), .02)); }
.hero-actions { margin-top: 6px; gap: 12px; }
.hero .btn.play { --b: #fff; background: linear-gradient(180deg, #FFFFFF 0%, #F1F2F7 100%); color: var(--c-deep); padding: 0 30px 0 10px; gap: 12px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c-deep) 55%, #000), 0 16px 26px -10px rgba(0, 0, 0, .45), inset 0 2px 0 #fff, inset 0 -3px 0 rgba(30, 34, 53, .08); }
.hero .btn.play:hover { filter: brightness(1.02); transform: translateY(-2px); }
.hero .btn.play:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c-deep) 55%, #000), 0 6px 12px -8px rgba(0, 0, 0, .4), inset 0 2px 0 #fff; }
.hero .btn.play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.play-disc { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(180deg, var(--c-strong), var(--c-deep)); color: #fff; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 3px 8px -2px color-mix(in srgb, var(--c-deep) 60%, transparent); }
.play-disc .ico { width: 22px; height: 22px; margin-left: 3px; }
.hero .btn.glass .ico { width: 20px; height: 20px; }
.hero-art { position: relative; min-height: 270px; }
.halo { position: absolute; width: 300px; height: 300px; right: 6%; bottom: 10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .34), rgba(255, 255, 255, .08) 70%, transparent); }
.plinth { position: absolute; left: -10%; right: -10%; bottom: -78px; height: 140px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .26), rgba(255, 255, 255, .1)); }
.hero-paige, .hero-smart { position: absolute; display: block; }
.hero-paige img, .hero-smart img { height: 100%; width: auto; max-width: none; display: block; }
.hero-paige { bottom: 0; right: 38%; height: min(94%, 330px); filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .25)); transform-origin: 50% 100%; }
.hero-smart { bottom: -8px; right: 4%; height: min(66%, 236px); aspect-ratio: 352 / 600; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, .25)); }
/* Smart AI One: antenna light and eye glow drawn over the portrait */
.hero-smart .ant { position: absolute; left: 50%; top: 2.6%; width: 16%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, #FFF6D6, #FFB070 45%, rgba(255, 138, 61, 0) 100%); opacity: .2; mix-blend-mode: screen; }
.hero-smart .eye { position: absolute; top: 21.7%; width: 13%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgba(120, 255, 236, .75), rgba(18, 181, 166, 0)); opacity: .25; mix-blend-mode: screen; }
.hero-smart .eye.l { left: 40.6%; }
.hero-smart .eye.r { left: 58.8%; }
/* Parallax layers (pointer position in --px / --py, -0.5..0.5) */
.hero-bg, .px-1, .px-2, .px-3, .bloom { transition: translate .4s var(--ease); }
.hero-bg { translate: calc(var(--px, 0) * 22px) calc(var(--py, 0) * 16px); }
.bloom { translate: calc(var(--px, 0) * -10px) calc(var(--py, 0) * -8px); }
.px-1 { translate: calc(var(--px, 0) * 8px) calc(var(--py, 0) * 6px); }
.px-2 { translate: calc(var(--px, 0) * 12px) calc(var(--py, 0) * 5px); }
.px-3 { translate: calc(var(--px, 0) * 20px) calc(var(--py, 0) * 8px); }
.hero .btn.play { position: relative; }
.hero .btn.play::after { content: ""; position: absolute; inset: -6px; border-radius: 22px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .7), 0 0 26px 6px rgba(255, 231, 168, .55); opacity: 0; pointer-events: none; }

/* Side cards */
.home-side { display: grid; gap: 22px; grid-template-rows: auto 1fr; }
.home-side .card { border-radius: 26px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 22px; font-weight: 700; margin-top: 2px; }
.week-card .kicker { color: var(--teal-text); }
.streak { display: flex; align-items: center; gap: 6px; }
.flame { display: inline-flex; filter: grayscale(1); opacity: .35; }
.flame.lit { filter: drop-shadow(0 4px 8px rgba(255, 107, 74, .45)); opacity: 1; }
.streak-n { display: grid; line-height: 1.05; }
.streak-n b { font: 700 20px var(--f-display); }
.streak-n small { font-size: 11.5px; font-weight: 800; color: var(--ink-2); }
.days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days li { display: grid; justify-items: center; gap: 6px; }
.days small { font: 800 12px var(--f-body); color: var(--ink-2); }
.day-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--line); color: #fff; }
.day-dot .ico { width: 18px; height: 18px; }
.days li.later .day-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.days li.on .day-dot { background: radial-gradient(circle at 35% 30%, #4FE0CC, var(--teal) 60%, #0B8F83); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 18%, transparent), 0 8px 16px -6px rgba(18, 181, 166, .7); }
.days li.today .day-dot { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--gold); }
.days li.today.on .day-dot { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--gold), 0 8px 16px -6px rgba(18, 181, 166, .7); }
.days li.today small { color: var(--ink); }
.goal { display: grid; gap: 8px; margin-top: 16px; }
.goal small { font-weight: 700; font-size: 14px; }
.goal-track { position: relative; height: 12px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.goal-track i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #6EE3B5 60%, var(--gold)); transform-origin: left; transform: scaleX(max(var(--v), .015)); }
.goal-tick { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: var(--card); opacity: .9; border-radius: 2px; }

.collect-teaser { display: grid; grid-template-columns: 136px 1fr; gap: 18px; align-items: center; text-decoration: none; color: inherit; overflow: hidden; transition: transform .25s var(--spring), box-shadow .25s; }
.collect-teaser:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.fan { position: relative; height: 150px; border-radius: 20px; background: radial-gradient(circle at 50% 35%, var(--tint-teal), var(--tint-teal-2)); }
.fan-card { position: absolute; left: 50%; top: 18px; width: 62px; height: 86px; margin-left: -31px; border-radius: 12px; display: grid; align-content: space-between; padding: 7px 7px 6px; color: #fff;
  transform: translateX(calc(var(--k) * 26px)) rotate(calc(var(--k) * 14deg)); transform-origin: 50% 120%; box-shadow: 0 8px 14px -6px rgba(30, 34, 53, .4); transition: transform .35s var(--spring); }
.fan-card i { font: 800 7.5px/1.1 var(--f-body); font-style: normal; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.fan-card b { font: 700 22px var(--f-display); }
.fan-card.Math { background: #24345F; background-image: linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px); background-size: 9px 9px; }
.fan-card.ELA { background: radial-gradient(circle at 70% 30%, #A592FF, var(--violet) 55%, #4C33C9); z-index: 1; }
.fan-card.Science { background: #FFFDF6; color: #1E2235; border-top: 14px solid var(--teal); }
.collect-teaser:hover .fan-card { transform: translateX(calc(var(--k) * 32px)) rotate(calc(var(--k) * 20deg)) translateY(-4px); }
.fan-bot { position: absolute; left: 50%; bottom: 0; translate: -50% 0; z-index: 2; }
.fan-bot .smart-fig { height: 76px; }
.teaser-copy { display: grid; gap: 6px; justify-items: start; }
.teaser-copy .kicker { color: var(--teal-text); }
.teaser-copy h3 { font-size: 22px; font-weight: 700; }
.next-unlock { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 99px; background: var(--tint-gold); color: var(--gold-text); font: 800 13px var(--f-body); box-shadow: inset 0 0 0 1.5px var(--tint-gold-line); }
.next-unlock .ico { width: 16px; height: 16px; color: var(--gold); }
.next-unlock::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .65) 50%, transparent 70%); transform: translateX(-120%); }
html[data-theme="dark"] .next-unlock::after { background: linear-gradient(100deg, transparent 30%, rgba(255, 231, 168, .22) 50%, transparent 70%); }
.collect-teaser .meter { width: 100%; background: var(--paper-2); }
.collect-teaser .meter > span { width: 100%; transform-origin: left; transform: scaleX(var(--v)); }

/* Subject tiles */
.subject-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; perspective: 1000px; }
.subject-tile { position: relative; background: var(--card); border-radius: 28px; box-shadow: var(--sh-2); overflow: hidden; display: flex; flex-direction: column;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0)); transition: transform .3s var(--spring), box-shadow .3s var(--ease); }
.subject-tile:hover { --ty: -6px; box-shadow: 0 30px 50px -24px color-mix(in srgb, var(--c-deep) 55%, rgba(30, 34, 53, .5)); }
/* Glowing border sweep on hover / keyboard focus */
@property --sweep { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.subject-tile::before { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 2.5px; pointer-events: none;
  background: conic-gradient(from var(--sweep), transparent 0deg, var(--c) 50deg, var(--gold) 90deg, transparent 150deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  opacity: 0; transition: opacity .25s; }
.subject-tile:hover::before, .subject-tile:focus-within::before { opacity: 1; }
.tile-top { --tile-ink: var(--c-deep); position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 20px 20px 22px; color: #fff; text-decoration: none; min-height: 136px; isolation: isolate;
  background: linear-gradient(115deg, var(--c-deep) 0%, color-mix(in srgb, var(--c-deep) 55%, var(--c-strong)) 45%, var(--c-strong) 100%); }
.tile-art { position: absolute; inset: 0; z-index: -1; }
.tile-art svg { width: 100%; height: 100%; display: block; }
.ta-float { transform-box: fill-box; transform-origin: center; }
.tile-id { display: flex; align-items: center; gap: 12px; }
.tile-id .glyph.lg { width: 54px; height: 54px; padding: 8px; border-radius: 18px; background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); color: var(--c-deep); }
.tile-id > span { display: grid; line-height: 1.1; }
.tile-id b { font: 700 25px var(--f-display); text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.tile-id small { font: 800 13px var(--f-body); opacity: .95; }
.tile-progress { display: flex; align-items: center; gap: 14px; }
.tile-prog-copy { flex: 1; min-width: 0; display: grid; gap: 8px; }
.tile-ring { position: relative; display: grid; place-items: center; color: var(--c); flex: none; border-radius: 50%; background: var(--c-wash); }
.tile-ring b { position: absolute; font: 700 17px var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.ring { display: inline-flex; }
.tile-body { padding: 18px 20px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tile-stats { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; }
.tile-stats b { font: 700 20px var(--f-display); }
.tile-stats .muted { font-size: 14px; }
.ch-bar { display: flex; gap: 4px; }
.ch-bar span { position: relative; flex: 1; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, var(--paper-2)); overflow: hidden; }
.ch-bar span::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--c); transform-origin: left; transform: scaleX(var(--v)); }
.tile-next-box { padding: 10px 14px 12px; border-radius: 16px; background: var(--c-wash); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 14%, transparent); }
.tile-kicker { display: block; font: 800 12px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text); }
.tile-next { font-weight: 800; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; margin-top: 2px; }
.tile-body .row { margin-top: auto; }
.tile-body .btn.ghost .ico { width: 18px; height: 18px; }

.home-foot { margin-top: 40px; display: flex; justify-content: center; }
.grownup-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 16px; border-radius: 99px; color: var(--ink-2); font-weight: 800; text-decoration: none; background: var(--card); box-shadow: var(--sh-1), inset 0 0 0 1px var(--line); transition: transform .2s var(--spring), color .2s; }
.grownup-link .ico { width: 18px; height: 18px; }
.grownup-link .ico:last-child { width: 14px; height: 14px; opacity: .7; }
.grownup-link:hover { color: var(--ink); transform: translateY(-2px); }

/* Sparkle burst when progress went up since the last visit */
.sparkles { position: absolute; inset: 50% auto auto 50%; width: 0; height: 0; pointer-events: none; }
.sparkles i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; background: #FFE7A8; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; }
.days li.on .day-dot { position: relative; }
.days li.on .day-dot::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 194, 61, .55), rgba(255, 107, 74, .25) 60%, transparent); z-index: -1; opacity: .7; }
.days li.on .day-dot { isolation: isolate; }
.goal-track::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%); transform: translateX(-110%); clip-path: inset(0 calc((1 - var(--fill, 0)) * 100%) 0 0 round 99px); }
.btn.squish.pressed { animation: squish .26s var(--spring); }
@keyframes squish { 0% { transform: scale(1); } 35% { transform: scale(1.08, .86); } 65% { transform: scale(.95, 1.06); } 100% { transform: scale(1); } }
/* Paused when off screen or the tab is hidden */
.offscreen *, .offscreen::before, .offscreen::after, html.tab-hidden .home *, html.tab-hidden .home *::before, html.tab-hidden .home *::after { animation-play-state: paused !important; }

/* Motion (only when the learner has not asked for less) */
@media (prefers-reduced-motion: no-preference) {
  .fl { animation: drift var(--d, 7s) ease-in-out var(--dl, 0s) infinite alternate; }
  .hero-paige { animation: breatheBob 4.6s ease-in-out infinite; }
  .hero-smart { animation: bob 4s ease-in-out .6s infinite; }
  .hero-smart .ant { animation: blink 3.4s steps(1, end) infinite, antGlow 3.4s ease-in-out infinite; }
  .hero-smart .eye { animation: eyeGlow 2.8s ease-in-out infinite; }
  .hero .btn.play::after { animation: playPulse 2.4s ease-out 1.2s infinite; }
  .subject-tile:hover::before, .subject-tile:focus-within::before { animation: sweep 2.2s linear infinite; }
  .snap { transform-box: fill-box; transform-origin: center; animation: snap 6s var(--spring) infinite; }
  .snap.s2 { animation-delay: -1.2s; } .snap.s3 { animation-delay: -2.4s; } .snap.s4 { animation-delay: -3.6s; } .snap.s5 { animation-delay: -4.8s; }
  .book .page { transform-box: view-box; transform-origin: 246px 80px; animation: pageFlip 4.8s ease-in-out infinite; }
  .rise { animation: rise 4.8s ease-out infinite; opacity: 0; }
  .rise.r2 { animation-delay: 1.2s; } .rise.r3 { animation-delay: 2.4s; } .rise.r4 { animation-delay: 3.6s; }
  .bub { animation: bubble 2.6s ease-in infinite; opacity: 0; }
  .bub.b2 { animation-delay: .7s; } .bub.b3 { animation-delay: 1.3s; } .bub.b4 { animation-delay: 1.9s; }
  .atom { transform-box: view-box; transform-origin: 282px 54px; animation: spin 14s linear infinite; }
  .electron { transform-box: view-box; transform-origin: 282px 54px; animation: spin 3.2s linear infinite; }
  .leaf { transform-box: view-box; transform-origin: 174px 112px; animation: sway 3.6s ease-in-out infinite; }
  .sparkles i { animation: sparkle .9s var(--ease) var(--dl, .7s) both; }
  .days li.on .day-dot::before { animation: flameGlow 1.8s ease-in-out infinite; animation-delay: calc(var(--i) * -0.3s); }
  .goal-track::after { animation: shine 3.6s ease-in-out 1.4s infinite; }
  .halo { animation: breathe 6s ease-in-out infinite; }
  .bloom.b1 { animation: breathe 9s ease-in-out infinite; }
  .ta-float.a { animation: drift 6s ease-in-out infinite alternate; }
  .ta-float.b { animation: drift 7.5s ease-in-out -2s infinite alternate; }
  .ta-float.c { animation: drift 5.5s ease-in-out -1s infinite alternate; }
  /* Entrance choreography: about 600 ms in total, never blocks input */
  .greet { animation: tileIn .4s var(--ease) both; }
  .hero { animation: tileIn .45s var(--spring) 40ms both; }
  .home-side > * { animation: tileIn .45s var(--spring) 100ms both; }
  .home-side > :nth-child(2) { animation-delay: 150ms; }
  .subject-tile { animation: tileIn .45s var(--spring) both; animation-delay: calc(var(--i, 0) * 50ms + 180ms); }
  .tile-ring .ring circle:last-child { animation: ringDraw70 1.3s var(--ease) .45s both; }
  .hp-ring .ring circle:last-child { animation: ringDraw46 1.2s var(--ease) .35s both; }
  .ch-bar span::after, .hp-bar i, .goal-track i, .collect-teaser .meter > span { animation: growX 1.1s var(--ease) .4s both; }
  .days li .day-dot { animation: dotPop .4s var(--spring) both; animation-delay: calc(var(--i) * 45ms + 200ms); }
  .flame.lit svg { animation: flicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
  .next-unlock::after { animation: shimmer 3.2s ease-in-out 1s infinite; }
  .sky-sun { animation: breathe 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .sky-cloud { animation: drift 8s ease-in-out infinite alternate; }
  .sky-star { animation: twinkle 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
}
@keyframes drift { from { transform: translate3d(0, 0, 0) rotate(0deg); } to { transform: translate3d(6px, -14px, 0) rotate(12deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .85; } }
@keyframes tileIn { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }
@keyframes ringDraw70 { from { stroke-dashoffset: 197.92; } }
@keyframes ringDraw46 { from { stroke-dashoffset: 125.66; } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes dotPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0deg); } 30% { transform: scale(1.05, .96) rotate(-2deg); } 60% { transform: scale(.97, 1.04) rotate(2deg); } }
@keyframes breatheBob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-7px) scale(1.012, .992); } }
@keyframes blink { 0%, 72%, 100% { opacity: .25; } 74%, 80% { opacity: 1; } 82% { opacity: .3; } 84%, 88% { opacity: 1; } }
@keyframes antGlow { 0%, 100% { transform: scale(.9); } 50% { transform: scale(1.15); } }
@keyframes eyeGlow { 0%, 100% { opacity: .15; transform: scale(.9); } 50% { opacity: .65; transform: scale(1.1); } }
@keyframes playPulse { 0% { opacity: .9; transform: scale(.96); } 70%, 100% { opacity: 0; transform: scale(1.12); } }
@keyframes sweep { to { --sweep: 360deg; } }
@keyframes snap { 0%, 12% { transform: translate(0, 0) rotate(0); } 40% { transform: translate(-10px, -8px) rotate(-12deg); } 58% { transform: translate(6px, 4px) rotate(8deg); } 66% { transform: translate(-2px, -1px) rotate(-2deg); } 72%, 100% { transform: translate(0, 0) rotate(0); } }
@keyframes pageFlip { 0%, 30% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 70%, 100% { transform: scaleX(-1); opacity: 0; } }
@keyframes rise { 0% { opacity: 0; transform: translate(0, 10px) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -46px) scale(1.15) rotate(10deg); } }
@keyframes bubble { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 20% { opacity: .95; } 100% { opacity: 0; transform: translate(4px, -62px) scale(1.25); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes sparkle { 0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-54px) scale(1.2); } }
@keyframes flameGlow { 0%, 100% { opacity: .55; transform: scale(.95); } 25% { opacity: .9; transform: scale(1.08, 1.14); } 50% { opacity: .65; transform: scale(1); } 75% { opacity: .95; transform: scale(1.06, 1.1); } }
@keyframes shine { 0% { transform: translateX(-110%); } 45%, 100% { transform: translateX(110%); } }
@keyframes shimmer { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }

/* Home responsive */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .subject-tiles { gap: 16px; }
}
@media (max-width: 900px) {
  .tile-top { min-height: 120px; padding: 16px; }
  .tile-id .glyph.lg { width: 44px; height: 44px; padding: 6px; }
  .tile-id b { font-size: 21px; }
  .tile-body { padding: 16px; }
  .tile-stats { flex-direction: column; gap: 0; }
  .tile-progress { gap: 10px; }
  .tile-body .row { flex-wrap: nowrap; gap: 8px; }
  .tile-body .btn.subject { flex: 1; padding: 0 12px; }
  .tile-body .btn.ghost.sm { padding: 0 12px; }
}
@media (max-width: 680px) {
  .greet { align-items: stretch; }
  .clock { align-self: flex-start; }
  .hero { grid-template-columns: 1fr; min-height: 0; border-radius: 28px; }
  .hero-copy { padding: 22px 22px 0; }
  .hero-art { min-height: 200px; margin-top: -4px; }
  .hero-paige { height: 200px; right: 42%; }
  .hero-smart { height: 140px; right: 12%; }
  .tile-art svg { transform: translateX(10%); }
  .halo { width: 220px; height: 220px; right: 20%; }
  .hero-actions { flex-wrap: nowrap; }
  .hero-actions .btn.xl { flex: 1.3; padding-right: 18px; }
  .hero-actions .btn.glass { flex: 1; min-height: 56px; padding: 0 12px; white-space: nowrap; font-size: 16px; }
  .home-side { grid-template-columns: 1fr; }
  .subject-tiles { grid-template-columns: 1fr; }
  .tile-stats { flex-direction: row; }
}
@media (max-width: 380px) { .day-dot { width: 32px; height: 32px; } .clock-time { font-size: 24px; } }
.seg-ctl button { white-space: nowrap; }
@media (max-width: 420px) { .seg-ctl .ico { display: none; } .seg-ctl button { padding: 0 6px; font-size: 15px; } }
