/* recursion.fast: one stylesheet for every page. No build step. */
:root {
  --page: #f6f7f9;
  --surface: #ffffff;
  --sunk: #eef1f5;
  --ink: #172033;
  --ink-2: #44506a;
  --muted: #626c80;
  --line: #d9dee7;
  --line-2: #c3cad6;
  --accent: #0a7666;
  --accent-ink: #075d51;
  --accent-soft: #e0f2ee;
  --warn: #855600;
  --warn-soft: #fbf0d9;
  --bad: #b0261d;
  --bad-soft: #fbe8e6;
  --violet: #6a3d9e;
  --violet-soft: #f0e9f8;
  --info: #22549f;
  --info-soft: #e5edf9;
  --chart-grid: #e3e7ee;
  --focus: #22549f;
  --math: "STIX Two Text", "STIX Two Math", "Cambria Math", Cambria, "Latin Modern Roman", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0f1521;
    --surface: #161e2d;
    --sunk: #121a27;
    --ink: #e7ebf2;
    --ink-2: #b6bfcd;
    --muted: #8f99ab;
    --line: #2a3447;
    --line-2: #3a4660;
    --accent: #4cc9b4;
    --accent-ink: #6fd8c6;
    --accent-soft: #12342f;
    --warn: #e5b65e;
    --warn-soft: #33290f;
    --bad: #f28b81;
    --bad-soft: #3a1b19;
    --violet: #b996e8;
    --violet-soft: #2a2141;
    --info: #8db3f0;
    --info-soft: #172740;
    --chart-grid: #222c3d;
    --focus: #8db3f0;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  overflow-wrap: break-word;
}
a { color: var(--accent-ink); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--sunk); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; }
pre { background: var(--sunk); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; border: 0; padding: 0; }
.math { font-family: var(--math); font-style: italic; font-size: 1.08em; letter-spacing: .01em; }
.math b, .math .up { font-style: normal; font-weight: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 10; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.skip:focus { top: 8px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.paused-banner { margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-soft); color: var(--ink); }
.paused-banner[hidden] { display: none; }
.demo-banner { margin: 0; padding: 6px 16px; text-align: center; font-size: 14px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); }

