/* extract-bench site. One stylesheet. Colors are tokens on :root, dark mode selected not flipped. */

:root {
  color-scheme: light;
  --paper: #f8f4ea;
  --paper-2: #f0eadc;
  --paper-3: #e8e0ce;
  --ink: #1d1b17;
  --ink-2: #48433a;
  --muted: #655e52;
  --rule: #ddd5c4;
  --rule-strong: #b4aa95;
  --accent: #a3361f;
  --accent-wash: rgba(163, 54, 31, 0.08);
  --focus: #1c5cab;

  /* series: validated with the dataviz validator, all pairs, light surface */
  --s-read: #2a6db5;
  --s-traf: #1b9a7a;
  --s-jus: #c2452d;
  --s-other: #8a8273;

  /* viewer line classes */
  --kept-bg: rgba(46, 125, 79, 0.13);
  --kept-bar: #2e7d4f;
  --leak-bg: rgba(194, 69, 45, 0.14);
  --leak-bar: #b23a22;
  --extra-bg: rgba(110, 102, 88, 0.11);
  --extra-bar: #8a8273;
  --drop-bg: rgba(201, 144, 0, 0.16);
  --drop-bar: #9a6a00;

  /* sequential ramp for the heatmap: one hue, light to dark */
  --seq-lo: #f6f1e5;
  --seq-hi: #c39a55;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --measure: 40rem;
  --side: 15.5rem;
  --gap: 2.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1a1813;
    --paper-2: #23201a;
    --paper-3: #2c2821;
    --ink: #ece6d8;
    --ink-2: #c9c1b0;
    --muted: #a39a88;
    --rule: #37322a;
    --rule-strong: #575044;
    --accent: #e8836a;
    --accent-wash: rgba(232, 131, 106, 0.10);
    --focus: #7fb0ec;
    --s-read: #5191dc;
    --s-traf: #1fa883;
    --s-jus: #e0603f;
    --s-other: #857e70;
    --kept-bg: rgba(76, 175, 110, 0.16);
    --kept-bar: #5cbf82;
    --leak-bg: rgba(224, 96, 63, 0.20);
    --leak-bar: #ef7a5c;
    --extra-bg: rgba(200, 190, 170, 0.09);
    --extra-bar: #8f8878;
    --drop-bg: rgba(214, 160, 40, 0.18);
    --drop-bar: #d6a028;
    --seq-lo: #201e19;
    --seq-hi: #7a5e2c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1813;
  --paper-2: #23201a;
  --paper-3: #2c2821;
  --ink: #ece6d8;
  --ink-2: #c9c1b0;
  --muted: #a39a88;
  --rule: #37322a;
  --rule-strong: #575044;
  --accent: #e8836a;
  --accent-wash: rgba(232, 131, 106, 0.10);
  --focus: #7fb0ec;
  --s-read: #5191dc;
  --s-traf: #1fa883;
  --s-jus: #e0603f;
  --s-other: #857e70;
  --kept-bg: rgba(76, 175, 110, 0.16);
  --kept-bar: #5cbf82;
  --leak-bg: rgba(224, 96, 63, 0.20);
  --leak-bar: #ef7a5c;
  --extra-bg: rgba(200, 190, 170, 0.09);
  --extra-bar: #8f8878;
  --drop-bg: rgba(214, 160, 40, 0.18);
  --drop-bar: #d6a028;
  --seq-lo: #201e19;
  --seq-hi: #7a5e2c;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
}

/* faint paper grain: a quiet texture, not decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.25 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::before { opacity: 0.18; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { opacity: 0.18; } }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 0.4rem 0.8rem;
  font: 500 0.875rem var(--sans);
}
.skip:focus { top: 1rem; }

/* ---------- page frame ---------- */

.frame {
  position: relative;
  z-index: 1;
  max-width: calc(14rem + var(--gap) + var(--measure) + var(--gap) + var(--side));
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 1280px) {
  .frame {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    column-gap: var(--gap);
    padding: 0 2rem;
  }
}

