/* Appearance changes surfaces only; D/R meanings stay the same in both themes. */
:root{--surface:#fff;--surface-soft:#f5f7fb;--map-water:#f8fafc;--map-boundary:#fff;--map-label:#172c45;--map-label-halo:#ffffffd9;--map-unmeasured:#cbd3df}
.appearance-control{display:flex;align-items:center;gap:7px;font-size:11px;font-weight:550;color:var(--muted);white-space:nowrap}.appearance-switch{border:0;width:50px;height:30px;border-radius:18px;padding:3px;background:#cdd4df;box-shadow:inset 0 1px 2px #11243b14;flex:none;display:block;transition:background .2s}.appearance-thumb{display:block;width:24px;height:24px;border-radius:50%;background:#fff;box-shadow:0 2px 5px #172a4550;transition:transform .2s}.appearance-switch[aria-checked=true]{background:#34c759}.appearance-switch[aria-checked=true] .appearance-thumb{transform:translateX(20px)}.appearance-switch:active{transform:none}.appearance-switch:focus-visible{outline:3px solid var(--green);outline-offset:4px}
.map-poll-hint{font-size:12px;margin:12px 0 0;color:var(--green);line-height:1.6}.is-poll-navigation .map-explainer{margin-top:4px}.map-state.is-cached .state-shape,.district-shape.is-cached path{stroke-dasharray:4 2}.map-band-neutral{stop-color:var(--map-unmeasured)}.us-poll-map stop:not(.map-band-neutral){stop-color:var(--map-color)}.house-dem{background:var(--party-dem)}.house-rep{background:var(--party-rep)}
.us-poll-map,.district-poll-map{background:var(--map-water);border-radius:14px}.state-shape,.district-shape path{stroke:var(--map-boundary)}.state-label,.state-code{fill:var(--map-label);stroke:var(--map-label-halo)}.district-shape text{fill:var(--map-label);stroke:var(--map-label-halo)}
:root[data-theme=dark]{color-scheme:dark;--bg:#101827;--paper:#182337;--surface:#182337;--surface-soft:#1d2b42;--ink:#edf3fc;--muted:#a6b5cb;--line:#35445c;--green:#a8c8f4;--deep:#263d62;--lime:#d8edc9;--shadow:0 18px 50px #0005;--party-dem-text:#9ebeff;--party-rep-text:#ffadb4;--party-dem-tint:#223c69;--party-rep-tint:#482b3a;--party-lib-text:#edcf81;--party-lib-tint:#403923;--party-green-text:#92dab2;--party-green-tint:#1d3a32;--party-independent-text:#c6aff2;--party-independent-tint:#352e4d;--party-constitution-text:#ddbf98;--party-constitution-tint:#3e342c;--party-nonpartisan-text:#91d8dd;--party-nonpartisan-tint:#203e48;--map-water:#131e30;--map-boundary:#182337;--map-label:#f4f7ff;--map-label-halo:#142137;--map-unmeasured:#506078}
[data-theme=dark] body{background:var(--bg)}
[data-theme=dark] :is(.sidebar,.mobile-nav){background:#121d2f}
[data-theme=dark] :is(.map-card,.real-polls,.real-poll-panel,.race-card,.summary-card,.watchlist,.spotlight,.event-row,.event-pop,dialog,.state-option,.poll-picker-result){background:var(--surface);border-color:var(--line)}
[data-theme=dark] :is(.button,.icon-button,.lang-mobile,.lang-button.active,.filter,.modal-close,.map-offices button,.map-toolbar select,.map-district select,.district-zoom button,.district-chips button,.district-filters input,.nav-count){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
[data-theme=dark] :is(.nav-button.active,.map-offices button.active,.map-view-tabs button.active,.segmented button.active,.district-filters button[aria-pressed=true],.state-option.selected){background:#304665;color:#f0f5ff;border-color:#7e9ac0}
[data-theme=dark] :is(.map-view-tabs,.segmented,.district-filters>div){background:#111d30}
[data-theme=dark] :is(.map-view-tabs button,.nav-button,.filter,.district-filters button,.map-offices button){color:var(--muted)}
[data-theme=dark] :is(.map-selection,.spot-race,.state-prompt,.detail-metrics div,.empty,.poll-race-choice,.poll-picker-filters,.poll-search-input,.real-source-box,.candidate-roster,.candidate-roster-row,.real-race-select){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
[data-theme=dark] :is(.real-bar,.vote-bar){background:#33435a}
[data-theme=dark] :is(.map-national-hint,.district-map-placeholder){background:#22324b;color:#c5d7ef}
[data-theme=dark] :is(.map-notice,.demo-notice,.modal-notice){background:#3c3224;color:#f3d49d;border-color:#695330}
[data-theme=dark] :is(.state-tile,.candidate-portrait,.candidate-initials,.district-overview-heading h3>span){background:#34445d;color:#d9e5f6}
[data-theme=dark] :is(.real-poll,.real-poll-card,.real-source,.poll-history-card){background:var(--surface);border-color:var(--line)}
[data-theme=dark] :is(.map-card-footer,.race-bottom,.district-overview,.map-photo-credits,.watch-row){border-color:var(--line)}
[data-theme=dark] :is(.district-map-source a,.map-explainer a,.map-photo-credits a){color:#b5d2fc}
[data-theme=dark] .map-no-election{--map-color:#283448}
[data-theme=dark] #map-hatch rect,[data-theme=dark] #district-hatch rect{fill:#344359}
[data-theme=dark] #map-hatch path,[data-theme=dark] #district-hatch path{stroke:#52647d}
[data-theme=dark] .map-state.is-selected .state-shape,[data-theme=dark] .map-state:focus .state-shape,[data-theme=dark] .district-shape:is(:hover,:focus,.is-selected) path{stroke:#f5db9c}
[data-theme=dark] .district-chips button.active{background:#375f94;color:white;border-color:#8da9ce}
[data-theme=dark] .map-gray{background:var(--map-unmeasured)}
[data-theme=dark] .button.primary{background:#365f94;color:#fff;border-color:#5d83b3}
[data-theme=dark] .map-race-card.is-active{border-color:#91b4e2;box-shadow:0 0 0 1px #91b4e244}
[data-theme=dark] .map-callout{stroke:#8c9fba}
@media(max-width:680px){.appearance-control{font-size:10px;gap:5px}.top-actions{gap:7px;flex-wrap:wrap;justify-content:flex-end}.appearance-switch{width:48px;height:30px}.appearance-switch[aria-checked=true] .appearance-thumb{transform:translateX(18px)}.appearance-control>span{display:none}.appearance-switch{min-height:30px}.appearance-control{min-height:44px}.map-national-hint{font-size:11px}}
@media(prefers-reduced-motion:reduce){.appearance-thumb,.appearance-switch,.state-shape{transition:none}html{scroll-behavior:auto}}

[data-theme=dark] :is(.poll-selection,.poll-selection-button,.poll-explanation,.live-race-option,.live-race-search input,.finder-filters select,.history-language select,.favorite-quick button){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
[data-theme=dark] :is(.live-race-option.selected,.live-race-option:hover){background:#304665;color:var(--ink)}
[data-theme=dark] :is(.history-snapshot-warning,.poll-age){color:#f1d29c}
[data-theme=dark] .real-data-badge{color:#a1d4bc}
[data-theme=dark] :is(.poll-selected,.poll-race-picker button,.roster-status,.skip,.button.subtle,.star-button.saved){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
[data-theme=dark] :is(.connection-error,.history-snapshot-warning){background:#3c3224;color:#f3d49d;border-color:#695330}
/* Provenance is available on demand in the map, poll history and activity feed. */
.poll-correction summary { cursor:pointer; min-height:44px; padding-block:12px; box-sizing:border-box; }
.poll-correction p { margin:.25rem 0 .5rem; }
