@font-face {
  font-family: "Inter";
  src: url("/vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens (ClipBox look; light-dark() follows the color-scheme meta) ---------- */
:root {
  color-scheme: light dark;
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --r-ctl: 11px;
  --ctl: 40px;
  --ctl-sm: 32px;
  --sidebar: 224px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --target: 24px;

  --accent: #7c5cff;
  --accent-2: #4fd1ff;
  --ok: #3ddc97;
  --bad: #ff5c7a;
  --warn: #ffb547;
  --gold: #ffc93c;
  --on-accent: #fff;
  --on-warn: #241500;

  --bg: light-dark(#f4f4f8, #0b0b10);
  --bg-2: light-dark(#ececf2, #111118);
  --panel: light-dark(#ffffff, #15151e);
  --panel-2: light-dark(#f6f6fa, #1c1c27);
  --panel-3: light-dark(#e9e9f1, #252532);
  --line: light-dark(rgba(10, 10, 30, .08), rgba(255, 255, 255, .07));
  --line-2: light-dark(rgba(10, 10, 30, .15), rgba(255, 255, 255, .13));
  --text: light-dark(#15151f, #ececf3);
  --text-2: light-dark(#55556a, #a3a3b5);
  --text-3: light-dark(#8b8ba0, #6d6d80);
  --shadow: light-dark(0 10px 40px rgba(20, 20, 50, .12), 0 10px 40px rgba(0, 0, 0, .45));
  --glass: light-dark(rgba(255, 255, 255, .8), rgba(14, 14, 20, .78));
  --hover: light-dark(rgba(10, 10, 30, .045), rgba(255, 255, 255, .05));
  --focus: color-mix(in srgb, var(--accent) 75%, white);
  --num-bg: light-dark(#fff1c2, #3a2f0c);
  --num-fg: light-dark(#6b4a00, #ffd66b);
  --ask-bg: color-mix(in srgb, var(--accent-2) 22%, transparent);

  --phys: #7c5cff;
  --ce: #ff8a3d;
}
@media (pointer: coarse) { :root { --target: 44px; --ctl: 46px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-bottom: 96px; -webkit-tap-highlight-color: transparent; } /* no grey flash on taps (phones) */
:focus:not(:focus-visible) { outline: none; }
@media (pointer: coarse) {
  * { -webkit-tap-highlight-color: transparent; }
  button, a, .btn, .choice, .mf, .mf-key, .feed-card, .w-timeline, .host, img { -webkit-touch-callout: none; }
}
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  min-block-size: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
input[type=range], input[type=checkbox], input[type=radio], progress { accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
img, svg, video { max-inline-size: 100%; }
img { block-size: auto; }
h1, h2, h3 { font-family: var(--font-head, var(--font)); text-wrap: balance; line-height: 1.2; letter-spacing: -.02em; margin: 0; }
p, li { text-wrap: pretty; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
svg.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-block-size: 100dvh; }
.sidebar {
  position: sticky; top: 0; block-size: 100dvh; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand .logo, .auth-brand .logo { inline-size: 34px; block-size: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent); }
.brand .logo svg.i, .auth-brand .logo svg.i { width: 20px; height: 20px; stroke-width: 2.4; }
.brand img.logo, .auth-brand img.logo { object-fit: cover; background: none; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 11px; color: var(--text-2);
  font-weight: 550; position: relative; transition: background .2s, color .2s; min-block-size: var(--target);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item svg.i { width: 20px; height: 20px; }
.side-stats { margin-top: auto; display: grid; gap: 8px; padding: 10px 6px; }

main { padding: 28px clamp(16px, 4vw, 44px) 120px; max-inline-size: 1180px; inline-size: 100%; outline: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; block-size: auto; flex-direction: row; justify-content: space-around;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line);
    background: var(--glass); backdrop-filter: blur(16px);
  }
  .brand, .side-stats { display: none; }
  .nav-item { flex: 1 1 0; min-inline-size: 0; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10.5px; text-align: center; }
  .nav-item > span:last-child { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item.active::before { display: none; }
  main { padding: 18px 14px 130px; }
  #player-dock { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- atoms ---------- */
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-inline-size: 0; }
.stack { display: grid; gap: 14px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-block-end: 22px; }
.page-head h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-block-size: var(--ctl); padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 650; cursor: pointer;
  transition: background .15s, transform .15s var(--spring), border-color .15s; white-space: nowrap; min-inline-size: var(--target);
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); border-color: transparent; color: var(--on-accent);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); color: #062716; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { min-block-size: var(--ctl-sm); padding: 0 12px; font-size: 13.5px; }
.btn.big { min-block-size: 56px; padding: 0 26px; font-size: 17px; border-radius: 16px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { position: relative; inline-size: var(--ctl); padding: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650;
  background: var(--panel-3); color: var(--text-2); }
.chip.phys { background: color-mix(in srgb, var(--phys) 20%, transparent); color: color-mix(in srgb, var(--phys) 60%, var(--text)); }
.chip.ce { background: color-mix(in srgb, var(--ce) 20%, transparent); color: color-mix(in srgb, var(--ce) 60%, var(--text)); }
.chip.gold { background: color-mix(in srgb, var(--gold) 22%, transparent); color: color-mix(in srgb, var(--gold) 55%, var(--text)); }

.input {
  min-block-size: var(--ctl); padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--panel-2);
  inline-size: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.input.right { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.input.wrong { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }

.bar { block-size: 8px; border-radius: 8px; background: var(--panel-3); overflow: hidden; }
.bar > span { display: block; block-size: 100%; inline-size: calc(var(--v, 0) * 100%); border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: inline-size .5s var(--ease); }

/* progress ring (modern-web-guidance: progress-ring) */
@property --value { syntax: '<number>'; inherits: true; initial-value: 0; }
.ring-wrap { position: relative; display: grid; place-items: center; }
progress.ring {
  --size: 64px; --thickness: 7px; --track-color: var(--panel-3); --fill-color: var(--accent);
  appearance: none; inline-size: var(--size); block-size: var(--size); border-radius: 50%;
  background: conic-gradient(var(--fill-color) calc(var(--value) * 1%), var(--track-color) 0);
  mask-image: radial-gradient(transparent calc(50% - var(--thickness)), black calc(50% - var(--thickness) + .5px));
  border: 0; transition: --value 0s;
  @media (prefers-reduced-motion: no-preference) { transition-duration: .6s; }
  @media (forced-colors: active) { forced-color-adjust: none; --fill-color: CanvasText; --track-color: Canvas; }
}
progress.ring::-webkit-progress-bar, progress.ring::-webkit-progress-value { display: none; background: none; }
progress.ring::-moz-progress-bar { display: none; background: none; }
.ring-wrap .ring-label { position: absolute; font-weight: 800; font-size: 14px; }

/* ---------- dialogs & toasts (native <dialog>, popover) ---------- */
dialog {
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel); color: var(--text); padding: 22px;
  max-inline-size: min(520px, calc(100vw - 24px)); box-shadow: var(--shadow);
}
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgba(5, 5, 15, .6); backdrop-filter: blur(4px); overflow: hidden; overscroll-behavior: contain; }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: pop .35s var(--spring); }
}
@keyframes pop { from { opacity: 0; scale: .92; } }
dialog h2 { font-size: 21px; margin-block-end: 8px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-block-start: 18px; flex-wrap: wrap; }

#toasts { inset: auto 16px 90px auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; display: grid; gap: 8px; justify-items: end; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: slide-in .3s var(--spring); } }
@keyframes slide-in { from { opacity: 0; translate: 0 10px; } }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--panel); }
.hero h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { display: grid; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); min-inline-size: 92px; }
.stat b { font-size: 20px; }
.stat span { font-size: 12px; color: var(--text-3); font-weight: 650; }
.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-block-start: 18px; }
.course { display: grid; gap: 14px; border-top: 3px solid var(--c); }
.course-head { display: flex; gap: 14px; align-items: center; }
.course-head h2 { font-size: 19px; }
.countdown { font-weight: 800; color: var(--c); }
.topics { display: grid; gap: 6px; }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); }
.topic-row .bar { grid-column: 1; }
.topic-row .t { font-weight: 650; }
.topic-row .acts { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; }

/* ---------- play / run ---------- */
.run-top { position: sticky; top: 0; z-index: 4; display: flex; gap: 12px; align-items: center; padding: 10px 0 12px; background: var(--bg); }
.pips { display: flex; gap: 5px; flex: 1; }
.pips i { flex: 1; block-size: 7px; border-radius: 6px; background: var(--panel-3); transition: background .3s; }
.pips i.done { background: var(--ok); }
.pips i.miss { background: var(--bad); }
.pips i.now { background: var(--accent); }
.combo { font-weight: 900; font-size: 15px; padding: 4px 10px; border-radius: 99px; background: var(--panel-2); min-inline-size: 64px; text-align: center; }
.combo.hot { background: linear-gradient(135deg, #ff7a2f, #ffc93c); color: #2a1300; }
@media (prefers-reduced-motion: no-preference) { .combo.bump { animation: bump .4s var(--spring); } }
@keyframes bump { 40% { scale: 1.25; } }
.xp-pill { font-weight: 800; color: var(--gold); }

.q-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .q-layout { grid-template-columns: 1fr; } }
.q-card { display: grid; gap: 14px; }
.q-kind { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-kind .eyebrow { min-inline-size: 10ch; }
.q-text { font-size: 17px; line-height: 1.65; }
mark.num { --hue: var(--num-fg); background: color-mix(in srgb, var(--hue) 20%, transparent); color: color-mix(in srgb, var(--hue) 75%, var(--text));
  padding: 0 4px; border-radius: 5px; font-weight: 700; white-space: nowrap; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--hue) 55%, transparent); }
mark.num.u-volt { --hue: #ffc93c; } mark.num.u-amp { --hue: #4fd1ff; } mark.num.u-ohm { --hue: #ff8a3d; }
mark.num.u-farad { --hue: #3ddc97; } mark.num.u-henry { --hue: #b69cff; } mark.num.u-field { --hue: #ff6fb5; }
mark.num.u-freq { --hue: #2ee6d6; } mark.num.u-time { --hue: #a3e635; } mark.num.u-energy { --hue: #ff5c7a; }
mark.num.u-gain { --hue: #8b9cff; } mark.num.u-angle { --hue: #f5a524; } mark.num.u-length, mark.num.u-speed { --hue: #94a3b8; } mark.num.u-charge { --hue: #e879f9; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; color: var(--text-2); }
.q-text.ask-on .ask { background: var(--ask-bg); padding: 0 4px; border-radius: 5px; font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent-2); }
.q-text .katex { font-size: 1.05em; }

.fig { position: relative; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; touch-action: pan-y; }
.fig > .fig-art { display: block; inline-size: 100%; }
.fig > .fig-art svg { display: block; inline-size: 100%; block-size: auto; }
.fig > img.fig-art { background: #fff; }
.fig canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; }
.fig:not(.drawing) canvas { pointer-events: none; }
.fig-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-group { display: flex; gap: 2px; align-items: center; padding: 3px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.tool-group.swatches { gap: 6px; padding: 5px 8px; }
.tool { gap: 6px; padding-inline: 10px; border: 0; background: transparent; }
.tool[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.tool-label { font-size: 12.5px; }
@media (max-width: 1180px) { .tool-group:last-child .tool-label { display: none; } .tool-group:last-child .tool { padding-inline: 8px; } }
@media (max-width: 560px) { .tool-label { display: none; } .tool { padding-inline: 8px; } .tool-group.swatches { gap: 4px; padding: 4px 6px; } .swatch { inline-size: 22px; block-size: 22px; } }
.bench.drawing .bench-ink { cursor: crosshair; }
.bench.erasing .bench-ink { cursor: cell; }
.swatch { inline-size: 26px; block-size: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; position: relative; }
.swatch::after { content: ""; position: absolute; inset: -9px; }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 2px var(--text); }
.scratch { block-size: 260px; }

.steps { display: grid; gap: 10px; counter-reset: step; }
.step { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 14px 16px; display: grid; gap: 10px; }
.step.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.step.done { opacity: .82; }
.step.locked { opacity: .4; }
.step-head { display: flex; gap: 10px; align-items: baseline; }
.step-head::before { counter-increment: step; content: counter(step); flex: none; inline-size: 24px; block-size: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--panel-3); }
.step.done .step-head::before { content: "✓"; background: var(--ok); color: #062716; }
.step.missed .step-head::before { content: "!"; background: var(--bad); color: #fff; }
.step-q { font-weight: 650; }
.step-tag { margin-inline-start: auto; }
.answer-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.answer-row .input { flex: 1 1 140px; inline-size: auto; font-variant-numeric: tabular-nums; font-size: 17px; }
.same-as { display: block; margin-block-start: 4px; color: var(--muted); }

/* math answer box: laid out as you type (fractions stack, powers rise) */
.mf { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 12px; cursor: text; min-inline-size: 0; }
.mf.focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.mf.off { cursor: default; }
.mf-view { flex: 1 1 auto; min-inline-size: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; font-family: "KaTeX_Main", "Times New Roman", serif; font-size: 19px; line-height: 1.15; padding-block: 2px; white-space: nowrap; }
.mf-ph { font-family: var(--font); font-size: 15px; color: var(--muted); }
.mf-row { display: inline-flex; align-items: center; }
.mf-row.tall > .mf-c.paren { font-size: 1.55em; line-height: 1; transform: scaleX(.8); }
.mf-c { padding-inline: .5px; }
.mf-c.op { padding-inline: .2em; }
.mf-sup .mf-c.op, .mf-sub .mf-c.op, .mf-row > .mf-c.op:first-child { padding-inline: 0 .05em; }
.mf-c.v { font-family: "KaTeX_Math", "KaTeX_Main", serif; font-style: italic; }
.mf-frac { display: inline-flex; flex-direction: column; align-items: center; margin-inline: 2px; font-size: .92em; }
.mf-num { padding: 0 3px 1px; border-block-end: 1.5px solid currentColor; }
.mf-den { padding: 2px 3px 0; }
.mf-num, .mf-den { display: flex; justify-content: center; min-inline-size: .8em; }
.mf-sup, .mf-sub { display: inline-flex; font-size: .7em; }
.mf-sup { align-self: flex-start; transform: translateY(-.15em); }
.mf-sub { align-self: flex-end; transform: translateY(.3em); }
.mf-sqrt { display: inline-flex; align-items: stretch; }
.mf-rad { font-size: 1.1em; line-height: 1; align-self: flex-end; }
.mf-rbody { display: inline-flex; border-block-start: 1.5px solid currentColor; padding: 1px 2px 0; }
.mf-empty { display: inline-block; min-inline-size: .7em; min-block-size: 1em; border: 1px dashed color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 3px; background: color-mix(in srgb, var(--accent) 8%, transparent); vertical-align: middle; position: relative; }
.mf-caret { display: inline-block; inline-size: 0; block-size: 1.1em; align-self: center; border-inline-start: 2px solid var(--accent); margin-inline: -1px; animation: mf-blink 1.05s steps(1) infinite; }
.mf-empty > .mf-caret { position: absolute; inset-inline-start: 2px; inset-block-start: 0; block-size: 100%; }
@keyframes mf-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mf-caret { animation: none; } }
.mf-ime { position: absolute; inset: 0; opacity: 0; resize: none; border: 0; padding: 0; font-size: 16px; color: transparent; background: transparent; caret-color: transparent; pointer-events: none; }
.mf-sym-btn { flex: none; inline-size: 34px; block-size: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-3); color: var(--text); font-size: 17px; font-family: serif; cursor: pointer; }
.mf-sym-btn:hover, .mf-sym-btn[aria-expanded="true"] { border-color: var(--accent); }
.mf-sym-btn:disabled { opacity: .4; cursor: default; }
.mf-pop { flex: 1 1 100%; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); }
.mf-pop[hidden] { display: none; }
.mf-key { min-block-size: 40px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-3); color: var(--text); font-family: "KaTeX_Main", serif; font-size: 16px; cursor: pointer; }
.mf-key:hover { border-color: var(--accent); background: var(--panel-3); }
.answer-row .mf { flex: 1 1 120px; inline-size: auto; }
@media (max-width: 560px) { .mf-pop { grid-template-columns: repeat(4, minmax(0, 1fr)); } .answer-row .btn.primary { padding-inline: 14px; } }

.unit { color: var(--text-2); font-weight: 650; }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.choices.stack { grid-template-columns: 1fr; }
.choice .katex { white-space: normal; font-size: 1.08em; } /* KaTeX may break between terms, so answers wrap instead of scrolling */
.choice .math { display: inline; }
.choice { overflow: visible; overflow-wrap: anywhere; }
.step.locked:empty { min-block-size: 22px; }
.choice { display: block; text-align: start; white-space: normal; min-block-size: 46px; padding: 8px 14px; line-height: 1.35; }
.choice.right { background: color-mix(in srgb, var(--ok) 25%, var(--panel-2)); border-color: var(--ok); }
.choice.wrong { background: color-mix(in srgb, var(--bad) 22%, var(--panel-2)); border-color: var(--bad); }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.dir-grid .choice { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; font-size: 12px; min-block-size: 64px; }
.dir-grid .choice svg { inline-size: 26px; block-size: 26px; }
.feedback { border-radius: 12px; padding: 10px 12px; font-size: 14.5px; background: var(--panel-2); }
.feedback.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.feedback.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.feedback .why { margin-block-start: 6px; color: var(--text-2); }
.recipe-chip { cursor: pointer; border: 0; }
@media (prefers-reduced-motion: no-preference) {
  .shake { animation: shake .35s; }
  .step.just-done { animation: pop .4s var(--spring); }
}
@keyframes shake { 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }

.float-xp { position: fixed; pointer-events: none; font-weight: 900; color: var(--gold); z-index: 50; text-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
@media (prefers-reduced-motion: no-preference) { .float-xp { animation: float-up 1s var(--ease) forwards; } }
@keyframes float-up { to { translate: 0 -60px; opacity: 0; } }

.summary { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 34px 18px; }
.summary .big { font-size: 46px; font-weight: 900; background: linear-gradient(135deg, var(--gold), #ff7a2f); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* play picker */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mode { display: grid; gap: 8px; text-align: start; cursor: pointer; transition: transform .2s var(--spring), border-color .2s; }
.mode:hover { transform: translateY(-2px); border-color: var(--line-2); }
.mode .mode-ico { inline-size: 44px; block-size: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--m1, var(--accent)), var(--m2, var(--accent-2))); }
.mode h3 { font-size: 17px; }

/* primer cards */
.primer { display: grid; grid-auto-flow: column; grid-auto-columns: min(560px, 88%); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-block-end: 10px; overscroll-behavior-x: contain; }
.primer > .card { scroll-snap-align: start; display: grid; gap: 12px; align-content: start; }
.primer .fig-art svg { inline-size: 100%; block-size: auto; }
.primer h3 { font-size: 18px; }

/* ---------- recipes ---------- */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.recipe { display: grid; gap: 10px; cursor: pointer; text-align: start; position: relative; transition: transform .2s var(--spring), border-color .2s; }
.recipe:hover { transform: translateY(-2px); border-color: var(--line-2); }
.recipe.undiscovered { filter: grayscale(1); opacity: .55; }
.recipe.undiscovered :is(.craft, .eq) { filter: blur(4px); }
.craft { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slot { min-inline-size: 44px; block-size: 44px; padding: 0 8px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: var(--panel-3); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .06); border: 1px solid var(--line-2); }
.slot.out { background: color-mix(in srgb, var(--gold) 26%, var(--panel-3)); min-inline-size: 52px; block-size: 52px; font-size: 19px; }
.craft .arrow { color: var(--text-3); font-weight: 900; }
.recipe .eq { font-size: 15px; overflow-x: auto; overflow-y: hidden; padding-block: 2px; }
.tier-label { margin-block: 18px 8px; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.inv .slot { block-size: auto; min-block-size: 64px; padding: 8px 6px; display: grid; gap: 2px; cursor: pointer; text-align: center; font-size: 17px; }
.inv .slot small { font-size: 11px; font-weight: 600; color: var(--text-2); line-height: 1.2; }
.inv .slot[aria-pressed=true] { background: color-mix(in srgb, var(--accent) 35%, var(--panel-3)); border-color: var(--accent); }

/* ---------- listen ---------- */
.episodes { display: grid; gap: 8px; }
.episode { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; text-align: start; }
.episode.playing { border-color: var(--accent); }
.episode .play-ico { inline-size: 40px; block-size: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); }
.episode.playing .play-ico { background: var(--accent); color: #fff; }
.transcript { white-space: pre-wrap; color: var(--text-2); max-block-size: 50vh; overflow: auto; }
#player-dock { position: fixed; right: 16px; bottom: 16px; z-index: 20; }
.dock { display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 14px; border-radius: 16px; background: var(--glass);
  backdrop-filter: blur(16px); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-inline-size: min(460px, calc(100vw - 32px)); }
.dock .title { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -10px; inline-size: 8px; block-size: 14px; border-radius: 2px; }
@media (prefers-reduced-motion: no-preference) { .confetti i { animation: fall var(--d, 1.6s) var(--ease) forwards; } }
@keyframes fall { to { translate: var(--x, 0) 105vh; rotate: var(--r, 540deg); } }

/* ---------- figure drawing classes (figs.js) ---------- */
.fig-art svg { color: var(--text); font-family: var(--font); }
.fig-art text { paint-order: stroke; stroke: var(--panel-2); stroke-width: 4px; stroke-linejoin: round; } /* halo: labels stay readable over lines */
.w-show .fig-art text { stroke: #1a1a26; }
.fig-art .panel { fill: var(--panel-2); stroke: none; }
.fig-art .w { stroke: currentColor; stroke-width: 2.2; fill: none; }
.fig-art .w-fill { fill: currentColor; }
.fig-art .axis { stroke: var(--text-3); stroke-width: 1.6; fill: none; }
.fig-art .faint { stroke: var(--line-2); stroke-width: 1.2; }
.fig-art .dash { stroke-dasharray: 5 5; }
.fig-art .a { stroke: var(--accent); stroke-width: 2.4; }
.fig-art .b { stroke: var(--accent-2); stroke-width: 1.8; }
.fig-art .ok { stroke: var(--ok); stroke-width: 2.4; }
.fig-art .thick { stroke-width: 3; }
.fig-art .thicker { stroke-width: 5; stroke-linecap: round; }
.fig-art .a-fill { fill: var(--accent); } .fig-art .b-fill { fill: var(--accent-2); } .fig-art .ok-fill { fill: var(--ok); } .fig-art .axis-fill { fill: var(--text-3); }
.fig-art .lbl { fill: currentColor; font-weight: 650; }
.fig-art .a-text { fill: color-mix(in srgb, var(--accent) 70%, var(--text)); }
.fig-art .b-text { fill: color-mix(in srgb, var(--accent-2) 70%, var(--text)); }
.fig-art .ok-text { fill: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.fig-art .core { fill: var(--panel-3); stroke: var(--line-2); }
.fig-art .b.faint { stroke: color-mix(in srgb, var(--accent-2) 45%, transparent); }

/* ---------- workbench (figure + scratch on one canvas) ---------- */
.bench { display: grid; gap: 8px; }
.bench-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bench-surface { position: relative; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); overflow: hidden; }
.bench-fig > .fig-art { display: block; inline-size: 100%; }
.bench-fig .fig-art svg { display: block; inline-size: 100%; block-size: auto; }
.bench-fig img.fig-art { background: #fff; }
.bench-pad { position: relative; border-top: 1px dashed var(--line-2);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1.2px); background-size: 22px 22px; }
.bench-pad-label { position: absolute; top: 6px; left: 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.bench-ink { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; pointer-events: none; }
.bench.drawing .bench-ink { pointer-events: auto; }
.bench-q { display: none; }
/* expand-right: question + steps on the left, a tall scratch column on the right */
.q-layout.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-areas: "card side" "steps side"; }
.q-layout.wide > .card { grid-area: card; }
.q-layout.wide > .stack { grid-area: steps; }
.bench-side { grid-area: side; position: sticky; top: 12px; align-self: start; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.bench.wide .bench-pad { min-block-size: calc(100dvh - 260px); }
.bench.wide .bench-fig .fig-art svg { max-block-size: 46dvh; }
@media (max-width: 980px) { .wide-btn { display: none; } .q-layout.wide { grid-template-columns: 1fr; grid-template-areas: "card" "side" "steps"; } .bench-side { position: static; } }
.pip-body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
details.found { border-radius: 12px; background: var(--panel-2); padding: 8px 10px; }
details.found > summary { cursor: pointer; list-style-position: inside; padding: 4px 2px; }
details.found[open] > summary { margin-block-end: 6px; }
details.found .topic-row { background: var(--panel); }
.refresh { margin-block-end: 14px; gap: 6px; }
.found-chip { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: color-mix(in srgb, var(--accent-2) 65%, var(--text)); }

/* ---------- lab ---------- */
.lab-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .lab-layout { grid-template-columns: 1fr; } }
.lab-view { padding: 8px; }
.lab-canvas { display: block; inline-size: 100%; }
.lab-slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.lab-slider input { grid-column: 1 / -1; inline-size: 100%; }
.lab-label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.lab-val { font-variant-numeric: tabular-nums; font-weight: 750; font-size: 13.5px; }
.lab-choice { display: grid; gap: 4px; }
.lab-choice .btn[aria-pressed=true] { background: color-mix(in srgb, var(--accent) 30%, var(--panel-2)); border-color: var(--accent); }
.lab-readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lab-read { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--rc, var(--line-2)); }
.lab-read > span:first-child { font-size: 12px; color: var(--text-3); font-weight: 650; }
.lab-read-v b { font-size: 18px; font-variant-numeric: tabular-nums; }
.lab-read-v small { color: var(--text-2); }
.lab-chs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.lab-ch { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); }
.lab-ch.done { background: color-mix(in srgb, var(--ok) 16%, var(--panel-2)); }
.lab-tick { inline-size: 22px; block-size: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); font-weight: 900; flex: none; }
.lab-ch.done .lab-tick { background: var(--ok); color: #062716; }

/* ---------- quests ---------- */
.quest-card { margin-block-start: 16px; display: grid; gap: 12px; border-left: 4px solid var(--gold); }
.quests { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.quest { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); flex-wrap: wrap; }
.quest.done { opacity: .6; }
.quest.done strong { text-decoration: line-through; }
.quest-ico { inline-size: 32px; block-size: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 22%, var(--panel-3)); flex: none; }
.quest.done .quest-ico { background: var(--ok); color: #062716; }
.backlog-chip { background: color-mix(in srgb, var(--warn) 22%, transparent); color: color-mix(in srgb, var(--warn) 65%, var(--text)); }
.quest-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.quest-cols > .card { align-content: start; }
.depth { font-weight: 800; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.masks { display: flex; gap: 4px; }
.mask { inline-size: 16px; block-size: 20px; border-radius: 50% 50% 45% 45%; background: linear-gradient(#fff, #cfd6ff); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.mask.cracked { background: var(--panel-3); box-shadow: inset 0 0 0 2px var(--line-2); }
@media (prefers-reduced-motion: no-preference) { .mask.cracked { animation: shake .4s; } }
.loot { font-size: 64px; line-height: 1; }
@media (prefers-reduced-motion: no-preference) { .loot { animation: pop .6s var(--spring); } }
@media (max-width: 560px) { .run-top { flex-wrap: wrap; } .pips { order: 9; flex-basis: 100%; } }
.tree-wrap { position: relative; overflow-x: auto; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.tree-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.tree-lines path { fill: none; stroke: var(--line-2); stroke-width: 2; }
.tree-lines path.lit { stroke: color-mix(in srgb, var(--gold) 70%, transparent); stroke-width: 2.5; }
.tree-grid { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 56px; align-items: start; }
.tree-col { display: grid; gap: 10px; align-content: start; }
.tree-node { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; text-align: start; padding: 8px 10px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
.tree-node .slot { grid-row: 1 / span 2; }
.tree-node small { color: var(--text-3); font-size: 11px; }
.tree-node.undiscovered { opacity: .55; filter: grayscale(1); }
.tree-node:hover { border-color: var(--accent); }
.transcript.chat { white-space: normal; display: grid; gap: 10px; align-content: start; position: sticky; top: 12px; }
.tlines { display: grid; gap: 6px; max-block-size: 62vh; overflow: auto; padding-inline-end: 4px; }
.tline { display: grid; grid-template-columns: 52px 1fr; gap: 8px; text-align: start; padding: 6px 10px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; line-height: 1.45; }
.tline:hover { background: var(--hover); }
.tline .who { font-weight: 800; font-size: 12.5px; padding-block-start: 1px; }
.tline.S1 .who { color: #ff8a3d; } .tline.S2 .who { color: var(--accent-2); }
.tline.now { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } .hero .btn.big { justify-self: start; } }

/* ---------- watch mode: a game-style screen + control bar; practice under it ---------- */
.w-show { --lvl: 0; position: relative; display: grid; grid-template-rows: auto auto; border-radius: 20px; overflow: hidden;
  background: #0d0d16; border: 1px solid var(--line-2); box-shadow: var(--shadow); color: #ececf3; color-scheme: dark; }
.w-show:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.w-screen { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 10px; padding: clamp(10px, 2vw, 22px); aspect-ratio: 16 / 9; min-block-size: 0; overflow: hidden; isolation: isolate; }
@media (max-width: 760px) { .w-screen { aspect-ratio: auto; min-block-size: 0; grid-template-rows: auto minmax(220px, auto) auto; } .w-show { border-radius: 16px; } .w-bottom .host:last-child { justify-self: end; } }
.w-backdrop { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 12%, #0d0d16), #0d0d16 70%); }
.w-backdrop i { display: none; }
.w-chapter { justify-self: start; max-inline-size: 70%; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-chapter .katex { font-size: 1em; }
.w-stage { display: grid; place-items: center; min-block-size: 0; overflow: hidden; }
.w-stage > * { inline-size: min(100%, 980px); max-block-size: 100%; min-block-size: 0; }
.w-fig { block-size: 100%; display: grid; place-items: center; border-radius: 16px; padding: 8px; }
.w-fig svg { display: block; inline-size: auto; block-size: 100%; max-inline-size: 100%; max-block-size: 100%; }
@media (max-width: 760px) { .w-fig { block-size: auto; } .w-fig svg { inline-size: 100%; block-size: auto; max-block-size: 260px; } }
.w-sim { overflow: hidden; }
.w-show .fig-art svg { color: #ececf3; }
.w-show .fig-art .panel { fill: rgba(255,255,255,.04); }
.w-big { display: grid; gap: .5em; justify-items: center; text-align: center; }
.w-big-main { font-size: clamp(22px, 3.8vw, 52px); font-weight: 850; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
.w-big-sub { margin: 0; font-size: clamp(14px, 1.7vw, 22px); font-weight: 600; color: #b8b8cc; text-wrap: balance; }
.w-big .katex { font-size: 1.05em; }
.w-eq { display: grid; gap: 12px; justify-items: center; text-align: center; }
.w-eq h2 { font-size: clamp(20px, 2.6vw, 32px); }
.w-eq-math { font-size: clamp(20px, 3vw, 38px); max-inline-size: 100%; overflow: hidden; }
.w-eq .muted { color: #b8b8cc; margin: 0; }
.w-sim { display: grid; gap: 10px; }
.w-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: clamp(16px, 2.1vw, 26px); counter-reset: st; }
.w-step { counter-increment: st; display: grid; grid-template-columns: 1.6em 1fr; gap: .5em; align-items: baseline; padding: .35em .6em; border-radius: 12px; opacity: .22; transition: opacity .4s, background .4s; }
.w-step::before { content: counter(st); font-weight: 900; color: var(--accent-2); }
.w-step.on { opacity: 1; }
.w-step.now { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.w-bottom { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: clamp(8px, 1.5vw, 16px); align-items: end; }
.w-caption { padding: 12px 16px; border-radius: 16px; background: rgba(10,10,18,.72); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.12); font-size: clamp(14px, 1.5vw, 20px); line-height: 1.45; min-block-size: 3.1em; }
.host { --lvl: 0; display: grid; justify-items: center; gap: 6px; inline-size: clamp(56px, 9vw, 120px); opacity: .55; transition: opacity .25s, transform .25s; }
.host-cam { inline-size: 100%; aspect-ratio: 1; border-radius: 28%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--hc), color-mix(in srgb, var(--hc) 45%, #000)); border: 3px solid color-mix(in srgb, var(--hc) 60%, transparent);
  transition: border-color .2s; }
.host-pic { inline-size: 100%; block-size: 100%; object-fit: cover; }
.host-initial { font-size: clamp(24px, 4vw, 54px); font-weight: 900; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.host-name { font-weight: 800; font-size: 13px; color: var(--hc); }
.host.talking { opacity: 1; }
.host.talking .host-cam { border-color: var(--hc); outline: 2px solid color-mix(in srgb, var(--hc) 55%, transparent); outline-offset: 3px; }
@keyframes bob { to { transform: translateY(-3px) rotate(-1.5deg); } }
.w-countdown { --p: 1; position: absolute; top: 14px; right: 14px; z-index: 3; inline-size: 92px; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 360deg), rgba(255,255,255,.1) 0); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.w-countdown::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #14141f; }
.w-count-n, .w-count-l { position: relative; }
.w-count-n { font-size: 30px; font-weight: 900; line-height: 1; }
.w-count-l { font-size: 10.5px; font-weight: 700; color: var(--gold); }
.w-banner { position: absolute; left: 50%; translate: -50% 0; top: 14px; z-index: 3; inline-size: max-content; max-inline-size: calc(100% - 24px); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 14px; background: rgba(14,14,22,.85); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.14); box-shadow: var(--shadow); }
/* control bar */
.w-controls { display: grid; gap: 6px; padding: 8px 12px 10px; background: #12121c; border-top: 1px solid rgba(255,255,255,.08); }
.w-ctrl-row { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; min-inline-size: 0; }
.w-ctrl-row > .grow { min-inline-size: 0; }
.w-show .btn.ghost { color: #ececf3; }
.w-show .btn.ghost:hover { background: rgba(255,255,255,.08); }
.w-time { font-size: 12.5px; font-variant-numeric: tabular-nums; color: #a3a3b5; margin-inline-start: 6px; white-space: nowrap; }
.w-timeline { position: relative; block-size: 22px; cursor: pointer; touch-action: none; }
.w-timeline:focus-visible { outline: 2px solid var(--focus); border-radius: 6px; }
.w-track, .w-fill { position: absolute; inset-inline-start: 0; top: 9px; block-size: 5px; border-radius: 5px; }
.w-track { inline-size: 100%; background: rgba(255,255,255,.14); }
.w-fill { inline-size: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.w-knob { position: absolute; top: 5px; inline-size: 13px; block-size: 13px; margin-inline-start: -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }
.w-tick { position: absolute; top: 7px; inline-size: 2px; block-size: 9px; margin-inline-start: -1px; background: rgba(255,255,255,.45); border-radius: 1px; pointer-events: none; }
.w-marker { position: absolute; top: -3px; inline-size: 26px; block-size: 26px; margin-inline-start: -13px; padding: 0; border-radius: 50%; border: 2px solid #12121c; background: var(--gold); color: #241500; display: grid; place-items: center; cursor: pointer; z-index: 1; }
.w-marker svg.i { width: 13px; height: 13px; stroke-width: 2.6; }
.w-marker:hover { scale: 1.15; }
.w-volume { display: flex; align-items: center; gap: 2px; }
.w-vol { --v: 1; inline-size: 90px; accent-color: var(--accent); }
.w-speed { min-inline-size: 48px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .w-vol { inline-size: 64px; } .w-time { font-size: 11.5px; } }
.w-show:fullscreen { border-radius: 0; }
.w-show:fullscreen .w-screen, .w-show.in-pip .w-screen { aspect-ratio: auto; min-block-size: 0; }
.w-show:fullscreen, .w-show.in-pip { block-size: 100dvh; grid-template-rows: 1fr auto; }
.w-popped { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 18px; border-radius: 16px; border: 1px dashed var(--line-2); color: var(--text-2); }
/* practice panel under the video */
.w-practice { margin-block-start: 16px; padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 10%, transparent); }
.w-practice-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-block-end: 12px; }
.w-practice-head h2 { font-size: 19px; }
.w-practice-head > .grow { flex: 1 1 180px; }
.w-practice-hint { flex: 1 1 100%; }
@media (min-width: 761px) { .w-practice-hint { flex: 0 1 auto; } }
.w-practice-head .eyebrow { margin: 0; }
.w-practice-badge { inline-size: 42px; block-size: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); flex: none; }
.w-practice-hint { font-size: 13px; }
.w-practice .run-top.embed-top { margin-block-end: 10px; }
@media (prefers-reduced-motion: no-preference) { .w-practice:not([hidden]) { animation: pop-in .35s var(--spring); } }
@keyframes pop-in { from { opacity: 0; translate: 0 12px; } }
.w-mini-bar, .w-mini-try { display: none; }
.w-opts { margin-block-start: 12px; gap: 18px; }
.w-opt { gap: 8px; font-size: 14px; color: var(--text-2); }
.w-keys { font-size: 12.5px; }
.section-title { margin: 22px 0 10px; font-size: 18px; }
.episode.watched { opacity: .7; }
/* mini player: a compact card in the corner (keeps playing while you browse) */
#watch-dock { position: fixed; right: 16px; bottom: 16px; z-index: 25; }
#watch-dock:empty { display: none; }
.w-mini-prog, .w-mini-cap { display: none; }
.w-show.mini { inline-size: min(380px, calc(100vw - 32px)); border-radius: 16px; grid-template-rows: auto auto auto; grid-template-columns: minmax(0, 1fr); }
.w-show { grid-template-columns: minmax(0, 1fr); }
.w-show.mini .w-mini-bar .btn.icon-btn { inline-size: 34px; min-inline-size: 34px; block-size: 34px; padding: 0; }
.w-show.mini .w-screen, .w-show.mini .w-controls { display: none; }
.w-show.mini .w-mini-prog { display: block; block-size: 3px; background: rgba(255,255,255,.12); }
.w-show.mini .w-mini-prog > span { display: block; block-size: 100%; inline-size: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.w-show.mini .w-mini-cap { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px 4px; }
.w-mini-face { inline-size: 36px; block-size: 36px; border-radius: 30%; overflow: hidden; display: grid; place-items: center; font-weight: 900; color: #fff;
  background: linear-gradient(140deg, var(--hc), color-mix(in srgb, var(--hc) 45%, #000)); }
.w-mini-face img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.w-mini-text { font-size: 13px; line-height: 1.4; color: #d6d6e2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.w-show.mini .w-mini-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px 8px 12px; }
.w-show.mini .w-mini-try:not([hidden]) { display: inline-grid; background: var(--gold); color: #241500; }
.w-show.mini .w-mini-bar .btn { flex: none; color: #ececf3; }
.w-mini-title { flex: 1; min-inline-size: 0; font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #a3a3b5; }
.w-show.mini .w-close { color: #ff8a9c; }
@media (max-width: 760px) { #watch-dock { right: 8px; left: 8px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); } .w-show.mini { inline-size: auto; } }


/* ---------- settings: look + hosts ---------- */
.cz-prev { padding: 0; font-size: 16px; }
.cz-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.cz-icons [aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.cz-swatch { inline-size: 34px; block-size: 34px; border-radius: 10px; border: 2px solid var(--line-2); cursor: pointer; }
.cz-color-row { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.cz-color { inline-size: 40px; block-size: 34px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
.host-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.host-edit { display: grid; gap: 12px; align-content: start; border-top: 4px solid var(--hc); }
.host-edit .host { inline-size: 84px; }
.host-edit audio { inline-size: 100%; block-size: 36px; }
.render-log { margin: 6px 0 0; padding: 10px; border-radius: 10px; background: var(--panel-2); font-size: 12px; max-block-size: 180px; overflow: auto; white-space: pre-wrap; }
.spin { display: inline-block; inline-size: 14px; block-size: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.bench-log { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bench-log { max-block-size: 190px; overflow: auto; }
.bench-log li:last-child { color: var(--text); font-weight: 650; }
.bench-fig-op svg { max-block-size: 220px; inline-size: 100%; }

/* ---------- home: energy picker ---------- */
.hero-energy { display: grid; gap: 14px; margin-block-end: 18px; }
.energy-head > .grow { min-inline-size: min(100%, 280px); }
.hero-energy h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 850; }
.energy-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .energy-row { grid-template-columns: 1fr; } }
.energy { display: grid; gap: 6px; align-content: start; text-align: start; cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--line); position: relative; overflow: hidden; min-block-size: 150px;
  transition: transform .2s var(--spring), box-shadow .2s, border-color .2s; }
.energy:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--ec); }
.energy strong { font-size: 20px; }
.energy .muted { font-size: 13.5px; }
.energy.low { --ec: #3ddc97; } .energy.mid { --ec: var(--gold); } .energy.high { --ec: var(--accent); }
.energy::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--ec) 22%, transparent), transparent 70%); pointer-events: none; }
.energy-ico { inline-size: 42px; block-size: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--ec, var(--accent)) 22%, transparent); color: var(--ec, var(--accent)); }
.energy-ico svg.i { width: 22px; height: 22px; }
.energy.low { order: -1; }
.energy-tip { margin: 0; font-size: 13.5px; }
/* topic page: watch → play → drill */
.learn-path { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-block: 14px; }
.path-step { display: grid; gap: 6px; align-content: start; text-align: start; position: relative; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); }
.path-step:hover { border-color: var(--accent); }
.path-step.watch { --ec: #3ddc97; border-color: color-mix(in srgb, #3ddc97 45%, transparent); }
.path-num { position: absolute; top: 12px; right: 14px; font-weight: 900; font-size: 22px; color: var(--text-3); }
.cheat { margin-block: 8px 4px; }
.cheat > summary { cursor: pointer; display: flex; gap: 4px; align-items: center; padding: 10px 2px; list-style: none; }
.cheat > summary::-webkit-details-marker { display: none; }

/* ---------- autopilot feed ---------- */
.autopilot { --ec: var(--accent); display: flex; align-items: center; gap: 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 20%, var(--panel)), var(--panel) 60%); }
.autopilot strong { display: block; font-size: 20px; }
.autopilot .muted { font-size: 13.5px; }
.autopilot:hover { border-color: var(--accent); }
.feed-head .stat { min-inline-size: 110px; }
.feed-list { display: grid; gap: 22px; padding-block-end: 40vh; }
.feed-card { scroll-margin-block-start: 12px; min-block-size: min(86dvh, 900px); display: grid; align-content: start; gap: 14px; padding: 16px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--fc); }
.feed-card.done { border-top-color: var(--ok); }
.feed-card.skipped { opacity: .7; }
.feed-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feed-kind { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--fc); text-transform: uppercase; font-size: 12.5px; letter-spacing: .06em; }
.feed-topic { font-weight: 650; min-inline-size: 0; flex: 1 1 140px; }
.feed-n { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.feed-body { min-inline-size: 0; }
.feed-body .page-head { margin-block-start: 0; }
.feed-recipe { display: grid; gap: 14px; justify-items: start; max-inline-size: 720px; }
.feed-recipe h2 { font-size: clamp(22px, 3vw, 30px); }
.feed-recipe-math { font-size: clamp(20px, 3vw, 30px); max-inline-size: 100%; overflow-x: auto; overflow-y: hidden; }
.feed-recipe-list { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.feed-watch-row { margin-block-start: 10px; }
.run-top.embed-top { background: transparent; border: 0; box-shadow: none; padding: 0; position: static; justify-content: flex-end; min-block-size: 0; }
.bench-open { justify-self: start; }
.q-kind { flex-wrap: wrap; }
.q-kind > .eyebrow { flex: 1 1 140px; }
@media (max-width: 560px) { .w-practice { padding: 10px; border-radius: 16px; } .w-practice .q-card, .feed-card .q-card { padding: 12px; } .feed-card { padding: 10px; } }
.feed-poster { inline-size: 100%; aspect-ratio: 16 / 9; display: grid; place-content: center; justify-items: center; gap: 14px; border-radius: 20px; border: 1px solid var(--line-2); cursor: pointer; color: #ececf3; font: inherit;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%), #0d0d16; }
.feed-poster-play { inline-size: 74px; block-size: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 50%, transparent); }
.feed-poster-play svg.i { width: 32px; height: 32px; }
.feed-poster-text { display: grid; gap: 4px; text-align: center; padding-inline: 16px; }
.feed-poster-text strong { font-size: clamp(18px, 2.4vw, 26px); }
.feed-poster-text span { color: #a3a3b5; font-size: 14px; }
.feed-poster:hover .feed-poster-play { scale: 1.06; }

/* diagram gallery */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 14px; }
.gal-tile { margin: 0; display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.gal-tile svg { inline-size: 100%; block-size: auto; }
.gal-tile figcaption { display: grid; gap: 2px; font-size: 13px; }

.t-num { display: inline-grid; place-items: center; min-inline-size: 1.7em; block-size: 1.7em; margin-inline-end: 8px; padding-inline: 4px; border-radius: 7px; font-size: 12px; font-weight: 800; background: var(--panel-3); color: var(--text-2); vertical-align: 1px; }
.topic-row .t { display: flex; align-items: baseline; gap: 0; min-inline-size: 0; }
.topic-row .t-num { flex: none; }
.t-title { min-inline-size: 0; }
.sm-chip { font-size: 10.5px; padding: 1px 7px; margin-inline-start: 8px; }

/* ---------- momentum, ranks, trophies ---------- */
.momentum { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.momentum.on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 12%, var(--panel-2)); }
.momentum b { font-variant-numeric: tabular-nums; }
.momentum-bar { inline-size: 42px; block-size: 5px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.momentum-bar > i { display: block; block-size: 100%; background: var(--gold); }
.momentum.big { white-space: normal; flex-wrap: wrap; font-size: 13.5px; padding: 6px 12px; }
.stat-mom { display: grid; place-items: center; }
.side-rank { display: grid; gap: 6px; color: inherit; }
.side-stats { gap: 8px; }
.rank-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.rank-card h2 { font-size: 28px; }
.rank-card > .grow { flex: 1 1 240px; min-inline-size: 0; }
.rank-card > .momentum { flex: 1 1 100%; justify-content: flex-start; }
.rank-badge { inline-size: 74px; block-size: 74px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.rank-badge svg.i { width: 38px; height: 38px; }
.rank-ladder { display: flex; gap: 6px; flex-wrap: wrap; margin-block: 14px; }
.rank-step { display: grid; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; opacity: .55; }
.rank-step.got { opacity: 1; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-block: 14px; }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.trophy { display: flex; gap: 12px; align-items: start; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); opacity: .75; }
.trophy.got { opacity: 1; border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.trophy p { margin: 2px 0 6px; font-size: 13px; }
.trophy .row { gap: 8px; flex-wrap: nowrap; }
.trophy .bar { flex: 1; }
.trophy-ico { inline-size: 40px; block-size: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--panel-3); color: var(--text-3); }
.trophy.got .trophy-ico { background: color-mix(in srgb, var(--gold) 25%, transparent); color: var(--gold); }
.trophy-toast { display: inline-flex; gap: 10px; align-items: center; }
.trophy-toast small { display: block; opacity: .8; }
.trophy-toast svg.i { color: var(--gold); }
.feed-end { place-items: center; text-align: center; min-block-size: 60dvh; border-top-color: var(--gold); }
.feed-end-inner { display: grid; gap: 12px; justify-items: center; max-inline-size: 560px; }
.feed-end-ico { inline-size: 72px; block-size: 72px; border-radius: 22px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
.feed-end-ico svg.i { width: 36px; height: 36px; }
.feed-mom { display: block; margin-block-start: 8px; }

/* the video adapts to its own width (page, feed card, pop-out) */
.w-show { container-type: inline-size; }
.w-screen { min-block-size: 380px; }
@container (max-width: 720px) {
  .w-screen { aspect-ratio: auto; min-block-size: 420px; grid-template-rows: auto minmax(200px, 1fr) auto; padding: 10px; }
  .host { inline-size: 52px; gap: 3px; }
  .host-name { font-size: 11px; }
  .host-initial { font-size: 22px; }
  .w-caption { font-size: 14px; padding: 8px 12px; }
  .w-big-main { font-size: 24px; }
  .w-steps { font-size: 16px; }
  .w-vol { inline-size: 60px; }
  .w-time { font-size: 11.5px; }
  .w-ctrl-row .btn.icon-btn { inline-size: 34px; min-inline-size: 34px; padding: 0; }
  .w-chapter { max-inline-size: calc(100% - 110px); }
}
@container (max-width: 460px) {
  .w-volume { display: none; }
  .w-bottom { grid-template-columns: auto minmax(0, 1fr) auto; }
}

/* host mood pictures (Settings → Hosts, advanced) */
.mood-pics > summary { cursor: pointer; font-size: 14px; font-weight: 650; }
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.mood-slot { display: grid; justify-items: center; gap: 4px; text-align: center; }
.mood-pic { inline-size: 64px; block-size: 64px; border-radius: 28%; overflow: hidden; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 2px dashed var(--line-2); background: var(--panel-2); color: var(--text-3); }
.mood-pic img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.mood-pic img.fallback { opacity: .35; filter: grayscale(1); }
.mood-pic:hover { border-color: var(--hc, var(--accent)); }
.mood-label { font-size: 12.5px; font-weight: 700; }
.mood-hint { font-size: 11px; }
.mood-hint, .mood-clear { block-size: 24px; display: grid; place-items: center; }
.mood-clear { min-block-size: 0; padding: 2px 8px; font-size: 11.5px; }
.host-pic { transition: opacity .15s; }

/* ---------- accounts ---------- */
#auth { min-block-size: 100dvh; }
.auth-page { min-block-size: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent), var(--bg); }
.auth-card { inline-size: min(400px, 100%); display: grid; gap: 12px; padding: 28px 24px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; }
.auth-card > .muted { margin: 0; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.auth-brand .logo { inline-size: 36px; block-size: 36px; }
.auth-form { gap: 10px; }
.auth-form .muted { margin: 0; }
.auth-err { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 14%, transparent); font-size: 14px; }
.auth-links { display: grid; gap: 4px; justify-items: start; }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent-2, var(--accent)); font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.users-list { gap: 8px; }
.user-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.user-row.attn { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.user-row > .grow { min-inline-size: 180px; display: grid; gap: 4px; }
.user-acts { gap: 6px; }
.voice-server { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.voice-server summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.voice-field > span { font-size: 13px; font-weight: 700; color: var(--text-2); }