/* ---------- topbar ---------- */

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: calc(14rem + var(--gap) + var(--measure) + var(--gap) + var(--side));
  margin: 0 auto; padding: 1rem 1rem 0;
  font: 500 0.8125rem/1.3 var(--sans);
  color: var(--muted);
  letter-spacing: 0.02em;
}
@media (min-width: 1280px) { .topbar { padding: 1.25rem 2rem 0; } }
.topbar .mark { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.topbar .mark svg { width: 22px; height: 22px; }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar nav a { color: var(--ink-2); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }

.theme-btn {
  font: 500 0.75rem var(--sans); color: var(--ink-2);
  background: transparent; border: 1px solid var(--rule-strong);
  padding: 0.3rem 0.6rem; border-radius: 3px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.theme-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.theme-btn svg { width: 13px; height: 13px; }

/* ---------- table of contents ---------- */

.toc { font-family: var(--sans); font-size: 0.8125rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 1.6rem 1fr; padding: 0.3rem 0;
  color: var(--muted); text-decoration: none; line-height: 1.35;
  border-left: 2px solid transparent; padding-left: 0.6rem; margin-left: -0.6rem;
}
.toc a::before { content: counter(toc); font-variant-numeric: tabular-nums; color: var(--rule-strong); }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); }
.toc a[aria-current="true"]::before { color: var(--accent); }
.toc-title { font: 600 0.6875rem var(--sans); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 0.6rem; }

.toc-side { display: none; }
@media (min-width: 1280px) {
  .toc-side { display: block; }
  .toc-side .toc { position: sticky; top: 2rem; padding-top: 22rem; }
  .toc-mobile { display: none; }
}
.toc-mobile {
  margin: 1.5rem 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.toc-mobile summary {
  cursor: pointer; list-style: none; padding: 0.7rem 0;
  font: 600 0.75rem var(--sans); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2);
  display: flex; justify-content: space-between; align-items: center;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: "+"; font-size: 1rem; color: var(--muted); }
.toc-mobile[open] summary::after { content: "\2212"; }
.toc-mobile .toc { padding-bottom: 0.8rem; }

/* ---------- article column + sidenotes ---------- */

article { min-width: 0; }

.col { max-width: var(--measure); }
@media (min-width: 1000px) {
  article { padding-right: calc(var(--side) + var(--gap)); }
}

.sn {
  display: block;
  font: 0.8125rem/1.5 var(--sans);
  color: var(--ink-2);
  margin: 0.6rem 0 1rem;
  padding: 0.55rem 0.75rem;
  border-left: 2px solid var(--rule-strong);
  background: var(--paper-2);
  font-variant-numeric: lining-nums tabular-nums;
}
.sn .n { font-weight: 600; color: var(--accent); margin-right: 0.35rem; }
@media (min-width: 1000px) {
  .sn {
    float: right; clear: right;
    width: var(--side);
    margin: 0.2rem calc(-1 * (var(--side) + var(--gap))) 1rem 0;
    padding: 0; background: none; border: 0;
    position: relative;
  }
}
sup.ref {
  font: 600 0.7rem var(--sans); color: var(--accent); line-height: 0; margin-left: 0.1em;
}

/* ---------- typography ---------- */

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(2.05rem, 4.4vw, 3.5rem); line-height: 1.06; margin: 0.4rem 0 1.2rem; font-weight: 450; letter-spacing: -0.022em; max-width: 21ch; }
h1 em { font-style: italic; color: var(--accent); }
h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.15rem); line-height: 1.15; margin: 0 0 1rem;
  display: flex; align-items: baseline; gap: 0.75rem;
}
h2 .sec { font: 500 0.875rem var(--sans); color: var(--accent); letter-spacing: 0.04em; min-width: 1.4rem; font-variant-numeric: lining-nums tabular-nums; }
h3 { font-size: 1.3rem; line-height: 1.25; margin: 2.2rem 0 0.6rem; font-weight: 600; }

p { margin: 0 0 1.05rem; }
strong { font-weight: 600; }
.lede { font-size: 1.3rem; line-height: 1.5; color: var(--ink); }
.kicker { font: 600 0.75rem var(--sans); text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); margin: 0; }
.small-sans { font: 0.875rem/1.5 var(--sans); color: var(--ink-2); }

section { padding: 3.5rem 0 1rem; border-top: 1px solid var(--rule); margin-top: 2.5rem; }
section::after { content: ""; display: table; clear: both; }

code, kbd { font-family: var(--mono); font-size: 0.86em; background: var(--paper-2); padding: 0.05em 0.3em; border-radius: 2px; }

/* ---------- masthead ---------- */

