/* ==========================================================================
   Oando Prompt Academy — premium dark design system
   One accent (Oando amber). Orange as a quiet secondary. Red only for errors.
   Brand blue lives in ambient glows, never in flat blocks.
   ========================================================================== */
:root, .stage, .play-chips, .assembled, .json-ed {
  --bg: #0A0B12;
  --bg-2: #0E0F18;
  --surface: #13141E;
  --surface-2: #191A26;
  --surface-3: #21222F;
  --ov: 255 255 255;            /* overlay colour: white on dark, navy in light mode */
  --line: rgb(var(--ov) / .07);
  --line-2: rgb(var(--ov) / .12);
  --line-3: rgb(var(--ov) / .2);
  --text: #EDECF4;
  --text-2: #B3B2C5;
  --muted: #7C7B93;

  --accent: #F9A51A;            /* Oando amber — the one accent */
  --accent-2: #FFC861;
  --accent-ink: #1B1206;
  --accent-text: #F9A51A;       /* amber used as TEXT (deeper in light mode for contrast) */
  --accent-soft: rgba(249,165,26,.10);
  --accent-line: rgba(249,165,26,.38);
  --orange: #F16522;
  --brand-blue: #2E3191;
  --glow-blue: rgba(58,62,190,.38);

  --good: #3DCB8F; --good-soft: rgba(61,203,143,.10); --good-line: rgba(61,203,143,.45);
  --bad: #F2636A;  --bad-soft: rgba(242,99,106,.10);  --bad-line: rgba(242,99,106,.45);
  --good-ink: #062115; --bad-ink: #2A0709; --blue-text: #C9CBFF;
  --glass: rgba(14,15,24,.92); --glass-2: rgba(10,11,18,.72);
  --glow-blue-a: rgba(46,49,145,.28); --glow-amber-a: rgba(249,165,26,.05);

  /* legacy aliases used by scripts */
  --yellow: var(--accent); --red: var(--bad); --blue: var(--accent); --ink: var(--text);
  --paper: var(--bg); --tint-yellow: var(--accent-soft); --tint-blue: var(--surface-2);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgb(var(--ov) / .03) inset, 0 20px 40px -20px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.75);
  --display: "Inter Tight", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: dark;
}
.stage, .play-chips, .assembled, .json-ed { color: var(--text); }

/* ── Light theme ──────────────────────────────────────────────────────────────
   Warm paper, white cards, Oando navy ink, navy hairlines. Brand amber stays the
   fill colour; amber, green and red TEXT are deepened to meet contrast on white. */
