* { box-sizing: border-box; }
:root {
  /* Single source of truth for the topbar/ticker's own real rendered
     height -- body's padding-top and .ticker-bar's top/height (below)
     all read from these two instead of each hardcoding its own guess,
     so the phone-landscape compact-topbar media query (see this file's
     own "phone landscape" section) only has to override these two
     variables once and every dependent rule stays correctly in sync,
     rather than three separate hardcoded pixel values that could
     silently drift apart from each other. */
  --topbar-height: 3rem;
  --ticker-height: 2.2rem;
}
html, body { margin: 0; height: 100%; font-family: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace; color: #1a1a2e; }
/* Form controls don't inherit font-family from the page by default in
   most browsers' own UA stylesheets (they fall back to the OS UI font
   instead) -- explicit here so every button/dropdown/input actually
   renders in the same JetBrains Mono as everything else, not just plain
   text. Font family only; no size/weight/spacing touched, so nothing
   else about how these controls are laid out changes. */
button, input, select, textarea { font-family: inherit; }
/* The topbar/ticker offset lives here (on body, main's PARENT), not on main
   itself -- main's own scrolling box (overflow-y: auto, see below) needs
   its box boundaries to actually start below the ticker, not just push its
   content down while the box itself (and so its scrollbar) still spans
   from y=0. body's own padding shrinks the content area .main's height:
   100% resolves against, so main's whole box -- scrollbar included --
   genuinely begins below the fixed topbar/ticker instead of running the
   full page height with its top end hidden underneath them. position:
   fixed elements (.topbar, .ticker-bar) are positioned against the
   viewport regardless, so this padding never shifts them. */
body { padding-top: calc(var(--topbar-height) + var(--ticker-height)); }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: #1a1a2e;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
}
.topbar .brand { margin-right: 0.4rem; }
/* Pushes #remote-toggle-btn + #remote-status + #fullscreen-btn to the
   topbar's far right edge, in that order -- margin-left: auto on a flex
   child consumes all remaining space before it, so this group (and only
   this group, kept together as one flex item's own children rather than
   several separate auto-margined topbar items) lands flush right
   regardless of how much or how little other content sits to its left on
   a given page. */