.masthead { padding: 2.5rem 0 0.5rem; }
.masthead-grid { display: grid; gap: 2rem; }
@media (min-width: 1000px) {
  .masthead-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: var(--gap); margin-right: calc(-1 * (var(--side) + var(--gap))); align-items: start; }
}
.dek { font-size: 1.22rem; line-height: 1.55; color: var(--ink-2); margin: 0 0 1rem; }
.dek strong { color: var(--ink); font-weight: 600; }
.byline {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; align-items: baseline;
  font: 0.875rem/1.5 var(--sans); color: var(--muted);
  border-top: 1px solid var(--ink); padding-top: 0.7rem; margin-top: 1.4rem;
}
.byline .who { color: var(--ink); font-weight: 600; }
.byline a { color: var(--ink-2); }
.byline a:hover { color: var(--accent); }

.glance { font-family: var(--sans); }
.glance-title { font: 600 0.6875rem var(--sans); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 0.3rem; }

/* ---------- figures ---------- */

figure { margin: 2rem 0 2.25rem; }
figure.wide, .col + figure, h3 { clear: both; }
figure.wide { }
@media (min-width: 1000px) {
  figure.wide { margin-right: calc(-1 * (var(--side) + var(--gap))); }
}
figcaption {
  font: 0.8125rem/1.5 var(--sans); color: var(--ink-2); margin-top: 0.7rem; max-width: 46rem;
  font-variant-numeric: lining-nums;
}
figcaption b { color: var(--ink); font-weight: 600; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.chart text { fill: var(--ink-2); font-size: 12px; }
.chart .t-ink { fill: var(--ink); }
.chart .t-muted { fill: var(--muted); }
.chart .t-strong { fill: var(--ink); font-weight: 600; }
.chart .halo { paint-order: stroke; stroke: var(--paper); stroke-width: 5px; stroke-linejoin: round; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart .zero { stroke: var(--ink); stroke-width: 1.25; }
.chart [data-tip] { cursor: default; }
.chart [tabindex]:focus { outline: none; }
.chart [tabindex]:focus-visible .hit-ring, .chart .hl .hit-ring { stroke: var(--focus); stroke-width: 2; fill: none; }

.fig-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0 0 0.9rem; font: 0.8125rem var(--sans); color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 3px; overflow: hidden; }
.seg button {
  font: 500 0.8125rem var(--sans); color: var(--ink-2); background: transparent; border: 0;
  padding: 0.38rem 0.75rem; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--rule-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--paper-2); color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font: 0.8125rem var(--sans); color: var(--ink-2); margin: 0 0 0.6rem; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.key-ring { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2px solid currentColor; flex: none; }
.key-line { width: 18px; height: 2px; display: inline-block; flex: none; }

/* tooltip */
.tip {
  position: fixed; z-index: 40; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font: 0.8125rem/1.4 var(--sans); padding: 0.45rem 0.6rem; border-radius: 3px;
  max-width: 17rem; opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
  font-variant-numeric: lining-nums tabular-nums;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 600; font-size: 0.9375rem; display: block; }
.tip span { opacity: 0.8; }

/* ---------- tables ---------- */

.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 0.25rem; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font: 0.875rem/1.4 var(--sans); font-variant-numeric: lining-nums tabular-nums; }
th, td { padding: 0.5rem 0.7rem; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 600; color: var(--ink-2); font-size: 0.75rem; letter-spacing: 0.02em; vertical-align: bottom; border-bottom: 1px solid var(--rule-strong); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--paper-2); }
td .ci { color: var(--muted); font-size: 0.8125rem; }
td.name { font-weight: 500; color: var(--ink); }
td.name .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; vertical-align: 1px; }
td.name .cfg { display: block; white-space: normal; max-width: 19rem; color: var(--muted); font-size: 0.75rem; font-weight: 400; margin: 0.15rem 0 0 1.05rem; line-height: 1.35; }

th.sortable { padding: 0; }
th.sortable button {
  all: unset; box-sizing: border-box; display: flex; width: 100%; justify-content: flex-end; align-items: center; gap: 0.3rem;
  padding: 0.5rem 0.7rem; cursor: pointer; font: inherit; color: inherit;
}
th.sortable:first-child button { justify-content: flex-start; }
th.sortable button:hover { color: var(--ink); }
th.sortable button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
th.sortable .arrow { width: 0.7rem; color: var(--rule-strong); font-size: 0.7rem; }
th[aria-sort="ascending"] .arrow, th[aria-sort="descending"] .arrow { color: var(--accent); }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--ink); }

