:root {
  --bg: #0b1020;
  --panel: #131a30;
  --panel-2: #1a2340;
  --line: #26304f;
  --text: #e8ecf6;
  --muted: #8f9bbd;
  --dem: #3b82f6;
  --dem-soft: rgba(59, 130, 246, .18);
  --rep: #ef4444;
  --rep-soft: rgba(239, 68, 68, .18);
  --ind: #a78bfa;
  --unk: #6b7799;
  --gold: #f5c451;
  --radius: 14px;
  --head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

.top {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(11,16,32,.85));
  backdrop-filter: blur(6px);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; max-width: 760px; margin: 0 auto; }
.flag { display: flex; gap: 3px; }
.flag i { width: 11px; height: 26px; border-radius: 3px; display: block; }
.flag .d { background: var(--dem); } .flag .r { background: var(--rep); }
h1 { font: 700 26px/1 var(--head); letter-spacing: .5px; margin: 0; text-transform: uppercase; }
.sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
#countdown { color: var(--gold); font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 0; }
.tab { display: none; }
.tab.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
h2 { font: 600 21px/1.1 var(--head); text-transform: uppercase; letter-spacing: .6px; margin: 22px 0 4px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.plain summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

/* control odds */
.control { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.chamber h3 { font: 600 17px var(--head); text-transform: uppercase; letter-spacing: .6px; margin: 0 0 8px; color: var(--muted); }
.big { font: 700 40px/1 var(--head); }
.bigsub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.odd .when { text-decoration: none; grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; margin-top: -1px; }
.odds { margin-top: 10px; display: grid; gap: 7px; }
.odd { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 12.5px; }
.odd .who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.odd .bar { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--rep); overflow: hidden; }
.odd .bar i { display: block; height: 100%; background: var(--dem); }
.odd.na .bar { background: var(--line); }
.odd { text-decoration: none; }
.odd .who, .odd .num { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.tag-mkt { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--panel-2); color: var(--gold); margin-left: 4px; }

/* charts */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.legend b { font: 700 22px var(--head); margin-left: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* tables of polls */
.polls { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.polls td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.polls td:last-child { text-align: right; white-space: nowrap; }
.polls .meta { color: var(--muted); font-size: 11.5px; }

/* races */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 12px 0 8px; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); }
.race { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.race summary { list-style: none; cursor: pointer; padding: 12px 14px; }
.race summary::-webkit-details-marker { display: none; }
.race .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.race .st { font: 700 20px var(--head); text-transform: uppercase; letter-spacing: .5px; }
.margin { font: 600 15px var(--head); padding: 2px 8px; border-radius: 6px; background: var(--panel-2); }
.margin.D { color: #93c5fd; background: var(--dem-soft); }
.margin.R { color: #fca5a5; background: var(--rep-soft); }
.margin.tight { color: var(--gold); }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 14px; margin-top: 6px; }
.cand .b { grid-column: 1/-1; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.cand .b i { display: block; height: 100%; border-radius: 4px; }
.p-D { background: var(--dem); } .p-R { background: var(--rep); } .p-I { background: var(--ind); } .p-x { background: var(--unk); }
.pl { font-size: 11px; font-weight: 600; padding: 0 4px; border-radius: 3px; margin-left: 5px; color: #fff; }
.race .body { padding: 0 14px 12px; }
.race .note { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* news */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.story { display: block; text-decoration: none; padding: 12px 0; border-bottom: 1px solid var(--line); }
.story .src { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.story .src .el { color: var(--gold); }
.story h3 { font-size: 15.5px; font-weight: 600; line-height: 1.3; margin: 3px 0 4px; }
.story p { margin: 0; color: var(--muted); font-size: 13px; }

/* podcasts */
.show { display: grid; grid-template-columns: 60px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.show img { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--panel-2); }
.show h3 { margin: 0; font-size: 15px; }
.show .by { color: var(--muted); font-size: 12px; }
.ptag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--gold); margin-left: 6px; vertical-align: 1px; }
.ep { grid-column: 1/-1; display: block; text-decoration: none; border-top: 1px solid var(--line); padding-top: 8px; }
.ep b { display: block; font-weight: 500; font-size: 14px; line-height: 1.3; }
.ep span { color: var(--muted); font-size: 12px; }

/* election night */
.slot { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.slot.past { opacity: .55; }
.slot .t { font: 700 21px/1 var(--head); white-space: nowrap; }
.slot .t small { display: block; font: 500 11px Inter, sans-serif; color: var(--muted); margin-top: 3px; }
.slot .states { font-size: 14px; }
.watch { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.watch span { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); }

.links a { display: flex; justify-content: space-between; padding: 9px 0; text-decoration: none; border-top: 1px solid var(--line); }
.links a:first-child { border-top: 0; }
.links a::after { content: "↗"; color: var(--muted); }

.foot { max-width: 760px; margin: 26px auto 0; padding: 0 16px; color: var(--muted); font-size: 11.5px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(19, 26, 48, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--text); }
.tabbar button.on svg { stroke: var(--gold); }

@media (min-width: 700px) {
  .control { gap: 14px; }
  .big { font-size: 48px; }
}
