/* ==========================================================================
   Bioinformatics course — "Molecular lab" design system
   Palette tokens: assets/site-theme.css (shared with the interactive widgets).
   Original visual tokens + ramp classes: assets/widget-host.css.

    1 tokens        2 base & controls   3 ambient lab     4 intro
    5 floating nav  6 lecture menu      7 glyphs          8 dashboard
    9 lecture shell 10 prose            11 figures        12 generated figures
   13 recap        14 concept maps     15 posters        16 quiz
   17 slides       18 lightbox         19 motion         20 responsive · print
   ========================================================================== */

/* 1. Tokens ----------------------------------------------------------------- */
:root {
  --read-w: 720px;
  --wide-w: 1180px;
  --gutter: 32px;
  --nav-h: 60px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --ease: cubic-bezier(.22, .8, .24, 1);        /* soft decelerate */
  --ease-io: cubic-bezier(.65, 0, .25, 1);      /* in-out for travels */
  --spring: cubic-bezier(.34, 1.36, .64, 1);    /* a whisper of overshoot */
  --dur: 220ms;
  --hairline: color-mix(in srgb, var(--lumen) 16%, var(--border));
  --card-bg: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 82%, var(--surface-1)));
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 60px -28px rgba(0, 0, 0, .45);
  --glow: 0 0 0 1px color-mix(in srgb, var(--lumen) 30%, transparent), 0 0 28px -6px var(--lumen-glow);

  /* ramp shortcuts (light) for generated figures, maps and posters */
  --rp-f: var(--purple-50); --rp-s: var(--purple-600); --rp-t: var(--purple-800);
  --rt-f: var(--teal-50);   --rt-s: var(--teal-600);   --rt-t: var(--teal-800);
  --rc-f: var(--coral-50);  --rc-s: var(--coral-600);  --rc-t: var(--coral-800);
  --ra-f: var(--amber-50);  --ra-s: var(--amber-600);  --ra-t: var(--amber-800);
  --rk-f: var(--pink-50);   --rk-s: var(--pink-600);   --rk-t: var(--pink-800);
  --rg-f: var(--gray-50);   --rg-s: var(--gray-600);   --rg-t: var(--gray-800);
  --rb-f: var(--blue-50);   --rb-s: var(--blue-600);   --rb-t: var(--blue-800);
  --rn-f: var(--green-50);  --rn-s: var(--green-600);  --rn-t: var(--green-800);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 12px 34px -20px rgba(0, 0, 0, .9);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 30px 70px -30px rgba(0, 0, 0, .95);
  --rp-f: rgba(83, 74, 183, .22);  --rp-s: #AFA9EC; --rp-t: #DCD9FB;
  --rt-f: rgba(29, 158, 117, .18); --rt-s: #5DCAA5; --rt-t: #BFF0DE;
  --rc-f: rgba(216, 90, 48, .18);  --rc-s: #F0997B; --rc-t: #FAD3C4;
  --ra-f: rgba(186, 117, 23, .18); --ra-s: #EF9F27; --ra-t: #F8DDB0;
  --rk-f: rgba(212, 83, 126, .18); --rk-s: #ED93B1; --rk-t: #F8D4E1;
  --rg-f: rgba(150, 170, 195, .10); --rg-s: #9FB2C8; --rg-t: #D7E2EE;
  --rb-f: rgba(55, 138, 221, .18); --rb-s: #85B7EB; --rb-t: #CFE3F8;
  --rn-f: rgba(99, 153, 34, .18);  --rn-s: #97C459; --rn-t: #D5EDB7;
  color-scheme: dark;
}
.ramp-purple { --rf: var(--rp-f); --rs: var(--rp-s); --rtx: var(--rp-t); }
.ramp-teal   { --rf: var(--rt-f); --rs: var(--rt-s); --rtx: var(--rt-t); }
.ramp-coral  { --rf: var(--rc-f); --rs: var(--rc-s); --rtx: var(--rc-t); }
.ramp-amber  { --rf: var(--ra-f); --rs: var(--ra-s); --rtx: var(--ra-t); }
.ramp-pink   { --rf: var(--rk-f); --rs: var(--rk-s); --rtx: var(--rk-t); }
.ramp-gray   { --rf: var(--rg-f); --rs: var(--rg-s); --rtx: var(--rg-t); }
.ramp-blue   { --rf: var(--rb-f); --rs: var(--rb-s); --rtx: var(--rb-t); }
.ramp-green  { --rf: var(--rn-f); --rs: var(--rn-s); --rtx: var(--rn-t); }

/* 2. Base & controls ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0; min-height: 100vh;
  background: var(--surface-0); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 16.5px; line-height: 1.72;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
html.will-intro body { overflow: hidden; }
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.012em; color: var(--text-primary); text-wrap: balance; }
p { text-wrap: pretty; }
strong, b { font-weight: 600; }
a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img, svg { max-width: 100%; }
code, pre, kbd { font-family: var(--font-mono); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--border-accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--lumen) 30%, transparent); color: var(--text-primary); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 600; background: var(--surface-2); color: var(--text-primary); padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--border-accent); font-size: 14px; cursor: pointer; }
.skip-link:focus { top: 16px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 16px; font-size: 14px; font-weight: 500; line-height: 1;
  color: var(--text-primary); background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none !important; white-space: nowrap; isolation: isolate; overflow: hidden;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 120ms var(--ease);
}
.btn:hover { border-color: color-mix(in srgb, var(--lumen) 55%, var(--border-strong)); background: color-mix(in srgb, var(--lumen) 8%, var(--surface-2)); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  color: #03131A; border-color: transparent;
  background: linear-gradient(135deg, var(--lumen), var(--lumen-2));
  box-shadow: 0 8px 24px -10px var(--lumen-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
:root[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--lumen), var(--lumen-2)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lumen) 18%, transparent), 0 12px 30px -10px var(--lumen-glow), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%) -150% 0 / 220% 100% no-repeat; opacity: .5; }
@media (prefers-reduced-motion: no-preference) { .btn-primary:hover::after { animation: sheen 900ms var(--ease) 1; } }
@keyframes sheen { to { background-position: 150% 0; } }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: color-mix(in srgb, var(--lumen) 7%, transparent); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; flex: none;
  border-radius: var(--r-sm); border: 1px solid transparent; background: transparent;
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: color-mix(in srgb, var(--lumen) 9%, transparent); color: var(--text-primary); border-color: var(--border); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; line-height: 1; font-weight: 500; padding: 6px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface-1) 80%, transparent); color: var(--text-secondary);
  border: 1px solid var(--border); white-space: nowrap; text-decoration: none !important;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
a.chip:hover { border-color: color-mix(in srgb, var(--hue, var(--lumen)) 50%, transparent); color: var(--text-primary); }
.chip-accent { background: var(--bg-accent); color: var(--text-accent); border-color: color-mix(in srgb, var(--lumen) 25%, transparent); }
.chip-warning { background: var(--bg-warning); color: var(--text-warning); border-color: transparent; }
.chip-success { background: var(--bg-success); color: var(--text-success); border-color: transparent; }
.kbd { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary); }
.bar { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text-primary) 8%, transparent); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--lumen-2), var(--lumen)); box-shadow: 0 0 10px var(--lumen-glow); transition: width 600ms var(--ease); }
.empty { padding: 32px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--r-md); font-size: 14px; }
.note-inline { font-size: 13px; color: var(--text-muted); }

/* 3. Ambient lab ------------------------------------------------------------ */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(60% 50% at 8% -6%, color-mix(in srgb, var(--lumen) 15%, transparent), transparent 70%),
    radial-gradient(45% 45% at 104% 30%, color-mix(in srgb, var(--lumen-2) 9%, transparent), transparent 70%),
    radial-gradient(60% 50% at 70% 115%, color-mix(in srgb, #2A5BD7 11%, transparent), transparent 70%);
}
:root[data-theme="light"] .ambient::before { opacity: .55; }
.ambient::after { /* fine lab-grid texture, strongest at the top */
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text-primary) 7%, transparent) 1px, transparent 0);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 0%, #000, transparent 75%); mask-image: radial-gradient(80% 60% at 50% 0%, #000, transparent 75%);
}
#bg-net { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 900ms var(--ease); }
body.reading #bg-net { opacity: .38; }
#view { position: relative; z-index: 1; padding: calc(var(--nav-h) + 40px) var(--gutter) 120px; min-height: 100vh; }
#view:focus { outline: none; }
.read-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 90; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--lumen-2), var(--lumen)); box-shadow: 0 0 12px var(--lumen-glow); transition: transform 120ms linear; }