/* sticky first column in scrolling tables */
.sticky-first th:first-child, .sticky-first td:first-child { position: sticky; left: 0; background: var(--paper); z-index: 1; }
.sticky-first tbody tr:hover td:first-child { background: var(--paper-2); }

/* heatmap */
table.heat td.cell { text-align: center; padding: 0.45rem 0.35rem; min-width: 3.1rem; font-size: 0.8125rem; border: 2px solid var(--paper); }
table.heat td.cell { color: var(--ink); }
table.heat thead th { text-align: center; white-space: normal; line-height: 1.2; min-width: 3.4rem; }
table.heat thead th:first-child { text-align: left; }
table.heat tbody tr:hover td { background: inherit; }

/* taxonomy dot matrix */
table.tax td.dot { text-align: center; padding: 0.3rem 0.1rem; min-width: 2.7rem; }
table.tax thead th { text-align: center; white-space: normal; line-height: 1.2; font-size: 0.6875rem; min-width: 2.7rem; max-width: 4.6rem; padding: 0.5rem 0.15rem; }
table.tax thead th:first-child { text-align: left; }
.dotcell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 3.4rem; }
.dotcell i { display: block; border-radius: 50%; background: var(--ink); opacity: 0.82; }
.dotcell i.z { width: 3px; height: 3px; opacity: 0.25; }
.dotcell i.hot { background: var(--s-jus); opacity: 0.95; }
.dotcell small { font-size: 0.6875rem; color: var(--muted); line-height: 1; }

/* ---------- prose blocks ---------- */

ol.takeaways { counter-reset: tk; list-style: none; padding: 0; margin: 1.5rem 0; }
ol.takeaways li {
  counter-increment: tk; display: grid; grid-template-columns: 2.4rem 1fr; padding: 0.9rem 0;
  border-top: 1px solid var(--rule); font-size: 1.22rem; line-height: 1.45;
}
ol.takeaways li:last-child { border-bottom: 1px solid var(--rule); }
ol.takeaways li::before { content: counter(tk); font: 500 1.5rem/1.2 var(--serif); color: var(--accent); font-style: italic; }

.slices { display: grid; gap: 0; margin: 1.5rem 0 1rem; }
.slice { padding: 0.9rem 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; }
.slice:last-child { border-bottom: 1px solid var(--rule); }
.slice h4 { margin: 0.15rem 0 0; font: 600 0.8125rem var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); }
.slice h4 small { display: block; font-weight: 400; letter-spacing: 0.02em; text-transform: none; color: var(--muted); margin-top: 0.2rem; font-size: 0.75rem; font-variant-numeric: lining-nums; }
.slice p { margin: 0; font-size: 1.05rem; }
@media (max-width: 520px) { .slice { grid-template-columns: 1fr; gap: 0.3rem; } }

.pull {
  margin: 2rem 0; padding: 0 0 0 1.25rem; border-left: 3px solid var(--accent);
  font: italic 400 1.45rem/1.4 var(--serif); color: var(--ink);
}

.spearman { width: auto; min-width: 18rem; }
.spearman td, .spearman th { padding: 0.4rem 0.8rem; }

ol.limits { padding: 0; list-style: none; counter-reset: lim; margin: 1.2rem 0; }
ol.limits li { counter-increment: lim; position: relative; padding: 0 0 1rem 2.4rem; }
ol.limits li::before {
  content: counter(lim) "."; position: absolute; left: 0; top: 0.05rem;
  font: 500 0.95rem var(--sans); color: var(--accent); font-variant-numeric: lining-nums tabular-nums;
}
ol.limits b { font-weight: 600; }

pre.cmd {
  font: 0.8125rem/1.65 var(--mono); background: var(--paper-2); color: var(--ink);
  padding: 1rem 1.1rem; overflow-x: auto; border-left: 2px solid var(--rule-strong); margin: 1rem 0 1.4rem;
}
pre.cmd .c { color: var(--muted); }
@media (min-width: 1000px) { pre.cmd { margin-right: calc(-1 * (var(--side) + var(--gap))); } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; font: 0.875rem/1.5 var(--sans); margin: 1rem 0; font-variant-numeric: lining-nums; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; color: var(--ink); }

.twocol { display: grid; gap: 1.5rem; }
@media (min-width: 700px) { .twocol { grid-template-columns: 1fr 1fr; } }

