:root {
  --fg: #1f1e1c; --muted: #6b6862; --bg: #faf9f6; --panel: #ffffff; --line: #e4e1da;
  --grid: #ece9e2; --s1: #2f6fb0; --s2: #c2662d; --s3: #3d8a5a; --mutedbar: #c9c5bc; --bad: #b23b3b;
  --radius: 8px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #ecebe7; --muted: #a29f97; --bg: #1b1a18; --panel: #24231f; --line: #3a3833;
          --grid: #2f2d29; --s1: #6aa5e0; --s2: #e39457; --s3: #6cc08b; --mutedbar: #57544d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: var(--s1); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px clamp(12px, 3vw, 32px) 48px; display: flex; flex-direction: column; gap: 20px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.head { display: flex; flex-direction: column; gap: 6px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.controls select { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.lede { font-size: 16px; max-width: 62rem; }
.lede b { font-variant-numeric: tabular-nums; }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tile, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tile { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.big, .tile .num { font-family: var(--serif); font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card { padding: 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.chart { position: relative; min-height: 280px; }
.chart.short { min-height: 200px; }
.chart svg { display: block; overflow: visible; }
.chart text { font-family: var(--sans); }
.pair { display: flex; gap: 28px; flex-wrap: wrap; }
.pair > div { display: flex; flex-direction: column; }
.split { height: 14px; border-radius: 4px; overflow: hidden; display: flex; background: var(--grid); }
.split span { display: block; height: 100%; }
.tablebox { max-height: 24rem; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; }
.n { text-align: right; }
td.empty { color: var(--muted); }
.defs { font-size: 13px; color: var(--muted); }
.defs summary { cursor: pointer; }
.defs dl { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: 4px 16px; margin: 10px 0; }
.defs dt { color: var(--fg); }
.defs dd { margin: 0; }
.tip { position: fixed; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
       box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 6px 10px; font-size: 12px; z-index: 10; white-space: nowrap; }
.tip .d { color: var(--muted); margin-bottom: 2px; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Projector view: ?tv=1 */
body.tv { font-size: 18px; }
body.tv .wrap { max-width: none; }
body.tv h1 { font-size: 44px; }
body.tv .lede { font-size: 22px; max-width: none; }
body.tv .big, body.tv .tile .num { font-size: 48px; }
body.tv .muted { font-size: 15px; }
body.tv table { font-size: 16px; }
body.tv .defs { display: none; }
body.tv .tablebox { max-height: none; }
.ci-line { font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--s3); } .dot.bad { background: var(--bad); }
body.tv .ci-line { font-size: 18px; }
