*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --navy: #0a1020;
  --navy-deep: #070c16;
  --surface: #0f192a;
  --surface-raised: #152136;
  --surface-soft: #101b2e;
  --cream: #f0ebe0;
  --muted: #9aa8bc;
  --faint: #76869e;
  --red: #cc1f35;
  --red-bright: #ff4058;
  --blue: #4b6fff;
  --blue-bright: #7392ff;
  --border: #243249;
  --border-soft: #1c293e;
  --map-dem: #3d65db;
  --map-rep: #cb3f50;
  --map-neutral: #45566d;
  --party-dem: #7194ff;
  --party-rep: #f47e89;
  --party-other: #c7b580;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Anton", Impact, "Arial Narrow", sans-serif;
}

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, select { touch-action: manipulation; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: #fff; }
button:disabled { cursor: wait; opacity: 0.65; }
button, select { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--blue-bright);
  outline-offset: 4px;
}
::selection { background: var(--blue); color: white; }
[hidden] { display: none !important; }
svg { display: block; }

.page-width { width: min(100% - 2rem, 1440px); margin-inline: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-200%);
  padding: 0.75rem 1rem;
  background: var(--cream);
  color: var(--navy);
  font-weight: 700;
}
.skip-link:focus { transform: none; color: var(--navy); }