/* 4. Intro ------------------------------------------------------------------ */
.intro { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 40%, #0A1830 0%, #050A14 55%, #02050B 100%); overflow: hidden; }
html:not(.will-intro) .intro { display: none; }
.intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: scale(1.04); transition: opacity 1600ms var(--ease), transform 4200ms var(--ease); }
.intro.play .intro-canvas { opacity: 1; transform: scale(1); }
.intro-vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(42% 30% at 50% 50%, rgba(5, 10, 20, .82), rgba(5, 10, 20, .35) 60%, transparent 100%), radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, .7) 100%); }
.intro-center { position: relative; text-align: center; padding: 0 24px; }
.intro-word {
  margin: 0; font-family: var(--font-display); font-weight: 300; color: #EAF7FA;
  font-size: clamp(24px, 5.6vw, 82px); line-height: 1; letter-spacing: .3em; margin-right: -.3em;
  text-shadow: 0 0 28px rgba(92, 225, 230, .35), 0 0 80px rgba(52, 198, 180, .18);
  white-space: nowrap;
}
.intro-word span { display: inline-block; opacity: 0; transform: translateY(.35em) scale(1.08); filter: blur(14px); }
.intro.play .intro-word span { animation: letter-in 1100ms var(--ease) forwards; animation-delay: calc(700ms + var(--i) * 70ms); }
@keyframes letter-in { 60% { opacity: 1; filter: blur(0); } to { opacity: 1; transform: none; filter: blur(0); } }
.intro-rule { width: min(420px, 60vw); height: 1px; margin: 34px auto 22px; background: linear-gradient(90deg, transparent, #5CE1E6, transparent); transform: scaleX(0); opacity: 0; box-shadow: 0 0 14px rgba(92, 225, 230, .6); }
.intro.play .intro-rule { animation: rule-in 1200ms var(--ease-io) 1900ms forwards; }
@keyframes rule-in { to { transform: scaleX(1); opacity: 1; } }
.intro-sub { margin: 0; font-size: clamp(14px, 1.6vw, 17px); color: #9DB0C4; letter-spacing: .02em; opacity: 0; transform: translateY(8px); }
.intro.play .intro-sub { animation: fade-up 900ms var(--ease) 2350ms forwards; }
@keyframes fade-up { to { opacity: 1; transform: none; } }
.intro-skip { position: absolute; right: 24px; bottom: 24px; padding: 9px 16px; border-radius: 999px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(150, 210, 255, .2); color: #9DB0C4; font-size: 13px; cursor: pointer; opacity: 0; animation: fade-up 600ms var(--ease) 500ms forwards; transition: color var(--dur), border-color var(--dur); }
.intro-skip:hover { color: #EAF7FA; border-color: rgba(92, 225, 230, .6); }
.intro.out { pointer-events: none; transition: opacity 900ms var(--ease), filter 900ms var(--ease); opacity: 0; filter: blur(6px); }
.intro.out .intro-canvas { transform: scale(1.12); transition: transform 900ms var(--ease-io), opacity 900ms; }
.intro.out .intro-center { transform: translateY(-12px) scale(.98); transition: transform 900ms var(--ease-io); }

/* 5. Floating navigation ------------------------------------------------------ */
.topnav {
  position: fixed; top: 12px; left: 50%; z-index: 80;
  width: min(1180px, calc(100% - 24px));
  transform: translate(-50%, calc(-100% - 24px)); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 420ms var(--ease), opacity 260ms var(--ease), visibility 0s linear 420ms;
}
body.nav-shown .topnav { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; transition: transform 480ms var(--ease), opacity 220ms var(--ease), visibility 0s; }
.topnav-inner {
  display: flex; align-items: center; gap: 6px; height: var(--nav-h); padding: 0 8px;
  background: color-mix(in srgb, var(--surface-1) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--hairline); border-radius: 18px; box-shadow: var(--shadow-2);
}
.nav-lectures { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 12px; border-radius: 12px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: var(--text-primary); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: border-color var(--dur), background var(--dur); flex: none; }
.nav-lectures:hover { border-color: color-mix(in srgb, var(--lumen) 50%, transparent); background: color-mix(in srgb, var(--lumen) 10%, var(--surface-2)); }
.nav-lectures .icon { width: 16px; height: 16px; color: var(--lumen); }
.nav-current { display: flex; align-items: baseline; gap: 9px; padding: 0 10px; min-width: 0; flex: 0 1 auto; max-width: 230px; color: var(--text-primary); text-decoration: none !important; }
.nav-current .num { font-family: var(--font-display); font-size: 12px; color: var(--hue, var(--lumen)); letter-spacing: .04em; }
.nav-current .t { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-spacer { flex: 1; }
.tabs { position: relative; display: flex; flex: 1; min-width: 0; height: 42px; overflow-x: auto; scrollbar-width: none; justify-content: flex-end; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; height: 42px; border-radius: 11px; font-size: 13.5px; color: var(--text-secondary); white-space: nowrap; text-decoration: none !important; transition: color var(--dur) var(--ease); flex: none; }
.tab .icon { width: 15px; height: 15px; opacity: .8; }
.tab:hover { color: var(--text-primary); }
.tab[aria-current="page"] { color: var(--text-primary); }
.tab[aria-current="page"] .icon { color: var(--hue, var(--lumen)); opacity: 1; }
.tab-ink { position: absolute; left: 0; top: 0; height: 42px; width: 0; border-radius: 11px; z-index: 0; pointer-events: none;
  background: color-mix(in srgb, var(--hue, var(--lumen)) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue, var(--lumen)) 32%, transparent), 0 0 22px -8px var(--hue, var(--lumen));
  opacity: 0; transition: transform 480ms var(--ease), width 480ms var(--ease), opacity 200ms; }
.tab-ink.ready { opacity: 1; }
.tab-ink::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: var(--hue, var(--lumen)); box-shadow: 0 0 10px var(--hue, var(--lumen)); }
.nav-handle { position: fixed; top: 0; left: 50%; z-index: 70; transform: translateX(-50%); width: 120px; height: 18px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: start center; transition: opacity 300ms var(--ease); }
.nav-handle span { display: block; width: 64px; height: 3px; margin-top: 5px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--lumen), transparent); box-shadow: 0 0 12px var(--lumen-glow); opacity: .55; transition: width 300ms var(--ease), opacity 300ms; }
.nav-handle:hover span { width: 96px; opacity: 1; }
body.nav-shown .nav-handle, body.menu-open .nav-handle, html.will-intro .nav-handle { opacity: 0; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .nav-handle { pointer-events: none; } }
@media (hover: none) { .nav-handle { height: 30px; width: 140px; } .nav-handle span { margin-top: 8px; width: 72px; opacity: .8; } }

.lectures-fab {
  position: fixed; left: 20px; bottom: 20px; z-index: 70;
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 7px 0 16px;
  border-radius: 999px; border: 1px solid var(--hairline); cursor: pointer; color: var(--text-primary);
  background: color-mix(in srgb, var(--surface-1) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-2); font-size: 13.5px; font-weight: 500;
  transition: transform 300ms var(--ease), border-color var(--dur), box-shadow var(--dur), opacity 300ms, bottom 300ms var(--ease);
}
.lectures-fab .icon { width: 17px; height: 17px; color: var(--lumen); }
.lectures-fab:hover { border-color: color-mix(in srgb, var(--lumen) 55%, transparent); box-shadow: var(--shadow-2), var(--glow); transform: translateY(-2px); }
.fab-cur { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; font-family: var(--font-display); font-size: 12px; color: var(--hue); background: color-mix(in srgb, var(--hue) 14%, transparent); border: 1px solid color-mix(in srgb, var(--hue) 35%, transparent); }
.lectures-fab:not(:has(.fab-cur)) { padding-right: 18px; }
body.menu-open .lectures-fab, html.will-intro .lectures-fab { opacity: 0; pointer-events: none; transform: translateY(12px); }
body.has-quiz-bar .lectures-fab { bottom: 96px; }
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 70; width: 46px; height: 46px; border-radius: 50%; background: color-mix(in srgb, var(--surface-1) 82%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--hairline); color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-2); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity var(--dur) var(--ease), transform 300ms var(--ease), color var(--dur), bottom 300ms var(--ease); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--lumen); }
body.has-quiz-bar .to-top { bottom: 96px; }

/* 6. Lecture menu ------------------------------------------------------------ */
.lmenu { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 28px; }
.lmenu[hidden] { display: none; }
.lmenu-backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface-0) 74%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); opacity: 0; transition: opacity 420ms var(--ease); }
.lmenu.open .lmenu-backdrop { opacity: 1; }
.lmenu-panel { position: relative; width: min(1160px, 100%); max-height: calc(100vh - 56px); overflow: auto; overscroll-behavior: contain; padding: 30px 30px 22px; border-radius: 26px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-1) 94%, transparent), color-mix(in srgb, var(--surface-0) 96%, transparent));
  border: 1px solid var(--hairline); box-shadow: var(--shadow-2), 0 0 120px -40px var(--lumen-glow);
  opacity: 0; transform: translateY(18px) scale(.985); transition: opacity 420ms var(--ease), transform 520ms var(--ease); scrollbar-width: thin; }
.lmenu.open .lmenu-panel { opacity: 1; transform: none; }
.lmenu.closing .lmenu-panel { opacity: 0; transform: translateY(-10px) scale(.98); transition: opacity 360ms var(--ease) 60ms, transform 420ms var(--ease-io); }
.lmenu.first .lmenu-panel { transition-duration: 700ms, 800ms; }
.lmenu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.lmenu-head h2 { font-family: var(--font-display); font-weight: 300; font-size: clamp(22px, 2.6vw, 30px); margin: 0 0 6px; letter-spacing: -0.01em; }
.lmenu-head p { margin: 0; color: var(--text-secondary); font-size: 14.5px; }
.lmenu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lmenu-foot { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.lmenu-hint { flex: 1; font-size: 12.5px; color: var(--text-muted); min-width: 200px; }

.lcard {
  --rx: 0deg; --ry: 0deg;
  position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 250px;
  padding: 18px 20px; border-radius: 18px; overflow: hidden; isolation: isolate;
  color: var(--text-primary); text-decoration: none !important;
  background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-1);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 500ms var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity 300ms var(--ease);
}
.lcard::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(90% 60% at 80% 0%, color-mix(in srgb, var(--hue) 18%, transparent), transparent 70%); opacity: .7; }
.lcard::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--hue) 16%, transparent), transparent 70%); transition: opacity 300ms var(--ease); }
.lcard:hover { border-color: color-mix(in srgb, var(--hue) 45%, transparent); box-shadow: var(--shadow-2), 0 0 40px -14px var(--hue); transition: transform 140ms linear, border-color var(--dur), box-shadow var(--dur); }
.lcard:hover::after, .lcard:focus-visible::after { opacity: 1; }
.lcard:focus-visible { outline: 2px solid var(--hue); outline-offset: 3px; }
.lcard.is-current { border-color: color-mix(in srgb, var(--hue) 60%, transparent); box-shadow: var(--shadow-2), 0 0 0 1px color-mix(in srgb, var(--hue) 40%, transparent), 0 0 46px -16px var(--hue); }
.lcard-art { position: absolute; right: -6px; top: 6px; width: 54%; color: var(--hue); opacity: .9; pointer-events: none; }
.lcard-num { font-family: var(--font-display); font-weight: 200; font-size: 54px; line-height: 1; letter-spacing: -0.02em; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--hue) 75%, transparent); margin-bottom: 30px; }
.lcard-here { position: absolute; left: 20px; top: 84px; font-size: 11.5px; font-weight: 500; color: var(--hue); display: inline-flex; align-items: center; gap: 6px; }
.lcard-here::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 8px var(--hue); }
.lcard h3 { font-size: 16px; line-height: 1.35; margin: 0; font-weight: 600; }
.lcard p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard-foot { margin-top: auto; padding-top: 10px; }
.lcard-prog { display: grid; gap: 7px; }
.lcard-prog .bar span, .tile-progress .bar span { background: var(--hue); box-shadow: 0 0 10px var(--hue); }
.lcard-meta { font-size: 12px; color: var(--text-muted); }
.lcard.soon { opacity: .55; }
@media (prefers-reduced-motion: no-preference) {
  .lmenu.open .lcard { animation: card-in 640ms var(--ease) both; animation-delay: calc(120ms + var(--i) * 55ms); }
  .lmenu.first.open .lcard { animation-duration: 820ms; animation-delay: calc(260ms + var(--i) * 80ms); }
}
@keyframes card-in { from { opacity: 0; transform: perspective(900px) translateY(26px) rotateX(10deg) scale(.97); } }
.lmenu.closing .lcard { animation: none; }
.lmenu.closing .lcard:not(.chosen) { opacity: 0; transform: perspective(900px) translateY(10px) scale(.97); }
.lmenu.closing .lcard.chosen { transform: perspective(900px) scale(1.03); border-color: var(--hue); box-shadow: 0 0 60px -10px var(--hue); }

