:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ee;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --good: #006300;
  --bad: #d03b3b;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --other: #b5b3ab;
  --poly: #2a78d6;
  --poly-us: #4a3aa7;
  --kalshi: #1baf7a;
  --band-1: #86b6ef;
  --band-2: #2a78d6;
  --band-3: #104281;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --good: #0ca30c;
    --bad: #e66767;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --other: #5c5b57;
    --poly: #3987e5;
    --poly-us: #9085e9;
    --kalshi: #199e70;
    --band-1: #1c5cab;
    --band-2: #3987e5;
    --band-3: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --good: #0ca30c;
  --bad: #e66767;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --other: #5c5b57;
  --poly: #3987e5;
  --poly-us: #9085e9;
  --kalshi: #199e70;
  --band-1: #1c5cab;
  --band-2: #3987e5;
  --band-3: #9ec5f4;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 16px 64px; }

header.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px;
}
header.top h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
header.top .sub { color: var(--text-secondary); margin-top: 2px; }
.updated { color: var(--text-muted); font-size: 12px; }

.filters {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 10px 0; margin-bottom: 8px;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.filters label { color: var(--text-secondary); font-size: 12px; margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.seg button {
  font: inherit; font-size: 13px; color: var(--text-secondary); background: transparent;
  border: 0; padding: 5px 11px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--surface-2); }
.seg button[aria-pressed="true"] { color: var(--text-primary); background: var(--surface-2); font-weight: 600; }
select {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}

section { margin-top: 36px; }
section > h2 { font-size: 17px; font-weight: 650; margin: 0 0 2px; }
section > p.lede { color: var(--text-secondary); margin: 0 0 14px; max-width: 900px; }
.section-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .label { color: var(--text-secondary); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 26px; font-weight: 600; margin-top: 4px; }
.tile .delta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tile .delta.up { color: var(--good); }
.tile .delta.down { color: var(--bad); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .trio { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .pair { grid-template-columns: 1fr; } }

figure.card {
  margin: 0; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 14px 8px; min-width: 0;
}
figure.card figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
figure.card .title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
figure.card .note { color: var(--text-muted); font-size: 12px; }
.chart { width: 100%; height: 340px; }
.chart.short { height: 260px; }
.table-toggle {
  font: inherit; font-size: 12px; color: var(--text-secondary); background: none; border: 0; cursor: pointer; padding: 0;
}
.table-toggle:hover { color: var(--text-primary); }
.table-view { max-height: 320px; overflow: auto; display: none; }
figure.card.show-table .table-view { display: block; }
figure.card.show-table .chart { display: none; }

.empty {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  color: var(--text-secondary); height: 100%; min-height: 200px; padding: 20px; gap: 6px;
}
.empty strong { color: var(--text-primary); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
table.data th { color: var(--text-secondary); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface-1); cursor: pointer; user-select: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: var(--surface-2); }
.trader { display: flex; align-items: center; gap: 8px; }
.trader img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.trader .avatar-fallback { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); flex: none; }
.addr { color: var(--text-muted); font-size: 12px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.x-link { display: inline-flex; align-items: center; gap: 4px; }
.table-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 4px 4px 8px; overflow: auto; max-height: 640px; }
figure.card.is-empty .table-toggle { display: none; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); margin: 4px 0 10px; }
.legend button {
  font: inherit; color: inherit; background: none; border: 0; padding: 2px 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.legend button[aria-pressed="false"] { opacity: 0.4; }

footer { margin-top: 48px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
footer p { margin: 4px 0; max-width: 980px; }
.chip {
  font: inherit; font-size: 11px; font-weight: 600; color: var(--text-secondary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; cursor: pointer;
}
.chip:hover { color: var(--text-primary); }
