:root {
  --bg: #06080b;
  --panel: #0c1015;
  --panel-2: #10161d;
  --line: #1b232d;
  --line-2: #26313d;
  --text: #e6edf3;
  --muted: #7d8a99;
  --dim: #4a5562;
  --heat: #fa5d19;
  --heat-12: rgba(250, 93, 25, 0.12);
  --dem: #2a6dfb;
  --rep: #eb3424;
  --oth: #ecb730;
  --ok: #42c366;
  --crit: #ff2d55;
  --high: #fa5d19;
  --med: #ecb730;
  --info: #3fa7ff;
  --sys: #9061ff;
  --surface-3: var(--surface-3);
  --line-soft: var(--line-soft);
  --track: var(--track);
  --bar-neutral: var(--bar-neutral);
  --btn: #121820;
  --ticker: #090c10;
  --topbar: linear-gradient(180deg, #0b0f14, #080b0f);
  --panel-end: #0a0d12;
  --grid: rgba(255, 255, 255, 0.018);
  --glow: rgba(250, 93, 25, 0.07);
  --party-neutral: #3a4552;
  --party-oth-bg: #6b5a1d;
  --scanlines: 1;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f9f9f9;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e8e8e8;
  --line-2: #d1d1d1;
  --text: #262626;
  --muted: #6b6b6b;
  --dim: #9a9a9a;
  --heat-12: rgba(250, 93, 25, 0.1);
  --ok: #1f9d47;
  --crit: #d9143f;
  --med: #b8860b;
  --info: #1f6fd1;
  --oth: #8a6a00;
  --surface-3: #f3f3f3;
  --line-soft: #f0f0f0;
  --track: #ececec;
  --bar-neutral: #a3a3a3;
  --btn: #ffffff;
  --ticker: #ffffff;
  --topbar: linear-gradient(180deg, #ffffff, #fbfbfb);
  --panel-end: #ffffff;
  --grid: rgba(0, 0, 0, 0.035);
  --glow: rgba(250, 93, 25, 0.06);
  --party-neutral: #8c8c8c;
  --party-oth-bg: #f6e7b8;
  --scanlines: 0;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; }
body {
  background:
    radial-gradient(ellipse at top left, var(--glow), transparent 45%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 100%,
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; }
.scanlines {
  pointer-events: none; position: fixed; inset: 0; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  opacity: var(--scanlines);
}
.muted { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.hidden { display: none !important; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: var(--topbar);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.flame { color: var(--heat); font-size: 22px; text-shadow: 0 0 14px rgba(250,93,25,0.8); animation: flicker 2.2s infinite; }
.brand-title { font-family: var(--mono); font-weight: 700; letter-spacing: 0.18em; font-size: 15px; }
.brand-sub { font-family: var(--mono); color: var(--muted); font-size: 11px; letter-spacing: 0.06em; margin-top: 2px; }
.status-cluster { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.clock { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--mono); padding: 2px 10px; border-left: 1px solid var(--line); }
.clock-label { font-size: 9px; color: var(--dim); letter-spacing: 0.14em; }
.clock span:last-child { font-size: 14px; font-variant-numeric: tabular-nums; }
.live-pill { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); }
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.live-pill.on { color: var(--crit); border-color: rgba(255,45,85,0.5); background: rgba(255,45,85,0.08); }
.live-pill.on .dot { background: var(--crit); box-shadow: 0 0 10px var(--crit); animation: pulse 1.2s infinite; }
.live-pill.off { color: var(--med); }
.btn { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; background: var(--btn); color: var(--text); border: 1px solid var(--line-2); border-radius: 4px; padding: 7px 10px; cursor: pointer; transition: all .2s cubic-bezier(.25,.1,.25,1); }
.btn:hover { border-color: var(--heat); color: var(--heat); }
.btn.on { background: var(--heat-12); border-color: var(--heat); color: var(--heat); }

/* Ticker */
.ticker { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--ticker); height: 30px; overflow: hidden; }
.ticker-label { background: var(--heat); color: #000; font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 0.16em; display: flex; align-items: center; padding: 0 12px; }
.ticker-track { flex: 1; overflow: hidden; position: relative; }
.ticker-inner { position: absolute; white-space: nowrap; display: flex; gap: 40px; align-items: center; height: 100%; font-family: var(--mono); font-size: 12px; animation: scroll 80s linear infinite; padding-left: 100%; }
.ticker-inner b { color: var(--heat); margin-right: 6px; }
.ticker-inner .crit b { color: var(--crit); }

/* Grid */
.grid {
  display: grid; gap: 10px; padding: 10px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt"
    "nat nat nat nat nat nat nat nat nat nat nat nat"
    "map map map alerts alerts alerts alerts alerts news news news news"
    "src src src src src src src src src src src src"
    "races races races races races races races races money money money money"
    "inc inc inc inc inc inc health health health health health health";
}
.national-panel { grid-area: nat; }
.sources-panel { grid-area: src; }
.map-panel { grid-area: map; }
.alerts-panel { grid-area: alerts; }
.news-panel { grid-area: news; }
.races-panel { grid-area: races; }
.money-panel { grid-area: money; }
.incumbents-panel { grid-area: inc; }
.health-panel { grid-area: health; }
@media (max-width: 1280px) {
  .grid { grid-template-areas:
    "mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt mkt"
    "nat nat nat nat nat nat nat nat nat nat nat nat"
    "map map map map map alerts alerts alerts alerts alerts alerts alerts"
    "news news news news news news news news news news news news"
    "src src src src src src src src src src src src"
    "races races races races races races races races races races races races"
    "money money money money money money inc inc inc inc inc inc"
    "health health health health health health health health health health health health"; }
}
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; grid-template-areas: "mkt" "nat" "alerts" "map" "news" "src" "races" "money" "inc" "health"; }
  .markets { grid-template-columns: 1fr !important; }
}
.markets-panel { grid-area: mkt; }

/* Prediction markets */
.markets { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr); gap: 10px; }
@media (max-width: 1280px) { .markets { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .mk-hero { grid-column: 1 / -1; } }
.mk-card { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 12px; min-width: 0; display: block; color: inherit; text-decoration: none; transition: border-color .2s; }
a.mk-card:hover, .mk-race:hover { border-color: var(--line-2); }
.mk-k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; gap: 8px; }
.mk-hero .mk-big { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.mk-big .lbl { font-size: 20px; font-weight: 700; }
.mk-big .pct { font-family: var(--mono); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mk-stack { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--track); gap: 2px; }
.mk-stack > div { height: 100%; transition: flex-grow 1.1s cubic-bezier(.2,.8,.2,1); min-width: 2px; }
.mk-hero-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; margin-top: 10px; align-items: center; }
.mk-legend { display: grid; gap: 4px; }
.mk-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 54px; gap: 8px; align-items: center; font-size: 12px; }
.mk-row .sw { width: 10px; height: 10px; border-radius: 2px; }
.mk-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row .pv { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.chg { font-family: var(--mono); font-size: 10px; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.chg.up { color: var(--ok); }
.chg.down { color: var(--crit); }
.mk-chart { width: 100%; height: 92px; display: block; }
.mk-chart .axis { stroke: var(--line); stroke-width: 1; }
.mk-chart text { fill: var(--dim); font-family: var(--mono); font-size: 9px; }
.mk-foot { font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mk-controls { display: grid; gap: 10px; align-content: start; }
.tug { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--track); margin: 8px 0 6px; }
.tug > div { transition: flex-grow 1.1s cubic-bezier(.2,.8,.2,1); }
.tug-nums { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tug-nums b { font-size: 22px; }
.tug-nums .l { color: var(--dem); }
.tug-nums .r { color: var(--rep); }
.tug-nums small { font-size: 10px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.sw.DEM, .mk-stack .DEM, .tug .DEM { background: var(--dem); }
.sw.REP, .mk-stack .REP, .tug .REP { background: var(--rep); }
.sw.MIX, .mk-stack .MIX { background: repeating-linear-gradient(135deg, var(--dem) 0 4px, var(--rep) 4px 8px); }
.sw.OTH, .mk-stack .OTH, .tug .OTH { background: var(--bar-neutral); }
.mk-races { display: grid; gap: 6px; align-content: start; }
.mk-race { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 8px 10px; cursor: pointer; transition: border-color .2s; }
.mk-race .top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.mk-race .top b { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; }
.mk-race .names { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.mk-race .names span:last-child { text-align: right; }
.mk-race .names b { color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mk-race .tug { margin: 5px 0 4px; height: 7px; }
.mk-race .vs { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.mk-race .vs .hot { color: var(--heat); }
.pv.tickup, .pct.tickup, .tug-nums b.tickup, .names b.tickup { animation: tickup 1.2s; }
.pv.tickdown, .pct.tickdown, .tug-nums b.tickdown, .names b.tickdown { animation: tickdown 1.2s; }
@keyframes tickup { 0% { color: var(--ok); text-shadow: 0 0 12px var(--ok); } 100% {} }
@keyframes tickdown { 0% { color: var(--crit); text-shadow: 0 0 12px var(--crit); } 100% {} }
.race .odds { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 8px; }
.race .odds b { color: var(--heat); font-weight: 600; }

.panel { background: linear-gradient(180deg, var(--panel), var(--panel-end)); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; position: relative; }
.panel::before { content: ""; position: absolute; top: -1px; left: 12px; width: 40px; height: 2px; background: var(--heat); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.count { font-family: var(--mono); background: var(--heat-12); color: var(--heat); border-radius: 3px; padding: 1px 6px; font-size: 11px; }

.seg, .tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.seg button, .tabs button { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; background: transparent; color: var(--muted); border: 0; padding: 6px 8px; cursor: pointer; border-right: 1px solid var(--line-2); }
.seg button:last-child, .tabs button:last-child { border-right: 0; }
.seg button.on, .tabs button.on { background: var(--heat-12); color: var(--heat); }
.tabs { margin-bottom: 10px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
select, input { font-family: var(--mono); font-size: 11px; background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); border-radius: 4px; padding: 6px 8px; }
input { width: 190px; }
input:focus, select:focus { outline: 1px solid var(--heat); }

/* Map */
.usmap { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; margin-bottom: 10px; }
.tile { aspect-ratio: 1; min-width: 0; overflow: hidden; border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; background: var(--surface-3); color: var(--dim); border: 1px solid var(--line-soft); position: relative; cursor: default; transition: transform .15s; }
.tile.senate::after { content: ""; position: absolute; top: 3px; right: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.tile.armed { color: var(--text); border-color: rgba(250,93,25,0.45); background: rgba(250,93,25,0.06); cursor: pointer; }
.tile.live { color: #000; background: var(--heat); border-color: var(--heat); cursor: pointer; box-shadow: 0 0 14px rgba(250,93,25,0.45); }
.tile.err { color: var(--med); border-color: rgba(236,183,48,0.45); border-style: dashed; }
.tile:hover { transform: scale(1.08); z-index: 2; }
.tile .pct { font-size: 8px; opacity: 0.85; }
.tile.flash { animation: tileflash 1.2s; }
.tile.closed:not(.live):not(.armed) { color: var(--text); background: var(--surface-3); border-color: var(--muted); }
.closes { font-family: var(--mono); font-size: 11px; color: var(--dim); margin: -2px 0 8px; line-height: 1.5; }
.closes b, .closes .hl { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 10px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.lg.live { background: var(--heat); }
.lg.armed { background: rgba(250,93,25,0.1); border: 1px solid rgba(250,93,25,0.5); }
.lg.err { border: 1px dashed var(--med); }
.lg.none { background: var(--surface-3); border: 1px solid var(--line); }
.lg.closed { background: var(--surface-3); border: 1px solid var(--muted); }
.lg-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-right: 4px; vertical-align: 1px; }
.feeds { display: flex; flex-direction: column; gap: 4px; }
.feed { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); cursor: pointer; }
.feed:hover { border-color: var(--line-2); }
.feed > div { min-width: 0; }
.feed .code { font-weight: 700; }
.feed .st { font-size: 10px; letter-spacing: 0.08em; }
.feed .st.live { color: var(--ok); }
.feed .st.error { color: var(--med); }
.feed .st.no-election, .feed .st.probing { color: var(--dim); }
.feed .sub { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Alerts */
.alerts, .news, .calllog { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.alerts { max-height: 470px; display: flex; flex-direction: column; gap: 6px; }
.alert { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 4px; background: var(--panel-2); cursor: pointer; }
.alert.new { animation: slidein .5s cubic-bezier(.25,.1,.25,1), glow 2.5s; }
.alert.critical { border-left-color: var(--crit); background: linear-gradient(90deg, rgba(255,45,85,0.12), var(--panel-2) 60%); }
.alert.high { border-left-color: var(--high); }
.alert.medium { border-left-color: var(--med); }
.alert.system { border-left-color: var(--sys); }
.alert time { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alert .kind { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; font-weight: 700; margin-top: 3px; }
.alert.critical .kind { color: var(--crit); }
.alert.high .kind { color: var(--high); }
.alert.medium .kind { color: var(--med); }
.alert.info .kind { color: var(--info); }
.alert.system .kind { color: var(--sys); }
.alert .title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.alert .detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
.alert .src { font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 3px; }

/* News */
.news { max-height: 470px; display: flex; flex-direction: column; gap: 6px; }
.news li { border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); padding: 8px 10px; display: grid; grid-template-columns: 1fr 64px; gap: 10px; }
.news li.new { animation: slidein .5s, glow 2.5s; }
.news .meta { font-family: var(--mono); font-size: 10px; color: var(--muted); display: flex; gap: 8px; margin-bottom: 3px; }
.news .meta .dom { color: var(--heat); }
.news .meta .brk { color: var(--crit); font-weight: 700; letter-spacing: 0.1em; }
.news a.t { font-weight: 600; text-decoration: none; line-height: 1.35; display: block; }
.news a.t:hover { color: var(--heat); }
.news .snip { color: var(--muted); font-size: 12px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news img { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); filter: saturate(0.85); }
.news li.nimg { grid-template-columns: 1fr; }
.news .via { font-weight: 700; letter-spacing: 0.1em; padding: 0 4px; border-radius: 2px; border: 1px solid currentColor; font-size: 9px; line-height: 14px; }
.news .via.live { color: var(--crit); }
.news .via.monitor, .news .via.web-monitor { color: var(--heat); }
.news .via.search { color: var(--muted); }
.news li.v-live { border-left: 3px solid var(--crit); }
.news li.v-monitor, .news li.v-web-monitor { border-left: 3px solid var(--heat); }
#newsFilter i { font-style: normal; opacity: .6; margin-left: 3px; }
.news-rate { font-family: var(--mono); font-size: 10px; margin: -4px 0 8px; }
.news-rate b { color: var(--heat); }

/* National board */
.nat-house { margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .nat-house { grid-template-columns: 1fr; } }
.nat-house .tug { height: 12px; }
.nat-house .hh { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; margin-bottom: 4px; gap: 10px; }
.nat-house .hh .D { color: var(--dem); } .nat-house .hh .R { color: var(--rep); }
.nat-senate { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ns { border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 4px; background: var(--panel-2); padding: 6px 8px; font-size: 12px; min-width: 0; transition: border-color .3s; }
.ns.DEM { border-left-color: var(--dem); } .ns.REP { border-left-color: var(--rep); } .ns.IND { border-left-color: var(--honey, #ecb730); }
.ns.called { box-shadow: inset 0 0 0 1px currentColor; }
.ns.called.DEM { color: var(--dem); } .ns.called.REP { color: var(--rep); }
.ns .nh { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--muted); gap: 6px; }
.ns .nh b { color: var(--text); font-size: 12px; }
.ns .nc { display: flex; justify-content: space-between; gap: 6px; color: var(--text); white-space: nowrap; overflow: hidden; }
.ns .nc span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ns .nc.lead { font-weight: 600; }
.ns .nbar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.ns .nbar i { display: block; height: 100%; background: var(--heat); transition: width .8s cubic-bezier(.25,.1,.25,1); }
.ns.flash { animation: glow 2.5s; }

/* Watched sources */
.monitors { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px; margin-bottom: 10px; }
.mon { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 10px 12px; font-size: 12px; }
.mon .mh { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.mon .mh .ok { color: var(--ok, #42c366); } .mon .mh .bad { color: var(--crit); }
.mon .mt { font-weight: 600; margin: 4px 0 2px; }
.mon .mm { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.mon .mm b { color: var(--text); }
.mon .countdown { color: var(--heat); }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.src { border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); padding: 7px 9px; font-size: 12px; text-decoration: none; color: inherit; display: block; min-width: 0; transition: border-color .2s; }
.src:hover { border-color: var(--line-2); }
.src.flash { animation: glow 2.5s; }
.src .sh { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.src .sh b { color: var(--heat); font-size: 11px; }
.src .tags { display: flex; gap: 4px; }
.src .tag { border: 1px solid var(--line-2); border-radius: 2px; padding: 0 4px; font-size: 9px; letter-spacing: .08em; }
.src .tag.mon { color: var(--heat); border-color: currentColor; }
.src .tag.meaningful { color: var(--crit); border-color: currentColor; }
.src .tag.err { color: var(--crit); }
.src .sl { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src .sm { color: var(--muted); font-family: var(--mono); font-size: 10px; margin-top: 2px; }

/* Races */
.races { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; max-height: 760px; overflow-y: auto; padding-right: 2px; }
.race { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 10px; cursor: pointer; transition: border-color .2s; }
.race:hover { border-color: var(--heat); }
.race.flash { animation: raceflash 1.6s; }
.race-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.race-label { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; }
.race-name { color: var(--muted); font-size: 11px; margin-top: 2px; }
.badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.won { color: #000; background: var(--ok); border-color: var(--ok); font-weight: 700; }
.badge.tight { color: var(--crit); border-color: var(--crit); }
.badge.counting { color: var(--heat); border-color: var(--heat); }
.prog { height: 4px; background: var(--track); border-radius: 2px; margin: 8px 0 4px; overflow: hidden; }
.prog > div { height: 100%; background: linear-gradient(90deg, var(--heat), #ffb37a); transition: width .8s; }
.prog-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.cand { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; font-size: 12px; }
.cand .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cand .nm span.n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party { font-family: var(--mono); font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 2px; color: #fff; background: var(--party-neutral); }
.party.DEM, .party.D { background: var(--dem); }
.party.REP, .party.R { background: var(--rep); }
.party.LIB, .party.GRE, .party.IND, .party.UAF, .party.UNA { background: var(--party-oth-bg); color: var(--oth); }
.cand .v { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cand .p { font-family: var(--mono); font-size: 12px; font-weight: 700; width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.cand.win .n { color: var(--ok); font-weight: 700; }
.bar { grid-column: 1 / -1; height: 3px; background: var(--track); border-radius: 2px; overflow: hidden; margin-top: -1px; }
.bar > div { height: 100%; transition: width .8s cubic-bezier(.25,.1,.25,1); background: var(--bar-neutral); }
.bar > div.DEM, .bar > div.D { background: var(--dem); }
.bar > div.REP, .bar > div.R { background: var(--rep); }
.race-foot { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.empty { color: var(--muted); font-family: var(--mono); font-size: 12px; padding: 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: 6px; }

/* Money */
.money-body { max-height: 720px; overflow-y: auto; }
.money-race { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px; background: var(--panel-2); }
.money-race h3 { margin: 0 0 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }
.mrow { display: grid; grid-template-columns: 130px 1fr 74px; gap: 8px; align-items: center; font-size: 11px; margin: 4px 0; }
.mrow .mn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .mbar { height: 10px; background: var(--track); border-radius: 2px; overflow: hidden; position: relative; }
.mrow .mbar > div { height: 100%; background: var(--bar-neutral); }
.mrow .mbar > div.DEM { background: var(--dem); }
.mrow .mbar > div.REP { background: var(--rep); }
.mrow .mbar > span { position: absolute; top: 0; height: 100%; border-right: 2px solid var(--text); opacity: 0.7; }
.mrow .mv { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.mnote { font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 4px; }
.ie { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.ie.tracked { background: rgba(250,93,25,0.05); }
.ie .amt { font-family: var(--mono); font-weight: 700; text-align: right; }
.ie .so { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; padding: 1px 5px; border-radius: 2px; margin-right: 6px; }
.ie .so.support { background: rgba(66,195,102,0.15); color: var(--ok); }
.ie .so.oppose { background: rgba(255,45,85,0.15); color: var(--crit); }
.ie .sub { grid-column: 1 / -1; color: var(--muted); font-family: var(--mono); font-size: 10px; }

/* Incumbents */
.incumbents { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; max-height: 520px; overflow-y: auto; }
.inc { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 10px; }
.inc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.inc-head a { font-weight: 600; text-decoration: none; }
.inc-head a:hover { color: var(--heat); }
.vote { display: grid; grid-template-columns: 38px 1fr; gap: 8px; font-size: 11px; padding: 3px 0; border-top: 1px solid var(--line-soft); }
.vote .vv { font-family: var(--mono); font-weight: 700; font-size: 10px; }
.vote .vv.Yea, .vote .vv.Aye { color: var(--ok); }
.vote .vv.Nay, .vote .vv.No { color: var(--crit); }
.vote .vv.Not { color: var(--dim); }
.vote a { text-decoration: none; color: var(--text); }
.vote a:hover { color: var(--heat); }
.vote .vm { color: var(--dim); font-family: var(--mono); font-size: 10px; }

/* Health */
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-bottom: 10px; }
.hc { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-family: var(--mono); font-size: 10px; background: var(--panel-2); }
.hc .hn { display: flex; justify-content: space-between; gap: 6px; }
.hc .hn b { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc .ok { color: var(--ok); }
.hc .bad { color: var(--crit); }
.hc .hm { color: var(--muted); margin-top: 2px; }
.hc .he { color: var(--med); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calllog { max-height: 240px; font-family: var(--mono); font-size: 10px; }
.calllog li { display: grid; grid-template-columns: 70px 1fr 60px 40px; gap: 8px; padding: 3px 4px; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.calllog li.bad { color: var(--med); }
.calllog li .ms { text-align: right; }

/* Modal */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; width: min(920px, 94vw); max-height: 86vh; padding: 0; }
dialog::backdrop { background: rgba(0,0,0,0.7); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-title { font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; }
.modal-body { padding: 14px 16px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
td.lead { color: var(--heat); font-weight: 700; }
.foot { padding: 14px 18px 24px; color: var(--dim); font-family: var(--mono); font-size: 10px; }

/* Real-time feel */
.topbar { position: sticky; }
.pollbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; overflow: hidden; }
.pollbar > div { height: 100%; width: 0; background: linear-gradient(90deg, transparent, var(--heat)); box-shadow: 0 0 8px var(--heat); }
.spark-wrap canvas { display: block; margin-top: 2px; }
.spark-wrap b { color: var(--heat); font-weight: 700; }
.live-pill.beat .dot { animation: beat .5s; }
.pulse-strip { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--panel-end); font-family: var(--mono); font-size: 10px; white-space: nowrap; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.pulse-label { color: var(--dim); letter-spacing: 0.14em; margin-right: 4px; flex: none; }
.blip { flex: none; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); animation: blipin .45s cubic-bezier(.2,.9,.3,1.3); }
.blip i { font-style: normal; color: var(--ok); margin-right: 4px; }
.blip.bad i { color: var(--crit); }
.blip.paid { border-color: rgba(250,93,25,0.4); }
.blip b { color: var(--text); font-weight: 500; }

.prog > div, .bar > div, .mbar > div { transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.enter { animation: popin .5s cubic-bezier(.2,.9,.3,1.25) both; animation-delay: calc(var(--i, 0) * 55ms); }
.panel.bump { animation: bump 1s; }
.race .delta { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--ok); margin-left: 6px; animation: deltapop 2.4s forwards; }
.count.tick { animation: counttick .5s; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column-reverse; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; overflow: hidden; cursor: pointer; padding: 10px 12px 12px; border: 1px solid var(--line-2); border-left: 3px solid var(--info); border-radius: 6px; background: var(--panel); box-shadow: 0 10px 30px rgba(0,0,0,0.35); animation: toastin .55s cubic-bezier(.2,.9,.3,1.3); }
.toast.out { animation: toastout .35s forwards; }
.toast.critical { border-left-color: var(--crit); }
.toast.high { border-left-color: var(--high); }
.toast.medium { border-left-color: var(--med); }
.toast.system { border-left-color: var(--sys); }
.toast.news { border-left-color: var(--heat); }
.toast .tk { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 3px; }
.toast.critical .tk { color: var(--crit); }
.toast.high .tk, .toast.news .tk { color: var(--heat); }
.toast .tt { font-weight: 600; font-size: 13px; line-height: 1.35; }
.toast .td { color: var(--muted); font-size: 12px; margin-top: 2px; }
.toast .life { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--heat); transform-origin: left; animation: life linear forwards; animation-duration: var(--life, 6s); }
.toast:hover .life { animation-play-state: paused; }

.edge-flash { position: fixed; inset: 0; pointer-events: none; z-index: 55; }
.edge-flash.go { animation: edge 1.4s; }
.edge-flash.go-heat { animation: edgeheat 1s; }

.boot { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(4,6,8,0.92); backdrop-filter: blur(3px); transition: opacity .5s; cursor: pointer; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-box { width: min(620px, 92vw); border: 1px solid var(--line-2); border-radius: 8px; background: #07090c; padding: 18px 20px; box-shadow: 0 0 60px rgba(250,93,25,0.15); }
.boot-title { font-family: var(--mono); font-weight: 700; letter-spacing: 0.16em; color: #e6edf3; margin-bottom: 12px; }
.boot pre { font-family: var(--mono); font-size: 12px; line-height: 1.7; color: #9fb0c0; margin: 0; min-height: 150px; white-space: pre-wrap; }
.boot pre .ok { color: #42c366; }
.boot pre .hl { color: #fa5d19; }
.boot pre .cur { display: inline-block; width: 7px; height: 13px; background: #fa5d19; vertical-align: -2px; animation: pulse .8s infinite; }
.boot-skip { font-family: var(--mono); font-size: 10px; color: #4a5562; margin-top: 10px; text-align: right; }

@keyframes popin { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes blipin { from { opacity: 0; transform: translateX(-14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes beat { 0% { transform: scale(1); } 40% { transform: scale(1.9); } 100% { transform: scale(1); } }
@keyframes bump { 0% { box-shadow: 0 0 0 1px var(--heat), 0 0 26px rgba(250,93,25,0.3); } 100% { box-shadow: none; } }
@keyframes counttick { 0% { transform: scale(1.4); background: var(--heat); color: #000; } 100% { transform: none; } }
@keyframes deltapop { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes toastin { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; } }
@keyframes life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes edge { 0%, 30% { box-shadow: inset 0 0 140px 24px rgba(255,45,85,0.5); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
@keyframes edgeheat { 0% { box-shadow: inset 0 0 90px 10px rgba(250,93,25,0.3); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes flicker { 0%,100% { opacity: 1; } 40% { opacity: 0.75; } 60% { opacity: 0.95; } }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes glow { 0% { box-shadow: 0 0 0 1px var(--heat), 0 0 18px rgba(250,93,25,0.35); } 100% { box-shadow: none; } }
@keyframes raceflash { 0% { border-color: var(--heat); box-shadow: 0 0 18px rgba(250,93,25,0.35); } 100% { border-color: var(--line); box-shadow: none; } }
@keyframes tileflash { 0% { box-shadow: 0 0 0 3px #fff; } 100% { box-shadow: 0 0 14px rgba(250,93,25,0.45); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