/* 7. Glyphs (lecture identities) ------------------------------------------- */
.glyph { width: 100%; height: auto; overflow: visible; display: block; }
.glyph .g-line { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.glyph .g-faint { opacity: .32; }
.glyph .g-fill { fill: currentColor; }
.glyph .g-strand { stroke-width: 1.8; filter: drop-shadow(0 0 3px currentColor); }
.glyph .g-strand2 { opacity: .55; }
.glyph .g-rung { stroke: currentColor; stroke-width: 1.2; opacity: .35; }
.glyph .g-node-big { fill: color-mix(in srgb, currentColor 22%, transparent); stroke: currentColor; stroke-width: 1.4; }
.glyph .g-diag { filter: drop-shadow(0 0 3px currentColor); }
.glyph .g-cell { fill: color-mix(in srgb, currentColor 7%, transparent); stroke: color-mix(in srgb, currentColor 30%, transparent); stroke-width: .8; }
.glyph .g-cell-on { fill: color-mix(in srgb, currentColor 55%, transparent); stroke: currentColor; stroke-width: 1; filter: drop-shadow(0 0 3px currentColor); }
.glyph .g-area { fill: color-mix(in srgb, currentColor 16%, transparent); }
.glyph .g-mark { stroke: var(--text-primary); fill: var(--text-primary); opacity: .85; }
@media (prefers-reduced-motion: no-preference) {
  .lcard:hover .g-rung, .tile:hover .g-rung { animation: rung-pulse 1.4s var(--ease) infinite; animation-delay: calc(var(--d) * 9ms); }
  @keyframes rung-pulse { 50% { opacity: .95; } }
  .lcard:hover .g-pulse, .tile:hover .g-pulse { animation: node-pulse 1.6s var(--ease) infinite; animation-delay: calc(var(--d) * 110ms); transform-box: fill-box; transform-origin: center; }
  @keyframes node-pulse { 50% { transform: scale(1.35); } }
  .lcard:hover .g-diag, .tile:hover .g-diag { animation: dot-blink 1.5s var(--ease) infinite; animation-delay: calc(var(--d) * 70ms); }
  @keyframes dot-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
  .lcard:hover .g-cell-on, .tile:hover .g-cell-on { animation: trace 1.8s var(--ease) infinite; animation-delay: calc(var(--d) * 140ms); }
  @keyframes trace { 0%, 100% { opacity: .35; } 30% { opacity: 1; } }
  .lcard:hover .g-spin, .tile:hover .g-spin { animation: spin 6s linear infinite; transform-box: view-box; transform-origin: 80px 50px; }
  .lcard:hover .g-draw, .tile:hover .g-draw { stroke-dasharray: 300; animation: draw 1.6s var(--ease) infinite; }
  @keyframes draw { from { stroke-dashoffset: 300; } to { stroke-dashoffset: 0; } }
  .lcard:hover .g-strand, .tile:hover .g-strand { stroke-dasharray: 6 4; animation: flow 1.2s linear infinite; }
  @keyframes flow { to { stroke-dashoffset: -20; } }
}

/* 8. Dashboard -------------------------------------------------------------- */
.dash { max-width: var(--wide-w); margin: 0 auto; display: grid; gap: 64px; }
.hero { position: relative; min-height: min(560px, 72vh); display: grid; align-items: end; padding: 40px 0 8px; isolation: isolate; }
.hero-helix { position: absolute; top: -40px; left: calc(var(--gutter) * -1); width: calc(100% + var(--gutter) * 2); height: calc(100% + 60px); z-index: -1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 36%, #000 62%, #000 88%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0%, transparent 36%, #000 62%, #000 88%, transparent 100%); }
.hero-copy { max-width: 640px; position: relative; }
.hero-copy::before { content: ""; position: absolute; inset: -40px 0 -40px -80px; z-index: -1; background: radial-gradient(70% 70% at 30% 55%, color-mix(in srgb, var(--surface-0) 92%, transparent), transparent 75%); }
.hero-course { margin: 0 0 18px; font-size: 13.5px; color: var(--text-accent); display: inline-flex; align-items: center; gap: 10px; }
.hero-course::before { content: ""; width: 28px; height: 1px; background: var(--lumen); box-shadow: 0 0 8px var(--lumen); }
.hero h1 { font-family: var(--font-display); font-weight: 300; font-size: clamp(36px, 5.2vw, 64px); line-height: 1.04; letter-spacing: -0.03em; margin: 0 0 14px; }
.hero .subtitle { font-size: clamp(17px, 1.7vw, 20px); color: var(--text-primary); margin: 0 0 18px; opacity: .92; }
.hero .lede { margin: 0 0 30px; color: var(--text-secondary); max-width: 56ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }
.resume { display: grid; gap: 1px; padding: 8px 18px 9px; border-radius: 12px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 70%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--text-primary); text-decoration: none !important; transition: border-color var(--dur), box-shadow var(--dur); }
.resume:hover { border-color: color-mix(in srgb, var(--hue) 55%, transparent); box-shadow: 0 0 30px -14px var(--hue); }
.resume-k { font-size: 11.5px; color: var(--text-muted); }
.resume-t { font-size: 14px; font-weight: 600; }
.resume-t::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 8px var(--hue); vertical-align: 1px; }
.resume-w { font-size: 12.5px; color: var(--text-secondary); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--border); }
.stat { padding: 20px 4px 18px 0; }
.stat .n { font-family: var(--font-display); font-weight: 300; font-size: 34px; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, var(--text-primary), color-mix(in srgb, var(--lumen) 70%, var(--text-primary))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--font-display); font-weight: 300; font-size: 24px; margin: 0; letter-spacing: -0.015em; }
.section-head p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

.featured { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); border-radius: var(--r-lg); overflow: hidden; background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-2); isolation: isolate; }
.featured::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 80% at 0% 0%, color-mix(in srgb, var(--hue) 13%, transparent), transparent 70%); }
.featured-text { padding: 34px 36px; display: flex; flex-direction: column; gap: 16px; }
.featured-k { margin: 0; font-size: 13px; color: var(--hue); }
.featured-text h2 { font-family: var(--font-display); font-weight: 300; font-size: 26px; line-height: 1.22; margin: 0; letter-spacing: -0.02em; }
.featured-text > p { margin: 0; color: var(--text-secondary); }
.featured-topics { display: flex; flex-wrap: wrap; gap: 7px; }
.featured-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 8px; }
.featured-visual { margin: 0; padding: 22px; display: flex; flex-direction: column; justify-content: center; gap: 10px; border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-0) 55%, transparent); }
.featured-visual figcaption { font-size: 12.5px; color: var(--text-muted); }
.specimen { position: relative; border-radius: var(--r-md); cursor: zoom-in; }
.specimen svg { display: block; width: 100%; height: auto; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 280px; padding: 22px 22px 18px;
  border-radius: 18px; overflow: hidden; isolation: isolate; color: var(--text-primary); text-decoration: none !important;
  background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-1);
  transition: border-color var(--dur) var(--ease), box-shadow 300ms var(--ease), transform 400ms var(--ease);
}
.tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--hue), transparent); opacity: .65; }
.tile::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; pointer-events: none; background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--hue) 13%, transparent), transparent 70%); transition: opacity 300ms var(--ease); }
.tile:hover { border-color: color-mix(in srgb, var(--hue) 40%, transparent); box-shadow: var(--shadow-2), 0 0 36px -16px var(--hue); transform: translateY(-3px); }
.tile:hover::after { opacity: 1; }
.tile-art { position: absolute; right: -10px; top: 10px; width: 46%; color: var(--hue); opacity: .55; transition: opacity 300ms var(--ease), transform 600ms var(--ease); pointer-events: none; }
.tile:hover .tile-art { opacity: .95; transform: translateX(-4px); }
.tile-num { font-family: var(--font-display); font-weight: 200; font-size: 44px; line-height: 1; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--hue) 70%, transparent); margin-bottom: 18px; }
.tile h3 { font-size: 16.5px; line-height: 1.35; margin: 0; font-weight: 600; max-width: 92%; }
.tile p { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-muted); margin-top: auto; padding-top: 6px; }
.tile-progress { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.tile-progress .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.tile.soon { opacity: .55; }

.journey { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; position: relative; counter-reset: step; }
.journey::before { content: ""; position: absolute; left: 22px; right: 22px; top: 21px; height: 1px; background: linear-gradient(90deg, var(--lumen), var(--lumen-2), color-mix(in srgb, var(--lumen) 20%, transparent)); opacity: .55; }
.step { position: relative; padding: 0 18px 0 0; counter-increment: step; }
.step-dot { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-1); border: 1px solid color-mix(in srgb, var(--lumen) 40%, var(--border)); color: var(--lumen); margin-bottom: 16px; box-shadow: 0 0 22px -8px var(--lumen-glow); }
.step-dot .icon { width: 18px; height: 18px; }
.step h3 { font-size: 15px; margin: 0 0 6px; }
.step h3::before { content: counter(step) ". "; color: var(--text-muted); font-weight: 400; }
.step p { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }
.dash-note { margin: 0 !important; }

