/*
 * Detailed view. Tokens come from theme.css; colours here are CSS variables
 * only. Party colour reaches an element through --pc (fill) and --pt (text),
 * set inline as var(--p-<key>) / var(--p-<key>-text).
 */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; font-size: 15px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
ul, ol { list-style: none; margin: 0; padding: 0; }

:root {
  --tap: 44px;
  --gap: 16px;
  --radius: 12px;
  --neutral-tint: rgba(255, 255, 255, 0.05);
  --neutral-ring: rgba(255, 255, 255, 0.1);
}

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px;
  padding: calc(10px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: rgba(14, 23, 19, 0.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--edge);
}
.brand { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.brand h1 { font-family: var(--font-display); font-weight: 650; font-size: 22px; letter-spacing: -0.01em; line-height: 1.1; }
.brand span { font-size: 12px; color: var(--dim); }
.status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow-sm); position: relative; }
.live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0; animation: pulse 2s ease-out infinite;
}
.live.is-bad { color: var(--flag); }
.live.is-bad .live-dot { background: var(--flag); box-shadow: var(--glow-flag); }
.live.is-bad .live-dot::after { display: none; }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.stat .num { font-size: 17px; font-weight: 600; color: var(--bright); }
.stat small { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Badges (VDV Badge pattern) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
}
.badge.caps { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.tint-neutral { background: var(--neutral-tint); color: var(--dim); box-shadow: inset 0 0 0 1px var(--neutral-ring); }
.tint-party {
  background: color-mix(in srgb, var(--pc) 16%, transparent);
  color: var(--pt);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent);
}
.tint-party-ring { background: transparent; color: var(--pt); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent); }
.tint-attn.badge { text-shadow: 0 0 12px rgba(184, 245, 220, 0.3); }

.chip-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--pf, var(--pc)); flex: none; }
.party-text { color: var(--pt); }

/* ---------- Layout ---------- */
.layout {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "verdict" "flip" "parties" "watch" "all" "events" "flags" "foot";
  max-width: 1320px; margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
/* Order top to bottom on narrow screens: verdict, parties, watch, all, events, flags (warnings at the bottom) */
.area-verdict { grid-area: verdict; }
.area-flags { grid-area: flags; display: flex; flex-direction: column; gap: 10px; }
.area-flags:empty { display: none; }
.area-parties { grid-area: parties; }
.area-flip { grid-area: flip; }
.area-flip[hidden] { display: none; }
.area-watch { grid-area: watch; }
.area-all { grid-area: all; }
.area-scenario { grid-area: scenario; }
.area-events { grid-area: events; }
.area-foot { grid-area: foot; }

@media (min-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas:
      "verdict verdict"
      "flip flip"
      "parties parties"
      "watch watch"
      "all events"
      "flags flags"
      "foot foot";
    align-items: start;
    padding-left: 24px; padding-right: 24px;
  }
}

.card { padding: 18px 20px; min-width: 0; }
.card-head, .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head { padding: 4px 4px 0; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--faint); text-align: right; }
.card-head:has(.is-note) { flex-wrap: wrap; row-gap: 4px; }
.card-sub.is-note { color: var(--dim); font-size: 13px; flex-basis: 100%; text-align: left; }
.label { font-size: 12px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.07em; }
.help { font-size: 12px; color: var(--faint); margin-top: 6px; }
.help-inline { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); margin-left: 6px; }
.faint { color: var(--faint); }
.dim { color: var(--dim); }

/* ---------- Header tabs: Live | Scenario ---------- */
.tabs {
  display: inline-flex; padding: 3px; border-radius: 10px;
  background: var(--abyss); box-shadow: inset 0 0 0 1px var(--edge);
}
.tabs a {
  min-height: 38px; min-width: 88px; padding: 0 14px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--dim); font-weight: 600; font-size: 14px; text-decoration: none;
}
.tabs a:hover { color: var(--bright); }
.tabs a[aria-current="page"] { background: var(--overlay); color: var(--bright); box-shadow: inset 0 0 0 1px var(--edge-bright); }

/* ---------- "Can the left govern?" (bloc level: jade is the chrome here) ---------- */
.verdict {
  --vg: 1;  /* type scale; ?tv raises it */
  position: relative; overflow: hidden; padding: 20px 22px 18px;
  border-color: var(--accent-deep);
  background:
    radial-gradient(ellipse 70% 60% at 0% 0%, rgba(61, 232, 160, 0.08), transparent 70%),
    linear-gradient(to bottom, var(--raised), var(--surface));
}
.verdict::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, #1e5c46, #2fa173, #3de8a0);
}
.verdict.is-left { box-shadow: var(--shadow-card), 0 0 0 1px rgba(61, 232, 160, 0.35), 0 0 48px rgba(61, 232, 160, 0.18); }
.v-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.v-title {
  font-family: var(--font-display); font-weight: 650; letter-spacing: -0.01em;
  font-size: calc(clamp(22px, 3vw, 30px) * var(--vg)); color: var(--accent-bright);
}
.counted-big {
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1;
  padding: 10px 14px; border-radius: 12px; min-width: 132px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}
.counted-num {
  font-size: calc(clamp(28px, 4vw, 40px) * var(--vg)); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; color: var(--bright); margin-top: 4px;
}
.counted-num small { font-size: 0.55em; color: var(--dim); margin-left: 2px; letter-spacing: 0; }
.counted-label { font-size: calc(11px * var(--vg)); color: var(--dim); letter-spacing: 0.08em; }
.counted-meter { display: block; width: 100%; height: 4px; margin-top: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.counted-meter i { display: block; height: 100%; background: var(--dim); border-radius: 2px; }
.counted-sub { font-size: calc(12px * var(--vg)); color: var(--faint); margin-top: 2px; }
.counted-sub .num { color: var(--dim); }

.v-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.v-col {
  min-width: 0; padding: 16px 18px; border-radius: var(--radius);
  background: rgba(10, 16, 14, 0.55); box-shadow: inset 0 0 0 1px var(--edge);
  display: flex; flex-direction: column; gap: 8px;
}
.v-col-label { font-size: calc(12px * var(--vg)); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
.v-col-label .num { color: var(--bright); margin-left: 2px; }
.v-col-label .faint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.v-headline {
  font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  font-size: calc(clamp(26px, 3.6vw, 40px) * var(--vg)); color: var(--bright);
}
.v-sub { font-size: calc(13px * var(--vg)); color: var(--dim); }
.v-sub b { color: var(--bright); }
/* Left wins: the hoped-for result gets the jade glow. */
.v-col.v-left { background: linear-gradient(to bottom, rgba(61, 232, 160, 0.10), rgba(10, 16, 14, 0.55)); box-shadow: inset 0 0 0 1px rgba(61, 232, 160, 0.45), var(--glow); }
.v-col.v-left .v-headline { color: var(--accent); text-shadow: 0 0 28px rgba(61, 232, 160, 0.55); }
.v-col.v-left .v-side.left .v-big { color: var(--accent-bright); text-shadow: 0 0 24px rgba(61, 232, 160, 0.45); }
/* Kingmakers: attention, not alarm. */
.v-col.v-kingmakers { box-shadow: inset 0 0 0 1px rgba(184, 245, 220, 0.28); }
.v-col.v-kingmakers .v-headline { color: var(--attn); }
/* Right wins or hung: subdued and neutral, not red. */
.v-col.v-right .v-headline, .v-col.v-hung .v-headline { color: var(--dim); }

.v-nums { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; margin-top: 4px; }
.v-side { display: flex; flex-direction: column; min-width: 0; }
.v-side.right { align-items: flex-end; text-align: right; }
.v-big {
  font-size: calc(clamp(56px, 8.5vw, 104px) * var(--vg)); line-height: 0.92; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; color: var(--bright);
}
.v-side.right .v-big { color: var(--dim); }
.v-col.v-right .v-side.right .v-big { color: var(--bright); }
.v-need { font-size: calc(13px * var(--vg)); color: var(--dim); white-space: nowrap; }
.v-need b { color: var(--bright); }
.v-side.left.has-majority .v-need { color: var(--accent); }
.v-mid { display: flex; flex-direction: column; align-items: center; padding-bottom: 20px; }
.v-mid .label { font-size: calc(10px * var(--vg)); }
.v-mid .display { font-size: calc(clamp(24px, 3vw, 34px) * var(--vg)); color: var(--attn); line-height: 1; }
.v-combo { font-size: calc(20px * var(--vg)); font-weight: 500; color: var(--dim); margin-top: 8px; }
.v-combo b { color: var(--bright); }
.v-combo > b.num:first-of-type { font-size: 1.6em; font-weight: 700; vertical-align: -0.08em; }
.v-combo.has-majority { color: var(--accent); }
body.view-tv .v-combo { display: none; } /* shown in the TV stats band instead */
.v-house { font-size: calc(14px * var(--vg)); color: var(--dim); margin-top: 4px; }
.v-house b { color: var(--bright); }
.v-ovh { font-size: calc(12px * var(--vg)); color: var(--dim); }
.v-ovh b { color: var(--bright); }

.top-gauge { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--edge); }
.top-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: calc(13px * var(--vg)); color: var(--dim); }
.top-name { font-weight: 600; color: var(--pt); }
.top-name b { color: var(--bright); }
.top-status { flex: 1; }
.top-gauge.is-in .top-status { color: var(--bright); }
.top-seats b { color: var(--bright); }
.gauge { position: relative; height: calc(10px * var(--vg)); margin: 6px 0 14px; border-radius: 5px; background: var(--abyss); box-shadow: inset 0 0 0 1px var(--edge); }
.gauge i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--pf, var(--pc)); opacity: 0.85; transition: width 0.5s ease; }
.gauge-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--bright); border-radius: 1px; }
.gauge-mark em { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; color: var(--dim); font-family: var(--font-mono); padding-top: 2px; }

