/* Project page styles. Open editorial layout; light by default, dark via prefers-color-scheme. */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --fg: #14171c;
  --muted: #525965;
  --faint: #7c8490;
  --rule: #e3e6eb;
  --rule-strong: #c8ced8;
  --panel: #ffffff;
  --link: #1c57b0;
  --btn-bg: #14171c;
  --btn-fg: #ffffff;
  --code-bg: #f4f5f7;

  /* Palette shared with the paper figures and the canvas demos. */
  --ink: #243642;
  --navy-l: #7aaed8;
  --navy-m: #3f78b5;
  --navy-d: #1b3a66;
  --terra: #c4572e;
  --terra-l: #f0c3ab;
  --ochre: #cf9a30;
  --cell-off: #eef1f4;
  --grid: #d9dee3;

  --chart-dense: #c4572e;
  --chart-moe: #3f78b5;

  --maxw: 1160px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --bg-alt: #15181c;
    --fg: #eaedf1;
    --muted: #a1a8b3;
    --faint: #727984;
    --rule: #252a30;
    --rule-strong: #39404a;
    --panel: #101215;
    --link: #80b0ff;
    --btn-bg: #eaedf1;
    --btn-fg: #101215;
    --code-bg: #181c21;

    --ink: #dfe6ec;
    --navy-l: #4f7fae;
    --navy-m: #6fa3dc;
    --navy-d: #a9cbf0;
    --terra: #e0794f;
    --terra-l: #6b3a26;
    --ochre: #e0b050;
    --cell-off: #21262c;
    --grid: #2f353c;

    --chart-dense: #e0794f;
    --chart-moe: #5b93d1;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 62px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.62 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, canvas, svg { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre code { background: none; padding: 0; font-size: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* Navigation */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap { display: flex; align-items: center; height: 54px; gap: 22px; }
.nav .brand {
  font-weight: 650; font-size: 0.94rem; letter-spacing: -0.01em;
  color: var(--fg); margin-right: auto; white-space: nowrap;
}
.nav .brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 20px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav a.item { color: var(--muted); font-size: 0.88rem; white-space: nowrap; transition: color 0.12s; }
.nav a.item:hover { color: var(--fg); text-decoration: none; }

/* Hero */
.hero { padding: 54px 0 48px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(0, 1.04fr); gap: 48px; align-items: center; }
.eyebrow {
  font: 500 0.74rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-m);
  margin: 0 0 12px;
}
.hero .eyebrow { color: var(--muted); text-transform: none; letter-spacing: 0.01em; font-size: 0.8rem; }
.hero h1 {
  font-size: clamp(1.75rem, 2.35vw, 2.08rem);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.028em;
  text-wrap: balance;
  margin: 0 0 16px;
}
.hero .lede { font-size: 1.02rem; line-height: 1.62; color: var(--muted); margin: 0 0 20px; max-width: 54ch; }
.hero .byline { font-size: 0.92rem; margin: 0 0 24px; color: var(--fg); font-weight: 500; }
.hero .byline span { color: var(--muted); font-weight: 400; }

.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 7px; font-size: 0.9rem; font-weight: 550;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bg);
  transition: opacity 0.14s, border-color 0.14s;
}
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--rule-strong); }
.btn:hover { text-decoration: none; opacity: 0.84; }
.btn.ghost:hover { opacity: 1; border-color: var(--muted); }

/* Open hero video — no outer card frame */
.hero-figure { margin: 0; }
.hero-media { background: #000; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-figcap {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 0 0;
  font-size: 0.8rem; color: var(--muted);
}
.hero-figcap a { font-weight: 550; white-space: nowrap; }

.hero-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px;
  margin-top: 38px; padding-top: 24px; border-top: 1px solid var(--rule);
}
.hero-stat { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hero-stat .val { font: 650 1.25rem/1.1 var(--mono); color: var(--fg); font-variant-numeric: tabular-nums; }
.hero-stat .desc { font-size: 0.84rem; color: var(--muted); line-height: 1.38; }

/* Sections */
section.block { padding: 72px 0; border-bottom: 1px solid var(--rule); }
section.block:last-of-type { border-bottom: 0; }
section.block.alt { background: var(--bg-alt); }
section#demos { padding: 52px 0 68px; }

.head { max-width: 740px; margin: 0 0 34px; text-align: left; }
.head h2 {
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  font-weight: 680;
  letter-spacing: -0.022em;
  margin: 0 0 10px;
}
.head p { color: var(--muted); margin: 0; font-size: 0.98rem; line-height: 1.62; }
.head-row { margin: 0 0 24px; }
.head-row .head { margin: 0; }
.prose { max-width: 780px; }
.prose p { margin: 0 0 14px; }

/* Overview — open hairline columns */
.facts3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; }
.fact-card { border-top: 1px solid var(--rule-strong); padding: 18px 0 0; }
.fact-card .stat { font: 600 0.78rem/1 var(--mono); color: var(--navy-m); margin: 0 0 8px; }
.fact-card h3 { font-size: 1.02rem; font-weight: 650; margin: 0 0 8px; letter-spacing: -0.01em; }
.fact-card p { color: var(--muted); margin: 0; font-size: 0.93rem; line-height: 1.58; }