/* 9. Lecture shell -------------------------------------------------------- */
.lecture { max-width: var(--wide-w); margin: 0 auto; }
.lec-head { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 28px; align-items: end; margin: 0 0 48px; padding: 8px 0 30px; border-bottom: 1px solid var(--border); isolation: isolate; }
.lec-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 180px; height: 1px; background: linear-gradient(90deg, var(--hue), transparent); box-shadow: 0 0 10px var(--hue); }
.lec-art { position: absolute; right: 0; top: 50%; width: min(360px, 34%); transform: translateY(-55%); color: var(--hue); opacity: .42; z-index: -1; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%); mask-image: linear-gradient(90deg, transparent, #000 40%); }
.lec-numeral { font-family: var(--font-display); font-weight: 200; font-size: clamp(72px, 9vw, 128px); line-height: .82; letter-spacing: -0.04em; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--hue) 80%, transparent); text-shadow: 0 0 40px color-mix(in srgb, var(--hue) 20%, transparent); user-select: none; }
.lec-titles { min-width: 0; max-width: 820px; }
.lec-crumb { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.lec-sec { display: inline-flex; align-items: center; gap: 10px; color: var(--hue); font-weight: 500; }
.lec-sec::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.lec-head h1 { font-family: var(--font-display); font-weight: 300; font-size: clamp(24px, 2.7vw, 34px); line-height: 1.2; letter-spacing: -0.022em; margin: 0; }
.lec-head .lede { margin: 14px 0 0; color: var(--text-secondary); max-width: 66ch; font-size: 15.5px; }
.pane { max-width: var(--wide-w); margin: 0 auto; }
.pane-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 24px; }
.pane-head h2 { font-family: var(--font-display); font-weight: 300; font-size: 24px; margin: 0; letter-spacing: -0.015em; }
.pane-head p { margin: 6px 0 0; color: var(--text-secondary); font-size: 14.5px; max-width: 70ch; }
.pager { max-width: var(--wide-w); margin: 88px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card-bg); color: var(--text-primary); text-decoration: none !important; overflow: hidden; transition: border-color var(--dur), box-shadow var(--dur); }
.pager a:hover { border-color: color-mix(in srgb, var(--hue) 50%, transparent); box-shadow: 0 0 30px -14px var(--hue); }
.pager a small { font-size: 12.5px; color: var(--text-muted); }
.pager a span { font-weight: 500; font-size: 15px; }
.pager a span b { font-family: var(--font-display); font-weight: 300; color: var(--hue); margin-right: 6px; }
.pager a.next { text-align: right; grid-column: 2; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }
.ov-side { display: grid; gap: 14px; position: sticky; top: 28px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-1); }
.card h3 { font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--text-secondary); }
.card p { margin: 0 0 10px; font-size: 14px; color: var(--text-secondary); }
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.card-list a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 0 -10px; border-radius: 9px; color: var(--text-primary); font-size: 14px; text-decoration: none !important; line-height: 1.4; transition: background var(--dur), color var(--dur); }
.card-list a .icon { width: 16px; height: 16px; color: var(--hue, var(--lumen)); }
.card-list a:hover { background: color-mix(in srgb, var(--hue, var(--lumen)) 9%, transparent); }
.card-list .k { font-size: 12px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.prose .topics { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; border-top: 1px solid var(--border); }
.prose .topics .topic { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px 14px; padding: 16px 4px; margin: 0; border-bottom: 1px solid var(--border); transition: background var(--dur); }
.prose .topics .topic:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--hue) 6%, transparent), transparent); }
.topic .idx { grid-row: span 2; font-family: var(--font-display); font-weight: 300; font-size: 22px; line-height: 1.1; color: var(--hue); font-variant-numeric: tabular-nums; }
.topic a.t { font-weight: 600; color: var(--text-primary); font-size: 15.5px; line-height: 1.4; }
.topic .subs { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.topic .subs a { color: var(--text-secondary); }
.topic .subs a:hover { color: var(--text-accent); }
.topic .subs .sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); margin: 0 9px; vertical-align: 3px; opacity: .6; }
.prose .takeaways ol { list-style: none; counter-reset: tk; padding: 0; margin: 0; display: grid; gap: 10px; }
.prose .takeaways ol > li { counter-increment: tk; position: relative; margin: 0; padding: 14px 16px 14px 56px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 15px; line-height: 1.6; }
.prose .takeaways ol > li::before { content: counter(tk); position: absolute; left: 16px; top: 13px; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--hue) 14%, transparent); border: 1px solid color-mix(in srgb, var(--hue) 35%, transparent); color: var(--hue); font-size: 12.5px; font-weight: 600; display: grid; place-items: center; }

.learn-grid { display: grid; grid-template-columns: minmax(0, var(--read-w)) 230px; gap: 72px; justify-content: center; max-width: var(--wide-w); margin: 0 auto; }
.toc { position: sticky; top: 28px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; scrollbar-width: thin; font-size: 13px; padding-right: 4px; }
.toc p { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; font-weight: 600; }
.toc ul, .toc-pop ul { list-style: none; margin: 0; padding: 0; }
.toc ul { border-left: 1px solid var(--border); }
.toc a { position: relative; display: block; padding: 5px 0 5px 14px; margin-left: -1px; color: var(--text-secondary); line-height: 1.4; text-decoration: none !important; transition: color var(--dur) var(--ease); }
.toc a::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--hue, var(--lumen)); opacity: 0; transform: scaleY(.3); transition: opacity 260ms var(--ease), transform 360ms var(--ease); box-shadow: 0 0 8px var(--hue, var(--lumen)); }
.toc a.l3 { padding-left: 26px; font-size: 12.5px; color: var(--text-muted); }
.toc a:hover { color: var(--text-primary); }
.toc a.on { color: var(--text-primary); }
.toc a.on::before { opacity: 1; transform: none; }
.toc-pop { display: none; margin: 0 0 28px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card-bg); }
.toc-pop summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 14px; font-size: 14px; font-weight: 500; }
.toc-pop summary::-webkit-details-marker { display: none; }
.toc-pop summary .icon:last-child { margin-left: auto; transition: transform var(--dur); }
.toc-pop[open] summary .icon:last-child { transform: rotate(180deg); }
.toc-pop ul { max-height: 50vh; overflow: auto; padding: 4px 8px 10px; border-top: 1px solid var(--border); }
.toc-pop a { display: block; padding: 6px 8px; border-radius: 7px; color: var(--text-secondary); font-size: 14px; text-decoration: none !important; }
.toc-pop a.l3 { padding-left: 22px; font-size: 13px; color: var(--text-muted); }
.toc-pop a:hover { background: color-mix(in srgb, var(--lumen) 8%, transparent); color: var(--text-primary); }

/* 10. Prose ---------------------------------------------------------------- */
.prose { min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-family: var(--font-display); font-weight: 300; font-size: 23px; line-height: 1.3; letter-spacing: -0.015em; margin: 3.4rem 0 1.1rem; scroll-margin-top: 28px; }
.prose h2::before { content: ""; display: block; width: 32px; height: 2px; margin-bottom: 14px; border-radius: 2px; background: var(--hue, var(--lumen)); box-shadow: 0 0 10px var(--hue, var(--lumen)); opacity: .9; }
.prose h3 { font-size: 17.5px; font-weight: 600; line-height: 1.45; margin: 2.2rem 0 .55rem; scroll-margin-top: 28px; letter-spacing: -0.005em; }
.prose h4 { font-size: 15.5px; font-weight: 600; margin: 1.5rem 0 .4rem; }
.prose p { margin: 0 0 1.05rem; }
.prose ul, .prose ol { margin: 0 0 1.05rem; padding-left: 1.45em; }
.prose li { margin: .32rem 0; }
.prose li > ul, .prose li > ol { margin: .3rem 0; }
.prose li::marker { color: color-mix(in srgb, var(--hue, var(--lumen)) 70%, var(--text-muted)); }
.prose strong { font-weight: 600; }
:root[data-theme="dark"] .prose strong { color: #F4FAFF; }
.prose em { font-style: italic; }
.prose hr { border: 0; height: 1px; margin: 3rem 0; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.prose code { font-size: .86em; background: color-mix(in srgb, var(--lumen) 7%, var(--surface-1)); color: color-mix(in srgb, var(--text-accent) 60%, var(--text-primary)); padding: .12em .42em; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }
.code-block { margin: 0 0 1.2rem; background: color-mix(in srgb, var(--surface-0) 70%, var(--surface-1)); border-radius: var(--r-sm); border: 1px solid var(--border); overflow-x: auto; position: relative; }
.code-block::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: linear-gradient(var(--lumen), var(--lumen-2)); opacity: .55; }
.code-block pre { margin: 0; padding: 14px 18px; font-size: 14px; line-height: 1.5; white-space: pre; tab-size: 4; color: var(--text-primary); }
.code-block code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre; color: inherit; }
.table-wrap { margin: 0 0 1.35rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card-bg); box-shadow: var(--shadow-1); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.table-wrap th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); background: color-mix(in srgb, var(--lumen) 5%, var(--surface-1)); padding: 10px 14px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.table-wrap td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.table-wrap tr:first-child td { border-top: 0; }
.table-wrap tbody tr { transition: background var(--dur); }
.table-wrap tbody tr:hover { background: color-mix(in srgb, var(--lumen) 4%, transparent); }
.table-wrap td:first-child { font-weight: 500; }
.table-wrap td code { white-space: nowrap; }
.callout { margin: 1.4rem 0; padding: 14px 18px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--lumen) 5%, var(--surface-1)); border: 1px solid var(--hairline); font-size: 15px; }
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 .6rem; }
.callout ul { margin: .3rem 0 0; }
.callout-note { background: linear-gradient(90deg, var(--bg-warning), color-mix(in srgb, var(--bg-warning) 35%, transparent)); border: 1px solid color-mix(in srgb, var(--border-warning) 30%, transparent); border-left: 3px solid var(--border-warning); border-radius: 4px var(--r-sm) var(--r-sm) 4px; }
.callout-note strong:first-child { color: var(--text-warning); }
.math-display { margin: 1.2rem 0 1.4rem; overflow-x: auto; overflow-y: hidden; padding: 14px 8px; text-align: center; border-radius: var(--r-sm); background: radial-gradient(60% 100% at 50% 50%, color-mix(in srgb, var(--lumen) 6%, transparent), transparent 75%); }
.math-display > code { display: inline-block; font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; text-align: left; }
.math-display .katex { font-size: 1.14em; }
.missing { color: var(--text-danger); }

