:root {
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781; --line: #e6e5e1;
  --accent: #2a78d6; --accent-track: #cde2fb; --accent-ink: #1c5cab;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --art-faint: #cfcdc6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --line: #33332f;
    --accent: #3987e5; --accent-track: #104281; --accent-ink: #86b6ef;
    --art-faint: #4a4a46;
  }
}
:root[data-theme="dark"] {
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --line: #33332f;
  --accent: #3987e5; --accent-track: #104281; --accent-ink: #86b6ef; --art-faint: #4a4a46;
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; overflow-x: hidden; background: var(--page); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; }
pre code { border: 0; padding: 0; background: none; }
.top, main, footer { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main { position: relative; }
.top { display: flex; align-items: baseline; gap: 24px; padding-top: 18px; padding-bottom: 8px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 22px; color: var(--ink); letter-spacing: -0.01em; }
.brand span { color: var(--accent-ink); }
nav { display: flex; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--ink-2); }
main { padding-bottom: 48px; }
footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 32px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; margin: 24px 0 8px; }
h2 { font-size: 19px; margin: 32px 0 10px; }
h2 .muted, h1 .muted { font-weight: 400; font-size: 0.75em; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; left: -9999px; }

/* stat tiles + hero figure */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.tile .label { color: var(--ink-2); font-size: 14px; }
.tile .value { font-size: 32px; font-weight: 600; line-height: 1.15; margin-top: 4px; }
.tile .unit { font-size: 14px; font-weight: 400; color: var(--muted); }
.tile .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* meter: the closed parts of the interval are the fill, the open gap is the track (same ramp) */