/* Demo tabs — open typographic bar with underline active indicator */
.tabs {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 28px;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 22px;
}
.tab-tray { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
.tab-tray .tab-group {
  font: 600 0.72rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-right: 10px;
  white-space: nowrap;
}
.tabs button {
  font: inherit; font-size: 0.89rem; font-weight: 500;
  padding: 6px 10px 10px; margin-bottom: -1px; cursor: pointer;
  border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted);
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--fg);
}

/* Open demo stage — no outer box, border, or shadow */
.panel { background: transparent; }
.panel-body { display: grid; grid-template-columns: minmax(0, 1.56fr) minmax(0, 1fr); gap: 28px; min-height: 420px; align-items: start; }
.stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 4px 0; min-width: 0;
}
.stage canvas { width: 100%; height: auto; }
.stream {
  border-left: 1px solid var(--rule);
  padding: 2px 0 2px 24px;
  overflow: auto;
  max-height: 540px;
  min-width: 0;
}
.stream .lbl {
  font: 600 0.72rem/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  margin: 0 0 6px;
}
.stream pre {
  margin: 0 0 16px;
  padding: 9px 11px;
  background: var(--code-bg);
  border-radius: 6px;
  font: 0.8rem/1.48 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--fg);
}
.stream pre .pending { color: var(--faint); opacity: 0.35; }
.stream pre .hl { background: color-mix(in srgb, var(--navy-l) 32%, transparent); border-radius: 3px; }
.stream pre .bad { color: var(--terra); font-weight: 600; }
.stream .note {
  font-size: 0.81rem; line-height: 1.54; color: var(--muted);
  margin: 0 0 10px;
}
.stream .note:last-child { margin-bottom: 0; }

.controls {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 0;
  margin-top: 14px;
  border-top: 1px solid var(--rule);
}
.controls .play,
.controls .step-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--rule-strong);
  background: transparent; color: var(--fg); cursor: pointer;
  display: grid; place-items: center; flex: none;
  font: 600 0.95rem/1 var(--font);
  transition: background 0.12s, border-color 0.12s;
}
.controls .play { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.controls .play:hover { opacity: 0.85; }
.controls .step-btn:hover { background: var(--bg-alt); border-color: var(--muted); }
.controls .play svg { width: 12px; height: 12px; }
.controls input[type="range"] { flex: 1; accent-color: var(--navy-m); min-width: 60px; cursor: pointer; }
.controls .step { font: 0.8rem var(--mono); color: var(--muted); min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.controls select {
  font: inherit; font-size: 0.85rem; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--rule-strong); background: var(--bg); color: var(--fg); max-width: 280px;
  cursor: pointer;
}
.demo-caption {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.58;
  max-width: 90ch;
}
.demo-caption b { color: var(--fg); font-weight: 600; }

/* Capabilities — open 2-column hairline grid */
.caps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 52px; row-gap: 0; }
.cap {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--rule);
  padding: 20px 0 24px;
}
.cap-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; }
.cap h3 { font-size: 1.04rem; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.cap .meta { font: 500 0.76rem/1.2 var(--mono); color: var(--faint); margin: 0; }
.cap p.cap-body { color: var(--muted); font-size: 0.93rem; line-height: 1.58; margin: 0 0 12px; flex: 1; }
.cap-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.84rem;
}
.cap-metric { font: 550 0.81rem/1.35 var(--mono); color: var(--fg); }
.cap .open-demo { white-space: nowrap; font-size: 0.85rem; font-weight: 550; }

/* Explainer / Method — open canvas */
.explain { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr); gap: 44px; align-items: start; }
.figure-card { background: transparent; padding: 0; }
ol.walk { list-style: none; margin: 0; padding: 0; }
ol.walk li { border-top: 1px solid var(--rule); }
ol.walk li:last-child { border-bottom: 1px solid var(--rule); }
ol.walk button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; font-size: 0.96rem; font-weight: 550; color: var(--muted);
  background: none; border: 0; border-left: 2px solid transparent;
  padding: 12px 6px 12px 10px; cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