.confusion { width: 100%; }
.confusion caption { caption-side: top; text-align: left; font: 600 0.8125rem var(--sans); color: var(--ink); padding-bottom: 0.4rem; }
.confusion th, .confusion td { text-align: center; padding: 0.55rem 0.5rem; }
.confusion th:first-child { text-align: left; }
.confusion td.agree { background: var(--paper-2); font-weight: 600; color: var(--ink); }
.confusion td.dis { color: var(--accent); font-weight: 600; }

/* ---------- viewer ---------- */

.viewer { font-family: var(--sans); font-size: 0.875rem; border-top: 1.5px solid var(--ink); padding-top: 1rem; }
.v-controls { display: grid; gap: 0.8rem 1rem; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 760px) { .v-controls { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); } }
.v-controls label { display: grid; gap: 0.25rem; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.v-controls select {
  font: 0.875rem var(--sans); color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: 3px; padding: 0.45rem 2rem 0.45rem 0.6rem; width: 100%;
  text-transform: none; letter-spacing: 0; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.v-controls select:hover { border-color: var(--ink-2); }
.v-pick-a .tag, .v-pick-b .tag { display: inline-block; width: 1.1rem; height: 1.1rem; line-height: 1.1rem; text-align: center; border-radius: 2px; background: var(--ink); color: var(--paper); font-size: 0.6875rem; margin-right: 0.35rem; }

.v-matrix { margin: 1rem 0 0.25rem; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.v-matrix button {
  all: unset; box-sizing: border-box; cursor: pointer; padding: 0.4rem 0.45rem; background: var(--paper-2);
  display: grid; gap: 0.1rem; min-width: 0; border-top: 3px solid transparent;
}
.v-matrix button:hover { background: var(--paper-3); }
.v-matrix button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.v-matrix .nm { font-size: 0.6875rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-matrix .vl { font-size: 1rem; color: var(--ink); font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }
.v-matrix .bar { height: 3px; background: var(--rule); position: relative; }
.v-matrix .bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); }
.v-matrix button.is-a { border-top-color: var(--ink); }
.v-matrix button.is-b { border-top-color: var(--ink); border-top-style: dotted; }
.v-matrix button.is-empty .vl { color: var(--accent); }
@media (max-width: 640px) {
  .v-matrix { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.v-matrix-cap { font-size: 0.75rem; color: var(--muted); margin: 0.3rem 0 1rem; }

.v-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.25rem 0 1rem; padding: 0.6rem 0.75rem; background: var(--paper-2); font-size: 0.8125rem; color: var(--ink-2); }
.v-legend > span { display: inline-flex; align-items: center; gap: 0.4rem; }

.mk {
  display: inline-grid; place-items: center; flex: none;
  width: 1.15rem; height: 1.15rem; border-radius: 2px;
  font: 600 0.625rem/1 var(--sans); color: var(--paper);
}
.mk.k { background: var(--kept-bar); }
.mk.l { background: var(--leak-bar); }
.mk.x { background: var(--extra-bar); }
.mk.d { background: var(--drop-bar); }

.v-top { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 900px) { .v-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pane { border: 1px solid var(--rule); background: var(--paper); min-width: 0; display: flex; flex-direction: column; }
.pane-h { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.pane-h h4 { margin: 0; font: 600 0.75rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.pane-h .meta { font-size: 0.75rem; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; text-align: right; }
.pane-b { overflow: auto; max-height: 26rem; padding: 0.6rem 0.75rem; }
details.pane > summary { list-style: none; cursor: pointer; }
details.pane > summary::-webkit-details-marker { display: none; }
details.pane > summary h4::after { content: "  +"; color: var(--muted); }
details.pane[open] > summary h4::after { content: "  \2212"; }
.frame-wrap { background: #fff; height: 26rem; }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
:root[data-theme="dark"] .frame-wrap { background: #2c2821; padding: 6px; }
:root[data-theme="dark"] .frame-wrap iframe { filter: brightness(0.78) contrast(0.95); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .frame-wrap { background: #2c2821; padding: 6px; }
  :root:not([data-theme="light"]) .frame-wrap iframe { filter: brightness(0.78) contrast(0.95); }
}

.gold-p { display: grid; grid-template-columns: auto 1fr; gap: 0.55rem; padding: 0.45rem 0; border-bottom: 1px dashed var(--rule); font: 0.8125rem/1.5 var(--serif); color: var(--ink); font-size: 0.9375rem; }
.gold-p:last-child { border-bottom: 0; }
.gold-p .marks { display: flex; gap: 2px; padding-top: 0.15rem; }
.gold-p.dropped-a .txt { background: var(--drop-bg); text-decoration: underline dotted var(--drop-bar); text-underline-offset: 3px; }
.gold-p .txt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gold-p.open .txt { -webkit-line-clamp: unset; display: block; }
.gold-p button.more { all: unset; cursor: pointer; font: 0.75rem var(--sans); color: var(--accent); grid-column: 2; }
.gold-p button.more:focus-visible { outline: 2px solid var(--focus); }
.gold-sub { font: 600 0.6875rem var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0.9rem 0 0.4rem; }
.bp { display: grid; grid-template-columns: auto 4.6rem 1fr; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.8125rem; color: var(--ink-2); border-bottom: 1px dashed var(--rule); align-items: start; }
.bp .kind { font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding-top: 0.15rem; }
.bp .marks { display: flex; gap: 2px; }
.mk.off { background: transparent; color: var(--muted); border: 1px solid var(--rule-strong); }

.v-tabs { display: none; margin: 0 0 0.6rem; }
.v-outs { display: grid; gap: 1rem; }
@media (min-width: 900px) { .v-outs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 899px) {
  .v-tabs { display: inline-flex; }
  .v-outs .pane[data-hidden="true"] { display: none; }
}
.out-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0.2rem 1.1rem; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); font-variant-numeric: lining-nums tabular-nums; }
.out-stats div { display: grid; }
.out-stats small { font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.out-stats b { font-size: 1rem; font-weight: 500; color: var(--ink); }
.out-labels { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.75rem; }
.out-labels span { border: 1px solid var(--rule-strong); padding: 0.05rem 0.4rem; border-radius: 2px; color: var(--ink-2); }
.out-labels .none { border: 0; color: var(--muted); padding: 0; }
.out-title { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--rule); font-size: 0.75rem; color: var(--muted); }
.out-title q { color: var(--ink); }
.out-lines { font: 0.75rem/1.55 var(--mono); padding: 0.4rem 0.5rem 0.6rem; max-height: 30rem; overflow: auto; }
.ln { display: grid; grid-template-columns: 1.15rem 1fr; gap: 0.5rem; padding: 0.2rem 0.4rem; margin: 1px 0; border-left: 3px solid transparent; }
.ln .tx { white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.ln.k { background: var(--kept-bg); border-left-color: var(--kept-bar); }
.ln.l { background: var(--leak-bg); border-left-color: var(--leak-bar); }
.ln.x { background: var(--extra-bg); border-left-color: var(--extra-bar); }
.ln .kind { font: 600 0.625rem var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--leak-bar); margin-right: 0.4rem; }
.empty-state {
  margin: 1rem 0.75rem; padding: 1.25rem 1rem; border: 1px dashed var(--accent); color: var(--ink);
  font: 0.875rem/1.5 var(--sans); background: var(--accent-wash);
}
.empty-state code { font-size: 0.8125rem; }
.empty-state b { display: block; font-size: 1rem; margin-bottom: 0.25rem; color: var(--accent); }
.v-loading { opacity: 0.55; transition: opacity 0.2s; }
.v-error { color: var(--accent); font-size: 0.875rem; padding: 0.75rem; }

/* ---------- footer ---------- */

.site-foot {
  position: relative; z-index: 1;
  max-width: calc(14rem + var(--gap) + var(--measure) + var(--gap) + var(--side));
  margin: 4rem auto 0; padding: 1.5rem 1rem 3rem;
  border-top: 1.5px solid var(--ink);
  font: 0.8125rem/1.6 var(--sans); color: var(--ink-2);
  display: grid; gap: 0.6rem;
}
@media (min-width: 1280px) { .site-foot { padding: 1.5rem 2rem 3rem; } }
.site-foot a { color: var(--ink); }
.site-foot .built { font: italic 1.1rem var(--serif); color: var(--ink); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 0.7s cubic-bezier(.2,.7,.2,1) both; }
  .rise.d1 { animation-delay: 0.08s; }
  .rise.d2 { animation-delay: 0.16s; }
  .rise.d3 { animation-delay: 0.28s; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .chart .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

@media print {
  body::before, .topbar nav, .theme-btn, .toc-side, .toc-mobile { display: none; }
}
@media (forced-colors: active) {
  .ln, .gold-p .txt { border-left-width: 4px; }
}