/* boards */
.boards { margin: 48px 0 32px; }
.board-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px 24px; }
.board-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.board-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.board-title-row h2 { margin: 0; font-size: 18px; }
.board-head .board-stats { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: var(--page); }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 5px; cursor: pointer; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.board-current { text-align: right; }
.board-current .board-big { margin: 0; font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.board-current .board-big .swatch { width: 12px; height: 12px; margin-right: 8px; vertical-align: 4px; }
.board-current .board-big .lb-unit { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.board-scroll { margin-top: 16px; max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.lb-table { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; font-size: 14px; border: 0; }
.lb-table thead th { position: sticky; top: 0; z-index: 1; background: var(--page); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lb-table th.r, .lb-table td.r { text-align: right; }
.sort-btn { border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.sort-btn:hover, .sort-btn[aria-pressed="true"] { color: var(--ink); }
.sort-btn .arr { opacity: .6; font-size: 11px; letter-spacing: 0; }
.lb-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-row:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.lb-row.current td { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.lb-row.pending td { color: var(--muted); }
.lb-row.pending a { color: inherit; }
.lb-solver { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-rank { display: inline-block; width: 22px; flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.lb-avatar { display: inline-block; width: 20px; height: 20px; flex: none; }
.lb-avatar img, .lb-avatar-blank { width: 20px; height: 20px; border-radius: 50%; display: block; background: var(--line); }
.lb-login { font-weight: 600; }
.lb-model { display: inline-block; margin-left: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; color: var(--ink-2); background: var(--page); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.lb-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-score a { color: inherit; }
.lb-unit { font-size: 12px; font-weight: 400; color: var(--muted); }
.lb-gain { font-size: 13px; font-variant-numeric: tabular-nums; }
.lb-gain .good { color: var(--good); font-weight: 600; }
.lb-date { font-size: 13px; }
.lb-empty { padding: 18px; text-align: center; }
@media (max-width: 720px) { .board-head { grid-template-columns: 1fr; align-items: start; } .board-current { text-align: left; } .board-current .board-big { font-size: 30px; } .board-panel { padding: 16px; } }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: top; }
thead th { border-top: 0; color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.nowrap { white-space: nowrap; }
td.num, th.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2); margin-left: 4px; vertical-align: middle; }
.status { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.status::before { content: "● "; }
.s-verified { color: var(--good); border-color: var(--good); }
.s-verifying, .s-pending { color: var(--accent-ink); border-color: var(--accent); }
.s-rejected, .s-policy_rejected { color: var(--critical); border-color: var(--critical); }
.s-timeout, .s-failed { color: var(--serious); border-color: var(--serious); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; }
dl.facts dt { color: var(--ink-2); }
dl.facts dd { margin: 0; }
pre.why { white-space: pre-wrap; margin: 0; }
.prose { max-width: 78ch; }
.prose table { width: auto; }
table.kv th { width: 200px; color: var(--ink-2); font-weight: 500; }
.how ol { max-width: 78ch; }
.avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; margin-right: 8px; }
@media (max-width: 720px) { .tiles { grid-template-columns: 1fr; } }

/* record chart: two series, fixed colors; light/dark steps from the validated palette */
:root { --series-1: #2a78d6; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; }
.chart { margin: 8px 0 0; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart figcaption { font-size: 13px; margin-top: 6px; }
.record-chart .grid { stroke: var(--line); stroke-width: 1; }
.record-chart .axis { stroke: var(--line); stroke-width: 1; }
.record-chart .tick { fill: var(--muted); font-size: 12px; font-family: inherit; }
.record-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.record-chart .line.dashed { stroke-dasharray: 6 5; opacity: 0.8; }
.record-chart .s1 { stroke: var(--series-1); }
.record-chart .s2 { stroke: var(--series-2); }
.record-chart .mark { stroke: var(--surface); stroke-width: 2; }
.record-chart .mark.s1 { fill: var(--series-1); }
.record-chart .mark.s2 { fill: var(--series-2); }
.record-chart .label { font-size: 13px; font-weight: 600; fill: var(--ink); stroke: none; font-family: inherit; }
.record-chart .label .muted { fill: var(--muted); font-weight: 400; }
.record-chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 2; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: baseline; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.record-chart .mark.hollow { fill: var(--surface); stroke-width: 2; }
.record-chart .mark.hollow.s1 { stroke: var(--series-1); }
.record-chart .mark.hollow.s2 { stroke: var(--series-2); }

/* the scheme, drawn beside the hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: center; margin: 16px 0 20px; }
.art-wrap { pointer-events: none; }
.scheme-art { width: 100%; height: auto; display: block; }
.scheme-art .e, .scheme-art .n { transition: fill .6s ease, stroke .6s ease, stroke-width .6s ease, opacity .6s ease; }
.scheme-art .e { stroke: var(--art-faint); stroke-width: 1; }
.scheme-art .e.recomputed { stroke: var(--series-1); stroke-width: 1.4; opacity: 0.9; }
.scheme-art .n { fill: var(--page); stroke: var(--art-faint); stroke-width: 1.1; }
.scheme-art .n.untouched { opacity: 1; }
.scheme-art .n.recomputed { fill: var(--series-1); stroke: var(--series-1); }
.scheme-art .n.revealed { fill: var(--series-2); stroke: var(--series-2); }
.scheme-art .n.src.revealed { fill: var(--series-2); }
.scheme-art .n.root { fill: var(--ink); stroke: var(--ink); }
.scheme-art .n.clasp { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: 0.6; }
.hero h1 { font-size: 34px; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .art-wrap { max-width: 420px; margin: 0 auto; } }

/* leaderboard, after better.codes */
.board-stats { margin: 0 0 8px; font-size: 14px; }

/* the framework explained (rules page): figures sit directly on the page, no box around them */
.how-it-works h2 { margin: 40px 0 10px; }
.prose h3 { font-size: 16px; margin: 26px 0 6px; }
.how-it-works .formula { font-size: 17px; margin: 6px 0 10px 1.5em; }
.how-it-works ul { padding-left: 1.2em; }
.how-it-works li { margin: 4px 0; }
.fig { margin: 18px 0 10px; padding: 0; max-width: 78ch; }
.fig svg { width: 100%; height: auto; display: block; overflow: visible; font-family: inherit; font-size: 12px; }
.fig figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 70ch; }
.fig figcaption .k::before { content: "\25CF"; margin-right: 4px; }
.fig figcaption .k.revealed::before { color: var(--series-2); }
.fig figcaption .k.recomputed::before { color: var(--series-1); }
.fig figcaption .k.untouched::before { color: var(--art-faint); }
.fig .t { fill: var(--ink-2); }
.fig .t.strong { fill: var(--ink); font-weight: 600; }
.fig .t.muted { fill: var(--muted); font-size: 11px; }
.fig .t.tag { fill: var(--muted); font-size: 10.5px; }
.fig .t.cost { fill: var(--series-1); font-weight: 600; font-size: 11px; }
.fig .t.cost.faint { fill: var(--accent-ink); font-weight: 500; }
.fig .e { stroke: var(--art-faint); stroke-width: 1.4; fill: none; }
.fig .e.recomputed { stroke: var(--series-1); stroke-width: 1.8; }
.fig .n { fill: var(--page); stroke: var(--ink-2); stroke-width: 1.4; }
.fig .n.root { fill: var(--ink); stroke: var(--ink); }
.fig .n.untouched { stroke: var(--art-faint); }
.fig .n.recomputed { fill: var(--series-1); stroke: var(--series-1); }
.fig .n.revealed { fill: var(--series-2); stroke: var(--series-2); }
.fig .pill { fill: var(--page); stroke: var(--ink-2); stroke-width: 1.3; }
.fig .bb { stroke: none; }
.fig .bits-a { fill: #4c8ef5; } .fig .bits-b { fill: #f0883e; } .fig .bits-c { fill: #3fb27f; } .fig .bits-d { fill: #a66bff; }
.fig .bits-f { fill: #2bb3b1; } .fig .bits-h1 { fill: #8593a3; } .fig .bits-h2 { fill: #66747f; } .fig .bits-h3 { fill: #9aa7b3; }
.fig .bits-root { fill: #4e5a66; } .fig .bits-pk { fill: #2f3a46; }
.fig .rib { opacity: .3; stroke: none; }
.fig .t.bl { fill: #fff; font-size: 9px; font-weight: 600; }
.fig .t.hl { fill: var(--ink); font-size: 9px; font-weight: 700; }
.fig .arrow { stroke: var(--ink-2); stroke-width: 1.4; fill: none; }
.fig .arrow.dashed { stroke: var(--muted); stroke-dasharray: 4 4; }
.fig marker path { fill: var(--ink-2); }
.fig marker.ah.e path { fill: var(--art-faint); }
.fig marker.ah.rec path { fill: var(--series-1); }
.fig .life { stroke: var(--line); stroke-width: 1.4; }
.fig .blockline { stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 3 4; }
.fig .bar { fill: var(--series-1); }
.fig .hatch line { stroke: var(--muted); stroke-width: 1.6; }
.fig .brk { stroke: var(--ink-2); stroke-width: 1.4; }
.fig .axis, .fig .tick { stroke: var(--ink-2); stroke-width: 1.4; }
.fig .ticklab { fill: var(--muted); font-size: 11px; }
.fig .gap { fill: var(--accent-track); opacity: .55; }
.fig .mark { stroke-width: 3; } .fig .mark.s1 { stroke: var(--series-1); } .fig .mark.s2 { stroke: var(--series-2); }
.fig .mlab { font-weight: 600; } .fig .mlab.s1 { fill: var(--series-1); } .fig .mlab.s2 { fill: var(--series-2); }
.fig .arr { fill: none; stroke-width: 2; } .fig .arr.s1 { stroke: var(--series-1); } .fig .arr.s2 { stroke: var(--series-2); }
table.params { max-width: 78ch; }
table.params th { width: 260px; color: var(--ink-2); font-weight: 500; }