ol.walk button:hover { color: var(--fg); }
ol.walk button span {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 600 0.74rem/1 var(--mono); border: 1px solid var(--rule-strong); color: var(--muted);
}
ol.walk button[aria-selected="true"] { color: var(--fg); border-left-color: var(--navy-m); }
ol.walk button[aria-selected="true"] span { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
ol.walk .walk-body p { margin: 2px 6px 16px 46px; color: var(--muted); font-size: 0.92rem; line-height: 1.58; }

.section-demo { margin-top: 44px; padding-top: 32px; border-top: 1px solid var(--rule); }
h3.sub { font-size: 1.12rem; font-weight: 650; letter-spacing: -0.015em; margin: 40px 0 12px; }
.section-demo h3.sub { margin-top: 0; margin-bottom: 16px; }
.note-p { color: var(--muted); font-size: 0.94rem; margin: 0 0 14px; line-height: 1.58; max-width: 78ch; }

/* Results chart & booktabs table — open on the section canvas */
.chart-card { max-width: 960px; }
.chart-legend { display: flex; gap: 22px; flex-wrap: wrap; font-size: 0.86rem; color: var(--muted); margin: 0 0 14px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; }
.chart-legend .dense i { background: var(--chart-dense); border-radius: 50%; }
.chart-legend .moe i { background: var(--chart-moe); transform: rotate(45deg) scale(0.85); }
#results-chart { position: relative; width: 100%; }
#results-chart svg { display: block; overflow: visible; font-family: var(--font); }
#results-chart .grid { stroke: var(--rule); stroke-width: 1; }
#results-chart .zero { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
#results-chart .sep { stroke: var(--rule); }
#results-chart .row { font-size: 13px; fill: var(--fg); }
#results-chart .tick, #results-chart .axis { font-size: 11.5px; fill: var(--muted); }
#results-chart .direct { font-size: 12px; fill: var(--muted); }
#results-chart .ci { stroke-width: 1.5; stroke-linecap: round; opacity: 0.55; }
#results-chart .dense .ci { stroke: var(--chart-dense); } #results-chart .dense .mark { fill: var(--chart-dense); }
#results-chart .moe .ci { stroke: var(--chart-moe); } #results-chart .moe .mark { fill: var(--chart-moe); }
#results-chart .mark { stroke: var(--bg-alt); stroke-width: 2; paint-order: stroke; }
#results-chart .pt.on .ci { opacity: 1; stroke-width: 2.5; }
#results-chart .hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--rule-strong);
  border-radius: 6px; padding: 7px 10px; font-size: 0.8rem; line-height: 1.45;
  white-space: nowrap; z-index: 2;
}
.chart-tip span { color: var(--muted); }

details.more { margin: 26px 0 0; max-width: 960px; }
details.more summary {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; color: var(--fg); font-size: 0.9rem; font-weight: 550;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule-strong);
  list-style: none;
}
details.more summary:hover { border-bottom-color: var(--fg); }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "▸"; font-size: 0.8rem; color: var(--muted); }
details.more[open] summary::after { content: "▾"; }
details.more[open] summary { margin-bottom: 14px; }

.table-wrap { overflow-x: auto; }
table.results {
  width: 100%; border-collapse: collapse; font-size: 0.91rem;
  border-top: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg);
}
table.results th, table.results td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.results thead th {
  font: 600 0.75rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border-bottom: 1px solid var(--rule-strong);
}
table.results tbody tr:last-child td { border-bottom: 0; }
table.results td.num { font-family: var(--mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-note { color: var(--muted); font-size: 0.86rem; line-height: 1.56; margin-top: 12px; max-width: 86ch; }

/* Audit / Limitations — open 2-column hairline grid */
.findings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 52px; row-gap: 0; margin-bottom: 24px; }
.finding-card { border-top: 1px solid var(--rule); padding: 18px 0 22px; }
.finding-card h3 { font-size: 0.98rem; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.01em; }
.finding-card p { color: var(--muted); font-size: 0.92rem; line-height: 1.58; margin: 0; }

.cli-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 14px; }
.cli-card { display: flex; flex-direction: column; gap: 8px; }
.cli-card .cli-label { font-size: 0.87rem; color: var(--muted); margin: 0; line-height: 1.5; }

.bib { position: relative; }
.bib pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 14px 66px 14px 16px;
  margin: 0;
  overflow-x: auto;
  font: 0.81rem/1.52 var(--mono);
  color: var(--fg);
}
.copy {
  position: absolute; top: 9px; right: 9px;
  font: 500 0.76rem/1 var(--font);
  padding: 5px 10px; border-radius: 5px;
  border: 1px solid var(--rule-strong); background: var(--bg); color: var(--fg); cursor: pointer;
}
.copy:hover { border-color: var(--muted); }

