:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f0efec;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11,11,11,0.10);
  --dem: #2a78d6; --rep: #e34948; --ind: #6250d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --bench: #898781; --up: #006300; --down: #d03b3b; --mid: #c9c8c0;
  --accent: #2a78d6;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #262624;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10);
  --dem: #3987e5; --rep: #e66767; --ind: #9085e9;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --up: #0ca30c; --down: #e66767; --mid: #5a5a55; --accent: #3987e5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: var(--surface);
  border-bottom: 1px solid var(--grid); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 20px; color: var(--ink); display: flex; flex-direction: column; line-height: 1.1; }
.brand span { font-weight: 400; font-size: 12px; color: var(--muted); }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { color: var(--ink-2); padding: 6px 9px; border-radius: 6px; font-size: 14px; }
nav a.on, nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
nav a.acct { margin-left: auto; border: 1px solid var(--grid); }
.theme { background: none; border: 1px solid var(--grid); color: var(--ink-2); border-radius: 6px; padding: 5px 9px; cursor: pointer; }
main { max-width: 1240px; margin: 0 auto; padding: 22px; min-height: 70vh; }
footer { max-width: 1240px; margin: 30px auto; padding: 0 22px; color: var(--muted); font-size: 12.5px; }
h1 { font-size: 28px; margin: 4px 0 6px; }
h2 { font-size: 20px; margin: 28px 0 8px; }
h3 { font-size: 16px; margin: 18px 0 6px; }
.lede { color: var(--ink-2); max-width: 820px; margin: 0 0 18px; }
.muted { color: var(--muted); }
.pad { padding: 30px 0; }
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 10px; padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.tile { background: var(--surface); border: 1px solid var(--grid); border-radius: 10px; padding: 12px 14px; }
.tile .k { font-size: 12.5px; color: var(--ink-2); }
.tile .v { font-size: 26px; font-weight: 600; margin-top: 2px; }
.tile .s { font-size: 12.5px; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }
.pill { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--grid); color: var(--ink-2); }
.pty { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.pty.D { background: var(--dem); } .pty.R { background: var(--rep); } .pty.I { background: var(--ind); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--axis); padding: 6px 8px;
  cursor: pointer; white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.t td { border-bottom: 1px solid var(--grid); padding: 6px 8px; vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; }
table.t tr:hover td { background: var(--surface-2); }
.scroll { max-height: 560px; overflow: auto; border: 1px solid var(--grid); border-radius: 10px; background: var(--surface); }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0 14px; }
.controls label { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
input, select, button { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis);
  border-radius: 6px; padding: 5px 8px; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 5px 11px; background: var(--surface); }
.seg button.on { background: var(--surface-2); font-weight: 600; }
.mhead { display: flex; gap: 18px; align-items: center; }
.photo { width: 96px; height: 118px; border-radius: 8px; object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--grid); flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600; color: var(--muted); }
.photo.sm { width: 40px; height: 49px; font-size: 14px; border-radius: 5px; }
.who { display: flex; gap: 10px; align-items: center; }
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.axis text { fill: var(--muted); font-size: 11.5px; }
.axis path, .axis line { stroke: var(--axis); }
.gridl line { stroke: var(--grid); }
.gridl path { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 4px 0 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: 3px; }
.legend i.dot { width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; }
.tip { position: fixed; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--ring);
  box-shadow: 0 4px 16px rgba(0,0,0,.14); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; opacity: 0;
  max-width: 300px; z-index: 50; font-variant-numeric: tabular-nums; }
.tip b { font-weight: 600; }
.map path.st, .map path.cd { stroke: var(--surface); stroke-width: .6; cursor: pointer; }
.map path.st:hover, .map path.cd:hover { stroke: var(--ink); stroke-width: 1.4; }
.map path.border { fill: none; stroke: var(--surface); stroke-width: 1.4; pointer-events: none; }
.note { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); margin: 12px 0; }
.lucky { border-top: 4px solid var(--dem); }
.lucky.red { border-top-color: var(--rep); }
.rank { font-weight: 700; color: var(--muted); width: 26px; display: inline-block; }
.bar { height: 8px; border-radius: 4px; display: inline-block; vertical-align: 1px; }
.form { display: grid; gap: 8px; max-width: 340px; }
.err { color: var(--down); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--axis); border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: 0; padding: 0 6px; background: none; color: var(--muted); }
.sugg { position: absolute; background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; z-index: 20;
  max-height: 260px; overflow: auto; min-width: 280px; }
.sugg div { padding: 6px 10px; cursor: pointer; font-size: 13.5px; }
.sugg div:hover { background: var(--surface-2); }
.big { font-size: 40px; font-weight: 700; }
@media (max-width: 700px) {
  .top { padding: 8px 12px; gap: 8px; }
  nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  nav a { white-space: nowrap; }
  nav a.acct { margin-left: 0; }
  .theme { margin-left: auto; }
  main { padding: 14px 12px; }
  .mhead { align-items: flex-start; }
  .photo { width: 72px; height: 88px; }
  h1 { font-size: 23px; }
}