:root[data-theme="light"] {
  --bg: #F6F5F1;
  --bg-2: #EFEDE7;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --surface-3: #EFEDE8;
  --ov: 21 22 61;
  --line: rgba(21,22,61,.09);
  --line-2: rgba(21,22,61,.15);
  --line-3: rgba(21,22,61,.28);
  --text: #15163D;
  --text-2: #45466A;
  --muted: #74758E;
  --accent-text: #A35C00;
  --accent-2: #8F5200;
  --accent-soft: rgba(249,165,26,.16);
  --accent-line: rgba(204,128,0,.55);
  --good: #0E8457; --good-soft: rgba(14,132,87,.09); --good-line: rgba(14,132,87,.42); --good-ink: #FFFFFF;
  --bad: #C2333B;  --bad-soft: rgba(194,51,59,.08);  --bad-line: rgba(194,51,59,.42);  --bad-ink: #FFFFFF;
  --blue-text: #2E3191;
  --glass: rgba(255,255,255,.92); --glass-2: rgba(246,245,241,.82);
  --glow-blue-a: rgba(46,49,145,.07); --glow-amber-a: rgba(249,165,26,.08);
  --shadow: 0 1px 2px rgba(21,22,61,.05), 0 12px 30px -16px rgba(21,22,61,.20);
  --shadow-lg: 0 28px 64px -28px rgba(21,22,61,.30);
  color-scheme: light;
}
/* Smooth switch between themes (only while toggling). */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease, fill .35s ease, stroke .35s ease !important;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
}
body::before { /* ambient brand glow, very low */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(1100px 520px at 15% -10%, var(--glow-blue-a), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, var(--glow-amber-a), transparent 60%);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
::selection { background: rgba(249,165,26,.3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.035em; line-height: 1.04; margin: 0; font-weight: 700; }
h1 { font-size: clamp(36px, 5vw, 64px); font-weight: 800; }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: 18px; letter-spacing: -0.015em; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.serif, .em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.em-orange, .em-yellow, .em-accent { color: var(--accent-text); }
.eyebrow, .step-kicker {
  text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 700; color: var(--accent-text);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 12px; padding: 13px 22px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.005em;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgb(var(--ov) / .08) inset, 0 8px 24px -8px rgba(249,165,26,.45);
  transition: transform .15s var(--ease), filter .15s, box-shadow .2s, background .2s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn.checking { position: relative; color: transparent !important; background: var(--surface-3); }
.btn.checking::after { content: "Checking…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2);
  background: linear-gradient(90deg, transparent, rgb(var(--ov) / .08), transparent) 0 0 / 200% 100%; animation: shimmer 1s linear infinite; border-radius: inherit; }
@keyframes shimmer { to { background-position: -200% 0; } }
.btn[disabled] { background: var(--surface-3); color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none; filter: none; }
.btn.orange, .btn.yellow { background: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); color: var(--good-ink); box-shadow: 0 8px 24px -10px rgba(61,203,143,.5); }
.btn.bad { background: var(--bad); color: var(--bad-ink); box-shadow: 0 8px 24px -10px rgba(242,99,106,.5); }
.btn.ghost, .btn.light { background: transparent; color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
.btn.ghost:hover, .btn.light:hover { box-shadow: 0 0 0 1px var(--line-3) inset; background: rgb(var(--ov) / .03); }
.btn.lg { padding: 16px 28px; font-size: 16px; }
.btn.sm { padding: 9px 14px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; display: grid; place-items: center;
  background: rgb(var(--ov) / .05); color: var(--text-2); box-shadow: 0 0 0 1px var(--line) inset; transition: background .2s, color .2s;
}
.icon-btn:hover { background: rgb(var(--ov) / .09); color: var(--text); }
.icon-btn.dark { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: rgb(var(--ov) / .05); color: var(--text-2); box-shadow: 0 0 0 1px var(--line) inset; }
.chip.yellow, .chip.orange { background: var(--accent-soft); color: var(--accent-2); box-shadow: 0 0 0 1px rgba(249,165,26,.2) inset; }
.chip.red { background: var(--bad-soft); color: #FF9CA1; box-shadow: 0 0 0 1px rgba(242,99,106,.25) inset; }
.chip.good { background: var(--good-soft); color: var(--good); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line) inset, var(--shadow); padding: 24px; }
.input {
  width: 100%; padding: 15px 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg-2); font-size: 16px; color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: #5E5D74; }
.input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px rgba(249,165,26,.08); }
textarea.input { resize: vertical; min-height: 130px; line-height: 1.6; }
label.field { display: grid; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); }
select.input option { background: var(--surface); }

/* ---------- Welcome ---------- */
.splash {
  min-height: 100vh; display: grid; place-items: center; text-align: center; overflow: hidden; position: relative; padding: 24px;
  background: radial-gradient(900px 600px at 50% 120%, rgba(46,49,145,.55), transparent 65%), radial-gradient(600px 400px at 50% 30%, rgba(249,165,26,.06), transparent 70%), var(--bg);
}
.splash .rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.splash .rings span { position: absolute; border-radius: 50%; border: 1px solid rgb(var(--ov) / .5); opacity: 0; }
.splash-inner { position: relative; z-index: 2; display: grid; gap: 28px; justify-items: center; max-width: 860px; }
.splash .emblem { width: 64px; }
.splash h1 { font-size: clamp(54px, 9.5vw, 128px); letter-spacing: -0.055em; line-height: .95; }
.splash h1 .line { display: block; }
.splash h1 .em { color: var(--accent-text); font-weight: 400; letter-spacing: -0.02em; padding-right: .05em; }
.splash .tag { font-size: clamp(17px, 2vw, 20px); color: var(--text-2); max-width: 540px; }
.splash .foot { position: absolute; bottom: 26px; left: 0; right: 0; display: flex; justify-content: center; z-index: 2; opacity: .55; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
  background: radial-gradient(700px 500px at 0% 100%, rgba(46,49,145,.55), transparent 65%), var(--bg-2); border-right: 1px solid var(--line);
}
.auth-art h2 { font-size: clamp(40px, 4.4vw, 66px); line-height: 1; font-weight: 800; letter-spacing: -0.045em; max-width: 640px; }
.auth-art h2 .em { color: var(--accent-text); font-weight: 400; }
.auth-art .orb-wrap { position: absolute; right: -150px; top: -170px; width: 440px; opacity: .14; filter: saturate(.8); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; }
.ms-btn:hover { border-color: var(--line-3); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { min-height: 320px; padding: 32px 24px; border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- Setup ---------- */
.setup { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.setup .box { width: 100%; max-width: 760px; display: grid; gap: 28px; }
.coach-line { display: flex; gap: 16px; align-items: flex-start; }
.coach-line .bubble { background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; border-radius: 4px 18px 18px 18px; padding: 18px 22px; font-size: 18px; color: var(--text-2); }
.coach-line .bubble strong { font-family: var(--display); color: var(--text); font-weight: 700; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.option {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px 18px;
  font-weight: 600; display: flex; gap: 12px; align-items: center; transition: border-color .15s, transform .15s, background .15s;
}
.option:hover { border-color: var(--accent-line); transform: translateY(-1px); background: var(--surface-2); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option .ico { font-size: 20px; filter: saturate(.7); }
.option small { display: block; font-weight: 400; color: var(--muted); }

/* ---------- Guide orb ---------- */
.orb { width: 40px; height: 44px; flex: none; position: relative; }
.orb svg { width: 100%; height: 100%; overflow: visible; }
.orb .ring { transform-origin: 50% 50%; transform-box: fill-box; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 24px;
  padding: 14px 32px; background: var(--glass-2); backdrop-filter: blur(16px) saturate(1.2); border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 26px; display: block; }
.topbar nav { display: flex; gap: 2px; margin-left: 16px; }
.topbar nav a { text-decoration: none; color: var(--muted); font-weight: 550; padding: 8px 14px; border-radius: 10px; font-size: 14.5px; transition: color .2s, background .2s; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--text); background: rgb(var(--ov) / .06); }
.topbar .stats { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.stat-pill { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; background: rgb(var(--ov) / .04); box-shadow: 0 0 0 1px var(--line) inset; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat-pill .ico { font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1px solid var(--line-2); font-family: var(--display); }
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .topbar nav { display: none; }
  .topbar .stat-pill .label { display: none; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--glass); backdrop-filter: blur(16px); border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
  .mobile-nav a { text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; display: grid; justify-items: center; gap: 2px; padding: 4px 10px; }
  .mobile-nav a .ico { font-size: 18px; filter: grayscale(1); opacity: .7; }
  .mobile-nav a.active { color: var(--accent-text); }
  .mobile-nav a.active .ico { filter: none; opacity: 1; }
  .page { padding-bottom: 96px !important; }
}
.page { max-width: 1240px; width: 100%; margin: 0 auto; padding: 44px 32px 72px; }
@media (max-width: 600px) { .page { padding: 28px 16px 64px; } }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 40px; align-items: start; }
@media (max-width: 1040px) { .home-grid { grid-template-columns: 1fr; } }
.hello h1 { font-size: clamp(40px, 5.6vw, 76px); letter-spacing: -0.05em; }
.hello h1 .em { font-weight: 400; }
.hello p { font-size: 17px; color: var(--text-2); margin-top: 12px; }
.hero-card {
  margin-top: 32px; border-radius: 24px; padding: 34px; position: relative; overflow: hidden;
  background: radial-gradient(600px 300px at 100% 0%, rgba(46,49,145,.45), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 0 0 0 1px var(--line-2) inset, var(--shadow-lg);
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center;
}
.hero-card h2 { font-size: clamp(30px, 3.6vw, 46px); margin: 12px 0 10px; font-weight: 800; letter-spacing: -0.045em; }
.hero-card p { color: var(--text-2); max-width: 520px; }
.hero-card .actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero-card .deco { position: absolute; right: -90px; bottom: -110px; width: 300px; opacity: .06; pointer-events: none; filter: grayscale(1) brightness(2); }
@media (max-width: 640px) { .hero-card { grid-template-columns: 1fr; padding: 24px; } .hero-card .ring-big { display: none; } }

.level-block { margin-top: 56px; }
.level-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.level-head .num { font-family: var(--display); font-weight: 300; font-size: 54px; line-height: .8; color: var(--muted); min-width: 64px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.level-head .num.on { color: var(--accent-text); }
.level-head h2 { font-size: 28px; }
.level-head .sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.level-head .meta { margin-left: auto; text-align: right; font-size: 13px; color: var(--muted); }
.pipeline { position: relative; display: grid; gap: 10px; padding-left: 44px; }
.pipeline::before { content: ""; position: absolute; left: 17px; top: 24px; bottom: 24px; width: 2px; background: var(--line); }
.pipeline .fill { position: absolute; left: 17px; top: 24px; width: 2px; background: linear-gradient(var(--accent), var(--orange)); box-shadow: 0 0 12px rgba(249,165,26,.5); }
.mod {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  background: var(--surface); border-radius: 16px; padding: 18px 20px; box-shadow: 0 0 0 1px var(--line) inset; border: 0;
  text-align: left; width: 100%; color: inherit; transition: transform .2s var(--ease), box-shadow .2s, background .2s;
}
button.mod:hover { transform: translateX(3px); box-shadow: 0 0 0 1px var(--line-3) inset; background: var(--surface-2); }
.mod .node {
  position: absolute; left: -44px; top: 50%; translate: 0 -50%; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line-2); font-size: 13px; color: var(--muted); z-index: 1;
}
.mod.done .node { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.mod.current { box-shadow: 0 0 0 1px var(--accent-line) inset, 0 20px 50px -24px rgba(249,165,26,.35); }
.mod.current .node { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 5px rgba(249,165,26,.1); }
.mod.locked { opacity: .45; cursor: not-allowed; }
.mod h3 { font-size: 17.5px; }
.mod .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mod .summary { color: var(--muted); font-size: 14px; margin-top: 3px; }
.mod .score { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.coming { padding: 18px 20px; border-radius: 16px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 14px; }

.side { display: grid; gap: 16px; position: sticky; top: 88px; }
.side .card h3 { margin-bottom: 14px; }
.goal { display: flex; gap: 18px; align-items: center; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-board { display: grid; gap: 4px; }
.mini-board .r { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; font-size: 14px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mini-board .r b { color: var(--muted); font-weight: 600; }
.mini-board .r.me { background: var(--accent-soft); color: var(--text); font-weight: 650; }
.tip-card { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.tip-card p { font-family: var(--serif); font-size: 24px; line-height: 1.25; margin-top: 10px; color: var(--text); }
.link { display: block; margin-top: 14px; font-weight: 600; font-size: 13.5px; color: var(--text-2); text-decoration: none; }
.link:hover { color: var(--accent-text); }

/* ---------- Medal ---------- */
.medal { display: grid; justify-items: center; gap: 6px; width: 78px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.medal .disc { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; position: relative;
  background: radial-gradient(circle at 50% 30%, #2A2B3B, #15161F 70%); box-shadow: 0 0 0 1px var(--accent-line) inset, 0 0 0 4px rgba(249,165,26,.06), 0 10px 24px -10px rgba(249,165,26,.4); }
.medal.locked .disc { box-shadow: 0 0 0 1px var(--line) inset; background: var(--surface-2); }
.medal.locked .disc span { filter: grayscale(1); opacity: .3; }
.medal.locked { color: var(--muted); }

/* ---------- Ring ---------- */
.ring-svg { transform: rotate(-90deg); }
.ring-svg .track { stroke: rgb(var(--ov) / .07); }
.ring-wrap { position: relative; display: grid; place-items: center; }
.ring-wrap .lbl { position: absolute; text-align: center; font-family: var(--display); font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-wrap .lbl small { display: block; font-family: var(--body); font-size: 10.5px; font-weight: 600; color: var(--muted); margin-top: 4px; letter-spacing: 0; }

/* ==========================================================================
   STAGE — narrated explainer
   ========================================================================== */
.stage {
  position: relative; overflow: hidden; color: var(--text); isolation: isolate; background: #07080D;
  display: grid; grid-template-rows: auto 1fr auto auto; min-height: 100vh;
}
.stage.embedded { min-height: min(640px, 74vh); border-radius: 22px; box-shadow: 0 0 0 1px var(--line) inset, var(--shadow-lg); }
.stage-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.stage-bg .glow { position: absolute; border-radius: 50%; filter: blur(90px); }
.stage-bg .vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.55) 100%); }
.stage-bg .grid { position: absolute; inset: 0; opacity: .5; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.stage-bg .grain { position: absolute; inset: 0; opacity: .06; background-image: 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='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.stage-top { display: flex; align-items: center; gap: 12px; padding: 18px 24px; }
.stage-top .who { display: grid; line-height: 1.25; }
.stage-top .who b { font-family: var(--display); font-size: 14.5px; font-weight: 650; }
.stage-top .who span { font-size: 12.5px; color: var(--muted); }
.stage-top .tools { margin-left: auto; display: flex; gap: 8px; }
.stage-visual { position: relative; display: grid; place-items: center; padding: 8px 40px; min-height: 0; overflow: hidden; }
/* Content never draws over the controls: it is clipped to this row and scrolls if taller ("safe" keeps the top reachable). */
.stage-visual > .vis { position: absolute; inset: 0; display: grid; place-items: safe center; padding: 8px 40px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.stage-visual > .vis::-webkit-scrollbar { display: none; }
.stage-caption {
  min-height: 84px; padding: 4px 32px 10px; text-align: center; font-size: clamp(16px, 1.7vw, 19px); line-height: 1.55;
  max-width: 860px; margin: 0 auto; width: 100%; color: rgba(237,236,244,.28); font-weight: 450;
}
.stage-caption .w { transition: color .25s; }
.stage-caption .w.on { color: var(--text); }
.stage.no-cc .stage-caption { visibility: hidden; }
.stage-bar { display: flex; align-items: center; gap: 12px; padding: 10px 24px 22px; }
.stage-bar .segs { flex: 1; display: flex; gap: 4px; }
.stage-bar .seg { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; cursor: pointer; border: 0; padding: 0; }
.stage-bar .seg i { display: block; height: 100%; width: 0; background: var(--accent); }
.stage-bar .seg.done i { width: 100%; background: rgba(255,255,255,.55); }
.stage .tap-hint { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: rgba(7,8,13,.7); backdrop-filter: blur(6px); }

/* Visuals */
.v-headline { text-align: center; max-width: 1100px; }
.v-headline .big { font-family: var(--display); font-weight: 800; font-size: clamp(52px, 9vw, 132px); line-height: .95; letter-spacing: -0.055em; color: #fff; }
.v-headline .big .wd { display: inline-block; white-space: nowrap; }
.v-headline .big .ch { display: inline-block; will-change: transform; }
.v-headline .sub { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.8vw, 34px); color: var(--text-2); margin-top: 22px; }
.v-headline .bar { height: 2px; border-radius: 2px; margin: 30px auto 0; width: 0; background: var(--accent); box-shadow: 0 0 16px rgba(249,165,26,.7); }

.v-tokens { text-align: center; max-width: 1100px; }
.v-tokens .src { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3.8vw, 50px); line-height: 1.15; letter-spacing: -0.03em; color: var(--text); }
.v-tokens .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px; margin-top: 30px; }
.tok { font-family: var(--display); font-weight: 600; padding: 6px 12px; border-radius: 10px; white-space: pre; letter-spacing: -0.02em; }
.v-tokens .tok { font-size: clamp(22px, 3vw, 40px); }
.tok.t0 { background: rgba(255,255,255,.06); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.14) inset; }
.tok.t1 { background: rgba(249,165,26,.12); color: var(--accent-2); box-shadow: 0 0 0 1px rgba(249,165,26,.4) inset; }
.tok.t2 { background: rgba(120,124,255,.10); color: #C9CBFF; box-shadow: 0 0 0 1px rgba(120,124,255,.32) inset; }
.v-tokens .count { margin-top: 30px; font-size: 16px; color: var(--muted); letter-spacing: .02em; }
.v-tokens .count b { font-family: var(--display); font-size: 38px; color: var(--accent); margin-right: 4px; letter-spacing: -0.03em; }

.v-chat { width: min(760px, 100%); display: grid; gap: 16px; }
.v-chat .msg { max-width: 86%; padding: 18px 22px; border-radius: 20px; font-size: clamp(18px, 2vw, 24px); line-height: 1.45; font-weight: 450; }
.v-chat .msg.user { justify-self: end; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-2) inset; border-bottom-right-radius: 6px; }
.v-chat .msg.ai { justify-self: start; background: rgba(249,165,26,.06); box-shadow: 0 0 0 1px rgba(249,165,26,.25) inset; border-bottom-left-radius: 6px; }
.v-chat .msg .who { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.v-chat .msg.ai .who { color: var(--accent); }
.v-chat .caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.v-list { width: min(820px, 100%); }
.v-list .ttl { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 4.8vw, 60px); margin-bottom: 24px; letter-spacing: -0.045em; }
.v-list ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.v-list li { display: flex; gap: 20px; align-items: center; font-size: clamp(19px, 2.3vw, 28px); font-weight: 500; padding: 14px 4px; border-bottom: 1px solid var(--line); letter-spacing: -0.015em; }
.v-list li .n { font-family: var(--display); font-weight: 500; width: 36px; flex: none; color: var(--accent); font-size: .8em; font-variant-numeric: tabular-nums; }
.v-list li b { font-family: var(--display); font-weight: 700; color: var(--accent-2); }

.v-compare { width: min(1080px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.v-compare .side { border-radius: 20px; padding: 28px; position: relative; }
.v-compare .side .lab { font-family: var(--display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .16em; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.v-compare .side .txt { font-size: clamp(18px, 1.9vw, 23px); line-height: 1.5; }
.v-compare .weak { background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }
.v-compare .weak .lab { color: var(--bad); }
.v-compare .weak .txt { color: var(--muted); }
.v-compare .strong { background: linear-gradient(180deg, rgba(249,165,26,.08), rgba(249,165,26,.02)); box-shadow: 0 0 0 1px var(--accent-line) inset; }
.v-compare .strong .lab { color: var(--accent); }
@media (max-width: 760px) {
  .v-compare { grid-template-columns: 1fr; gap: 10px; }
  .v-compare .side { padding: 14px 16px; border-radius: 16px; }
  .v-compare .side .lab { font-size: 11px; margin-bottom: 8px; }
  .v-compare .side .txt { font-size: 15px; line-height: 1.45; }
  .stage-visual, .stage-visual > .vis { padding: 8px 14px; }
  .stage-top { padding: 12px 14px; }
  .stage-top .who { min-width: 0; }
  .stage-top .who b, .stage-top .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage-top .orb { width: 32px; height: 36px; }
  .stage-top .icon-btn { width: 36px; height: 36px; }
  .stage-bar { padding: 8px 14px 14px; gap: 8px; }
  .stage-caption { padding: 4px 16px 8px; min-height: 64px; font-size: 15px; }
  .v-chat .msg { font-size: 16px; padding: 12px 14px; }
  .v-list li { font-size: 17px; padding: 9px 2px; }
  .v-list .ttl { font-size: 28px; margin-bottom: 12px; }
  .v-highlight { font-size: 28px; }
  .v-quote .t { font-size: 30px; }
  .v-eq .part { font-size: 22px; padding: 8px 14px; }
  .v-eq .res { font-size: 36px; }
  .v-icon .e { width: 110px; font-size: 56px; }
  .v-icon .t { font-size: 26px; margin-top: 16px; }
}

.v-eq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; max-width: 1100px; }
.v-eq .part { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 54px); padding: 12px 24px; border-radius: 16px; color: #fff; background: rgba(255,255,255,.04); box-shadow: 0 0 0 1px var(--line-2) inset; letter-spacing: -0.035em; }
.v-eq .op { font-family: var(--display); font-weight: 300; font-size: clamp(26px, 3.4vw, 46px); color: var(--muted); }
.v-eq .res { font-family: var(--serif); font-style: italic; font-size: clamp(40px, 6.4vw, 92px); color: var(--accent); flex-basis: 100%; text-align: center; margin-top: 14px; line-height: 1; }
.v-eq .res::before { content: "= "; font-family: var(--display); font-style: normal; color: var(--muted); font-weight: 300; }

.v-counter { text-align: center; }
.v-counter .num { display: inline-block; padding: 0 .1em .04em .04em; font-family: var(--display); font-weight: 800; font-size: clamp(110px, 19vw, 250px); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #FFE1A3 0%, var(--accent) 55%, #C9790A 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.v-counter .lab { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.6vw, 34px); color: var(--text-2); margin-top: 10px; }

.v-highlight { max-width: 1050px; text-align: center; font-family: var(--display); font-weight: 750; font-size: clamp(34px, 5vw, 68px); line-height: 1.14; letter-spacing: -0.045em; }
.v-highlight mark { background: none; color: var(--accent); position: relative; white-space: nowrap; }
.v-highlight mark::before { content: ""; position: absolute; left: -2px; right: -2px; bottom: .02em; height: 3px; background: var(--accent); transform-origin: left; transform: scaleX(var(--s, 0)); border-radius: 3px; box-shadow: 0 0 14px rgba(249,165,26,.8); }

.v-icon { text-align: center; }
.v-icon .e { font-size: clamp(64px, 9vw, 104px); line-height: 1; width: clamp(130px, 17vw, 190px); aspect-ratio: 1; display: inline-grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.08), rgba(255,255,255,.01) 70%); box-shadow: 0 0 0 1px var(--line-2) inset, 0 0 80px rgba(249,165,26,.12); }
.v-icon .t { font-family: var(--display); font-weight: 750; font-size: clamp(28px, 4vw, 52px); margin-top: 26px; letter-spacing: -0.04em; }

.v-quote { max-width: 980px; text-align: center; }
.v-quote .qm { font-family: var(--serif); font-size: 160px; line-height: .6; color: var(--accent); height: 70px; }
.v-quote .t { font-family: var(--serif); font-style: italic; font-size: clamp(36px, 5.2vw, 70px); line-height: 1.1; }
.v-quote .by { margin-top: 18px; color: var(--muted); font-size: 16px; }

/* Tight display tracking squeezes spaces (e.g. "AI tool"); restore clear word gaps. */
.v-headline .big, .v-icon .t, .v-highlight, .v-list .ttl, .v-list li, .v-eq .part, .v-tokens .src,
.v-quote .t, .v-counter .lab, .v-headline .sub, .splash h1, .hero-card h2, .hello h1, .auth-art h2, .result h1, .step-title, .lightning .q {
  word-spacing: 0.06em;
}

@media (max-height: 760px) {
  .v-list .ttl { font-size: 34px; margin-bottom: 10px; }
  .v-list li { font-size: 19px; padding: 9px 4px; }
  .stage-caption { min-height: 66px; font-size: 16px; }
}

/* ==========================================================================
   LESSON PLAYER
   ========================================================================== */
.lesson { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.lesson-top { display: flex; align-items: center; gap: 18px; padding: 18px 32px; max-width: min(1680px, 100%); width: 100%; margin: 0 auto; }
.lesson-top .bar { flex: 1; height: 4px; border-radius: 4px; background: rgb(var(--ov) / .08); overflow: hidden; }
.lesson-top .bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); box-shadow: 0 0 12px rgba(249,165,26,.6); transition: width .5s var(--ease); }
.combo { font-family: var(--display); font-weight: 700; color: var(--accent-text); font-size: 15px; min-width: 64px; text-align: right; }
.lesson-body { max-width: 860px; width: 100%; margin: 0 auto; padding: 28px 32px 48px; }
/* Narrated scenes: grow with the screen, cinematic 16:9, capped by viewport height */
.lesson-body.wide { max-width: min(1720px, 94vw); padding-top: 8px; padding-bottom: 24px; }
.lesson-body.wide .stage.embedded { min-height: clamp(520px, calc(100vh - 130px), 980px); }
@media (max-width: 900px) { .lesson-body.wide { max-width: 100%; padding-top: 4px; padding-bottom: 12px; } .lesson-body.wide .stage.embedded { aspect-ratio: auto; min-height: max(520px, calc(100svh - 96px)); border-radius: 18px; } }
.step-kicker { margin-bottom: 12px; }
.chip.tailored { margin-bottom: 14px; font-size: 12px; letter-spacing: .02em; }
.step-title { font-family: var(--display); font-weight: 750; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.12; margin-bottom: 26px; letter-spacing: -0.04em; }
.lesson-foot { border-top: 1px solid var(--line); background: rgba(14,15,24,.85); backdrop-filter: blur(14px); position: sticky; bottom: 0; transition: background .3s, border-color .3s; }
.lesson-foot .inner { max-width: 1100px; margin: 0 auto; padding: 18px 32px; display: flex; gap: 20px; align-items: center; min-height: 96px; }
.lesson-foot .fb { flex: 1; display: flex; gap: 16px; align-items: center; }
.lesson-foot .fb .big { font-family: var(--display); font-weight: 750; font-size: 22px; letter-spacing: -0.03em; }
.lesson-foot .fb .why { font-size: 14.5px; max-width: 660px; color: var(--text-2); margin-top: 2px; }
.lesson-foot .fb .badge-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: none; font-weight: 800; }
.lesson-foot.good { background: linear-gradient(0deg, rgba(61,203,143,.10), rgba(61,203,143,.04)), var(--glass); border-color: var(--good-line); }
.lesson-foot.good .big, .lesson-foot.good .badge-ic { color: var(--good); }
.lesson-foot.good .badge-ic { box-shadow: 0 0 0 1px var(--good-line) inset; }
.lesson-foot.bad { background: linear-gradient(0deg, rgba(242,99,106,.10), rgba(242,99,106,.04)), var(--glass); border-color: var(--bad-line); }
.lesson-foot.bad .big, .lesson-foot.bad .badge-ic { color: var(--bad); }
.lesson-foot.bad .badge-ic { box-shadow: 0 0 0 1px var(--bad-line) inset; }
.lesson-foot.partial { background: linear-gradient(0deg, rgba(249,165,26,.10), rgba(249,165,26,.04)), var(--glass); border-color: var(--accent-line); }
.lesson-foot.partial .big, .lesson-foot.partial .badge-ic { color: var(--accent-text); }
.lesson-foot.partial .badge-ic { box-shadow: 0 0 0 1px var(--accent-line) inset; }
@media (max-width: 640px) { .lesson-foot .inner { flex-direction: column; align-items: stretch; padding: 16px; } .lesson-top, .lesson-body { padding-left: 16px; padding-right: 16px; } }

/* Choices */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 17px 18px; border-radius: 14px;
  background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--line) inset; font-size: 16.5px; font-weight: 500; color: var(--text);
  transition: box-shadow .15s, background .15s, transform .1s;
}
.choice:hover:not([disabled]) { box-shadow: 0 0 0 1px var(--line-3) inset; background: var(--surface-2); }
.choice:active:not([disabled]) { transform: scale(.995); }
.choice .key { width: 28px; height: 28px; flex: none; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2) inset; display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--muted); }
.choice[aria-pressed="true"] { box-shadow: 0 0 0 1.5px var(--accent) inset; background: var(--accent-soft); }
.choice[aria-pressed="true"] .key { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.choice.right { box-shadow: 0 0 0 1.5px var(--good) inset; background: var(--good-soft); }
.choice.right .key { background: var(--good); color: var(--good-ink); box-shadow: none; }
.choice.wrong { box-shadow: 0 0 0 1.5px var(--bad) inset; background: var(--bad-soft); }
.choice.wrong .key { background: var(--bad); color: var(--bad-ink); box-shadow: none; }
.choice .why { display: block; font-size: 14px; color: var(--text-2); margin-top: 6px; font-weight: 400; }
.choice[disabled] { cursor: default; }
.multi-note { font-size: 13.5px; color: var(--muted); margin: -14px 0 18px; font-weight: 500; }

.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf .choice { justify-content: center; font-family: var(--display); font-weight: 700; font-size: 24px; padding: 28px; letter-spacing: -0.03em; }
.statement { font-family: var(--serif); font-size: clamp(26px, 3.2vw, 38px); line-height: 1.25; padding: 8px 0 28px 26px; margin-bottom: 24px; border-left: 2px solid var(--accent); }

.concept { background: var(--surface); border-radius: 22px; padding: 36px; box-shadow: 0 0 0 1px var(--line) inset; }
.concept .lead { font-size: 20px; line-height: 1.6; color: var(--text); }
.concept ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.concept li { display: flex; gap: 14px; font-size: 17px; color: var(--text-2); }
.concept li::before { content: ""; width: 6px; height: 6px; margin-top: 11px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 8px var(--accent); }
.concept .tip { margin-top: 28px; padding: 16px 18px; border-radius: 14px; background: var(--accent-soft); box-shadow: 0 0 0 1px rgba(249,165,26,.2) inset; display: flex; gap: 12px; font-size: 15px; color: var(--text); }

.order-list { display: grid; gap: 8px; }
.order-item { display: flex; gap: 12px; align-items: center; background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; border-radius: 14px; padding: 13px 14px; font-weight: 500; touch-action: none; user-select: none; }
.order-item .grip { cursor: grab; color: var(--muted); font-size: 18px; padding: 0 4px; }
.order-item .pos { font-family: var(--display); font-weight: 600; color: var(--accent-text); width: 22px; font-variant-numeric: tabular-nums; }
.order-item .mv { margin-left: auto; display: flex; gap: 6px; }
.order-item .mv button { border: 0; background: rgb(var(--ov) / .05); color: var(--text-2); border-radius: 8px; width: 30px; height: 30px; font-weight: 700; }
.order-item .mv button:hover { background: rgb(var(--ov) / .1); }
.order-item.dragging { box-shadow: 0 0 0 1.5px var(--accent) inset, var(--shadow-lg); z-index: 2; position: relative; background: var(--surface-2); }
.order-item.right { box-shadow: 0 0 0 1.5px var(--good) inset; background: var(--good-soft); }
.order-item.wrong { box-shadow: 0 0 0 1.5px var(--bad) inset; background: var(--bad-soft); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.match .col { display: grid; gap: 8px; align-content: start; }
.match .choice { padding: 14px 16px; font-size: 15.5px; }
.match .choice .tag { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; flex: none; }

.spot-text { background: var(--surface); border-radius: 20px; padding: 30px; box-shadow: 0 0 0 1px var(--line) inset; font-size: clamp(19px, 2.2vw, 24px); line-height: 1.85; font-weight: 450; }
.spot-text .ph { border-radius: 6px; padding: 2px 4px; cursor: pointer; background: rgb(var(--ov) / .04); border-bottom: 1px dashed var(--line-3); transition: background .15s; }
.spot-text .ph:hover { background: rgb(var(--ov) / .08); }
.spot-text .ph.sel { background: var(--accent-soft); border-bottom: 2px solid var(--accent); color: var(--accent-2); }
.spot-text .ph.hit { background: var(--good-soft); border-bottom: 2px solid var(--good); }
.spot-text .ph.miss { background: var(--accent-soft); border-bottom: 2px solid var(--accent); }
.spot-text .ph.fp { background: var(--bad-soft); border-bottom: 2px solid var(--bad); }
.spot-notes { display: grid; gap: 8px; margin-top: 16px; }
.spot-notes .n { background: var(--surface); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; color: var(--text-2); box-shadow: inset 2px 0 0 var(--good), 0 0 0 1px var(--line) inset; }
.spot-notes .n b { color: var(--text); }
.spot-notes .n.miss { box-shadow: inset 2px 0 0 var(--accent), 0 0 0 1px var(--line) inset; }

.builder { display: grid; gap: 20px; }
.assembled { background: var(--bg-2); border-radius: 18px; padding: 24px; min-height: 140px; font-size: 18px; line-height: 1.9; box-shadow: 0 0 0 1px var(--line-2) inset; font-family: "Cascadia Code", Consolas, ui-monospace, monospace; font-size: 15.5px; }
.assembled .ph { color: var(--muted); font-family: var(--body); font-style: italic; }
.assembled .pc { padding: 3px 8px; border-radius: 6px; margin-right: 4px; cursor: pointer; }
.assembled .lab { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; vertical-align: 2px; margin-right: 6px; opacity: .85; font-family: var(--body); }
.bank { display: flex; flex-wrap: wrap; gap: 8px; }
.piece { padding: 11px 14px; border-radius: 12px; border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2) inset; font-weight: 500; text-align: left; color: var(--text); }
.piece:hover:not([disabled]) { box-shadow: 0 0 0 1px var(--accent-line) inset; }
.piece.used { opacity: .3; }
.piece.right { box-shadow: 0 0 0 1.5px var(--good) inset; background: var(--good-soft); opacity: 1; }
.piece.wrong { box-shadow: 0 0 0 1.5px var(--bad) inset; background: var(--bad-soft); opacity: 1; }
.slot-role, .slot-task, .slot-context, .slot-format, .slot-constraint, .slot-example, .slot-audience { background: rgba(249,165,26,.1); color: var(--accent-2); box-shadow: 0 0 0 1px rgba(249,165,26,.25) inset; }
.slot-task, .slot-format { background: rgb(var(--ov) / .06); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
.slot-context, .slot-example { background: rgba(120,124,255,.1); color: var(--blue-text); box-shadow: 0 0 0 1px rgba(120,124,255,.3) inset; }
.slot-null { background: rgba(242,99,106,.1); color: #FFB0B4; }

.ab { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ab .choice { flex-direction: column; align-items: flex-start; padding: 22px; font-size: 16.5px; line-height: 1.55; min-height: 160px; }
.ab .choice .key { width: 32px; height: 32px; font-family: var(--display); font-size: 14px; }
.scenario { background: transparent; border-radius: 14px; padding: 16px 18px; font-size: 16px; margin-bottom: 22px; display: flex; gap: 12px; color: var(--text-2); box-shadow: 0 0 0 1px var(--line) inset; }
@media (max-width: 700px) { .ab, .match, .tf { grid-template-columns: 1fr; } }

.weak-box { background: var(--bad-soft); border-radius: 14px; padding: 16px 18px; box-shadow: 0 0 0 1px rgba(242,99,106,.25) inset; font-size: 17px; margin-bottom: 16px; font-family: "Cascadia Code", Consolas, ui-monospace, monospace; font-size: 15px; }
.weak-box b { color: var(--bad); font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; display: block; margin-bottom: 4px; font-family: var(--body); }
.meter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.meter .crit { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; background: rgb(var(--ov) / .04); color: var(--muted); box-shadow: 0 0 0 1px var(--line) inset; transition: background .25s, color .25s, box-shadow .25s; }
.meter .crit.on { background: var(--good-soft); color: var(--good); box-shadow: 0 0 0 1px var(--good-line) inset; }
.meter .crit.on::before { content: "✓ "; }
.strength { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.strength .track { flex: 1; height: 4px; border-radius: 4px; background: rgb(var(--ov) / .08); overflow: hidden; }
.strength .track i { display: block; height: 100%; width: 0; transition: width .35s var(--ease), background .35s; border-radius: 4px; }
.model-answer { margin-top: 18px; background: var(--surface); border-radius: 14px; padding: 18px 20px; font-size: 15.5px; box-shadow: inset 2px 0 0 var(--accent), 0 0 0 1px var(--line) inset; color: var(--text-2); }
.model-answer b { color: var(--accent-text); font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; display: block; margin-bottom: 6px; }

.lightning { display: grid; gap: 22px; justify-items: center; text-align: center; }
.lightning .q { font-family: var(--display); font-weight: 750; font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -0.04em; }
.lightning .choices { width: 100%; max-width: 620px; }
.lightning .meta { display: flex; gap: 22px; align-items: center; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.lightning .start { display: grid; gap: 16px; justify-items: center; padding: 30px; }
.lightning .start .e { font-size: 64px; }
.lt-track { width: 100%; max-width: 620px; height: 3px; background: rgb(var(--ov) / .08); border-radius: 3px; overflow: hidden; }
.lt-track i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width 1s linear; }

.play-chips { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-top: 14px; min-height: 52px; padding: 18px; border-radius: 16px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line) inset; }
.play-chips .tok { font-size: 17px; padding: 3px 8px; border-radius: 7px; }
.play-stats { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Result */
.result { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 32px 16px; background: radial-gradient(800px 500px at 50% 0%, rgba(249,165,26,.08), transparent 70%); }
.result .box { display: grid; gap: 22px; justify-items: center; max-width: 720px; }
.result h1 { font-size: clamp(48px, 7.5vw, 96px); letter-spacing: -0.055em; }
.result .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.result .tile { background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: 0 0 0 1px var(--line) inset; }
.result .tile .v { font-family: var(--display); font-weight: 750; font-size: 38px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.result .tile:first-child .v { color: var(--accent-text); }
.result .tile .k { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.result .big-ic { font-size: 56px; }

/* Progress */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 30px; }
.stats-grid .card .v { font-family: var(--display); font-weight: 750; font-size: 42px; line-height: 1; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.stats-grid .card:first-child .v { color: var(--accent-text); }
.stats-grid .card .k { color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; margin-top: 10px; }
@media (max-width: 860px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.lvl-row { display: grid; grid-template-columns: 150px 1fr 48px; gap: 14px; align-items: center; padding: 9px 0; font-size: 14.5px; }
.lvl-row .track { height: 4px; border-radius: 4px; background: rgb(var(--ov) / .07); overflow: hidden; }
.lvl-row .track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.history { display: grid; gap: 6px; }
.history .h { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: 10px; background: rgb(var(--ov) / .03); font-size: 14px; }

/* Leaderboard */
.board { display: grid; gap: 6px; }
.board .r { display: grid; grid-template-columns: 40px 40px 1fr auto; align-items: center; gap: 14px; padding: 13px 16px; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--line) inset; font-variant-numeric: tabular-nums; }
.board .r.me { box-shadow: 0 0 0 1.5px var(--accent-line) inset; background: linear-gradient(90deg, rgba(249,165,26,.07), transparent); }
.board .rank { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--muted); }
.board .r:nth-child(-n+3) .rank { color: var(--accent-text); }
.tabs { display: inline-flex; background: var(--surface); border-radius: 12px; padding: 4px; gap: 4px; box-shadow: 0 0 0 1px var(--line) inset; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* ---------- Certificate (a light, printable document on the dark page) ---------- */
.cert-wrap { display: grid; justify-items: center; gap: 28px; }
.cert {
  --c-ink: #14152B; --c-ink-2: #4A4B66; --c-blue: #2E3191; --c-gold: #C98A12; --c-paper: #FBF8F1;
  width: min(1100px, 100%); aspect-ratio: 1.414; background: var(--c-paper); position: relative; overflow: hidden;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.8), 0 0 0 1px rgb(var(--ov) / .06); border-radius: 4px; color: var(--c-ink); container-type: inline-size;
}
.cert .frame { position: absolute; inset: 2.4cqw; border: .12cqw solid var(--c-gold); }
.cert .frame::after { content: ""; position: absolute; inset: .7cqw; border: .06cqw solid rgba(201,138,18,.5); }
.cert .corner { position: absolute; width: 30cqw; right: -8cqw; top: -9cqw; opacity: .07; filter: grayscale(1); }
.cert .inner { position: absolute; inset: 6.2cqw 7.4cqw; display: flex; flex-direction: column; }
.cert .logo { height: 3.6cqw; align-self: flex-start; }
.cert .eyebrow { margin-top: 4.4cqw; font-size: 1.1cqw; letter-spacing: .34em; color: var(--c-gold); }
.cert .title { font-family: var(--display); font-weight: 800; font-size: 4.6cqw; line-height: 1; margin-top: 1.1cqw; color: var(--c-ink); letter-spacing: -0.045em; }
.cert .pres { margin-top: 3.4cqw; font-size: 1.4cqw; color: var(--c-ink-2); font-family: var(--serif); font-style: italic; }
.cert .name { font-family: var(--serif); font-size: 7cqw; line-height: 1; margin-top: .4cqw; letter-spacing: -0.02em; color: var(--c-blue); }
.cert .rule { height: .12cqw; width: 16cqw; margin: 2cqw 0 1.6cqw; background: var(--c-gold); }
.cert .desc { font-size: 1.35cqw; max-width: 60cqw; color: var(--c-ink-2); line-height: 1.6; }
.cert .bottom { margin-top: auto; display: flex; align-items: flex-end; gap: 5cqw; }
.cert .sig { display: grid; gap: .6cqw; font-size: 1.1cqw; color: var(--c-ink-2); min-width: 20cqw; }
.cert .sig .line { border-top: .1cqw solid var(--c-ink); padding-top: .6cqw; }
.cert .sig .script { font-family: var(--serif); font-style: italic; font-size: 2.2cqw; color: var(--c-ink); }
.cert .seal { margin-left: auto; width: 13cqw; text-align: center; }
.cert .seal img { width: 7.5cqw; }
.cert .seal div { font-size: .95cqw; color: var(--c-ink-2); margin-top: .6cqw; letter-spacing: .08em; }
.cert-locked { filter: blur(4px) grayscale(.5); opacity: .35; pointer-events: none; }
.cert-lock-msg { text-align: center; display: grid; gap: 12px; justify-items: center; }

/* ---------- Studio ---------- */
.studio { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media (max-width: 960px) { .studio { grid-template-columns: 1fr; } }
.tree { display: grid; gap: 10px; }
.tree .lv { background: var(--surface); border-radius: 14px; padding: 12px; box-shadow: 0 0 0 1px var(--line) inset; }
.tree .lv-h { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tree .lv-h input { border: 0; font-weight: 650; font-size: 14.5px; background: transparent; flex: 1; min-width: 0; padding: 4px; border-radius: 6px; }
.tree .lv-h input:focus { background: var(--bg-2); outline: none; }
.tree .mods { display: grid; gap: 4px; margin-top: 8px; min-height: 30px; padding: 4px; border-radius: 10px; }
.tree .mods.over { background: var(--accent-soft); }
.tree .m { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: rgb(var(--ov) / .03); font-size: 13.5px; cursor: pointer; box-shadow: 0 0 0 1px transparent inset; }
.tree .m.sel { box-shadow: 0 0 0 1px var(--accent-line) inset; background: var(--accent-soft); }
.tree .m .g { cursor: grab; color: var(--muted); }
.mini { border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.mini:hover { background: rgb(var(--ov) / .06); color: var(--text); }
.steps-list { display: grid; gap: 6px; }
.step-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: rgb(var(--ov) / .03); border-radius: 10px; box-shadow: 0 0 0 1px var(--line) inset; font-size: 13.5px; cursor: pointer; }
.step-row.sel { box-shadow: 0 0 0 1px var(--accent-line) inset; }
.step-row .t { font-weight: 700; min-width: 96px; text-transform: uppercase; font-size: 10px; letter-spacing: .14em; color: var(--accent-text); }
.step-row .d { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.json-ed { width: 100%; min-height: 360px; font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.55; border-radius: 12px; border: 1px solid var(--line-2); padding: 14px; background: #07080D; color: #E4E3F0; }
.json-ed.err { border-color: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.modal { position: fixed; inset: 0; background: rgba(5,6,10,.75); backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal .sheet { background: var(--bg-2); border-radius: 22px; width: min(1000px, 100%); max-height: 92vh; overflow: auto; padding: 24px; box-shadow: 0 0 0 1px var(--line-2) inset, var(--shadow-lg); }

/* Toast, confetti */
#toast { position: fixed; top: 20px; left: 50%; translate: -50% 0; z-index: 200; display: grid; gap: 8px; pointer-events: none; }
#toast .t { background: var(--surface-3); color: var(--text); padding: 12px 18px; border-radius: 12px; font-weight: 550; font-size: 14.5px; box-shadow: 0 0 0 1px var(--line-2) inset, var(--shadow-lg); display: flex; gap: 10px; align-items: center; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; width: 100vw; height: 100vh; }
.xp-float { position: fixed; z-index: 160; font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--accent-text); pointer-events: none; text-shadow: 0 0 20px rgba(249,165,26,.6); letter-spacing: -0.03em; }

.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; } }

@media print {
  body { background: #fff; } body::before { display: none; }
  .topbar, .mobile-nav, .no-print { display: none !important; }
  .page { padding: 0; max-width: none; }
  .cert { box-shadow: none; width: 100%; }
  @page { size: A4 landscape; margin: 0; }
}

/* ── Light theme refinements ──────────────────────────────────────────────── */
:root[data-theme="light"] .splash {
  background: radial-gradient(900px 600px at 50% 120%, rgba(46,49,145,.10), transparent 65%), radial-gradient(600px 400px at 50% 30%, rgba(249,165,26,.10), transparent 70%), var(--bg);
}
:root[data-theme="light"] .splash .foot img, :root[data-theme="light"] .topbar .logo { filter: none; }
:root[data-theme="light"] .hero-card {
  background: radial-gradient(600px 300px at 100% 0%, rgba(46,49,145,.08), transparent 70%), linear-gradient(180deg, #FFFFFF, #FBFAF7);
}
:root[data-theme="light"] .hero-card .deco { filter: none; opacity: .07; }
:root[data-theme="light"] .btn { box-shadow: 0 0 0 1px rgba(21,22,61,.06) inset, 0 8px 20px -10px rgba(204,128,0,.55); }
:root[data-theme="light"] .btn.ghost, :root[data-theme="light"] .btn.light { box-shadow: 0 0 0 1px var(--line-2) inset; }
:root[data-theme="light"] .btn[disabled] { box-shadow: none; }
:root[data-theme="light"] .medal .disc { background: radial-gradient(circle at 50% 30%, #FFFFFF, #F3F1EC 70%); box-shadow: 0 0 0 1px var(--accent-line) inset, 0 0 0 4px rgba(249,165,26,.08), 0 8px 18px -10px rgba(204,128,0,.45); }
:root[data-theme="light"] .stage.embedded { box-shadow: 0 30px 70px -30px rgba(21,22,61,.45); }
:root[data-theme="light"] .cert { box-shadow: 0 30px 80px -30px rgba(21,22,61,.35), 0 0 0 1px rgba(21,22,61,.06); }
:root[data-theme="light"] .lesson-foot.good .badge-ic, :root[data-theme="light"] .lesson-foot.bad .badge-ic, :root[data-theme="light"] .lesson-foot.partial .badge-ic { background: #fff; }
:root[data-theme="light"] .result { background: radial-gradient(800px 500px at 50% 0%, rgba(249,165,26,.12), transparent 70%); }
:root[data-theme="light"] .modal { background: rgba(21,22,61,.45); }
:root[data-theme="light"] #toast .t { background: #15163D; color: #fff; }
.theme-toggle { position: relative; }
.theme-toggle svg { width: 18px; height: 18px; }
.splash .theme-toggle { position: absolute; top: 20px; right: 20px; z-index: 5; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line) inset; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Theme-aware logo */
.brand-logo { display: inline-flex; }
.brand-logo .on-light { display: none; }
:root[data-theme="light"] .brand-logo .on-light { display: inline; }
:root[data-theme="light"] .brand-logo .on-dark { display: none; }