.v-waiting { margin-top: 14px; padding: 22px 20px; border-radius: var(--radius); background: rgba(10, 16, 14, 0.55); box-shadow: inset 0 0 0 1px var(--edge); display: flex; flex-direction: column; gap: 8px; }
.v-waiting .v-headline { color: var(--accent-bright); }
.wait-clock { margin: 0; font-size: calc(16px * var(--vg)); color: var(--dim); }
.wait-clock .num { color: var(--bright); font-size: 1.15em; }
.wait-steps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: calc(13px * var(--vg)); color: var(--dim); }
.wait-steps li { display: flex; align-items: baseline; gap: 8px; }
.wait-steps li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; align-self: center; background: rgba(255, 255, 255, 0.15); }
.wait-steps li.is-done::before { background: var(--accent); }
.wait-steps li.is-next::before { background: var(--accent); animation: wait-pulse 2.4s ease-in-out infinite; }
.wait-steps li.is-done { color: var(--faint); }
.wait-steps b { color: var(--bright); font-weight: 600; }
@keyframes wait-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(61, 232, 160, 0.5); } 50% { box-shadow: 0 0 0 7px rgba(61, 232, 160, 0); } }
@media (prefers-reduced-motion: reduce) { .wait-steps li.is-next::before { animation: none; } }

.v-basis { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 12px; font-size: calc(13px * var(--vg)); color: var(--dim); }
.v-basis b { color: var(--bright); }
.v-basis i { color: var(--faint); font-style: normal; }

.conflicts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.conflict-banner {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); text-align: left;
  padding: 10px 14px; border: 0; border-radius: var(--radius); font-size: calc(14px * var(--vg));
}
.conflict-banner.tint-flag { box-shadow: inset 0 0 0 1px rgba(232, 106, 106, 0.4), var(--glow-flag); }
.conflict-banner.tint-attn { box-shadow: inset 0 0 0 1px rgba(184, 245, 220, 0.3); }
.cf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cf-text strong { font-weight: 700; }
.cf-seats { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--dim); }
.cf-go { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; opacity: 0.85; }

.v-bars { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.seatbar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); margin-bottom: -16px; }
.seatbar-label .num { color: var(--bright); }
.seatbar-wrap.no-label { padding-top: 20px; }
.seatbar-wrap.no-label .seatbar { height: 24px; }
.seatbar-wrap.no-label .majority-line { top: 16px; }

@media (max-width: 720px) {
  .v-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ?tv: one screen, no scrolling, laid out for 1920x1080 and scaled to fit (fitTv).
   Top band (the headline): the verdict across two thirds, seats to govern / counted / overhang beside it.
   Below (the detail): rotating key seats across two thirds, changing hands and closest races beside them. */
.area-tv, .area-tvstats, .area-tvrot { display: none; }
body.view-tv { overflow: hidden; height: var(--tvh, 100vh); }
body.view-tv .layout > :not(.area-verdict):not(.area-tv):not(.area-tvstats):not(.area-tvrot) { display: none; }
body.view-tv .layout {
  max-width: none; height: calc(var(--tvh, 100vh) - 64px); padding-bottom: 18px;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: 460px minmax(0, 1fr);
  grid-template-areas: "verdict stats" "rot feed";
}
body.view-tv .verdict { --vg: 1.2; height: 100%; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 18px 26px 16px; }
body.view-tv .verdict .conflicts, body.view-tv .verdict .counted-big, body.view-tv .verdict .v-basis { display: none; }
body.view-tv .verdict .v-title { font-size: 24px; letter-spacing: 0.01em; color: var(--dim); }
/* Inside the verdict: words on the left, the big numbers on the right. */
body.view-tv .v-cols { margin-top: 0; flex: 1; min-height: 0; display: flex; }
body.view-tv .v-cols > .v-col { flex: 1; min-height: 0; }
body.view-tv .v-col {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 40px; row-gap: 8px;
  align-content: center; padding: 18px 26px;
}
body.view-tv .v-col > :not(.v-nums) { grid-column: 1; }
body.view-tv .v-nums { grid-column: 2; grid-row: 1 / span 4; align-self: center; margin-top: 0; }
body.view-tv .v-headline { font-size: 54px; }
body.view-tv .v-big { font-size: 112px; }
body.view-tv .v-house { font-size: 18px; }
body.view-tv .top-gauge { margin-top: 2px; }
body.view-tv .top-gauge .gauge { margin-bottom: 6px; }
body.view-tv .v-bars { margin-top: 0; }
/* TV before results: the waiting panel fills the card, centred and calm. */
body.view-tv .verdict.is-waiting .v-waiting {
  flex: 1; margin-top: 0; justify-content: center; gap: 18px; padding: 30px 40px;
  background: radial-gradient(ellipse 60% 80% at 15% 50%, rgba(61, 232, 160, 0.07), transparent 70%), rgba(10, 16, 14, 0.55);
}
body.view-tv .verdict.is-waiting .v-headline { font-size: 64px; }
body.view-tv .wait-clock { font-size: 28px; }
body.view-tv .wait-clock .num { font-size: 1.3em; letter-spacing: -0.01em; }
body.view-tv .wait-steps { gap: 12px 40px; font-size: 20px; margin-top: 12px; padding-top: 22px; border-top: 1px solid var(--edge); }
body.view-tv .verdict .bracket-row { display: none; }
body.view-tv .v-specials { margin-top: 0; }
body.view-tv .seatbar { height: 48px; }
body.view-tv .legend { margin-top: 10px; }
body.view-tv .legend { font-size: 17px; }
body.view-tv .v-specials { font-size: 28px; }
body.view-tv .area-tvstats { grid-area: stats; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); min-height: 0; }
body.view-tv .area-tvrot { grid-area: rot; display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; align-self: stretch; }
body.view-tv .area-tv { grid-area: feed; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); min-height: 0; height: 100%; overflow: hidden; }

/* ?ipad: the TV screen without the rotating seat cards, laid out for an 11-inch iPad
   (1180x820 landscape, 820x1180 portrait) and scaled to fit by fitTv. */