/* 11. Figures --------------------------------------------------------------- */
.asset { margin: 1.8rem 0 2rem; }
.frame { position: relative; background-color: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 22px; box-shadow: var(--shadow-1); overflow: hidden; }
.frame::before, .frame::after { /* specimen registration marks */
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; opacity: .55;
  border-color: color-mix(in srgb, var(--hue, var(--lumen)) 70%, transparent); border-style: solid; border-width: 0;
}
.frame::before { left: 8px; top: 8px; border-left-width: 1px; border-top-width: 1px; border-top-left-radius: 4px; }
.frame::after { right: 8px; bottom: 8px; border-right-width: 1px; border-bottom-width: 1px; border-bottom-right-radius: 4px; }
.frame svg { display: block; width: 100%; height: auto; }
.frame.clickable { cursor: zoom-in; transition: border-color var(--dur), box-shadow 300ms var(--ease); }
.frame.clickable:hover { border-color: color-mix(in srgb, var(--lumen) 40%, transparent); box-shadow: var(--shadow-2), 0 0 40px -18px var(--lumen); }
.frame .zoom { position: absolute; top: 12px; right: 12px; opacity: 0; background: var(--surface-1); border-color: var(--border); transition: opacity var(--dur); z-index: 2; }
.frame:hover .zoom, .frame:focus-visible .zoom { opacity: 1; }
.frame-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -6px 0 10px; }
.frame-label { font-size: 12.5px; color: var(--text-accent); font-weight: 600; display: inline-flex; align-items: center; gap: 9px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lumen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lumen) 20%, transparent), 0 0 10px var(--lumen); }
.frame-tools { display: flex; gap: 4px; }
.asset figcaption, .gen-caption { margin-top: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.asset figcaption .id { color: var(--hue, var(--text-accent)); font-weight: 600; font-size: 12px; }
.iframe-frame { padding: 16px 16px 10px; }
.iframe-shell { position: relative; border-radius: var(--r-sm); overflow: hidden; }
.iframe-shell iframe { display: block; width: 100%; border: 0; min-height: 320px; background: var(--surface-2); transition: opacity 400ms var(--ease); }
.iframe-shell.is-loading iframe { opacity: 0; }
.iframe-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: none; opacity: 0; transition: opacity 300ms; }
.iframe-shell.is-loading .iframe-loader { opacity: 1; }
.iframe-loader span { width: 8px; height: 8px; border-radius: 50%; background: var(--lumen); box-shadow: 0 0 10px var(--lumen); animation: load-dot 1s var(--ease) infinite; }
.iframe-loader span:nth-child(2) { animation-delay: .15s; } .iframe-loader span:nth-child(3) { animation-delay: .3s; }
@keyframes load-dot { 0%, 100% { transform: translateY(0); opacity: .35; } 50% { transform: translateY(-8px); opacity: 1; } }
.gen-figure { margin: 0; }
.gen-figure svg { display: block; width: 100%; height: auto; max-width: 460px; margin: 0 auto; }
.fig-caption { font-size: 13px; color: var(--text-secondary); margin: 10px 0 0; line-height: 1.5; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.vcard { position: relative; display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); isolation: isolate; transition: border-color var(--dur), box-shadow 300ms var(--ease); }
.vcard::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--hue, var(--lumen)) 10%, transparent), transparent 70%); transition: opacity 300ms; }
.vcard:hover { border-color: color-mix(in srgb, var(--hue, var(--lumen)) 35%, transparent); box-shadow: var(--shadow-2); }
.vcard:hover::after { opacity: 1; }
.vcard-media { background: color-mix(in srgb, var(--surface-0) 50%, var(--surface-2)); border-bottom: 1px solid var(--border); border-radius: 0; padding: 18px; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; }
.vcard-media svg { width: 100%; height: 100%; transition: transform 700ms var(--ease); }
.vcard-media img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; transition: transform 700ms var(--ease); }
.vcard:hover .vcard-media svg, .vcard:hover .vcard-media img { transform: scale(1.025); }
.vcard-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.vcard-body h3 { font-size: 16.5px; margin: 0; line-height: 1.4; font-weight: 600; }
.vcard-body p { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; }
.vcard-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.vcard-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.theme-img-dark { display: none; }
:root[data-theme="dark"] .theme-img-light { display: none; }
:root[data-theme="dark"] .theme-img-dark { display: block; }

.terms-tools { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 440px; min-width: 220px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.search input { width: 100%; height: 44px; padding: 0 14px 0 40px; font: inherit; font-size: 14.5px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; transition: border-color var(--dur), box-shadow var(--dur); }
.search input:focus { outline: none; border-color: var(--border-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lumen) 16%, transparent); }
.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.term { position: relative; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 15px 18px 15px 20px; transition: border-color var(--dur); overflow: hidden; }
.term::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; border-radius: 2px; background: var(--hue, var(--lumen)); opacity: .55; }
.term:hover { border-color: color-mix(in srgb, var(--hue, var(--lumen)) 35%, transparent); }
.term dt { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.term dd { margin: 0; font-size: 14.5px; color: var(--text-secondary); line-height: 1.6; }
.terms-count { font-size: 13px; color: var(--text-muted); }

/* 12. Generated figures -------------------------------------------------- */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; margin: .5rem 0 1rem; }
.flow-node { display: flex; flex-direction: column; justify-content: center; padding: 9px 13px; border-radius: var(--r-sm); background: var(--rf, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--rs, var(--border-strong)) 60%, transparent); min-width: 76px; text-align: center; line-height: 1.3; box-shadow: 0 0 18px -10px var(--rs, transparent); }
.flow-node strong { font-size: 14px; font-weight: 600; color: var(--rtx, var(--text-primary)); }
.flow-node span { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.flow-edge { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 6px; min-width: 70px; flex: 1 1 70px; max-width: 150px; }
.flow-edge span { font-size: 11.5px; color: var(--text-secondary); text-align: center; line-height: 1.3; margin-bottom: 5px; }
.flow-edge::after { content: ""; display: block; width: 100%; height: 8px; transform-origin: 0 50%; background:
  linear-gradient(var(--rs, var(--text-muted)), var(--rs, var(--text-muted))) left center / calc(100% - 6px) 1px no-repeat,
  conic-gradient(from 45deg at 100% 50%, var(--rs, var(--text-muted)) 0 90deg, transparent 0) right center / 7px 8px no-repeat; }
.codon-compare { display: grid; gap: 8px; margin: .75rem 0 0; }
.codon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.codon-label { width: 70px; font-size: 13px; color: var(--text-secondary); }
.codon { display: grid; justify-items: center; gap: 2px; padding: 6px 11px; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border); }
.codon code { font-size: 15px; letter-spacing: .1em; background: none; border: 0; padding: 0; color: var(--text-primary); }
.codon small { font-size: 11.5px; color: var(--text-secondary); }
.codon.changed { background: var(--bg-danger); border-color: var(--border-danger); box-shadow: 0 0 18px -6px var(--border-danger); }
.codon.changed small { color: var(--text-danger); font-weight: 600; }
.codon .mut { color: var(--text-danger); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lookup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0; }
.lookup-cell { padding: 9px 11px; border-radius: 9px; background: color-mix(in srgb, var(--rs, var(--lumen)) 6%, var(--surface-1)); border: 1px solid var(--border); transition: border-color var(--dur); }
.lookup-cell:hover { border-color: color-mix(in srgb, var(--rs, var(--lumen)) 50%, transparent); }
.lookup-cell dt { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
.lookup-cell dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.mini-dot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mini-dot { margin: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-1); border: 1px solid var(--border); }
.mini-dot-plot { display: grid; place-items: center; }
.mini-dot-plot svg { width: 100%; max-height: 200px; }
.mini-dot figcaption { display: grid; gap: 2px; font-size: 13px; }
.mini-dot figcaption strong { font-weight: 600; }
.mini-dot figcaption span { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; word-break: break-all; }
.mini-dot figcaption code { font-size: 10.5px; background: none; border: 0; padding: 0; color: var(--text-secondary); }
.dotplot .dp-bg { fill: color-mix(in srgb, var(--surface-0) 60%, transparent); stroke: var(--border); stroke-width: .5; }
.dotplot .dp-ax { font-family: var(--font-mono); font-size: 6.5px; fill: var(--text-muted); }
.dotplot .dp-dot { fill: var(--lumen); }
.dp-wrap { overflow-x: auto; }
.dp-matrix { border-collapse: separate; border-spacing: 4px; margin: 0 auto; font-family: var(--font-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dp-matrix th { font-weight: 500; color: var(--text-secondary); padding: 4px 6px; font-size: 13px; }
.dp-matrix td { min-width: 44px; height: 36px; text-align: center; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary); }
.dp-matrix td.path { background: var(--rc-f); border-color: var(--rc-s); color: var(--rc-t); font-weight: 600; box-shadow: 0 0 14px -6px var(--rc-s); }
.dp-matrix td.qcell { outline: 2px dashed var(--border-accent); outline-offset: 1px; }
.dp-matrix td.end { background: var(--rc-s); color: var(--surface-0); box-shadow: 0 0 22px -4px var(--rc-s); }
.dp-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 12.5px; color: var(--text-secondary); margin: 12px 0; }
.dp-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.dp-legend .sw.path { background: var(--rc-f); border: 1px solid var(--rc-s); }
.dp-legend .sw.qcell { border: 1.5px dashed var(--border-accent); }
.gap-table td.win { background: var(--bg-success); color: var(--text-success); font-weight: 600; }
.gap-table tr.hl td { background: color-mix(in srgb, var(--bg-warning) 70%, transparent); }
.gap-table tr.hl td.win { background: var(--bg-success); }
.gap-table tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--border-warning); }