/* Paper section */
.paper-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 40px; align-items: start; }
.paper-info p { color: var(--muted); font-size: 0.94rem; line-height: 1.62; margin: 16px 0 0; }

footer { border-top: 1px solid var(--rule); padding: 24px 0 36px; color: var(--muted); font-size: 0.85rem; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }

/* Game engine readout (js/demo-doom.js) */
.gs { font-size: 0.85rem; margin: 0 0 16px; }
.gs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; }
.gs-tick { font-weight: 650; font-size: 0.98rem; }
.gs-model { color: var(--faint); font: 0.76rem var(--mono); }
.gs-key { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.gs kbd {
  font: 600 0.76rem var(--mono); min-width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0 5px;
  border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--fg); background: var(--bg);
}
.gs-ev { padding: 2px 8px; border-radius: 999px; background: var(--cell-off); color: var(--muted); font-size: 0.78rem; }
.gs-ev.ok { background: color-mix(in srgb, var(--navy-l) 30%, transparent); color: var(--fg); }
.gs-ev.warn { background: color-mix(in srgb, var(--terra) 22%, transparent); color: var(--fg); }
.gs-match { margin-left: auto; font: 500 0.76rem var(--mono); color: var(--faint); }
.gs-match.bad { color: var(--terra); }
.gs-bars > div, .gs-en { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; margin: 0 0 6px; }
.gs-bars span:first-child, .gs-en span:first-child { color: var(--muted); }
.gs-bars b { font: 500 0.8rem var(--mono); color: var(--fg); }
.gs .pips { display: flex; gap: 3px; }
.gs .pips i { display: block; width: 14px; height: 9px; border-radius: 2px; background: var(--cell-off); }
.gs .pips i.h { background: var(--navy-m); }
.gs .pips i.a { background: var(--ochre); }
.gs .pips i.e { background: var(--terra); }
.gs-en .pos { font: 0.78rem var(--mono); color: var(--muted); }
.gs-en.dead span:first-child { text-decoration: line-through; color: var(--faint); }
.gs-where { color: var(--muted); font-size: 0.81rem; margin: 6px 0 10px; }
.gs-sub { font: 600 0.72rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); margin: 12px 0 6px; }
.gs-sub span { margin-left: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.gs-tl { display: flex; flex-wrap: wrap; gap: 3px; }
.gs-tl span {
  width: 19px; height: 19px; border-radius: 4px; display: grid; place-items: center;
  font: 600 0.66rem var(--mono); color: var(--btn-fg); background: var(--navy-m);
}
.gs-tl span.bad { background: var(--terra); }
.gs-tl span.future { background: var(--cell-off); color: var(--faint); }
.gs-tl span.cur { outline: 2px solid var(--fg); outline-offset: 1px; }

/* Record mode: the demo stage alone at a fixed size. */
body.record { background: var(--panel); }
body.record .panel { border: 0; border-radius: 0; }
body.record .controls { display: none; }
body.record .panel-body { height: auto; gap: 0; }
body.record .stage { padding: 22px; }
body.record .stream { max-height: none; padding: 18px 20px; }
body.record .stage canvas { width: auto; max-width: 100%; max-height: calc(100vh - 44px); }
body.record .rec-title {
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
  padding: 18px 28px 0; font-size: 16px; font-weight: 600; color: var(--fg);
}
body.record .rec-title span:last-child { font-size: 13px; font-weight: 400; color: var(--faint); }
body.record.titled .stage canvas { max-height: calc(100vh - 88px); }

@media (max-width: 1040px) {
  .tabs { justify-content: flex-start; gap: 6px 24px; }
  .tab-tray { width: 100%; }
}

@media (max-width: 900px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 34px 0 36px; }
  .hero-grid, .explain, .paper-grid, .cli-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-stats, .facts3, .caps, .findings-grid { grid-template-columns: 1fr; gap: 16px; }
  .panel-body { grid-template-columns: 1fr; gap: 16px; min-height: 0; }
  .stream { border-left: 0; border-top: 1px solid var(--rule); padding: 16px 0 0; max-height: 300px; }
  .controls { flex-wrap: wrap; }
  .controls select { flex-basis: 100%; max-width: none; }
  section.block, section#demos { padding: 48px 0; }
  .nav .wrap { gap: 14px; }
  .nav-links { gap: 14px; }
  .tab-tray .tab-group { flex-basis: 100%; margin: 6px 0 2px; }
}

@media (max-width: 560px) {
  .tabs { border-bottom: 0; gap: 10px; }
  .tab-tray {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px;
    border-bottom: 1px solid var(--rule); padding-bottom: 4px;
  }
  .tab-tray .tab-group { grid-column: 1 / -1; }
  .tabs button { text-align: left; padding: 6px 2px 8px; font-size: 0.85rem; }
}
