:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e3e2de;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #6f6e69;
  --series: #2a78d6;
  --series-wash: rgba(42, 120, 214, 0.10);
  --then: #b5b4ae;
  --rank-1: #86b6ef;
  --rank-2: #2a78d6;
  --rank-3: #104281;
  --average: #898781;
  --banner-bg: #fdeceb;
  --banner-border: #f0b8b6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #33332f;
    --grid: #2c2c2a;
    --axis: #383835;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9b9a93;
    --series: #3987e5;
    --series-wash: rgba(57, 135, 229, 0.14);
    --then: #5c5b56;
    --rank-1: #256abf;
    --rank-2: #5598e7;
    --rank-3: #b7d3f6;
    --average: #898781;
    --banner-bg: #2f1716;
    --banner-border: #74302e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1240px; margin: 0 auto; padding: 24px 24px 56px; }
header.top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 22px; font-weight: 650; margin: 0; }
.meta { color: var(--text-3); font-size: 13px; }
.privacy { color: var(--text-2); font-size: 13px; margin: 4px 0 18px; }
button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 11px;
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
button:focus-visible, svg:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; }
.actions { margin-left: auto; display: flex; gap: 8px; }
[hidden] { display: none !important; }
.door { max-width: 340px; margin: 18vh auto 0; text-align: center; }
.door p { color: var(--text-2); }
.door button { background: var(--series); border-color: var(--series); color: #fff; padding: 8px 16px; font-weight: 600; }
.door button:hover { background: var(--series); opacity: 0.9; }
.door button:disabled { opacity: 0.6; cursor: default; }
.door-error { color: var(--text); }
.filters { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter > span { color: var(--text-3); font-size: 13px; }
.segments { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.segments button { border: 0; background: transparent; color: var(--text-2); padding: 4px 10px; border-radius: 6px; white-space: nowrap; }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.banner { background: var(--banner-bg); border: 1px solid var(--banner-border); border-radius: 9px; padding: 9px 12px; margin-bottom: 16px; }
#app.loading { opacity: 0.55; transition: opacity 0.15s; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.tile, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tile { padding: 13px 15px; }
.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 650; line-height: 1.2; margin-top: 2px; }
.tile .sub { color: var(--text-3); font-size: 12.5px; }
h2 { font-size: 15px; font-weight: 650; margin: 28px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.card { padding: 13px 15px 11px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h3 { font-size: 14px; font-weight: 600; margin: 0; }
.card .help { color: var(--text-3); font-size: 12.5px; margin: 1px 0 7px; }
.card .figure { text-align: right; white-space: nowrap; }
.card .figure b { font-size: 19px; font-weight: 650; display: block; line-height: 1.15; }
.card .figure span { color: var(--text-3); font-size: 12px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.empty { color: var(--text-3); font-size: 13px; padding: 26px 0; text-align: center; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; margin: 2px 0 6px; }
.legend i { display: inline-block; vertical-align: 2px; margin-right: 5px; }
.legend i.swatch { width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.legend i.key { width: 14px; height: 2px; border-radius: 1px; }
.stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 2px 0 12px; }
.stats div { background: var(--surface-2); border-radius: 8px; padding: 6px 9px; min-width: 0; }
.stats b { display: block; font-size: 17px; font-weight: 650; line-height: 1.2; }
.stats span { color: var(--text-3); font-size: 12px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.pair h4 { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 4px; }
.scroll { max-height: 300px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: right; color: var(--text-3); font-weight: 500; position: sticky; top: 0; background: var(--surface); padding: 3px 8px; border-bottom: 1px solid var(--border); }
td { text-align: right; padding: 3px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
.note { color: var(--text-3); font-size: 12.5px; margin: 6px 0 0; }
footer { color: var(--text-3); font-size: 12.5px; margin-top: 30px; border-top: 1px solid var(--border); padding-top: 12px; }
footer p { margin: 0 0 4px; }
#tip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  padding: 6px 9px;
  font-size: 12.5px;
  min-width: 110px;
}
#tip .when { color: var(--text-3); margin-bottom: 2px; }
#tip .row { display: flex; align-items: center; gap: 7px; }
#tip .row i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
#tip .row b { font-weight: 650; font-variant-numeric: tabular-nums; }
#tip .row span { color: var(--text-3); }
@media (max-width: 760px) {
  main { padding: 16px 16px 40px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (forced-colors: active) {
  .chart rect, .chart path { forced-color-adjust: none; }
}
