:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --surface: #ffffff;
  --border: #e4e3df;
  --grid: #ecebe7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #75746f;
  --better: #2a78d6;
  --worse: #eb6834;
  --accent: #2a78d6;
  --chip: #f1f0ec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141413;
    --surface: #1a1a19;
    --border: #2f2f2c;
    --grid: #2a2a28;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9b9a92;
    --better: #3987e5;
    --worse: #d95926;
    --accent: #3987e5;
    --chip: #262624;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413;
  --surface: #1a1a19;
  --border: #2f2f2c;
  --grid: #2a2a28;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #9b9a92;
  --better: #3987e5;
  --worse: #d95926;
  --accent: #3987e5;
  --chip: #262624;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
header.site { border-bottom: 1px solid var(--border); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
header.site .brand { font-weight: 650; text-decoration: none; color: var(--text); }
header.site nav a { color: var(--text-2); text-decoration: none; margin-left: 18px; }
header.site nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

h1 { font-size: 28px; line-height: 1.2; margin: 32px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 36px 0 10px; }
h3 { font-size: 16px; margin: 24px 0 6px; }
.lede { color: var(--text-2); max-width: 70ch; margin: 0 0 8px; }
.meta { color: var(--text-3); font-size: 13px; }
.notice { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 12px 14px; margin: 16px 0; color: var(--text-2); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0 12px; }
.controls label { color: var(--text-2); font-size: 13px; }
select, input[type="search"] {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
#chart svg { display: block; width: 100%; height: auto; overflow: visible; }
#chart text { fill: var(--text-2); font-size: 12px; }
#chart .label { fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
#chart .value { fill: var(--text-2); font-variant-numeric: tabular-nums; }
#chart .grid { stroke: var(--grid); }
#chart .mid { stroke: var(--text-3); }
#chart .hit { fill: transparent; cursor: default; }
#chart .row:hover .bar, #chart .row:focus .bar { opacity: 0.8; }
#chart .row:focus { outline: none; }
#chart .row:focus .hit { stroke: var(--accent); stroke-width: 1; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 10; max-width: 300px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .row2 { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.tooltip .row2 span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

.table-wrap { position: relative; overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 13px; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 10px; }
th[aria-sort="descending"] button::after { content: " ▼"; font-size: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--chip); }
tr.detail td { white-space: normal; background: var(--bg); color: var(--text-2); font-size: 13px; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 1px 8px; margin: 2px 4px 2px 0; font-size: 12px; color: var(--text-2); }
.score-pill { display: inline-block; min-width: 34px; text-align: center; border-radius: 6px; padding: 1px 6px; font-weight: 650; }
.expand { all: unset; cursor: pointer; color: var(--accent); font-size: 13px; }

.prose { max-width: 72ch; }
.prose li { margin: 4px 0; }
code { background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
footer { margin: 48px 0 32px; color: var(--text-3); font-size: 13px; }

@media (max-width: 640px) {
  h1 { font-size: 23px; }
  header.site nav a { margin-left: 12px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  #table th:nth-child(2), #table td:nth-child(2) { display: none; }
}
