/* Tokens. Light is the default; dark applies from the OS setting unless the
   viewer picked a theme with the toggle (data-theme wins both ways). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;  /* OpenAI */
  --s2: #eb6834;  /* Anthropic */
  --s3: #1baf7a;  /* next vendor */
  --s-other: #898781;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --link: #1c5cab;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --link: #86b6ef;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --link: #86b6ef;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 0; }
p { margin: 0 0 10px; }
code, pre { font: 12.5px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; margin: 0 0 12px; }
pre code { background: none; padding: 0; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; gap: 20px; min-height: 52px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav a { color: var(--ink-2); padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.on { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.top-tools { display: flex; gap: 8px; align-items: center; }
main { padding-top: 24px; padding-bottom: 40px; min-height: 70vh; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--border); }
.loading, .empty { color: var(--ink-2); padding: 40px 0; }
.lede { color: var(--ink-2); max-width: 78ch; margin-bottom: 18px; font-size: 15px; }
.sub { color: var(--ink-2); font-size: 13px; margin: 2px 0 0; max-width: 90ch; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Controls */
button, select, input { font: inherit; color: inherit; }
select, input[type="search"] {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; min-height: 30px;
}
.ghost { background: none; border: 1px solid var(--border); border-radius: 6px; min-width: 30px; min-height: 30px; cursor: pointer; }
.ghost:hover { background: var(--surface-2); }
.filters { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.filters .group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filters .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); border-color: var(--axis); font-weight: 600; }
.chip:hover { border-color: var(--axis); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); font-weight: 600; }

/* Cards & tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile .k { color: var(--ink-2); font-size: 12.5px; }
.tile .v { font-size: 24px; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.tile .d { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero { display: flex; gap: 28px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.hero .big { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.hero .who { font-size: 15px; font-weight: 600; }
.note { border-left: 3px solid var(--warning); background: var(--surface); padding: 8px 12px; border-radius: 0 8px 8px 0; margin-bottom: 16px; color: var(--ink-2); font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -18px -16px; padding: 0 18px 16px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface); vertical-align: bottom; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th .arrow { color: var(--muted); font-size: 10px; margin-left: 3px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface-2); }
tr.click { cursor: pointer; }
td.heat { text-align: center; font-variant-numeric: tabular-nums; border-bottom-color: var(--surface); border-right: 2px solid var(--surface); min-width: 54px; }
.model-cell { display: flex; align-items: center; gap: 8px; }
.model-cell .name { font-weight: 600; color: var(--ink); }
.level { display: inline-block; padding: 0 7px; border-radius: 5px; border: 1px solid var(--border); font-size: 12px; color: var(--ink-2); background: var(--surface); }
.inbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inbar .track { width: 90px; height: 8px; background: var(--surface-2); border-radius: 0 4px 4px 0; position: relative; flex: none; }
.inbar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.ok::before { background: var(--good); }
.badge.bad::before { background: var(--critical); border-radius: 2px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--ink-2); font-size: 13px; }
.thumb { width: 34px; height: 44px; object-fit: cover; object-position: top; border: 1px solid var(--border); border-radius: 3px; background: #fff; display: block; }

/* Charts */
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .line { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.bars { display: grid; grid-template-columns: minmax(120px, max-content) minmax(80px, 1fr) max-content; gap: 5px 12px; align-items: center; }
.bars .lab { display: flex; gap: 8px; align-items: center; min-width: 0; }
.bars .lab a { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 16px; position: relative; border-left: 1px solid var(--axis); cursor: default; }
.bars .fill { position: absolute; left: 0; top: 1px; bottom: 1px; border-radius: 0 4px 4px 0; min-width: 1px; }
.bars .ci { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--ink); opacity: 0.55; border-radius: 1px; }
.bars .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.bars .row:hover .fill, .bars .track:hover .fill { filter: brightness(1.12); }
.axis-note { color: var(--muted); font-size: 12px; margin-top: 8px; }
svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.chart .tick-label { font-variant-numeric: tabular-nums; }
svg.chart .axis-title { fill: var(--ink-2); font-size: 11.5px; }
svg.chart .direct { fill: var(--ink-2); font-size: 11px; }
svg.chart .gridline { stroke: var(--grid); stroke-width: 1; }
svg.chart .baseline { stroke: var(--axis); stroke-width: 1; }
svg.chart .ring { stroke: var(--surface); stroke-width: 2; }
svg.chart .cross { stroke: var(--axis); stroke-width: 1; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.multiples .panel h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.multiples .panel h3 a { color: var(--ink); }
.strips { display: grid; grid-template-columns: minmax(120px, max-content) minmax(120px, 1fr) max-content; gap: 3px 12px; align-items: center; }
.heat-scroll { overflow-x: auto; }
.scale { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.scale .ramp { display: inline-flex; }
.scale .ramp i { width: 14px; height: 10px; display: block; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 320px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.tip .r .l { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.tip .r .l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip .r .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .key { width: 10px; height: 2px; border-radius: 1px; flex: none; }
.tip .more { color: var(--muted); margin-top: 3px; }

/* Form viewer */
.viewer { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .viewer { grid-template-columns: minmax(0, 1fr); } }
.page-stack { display: grid; gap: 14px; }
.page { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; line-height: 0; }
.page img { width: 100%; height: auto; display: block; }
.box { position: absolute; box-sizing: border-box; border-radius: 1px; }
.box.gt-found { border: 2px solid #0a8a0a; background: rgba(12, 163, 12, 0.10); }
.box.gt-missed { border: 2px dashed #d03b3b; background: rgba(208, 59, 59, 0.16); }
.box.gt-ignore { border: 1.5px dotted #898781; }
.box.pr-match { border: 2px solid #2a78d6; }
.box.pr-fp { border: 2px dashed #c97a00; background: repeating-linear-gradient(45deg, rgba(237, 161, 0, 0.30) 0 3px, transparent 3px 7px); }
.box.pr-ignore { border: 1.5px dotted #898781; }
.box:hover { outline: 2px solid #0b0b0b; z-index: 3; }
.key-list { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.key-list div { display: flex; gap: 8px; align-items: center; }
.key-list .box { position: static; width: 26px; height: 13px; flex: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.prose { max-width: 82ch; }
.prose h2 { margin: 26px 0 8px; font-size: 18px; }
.prose h3 { margin: 16px 0 6px; font-size: 14px; }
.prose li { margin-bottom: 4px; }
.prose table { width: auto; }
.formula { font-size: 15px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin: 0 0 12px; line-height: 1.7; }

.fine { color: var(--ink-2); font-size: 13px; margin: -4px 0 16px; }