body.view-ipad .area-tvrot { display: none; }
body.view-ipad .layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-rows: 396px minmax(0, 1fr);
  grid-template-areas: "verdict verdict" "stats feed";
  padding-left: 16px; padding-right: 16px; padding-top: 12px; padding-bottom: 14px; gap: 12px;
  height: calc(var(--tvh, 100vh) - 64px);
}
body.view-ipad .verdict { --vg: 1; padding: 14px 20px 12px; gap: 10px; }
body.view-ipad .verdict .v-title { font-size: 18px; }
body.view-ipad .v-col { column-gap: 28px; row-gap: 6px; padding: 10px 18px; }
body.view-ipad .v-headline { font-size: 42px; }
body.view-ipad .v-big { font-size: 92px; }
body.view-ipad .v-house { font-size: 15px; }
body.view-ipad .seatbar { height: 38px; }
body.view-ipad .legend { font-size: 14px; }
body.view-ipad .v-specials { font-size: 20px; }
body.view-ipad .legend { gap: 4px 12px; margin-top: 8px; }
body.view-ipad .area-tvstats { gap: 12px; }
body.view-ipad .area-tvstats .card { padding: 14px 18px; }
body.view-ipad .tv-stat-row { gap: 14px; }
body.view-ipad .tv-govern-num, body.view-ipad .tv-combo-num { font-size: 76px; }
body.view-ipad .tv-count-num { font-size: 52px; }
body.view-ipad .tv-govern .faint, body.view-ipad .tv-combo .faint { font-size: 15px; }
body.view-ipad .tv-stat-row .label, body.view-ipad .tv-oh .label { font-size: 12px; }
body.view-ipad .tv-oh-num { font-size: 54px; }
body.view-ipad .tv-oh ul, body.view-ipad .tv-oh p { font-size: 13px; }
body.view-ipad .area-tv { gap: 12px; }
body.view-ipad .area-tv .card { padding: 12px 18px; }
body.view-ipad .area-tv .tv-h { font-size: 19px; margin-bottom: 6px; }
body.view-ipad .tv-list li { font-size: 15px; padding-bottom: 5px; }
body.view-ipad .tv-list { gap: 5px; }
body.view-ipad .tv-list li.empty { font-size: 14px; }
body.view-ipad .verdict.is-waiting .v-headline { font-size: 48px; }
body.view-ipad .wait-clock { font-size: 22px; }
body.view-ipad .wait-steps { font-size: 16px; gap: 10px 28px; }
/* Portrait: verdict, then the stats, then the two lists side by side. */
body.view-ipad.is-portrait .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 440px auto minmax(0, 1fr);
  grid-template-areas: "verdict" "stats" "feed";
}
body.view-ipad.is-portrait .v-col { column-gap: 20px; }
body.view-ipad.is-portrait .v-headline { font-size: 38px; }
body.view-ipad.is-portrait .v-big { font-size: 84px; }
body.view-ipad.is-portrait .area-tvstats { height: auto; grid-template-rows: auto auto; }
body.view-ipad.is-portrait .area-tv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }

.tv-exit {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--dim); text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.04);
}
.tv-exit:hover { color: var(--bright); border-color: rgba(255, 255, 255, 0.3); }

.tv-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: end; }
.tv-govern, .tv-count, .tv-combo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tv-combo-num { font-size: 104px; line-height: 0.9; letter-spacing: -0.03em; color: var(--bright); font-variant-numeric: tabular-nums; }
.tv-combo .faint { font-size: 22px; white-space: nowrap; }
.tv-combo .faint b { color: var(--bright); }
.tv-combo.has-majority .tv-combo-num, .tv-combo.has-majority .faint { color: var(--accent); }
.tv-govern-num { font-size: 104px; line-height: 0.9; letter-spacing: -0.04em; color: var(--accent-bright); font-variant-numeric: tabular-nums; }
.tv-count-num { font-size: 72px; line-height: 0.9; letter-spacing: -0.03em; color: var(--bright); font-variant-numeric: tabular-nums; }
.tv-count-num small { font-size: 0.45em; color: var(--dim); }
.tv-govern .faint, .tv-count .counted-meter { font-size: 18px; }
.tv-count .counted-meter { height: 8px; border-radius: 4px; }
.tv-stat-row .label, .tv-oh .label { font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }

.tv-oh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.tv-oh { display: flex; flex-direction: column; gap: 4px; padding-left: 14px; border-left: 4px solid rgba(255, 255, 255, 0.12); }
.tv-oh-left { border-left-color: var(--p-lab); }
.tv-oh-right { border-left-color: var(--p-nat); }
.tv-oh-num { font-size: 72px; line-height: 0.95; letter-spacing: -0.03em; color: var(--dim); font-variant-numeric: tabular-nums; }
.tv-oh.has .tv-oh-num { color: var(--bright); }
.tv-oh ul { list-style: none; margin: 2px 0 0; padding: 0; font-size: 15px; color: var(--dim); display: flex; flex-direction: column; gap: 3px; }
.tv-oh ul .party-text { font-weight: 700; }
.tv-oh p { font-size: 15px; margin: 0; }
.tv-oh ul { overflow: hidden; }
body.view-tv .area-tvstats .card { padding: 18px 24px; min-height: 0; overflow: hidden; align-content: center; }