.remote-group { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
/* The one broadcasting on/off control (see base.html's #remote-toggle-btn
   and remote_sync.js's own toggleRemoteBroadcast) -- same compact-pill
   family as .remote-status right next to it. .active (broadcasting
   currently ON) gets the same gold as .remote-status's own "connected"
   look; the default (off) state is a plain outline. */
.remote-toggle-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.remote-toggle-btn:hover { background: rgba(255, 255, 255, 0.15); }
.remote-toggle-btn.active { background: #f5b942; color: #1a1a2e; border-color: #f5b942; }
.remote-toggle-btn.active:hover { background: #ffcc66; }
/* Icon-only, square -- deliberately smaller/plainer than the text pills
   either side of it, matching the traditional look of a fullscreen
   toggle everywhere else on the web. Exactly one of its two child SVGs
   (see base.html) is visible at a time, swapped by
   remote_sync.js's own updateFullscreenButton. */
.fullscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}
.fullscreen-btn:hover { background: rgba(255, 255, 255, 0.15); }
/* Settings: a gear button (same square icon button as the fullscreen one) opening a
   right-aligned drop-down of links. Opened by clicking the gear (see base.html). */
.settings-dropdown { position: relative; flex: 0 0 auto; }
.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.settings-btn:hover, .settings-dropdown.open .settings-btn { background: rgba(255, 255, 255, 0.15); }
.settings-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.35rem;
  min-width: 8rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  padding: 0.35rem;
  z-index: 2600;
  flex-direction: column;
}
.settings-dropdown.open .settings-menu { display: flex; }
.settings-menu a {
  display: block;
  padding: 0.45rem 0.7rem;
  color: #1a1a2e;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 4px;
  white-space: nowrap;
}
.settings-menu a:hover { background: #eef1f5; }
.settings-menu .settings-menu-item {
  display: block; width: 100%; text-align: left; padding: 0.45rem 0.7rem; background: transparent; border: 0; color: #1a1a2e;
  font: inherit; font-size: 0.85rem; border-radius: 4px; white-space: nowrap; cursor: pointer;
}
.settings-menu .settings-menu-item:hover { background: #eef1f5; }
/* Broadcasting is on: the menu item says so with the live red dot, the same one the topbar's LIVE indicator carries. */
.settings-menu .settings-menu-item.active { font-weight: 700; }
.settings-menu .settings-menu-item.active::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.45rem; border-radius: 50%; background: #e5252a; }
/* FAQ page */
.faq-page { max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem; }
.faq-page h1 { font-size: 1.6rem; margin: 0.4rem 0 0; }
.faq-back-btn {
  border: 1px solid #c8ccd1;
  background: #fff;
  color: #1a1a2e;
  border-radius: 4px;
  width: 2.2rem;
  height: 2rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.faq-back-btn:hover { background: #eef1f5; }
a.faq-back-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
.faq-datasheet-link { font-size: 1rem; font-weight: 600; color: #1f4e8c; }
.faq-intro { color: #626977; line-height: 1.6; margin: 0.75rem 0 1.25rem; }
.faq-questions { display: grid; gap: 0.65rem; padding-bottom: 2rem; }
.faq-item { border: 1px solid #c8ccd1; border-radius: 4px; background: #fff; min-width: 0; }
.faq-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 4px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { background: #eef1f5; }
.faq-item > summary:focus-visible { outline: 2px solid #1f4e8c; outline-offset: 3px; }
.faq-item > summary > span { min-width: 0; overflow-wrap: anywhere; }
.faq-chevron { flex: 0 0 20px; transition: transform 150ms ease; }
.faq-item[open] > summary { border-bottom: 1px solid #e1e4e9; border-radius: 4px 4px 0 0; background: #f5f6f9; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-answer { padding: 0.1rem 1rem 0.25rem; font-size: 0.9rem; line-height: 1.7; overflow-wrap: anywhere; }
.faq-answer a { color: #1f4e8c; }
.faq-answer .faq-datasheet-link { font-size: inherit; }
@media (prefers-reduced-motion: reduce) {
  .faq-chevron { transition: none; }
}
.datasheet-download { display: inline-block; padding: 0.45rem 0.9rem; border: 1px solid #1f4e8c; border-radius: 4px; color: #1f4e8c; text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.datasheet-download:hover { background: #1f4e8c; color: #fff; }
.datasheet-viewer { width: 100%; height: calc(100vh - 16rem); min-height: 420px; border: 1px solid #c8ccd1; border-radius: 4px; margin-top: 0.6rem; }
.fullscreen-btn svg.hidden { display: none; }
.fullscreen-btn.hidden { display: none; }
/* The logo (base.html): wordmark, trend line and a blinking cursor, all in one colour (set once, on .brand). The mark and cursor are sized in em from the
   wordmark -- 0.77em is JetBrains Mono's ascender height -- and sit on the text's baseline, so they scale together. */
.topbar .brand {
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
  color: #d9605a;
  text-decoration: none;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.2;
}
.topbar .brand-mark { width: 1.155em; height: 0.77em; margin-left: 0.28em; vertical-align: baseline; overflow: visible; }
.topbar .brand-line { fill: none; stroke: currentColor; stroke-width: 5.4; stroke-linecap: butt; stroke-linejoin: miter; }
.topbar .brand-head { fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
/* The typing cursor of a command prompt: a thin upright bar that is on for half of each cycle and off for the other half, with no fade (Windows' own blink
   rate). Viewers who ask for reduced motion see it steady. */
.topbar .brand-cursor { display: inline-block; width: 0.13em; height: 0.92em; margin-left: 0.26em; vertical-align: -0.1em; background: currentColor; animation: brand-cursor-blink 1.06s step-end infinite; }
@keyframes brand-cursor-blink { 0% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .topbar .brand-cursor { animation: none; } }
.topbar .state-name { opacity: 0.85; }
/* Same treatment as .uk-flag-icon (the world map's own country-flag
   labels) -- a small bordered icon that reads clearly against the dark
   topbar background regardless of how light or dark the flag itself is. */
.state-flag-icon { width: 22px; height: auto; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 2px; }
/* The original single Polls button (non-U.S. countries); the U.S. gets the Polls dropdown (#nav-dropdown-polls), a normal .nav-dropdown. Same visual family as
   .nav-dropdown-trigger (Election Maps / Data Visualization Maps). */
.polls-nav-link {
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.polls-nav-link:hover { background: #fff; color: #1a1a2e; border-color: #fff; }
.polls-nav-link.active { background: #fff; color: #1a1a2e; border-color: #fff; }
/* Hidden once a specific state/district election map is on screen (any of
   enterStateView/enterMarginMapView/enterVoterRegistrationView/
   enterHouseView/enterHouseViaHistory in map_app.js -- all of them, and
   only them, toggle #app-layout's "state-mode" class, so it's already the
   exact right signal to key off of here) -- back on the national map,
   .topbar and #app-layout are siblings under <body>, hence :has() rather
   than a plain descendant selector. */
body:has(#app-layout.state-mode) .polls-nav-link, body:has(#app-layout.state-mode) #nav-dropdown-polls { display: none; }
/* Hidden while the world map itself is on screen -- see map_app.js's
   setWorldNavVisible -- same reasoning as .national-office-toggle.hidden
   just below: nothing real to point at until a country is selected. */
.polls-nav-link.hidden { display: none; }
#nav-dropdown-polls.hidden { display: none; }

.polls-page { max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem; }
.polls-page h1 { font-size: 1.4rem; margin-bottom: 0.3rem; }
/* Filter bar at the top of /polls (see polls.js) -- state/election-type/
   office selects, all optional (blank = no constraint on that one
   dimension), combined with AND. */
.polls-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.9rem;
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f7f7f9;
}
.polls-filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.polls-filter-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  font-weight: 700;
}
.polls-filter-group select {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #1a1a2e;
  min-width: 160px;
}
.polls-filter-reset {
  align-self: flex-end;
  font-size: 0.78rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.polls-filter-reset:hover { border-color: #1a1a2e; }
.polls-filter-reset.hidden { display: none; }
.polls-filter-empty-hint.hidden { display: none; }
/* Filtered-out cards/groups/sections collapse entirely rather than just
   dimming -- an empty "Senate" heading with zero cards under it, or an
   empty "Primary" section, would read as a real (but blank) result
   instead of "hidden by your own filter". */
.polls-card.polls-card-filtered-out { display: none; }
.polls-office-group.polls-group-filtered-out { display: none; }
.polls-section.polls-section-filtered-out { display: none; }
.polls-section-heading {
  font-size: 1.1rem;
  margin: 2rem 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #1a1a2e;
}
.polls-group-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  margin: 1rem 0 0;
}
.polls-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 0;
}
.polls-card {
  display: block;
  color: inherit;
  text-decoration: none;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: #fff;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.polls-card:hover { border-color: #1a1a2e; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.polls-card-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.2rem; }
.polls-card-date { font-size: 0.75rem; color: #888; margin-bottom: 0.5rem; }
.polls-card-candidates { display: flex; flex-direction: column; gap: 0.4rem; }
.polls-card-candidate { display: flex; align-items: center; gap: 0.5rem; }
.polls-card-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #eee;
}
.polls-card-name { font-size: 0.8rem; color: #222; font-weight: 600; }
.polls-card-more { font-size: 0.7rem; color: #888; margin-top: 0.5rem; }
.key-race-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: #ffd166;
  color: #663c00;
}

/* Pushed to the far right of the topbar's flex row via margin-left: auto —
   only shown while viewing a specific House district (see
   showDistrictCounties in map_app.js), never on the national/state-overview
   views where there's no single district's PVI to show. */
.district-pvi-badge {
  display: inline-block;
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.national-office-toggle { display: flex; gap: 0.25rem; }
/* Only meaningful on the national map — hidden once drilled into a state
   (toggled via JS, since #app-layout's state-mode class can't target this
   topbar element with a CSS combinator — it comes before app-layout in the DOM). */
.national-office-toggle.hidden { display: none; }
/* "Data Maps & Tools" specifically (not the whole toggle above -- see
   setWorldNavVisible in map_app.js): hidden on the world map, where
   "Election Maps" stays visible but there's no US-specific margin/voter-
   registration data to show yet. */
#nav-dropdown-dataviz.hidden { display: none; }
/* Replaces #nav-dropdown-election while Peru's own map is on screen (see
   enterPeruFromWorld/backToWorldMap in map_app.js) -- Senate/House/Governor/
   House (Special) are US-specific offices that don't apply to Peru, so
   rather than leave that dropdown showing (or empty), a flag + country name
   takes its place, matching #nav-dropdown-dataviz's own "hidden while not
   meaningful for what's on screen" pattern above. */
#nav-dropdown-election.hidden { display: none; }
/* Same "hidden until its own country is on screen" pattern as
   #nav-dropdown-election.hidden just above -- see base.html's own
   comment on #nav-dropdown-canada-election. */
#nav-dropdown-canada-election.hidden { display: none; }
/* World-map-only Year menu (world_year.js shows it only while the actual world map is on screen). */
#nav-dropdown-year.hidden { display: none; }
.peru-topbar-label,
.colombia-topbar-label,
.uk-topbar-label { display: flex; align-items: center; gap: 0.4rem; color: #fff; font-weight: 600; }
.peru-topbar-label.hidden,
.colombia-topbar-label.hidden,
.uk-topbar-label.hidden { display: none; }
.peru-flag-icon,
.colombia-flag-icon,
.uk-flag-icon { width: 22px; height: auto; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 2px; }

/* Two top-level groups ("Election Maps" / "Data Visualization Maps"), each
   a hover-to-reveal dropdown of the office/mode buttons that used to sit
   flat in the topbar. The dropdown buttons themselves keep their original
   data-office attributes and click handling untouched (map_app.js's
   `#national-office-toggle button[data-office]` selector doesn't care how
   deeply they're nested) — this only restructures how they're grouped and
   shown. */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nav-dropdown-caret { font-size: 0.65rem; opacity: 0.85; }
/* The group containing the currently-active office/mode reads as "on,"
   even while its dropdown is closed — same idea as RealClearPolitics'
   red-highlighted nav section for whichever category you're in. */
.nav-dropdown.active .nav-dropdown-trigger { background: #fff; color: #1a1a2e; border-color: #fff; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.35rem;
  min-width: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  padding: 0.35rem;
  z-index: 2500;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
/* Real click/tap-driven fallback (see remote_sync.js's own click handler)
   alongside the plain :hover/:focus-within above -- a tap's "hover" state
   is inconsistent across real mobile browsers (some need a second tap to
   actually activate a link under a hover-only menu), so this dropdown
   needs a real toggled class to open reliably from a touch device, not
   just a mouse. */
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-menu button, .nav-dropdown-menu a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.7rem;
  border: none;
  background: transparent;
  color: #1a1a2e;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}
.nav-dropdown-menu button:hover, .nav-dropdown-menu a:hover { background: #eef1f5; }
.nav-dropdown-menu button.active, .nav-dropdown-menu a.active { background: #1a1a2e; color: #fff; }

/* Country/Year dropdowns currently have only one real value each (this app
   covers a single country/cycle) -- styled identically to a real menu
   item's .active state but as a plain <span>, not a button/link, since
   there's nothing else to switch to yet. */
.nav-dropdown-menu span.nav-dropdown-static {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: default;
}
.nav-dropdown-menu span.nav-dropdown-static.active { background: #1a1a2e; color: #fff; }

/* .topbar and .ticker-bar are both fixed (out of flow, always on screen
   even mid-scroll) -- main gets the matching top offset + reduced height so
   its content still starts exactly where it used to, just no longer
   reserving that space via normal document flow. */
/* The topbar/ticker offset is body's own padding now (see above), not
   anything here -- main just fills whatever content area that padding
   leaves. overflow-y: auto (not hidden) is the correct default everywhere:
   a no-op (no visible scrollbar) when content fits exactly, as the map
   SPA's own content always does, and a real working scrollbar -- genuinely
   confined to the area below the ticker, top arrow included, since main's
   own box now actually starts there -- when a plain content page (e.g.
   /polls, /polls/<race id>) runs taller than one viewport. Sidebars that
   genuinely need to scroll internally (.race-selector, .county-panel)
   still do, via their own overflow-y: auto -- scoped to their own box, so
   they never push main's own height past its share of the viewport. */
main { height: 100%; overflow-y: auto; }

.ticker-bar {
  height: var(--ticker-height);
  overflow: hidden;
  white-space: nowrap;
  background: #12121f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  position: fixed;
  /* Stacks directly under .topbar -- reads the same --topbar-height
     variable body's own offset above relies on. */
  top: var(--topbar-height);
  left: 0;
  right: 0;
  z-index: 2900;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
.ticker-track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: ticker-scroll 30s linear infinite;
}
.ticker-copy {
  display: inline-flex;
  align-items: center;
  flex: none;
}
.ticker-item {
  display: inline-block;
  padding: 0 1.5rem;
  color: #dcdce6;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}
.ticker-item::after {
  content: "•";
  margin-left: 1.5rem;
  opacity: 0.4;
}
.ticker-item.key { color: #ffd166; font-weight: 600; }
.ticker-item.interrupt { animation: ticker-flash 1s ease-in-out 3; border-radius: 3px; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes ticker-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(255, 209, 102, 0.35); }
}

.map { width: 100%; height: 100%; background: #eef1f5; position: relative; overflow: hidden; }
/* width/height are explicit pixel attributes set by map_app.js's own dims()
   (mapEl.clientWidth/clientHeight), matched 1:1 by an identical viewBox --
   a no-op here on this element's own real screen, since 100% of #map is
   already that same pixel size. It matters for remote_sync.js's own
   #app-layout mirror: a snapshot's width/height attrs are frozen at
   whatever the SENDING device's own #map happened to be, so without this
   rule the RECEIVING device would render a literal fixed-pixel box (its
   viewer's tablet-portrait/monitor-landscape shape) instead of one that
   fills whatever shape ITS OWN #map actually is -- this rule lets the
   already-matching viewBox's default preserveAspectRatio scale/letterbox
   it correctly instead. */
.app-svg { display: block; cursor: grab; width: 100%; height: 100%; }
.app-svg:active { cursor: grabbing; }

/* Anchored to #map's own left/right edges (not the sidebar's), so each
   button tracks the actual left/right-sidebar boundary regardless of
   whether that sidebar is at its full width or collapsed to 0 — no JS
   repositioning needed, the grid column change moves the boundary and the
   button (sitting flush against #map's edge either way) just follows it.
   Pinned to the top corner (not vertically centered) so the right one
   never overlaps .zoom-control, which owns the vertical center of the
   right edge. */
.sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  width: 22px;
  height: 32px;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1500;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.sidebar-toggle:hover { background: #eef1f5; }
/* Top-left corner of #map itself (not the topbar -- see map_app.js's
   updateBackToWorldBtnVisibility) -- shown only on the plain national US
   map (mode "national", not the world map itself), never while inside any
   individual state's own map, which already has its own "Back to
   Statewide/US Map" control in the left sidebar. */
.back-to-world-btn {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1500;
  padding: 0.5rem 0.85rem;
  border: 1px solid #1a1a2e;
  background: #fff;
  color: #1a1a2e;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.back-to-world-btn:hover { background: #1a1a2e; color: #fff; }
.sidebar-toggle-left { left: 0; border-radius: 0 6px 6px 0; border-left: none; }
.sidebar-toggle-right { right: 0; border-radius: 6px 0 0 6px; border-right: none; }
/* No sidebars exist outside state/margin-map/voter-registration/country modes
   (the national view has nothing to collapse). */
.app-layout:not(.state-mode):not(.margin-map-mode):not(.country-mode) .sidebar-toggle,
/* Germany's own plain 16-state map has no sidebar (just the boundaries --
   see its own .germany-states-view override further up that already
   hides .race-selector/.county-panel for the same reason); once drilled
   into one state's own constituencies it gets a real sidebar (statewide
   party results) same as every other country, so this only applies while
   .germany-states-view is still present. */
.app-layout.germany-mode.germany-states-view .sidebar-toggle,
/* Canada's plain province map has no sidebar; once a province (BC/Quebec
   ridings) or Alberta's referendum is open (.canada-province-selected) both
   sidebars exist and get their hide/show buttons back. */
.app-layout.canada-mode:not(.canada-province-selected) .sidebar-toggle {
  display: none;
}
/* Margin Maps' left sidebar is real (Statewide/By District picker), but
   its right county-panel only exists once a scenario is selected — see
   .app-layout.margin-map-mode's grid-template-columns override below. */
.app-layout.margin-map-mode:not(.scenario-active) .sidebar-toggle-right { display: none; }

.state-path, .county-path {
  stroke: #ffffff;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 0.1s ease;
}
/* County fills range from a near-white margin tint up to a fully saturated
   party/candidate color — a white border all but disappears against the
   light end of that range. A translucent dark stroke reads as a border
   against both light and dark fills instead of only showing up on one end. */
.county-path {
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
}
/* Alaska and Hawaii are drawn small, in their insets, and are mostly islands: a full
   1px white border swallows the Aleutians and the other small islands, so theirs is thinner. */
.state-path.state-path-inset { stroke-width: 0.3px; }
.state-path:hover, .county-path:hover { opacity: 0.8; }
/* Population View's own proportional tile grid map (see
   populationTileLayer/renderPopulationTileMap in map_app.js) -- a
   completely separate overlay layer, not a transform on .county-path
   itself, so it's styled independently here. */
.population-tile { cursor: pointer; transition: opacity 0.1s ease; }
.population-tile:hover { opacity: 0.85; }
.population-tile-fill { stroke: rgba(0, 0, 0, 0.45); stroke-width: 1px; vector-effect: non-scaling-stroke; }
/* A real county with no sourced registered-voter figure
   (CountyVoterRegistration's own disclosed gap) still gets a real tile
   (sized as the smallest among counties that DO have data) but with a
   hatch pattern instead of its normal choropleth fill, so it reads as
   "no data," never as "counted as zero population." Same convention (and
   the same hatch pattern) every prior Population View design used. */
.population-tile.no-data-population .population-tile-fill { fill: url(#cartogram-no-data-hatch) !important; stroke: rgba(0, 0, 0, 0.3); }
.population-tile-label {
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  dominant-baseline: hanging;
}
/* Required sizing-metric disclosure for a generic (non-US) Tree Map --
   see map_app.js's renderGenericTreeMap. Sits just above the tile grid
   (negative y, within populationTileLayer's own padded transform) so it
   never overlaps a tile. pointer-events: none -- purely informational,
   never steals a hover/click meant for the tile underneath it. */
.generic-tree-caption {
  pointer-events: none;
  font-size: 12px;
  font-weight: 600;
  fill: #555;
  dominant-baseline: text-after-edge;
}
/* World map landing screen -- every country is a plain, non-interactive
   gray shape except the United States (see map_app.js's renderWorld),
   which alone gets the pointer cursor/hover feedback and a real tooltip.
   Same translucent-dark-stroke reasoning as .county-path above -- a white
   border reads poorly against this map's light gray/yellow fills. */
.country-path { stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke; cursor: default; }
.country-path-highlight { cursor: pointer; transition: opacity 0.1s ease; }
.country-path-highlight:hover { opacity: 0.85; }
/* Major real lakes (the Great Lakes among them -- see map_app.js's
   renderWorld/fetchWorldLakesGeojson), filled the exact same color as
   .map's own ocean/background so a lake reads as the same body of water
   as the ocean around it, never a distinctly-colored feature. No stroke of
   its own -- it sits on top of the country fills below, which would
   otherwise erase any real international border running through the lake
   (e.g. US/Canada down the middle of the Great Lakes); .country-border-line
   below redraws those borders back on top of this fill. */
.country-path-lake { fill: #eef1f5; stroke: none; pointer-events: none; }
/* Peru's own regional (department-level) choropleth -- see renderPeruCountry
   in map_app.js. Same stroke treatment as .country-path, always clickable
   (unlike .country-path, which is only pointer-cursor for the two
   highlighted countries) since every department here has real results. */
.peru-region-path,
.colombia-region-path,
.portugal-region-path,
.uk-constituency-path,
.brazil-state-path,
.hungary-constituency-path,
.thailand-constituency-path,
.malta-district-path,
.denmark-district-path,
.faroe-region-path,
.iceland-constituency-path,
.barbados-constituency-path,
.costarica-region-path,
.nepal-constituency-path,
.germany-state-path,
.germany-constituency-path,
.sweden-valkrets-path,
.morocco-region-path,
.morocco-constituency-path,
.algeria-wilaya-path,
.antigua-constituency-path,
.kazakhstan-region-path,
.latvia-constituency-path,
.bulgaria-constituency-path,
.israel-region-path,
.serbia-municipality-path,
.france-department-path,
.italy-constituency-path,
.poland-constituency-path,
.slovakia-constituency-path,
.andorra-constituency-path,
.switzerland-constituency-path,
.slovenia-constituency-path,
.estonia-constituency-path,
.mongolia-constituency-path,
.legislative-unit-path,
.presidential-unit-path,
.combined-unit-path,
.national-shell-path,
.elsalvador-department-path,
.australia-state-path,
.australia-district-path,
.nz-electorate-path,
.spain-province-path,
.canada-province-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
/* Invisible minimum-size click/hover target for Sweden's own real
   single-city valkretsar (Stockholm/Malmo/Goteborg kommun), each
   genuinely too small on screen at this whole-country zoom to reliably
   click otherwise -- see SWEDEN_MIN_HIT_DIAMETER's own comment in
   map_app.js. Never visible (fill: transparent) and draws no border of
   its own; pointer-events: all is what actually matters here, since a
   plain transparent fill alone wouldn't otherwise capture clicks/hovers
   by default. */
.sweden-valkrets-hit-target {
  fill: transparent;
  stroke: none;
  cursor: pointer;
  pointer-events: all;
  transition: opacity 0.1s ease;
}
/* A state with a real, scraped constituency-level result (see
   GERMANY_STATE_ELECTION_DATA) gets a visibly heavier border so it reads
   as clickable/explorable -- every other state still renders (this app
   never hides real geography just because it lacks a further real
   dataset) but looks the same flat accent color either way otherwise, so
   without this the 15 states with no drill-down yet would be
   indistinguishable from the one that has it. */
.germany-state-path.germany-state-has-data {
  stroke: rgba(0, 0, 0, 0.85);
  stroke-width: 1.5px;
}
/* Same real-data-vs-no-data distinction as .germany-state-has-data just
   above, applied to Canada's own top-level province map -- British
   Columbia/Quebec in Provincial mode, Alberta in Referendum mode (see
   canadaProvinceHasRealData in map_app.js). */
.canada-province-path.canada-province-has-data {
  stroke: rgba(0, 0, 0, 0.85);
  stroke-width: 1.5px;
}
/* CDU's own real party color is solid black, so in Raw shade-by mode a CDU
   win would otherwise render with the shared default stroke (rgba(0,0,0,0.5),
   0.75px) essentially invisible against its own fill -- overridden here with
   a bright, clearly-visible white border (see germanyConstituencyIsCduRawWinner
   in map_app.js, which only applies this class while Raw mode is active).
   Full opacity (not rgba) and a wider, non-scaling stroke -- max real
   contrast against solid black, at any zoom level -- plus renderGermanyConstituencies
   raises these paths to the top of the layer so this border never gets
   partially painted over by a neighboring constituency's own stroke along
   a shared edge. */
.germany-constituency-path.germany-cdu-raw-winner {
  stroke: #ffffff;
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}
.brazil-state-path:hover,
.hungary-constituency-path:hover,
.thailand-constituency-path:hover,
.malta-district-path:hover,
.denmark-district-path:hover,
.faroe-region-path:hover,
.peru-region-path:hover,
.colombia-region-path:hover,
.portugal-region-path:hover,
.uk-constituency-path:hover,
.japan-constituency-path:hover,
.scotland-constituency-path:hover,
.iceland-constituency-path:hover,
.barbados-constituency-path:hover,
.costarica-region-path:hover,
.nepal-constituency-path:hover,
.germany-state-path:hover,
.germany-constituency-path:hover,
.sweden-valkrets-path:hover,
.russia-region-path:hover,
.russia-district-path:hover,
.russia-subject-path:hover,
.morocco-constituency-path:hover,
.morocco-region-path:hover,
.algeria-wilaya-path:hover,
.antigua-constituency-path:hover,
.kazakhstan-region-path:hover, .latvia-constituency-path:hover, .bulgaria-constituency-path:hover { opacity: 0.85; }
.israel-region-path:hover { opacity: 0.85; }
.israel-region-path.israel-disputed { stroke: #1a1a2e; stroke-width: 1.8px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.serbia-municipality-path:hover { opacity: 0.85; }
.france-department-path:hover, .italy-constituency-path:hover, .poland-constituency-path:hover, .slovakia-constituency-path:hover, .andorra-constituency-path:hover, .switzerland-constituency-path:hover, .slovenia-constituency-path:hover, .estonia-constituency-path:hover, .mongolia-constituency-path:hover, .legislative-unit-path:hover, .presidential-unit-path:hover, .combined-unit-path:hover, .national-shell-path:hover, .elsalvador-department-path:hover { opacity: 0.85; }
.france-inset-frame { fill: none; stroke: #8a8f98; stroke-width: 1px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.france-inset-label, .baked-inset-label { font-size: 10px; fill: #555; pointer-events: none; }
/* Presidential-election insets drawn inside the map (see renderBakedInsets in map_app.js): the same dashed frame and
   caption as France's overseas departments, zooming with the map. */
.baked-inset-frame { fill: none; stroke: #8a8f98; stroke-width: 1px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.baked-inset-hit { fill: transparent; pointer-events: all; }
.baked-inset-overseas { cursor: pointer; }
.baked-overseas-path { stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.4px; vector-effect: non-scaling-stroke; pointer-events: none; }
.baked-inset-overseas.selected .baked-inset-frame { stroke: #1a1a2e; stroke-width: 2.5px; stroke-dasharray: none; }
/* The same small grey caption for the corner-card insets (Overseas, Azores, Faroe Islands, ...). */
.inset-box-label { font-size: 10px; line-height: 1.1; color: #555; margin-top: 3px; text-align: left; pointer-events: none; }
.australia-state-path { cursor: default; }
.australia-state-path.australia-clickable { cursor: pointer; }
.australia-state-path.australia-clickable:hover, .australia-district-path:hover { opacity: 0.85; }
.australia-district-path.selected { stroke: #1a1a2e; stroke-width: 2px; }
/* Kosovo and Metohija's border against Serbia: dashed and heavier than the
   municipality borders. */
.serbia-kosovo-outline { fill: none; stroke: #1a1a2e; stroke-width: 1.8px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.serbia-municipality-path.serbia-no-unit-path { cursor: default; }
.nz-electorate-path:hover { opacity: 0.85; }
.spain-province-path:hover { opacity: 0.85; }
.spain-municipality-path { stroke-width: 0.4px; }
.canada-province-path:hover { opacity: 0.85; }
.canada-riding-path:hover { opacity: 0.85; }
/* Japan's own constituency/block borders -- higher-contrast than every
   other country's own shared 0.5-opacity/0.75px baseline above, since
   the 289-constituency map packs far more, far smaller adjacent shapes
   into the same space than any other country map here (Denmark's own
   10 storkredse, Malta's 13 districts, even Thailand's 400 don't sit
   quite this dense edge-to-edge) -- a same-party pair of neighboring
   districts needs a visibly darker line between them to read as two
   shapes at all, not one fused blob. */
/* Russia's own 83 real federal-subject borders -- same higher-contrast
   treatment as Japan/Scotland just above, for the same real reason:
   several real regions (the cluster around Moscow especially --
   Moscow Oblast, Tula, Ivanovo, Kaluga, ...) sit small and edge-to-edge,
   where the shared 0.5-opacity/0.75px baseline read as barely-there --
   confirmed directly, not just in theory: it was effectively invisible
   (no .russia-region-path rule existed here at all before this, so
   these paths drew with no real stroke whatsoever). */
.japan-constituency-path,
.scotland-constituency-path,
.russia-region-path,
.russia-district-path,
.russia-subject-path {
  stroke: rgba(0, 0, 0, 0.75); stroke-width: 1px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
/* Same higher-contrast treatment as Japan/Scotland/Russia above, same
   real reason -- user-reported (2026-10-07): Quebec's own 127 ridings
   read as "one giant blob" at province-wide zoom. Confirmed not a data
   bug (every riding's own real geometry/color resolves correctly) but a
   real, inherent choropleth effect: a run of adjacent same-party ridings
   (Parti Quebecois's own real sweep of Quebec's sparse north especially)
   shares one fill color, so the shared 0.5-opacity/0.75px baseline
   between them was too faint to read as separate shapes at all -- same
   underlying problem this exact CSS fix already solved for Japan/Russia.
   British Columbia's own 93 ridings cluster just as densely around
   Vancouver/Victoria, so it gets the same treatment. */
.canada-riding-path {
  stroke: rgba(0, 0, 0, 0.75); stroke-width: 1px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
/* Peru/Colombia/UK's default "just entered" state (see
   renderPeruSilhouette/renderColombiaSilhouette/renderUkSilhouette in
   map_app.js) -- a flat, non-interactive whole-country shape shown before
   the reveal button (PRESIDENT / PARLIAMENTARY_BY_ELECTIONS) shows the
   real per-department/constituency map above. No :hover/cursor:pointer,
   unlike .peru-region-path/.colombia-region-path/.uk-constituency-path --
   there's nothing to click through to yet. */
.peru-country-silhouette,
.colombia-country-silhouette,
.portugal-country-silhouette,
.uk-country-silhouette,
.hungary-country-silhouette,
.thailand-country-silhouette,
.malta-country-silhouette,
.denmark-country-silhouette,
.faroe-country-silhouette,
.iceland-country-silhouette,
.barbados-country-silhouette,
.costarica-country-silhouette,
.nepal-country-silhouette,
.sweden-country-silhouette,
.latvia-country-silhouette {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: default;
}
/* Same higher-contrast treatment as .japan-constituency-path above --
   the silhouette is one single shape (nothing to visually separate from
   a neighbor), but keeping the same stroke weight/opacity here avoids
   an inconsistent-looking border the instant the real map reveals. */
.japan-country-silhouette {
  stroke: rgba(0, 0, 0, 0.75); stroke-width: 1px; vector-effect: non-scaling-stroke;
  cursor: default;
}
/* Real municipality choropleth drawn inside a drilled-into Hungarian
   constituency (see hungaryMunicipalityLayer) -- same border treatment as
   every other choropleth boundary (.county-path/.hungary-constituency-path). */
.hungary-municipality-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.hungary-municipality-path:hover { opacity: 0.85; }
/* Municipality (novads / republic city) choropleth drawn inside a drilled-into Latvian Saeima constituency (see
   latviaMunicipalityLayer) -- same border treatment as every other choropleth boundary. */
.latvia-municipality-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.latvia-municipality-path:hover { opacity: 0.85; }
/* Municipality (or Sofia district) choropleth drawn inside a drilled-into Bulgarian constituency (see bulgariaMunicipalityLayer). */
.bulgaria-municipality-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.bulgaria-municipality-path:hover { opacity: 0.85; }
/* Real opstillingskreds (nomination district) choropleth drawn inside a
   drilled-into Danish storkreds (see denmarkOpstillingskredsLayer) -- same
   border treatment as every other choropleth boundary/Hungary's own
   municipality layer above. */
.denmark-opstillingskreds-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.denmark-opstillingskreds-path:hover { opacity: 0.85; }
/* Real kommune choropleth drawn inside Greenland's own drilled-into
   overseas-territory detail (see denmarkGreenlandKommuneLayer) -- same
   border treatment as every other choropleth boundary. */
.denmark-greenland-kommune-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.denmark-greenland-kommune-path:hover { opacity: 0.85; }
/* Real per-valdistrikt (precinct) choropleth drawn inside a drilled-into
   Swedish valkrets (see swedenPrecinctsLayer) -- same border treatment
   as every other choropleth boundary/Denmark's own opstillingskreds
   layer above. */
.sweden-precinct-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.sweden-precinct-path:hover { opacity: 0.85; }
.hungary-back-link {
  display: inline-block;
  background: none; border: none; padding: 0; margin: 0 0 0.5rem;
  color: #3a5fc4; font-size: 0.85rem; cursor: pointer;
}
.hungary-back-link:hover { text-decoration: underline; }
.peru-legend {
  position: absolute;
  bottom: 0.75rem; left: 0.75rem;
  z-index: 1500;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #1a1a2e;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
/* Redrawn on top of the lake cut-outs above so a real border that runs
   through a lake stays visible over the water -- see renderWorld's own
   comment. Same stroke as .country-path; fill: none so it doesn't add a
   second, higher-z-index hit target over the US/Peru (that stays on
   .country-path-highlight underneath). */
.country-border-line { fill: none; stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke; pointer-events: none; }
/* No race for the currently-selected office this cycle — not drillable. */
.state-path.no-data { cursor: default; }
.state-path.no-data:hover { opacity: 1; }
/* The real line where a split-timezone state's regions meet (see
   app/geo/timezone_boundary.py) — dashed and dark so it reads as a
   geographic marker distinct from both the plain county borders and any
   party/candidate choropleth color underneath it. Non-interactive: a
   click through this line should still hit the county beneath it. */
.timezone-boundary-line {
  fill: none;
  stroke: #1a1a2e;
  stroke-width: 3.5px;
  stroke-dasharray: 8 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  /* A thin light halo keeps the dark dashes readable over dark party fills. */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95));
}
/* The district-list map (one state's House districts before drilling into
   one) — colored by race status like the national map, via JS attr("fill").
   Once a district is selected, its counties render with .county-path
   instead (the same full results choropleth Senate/Governor use). */
.district-path {
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 0.1s ease, fill 0.1s ease;
}
.district-path:hover { opacity: 0.75; }
/* House (Special): a district with no special election this year -- not drillable. */
.district-path.no-data { cursor: default; }
.district-path.no-data:hover { opacity: 1; }

/* City pins (top 10 most populous places + state capital per state -- see
   app/geo/load_places.py). pointer-events is off so a pin never steals a
   click meant for the county/district shape underneath. Each marker's
   .city-marker-scale inner group is counter-scaled by JS
   (updateCityMarkers in map_app.js) every pan/zoom event, so the dot/label
   stay a constant on-screen size regardless of map zoom -- only which
   markers are visible at all changes with zoom (metro clusters revealing
   their other members), never their rendered size. */
.city-marker {
  pointer-events: none;
}
.city-dot {
  fill: #1a1a2e;
  stroke: #fff;
  stroke-width: 1.5px;
}
.city-marker-capital .city-dot {
  fill: #b2182b;
  r: 5.5px;
}
.city-label {
  font-size: 11px;
  font-weight: 600;
  fill: #1a1a2e;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.city-marker-capital .city-label {
  font-weight: 700;
}

/* Stacks every floating map-key widget (the city-points key, the MARGIN
   shading key) in one corner, top to bottom, gap between whichever of
   them are actually visible -- flexbox's own `gap` only applies between
   in-flow (non-display:none) children, so one key being hidden (e.g. the
   Shade key outside MARGIN mode) never leaves an awkward empty gap where
   it would have been; the other key(s) simply close up around it. Same
   top corner every other floating widget here already claims: opposite
   .peru-legend (bottom-left) and .zoom-control (bottom-right). */
.map-legends-stack {
  display: none;
  position: absolute;
  right: 0.75rem;
  /* Clears .sidebar-toggle-right (top: 0.75rem, 32px tall) sitting in the
     same corner -- same clearance as the other corner widgets. */
  top: 3.25rem;
  z-index: 1500;
  flex-direction: column;
  gap: 0.5rem;
  /* Default (stretch): both keys share the widest one's natural width
     rather than each hugging its own shorter content, so the stack reads
     as one aligned block instead of two jagged-width boxes. */
}
.app-layout.state-mode .map-legends-stack { display: flex; }
/* Explains the city-point markers every US state/district map already
   draws (see renderCities/updateCityMarkers in map_app.js) -- same
   floating-widget look as .peru-legend, gated on .state-mode generically
   (via its own .map-legends-stack parent) rather than any one specific
   office view, since Senate/House/Governor/AG/SoS/Ballot Measures/House
   district/Voter Registration/Margin Map all share this same citiesLayer. */
.cities-legend {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #1a1a2e;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  width: 100%;
}
.cities-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  font-weight: 600;
  color: #1a1a2e;
}
.cities-legend:not(.collapsed) .cities-legend-header { border-bottom: 1px solid #1a1a2e; }
.cities-legend-body { padding: 0.4rem 0.75rem; }
.cities-legend.collapsed .cities-legend-body { display: none; }
.cities-legend-toggle-btn {
  padding: 0.15rem 0.5rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  color: #333;
}
.cities-legend-toggle-btn:hover { background: #eef1f5; }
/* Matches .city-marker-capital .city-dot's own real "bigger than a plain
   city dot" sizing (r: 5.5px vs 4px on the map itself) so the key's two
   swatches are actually distinguishable at a glance, not just two
   differently-colored circles the same size. */
.color-swatch-capital {
  width: 0.85rem;
  height: 0.85rem;
}

/* Fixed to the map's own bottom-right corner (not vertically centered)
   on every map in the app -- the Re-center button plus the +/- stack, no
   slider, so it stays a small, low corner widget regardless of which
   other corner widgets (overseas insets, leveling-seat panel, etc.) any
   given country's own map adds elsewhere. A row (Re-center to the left of
   the +/- stack) rather than the +/- pair's own internal column -- see
   .zoom-btn-stack below for that inner stack. */
.zoom-control {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.6rem 0.45rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 1500;
}
.zoom-control.hidden { display: none; }
.zoom-btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
/* Resets whatever pan/zoom the user has dragged/scrolled/pinched into
   (see resetZoom in map_app.js) back to the map's own original fitted
   view -- same real d3.zoom() identity transform the built-in "zoomed
   past 1x" state already tracks (.map-zoomed), just reachable by a click
   instead of only by manually scrolling back out. Shares #zoom-control's
   own show/hide lifecycle, so it's available on every map in the app
   with no per-country wiring of its own. */
.recenter-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.4rem 0.55rem;
  white-space: nowrap;
  color: #2f353f;
}
.recenter-btn:hover { background: #eef1f5; }
/* Spain's own real Ceuta/Melilla/Las Palmas/Santa Cruz de Tenerife corner
   insets -- same reasoning/convention as Spain's corner insets above,
   just four real geographic boxes and no non-geographic "overseas votes"
   marker box (Spain has no equivalent concept -- see SPAIN_INSET_REGIONS
   in map_app.js). Smaller box size (110x70 vs. Portugal's 130x88) since
   four stacked boxes run taller than two or three. */
.spain-overseas-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  z-index: 1500;
}
.spain-overseas-insets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.spain-inset-box {
  background: rgba(255, 255, 255, 0.92);
  padding: 0.4rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.spain-inset-box svg { display: block; width: 110px; height: 70px; }
/* Algeria's 8 diaspora electoral zones -- one small world-map inset per
   zone (built in renderAlgeriaDiasporaInsets), same corner-widget
   convention as Spain's corner insets above but laid out in two
   columns, since eight stacked boxes would run off the page. */
.algeria-overseas-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  z-index: 1500;
}
/* Header bar with a Hide/Show button, same look as .map-tools-header. */
.algeria-zones-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #666;
}
.algeria-overseas-insets {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.45rem;
}
.algeria-inset-box {
  background: rgba(255, 255, 255, 0.92);
  padding: 0.35rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.algeria-inset-box svg { display: block; width: 104px; height: 60px; }
.algeria-inset-box.wide { grid-column: span 2; }
.algeria-inset-box.wide svg { width: 226px; height: auto; }
.algeria-inset-label {
  font-size: 0.62rem;
  line-height: 1.1;
  text-align: center;
  margin-top: 0.15rem;
  color: #1a1a2e;
}
.algeria-inset-box.selected {
  outline: 3.5px solid #1a1a2e;
  outline-offset: 1.5px;
  box-shadow: 0 0 0 1.5px #fff, 0 1px 4px rgba(0, 0, 0, 0.25);
}
/* Real 2026 Danish general election results for the Faroe Islands' and
   Greenland's own 2 real Folketing seats each -- both are part of the
   same 24 March 2026 election as Denmark proper's own 175 storkreds
   seats, but each is its own separate constituency with its own
   distinct real parties, so they're shown here as two small flat
   corner insets (same fixed-widget convention as Peru/Colombia's own
   overseas insets above) rather than folded into Denmark's own
   storkreds choropleth, plus a real national leveling-seat (tillaegs-
   mandat) composition grid underneath. One shared flex-column wrapper
   positions the whole stack (insets row, then the leveling-seat panel)
   so nothing here is ever manually offset by a guessed pixel/rem value
   -- every piece lays out purely from its neighbors' real size via
   flexbox, so nothing in this stack can ever overlap another. */
.denmark-overseas-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  gap: 0.6rem;
  z-index: 1500;
}
/* Faroe Islands, Greenland and Bornholm in one row (so they never overlap each other), with the Leveling Seats panel
   beneath stretched to the same width -- a long seat array that ends at the right edge, beside the sidebar. */
.denmark-overseas-insets {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}
#denmark-leveling-seats-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  width: 583px;   /* as wide as the inset row at full size */
  z-index: 1500;
}
#denmark-leveling-seats-grid { grid-template-columns: repeat(14, 1fr); }
/* Slightly larger type than the other seat panels: the Danish insets' captions, the table title and the party key. */
.denmark-faroe-inset .inset-box-label,
.denmark-greenland-inset .inset-box-label,
.denmark-bornholm-inset .inset-box-label { font-size: 15px; }
#denmark-leveling-seats-panel .national-seat-panel-title { font-size: 1.2rem; }
#denmark-leveling-seats-legend {
  font-size: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 1rem;
  max-height: none;
}
.denmark-faroe-inset,
.denmark-greenland-inset,
.denmark-bornholm-inset {
  background: rgba(255, 255, 255, 0.92);
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.denmark-faroe-inset svg,
.denmark-greenland-inset svg,
.denmark-bornholm-inset svg { display: block; width: 170px; height: 100px; }
/* Okinawa's own corner inset (see its own comment further below, near
   the .japan-election-selected reveal rule) -- same fixed corner-box
   convention/positioning as Peru/Colombia/Denmark's own overseas insets.
   Anchored top-LEFT rather than every other country map's own default
   top-right corner: Japan's own real shape trends northeast (Hokkaido)
   to southwest (Kyushu), so the top-right corner sits uncomfortably
   close behind Hokkaido's own coastline at plausible viewport sizes
   (confirmed empirically -- the inset's own translucent background
   visibly picked up Hokkaido's red fill bleeding through its corner)
   where every other country's map happens to leave that corner empty.
   Top-left, by contrast, is real open sea (northwest of Hokkaido) at
   every viewport size checked. `top: 4.5rem` (rather than every other
   inset's own `top: 3.25rem`) clears #sidebar-toggle-left (top: 0.75rem,
   32px tall) with a generous, unambiguous gap -- 3.25rem's own 8px gap
   was technically non-overlapping but read as touching at a glance,
   given the two widgets also share horizontal space (the toggle sits at
   the map's own left edge, this inset just 0.75rem further in).

   Holds TWO real, independently-fit shapes stacked in one column (see
   renderJapanOkinawaInset in map_app.js), not one shared fitExtent over
   the whole prefecture -- Okinawa's real 4 districts all cross the main
   island (Okinawa Honto) itself, but that single island is a sliver of
   the real ~900km-wide span once the 1st/3rd/4th districts' own real
   outlying islands (Kerama, Iheya/Izena, Daito, Miyako, Yaeyama/
   Ishigaki/Iriomote, Yonaguni) are folded into the same bounding box --
   a shared fitExtent left the main island's own real district lines too
   small to read at all. #japan-okinawa-svg (top pane, 220x260) now
   fits ONLY the main island's own real geometry, at real size big
   enough to show its own internal district boundaries clearly;
   #japan-okinawa-outlying-svg (bottom pane, 260x110) fits everything
   else on its own separate, smaller scale. Both stay keyed by the same
   real district id as the main map (japanConstituencyResults[id]), so
   color/tooltip/click all resolve identically regardless of which pane
   a given piece renders in. Only the constituencies map view splits
   like this -- the regional-blocks view has no internal subdivision to
   show, so #japan-okinawa-svg alone renders Okinawa's whole real shape
   as one flat Kyushu-colored piece there instead (see japanGranularity
   in renderJapanOkinawaInset), with #japan-okinawa-outlying-svg hidden. */
.japan-okinawa-inset {
  position: absolute;
  left: 0.75rem;
  top: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 1500;
}
/* Single Constituencies view only (see .japan-constituencies-granularity
   in map_app.js's own syncJapanGranularityClass) -- repositioned to the
   map's center-right edge instead of the default top-left corner. The
   regional-blocks view's own single-shape inset is small/short enough
   that top-left never needed reconsidering, but this view's own two-pane
   stack (see the comment above) is much taller, and center-right is real
   open Pacific water at every viewport size checked (same empty-corner
   verification as the original top-left placement), clear of both
   #sidebar-toggle-right and #zoom-control at any reasonable viewport
   height since it's vertically centered rather than anchored to either
   edge. */
.app-layout.country-mode.japan-mode.japan-constituencies-granularity .japan-okinawa-inset {
  left: auto;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}
/* Parliamentary-election map components -- the overseas-constituency insets (Spain, Denmark, Japan, Algeria, Kaliningrad)
   and the national seat lists (Denmark, Malta, Thailand, Nepal, Germany, Sweden, Morocco, Russia, New Zealand) -- live in
   #map-widget-layer, whose transform map_app.js keeps equal to the map's zoom transform: they are placed on the map at the
   same spot as before (the country itself is not resized to make room) and pan/zoom with it instead of hiding. */
.map-widget-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 1500;
}
.map-widget-layer > * { pointer-events: auto; }
/* The inset maps share the dashed, captioned look of France's overseas departments. */
.spain-inset-box,
.algeria-inset-box,
.denmark-faroe-inset,
.denmark-greenland-inset,
.denmark-bornholm-inset,
.japan-okinawa-inset {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  border: 1px dashed #8a8f98;
}
/* Both panes' own width/height are set inline by renderJapanOkinawaInset
   (map_app.js), not fixed here -- #japan-okinawa-svg alone needs to be a
   different real size in each of Japan's two map granularities (300x170
   for the regional-blocks view's single whole-prefecture shape; 220x260,
   taller than wide, for the constituencies view's own main-island-only
   pane), and .japan-okinawa-outlying-svg only exists at all in the
   constituencies view. display:none here is just the safe default for
   that second pane before the first real render ever sets it. */
.japan-okinawa-inset svg { display: block; }
.japan-okinawa-outlying-svg { display: none; }
.japan-okinawa-inset .japan-okinawa-path { cursor: pointer; }
/* San Andrés'/Açores'/Madeira's own single-shape inset paths -- same
   stroke treatment as .portugal-region-path/.colombia-region-path on the
   main map, just a real single shape apiece rather than a set of
   neighboring districts (see renderColombiaRegionInset/
   renderPortugalRegionInset in map_app.js). No hover/click bound directly
   to these paths -- the wrapping .colombia-inset-box/.portugal-inset-box
   div handles that (see wireColombiaRegionInset/wirePortugalRegionInset),
   same as every other overseas-style inset in this app. */
.spain-inset-path {
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
}
/* Real national composition of a country's own real nationally-allocated
   top-up seats -- one dot per real seat, colored by that seat's own real
   party color, grouped by party. Shared across every country that has a
   real equivalent of this (each with its own real, different name/
   mechanism, never the same fabricated "leveling seats" label pasted
   everywhere -- see each render*Seats function in map_app.js for the
   real mechanism and real source behind its own numbers):
     - Denmark: 40 real tillaegsmandater (leveling/compensatory seats),
       summed from each storkreds's own real tillaegsmandater field.
     - Malta: 12 real gender-corrective seats (a real 2021 constitutional
       mechanism, separate from the 65 real district-won STV seats).
     - Thailand: 100 real party-list seats (a real separate party-list
       ballot, separate from the 400 real constituency FPTP seats).
     - Nepal: 110 real nationwide party-list PR seats (a real separate
       closed-list ballot, 3% threshold, separate from the 165 real
       constituency FPTP seats) -- structurally the same mechanism as
       Thailand's own, just a different real seat count.
     - The Faroe Islands has no equivalent panel: its own real Logting
       election allocates all 33 seats through one single real nationwide
       constituency (a 2007 reform), so there is no real second, more-
       local tier for a national mechanism to correct in the first place. */
.national-seat-panel {
  background: #fff;
  padding: 0.5rem 0.6rem 0.6rem;
  border: 1.5px solid #1a1a2e;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  width: 316px;
  box-sizing: border-box;
}
.national-seat-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
  border-bottom: 1.5px solid #1a1a2e;
}
.national-seat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  justify-items: center;
  row-gap: 6px;
}
.national-seat-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  cursor: default;
}
/* Color key beneath each country's own national-seat-grid, shared by all
   six real party-list/leveling/gender-corrective panels (Denmark/Malta/
   Thailand/Nepal/Germany/Sweden) -- same swatch+label row convention as
   .party-stack-legend, reusing the app's existing shared .color-swatch
   dot rather than inventing a second swatch style. Built by
   nationalSeatLegendHtml in map_app.js from the same per-party
   color/label already used by that grid's own dot tooltips, so the key
   never drifts out of sync with what hovering a dot already shows. */
.national-seat-legend {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  /* Same "past a handful of rows, scroll instead of growing the panel
     forever" convention as .candidate-list-scroll -- Thailand's real
     party-list panel alone has 21 real parties holding at least one
     seat (a far more fragmented field than Denmark's 12/Sweden's 8/
     Nepal's 6/Malta's 2), so an uncapped legend under its already-tall
     100-dot grid would otherwise run the fixed corner panel off the
     bottom of the viewport. */
  max-height: 8rem;
  overflow-y: auto;
}
.national-seat-legend-item {
  display: flex;
  align-items: center;
}
/* Malta/Thailand have no overseas insets of their own to stack under
   (unlike Denmark's own .denmark-overseas-panel wrapper above), so their
   own national-seat-panel is positioned directly in the same corner. */
.corner-seat-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  z-index: 1500;
}
/* Thailand's real 100 party-list seats, arranged 5 columns by 20 rows
   (a narrower, taller panel than Denmark's/Malta's own 8-column grid) --
   tall enough to reach down into #zoom-control's own bottom-right corner,
   so this one panel anchors from the LEFT side instead of .corner-seat-
   panel's own shared right-side default, clearing the zoom buttons by
   putting them in a different horizontal column entirely rather than
   just a vertical gap that a taller grid could still close. */
#thailand-partylist-seats-panel {
  left: 0.75rem;
  right: auto;
  width: 160px;
}
#thailand-partylist-seats-grid {
  grid-template-columns: repeat(5, 1fr);
  /* Same "past a handful of rows, scroll instead of growing forever"
     convention as .national-seat-legend's own max-height/overflow-y
     below -- Thailand's real 100 party-list seats (20 rows at 5 columns)
     would otherwise push .national-seat-legend's own 21-party key far
     down the page, off the bottom of the viewport on a normal window.
     Scoped to Thailand's own ID, not the shared .national-seat-grid
     class -- Denmark/Malta/Nepal/Germany/Sweden's own smaller-or-
     collapsible grids don't need this. */
  max-height: 11rem;
  overflow-y: auto;
}
/* Nepal's real 110 nationwide party-list seats -- unlike Thailand's own
   100-seat panel above (deliberately narrow/tall and left-anchored to
   clear #zoom-control's bottom-right corner), Nepal's own panel stays in
   .corner-seat-panel's default top-right (northeast) position and is
   wide/short instead -- 11 columns by 10 rows, more columns than rows,
   short enough that it never reaches down into the zoom buttons' own
   corner in the first place, so there's no need for Thailand's
   left-anchor workaround. */
#nepal-partylist-seats-panel {
  width: 420px;
}
#nepal-partylist-seats-grid {
  grid-template-columns: repeat(11, 1fr);
}
/* Morocco's real 395-seat House of Representatives dwarfs every other
   country's own national-seat-grid here (nearly 4x Thailand's real
   100-seat party-list panel, the next largest) -- same real "past a
   handful of rows, scroll instead of growing forever" convention as
   #thailand-partylist-seats-grid's own max-height/overflow-y above,
   just a taller cap since this panel starts collapsed-away-from by
   default less often (Morocco has no other corner panel competing for
   the same on-screen space the way Thailand's own left-anchor dodges
   #zoom-control). */
#morocco-partylist-seats-grid,
#russia-partylist-seats-grid {
  max-height: 16rem;
  overflow-y: auto;
}
/* Nepal's own Party-List Seats panel is the one collapsible national-seat-
   panel in the app -- a real <button> (see #nepal-partylist-seats-toggle
   in map.html) in place of the plain .national-seat-panel-title div every
   other country's own panel uses, with a caret that flips to show
   collapsed/expanded state. Scoped entirely to Nepal's own class/ID so
   Denmark's/Malta's/Thailand's own static, non-collapsible panel titles
   are untouched. */
.national-seat-panel-toggle {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
  border-bottom: 1.5px solid #1a1a2e;
}
.national-seat-panel-caret {
  font-size: 0.65rem;
  transition: transform 0.15s ease;
}
#nepal-partylist-seats-panel.collapsed .national-seat-panel-toggle {
  margin-bottom: 0;
}
#nepal-partylist-seats-panel.collapsed .national-seat-panel-caret {
  transform: rotate(-90deg);
}
#nepal-partylist-seats-panel.collapsed .national-seat-grid,
#nepal-partylist-seats-panel.collapsed .national-seat-legend {
  display: none;
}
/* Germany's own Party-List Seats panel is collapsible the same way --
   the state's own real total seats can run well past 100 (Baden-
   Württemberg's real 157), so being able to collapse it out of the way
   matters here too. */
#germany-partylist-seats-panel.collapsed .national-seat-panel-toggle {
  margin-bottom: 0;
}
#germany-partylist-seats-panel.collapsed .national-seat-panel-caret {
  transform: rotate(-90deg);
}
#germany-partylist-seats-panel.collapsed .national-seat-grid,
#germany-partylist-seats-panel.collapsed .national-seat-legend {
  display: none;
}
/* Same real collapsible-panel convention as Nepal's/Germany's own
   toggles above -- Sweden's real 39 leveling seats are a smaller grid
   than either of those, but the toggle is still useful to tuck the
   panel away entirely when it's not the thing being looked at. */
#sweden-leveling-seats-panel.collapsed .national-seat-panel-toggle {
  margin-bottom: 0;
}
#sweden-leveling-seats-panel.collapsed .national-seat-panel-caret {
  transform: rotate(-90deg);
}
#sweden-leveling-seats-panel.collapsed .national-seat-grid,
#sweden-leveling-seats-panel.collapsed .national-seat-legend {
  display: none;
}
/* Same real collapsible-panel convention as Nepal's/Germany's/Sweden's
   own toggles above -- Thailand's real 100 party-list seats are the
   tallest single grid of any of these five countries' own panels
   (see #thailand-partylist-seats-grid's own real max-height/scroll
   comment above), so tucking the whole panel away matters here too. */
#thailand-partylist-seats-panel.collapsed .national-seat-panel-toggle {
  margin-bottom: 0;
}
#thailand-partylist-seats-panel.collapsed .national-seat-panel-caret {
  transform: rotate(-90deg);
}
#thailand-partylist-seats-panel.collapsed .national-seat-grid,
#thailand-partylist-seats-panel.collapsed .national-seat-legend {
  display: none;
}
/* Morocco's House of Representatives panel collapses like the others above. */
#morocco-partylist-seats-panel.collapsed .national-seat-panel-toggle { margin-bottom: 0; }
#morocco-partylist-seats-panel.collapsed .national-seat-panel-caret { transform: rotate(-90deg); }
#morocco-partylist-seats-panel.collapsed .national-seat-grid,
#morocco-partylist-seats-panel.collapsed .national-seat-legend { display: none; }
.zoom-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.zoom-btn:hover { background: #eef1f5; }

/* Fixed to #map's own top-left corner on every map in the app (world map
   included -- see this app's own "pen tool" feature request), same
   "always-present floating widget" convention as .zoom-control (bottom-
   right). Cleared below .sidebar-toggle-left/.back-to-world-btn (both
   top: 0.75rem, ~32px tall) with the same top: 3.25rem clearance
   .map-legends-stack already uses opposite it at top-right. Higher
   z-index than .pen-canvas below so its own buttons stay clickable even
   while the pen canvas is actively capturing pointer events over the
   rest of the map. */
.map-tools-panel {
  position: absolute;
  left: 0.75rem;
  top: 3.25rem;
  z-index: 1500;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0.6rem;
}
.map-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 0.35rem;
}
/* Same real "collapse to just the header" convention as .cities-legend/
   .national-legend-panel/.margin-legend-panel -- collapsing never
   resets the pen's own on/off state, it just hides the button that
   toggles it (same as collapsing a legend never resets its own data). */
.map-tools-panel.collapsed .map-tools-buttons { display: none; }
.map-tools-panel.collapsed .map-tools-header { margin-bottom: 0; }
.map-tools-toggle-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
  color: #666;
  padding: 0;
}
/* Stacked (Pen, then Eraser, then Clear) rather than a row -- Pen/Eraser
   are the two mutually-exclusive tool choices (see currentPenTool in
   map_app.js), Clear is a one-off action, same top-to-bottom reading
   order as any other small vertical tool palette. */
.map-tools-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}
.map-tool-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
  color: #2f353f;
}
.map-tool-btn:hover { background: #eef1f5; }
/* Active pen tool -- green to match the ink itself, same immediate
   "this control is on" cue as every other active/selected toggle button
   in this app (e.g. .office-type-toggle button.active). */
.map-tool-btn.active {
  background: #00c853;
  border-color: #00a844;
  color: #fff;
}
.map-tool-clear-btn.hidden { display: none; }

/* Pen color palette (see map.html's own #pen-color-row, map_app.js's
   renderPenColorRow/setPenColor/PEN_COLORS) -- a fixed 3-column, 2-row
   grid of solid-color squares (PEN_COLORS is exactly 6 entries, black
   and white deliberately dropped), shown only while Pen (not Eraser) is
   the active tool. A real grid, not a flex-wrap row left to reflow on
   its own -- guarantees this same 3x2 shape regardless of the panel's
   own width, rather than however many columns happen to fit. */
.pen-color-row {
  display: grid;
  grid-template-columns: repeat(3, 20px);
  justify-content: start;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e0e0e0;
}
.pen-color-row.hidden { display: none; }
.pen-color-swatch {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  cursor: pointer;
}
/* A ring around the currently-selected swatch, not just a border tweak --
   stays legible against any of PEN_COLORS' own real values, using two
   contrasting layers (white then dark) rather than one color that could
   blend into the swatch itself. */
.pen-color-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a2e;
}

/* The pen tool's own drawing surface -- one shared canvas covering the
   whole map viewport (not per-country: see this app's own "include this
   for all maps" request), a sibling of the SVG map itself inside #map so
   it overlays whichever map is currently showing, world map included.
   pointer-events stays off by default so it never steals a click/hover
   meant for the map underneath; toggled on only while the pen tool
   itself is active (see togglePenMode in map_app.js). Sits above the map
   SVG but below .map-tools-panel/.zoom-control (z-index 1500) so the Pen/
   Clear buttons stay reachable even mid-drawing. */
.pen-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1400;
  pointer-events: none;
}
/* The system "crosshair" cursor's own rendered hotspot turned out not to
   sit exactly on the real pixel .pen-canvas actually draws to on every
   real OS/browser/display-scaling combination (confirmed reported live)
   -- so the system cursor is hidden outright here (cursor: none) and
   .pen-cursor-dot below is drawn instead, positioned every pointermove
   from the exact same (x, y) the ink itself uses, which is what
   guarantees the two always agree. */
.pen-canvas.active { pointer-events: auto; cursor: none; touch-action: none; }

/* Tracks the current tool's own real drawing/erasing point 1:1 (see
   updatePenCursorDot in map_app.js) -- centered on (left, top) via the
   translate below so its MIDDLE, not its corner, is the real pixel that
   gets drawn/erased, regardless of this dot's own size. Its own width/
   height are set from JS (see updatePenCursorDot): the pen's own dot
   stays a fixed 3x its real 4px line width purely for visibility (a
   literal 4px dot is hard to aim), but the eraser's own dot is sized to
   its real, much wider brush diameter exactly, since there the size
   itself is the useful information -- an honest preview of how much
   ink an erase stroke will actually remove, not just a decorative
   pointer. Sits above the ink itself (pen-canvas is z-index 1400) but
   below the Tools/zoom-control panels (1500), same as a real system
   cursor would disappear under a topmost UI panel. */
.pen-cursor-dot {
  position: absolute;
  z-index: 1450;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 200, 83, 0.55);
  border: 1.5px solid #00c853;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.pen-cursor-dot.hidden { display: none; }
/* Eraser's own cursor -- a neutral white/gray ring instead of the pen's
   green fill, so it reads as "remove", not "draw", at a glance. */
/* Laser pointer: a bright red dot with a glow, so it reads as a pointer, not as ink. */
.pen-cursor-dot.laser {
  background: radial-gradient(circle, #ff6b6b 0%, #ff1e1e 55%, rgba(255, 30, 30, 0.6) 100%);
  border: 0;
  box-shadow: 0 0 10px 4px rgba(255, 30, 30, 0.65);
}
.pen-cursor-dot.eraser {
  background: rgba(255, 255, 255, 0.35);
  border: 1.5px solid #666;
}

.map-tooltip {
  display: none;
  position: absolute;
  z-index: 2000;
  background: rgba(26, 26, 46, 0.95);
  color: #fff;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 16px);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
/* Flag shown to the left of a country's name in the world-map hover
   tooltip (US/Peru only -- the two with their own results map to drill
   into; see worldUsTooltipHtml/worldPeruTooltipHtml) -- scaled down from
   .peru-flag-icon's topbar size to sit inline with the tooltip's own
   0.8rem text instead of towering over it. */
.tooltip-flag-icon {
  width: 14px; height: auto; margin-right: 0.35rem;
  vertical-align: -1px;
  border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 1px;
}
.map-tooltip .tooltip-candidate {
  margin-top: 0.4rem;
}
.map-tooltip .tooltip-candidate:first-of-type {
  margin-top: 0.3rem;
}
.map-tooltip .tooltip-margin {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0.85;
}
.map-tooltip .tooltip-votes-left {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0.85;
}
.map-tooltip .tooltip-margin-scenario {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0.85;
}
.map-tooltip .tooltip-more {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  opacity: 0.7;
  font-style: italic;
}
.map-tooltip .tooltip-reporting-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.3rem;
}
.map-tooltip .tooltip-reporting-bar-fill {
  height: 100%;
  background: #06d6a0;
}
.map-tooltip .tooltip-reporting {
  margin-top: 0.2rem;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.72rem;
  opacity: 0.75;
}
.map-tooltip .tooltip-district-wide {
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-style: italic;
  opacity: 0.75;
}
.map-tooltip .tooltip-key-race {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffd166;
}
.map-tooltip .tooltip-primary-pending {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #4a90e2;
}
.map-tooltip .tooltip-special-house-done {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a9850;
}
.map-tooltip .tooltip-countdown {
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ff6b6b;
}
/* Split-timezone disclosure (see pollCloseSplitHtml) -- a muted, smaller
   block under the main "Polls close: ..." line, listing every region's
   own real close time rather than letting the single summary line above
   stand in for the whole picture. */
.map-tooltip .tooltip-split-closes {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
  font-size: 0.7rem;
  opacity: 0.85;
  line-height: 1.35;
}
.map-tooltip .hint { opacity: 0.85; }
/* General Voter Registration Map's per-county D/R/O split (see
   partyBreakdownTooltipHtml) — lightened versions of the same DEM/REP/
   other colors used elsewhere (party-stack-segment, candidate rows) since
   the saturated originals read too dark against this tooltip's near-black
   background. */
.map-tooltip .tooltip-party-breakdown {
  margin-top: 0.3rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.72rem;
}
.map-tooltip .tooltip-party-dem { color: #7fb1e0; }
.map-tooltip .tooltip-party-rep { color: #e58f96; }
.map-tooltip .tooltip-party-other { color: #c9a0da; }

.banner {
  position: absolute;
  top: 5.7rem; left: 50%;
  transform: translateX(-50%);
  background: #fff3cd; border: 1px solid #ffe08a;
  padding: 0.5rem 1rem; border-radius: 6px;
  font-size: 0.9rem;
  z-index: 1000;
}

/* Rare-message popup only now (room picker, "no display open yet") --
   the ordinary connected/broadcasting status moved to the compact
   #remote-status badge in the topbar itself (see base.html and the CSS
   just below) instead of a persistent full-width bottom bar. Anchored
   under the topbar's own right side, near the Remote buttons, rather
   than spanning the viewport -- shows identically on every page (Polls
   included), not just the map, same as before. */
#remote-sync-banner {
  display: none;
  position: fixed;
  top: 3.4rem; right: 1rem;
  max-width: min(90vw, 26rem);
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: #1a1a2e; color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  font-size: 0.82rem;
  z-index: 3000;
}
#remote-sync-banner strong { color: #f5b942; }
#remote-sync-banner button {
  background: #f5b942; color: #1a1a2e; border: none;
  padding: 0.25rem 0.75rem; border-radius: 4px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
#remote-sync-banner button:hover { background: #ffcc66; }
/* Individual room choices in the rare multiple-open-displays picker (see
   renderRoomPickerBanner) -- visually distinct from the single Stop/Cancel
   button so it's clear these are the tappable choices. */
#remote-sync-banner button.remote-sync-pick {
  background: transparent; color: #fff; border: 1px solid #f5b942;
}
#remote-sync-banner button.remote-sync-pick:hover { background: #f5b942; color: #1a1a2e; }

/* Compact "Broadcasting"/"Live" indicator -- the ordinary connected-
   session status, always in the topbar next to #remote-toggle-btn (see
   base.html). Room code, join URL, and "last sent"/"last followed"
   diagnostics all move to this element's own title tooltip (hover/long-
   press) rather than staying permanently on screen. Purely informational
   -- no click handler -- #remote-toggle-btn is the one control for
   turning broadcasting on/off. */
.remote-status {
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f5b942;
  color: #1a1a2e;
}
.remote-status.hidden { display: none !important; }       /* broadcasting off: no indicator, whatever else styles the pill */
/* Connected (broadcasting): the LIVE indicator -- a red pill with a pulsing dot, on the display and on the tablet alike. */
.remote-status:not(.connecting):not(.hidden) { background: #e5252a; color: #fff; text-transform: uppercase; letter-spacing: 0.06em; display: inline-flex; align-items: center; gap: 0.4rem; }
.remote-status:not(.connecting):not(.hidden)::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #fff; animation: remote-live-pulse 1.4s ease-in-out infinite; }
@keyframes remote-live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .remote-status:not(.connecting):not(.hidden)::before { animation: none; } }
/* Not yet connected (still dialing in, reconnecting after a drop, or
   deliberately paused via #remote-toggle-btn) -- same neutral-outline
   treatment as .remote-toggle-btn's own default state so it doesn't read
   as "live" before it really is. */
.remote-status.connecting {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Shown when clicking a world-map country whose real numbers are known but
   that has no region-level map/ResultsProvider wired up yet (see Peru in
   renderWorld/showCountryResultsPanel) -- a static, real-data summary
   panel, not a drill-down. Same dark theme as .map-tooltip for visual
   consistency, but a persistent panel (explicit close button) rather than
   a hover-only, pointer-events:none tooltip. */
.country-results-panel {
  position: absolute;
  top: 5.7rem; left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.97);
  color: #fff;
  padding: 1rem 1.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  z-index: 2500;
  width: min(360px, 90%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.country-results-panel h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.country-results-close {
  position: absolute;
  top: 0.4rem; right: 0.6rem;
  background: none; border: none;
  color: #fff; opacity: 0.7;
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
}
.country-results-close:hover { opacity: 1; }
.country-results-section { margin-top: 0.7rem; }
.country-results-heading {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  opacity: 0.7; margin-bottom: 0.3rem;
}
.country-results-row {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding: 0.15rem 0;
}
.country-results-row.country-results-winner { font-weight: 700; color: #ffd166; }
.country-results-footnote {
  margin-top: 0.7rem; padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.72rem; opacity: 0.75;
}

/* Collapsible via the sidebar-toggle buttons in #map (see map_app.js's
   setSidebarCollapsed): each column's width lives in a custom property so
   every mode below can reference the same two variables instead of
   duplicating "0px vs. its real width" across each grid-template-columns
   declaration. Transitioned so collapsing reads as a slide, not a snap;
   map_app.js repaints the D3 map itself once the transition finishes
   (see rerenderCurrentView), since a CSS-only transition doesn't tell the
   SVG's own width attribute to follow along. */
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  height: 100%;
  --left-col-width: 264px;
  --right-col-width: 300px;
  transition: grid-template-columns 0.2s ease;
}
.app-layout.sidebar-left-collapsed { --left-col-width: 0px; }
.app-layout.sidebar-right-collapsed { --right-col-width: 0px; }
.app-layout.state-mode {
  grid-template-columns: var(--left-col-width) 1fr var(--right-col-width);
}

.race-selector, .county-panel { display: none; }
.app-layout.state-mode .race-selector,
.app-layout.state-mode .county-panel {
  display: block;
}

/* Peru (and future non-US countries) get the same left/right sidebar
   columns as a US state for visual consistency -- see renderPeruCountry in
   map_app.js and CLAUDE.md's "US map is the reference standard" section.
   Reuses .race-selector/.county-panel's own column chrome (background/
   border/padding) rather than duplicating it, just swaps out the
   US-specific race/office/county widgets (grouped under
   #race-selector-content/#county-panel-content) for Peru's own -- an office
   toggle (#peru-office-toggle, Peru's only office -- President) and, once
   that's picked, a round toggle and department-detail panel on the left
   (#peru-round-toggle/#peru-department-detail-panel, kept as separate
   top-level siblings rather than one wrapper so #multiselect-summary --
   genuinely shared with the US left sidebar, not Peru-specific -- can sit
   between them in plain DOM order) and a real candidate list on the right
   (#peru-candidate-list, next to #color-mode-toggle, same spot as the US
   map's own race-summary candidate rows). back-button and
   #color-mode-toggle are genuinely shared (same element, same handler)
   since both apply as-is to a country-level map, not just a US state's. */
.app-layout.country-mode {
  grid-template-columns: var(--left-col-width) 1fr var(--right-col-width);
}
.app-layout.country-mode .race-selector,
.app-layout.country-mode .county-panel {
  display: block;
}
.app-layout.country-mode #race-selector-content,
.app-layout.country-mode #county-panel-content {
  display: none;
}
/* The plain 16-state map is deliberately boundaries-only -- no results at
   that level, so it gets no sidebar (overriding country-mode's own
   default of showing the shared .race-selector/.county-panel column
   chrome, which here would only ever hold the generic, meaningless-
   without-results Shade-by/Single-Multiselect widgets). Full width map,
   same single-column grid the plain world map itself uses. Once drilled
   into one state's own real constituencies (.germany-states-view removed,
   see enterGermanyStateConstituencies), the sidebar reappears with that
   state's own real statewide party results/leaders -- same two-column
   layout every other country's own constituency map already uses. */
.app-layout.germany-mode.germany-states-view {
  grid-template-columns: 1fr;
}
.app-layout.germany-mode.germany-states-view .race-selector,
.app-layout.germany-mode.germany-states-view .county-panel {
  display: none;
}
/* Canada -- same real "boundaries-only, no sidebar" PATTERN as Germany's
   own plain 16-state map above (see that rule's own comment), but now
   scoped to :not(.canada-province-selected) rather than unconditional on
   .canada-mode alone. Real, confirmed bug (2026-10-07, user-reported
   "sidebars not present" with a screenshot proving the map itself was
   rendering real per-riding colors correctly): this rule predates
   British Columbia's/Quebec's own real riding maps and Alberta's own
   real referendum detail (see enterCanadaProvinceRidings/
   showAlbertaReferendumDetail in map_app.js, all of which add the real
   .canada-province-selected class) and was never updated once those were
   built -- it unconditionally forced .race-selector/.county-panel to
   display:none for EVERY .canada-mode state, including a province
   actually selected. Confirmed live with a full DOM simulation against
   this app's own real running server: #canada-province-summary's own
   child-level `display: block` rule further down (search
   "canada-province-summary") WAS correctly matching and injecting real
   HTML the whole time -- a child element's own display:block cannot
   override its own PARENT being display:none, which is exactly what
   this rule was unconditionally doing to .race-selector, the real parent
   of every Canada-specific panel. Once a real province IS selected, this
   now stops applying and the earlier, more general
   ".app-layout.country-mode .race-selector { display: block; }" rule
   (Canada carries .country-mode too) takes over instead, same two-column
   layout every other country's own constituency map already uses. */
.app-layout.canada-mode:not(.canada-province-selected) {
  grid-template-columns: 1fr;
}
.app-layout.canada-mode:not(.canada-province-selected) .race-selector,
.app-layout.canada-mode:not(.canada-province-selected) .county-panel {
  display: none;
}
/* #germany-candidate-list defaults to display:none like every other
   country's own -candidate-list (see #peru-candidate-list's own reveal
   rule below) -- shown once inside one state's own constituencies (i.e.
   .germany-states-view has been removed), holding that state's own real
   statewide party results (votes, seats, leader/Spitzenkandidat). */
.app-layout.germany-mode:not(.germany-states-view) #germany-candidate-list {
  display: block;
}
/* #germany-constituency-detail-panel (left sidebar) -- same real "click a
   [constituency] to see its own result on the left, same as a US county"
   convention as the shared #county-detail-panel/#county-detail (see
   showCountyDetail in map_app.js), shown alongside the (always-on,
   never-replaced) statewide results panel on the right. */
.app-layout.germany-mode:not(.germany-states-view) #germany-constituency-detail-panel {
  display: block;
}
/* #germany-partylist-seats-panel -- that state's own real total seats
   (see parse_statewide_results), one dot per real seat colored by that
   seat's own real party, same convention as Denmark/Malta/Thailand/
   Nepal's own equivalents (see .national-seat-panel's own comment). */
.app-layout.germany-mode:not(.germany-states-view) #germany-partylist-seats-panel {
  display: block;
}
/* Germany-specific override of the shared .national-seat-grid -- Berlin
   and Mecklenburg-Vorpommern's own real total seats (158 and 71 with
   real overhang/leveling seats, confirmed live) run the shared 8-column
   layout's own dot count tall enough to push #germany-partylist-seats-legend
   right off the bottom of a real laptop-height viewport, below the panel's
   own fixed position with no cap of its own -- the legend already had its
   own internal scroll (see .national-seat-legend), but that's no help
   when the whole panel never even reaches that far down the screen.
   More columns (12 instead of 8) means fewer real rows for the same real
   seat count -- "condensed" -- and this grid's own max-height + scroll
   (the same pattern .national-seat-legend already uses) means whatever's
   still left over scrolls internally instead of pushing the legend out
   of the panel's own fixed height. A no-op for a state with few enough
   real seats to already fit (no scrollbar appears unless content
   actually exceeds max-height), so this is safe to apply to every German
   state uniformly rather than only Berlin/Mecklenburg-Vorpommern
   specifically. */
#germany-partylist-seats-grid {
  grid-template-columns: repeat(12, 1fr);
  max-height: 9rem;
  overflow-y: auto;
}
/* #peru-office-toggle (the President button) is the one piece of Peru's
   own sidebar shown right away -- same as landing on the world map itself,
   nothing about a specific race is shown until something is actually
   picked (see enterPeruFromWorld/renderPeruSilhouette in map_app.js, which
   renders a single flat, no-data-colored national outline by default).
   Everything else here is real per-department/national result data, so it
   only appears once #app-layout also carries .peru-race-selected (added
   when President is clicked -- see the #peru-office-toggle click handler). */
#peru-office-toggle,
#peru-round-toggle, #peru-department-detail-panel, #peru-candidate-list,
#colombia-office-toggle,
#colombia-round-toggle, #colombia-department-detail-panel, #colombia-candidate-list,
#portugal-office-toggle,
#portugal-round-toggle, #portugal-department-detail-panel, #portugal-candidate-list,
#costarica-office-toggle, #costarica-department-detail-panel, #costarica-candidate-list,
#uk-office-toggle, #uk-constituency-detail-panel, #uk-candidate-list,
#scotland-map-toggle, #scotland-constituency-detail-panel, #scotland-candidate-list,
#brazil-office-toggle, #brazil-round-toggle, #brazil-state-detail-panel, #brazil-candidate-list,
#canada-province-summary, #canada-riding-detail-panel,
#hungary-office-toggle, #hungary-constituency-detail-panel, #hungary-candidate-list,
#thailand-office-toggle, #thailand-constituency-detail-panel, #thailand-candidate-list, #thailand-partylist-seats-panel,
#malta-office-toggle, #malta-district-detail-panel, #malta-candidate-list, #malta-gender-corrective-seats-panel,
#denmark-office-toggle, #denmark-district-detail-panel, #denmark-candidate-list, .denmark-overseas-panel, #denmark-leveling-seats-panel,
#faroe-office-toggle, #faroe-region-detail-panel, #faroe-candidate-list,
#japan-office-toggle, #japan-map-toggle, #japan-constituency-detail-panel, #japan-candidate-list, .japan-okinawa-inset,
#iceland-office-toggle, #iceland-constituency-detail-panel, #iceland-candidate-list,
#barbados-office-toggle, #barbados-constituency-detail-panel, #barbados-candidate-list,
#nepal-office-toggle, #nepal-constituency-detail-panel, #nepal-candidate-list, #nepal-partylist-seats-panel,
#germany-constituency-detail-panel,
#germany-partylist-seats-panel,
#sweden-office-toggle, #sweden-valkrets-detail-panel, #sweden-candidate-list,
#sweden-seats-panel, #sweden-leveling-seats-panel,
#russia-office-toggle, #russia-region-detail-panel, #russia-candidate-list, #russia-partylist-seats-panel,
#morocco-office-toggle, #morocco-region-detail-panel, #morocco-candidate-list, #morocco-partylist-seats-panel,
#algeria-office-toggle, #algeria-wilaya-detail-panel, #algeria-candidate-list, .algeria-overseas-panel,
#antigua-office-toggle, #antigua-constituency-detail-panel, #antigua-candidate-list,
#kazakhstan-office-toggle, #kazakhstan-region-detail-panel, #kazakhstan-candidate-list,
#latvia-office-toggle, #latvia-constituency-detail-panel, #latvia-candidate-list,
#bulgaria-office-toggle, #bulgaria-round-toggle, #bulgaria-constituency-detail-panel, #bulgaria-candidate-list,
#serbia-office-toggle, #serbia-region-detail-panel, #serbia-candidate-list,
#france-office-toggle, #france-region-detail-panel, #france-candidate-list,
#italy-office-toggle, #italy-constituency-detail-panel, #italy-candidate-list,
#poland-office-toggle, #poland-constituency-detail-panel, #poland-candidate-list,
#slovakia-office-toggle, #slovakia-constituency-detail-panel, #slovakia-candidate-list,
#andorra-office-toggle, #andorra-constituency-detail-panel, #andorra-candidate-list,
#switzerland-office-toggle, #switzerland-constituency-detail-panel, #switzerland-candidate-list,
#slovenia-office-toggle, #slovenia-constituency-detail-panel, #slovenia-candidate-list,
#estonia-office-toggle, #estonia-constituency-detail-panel, #estonia-candidate-list,
#mongolia-office-toggle, #mongolia-constituency-detail-panel, #mongolia-candidate-list,
#legislative-office-toggle, #legislative-detail-panel, #legislative-candidate-list,
#uk27-office-toggle,
#presidential-office-toggle, #presidential-round-toggle, #presidential-detail-panel, #presidential-candidate-list,
#combined-office-toggle, #combined-chamber-toggle, #combined-round-toggle, #combined-detail-panel, #combined-candidate-list,
#elsalvador-office-toggle, #elsalvador-department-detail-panel, #elsalvador-candidate-list,
#australia-office-toggle, #australia-region-detail-panel, #australia-candidate-list,
#israel-office-toggle, #israel-region-detail-panel, #israel-candidate-list,
#nz-party-vote-summary, #nz-map-toggle, #nz-electorate-detail-panel, #nz-partylist-panel,
#spain-office-toggle, #spain-province-detail-panel, #spain-candidate-list, .spain-overseas-panel,
#county-select-mode-toggle, #county-select-mode-hotkeys, #map-type-toggle { display: none; }
/* .app-layout .color-mode-toggle (two classes), not the bare single-class
   .color-mode-toggle -- specificity has to beat its own base style rule
   below (also a bare single class; source order alone would otherwise let
   that later rule win regardless of this one) while staying under the
   .app-layout.voter-registration-mode .color-mode-toggle override further
   below (three classes), which must still be able to win there -- an ID
   selector would outrank that override unconditionally and wrongly show
   the toggle in that mode too. */
.app-layout .color-mode-toggle { display: none; }
/* .peru-mode/.colombia-mode (set alongside .country-mode -- see
   enterPeruFromWorld/enterColombiaFromWorld) pick which country's own
   sidebar block shows, since both countries' elements coexist in the DOM
   at once but only one country is ever actually on screen. */
.app-layout.country-mode.peru-mode #peru-office-toggle { display: flex; }
.app-layout.country-mode.peru-mode.peru-race-selected #peru-round-toggle { display: flex; }
.app-layout.country-mode.peru-mode.peru-race-selected #peru-department-detail-panel { display: block; }
.app-layout.country-mode.peru-mode.peru-race-selected #peru-candidate-list { display: block; }
/* .peru-department-selected/.colombia-department-selected (added by
   showPeruDepartmentDetail/showColombiaDepartmentDetail once any
   department -- including Overseas itself -- has been clicked) hide
   the fixed overseas inset widget once a subdivision's own detail is
   showing, rather than leaving it sitting on screen throughout; it
   only ever shows again on a fresh re-entry from the world map. */
.app-layout.country-mode.colombia-mode #colombia-office-toggle { display: flex; }
.app-layout.country-mode.colombia-mode.colombia-race-selected #colombia-round-toggle { display: flex; }
.app-layout.country-mode.colombia-mode.colombia-race-selected #colombia-department-detail-panel { display: block; }
.app-layout.country-mode.colombia-mode.colombia-race-selected #colombia-candidate-list { display: block; }
.app-layout.country-mode.portugal-mode #portugal-office-toggle { display: flex; }
.app-layout.country-mode.portugal-mode.portugal-race-selected #portugal-round-toggle { display: flex; }
.app-layout.country-mode.portugal-mode.portugal-race-selected #portugal-department-detail-panel { display: block; }
.app-layout.country-mode.portugal-mode.portugal-race-selected #portugal-candidate-list { display: block; }
.app-layout.country-mode.costarica-mode #costarica-office-toggle { display: flex; }
.app-layout.country-mode.costarica-mode.costarica-race-selected #costarica-department-detail-panel { display: block; }
.app-layout.country-mode.costarica-mode.costarica-race-selected #costarica-candidate-list { display: block; }
/* The UK has no single "President"-style reveal (a by-election is a
   per-constituency event, not one shared election day) -- #uk-office-toggle
   (the PARLIAMENTARY_BY_ELECTIONS button) reveals the all-650 constituency
   map (.uk-byelection-selected), and clicking one of the 5 real
   by-elections on THAT map (see enterUkConstituencyDetail in map_app.js)
   is what adds .uk-constituency-selected (added ALONGSIDE .uk-byelection-selected,
   never instead of it). #uk-candidate-list shows at BOTH levels: the plain
   all-650 map default is renderUkPartyLeadersSummary's own real UK-wide
   party leaders/net seat-change summary, replaced by one specific
   by-election's own real candidate list only once drilled into. */
.app-layout.country-mode.uk-mode #uk-office-toggle { display: flex; }
.app-layout.country-mode.uk-mode.uk-byelection-selected #uk-constituency-detail-panel { display: block; }
.app-layout.country-mode.uk-mode.uk-byelection-selected #uk-candidate-list { display: block; }
/* Scotland's own devolved Parliament (Holyrood), 2026 election -- a real,
   DIFFERENT election reached via this same #uk-office-toggle's second
   button (see map_app.js's own Scottish Parliament section header
   comment). Same two-real-parallel-granularities shape as Japan's own
   #japan-map-toggle (73 constituencies vs. 8 regions, switched with
   #scotland-map-toggle rather than one map with two views) -- the
   national party-by-party summary in #scotland-candidate-list is the
   same data regardless of which granularity is showing, only replaced
   once you drill into one specific constituency or region
   (.scotland-detail-selected, added by either
   enterScotlandConstituencyDetail or enterScotlandRegionDetail). */
.app-layout.country-mode.uk-mode.scotland-election-selected #scotland-map-toggle { display: flex; }
.app-layout.country-mode.uk-mode.scotland-election-selected #scotland-constituency-detail-panel { display: block; }
.app-layout.country-mode.uk-mode.scotland-election-selected #scotland-candidate-list { display: block; }
/* The Senedd (Welsh Parliament), 2026 election -- a real, THIRD election
   under this same #uk-office-toggle. Only one real geometry (16
   constituencies, no separate regional tier -- see map_app.js's own
   Senedd section header comment for why), so there's no map-view toggle
   the way Scotland's own #scotland-map-toggle has; the national summary
   and the one map are always in sync. */
.app-layout.country-mode.uk-mode.senedd-election-selected #senedd-constituency-detail-panel { display: block; }
.app-layout.country-mode.uk-mode.senedd-election-selected #senedd-candidate-list { display: block; }
/* Hungary's 2026 parliamentary election has already happened (12 April
   2026) and every one of its 106 real single-member constituencies has a
   real, sourced winner (see hungary_constituencies.geojson) -- same
   national-map-then-all-constituencies-then-one-constituency drill-down as
   the UK's own by-elections, just with every constituency real instead of
   only 5 of 650. #hungary-office-toggle reveals the all-106 map
   (.hungary-election-selected); clicking one specific constituency (see
   enterHungaryConstituencyDetail in map_app.js) adds
   .hungary-constituency-selected for its own single-constituency detail. */
.app-layout.country-mode.hungary-mode #hungary-office-toggle { display: flex; }
.app-layout.country-mode.hungary-mode.hungary-election-selected #hungary-constituency-detail-panel { display: block; }
/* Unlike the UK's own #uk-candidate-list (real per-constituency results
   only, gated on .uk-constituency-selected), Hungary's right panel is
   meaningful at BOTH levels: the real national party-by-party summary
   (see renderHungaryNationalSummary) once the election is revealed, then
   overwritten with one constituency's own real winner (see
   renderHungaryCandidateList) once you drill into it -- so this is gated
   on the broader .hungary-election-selected alone, which stays present
   through both. */
.app-layout.country-mode.hungary-mode.hungary-election-selected #hungary-candidate-list { display: block; }
/* Thailand's 2026 general election (8 February 2026) has already happened
   and been decided -- same national-map-then-all-constituencies-then-one-
   constituency drill-down as Hungary, for all 400 real single-member
   constituencies. Exactly like Hungary: the national 400-constituency map
   is flat/raw-only (see thailandConstituencyColor -- no margin tint, no
   shade-by/multiselect toggle at all here); both toggles only appear once
   zoomed into one specific constituency (.thailand-constituency-selected),
   same gating as Hungary's own .hungary-constituency-selected. Unlike
   Hungary there's no locality sub-layer for them to act on there (see this
   session's own research summary -- no real sub-constituency breakdown was
   found anywhere), so Raw/Margin retints that one constituency's own single
   shape (see thailandConstituencyDetailColor) and multiselect can only ever
   select that same one shape -- offered for the same UI consistency with
   every other country map rather than because there's a second shape to
   pick from. */
.app-layout.country-mode.thailand-mode #thailand-office-toggle { display: flex; }
.app-layout.country-mode.thailand-mode.thailand-election-selected #thailand-constituency-detail-panel { display: block; }
.app-layout.country-mode.thailand-mode.thailand-election-selected #thailand-candidate-list { display: block; }
.app-layout.country-mode.thailand-mode.thailand-election-selected:not(.thailand-constituency-selected) #thailand-partylist-seats-panel { display: block; }
/* Malta's 2026 general election (30 May 2026) has already happened and been
   decided -- same national-map-then-all-districts-then-one-district
   drill-down as Hungary/Thailand, for all 13 real 5-seat STV districts.
   Malta's own system reports real results at PARTY granularity per
   district (votes/seats/swing), not individual first-preference vote
   counts per candidate -- the Electoral Commission's own count sheets that
   would have that are unreachable from this environment (403/Cloudflare,
   confirmed directly and via headless browser). The national 13-district
   map is flat/raw-only (see maltaDistrictColor -- colored by whichever
   party won the most seats there); shade-by/multiselect only appear once
   zoomed into one specific district (.malta-district-selected), same
   gating as Hungary/Thailand's own constituency-selected toggles. */
.app-layout.country-mode.malta-mode #malta-office-toggle { display: flex; }
.app-layout.country-mode.malta-mode.malta-election-selected #malta-district-detail-panel { display: block; }
.app-layout.country-mode.malta-mode.malta-election-selected #malta-candidate-list { display: block; }
.app-layout.country-mode.malta-mode.malta-election-selected:not(.malta-district-selected) #malta-gender-corrective-seats-panel { display: block; }
/* Denmark's 2026 Folketing general election (24 March 2026) has already
   happened and been decided -- same national-map-then-all-districts-then-
   one-district drill-down as Hungary/Thailand/Malta, for all 10 real
   storkredse (multi-member constituencies). Denmark's own official source
   (Danmarks Statistik) publishes real per-storkreds party totals AND real
   individual candidate personal vote counts, matching Hungary's own "gold
   standard" depth. The national 10-storkreds map is flat/raw-only (see
   denmarkDistrictColor -- colored by whichever party won the most votes
   there); shade-by/multiselect only appear once zoomed into one specific
   storkreds (.denmark-district-selected), same gating as Hungary/Thailand/
   Malta's own constituency/district-selected toggles. */
.app-layout.country-mode.denmark-mode #denmark-office-toggle { display: flex; }
.app-layout.country-mode.denmark-mode.denmark-election-selected #denmark-district-detail-panel { display: block; }
.app-layout.country-mode.denmark-mode.denmark-election-selected #denmark-candidate-list { display: block; }
/* Hidden once drilled into any one district's own detail (including the
   Faroe/Greenland insets' own detail, since .denmark-district-selected
   is the same class either way -- see enterDenmarkOverseasDetail) --
   same "fixed inset widget, not shown alongside a subdivision's own
   detail" convention as Peru/Colombia's own overseas insets above. */
.app-layout.country-mode.denmark-mode.denmark-election-selected:not(.denmark-district-selected) .denmark-overseas-panel { display: flex; }
.app-layout.country-mode.denmark-mode.denmark-election-selected:not(.denmark-district-selected) #denmark-leveling-seats-panel { display: block; }
/* The Faroe Islands' 2026 Logting general election (26 March 2026) has
   already happened and been decided -- same national-map-then-all-
   regions-then-one-region drill-down as Hungary/Thailand/Malta/Denmark,
   for the six real traditional sysla (region) groupings. Unlike every
   other country map here, the Logting's own 33 seats have been elected
   via ONE single nationwide constituency since a 2007 reform -- no real
   seats are allocated per sysla, so the national map/detail view here
   are real VOTE SHARE only, never a fabricated regional seat count (see
   build_faroe_results.py's own docstring for why kommuna-level
   boundaries were deliberately not used instead: a confirmed real 2009
   municipal merger was missing from the one open boundary dataset
   available, undermining confidence in it as ground truth). The
   national 6-region map is flat/raw-only (see faroeRegionColor --
   colored by whichever party got the most votes there); shade-by/
   multiselect only appear once zoomed into one specific region
   (.faroe-region-selected), same gating as every other country map's own
   constituency/district-selected toggles. */
.app-layout.country-mode.faroe-mode #faroe-office-toggle { display: flex; }
.app-layout.country-mode.faroe-mode.faroe-election-selected #faroe-region-detail-panel { display: block; }
.app-layout.country-mode.faroe-mode.faroe-election-selected #faroe-candidate-list { display: block; }
/* Japan's 2026 general election (8 February 2026) has already happened and
   been decided -- unlike every other country map here, it has TWO real
   parallel levels of single-shape granularity rather than one: 289 real
   single-member constituencies (shosenkyoku, first-past-the-post) AND 11
   real fixed proportional-representation blocks (each an aggregate of
   several prefectures' own constituencies), switched between with
   #japan-map-toggle (see enterJapanFromWorld/backToJapanTopMap in
   map_app.js) -- the national party-by-party summary in #japan-candidate-
   list is the SAME data regardless of which map is showing, only replaced
   once you drill into one specific constituency or block
   (.japan-detail-selected, added by either enterJapanConstituencyDetail or
   enterJapanBlockDetail). Both top-level maps are flat/raw-only, matching
   Hungary/Thailand/Malta/Denmark/Faroe's own national maps. */
.app-layout.country-mode.japan-mode #japan-office-toggle { display: flex; }
.app-layout.country-mode.japan-mode.japan-election-selected #japan-map-toggle { display: flex; }
.app-layout.country-mode.japan-mode.japan-election-selected #japan-constituency-detail-panel { display: block; }
.app-layout.country-mode.japan-mode.japan-election-selected #japan-candidate-list { display: block; }
/* Okinawa's own real islands sit ~400-600km south/west of the rest of
   Japan's real geography -- including them in the main map's own
   fitExtent bounds (either the 289-constituency map or the 11-PR-block
   map) would shrink mainland Japan down to a fraction of the available
   space, same real cartographic problem the US map's own Alaska/Hawaii
   solves by detaching them into their own corner treatment (see
   d3.geoAlbersUsa's own built-in insets) -- Okinawa doesn't have an
   equivalent composite-projection primitive to reuse, so it gets its own
   small corner map instead (same fixed-widget convention as Peru/
   Colombia/Denmark's own overseas insets), real geometry, sized up a bit
   from Denmark's own 150x88 insets since this one packs Okinawa's own
   real 4 constituencies (in the constituencies map) rather than a single
   shape. Visible for both top-level granularities, but hidden once
   drilled into either one's own detail view (see the
   :not(.japan-detail-selected) reveal rule just below). */
/* Hidden once drilled into a specific constituency or block's own
   detail (.japan-detail-selected, added by either
   enterJapanConstituencyDetail or enterJapanBlockDetail) -- same "fixed
   inset widget, not shown alongside a subdivision's own detail"
   convention as Peru/Colombia/Denmark's own overseas insets above. */
.app-layout.country-mode.japan-mode.japan-election-selected:not(.japan-detail-selected) .japan-okinawa-inset { display: block; }
/* ---- Default view of a map with insets -------------------------------------------------------------------------------------------------------------
   Before an election is chosen these countries show the election map itself -- same shapes, same position, same inset maps -- shaded neutral and not
   yet clickable; choosing the election only brings in the results (map_app.js, renderPortugalSilhouette and its siblings). */
.app-layout.peru-mode:not(.peru-race-selected) .peru-region-path,
.app-layout.colombia-mode:not(.colombia-race-selected) .colombia-region-path,
.app-layout.portugal-mode:not(.portugal-race-selected) .portugal-region-path,
.app-layout.costarica-mode:not(.costarica-race-selected) .costarica-region-path,
.app-layout.peru-mode:not(.peru-race-selected) .baked-overseas-path,
.app-layout.colombia-mode:not(.colombia-race-selected) .baked-overseas-path,
.app-layout.portugal-mode:not(.portugal-race-selected) .baked-overseas-path,
.app-layout.costarica-mode:not(.costarica-race-selected) .baked-overseas-path,
.app-layout.denmark-mode:not(.denmark-election-selected) .denmark-district-path,
.app-layout.denmark-mode:not(.denmark-election-selected) #denmark-overseas-insets path,
.app-layout.japan-mode:not(.japan-election-selected) .japan-constituency-path,
.app-layout.japan-mode:not(.japan-election-selected) .japan-okinawa-path,
.app-layout.algeria-mode:not(.algeria-election-selected) .algeria-wilaya-path,
.app-layout.algeria-mode:not(.algeria-election-selected) #algeria-overseas-insets path { fill: #d9d9d9 !important; }
.app-layout.peru-mode:not(.peru-race-selected) .peru-region-path,
.app-layout.colombia-mode:not(.colombia-race-selected) .colombia-region-path,
.app-layout.portugal-mode:not(.portugal-race-selected) .portugal-region-path,
.app-layout.costarica-mode:not(.costarica-race-selected) .costarica-region-path,
.app-layout.peru-mode:not(.peru-race-selected) .baked-overseas-path,
.app-layout.colombia-mode:not(.colombia-race-selected) .baked-overseas-path,
.app-layout.portugal-mode:not(.portugal-race-selected) .baked-overseas-path,
.app-layout.costarica-mode:not(.costarica-race-selected) .baked-overseas-path,
.app-layout.denmark-mode:not(.denmark-election-selected) .denmark-district-path,
.app-layout.denmark-mode:not(.denmark-election-selected) #denmark-overseas-insets path,
.app-layout.japan-mode:not(.japan-election-selected) .japan-constituency-path,
.app-layout.japan-mode:not(.japan-election-selected) .japan-okinawa-path,
.app-layout.algeria-mode:not(.algeria-election-selected) .algeria-wilaya-path,
.app-layout.algeria-mode:not(.algeria-election-selected) #algeria-overseas-insets path,
.app-layout.peru-mode:not(.peru-race-selected) .baked-inset,
.app-layout.colombia-mode:not(.colombia-race-selected) .baked-inset,
.app-layout.portugal-mode:not(.portugal-race-selected) .baked-inset,
.app-layout.costarica-mode:not(.costarica-race-selected) .baked-inset,
.app-layout.denmark-mode:not(.denmark-election-selected) #denmark-overseas-insets > *,
.app-layout.japan-mode:not(.japan-election-selected) .japan-okinawa-inset,
.app-layout.algeria-mode:not(.algeria-election-selected) #algeria-overseas-insets > * { pointer-events: none !important; cursor: default; }
.app-layout.country-mode.denmark-mode:not(.denmark-election-selected) .denmark-overseas-panel { display: flex; }
.app-layout.country-mode.japan-mode:not(.japan-election-selected) .japan-okinawa-inset { display: block; }
.app-layout.country-mode.algeria-mode:not(.algeria-election-selected) .algeria-overseas-panel { display: block; }
/* Brazil's real October 4, 2026 first-round results are already in (see
   renderBrazilStates' own real per-state shading/Tree Map) -- there's no
   separate "silhouette vs revealed" map state the way Peru/Colombia have
   before their own first round, just a single click to reveal the
   national summary panel (see the #brazil-office-toggle click handler in
   map_app.js). Round 1 (Oct 4) has results; #brazil-round-toggle switches
   to the Oct 25 runoff, which has none yet. */
.app-layout.country-mode.brazil-mode #brazil-office-toggle { display: flex; }
.app-layout.country-mode.brazil-mode.brazil-race-selected #brazil-round-toggle { display: flex; }
.app-layout.country-mode.brazil-mode.brazil-race-selected #brazil-state-detail-panel { display: block; }
.app-layout.country-mode.brazil-mode.brazil-race-selected #brazil-candidate-list { display: block; }
/* Canada's summary/detail panels appear once a real province has
   actually been picked -- a drilled-into BC/Quebec riding map (see
   enterCanadaProvinceRidings) or Alberta's own referendum detail (see
   showAlbertaReferendumDetail), both of which add the same
   .canada-province-selected class. All three real provinces are always
   shown/clickable together on the map itself (no mode toggle -- see
   map_app.js's own Canada section header comment). */
.app-layout.country-mode.canada-mode.canada-province-selected #canada-province-summary { display: block; }
.app-layout.country-mode.canada-mode.canada-province-selected #canada-riding-detail-panel { display: block; }
/* Iceland's real 2026 EU membership negotiations referendum (29 August
   2026, already held and decided -- real result NO, 52.84%-47.16%) --
   same national-map-then-all-constituencies-then-one-constituency
   drill-down as Hungary/Thailand/Malta/Denmark/Faroe, for the 6 real
   kjördæmi (constituencies): Reykjavík North, Reykjavík South,
   Southwest, Northwest, Northeast, South. Unlike every party-based
   country map here, this is a binary Yes/No referendum with no
   parties/seats -- #iceland-candidate-list shows the real national
   Yes/No tally instead of a party list, and each constituency is
   colored by which side won there, not by a party color. Reykjavík
   North and South are shown as ONE combined map shape carrying both
   real halves' own real numbers (see iceland_results.json's own
   "halves"/"combinedNote" fields) -- the real electoral boundary
   between them has no published geometry anywhere; Kosningalög
   112/2021 Art. 8 has it redrawn by street centerline before every
   single election, published only as a text description, never a
   boundary file. Unlike most other country maps here (which only reveal
   shade-by/multiselect once zoomed into one specific constituency/
   district), Iceland's national 5-shape map shows both immediately, the
   same "available across the whole map right away" convention Peru and
   Colombia use (.iceland-election-selected, not the narrower
   .iceland-constituency-selected) -- Iceland only has 5 real regions
   total, so multiselecting/shading across all of them from the top map
   is a genuinely useful comparison, the same way it is for Peru's
   25 departments. */
.app-layout.country-mode.iceland-mode #iceland-office-toggle { display: flex; }
.app-layout.country-mode.iceland-mode.iceland-election-selected #iceland-constituency-detail-panel { display: block; }
.app-layout.country-mode.iceland-mode.iceland-election-selected #iceland-candidate-list { display: block; }
/* Barbados's real 2026 general election (11 February 2026, already held
   and decided) -- no real sub-constituency results exist to shade by or
   compare across (checked directly: the EBC's own finer "Polling
   Districts" layer carries only voter-registration counts, no
   candidate/vote fields at all -- see this app's own Barbados section
   header comment in map_app.js), so neither the color-mode-toggle nor
   #county-select-mode-toggle ever shows for Barbados at all, at either
   level -- only .barbados-constituency-selected (below) gates the
   color-mode-toggle, narrower than every other country's own
   -election-selected gate. */
.app-layout.country-mode.barbados-mode #barbados-office-toggle { display: flex; }
.app-layout.country-mode.barbados-mode.barbados-election-selected #barbados-constituency-detail-panel { display: block; }
.app-layout.country-mode.barbados-mode.barbados-election-selected #barbados-candidate-list { display: block; }
/* Nepal's real 2026 general election (5 March 2026, already held and
   decided) -- an even narrower real data gap than Barbados's: Barbados
   still has a real winner-vs-runner-up vote margin at the single
   constituency shape once drilled in (see .barbados-constituency-selected
   below), but Nepal's own sourced table (Election Commission of Nepal via
   Wikipedia) publishes only the real winning candidate's name/party per
   constituency -- no runner-up, no vote count at all, not even for the
   winner. So the color-mode-toggle never shows for Nepal at ANY level,
   not even Barbados's own narrower constituency-selected exception (there
   is nothing real to tint with), and #county-select-mode-toggle never
   shows either, same as Barbados. The real 110-seat nationwide party-list
   panel (see #nepal-partylist-seats-panel) is Thailand's own pattern
   though, not Barbados's (which has no PR tier at all) -- gated the same
   way Thailand's is, hidden once zoomed into one specific constituency. */
.app-layout.country-mode.nepal-mode #nepal-office-toggle { display: flex; }
.app-layout.country-mode.nepal-mode.nepal-election-selected #nepal-constituency-detail-panel { display: block; }
.app-layout.country-mode.nepal-mode.nepal-election-selected #nepal-candidate-list { display: block; }
.app-layout.country-mode.nepal-mode.nepal-election-selected:not(.nepal-constituency-selected) #nepal-partylist-seats-panel { display: block; }
/* Sweden's real 2026-09-13 Riksdagsval, LIVE as this is written -- unlike
   Barbados/Nepal above, Sweden DOES have a real per-valkrets vote margin
   (leading party vs. runner-up, by real vote share) worth shading by
   once drilled into one specific valkrets, same as Denmark's own
   storkreds detail view -- see .sweden-constituency-selected in the
   color-mode-toggle list below. */
.app-layout.country-mode.sweden-mode #sweden-office-toggle { display: flex; }
.app-layout.country-mode.sweden-mode.sweden-election-selected #sweden-valkrets-detail-panel { display: block; }
.app-layout.country-mode.sweden-mode.sweden-election-selected #sweden-candidate-list { display: block; }
/* #sweden-seats-panel -- the real preliminary fixed+leveling seat
   breakdown (see renderSwedenSeatsPanel in map_app.js), shown alongside
   the vote-based #sweden-candidate-list at both the national-summary
   and drilled-into-valkrets level. */
.app-layout.country-mode.sweden-mode.sweden-election-selected #sweden-seats-panel { display: block; }
/* #sweden-leveling-seats-panel -- a SEPARATE insert, same real
   national-seat-panel/corner-seat-panel dot-grid convention as Denmark's
   own #denmark-leveling-seats-panel (tillaegsmandater are the same real
   "leveling seat" concept) and Malta's/Thailand's own corner panels (see
   .national-seat-panel's own comment near the top of this file) -- one
   dot per real nationwide utjamningsmandat (see renderSwedenLevelingSeats
   in map_app.js). Same "national-summary level only" gate as Malta's own
   #malta-gender-corrective-seats-panel -- hidden again once drilled into
   one specific valkrets (.sweden-constituency-selected), since Sweden's
   own leveling seats, like Denmark's, are a real NATIONAL total, not
   something that changes per valkrets shown. */
.app-layout.country-mode.sweden-mode.sweden-election-selected:not(.sweden-constituency-selected) #sweden-leveling-seats-panel { display: block; }
/* Russia's real 2026 State Duma election -- national + regional level
   only (no color-mode-toggle/county-select-mode entry here: unlike
   Sweden's real per-valkrets seat MARGIN, a region's own fill is a flat
   "which party leads this region's own real single-mandate seats"
   color, nothing to switch between Raw/Margin for -- see
   russiaRegionColor's own comment in map_app.js). */
.app-layout.country-mode.russia-mode #russia-office-toggle { display: flex; }
/* Federal Districts (the real 83-region map, click through to one
   region's own real single-mandate districts) vs. Single-Member
   Districts (all 225 real districts at once, flat, no region map to
   click through first) -- same real #japan-map-toggle granularity-
   switch convention (see that toggle's own comment), adapted for the
   real constraint that Russia's 225 districts have no real boundary
   source to draw a second real map from (see ingestion/build_russia_
   duma_results.py's own module docstring) -- so switching to
   Single-Member Districts swaps the region map for a flat, non-
   interactive silhouette (renderRussiaSilhouette, the same "nothing to
   click here" shape every country's own pre-reveal silhouette already
   uses) rather than a second real drawn map. */
.app-layout.country-mode.russia-mode.russia-election-selected:not(.russia-region-selected) #russia-partylist-seats-panel { display: block; }
.app-layout.country-mode.russia-mode.russia-election-selected #russia-region-detail-panel { display: block; }
.app-layout.country-mode.russia-mode.russia-election-selected #russia-candidate-list { display: block; }
/* Morocco's real 2026 general election -- national + real 12-region
   level only, one single map view (no granularity toggle -- unlike
   Russia, no real per-local-constituency boundary source was even
   attempted here; see ingestion/build_morocco_election_results.py's
   own module docstring for the real, confirmed reasons). A region's
   own real fill is neutral/flat -- no real per-region party result
   exists anywhere to choropleth by (same module's own docstring). */
.app-layout.country-mode.morocco-mode #morocco-office-toggle { display: flex; }
.app-layout.country-mode.morocco-mode.morocco-election-selected #morocco-region-detail-panel { display: block; }
.app-layout.country-mode.morocco-mode.morocco-election-selected #morocco-candidate-list { display: block; }
/* #morocco-partylist-seats-panel -- that real party's own real 395-seat
   House of Representatives total (declared post-election) or real 2021
   baseline composition (pre-election), one dot per real seat colored by
   that party's own real color -- same real national-seat-panel/corner-
   seat-panel dot-grid convention as Denmark/Malta/Thailand/Nepal/
   Germany/Sweden's own equivalents (see .national-seat-panel's own
   comment near the top of this file). Same "national-summary level
   only" gate as Sweden's own #sweden-leveling-seats-panel -- hidden
   again once drilled into one specific region, since this is a real
   NATIONAL total, not something that changes per region shown (no real
   per-region result exists at all -- see ingestion/build_morocco_
   election_results.py's own module docstring). */
.app-layout.country-mode.morocco-mode.morocco-election-selected:not(.morocco-region-selected) #morocco-partylist-seats-panel { display: block; }
/* Algeria's real 2026 People's National Assembly election -- already
   complete/certified (held 2 July 2026), unlike Morocco's own still-
   upcoming one, so shown as a plain final result, no "Scheduled for"
   language. National + real 58-wilaya level only (a real, slightly
   older administrative map than the real 2026 election's own 69
   electoral constituencies -- see ingestion/build_algeria_election_
   results.py's own module docstring for the real, confirmed reason). A
   wilaya's own real fill is neutral/flat -- no real per-wilaya result
   exists anywhere to choropleth by (same module's own docstring). */
.app-layout.country-mode.algeria-mode #algeria-office-toggle { display: flex; }
.app-layout.country-mode.algeria-mode.algeria-election-selected #algeria-wilaya-detail-panel { display: block; }
.app-layout.country-mode.algeria-mode.algeria-election-selected #algeria-candidate-list { display: block; }
.app-layout.country-mode.algeria-mode.algeria-election-selected:not(.algeria-wilaya-selected) .algeria-overseas-panel { display: block; }
/* Antigua and Barbuda's real 2026 general election -- already complete/
   certified (held 30 April 2026). Unlike Morocco/Algeria, real
   individual results exist for every one of the real 17 constituencies
   (see ingestion/build_antigua_election_results.py's own module
   docstring), and the map itself now has its own real distinct shape
   for all 17 of them too -- reconstructed from Wikipedia's own real
   per-constituency locator-map SVGs, since no official GIS source has
   ever digitized these boundaries (see that same module docstring).
   Every map shape maps 1:1 to exactly one real constituency's own
   real result, same convention as Kazakhstan's own region map below. */
.app-layout.country-mode.antigua-mode #antigua-office-toggle { display: flex; }
.app-layout.country-mode.antigua-mode.antigua-election-selected #antigua-constituency-detail-panel { display: block; }
.app-layout.country-mode.antigua-mode.antigua-election-selected #antigua-candidate-list { display: block; }
/* Kazakhstan's real 2026 Kurultai election -- the real, brand-new
   unicameral legislature (145 seats) that replaced the real bicameral
   Parlament (Mazhilis + Senate) under the real July 2026 constitutional
   reform; already complete/certified (held 23 August 2026). Real
   individual results exist for every one of the real 20 current top-
   level divisions (see ingestion/build_kazakhstan_election_results.py's
   own module docstring), and the map itself now has its own real
   distinct current-era boundary shape for all 20 of them too -- the
   real 4 divisions created by the 2018/2022 reforms (Abai/Jetisu/
   Ulytau/Shymkent) are reconstructed from GADM's own real admin-2
   (district/rayon) boundaries, regrouped by each new region's own
   real documented district list, since no whole-region boundary
   source had caught up to the reform on its own yet. Every map shape
   maps 1:1 to exactly one real division's own real results. */
.app-layout.country-mode.kazakhstan-mode #kazakhstan-office-toggle { display: flex; }
.app-layout.country-mode.kazakhstan-mode.kazakhstan-election-selected #kazakhstan-region-detail-panel { display: block; }
.app-layout.country-mode.kazakhstan-mode.kazakhstan-election-selected #kazakhstan-candidate-list { display: block; }
/* Latvia -- 15th Saeima election (3 October 2026): 5 constituencies, drilling into a constituency shows its municipalities. The
   Saeima Election toggle is selected on entry. */
.app-layout.country-mode.latvia-mode #latvia-office-toggle { display: flex; }
.app-layout.country-mode.latvia-mode.latvia-election-selected #latvia-constituency-detail-panel { display: block; }
.app-layout.country-mode.latvia-mode.latvia-election-selected #latvia-candidate-list { display: block; }
/* Bulgaria -- President / National Assembly toggle (President selected on entry); 31 constituencies, drilling into one shows its
   municipalities. */
.app-layout.country-mode.bulgaria-mode #bulgaria-office-toggle { display: flex; }
.app-layout.country-mode.bulgaria-mode.bulgaria-president:not(.bulgaria-constituency-selected) #bulgaria-round-toggle { display: flex; }
.app-layout.country-mode.bulgaria-mode.bulgaria-election-selected #bulgaria-constituency-detail-panel { display: block; }
.app-layout.country-mode.bulgaria-mode.bulgaria-election-selected #bulgaria-candidate-list { display: block; }
/* Serbia -- 2026 parliamentary election: one nationwide closed-list PR
   constituency; the municipality map is where the votes were cast, shown
   under the National Assembly toggle that is selected on entry. */
.app-layout.country-mode.serbia-mode #serbia-office-toggle { display: flex; }
.app-layout.country-mode.serbia-mode.serbia-election-selected #serbia-region-detail-panel { display: block; }
.app-layout.country-mode.serbia-mode.serbia-election-selected #serbia-candidate-list { display: block; }
/* France -- 2027 presidential election (upcoming: no votes yet, so no shading/Tree Map/multiselect). */
.app-layout.country-mode.france-mode #france-office-toggle { display: flex; }
.app-layout.country-mode.france-mode.france-election-selected #france-region-detail-panel { display: block; }
.app-layout.country-mode.france-mode.france-election-selected #france-candidate-list { display: block; }
/* Italy -- next general election (upcoming: no votes yet, so no shading/Tree Map/multiselect). */
.app-layout.country-mode.italy-mode #italy-office-toggle { display: flex; }
.app-layout.country-mode.italy-mode.italy-election-selected #italy-constituency-detail-panel { display: block; }
.app-layout.country-mode.italy-mode.italy-election-selected #italy-candidate-list { display: block; }
.app-layout.country-mode.poland-mode #poland-office-toggle { display: flex; }
.app-layout.country-mode.poland-mode.poland-election-selected #poland-constituency-detail-panel { display: block; }
.app-layout.country-mode.poland-mode.poland-election-selected #poland-candidate-list { display: block; }
.app-layout.country-mode.slovakia-mode #slovakia-office-toggle { display: flex; }
.app-layout.country-mode.slovakia-mode.slovakia-election-selected #slovakia-constituency-detail-panel { display: block; }
.app-layout.country-mode.slovakia-mode.slovakia-election-selected #slovakia-candidate-list { display: block; }
.app-layout.country-mode.andorra-mode #andorra-office-toggle { display: flex; }
.app-layout.country-mode.andorra-mode.andorra-election-selected #andorra-constituency-detail-panel { display: block; }
.app-layout.country-mode.andorra-mode.andorra-election-selected #andorra-candidate-list { display: block; }
.app-layout.country-mode.switzerland-mode #switzerland-office-toggle { display: flex; }
.app-layout.country-mode.switzerland-mode.switzerland-election-selected #switzerland-constituency-detail-panel { display: block; }
.app-layout.country-mode.switzerland-mode.switzerland-election-selected #switzerland-candidate-list { display: block; }
.app-layout.country-mode.slovenia-mode #slovenia-office-toggle { display: flex; }
.app-layout.country-mode.slovenia-mode.slovenia-election-selected #slovenia-constituency-detail-panel { display: block; }
.app-layout.country-mode.slovenia-mode.slovenia-election-selected #slovenia-candidate-list { display: block; }
.app-layout.country-mode.estonia-mode #estonia-office-toggle { display: flex; }
.app-layout.country-mode.estonia-mode.estonia-election-selected #estonia-constituency-detail-panel { display: block; }
.app-layout.country-mode.estonia-mode.estonia-election-selected #estonia-candidate-list { display: block; }
.app-layout.country-mode.mongolia-mode #mongolia-office-toggle { display: flex; }
.app-layout.country-mode.mongolia-mode.mongolia-election-selected #mongolia-constituency-detail-panel { display: block; }
.app-layout.country-mode.mongolia-mode.mongolia-election-selected #mongolia-candidate-list { display: block; }
.app-layout.country-mode.legislative-mode #legislative-office-toggle { display: flex; }
.app-layout.country-mode.legislative-mode.legislative-election-selected #legislative-detail-panel { display: block; }
.app-layout.country-mode.legislative-mode.legislative-election-selected #legislative-candidate-list { display: block; }
.app-layout.country-mode.presidential-mode #presidential-office-toggle { display: flex; }
.app-layout.country-mode.presidential-mode.presidential-election-selected #presidential-round-toggle { display: flex; }
.app-layout.country-mode.presidential-mode.presidential-election-selected #presidential-detail-panel { display: block; }
.app-layout.country-mode.presidential-mode.presidential-election-selected #presidential-candidate-list { display: block; }
.app-layout.country-mode.combined-mode #combined-office-toggle { display: flex; }
.app-layout.country-mode.combined-mode.combined-election-selected #combined-detail-panel { display: block; }
.app-layout.country-mode.combined-mode.combined-election-selected #combined-candidate-list { display: block; }
/* 2027 national shells: just the map, like the plain 2026 provinces / states overviews -- no sidebars at all. */
.app-layout.country-mode.national-shell-mode:not(.national-shell-sidebars) { grid-template-columns: 1fr; }
.app-layout.country-mode.national-shell-mode:not(.national-shell-sidebars) .race-selector,
.app-layout.country-mode.national-shell-mode:not(.national-shell-sidebars) .county-panel,
.app-layout.country-mode.national-shell-mode:not(.national-shell-sidebars) .sidebar-toggle { display: none; }
/* The UK 2027 map keeps the 2026 UK map's two sidebars (election buttons on the left, the right one empty until an election is opened). */
.app-layout.country-mode.national-shell-mode.national-shell-sidebars { grid-template-columns: var(--left-col-width) 1fr var(--right-col-width); }
.app-layout.country-mode.national-shell-mode.national-shell-sidebars #uk27-office-toggle { display: flex; }
/* The 2027 U.S. map (the three governorships) offers Governor only -- no other office, and no data/poll tools of the 2026 cycle. */
body.us-2027-mode #national-office-toggle [data-office]:not([data-office="GOVERNOR"]):not([data-office="SENATE_SPECIAL"]),
/* The special U.S. Senate election is a 2027 contest (Minnesota): its menu entry exists only on the 2027 map. */
body:not(.us-2027-mode) #national-office-toggle [data-office="SENATE_SPECIAL"],
body.us-2027-mode #nav-dropdown-dataviz,
body.us-2027-mode .polls-nav-link, body.us-2027-mode #nav-dropdown-polls { display: none; }
#combined-round-toggle button:disabled { opacity: 0.45; cursor: not-allowed; }
#presidential-round-toggle button:disabled { opacity: 0.45; cursor: not-allowed; }
.presidential-timeline { margin: 0.2rem 0 0.4rem 1.1rem; padding: 0; }
/* El Salvador -- 2027 presidential + legislative elections (upcoming: no votes yet, so no shading/Tree Map/multiselect). */
.app-layout.country-mode.elsalvador-mode #elsalvador-office-toggle { display: flex; }
.app-layout.country-mode.elsalvador-mode.elsalvador-election-selected #elsalvador-department-detail-panel { display: block; }
.app-layout.country-mode.elsalvador-mode.elsalvador-election-selected #elsalvador-candidate-list { display: block; }
/* Australia -- the 2025 federal election (historical, final AEC results): House of
   Representatives divisions and Senate by state/territory. */
/* The plain map of the states has no sidebars at all. */
.app-layout.australia-mode:not(.australia-election-selected) { grid-template-columns: 1fr; }
.app-layout.australia-mode:not(.australia-election-selected) .race-selector,
.app-layout.australia-mode:not(.australia-election-selected) .county-panel,
.app-layout.australia-mode:not(.australia-election-selected) .sidebar-toggle { display: none; }
.app-layout.country-mode.australia-mode.australia-election-selected #australia-office-toggle { display: flex; }
.app-layout.country-mode.australia-mode.australia-election-selected #australia-region-detail-panel { display: block; }
.app-layout.country-mode.australia-mode.australia-election-selected #australia-candidate-list { display: block; }
/* Israel -- 2026 Knesset election. Single real nationwide PR
   constituency (see app/services/israel_client.py's own module
   docstring) -- the real 6 Districts drawn here are a geographic
   DISPLAY layer only, never seat-determining, same non-seat role
   Kazakhstan's own 20 divisions play above. */
.app-layout.country-mode.israel-mode #israel-office-toggle { display: flex; }
.app-layout.country-mode.israel-mode.israel-election-selected #israel-region-detail-panel { display: block; }
.app-layout.country-mode.israel-mode.israel-election-selected #israel-candidate-list { display: block; }
/* No real office-toggle for New Zealand -- General Election is the only
   real office, same "nothing left to choose, so show it immediately"
   convention as Brazil/Israel's own single-button auto-select (see
   enterNzFromWorld in map_app.js), so these show as soon as nz-mode
   itself is active, no further .nz-election-selected gate needed. */
.app-layout.country-mode.nz-mode #nz-party-vote-summary { display: block; }
.app-layout.country-mode.nz-mode #nz-map-toggle { display: flex; }
.app-layout.country-mode.nz-mode.nz-electorate-selected #nz-electorate-detail-panel { display: block; }
/* The electorate's own panel on the left: its results, then every counted voting place (a point on the map, a row here). */
.nz-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.nz-detail-close { border: 0; background: transparent; font-size: 1.1rem; line-height: 1; cursor: pointer; color: #555; padding: 0.1rem 0.3rem; }
.app-layout.country-mode.nz-mode #nz-partylist-panel { display: block; }
/* Spain's announced 2026 general election -- Congress of Deputies +
   directly elected Senate (see map_app.js's own Spain section header
   comment for the real announced-date/decree-pending status and the
   Senate geography: the Senate button shows the 59 real Senate
   constituencies). #spain-province-detail-panel shows a real
   province's own name once clicked, always with a "no results yet"
   message -- no real per-province seat magnitude exists until the
   real convocation decree's own annex is found and parsed. */
.app-layout.country-mode.spain-mode #spain-office-toggle { display: flex; }
.app-layout.country-mode.spain-mode.spain-election-selected #spain-province-detail-panel { display: block; }
.app-layout.country-mode.spain-mode.spain-election-selected #spain-candidate-list { display: block; }
.app-layout.country-mode.spain-mode.spain-election-selected .spain-overseas-panel { display: block; }
/* inside a constituency the overseas insets belong to the whole-country map, not its municipalities */
.app-layout.country-mode.spain-mode.spain-detail-selected .spain-overseas-panel { display: none; }
.app-layout.state-mode .color-mode-toggle,
.app-layout.country-mode.peru-mode.peru-race-selected .color-mode-toggle,
.app-layout.country-mode.colombia-mode.colombia-race-selected .color-mode-toggle,
.app-layout.country-mode.portugal-mode.portugal-race-selected .color-mode-toggle,
.app-layout.country-mode.costarica-mode.costarica-race-selected .color-mode-toggle,
.app-layout.country-mode.serbia-mode.serbia-election-selected .color-mode-toggle,
.app-layout.country-mode.australia-mode.australia-election-selected .color-mode-toggle,
.app-layout.country-mode.brazil-mode.brazil-race-selected .color-mode-toggle,
.app-layout.country-mode.bulgaria-mode.bulgaria-president:not(.bulgaria-constituency-selected) .color-mode-toggle,
.app-layout.country-mode.uk-mode.uk-constituency-selected .color-mode-toggle,
.app-layout.country-mode.uk-mode.scotland-detail-selected .color-mode-toggle,
.app-layout.country-mode.uk-mode.senedd-election-selected .color-mode-toggle,
.app-layout.country-mode.uk-mode.senedd-detail-selected .color-mode-toggle,
.app-layout.country-mode.hungary-mode.hungary-constituency-selected .color-mode-toggle,
.app-layout.country-mode.latvia-mode.latvia-constituency-selected .color-mode-toggle,
.app-layout.country-mode.bulgaria-mode.bulgaria-constituency-selected .color-mode-toggle,
.app-layout.country-mode.thailand-mode.thailand-constituency-selected .color-mode-toggle,
.app-layout.country-mode.malta-mode.malta-district-selected .color-mode-toggle,
.app-layout.country-mode.denmark-mode.denmark-district-selected .color-mode-toggle,
.app-layout.country-mode.faroe-mode.faroe-region-selected .color-mode-toggle,
.app-layout.country-mode.japan-mode.japan-detail-selected .color-mode-toggle,
.app-layout.country-mode.iceland-mode.iceland-election-selected .color-mode-toggle,
.app-layout.country-mode.barbados-mode.barbados-constituency-selected .color-mode-toggle,
.app-layout.country-mode.sweden-mode.sweden-constituency-selected .color-mode-toggle,
/* Germany's own constituency map (41-70 real constituencies) is already
   the top, only level -- same scale/role as a US state's own county map
   (.state-mode above), not a further-drilled-into single-constituency
   detail the way every other country's own "-selected" gate means -- so
   this reveals as soon as .germany-states-view is gone, same condition
   #germany-candidate-list itself already uses. */
.app-layout.country-mode.germany-mode:not(.germany-states-view) .color-mode-toggle { display: flex; }
.app-layout.state-mode #county-select-mode-toggle,
.app-layout.country-mode.peru-mode.peru-race-selected #county-select-mode-toggle,
.app-layout.country-mode.colombia-mode.colombia-race-selected #county-select-mode-toggle,
.app-layout.country-mode.portugal-mode.portugal-race-selected #county-select-mode-toggle,
.app-layout.country-mode.costarica-mode.costarica-race-selected #county-select-mode-toggle,
.app-layout.country-mode.serbia-mode.serbia-election-selected #county-select-mode-toggle,
.app-layout.country-mode.brazil-mode.brazil-race-selected #county-select-mode-toggle,
.app-layout.country-mode.hungary-mode.hungary-constituency-selected #county-select-mode-toggle,
.app-layout.country-mode.latvia-mode.latvia-constituency-selected #county-select-mode-toggle,
.app-layout.country-mode.bulgaria-mode.bulgaria-constituency-selected #county-select-mode-toggle,
.app-layout.country-mode.thailand-mode.thailand-constituency-selected #county-select-mode-toggle,
.app-layout.country-mode.malta-mode.malta-district-selected #county-select-mode-toggle,
.app-layout.country-mode.denmark-mode.denmark-district-selected #county-select-mode-toggle,
.app-layout.country-mode.faroe-mode.faroe-region-selected #county-select-mode-toggle,
.app-layout.country-mode.japan-mode.japan-detail-selected #county-select-mode-toggle,
.app-layout.country-mode.iceland-mode.iceland-election-selected #county-select-mode-toggle,
.app-layout.country-mode.sweden-mode.sweden-constituency-selected #county-select-mode-toggle,
.app-layout.country-mode.israel-mode.israel-election-selected #county-select-mode-toggle { display: flex; }
/* Israel: Shade by (% Margin / Raw / Votes Left) and Map Type (Tree Map), like any other election map with divisions to shade and tile. */
.app-layout.country-mode.israel-mode.israel-election-selected .color-mode-toggle,
.app-layout.country-mode.israel-mode.israel-election-selected #map-type-toggle { display: flex; }
.app-layout.country-mode.israel-mode.israel-election-selected #color-mode-toggle [data-mode="VOTES_LEFT"] { display: inline-block; }
/* New Zealand: Shade by (Candidate Strength / Flat / Votes Left) on the electorate map; votes left is the share of an electorate's voting places still to report. */
.app-layout.country-mode.nz-mode .color-mode-toggle { display: flex; }
.app-layout.country-mode.nz-mode #color-mode-toggle [data-mode="VOTES_LEFT"] { display: inline-block; }
.app-layout.state-mode #county-select-mode-hotkeys,
.app-layout.country-mode.peru-mode.peru-race-selected #county-select-mode-hotkeys,
.app-layout.country-mode.colombia-mode.colombia-race-selected #county-select-mode-hotkeys,
.app-layout.country-mode.portugal-mode.portugal-race-selected #county-select-mode-hotkeys,
.app-layout.country-mode.costarica-mode.costarica-race-selected #county-select-mode-hotkeys,
.app-layout.country-mode.serbia-mode.serbia-election-selected #county-select-mode-hotkeys,
.app-layout.country-mode.brazil-mode.brazil-race-selected #county-select-mode-hotkeys,
.app-layout.country-mode.hungary-mode.hungary-constituency-selected #county-select-mode-hotkeys,
.app-layout.country-mode.latvia-mode.latvia-constituency-selected #county-select-mode-hotkeys,
.app-layout.country-mode.bulgaria-mode.bulgaria-constituency-selected #county-select-mode-hotkeys,
.app-layout.country-mode.thailand-mode.thailand-constituency-selected #county-select-mode-hotkeys,
.app-layout.country-mode.malta-mode.malta-district-selected #county-select-mode-hotkeys,
.app-layout.country-mode.denmark-mode.denmark-district-selected #county-select-mode-hotkeys,
.app-layout.country-mode.faroe-mode.faroe-region-selected #county-select-mode-hotkeys,
.app-layout.country-mode.japan-mode.japan-detail-selected #county-select-mode-hotkeys,
.app-layout.country-mode.iceland-mode.iceland-election-selected #county-select-mode-hotkeys,
.app-layout.country-mode.sweden-mode.sweden-constituency-selected #county-select-mode-hotkeys,
.app-layout.country-mode.israel-mode.israel-election-selected #county-select-mode-hotkeys { display: block; }
/* Map Type (Geographic Map / Tree Map) is a US-state feature, PLUS every
   international election whose own render function now actually supports
   it (see this app's own Worldwide Tree Map plan, improvements.txt, and
   each renderXCountry/renderXDistricts' own mapType branch in map_app.js).
   Deliberately still narrower than #county-select-mode-toggle's own much
   broader country-mode visibility list just above: only a country listed
   here has a tree-map renderer at all; everywhere else the toggle would
   be visible but inert. Scoped to each country's own national, undrilled
   view (:not(...-selected)) wherever that country ALSO has a deeper
   single-unit detail view with no sub-units of its own to tile -- same
   reasoning as #county-select-mode-toggle's own opposite-direction
   scoping just above (that one shows only ONCE drilled in; this one shows
   only BEFORE that). A single-level country (Peru/Colombia/Portugal/
   Costa Rica/Brazil -- no deeper drill view that changes the map itself,
   just a sidebar update) needs no :not() exclusion at all. */
.app-layout.state-mode #map-type-toggle,
.app-layout.country-mode.peru-mode.peru-race-selected #map-type-toggle,
.app-layout.country-mode.colombia-mode.colombia-race-selected #map-type-toggle,
.app-layout.country-mode.portugal-mode.portugal-race-selected #map-type-toggle,
.app-layout.country-mode.costarica-mode.costarica-race-selected #map-type-toggle,
.app-layout.country-mode.australia-mode.australia-election-selected #map-type-toggle,
.app-layout.country-mode.serbia-mode.serbia-election-selected #map-type-toggle,
.app-layout.country-mode.brazil-mode.brazil-race-selected #map-type-toggle,
.app-layout.country-mode.bulgaria-mode.bulgaria-president:not(.bulgaria-constituency-selected) #map-type-toggle,
/* Japan has two real, parallel ballot granularities (constituencies vs.
   PR blocks, see #japan-map-toggle/japanGranularity) sharing the same
   .japan-election-selected flag -- Tree Map only covers constituencies
   (see renderJapanConstituencyTreeMap), so this also requires the
   .japan-constituencies-granularity class, or the toggle would show
   while inert on the PR-block view too. */
/* Tree Map is not offered on any national parliamentary map; Latvia offers it inside a constituency (one tile per municipality). */
.app-layout.country-mode.latvia-mode.latvia-constituency-selected #map-type-toggle { display: flex; }
/* No live vote count to draw down for Peru (unlike a US race that's still
   being counted -- see renderPeruCountry), so "Votes Left" isn't a
   meaningful shade-by option for it. */
.app-layout.country-mode #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: none;
}
.app-layout.country-mode.australia-mode.australia-election-selected.australia-victoria-selected #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: inline-block;
}
/* Brazil's runoff is counted live by TSE section, so Votes Left (the estimate of votes still to come from sections not yet totalised) is meaningful there. */
.app-layout.country-mode.brazil-mode.brazil-race-selected #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: inline-block;
}
/* Serbia's count comes in by polling station, so Votes Left (the share of stations not yet processed) is meaningful there. */
.app-layout.country-mode.serbia-mode.serbia-election-selected #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: inline-block;
}
/* Bulgaria's presidential count comes in by polling-station protocol, so Votes Left is meaningful there. */
.app-layout.country-mode.bulgaria-mode.bulgaria-president #color-mode-toggle [data-mode="VOTES_LEFT"] { display: inline-block; }
/* Alberta's referendum is still being counted, so Votes Left (voting areas not yet reporting) is meaningful there. */
.app-layout.country-mode.alberta-referendum-selected #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: inline-block;
}
/* Alberta's referendum: Shade by, Map Selection Mode and Map Type, like any other election map with divisions to select and tile. */
.app-layout.country-mode.canada-mode.alberta-referendum-selected .color-mode-toggle,
.app-layout.country-mode.canada-mode.alberta-referendum-selected #county-select-mode-toggle,
.app-layout.country-mode.canada-mode.alberta-referendum-selected #map-type-toggle { display: flex; }
.app-layout.country-mode.canada-mode.alberta-referendum-selected #county-select-mode-hotkeys { display: block; }
/* Margin Maps model a historical/hypothetical scenario (see
   ingestion/compute_margin_scenarios.py), never a live vote count --
   "Votes Left" isn't a meaningful shade-by option here, same reasoning as
   the country-mode rule just above. Only % Margin/Raw stay. */
.app-layout.margin-map-mode #color-mode-toggle [data-mode="VOTES_LEFT"] {
  display: none;
}

/* Margin Maps: no office/race picker, no county-detail panel, no result
   panel — just the Statewide/By Congressional District toggle and the map.
   Reclaims the county-panel's grid column for the map instead of leaving it
   blank. Placed after the .state-mode rules above so it wins the
   (equal-specificity) cascade. */
.app-layout.margin-map-mode {
  grid-template-columns: var(--left-col-width) 1fr;
}
.app-layout.margin-map-mode .county-panel {
  display: none;
}
.app-layout.margin-map-mode #state-office-toggle,
.app-layout.margin-map-mode #county-detail-panel {
  display: none;
}
#margin-map-sidebar { display: none; }
.app-layout.margin-map-mode #margin-map-sidebar { display: block; }

/* Voter Registration Map: no office/race picker or per-county result panel
   (no selectable race here), but — unlike Margin Maps — the right-hand
   county-panel IS used, repurposed to show the state total for whichever
   of the three modes (General/Republican/Democratic) is selected. Keeps
   .state-mode's default 3-column grid and visible county-panel rather
   than overriding them. */
.app-layout.voter-registration-mode #state-office-toggle,
.app-layout.voter-registration-mode #county-detail-panel,
.app-layout.voter-registration-mode .color-mode-toggle {
  display: none;
}
#voter-registration-sidebar { display: none; }
.app-layout.voter-registration-mode #voter-registration-sidebar { display: block; }

.voter-registration-mode-toggle button {
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
  padding: 0.5rem 0.6rem;
}
/* No party voter-registration data sourced for this state at all (either a
   genuine gap or a state that simply doesn't collect it) — not just
   visually muted, actually unclickable via the disabled attribute. */
.voter-registration-mode-toggle button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* Early Voting Map: same shape as the Voter Registration Map above (no office/race picker, mode buttons on the left, the state's early-vote summary on the right). */
.app-layout.early-vote-mode #state-office-toggle,
.app-layout.early-vote-mode #county-detail-panel {
  display: none;
}
#early-vote-sidebar { display: none; }
.early-vote-accounting-title { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0.9rem 0 0.4rem; }
.app-layout.early-vote-mode #early-vote-sidebar { display: block; }

/* Demographic Maps: same "no office/race picker, right-hand panel
   repurposed for the state figure" shape as Voter Registration Map above. */
.app-layout.demographic-map-mode #state-office-toggle,
.app-layout.demographic-map-mode #county-detail-panel,
.app-layout.demographic-map-mode .color-mode-toggle {
  display: none;
}
#demographic-map-sidebar { display: none; }
.app-layout.demographic-map-mode #demographic-map-sidebar { display: block; }

/* Ethnic Maps vs. Socioeconomic Maps: distinct accent colors when active so
   the two categories read as visually separate map types, not just two
   more buttons in the same undifferentiated row every other office-type-
   toggle uses. */
.demographic-category-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.demographic-category-toggle button {
  flex: 1 1 calc(50% - 0.2rem);
  font-size: 0.8rem;
  padding: 0.5rem 0.3rem;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
}
.demographic-category-toggle button[data-category="ethnic"].active {
  background: #6a3d9a;
  color: #fff;
  border-color: #6a3d9a;
}
.demographic-category-toggle button[data-category="socioeconomic"].active {
  background: #117864;
  color: #fff;
  border-color: #117864;
}
.demographic-category-toggle button[data-category="education"].active {
  background: #1f4e8c;
  color: #fff;
  border-color: #1f4e8c;
}
.demographic-category-toggle button[data-category="age"].active {
  background: #b8590a;
  color: #fff;
  border-color: #b8590a;
}
.demographic-subcategory-toggle.hidden { display: none; }
.demographic-subcategory-toggle button {
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
  padding: 0.5rem 0.6rem;
}

.voter-registration-summary .voter-registration-total-number {
  font-size: 1.9rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0.35rem 0 0.15rem;
}
.voter-registration-summary .voter-registration-total-number.rep { color: #b2182b; }
.voter-registration-summary .voter-registration-total-number.dem { color: #2166ac; }
.voter-registration-summary .voter-registration-total-number.other { color: #762a83; }
.voter-registration-summary .voter-registration-coverage { font-size: 0.75rem; color: #888; }
.voter-registration-summary .voter-registration-pct-of-total {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.3rem;
}

/* General mode's statewide D/R/O split (see partyBreakdownSummaryHtml) —
   a single stacked bar rather than three separate poll-bar-style rows,
   since the three segments are parts of one whole (the state's total
   registration) rather than independent quantities. */
.voter-registration-party-breakdown {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e0e0e0;
}
.voter-registration-party-breakdown h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
}
.party-stack-bar {
  display: flex;
  height: 0.9rem;
  border-radius: 4px;
  overflow: hidden;
  background: #eee;
  margin-bottom: 0.6rem;
}
.party-stack-segment { height: 100%; min-width: 2px; }
.party-stack-segment.dem { background: #2166ac; }
.party-stack-segment.rep { background: #b2182b; }
.party-stack-segment.other { background: #762a83; }
.party-stack-legend { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; }
.party-stack-legend-item { display: flex; align-items: center; }

/* A Margin Map scenario (Hypothetical GOP/Dem Win) is a real selected race
   under the hood, so its results deserve the normal results/county-detail
   panels back — restores the 3-column layout and re-shows both panels only
   while scenario-active, reverting to the plain 2-column look above the
   instant no scenario is selected. Placed after .margin-map-mode's rules so
   it wins the cascade when both classes are present. */
.app-layout.margin-map-mode.scenario-active {
  grid-template-columns: var(--left-col-width) 1fr var(--right-col-width);
}
.app-layout.margin-map-mode.scenario-active .county-panel,
.app-layout.margin-map-mode.scenario-active #county-detail-panel {
  display: block;
}
#margin-scenario-toggle.hidden { display: none; }
/* Deliberately amber/neutral, not red or blue — never stylable to look
   like a real party-colored result. */
.modeled-scenario-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #f5b942;
  color: #3a2a00;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
/* The real statewide turnout-needed/independents-needed breakdown behind a
   Margin Map scenario's swing (see marginScenarioStatsHtml) -- a plain
   informational block, not another badge, since this is the substance of
   the model rather than a disclosure label. */
.margin-scenario-stats {
  margin: 0.4rem 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  background: #fdf3e0;
  border: 1px solid #f0d9a8;
  font-size: 0.85rem;
  color: #3a2a00;
}
.margin-scenario-stats div + div { margin-top: 0.2rem; }

/* See app/services/race_calling_service.py / callBasisHtml -- a real,
   arithmetic-only call this app made itself (never a provider's own
   certification, which keeps the plain ".reporting"'s "— FINAL" text
   instead). Deliberately NOT the same amber/uppercase treatment as
   .modeled-scenario-badge, since a math-clinched call is grounded in real
   reported votes -- a distinct, calmer "confident but not yet official"
   tone rather than the modeled-scenario badge's "this isn't real" warning. */
.math-clinched-badge {
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border-left: 3px solid #2a6f7f;
  background: #eaf4f6;
  color: #17414a;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

/* Race-wide "Too Early/Too Close to Call" indicator (see callStateHtml,
   routes_map.py's race_calling_service.call_state) -- same compact pill
   treatment as #race-list li .status (UPCOMING/PAST), the app's existing
   race-status indicator, just placed inline below the results heading
   instead of next to a race-list entry. Too Early reuses .status.UPCOMING's
   neutral gray (no signal yet); Too Close gets its own distinct amber so
   the two read as different situations at a glance, not just different text. */
.call-state-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  margin: 0.3rem 0 0.7rem;
}
/* The shared parliamentary party row (parliamentPartyRowHtml): votes (left) and share (right) on one line, seats (left) and the change since the last election (right) on the next. */
.candidate-row > span.parl-votes { flex: 1 0 100% !important; margin-left: 0 !important; white-space: normal !important; }
.parl-line { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; width: 100%; }
.candidate-row-votes.parl-seats { color: #1a1a2e; flex: 1 1 100%; }
.candidate-row-votes.parl-seats .hint { color: #888; font-weight: normal; }
/* A race nobody can still win outright: not "too close", just certain to go to a runoff -- the same amber family as Too Close, a deeper tone so the two never read as one. */
.nz-electorate-status.called { margin: 0.5rem 0 0.2rem; font-size: 0.8rem; font-weight: 700; color: #1a1a2e; }
.call-state-runoff { background: #fde8c8; color: #8a4b00; border: 1px solid #e0a35a; }
/* "Leads by N votes", at the bottom of the leading candidate's row (leadMarginHtml); full width so it sits under a flex-wrapped row's vote bar. */
.lead-margin {
  flex-basis: 100%;
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #2c3e50;
}
/* A list's seats in a proportional legislature (Serbia): same placement as the lead margin, under the row. */
.seat-line {
  flex-basis: 100%;
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #2c3e50;
}
.seat-line .seat-up { color: #1a7f37; font-size: 0.9rem; }
.seat-line .seat-down { color: #b42318; font-size: 0.9rem; }
.call-state-too-early { background: #a8b4c0; color: #1a2733; }
.call-state-too-close { background: #f5b942; color: #3a2a00; }

.race-selector, .county-panel {
  padding: 1rem;
  overflow-y: auto;
  background: #fafafa;
  border-right: 1px solid #e0e0e0;
  /* Grid items default to min-width:auto, which refuses to shrink below
     their own content's min-content size (padding included) — without
     this, --left-col-width/--right-col-width's 0px would just get
     overridden back up to ~32px by the item's own padding, and the
     sidebar-toggle buttons would never fully collapse either column. */
  min-width: 0;
}
.county-panel { border-right: none; border-left: 1px solid #e0e0e0; }
/* S Pen hover and the other device's pointer; never captures input. */
#remote-pointer {
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 25px;
  z-index: 2147483647;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 25'%3E%3Cpath fill='%23171923' stroke='white' stroke-width='1.5' stroke-linejoin='round' d='M1 1v20l5-5 4 8 4-2-4-8h7Z'/%3E%3C/svg%3E") no-repeat;
  will-change: transform;
}
#remote-pointer[hidden] { display: none; }
.app-layout.sidebar-left-collapsed .race-selector,
.app-layout.sidebar-right-collapsed .county-panel {
  padding: 0;
  overflow: hidden;
  border: none;
}

/* County-level detail — nested inside the left sidebar below the
   map-settings/race-list content, so clicking a county doesn't touch the
   statewide results sitting in the right-hand .county-panel. Just a plain
   wrapper: #county-detail below already supplies its own divider and (via
   :empty) fully collapses — no margin/border/padding left behind — when no
   county is selected, so this shouldn't add a static border of its own on
   top of that or an empty divider line would linger on screen. */

.back-button {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid #1a1a2e;
  background: #fff;
  color: #1a1a2e;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.back-button:hover { background: #1a1a2e; color: #fff; }

/* The Single/Multiselect toggle itself lives in the right-hand county-panel
   (see .county-select-mode-toggle below, next to .color-mode-toggle) — this
   card is just the data it drives: the running multiselect total, shown at
   the top of the left sidebar right under the back button, only while in
   multi mode (toggled via JS, not tied to which office/mode's own
   mode-specific sidebar div is visible, since the selection itself is
   mode-agnostic). */
#multiselect-summary { margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid #e0e0e0; }
#multiselect-summary.hidden { display: none; }
.multiselect-summary-header { display: flex; align-items: center; justify-content: space-between; }
.multiselect-summary-header h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; margin: 0; }
#multiselect-clear-btn {
  padding: 0.2rem 0.5rem; border: 1px solid #ccc; background: #fff; cursor: pointer; border-radius: 4px; font-size: 0.72rem; color: #888;
}
#multiselect-clear-btn:hover { border-color: #b2182b; color: #b2182b; }
#multiselect-totals { font-size: 0.85rem; margin-top: 0.5rem; }
/* A boxed card — same visual language as #county-detail's per-county
   result card — so the combined multiselect totals read as one clean,
   self-contained block rather than a loose run of text. */
.multiselect-results-card {
  margin-top: 0.25rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.multiselect-results-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
}
/* Candidate rows inside the multiselect card reuse the exact same
   .candidate-row/.candidate-photo/.badge treatment the statewide results
   panel uses (see .county-panel .candidate-row et al. below) — same photo,
   party label, and vote-share layout, just fed summed-across-counties
   numbers instead of one race's statewide total. */
.multiselect-results-card .candidate-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}
.multiselect-results-card .candidate-row:last-child { border-bottom: none; }
.multiselect-results-card .candidate-row > span:last-child { white-space: nowrap; margin-left: auto; }
.multiselect-results-card .multiselect-total-number {
  font-size: 1.9rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 0.15rem;
}
.multiselect-results-card .multiselect-total-label { font-size: 0.78rem; color: #888; margin: 0; }
/* The multiselected region's share of the statewide total — only ever
   shown for Voter Registration Map (the one mode with a real, sourced
   statewide denominator readily on hand; see renderMultiselectSummary). */
.multiselect-results-card .multiselect-pct-of-state {
  margin: 0.4rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px dashed #eee;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a2e;
}

/* A county included in the current multiselect set. A single stroke color
   can't stay legible against every fill this app puts under it (a light
   margin tint one moment, a saturated party color the next) — a plain
   amber line all but disappeared against light-yellow/light-orange fills.
   Pairing a dark stroke with a white halo (the same double-drop-shadow
   trick used for high-contrast map labels) guarantees a light edge against
   dark fills and a dark edge against light ones, so it reads clearly no
   matter what choropleth (election results, margin, voter registration) is
   showing underneath. */
.county-path.selected,
.peru-region-path.selected,
.colombia-region-path.selected,
.portugal-region-path.selected,
.costarica-region-path.selected,
.brazil-state-path.selected,
.france-department-path.selected,
.italy-constituency-path.selected,
.poland-constituency-path.selected,
.slovakia-constituency-path.selected,
.andorra-constituency-path.selected,
.switzerland-constituency-path.selected,
.slovenia-constituency-path.selected,
.estonia-constituency-path.selected,
.mongolia-constituency-path.selected,
.legislative-unit-path.selected,
.presidential-unit-path.selected,
.combined-unit-path.selected,
.canada-riding-path.selected,
.elsalvador-department-path.selected,
.hungary-municipality-path.selected,
.latvia-municipality-path.selected,
.bulgaria-municipality-path.selected,
.thailand-constituency-path.selected,
.malta-district-path.selected,
.denmark-district-path.selected,
.denmark-opstillingskreds-path.selected,
.denmark-greenland-kommune-path.selected,
.faroe-region-path.selected,
.japan-constituency-path.selected,
.iceland-constituency-path.selected,
.russia-subject-path.selected,
.sweden-precinct-path.selected,
.nz-electorate-path.selected,
.population-tile.selected .population-tile-fill {
  stroke: #1a1a2e;
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff);
}

.race-selector h2 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }

.office-type-toggle, .election-type-toggle { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.75rem; }
.election-type-toggle.hidden { display: none; }
.office-type-toggle button, .election-type-toggle button {
  flex: 1; padding: 0.4rem; border: 1px solid #ccc; background: #fff; cursor: pointer; border-radius: 4px;
}
.office-type-toggle button.active, .election-type-toggle button.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.office-type-toggle button.hidden { display: none; }

/* The "Other" dropdown (Attorney General / Secretary of State) — state/
   district sidebar only, no national-map equivalent. It sits inside
   #state-office-toggle (a column flex container) and expands in the normal
   document flow, so growing it pushes the sidebar's Senate/House/Governor
   buttons' siblings (#election-sidebar / #house-sidebar) straight down the
   same way any other taller sidebar content would. */
.office-other-menu {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding-left: 0.5rem;
  border-left: 2px solid #ccc;
}
.office-other-menu.open { display: flex; }
.office-other-menu button {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ccc;
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: left;
  white-space: nowrap;
}
.office-other-menu button.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.office-other-menu button.hidden { display: none; }

.color-mode-toggle { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.9rem; padding-bottom: 0.75rem; border-bottom: 1px solid #e0e0e0; }
.color-mode-label { font-size: 0.75rem; color: #888; }
.election-rounds-label { font-size: 0.75rem; color: #888; }
.color-mode-toggle button {
  padding: 0.3rem 0.6rem; border: 1px solid #ccc; background: #fff; cursor: pointer; border-radius: 4px; font-size: 0.8rem;
}
.color-mode-toggle button.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }

/* Explains what every color actually drawn on the map's own MARGIN
   shading means (see updateMarginLegend/countyColor in map_app.js) -- a
   floating widget stacked below the city-points key (see
   .map-legends-stack), not embedded in #race-summary, so it survives
   independently of whatever that panel's own markup happens to be
   showing (a ballot preview, an RCV round table, ...) and can be
   collapsed on its own via #margin-legend-toggle-btn. updateMarginLegend
   toggles the outer panel's own .hidden (nothing real to explain right
   now) independently of .collapsed (the user chose to tuck it away) --
   both can apply at once without conflicting. */
.margin-legend-panel {
  border: 1px solid #1a1a2e;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-size: 0.8rem;
}
.margin-legend-panel.hidden { display: none; }
.margin-legend-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  font-weight: 600;
  color: #1a1a2e;
}
.margin-legend-panel:not(.collapsed) .margin-legend-panel-header {
  border-bottom: 1px solid #1a1a2e;
}
.margin-legend-toggle-btn {
  padding: 0.15rem 0.5rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  color: #333;
}
.margin-legend-toggle-btn:hover { background: #eef1f5; }
.margin-legend-body { padding: 0.5rem 0.65rem; }
.margin-legend-panel.collapsed .margin-legend-body { display: none; }
.margin-legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.1rem 0;
}
.margin-legend-header-row { margin-top: 0.5rem; }
.margin-legend-header-row:first-of-type { margin-top: 0; }
.margin-legend-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Explains every color the whole-US national map's own statusColor can
   currently produce for the selected office type (see
   updateNationalLegend/nationalStatusLabel in map_app.js) -- same floating
   corner .map-legends-stack uses, safe to reuse since the two are never on
   screen at once (that stack is gated on .state-mode; this one shows only
   for the plain national view, toggled directly by JS since there's no
   equivalent standing CSS class for "the national map is showing"). */
/* US Senate national map only (see renderUsSenateBalanceBar in
   map_app.js) -- "seats up for grabs" bar: the real, current pre-2026
   balance of power, three plain segments (each party's own real seats
   NOT up in 2026 on its own outer edge, the real 35 seats actually up
   this cycle as one neutral, undetermined block in the middle -- see
   that function's own comment on why the middle block is never pre-
   colored by party). */
.senate-balance-bar {
  position: absolute;
  left: 50%;
  top: 0.75rem;
  transform: translateX(-50%);
  z-index: 1500;
  width: min(640px, 92vw);
  border: 1px solid #1a1a2e;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0.85rem 0.65rem;
  text-align: center;
}
.senate-balance-bar.hidden { display: none; }
.us-chamber-balance-dock {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 2rem));
  min-height: 4.5rem;
  z-index: 1500;
}
.us-chamber-balance-dock.hidden,
.app-layout.state-mode .us-chamber-balance-dock { display: none; }
.us-chamber-balance-dock > .senate-balance-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 180ms ease, visibility 0s;
}
.us-chamber-balance-dock > .senate-balance-bar.hidden {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}
@media (prefers-reduced-motion: reduce) {
  .us-chamber-balance-dock > .senate-balance-bar,
  .us-chamber-balance-dock > .senate-balance-bar.hidden { transition: none; }
}
/* The state legislative chamber bar belongs to the chamber map only: it follows the layout's own chamber-level flag, so no navigation path can leave it showing over a district or another view. */
.app-layout:not(.sleg-chamber-level) #state-legislature-balance-bar { display: none; }
/* Each party's own real seat total sits directly beside its own real
   bar segment (left of the blue end, right of the red end) rather than
   up in the title row -- the track itself takes whatever width is left
   over (flex: 1) between the two. */
.senate-balance-track-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.senate-balance-track {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0.9rem 0 0.6rem;
}
.senate-balance-segments {
  display: flex;
  width: 100%;
  height: 17px;
  border-radius: 4px;
  overflow: hidden;
}
.senate-balance-segment {
  height: 100%;
  box-sizing: border-box;
  border-right: 1px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}
.senate-balance-segment:last-child { border-right: none; }
.senate-balance-majority-tick {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  line-height: 1;
  color: #888;
}
.senate-balance-majority-tick-top { top: 0; }
.senate-balance-majority-tick-bottom { bottom: 0; }
.senate-balance-total {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.senate-balance-total-rep { flex-direction: row; }
.senate-balance-count {
  font-size: 1.35rem;
  font-weight: 800;
}
.senate-balance-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 3px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.senate-balance-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 3px;
  color: #1a1a2e;
  font-size: 0.8rem;
  font-weight: 700;
}

.national-legend-panel {
  position: absolute;
  right: 0.75rem;
  top: 3.25rem;
  z-index: 1500;
  border: 1px solid #1a1a2e;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-size: 0.8rem;
}
.national-legend-panel.hidden { display: none; }
.national-legend-panel.us-national-legend {
  top: 50%;
  transform: translateY(-50%);
}
.national-legend-panel.us-national-legend .national-legend-row { white-space: normal; }
.national-legend-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  font-weight: 600;
  color: #1a1a2e;
}
.national-legend-panel:not(.collapsed) .national-legend-panel-header { border-bottom: 1px solid #1a1a2e; }
.national-legend-toggle-btn {
  padding: 0.15rem 0.5rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  color: #333;
}
.national-legend-toggle-btn:hover { background: #eef1f5; }
.national-legend-body { padding: 0.5rem 0.65rem; }
.national-legend-panel.collapsed .national-legend-body { display: none; }
.national-legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0;
  white-space: nowrap;
}
.national-legend-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Single/Multiselect — present in every state-level view (election
   results, Margin Maps, Voter Registration Map alike), so it sits in the
   right-hand county-panel right below the shade toggle rather than inside
   any one office's own left-sidebar div. The data it drives (the running
   multiselect total) lives separately, in the left sidebar — see
   #multiselect-summary below. */
.county-select-mode-toggle { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.county-select-mode-label { font-size: 0.75rem; color: #888; }
.county-select-mode-toggle button {
  padding: 0.3rem 0.6rem; border: 1px solid #ccc; background: #fff; cursor: pointer; border-radius: 4px; font-size: 0.8rem;
}
.county-select-mode-toggle button.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }

/* "Subdivision by: County | Municipality" -- offered only on NJ, PA, IL, NY, MI and AR (JS sets .has-subdivisions from /api/subdivisions) and only on a U.S. state map. */
#subdivision-toggle { display: none; flex-wrap: wrap; }
#subdivision-toggle .county-select-mode-label { flex-basis: 100%; }
#subdivision-toggle button { white-space: nowrap; }
.app-layout.state-mode.has-subdivisions #subdivision-toggle { display: flex; }

/* Ballot measure summary: about / what a Yes vote does / what a No vote does (map_app.js measureHeaderHtml). */
.measure-summary { margin: 0.4rem 0 0.8rem; display: flex; flex-direction: column; gap: 0.45rem; }
.measure-summary-part { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.6rem; border-left: 4px solid #9aa0a6; background: rgba(26, 26, 46, 0.04); border-radius: 0 6px 6px 0; font-size: 0.82rem; line-height: 1.35; }
.measure-summary-part.yes { border-left-color: rgb(0, 87, 183); background: rgba(0, 87, 183, 0.07); }
.measure-summary-part.no { border-left-color: rgb(224, 130, 20); background: rgba(224, 130, 20, 0.09); }
.measure-summary-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #555; }
.measure-summary-part.yes .measure-summary-label { color: rgb(0, 87, 183); }
.measure-summary-part.no .measure-summary-label { color: rgb(168, 92, 8); }

/* QR pop-up that pairs a tablet or phone with this display (remote_sync.js showJoinQr). */
#remote-qr-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: rgba(15, 15, 30, 0.6); }
.remote-qr-card { background: #fff; color: #1a1a2e; border-radius: 12px; padding: 1.4rem 1.6rem 1.2rem; width: min(26rem, 92vw); text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.remote-qr-card h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.remote-qr-how { margin: 0 0 0.9rem; font-size: 0.85rem; line-height: 1.35; color: #444; }
.remote-qr-route { margin: 0 0 0.7rem; font-size: 0.85rem; }
.remote-qr-route:not([hidden]) { display: block; }
.remote-qr-route select { font: inherit; color: inherit; background: #fff; border: 1px solid #aaa; border-radius: 4px; padding: 0.25rem; max-width: 100%; }
.remote-qr-card button + button { margin-left: 0.5rem; }
.remote-qr-code svg { width: min(18rem, 70vw); height: auto; display: block; margin: 0 auto; }
.remote-qr-link { margin: 0.7rem 0 0.2rem; font-size: 0.72rem; color: #666; overflow-wrap: anywhere; user-select: all; }
.remote-qr-status { margin: 0.3rem 0 0.9rem; font-size: 0.85rem; font-weight: 600; }
.remote-qr-status.connected { color: #1b7f3b; }
.remote-qr-close { padding: 0.4rem 1.4rem; border: 1px solid #1a1a2e; background: #1a1a2e; color: #fff; border-radius: 6px; cursor: pointer; font: inherit; }

/* Small grey hotkey legend under the mode toggle — only meaningful in
   Multiselect (F/R are no-ops in Single, see the keydown listener in
   map_app.js), but shown regardless of which mode is active since it's
   also how someone discovers the hotkeys exist in the first place. */
.county-select-mode-hotkeys {
  margin: 0 0 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.72rem;
  color: #999;
}
.county-select-mode-hotkeys kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f5f5f5;
  font-family: inherit;
  font-size: 0.68rem;
  color: #555;
}

#race-list, #district-list, #alberta-question-list, #margin-scenario-toggle { list-style: none; margin: 0; padding: 0; }
#race-list li, #district-list li, #alberta-question-list li, #margin-scenario-toggle li {
  padding: 0.5rem; margin-bottom: 0.4rem; border: 1px solid #ddd; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem; background: #fff;
}
#race-list li.selected, #district-list li.selected, #alberta-question-list li.selected, #margin-scenario-toggle li.selected { border-color: #1a1a2e; background: #f0f0f5; }
/* Same pill treatment as .badge/.badge-winner (bold, letter-spaced,
   compact) — colors stay their own (UPCOMING gray, PAST reuses the
   badge-winner green) rather than the .badge class itself, since this
   isn't a candidate badge and sits at a slightly larger size in the race list. */
#race-list li .status, #district-list li .status, #alberta-question-list li .status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.3rem;
  vertical-align: middle;
}
#race-list li .race-date, #district-list li .race-date, #alberta-question-list li .race-date { display: block; margin-top: 0.25rem; font-size: 0.7rem; color: #888; }
#race-list li.empty-hint, #district-list li.empty-hint { cursor: default; color: #888; background: transparent; border-style: dashed; }
/* Just two colors: races that have already happened (poll closed — live
   count or already called) vs. races still to come. PAST intentionally
   reuses .badge-winner's exact green/text combo so both read as the same
   "decided/done" visual language across the app. */
.status.UPCOMING { background: #FF8C00; color: #1a2733; }
.status.PAST { background: #06d6a0; color: #06402b; }
.status.COUNTING { background: #ffd166; color: #3d2f00; }
.runoff-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  margin-left: 0.3rem;
  border-radius: 3px;
  background: #6b3fa0;
  color: #fff;
  vertical-align: middle;
}
.key-race-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  margin-left: 0.3rem;
  border-radius: 3px;
  background: #ffd166;
  color: #663c00;
  vertical-align: middle;
}

.county-panel .hint, .race-selector .hint { color: #888; font-size: 0.85rem; }
/* #county-detail (the per-county click results) sits inside .race-selector,
   not .county-panel — same cross-scope situation the rules above/below
   handle by duplicating selectors rather than relying on being reached
   automatically. */
.county-panel h3, .county-panel h4,
#county-detail h3, #county-detail h4,
#peru-department-detail h3, #algeria-wilaya-detail h3, #andorra-constituency-detail h3, #antigua-constituency-detail h3, #australia-region-detail h3, #barbados-constituency-detail h3, #brazil-state-detail h3, #bulgaria-constituency-detail h3, #canada-riding-detail h3, #denmark-district-detail h3, #nz-electorate-detail h3, #elsalvador-department-detail h3, #estonia-constituency-detail h3, #faroe-region-detail h3, #france-region-detail h3, #hungary-constituency-detail h3, #iceland-constituency-detail h3, #israel-region-detail h3, #italy-constituency-detail h3, #japan-constituency-detail h3, #kazakhstan-region-detail h3, #latvia-constituency-detail h3, #malta-district-detail h3, #mongolia-constituency-detail h3, #morocco-region-detail h3, #nepal-constituency-detail h3, #poland-constituency-detail h3, #russia-region-detail h3, #scotland-constituency-detail h3, #senedd-constituency-detail h3, #serbia-region-detail h3, #slovakia-constituency-detail h3, #slovenia-constituency-detail h3, #spain-province-detail h3, #sweden-valkrets-detail h3, #switzerland-constituency-detail h3, #thailand-constituency-detail h3, #peru-department-detail h4, #algeria-wilaya-detail h4, #andorra-constituency-detail h4, #antigua-constituency-detail h4, #australia-region-detail h4, #barbados-constituency-detail h4, #brazil-state-detail h4, #bulgaria-constituency-detail h4, #canada-riding-detail h4, #denmark-district-detail h4, #nz-electorate-detail h4, #elsalvador-department-detail h4, #estonia-constituency-detail h4, #faroe-region-detail h4, #france-region-detail h4, #hungary-constituency-detail h4, #iceland-constituency-detail h4, #israel-region-detail h4, #italy-constituency-detail h4, #japan-constituency-detail h4, #kazakhstan-region-detail h4, #latvia-constituency-detail h4, #malta-district-detail h4, #mongolia-constituency-detail h4, #morocco-region-detail h4, #nepal-constituency-detail h4, #poland-constituency-detail h4, #russia-region-detail h4, #scotland-constituency-detail h4, #senedd-constituency-detail h4, #serbia-region-detail h4, #slovakia-constituency-detail h4, #slovenia-constituency-detail h4, #spain-province-detail h4, #sweden-valkrets-detail h4, #switzerland-constituency-detail h4, #thailand-constituency-detail h4, #colombia-department-detail h3, #colombia-department-detail h4,
#portugal-department-detail h3, #portugal-department-detail h4,
#costarica-department-detail h3, #costarica-department-detail h4,
#uk-constituency-detail h3, #uk-constituency-detail h4,
#germany-constituency-detail h3, #germany-constituency-detail h4 { margin-top: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }
/* Wraps just the "Polling Average" heading (see renderPollingSummary) so
   its own "View more" link sits inline at the same baseline instead of on
   its own line — the h3 above still supplies the actual heading look. */
.polling-summary-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.polling-summary-header h3 { margin: 0; }
.polling-view-more-link, .view-on-map-link {
  font-size: 0.75rem;
  color: #2166ac;
  text-decoration: none;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
}
.polling-view-more-link:hover, .view-on-map-link:hover { text-decoration: underline; }
.county-panel h4.round-label { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px dashed #ddd; color: #888; }
.county-panel h4.round-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* One label per real single-mandate constituency inside a drilled-into
   Russian region (see russiaConstituencyListHtml in map_app.js) -- same
   "dashed rule above, muted color" convention as .round-label above,
   since a region can carry 1-16 of these stacked in one scrollable
   list (Moscow alone has 16). */
#russia-candidate-list h4.russia-constituency-heading { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px dashed #ddd; color: #444; font-size: 0.85rem; }
#russia-candidate-list h4.russia-constituency-heading:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* Same "flat, real per-locality section headings inside one long
   scrollable list" convention as russia-constituency-heading above,
   for New Zealand's own 71 real electorates (see nzElectorateListHtml
   in map_app.js). */
#nz-electorate-detail h4.nz-electorate-heading { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px dashed #ddd; color: #444; font-size: 0.85rem; }
#nz-electorate-detail h4.nz-electorate-heading:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* One full-sentence real referendum ballot question per row (see
   showAlbertaReferendumDetail in map_app.js) -- unlike .candidate-row's
   own two-column name/vote-share layout, a referendum question is a
   single long sentence with nothing to right-align against it. */
.candidate-row-full { padding: 0.5rem 0; border-bottom: 1px solid #eee; font-size: 0.85rem; line-height: 1.4; }
.candidate-row-full:last-child { border-bottom: none; }
.county-panel .candidate-row,
#county-detail .candidate-row,
.peru-candidate-list .candidate-row,
#peru-department-detail .candidate-row, #algeria-wilaya-detail .candidate-row, #andorra-constituency-detail .candidate-row, #antigua-constituency-detail .candidate-row, #australia-region-detail .candidate-row, #barbados-constituency-detail .candidate-row, #brazil-state-detail .candidate-row, #bulgaria-constituency-detail .candidate-row, #canada-riding-detail .candidate-row, #denmark-district-detail .candidate-row, #nz-electorate-detail .candidate-row, #elsalvador-department-detail .candidate-row, #estonia-constituency-detail .candidate-row, #faroe-region-detail .candidate-row, #france-region-detail .candidate-row, #hungary-constituency-detail .candidate-row, #iceland-constituency-detail .candidate-row, #israel-region-detail .candidate-row, #italy-constituency-detail .candidate-row, #japan-constituency-detail .candidate-row, #kazakhstan-region-detail .candidate-row, #latvia-constituency-detail .candidate-row, #malta-district-detail .candidate-row, #mongolia-constituency-detail .candidate-row, #morocco-region-detail .candidate-row, #nepal-constituency-detail .candidate-row, #poland-constituency-detail .candidate-row, #russia-region-detail .candidate-row, #scotland-constituency-detail .candidate-row, #senedd-constituency-detail .candidate-row, #serbia-region-detail .candidate-row, #slovakia-constituency-detail .candidate-row, #slovenia-constituency-detail .candidate-row, #spain-province-detail .candidate-row, #sweden-valkrets-detail .candidate-row, #switzerland-constituency-detail .candidate-row, #thailand-constituency-detail .candidate-row, #colombia-department-detail .candidate-row,
#portugal-department-detail .candidate-row,
#costarica-department-detail .candidate-row,
#germany-constituency-detail .candidate-row,
#canada-riding-detail .candidate-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}
/* "Nationwide Results" -- the real candidate list for whichever round
   #peru-round-toggle has selected (see renderPeruCandidateList in
   map_app.js), same <h3> heading (.county-panel h3 above already styles
   it) + candidate-row treatment, and past 3 rows the same
   .candidate-list-scroll behavior, as the US map's own Statewide Results
   panel -- and the same right-sidebar spot, next to #color-mode-toggle. */
.peru-candidate-list { margin: 0.75rem 0 0; }
/* The vote-share/status value (e.g. "This race is uncontested") never
   breaks mid-phrase — it either sits on the same line with a minimum gap
   from the candidate name, or wraps down to its own full line. */
.county-panel .candidate-row > span:last-child,
#county-detail .candidate-row > span:last-child,
.peru-candidate-list .candidate-row > span:last-child,
#peru-department-detail .candidate-row > span:last-child, #algeria-wilaya-detail .candidate-row > span:last-child, #andorra-constituency-detail .candidate-row > span:last-child, #antigua-constituency-detail .candidate-row > span:last-child, #australia-region-detail .candidate-row > span:last-child, #barbados-constituency-detail .candidate-row > span:last-child, #brazil-state-detail .candidate-row > span:last-child, #bulgaria-constituency-detail .candidate-row > span:last-child, #canada-riding-detail .candidate-row > span:last-child, #denmark-district-detail .candidate-row > span:last-child, #nz-electorate-detail .candidate-row > span:last-child, #elsalvador-department-detail .candidate-row > span:last-child, #estonia-constituency-detail .candidate-row > span:last-child, #faroe-region-detail .candidate-row > span:last-child, #france-region-detail .candidate-row > span:last-child, #hungary-constituency-detail .candidate-row > span:last-child, #iceland-constituency-detail .candidate-row > span:last-child, #israel-region-detail .candidate-row > span:last-child, #italy-constituency-detail .candidate-row > span:last-child, #japan-constituency-detail .candidate-row > span:last-child, #kazakhstan-region-detail .candidate-row > span:last-child, #latvia-constituency-detail .candidate-row > span:last-child, #malta-district-detail .candidate-row > span:last-child, #mongolia-constituency-detail .candidate-row > span:last-child, #morocco-region-detail .candidate-row > span:last-child, #nepal-constituency-detail .candidate-row > span:last-child, #poland-constituency-detail .candidate-row > span:last-child, #russia-region-detail .candidate-row > span:last-child, #scotland-constituency-detail .candidate-row > span:last-child, #senedd-constituency-detail .candidate-row > span:last-child, #serbia-region-detail .candidate-row > span:last-child, #slovakia-constituency-detail .candidate-row > span:last-child, #slovenia-constituency-detail .candidate-row > span:last-child, #spain-province-detail .candidate-row > span:last-child, #sweden-valkrets-detail .candidate-row > span:last-child, #switzerland-constituency-detail .candidate-row > span:last-child, #thailand-constituency-detail .candidate-row > span:last-child, #colombia-department-detail .candidate-row > span:last-child,
#portugal-department-detail .candidate-row > span:last-child,
#costarica-department-detail .candidate-row > span:last-child,
#germany-constituency-detail .candidate-row > span:last-child,
#canada-riding-detail .candidate-row > span:last-child { white-space: nowrap; margin-left: auto; }
/* A real party row with its own real published MMP list (see
   nzPartyRowHtml/showNzPartyListPopup) -- cursor + a subtle hover tint
   are the only real signal this row opens a popup, rather than a
   heavier button-like border/shadow. */
.nz-party-row-clickable { cursor: pointer; }
.nz-party-row-clickable:hover { background: rgba(26, 26, 46, 0.04); }
#serbia-region-detail .reporting, #australia-region-detail .reporting { font-size: 0.75rem; color: #888; margin-top: 0.3rem; }
/* Israel's and New Zealand's national party lists share one row layout: party
   on the left, seats or vote share on the right, a one-line note, and a bar
   showing that party's share (see countryPartyRowHtml in map_app.js). */
#israel-candidate-list .candidate-row,
#australia-candidate-list .candidate-row,
#australia-region-detail .candidate-row,
#spain-candidate-list .candidate-row,
#serbia-candidate-list .candidate-row,
#serbia-region-detail .candidate-row,
#bulgaria-constituency-detail .candidate-row,
#france-candidate-list .candidate-row,
#slovenia-candidate-list .candidate-row,
#mongolia-candidate-list .candidate-row,
#legislative-candidate-list .candidate-row,
#presidential-candidate-list .candidate-row,
#combined-candidate-list .candidate-row,
#italy-candidate-list .candidate-row,
#elsalvador-candidate-list .candidate-row,
.nz-result-roster .candidate-row,
#nz-party-vote-summary .candidate-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}
#israel-candidate-list .candidate-row > span:last-of-type,
#spain-candidate-list .candidate-row > span:last-of-type,
#australia-candidate-list .candidate-row > span:last-of-type,
#australia-region-detail .candidate-row > span:last-of-type,
#serbia-candidate-list .candidate-row > span:last-of-type,
#serbia-region-detail .candidate-row > span:last-of-type,
#bulgaria-constituency-detail .candidate-row > span:last-of-type,
#france-candidate-list .candidate-row > span:last-of-type,
#slovenia-candidate-list .candidate-row > span:last-of-type,
#mongolia-candidate-list .candidate-row > span:last-of-type,
#legislative-candidate-list .candidate-row > span:last-of-type,
#presidential-candidate-list .candidate-row > span:last-of-type,
#combined-candidate-list .candidate-row > span:last-of-type,
#italy-candidate-list .candidate-row > span:last-of-type,
#elsalvador-candidate-list .candidate-row > span:last-of-type,
.nz-result-roster .candidate-row > span:last-of-type,
#nz-party-vote-summary .candidate-row > span:last-of-type { white-space: nowrap; margin-left: auto; }
#israel-candidate-list .candidate-row.winner,
#brazil-candidate-list .candidate-row.winner,
#australia-candidate-list .candidate-row.winner,
#australia-region-detail .candidate-row.winner,
#serbia-candidate-list .candidate-row.winner,
#serbia-region-detail .candidate-row.winner {
  background: var(--winner-bg, rgba(6, 214, 160, 0.12));
  border-bottom-color: var(--winner-border, rgba(6, 214, 160, 0.4));
  font-weight: 600;
}
/* The winner highlight is that candidate's own map color (see
   candidateRowStyleAttr in map_app.js, which sets --winner-bg/--winner-border
   inline per row) rather than one fixed color for every winner — the
   rgba(6, 214, 160, ...) green here only fires as a fallback for a winner
   row that somehow didn't get the inline style set. */
.county-panel .candidate-row.winner,
#county-detail .candidate-row.winner,
#algeria-wilaya-detail .candidate-row.winner,
#andorra-constituency-detail .candidate-row.winner,
#antigua-constituency-detail .candidate-row.winner,
#australia-region-detail .candidate-row.winner,
#barbados-constituency-detail .candidate-row.winner,
#brazil-state-detail .candidate-row.winner,
#bulgaria-constituency-detail .candidate-row.winner,
#canada-riding-detail .candidate-row.winner,
#denmark-district-detail .candidate-row.winner, #nz-electorate-detail .candidate-row.winner,
#elsalvador-department-detail .candidate-row.winner,
#estonia-constituency-detail .candidate-row.winner,
#faroe-region-detail .candidate-row.winner,
#france-region-detail .candidate-row.winner,
#hungary-constituency-detail .candidate-row.winner,
#iceland-constituency-detail .candidate-row.winner,
#israel-region-detail .candidate-row.winner,
#italy-constituency-detail .candidate-row.winner,
#japan-constituency-detail .candidate-row.winner,
#kazakhstan-region-detail .candidate-row.winner,
#latvia-constituency-detail .candidate-row.winner,
#malta-district-detail .candidate-row.winner,
#mongolia-constituency-detail .candidate-row.winner,
#morocco-region-detail .candidate-row.winner,
#nepal-constituency-detail .candidate-row.winner,
#poland-constituency-detail .candidate-row.winner,
#russia-region-detail .candidate-row.winner,
#scotland-constituency-detail .candidate-row.winner,
#senedd-constituency-detail .candidate-row.winner,
#serbia-region-detail .candidate-row.winner,
#slovakia-constituency-detail .candidate-row.winner,
#slovenia-constituency-detail .candidate-row.winner,
#spain-province-detail .candidate-row.winner,
#sweden-valkrets-detail .candidate-row.winner,
#switzerland-constituency-detail .candidate-row.winner,
#thailand-constituency-detail .candidate-row.winner,
#germany-constituency-detail .candidate-row.winner {
  background: var(--winner-bg, rgba(6, 214, 160, 0.12));
  border-bottom-color: var(--winner-border, rgba(6, 214, 160, 0.4));
  font-weight: 600;
}
.county-panel .candidate-row.advanced,
#county-detail .candidate-row.advanced { background: rgba(255, 209, 102, 0.15); border-bottom-color: rgba(255, 209, 102, 0.5); }
/* A US candidate row's votes/percentage line (see formatVoteLine's output,
   wrapped by candidateRowsHtml/renderMultiselectSummary in map_app.js) --
   flex-basis:100% forces it onto its own line below the name span above
   it, same trick .candidate-row-bar below already uses (.candidate-row is
   already display:flex; flex-wrap:wrap, so a full-width item always
   starts a new line regardless of how much space the line above leaves).
   Sits between the name and the bar in DOM order, so that's also its
   visual position: name, then votes/pct, then the bar it describes. */
.candidate-row-votes { flex: 1 1 100%; margin-top: 0.15rem; color: #333; }
.nz-result-roster .candidate-row-votes { color: #aaa; }
.nz-result-roster .lead-margin { color: inherit; }
/* Real, proportional vote-share bar under a US candidate row (see
   candidateVoteBarHtml in map_app.js) -- same full-width-line trick as
   .candidate-row-votes above, placed after it in DOM order so the bar
   renders as the third line. US map only, by construction -- only
   candidateRowsHtml/renderMultiselectSummary ever emit this markup, no
   other country's own candidate-row renderer does. */
.candidate-row-bar { flex: 1 1 100%; margin-top: 0.3rem; }
.candidate-row-bar-track { height: 0.35rem; background: #eee; border-radius: 2px; overflow: hidden; }
.candidate-row-bar-fill { height: 100%; min-width: 2px; }
/* A leader-led national-summary row (see swedenPartyNationalRowHtml,
   antiguaPartyRowHtml, kazakhstanPartyRowHtml) shows that leader's own
   real party name directly under their name, inside the same
   .candidate-row box -- same full-width-child trick as
   .candidate-row-votes above, forcing it onto its own line right below
   the name/badge/votes line instead of sitting between two rows with
   no clear border to say which one it belongs to. Shared across every
   country that leads with the leader's own name rather than the
   party's (not scoped to just one country's own class/ID). */
.candidate-row-subtitle { flex: 1 1 100%; margin-top: -0.1rem; }
/* Wraps a candidate list once it's more than 3 deep (see candidateRowsHtml/
   renderMultiselectSummary in map_app.js) so a crowded-field race (a
   16-candidate blanket primary, say) scrolls within its own region instead
   of stretching the whole results panel — the rest of the sidebar
   (polling, fundraising) stays reachable without first scrolling past a
   long roster. max-height here is just a same-paint-frame fallback (in
   case JS hasn't run yet) — sizeCandidateListScroll (map_app.js) measures
   the real rendered height of the first 3 rows, right after this element
   lands in the DOM, and sets max-height inline to fit exactly that. A
   fixed guess couldn't stay accurate once a candidate's full,
   never-truncated name (see CLAUDE.md/candidateRowsHtml — names are always
   shown in full) wraps to a second line, growing that one row taller than
   any other. */
.candidate-list-scroll {
  max-height: 12.5rem;
  overflow-y: auto;
  border-bottom: 1px solid #eee;
}
.candidate-list-scroll .candidate-row:last-child { border-bottom: none; }
.rcv-round + .rcv-round { margin-top: 0.5rem; }
.rcv-eliminated { font-size: 0.75rem; color: #b2182b; margin: 0.3rem 0 0.5rem; font-style: italic; }
.rcv-rounds-skipped {
  font-size: 0.72rem;
  color: #888;
  font-style: italic;
  text-align: center;
  margin: 0.4rem 0;
  padding: 0.2rem 0;
  border-top: 1px dashed #ddd;
  border-bottom: 1px dashed #ddd;
}
.badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.05rem 0.3rem;
  margin-left: 0.3rem;
  border-radius: 3px;
  vertical-align: middle;
}
.badge-incumbent { background: #e0e0e0; color: #444; }
/* New Zealand's own real per-candidate MMP list rank (see
   nzCandidateRowHtml) -- distinct from .badge-incumbent's neutral grey so
   the two real, independent facts (this candidate is the sitting MP /
   this candidate also has a real position on their own party's list)
   never read as the same kind of badge. */
.badge-list { background: #d6e4ff; color: #1a3a6b; }
/* Fallback only -- candidateBadges (map_app.js) sets background/color
   inline per badge to that candidate's own map color, which (being on the
   element itself) always overrides this class. */
.badge-winner { background: #06d6a0; color: #06402b; }
/* A flipped seat: a "+ FLIP" pill beside the WINNER pill, in the deeper shade of the winner's colour (set inline). */
.badge-flip, .badge-hold, .badge-eliminated { margin-left: 0.25rem; letter-spacing: 0.04em; }
.badge-eliminated { background: #8a8a8a; color: #fff; }
.badge-hold { background: #4a4a4a; color: #fff; }
.badge-advanced { background: #ffd166; color: #663c00; }
.color-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
/* Sourced candidate portrait (Wikipedia/Wikimedia Commons) — absent for
   most candidates, since these are only ever added from a real found
   photo, never a generic placeholder silhouette (see Candidate.photo_url). */
.candidate-photo {
  display: inline-block;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  object-fit: cover;
  /* Overridden inline per photo to that candidate's own map color (see
     candidatePhotoStyleAttr/partyColorPhotoHtml in map_app.js) -- shows
     through around/behind the person for a photo with its own background
     actually removed (transparent PNG); stays invisible behind a plain
     opaque photo, deliberately, rather than a ring/frame around it --
     #fff only fires as a fallback if that inline style is ever missing.
     No border ring on top of it either -- that real party color is already the
     visual distinction every candidate/leader photo needs. */
  background: #fff;
}
/* A referendum/ballot-measure "Yes"/"No" option's own big checkmark/X
   (see referendumIconHtml in map_app.js) -- same size/shape/position as
   a real .candidate-photo (there's no real person to photograph for a
   referendum side), just a <span><svg> instead of an <img>, so it drops
   into every existing candidate-row/tooltip-candidate layout unchanged.
   Its own background color (set inline, real blue for Yes/orange for
   No -- see PARTY_COLORS.YES/NO) is the checkmark/X's actual color, not
   a backdrop behind a transparent photo, so object-fit/#fff fallback
   from the shared .candidate-photo rule don't apply here. */
.candidate-photo.referendum-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Hungary "National Results" seat-change indicators (renderHungaryNationalSummary) --
   green up-arrow for a seat gain, red down-arrow for a loss, in place of a
   plain +/- sign. */
.seat-change.up { color: #1a8a3b; font-weight: 600; }
.seat-change.down { color: #c0392b; font-weight: 600; }
.seat-change.new,
.seat-change.flat { color: #888; }
.nz-live-reporting .reporting-bar,
.county-panel .reporting-bar,
#county-detail .reporting-bar,
#peru-department-detail .reporting-bar, #algeria-wilaya-detail .reporting-bar, #andorra-constituency-detail .reporting-bar, #antigua-constituency-detail .reporting-bar, #australia-region-detail .reporting-bar, #barbados-constituency-detail .reporting-bar, #brazil-state-detail .reporting-bar, #bulgaria-constituency-detail .reporting-bar, #canada-riding-detail .reporting-bar, #denmark-district-detail .reporting-bar, #nz-electorate-detail .reporting-bar, #elsalvador-department-detail .reporting-bar, #estonia-constituency-detail .reporting-bar, #faroe-region-detail .reporting-bar, #france-region-detail .reporting-bar, #hungary-constituency-detail .reporting-bar, #iceland-constituency-detail .reporting-bar, #israel-region-detail .reporting-bar, #italy-constituency-detail .reporting-bar, #japan-constituency-detail .reporting-bar, #kazakhstan-region-detail .reporting-bar, #latvia-constituency-detail .reporting-bar, #malta-district-detail .reporting-bar, #mongolia-constituency-detail .reporting-bar, #morocco-region-detail .reporting-bar, #nepal-constituency-detail .reporting-bar, #poland-constituency-detail .reporting-bar, #russia-region-detail .reporting-bar, #scotland-constituency-detail .reporting-bar, #senedd-constituency-detail .reporting-bar, #serbia-region-detail .reporting-bar, #slovakia-constituency-detail .reporting-bar, #slovenia-constituency-detail .reporting-bar, #spain-province-detail .reporting-bar, #sweden-valkrets-detail .reporting-bar, #switzerland-constituency-detail .reporting-bar, #thailand-constituency-detail .reporting-bar, #colombia-department-detail .reporting-bar,
#portugal-department-detail .reporting-bar,
#costarica-department-detail .reporting-bar,
#peru-candidate-list .reporting-bar,
#colombia-candidate-list .reporting-bar,
#portugal-candidate-list .reporting-bar,
#costarica-candidate-list .reporting-bar,
#uk-candidate-list .reporting-bar,
#hungary-candidate-list .reporting-bar,
#germany-candidate-list .reporting-bar,
#brazil-candidate-list .reporting-bar {
  height: 5px;
  background: #e5e5e5;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.6rem;
}
.nz-live-reporting .reporting-bar-fill,
.county-panel .reporting-bar-fill,
#county-detail .reporting-bar-fill,
#peru-department-detail .reporting-bar-fill, #algeria-wilaya-detail .reporting-bar-fill, #andorra-constituency-detail .reporting-bar-fill, #antigua-constituency-detail .reporting-bar-fill, #australia-region-detail .reporting-bar-fill, #barbados-constituency-detail .reporting-bar-fill, #brazil-state-detail .reporting-bar-fill, #bulgaria-constituency-detail .reporting-bar-fill, #canada-riding-detail .reporting-bar-fill, #denmark-district-detail .reporting-bar-fill, #nz-electorate-detail .reporting-bar-fill, #elsalvador-department-detail .reporting-bar-fill, #estonia-constituency-detail .reporting-bar-fill, #faroe-region-detail .reporting-bar-fill, #france-region-detail .reporting-bar-fill, #hungary-constituency-detail .reporting-bar-fill, #iceland-constituency-detail .reporting-bar-fill, #israel-region-detail .reporting-bar-fill, #italy-constituency-detail .reporting-bar-fill, #japan-constituency-detail .reporting-bar-fill, #kazakhstan-region-detail .reporting-bar-fill, #latvia-constituency-detail .reporting-bar-fill, #malta-district-detail .reporting-bar-fill, #mongolia-constituency-detail .reporting-bar-fill, #morocco-region-detail .reporting-bar-fill, #nepal-constituency-detail .reporting-bar-fill, #poland-constituency-detail .reporting-bar-fill, #russia-region-detail .reporting-bar-fill, #scotland-constituency-detail .reporting-bar-fill, #senedd-constituency-detail .reporting-bar-fill, #serbia-region-detail .reporting-bar-fill, #slovakia-constituency-detail .reporting-bar-fill, #slovenia-constituency-detail .reporting-bar-fill, #spain-province-detail .reporting-bar-fill, #sweden-valkrets-detail .reporting-bar-fill, #switzerland-constituency-detail .reporting-bar-fill, #thailand-constituency-detail .reporting-bar-fill, #colombia-department-detail .reporting-bar-fill,
#portugal-department-detail .reporting-bar-fill,
#costarica-department-detail .reporting-bar-fill,
#peru-candidate-list .reporting-bar-fill,
#colombia-candidate-list .reporting-bar-fill,
#portugal-candidate-list .reporting-bar-fill,
#costarica-candidate-list .reporting-bar-fill,
#uk-candidate-list .reporting-bar-fill,
#hungary-candidate-list .reporting-bar-fill,
#germany-candidate-list .reporting-bar-fill,
#brazil-candidate-list .reporting-bar-fill {
  height: 100%;
  background: #06d6a0;
  transition: width 0.3s ease;
}
.nz-live-reporting .reporting,
.county-panel .reporting,
#county-detail .reporting,
#peru-department-detail .reporting, #algeria-wilaya-detail .reporting, #andorra-constituency-detail .reporting, #antigua-constituency-detail .reporting, #australia-region-detail .reporting, #barbados-constituency-detail .reporting, #brazil-state-detail .reporting, #bulgaria-constituency-detail .reporting, #canada-riding-detail .reporting, #denmark-district-detail .reporting, #nz-electorate-detail .reporting, #elsalvador-department-detail .reporting, #estonia-constituency-detail .reporting, #faroe-region-detail .reporting, #france-region-detail .reporting, #hungary-constituency-detail .reporting, #iceland-constituency-detail .reporting, #israel-region-detail .reporting, #italy-constituency-detail .reporting, #japan-constituency-detail .reporting, #kazakhstan-region-detail .reporting, #latvia-constituency-detail .reporting, #malta-district-detail .reporting, #mongolia-constituency-detail .reporting, #morocco-region-detail .reporting, #nepal-constituency-detail .reporting, #poland-constituency-detail .reporting, #russia-region-detail .reporting, #scotland-constituency-detail .reporting, #senedd-constituency-detail .reporting, #serbia-region-detail .reporting, #slovakia-constituency-detail .reporting, #slovenia-constituency-detail .reporting, #spain-province-detail .reporting, #sweden-valkrets-detail .reporting, #switzerland-constituency-detail .reporting, #thailand-constituency-detail .reporting, #colombia-department-detail .reporting,
#portugal-department-detail .reporting,
#costarica-department-detail .reporting,
#peru-candidate-list .reporting,
#colombia-candidate-list .reporting,
#portugal-candidate-list .reporting,
#costarica-candidate-list .reporting,
#uk-candidate-list .reporting,
#hungary-candidate-list .reporting,
#germany-candidate-list .reporting,
#brazil-candidate-list .reporting { font-size: 0.75rem; color: #888; margin-top: 0.3rem; }
.county-panel .expected-votes-left { font-size: 0.75rem; color: #888; font-style: italic; margin-top: 0.15rem; }
/* The primary (not supplementary) content of the county-detail panel while
   "Votes Left" shading is active -- see showCountyDetail's VOTES_LEFT
   branch, which suppresses the normal results display entirely in favor of
   just this figure, so it reads as the main answer, not a footnote. */
#county-detail .votes-left-detail {
  font-size: 1.1rem;
  font-weight: 600;
  color: #b8860b;
  margin-top: 0.4rem;
}
/* A distinct card, matching #race-list li's rounded-card treatment, so the
   selected county's results read as one clearly separate block from the
   race list above rather than just more items in the same list. */
#county-detail,
#peru-department-detail, #algeria-wilaya-detail, #andorra-constituency-detail, #antigua-constituency-detail, #australia-region-detail, #barbados-constituency-detail, #brazil-state-detail, #bulgaria-constituency-detail, #canada-riding-detail, #denmark-district-detail, #nz-electorate-detail, #elsalvador-department-detail, #estonia-constituency-detail, #faroe-region-detail, #france-region-detail, #hungary-constituency-detail, #iceland-constituency-detail, #israel-region-detail, #italy-constituency-detail, #japan-constituency-detail, #kazakhstan-region-detail, #latvia-constituency-detail, #malta-district-detail, #mongolia-constituency-detail, #morocco-region-detail, #nepal-constituency-detail, #poland-constituency-detail, #russia-region-detail, #scotland-constituency-detail, #senedd-constituency-detail, #serbia-region-detail, #slovakia-constituency-detail, #slovenia-constituency-detail, #spain-province-detail, #sweden-valkrets-detail, #switzerland-constituency-detail, #thailand-constituency-detail, #colombia-department-detail,
#portugal-department-detail,
#costarica-department-detail,
#uk-constituency-detail,
#germany-constituency-detail {
  margin-top: 1rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}
#county-detail:empty, #peru-department-detail:empty, #algeria-wilaya-detail:empty, #andorra-constituency-detail:empty, #antigua-constituency-detail:empty, #australia-region-detail:empty, #barbados-constituency-detail:empty, #brazil-state-detail:empty, #bulgaria-constituency-detail:empty, #canada-riding-detail:empty, #denmark-district-detail:empty, #nz-electorate-detail:empty, #elsalvador-department-detail:empty, #estonia-constituency-detail:empty, #faroe-region-detail:empty, #france-region-detail:empty, #hungary-constituency-detail:empty, #iceland-constituency-detail:empty, #israel-region-detail:empty, #italy-constituency-detail:empty, #japan-constituency-detail:empty, #kazakhstan-region-detail:empty, #latvia-constituency-detail:empty, #malta-district-detail:empty, #mongolia-constituency-detail:empty, #morocco-region-detail:empty, #nepal-constituency-detail:empty, #poland-constituency-detail:empty, #russia-region-detail:empty, #scotland-constituency-detail:empty, #senedd-constituency-detail:empty, #serbia-region-detail:empty, #slovakia-constituency-detail:empty, #slovenia-constituency-detail:empty, #spain-province-detail:empty, #sweden-valkrets-detail:empty, #switzerland-constituency-detail:empty, #thailand-constituency-detail:empty, #colombia-department-detail:empty, #portugal-department-detail:empty, #costarica-department-detail:empty, #uk-constituency-detail:empty, #germany-constituency-detail:empty { margin: 0; padding: 0; border: none; }
#county-detail h4, #peru-department-detail h4, #algeria-wilaya-detail h4, #andorra-constituency-detail h4, #antigua-constituency-detail h4, #australia-region-detail h4, #barbados-constituency-detail h4, #brazil-state-detail h4, #bulgaria-constituency-detail h4, #canada-riding-detail h4, #denmark-district-detail h4, #nz-electorate-detail h4, #elsalvador-department-detail h4, #estonia-constituency-detail h4, #faroe-region-detail h4, #france-region-detail h4, #hungary-constituency-detail h4, #iceland-constituency-detail h4, #israel-region-detail h4, #italy-constituency-detail h4, #japan-constituency-detail h4, #kazakhstan-region-detail h4, #latvia-constituency-detail h4, #malta-district-detail h4, #mongolia-constituency-detail h4, #morocco-region-detail h4, #nepal-constituency-detail h4, #poland-constituency-detail h4, #russia-region-detail h4, #scotland-constituency-detail h4, #senedd-constituency-detail h4, #serbia-region-detail h4, #slovakia-constituency-detail h4, #slovenia-constituency-detail h4, #spain-province-detail h4, #sweden-valkrets-detail h4, #switzerland-constituency-detail h4, #thailand-constituency-detail h4, #colombia-department-detail h4, #portugal-department-detail h4, #costarica-department-detail h4, #uk-constituency-detail h4, #germany-constituency-detail h4 { margin-bottom: 0.4rem; }
#county-detail .candidate-row:last-of-type,
#peru-department-detail .candidate-row:last-of-type, #algeria-wilaya-detail .candidate-row:last-of-type, #andorra-constituency-detail .candidate-row:last-of-type, #antigua-constituency-detail .candidate-row:last-of-type, #australia-region-detail .candidate-row:last-of-type, #barbados-constituency-detail .candidate-row:last-of-type, #brazil-state-detail .candidate-row:last-of-type, #bulgaria-constituency-detail .candidate-row:last-of-type, #canada-riding-detail .candidate-row:last-of-type, #denmark-district-detail .candidate-row:last-of-type, #nz-electorate-detail .candidate-row:last-of-type, #elsalvador-department-detail .candidate-row:last-of-type, #estonia-constituency-detail .candidate-row:last-of-type, #faroe-region-detail .candidate-row:last-of-type, #france-region-detail .candidate-row:last-of-type, #hungary-constituency-detail .candidate-row:last-of-type, #iceland-constituency-detail .candidate-row:last-of-type, #israel-region-detail .candidate-row:last-of-type, #italy-constituency-detail .candidate-row:last-of-type, #japan-constituency-detail .candidate-row:last-of-type, #kazakhstan-region-detail .candidate-row:last-of-type, #latvia-constituency-detail .candidate-row:last-of-type, #malta-district-detail .candidate-row:last-of-type, #mongolia-constituency-detail .candidate-row:last-of-type, #morocco-region-detail .candidate-row:last-of-type, #nepal-constituency-detail .candidate-row:last-of-type, #poland-constituency-detail .candidate-row:last-of-type, #russia-region-detail .candidate-row:last-of-type, #scotland-constituency-detail .candidate-row:last-of-type, #senedd-constituency-detail .candidate-row:last-of-type, #serbia-region-detail .candidate-row:last-of-type, #slovakia-constituency-detail .candidate-row:last-of-type, #slovenia-constituency-detail .candidate-row:last-of-type, #spain-province-detail .candidate-row:last-of-type, #sweden-valkrets-detail .candidate-row:last-of-type, #switzerland-constituency-detail .candidate-row:last-of-type, #thailand-constituency-detail .candidate-row:last-of-type, #colombia-department-detail .candidate-row:last-of-type,
#portugal-department-detail .candidate-row:last-of-type,
#costarica-department-detail .candidate-row:last-of-type,
#germany-constituency-detail .candidate-row:last-of-type { border-bottom: none; }

#polling-summary { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
#polling-summary:empty { margin: 0; padding: 0; border: none; }
/* The Polling Average block in a non-US country's sidebar (see
   loadCountryPollingBlock): same own-section divider and spacing as the US
   #polling-summary above, with room between the heading and the first bar. */
.country-polling-block { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
.country-polling-block:empty { margin: 0; padding: 0; border: none; }
.country-polling-block .polling-summary-header { margin-bottom: 0.9rem; }
.country-polling-block h3 { margin-top: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }
.country-polling-block .reporting { margin-top: 0.4rem; line-height: 1.4; }
/* Separates the second-vote (Zweitstimme/party-list) section from the
   first-vote candidate list above it in the per-constituency detail
   panel -- same "own section, own divider" treatment as #polling-summary
   above, rather than letting the two real, separate votes visually run
   together as if they were one list. */
.germany-party-list-section { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #e0e0e0; }
#fundraising-summary { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
#fundraising-summary:empty { margin: 0; padding: 0; border: none; }
.fundraising-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 0.5rem; }
.fundraising-table th, .fundraising-table td { padding: 0.35rem 0.4rem; text-align: right; }
.fundraising-table th:first-child, .fundraising-table td:first-child { text-align: left; }
.fundraising-table thead th { border-bottom: 1px solid #ccc; color: #555; font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.fundraising-table tbody td { border-bottom: 1px solid #eee; }
.fundraising-table tbody tr:last-child td { border-bottom: none; }
/* Same tint palette as .race-polling-table's leader-dem/leader-rep/
   leader-neutral cells, applied per-row here (not just the winning
   cell) since every row is its own candidate, not a shared comparison. */
.fundraising-row-dem td { background: #d5e2f7; }
.fundraising-row-rep td { background: #f7d5d5; }
.fundraising-row-other td { background: #e5e5e5; }
#fundraising-summary .reporting { font-size: 0.72rem; color: #888; margin-top: 0.4rem; }
.poll-bar-row { margin-bottom: 0.9rem; font-size: 0.8rem; }
.poll-bar-label { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1rem; margin-bottom: 0.35rem; }
.poll-bar-photo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #eee; }
.poll-bar-track { display: flex; align-items: center; gap: 0.5rem; }
.poll-bar-track-bg {
  flex: 1;
  height: 0.9rem;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.poll-bar-fill {
  height: 100%;
  min-width: 2px;
  transition: width 0.2s ease;
}
.poll-bar-fill.dem { background: #2166ac; }
.poll-bar-fill.rep { background: #b2182b; }
.poll-bar-fill.ind { background: #1a9850; }
.poll-bar-fill.other { background: #888; }
.poll-bar-pct { flex: 0 0 auto; font-size: 0.75rem; color: #555; white-space: nowrap; }
/* Bounded, independently-scrollable region for the sidebar's own polling
   summary -- same pattern as .candidate-list-scroll (a race with many
   individually-polled candidates otherwise pushes the reporting line and
   the fundraising section below it far down the sidebar). Fixed max-height
   rather than .candidate-list-scroll's JS-measured one -- real polling data
   rarely covers more than a handful of candidates (public polling mostly
   only exists for the top few in a race), so a flat height comfortably
   fits the common case without needing per-row measurement. */
.poll-bar-list { max-height: 16rem; overflow-y: auto; }

.race-polling-page { max-width: 1000px; margin: 2rem auto; padding: 0 1.25rem 3rem; }
.race-polling-page-nav { display: flex; align-items: baseline; justify-content: space-between; }
.race-polling-page .back-link { font-size: 0.85rem; color: #1a1a2e; text-decoration: none; }
.race-polling-page .back-link:hover { text-decoration: underline; }
.race-polling-page .view-on-map-link { font-size: 0.85rem; }
.race-polling-page h1 { font-size: 1.3rem; margin: 0.5rem 0 1.25rem; }
.race-polling-section-heading { font-size: 1.05rem; margin: 2rem 0 0.75rem; padding-bottom: 0.3rem; border-bottom: 2px solid #1a1a2e; }
.race-polling-bars { max-width: 480px; }
.race-polling-bars .reporting { font-size: 0.75rem; color: #888; margin-top: 0.4rem; }

/* Modeled on Wikipedia's "wikitable sortable" look -- gray header with
   sort carets, zebra striping, and a party-tinted cell for whoever leads
   each row (and the matching Margin cell), same idea as the reference's
   pink "Rogers" column. */
/* table-layout: fixed + an explicit <colgroup> (built in race_polling.js,
   Pollster gets the lion's share, the rest split evenly) is what actually
   guarantees the table fits the page width regardless of column count --
   auto layout with nowrap cells just pushes the overflow into a scrollbar
   instead of preventing it. overflow-x:auto stays only as a defensive
   fallback for a genuinely narrow viewport, not the normal case. */
.race-polling-table-wrap { overflow-x: auto; }
.race-polling-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.8rem; border: 1px solid #c8ccd1; }
.race-polling-table th, .race-polling-table td {
  padding: 0.5rem 0.55rem;
  text-align: left;
  border: 1px solid #c8ccd1;
  white-space: normal;
  overflow-wrap: break-word;
}
.race-polling-table th {
  background: #eaecf0;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  user-select: none;
}
/* Wide tables (many party columns): every header and figure on one line. */
.race-polling-table-wide th, .race-polling-table-wide td { white-space: nowrap; }
.race-polling-table-moe { min-width: 640px; }
.race-polling-table .poll-moe-cell, .poll-moe { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.race-polling-table th[data-sort-key]::after { content: " \25B4\25BE"; font-size: 0.6rem; color: #888; }
.race-polling-table th.sorted-asc::after { content: " \25B4"; color: #1a1a2e; }
.race-polling-table th.sorted-desc::after { content: " \25BE"; color: #1a1a2e; }
.race-polling-table tbody tr:nth-child(even) { background: #f8f9fa; }
.race-polling-table tbody tr:hover { background: #eef1f5; }
.race-polling-table a { color: #1a1a2e; }
.race-polling-table td.leader-rep { background: #f7d5d5; font-weight: 700; }
.race-polling-table td.leader-dem { background: #d5e2f7; font-weight: 700; }
.race-polling-table td.leader-ind { background: #d3ecd9; font-weight: 700; }
.race-polling-table td.leader-other { background: #e6dcf2; font-weight: 700; }
.race-polling-table td.leader-positive { background: #d5f2df; font-weight: 700; }
.race-polling-table td.leader-negative { background: #f7d5d5; font-weight: 700; }
.race-polling-table td.leader-neutral { background: #e5e5e5; font-weight: 700; }
.race-polling-table tfoot td { border-top: 2px solid #1a1a2e; background: #f8f9fa; }

.race-polling-trend { margin-top: 0.5rem; }

.race-polling-polymarket { max-width: 480px; }
.race-polling-polymarket .reporting { font-size: 0.75rem; color: #888; margin-top: 0.4rem; }

.trend-title { font-weight: 700; font-size: 0.8rem; color: #222; text-align: center; margin-bottom: 0.4rem; }
.trend-grid line { stroke: #eee; stroke-width: 1; }
.trend-axis text { font-size: 0.65rem; fill: #888; }
.trend-axis path, .trend-axis line { stroke: #ccc; }
.trend-axis-label { font-size: 0.62rem; fill: #888; }
.trend-line { fill: none; stroke-width: 2px; }
.trend-dot { stroke: #fff; stroke-width: 1px; }
.trend-hover-line { stroke: #999; stroke-width: 1px; stroke-dasharray: 3,2; pointer-events: none; }
.trend-hover-overlay { fill: transparent; pointer-events: all; cursor: crosshair; }
.trend-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; margin-bottom: 0.4rem; }
.trend-legend-item { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: #555; }
.trend-legend-icon { flex: 0 0 auto; overflow: visible; }

/* ---------- phone/tablet: landscape-only ---------- */
/* (pointer: coarse) is this device's PRIMARY pointer being touch, not
   just a touchscreen being present -- same real signal remote_sync.js's
   own isTouchPrimaryDevice uses (a touchscreen laptop, whose primary
   pointer is still its trackpad, correctly stays exempt from this). */
.orientation-lock-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #1a1a2e;
  color: #fff;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
@media (pointer: coarse) and (orientation: portrait) {
  .orientation-lock-overlay { display: flex; }
}
.orientation-lock-message { max-width: 320px; }
.orientation-lock-message p { font-size: 1rem; line-height: 1.5; margin: 0; }
.orientation-lock-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 1.2rem;
  animation: orientation-lock-rotate-hint 1.8s ease-in-out infinite;
}
@keyframes orientation-lock-rotate-hint {
  0%, 15% { transform: rotate(0deg); }
  50%, 65% { transform: rotate(90deg); }
  100% { transform: rotate(90deg); }
}

/* ---------- phone landscape: compact topbar ---------- */
/* Scoped to touch-primary + short viewport height (a phone held
   landscape is short and wide -- roughly 320-430px tall depending on
   model/browser-chrome -- quite different from a tablet's own much
   taller landscape, which already has plenty of room and needs none of
   this). Trims the topbar's own padding/gaps/font size so its many
   items (brand, flags, Year/Election Maps/Data dropdowns, Polls, the
   remote broadcasting controls) fit one row on a narrow phone screen
   without the app's own fixed-height body padding (see body's own
   padding-top) leaving too little room for the actual map underneath. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 480px) {
  /* Redefines the SAME two variables body's padding-top and .ticker-bar's
     own top/height already read from -- both stay correctly in sync with
     the shorter topbar automatically, rather than needing their own
     separate hardcoded overrides here that could drift out of agreement
     with each other. */
  :root {
    --topbar-height: 2.4rem;
    --ticker-height: 1.6rem;
  }
  .topbar {
    padding: 0.3rem 0.6rem;
    gap: 0.35rem;
    font-size: 0.85em;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .map-tools-panel { padding: 0.35rem 0.45rem; }
  .map-tool-btn { padding: 0.25rem 0.4rem; font-size: 0.72rem; }
}

/* Country map key (see country_key.js): same panel look as the world Map
   Key, bottom-left of the map so it stays clear of the sidebar buttons, the
   Tools panel (top-left) and the inset maps (top-right). Hide/Show collapses
   it to just its header. */
#country-key-panel {
  right: auto;
  top: auto;
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: 17rem;
}
#country-key-panel .national-legend-row { white-space: normal; }
/* Map keys stay small: about four rows show, and a long key (many parties, each with its margin shades) scrolls inside the panel instead of growing up the map. Hide/Show still
   collapses it. The country key and the US shade key share this. */
#country-key-panel,
#margin-legend-panel {
  max-width: 13rem;
  font-size: 0.7rem;
}
#country-key-panel .national-legend-panel-header,
#margin-legend-panel .margin-legend-panel-header {
  padding: 0.2rem 0.45rem;
  gap: 0.5rem;
}
#country-key-panel .national-legend-toggle-btn,
#margin-legend-panel .margin-legend-toggle-btn {
  padding: 0.05rem 0.35rem;
  font-size: 0.64rem;
}
#country-key-panel .national-legend-body,
#margin-legend-panel .margin-legend-body {
  padding: 0.3rem 0.45rem;
  max-height: 5.1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#country-key-panel .national-legend-row,
#margin-legend-panel .margin-legend-row {
  gap: 0.35rem;
  padding: 0.06rem 0;
  line-height: 1.15;
}
#country-key-panel .national-legend-swatch,
#margin-legend-panel .margin-legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
}
#country-key-panel .national-legend-note { font-size: 0.62rem; max-width: 11rem; }
.national-legend-note { margin-top: 0.35rem; font-size: 0.68rem; color: #666; max-width: 15rem; }

/* Polling trend charts: one dot per poll, regression line through them; the
   part of the line past the latest poll is dashed. */
.trend-line-projected { stroke-dasharray: 6 4; opacity: 0.8; }
.trend-dot-poll { opacity: 0.5; }
.trend-note { margin-top: 0.5rem; font-size: 0.78rem; max-width: 46rem; }


/* The District of Columbia inset on the national map (see syncDcInset in map_app.js). */
.dc-inset-box { fill: rgba(255, 255, 255, 0.55); stroke: #8a8f98; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.dc-inset-line { stroke: #8a8f98; stroke-width: 1px; vector-effect: non-scaling-stroke; }

/* State Legislative Elections: chamber switch + election-type toggle at the top of the left (district) sidebar. */
#sleg-sidebar-extra .sleg-chamber-toggle { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#sleg-sidebar-extra .sleg-chamber-toggle button { width: 100%; text-align: left; }
#sleg-sidebar-extra .sleg-chamber-toggle button:disabled { opacity: 0.55; cursor: not-allowed; }
#sleg-sidebar-extra .sleg-election-toggle { margin: 6px 0 10px; }
.sleg-contest { margin: 10px 0; }
.district-path.selected { stroke: #111; stroke-width: 1.4px; }
/* State legislative view: the federal office tabs don't apply. A district opens like a U.S. House district
   (right sidebar with results and every county tool); the statewide (chamber) map has no right sidebar. */
.sleg-mode #state-office-toggle { display: none !important; }
.app-layout.sleg-mode.sleg-chamber-level { grid-template-columns: var(--left-col-width) 1fr; }
.app-layout.sleg-mode.sleg-chamber-level .county-panel,
.app-layout.sleg-mode.sleg-chamber-level .sidebar-toggle-right { display: none; }

/* Fade-in for whichever map was just switched on (see map_transitions.js). Opacity only. */
@keyframes map-fade-in { from { opacity: 0; } to { opacity: 1; } }
.map-fade-in { animation: map-fade-in 0.24s ease-out; }
.map-view-ghost { position: fixed; z-index: 4; transform-origin: center; overflow: hidden; }
.map-view-ghost, .map-view-ghost * { pointer-events: none !important; }
@media (prefers-reduced-motion: reduce) {
  .map-fade-in { animation: none; }
  .map-view-ghost { display: none; }
}

/* The empty 2027 world shell hides the 2026 election menus (see world_year.js). */
.world-empty-hide { display: none !important; }

/* France's candidate list: a long field (22 declared candidates) scrolls inside the panel. */
#france-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#italy-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#poland-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#slovakia-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#andorra-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#switzerland-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#slovenia-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#estonia-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#mongolia-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#legislative-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#presidential-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#combined-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
#elsalvador-candidate-list .candidate-list-scroll { max-height: 46vh; overflow-y: auto; }
/* Annexed Ukrainian regions on the Russia map (disputed): dashed border, as Kosovo's on the Serbia map. */
.russia-annexed-path { stroke: #1a1a2e; stroke-width: 1.8px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; cursor: pointer; }
.russia-annexed-path:hover { opacity: 0.85; }
/* Russia's State Duma seat table is wide and short so it fits in the strip below the south of Russia: a long row-run of small
   dots, the party key in three columns. */
/* (the width and the number of dots per row are set by placeRussiaSeatsPanel in map_app.js) */
#russia-partylist-seats-panel { width: 984px; }
#russia-partylist-seats-grid { grid-template-columns: repeat(60, 1fr); row-gap: 3px; max-height: none; overflow: visible; }
#russia-partylist-seats-panel .national-seat-dot { width: 12px; height: 12px; }
#russia-partylist-seats-legend { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 1rem; max-height: none; }
/* Thailand's and Nepal's party-list seat tables ride on the map like Russia's State Duma table: small dots, the width and the number of dots per row set by placeSeatsPanelBestFit in
   map_app.js (so the table takes the largest size that clears the country), the party key in columns, no inner scrolling. */
#thailand-partylist-seats-panel, #nepal-partylist-seats-panel, #nz-partylist-panel { width: 400px; left: auto; }
#thailand-partylist-seats-grid, #nepal-partylist-seats-grid, #nz-partylist-grid { grid-template-columns: repeat(20, 1fr); row-gap: 3px; max-height: none; overflow: visible; }
#thailand-partylist-seats-panel .national-seat-dot, #nepal-partylist-seats-panel .national-seat-dot, #nz-partylist-panel .national-seat-dot { width: 12px; height: 12px; }
#thailand-partylist-seats-legend, #nepal-partylist-seats-legend, #nz-partylist-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); column-gap: 0.8rem; max-height: none; overflow: visible; }
/* New Zealand's table is narrow (7-25 dots a row, 49 seats), so its key is one party per line rather than the 135px columns the 100+-seat tables use. */
#nz-partylist-rows { grid-template-columns: 1fr; }
#nz-partylist-rows:empty { display: none; }
/* New Zealand's party-list seat table wears the dashed, captioned frame of the map insets (France's overseas departments, Denmark's islands) and, like Russia's State Duma table, is a plain
   titled panel with no drop-down. */
#nz-partylist-panel { background: transparent; box-shadow: none; border-radius: 0; border: 1px dashed #8a8f98; }
#nz-partylist-panel .national-seat-panel-title { font-size: 0.75rem; font-weight: 600; text-align: left; color: #555; border-bottom: 0; padding-bottom: 0; margin-bottom: 0.4rem; }
/* Poland / Slovakia party lists (no vote figure yet): one left-aligned line per party, a long "Leader & Leader (ABBR)" label wraps. */
#poland-candidate-list .candidate-row,
#slovakia-candidate-list .candidate-row,
#andorra-candidate-list .candidate-row,
#switzerland-candidate-list .candidate-row,
#estonia-candidate-list .candidate-row { justify-content: flex-start; }
#poland-candidate-list .candidate-row > span,
#slovakia-candidate-list .candidate-row > span,
#andorra-candidate-list .candidate-row > span,
#switzerland-candidate-list .candidate-row > span,
#estonia-candidate-list .candidate-row > span { white-space: normal; min-width: 0; margin-left: 0; }

.subdivision-heading { margin: 0.9rem 0 0.2rem; font-size: 0.95rem; }
/* A clicked municipality's results in the left sidebar: show the whole list (it scrolls only if it must), not just three rows. */
#latvia-constituency-detail .candidate-list-scroll,
#bulgaria-constituency-detail .candidate-list-scroll { max-height: 55vh; }

/* Bulgaria's presidential view has results but no sub-constituency units to select, so single / multiselect is not offered; Shade by is, with Votes Left (the protocols still to process). */
.app-layout.country-mode.bulgaria-mode.bulgaria-president #county-select-mode-toggle,
.app-layout.country-mode.bulgaria-mode.bulgaria-president #county-select-mode-hotkeys { display: none; }

/* Municipalities inside a drilled-into Swiss canton (see switzerlandMunicipalityLayer): the standard thin border, as Denmark's subdivisions. */
.switzerland-municipality-path {
  stroke: rgba(0, 0, 0, 0.5); stroke-width: 0.75px; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: opacity 0.1s ease;
}
.switzerland-municipality-path:hover { opacity: 0.85; }

/* Canada's 2027 map offers the General Election only (the Referendum is a 2026 map type). */
body.canada-2027-mode #nav-dropdown-canada-election a[data-canada-map-type="REFERENDUM"] { display: none; }

/* Escape closes an open topbar dropdown even while focus is inside it (remote_sync.js adds .suppressed, removed on leave/blur/click). */
.nav-dropdown.suppressed .nav-dropdown-menu { display: none !important; }
.nav-dropdown-menu a:focus-visible, .nav-dropdown-trigger:focus-visible { outline: 2px solid #4a90d9; outline-offset: 1px; }

/* Poll Grading (U.S.). The shared .race-polling-table is table-layout: fixed with one-line cells, which suits its few party columns but overlaps a dozen text columns; the grading
   tables size their columns to their content, wrap long names and keep figures on one line. */
.poll-grading-page { max-width: 1280px; }
.poll-grading-page .race-polling-table-wrap { margin-bottom: 1rem; }
.race-polling-table.poll-grading-table { table-layout: auto; min-width: 100%; font-size: 0.74rem; }
.poll-grading-table th, .poll-grading-table td { white-space: normal; overflow-wrap: normal; vertical-align: top; padding: 0.4rem 0.45rem; }
.poll-grading-table th { cursor: default; white-space: normal; line-height: 1.25; }
.poll-grading-table td:first-child { min-width: 9rem; }
.poll-grading-table td:nth-child(n+2), .poll-grading-table th:nth-child(n+2) { white-space: nowrap; }
.poll-grading-table .poll-grade { font-size: 1rem; }
.poll-grading-table .poll-grade-meaning { font-size: 0.7rem; color: #666; white-space: nowrap; }
#poll-grading-polls td:nth-child(2), #poll-grading-polls td:nth-child(3), #poll-grading-polls td:nth-child(10), #poll-grading-polls td:nth-child(11) { white-space: normal; min-width: 0; }
#poll-grading-polls td:nth-child(3) { min-width: 8rem; }
.poll-grading-method { margin: 0.6rem 0 0.8rem; }
.poll-grading-method summary { cursor: pointer; font-weight: 700; }
.poll-grading-method ul { margin: 0.5rem 0 0 1.1rem; font-size: 0.85rem; line-height: 1.4; }
.poll-grading-coverage { max-width: 70rem; }
#poll-grading-filters { align-items: flex-end; flex-wrap: wrap; gap: 0.75rem 1rem; }
.polls-filter-group input[type="search"] {
  font-size: 0.85rem; padding: 0.35rem 0.5rem; border: 1px solid #ccc; border-radius: 6px; background: #fff; color: #1a1a2e; min-width: 200px; box-sizing: border-box; height: 2.1rem;
}
.polls-filter-group select { height: 2.1rem; box-sizing: border-box; }
#poll-grading-filters .polls-filter-reset { height: 2.1rem; display: inline-flex; align-items: center; text-decoration: none; }
.poll-grading-pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0 2rem; }
.poll-grading-pager a { color: #1a1a2e; font-weight: 700; }
.poll-grading-search { position: relative; }
.poll-grading-search input[type="search"] { min-width: 280px; }
.poll-grading-suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 2px 0 0; padding: 0.2rem 0; list-style: none; background: #fff; border: 1px solid #ccc; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); max-height: 16rem; overflow-y: auto;
}
.poll-grading-suggest[hidden] { display: none; }
.poll-grading-suggest li { padding: 0.4rem 0.6rem; font-size: 0.82rem; color: #1a1a2e; cursor: pointer; }
.poll-grading-suggest li.active, .poll-grading-suggest li:hover { background: #eef0f6; }
.poll-grading-suggest li strong { font-weight: 800; }
#poll-grading-averages td:first-child { min-width: 14rem; }
.poll-moe { color: #444; font-size: 0.78rem; font-weight: 600; margin-left: 0.3rem; cursor: help; }
.poll-bar-row.unpolled { opacity: 0.75; }
.poll-bar-row.unpolled .poll-bar-pct { color: #777; font-style: italic; }
.poll-advanced-badge { font-style: normal; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: #2b6a3e; border-radius: 3px; padding: 0.05rem 0.3rem; }
.poll-round-heading { font-size: 0.8rem; margin: 0.8rem 0 0.3rem; color: #444; }
.poll-advanced-badge.withdrew { background: #8a5a00; }
/* Wording about how a map works moves to the FAQ: the Map Key's shading note and the multiselect hotkey line. (The hotkeys themselves still work.) */
.national-legend-note, .county-select-mode-hotkeys { display: none !important; }
.vote-in { font-size: 0.78rem; color: #666; margin-top: 0.3rem; }


/* Live result motion (live_result_motion.js): bars ease to their new width when a live update patches the results panel in place; a short party-coloured change label rises above a
   candidate's percentage. Nothing here changes layout (the label is absolutely positioned and ignores pointer events); reduced motion turns every movement off. */
.candidate-row-bar-fill,
.reporting-bar-fill { transition: width 800ms ease-out; }
.candidate-row.lrm-host, .candidate-row-full.lrm-host { position: relative; }
.lrm-badge {
  position: absolute; right: 0; top: -0.55rem; z-index: 2; pointer-events: none;
  padding: 0 0.35rem; border: 1px solid currentColor; border-radius: 0.6rem; background: rgba(255, 255, 255, 0.94);
  font-size: 0.7rem; font-weight: 700; line-height: 1.15rem; white-space: nowrap; opacity: 0;
}
.lrm-badge-on { animation: lrm-badge 2000ms ease-out forwards; }
@keyframes lrm-badge {
  0%   { opacity: 0; transform: translateY(12px); }
  11%  { opacity: 1; transform: translateY(0); }
  86%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .candidate-row-bar-fill,
  .reporting-bar-fill { transition: none; }
  .lrm-badge-on { animation: lrm-badge-static 2000ms linear forwards; }
  @keyframes lrm-badge-static { 0%, 90% { opacity: 1; } 100% { opacity: 0; } }
}


/* Early Voting Map: Party / Age / Gender switch (same button look as the Demographic Maps category switch). */
#early-vote-view-toggle button { flex: 1 1 calc(33% - 0.3rem); }
#early-vote-view-toggle button.active { background: #2f5d50; color: #fff; border-color: #2f5d50; }


/* Israel's national summary: the green counted-share bar and its caption (the same look the other countries' progress bars have). */
#israel-candidate-list .reporting-bar, #israel-region-detail .reporting-bar { height: 5px; background: #e5e5e5; border-radius: 3px; overflow: hidden; margin-top: 0.6rem; }
#israel-candidate-list .reporting-bar-fill, #israel-region-detail .reporting-bar-fill { height: 100%; background: #06d6a0; transition: width 800ms ease-out; }
#israel-candidate-list .reporting, #israel-region-detail .reporting { font-size: 0.75rem; color: #888; margin-top: 0.3rem; }
#israel-candidate-list .expected-votes-left { font-size: 0.75rem; color: #888; font-style: italic; margin-top: 0.15rem; }


/* Israel district card: how the district figures were put together (see israelCoverageHtml). */
.district-coverage { margin-top: 0.5rem; font-size: 0.72rem; color: #888; line-height: 1.35; }


/* Elections calendar (static/js/calendar.js): every rule is scoped to .cal-* so nothing else in the program changes. The overlay sits below the top bar; the month grid is the left/main area and the
   day-details sidebar its right side (stacked under the grid on narrow screens). */
.calendar-btn { margin-right: 0.35rem; }
.cal-overlay { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2400; display: flex; background: #f6f7f9; color: #1a1a2e; border-top: 1px solid #ccd; }
.cal-overlay[hidden] { display: none; }
.cal-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 0.75rem 1rem; }
.cal-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.cal-head select, .cal-head button { font: inherit; font-size: 0.9rem; padding: 0.3rem 0.6rem; border: 1px solid #aab; border-radius: 4px; background: #fff; color: inherit; cursor: pointer; }
.cal-head .cal-close { margin-left: auto; font-size: 1.2rem; line-height: 1; }
.cal-head button:hover { background: #eceef5; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays span { padding: 0.25rem 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #667; }
.cal-grid { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(5.2rem, 1fr); border-top: 1px solid #ccd; border-left: 1px solid #ccd; overflow-y: auto; }
.cal-cell { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; text-align: left; padding: 0.25rem 0.35rem; min-width: 0; overflow: hidden; font: inherit; font-size: 0.72rem; color: inherit;
  background: #fff; border: 0; border-right: 1px solid #ccd; border-bottom: 1px solid #ccd; border-radius: 0; cursor: pointer; }
.cal-cell:hover { background: #eef0f8; }
.cal-cell.cal-out { background: #eceef2; color: #889; }
.cal-cell.cal-selected { outline: 3px solid #1a1a2e; outline-offset: -3px; background: #e6e9f5; }
.cal-cell.cal-today .cal-num { font-weight: 700; }
.cal-num { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.cal-today-mark { font-style: normal; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.3rem; border: 1px solid #1a1a2e; border-radius: 3px; }
.cal-chip { display: flex; align-items: center; gap: 0.25rem; min-width: 0; padding: 0.05rem 0.2rem; background: #dfe3f3; border-radius: 3px; white-space: nowrap; }
.cal-chip span { overflow: hidden; text-overflow: ellipsis; }
.cal-chip img, .cal-event-title img { width: 1.1rem; height: 0.75rem; object-fit: cover; border: 1px solid rgba(0, 0, 0, 0.25); flex: 0 0 auto; }
.cal-more { color: #445; font-weight: 600; }
.cal-note { margin-top: 0.4rem; }
.cal-side { flex: 0 0 22rem; max-width: 40%; overflow-y: auto; padding: 0.9rem 1rem; background: #fff; border-left: 1px solid #ccd; }
.cal-side-date { margin: 0 0 0.2rem; font-size: 1rem; }
.cal-zone { margin-bottom: 0.7rem; }
.cal-event { padding: 0.6rem 0; border-top: 1px solid #e3e5ec; font-size: 0.85rem; }
.cal-event-title { display: flex; align-items: center; gap: 0.4rem; }
.cal-status { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.3rem; border: 1px solid #b8860b; color: #8a6508; border-radius: 3px; }
.cal-closes-head { margin-top: 0.4rem; font-size: 0.78rem; color: #556; }
.cal-closes { list-style: none; margin: 0.2rem 0 0; padding: 0; max-height: 18rem; overflow-y: auto; font-size: 0.78rem; }
.cal-closes li { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.12rem 0; border-bottom: 1px dotted #dde; }
.cal-undated { margin-top: 0.8rem; font-size: 0.8rem; }
.cal-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 760px) {
  .cal-overlay { flex-direction: column; overflow-y: auto; }
  .cal-main { flex: 0 0 auto; }
  .cal-side { flex: 0 0 auto; max-width: none; border-left: 0; border-top: 1px solid #ccd; }
  .cal-grid { grid-auto-rows: minmax(3.4rem, auto); overflow: visible; }
  .cal-chip span { display: none; }
}

.cal-view { display: inline-block; margin-top: 0.35rem; font-size: 0.8rem; color: #2166ac; text-decoration: none; }
.cal-view:hover, .cal-view:focus { text-decoration: underline; }

.poll-rcv-line { margin-top: 0.5rem; font-size: 0.78rem; color: #333; }

/* Ranked-choice poll table (Wikipedia layout): each poll is one block, the rounds its rows. */
#race-polling-table-rcv tr.poll-group-start > td { border-top: 2px solid var(--border, #555); }
#race-polling-table-rcv td[rowspan] { vertical-align: middle; }
#race-polling-table-rcv td.poll-round-cell { white-space: nowrap; }

/* Election night (election_night_display.js): seat segments grow/shrink in place, a live fill eases to its new colour, and a key race keeps an outline once its fill shows a real result. */
.senate-balance-segment { overflow: hidden; transition: width 580ms cubic-bezier(0.22, 0.61, 0.36, 1), background-color 300ms ease; }
.senate-balance-segment-empty { border-right: none; }
.state-path, .district-path { transition: opacity 0.1s ease, fill 380ms ease; }
.state-path.key-race-outline, .district-path.key-race-outline { stroke: #ffd166; stroke-width: 1.6px; }
.tooltip-result-call { font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .senate-balance-segment, .state-path, .district-path { transition: opacity 0.1s ease; }
}