/* 13. Recap ----------------------------------------------------------------- */
.recap-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 32px; position: sticky; top: 10px; z-index: 5; padding: 8px; border-radius: 16px; background: color-mix(in srgb, var(--surface-1) 82%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--border); box-shadow: var(--shadow-1); transition: top 460ms var(--ease); }
body.nav-shown .recap-nav { top: calc(var(--nav-h) + 22px); }
.recap-nav a { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px 6px 6px; border-radius: 11px; color: var(--text-secondary); font-size: 13px; text-decoration: none !important; transition: background var(--dur), color var(--dur), box-shadow var(--dur); }
.recap-nav a:hover { color: var(--text-primary); background: color-mix(in srgb, var(--lumen) 7%, transparent); }
.recap-nav a.on { color: var(--text-primary); background: color-mix(in srgb, var(--hue) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 35%, transparent); }
.recap-nav .l { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-display); font-size: 11px; color: var(--text-primary); border: 1px solid var(--border); }
.recap-nav a.on .l { color: var(--hue); border-color: color-mix(in srgb, var(--hue) 50%, transparent); }
.recap-intro { margin-bottom: 48px; }
.recap-sec { margin: 0 0 72px; scroll-margin-top: 96px; }
.recap-sec-head { display: flex; align-items: center; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.recap-sec-head .letter { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-family: var(--font-display); font-size: 17px; color: var(--hue); background: color-mix(in srgb, var(--hue) 12%, transparent); border: 1px solid color-mix(in srgb, var(--hue) 35%, transparent); box-shadow: 0 0 24px -10px var(--hue); flex: none; }
.recap-sec-head h2 { font-family: var(--font-display); font-weight: 300; font-size: 24px; margin: 0; letter-spacing: -0.015em; }
.recap-sec-head .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.built-note { font-size: 13px; color: var(--text-muted); margin: -6px 0 18px; max-width: 80ch; }
.recap-body { max-width: 920px; }
.recap-body.wide { max-width: none; }
.recap-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-top: 10px; }
.recap-figs .asset { margin: 0; }
.spec { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card-bg); }
.spec summary { cursor: pointer; padding: 11px 16px; font-size: 13.5px; color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 8px; }
.spec summary::-webkit-details-marker { display: none; }
.spec summary .icon { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.spec[open] summary .icon { transform: rotate(90deg); }
.spec .spec-body { padding: 6px 20px 16px; font-size: 14.5px; border-top: 1px solid var(--border); }
.recap-sec[data-letter="C"] .prose > ol { list-style: none; padding: 0; counter-reset: proc; display: grid; gap: 14px; }
.recap-sec[data-letter="C"] .prose > ol > li { counter-increment: proc; position: relative; margin: 0; padding: 16px 18px 14px 60px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-md); }
.recap-sec[data-letter="C"] .prose > ol > li::before { content: counter(proc); position: absolute; left: 16px; top: 15px; width: 28px; height: 28px; border-radius: 9px; background: color-mix(in srgb, var(--hue) 13%, transparent); border: 1px solid color-mix(in srgb, var(--hue) 40%, transparent); color: var(--hue); display: grid; place-items: center; font-family: var(--font-display); font-size: 12px; }
.recap-sec[data-letter="C"] .prose > ol > li ol { list-style: none; counter-reset: sub; padding: 0; margin: 12px 0 2px; display: flex; flex-wrap: wrap; gap: 8px 0; }
.recap-sec[data-letter="C"] .prose > ol > li ol > li { counter-increment: sub; position: relative; margin: 0 8px 0 0; padding: 7px 30px 7px 10px; font-size: 14px; line-height: 1.45; display: flex; align-items: center; background: var(--surface-1); border: 1px solid var(--border); border-radius: 9px; }
.recap-sec[data-letter="C"] .prose > ol > li ol > li > :first-child::before { content: counter(sub); display: inline-grid; place-items: center; width: 19px; height: 19px; margin-right: 8px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--hue) 45%, transparent); font-size: 11px; color: var(--hue); flex: none; }
.recap-sec[data-letter="C"] .prose > ol > li ol > li::after { content: "→"; position: absolute; right: 9px; color: var(--hue); opacity: .7; }
.recap-sec[data-letter="C"] .prose > ol > li ol > li:last-child::after { content: none; }
.recap-sec[data-letter="C"] .prose > ol > li ul { margin: 8px 0 0; }
.recap-sec[data-letter="D"] .table-wrap, .recap-sec[data-letter="E"] .table-wrap { display: inline-block; min-width: min(100%, 420px); max-width: 100%; vertical-align: top; margin-right: 12px; }
.recap-sec[data-letter="D"] .table-wrap table, .recap-sec[data-letter="E"] .table-wrap table { width: 100%; }
.recap-sec[data-letter="D"] .table-wrap th:not(:first-child) { color: var(--text-primary); }
.recap-sec[data-letter="E"] .prose > p { margin-bottom: .8rem; }

/* 14. Concept maps -------------------------------------------------------- */
.cmap { position: relative; padding: 6px 0 8px; }
.cmap-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.cmap-links path { fill: none; stroke: color-mix(in srgb, var(--lumen) 55%, var(--border-strong)); stroke-width: 1.3; }
.cmap-links path.drawing { transition: stroke-dashoffset 1400ms var(--ease-io); }
.cmap-links circle { fill: var(--surface-0); stroke: var(--lumen); stroke-width: 1.3; }
.cmap-root { display: flex; justify-content: center; position: relative; z-index: 1; }
.cmap-root-node { text-align: center; padding: 16px 30px; border-radius: 16px; max-width: 480px; color: var(--text-primary);
  background: radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, var(--lumen) 20%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--lumen) 45%, transparent); box-shadow: var(--shadow-2), 0 0 50px -16px var(--lumen); }
.cmap-root-node strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: -0.01em; }
.cmap-root-node span { display: block; font-size: 13.5px; color: var(--text-secondary); margin-top: 3px; }
.cmap-branches { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 44px 18px; margin-top: 66px; align-items: start; }
.cmap-branch { position: relative; background: var(--card-bg); border: 1px solid var(--border); border-top: 2px solid var(--rs); border-radius: var(--r-md); padding: 24px 16px 14px; box-shadow: var(--shadow-1), 0 -10px 30px -22px var(--rs); }
.cmap-rel { position: absolute; top: 0; left: 50%; transform: translate(-50%, -60%); font-size: 11.5px; line-height: 1; padding: 6px 11px; border-radius: 999px; background: var(--surface-0); border: 1px solid var(--rs, var(--border-strong)); color: var(--rtx, var(--text-secondary)); white-space: nowrap; font-style: italic; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.cmap-head { font-size: 15px !important; margin: 0 0 12px !important; color: var(--rtx); font-weight: 600 !important; text-align: center; line-height: 1.35; font-family: var(--font-sans) !important; }
.cm-items, .cm-sub { list-style: none; margin: 0; padding: 0; }
.cm-items > li { position: relative; padding: 0 0 0 16px; margin: 0 0 8px; }
.cm-items > li::before { content: ""; position: absolute; left: 4px; top: 0; bottom: -8px; width: 1px; background: var(--rs); opacity: .35; }
.cm-items > li:last-child::before { bottom: auto; height: 13px; }
.cm-items > li::after { content: ""; position: absolute; left: 4px; top: 12px; width: 9px; height: 1px; background: var(--rs); opacity: .5; }
.cm-node { font-size: 13.5px; line-height: 1.45; padding: 4px 9px; border-radius: 7px; background: var(--rf); display: inline-block; }
.cm-node b { font-weight: 600; color: var(--text-primary); }
.cm-node .cm-d { color: var(--text-secondary); }
.cm-node .cm-d::before { content: "· "; color: var(--text-muted); }
.cm-item.em > .cm-node { box-shadow: inset 0 0 0 1px var(--rs), 0 0 14px -6px var(--rs); }
.cm-link { font-weight: 600; color: var(--text-accent) !important; }
.cm-link::after { content: " ↗"; font-size: .85em; }
.cm-sub { margin: 6px 0 0 6px; }
.cm-sub > li { position: relative; padding-left: 14px; margin-bottom: 4px; }
.cm-sub > li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 8px; height: 1px; background: var(--border-strong); }
.cm-sub .cm-node { background: transparent; padding: 1px 4px; font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.cm-chain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: stretch; }
.cm-step { text-align: center; padding: 8px 10px; border-radius: 9px; background: var(--rf); border: 1px solid color-mix(in srgb, var(--rs) 45%, transparent); font-size: 13.5px; line-height: 1.35; }
.cm-step b { display: block; font-weight: 600; }
.cm-step .cm-d { display: block; font-size: 12px; color: var(--text-secondary); }
.cm-arrow { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 24px; font-size: 11.5px; color: var(--text-secondary); font-style: italic; padding: 3px 0; }
.cm-arrow::before { content: "↓"; font-style: normal; color: var(--rs); font-size: 14px; line-height: 1; }
.cm-side { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.cm-side-label { font-size: 11.5px; color: var(--text-muted); margin: 0 0 8px; }
.cmap-footer { position: relative; z-index: 1; margin-top: 44px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card-bg); padding: 24px 18px 18px; }
.cmap-footer .cmap-rel { --rs: var(--border-strong); }
.cmap-footer .cmap-head { color: var(--text-primary); }
.cm-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 0; }
.cm-chips li { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface-1); border: 1px solid var(--border); }
.cmap-note { font-size: 12.5px; color: var(--text-muted); margin: 14px 0 0; position: relative; z-index: 1; }

