:root { --fig-blue:#2f6fb0; --fig-orange:#d0731c; --fig-green:#2e8b57; --fig-red:#c23b3b; --fig-purple:#7b4fb0; --fig-gray:#7a776f; --gutter:24px; }
@media (prefers-color-scheme: dark) {
  :root { --fig-blue:#6ea8e0; --fig-orange:#f0a050; --fig-green:#5cc08a; --fig-red:#ec7070; --fig-purple:#b493e6; --fig-gray:#a8a49b; }
}
@media (max-width:600px) { :root { --gutter:16px; } }
main { max-width:var(--narrow); margin:0 auto; padding:16px var(--gutter); overflow-wrap:anywhere; }
main.wide { max-width:var(--wide); }
h1 { font-weight:800; font-size:clamp(1.8rem, 4vw, 2.5rem); line-height:1.08; letter-spacing:-.03em; margin:28px 0 12px; text-wrap:balance; }
main.paper > h1 { font:600 clamp(1.6rem, 3.6vw, 2.2rem)/1.2 var(--journal); letter-spacing:0; }
.meta, .links { color:var(--muted); font-size:.88rem; }
.summary { font-weight:700; }
.notice { background:var(--card); border-left:3px solid var(--accent); border-radius:6px; padding:12px 16px; }
.state.known { border-color:var(--accent); color:var(--accent); }
.actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:14px 0; }
.version-tabs { display:inline-flex; margin:4px 0 8px; border:1.5px solid var(--line); border-radius:99px; overflow:hidden; }
.version-tabs a { padding:5px 18px; font-size:.9rem; color:var(--muted); text-decoration:none; }
.version-tabs a + a { border-left:1.5px solid var(--line); }
.version-tabs a.on { background:var(--fg); color:var(--bg); }
.state.reading { border-color:var(--accent); color:var(--accent); align-self:center; }
details { margin:12px 0; }
summary { cursor:pointer; color:var(--muted); font-weight:500; }
.prose { background:var(--card); border-radius:10px; padding:6px 32px 20px; margin:20px 0; font-size:1.05rem; line-height:1.68; box-shadow:var(--shadow); }
.prose h1, .prose h2 { font-weight:800; font-size:1.45rem; line-height:1.2; letter-spacing:-.02em; margin:1.7em 0 .5em; }
.prose h3 { font-weight:700; font-size:1.15rem; line-height:1.3; margin:1.5em 0 .4em; }
.prose em { font-style:normal; background:var(--mark); padding:0 2px; border-radius:2px; }
.prose pre { overflow-x:auto; padding:10px; background:var(--bg); border-radius:6px; }
.prose table { border-collapse:collapse; display:block; overflow-x:auto; }
.prose th, .prose td { border:1px solid var(--line); padding:4px 8px; }
.missing { border-bottom:1px dotted var(--muted); }
.footnotes { font-size:.85rem; color:var(--muted); }
.sheet { position:fixed; left:0; right:0; bottom:0; z-index:10; max-height:50vh; overflow-y:auto; background:var(--card); border-top:1px solid var(--line); border-radius:12px 12px 0 0; box-shadow:0 -4px 16px rgba(0,0,0,.15); padding:12px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet[hidden] { display:none; }
.sheet-head { display:flex; align-items:center; gap:10px; max-width:760px; margin:0 auto; }
.sheet-title { flex:1; font-size:1.05rem; }
.sheet-open { font-size:1.2rem; text-decoration:none; padding:4px 8px; }
.sheet-meta, .sheet-body { max-width:760px; margin:6px auto; }
.stack-toggle { flex:none; margin-left:auto; font-size:.9rem; padding:4px 6px; }
.stack-count { margin-left:3px; font-size:.75rem; color:var(--muted); }
.stack { position:fixed; top:64px; right:max(16px, calc((100vw - 760px) / 2)); z-index:10; width:min(320px, calc(100vw - 32px)); max-height:60vh; overflow-y:auto; background:var(--card); border:1px solid var(--line); border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,.18); }
.stack[hidden] { display:none; }
.stack ol { list-style:none; margin:0; padding:6px 0; }
.stack li { padding:10px 14px; border-left:3px solid transparent; line-height:1.35; }
.stack li + li { border-top:1px solid var(--line); }
.stack li[aria-current] { border-left-color:var(--accent); font-weight:600; }
.stack a { color:var(--fg); text-decoration:none; display:block; }
.math.block { display:block; overflow-x:auto; overflow-y:hidden; margin:12px 0; padding:2px 0; }
.math.block .katex-display { margin:0; }
.fig { margin:18px 0; }
.fig-board { width:100%; aspect-ratio:4 / 3; max-height:420px; border:1px solid var(--line); border-radius:8px; background:color-mix(in srgb, var(--bg) 35%, var(--card)); touch-action:pan-y; }
.fig-3d { aspect-ratio:1 / 1; touch-action:none; overflow:hidden; }
.fig-board .JXGtext { color:var(--fg); white-space:nowrap; }
.fig-title { font-weight:600; margin-bottom:6px; }
.fig-eq { overflow-x:auto; overflow-y:hidden; margin:8px 0 0; }
.fig-eq .katex-display { margin:4px 0; }
.fig-eq-live { color:var(--muted); font-size:.9em; }
.fig-eq-raw [data-tip] { cursor:help; border-bottom:1.5px dotted var(--accent); outline:none; }
.fig-eq-raw [data-tip]:hover, .fig-eq-raw [data-tip]:focus { color:var(--accent); }
.sym-tip { position:absolute; z-index:20; max-width:min(280px, calc(100vw - 16px)); background:var(--fg); color:var(--bg); font-size:.85rem; line-height:1.4; padding:6px 10px; border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.2); pointer-events:none; }
.sym-tip[hidden] { display:none; }
.grid .fig-eq { font-size:.85rem; }
.fig-caption, .fig-hint { color:var(--muted); font-size:.85rem; margin-top:6px; }
.fig-hint { margin:4px 0 0; }
.fig-legend { list-style:none; display:flex; flex-wrap:wrap; gap:4px 14px; margin:6px 0 0; padding:0; font-size:.85rem; }
.fig-legend .swatch { display:inline-block; width:14px; height:3px; border-radius:2px; vertical-align:middle; margin-right:6px; }
.fig-params { display:grid; gap:4px; margin-top:8px; }
.fig-params label { display:grid; grid-template-columns:minmax(3em, auto) 1fr 3.5em; align-items:center; gap:10px; font-size:.9rem; }
.fig-params input { width:100%; accent-color:var(--accent); min-height:28px; }
.fig-params output { font-variant-numeric:tabular-nums; text-align:right; color:var(--muted); }
.fig-views { display:inline-flex; margin-top:8px; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.fig-views button { border:0; border-radius:0; padding:6px 14px; color:var(--muted); background:var(--bg); }
.fig-views button + button { border-left:1px solid var(--line); }
.fig-views button[aria-pressed=true] { color:var(--fg); background:var(--card); box-shadow:inset 0 -2px var(--accent); }
.fig-elements .dot { display:inline-block; width:11px; height:11px; border-radius:50%; border:1px solid var(--line); vertical-align:-1px; margin-right:5px; }
.fig-elements b { font-weight:600; }
.fig-elements li span:last-child { color:var(--muted); }
.figure-error { color:var(--muted); font-size:.85rem; border:1px dashed var(--line); border-radius:8px; padding:8px 12px; }
.tabs { margin:18px 0; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.tab-bar { display:flex; overflow-x:auto; scrollbar-width:none; border-bottom:1px solid var(--line); background:var(--bg); }
.tab-bar button { flex:none; border:0; border-bottom:2px solid transparent; border-radius:0; background:none; padding:10px 14px; color:var(--muted); font-size:.9rem; }
.tab-bar button[aria-selected=true] { color:var(--fg); border-bottom-color:var(--accent); }
.tab-track { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none; align-items:flex-start; }
.tab-track > .tab { flex:0 0 100%; min-width:0; scroll-snap-align:start; padding:4px 14px 10px; }
.tabs > .tab { padding:4px 14px; }
.tabs .tab-title, .grid .cell-title { margin:10px 0 4px; font-size:.95rem; }
.grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin:18px 0; }
.grid > .cell { min-width:0; border:1px solid var(--line); border-radius:8px; padding:2px 10px 8px; font-size:.9rem; }
.grid .cell-title { margin-top:8px; }
.grid .fig { margin:8px 0 4px; }
.grid .fig-board { aspect-ratio:1 / 1; }
.grid .fig-params label { grid-template-columns:auto 1fr; }
.grid .fig-params output { display:none; }
.grid p { margin:6px 0; }
audio { display:block; width:100%; margin:8px 0 16px; }
.cast-line { color:var(--muted); font-size:.85rem; margin:0 0 16px; }
.cast { list-style:none; padding:0; margin:12px 0 0; display:grid; gap:2px; font-size:.88rem; color:var(--muted); }
.cast b { color:var(--sp, var(--fg)); }
.transcript { list-style:none; padding:0; margin:20px 0 0; }
.transcript li { padding:8px 10px; margin:0 -10px; border-radius:8px; cursor:pointer; line-height:1.55; border-left:3px solid transparent; }
.transcript li:hover { background:var(--card); }
.transcript li.on { background:color-mix(in srgb, var(--sp, var(--accent)) 13%, var(--bg)); border-left-color:var(--sp, var(--accent)); }
.transcript .when { color:var(--muted); font-size:.78rem; font-variant-numeric:tabular-nums; }
.transcript li b { color:var(--sp, var(--fg)); }
.transcript li.comment { border-left:3px dashed var(--accent); background:var(--card); font-size:.92rem; margin:4px -10px; }
.transcript li.comment b { color:var(--accent); }
.transcript li.comment .delete { border:0; background:none; color:var(--muted); cursor:pointer; font-size:1rem; padding:0 4px; }

.player { position:sticky; bottom:0; z-index:5; margin:0 calc(-1 * var(--gutter)) -16px; padding:14px var(--gutter) calc(8px + env(safe-area-inset-bottom)); background:var(--card); border-top:1px solid var(--line); box-shadow:0 -6px 20px rgba(0,0,0,.07); }
.player [hidden] { display:none !important; }
.player button { font:inherit; color:var(--fg); background:none; cursor:pointer; }

/* The strip: every turn as a band in its speaker's color, played turns at full strength. */
.player .strip { position:relative; height:22px; border-radius:6px; }
.player .strip .turns { position:absolute; inset:0; border-radius:6px; background:var(--line); opacity:.32; }
.player .strip .turns.played { opacity:1; clip-path:inset(0 calc(100% - var(--progress, 0%)) 0 0 round 6px); }
.player .strip .head { position:absolute; top:-3px; bottom:-3px; left:var(--progress, 0%); width:3px; margin-left:-1.5px; border-radius:2px; background:var(--fg); pointer-events:none; }
.player .strip .scrub { position:absolute; inset:-6px 0; width:100%; height:calc(100% + 12px); margin:0; opacity:0; cursor:pointer; }
.player .strip:has(.scrub:focus-visible) { outline:2px solid var(--accent); outline-offset:3px; }
.player .marks { position:absolute; left:0; right:0; top:-11px; height:8px; }
.player .marks button { position:absolute; top:0; width:8px; height:8px; padding:0; border:0; border-radius:50%; background:var(--accent); transform:translateX(-50%); }

.player .times { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; color:var(--muted); font-size:.8rem; font-variant-numeric:tabular-nums; }
.player .now { display:flex; align-items:center; gap:6px; color:var(--fg); font-weight:600; font-size:.88rem; }
.player .now:not(:empty)::before { content:""; width:9px; height:9px; border-radius:50%; background:var(--now, var(--accent)); }

.player .controls { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:2px; }
.player .controls button { flex:none; display:grid; place-items:center; width:46px; height:46px; padding:0; border:none; border-radius:50%; }
.player .controls button > * { grid-area:1 / 1; }
.player .controls svg { width:24px; height:24px; fill:currentColor; }
.player .controls .back, .player .controls .fwd { width:54px; height:54px; }
.player .controls .back svg, .player .controls .fwd svg { width:38px; height:38px; }
.player .controls button span { font-size:.68rem; font-weight:700; padding-top:5px; }
.player .controls .play { width:60px; height:60px; margin:0 6px; background:var(--fg); color:var(--card); }
.player .controls .play svg { width:28px; height:28px; }
.player .play svg + svg, .player.playing .play svg:first-child { display:none; }
.player.playing .play svg + svg { display:block; }

.player .tools { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin-top:6px; }
.player .tools button { display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 12px; border:1px solid var(--line); border-radius:99px; font-size:.82rem; font-variant-numeric:tabular-nums; white-space:nowrap; }
.player .tools svg { width:16px; height:16px; fill:currentColor; }
.player .tools [aria-expanded=true] { border-color:var(--accent); color:var(--accent); }

/* Drawers rise over the transcript, so opening one never grows the player. */
.player .drawer { position:absolute; left:8px; right:8px; bottom:calc(100% + 8px); display:grid; gap:10px; padding:12px 14px 14px; background:var(--card); border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.14); font-size:.9rem; animation:rise .16s ease-out; }
@keyframes rise { from { opacity:0; transform:translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .player .drawer { animation:none; } }
.player .drawer-head { display:flex; align-items:center; justify-content:space-between; }
.player .drawer .close { display:grid; place-items:center; width:30px; height:30px; padding:0; border:0; border-radius:50%; color:var(--muted); }
.player .drawer .close svg { width:16px; height:16px; }
.player .comment-form textarea { width:100%; box-sizing:border-box; font:inherit; font-size:.95rem; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); resize:vertical; }
.player .comment-form .row { display:flex; justify-content:flex-end; }
.player .comment-form .row button { padding:6px 16px; border:0; border-radius:99px; background:var(--accent); color:var(--bg); font-weight:600; }
.player .mix .styles { display:flex; flex-wrap:wrap; gap:6px; }
.player .space { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:4px 12px; padding-bottom:10px; border-bottom:1px solid var(--line); }
.player .space .label { color:var(--muted); }
.player .spaces { display:inline-flex; justify-self:start; border:1px solid var(--line); border-radius:99px; overflow:hidden; }
.player .spaces button { padding:5px 14px; border:0; border-radius:0; font-size:.85rem; font-weight:600; letter-spacing:.02em; }
.player .spaces button + button { border-left:1px solid var(--line); }
.player .spaces button[aria-pressed=true] { background:var(--accent); color:var(--bg); }
.player .spaces button:disabled { color:var(--muted); opacity:.45; cursor:default; }
.player .takes { display:flex; flex-wrap:wrap; gap:6px; }
.player .takes button { padding:4px 12px; border:1px solid var(--line); border-radius:99px; font-size:.85rem; }
.player .takes button[aria-pressed=true] { border-color:var(--accent); color:var(--accent); font-weight:600; }
.player .space .hint { grid-column:2; margin:0; color:var(--muted); font-size:.78rem; }
.player .mix .styles button { padding:4px 12px; border:1px solid var(--line); border-radius:99px; font-size:.85rem; }
.player .mix .styles button[aria-pressed=true] { border-color:var(--accent); color:var(--accent); font-weight:600; }
.player .mix label { display:grid; grid-template-columns:4.5em 1fr 3.2em; align-items:center; gap:10px; color:var(--muted); }
.player .mix input[type=range] { accent-color:var(--accent); min-height:28px; }
.player .mix .val { text-align:right; font-variant-numeric:tabular-nums; }
@media (min-width:700px) { .player .drawer { left:auto; width:360px; } }
.transcript li.card { margin:22px -10px 10px; font-weight:600; font-size:1.05rem; }
.transcript li.card b { display:none; }
.player .chapter-list { list-style:none; margin:0; padding:0; display:grid; gap:2px; max-height:50vh; overflow:auto; }
.player .chapter-list button { display:flex; justify-content:space-between; gap:12px; width:100%; padding:8px 10px; border:0; border-radius:8px; background:none; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.player .chapter-list button:hover { background:var(--bg); }
.player .chapter-list button[aria-current] { color:var(--accent); font-weight:600; }
.player .chapter-list .when { color:var(--muted); font-variant-numeric:tabular-nums; }

.grant { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:0 0 20px; }
.grant input { flex:1 1 240px; }
.accounts-card { background:var(--card); border-radius:10px; box-shadow:var(--shadow); overflow-x:auto; }
.accounts { width:100%; border-collapse:collapse; font-size:.92rem; }
.accounts th { font:500 .76rem/1.4 var(--mono); color:var(--muted); text-align:left; text-transform:uppercase; letter-spacing:.06em; }
.accounts th, .accounts td { padding:12px 16px; border-bottom:1px solid var(--line); white-space:nowrap; }
.accounts tr:last-child td { border-bottom:0; }

/* Subscribe and account pages. */
.plans { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:20px; align-items:start; margin:0 0 20px; }
.plan { border:1.5px solid var(--line); border-radius:10px; padding:22px 24px; }
.plan.paid { background:var(--card); border:0; border-top:4px solid var(--subscriber); box-shadow:var(--lift); }
.plan h2 { font:500 .8rem/1.4 var(--mono); color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin:0; }
.plan.paid h2 { color:var(--subscriber); }
.price { margin:8px 0 16px; color:var(--muted); }
.price b { font-weight:800; font-size:2.6rem; line-height:1; letter-spacing:-.03em; color:var(--fg); }
.plan ul { list-style:none; display:grid; gap:8px; margin:0; padding:0; }
.plan li { position:relative; padding-left:22px; }
.plan li::before { content:""; position:absolute; left:2px; top:.72em; width:10px; height:2px; border-radius:1px; background:var(--muted); }
.plan.paid li::before { background:var(--subscriber); }
.plan-action { margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }
.plan-action .fine { margin:8px 0 0; }
.standing { margin:0 0 12px; font-weight:700; }
.fine { color:var(--muted); font-size:.88rem; }
.page-sub .state { margin-right:0; }
.fine a { color:inherit; }
.panel { background:var(--card); border-radius:10px; box-shadow:var(--shadow); padding:18px 24px 20px; margin:0 0 16px; }
.panel .eyebrow { margin:0 0 8px; }
.panel p { margin:4px 0; }
.panel .actions { margin:14px 0 0; }
.plan-name { font-weight:800; font-size:1.5rem; line-height:1.2; letter-spacing:-.02em; }
.panel p.plan-name { margin:0 0 4px; }
.kept { margin:0; }
.kept div { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:baseline; gap:2px 16px; padding:9px 0; border-bottom:1px solid var(--line); }
.kept dd { margin:0 0 0 auto; font-weight:700; font-variant-numeric:tabular-nums; text-align:right; }
.panel.leave { background:none; box-shadow:none; padding:4px 0; }
.leave .actions { margin-top:0; }
.delete summary { color:var(--fig-red); }
.delete[open] { border-left:3px solid var(--fig-red); padding-left:14px; }
.delete form { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; }
.delete label { display:flex; align-items:center; gap:8px; }
button.danger { border-color:var(--fig-red); color:var(--fig-red); font-weight:700; }
button.danger:hover { background:var(--fig-red); color:var(--card); }
.eyebrow + .page-title { margin-top:0; }
main > .eyebrow:first-child { margin-top:32px; }
@media (max-width:640px) {
  .plans { grid-template-columns:1fr; }
  .plan, .panel { padding:18px; }
  .panel.leave { padding:4px 0; }
}
