@font-face { font-family: "Cormorant Garamond"; font-weight: 300; font-style: normal; font-display: swap; src: url(../fonts/cormorant-garamond-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 300; font-style: italic; font-display: swap; src: url(../fonts/cormorant-garamond-latin-300-italic.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap; src: url(../fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap; src: url(../fonts/cormorant-garamond-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-display: swap; src: url(../fonts/cormorant-garamond-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 400; font-display: swap; src: url(../fonts/figtree-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 500; font-display: swap; src: url(../fonts/figtree-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 600; font-display: swap; src: url(../fonts/figtree-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 800; font-display: swap; src: url(../fonts/figtree-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url(../fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url(../fonts/playfair-display-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 900; font-display: swap; src: url(../fonts/playfair-display-latin-900-normal.woff2) format("woff2"); }

/* One dark world: the film's own black, warm paper-white ink, gold for the old money, orange for the proof. */
:root {
  --bg: #060504;
  --panel: #100d0a;
  --ink: #efe8dc;
  --muted: #a79e90;
  --line: #2b241d;
  --gold: #e3b45c;
  --orange: #f7931a;
  --track: #3a3129;
  --bad: #ff8a7a;
  --strc: #9fc4b6; /* STRC: the film's cold green-grey of paper money, lifted to read on black */
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 18px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--orange); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, .scrub:focus-visible, summary:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

/* The player: always 16:9, as large as the window allows. */
.stage { position: relative; width: min(100%, calc(100svh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; background: #000; overflow: hidden; }
.stage canvas, .stage video, .poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage video { object-fit: contain; background: #000; }
.poster { object-fit: cover; transition: opacity 0.6s ease; z-index: 1; }
.cover { z-index: 2; }
.poster.gone { opacity: 0; }
#hud { pointer-events: none; }

.cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; background: radial-gradient(ellipse at center, rgba(4, 3, 2, 0.5) 0%, rgba(0, 0, 0, 0.62) 55%, rgba(0, 0, 0, 0.85) 100%); transition: opacity 0.6s ease; }
.cover.gone { opacity: 0; pointer-events: none; }
.kicker { margin: 0 0 12px; font-size: clamp(11px, 1.3vw, 14px); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.byline { margin: 0 0 clamp(16px, 3vw, 28px); font: 600 clamp(15px, 1.6vw, 19px)/1.2 "Figtree", system-ui, sans-serif; letter-spacing: 0.02em; color: var(--muted); }
.byline a { color: var(--orange); text-decoration: none; border-bottom: 1px solid rgba(247, 147, 26, 0.45); }
.byline a:hover { border-bottom-color: var(--orange); }
.cover h1 { margin: 0 0 clamp(10px, 1.6vw, 16px); font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(38px, 8.5vw, 124px); line-height: 0.92; text-wrap: balance; }
.play { display: inline-flex; align-items: center; gap: 12px; font: 600 17px/1 "Figtree", system-ui, sans-serif; color: #140c02; background: var(--orange); border: 0; border-radius: 999px; padding: 15px 26px 15px 20px; cursor: pointer; }
.play:disabled { opacity: 0.55; cursor: progress; }
.play-icon { width: 0; height: 0; border-left: 14px solid #140c02; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.fine { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.cover-sim { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--gold); text-decoration-color: rgba(227, 180, 92, 0.5); }
/* Phones: the 16:9 frame is short, so the cover keeps its tagline, title, byline and Play button only. */
@media (max-width: 600px) { .cover .fine, .cover-sim { display: none; } }

.ui { display: flex; align-items: center; gap: 14px; width: min(100%, calc(100svh * 16 / 9)); margin: 0 auto; padding: 12px 16px; }
.ui[hidden] { display: none; }
.icon-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; position: relative; }
.icon-btn::before, .icon-btn::after { content: ""; position: absolute; top: 12px; width: 4px; height: 14px; background: var(--ink); }
.icon-btn::before { left: 13px; } .icon-btn::after { right: 13px; }
.icon-btn.paused::after { display: none; }
.icon-btn.paused::before { left: 14px; top: 11px; width: 0; height: 0; background: none; border-left: 12px solid var(--ink); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.scrub { flex: 1; height: 6px; border-radius: 3px; background: var(--line); cursor: pointer; position: relative; touch-action: none; }
.scrub-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 3px; background: var(--orange); }
.clock { font: 500 14px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }

/* The page below: one reading column. */
.page { max-width: 44rem; margin: 0 auto; padding-inline: 16px; padding-block: clamp(40px, 7vw, 88px) 64px; display: grid; gap: clamp(48px, 8vw, 88px); }
.big { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(26px, 3.6vw, 38px); line-height: 1.25; text-wrap: balance; }
section p { margin: 0 0 1em; max-width: 65ch; }
h2 { margin: 6px 0 16px; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: clamp(32px, 4.4vw, 46px); line-height: 1.05; text-wrap: balance; }
.stamp { font: 500 13px/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.04em; color: var(--gold); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; display: inline-block; }
.stamp::before { content: "▶ "; font-size: 10px; }
.stamp:hover { border-color: var(--gold); }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0 28px; padding: 18px 0; border-block: 1px solid var(--line); }
.figures div { margin: 0; }
.figures dt { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.figures dd { margin: 4px 0 0; font: 500 clamp(17px, 2.4vw, 24px)/1.2 "JetBrains Mono", ui-monospace, monospace; color: var(--orange); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 520px) { .figures { grid-template-columns: 1fr 1fr; } }
.btn { font: 600 16px/1 "Figtree", system-ui, sans-serif; color: var(--ink); background: transparent; border: 1px solid var(--orange); border-radius: 999px; padding: 14px 22px; cursor: pointer; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.verify-out { margin: 18px 0 0; font: 14px/1.6 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
.verify-out .ok { color: #8fd694; }
.repo { font-weight: 600; }
.duel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
@media (max-width: 620px) { .duel { grid-template-columns: 1fr; } }
.side { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--panel); display: grid; gap: 12px; align-content: start; }
.side .btn { justify-self: start; }
.btn-orange { background: var(--orange); color: #140c02; border-color: var(--orange); }
.readout { margin: 0; font: 500 clamp(22px, 3vw, 30px)/1.1 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.side .note { margin: 0; font-size: 15px; color: var(--muted); }
.mined { list-style: none; margin: 0; padding: 0; display: block; font: 13px/1.5 "JetBrains Mono", ui-monospace, monospace; max-height: 240px; overflow-y: auto; }
.mined li + li { margin-top: 3px; }
.mined li { display: flex; gap: 10px; white-space: nowrap; min-height: 1.5em; }
.mined li > span:first-child { flex: none; min-width: 6ch; }
.mined .h { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.mined .z { color: var(--orange); }
.credits { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 20px; }
.credits p { margin: 0; max-width: 70ch; }

@media (prefers-reduced-motion: reduce) { .cover, .poster { transition: none; } }

body.capture { overflow: hidden; }
body.capture .stage { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; }
body.capture .cover, body.capture .ui, body.capture .page, body.capture .poster, body.capture .sim { display: none; }

/* But what about quantum?: The Construct, embedded from its own site. */
.quantum { max-width: 78rem; margin: 0 auto; padding-inline: 16px; padding-block: clamp(48px, 8vw, 96px); border-bottom: 1px solid var(--line); }
.quantum-head { max-width: 44rem; margin: 0 auto clamp(24px, 4vw, 40px); }
.quantum-head .kicker { margin: 0; }
.quantum-head h2 { margin-top: 4px; }
.quantum-frame { display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 560px; max-height: 85vh; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
@media (max-width: 600px) { .quantum-frame { margin-inline: -16px; width: calc(100% + 32px); border-radius: 0; border-inline: 0; } }
.quantum-foot { max-width: 44rem; margin: 16px auto 0; font-size: 14px; color: var(--muted); }
body.capture .quantum { display: none; }

/* The Sovereignty simulator: wider than the reading column. The scene stays in view while you move the controls. */
.sim { max-width: 78rem; margin: 0 auto; padding-inline: 16px; padding-block: clamp(48px, 8vw, 96px); border-block: 1px solid var(--line); }
.sim-head { max-width: 44rem; margin: 0 auto clamp(28px, 5vw, 48px); }
.sim-head .kicker { margin: 18px 0 0; }
.sim-head h2 { margin-top: 4px; }
.sim-head .byline { margin: -6px 0 18px; }
.sim-credit { color: var(--muted); font-size: 16px; }
.sim-grid { display: grid; gap: clamp(28px, 4vw, 52px); align-items: start; }
.sim-view { display: grid; gap: 16px; min-width: 0; }
.sim-controls { display: grid; gap: 34px; min-width: 0; }
@media (min-width: 960px) {
  .sim-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .sim-controls { order: 1; }
  .sim-view { order: 2; }
  .sim-grid.pinned .sim-view { position: sticky; top: 16px; }
  .sim-grid.pinned .sim-pin { display: none; }
}

.sim-scene { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(to bottom, #04050c 0%, #120b16 34%, #4a2214 49%, #0a0706 50%, #1e0f0b 56%, #050403 100%); }
.sim-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.8s ease; }
.sim-scene.ready canvas { opacity: 1; }
.sim-year { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; font: 500 clamp(56px, 11vw, 132px)/1 "Playfair Display", Georgia, serif; font-weight: 900; color: var(--gold); letter-spacing: 0.01em; transition: opacity 0.6s ease; pointer-events: none; }
.sim-scene.ready .sim-year { opacity: 0; }
@media (max-width: 600px) { .sim-scene { margin-inline: -16px; border-radius: 0; border-inline: 0; } }
.sim-verdict { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; text-wrap: balance; min-height: 2.4em; }
@media (max-width: 959px) { .sim-verdict { min-height: 3.6em; } }

.sim-chart { margin: 0; }
.sim-chart figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sim-chart figcaption span:last-child { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--orange); font-variant-numeric: tabular-nums; }
.chart-row { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 8px; padding-top: 6px; }
.c-yaxis { position: relative; font: 12px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); font-variant-numeric: tabular-nums; }
.c-ytick { position: absolute; right: 0; transform: translateY(-50%); }
.c-y1 { top: 0; } .c-y2 { top: 50%; } .c-y3 { top: 100%; }
.c-ytitle { position: absolute; left: 6px; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); white-space: nowrap; font: 600 10px/1 "Figtree", system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.chart-box { position: relative; height: clamp(84px, 11vw, 112px); border-bottom: 1px solid var(--track); }
.c-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.chart-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.c-area { fill: rgba(247, 147, 26, 0.16); }
.c-line { fill: none; stroke: var(--orange); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.c-free { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.c-free-label { position: absolute; top: -2px; font: 500 12px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--gold); white-space: nowrap; background: var(--bg); padding: 2px 4px; border-radius: 4px; }
.c-axis { position: relative; height: 18px; margin: 4px 0 0 58px; font: 12px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }
.c-axis span { position: absolute; top: 2px; left: 0; }
.c-axis span.c-mid { left: 50%; transform: translateX(-50%); }
.c-axis span:last-child { left: auto; right: 0; }

.sim-results { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; border-top: 1px solid var(--line); padding-top: 16px; }
@media (min-width: 560px) { .sim-results { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sim-results div { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.sim-results dt { font-size: 13px; line-height: 1.35; color: var(--muted); text-wrap: balance; }
.sim-results dd { margin: auto 0 0; padding-top: 4px; font: 500 clamp(18px, 1.8vw, 22px)/1.15 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Warning zone: numbers that should make you look twice turn red, with the reason listed under the results. */
.sim .warn, .sim output.warn, .sim-results dd.warn { color: var(--bad); }
.sim-warn { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sim-warn:empty { display: none; }
.sim-warn li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.45; color: var(--bad); }
.sim-warn li::before { content: "!"; position: absolute; left: 0; top: 0; width: 13px; height: 13px; margin-top: 2px; border-radius: 50%; background: var(--bad); color: var(--bg); font: 700 10px/13px "Figtree", system-ui, sans-serif; text-align: center; }
.sim-pin { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3; margin: 0 -16px -12px; padding: 10px 16px; display: flex; justify-content: space-between; gap: 12px;
  background: rgba(6, 5, 4, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.sim-pin b { font: 600 15px/1.3 "JetBrains Mono", ui-monospace, monospace; color: var(--orange); }

.sim fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.grp { display: grid; gap: 22px; }
.grp > legend { padding: 0; margin-bottom: 14px; font: 600 12px/1 "Figtree", system-ui, sans-serif; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.control { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 8px; column-gap: 12px; }
.control label { font-weight: 500; }
.control output, .field { font: 500 20px/1.2 "JetBrains Mono", ui-monospace, monospace; color: var(--orange); font-variant-numeric: tabular-nums; }
.sim .hint { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.sim .hint.warn { color: var(--ink); font-weight: 600; }
.field input { font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed var(--muted); border-radius: 0; width: 8ch; max-width: 14ch; padding: 0 0 0 2px; margin: 0; text-align: right; }
.field input.bad { color: var(--bad); border-bottom: 2px solid var(--bad); }
.field input:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.field input:disabled { color: var(--muted); border-bottom-color: transparent; }
.sim .link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; margin-left: 6px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }

.sim input[type=range] { grid-column: 1 / -1; width: 100%; -webkit-appearance: none; appearance: none; background: transparent; height: 28px; margin: 0; cursor: pointer; }
.sim input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--orange) var(--p, 50%), var(--track) var(--p, 50%)); }
.sim input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--track); }
.sim input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--orange); }
.sim input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9.5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--orange); box-shadow: 0 0 0 6px rgba(247, 147, 26, 0.14); }
.sim input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 2px solid var(--orange); }
.sim input[type=range]:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; border-radius: 4px; }

.seg { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg.n2 { --n: 2; } .seg.n3 { --n: 3; } .seg.n5 { --n: 5; }
.seg button { font: 500 15px/1.25 "Figtree", system-ui, sans-serif; color: var(--ink); background: transparent; border: 0; padding: 11px 6px; cursor: pointer; text-align: center; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg small { display: block; font-size: 13px; line-height: 1.2; color: var(--muted); }
.seg b { font: 600 clamp(15px, 1.7vw, 18px)/1 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--orange); color: #140c02; }
.seg button[aria-pressed="true"] small, .seg button[aria-pressed="true"] b { color: #140c02; }
.seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.seg button[aria-pressed="true"]:focus-visible { outline-color: #140c02; }
.seg.n5 button { padding: 10px 2px; }
@media (max-width: 480px) { .seg.n5 small { font-size: 12px; } .seg.n5 b { font-size: 14px; } }

.sim-adv, .asm, .sim-math { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
/* Saving in STRC: a "+" row like the simulator's other disclosures, set apart only by STRC's colour. */
.strc-save > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1ch minmax(0, 1fr); align-items: baseline; gap: 4px 12px; }
.strc-save > summary::-webkit-details-marker { display: none; }
.strc-save > summary::before { content: "+"; grid-row: 1 / span 2; font: 500 18px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--strc); }
.strc-save[open] > summary::before { content: "−"; }
.strc-save > summary > span { grid-column: 2; }
.strc-title { font-weight: 500; color: var(--strc); }
.strc-split { font: 13px/1.4 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }
.strc-split b { font-weight: 500; color: var(--orange); }
.strc-split b.s { color: var(--strc); }
.strc-save .control { padding-top: 18px; }
.strc-save output { color: var(--strc); }
.sim .strc-save input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--strc) var(--p, 50%), var(--track) var(--p, 50%)); }
.sim .strc-save input[type=range]::-moz-range-progress { background: var(--strc); }
.sim .strc-save input[type=range]::-webkit-slider-thumb { border-color: var(--strc); box-shadow: 0 0 0 6px rgba(159, 196, 182, 0.14); }
.sim .strc-save input[type=range]::-moz-range-thumb { border-color: var(--strc); }
.seg button.dd:not([aria-pressed="true"]) small { color: var(--strc); }
.seg button.dd[aria-pressed="true"] { background: linear-gradient(90deg, var(--orange) 50%, var(--strc) 50%); }
.sim-adv > summary, .asm > summary, .sim-math > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: grid; grid-template-columns: 1ch minmax(0, 1fr); align-items: baseline; gap: 2px 12px; font-weight: 600; }
.sim-adv > summary > span, .asm > summary > span { grid-column: 2; }
.sim-math > summary::-webkit-details-marker { display: none; }
.sim-math > summary::before { content: "+"; font: 500 18px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--orange); }
.sim-math[open] > summary::before { content: "−"; }
.sim-adv > summary::-webkit-details-marker, .asm > summary::-webkit-details-marker { display: none; }
.sim-adv > summary::before, .asm > summary::before { content: "+"; grid-row: 1 / span 2; font: 500 18px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--orange); }
.sim-adv[open] > summary::before, .asm[open] > summary::before { content: "−"; }
.adv-now { font-weight: 400; font-size: 14px; color: var(--muted); }
.adv-now::before { content: "Now: "; }
.adv-body { display: grid; gap: 20px; padding: 0 18px 20px; }
.panel { display: grid; gap: 20px; }
.panel > p:not(.hint) { margin: 0; font-size: 16px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); margin: 0; }

.asm-body { display: grid; gap: 28px; padding: 4px 18px 22px; }
@media (min-width: 640px) { .asm-body { grid-template-columns: 1fr 1fr; column-gap: 36px; } }
.asm-body fieldset { display: grid; gap: 10px; align-content: start; }
.asm-body legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.num { display: grid; grid-template-columns: 1fr auto 2.2em; align-items: center; column-gap: 10px; font-size: 15px; }
.num input { font: 15px/1.2 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; width: 5.6em; padding: 6px 8px; margin: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); text-align: right; }
.num input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.num i { font-style: normal; font-size: 14px; color: var(--muted); }
.asm-body .btn { justify-self: start; align-self: end; }

.sim-math { max-width: 60rem; margin: clamp(28px, 4vw, 44px) auto 0; }
.math-wrap { max-height: 420px; overflow: auto; margin: 0 18px; border-top: 1px solid var(--line); }
.sim-math table { width: 100%; border-collapse: collapse; font: 13px/1.4 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.sim-math th { position: sticky; top: 0; background: var(--panel); text-align: right; vertical-align: bottom; padding: 10px 8px; font: 600 12px/1.3 "Figtree", system-ui, sans-serif; color: var(--muted); }
.sim-math td { text-align: right; padding: 4px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.sim-math th:first-child, .sim-math td:first-child { text-align: left; }
.sim-math tr.free td { color: var(--orange); font-weight: 700; }
.sim-math tr.out td { color: var(--bad); font-weight: 700; }
.sim-math tr.work td { color: var(--muted); }
.sim-math td small { margin-left: 6px; font: 600 11px/1 "Figtree", system-ui, sans-serif; letter-spacing: 0.04em; }
.sim-math > .hint { padding: 12px 18px 18px; }
.sim-notes { max-width: 44rem; margin: clamp(36px, 5vw, 56px) auto 0; font-size: 14px; color: var(--muted); }
.sim-notes p { margin: 0 0 12px; }
/* Shorter laptop windows: a more compact view, so it can stay in view beside the controls. */
@media (min-width: 960px) and (max-height: 880px) {
  .sim-scene { aspect-ratio: 2 / 1; }
  .chart-box { height: 72px; }
  .sim-view { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { .sim-scene canvas, .sim-year { transition: none; } }
