/* Off The Press — Elections HQ. Dark "election night" broadcast look on the
   OTP palette (red #c8102e, Lato + Merriweather). Party colors are chosen to
   sit apart from the brand red. */
:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --panel: #151922;
  --panel-2: #1b202b;
  --line: #262c39;
  --line-2: #323a4a;
  --text: #eef1f6;
  --text-2: #aab2c2;
  --text-3: #727c90;
  --brand: #c8102e;
  --brand-hi: #ff2d4b;
  --dem: #3d7dff;
  --dem-soft: #24427d;
  --rep: #ef4b4b;
  --rep-soft: #7d2a2f;
  --ind: #a879ff;
  --ind-soft: #4c3a78;
  --oth: #e7b23c;
  --oth-soft: #6d5527;
  --pending: #363e52;
  --norace: #161a23;
  --gold: #ffd166;
  --win: #39d98a;
  --font-sans: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(61,125,255,.10), transparent 60%),
    radial-gradient(1000px 600px at 95% -5%, rgba(239,75,75,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
[hidden] { display: none !important; }

/* ---- test banner ------------------------------------------------------- */
.test-banner {
  background: repeating-linear-gradient(-45deg, #ffd166 0 14px, #f5b82e 14px 28px);
  color: #1a1400; text-align: center; font-weight: 700; font-size: 13px; padding: 7px 16px;
}
.test-banner strong { background: #1a1400; color: #ffd166; padding: 2px 8px; border-radius: 4px; margin-right: 8px; letter-spacing: .1em; }

/* ---- top bar ----------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11,13,18,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand img { display: block; height: 30px; width: auto; }
.brand__divider { width: 1px; height: 26px; background: var(--line-2); }
.brand__hq { white-space: nowrap; font-weight: 900; text-transform: uppercase; letter-spacing: .16em; font-size: 14px; color: var(--text-2); }
.brand__hq b { color: var(--brand-hi); }
.top__status { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top__updated { color: var(--text-3); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }
@media (max-width: 760px) { .top__updated { display: none; } }
.live { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px 5px 9px; border-radius: 999px; background: #1d2230; border: 1px solid var(--line-2); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .14em; color: var(--text-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live.is-live { color: #fff; background: rgba(200,16,46,.18); border-color: rgba(255,45,75,.5); }
.live.is-live i { background: var(--brand-hi); box-shadow: 0 0 0 0 rgba(255,45,75,.7); animation: pulse 1.6s infinite; }
.live.is-stale i { background: var(--gold); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,45,75,.7); } 70% { box-shadow: 0 0 0 9px rgba(255,45,75,0); } 100% { box-shadow: 0 0 0 0 rgba(255,45,75,0); } }

/* ---- hero -------------------------------------------------------------- */
.hero { padding: 34px 0 10px; }
.hero__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--brand-hi); font-weight: 900; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; }
h1 { font-family: var(--font-serif); font-weight: 900; font-size: clamp(34px, 5.4vw, 60px); line-height: 1; margin: 0; letter-spacing: -.02em; }
.hero__dek { margin: 10px 0 0; color: var(--text-2); font-size: 15px; max-width: 620px; }
h1 span { background: linear-gradient(90deg, var(--dem), var(--ind) 50%, var(--rep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__clock { text-align: right; }
.hero__clock .lbl { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .14em; font-weight: 900; }
.hero__clock .val { font-family: var(--font-mono); font-size: clamp(22px, 3vw, 32px); font-weight: 700; color: var(--text); }
.hero__clock .val small { font-size: .55em; color: var(--text-3); margin: 0 6px 0 2px; }

/* ---- balance of power -------------------------------------------------- */
.bop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bop__card { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px; cursor: pointer; transition: border-color .2s, transform .2s; text-align: left; width: 100%; }
.bop__card:hover, .bop__card.is-active { border-color: var(--line-2); transform: translateY(-1px); }
.bop__card.is-active { box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 10px 30px -18px rgba(0,0,0,.8); }
.bop__title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.bop__title h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .14em; font-weight: 900; color: var(--text-2); }
.bop__title span { font-size: 11px; color: var(--text-3); }
.bop__nums { display: flex; justify-content: space-between; align-items: flex-end; }
.bop__num { font-family: var(--font-mono); font-weight: 700; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.bop__num--d { color: var(--dem); }
.bop__num--r { color: var(--rep); }
.bop__num small { display: block; font-family: var(--font-sans); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-top: 6px; }
.bop__num--r small { text-align: right; }
.bop__mid { text-align: center; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; padding-bottom: 4px; }
.bop__mid b { display: block; font-family: var(--font-mono); font-size: 18px; color: var(--text-2); }
.bar { position: relative; display: flex; height: 16px; margin: 14px 0 8px; border-radius: 4px; overflow: visible; background: var(--pending); }
.bar > span { height: 100%; transition: flex-basis .8s cubic-bezier(.2,.7,.2,1); flex: 0 0 auto; }
.bar > span:first-child { border-radius: 4px 0 0 4px; }
.bar > span:last-child { border-radius: 0 4px 4px 0; }
.bar .s-d { background: var(--dem); }
.bar .s-dl { background: var(--dem-soft); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 6px); }
.bar .s-i { background: var(--ind); }
.bar .s-u { background: var(--pending); flex-grow: 1; }
.bar .s-rl { background: var(--rep-soft); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 6px); }
.bar .s-r { background: var(--rep); }
.bar__tick { position: absolute; top: -5px; bottom: -5px; width: 2px; background: #fff; margin-left: -1px; border-radius: 1px; }
.bar__tick::after { content: attr(data-label) ' to win'; position: absolute; top: 24px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 900; color: var(--text-2); white-space: nowrap; }
.bop__note { font-size: 11.5px; color: var(--text-3); margin-top: 18px; }

/* ---- panels / stage ---------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-top: 18px; align-items: stretch; }
.panel__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: transparent; padding: 7px 15px; border-radius: 7px; font-weight: 900; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 8px rgba(0,0,0,.4); }
.tabs--small button { padding: 5px 11px; font-size: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.map { position: relative; padding: 8px 10px 0; overflow: hidden; }
.map svg { display: block; width: 100%; height: auto; }
.map__hint { margin: 0; padding: 4px 16px 12px; font-size: 12px; color: var(--text-3); }
.map__watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-weight: 900; font-size: clamp(40px, 9vw, 110px); letter-spacing: .2em; color: rgba(255,209,102,.07); transform: rotate(-12deg); }
.st { stroke: var(--bg); stroke-width: .8; cursor: pointer; transition: opacity .2s; }
.st.is-norace { cursor: default; }
.st:hover:not(.is-norace) { stroke: #fff; stroke-width: 1.6; }
.st.is-selected { stroke: #fff; stroke-width: 2.4; }
.st.is-house { stroke: #2b3242; stroke-width: .9; }
.st.is-house:hover { stroke: #4a556e; stroke-width: 1.2; }
.st-label { font: 900 11px var(--font-sans); fill: rgba(255,255,255,.85); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 2px; }
.st-label.is-dim { fill: rgba(255,255,255,.28); stroke: none; }
.dot { stroke: var(--bg); stroke-width: .9; cursor: pointer; }
.dot:hover { stroke: #fff; stroke-width: 1.5; }
.dot.is-selected-state { stroke: #fff; stroke-width: 1.2; }
.map.is-dimmed .st:not(.is-selected), .map.is-dimmed .dot:not(.is-selected-state) { opacity: .45; }
.flip-ring { fill: none; stroke: var(--gold); stroke-width: 1.6; pointer-events: none; }

.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 220px; max-width: 280px; background: rgba(17,20,27,.97); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.8); font-size: 13px; }
.tip h4 { margin: 0 0 2px; font-size: 14px; font-weight: 900; }
.tip .sub { font-size: 11px; color: var(--text-3); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

/* ---- candidate rows (shared) ------------------------------------------ */
.cands { list-style: none; margin: 0; padding: 0; }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 5px 0; align-items: center; }
.cand__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cand__name em { font-style: normal; font-size: 10px; font-weight: 900; color: var(--text-3); margin-left: 5px; letter-spacing: .06em; }
.cand__pct { font-family: var(--font-mono); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.cand__bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.cand__bar i { display: block; height: 100%; border-radius: 3px; transition: width .8s cubic-bezier(.2,.7,.2,1); }
.cand__votes { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.cand.is-winner .cand__name::after { content: '✓'; margin-left: 6px; color: var(--win); font-weight: 900; }
.called .cand:not(.is-winner) { opacity: .5; }
.pchip { display: inline-block; width: 16px; height: 16px; border-radius: 4px; font: 900 10px/16px var(--font-sans); text-align: center; color: #fff; margin-right: 7px; vertical-align: 1px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.badge--call { background: rgba(57,217,138,.13); color: var(--win); }
.badge--flip { background: rgba(255,209,102,.15); color: var(--gold); }
.badge--count { background: rgba(255,45,75,.12); color: #ff8091; }
.badge--wait { background: var(--panel-2); color: var(--text-3); }

/* ---- side panel -------------------------------------------------------- */
/* height:0 + min-height:100% lets the map alone set the row height; the side scrolls. */
.side { padding: 16px; overflow: auto; height: 0; min-height: 100%; }
.side h2 { margin: 0; font-size: 20px; font-weight: 900; }
.side .side__label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); padding-bottom: 10px; margin-bottom: 2px; }
.side__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.side__close { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; color: var(--text-2); flex: none; }
.race { border-top: 1px solid var(--line); padding: 12px 0 8px; }
.race:first-of-type { border-top: 0; padding-top: 4px; }
.race__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.race__head h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; color: var(--text-2); }
.race__meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.house-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.house-list li { background: var(--bg-2); border-radius: 7px; border-left: 3px solid var(--pending); font-size: 13px; }
.hl__row { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; align-items: center; width: 100%; padding: 6px 8px; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 7px; }
.hl__row:hover { background: var(--panel-2); }
.hl__row .vs { color: var(--text-3); font-size: 11px; font-weight: 700; margin: 0 2px; }
.hl__chev { font-style: normal; margin-left: 6px; color: var(--text-3); display: inline-block; transition: transform .2s; }
.hl.is-open .hl__chev { transform: rotate(180deg); }
.hl__body { padding: 0 10px 8px 10px; }
.hl__body .cands { margin-top: 2px; }
.house-list .d { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); font-weight: 700; }
.house-list .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.house-list .pc { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; cursor: pointer; }
.mini-list li:hover .nm { text-decoration: underline; }
.mini-list .nm { font-weight: 700; }
.mini-list .mg { font-family: var(--font-mono); color: var(--text-2); white-space: nowrap; }

/* ---- blocks ------------------------------------------------------------ */
.block { margin-top: 34px; }
.block__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.block__head h2 { margin: 0; font-family: var(--font-serif); font-size: 26px; letter-spacing: -.01em; }
.panel .block__head { padding: 16px 16px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px 10px; position: relative; overflow: hidden; cursor: pointer; transition: border-color .2s, transform .2s; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--accent, var(--pending)); }
.card__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.card__head h3 { min-width: 0; }
.card__head > div { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.card__head h3 { margin: 0; font-size: 17px; font-weight: 900; }
.card__head h3 small { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; margin-left: 6px; }
.card__foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); }
.card__rep { display: flex; align-items: center; gap: 7px; }
.meter { width: 60px; height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--text-2); }
.card.is-new { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 2px var(--gold), 0 0 40px rgba(255,209,102,.4); } 100% { box-shadow: 0 0 0 0 transparent; } }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; }
.calls { list-style: none; margin: 0; padding: 4px 16px 16px; max-height: 420px; overflow: auto; }
.calls li { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.calls li:first-child { border-top: 0; }
.calls li.is-new { animation: slideIn .6s cubic-bezier(.2,.7,.2,1); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.calls time { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); padding-top: 2px; }
.calls .what { font-size: 14px; }
.calls .what b { font-weight: 900; }
.calls .race-nm { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 2px; }
.calls .empty { display: block; color: var(--text-3); font-size: 13.5px; border: 0; padding: 14px 0; }

.timeline { list-style: none; margin: 0; padding: 8px 16px 16px; position: relative; }
.timeline li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 8px 0; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 80px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline li::after { content: ''; position: absolute; left: 76px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-2); }
.timeline li.is-past::after { background: var(--brand-hi); border-color: var(--brand-hi); }
.timeline li.is-next::after { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,209,102,.18); }
.timeline time { font-family: var(--font-mono); font-weight: 700; font-size: 13px; padding-top: 6px; color: var(--text-2); }
.timeline li.is-past time { color: var(--text); }
.timeline .sts { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 14px; }
.timeline .sts button { border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 6px; padding: 4px 7px; font: 900 11px var(--font-mono); letter-spacing: .04em; color: var(--text-2); cursor: pointer; }
.timeline .sts button.has-race { color: var(--text); border-color: #45506a; }
.timeline .sts button:hover { border-color: var(--text-2); }

.close-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.close-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; }
.close-row:hover { border-color: var(--line-2); }
.close-row .nm { font-weight: 900; }
.close-row .nm small { color: var(--text-3); font-weight: 700; margin-left: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.close-row .mg { font-family: var(--font-mono); font-weight: 700; text-align: right; }
.close-row .who { font-size: 12.5px; color: var(--text-2); }
.close-row .rp { font-size: 11px; color: var(--text-3); text-align: right; font-family: var(--font-mono); }
.close-empty { color: var(--text-3); font-size: 14px; padding: 18px; border: 1px dashed var(--line-2); border-radius: 12px; grid-column: 1 / -1; }

.foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--bg-2); }
.foot__inner { padding: 22px 20px 34px; font-size: 12.5px; color: var(--text-3); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot__inner p { margin: 0; max-width: 760px; }
.foot a { color: var(--text-2); }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 1060px) {
  .stage { grid-template-columns: 1fr; }
  .side { height: auto; min-height: 0; max-height: 640px; }
}
@media (max-width: 860px) {
  .bop { grid-template-columns: 1fr; gap: 10px; }
  .bop__num { font-size: 32px; }
  .duo { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .brand__divider, .top__updated { display: none; }
  .brand img { height: 24px; }
  .brand__hq { font-size: 11px; letter-spacing: .1em; }
  .top__inner { gap: 10px; }
  .live { padding: 4px 9px 4px 8px; font-size: 10px; letter-spacing: .1em; }
  .bop__card { padding: 12px 14px 10px; }
  .bop__note { margin-top: 16px; }
  .hero { padding-top: 22px; }
  .hero__clock { text-align: left; }
  .panel__bar { padding: 10px; }
  .tabs button { padding: 6px 10px; font-size: 12px; }
  .map { padding: 4px 2px 0; }
  .st-label { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