/* A small masthead keeps the map close to the top of the page. */
.site-header {
  border-bottom: 3px solid var(--red);
  background: var(--navy-deep);
}
.header-inner {
  min-height: 69px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-logo {
  flex: 0 0 auto;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.035em;
  text-decoration: none;
  white-space: nowrap;
}
.site-logo em { color: var(--blue-bright); font-style: normal; }
.site-logo em:first-of-type { color: var(--red-bright); }
.header-actions { display: flex; gap: 0.5rem; align-items: center; }
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.65rem 1rem;
  font-size: 0.84rem;
  line-height: 1.2;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.button svg { width: 18px; height: 18px; flex: 0 0 auto; }
.button-red { background: var(--red); color: #fff; }
.button-red:hover { background: #df263e; color: #fff; }
.button-blue { background: var(--blue); color: #fff; }
.button-blue:hover { background: #5b7cff; color: #fff; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--surface); color: var(--cream); }
.button-outline { border-color: #53627c; background: transparent; color: var(--cream); }
.button-outline:hover { border-color: var(--cream); background: var(--surface-raised); }

.page-intro { padding: 1.6rem 0 1.4rem; }
.page-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.75rem, 10.3vw, 5.65rem);
  line-height: 1.03;
  letter-spacing: -0.015em;
}
.page-intro h1 .headline-red { color: var(--red-bright); }
.page-intro h1 .headline-blue { display: block; color: var(--blue-bright); }
.intro-copy { margin: 0.7rem 0 0; color: var(--muted); font-size: 1rem; }

/* Map and state results. All grid children are allowed to shrink. */
.election-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.map-panel, .results-panel { min-width: 0; border: 1px solid var(--border); background: var(--surface); }
.map-panel { overflow: hidden; }
.map-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.control-field { min-width: 0; }
.control-field label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.74rem; font-weight: 500; }
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  min-height: 45px;
  border: 1px solid #354560;
  border-radius: 3px;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.6rem 2.1rem 0.6rem 0.75rem;
  background: #0a1324;
  color: var(--cream);
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select-wrap select:hover { border-color: #617493; }
.select-wrap select:focus-visible { outline-offset: 2px; }
.select-wrap > svg { position: absolute; right: 0.7rem; top: calc(50% - 8px); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.map-surface { position: relative; padding: 1.2rem 0.25rem 0.4rem; }
.results-map { position: relative; width: 100%; min-height: 205px; }
.results-map:empty { aspect-ratio: 1.65; display: grid; place-items: center; }
.results-map:empty::before { content: "Loading the map…"; color: var(--muted); font-size: 0.9rem; }
.results-map > svg { width: 100%; height: auto; display: block; overflow: visible; }

/* Fills show the reported party lead; all interactions change only the outline. */
.map-state, .state {
  --state-fill: var(--map-neutral);
  fill: var(--state-fill);
  stroke: var(--navy);
  stroke-width: 1.4px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 140ms ease, stroke 140ms ease;
  touch-action: manipulation;
}
.map-state[data-lead="D"], .state[data-lead="D"] { --state-fill: var(--map-dem); }
.map-state[data-lead="R"], .state[data-lead="R"] { --state-fill: var(--map-rep); }
.map-state:hover, .state:hover { stroke: #fff; stroke-width: 2px; }
.map-state.is-selected, .state.is-selected, .map-state[aria-pressed="true"], .state[aria-pressed="true"], .state-selected {
  stroke: #fff;
  stroke-width: 2.8px;
}
.map-state:focus-visible, .state:focus-visible { outline: none; stroke: #fff; stroke-width: 3.2px; }
.map-selection-outline { fill: none; stroke: #fff; stroke-width: 2.8px; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-label, .state-label { fill: #f4f4f8; font-family: var(--font-body); font-size: 11px; font-weight: 600; pointer-events: none; user-select: none; text-anchor: middle; }
.state-label.is-muted, .map-label.is-muted { fill: #a0afc3; }
.state-callout { --state-fill: var(--map-neutral); cursor: pointer; }
.state-callout[data-lead="D"] { --state-fill: var(--map-dem); }
.state-callout[data-lead="R"] { --state-fill: var(--map-rep); }
.state-callout line, .callout-line { stroke: #788ba7; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.state-callout rect { fill: var(--state-fill); stroke: #49607e; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.state-callout.is-selected rect, .state-callout[aria-pressed="true"] rect { stroke: #fff; stroke-width: 2px; }
.state-callout:hover rect, .state-callout:focus-visible rect { stroke: #fff; stroke-width: 2px; }
.state-callout:focus-visible { outline: none; }
.state-callout text { fill: var(--cream); font: 600 12px var(--font-body); text-anchor: middle; pointer-events: none; }
.map-tooltip {
  position: fixed;
  z-index: 30;
  max-width: 235px;
  padding: 0.55rem 0.7rem;
  border: 1px solid #506584;
  border-radius: 3px;
  background: #0a1020;
  color: var(--cream);
  box-shadow: 0 5px 20px #0004;
  font-size: 0.8rem;
  pointer-events: none;
}
.map-error { margin: 1rem !important; }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.55rem 1rem; list-style: none; padding: 0.6rem 1rem 1rem; margin: 0; }
.map-legend li { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.67rem; line-height: 1.35; }
.legend-swatch { width: 10px; height: 10px; border-radius: 1px; border: 1px solid transparent; flex: 0 0 auto; }
.legend-dem { background: var(--map-dem); }
.legend-rep { background: var(--map-rep); }
.legend-neutral, .legend-current, .legend-waiting, .legend-unavailable { background: var(--map-neutral); border-color: #61738d; }
.legend-selected { background: transparent; border: 2px solid #fff; }
#map-color-note { margin: -0.25rem 0 1rem; padding: 0 1rem; color: var(--muted); font-size: 0.71rem; line-height: 1.6; }

.feed-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1rem; border-top: 1px solid var(--border); padding: 0.8rem 1rem 0; }
.feed-status-line { min-width: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 0.74rem; color: var(--cream); }
.status-dot { width: 6px; height: 6px; flex: 0 0 auto; display: inline-block; border-radius: 50%; background: #8493ab; }
.status-dot[data-status="current"], .status-dot[data-status="live"], .status-dot.is-current, .status-dot.is-live { background: #8dc5ac; box-shadow: 0 0 0 3px #8dc5ac14; }
.status-dot[data-status="waiting"], .status-dot[data-status="loading"], .status-dot.is-waiting { background: #8ea3cf; }
.status-dot[data-status="stale"], .status-dot[data-status="error"], .status-dot.is-stale, .status-dot.is-error { background: #dfbd7a; }
.checked-label { color: var(--faint); font-size: 0.67rem; font-variant-numeric: tabular-nums; }
.coverage-note { margin: 0; padding: 0.5rem 1rem 0.9rem; font-size: 0.78rem; color: var(--muted); }
.coverage-note strong { color: var(--cream); font-weight: 600; }

/* These reusable classes are shared by the live race renderer. */
.results-panel { scroll-margin-top: 1rem; }
.results-panel:focus { outline: none; }
.results-heading { padding: 1.15rem 1.2rem 1rem; border-bottom: 1px solid var(--border); }
.results-heading h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.75rem, 5vw, 2.15rem); line-height: 1.1; letter-spacing: 0.005em; }
#state-subtitle { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.state-lead-summary { margin: 0.8rem 0 0; border-left: 3px solid var(--map-neutral); padding: 0.6rem 0.7rem; background: #ffffff04; }
.state-lead-summary[data-lead="D"] { border-left-color: var(--map-dem); }
.state-lead-summary[data-lead="R"] { border-left-color: var(--map-rep); }
.lead-summary-title { display: block; color: var(--cream); font-size: 0.81rem; line-height: 1.45; font-weight: 600; }
.lead-summary-detail { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.69rem; line-height: 1.6; }
.official-link { display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%; margin-top: 0.7rem; color: var(--blue-bright); font-size: 0.78rem; font-weight: 600; text-decoration: none; }
.official-link:hover { text-decoration: underline; }
.official-link svg { width: 13px; height: 13px; flex: 0 0 auto; }
.race-results { padding: 0 1.2rem; }
.race-card { padding: 1.1rem 0; min-width: 0; border-bottom: 1px solid var(--border); }
.race-card:last-child { border-bottom: 0; }
.race-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.race-header > div { min-width: 0; }
.race-title { margin: 0; color: var(--cream); font-size: 0.92rem; font-weight: 600; line-height: 1.35; }
.race-meta { display: block; margin: 0.25rem 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.race-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.25rem; max-width: 145px; padding: 0.2rem 0.4rem; border: 1px solid #455b74; border-radius: 2px; color: #b0c3d9; font-size: 0.61rem; line-height: 1.35; font-weight: 500; text-align: center; }
.race-badge.is-called, .race-badge.is-certified { color: #acd7bd; border-color: #436b56; background: #8dc5ac09; }
.race-badge.is-stale { color: #ddc38e; border-color: #786544; }
.candidate-list { display: flex; flex-direction: column; gap: 0.85rem; list-style: none; margin: 0; padding: 0; }
.candidate-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.75rem; row-gap: 0.35rem; min-width: 0; }
.candidate-identity { min-width: 0; align-self: start; }
.candidate-name { display: block; overflow-wrap: anywhere; color: var(--cream); font-size: 0.85rem; line-height: 1.3; font-weight: 500; }
.candidate-party { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.66rem; line-height: 1.3; }
.candidate-counts { display: flex; flex-direction: column; align-items: flex-end; min-width: 4rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.candidate-percent { color: var(--cream); font-size: 0.92rem; font-weight: 600; line-height: 1.2; }
.candidate-votes { margin-top: 0.2rem; color: var(--muted); font-size: 0.66rem; line-height: 1.3; }
.candidate-track { grid-column: 1 / -1; overflow: hidden; height: 4px; background: #253249; border-radius: 1px; }
.candidate-fill { display: block; height: 100%; max-width: 100%; min-width: 0; background: var(--party-other); transition: width 240ms ease; }
.party-dem .candidate-fill, .candidate-fill.party-dem, .party-d .candidate-fill, .candidate-fill.party-d { background: var(--party-dem); }
.party-rep .candidate-fill, .candidate-fill.party-rep, .party-r .candidate-fill, .candidate-fill.party-r { background: var(--party-rep); }
.party-other .candidate-fill, .candidate-fill.party-other { background: var(--party-other); }
.party-dem .candidate-party, .candidate-party.party-dem { color: #99b1ff; }
.party-rep .candidate-party, .candidate-party.party-rep { color: #efa0a8; }
.party-other .candidate-party, .candidate-party.party-other { color: #c8bc97; }
.candidate-lead { display: inline-block; margin-left: 0.35rem; color: var(--muted); font-size: 0.61rem; font-weight: 400; }
.race-footer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 0.65rem; margin-top: 0.85rem; color: var(--faint); font-size: 0.65rem; line-height: 1.45; }
.race-footer a { color: var(--muted); }
.race-footer .race-source { flex-basis: 100%; overflow-wrap: anywhere; }
.race-note { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.race-group-title { margin: 1.1rem 0 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); color: var(--blue-bright); font-size: 0.75rem; line-height: 1.4; font-weight: 600; }
.empty-state { min-height: 265px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 2rem 0.7rem; text-align: center; }
.selection-mark { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 1rem; border: 1px solid #344766; border-radius: 50%; background: #101e33; color: var(--blue-bright); }
.selection-mark svg { width: 38px; height: 38px; }
.empty-title { margin: 0; color: var(--cream); font-family: var(--font-display); font-size: 1.4rem; line-height: 1.2; font-weight: 400; }
.empty-copy { max-width: 270px; margin: 0.65rem 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.65; }
.empty-state .button { margin-top: 1rem; }
.notice { margin: 1rem 0; padding: 0.9rem 1rem; border: 1px solid #566079; border-left: 3px solid var(--blue-bright); border-radius: 2px; background: #17243a; color: #bcc9db; font-size: 0.8rem; line-height: 1.6; }
.notice strong { color: var(--cream); }
.notice p { margin: 0.3rem 0 0; }
.notice a { color: #aec0ff; }
.notice.is-warning, .notice.is-stale { border-left-color: #dfbd7a; }

/* Sources are present without competing with the result cards. */
.below-map { display: flex; flex-direction: column; gap: 1.3rem; padding: 1.2rem 0 1.5rem; }
.source-notes { min-width: 0; }
.source-notes > p { margin: 0 0 0.35rem; color: var(--muted); font-size: 0.71rem; line-height: 1.6; }
.source-notes a { color: #bdc8d9; text-decoration-color: #5c6c86; }
.source-notes > .source-caveat { color: var(--faint); }
.about-data { margin-top: 0.6rem; color: var(--muted); font-size: 0.74rem; }
.about-data summary { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; list-style: none; color: #bdc8d9; }
.about-data summary::-webkit-details-marker { display: none; }
.about-data summary span { font-size: 1rem; line-height: 1; transition: transform 120ms ease; }
.about-data[open] summary span { transform: rotate(45deg); }
.about-data-copy { max-width: 760px; padding: 0.25rem 0 0.1rem; }
.about-data-copy p { margin: 0.6rem 0; line-height: 1.7; }
.voter-help { display: flex; flex-direction: column; gap: 0.25rem; align-self: flex-start; min-height: 44px; border-left: 2px solid #3d5271; padding: 0.1rem 0 0.1rem 0.9rem; text-decoration: none; }
.voter-help > span { color: var(--muted); font-size: 0.73rem; }
.voter-help strong { display: flex; align-items: center; gap: 0.5rem; color: var(--cream); font-size: 0.75rem; font-weight: 500; }
.voter-help svg { width: 12px; height: 12px; color: var(--blue-bright); }
.voter-help:hover strong { text-decoration: underline; text-underline-offset: 0.2em; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; border-top: 1px solid var(--border-soft); padding-block: 1rem 1.5rem; color: var(--faint); font-size: 0.65rem; }
.site-footer > span:first-child { font-weight: 600; letter-spacing: 0.06em; }

/* Native dialog keeps the sticker separate from the live count. */
.sticker-dialog { position: fixed; width: min(500px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; margin: auto; border: 1px solid #40577d; border-top: 3px solid var(--blue); border-radius: 4px; padding: 2rem 1.25rem 1.25rem; background: var(--navy); color: var(--cream); box-shadow: 0 20px 100px #0009; text-align: center; }
.sticker-dialog::backdrop { background: #020711db; backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 0.5rem; right: 0.5rem; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 2px; background: transparent; color: var(--muted); }
.dialog-close:hover { background: var(--surface-raised); color: white; }
.dialog-close svg { width: 20px; height: 20px; }
.sticker-dialog h2 { margin: 0.4rem 0 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 7vw, 2.35rem); line-height: 1.1; }
.sticker-copy { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.95rem; }
.sticker-image { display: block; width: min(100%, 320px); height: auto; max-height: 44dvh; object-fit: contain; margin: 1.5rem auto; }
.dialog-actions { display: flex; justify-content: center; gap: 0.65rem; flex-wrap: wrap; }
.dialog-status { min-height: 1em; margin: 0.75rem 0 0; font-size: 0.75rem; color: var(--muted); }
.share-status:not(:empty) { position: fixed; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 110; max-width: calc(100vw - 2rem); margin: 0; border: 1px solid #526a94; border-radius: 3px; padding: 0.8rem 1rem; background: #14233c; color: var(--cream); font-size: 0.8rem; box-shadow: 0 8px 32px #0006; }
.share-status:empty { display: none; }

@media (min-width: 600px) {
  .page-width { width: min(100% - 3rem, 1440px); }
  .header-inner { min-height: 74px; }
  .site-logo { font-size: 1.65rem; }
  .header-actions { gap: 0.75rem; }
  .page-intro { padding-top: 1.8rem; }
  .intro-copy { font-size: 1.05rem; }
  .map-controls { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1rem; padding: 1rem 1.2rem; }
  .map-surface { padding: 1.4rem 0.7rem 0.5rem; }
  .map-legend { padding-inline: 1.25rem; gap: 0.6rem 1.2rem; }
  .map-legend li { font-size: 0.7rem; }
  .feed-bar { padding-inline: 1.25rem; }
  .coverage-note { padding-inline: 1.25rem; }
  .race-results { padding-inline: 1.4rem; }
  .results-heading { padding-inline: 1.4rem; }
  .sticker-dialog { padding: 2.4rem 2rem 1.4rem; }
}

@media (min-width: 960px) {
  .page-width { width: min(100% - 4rem, 1440px); }
  .page-intro { padding: 1.8rem 0 1.6rem; }
  .page-intro h1 { font-size: clamp(3.5rem, 5.8vw, 5.65rem); }
  .page-intro h1 .headline-blue { display: inline; }
  .intro-copy { margin-top: 0.6rem; }
  .election-workspace { grid-template-columns: minmax(0, 1.75fr) minmax(325px, 1fr); gap: 1.25rem; }
  .map-controls { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .map-surface { padding-top: 2rem; padding-bottom: 0.9rem; }
  .results-map { min-height: 310px; }
  .results-map:empty { aspect-ratio: 1.65; }
  .results-panel { max-height: min(860px, calc(100vh - 235px)); overflow-y: auto; scrollbar-color: #435b80 transparent; scrollbar-width: thin; }
  .results-panel:has(.empty-state) { min-height: 530px; }
  .results-heading { position: sticky; top: 0; z-index: 2; background: var(--surface); }
  .empty-state { min-height: 375px; }
  .below-map { flex-direction: row; justify-content: space-between; gap: 2rem; }
  .source-notes { flex: 1; }
  .voter-help { margin-top: 0.1rem; flex: 0 0 auto; }
}

@media (min-width: 1300px) {
  .election-workspace { grid-template-columns: minmax(0, 1.85fr) minmax(390px, 1fr); gap: 1.5rem; }
  .map-controls { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); max-width: none; }
  .results-map { min-height: 370px; }
  .map-surface { padding-inline: 1rem; padding-top: 2.25rem; }
  .results-panel:has(.empty-state) { min-height: 590px; }
  .empty-state { min-height: 430px; }
  .map-legend { gap: 0.7rem 1.5rem; }
}

@media (max-width: 380px) {
  .page-width { width: calc(100% - 1.5rem); }
  .header-inner { gap: 0.4rem; }
  .site-logo { font-size: 1.25rem; }
  .header-actions { gap: 0.2rem; }
  .header-actions .button { padding-inline: 0.6rem; font-size: 0.72rem; }
  .button-share svg { display: none; }
  .page-intro h1 { font-size: 2.65rem; }
  .map-controls { padding: 0.8rem; gap: 0.55rem; }
  .select-wrap select { padding-left: 0.6rem; padding-right: 1.6rem; }
  .select-wrap > svg { right: 0.5rem; }
  .results-map { min-height: 180px; }
  .map-legend { gap: 0.5rem 0.75rem; padding-inline: 0.8rem; }
  .map-legend li { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Live result detail states. */
.update-warning { color: #ead3a3; }
.race-footer .update-warning { flex-basis: 100%; }
.coverage-footnote { margin: 1rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.6; }
.candidate-lead { margin-left: 0; margin-top: .15rem; color: #c8d9ff; }

@media (max-width: 540px) {
  .header-inner { gap: .6rem; }
  .header-actions { gap: .45rem; }
  .button-share span { display: none; }
  .button-share { width: 40px; min-width: 40px; padding-inline: .5rem; }
  .header-actions .button-red { font-size: .75rem; padding-inline: .7rem; }
}