/* header */
.site-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 28px; padding-top: 20px; padding-bottom: 8px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 21px; letter-spacing: -.02em; }
.brand span { color: var(--accent-ink); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-header nav a { color: var(--ink-2); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

main { padding-bottom: 56px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h2 { font-size: 22px; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 24px 0 6px; }
.section { margin-top: 56px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.lede { max-width: 66ch; color: var(--ink-2); font-size: 17px; margin: 0; }

/* hero */
.hero { padding-top: 28px; }
.hero h1 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 16px; max-width: 25ch; font-weight: 720; text-wrap: balance; }
.hero .lede a { white-space: nowrap; }

/* record */
/* the track tabs: one segmented control above the record, the chart and the leaderboard */
.track-bar { margin-top: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.track-tabs { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--sunk); }
.track-tab { appearance: none; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink-2); font: 600 15px var(--sans); padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: baseline; gap: 8px; min-height: 40px; }
.track-tab:hover { color: var(--ink); }
.track-tab[aria-selected="true"] { background: var(--surface); border-color: var(--line-2); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tab-formula { font-family: var(--math); font-style: italic; font-weight: 400; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.track-tab[aria-selected="true"] .tab-formula { color: var(--accent-ink); }
.track-blurb { margin: 0; flex: 1 1 32ch; color: var(--muted); font-size: 14px; max-width: 70ch; }
.section.first { margin-top: 18px; }
table.data .unscored { color: var(--muted); }
table.data tr.note-row td { white-space: normal; font-size: 13px; padding: 8px 12px; }
.rec-mark { color: var(--accent-ink); }
.track-head { font-size: 19px; margin: 28px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.track-head .tab-formula { font-size: 16px; }
.metrics.m4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics.m5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.track-head + .metrics { margin-top: 12px; }

.record { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface); }
.record > div { padding: 20px 24px; min-width: 0; }
.record .facts { border-left: 1px solid var(--line); }
.record h2 { font-size: 15px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin: 0 0 4px; }
.score-big { margin: 0; font-size: clamp(40px, 7vw, 64px); line-height: 1.05; font-weight: 650; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.score-big .unit { font-size: .42em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: .2em; }
.score-big .math { font-weight: 400; margin-right: .18em; color: var(--ink-2); }
.score-split { margin: 6px 0 0; font-size: 18px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.score-split .math { margin: 0 .15em 0 .35em; }
.score-split .op { color: var(--muted); margin: 0 .25em; }
.score-note { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0; font-size: 15px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; }
.record .facts .more { margin: 14px 0 0; }
.empty-card { padding: 28px 24px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface); }
.empty-card h2 { font-size: 22px; margin-bottom: 8px; }
.empty-card p { margin: 0 0 12px; max-width: 62ch; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.button { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--accent); background: var(--accent); color: var(--surface); font: 600 15px var(--sans); text-decoration: none; cursor: pointer; }
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--accent-ink); }
.notice { padding: 16px 20px; border: 1px solid var(--bad); border-radius: 10px; background: var(--bad-soft); color: var(--ink); }
.notice p { margin: 0 0 10px; }
.notice .button { background: var(--bad); border-color: var(--bad); }
.loading { color: var(--muted); padding: 18px 0; }

/* chart */
.chart-box { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 8px 4px; }
.chart-box svg { display: block; width: 100%; height: 300px; }
.chart-box .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-box .axis { stroke: var(--line-2); stroke-width: 1; }
.chart-box .tick { fill: var(--muted); font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.chart-box .step { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-box .step-tail { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 4; }
.chart-box .pt-record { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-box .pt-retired { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart-box .pt-other { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.chart-box .hit { fill: transparent; }
.chart-box a:focus-visible { outline: none; }
.chart-box a:focus-visible circle:not(.hit) { stroke: var(--focus); stroke-width: 3; }
.chart-box .direct { fill: var(--ink); font: 600 13px var(--sans); font-variant-numeric: tabular-nums; }
.chart-box .empty-msg { fill: var(--muted); font: 15px var(--sans); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 8px 6px; font-size: 13px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .lg-record::before { background: var(--accent); }
.legend .lg-retired::before { border: 2px solid var(--accent); width: 7px; height: 7px; }
.legend .lg-other::before { border: 1.5px solid var(--muted); width: 8px; height: 8px; }
.tooltip { position: absolute; z-index: 3; pointer-events: none; max-width: 260px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); box-shadow: 0 4px 14px rgb(15 21 33 / .12); font-size: 13px; line-height: 1.4; }
.tooltip strong { display: block; font-size: 14px; }
.tooltip[hidden] { display: none; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.data { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
table.data thead th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--sunk); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data td.wrap-ok { white-space: normal; min-width: 18ch; max-width: 30ch; }
table.data tr.current td { background: var(--accent-soft); }
table.data tr.pin-row th { background: var(--page); color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: left; border-top: 2px solid var(--line-2); white-space: normal; }
.section-error { color: var(--bad); margin: 0; padding: 12px 0; }
.more-rows { margin-top: 10px; }
.more-rows:empty { display: none; }
.st-retired { color: var(--muted); }
.st-retired::before { background: transparent; border: 2px solid currentColor; width: 5px; height: 5px; }
table.data .entry { font-weight: 600; }
table.data .sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); white-space: normal; max-width: 34ch; }
table.data .empty-row td { white-space: normal; color: var(--muted); padding: 18px 12px; }
table.data:has(.empty-row) { min-width: 0; }
.gain { color: var(--accent-ink); }
.agent { color: var(--ink-2); white-space: normal; display: inline-block; min-width: 15ch; max-width: 26ch; }

/* status badges: text label plus a shape, so status is never colour alone */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 7px; border-radius: 999px; border: 1px solid currentColor; font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-record { color: var(--accent-ink); background: var(--accent-soft); }
.st-accepted { color: var(--accent-ink); }
.st-accepted::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.st-unranked, .st-superseded, .st-withdrawn { color: var(--muted); }
.st-unranked::before { border-radius: 1px; }
.st-superseded::before, .st-withdrawn::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; border-radius: 1px; }
.st-provisional { color: var(--warn); background: var(--warn-soft); }
.st-provisional::before { border-radius: 1px; transform: rotate(45deg); }
.st-rejected { color: var(--bad); background: var(--bad-soft); }
.st-rejected::before, .st-invalid::before { border-radius: 0; width: 8px; height: 2px; }
.st-invalid { color: var(--bad); }
.st-error { color: var(--violet); background: var(--violet-soft); }
.st-error::before { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 8px; height: 8px; }
.st-unverified { color: var(--warn); border-style: dashed; }
.st-unverified::before { display: none; }
.warn-text { color: var(--warn); font-weight: 600; }
code.hash { overflow-wrap: anywhere; word-break: break-all; }
.st-queued, .st-running { color: var(--info); background: var(--info-soft); }
.st-queued::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
@media (prefers-reduced-motion: no-preference) {
  .st-running::before { animation: pulse 1.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { opacity: .25; } }

/* queue */
.queue { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.queue li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.queue li:last-child { border-bottom: 0; }
.queue li.empty-li { display: block; }
.queue .pos { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.queue .when { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.queue .empty { display: block; color: var(--muted); }
.queue-note { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); max-width: 72ch; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 3px 11px; font: 13.5px var(--sans); cursor: pointer; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--page); }
.search { flex: 1 1 220px; max-width: 340px; }
.search input { width: 100%; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); color: var(--ink); font: 15px var(--sans); }
.count { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 32px; color: var(--muted); font-size: 14px; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--ink-2); }

/* submission page */
.back { margin: 20px 0 0; font-size: 15px; }
.detail-head { margin-top: 18px; }
.detail-head h1 { font-size: clamp(28px, 4.4vw, 40px); margin: 0; letter-spacing: -.025em; word-break: break-word; }
.detail-head .title { margin: 10px 0 0; color: var(--ink-2); font-size: 15.5px; max-width: 72ch; }
.detail-head .title .muted { font-size: 13.5px; }
.detail-head .badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.metrics > div { padding: 14px 18px; border-left: 1px solid var(--line); min-width: 0; }
.metrics > div:first-child { border-left: 0; }
.metrics .lbl { display: block; font-size: 14px; color: var(--muted); }
.metrics .val { display: block; font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metrics .val small { font-size: 15px; font-weight: 500; color: var(--muted); }
.against { margin: 12px 0 0; max-width: 80ch; color: var(--ink-2); }
.against strong { color: var(--ink); }
.reasons { margin: 0; padding-left: 1.2em; }
.reasons li { margin: 4px 0; max-width: 80ch; }
.reasons code { white-space: pre-wrap; }
.panel { margin-top: 28px; }
.panel > h2 { font-size: 19px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.untrusted { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.prose { max-width: 76ch; padding: 4px 22px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.prose h3, .prose h4, .prose h5, .prose h6 { margin: 22px 0 6px; font-size: 17px; }
.prose h5, .prose h6 { font-size: 15.5px; }
.prose blockquote { margin: 12px 0; padding: 0 14px; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.prose table { border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.prose .table-scroll { overflow-x: auto; margin: 12px 0; }
.prose img { display: none; }
.prose .ext-host { color: var(--muted); font-size: .9em; }
.prose a:not([href]) { color: inherit; text-decoration: none; }
details.readme > summary { cursor: pointer; font-weight: 600; font-size: 17px; padding: 6px 0; }
details.readme[open] > summary { margin-bottom: 8px; }
.kv-wide { grid-template-columns: max-content minmax(0, 1fr); }

/* rules page */
.rules { max-width: 74ch; }
.rules h1 { font-size: clamp(30px, 4.4vw, 42px); letter-spacing: -.03em; margin: 28px 0 10px; }
.rules h2 { font-size: 22px; margin: 44px 0 10px; }
.rules p, .rules li { color: var(--ink); }
.rules .intuition { color: var(--ink-2); border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin: 12px 0; }
.formula { margin: 16px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow-x: auto; font-family: var(--math); font-size: 19px; line-height: 1.9; white-space: nowrap; }
.formula i { font-style: italic; }
.formula .lhs { display: inline-block; min-width: 2.2em; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 14px 44px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.rules table.data { font-size: 14.5px; min-width: 0; }
.rules table.data td { white-space: normal; }
.rules table.data td:first-child { white-space: nowrap; }

@media (max-width: 760px) {
  .record { grid-template-columns: minmax(0, 1fr); }
  .record .facts { border-left: 0; border-top: 1px solid var(--line); }
  .record > div { padding: 18px; }
  .metrics, .metrics.m4, .metrics.m5 { grid-template-columns: minmax(0, 1fr); }
  .track-tab { padding: 6px 10px; gap: 6px; font-size: 14.5px; }
  .tab-formula { font-size: 13.5px; }
  .metrics > div { border-left: 0; border-top: 1px solid var(--line); }
  .metrics > div:first-child { border-top: 0; }
  .chart-box svg { height: 240px; }
  .queue li { grid-template-columns: 1.8em minmax(0, 1fr); }
  .queue .when { grid-column: 2; }
  .prose { padding: 2px 14px 8px; }
  .formula { font-size: 17px; }
}
@media (forced-colors: active) {
  .badge { border: 1px solid CanvasText; }
  .track-tab[aria-selected="true"] { border: 2px solid Highlight; }
  .chart-box .step { stroke: CanvasText; }
}