.tv-rot-head { display: flex; align-items: baseline; justify-content: space-between; }
.tv-rot-head .faint { font-size: 0.7em; font-family: var(--font-ui, inherit); margin-left: 8px; }
.tv-dots { display: inline-flex; gap: 6px; }
.tv-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.tv-dots i.on { background: var(--accent); }
.tv-rot-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* Page turns: the old page fades away, then the new cards drift in one after another. Slow on purpose. */
.tv-rot-body { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity 1.2s ease; }
.tv-rot-body.is-leaving { opacity: 0; }
.tv-rot-body.is-entering .tvc, .tv-rot-body.is-entering .tv-rot-head { animation: tv-fade 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) both; animation-delay: calc(var(--i, 0) * 110ms); }
.tv-rot-grid .wcard { min-height: 0; overflow: hidden; font-size: 15px; padding: 12px 14px; gap: 6px; }
.tv-rot-grid .wcard .tags, .tv-rot-grid .wcard .share { display: none; }
.tv-rot-timer { height: 2px; margin-top: 12px; background: rgba(255, 255, 255, 0.04); border-radius: 2px; overflow: hidden; }
.tv-rot-timer i { display: block; height: 100%; background: rgba(61, 232, 160, 0.35); animation: tv-timer var(--tv-rot-ms, 12000ms) linear both; }
@keyframes tv-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tv-rot-body.is-entering .tvc, .tv-rot-body.is-entering .tv-rot-head { animation: none; } }
@keyframes tv-timer { from { width: 0; } to { width: 100%; } }
.tv-card { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.tv-h { font-family: var(--font-display); font-size: 26px; color: var(--accent-bright); margin-bottom: 10px; }
.tv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; overflow: hidden; flex: 1; min-height: 0; }
.tv-list li[hidden] { display: none; }
.tv-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; font-size: 18px; }
.tv-list li > :not(time) { grid-column: 2; }
.tv-list li time { color: var(--dim); font-size: 0.8em; }
.tv-list li:not(:has(time)) { grid-template-columns: minmax(0, 1fr); }
.tv-list li:not(:has(time)) > * { grid-column: 1; }
.tv-row { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; }
.tv-row b { flex: 1; min-width: 0; }
.tv-margin { min-width: 56px; text-align: right; }
.tv-list li.empty { border-bottom: 0; font-size: 17px; line-height: 1.45; }
.tv-list li { line-height: 1.3; padding-bottom: 7px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
body.view-tv .area-tv .card { padding: 14px 22px; }
body.view-tv .area-tv .tv-h { font-size: 22px; margin-bottom: 8px; }
.tv-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-flip { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tv-flip .arrow { color: var(--faint, var(--dim)); }
.tv-party { display: inline-flex; align-items: center; gap: 5px; color: var(--pt, var(--pc)); font-weight: 600; }
.tv-party .chip-dot { background: var(--pf, var(--pc)); }
.tv-meta { font-size: 0.8em; }
.tv-margin { color: var(--bright); }
.link-plain { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; margin-left: 8px; }

.seatbar-wrap { position: relative; padding-top: 22px; }
.seatbar-block { position: relative; }
.seatbar {
  display: flex; height: 40px; border-radius: 8px; overflow: hidden;
  background: var(--abyss); box-shadow: inset 0 0 0 1px var(--edge);
}
.seg { box-shadow: inset -2px 0 0 var(--abyss);
  flex: none; display: flex; align-items: center; justify-content: center; min-width: 0;
  color: rgba(0, 0, 0, 0.72); font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  /* faint seat ticks over the party fill (TPM's fill is striped) */
  background: repeating-linear-gradient(90deg, transparent 0 calc(var(--seat) - 1px), rgba(0, 0, 0, 0.18) calc(var(--seat) - 1px) var(--seat)), var(--pf, var(--pc));
  transition: width 0.5s ease;
}
.seg.dark-fill { color: rgba(255, 255, 255, 0.92); }
.seg span { overflow: hidden; white-space: nowrap; padding: 0 2px; }
.majority-line {
  position: absolute; top: 14px; bottom: -6px; width: 2px; margin-left: -1px;
  background: var(--accent); box-shadow: var(--glow); border-radius: 2px; pointer-events: none;
}
.majority-label {
  position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase;
  text-shadow: 0 0 12px rgba(61, 232, 160, 0.4);
}
.bracket-row { display: flex; margin-top: 10px; font-size: 12px; color: var(--dim); }
.bracket { flex: none; min-width: 0; border-top: 2px solid var(--edge-bright); padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bracket.right { text-align: right; }
.bracket.mid { text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 13px; color: var(--dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .num { color: var(--bright); }
.legend .lg-pct { display: none; }
body.view-tv .legend .lg-pct { display: inline; color: var(--dim); font-weight: 400; margin-left: 2px; }
body.view-tv .legend b.num { margin-right: 2px; }

/* ---------- Flags ---------- */
.flag-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); font-size: 14px; }
.flag-banner.tint-flag { box-shadow: inset 0 0 0 1px rgba(232, 106, 106, 0.3), var(--glow-flag); }
.flag-banner strong { font-weight: 700; }
.flag-icon { font-weight: 800; font-family: var(--font-mono); }

/* ---------- Party table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -8px; }
table.parties { width: 100%; border-collapse: collapse; font-size: 14px; }
.parties th {
  font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em;
  text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--edge); white-space: nowrap;
}
.parties th:first-child, .parties td:first-child { text-align: left; }
.parties td { padding: 10px 8px; text-align: right; border-bottom: 1px solid rgba(30, 48, 40, 0.6); white-space: nowrap; }
.parties tr:last-child td { border-bottom: 0; }
.parties td.num { color: var(--dim); }
.parties td.total { color: var(--bright); font-weight: 700; font-size: 16px; }
.parties td.ovh { color: var(--attn); }
.parties td.sp { color: var(--dim); }
.parties td.sp small { font-size: 11px; margin-left: 2px; }
.parties td.sp small.up { color: var(--attn); }
.parties td.sp small.down { color: var(--faint); }
.parties .pname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.parties .pname .abbr { font-weight: 600; color: var(--bright); }
.parties .pname .full { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.parties tr.unqualified td { opacity: 0.5; }
.parties .zero { color: var(--faint); opacity: 0.6; }
@media (max-width: 560px) { .parties .pname .full { display: none; } }

/* ---------- Watchlist ---------- */
.watch-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.wcard { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.wcard.is-tossup { border-color: rgba(184, 245, 220, 0.3); }
.wcard-head { display: flex; align-items: flex-start; gap: 6px; }
.e-open {
  flex: 1; min-width: 0; min-height: var(--tap); text-align: left; background: none; border: 0; padding: 0;
  display: flex; flex-direction: column; justify-content: center;
}
.e-open h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); padding: 1px 6px; border-radius: 4px; background: var(--neutral-tint); }
.star {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 10px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px; color: var(--faint);
  margin: -6px -8px 0 0;
}
.star:hover { background: var(--raised); }
.star[aria-pressed="true"] { color: var(--attn); text-shadow: 0 0 12px rgba(184, 245, 220, 0.5); }
.race { display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.cand { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.cand .bar { align-self: stretch; border-radius: 2px; background: var(--pf, var(--pc)); }
.cand .who { min-width: 0; }
.cand .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand .who small { color: var(--pt); font-size: 12px; font-weight: 600; }
.cand .votes { text-align: right; font-size: 14px; }
.cand .votes small { display: block; color: var(--faint); font-size: 12px; }
.cand.runner { opacity: 0.72; }
.cand.runner .who b { font-weight: 500; }
.share { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--abyss); gap: 1px; }
.share i { background: var(--pf, var(--pc)); }
.wfoot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--dim); margin-top: auto; }
.wstats { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wfoot .num { color: var(--bright); }
.wfoot .badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.counted { display: flex; align-items: center; gap: 8px; }
.meter { width: 54px; height: 4px; border-radius: 2px; background: var(--abyss); overflow: hidden; box-shadow: inset 0 0 0 1px var(--edge); }
.meter i { display: block; height: 100%; background: var(--dim); }
.call-note { font-size: 12px; color: var(--attn); }
.call-note.is-strong { color: var(--flag); }
.cand-empty { font-size: 13px; color: var(--faint); padding: 4px 0; }
/* Seat sources: 2023 starting points dimmed; conflicts ringed. */
/* Before votes: only the 2023 holder line is softened slightly */
.wcard.is-baseline .race { opacity: 0.85; }
.wcard.is-called { border-color: rgba(184, 245, 220, 0.35); }
.wcard.conflict-strong { border-color: rgba(232, 106, 106, 0.6); box-shadow: var(--shadow-card), 0 0 0 1px rgba(232, 106, 106, 0.6), var(--glow-flag); }
.wcard.conflict-close { border-color: rgba(184, 245, 220, 0.55); box-shadow: var(--shadow-card), 0 0 0 1px rgba(184, 245, 220, 0.4), var(--glow-attn); }
.is-highlight { animation: seatPing 1.2s ease-out 3; }
@keyframes seatPing { 0% { outline: 3px solid var(--accent); outline-offset: 2px; } 100% { outline: 3px solid transparent; outline-offset: 8px; } }
.empty { color: var(--faint); font-size: 14px; padding: 12px 4px; }

/* ---------- All electorates ---------- */
.search-wrap { margin-bottom: 8px; }
input[type="search"] {
  width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: 10px;
  background: var(--abyss); border: 1px solid var(--edge); font-size: 16px; /* 16px stops iOS zoom */
  -webkit-appearance: none; appearance: none;
}
input[type="search"]::placeholder { color: var(--faint); }
input[type="search"]:focus { border-color: var(--edge-bright); outline: none; box-shadow: var(--glow-sm); }
.e-list { max-height: 640px; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -8px; padding: 0 8px; }
.e-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid rgba(30, 48, 40, 0.6); border-radius: 8px; }
.e-row:last-child { border-bottom: 0; }
.e-row .e-open {
  flex-direction: row; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px;
}
.e-row .e-open:hover { background: var(--raised); }
.e-row .stripe { width: 4px; align-self: stretch; border-radius: 2px; background: var(--pf, var(--pc)); flex: none; }
.e-row .ename { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.e-row .lead { font-size: 13px; font-weight: 600; color: var(--pt); min-width: 40px; }
.e-row .margin { font-size: 13px; color: var(--dim); min-width: 56px; text-align: right; }
.e-row .pc { font-size: 12px; color: var(--faint); min-width: 44px; text-align: right; }
.e-row .badge { min-width: 62px; justify-content: center; }
.e-row .star { margin: 0; }
.mark { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; }
.mark-called { color: var(--attn); background: rgba(184, 245, 220, 0.1); }
.mark-2023 { color: var(--dim); background: var(--neutral-tint); }
.mark-strong { color: var(--flag); background: rgba(232, 106, 106, 0.12); }
.mark-close { color: var(--attn); background: rgba(184, 245, 220, 0.1); }
.e-row.is-baseline .ename, .e-row.is-baseline .lead, .e-row.is-baseline .stripe { opacity: 0.55; }
.e-row.conflict-strong { box-shadow: inset 0 0 0 1px rgba(232, 106, 106, 0.6); }
.e-row.conflict-close { box-shadow: inset 0 0 0 1px rgba(184, 245, 220, 0.45); }
@media (max-width: 520px) { .mark-strong, .mark-close { display: none; } }
@media (max-width: 520px) { .e-row .pc { display: none; } }

/* ---------- Scenario ---------- */
.scenario-block + .scenario-block { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--edge); }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-value { font-size: 22px; font-weight: 600; color: var(--bright); }
input[type="range"] {
  width: 100%; height: var(--tap); margin: 4px 0 0; background: transparent; -webkit-appearance: none; appearance: none;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-deep) var(--fill), var(--abyss) var(--fill));
  box-shadow: inset 0 0 0 1px var(--edge);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--bright); border: 3px solid var(--accent-deep); box-shadow: var(--glow-sm);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--abyss); box-shadow: inset 0 0 0 1px var(--edge); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent-deep); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--bright); border: 3px solid var(--accent-deep); }

.bloc-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.bloc-col h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--dim); display: flex; justify-content: space-between; }
.bloc-col h4 .num { color: var(--bright); }
.bloc-col .chips { display: flex; flex-direction: column; gap: 6px; }
.bloc-chip {
  min-height: var(--tap); width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  border-radius: 10px; border: 0; text-align: left; font-size: 14px; font-weight: 600;
  background: color-mix(in srgb, var(--pc) 12%, var(--raised));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 40%, transparent);
  transition: transform 0.1s ease;
}
.bloc-chip:active { transform: scale(0.97); }
.bloc-chip .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloc-chip .num { color: var(--dim); font-size: 13px; }
.bloc-chip.is-pending { opacity: 0.55; }

