/* ════════════════════════════════════════════
   demo.css — Beyond Model Weights demo
   Tokens copied from ../../css/style.css (main site) so the theme carries over.
════════════════════════════════════════════ */

:root {
  --stone: #AD9F94;
  --bg: #f4f2ef; --surface: #ffffff; --surface-2: #f9f8f6; --border: #E6E6E6;
  --text: #595959; --muted: #757575;
  --accent: #3AABD2; --accent-lt: #ddf0f9; --accent-bd: #a8dcf0;
  --radius: 8px; --shadow: 0 1px 14px rgba(89,89,89,0.09);

  /* chart roles */
  --m-llada: #2f8fb3; --m-llada15: #c08a2a; --m-dream: #d14848;     /* models */
  --t-lr: #8B6FC9; --t-js: #0f8f6a; --t-var: #cf7417;                 /* fairness terms */
  --grid: #ebe8e4; --axis: #d6d2cd; --ink: #3f3f3f; --fig-bg: #ffffff;
  --q-red: #c83c3c;                                                   /* answers / key question */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1a1917; --surface: #242220; --surface-2: #2c2a27; --border: #3a3835;
  --text: #d8d4cf; --muted: #948e88;
  --accent: #4bbde0; --accent-lt: #172f3a; --accent-bd: #2a5a70;
  --shadow: 0 1px 14px rgba(0,0,0,0.35); --stone: #c0b4ab;
  --m-llada: #3a9cc4; --m-llada15: #ba8a2c; --m-dream: #cc4646;
  --t-lr: #9480d8; --t-js: #1f9a70; --t-var: #c97a22;
  --grid: #34312e; --axis: #4a4642; --ink: #ece8e3; --fig-bg: #f4f2ef;
  --q-red: #f07a72;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #1a1917; --surface: #242220; --surface-2: #2c2a27; --border: #3a3835;
    --text: #d8d4cf; --muted: #948e88;
    --accent: #4bbde0; --accent-lt: #172f3a; --accent-bd: #2a5a70;
    --shadow: 0 1px 14px rgba(0,0,0,0.35); --stone: #c0b4ab;
    --m-llada: #3a9cc4; --m-llada15: #ba8a2c; --m-dream: #cc4646;
    --t-lr: #9480d8; --t-js: #1f9a70; --t-var: #c97a22;
    --grid: #34312e; --axis: #4a4642; --ink: #ece8e3; --fig-bg: #f4f2ef;
    --q-red: #f07a72;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Noto Sans JP', system-ui, sans-serif; font-weight: 400; line-height: 1.75; font-size: 15px;
  transition: background 0.25s, color 0.25s; overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
math { font-size: 1.08em; color: var(--ink); }

/* ── Fixed controls: language pill + theme toggle ── */
.fixed-controls { position: fixed; top: 14px; right: 16px; z-index: 300; display: flex; align-items: center; gap: 8px; }
.lang-switch { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.lang-btn { font: inherit; padding: 5px 12px; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); background: none; border: 0; border-radius: 18px; cursor: pointer; line-height: 1.4; transition: background 0.15s, color 0.15s; }
.lang-btn:hover { color: var(--text); background: var(--surface-2); }
.lang-btn.active { background: var(--accent); color: #fff; }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-size: 15px; transition: transform 0.15s; }
.theme-toggle:hover { transform: scale(1.08); }

/* ── Page ── */
.page { max-width: 1000px; margin: 0 auto; padding: 48px 24px 44px; display: flex; flex-direction: column; gap: 24px; }

/* ── Hero ── */
.hero { text-align: center; padding: 8px 0 0; animation: fadeUp 0.42s ease both; }
.back-link { display: inline-block; font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.kicker { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--stone); }
.title { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; color: var(--ink); font-size: clamp(26px, 4.2vw, 40px); line-height: 1.18; margin: 10px auto 14px; max-width: 860px; }
.authors { font-size: 16px; color: var(--ink); }
.authors a { color: inherit; border-bottom: 1px solid var(--accent-bd); }
.authors a:hover { text-decoration: none; border-bottom-color: var(--accent); }
.authors sup, .affils sup { font-size: 0.7em; color: var(--muted); }
.affils { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0; }
.pill { display: inline-flex; align-items: center; font-size: 13px; color: var(--accent); background: var(--accent-lt); border: 1px solid var(--accent-bd); border-radius: 20px; padding: 4px 16px; transition: background 0.13s, color 0.13s; }
.pill:hover { background: var(--accent); color: #fff; text-decoration: none; }
.hook { font-family: 'DM Serif Display', Georgia, serif; font-style: italic; font-size: clamp(17px, 2.1vw, 19.5px); color: var(--ink); max-width: 760px; margin: 0 auto; line-height: 1.55; }

/* ── Blocks ── */
.block { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 28px 22px; animation: fadeUp 0.42s ease both; transition: background 0.25s, border-color 0.25s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(13px); } to { opacity: 1; transform: none; } }
.block-title { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; font-size: 23px; color: var(--ink); line-height: 1.3; border-left: 4px solid var(--stone); margin: 0 0 10px -28px; padding-left: 24px; }
:root[lang="ja"] .block-title { font-family: 'Noto Sans JP', sans-serif; font-weight: 700; }
:root[lang="ja"] #bibtex-h { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }
.lede { margin-bottom: 12px; font-size: 14.5px; }
.src { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* ── TL;DR ── */
.findings { display: grid; grid-template-columns: 1fr; gap: 10px; }
.finding { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 18px 12px 14px; }
.finding-n { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--stone); line-height: 1.6; padding-top: 1px; }
.finding .q { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.finding .a { font-size: 17.5px; font-weight: 700; color: var(--q-red); line-height: 1.45; margin: 1px 0 4px; }
@media (min-width: 1000px) { .finding .q, .finding .a { white-space: nowrap; } }
.finding .d { font-size: 13.5px; line-height: 1.7; }
.q-red { color: var(--q-red); font-weight: 700; }

/* ── Preliminary ── */
.mech { max-width: 820px; margin: 0 auto; }
.mech-img { background: var(--fig-bg); border-radius: 6px; padding: 10px; border: 1px solid var(--border); }
.mech-img img { display: block; width: 100%; height: auto; }
.mech .src { text-align: right; margin-top: 4px; }
.prelim-lede { margin: 6px 0 0; }
.knobs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.knobs > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px 12px; }
.knobs dt { font-weight: 700; color: var(--ink); font-size: 14px; }
.knobs dd { font-size: 13.5px; line-height: 1.6; }

/* ── Controls ── */
.controls.controls-strip { margin: 26px 0 10px; }
.ctl.ctl-inline { flex-direction: row; align-items: center; gap: 10px; }
.ctl-inline .ctl-label { white-space: nowrap; min-width: 46px; }
.btn-sweep { font: inherit; font-size: 16px; font-weight: 500; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 14px; padding: 10px 26px; cursor: pointer; transition: filter 0.13s; white-space: nowrap; }
.btn-sweep:hover { filter: brightness(1.08); }
.btn-sweep[aria-pressed="true"] { background: var(--surface); color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: flex-end; justify-content: flex-start; margin: 0 0 14px; }
/* Demo 1 controls: two rows on a shared column grid, sweep button on the right spanning both rows */
.controls-grid { display: grid; grid-template-columns: 230px 136px 216px 1fr; gap: 14px 28px; align-items: start; }
.c-state { grid-column: 1 / span 2; grid-row: 1; }
.c-metric { grid-column: 3; grid-row: 1; }
.c-rk { grid-column: 1; grid-row: 2; }
.c-b { grid-column: 2; grid-row: 2; }
.c-tps { grid-column: 3; grid-row: 2; }
.controls-grid .btn-sweep { grid-column: 4; grid-row: 1 / span 2; justify-self: end; align-self: stretch; width: 210px; }
.controls-tight { margin-bottom: 10px; }
.ctl { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ctl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ctl-label { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
:root[lang="ja"] .ctl-label { font-family: 'Noto Sans JP', sans-serif; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; background: var(--surface-2); }
.seg button { font: inherit; font-size: 13px; color: var(--text); background: none; border: 0; padding: 4px 13px; cursor: pointer; transition: background 0.13s, color 0.13s; min-width: 36px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--accent-lt); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; }
.sel { font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 28px 4px 12px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; max-width: 100%; }
.sel:disabled { opacity: 0.45; cursor: default; }

/* ── Viz cards ── */
.viz-card, .strip-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 12px; }
.strip-card { margin-top: 12px; }
.viz-title { font-weight: 700; color: var(--ink); font-size: 14px; }

/* podium + bars */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: end; }
.pod-title { margin-bottom: 6px; line-height: 1.45; }
.pod-sub { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.podium { position: relative; height: 150px; }
.pod { position: absolute; left: 0; bottom: 0; display: flex; flex-direction: column; align-items: stretch; transition: transform 0.55s cubic-bezier(.3,.7,.2,1); }
.pod-label { text-align: center; padding-bottom: 6px; }
.pod-name { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.pod-name i { width: 9px; height: 9px; border-radius: 2px; background: var(--mc); flex: none; }
.pod-val { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.pod.first .pod-val { font-size: 22px; }
.pod-step { background: color-mix(in srgb, var(--mc) 18%, var(--surface)); border-top: 4px solid var(--mc); border-radius: 4px 4px 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; transition: height 0.55s cubic-bezier(.3,.7,.2,1); }
.pod-rank { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--ink); }
.pod.first .pod-rank { font-weight: 700; }
.pod-cap { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 4px; border-top: 1px solid var(--axis); padding-top: 3px; min-height: 22px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.brow { display: grid; grid-template-columns: 92px 1fr 48px; align-items: center; gap: 10px; padding: 2px 0; border-radius: 6px; cursor: default; }
.brow:hover, .brow:focus-visible { background: color-mix(in srgb, var(--accent-lt) 55%, transparent); }
.bname { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); min-width: 0; white-space: nowrap; }
.bname i { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--mc); }
.track { position: relative; height: 24px; }
.gridlayer { position: absolute; inset: 0; pointer-events: none; }
.gridline { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--grid); }
.gridline.zero { background: color-mix(in srgb, var(--ink) 55%, transparent); width: 1.5px; margin-left: -0.25px; }
.bfair { position: relative; height: 14px; margin-bottom: 10px; }
.bfair span { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--ink); line-height: 1; white-space: nowrap; }
.bfair .bf-biased { left: 100%; }
.bar { position: absolute; top: 50%; height: 14px; margin-top: -7px; background: var(--mc); transition: left 0.5s cubic-bezier(.3,.7,.2,1), width 0.5s cubic-bezier(.3,.7,.2,1); }
.bar.pos { border-radius: 0 4px 4px 0; }
.bar.neg { border-radius: 4px 0 0 4px; }
.bar.clamp.pos::after { content: '›'; position: absolute; right: -10px; top: -7px; font-size: 16px; color: var(--muted); }
.bar.clamp.neg::after { content: '‹'; position: absolute; left: -10px; top: -7px; font-size: 16px; color: var(--muted); }
.bval { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.axis { position: relative; height: 18px; margin-top: 4px; }
.axis .tick { position: absolute; transform: translateX(-50%); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* formula toggle */
.formula { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.formula summary { cursor: pointer; font-size: 12.5px; color: var(--muted); width: fit-content; }
.formula-card { margin-top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 16px 12px; }
.math-row { display: flex; flex-wrap: wrap; gap: 4px 36px; justify-content: center; margin-bottom: 6px; }
.math-row math { margin: 4px 0; }
.formula-card p { font-size: 13px; line-height: 1.6; }

/* strip */
.strip-head { margin-bottom: 10px; }
.strip { display: grid; grid-template-columns: 74px repeat(4, minmax(0, 1fr)); gap: 4px 10px; align-items: center; }
.strip .hdr { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); text-align: center; }
.strip .rlab { font-size: 12px; color: var(--muted); line-height: 1.2; }
.cg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.cg.hdr { font-size: 10px; }
.cell { position: relative; height: 36px; border-radius: 4px; border: 0; padding: 0; font: inherit; cursor: pointer; background: var(--surface); color: var(--ink);
  font-family: 'JetBrains Mono', monospace; font-size: 12px; box-shadow: inset 0 0 0 1px var(--border); transition: background 0.3s, box-shadow 0.2s; }
.cell:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.cell.cur { box-shadow: 0 0 0 2px var(--ink); z-index: 1; }
.cell.on-dark { color: #fff; }
.cin { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; line-height: 1.05; }
.full + .short { display: none; }
.answer { margin-top: 10px; font-size: 16.5px; font-weight: 700; color: var(--q-red); line-height: 1.45; }
.strip-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.strip-legend .sw { display: inline-block; width: 16px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; box-shadow: inset 0 0 0 1px var(--border); }
.live { margin-top: 2px; font-size: 14px; color: var(--ink); line-height: 1.6; }

/* ranges */
.range-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; align-items: center; }
.range-legend .k { display: inline-flex; align-items: center; gap: 6px; }
.range-legend .kb { display: inline-block; width: 18px; height: 6px; border-radius: 3px; }
.range-legend .kd { display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); background: var(--ink); }
.range-legend .kd.out { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.range-legend .kl { display: inline-block; width: 0; height: 14px; border-left: 1.5px dashed var(--muted); }
.rhead, .rrow, .raxis { display: grid; grid-template-columns: 160px 1fr 52px; gap: 12px; }
.rhead { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
:root[lang="ja"] .rhead { font-family: 'Noto Sans JP', sans-serif; }
.rhead span:last-child { text-align: right; }
.rrow { align-items: center; padding: 1px 0; border-radius: 6px; }
.rrow.fam { margin-top: 6px; }
.rname { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; border-radius: 4px; padding: 0 4px; margin-left: -4px; width: fit-content; max-width: 100%;
  text-decoration: underline dotted var(--axis); text-underline-offset: 3px; }
.rname:hover, .rname:focus-visible { background: color-mix(in srgb, var(--accent-lt) 70%, transparent); }
.rname.base { font-weight: 700; }
.rtrack { position: relative; height: 22px; }
.rgrid { position: absolute; inset: 0; pointer-events: none; }
.rgrid .gridline { top: 0; bottom: 0; }
.rbar { position: absolute; height: 6px; border-radius: 3px; background: var(--mc); min-width: 3px; transition: left 0.45s ease, width 0.45s ease; }
.rbar.c { top: 3px; }
.rbar.r { top: 13px; background: color-mix(in srgb, var(--mc) 45%, var(--surface-2)); }
.rdef { position: absolute; top: 6px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg); background: var(--ink); box-shadow: 0 0 0 2px var(--surface-2); transition: left 0.45s ease; }
.rdef.out { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 2px var(--surface-2); }
.rbase { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--muted); }
.rspan { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; line-height: 10px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-direction: column; }

/* utility scatter grid */
.sc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; align-items: center; }
.sc-legend .k { display: inline-flex; align-items: center; gap: 5px; }
.sc-legend .kc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.sc-legend .sep { color: var(--axis); }
.sc-grid { display: grid; grid-template-columns: 18px 88px repeat(3, minmax(0, 1fr)); gap: 2px 10px; align-items: center; }
.sc-corner { grid-column: 1 / span 2; }
.sc-ytitle { grid-column: 1; grid-row: 2 / span 3; align-self: stretch; position: relative; min-width: 0; }
.sc-ytitle span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--ink); }
.sc-col { text-align: center; font-size: 13.5px; font-weight: 700; color: var(--ink); padding-left: 24px; }
.sc-row { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.sc-row i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.sc-cell { min-width: 0; }
.sc-cell svg { display: block; overflow: visible; }
.sc-gl { stroke: var(--grid); stroke-width: 1; }
.sc-axis { stroke: color-mix(in srgb, var(--ink) 60%, transparent); stroke-width: 1.2; }
.sc-ref { stroke: var(--axis); stroke-width: 1.2; }
.sc-tick { font-family: 'JetBrains Mono', monospace; font-size: 11px; fill: var(--text); }
.sc-sig { font-size: 11px; fill: var(--ink); }
.sc-pt { cursor: default; outline: none; }
.sc-pt:hover path, .sc-pt:focus-visible path { stroke: var(--ink); stroke-width: 2; }
.sc-xlab { grid-column: 3 / -1; text-align: center; font-size: 12px; font-weight: 500; color: var(--ink); margin-top: 2px; }

/* bibtex */
.bib-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.bib-head .block-title { margin-bottom: 0; }
.bib pre { font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.6; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; }
.copy-btn { flex: none; font: inherit; font-size: 12px; color: var(--accent); background: var(--accent-lt); border: 1px solid var(--accent-bd); border-radius: 4px; padding: 2px 10px; cursor: pointer; }
.copy-btn:hover { background: var(--accent); color: #fff; }

/* tooltip */
.tip { position: fixed; z-index: 400; pointer-events: none; max-width: 300px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 18px rgba(0,0,0,0.16); padding: 8px 11px; font-size: 12px; line-height: 1.5; }
.tip.tip-wide { max-width: min(420px, calc(100vw - 16px)); }
.tip .tv { font-size: 13.5px; color: var(--ink); font-weight: 700; }
.tip .tl { color: var(--muted); }
.tip .tw { margin-top: 4px; color: var(--ink); }
.tip .tmath { margin: 6px 0 4px; overflow: hidden; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .duo { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 768px) {
  .fixed-controls { top: 10px; right: 10px; }
  .page { padding: 56px 16px 22px; gap: 18px; }
  .block { padding: 16px 16px 18px; }
  .block-title { margin-left: -16px; padding-left: 12px; font-size: 21px; }
  .viz-card, .strip-card { padding: 12px 10px; }
  .knobs { grid-template-columns: 1fr; gap: 8px; }
  .podium { height: 140px; }
  .pod-name { font-size: 11.5px; gap: 4px; }
  .pod-val { font-size: 16px; } .pod.first .pod-val { font-size: 19px; }
  .brow { grid-template-columns: 76px 1fr 44px; gap: 6px; }
  .bname { font-size: 12px; gap: 5px; }
  .strip { grid-template-columns: 44px repeat(4, minmax(0, 1fr)); gap: 3px 5px; }
  .strip .rlab { font-size: 10.5px; }
  .cell { height: 32px; font-size: 11px; }
  .full + .short { display: inline; }
  .full { display: none; }
  .rhead, .rrow, .raxis { grid-template-columns: 112px 1fr 34px; gap: 6px; }
  .rname { font-size: 11.5px; }
  .rname .short.sub { padding-left: 8px; }
  .rspan { font-size: 9.5px; }
  .range-legend { font-size: 11.5px; gap: 4px 12px; }
  .sc-grid { grid-template-columns: 14px repeat(3, minmax(0, 1fr)); gap: 2px 6px; }
  .sc-corner { grid-column: 1; }
  .sc-ytitle { grid-row: 2 / span 6; }
  .sc-ytitle span { font-size: 11px; }
  .sc-row { grid-column: 2 / -1; margin-top: 6px; }
  .sc-xlab { grid-column: 2 / -1; font-size: 11px; }
  .finding { padding: 10px 12px 12px 10px; grid-template-columns: 16px minmax(0, 1fr); }
  .finding .q { font-size: 14px; }
  .finding .a { font-size: 16px; }
  .sc-legend { font-size: 11.5px; gap: 3px 10px; }
  .sc-col { font-size: 12px; padding-left: 14px; }
  .sc-tick { font-size: 10px; }
  .seg button { padding: 4px 10px; font-size: 12.5px; }
  .controls-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .controls-grid > * { grid-column: 1; grid-row: auto; }
  .controls-grid .btn-sweep { grid-column: 1; grid-row: auto; justify-self: stretch; width: auto; padding: 10px 16px; }
  .bib pre { font-size: 10.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