/* 15. Posters --------------------------------------------------------------- */
.poster-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin: -8px 0 12px; }
.poster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; grid-auto-flow: dense; padding: 16px; border-radius: 22px; background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--lumen) 7%, var(--surface-1)), var(--surface-1)); border: 1px solid var(--hairline); box-shadow: var(--shadow-2); }
.poster-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px 18px; min-width: 0; position: relative; overflow: hidden; }
.poster-panel::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--rs), transparent 80%); opacity: .9; }
.poster-panel.wide { grid-column: span 2; }
.poster-panel.full { grid-column: 1 / -1; }
.panel-title { font-size: 14px !important; font-weight: 600 !important; margin: 0 0 12px !important; color: var(--rtx); letter-spacing: 0; }
.panel-body { font-size: 14px; line-height: 1.58; }
.panel-body p { margin: 0 0 .6rem; }
.panel-body ul, .panel-body ol { margin: 0 0 .6rem; padding-left: 1.3em; }
.panel-body li { margin: .15rem 0; }
.panel-body .table-wrap { margin-bottom: .7rem; box-shadow: none; }
.panel-body .table-wrap table { font-size: 13px; }
.panel-body .table-wrap th { font-size: 12px; padding: 7px 10px; }
.panel-body .table-wrap td { padding: 7px 10px; }
.panel-body .callout { font-size: 13px; padding: 9px 12px; margin: .6rem 0 0; }
.panel-body .math-display { margin: .4rem 0 .7rem; font-size: 14px; padding: 8px 4px; }
.panel-body .math-display .katex { font-size: .98em; }
.panel-body .asset { margin: 0 0 .7rem; }
.panel-body .frame { padding: 10px; border-radius: var(--r-sm); background-color: color-mix(in srgb, var(--surface-0) 55%, var(--surface-2)); box-shadow: none; }
.panel-body .frame::before, .panel-body .frame::after { display: none; }
.panel-body .flow { margin: 0 0 .7rem; }

/* 16. Quiz ------------------------------------------------------------------ */
.quiz { max-width: 840px; margin: 0 auto; }
.quiz-intro { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 24px; }
.quiz-intro h2 { font-family: var(--font-display); font-weight: 300; font-size: 24px; margin: 0; letter-spacing: -0.015em; }
.quiz-intro p { margin: 6px 0 0; color: var(--text-secondary); font-size: 14.5px; }
.q-list { display: grid; gap: 16px; }
.q { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px; margin: 0; min-width: 0; scroll-margin-top: 90px; box-shadow: var(--shadow-1); transition: border-color 400ms var(--ease), box-shadow 400ms var(--ease); }
.q legend { padding: 0; float: left; width: 100%; margin-bottom: 16px; }
.q legend + * { clear: both; }
.q-num { font-size: 12.5px; color: var(--hue, var(--text-accent)); font-weight: 600; display: block; margin-bottom: 6px; }
.q-prompt { font-size: 16.5px; font-weight: 500; line-height: 1.5; }
.q .code-block { margin: 0 0 12px; }
.opts { display: grid; gap: 9px; }
.opt { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 15px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; font-size: 15px; line-height: 1.5; background: color-mix(in srgb, var(--surface-1) 40%, transparent); transition: background var(--dur), border-color var(--dur), box-shadow var(--dur), transform 140ms var(--ease); }
.opt:hover { background: color-mix(in srgb, var(--lumen) 6%, var(--surface-1)); border-color: color-mix(in srgb, var(--lumen) 35%, var(--border-strong)); }
.opt:active { transform: scale(.995); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .letter { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-secondary); transition: background 260ms var(--ease), color 260ms, border-color 260ms, transform 300ms var(--spring), box-shadow 260ms; }
.opt:has(input:checked) { border-color: var(--border-accent); background: var(--bg-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lumen) 10%, transparent); }
.opt:has(input:checked) .letter { background: linear-gradient(135deg, var(--lumen), var(--lumen-2)); border-color: transparent; color: #03131A; transform: scale(1.08); box-shadow: 0 0 12px var(--lumen-glow); }
.opt:has(input:focus-visible) { outline: 2px solid var(--border-accent); outline-offset: 2px; }
.q.graded .opt { cursor: default; }
.q.graded .opt:hover { background: transparent; border-color: var(--border-strong); }
.opt.is-correct, .q.graded .opt.is-correct:hover { background: var(--bg-success); border-color: var(--border-success); }
.opt.is-correct .letter { background: var(--text-success); border-color: var(--text-success); color: var(--surface-0); }
.opt.is-wrong, .q.graded .opt.is-wrong:hover { background: var(--bg-danger); border-color: var(--border-danger); }
.opt.is-wrong .letter { background: var(--text-danger); border-color: var(--text-danger); color: var(--surface-0); }
.opt .tag { font-size: 12px; font-weight: 600; margin-left: 8px; }
.opt.is-correct .tag { color: var(--text-success); }
.opt.is-wrong .tag { color: var(--text-danger); }
.q.is-right { border-color: color-mix(in srgb, var(--border-success) 70%, transparent); box-shadow: var(--shadow-1), 0 0 30px -16px var(--border-success); }
.q.is-wrong-q { border-color: color-mix(in srgb, var(--border-danger) 70%, transparent); box-shadow: var(--shadow-1), 0 0 30px -16px var(--border-danger); }
.q.unanswered { border-color: var(--border-warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-warning) 18%, transparent); }
.feedback { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 11px; font-size: 14.5px; color: var(--text-secondary); line-height: 1.65; }
.feedback .verdict { font-weight: 600; font-size: 14px; }
.feedback .verdict.ok { color: var(--text-success); }
.feedback .verdict.no { color: var(--text-danger); }
.feedback .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }
.feedback details summary { cursor: pointer; font-size: 13px; color: var(--text-accent); }
.feedback details ul { margin: 6px 0 0; padding-left: 1.2em; }
.feedback .review a { font-size: 13.5px; }
.quiz-bar { position: sticky; bottom: 18px; z-index: 10; margin-top: 22px; display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 12px 14px 12px 20px; background: color-mix(in srgb, var(--surface-1) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--hairline); border-radius: 16px; box-shadow: var(--shadow-2); flex-wrap: wrap; }
.quiz-bar .status { font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 14px; flex: 1; min-width: 200px; flex-wrap: wrap; }
.quiz-bar .status .bar { flex: 1; max-width: 200px; min-width: 80px; }
.quiz-bar .msg { color: var(--text-warning); font-size: 13.5px; font-weight: 500; }
.quiz-actions { display: flex; gap: 8px; }
.result { position: relative; background: var(--card-bg); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 26px; margin-bottom: 26px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; scroll-margin-top: 90px; box-shadow: var(--shadow-2), 0 0 60px -30px var(--lumen); overflow: hidden; }
.score-ring { width: 120px; height: 120px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 8; }
.score-ring .bg { stroke: color-mix(in srgb, var(--text-primary) 8%, transparent); }
.score-ring .fg { stroke: var(--lumen); stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease-io); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.score-ring .val b { font-family: var(--font-display); font-size: 32px; font-weight: 300; font-variant-numeric: tabular-nums; }
.score-ring .val small { display: block; font-size: 12px; color: var(--text-muted); }
.result h3 { margin: 0 0 4px; font-size: 19px; font-family: var(--font-display); font-weight: 300; }
.result p { margin: 0 0 12px; color: var(--text-secondary); font-size: 14.5px; }
.review-h { margin: 0 0 4px !important; font-weight: 600; color: var(--text-primary) !important; }
.review-list { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 7px; }
.review-list li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; flex-wrap: wrap; }
.review-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-danger); flex: none; transform: translateY(-2px); }
.review-list a { font-size: 13px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.authorship { font-size: 12.5px !important; color: var(--text-muted) !important; margin: 16px 0 0 !important; }
.history { margin-top: 32px; }
.history h3 { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; }
.history ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-secondary); }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 9px; background: color-mix(in srgb, var(--surface-1) 70%, transparent); border: 1px solid var(--border); }
.history b { font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }

/* 17. Slides ---------------------------------------------------------------- */
.slides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.slide-thumb { display: flex; flex-direction: column; gap: 9px; padding: 0; border: 0; background: transparent; text-align: left; cursor: zoom-in; color: inherit; }
.slide-thumb .img { aspect-ratio: 16 / 9; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-1); transition: border-color var(--dur), box-shadow 300ms var(--ease), transform 400ms var(--ease); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 700ms var(--ease); }
.slide-thumb:hover .img { border-color: color-mix(in srgb, var(--hue, var(--lumen)) 45%, transparent); box-shadow: var(--shadow-2), 0 0 30px -14px var(--hue, var(--lumen)); transform: translateY(-2px); }
.slide-thumb:hover img { transform: scale(1.03); }
.slide-thumb .cap { font-size: 12.5px; color: var(--text-secondary); line-height: 1.35; display: flex; gap: 8px; }
.slide-thumb .cap b { color: var(--hue, var(--text-muted)); font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.slide-thumb .cap span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orientation-note { max-width: var(--read-w); margin-bottom: 40px; }

/* 18. Lightbox -------------------------------------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 400; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: rgba(2, 6, 14, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #E6EEF6; }
.lightbox[hidden] { display: none; }
.lb-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.lb-title { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.lb-title small { display: block; color: #9DB0C4; font-size: 12.5px; }
.lightbox .icon-btn { color: #E6EEF6; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .1); }
.lb-stage { display: grid; place-items: center; padding: 8px 72px 16px; min-height: 0; position: relative; }
.lb-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.lb-stage > .lb-svg { width: min(1100px, 100%); max-height: 100%; overflow: auto; background: var(--surface-2); color: var(--text-primary); border-radius: var(--r-lg); padding: 28px; border: 1px solid var(--border); }
.lb-stage > .lb-svg svg { width: 100%; height: auto; display: block; }
.lb-stage > .lb-frame { width: min(1000px, 100%); height: 100%; background: var(--surface-2); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.lb-stage > .lb-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-foot { padding: 0 16px 16px; text-align: center; font-size: 12.5px; color: #9DB0C4; }

/* 19. Motion ------------------------------------------------------------------
   One orchestrated entrance per view; diagrams animate once on reveal, where
   the motion explains something. Reading text never animates. */
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live 2.4s var(--ease) infinite; }
  @keyframes live { 50% { box-shadow: 0 0 0 6px transparent, 0 0 10px var(--lumen); } }
  .lightbox:not([hidden]) { animation: fade 260ms var(--ease); }
  .lightbox:not([hidden]) .lb-stage > :not(.lb-nav) { animation: lb-zoom 420ms var(--ease); }
  @keyframes lb-zoom { from { opacity: 0; transform: scale(.965); } }

  .dash .hero-copy > * { animation: rise 900ms var(--ease) both; }
  .dash .hero-copy > :nth-child(2) { animation-delay: 90ms; }
  .dash .hero-copy > :nth-child(3) { animation-delay: 180ms; }
  .dash .hero-copy > :nth-child(4) { animation-delay: 260ms; }
  .dash .hero-copy > :nth-child(5) { animation-delay: 340ms; }
  .dash .hero-helix { animation: fade 1800ms var(--ease) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
  @keyframes fade { from { opacity: 0; } }

  .lec-enter .lec-numeral { animation: numeral 1000ms var(--ease) both; }
  .lec-enter .lec-titles > * { animation: rise 800ms var(--ease) both; }
  .lec-enter .lec-titles > :nth-child(2) { animation-delay: 90ms; }
  .lec-enter .lec-titles > :nth-child(3) { animation-delay: 170ms; }
  .lec-enter .lec-art { animation: art-in 1400ms var(--ease) 100ms both; }
  .lec-enter .lec-head::after { animation: line-in 1200ms var(--ease-io) 200ms both; }
  .lec-enter .pane-anim { animation: rise 800ms var(--ease) 220ms both; }
  @keyframes numeral { from { opacity: 0; transform: translateY(30px); clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
  @keyframes art-in { from { opacity: 0; transform: translateY(-55%) translateX(30px); } }
  @keyframes line-in { from { width: 0; } }
  .tab-switch .pane-anim { animation: pane-in 520ms var(--ease) both; }
  .tab-switch .lec-sec { animation: rise 500ms var(--ease) both; }
  @keyframes pane-in { from { opacity: 0; transform: translateX(calc(var(--dir) * 34px)); filter: blur(4px); } }

  .rv.stats .stat, .rv.tiles > *, .rv.journey > *, .rv[data-stagger] > * { opacity: 0; }
  .in.stats .stat, .in.tiles > *, .in.journey > *, .in[data-stagger] > * { opacity: 1; animation: rise 760ms var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }

  .asset .frame.rv { opacity: 0; }
  .asset .frame.in { opacity: 1; animation: rise 800ms var(--ease) both; }
  .asset .frame.in:not(.iframe-frame) {
    background-image: linear-gradient(180deg, transparent, color-mix(in srgb, var(--lumen) 14%, transparent) 50%, transparent);
    background-size: 100% 70px; background-repeat: no-repeat; background-position: 0 -90px;
    animation: rise 800ms var(--ease) both, scan 1500ms var(--ease-io) 250ms both;
  }
  @keyframes scan { from { background-position: 0 -90px; } to { background-position: 0 calc(100% + 90px); } }

  .rv.cmap .cmap-root-node, .rv.cmap .cmap-branch, .rv.cmap .cmap-footer { opacity: 0; }
  .in.cmap .cmap-root-node { opacity: 1; animation: pop 700ms var(--ease) both; }
  .in.cmap .cmap-branch { opacity: 1; animation: rise 760ms var(--ease) both; animation-delay: calc(500ms + var(--i) * 110ms); }
  .in.cmap .cmap-footer { opacity: 1; animation: rise 760ms var(--ease) 1200ms both; }
  @keyframes pop { from { opacity: 0; transform: scale(.94); } }

  .rv.flow > * { opacity: 0; }
  .in.flow > * { opacity: 1; }
  .in.flow > .flow-node { animation: pop 520ms var(--ease) both; animation-delay: calc(var(--i) * 140ms); }
  .in.flow > .flow-edge { animation: fade 400ms var(--ease) both; animation-delay: calc(var(--i) * 140ms); }
  .in.flow > .flow-edge::after { animation: grow 520ms var(--ease-io) both; animation-delay: calc(var(--i) * 140ms); }
  @keyframes grow { from { transform: scaleX(0); } }

  .in.dp-matrix td.path { animation: lit 600ms var(--ease) both; animation-delay: calc(300ms + var(--step) * 170ms); }
  @keyframes lit { from { background: var(--surface-1); border-color: var(--border); color: var(--text-secondary); box-shadow: none; transform: scale(.88); } }
  .rv.mini-dot-grid .dp-dot { opacity: 0; }
  .in.mini-dot-grid .dp-dot { opacity: 1; animation: fade 300ms var(--ease) both; animation-delay: calc(var(--d) * 55ms); }
  .rv.poster .poster-panel { opacity: 0; }
  .in.poster .poster-panel { opacity: 1; animation: rise 760ms var(--ease) both; animation-delay: calc(var(--i) * 90ms); }
  .recap-sec[data-letter="C"] .prose > ol.rv > li { opacity: 0; }
  .recap-sec[data-letter="C"] .prose > ol.in > li { opacity: 1; animation: slide-r 640ms var(--ease) both; animation-delay: calc(var(--i) * 110ms); }
  @keyframes slide-r { from { opacity: 0; transform: translateX(-14px); } }

  .q.graded { animation: settle 600ms var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
  @keyframes settle { from { transform: translateY(5px); } }
  .result { animation: rise 700ms var(--ease) both; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .intro-word span, .intro-rule, .intro-sub, .intro-skip { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* 20. Responsive & print ------------------------------------------------- */
@media (max-width: 1279px) {
  .learn-grid { grid-template-columns: minmax(0, var(--read-w)); }
  .toc { display: none; }
  .toc-pop { display: block; max-width: var(--read-w); margin-left: auto; margin-right: auto; }
  .poster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 36px; }
  .tiles, .lmenu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-current { max-width: 170px; }
  .tab span { display: none; }
  .tab { padding: 0 13px; }
  .tab .icon { width: 17px; height: 17px; }
}
@media (min-width: 1280px) and (max-width: 1420px) { .tab { padding: 0 10px; } .nav-current { max-width: 170px; } }
@media (max-width: 1100px) {
  .featured { grid-template-columns: 1fr; }
  .featured-visual { border-left: 0; border-top: 1px solid var(--border); }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 18px; }
  .journey::before { display: none; }
  .mini-dot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  :root { --gutter: 18px; --nav-h: 54px; }
  #view { padding-top: calc(var(--nav-h) + 30px); padding-bottom: 110px; }
  .topnav { top: 8px; width: calc(100% - 16px); }
  .topnav-inner { padding: 0 6px; gap: 2px; border-radius: 15px; }
  .nav-lectures span { display: none; }
  .nav-lectures { padding: 0 11px; height: 40px; }
  .nav-current { display: none; }
  .tabs { justify-content: flex-start; height: 40px; }
  .tab { height: 40px; padding: 0 11px; }
  .tab-ink { height: 40px; }
  .ov-grid, .gallery, .terms { grid-template-columns: minmax(0, 1fr); }
  .ov-side { position: static; }
  .poster { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .poster-panel.wide { grid-column: auto; }
  .lec-head { grid-template-columns: minmax(0, 1fr); gap: 6px; padding-bottom: 24px; margin-bottom: 36px; }
  .lec-numeral { font-size: 64px; }
  .lec-art { width: 52%; top: 26%; opacity: .32; }
  .result { grid-template-columns: 1fr; justify-items: start; }
  .lb-stage { padding: 8px 8px 12px; }
  .lb-nav { top: auto; bottom: -4px; transform: none; }
  .cmap-branches { margin-top: 40px; gap: 36px; }
  .hero { min-height: 0; padding-top: 16px; }
  .hero-helix { opacity: .4; -webkit-mask-image: linear-gradient(180deg, #000, transparent 45%); mask-image: linear-gradient(180deg, #000, transparent 45%); }
  .dash { gap: 48px; }
  .lmenu { padding: 10px; align-items: end; }
  .lmenu-panel { padding: 20px 16px 16px; border-radius: 22px; max-height: calc(100vh - 20px); }
  .lcard { min-height: 210px; }
  .lcard-num { font-size: 42px; margin-bottom: 22px; }
  .lcard-here { top: 68px; }
  /* phones: while reading (scrolling down) the pill tucks away with the nav */
  body.reading:not(.nav-shown) .lectures-fab { opacity: 0; transform: translateY(16px); pointer-events: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .tiles, .lmenu-grid, .journey, .mini-dot-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:last-child { grid-column: 1 / -1; }
  .featured-text { padding: 24px 20px; }
  .flow { flex-direction: column; align-items: stretch; }
  .flow-edge { max-width: none; min-height: 34px; flex-direction: row; gap: 8px; padding: 2px 0; }
  .flow-edge span { margin: 0; order: 2; }
  .flow-edge::after { width: 8px; height: 22px; flex: none; transform-origin: 50% 0; background:
    linear-gradient(var(--rs, var(--text-muted)), var(--rs, var(--text-muted))) center top / 1px calc(100% - 6px) no-repeat,
    conic-gradient(from 135deg at 50% 100%, var(--rs, var(--text-muted)) 0 90deg, transparent 0) center bottom / 8px 7px no-repeat; }
  .q { padding: 18px 16px; }
  .quiz-bar { bottom: 10px; }
  .quiz-actions { width: 100%; }
  .quiz-actions .btn-primary { flex: 1; justify-content: center; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .frame { padding: 12px; }
  .iframe-frame { padding: 10px 8px 8px; }
  .slides-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .codon-label { width: 100%; }
  .lectures-fab { left: 12px; bottom: 12px; height: 44px; }
  .lectures-fab .fab-text { display: none; }
  .lectures-fab:not(:has(.fab-cur)) { padding-right: 14px; padding-left: 14px; }
  .to-top { right: 12px; bottom: 12px; width: 44px; height: 44px; }
  body.has-quiz-bar .lectures-fab, body.has-quiz-bar .to-top { bottom: 132px; }
  .lmenu-hint { display: none; }
  .recap-nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .recap-nav a { flex: none; }
}
@media print {
  @page { size: A3 landscape; margin: 10mm; }
  body { background: #fff; }
  .ambient, .topnav, .nav-handle, .to-top, .lectures-fab, .lmenu, .recap-nav, .pager, .poster-toolbar, .lightbox, .read-progress, .intro, .skip-link { display: none !important; }
  body.print-poster #view { padding: 0; }
  body.print-poster #view > * { display: none !important; }
  body.print-poster #view > .print-root { display: block !important; }
  body.print-poster .print-root > :not(.pane-anim) { display: none !important; }
  body.print-poster .print-root .recap-wrap > :not(.print-target) { display: none !important; }
  .poster { grid-template-columns: repeat(3, 1fr) !important; background: #fff; border: 0; padding: 0; box-shadow: none; }
  .poster-panel { break-inside: avoid; opacity: 1 !important; animation: none !important; }
  .poster-panel.wide { grid-column: span 2 !important; }
}