.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--edge-bright);
  background: var(--raised); font-weight: 600; font-size: 14px; transition: transform 0.1s ease, background 0.15s;
}
.btn:hover { background: var(--overlay); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-danger { color: var(--flag); border-color: rgba(232, 106, 106, 0.4); background: rgba(232, 106, 106, 0.08); }
.btn-danger:hover { background: rgba(232, 106, 106, 0.16); }
.btn-attn { color: var(--attn); border-color: rgba(184, 245, 220, 0.35); background: rgba(184, 245, 220, 0.06); }
.reset-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reset-row p { font-size: 13px; color: var(--dim); flex: 1 1 200px; }

/* ---------- Events ---------- */
.events { max-height: 640px; overflow-y: auto; }
.events li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid rgba(30, 48, 40, 0.6); }
.events li:last-child { border-bottom: 0; }
.events time { font-size: 12px; color: var(--faint); grid-row: span 2; padding-top: 2px; }
.events .ev-name { font-weight: 600; }
.events .ev-swing { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.events .arrow { color: var(--faint); }

/* ---------- Footer caveats ---------- */
.caveats { padding: 8px 6px; font-size: 13px; color: var(--dim); display: flex; flex-direction: column; gap: 6px; max-width: 80ch; }
.caveats strong { color: var(--bright); }

/* ---------- Sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 9, 7, 0.66); animation: fadeIn 0.15s ease-out both;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 16px 16px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.22s ease-out both;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) and (min-height: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 16px; }
}
.sheet-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 22px; }
.sheet-meta { font-size: 13px; color: var(--dim); margin-bottom: 14px; }
.close {
  width: var(--tap); height: var(--tap); border-radius: 10px; border: 0; background: var(--raised);
  font-size: 22px; color: var(--dim); flex: none;
}
.cand-list { display: flex; flex-direction: column; gap: 6px; }
.cand-btn {
  width: 100%; min-height: 56px; display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 12px 8px 8px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface); text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.cand-btn:hover { background: var(--raised); }
.cand-btn:disabled { cursor: default; color: inherit; opacity: 1; }
.cand-btn:disabled:hover { background: var(--surface); }
.cand-btn .bar { align-self: stretch; border-radius: 3px; background: var(--pf, var(--pc)); }
.cand-btn .who b { display: block; font-weight: 600; }
.cand-btn .who small { color: var(--pt); font-size: 12px; font-weight: 600; }
.cand-btn .who em { font-style: normal; color: var(--attn); font-size: 12px; font-weight: 600; margin-left: 6px; }
.cand-btn .votes { text-align: right; }
.cand-btn .votes small { display: block; color: var(--faint); font-size: 12px; }
.cand-btn.is-winner { border-color: color-mix(in srgb, var(--pc) 60%, transparent); background: color-mix(in srgb, var(--pc) 10%, var(--surface)); }
.cand-btn .who em.muted { color: var(--faint); }
.sheet-source { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.sheet-source strong { font-weight: 700; }
.sheet-source .flag-text { color: var(--flag); font-weight: 600; }
.quick-calls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.btn-call { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding: 8px 14px; text-align: left; min-height: 56px; }
.btn-call small { font-size: 12px; font-weight: 500; color: var(--pt, var(--dim)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.btn-call[aria-pressed="true"] { border-color: color-mix(in srgb, var(--pc) 70%, transparent); background: color-mix(in srgb, var(--pc) 14%, var(--raised)); }
.btn-call[aria-pressed="true"] span::after { content: ' ✓'; color: var(--attn); }
.sheet-sub { margin: 4px 0 8px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.sheet-help { font-size: 12px; color: var(--faint); margin-top: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px);
  background: var(--overlay); border: 1px solid var(--edge-bright); box-shadow: var(--shadow-card);
}
.toast.is-error { color: var(--flag); border-color: rgba(232, 106, 106, 0.4); }

@media (prefers-reduced-motion: reduce) {
  .live-dot::after, .sheet, .sheet-backdrop { animation: none; }
  .seg { transition: none; }
}

/* One-column top section (specials reduced to a single line). */
.v-cols.v-single { grid-template-columns: minmax(0, 1fr); }
.v-single .v-col { padding-top: 18px; }
.v-specials { margin-top: 10px; font-size: calc(20px * var(--vg, 1)); color: var(--dim); font-weight: 600; }
.v-specials b { font-size: 1.35em; }
.v-specials .v-sp-left { color: var(--accent-bright); }
.v-specials b { color: var(--bright); }

/* A called seat takes the colour of the party it's called for */
.wcard.is-called { background: linear-gradient(to bottom, color-mix(in srgb, var(--pc) 16%, var(--surface)), var(--surface) 70%); }
.wcard.is-called:not(.conflict-strong):not(.conflict-close) {
  border-color: color-mix(in srgb, var(--pc) 70%, transparent);
  box-shadow: var(--shadow-card), 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent);
}
.call-tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--pc) 28%, transparent); color: var(--pt); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 60%, transparent); }
.e-row.is-called .e-open { background: color-mix(in srgb, var(--pc) 12%, transparent); }

.sheet-source { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sheet-source .sheet-uncall { margin-left: auto; min-height: 36px; padding: 6px 14px; font-size: 14px; }

/* All electorates: quick filters (same look as the Scenario tab) */
.e-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.e-filter {
  min-height: var(--tap); padding: 0 14px; border-radius: 999px; border: 1px solid var(--edge);
  background: var(--surface); color: var(--dim); font-size: 13px; font-weight: 600;
}
.e-filter .num { color: var(--faint); margin-left: 4px; font-size: 12px; }
.e-filter[aria-pressed="true"] { background: var(--overlay); color: var(--bright); border-color: var(--edge-bright); }
.e-filter[aria-pressed="true"] .num { color: var(--dim); }

/* Footer: quiet links for clearing calls and resetting */
.foot-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.foot-ctl .link { background: none; border: 0; padding: 8px 0; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; font: inherit; cursor: pointer; }
.foot-ctl .link:disabled { opacity: 0.4; cursor: default; }
.foot-ctl .link.danger { color: var(--flag); font-weight: 600; }
.flag-actions { margin-top: 10px; }
.v-basis .link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ----- outcome change: confetti for a move left, a slow dim-down for a move right ----- */
.fx-overlay {
  position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 16px;
  cursor: pointer; transition: opacity 0.8s ease;
}
.fx-overlay.fx-out { opacity: 0; }
.fx-card {
  max-width: 560px; width: 100%; text-align: center; padding: 28px 24px; border-radius: 20px;
  background: rgba(10, 20, 16, 0.92); display: flex; flex-direction: column; gap: 10px;
}
.fx-kicker { font-size: 12px; letter-spacing: 0.14em; }
.fx-head { font-size: clamp(30px, 7vw, 54px); line-height: 1.05; letter-spacing: -0.02em; }
.fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1002; pointer-events: none; }

.fx-good { background: radial-gradient(circle at 50% 45%, rgba(61, 232, 160, 0.22), rgba(0, 0, 0, 0.35) 70%); }
.fx-good .fx-card {
  box-shadow: 0 0 0 1px rgba(61, 232, 160, 0.55), 0 0 80px rgba(61, 232, 160, 0.35);
  animation: fx-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.fx-good .fx-kicker { color: var(--accent); }
.fx-good .fx-head { color: var(--accent-bright); text-shadow: 0 0 30px rgba(61, 232, 160, 0.5); }

.fx-bad {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: grayscale(0.9) brightness(0.6); backdrop-filter: grayscale(0.9) brightness(0.6);
  animation: fx-dim 1.4s ease both;
}
.fx-bad .fx-card {
  box-shadow: 0 0 0 1px rgba(232, 106, 106, 0.35), 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: fx-sink 1.6s ease-out both;
}
.fx-bad .fx-kicker { color: var(--flag, #e86a6a); }
.fx-bad .fx-head { color: #c9cdcb; }

@keyframes fx-pop { from { transform: scale(0.6); } to { transform: scale(1); } }
@keyframes fx-dim { from { opacity: 0; } to { opacity: 1; } }
@keyframes fx-sink { from { transform: translateY(-40px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .fx-good .fx-card, .fx-bad, .fx-bad .fx-card { animation: none; }
}

/* Close button on every notification */
.fx-pill, .fx-card { position: relative; }
.fx-pill { position: fixed; }
.fx-close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px; line-height: 1; cursor: pointer;
  color: var(--bright); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);
}
.fx-close:hover { background: rgba(255, 255, 255, 0.16); }
.fx-pill { padding-right: 56px; }
.fx-card { padding-left: 56px; padding-right: 56px; }
body.view-tv .fx-close { width: 48px; height: 48px; font-size: 22px; top: 14px; right: 14px; }

/* Dead heat: gold, both sides' colours, the card throbs. */
.fx-tie { background: radial-gradient(circle at 50% 45%, rgba(240, 196, 80, 0.2), rgba(0, 0, 0, 0.45) 70%); }
.fx-tie .fx-card {
  box-shadow: 0 0 0 1px rgba(240, 196, 80, 0.6), 0 0 90px rgba(240, 196, 80, 0.35);
  animation: fx-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both, fx-throb 1.6s 0.6s ease-in-out infinite;
}
.fx-tie .fx-kicker { color: #f0c450; }
.fx-tie .fx-head { color: #ffe08a; text-shadow: 0 0 30px rgba(240, 196, 80, 0.5); }
.fx-score { display: flex; align-items: baseline; justify-content: center; gap: 14px; font-size: 22px; }
.fx-score b { font-size: 2.4em; color: var(--bright); line-height: 1; }
.fx-team { color: var(--pt, var(--pc)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8em; }
.fx-eq { font-size: 1.8em; color: #f0c450; }
.fx-note { color: var(--dim); font-size: 15px; }
body.view-tv .fx-score { font-size: 34px; }
body.view-tv .fx-note { font-size: 24px; }
@keyframes fx-throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .fx-tie .fx-card { animation: none; } }

/* Seat swing: a card under the header, the impact on top and seats below. */
.fx-pill {
  position: fixed; top: 84px; left: 50%; z-index: 1000; transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px)); padding: 14px 18px; border-radius: 18px;
  background: rgb(12, 24, 19); color: var(--bright); cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
  animation: fx-drop 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both; transition: opacity 0.6s ease;
}
.fx-pill.fx-out { opacity: 0; }
.fx-pill.fx-good { background-image: none; box-shadow: 0 0 0 1px rgba(61, 232, 160, 0.6), 0 0 40px rgba(61, 232, 160, 0.35); }
.fx-pill.fx-bad { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 0 0 1px rgba(232, 106, 106, 0.45), 0 12px 30px rgba(0, 0, 0, 0.5); animation: fx-drop-slow 0.9s ease-out both; }
.fx-impact { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.fx-impact { align-items: flex-start; }
.fx-moves { display: flex; flex-direction: column; gap: 4px; }
.fx-move { display: inline-flex; align-items: center; gap: 8px; }
.fx-move b { color: var(--bright); }
.fx-darr { font-size: 0.8em; }
.fx-move.is-up .fx-darr { color: var(--accent); }
.fx-move.is-down .fx-darr { color: var(--flag, #e86a6a); }
.fx-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.fx-tag { font-size: 0.6em; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.fx-good .fx-tag { color: var(--accent); }
.fx-bad .fx-tag { color: var(--flag, #e86a6a); }
.fx-impact .fx-now { color: var(--dim); font-weight: 400; font-size: 0.6em; white-space: nowrap; }
.fx-pill.fx-good .fx-arrow { color: var(--accent); }
.fx-pill.fx-bad .fx-arrow { color: var(--flag, #e86a6a); }
.fx-pill.fx-even { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 12px 30px rgba(0, 0, 0, 0.5); }
.fx-pill.fx-even .fx-arrow { color: var(--attn); }
/* TV: big enough to read from the couch */
body.view-tv .fx-pill { top: 120px; width: 860px; padding: 26px 80px 26px 32px; gap: 16px; border-radius: 26px; }
body.view-tv .fx-impact { font-size: 34px; gap: 16px; }
body.view-tv .fx-seat { padding-top: 16px; gap: 10px; }
body.view-tv .fx-seat-head { font-size: 26px; }
body.view-tv .fx-seat-head .faint, body.view-tv .fx-flip { font-size: 20px; }
body.view-tv .fx-cand { font-size: 22px; gap: 12px; }
body.view-tv .fx-more { font-size: 18px; }
body.view-tv .fx-card { max-width: 1000px; padding: 48px 80px; gap: 16px; border-radius: 28px; }
body.view-tv .fx-kicker { font-size: 22px; }
body.view-tv .fx-head { font-size: 84px; line-height: 1; }
.fx-seat { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fx-seat-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.fx-seat-head .faint { margin-left: auto; font-size: 13px; }
.fx-flip { font-size: 13px; font-weight: 600; }
.fx-cand { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fx-cand .chip-dot { background: var(--pf, var(--pc)); }
.fx-cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-cname small { font-size: 12px; margin-left: 4px; }
.fx-more { font-size: 13px; }
@keyframes fx-drop { from { transform: translate(-50%, -30px); } to { transform: translate(-50%, 0); } }
@keyframes fx-drop-slow { from { transform: translate(-50%, -12px); } to { transform: translate(-50%, 0); } }

/* Outcome change: the page and the card shake with excitement. */
.fx-shake main.layout { animation: fx-shake 1.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
.fx-shake .fx-good .fx-card { animation: fx-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both, fx-jiggle 0.9s 0.5s ease-in-out both; }
@keyframes fx-shake {
  10%, 90% { transform: translate(-2px, 1px) rotate(-0.3deg); }
  20%, 80% { transform: translate(4px, -2px) rotate(0.4deg); }
  30%, 50%, 70% { transform: translate(-6px, 2px) rotate(-0.6deg); }
  40%, 60% { transform: translate(6px, -1px) rotate(0.6deg); }
}
@keyframes fx-jiggle {
  0%, 100% { transform: scale(1) rotate(0); }
  20% { transform: scale(1.06) rotate(-2deg); }
  40% { transform: scale(1.04) rotate(2deg); }
  60% { transform: scale(1.06) rotate(-1.5deg); }
  80% { transform: scale(1.02) rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) { .fx-pill, .fx-shake main.layout, .fx-shake .fx-good .fx-card { animation: none; } }

/* Footer switches for the animations. */
.fx-switches { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-left: auto; }
.fx-switch {
  font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--dim); border: 1px solid rgba(255, 255, 255, 0.14);
}
.fx-switch::before { content: '○ '; }
.fx-switch.is-on { color: var(--accent); border-color: rgba(61, 232, 160, 0.45); background: rgba(61, 232, 160, 0.08); }
.fx-switch.is-on::before { content: '● '; }
@media (prefers-reduced-motion: reduce) { .fx-pill { animation: none; } }

/* TV seat card: 8 per page, 4 across. Each candidate: name, then party; votes large on the right. */
.tvc {
  min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07); font-size: 17px;
}
.tvc.is-tossup { border-color: rgba(240, 190, 80, 0.45); }
.tvc.is-called { background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 16%, transparent), transparent 70%); }
.tvc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 19px; }
.tvc-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvc-head .badge { font-size: 12px; padding: 2px 9px; flex: none; }
.tvc-cands { display: flex; flex-direction: column; gap: 10px; }
.tvc-cand { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; min-width: 0; }
.tvc-bar { grid-row: 1 / span 2; width: 4px; align-self: stretch; border-radius: 2px; background: var(--pf, var(--pc)); }
.tvc-name { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.tvc-party { grid-column: 2; grid-row: 2; font-size: 13px; font-weight: 600; line-height: 1.2; }
.tvc-votes { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-size: 22px; color: var(--bright); }
.tvc-cand.is-runner .tvc-votes { color: var(--dim); }
.tvc-cand .tvc-note { font-size: 14px; color: var(--dim); }
.tvc.is-pending { background: rgba(255, 255, 255, 0.02); }
.tvc.is-pending .tvc-cands { gap: 8px; }
.tvc.is-pending .tvc-cand { grid-template-columns: 4px minmax(0, 1fr) auto; }
.tvc.is-pending .tvc-bar { grid-row: 1; }
.tvc.is-pending .tvc-party { grid-column: 3; grid-row: 1; }
.tvc-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--dim); padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); }

/* TV seat card: seat changed party since 2023 */
.tvc-flip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 0 -2px; padding: 5px 10px; border-radius: 8px;
  font-size: 15px; font-weight: 700; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); }
.tvc-flip .arrow { margin: 0 6px; color: var(--dim); }
.tvc-flip-tag { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bright); }
.tvc-flip.is-left { background: rgba(229, 57, 53, 0.16); border-color: rgba(229, 57, 53, 0.5); }
.tvc-flip.is-left .tvc-flip-tag { color: #ff8a80; }
.tvc-flip.is-right { background: rgba(30, 136, 229, 0.16); border-color: rgba(30, 136, 229, 0.5); }
.tvc-flip.is-right .tvc-flip-tag { color: #82b1ff; }
.tvc-flip.is-kingmakers { background: rgba(0, 191, 165, 0.14); border-color: rgba(0, 191, 165, 0.5); }
.tvc-flip.is-kingmakers .tvc-flip-tag { color: #64ffda; }
.tvc.has-flip { gap: 4px; padding-top: 9px; padding-bottom: 9px; }
.tvc.has-flip .tvc-cands { gap: 4px; }
.tvc.has-flip .tvc-foot { padding-top: 5px; }
.tvc.has-flip .tvc-flip { padding: 3px 10px; margin: 0; }

/* ===== "Can the specials flip it?" dashboard ===== */
.area-flip { display: flex; flex-direction: column; gap: 14px; }
.fp-headrow { margin-bottom: 0; align-items: center; flex-wrap: wrap; }
.fp-countdown { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--dim);
  background: rgba(61, 232, 160, 0.08); border: 1px solid rgba(61, 232, 160, 0.3); white-space: nowrap; }
.fp-countdown b { color: var(--accent-bright); }
.fp-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.fp-sub-label { font-size: 12px; font-weight: 600; color: var(--dim); margin-top: 4px; }
.fp-sub-label.is-danger { color: #ff8a80; }
.fp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; }
@media (max-width: 760px) { .fp-grid { grid-template-columns: minmax(0, 1fr); } }
.fp-tile { border-radius: 14px; padding: 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.07); min-width: 0; }

/* Result */
.fp-result { display: flex; flex-direction: column; gap: 12px; }
.fp-score { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.fp-side { display: flex; flex-direction: column; }
.fp-side.is-right { align-items: flex-end; }
.fp-sl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.fp-big { font-family: var(--font-display); font-size: 64px; font-weight: 700; line-height: 0.95; letter-spacing: -0.03em; color: var(--dim); }
.fp-big.is-win { color: var(--accent-bright); text-shadow: 0 0 24px rgba(61, 232, 160, 0.4); }
.fp-side.is-right .fp-big.is-win { color: var(--bright); text-shadow: none; }
.fp-vs { color: var(--faint); padding-bottom: 12px; }
.fp-bar { position: relative; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.06); overflow: visible; }
.fp-bar i { position: absolute; top: 0; bottom: 0; transition: width 0.4s ease; }
.fp-bar i.is-left { left: 0; border-radius: 7px 0 0 7px; background: linear-gradient(90deg, var(--p-lab, #d82c20), var(--p-top, #32dac3)); }
.fp-bar i.is-right { right: 0; border-radius: 0 7px 7px 0; background: linear-gradient(90deg, var(--p-act, #fde401), var(--p-nat, #00529f)); }
.fp-bar b { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--accent-bright); box-shadow: 0 0 8px rgba(61, 232, 160, 0.7); transition: left 0.4s ease; }
.fp-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--dim); }
.fp-meta b { color: var(--bright); }
.fp-verdict { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.fp-verdict.is-good { color: #06231a; background: var(--accent-bright); }
.fp-verdict.is-tie { color: #2b1f00; background: #f0be50; }
.fp-verdict.is-bad { color: var(--bright); background: rgba(30, 136, 229, 0.35); }
.fp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.fp-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 10px; cursor: pointer; color: #06231a;
  background: var(--accent); border: 1px solid transparent; }
.fp-btn.is-ghost { color: var(--dim); background: transparent; border-color: rgba(255, 255, 255, 0.15); }

/* Switches */
.fp-levers { display: flex; flex-direction: column; gap: 8px; }
.fp-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.fp-chip { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; cursor: pointer; user-select: none;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); transition: background 0.15s, border-color 0.15s; }
.fp-chip:hover { background: rgba(255, 255, 255, 0.06); }
.fp-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fp-chip.is-on { background: rgba(61, 232, 160, 0.1); border-color: rgba(61, 232, 160, 0.55); }
.fp-chip.is-danger.is-on { background: rgba(229, 57, 53, 0.12); border-color: rgba(229, 57, 53, 0.55); }
.fp-sw { flex: none; position: relative; width: 30px; height: 18px; border-radius: 9px; background: rgba(255, 255, 255, 0.14); transition: background 0.15s; }
.fp-sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--bright); transition: transform 0.15s; }
.fp-chip.is-on .fp-sw { background: var(--accent); }
.fp-chip.is-danger.is-on .fp-sw { background: #e53935; }
.fp-chip.is-on .fp-sw::after { transform: translateX(12px); }
.fp-chip-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.fp-chip-main b { font-size: 14px; color: var(--bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-chip-main small { font-size: 12px; color: var(--faint); font-weight: 600; }
.fp-chip-num { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.fp-chip-num b { font-size: 15px; color: var(--bright); }
.fp-chip-num small { font-size: 11px; color: var(--faint); }
.fp-chip.is-shift { padding: 11px 12px; }
.fp-chip.is-shift .fp-chip-main small { font-weight: 400; }
.fp-info { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 12px/1 var(--font-display, inherit); font-style: italic;
  color: var(--accent); background: rgba(61, 232, 160, 0.1); border: 1px solid rgba(61, 232, 160, 0.35); cursor: pointer; padding: 0; }
.fp-info:hover { background: rgba(61, 232, 160, 0.22); }
.fp-info.is-inline { width: 18px; height: 18px; font-size: 10px; vertical-align: -3px; cursor: default; }

/* Party gauges */
.fp-tips-wrap { display: flex; flex-direction: column; gap: 8px; }
.fp-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.fp-gauge { display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--pc); }
.fp-gauge.fp-tap { cursor: pointer; transition: background 0.15s; }
.fp-gauge.fp-tap:hover { background: rgba(255, 255, 255, 0.06); }
.fp-g-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.fp-g-head .party-text { font-weight: 700; font-size: 15px; }
.fp-g-head .fp-info { margin-left: auto; }
.fp-g-nums { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--bright); line-height: 1; }
.fp-g-nums .arrow { margin: 0 8px; color: var(--faint); font-size: 18px; }
.fp-g-track { position: relative; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); margin: 6px 0 2px; }
.fp-g-need { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--pc) 45%, transparent); border-radius: 5px; }
.fp-g-track b { position: absolute; top: -4px; width: 3px; height: 18px; margin-left: -1.5px; border-radius: 2px; }
.fp-g-now { background: var(--bright); }
.fp-g-target { background: var(--pc); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.fp-g-proj { top: -6px !important; width: 0 !important; height: 0 !important; margin-left: -6px !important; border-radius: 0 !important;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid #f0be50; }
.fp-g-proj.is-reach { border-top-color: var(--accent-bright); }
.fp-g-foot { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--faint); }
.fp-g-eff { color: var(--bright); font-weight: 600; }
.fp-g-hist { font-size: 12px; color: var(--faint); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.fp-note { font-size: 12px; color: var(--faint); }

/* TV page version: no controls, fills the rotating area */
.tv-rot-grid.is-flip { display: block; overflow: hidden; }
.flip-panel.is-tv { display: flex; flex-direction: column; gap: 12px; }
.flip-panel.is-tv .fp-headrow h2 { display: none; }
.flip-panel.is-tv .fp-headrow { justify-content: flex-start; }
.flip-panel.is-tv .fp-countdown { font-size: 17px; }
.flip-panel.is-tv .fp-grid { grid-template-columns: 0.9fr 1.1fr 1.3fr; }
.flip-panel.is-tv .fp-tips-wrap { display: contents; }
.flip-panel.is-tv .fp-tips-wrap > .fp-label { display: none; }
.flip-panel.is-tv .fp-big { font-size: 72px; }
.flip-panel.is-tv .fp-sl, .flip-panel.is-tv .fp-label { font-size: 14px; }
.flip-panel.is-tv .fp-meta { font-size: 16px; }
.flip-panel.is-tv .fp-verdict { font-size: 16px; }
.flip-panel.is-tv .fp-chips { grid-template-columns: 1fr 1fr; }
.flip-panel.is-tv .fp-chip-main b { font-size: 17px; }
.flip-panel.is-tv .fp-chip-num b { font-size: 18px; }
.flip-panel.is-tv .fp-tips { grid-template-columns: 1fr; gap: 8px; }

/* History pop-up */
.hm-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(4, 10, 8, 0.72); backdrop-filter: blur(4px); }
.hm { position: relative; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; background: var(--surface, #111a16);
  border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.hm h3 { font-family: var(--font-display); font-size: 21px; font-weight: 600; padding-right: 44px; }
.hm-sub { margin-top: 6px; color: var(--dim); font-size: 15px; }
.hm-sub b { color: var(--bright); }
.hm-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.hm-list li { display: grid; grid-template-columns: 52px 1fr; gap: 2px 12px; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.hm-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.hm-year { grid-row: 1 / span 3; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--bright); }
.hm-main { font-size: 15px; color: var(--dim); }
.hm-main b { color: var(--bright); }
.hm-main .arrow { margin: 0 4px; color: var(--faint); }
.hm-move { grid-column: 2; font-size: 14px; font-weight: 600; }
.hm-move.is-up { color: var(--accent); }
.hm-move.is-down { color: #ff8a80; }
.hm-move b { color: inherit; }
.hm-list .hm-note { grid-column: 2; }
.hm-note { font-size: 13px; color: var(--faint); margin-top: 2px; }
.hm > .hm-note { margin-top: 14px; }
.hm-sum { margin-top: 14px; font-size: 15px; color: var(--dim); }
.hm-sum b { color: var(--bright); }
.hm-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06); color: var(--bright); font-size: 16px; cursor: pointer; }
.fp-chip-main b { white-space: normal; overflow-wrap: normal; font-size: 13.5px; }
.fp-chip { gap: 8px; padding: 9px 8px; }
.fp-chip-num small { display: none; }
.fp-chip-main small .pct { color: var(--faint); }
/* TV: three columns (result | switches | gauges) */
.flip-panel.is-tv { display: grid; grid-template-columns: 0.85fr 1.15fr 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; height: 100%; }
.flip-panel.is-tv .fp-headrow { grid-column: 1 / -1; }
.flip-panel.is-tv .fp-grid { display: contents; }
.flip-panel.is-tv .fp-tips-wrap { display: flex; min-height: 0; }
.flip-panel.is-tv .fp-tips { grid-template-columns: 1fr; gap: 8px; }
.flip-panel.is-tv .fp-gauge { padding: 10px 12px; gap: 5px; }
.flip-panel.is-tv .fp-g-nums { font-size: 22px; }
.flip-panel.is-tv .fp-g-hist, .flip-panel.is-tv .fp-g-foot { font-size: 13px; }
.flip-panel.is-tv .fp-chips { grid-template-columns: 1fr 1fr; }
.flip-panel.is-tv .fp-big { font-size: 80px; }
.flip-panel.is-tv .fp-result { justify-content: center; gap: 18px; }
.flip-panel.is-tv .fp-headrow { display: none; } /* the TV header already counts down to specials */
.flip-panel.is-tv { grid-template-rows: minmax(0, 1fr); }
.flip-panel.is-tv .fp-g-track { margin: 3px 0 0; }
.flip-panel.is-tv .fp-g-foot span:first-child { display: none; }
.flip-panel.is-tv .fp-g-foot { margin-top: -2px; }
.flip-panel.is-tv .fp-gauge { padding: 7px 12px; gap: 3px; border-top-width: 2px; }
.flip-panel.is-tv .fp-tips { gap: 6px; }

/* Count complete, normal view: a compact results block - words left, numbers right */
.verdict.is-final .v-cols { margin-top: 8px; }
.verdict.is-final .v-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; row-gap: 6px; align-items: center; padding: 16px 20px; }
.verdict.is-final .v-col > :not(.v-nums) { grid-column: 1; }
.verdict.is-final .v-nums { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
.verdict.is-final .v-big { font-size: clamp(56px, 8vw, 84px); }
.verdict.is-final .v-bars { margin-top: 10px; }
@media (max-width: 640px) {
  .verdict.is-final .v-col { grid-template-columns: minmax(0, 1fr); }
  .verdict.is-final .v-nums { grid-column: 1; grid-row: auto; }
}

/* Verdict badge sits on the side that wins */
.fp-meta.is-left { flex-direction: row; }
.fp-meta.is-right { flex-direction: row-reverse; }
.fp-meta.is-tie { flex-direction: column; align-items: center; }
/* "Past" history button (replaces the i icon) */
.fp-info { width: auto; height: auto; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px 4px 7px; border-radius: 999px;
  font: 600 12px/1 var(--font-body, inherit); font-style: normal; letter-spacing: 0.01em; white-space: nowrap; }
.fp-info svg { flex: none; }
.fp-info.is-inline { width: auto; height: auto; padding: 2px 7px 2px 5px; font-size: 11px; vertical-align: 1px; }

.fp-chip-main { gap: 4px; }
.fp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.fp-row b { min-width: 0; }
.fp-chip-margin { flex: none; font-size: 16px !important; color: var(--bright); }
.fp-row small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fp-row .fp-info { padding: 3px 8px 3px 6px; font-size: 11px; }
/* TV: four party gauges as a 2x2 grid */
.flip-panel.is-tv .fp-tips { grid-template-columns: 1fr 1fr; align-content: start; }
.flip-panel.is-tv .fp-g-nums { font-size: 20px; }
.flip-panel.is-tv .fp-g-nums .arrow { margin: 0 4px; font-size: 15px; }
.flip-panel.is-tv .fp-g-hist { font-size: 12px; }

/* Party vote sliders in the specials panel: change in points, centred on no change. */
.fp-pv { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 8px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); }
.fp-pv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.fp-pv-head .fp-sub-label { margin-top: 0; }
.fp-pv-btns { display: flex; gap: 6px; }
.fp-btn.is-small { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.fp-pv-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 46px 108px; align-items: center; gap: 8px; min-height: 30px; font-size: 13px; }
.fp-pv-row .party-text { font-weight: 700; }
.fp-pv-d { text-align: right; color: var(--faint); }
.fp-pv-row.is-moved .fp-pv-d { color: var(--bright); font-weight: 600; }
.fp-pv-to { text-align: right; color: var(--faint); white-space: nowrap; }
.fp-pv-to b { color: var(--bright); }
.fp-pv-range { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; }
.fp-pv-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,0.35) calc(50% - 1px), rgba(255,255,255,0.35) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.1)); }
.fp-pv-range::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); }
.fp-pv-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: var(--pc, var(--bright)); border: 2px solid var(--bright); box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.fp-pv-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--pc, var(--bright)); border: 2px solid var(--bright); }
.fp-pv-note { margin: 4px 0 0; font-size: 12px; color: var(--faint); }
.fp-result.is-pending .fp-big, .fp-result.is-pending .fp-meta { opacity: 0.55; transition: opacity 0.2s; }
@media (max-width: 480px) { .fp-pv-row { grid-template-columns: 36px minmax(0, 1fr) 44px; } .fp-pv-to { display: none; } }

.fp-summary { margin: -4px 0 0; font-size: 15px; line-height: 1.45; color: var(--dim); max-width: 75ch; }

/* "History ›": reads as a link to more detail, not a reset. */
.fp-info { color: var(--dim); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.14); font-style: normal; font-weight: 600; }
.fp-info svg { color: var(--accent); }
.fp-info .fp-chev { font-size: 1.25em; line-height: 0.8; margin-left: 1px; color: var(--faint); }
.fp-info:hover, .fp-tap:hover .fp-info { color: var(--bright); background: rgba(255, 255, 255, 0.1); }
.fp-info:hover .fp-chev, .fp-tap:hover .fp-info .fp-chev { color: var(--bright); }

/* Narrow screens: title and countdown share the top row, the Live/Scenario switch goes full width below. */
@media (max-width: 640px) {
  .topbar .status { order: 2; }
  .topbar .tabs { order: 3; flex-basis: 100%; }
  .topbar .tabs a { flex: 1; text-align: center; }
  .hdr-countdown .num { font-size: 18px; }
  .hdr-countdown small { font-size: 10px; letter-spacing: 0.04em; }
}
@media (max-width: 400px) {
  .topbar .status { flex-basis: 100%; }
  .hdr-countdown { flex-direction: row; align-items: baseline; gap: 8px; }
}

/* Specials volume slider, above the party sliders. */
.fp-vol { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; margin: 0 0 4px;
  padding-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.fp-vol .fp-sub-label { margin-top: 0; }
.fp-vol-val { font-size: 13px; color: var(--faint); }
.fp-vol-val b { color: var(--bright); }
.fp-summary .faint { font-size: 13px; }

/* Seats per party in the specials scenario */
.fp-seats-by { display: flex; flex-direction: column; gap: 6px; }
.fp-seats-cap { font-size: 12px; color: var(--faint); }
.fp-seat-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-seat { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); font-size: 13px; }
.fp-seat b { color: var(--bright); font-size: 14px; }
.fp-seat.is-moved { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); }
.fp-seat-d { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.fp-seat-d.is-up { color: var(--accent-bright); }
.fp-seat-d.is-down { color: var(--flag); }
.flip-panel.is-tv .fp-seat { font-size: 15px; }
.flip-panel.is-tv .fp-seat b { font-size: 17px; }

/* Count and turnout stats under the preliminary results */
.v-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.v-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06); min-width: 0; }
.v-stat-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.v-stat b { font-size: 22px; color: var(--bright); line-height: 1.2; }
.v-stat-sub { font-size: 12px; color: var(--faint); }
@media (max-width: 480px) { .v-stats { gap: 6px; } .v-stat { padding: 8px 10px; } .v-stat b { font-size: 17px; } .v-stat-label { font-size: 10px; letter-spacing: 0.04em; } }

/* Likelihood badge on the tipping-point cards */
.fp-odds { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.fp-odds.is-likely { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fp-odds.is-tossup { color: #f0be50; border-color: rgba(240, 190, 80, 0.45); background: rgba(240, 190, 80, 0.1); }
.fp-odds.is-unlikely { color: var(--faint); border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); }

/* Share of the specials needed on the tipping-point cards */
.fp-g-q { font-size: 13px; color: var(--dim); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.fp-g-q b { color: var(--bright); font-size: 15px; }
.fp-g-typ { font-size: 12px; color: var(--faint); }
