:root {
  color-scheme: light;
  --bg: #e9e6da;
  --surface: #fffdf7;
  --surface-2: #f3f0e4;
  --ink: #17342b;
  --muted: #627169;
  --line: #c9c5b6;
  --accent: #0b3d2e;
  --accent-strong: #062a20;
  --accent-soft: #e2ecdf;
  --header: #0b3d2e;
  --header-ink: #fffaf0;
  --rail: #082f24;
  --rail-ink: #fffaf0;
  --gold: #d4a72c;
  --gold-soft: #f5e8b9;
  --warning: #8c451c;
  --map-missing: #d9d7ce;
  --map-underlay: #e6e8df;
  --map-line: #60746a;
  --map-hue: 151;
  --focus: #f1c64e;
  --shadow: 0 20px 55px rgba(6, 42, 32, .16);
  --display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #0c1713;
  --surface: #14251f;
  --surface-2: #1c3028;
  --ink: #f5f0df;
  --muted: #b4c3ba;
  --line: #3b554a;
  --accent: #d4a72c;
  --accent-strong: #f1ce67;
  --accent-soft: #263c31;
  --header: #061d17;
  --header-ink: #fffaf0;
  --rail: #081f19;
  --rail-ink: #fffaf0;
  --gold: #e1b83e;
  --gold-soft: #3b3522;
  --warning: #ffc082;
  --map-missing: #34443d;
  --map-underlay: #253a31;
  --map-line: #8aa095;
  --focus: #f1c64e;
  --shadow: 0 20px 55px rgba(0, 0, 0, .4);
}

:root[data-theme="contrast"] {
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --surface-2: #f2f2f2;
  --ink: #000;
  --muted: #202020;
  --line: #000;
  --accent: #00452f;
  --accent-strong: #000;
  --accent-soft: #e4ffeb;
  --header: #000;
  --header-ink: #fff;
  --rail: #000;
  --rail-ink: #fff;
  --gold: #9a6d00;
  --gold-soft: #fff1a8;
  --warning: #6f2d00;
  --map-missing: #ccc;
  --map-underlay: #eee;
  --map-line: #000;
  --focus: #e04a00;
  --shadow: 0 0 0 2px #000;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); }
button, select, input { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.site-header {
  position: relative;
  z-index: 40;
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 4px solid var(--gold);
  background: var(--header);
  color: var(--header-ink);
}
.brand { min-height: 68px; display: flex; align-items: center; gap: 22px; min-width: max-content; text-decoration: none; }
.brand-mark { width: 64px; height: 64px; flex: 0 0 64px; display: block; border-radius: 50%; background: #0b3d2e; object-fit: cover; }
.brand strong, .brand small { display: block; }
.brand strong { color: #fffaf0; font-family: var(--display); font-size: 26px; line-height: 1; letter-spacing: -.02em; }
.brand small { margin-top: 7px; color: color-mix(in srgb, var(--header-ink) 96%, transparent); font-size: 12px; font-weight: 800; line-height: 1.2; letter-spacing: .11em; text-transform: uppercase; }
.primary-nav { height: 46px; display: flex; align-items: center; gap: 3px; margin-left: auto; padding: 3px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.06); }
.nav-link { position: relative; min-width: 44px; min-height: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: color-mix(in srgb, var(--header-ink) 84%, transparent); text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 820; line-height: 1; }
.nav-link:hover, .nav-link[aria-expanded="true"], .nav-link.is-active { border-color: color-mix(in srgb, var(--gold) 72%, #fff); background: rgba(255,255,255,.1); color: #fff; }
#compareCount { min-width: 18px; height: 18px; display: inline-grid; place-items: center; margin-left: 6px; border: 1px solid var(--gold); border-radius: 50%; background: transparent; color: var(--gold); font-size: 9px; }
.mobile-nav-trigger, .mobile-map-head, .sheet-close { display: none; }
.menu-wrap { position: relative; }
.menu-popover { position: absolute; top: calc(100% + 10px); right: 0; min-width: 240px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.menu-popover a { min-height: 44px; display: flex; align-items: center; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 760; }
.menu-popover a:hover { background: var(--accent-soft); color: var(--accent-strong); }

.app-shell { min-height: calc(100dvh - 92px); display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.topic-rail { min-height: calc(100dvh - 92px); padding: 20px 14px; border-right: 1px solid rgba(255,255,255,.14); background: var(--rail); color: var(--rail-ink); }
.rail-heading { padding: 0 9px 17px; }
.rail-heading small, .panel-title small, .dialog-card > small, .compare-heading small { display: block; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.rail-heading strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 24px; line-height: 1.05; }
.topic-list { display: grid; gap: 6px; }
body[data-app-ready="false"] .topic-list { min-height: 255px; }
body[data-app-ready="false"] :is(.topic-list, .rail-note, .control-deck, .map-and-panel) { visibility: hidden; }
.topic-list button { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; font-weight: 790; }
.topic-list button:hover { border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.07); }
.topic-list button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--accent-strong); box-shadow: inset 4px 0 0 var(--gold); }
.rail-note { margin: 22px 2px 0; padding: 14px; border-top: 1px solid rgba(255,255,255,.2); color: color-mix(in srgb, var(--rail-ink) 76%, transparent); }
.rail-note strong { color: var(--gold); font-size: 11px; }
.rail-note p { margin: 6px 0 0; font-size: 10px; line-height: 1.55; }

.workspace { min-width: 0; min-height: calc(100dvh - 92px); display: flex; flex-direction: column; padding: 10px 14px 14px; }
.map-intro { position: relative; z-index: 20; min-height: 118px; display: grid; grid-template-columns: minmax(210px, .72fr) minmax(240px, .88fr) minmax(340px, 1.35fr); align-items: center; gap: 22px; margin-bottom: 7px; padding: 10px 14px 10px 18px; border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 10px; background: var(--surface); box-shadow: 0 7px 20px rgba(6,42,32,.07); }
.intro-copy { min-width: 0; }
.intro-copy > small { display: block; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .17em; }
.intro-copy > p { display: block; margin: 5px 0 0; color: var(--muted); font-size: 12px; font-weight: 720; }
.map-intro h1 { margin: 3px 0 0; color: var(--accent-strong); font-family: var(--display); font-size: clamp(25px, 1.85vw, 34px); line-height: .96; letter-spacing: -.03em; }
.quick-fact-field, .place-search { min-width: 0; padding: 10px 12px; border: 2px solid color-mix(in srgb, var(--line) 58%, var(--accent)); border-radius: 10px; background: var(--surface-2); }
.quick-fact-field { position: relative; display: grid; grid-template-rows: 20px 48px 16px; gap: 5px; color: var(--muted); }
.quick-fact-field > span, .place-search label > span { width: max-content; min-height: 20px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 999px; font-size: 10px; font-weight: 950; line-height: 20px; letter-spacing: .1em; text-transform: uppercase; }
.quick-fact-field > span { background: var(--gold); color: #183329; }
.place-search label > span { border: 1px solid var(--gold); background: var(--surface); color: var(--accent-strong); }
.quick-fact-field::after { content: "▾"; position: absolute; z-index: 2; top: calc(10px + 20px + 5px + 24px); right: 26px; transform: translateY(-50%); color: var(--accent-strong); font-size: 15px; font-weight: 950; pointer-events: none; }
.quick-fact-field select { width: 100%; min-width: 0; min-height: 48px; height: 48px; appearance: none; padding: 0 42px 0 12px; border: 2px solid color-mix(in srgb, var(--line) 52%, var(--accent)); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 800; line-height: 1.2; outline: none; box-shadow: inset 5px 0 0 var(--gold); }
.quick-fact-field select:focus { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--gold), 0 0 0 3px var(--focus); }
.quick-fact-field small { padding-left: 3px; overflow: hidden; color: color-mix(in srgb, var(--ink) 82%, transparent); font-size: 10px; font-weight: 780; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.place-search { position: relative; color: var(--ink); }
.place-search label { display: grid; grid-template-rows: 20px 48px; gap: 5px; }
.place-search input { width: 100%; min-height: 48px; height: 48px; padding: 0 18px 0 44px; border: 2px solid color-mix(in srgb, var(--line) 52%, var(--accent)); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 760; line-height: 1.2; outline: none; box-shadow: inset 5px 0 0 var(--gold); }
.place-search::before { content: "⌕"; position: absolute; z-index: 1; top: 50px; left: 27px; color: var(--accent); font-size: 22px; line-height: 1; }
.place-search input:focus { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--gold), 0 0 0 3px var(--focus); }
.place-search #placeSearchHint { min-height: 16px; margin: 5px 3px 0; overflow: hidden; color: color-mix(in srgb, var(--ink) 82%, transparent); font-size: 10px; font-weight: 780; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.place-search-results { position: absolute; z-index: 90; top: calc(100% + 7px); right: 0; width: min(520px, calc(100vw - 32px)); max-height: min(540px, 68dvh); overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.search-summary { margin: 0 0 7px !important; padding: 9px; border-left: 3px solid var(--gold); background: var(--surface-2); color: var(--ink) !important; font-size: 10px !important; line-height: 1.4; }
.search-result-group + .search-result-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.search-result-group h2 { margin: 0 0 4px; padding: 6px 8px; color: var(--accent-strong); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.search-result-group button { width: 100%; min-height: 60px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-content: center; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.search-result-group button + button { margin-top: 4px; }
.search-result-group button:hover, .search-result-group button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.search-result-group button[aria-selected="true"] { outline: 3px solid var(--focus); outline-offset: -3px; }
.search-result-group strong { grid-column: 1; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.search-result-group span, .search-result-group em { grid-column: 1; color: var(--muted); font-size: 10px; line-height: 1.3; }
.search-result-group em { color: var(--accent-strong); font-style: normal; font-weight: 800; }
.search-result-group button > i { grid-column: 2; grid-row: 1 / span 3; align-self: center; padding: 5px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 8px; font-style: normal; font-weight: 850; white-space: nowrap; }
.search-empty { padding: 18px !important; color: var(--muted) !important; text-align: center; }

.control-deck { flex: 0 0 auto; padding: 0 2px; }
.workspace-topline { min-height: 56px; display: flex; align-items: end; gap: 14px; }
.breadcrumb { min-width: 150px; min-height: 44px; display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 760; }
.breadcrumb button { min-height: 44px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); cursor: pointer; font-weight: 850; }
.breadcrumb button:hover { background: var(--accent-soft); }
.breadcrumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-controls { min-width: 0; display: flex; align-items: end; justify-content: flex-end; gap: 8px; margin-left: auto; }
.geo-field, .geo-controls label { min-width: 160px; display: grid; grid-template-rows: 13px 44px; gap: 3px; color: var(--muted); font-size: 9px; font-weight: 850; }
.country-field { min-width: 94px; }
.geo-field > span, .geo-controls label > span { padding-left: 4px; line-height: 13px; text-transform: uppercase; letter-spacing: .06em; }
.geo-controls button, .geo-controls select { width: 100%; min-width: 0; min-height: 44px; height: 44px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 730; }
.geo-controls button:hover, .geo-controls select:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.geo-controls button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.geo-controls select:disabled { cursor: not-allowed; opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); }
#localField { width: 210px; }
#dataAreaField { width: clamp(220px, 24vw, 350px); }
.geo-help { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.measure-heading { min-height: 25px; display: flex; align-items: center; gap: 8px; padding-top: 3px; }
.measure-heading small { color: var(--gold); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.measure-heading strong { color: var(--ink); font-size: 10px; }
.measure-list { min-height: 48px; display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 5px; scrollbar-width: thin; }
.measure-list button { min-height: 44px; flex: 0 0 auto; padding: 0 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 780; white-space: nowrap; }
.measure-list button:hover { border-color: var(--accent); background: var(--accent-soft); }
.measure-list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.mobile-measure-field { display: none; }

.map-and-panel { min-height: 500px; height: calc(100dvh - 322px); flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 23vw, 360px); gap: 12px; }
body[data-has-selection="false"] .map-and-panel { grid-template-columns: minmax(0, 1fr); }
body[data-has-selection="false"] .detail-panel { display: none; }
.map-stage { position: relative; min-width: 0; min-height: 500px; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 78%, var(--accent-soft)); box-shadow: 0 14px 36px rgba(6,42,32,.12); }
:root[data-theme="night"] .map-stage { background-color: #13251f; }
.map-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.map-stage > .map-camera-surface, .map-stage > .map-canvas { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; }
.map-canvas { position: absolute; inset: 0; min-height: 0; display: block; padding: 12px 78px 110px 14px; }
.map-svg { width: 100%; height: 100%; min-height: 0; display: block; touch-action: none; user-select: none; cursor: grab; }
.map-svg:active { cursor: grabbing; }
.map-toolbar { position: absolute; z-index: 8; top: 14px; right: 14px; width: 50px; display: grid; gap: 6px; }
.map-zoom-buttons { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 6px 18px rgba(6,42,32,.14); }
.map-toolbar button { min-width: 44px; min-height: 44px; border: 0; background: var(--surface); color: var(--accent-strong); cursor: pointer; font-weight: 900; }
.map-zoom-buttons button + button { border-top: 1px solid var(--line); }
.map-toolbar button:hover { background: var(--gold-soft); }
.map-reset-button { padding: 0 4px; border: 1px solid var(--line) !important; border-radius: 8px; box-shadow: 0 6px 18px rgba(6,42,32,.14); font-size: 9px; }
.map-camera-status { display: none; }
.map-region { cursor: pointer; stroke: color-mix(in srgb, var(--accent-strong) 62%, transparent); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: filter .16s ease, opacity .16s ease, stroke-width .16s ease; }
.map-region:hover, .map-region:focus-visible { filter: brightness(1.08) saturate(1.15); stroke: var(--gold); stroke-width: 2.5; outline: none; }
.map-region.is-selected { stroke: var(--gold); stroke-width: 3.5; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--surface) 88%, transparent)); }
.map-region.is-compared { stroke: var(--accent-strong); stroke-dasharray: 6 3; stroke-width: 3; }
.map-region.is-context { stroke: var(--gold); stroke-dasharray: 7 3; stroke-width: 3; }
.map-region.is-context-filter { fill: var(--map-underlay); }
.map-region.is-unavailable { cursor: not-allowed; filter: grayscale(.55); opacity: .5; }
.map-region.is-unavailable:hover { filter: grayscale(.55); stroke: color-mix(in srgb, var(--accent-strong) 62%, transparent); stroke-width: 1; }
.election-region { stroke-width: .65; }
.election-province-border { pointer-events: none; stroke: color-mix(in srgb, var(--ink) 82%, #fff); stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.selected-location-markers { pointer-events: none; }
.selected-location-marker-halo { fill: color-mix(in srgb, var(--surface) 80%, transparent); stroke: var(--accent-strong); stroke-width: 3; vector-effect: non-scaling-stroke; }
.selected-location-marker { fill: var(--gold); stroke: var(--accent-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.map-label { fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; font-size: 18px; font-weight: 900; pointer-events: none; }
.map-label.is-overview { stroke-width: 4px; font-size: 14px; letter-spacing: .04em; }
.country-headtohead { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: grid; gap: 6px; }
.country-headtohead h2 { margin: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.country-headtohead-row { margin: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.country-headtohead-row small { opacity: .72; }
.country-headtohead-row strong { font-variant-numeric: tabular-nums; }
.country-headtohead-note { margin: 2px 0 0; font-size: 11px; line-height: 1.45; opacity: .78; }
.map-label-value { font-size: .88em; font-weight: 800; }
.province-underlay path { vector-effect: non-scaling-stroke; }
.local-parent-underlay path { stroke: var(--accent-strong); stroke-width: 3; stroke-linejoin: round; }
.local-parent-outline { pointer-events: none; }
.local-parent-outline path { stroke: var(--gold); stroke-width: 5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.climate-point { stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.climate-point.is-selected { stroke: var(--gold); stroke-width: 4; }
.climate-hit { cursor: pointer; }
.legend, .party-legend { position: absolute; z-index: 7; right: 78px; bottom: 12px; left: 14px; min-height: 36px; max-height: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; overflow: auto; padding: 6px 10px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 7px; background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--muted); font-size: 9px; box-shadow: 0 5px 16px rgba(6,42,32,.09); }
.legend > span:first-child { color: var(--ink); font-weight: 840; }
.context-legend { align-content: center; }
.context-legend strong { color: var(--ink); }
.context-legend span { line-height: 1.35; }
.legend-gradient { width: 90px; height: 8px; border-radius: 5px; background: linear-gradient(90deg, hsl(var(--map-hue) 58% 88%), hsl(var(--map-hue) 58% 40%)); }
.legend-missing { width: 18px; height: 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--map-missing); }
.party-legend span { display: inline-flex; align-items: center; gap: 4px; }
.party-legend i { width: 10px; height: 10px; border-radius: 50%; }
.map-touch-list { position: absolute; z-index: 7; right: 78px; bottom: 58px; left: 14px; min-width: 0; display: flex; gap: 5px; overflow-x: auto; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: color-mix(in srgb, var(--surface) 94%, transparent); scrollbar-width: thin; }
.map-touch-list button { min-width: 44px; min-height: 44px; flex: 1 0 44px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); cursor: pointer; font-size: 9px; font-weight: 850; }
.map-touch-list button:hover, .map-touch-list button.is-selected { border-color: var(--gold); background: var(--gold-soft); color: var(--accent-strong); }
.map-touch-list button:disabled { cursor: not-allowed; opacity: .45; }
.map-touch-long { display: none; }
.map-local-button { position: absolute; z-index: 9; top: 15px; left: 15px; min-height: 44px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #fff; cursor: pointer; font-size: 11px; font-weight: 820; }
.map-instruction { position: absolute; z-index: 6; top: 14px; left: 14px; max-width: calc(100% - 170px); padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--muted); font-size: 9px; font-weight: 720; }
body[data-local-map="true"] .map-stage { background-color: #d8edf0; }

.detail-panel { position: relative; min-width: 0; height: 100%; padding: 19px 18px 22px; overflow: auto; border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 34px rgba(6,42,32,.12); }
.result-sheet-toggle { display: none; }
.panel-title h2 { margin: 7px 0 6px; font-family: var(--display); font-size: clamp(27px, 2.2vw, 38px); line-height: .98; letter-spacing: -.025em; }
.panel-title p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.hero-fact { margin-top: 16px; padding: 17px; border: 1px solid color-mix(in srgb, var(--gold) 62%, var(--line)); border-radius: 9px; background: var(--gold-soft); }
.hero-fact small, .hero-fact strong, .hero-fact p { display: block; }
.hero-fact small { color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; }
.hero-fact strong { margin-top: 5px; color: var(--accent-strong); font-family: var(--display); font-size: 32px; line-height: 1; }
.hero-fact p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.hero-fact.is-unavailable { border: 2px solid var(--warning); background: color-mix(in srgb, #f2d7b7 62%, var(--surface)); }
.hero-fact.is-unavailable strong { color: var(--ink); font-size: 21px; line-height: 1.15; }
.hero-fact.is-next-action { border-color: var(--gold); border-left: 5px solid var(--gold); background: var(--surface-2); }
.hero-fact.is-next-action strong { font-family: inherit; font-size: 18px; line-height: 1.2; }
.hero-fact.start-here { border-color: color-mix(in srgb, var(--gold) 72%, var(--line)); border-left: 5px solid var(--gold); background: var(--surface-2); box-shadow: none; }
.hero-fact.start-here strong { font-size: 27px; }
.hero-fact[data-party] { border-color: var(--party-colour); background: color-mix(in srgb, var(--party-colour) 13%, var(--surface)); box-shadow: inset 5px 0 0 var(--party-colour); }
.hero-fact[data-party] strong { width: fit-content; margin-top: 7px; padding: 7px 10px; border-radius: 6px; background: var(--party-colour); color: var(--party-ink); font-family: inherit; font-size: 18px; font-weight: 900; line-height: 1.1; }
.scenario-controls { display: grid; gap: 8px; margin-top: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.scenario-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 820; }
.scenario-controls input, .scenario-controls select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.result-details { display: grid; gap: 6px; margin-top: 12px; }
.result-details p { margin: 0; padding: 9px 10px; border-left: 3px solid var(--gold); background: var(--surface-2); color: var(--muted); font-size: 10px; line-height: 1.45; }
.start-guide { display: grid; gap: 7px; margin-top: 12px; }
.start-guide p { min-height: 44px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 9px; margin: 0; padding: 6px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.start-guide strong { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--gold); }
.panel-actions { display: grid; gap: 8px; margin: 14px 0 6px; }
.panel-actions button, .dialog-actions button { min-height: 44px; padding: 7px 12px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 820; text-align: center; }
.panel-actions button:hover:not(:disabled), .dialog-actions button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.panel-actions button:disabled { cursor: not-allowed; opacity: .55; }
.primary-action { border-color: var(--accent) !important; background: var(--accent) !important; color: #fff !important; box-shadow: inset 0 -3px 0 var(--gold); }
.primary-action:hover:not(:disabled) { background: var(--accent-strong) !important; }
.source-line { margin: 16px 0 0; padding: 12px 0 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; line-height: 1.5; }
.source-line a { min-height: 44px; display: flex; align-items: center; width: fit-content; margin-top: 3px; color: var(--accent-strong); font-weight: 850; }
.notice { min-height: 22px; padding: 6px 4px 0; color: var(--warning); font-size: 11px; font-weight: 760; }

.compare-tray { position: relative; z-index: 30; min-height: 96px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: center; margin: 9px 14px 0; padding: 14px 20px; border-top: 4px solid var(--gold); border-radius: 10px; background: var(--accent-strong); color: #fff; }
.compare-slots { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.compare-add-note { width: 150px; min-height: 44px; display: grid; align-content: center; gap: 3px; }
.compare-add-note strong { font-size: 11px; }
.compare-add-note span { color: rgba(255,255,255,.75); font-size: 9px; }
.compare-slot { width: 188px; min-height: 44px; }
.slot-main { display: grid; grid-template-columns: minmax(0, 1fr) 76px; align-items: center; gap: 7px; }
.slot-main strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.slot-link { min-width: 76px; min-height: 44px; border: 1px solid rgba(255,255,255,.75); border-radius: 6px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: 10px; font-weight: 800; }
.tray-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.tray-action { min-height: 48px; border: 1px solid rgba(255,255,255,.76); border-radius: 7px; background: transparent; color: #fff; cursor: pointer; font-size: 11px; font-weight: 880; text-transform: uppercase; }
.tray-done { border-color: var(--gold); background: var(--gold); color: #122b23; }
.tray-share { border-color: rgba(255,255,255,.95); background: rgba(255,255,255,.12); }
.compare-grid { display: grid; gap: 9px; margin-top: 12px; }
.compare-card { padding: 13px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px; background: var(--surface-2); }
.compare-card h3 { margin: 4px 0 0; font-family: var(--display); }
.compare-card small, .compare-card p { color: var(--muted); font-size: 9px; line-height: 1.4; }
.compare-value { display: block; margin-top: 7px; color: var(--accent-strong); font-family: var(--display); font-size: 25px; }
.text-button { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--accent-strong); cursor: pointer; font-size: 10px; font-weight: 820; }
.empty-state { padding: 18px; border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 9px; background: var(--surface); }
.empty-state p { color: var(--muted); line-height: 1.5; }
.empty-state.is-warning { border-left-color: var(--warning); }

.dialog-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(5,24,18,.7); }
.dialog-card { width: min(570px, 100%); padding: 25px; border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: 12px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.38); }
.dialog-card h2 { margin: 8px 0; font-family: var(--display); font-size: 30px; }
.dialog-card > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.theme-grid button { min-height: 110px; display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.theme-grid button:hover, .theme-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.theme-grid button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.theme-grid small { color: var(--muted); font-size: 9px; }
.theme-swatch { height: 50px; margin-bottom: 5px; border: 1px solid var(--line); border-radius: 5px; }
.theme-swatch.paper { background: linear-gradient(135deg, #fffdf7 50%, #0b3d2e 50%); }
.theme-swatch.night { background: linear-gradient(135deg, #14251f 50%, #d4a72c 50%); }
.theme-swatch.contrast { background: linear-gradient(135deg, #fff 50%, #000 50%); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.share-field { display: grid; gap: 6px; margin-top: 18px; color: var(--muted); font-size: 10px; font-weight: 800; }
.share-field input { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); }

.trust-page { min-height: calc(100dvh - 82px); padding: clamp(38px, 7vw, 84px) 20px; background: linear-gradient(90deg, var(--accent-strong) 0 12px, transparent 12px); }
.trust-shell { width: min(880px, 100%); margin: 0 auto; }
.trust-shell > small { color: var(--gold); font-weight: 900; letter-spacing: .16em; }
.trust-shell h1 { max-width: 760px; margin: 11px 0 16px; font-family: var(--display); font-size: clamp(38px, 7vw, 68px); line-height: .95; letter-spacing: -.035em; }
.trust-shell .lead { max-width: 700px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.trust-section { margin-top: 30px; padding: 23px; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 9px; background: var(--surface); box-shadow: 0 12px 32px rgba(6,42,32,.08); }
.trust-section h2 { margin: 0 0 8px; font-family: var(--display); }
.trust-section p, .trust-section li { color: var(--muted); line-height: 1.65; }
.trust-section details { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.trust-section summary { min-height: 44px; display: flex; align-items: center; color: var(--accent-strong); cursor: pointer; font-weight: 800; }
.site-footer { min-height: 50px; display: flex; justify-content: space-between; gap: 12px; padding: 8px 20px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 10px; }
.site-footer a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

@media (min-width: 1800px) {
  .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .topic-rail { padding-inline: 18px; }
  .workspace { padding: 11px 20px 15px; }
  .map-and-panel { min-height: 820px; height: calc(100dvh - 258px); grid-template-columns: minmax(0, 1fr) clamp(330px, 15vw, 390px); gap: 16px; }
  .map-stage { min-height: 820px; }
  .panel-title h2 { font-size: 40px; }
}

@media (min-width: 1100px) {
  body[data-compare-open="true"] .map-and-panel { min-height: 320px; height: calc(100dvh - 431px); flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) clamp(460px, 42vw, 620px); }
  body[data-compare-open="true"] .map-stage { min-height: 320px; }
  body[data-compare-open="true"] .compare-results { min-height: 0; }
  body[data-compare-open="true"] .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
  body[data-compare-open="true"] .compare-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, auto); grid-template-rows: repeat(5, auto); align-items: center; gap: 2px 8px; padding: 8px; }
  body[data-compare-open="true"] .compare-card > small:first-child { grid-column: 1; grid-row: 1; }
  body[data-compare-open="true"] .compare-card h3 { grid-column: 1; grid-row: 2; margin: 0; font-size: 16px; line-height: 1.05; }
  body[data-compare-open="true"] .compare-value { grid-column: 1; grid-row: 3; margin: 1px 0 0; font-size: 20px; }
  body[data-compare-open="true"] .compare-card p { grid-column: 1; grid-row: 4; margin: 0; }
  body[data-compare-open="true"] .compare-card > small:last-of-type { grid-column: 1; grid-row: 5; }
  body[data-compare-open="true"] .compare-card .text-button { grid-column: 2; grid-row: 1 / 6; max-width: 104px; padding: 5px; line-height: 1.2; }
}

@media (min-width: 761px) and (pointer: fine), (min-width: 761px) and (min-height: 501px) {
  .map-canvas { padding-bottom: 62px; }
  .map-touch-list { display: none; }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .map-intro { grid-template-columns: minmax(190px, .7fr) minmax(220px, .85fr) minmax(290px, 1.25fr); gap: 14px; }
  .geo-controls { flex-wrap: wrap; }
  .workspace-topline { align-items: flex-start; }
  .map-and-panel { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (min-width: 761px) and (max-width: 950px) {
  .map-intro { grid-template-columns: minmax(210px, .8fr) minmax(280px, 1.2fr); }
  .intro-copy { display: none; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body { min-height: 100dvh; }
  .site-header { position: sticky; top: 0; min-height: 64px; height: 64px; padding: 8px 16px; border-bottom-width: 2px; }
  .brand { min-height: 46px; gap: 12px; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .brand strong { font-size: 17px; line-height: 1.1; }
  .brand small { display: none; }
  .mobile-nav-trigger { min-width: 64px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-left: auto; border: 1px solid color-mix(in srgb, var(--gold) 72%, #fff); border-radius: 7px; background: rgba(255,255,255,.08); color: var(--header-ink); font-size: 11px; font-weight: 850; }
  .primary-nav { position: fixed; z-index: 70; top: 70px; right: 8px; left: 8px; height: auto; display: none; grid-template-columns: repeat(2, 1fr); gap: 5px; margin: 0; padding: 8px; border-color: var(--line); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
  body[data-mobile-nav-open="true"] .primary-nav { display: grid; }
  .nav-link { min-height: 46px; height: 46px; color: var(--ink); }
  .nav-link:hover, .nav-link[aria-expanded="true"], .nav-link.is-active { border-color: var(--gold); background: var(--gold-soft); color: var(--accent-strong); }
  .menu-wrap { display: contents; }
  .menu-popover { position: fixed; z-index: 80; top: 126px; right: 12px; left: 12px; }

  .app-shell { min-height: calc(100dvh - 64px); display: block; }
  .workspace { min-height: 0; height: calc(100dvh - 64px); padding: 0; overflow: hidden; }
  .mobile-map-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .mobile-map-head small, .mobile-map-head strong { display: block; }
  .mobile-map-head small { color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
  .mobile-map-head strong { max-width: 145px; margin-top: 2px; overflow: hidden; font-family: var(--display); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-map-actions { display: flex; gap: 5px; }
  .mobile-map-actions button, .sheet-close { min-width: 44px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--ink); font-size: 10px; font-weight: 820; }
  .map-intro { display: none; }
  body[data-mobile-search-open="true"] .map-intro { position: fixed; z-index: 65; top: 64px; right: 0; bottom: 0; left: 0; min-height: 0; display: block; overflow: auto; margin: 0; padding: 13px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink); }
  body[data-mobile-search-open="true"] .intro-copy { display: none; }
  body[data-mobile-search-open="true"] .quick-fact-field { display: none; }
  body[data-mobile-search-open="true"] .place-search { width: 100%; padding: 0; border: 0; background: transparent; }
  body[data-mobile-search-open="true"] .place-search label { grid-template-rows: 36px 52px; gap: 16px; }
  body[data-mobile-search-open="true"] .place-search input { width: 100%; min-height: 52px; height: 52px; margin: 0; padding: 0 16px; }
  body[data-mobile-search-open="true"] .place-search::before { display: none; }
  body[data-mobile-search-open="true"] .place-search .sheet-close { display: flex; }
  body[data-mobile-search-open="true"] .place-search label > span, body[data-mobile-search-open="true"] #placeSearchHint { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
  body[data-mobile-search-open="true"] .place-search label > span { width: 100%; height: 36px; min-height: 36px; align-self: center; justify-content: flex-start; padding: 0 2px; border: 0; border-bottom: 2px solid var(--gold); border-radius: 0; background: transparent; color: var(--accent-strong); font-size: 11px; font-weight: 950; line-height: 36px; letter-spacing: .1em; word-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
  body[data-mobile-search-open="true"] #placeSearchHint { margin: 12px 0 14px; padding: 8px 10px; border-left: 4px solid var(--gold); background: var(--gold-soft); color: var(--ink); font-size: 11px; font-weight: 800; line-height: 1.5; }
  body[data-mobile-search-open="true"] .place-search-results { position: static; width: 100%; max-height: none; margin: 0; overflow: visible; padding: 6px 0 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  body[data-mobile-search-open="true"] .search-summary { display: none; }
  body[data-mobile-search-open="true"] .sheet-close { position: relative; min-height: 48px; height: 48px; display: block; padding: 0 12px; overflow: visible; color: transparent; line-height: 1; }
  body[data-mobile-search-open="true"] .sheet-close > span { display: none; }
  body[data-mobile-search-open="true"] .sheet-close::after { content: "Show map"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 820; line-height: 1; }
  body[data-mobile-search-open="true"] .search-result-group h2 { margin-bottom: 7px; padding: 7px 8px; }
  body[data-mobile-search-open="true"] .search-result-group button { min-height: 86px; gap: 5px 10px; padding: 11px; overflow: visible; line-height: 1.45; }
  body[data-mobile-search-open="true"] .search-result-group strong { font-size: 12px; line-height: 1.45; }
  body[data-mobile-search-open="true"] .search-result-group span, body[data-mobile-search-open="true"] .search-result-group em { font-size: 11px; line-height: 1.55; }

  .topic-rail, .control-deck { position: fixed; z-index: 60; right: 0; bottom: 0; left: 0; max-height: calc(100dvh - 64px); overflow: auto; transform: translateY(105%); transition: transform .2s ease; border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: 14px 14px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -18px 50px rgba(4,30,21,.28); }
  .topic-rail { min-height: 0; padding: 12px; }
  .control-deck { padding: 12px; }
  body[data-mobile-topics-open="true"] .topic-rail, body[data-mobile-filters-open="true"] .control-deck { transform: translateY(0); }
  .sheet-close { width: 100%; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; border-color: var(--accent); background: var(--accent); color: #fff; }
  .rail-heading { padding: 3px 6px 10px; }
  .rail-heading strong { font-size: 23px; }
  .topic-list { grid-template-columns: 1fr; gap: 5px; }
  .topic-list button { min-height: 48px; border-color: var(--line); color: var(--ink); }
  .topic-list button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--accent-strong); }
  .rail-note { display: none; }
  .workspace-topline { display: grid; gap: 8px; }
  .breadcrumb { min-height: 44px; }
  .geo-controls { width: 100%; display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0; }
  .geo-field, .geo-controls label, #localField, #dataAreaField { width: 100%; min-width: 0; grid-template-rows: 15px 44px; }
  .geo-controls button, .geo-controls select { min-height: 45px; height: 45px; font-size: 12px; }
  .geo-help { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin: 9px 0; padding: 8px; border-left: 3px solid var(--gold); background: var(--surface-2); color: var(--muted); font-size: 11px; }
  .measure-heading { display: none; }
  .measure-list { display: none; }
  .mobile-measure-field { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 820; }
  .mobile-measure-field select { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }

  .map-and-panel { position: relative; min-height: 0; height: calc(100dvh - 122px); display: block; }
  .map-stage { min-height: 0; height: 100%; border-width: 0; border-radius: 0; box-shadow: none; }
  .map-canvas { padding: 54px 8px 62px; }
  .map-svg { min-height: 0; }
  .map-toolbar { top: 7px; right: 7px; width: auto; display: flex; justify-content: flex-end; gap: 8px; }
  .map-zoom-buttons { display: flex; }
  .map-zoom-buttons button + button { border-top: 0; border-left: 1px solid var(--line); }
  .map-toolbar button { min-width: 44px; min-height: 44px; font-size: 16px; }
  .map-reset-button { min-width: 72px !important; padding-inline: 7px; font-size: 8px; }
  .legend, .party-legend { right: 8px; bottom: 8px; left: 8px; max-height: 54px; font-size: 9px; }
  .legend:not(.context-legend) { display: grid; grid-template-columns: minmax(62px, 1fr) auto auto auto; grid-template-rows: auto auto; gap: 3px 7px; overflow: hidden; }
  .legend:not(.context-legend) .legend-title { grid-column: 1 / 2; grid-row: 1; }
  .legend:not(.context-legend) .legend-missing { grid-column: 2; grid-row: 1; }
  .legend:not(.context-legend) .legend-missing-label { grid-column: 3 / 5; grid-row: 1; white-space: nowrap; }
  .legend:not(.context-legend) .legend-gradient { grid-column: 1; grid-row: 2; width: auto; min-width: 62px; }
  .legend:not(.context-legend) .legend-min { grid-column: 2; grid-row: 2; }
  .legend:not(.context-legend) .legend-to { grid-column: 3; grid-row: 2; }
  .legend:not(.context-legend) .legend-max { grid-column: 4; grid-row: 2; white-space: nowrap; }
  .map-touch-list { display: none; }
  .map-touch-list button { min-width: 48px; flex-basis: 48px; }
  .map-instruction { top: 7px; left: 7px; max-width: calc(100% - 214px); display: block; padding: 7px 9px; font-size: 10px; line-height: 1.3; }
  .detail-panel { position: absolute; z-index: 12; right: 7px; bottom: 7px; left: 7px; width: auto; height: auto; max-height: min(30%, 230px); padding: 26px 14px 14px; border-top-width: 5px; border-radius: 14px; box-shadow: 0 -8px 30px rgba(7,48,35,.22); }
  .detail-panel::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; transform: translateX(-50%); border-radius: 99px; background: var(--line); }
  body[data-has-selection="false"] .detail-panel { display: none; }
  body[data-has-selection="true"] .map-canvas { padding: 112px 8px calc(16% + 50px); }
  body[data-has-selection="true"] .map-canvas .map-touch-list { display: none; }
  body[data-has-selection="true"] .legend, body[data-has-selection="true"] .party-legend { top: 62px; bottom: auto; }
  body[data-result-expanded="true"] .detail-panel { top: 7px; max-height: none; }
  body[data-result-expanded="true"] .map-canvas { padding-bottom: 62px; }
  body[data-result-expanded="true"] .legend, body[data-result-expanded="true"] .party-legend { bottom: 8px; }
  .result-sheet-toggle { min-width: 104px; min-height: 44px; display: flex; align-items: center; justify-content: center; margin: 4px 4px 10px auto; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--accent-strong); font-size: 10px; font-weight: 850; }
  .panel-title h2 { font-size: 23px; }
  .panel-title p { font-size: 10px; }
  .hero-fact { margin-top: 10px; padding: 12px; }
  .hero-fact strong { font-size: 26px; }
  .result-details p { font-size: 9px; }
  .source-line { font-size: 9px; }
  .detail-panel:has(input:focus, select:focus) { top: 4px; max-height: calc(100% - 8px); }
  body:has(.detail-panel input:focus, .detail-panel select:focus) .map-canvas .map-touch-list { display: none; }
  .notice { position: absolute; z-index: 15; top: 4px; left: 8px; max-width: calc(100% - 16px); }

  .compare-tray { position: fixed; z-index: 55; right: 7px; bottom: 7px; left: 7px; max-height: calc(100dvh - 70px); display: block; overflow: auto; margin: 0; padding: 11px; }
  .compare-slots { display: grid; grid-template-columns: 1fr; }
  .compare-add-note, .compare-slot { width: 100%; }
  .slot-main { grid-template-columns: minmax(0, 1fr) 80px; }
  .tray-actions { margin-top: 8px; }
  .compare-results { max-height: 58%; }
  .theme-grid { grid-template-columns: 1fr; }
  .theme-grid button { min-height: 78px; grid-template-columns: 62px 1fr; align-items: center; }
  .theme-grid small { grid-column: 2; }
  .theme-swatch { grid-row: 1 / span 2; margin: 0; }
  .dialog-card { padding: 19px; }
  .site-footer { display: none; }
}

@media (max-width: 360px) {
  .mobile-map-head { min-height: 82px; height: 82px; display: grid; grid-template-columns: 1fr; gap: 5px; padding: 5px 7px; }
  .mobile-map-head > div:first-child { min-width: 0; }
  .mobile-map-head small { display: none; }
  .mobile-map-head strong { max-width: none; margin: 0; font-size: 13px; }
  .mobile-map-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .mobile-map-actions button { width: 100%; min-width: 0; padding-inline: 0; overflow: visible; font-size: 9px; white-space: nowrap; }
  .map-and-panel { height: calc(100dvh - 146px); }
  .map-instruction { max-width: calc(100% - 190px); }
  .map-toolbar { width: 150px; display: grid; grid-template-columns: 88px 57px; gap: 5px; }
  .map-zoom-buttons { display: grid; grid-template-columns: repeat(2, 44px); }
  .map-reset-button { width: 57px; }
  .map-reset-button { min-width: 56px !important; }
}

@media (min-width: 361px) and (max-width: 760px) and (max-height: 600px) {
  .mobile-map-head { min-height: 52px; height: 52px; }
  .map-and-panel { height: calc(100dvh - 108px); }
  .detail-panel:has(input:focus, select:focus) { top: 4px; bottom: 4px; max-height: none; }
}

@media (max-width: 760px) and (max-height: 600px) {
  body[data-has-selection="true"] .map-canvas { padding: 82px 6px 112px; }
  body[data-has-selection="true"] .legend, body[data-has-selection="true"] .party-legend { top: 46px; }
  .detail-panel { max-height: min(31%, 176px); }
}

@media (max-width: 360px) and (max-height: 600px) {
  body[data-has-selection="true"] .map-canvas { padding: 50px 6px 148px; }
  body[data-has-selection="true"] .legend, body[data-has-selection="true"] .party-legend { top: auto; bottom: calc(31% + 8px); max-height: 34px; font-size: 8px; }
  body[data-has-selection="true"] .legend:not(.context-legend) > span:first-child,
  body[data-has-selection="true"] .legend:not(.context-legend) > .legend-missing,
  body[data-has-selection="true"] .legend:not(.context-legend) > span:last-child { display: none; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .site-header { position: fixed; top: 0; left: 0; width: 270px; min-height: 48px; height: 48px; padding-block: 0; border-bottom-width: 2px; }
  .brand { min-height: 44px; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .brand strong { font-size: 16px; }
  .mobile-nav-trigger { min-height: 44px; }
  .workspace { height: 100dvh; }
  .mobile-map-head { min-height: 48px; height: 48px; margin-left: 270px; padding-block: 2px; border-bottom: 2px solid var(--gold); background: var(--header); color: var(--header-ink); }
  .mobile-map-head small { color: var(--gold); }
  .mobile-map-head strong { max-width: clamp(82px, 18vw, 180px); color: var(--header-ink); }
  .mobile-map-actions button { border-color: color-mix(in srgb, var(--gold) 64%, #fff); background: rgba(255,255,255,.06); color: var(--header-ink); }
  .map-and-panel { height: calc(100dvh - 48px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(164px, 29%); gap: 4px; }
  body[data-has-selection="false"] .map-and-panel { grid-template-columns: minmax(0, 1fr); }
  body[data-has-selection="false"] .detail-panel { display: none; }
  .map-stage { grid-column: 1; grid-row: 1; }
  .map-canvas, body[data-has-selection="true"] .map-canvas { padding: 6px 64px 40px 6px; }
  .map-canvas .map-touch-list { display: none; }
  .map-toolbar { top: 6px; right: 6px; width: 52px; display: grid; gap: 4px; }
  .map-zoom-buttons { display: grid; }
  .map-zoom-buttons button + button { border-top: 1px solid var(--line); border-left: 0; }
  .map-toolbar button { width: 52px; min-width: 52px; min-height: 44px; }
  .map-reset-button { min-width: 52px !important; width: 52px; padding: 0; }
  .legend, .party-legend, body[data-has-selection="true"] .legend, body[data-has-selection="true"] .party-legend { right: 64px; bottom: 5px; left: 6px; min-height: 30px; max-height: 34px; padding-block: 3px; border-left-width: 3px; }
  .detail-panel { position: relative; inset: auto; grid-column: 2; grid-row: 1; width: auto; height: 100%; max-height: none; padding: 12px 10px; border-radius: 9px 0 0 9px; }
  .detail-panel::before { display: none; }
  .result-sheet-toggle { display: none; }
  .panel-title h2 { font-size: 19px; }
  .hero-fact strong { font-size: 22px; }
  .start-guide { display: none; }
  .compare-results { max-height: none; }
  .detail-panel:has(input:focus, select:focus) { position: absolute; z-index: 20; inset: 4px; width: auto; max-height: none; }
}


/* V47: touch-first tablet layout, flexible text reflow and explicit camera controls. */
.site-header {
  height: auto;
  flex-wrap: wrap;
}
.brand {
  min-width: 0;
  flex: 1 1 300px;
}
.brand > span { min-width: 0; }
.brand strong { overflow-wrap: anywhere; }
.primary-nav {
  min-height: 46px;
  height: auto;
  max-width: 100%;
  flex-wrap: wrap;
}
.nav-link {
  min-height: 44px;
  height: auto;
  padding-block: 8px;
  line-height: 1.2;
  white-space: normal;
}
.quick-fact-field { grid-template-rows: minmax(20px, auto) minmax(48px, auto) minmax(16px, auto); }
.place-search label { grid-template-rows: minmax(20px, auto) minmax(48px, auto); }
.quick-fact-field > span,
.place-search label > span {
  width: auto;
  max-width: 100%;
  height: auto;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.quick-fact-field select,
.place-search input {
  height: auto;
  padding-block: 10px;
}
.quick-fact-field small,
.place-search #placeSearchHint {
  height: auto;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
.geo-field,
.geo-controls label { grid-template-rows: minmax(13px, auto) minmax(44px, auto); }
.geo-controls button,
.geo-controls select {
  height: auto;
  padding-block: 8px;
}
.geo-help {
  position: static;
  width: auto;
  height: auto;
  margin: 6px 0;
  padding: 7px 9px;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.measure-list {
  height: auto;
  flex-wrap: wrap;
  overflow-x: visible;
}
.measure-list button {
  height: auto;
  padding-block: 8px;
  white-space: normal;
}
.map-toolbar { width: auto; }
.map-reset-button {
  width: auto !important;
  min-width: 72px !important;
  height: auto;
  padding: 8px !important;
  line-height: 1.2;
  white-space: normal;
}
.map-instruction { max-width: calc(100% - 230px); }
.panel-actions button,
.dialog-actions button {
  height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .intro-copy { display: none; }
  .map-intro {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }
  .workspace-topline {
    display: grid;
    align-items: start;
    gap: 8px;
  }
  .breadcrumb {
    min-width: 0;
    flex-wrap: wrap;
  }
  .breadcrumb span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .geo-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 0;
  }
  .geo-field,
  .geo-controls label,
  #localField,
  #dataAreaField {
    width: 100%;
    min-width: 0;
  }
  #dataAreaField { grid-column: 1 / -1; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .site-header {
    min-height: 64px;
    height: auto;
  }
  .brand {
    min-width: 0;
    flex: 1 1 180px;
  }
  .brand strong { line-height: 1.3; }
  .mobile-nav-trigger { flex: 0 0 auto; }
  .workspace {
    min-height: calc(100dvh - 64px);
    height: auto;
    overflow: visible;
  }
  .mobile-map-head {
    height: auto;
    flex-wrap: wrap;
  }
  .mobile-map-head > div:first-child {
    min-width: 0;
    flex: 1 1 145px;
  }
  .mobile-map-head strong {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .mobile-map-actions {
    min-width: 0;
    flex: 1 1 210px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mobile-map-actions button,
  .sheet-close {
    height: auto;
    padding-block: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .geo-controls { grid-template-columns: minmax(0, 1fr); }
  .map-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .map-zoom-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(44px, 1fr));
  }
  body[data-has-selection="true"] .map-canvas {
    padding-bottom: calc(min(30dvh, 230px) + 24px);
  }
  .map-instruction { max-width: calc(100% - 214px); }
  .map-reset-button {
    width: 100% !important;
    min-width: 72px !important;
  }
}

@media (max-width: 360px) {
  .mobile-map-head { height: auto; }
  .map-toolbar {
    width: auto;
    grid-template-columns: minmax(0, 1fr);
  }
  .map-reset-button { width: 100% !important; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .site-header { min-height: 48px; height: 48px; flex-wrap: nowrap; }
  .brand { flex: 1 1 160px; }
  .workspace { min-height: 0; height: 100dvh; overflow: hidden; }
  .mobile-map-head { min-height: 48px; height: 48px; flex-wrap: nowrap; }
  .mobile-map-head > div:first-child { flex: 1 1 auto; }
  .mobile-map-actions { display: flex; flex: 0 1 auto; }
  .map-and-panel { height: calc(100dvh - 48px); }
  .map-toolbar { width: 52px; grid-template-columns: minmax(0, 1fr); }
  .map-zoom-buttons { grid-template-columns: minmax(0, 1fr); }
  .map-reset-button { width: 52px !important; min-width: 52px !important; }
  body[data-has-selection="true"] .map-canvas { padding-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}


/* V48 human-first map repair: real movement, readable scale, honest result bar. */
.compact-result-summary { display: none; }
.legend {
  min-height: 54px;
  max-height: none;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  grid-template-rows: auto 9px auto;
  gap: 4px 12px;
  overflow: visible;
  padding: 7px 10px;
}
.legend-heading { grid-column: 1; grid-row: 1; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.legend-heading strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.legend-heading small { flex: 0 0 auto; font-size: 8px; }
.legend-gradient { grid-column: 1; grid-row: 2; width: 100%; height: 9px; }
.legend-values { grid-column: 1; grid-row: 3; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; color: var(--ink); font-size: 9px; }
.legend-values span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-values span:nth-child(2) { text-align: center; }
.legend-values span:last-child { text-align: right; }
.legend-values b { color: var(--muted); font-size: 7px; text-transform: uppercase; letter-spacing: .05em; }
.legend-missing-wrap { grid-column: 2; grid-row: 1 / 4; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.legend-missing-wrap .legend-missing { width: 18px; height: 10px; }
.map-label.is-selected-label { fill: var(--accent-strong); stroke: var(--gold-soft); stroke-width: 7px; }

@media (min-width: 761px) and (max-width: 1100px) {
  .map-label.is-overview { font-size: 20px; stroke-width: 5px; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-canvas,
  body[data-has-selection="true"] .map-canvas,
  body[data-result-expanded="true"] .map-canvas { padding: 58px 6px 6px; }
  .map-svg { touch-action: none; }
  .map-label.is-overview { font-size: 30px; stroke-width: 8px; }
  .map-toolbar { top: 7px; right: 7px; width: auto; display: flex; grid-template-columns: none; align-items: flex-start; gap: 6px; }
  .map-zoom-buttons { display: flex; grid-template-columns: none; }
  .map-reset-button { width: auto !important; min-width: 72px !important; }
  .map-instruction { top: 7px; left: 7px; max-width: calc(100% - 190px); font-size: 9px; line-height: 1.25; }
  .legend,
  body[data-has-selection="true"] .legend,
  body[data-result-expanded="true"] .legend {
    top: auto;
    right: 6px;
    bottom: 6px;
    left: 6px;
    min-height: 56px;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 8px auto;
    gap: 3px 8px;
    overflow: visible;
    padding: 5px 8px;
    font-size: 8px;
  }
  body[data-has-selection="true"] .legend { bottom: 90px; }
  .legend-heading strong { font-size: 9px; }
  .legend-heading small { font-size: 7px; }
  .legend-values { gap: 5px; font-size: 8px; }
  .legend-values b { display: block; font-size: 6px; }
  .legend-missing-wrap { font-size: 7px; }
  .detail-panel {
    position: absolute;
    z-index: 12;
    top: auto;
    right: 6px;
    bottom: 6px;
    left: 6px;
    width: auto;
    height: 78px;
    max-height: 78px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    padding: 8px 8px 8px 12px;
    border-top-width: 4px;
    border-radius: 12px;
  }
  .detail-panel::before { display: none; content: none; }
  .compact-result-summary { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
  .compact-result-copy { min-width: 0; display: grid; gap: 2px; }
  .compact-result-copy small { overflow: hidden; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .03em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
  .compact-result-copy strong { overflow: hidden; color: var(--ink); font-family: var(--display); font-size: 16px; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
  .compact-result-value { color: var(--accent-strong); font-family: var(--display); font-size: 19px; line-height: 1; white-space: nowrap; }
  .compact-result-summary.is-unavailable .compact-result-value { color: var(--ink); font-family: inherit; font-size: 12px; font-weight: 900; }
  .result-sheet-toggle { min-width: 88px; min-height: 48px; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0 9px; font-size: 9px; }
  .detail-panel > .panel-title,
  .detail-panel > .hero-fact,
  .detail-panel > .scenario-controls,
  .detail-panel > .result-details,
  .detail-panel > .panel-actions,
  .detail-panel > .source-line { display: none; }
  body[data-result-expanded="true"] .detail-panel {
    top: 6px;
    bottom: 6px;
    height: auto;
    max-height: none;
    display: block;
    overflow: auto;
    padding: 12px;
  }
  body[data-result-expanded="true"] .compact-result-summary { display: none; }
  body[data-result-expanded="true"] .result-sheet-toggle { margin: 0 0 10px auto; }
  body[data-result-expanded="true"] .detail-panel > .panel-title,
  body[data-result-expanded="true"] .detail-panel > .hero-fact,
  body[data-result-expanded="true"] .detail-panel > .source-line { display: block; }
  body[data-result-expanded="true"] .detail-panel > .scenario-controls,
  body[data-result-expanded="true"] .detail-panel > .result-details,
  body[data-result-expanded="true"] .detail-panel > .panel-actions { display: grid; }
  body[data-has-selection="true"] .corbot-consent-settings { bottom: calc(92px + env(safe-area-inset-bottom)); }
  body[data-result-expanded="true"] .corbot-consent-settings { display: none; }
}

@media (max-width: 360px) {
  .compact-result-summary { gap: 5px; }
  .compact-result-copy strong { font-size: 14px; }
  .compact-result-value { font-size: 16px; }
  .result-sheet-toggle { min-width: 76px; padding-inline: 6px; }
  .legend-missing-wrap { display: none; }
  .legend,
  body[data-has-selection="true"] .legend { grid-template-columns: minmax(0, 1fr); }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-and-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(176px, 30%); gap: 4px; }
  body[data-has-selection="false"] .map-and-panel { grid-template-columns: minmax(0, 1fr); }
  .map-stage { grid-column: 1; grid-row: 1; }
  .map-canvas,
  body[data-has-selection="true"] .map-canvas,
  body[data-result-expanded="true"] .map-canvas { padding: 6px 64px 44px 6px; }
  .map-label.is-overview { font-size: 22px; stroke-width: 6px; }
  .legend,
  body[data-has-selection="true"] .legend,
  body[data-result-expanded="true"] .legend { right: 64px; bottom: 5px; left: 6px; min-height: 34px; grid-template-rows: auto 7px auto; padding: 3px 6px; }
  .detail-panel,
  body[data-result-expanded="true"] .detail-panel {
    position: relative;
    inset: auto;
    grid-column: 2;
    grid-row: 1;
    width: auto;
    height: 100%;
    max-height: none;
    display: block;
    overflow: auto;
    padding: 12px 10px;
    border-radius: 9px 0 0 9px;
  }
  .compact-result-summary,
  .result-sheet-toggle { display: none; }
  .detail-panel > .panel-title,
  .detail-panel > .hero-fact,
  .detail-panel > .source-line { display: block; }
  .detail-panel > .scenario-controls,
  .detail-panel > .result-details,
  .detail-panel > .panel-actions { display: grid; }
  body[data-has-selection="true"] .corbot-consent-settings { bottom: max(10px, env(safe-area-inset-bottom)); }
}


/* V48 R2: the legend and result are real layout rows, never map overlays. */
.map-and-panel { grid-template-rows: minmax(0, 1fr) auto; }
.map-stage { grid-column: 1; grid-row: 1; }
.map-legend-dock { min-width: 0; grid-column: 1; grid-row: 2; }
.map-legend-dock:empty { display: none; }
.map-legend-dock .legend,
.map-legend-dock .party-legend {
  position: relative;
  inset: auto;
  width: 100%;
  margin-top: 7px;
  pointer-events: none;
}
.detail-panel,
.compare-results { grid-column: 2; grid-row: 1 / span 2; }

@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  .workspace { height: calc(100dvh - 92px); min-height: 0; overflow: hidden; }
  .measure-list { height: 50px; flex-wrap: nowrap; overflow-x: auto; }
  .measure-list button { height: 44px; padding-block: 0; white-space: nowrap; }
  .map-and-panel { min-height: 0; height: auto; flex: 1 1 0; }
  .map-stage { min-height: 0; height: auto; }
  .detail-panel,
  .compare-results { height: auto; }
}

@media (min-width: 907px) and (max-width: 1100px) {
  .map-intro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-and-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
  }
  .map-stage { grid-column: 1; grid-row: 1; min-height: 0; height: auto; }
  .map-legend-dock { grid-column: 1; grid-row: 2; padding: 0 6px; background: var(--bg); }
  .map-legend-dock .legend,
  .map-legend-dock .party-legend,
  body[data-has-selection="true"] .map-legend-dock .legend,
  body[data-result-expanded="true"] .map-legend-dock .legend {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 56px;
    max-height: 62px;
    margin: 6px 0 0;
  }
  .map-canvas,
  body[data-has-selection="true"] .map-canvas,
  body[data-result-expanded="true"] .map-canvas { padding: 58px 6px 4px; }
  .detail-panel {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 3;
    width: auto;
    height: 78px;
    max-height: 78px;
    margin: 6px;
  }
  body[data-result-expanded="true"] .detail-panel {
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: 6px;
    left: 6px;
    width: auto;
    height: auto;
    margin: 0;
  }
  body[data-has-selection="true"] .corbot-consent-settings,
  body[data-result-expanded="true"] .corbot-consent-settings { display: none; }
}

@media (max-width: 360px) {
  .mobile-map-head { min-height: 58px; display: flex; grid-template-columns: none; flex-wrap: nowrap; }
  .mobile-map-head > div:first-child { flex: 0 1 74px; }
  .mobile-map-head strong { font-size: 11px; line-height: 1.1; }
  .mobile-map-actions { flex: 1 1 auto; }
  .map-and-panel { height: calc(100dvh - 122px); }
  .map-legend-dock .legend { min-height: 52px; max-height: 56px; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-and-panel { grid-template-columns: minmax(0, 1fr) minmax(176px, 30%); grid-template-rows: minmax(0, 1fr) auto; }
  body[data-has-selection="false"] .map-and-panel { grid-template-columns: minmax(0, 1fr); }
  .map-stage { grid-column: 1; grid-row: 1; }
  .map-legend-dock { grid-column: 1; grid-row: 2; padding: 0 4px 4px; background: transparent; }
  .map-legend-dock .legend,
  body[data-has-selection="true"] .map-legend-dock .legend,
  body[data-result-expanded="true"] .map-legend-dock .legend { min-height: 34px; max-height: 48px; margin: 4px 0 0; }
  .detail-panel,
  body[data-result-expanded="true"] .detail-panel {
    position: relative;
    inset: auto;
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
    height: auto;
    max-height: none;
    margin: 0;
  }
}


/* V48 R3: make the selected desktop map the main event, not the setup form. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  .map-canvas,
  body[data-has-selection="true"] .map-canvas { padding: 8px 70px 8px 10px; }
  body[data-has-selection="true"] .map-intro {
    min-height: 58px;
    grid-template-columns: minmax(250px, .85fr) minmax(340px, 1.15fr);
    gap: 8px;
    padding: 6px 8px 6px 12px;
  }
  body[data-has-selection="true"] .intro-copy { display: none; }
  body[data-has-selection="true"] .quick-fact-field,
  body[data-has-selection="true"] .place-search {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
  }
  body[data-has-selection="true"] .quick-fact-field > span,
  body[data-has-selection="true"] .quick-fact-field > small,
  body[data-has-selection="true"] .place-search label > span,
  body[data-has-selection="true"] .place-search #placeSearchHint { display: none; }
  body[data-has-selection="true"] .quick-fact-field select,
  body[data-has-selection="true"] .place-search input {
    min-height: 44px;
    height: 44px;
    padding-block: 0;
  }
  body[data-has-selection="true"] .quick-fact-field::after { top: 22px; }
  body[data-has-selection="true"] .place-search label { display: block; }
  body[data-has-selection="true"] .place-search::before { top: 11px; left: 15px; }
  body[data-has-selection="true"] .geo-help {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  body[data-has-selection="true"] .measure-heading { display: none; }
  body[data-has-selection="true"] .measure-list {
    min-height: 46px;
    height: 46px;
    padding-block: 1px;
  }
}


/* V48 R4: controls participate in layout, enlarged text grows, and focus is direct. */
.map-stage { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.map-command-bar {
  position: relative;
  z-index: 8;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}
.map-command-bar .map-instruction {
  position: static;
  inset: auto;
  min-width: 0;
  max-width: none;
  flex: 1 1 150px;
  padding: 7px 9px;
  overflow: visible;
  line-height: 1.3;
  white-space: normal;
}
.map-command-bar .map-toolbar {
  position: static;
  inset: auto;
  width: auto;
  flex: 0 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 6px;
}
.map-command-bar .map-zoom-buttons { display: flex; }
.map-command-bar .map-zoom-buttons button + button { border-top: 0; border-left: 1px solid var(--line); }
.map-command-bar .map-reset-button { width: auto !important; min-width: 82px !important; }
.map-canvas,
body[data-has-selection="true"] .map-canvas,
body[data-result-expanded="true"] .map-canvas {
  position: relative;
  inset: auto;
  min-height: 0;
  padding: 6px 10px;
}

@media (min-width: 907px) and (max-width: 1100px) {
  .measure-heading,
  .measure-list { display: none; }
  .mobile-measure-field {
    min-height: 50px;
    display: grid;
    grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 820;
  }
  .mobile-measure-field select {
    width: 100%;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink);
  }
}

@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-has-selection="true"] .geo-help { display: none; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-command-bar { min-height: 58px; flex-wrap: wrap; gap: 5px; padding: 6px 7px; }
  .map-command-bar .map-instruction { flex: 1 1 90px; padding: 5px 7px; font-size: 9px; }
  .map-command-bar .map-toolbar { width: auto; display: flex; flex: 0 1 auto; }
  .map-command-bar .map-zoom-buttons { display: flex; }
  .map-command-bar .map-reset-button { width: auto !important; min-width: 82px !important; }
  .map-canvas,
  body[data-has-selection="true"] .map-canvas,
  body[data-result-expanded="true"] .map-canvas { padding: 4px 6px; }
  .detail-panel {
    min-height: 78px;
    height: auto;
    max-height: none;
    overflow: visible;
    align-self: end;
  }
  .compact-result-copy small,
  .compact-result-copy strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
  body[data-result-expanded="true"] .detail-panel { overflow: auto; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .map-command-bar { min-height: 50px; flex-wrap: nowrap; padding-block: 3px; }
  .map-command-bar .map-instruction { flex-basis: 130px; }
}

/* V48 R7: compared places and shared state must look the same everywhere. */
[data-compare-index="1"] { --compare-colour: #d4a72c; --compare-ink: #17342b; }
[data-compare-index="2"] { --compare-colour: #2474a7; --compare-ink: #fff; }
[data-compare-index="3"] { --compare-colour: #c45137; --compare-ink: #fff; }
[data-compare-index="4"] { --compare-colour: #7654a8; --compare-ink: #fff; }

body[data-compare-open="true"] .map-region:not(.is-compared):not(.is-compare-context) { opacity: .26 !important; filter: grayscale(.28) saturate(.55); }
body[data-compare-open="true"] .map-region.is-compared {
  opacity: 1 !important;
  stroke: var(--compare-colour, var(--gold));
  stroke-dasharray: none;
  stroke-width: 5;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--compare-colour, var(--gold)) 55%, transparent));
}
body[data-compare-open="true"] .map-region.is-compare-context { opacity: 1 !important; stroke: var(--gold); stroke-width: 4; filter: saturate(1.05); }
body[data-compare-open="true"] .climate-point:not(.is-compared) { opacity: .22; }
body[data-compare-open="true"] .climate-point.is-compared { fill: var(--compare-colour, var(--gold)); opacity: 1; }
body[data-compare-open="true"] .map-label:not(.is-compared-label) { opacity: .28; }
body[data-compare-open="true"] .map-label.is-compared-label { fill: var(--compare-colour, var(--accent-strong)); opacity: 1; }
.compare-map-markers, .compare-map-marker { pointer-events: none; }
.compare-map-marker circle {
  fill: var(--compare-colour, var(--gold));
  stroke: var(--surface);
  stroke-width: 5;
  paint-order: stroke;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 3px rgba(5,24,18,.42));
}
.compare-map-marker text {
  fill: var(--compare-ink, #17342b);
  stroke: none;
  font-weight: 950;
  paint-order: normal;
}
.compare-number {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  border: 2px solid color-mix(in srgb, var(--compare-colour, var(--gold)) 72%, var(--surface));
  border-radius: 50%;
  background: var(--compare-colour, var(--gold));
  color: var(--compare-ink, #17342b);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(5,24,18,.22);
}
.slot-main { grid-template-columns: 26px minmax(0, 1fr) 76px; }
.slot-copy { min-width: 0; display: grid; gap: 2px; }
.slot-copy strong, .slot-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-copy small { color: rgba(255,255,255,.78); font-size: 9px; }
.compare-card { position: relative; border-left-color: var(--compare-colour, var(--gold)); }
.compare-card > .compare-number { position: absolute; top: 9px; right: 9px; }
.compare-card h3 { padding-right: 32px; }

.share-summary {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: var(--surface-2);
}
.share-summary > strong { color: var(--accent-strong); font-family: var(--display); font-size: 19px; }
.share-summary > span, .share-summary > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.share-summary ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; padding: 0; list-style: none; counter-reset: shared-place; }
.share-summary li { counter-increment: shared-place; min-height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 10px; font-weight: 800; }
.share-summary li::before { content: counter(shared-place); width: 19px; height: 19px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 8px; }

@media (min-width: 1100px) {
  body[data-compare-open="true"] .compare-card > small:first-of-type { grid-column: 1; grid-row: 1; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body[data-compare-open="true"] { overflow-y: auto; }
  body[data-compare-open="true"] .compare-tray {
    position: relative;
    inset: auto;
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin: 6px;
    padding: 8px;
    overflow: hidden;
  }
  body[data-compare-open="true"] .compare-slots { display: flex; flex-wrap: nowrap; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
  body[data-compare-open="true"] .compare-add-note { min-width: 132px; flex: 0 0 132px; }
  body[data-compare-open="true"] .compare-slot { width: 188px; min-width: 188px; flex: 0 0 188px; }
  body[data-compare-open="true"] .slot-main { grid-template-columns: 26px minmax(0, 1fr) 62px; }
  body[data-compare-open="true"] .slot-link { min-width: 62px; }
  body[data-compare-open="true"] .tray-actions { margin: 0; }
  body[data-compare-open="true"] .workspace { height: auto; min-height: 0; overflow: visible; }
  body[data-compare-open="true"] .map-and-panel {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(360px, 58dvh) auto auto;
  }
  body[data-compare-open="true"] .map-stage { grid-column: 1; grid-row: 1; height: 58dvh; min-height: 360px; }
  body[data-compare-open="true"] .map-legend-dock { grid-column: 1; grid-row: 2; }
  body[data-compare-open="true"] .compare-results {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 3;
    width: auto;
    height: auto;
    max-height: none;
    display: block;
    margin: 6px;
    overflow: visible;
  }
  body[data-compare-open="true"] .compare-grid { margin-top: 0; }
  body[data-compare-open="true"] .map-canvas { padding: 4px 6px; }
  body[data-compare-open="true"] .map-legend-dock .legend { bottom: auto; }
  body[data-compare-open="true"] .map-command-bar .map-instruction { max-width: none; }
  body[data-compare-open="true"] .map-command-bar .map-reset-button { min-width: 100px !important; }
  .compare-card > .compare-number { top: 8px; right: 8px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions button { flex: 1 1 110px; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body[data-compare-open="true"] .map-and-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(300px, calc(100dvh - 58px)) auto auto; }
  body[data-compare-open="true"] .map-stage { grid-column: 1; grid-row: 1; height: calc(100dvh - 58px); min-height: 300px; }
  body[data-compare-open="true"] .compare-results { grid-column: 1; grid-row: 3; }
}
/* V49 truth, membership, Compare and Share repair */
.account-link{border-color:var(--gold)!important;background:var(--surface)!important;color:var(--ink)!important}
.account-link.is-member{background:var(--accent)!important;color:#fff!important}
.membership-card{width:min(560px,calc(100vw - 28px))}
.membership-card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.membership-card h2{margin:.2rem 0 .45rem;font-size:clamp(1.55rem,4vw,2.15rem)}
.membership-card p{line-height:1.55}
.membership-close{min-width:42px;min-height:42px;border:1px solid var(--line);border-radius:50%;background:transparent;color:var(--ink);font-weight:900}
.membership-benefits{display:grid;gap:7px;margin:16px 0;padding:0;list-style:none}
.membership-benefits li{display:flex;gap:9px;align-items:flex-start}
.membership-benefits li:before{content:'\2713';display:grid;place-items:center;flex:0 0 23px;height:23px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-weight:950}
.google-auth{width:100%;min-height:48px;border:2px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font-weight:900}
.auth-divider{display:flex;align-items:center;gap:10px;margin:14px 0;color:var(--muted);font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.auth-divider:before,.auth-divider:after{content:'';height:1px;flex:1;background:var(--line)}
.email-auth-form{display:grid;gap:10px}
.email-auth-form label{display:grid;gap:5px;color:var(--ink);font-size:.78rem;font-weight:900}
.email-auth-form input{min-height:46px;padding:8px 11px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink)}
.email-auth-form button{min-height:46px}
.auth-mode-switch{width:100%;margin-top:9px;border:0;background:transparent;color:var(--accent);font-weight:850;text-decoration:underline;text-underline-offset:3px}
.account-legal{font-size:.73rem;color:var(--muted)}
.account-status{min-height:23px;margin:10px 0 0!important;font-weight:750}
.account-status[data-tone='error']{color:#a02820}
.account-status[data-tone='success']{color:var(--accent)}
.member-identity{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px;border:2px solid var(--accent);border-radius:10px;background:var(--surface)}
.member-identity span{display:grid;gap:2px}
.member-identity small{color:var(--muted)}
.member-actions{display:grid;grid-template-columns:1fr auto;gap:12px;margin:18px 0}
.member-actions .primary-action{min-height:46px;padding:9px 14px;color:#fff;background:var(--accent);font-weight:900}
.saved-maps-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:22px;padding-top:14px;border-top:1px solid var(--line)}
.saved-maps-head>span{padding:4px 8px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-weight:850}
.saved-maps-list{display:grid;gap:8px;max-height:265px;overflow:auto;margin-top:8px}
.saved-map-empty{padding:14px;border:1px dashed var(--line);border-radius:9px;color:var(--muted)}
.saved-map-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;padding:14px;border:1px solid var(--line);border-radius:9px;background:var(--surface-2)}
.saved-map-row>div{display:grid;gap:2px;min-width:0}
.saved-map-row>div:last-child{display:flex;gap:7px;align-items:center}
.saved-map-row a,.saved-map-row button{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:8px 12px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink);font-weight:850;text-decoration:none}
.share-image-action,.save-map-action{min-height:42px}
.compare-tray{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center}
.compare-tray[hidden]{display:none!important}
.compare-tray:not(.is-open){padding:8px 14px}
.compare-tray:not(.is-open) .compare-slots{display:flex;align-items:center;gap:8px;overflow:auto}
.compare-tray:not(.is-open) .compare-add-note{min-width:max-content}
.compare-tray:not(.is-open) .compare-slot{width:230px;min-width:230px;flex:0 0 230px}
.compare-tray:not(.is-open) .compare-slot .slot-main{padding:7px 8px}
.compare-tray:not(.is-open) .slot-copy small{display:none}
.compare-tray:not(.is-open) .slot-copy strong{overflow:visible;text-overflow:clip;white-space:normal;line-height:1.2}
.compare-tray:not(.is-open) .slot-link{border-color:var(--gold);background:#fff;color:var(--accent-strong)}
.compare-tray:not(.is-open) .tray-actions{display:flex;min-width:max-content}
.compare-tray.is-open{grid-template-columns:1fr;padding:12px 16px}
.election-province-choice{cursor:pointer;stroke:var(--accent);stroke-width:2.2;vector-effect:non-scaling-stroke}
.election-province-choice:hover,.election-province-choice:focus{stroke:#0b3d2e;stroke-width:3;filter:brightness(1.04);outline:none}
.election-province-choice.is-selected{stroke:var(--gold);stroke-width:4}
.election-province-labels .map-label{font-size:16px;font-weight:950}
.election-label-leader{stroke:var(--accent);stroke-width:1.6;stroke-dasharray:4 3;vector-effect:non-scaling-stroke}
.election-province-picker{display:none}
.election-choice-legend{display:grid;gap:3px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.election-choice-legend small{color:var(--muted)}
.election-region{stroke:rgba(255,255,255,.78);stroke-width:.75}
.election-region:hover,.election-region:focus{stroke:#0b3d2e;stroke-width:2}
@media(max-width:760px){
  .account-link{width:100%}
  .compare-tray{grid-template-columns:1fr;gap:7px}
  .compare-tray:not(.is-open){padding:7px 9px}
  .compare-tray:not(.is-open) .compare-slots{width:100%}
  .compare-tray:not(.is-open) .compare-slot{width:210px;min-width:210px;flex-basis:210px}
  .compare-tray:not(.is-open) .tray-actions{width:100%}
  .compare-tray:not(.is-open) .tray-actions button{flex:1}
  .member-actions{grid-template-columns:1fr}
  .saved-map-row{grid-template-columns:1fr}
  .map-canvas:has(.election-province-picker){padding-bottom:225px}
  .election-province-labels{display:none}
  .election-province-picker{position:absolute;z-index:9;right:8px;bottom:68px;left:8px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;padding:6px;border:1px solid var(--line);border-radius:8px;background:color-mix(in srgb,var(--surface) 97%,transparent);box-shadow:0 5px 16px rgba(6,42,32,.09)}
  .election-province-picker button{min-width:44px;min-height:44px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--accent-strong);font-size:11px;font-weight:950}
  .election-province-picker button:hover,.election-province-picker button:focus-visible{border-color:var(--gold);background:var(--gold-soft)}
  body[data-active-metric='federal-result'] .map-legend-dock .election-choice-legend{width:calc(100% - 154px);margin-right:154px}
  body[data-active-metric='federal-result'] .map-legend-dock .election-choice-legend small{display:none}
}
/* V49 R13 owner-feedback repair */
.topic-list button{min-height:50px;padding:0 15px;border-radius:12px;font-size:13px;font-weight:760;letter-spacing:.01em}
.topic-list button[aria-pressed="true"]{box-shadow:inset 4px 0 0 var(--gold),0 7px 20px rgba(0,0,0,.12)}
.measure-list{gap:9px;padding:4px 0 7px}
.measure-list button{min-height:46px;padding:0 17px;border-radius:999px;font-size:12px;font-weight:780;letter-spacing:.005em}
.measure-list button[aria-pressed="true"]{box-shadow:inset 0 -3px 0 var(--gold),0 5px 14px rgba(6,42,32,.12)}
.measure-list button:disabled{cursor:not-allowed;opacity:.58;background:var(--surface-2)}
body[data-has-selection="true"] .map-intro{min-height:94px;grid-template-columns:minmax(270px,.85fr) minmax(360px,1.15fr)}
body[data-has-selection="true"] .map-intro .intro-copy{display:none}
body[data-compare-open="true"] .map-intro{display:none}
body[data-compare-open="true"] .map-and-panel{height:calc(100dvh - 242px);min-height:520px;flex:1 1 auto}
body[data-compare-open="true"] .map-stage{min-height:520px}
.panel-share-action,.compare-share-action{border-color:#b68813!important;background:var(--gold)!important;color:#17342b!important;box-shadow:inset 0 -3px 0 rgba(11,61,46,.28);font-weight:950!important}
.panel-share-action:hover,.compare-share-action:hover{background:#e6bf4c!important}
.compare-panel-tools{position:sticky;z-index:4;top:-19px;display:grid;grid-template-columns:minmax(0,1fr) repeat(3,auto);gap:7px;margin:-19px -18px 15px;padding:12px 14px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--surface) 96%,transparent);backdrop-filter:blur(8px)}
.compare-panel-tools strong{align-self:center;color:var(--accent-strong);font-size:13px}
.compare-panel-tools button{min-height:44px;padding:7px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);cursor:pointer;font-size:11px;font-weight:850}
.source-line.r13-source{display:flex;flex-wrap:wrap;align-items:center;gap:7px 10px;padding-top:10px;font-size:10px}
.source-line.r13-source a{min-height:40px;margin:0 0 0 auto}
.source-chip{display:inline-flex;align-items:center;min-height:30px;padding:4px 9px;border-radius:999px;background:var(--accent-soft);color:var(--accent-strong);font-weight:900}
.election-level-tabs{display:flex;gap:9px;min-height:48px;align-items:center}
.election-level-tabs button{min-width:116px}
.election-level-tabs button span{display:block;margin-top:2px;font-size:8px;font-weight:700;opacity:.74}
.election-national-outline{pointer-events:none;fill:none;stroke:color-mix(in srgb,var(--ink) 82%,#fff);stroke-width:2.1;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.election-national-map .election-region{stroke:rgba(255,255,255,.68);stroke-width:.55}
.election-national-map .election-region:hover,.election-national-map .election-region:focus{stroke:#112e25;stroke-width:2.2}
.election-national-legend{max-height:62px}
.national-election-summary{display:grid;gap:13px}
.national-election-summary .panel-title h2{font-size:32px}
.election-history-badge{display:inline-flex;width:max-content;min-height:32px;align-items:center;padding:5px 10px;border-radius:999px;background:var(--gold-soft);color:var(--accent-strong);font-size:10px;font-weight:900}
.election-seat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.election-seat{display:grid;grid-template-columns:12px 1fr auto;gap:8px;align-items:center;padding:10px;border:1px solid var(--line);border-radius:9px;background:var(--surface-2);font-size:10px}
.election-seat i{width:12px;height:12px;border-radius:50%}
.election-seat strong{font-size:18px}
.proof-mode-banner{display:flex;align-items:flex-start;gap:10px;margin:0 0 16px;padding:12px 14px;border:1px solid var(--gold);border-radius:10px;background:var(--gold-soft);color:#17342b;font-size:12px;line-height:1.45}
.proof-mode-banner strong{display:block;margin-bottom:2px}
.proof-mode-banner:before{content:"DEMO";flex:0 0 auto;padding:4px 7px;border-radius:999px;background:var(--accent);color:#fff;font-size:8px;font-weight:950;letter-spacing:.08em}
.share-card{width:min(940px,calc(100vw - 28px));max-height:calc(100dvh - 28px);overflow:auto;padding:0;border-top:0}
.share-card-head{position:sticky;z-index:4;top:0;display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:22px 24px 18px;border-top:5px solid var(--gold);border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--surface) 97%,transparent);backdrop-filter:blur(9px)}
.share-card-head small{display:block;color:var(--gold);font-size:9px;font-weight:950;letter-spacing:.16em}
.share-card-head h2{margin:6px 0 3px;font-size:30px}
.share-card-head p{margin:0;color:var(--muted);font-size:12px}
.share-close{min-width:44px;min-height:44px;border:1px solid var(--line);border-radius:50%;background:var(--surface);color:var(--ink);font-weight:950}
.share-layout{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(290px,.88fr);gap:22px;padding:22px 24px}
.share-preview-column,.share-tools-column{min-width:0}
.share-section-label{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;color:var(--accent-strong);font-size:11px;font-weight:900}
.share-preview-frame{min-height:280px;display:grid;place-items:center;padding:14px;overflow:hidden;border:1px solid var(--line);border-radius:14px;background:linear-gradient(145deg,#dcebf0,#c5ded5)}
.share-preview-frame img{display:block;max-width:100%;max-height:440px;border-radius:8px;box-shadow:0 14px 34px rgba(6,42,32,.22);object-fit:contain}
.share-preview-frame[data-format="story"] img{height:440px;width:auto}
.share-preview-status{min-height:22px;margin:7px 0 0;color:var(--muted);font-size:10px}
.share-format-options{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-bottom:17px}
.share-format-options button{min-height:58px;padding:7px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);cursor:pointer;font-size:10px;font-weight:850}
.share-format-options button span{display:block;margin-top:2px;color:var(--muted);font-size:8px;font-weight:700}
.share-format-options button[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-soft);box-shadow:inset 0 0 0 2px var(--accent)}
.social-share-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:17px}
.social-share-grid button{min-height:50px;display:flex;align-items:center;justify-content:flex-start;gap:9px;padding:8px 11px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);cursor:pointer;font-size:11px;font-weight:850}
.social-share-grid button:hover{border-color:var(--accent);background:var(--accent-soft)}
.social-icon{width:28px;height:28px;display:grid;place-items:center;flex:0 0 28px;border-radius:8px;color:#fff;font-family:Arial,sans-serif;font-size:15px;font-weight:950;line-height:1}
.social-icon.facebook{background:#1877f2}.social-icon.instagram{background:linear-gradient(135deg,#f9ce34,#ee2a7b 52%,#6228d7)}.social-icon.x{background:#111}.social-icon.linkedin{background:#0a66c2}.social-icon.whatsapp{background:#25d366}.social-icon.native{background:var(--accent)}
.share-summary{margin-bottom:13px;padding:12px;border:1px solid var(--line);border-left:4px solid var(--gold);border-radius:9px;background:var(--surface-2)}
.share-field{margin-top:0}
.share-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.share-actions button{width:100%;min-height:46px}
.share-image-action{grid-column:1/-1}
.share-help{margin:10px 0 0;color:var(--muted);font-size:10px;line-height:1.45}

@media(min-width:1100px){
  body[data-compare-open="true"] .map-and-panel{grid-template-columns:minmax(0,1fr) clamp(430px,37vw,580px)}
}
@media(max-width:900px){
  .share-layout{grid-template-columns:1fr}
  .share-preview-frame img{max-height:360px}
  .share-preview-frame[data-format="story"] img{height:360px}
}
@media(max-width:760px){
  .topic-list button{font-size:14px}
  .measure-list button{font-size:12px}
  .compare-panel-tools{position:relative;top:auto;grid-template-columns:1fr 1fr;margin:-19px -18px 12px}
  .compare-panel-tools strong{grid-column:1/-1}
  .compare-panel-tools button{width:100%}
  .share-card{width:100%;height:100dvh;max-height:none;border-radius:0}
  .share-card-head{padding:14px 14px 12px}
  .share-card-head h2{font-size:24px}
  .share-layout{gap:16px;padding:15px 14px 24px}
  .share-preview-frame{min-height:220px;padding:10px}
  .share-preview-frame img{max-height:300px}
  .share-preview-frame[data-format="story"] img{height:300px}
  .share-format-options{grid-template-columns:1fr}
  .share-format-options button{min-height:48px;text-align:left;padding:8px 12px}
  .share-format-options button span{display:inline;margin-left:5px}
  .social-share-grid{grid-template-columns:1fr 1fr}
  .share-actions{grid-template-columns:1fr}
  .share-image-action{grid-column:auto}
  .election-level-tabs{display:grid;grid-template-columns:repeat(3,1fr);width:100%}
  .election-level-tabs button{min-width:0;padding:0 8px}
  .election-seat-grid{grid-template-columns:1fr}
}
@media(max-width:380px){
  .social-share-grid{grid-template-columns:1fr}
  .share-card-head p{display:none}
}
.map-svg .national-land-underlay {
  fill: var(--map-missing);
  stroke: color-mix(in srgb, var(--ink) 34%, transparent);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.map-svg.north-up-land-map .election-national-outline {
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}


/* V49 R20: compact desktop chrome and collapsible map tools. */
.desktop-search-tools { display: contents; }
.desktop-search-toggle { display: none; }
.map-page > .site-footer { display: none; }

@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  .site-header {
    min-height: 68px;
    height: 68px;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 7px 18px;
    border-bottom-width: 3px;
  }
  .brand { min-height: 48px; flex: 0 1 auto; gap: 14px; }
  .brand-mark { width: 46px; height: 46px; flex-basis: 46px; }
  .brand strong { font-size: 22px; }
  .brand small { margin-top: 4px; font-size: 9px; }
  .primary-nav { min-height: 42px; height: 42px; flex-wrap: nowrap; }
  .nav-link { min-height: 34px; height: 34px; padding: 6px 11px; }
  .app-shell { min-height: calc(100dvh - 68px); grid-template-columns: 210px minmax(0, 1fr); }
  .topic-rail { min-height: calc(100dvh - 68px); overflow-y: auto; padding: 14px 12px; }
  .rail-heading { padding: 0 8px 11px; }
  .rail-heading strong { margin-top: 5px; font-size: 21px; }
  .topic-list { gap: 5px; }
  .topic-list button { min-height: 45px; padding-inline: 13px; font-size: 12px; }
  .rail-note { margin-top: 14px; padding: 11px; }
  .workspace { min-height: 0; height: calc(100dvh - 68px); padding: 8px 14px 10px; overflow: hidden; }
  .map-intro {
    min-height: 54px;
    height: 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    padding: 5px 7px 5px 14px;
    border-left-width: 4px;
    box-shadow: 0 4px 14px rgba(6,42,32,.07);
  }
  .intro-copy { min-width: 0; display: flex; align-items: baseline; gap: 11px; }
  .intro-copy > small { flex: 0 0 auto; font-size: 8px; }
  .intro-copy > p { min-width: 0; margin: 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .map-intro h1 { flex: 0 0 auto; margin: 0; font-size: 19px; line-height: 1; }
  .desktop-search-toggle {
    min-width: 152px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 13px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background: var(--gold-soft);
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
  }
  .desktop-search-toggle:hover { background: var(--gold); color: #17342b; }
  .desktop-search-toggle i { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .16s ease; }
  .desktop-search-toggle[aria-expanded="true"] i { transform: translateY(2px) rotate(225deg); }
  .desktop-search-tools { display: none; }
  body[data-desktop-search-open="true"] .map-intro {
    min-height: 106px;
    height: 106px;
    grid-template-columns: minmax(250px, .82fr) minmax(340px, 1.18fr) auto;
    gap: 8px;
    padding: 7px 8px 7px 10px;
  }
  body[data-desktop-search-open="true"] .intro-copy { display: none; }
  body[data-desktop-search-open="true"] .desktop-search-tools { display: contents; }
  body[data-desktop-search-open="true"] .quick-fact-field { grid-column: 1; }
  body[data-desktop-search-open="true"] .place-search { grid-column: 2; }
  body[data-desktop-search-open="true"] .desktop-search-toggle { grid-column: 3; }
  body[data-desktop-search-open="true"] .quick-fact-field,
  body[data-desktop-search-open="true"] .place-search { padding: 6px 8px; }
  body[data-desktop-search-open="true"] .quick-fact-field { grid-template-rows: 18px 44px 14px; gap: 3px; }
  body[data-desktop-search-open="true"] .place-search label { grid-template-rows: 18px 44px; gap: 3px; }
  body[data-desktop-search-open="true"] .quick-fact-field > span,
  body[data-desktop-search-open="true"] .place-search label > span { min-height: 18px; line-height: 18px; }
  body[data-desktop-search-open="true"] .quick-fact-field select,
  body[data-desktop-search-open="true"] .place-search input { min-height: 44px; height: 44px; padding-block: 7px; }
  body[data-desktop-search-open="true"] .quick-fact-field::after { top: 49px; }
  body[data-desktop-search-open="true"] .place-search::before { top: 38px; }
  body[data-desktop-search-open="true"] .place-search #placeSearchHint { min-height: 14px; margin-top: 3px; line-height: 14px; }
  .control-deck { padding-inline: 2px; }
  .workspace-topline { min-height: 48px; align-items: center; gap: 10px; }
  .breadcrumb { min-height: 38px; }
  .breadcrumb button { min-height: 38px; }
  .geo-controls { align-items: center; }
  .geo-field,
  .geo-controls label { grid-template-rows: 11px 38px; gap: 2px; }
  .geo-controls button,
  .geo-controls select { min-height: 38px; height: 38px; padding-block: 5px; }
  .geo-help { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  body[data-desktop-search-open="false"] .measure-heading,
  body[data-desktop-search-open="false"] .measure-list { display: none; }
  body[data-desktop-search-open="true"] .measure-heading { min-height: 22px; padding-top: 2px; }
  body[data-desktop-search-open="true"] .measure-list { min-height: 0; height: auto; flex-wrap: wrap; overflow: visible; padding: 2px 0 4px; }
  body[data-desktop-search-open="true"] .measure-list button { min-height: 40px; height: 40px; padding: 6px 13px; }
  .map-and-panel { min-height: 0; height: auto; flex: 1 1 0; }
  .map-stage { min-height: 0; height: auto; }
  .map-command-bar { min-height: 52px; padding: 4px 6px; }
  .notice { min-height: 18px; padding-top: 4px; }
}

@media (min-width: 761px) and (max-width: 1100px) and (pointer: fine) {
  .site-header { padding-inline: 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .brand strong { font-size: 19px; }
  .brand small { display: none; }
  .nav-link { padding-inline: 8px; font-size: 11px; }
  .app-shell { grid-template-columns: 186px minmax(0, 1fr); }
  .intro-copy > p { display: none; }
  body[data-desktop-search-open="true"] .map-intro { grid-template-columns: minmax(205px, .82fr) minmax(255px, 1.18fr) auto; }
  body[data-desktop-search-open="true"] .desktop-search-toggle { min-width: 52px; width: 52px; padding: 0; }
  body[data-desktop-search-open="true"] .desktop-search-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .geo-field,
  .geo-controls label { min-width: 128px; }
  #dataAreaField { min-width: 190px; }
}


/* V49 R21: wide-screen map fit and final chrome polish. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  .site-header { min-height: 62px; height: 62px; padding-block: 6px; }
  .brand { min-height: 44px; }
  .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .brand strong { font-size: 21px; }
  .primary-nav { min-height: 40px; height: 40px; }
  .nav-link { min-height: 32px; height: 32px; padding-block: 5px; }
  .app-shell { min-height: calc(100dvh - 62px); }
  .topic-rail { min-height: calc(100dvh - 62px); }
  .workspace { height: calc(100dvh - 62px); }
  .map-intro { min-height: 50px; height: 50px; }
  .map-intro h1 { font-size: 18px; }
  .desktop-search-toggle { min-height: 40px; }
  body[data-desktop-search-open="true"] .map-intro { min-height: 104px; height: 104px; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.map-page .corbot-consent-settings {
    right: 8px;
    bottom: max(126px, calc(126px + env(safe-area-inset-bottom)));
    min-height: 28px;
    padding: 0 10px;
    font-size: 9px;
    opacity: .72;
  }
}


/* V49 R22: collision-free labels, readable legend, and in-menu privacy control. */
.map-page .corbot-consent-settings { display: none; }
.menu-popover button[data-corbot-privacy-settings] {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 760;
}
.menu-popover button[data-corbot-privacy-settings]:hover { background: var(--accent-soft); color: var(--accent-strong); }

@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  .desktop-search-toggle[aria-expanded="true"] i { transform: translateY(-1px) rotate(225deg); }
  .legend-heading strong { font-size: 11px; }
  .legend-heading small { font-size: 9px; }
  .legend-values { font-size: 10px; }
  .legend-values b { font-size: 8px; }
  .legend-missing-wrap { font-size: 9px; }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (min-height: 501px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .legend-heading strong { font-size: 10px; }
  .legend-values { font-size: 9px; }
  .legend-values b { font-size: 7px; }
  .legend-missing-wrap { font-size: 8px; }
}


/* V49 R23: the compact tools state stays consistent after selection and in Compare. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-has-selection="true"][data-desktop-search-open="false"] .map-intro,
  body[data-compare-open="true"][data-desktop-search-open="false"] .map-intro {
    min-height: 50px;
    height: 50px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 5px 7px 5px 14px;
  }
  body[data-has-selection="true"][data-desktop-search-open="false"] .intro-copy,
  body[data-compare-open="true"][data-desktop-search-open="false"] .intro-copy { display: flex; }
  body[data-compare-open="true"][data-desktop-search-open="true"] .map-intro { display: grid; }
  body[data-compare-open="true"] .map-and-panel { min-height: 0; height: auto; flex: 1 1 0; }
  body[data-compare-open="true"] .map-stage { min-height: 0; }
}


/* V49 R24: give wide-screen geography controls deliberate breathing room. */
@media (min-width: 1500px) {
  .workspace-topline .geo-controls { gap: 14px; }
  .workspace-topline .province-field { min-width: 190px; }
  .workspace-topline #localField { width: 230px; }
}


/* V49 R25: one aligned, restrained control system for expanded desktop tools. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-desktop-search-open="true"] .map-intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 160px;
    gap: 12px;
    padding-inline: 10px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field,
  body[data-desktop-search-open="true"] .place-search {
    padding: 7px 10px;
    border-width: 1px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field select,
  body[data-desktop-search-open="true"] .place-search input { box-shadow: none; }
  body[data-desktop-search-open="true"] .quick-fact-field select { padding-inline: 12px 36px; }
  body[data-desktop-search-open="true"] .place-search input { padding-inline: 36px 14px; }
  body[data-desktop-search-open="true"] .quick-fact-field::after { top: 50px; right: 24px; font-size: 12px; }
  body[data-desktop-search-open="true"] .place-search::before { top: 40px; left: 25px; font-size: 18px; }
  body[data-desktop-search-open="true"] .desktop-search-toggle i {
    width: 7px;
    height: 7px;
    border-right-width: 1.5px;
    border-bottom-width: 1.5px;
  }
}

@media (min-width: 1500px) {
  .workspace-topline .geo-controls {
    display: grid;
    grid-template-columns: repeat(3, 190px) 260px;
    align-items: center;
  }
  .workspace-topline :is(.country-field, .province-field, #localField) {
    width: 190px;
    min-width: 190px;
  }
  .workspace-topline #dataAreaField {
    width: 260px;
    min-width: 260px;
  }
}


/* V49 R26: visible geography controls pack dynamically with no ghost columns. */
@media (min-width: 1500px) {
  .workspace-topline .geo-controls { display: flex; }
}


/* V49 R27: keep every expanded desktop tool inside one real grid row. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-desktop-search-open="true"] :is(.quick-fact-field, .place-search, .desktop-search-toggle) { grid-row: 1; }
  body[data-desktop-search-open="true"] :is(.quick-fact-field, .place-search) { padding: 6px 9px; }
  body[data-desktop-search-open="true"] .quick-fact-field {
    grid-template-rows: 16px 40px 12px;
    gap: 2px;
  }
  body[data-desktop-search-open="true"] .place-search label {
    grid-template-rows: 16px 40px;
    gap: 2px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field > span,
  body[data-desktop-search-open="true"] .place-search label > span {
    min-height: 16px;
    height: 16px;
    line-height: 16px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field select,
  body[data-desktop-search-open="true"] .place-search input {
    min-height: 40px;
    height: 40px;
    padding-block: 5px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field::after { top: 44px; }
  body[data-desktop-search-open="true"] .place-search::before { top: 35px; }
  body[data-desktop-search-open="true"] .place-search #placeSearchHint {
    min-height: 12px;
    height: 12px;
    margin-top: 2px;
    line-height: 12px;
  }
}


/* V49 R28: an open selected-place or Compare strip uses the complete control style. */
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field,
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search {
    padding: 6px 9px;
    border: 1px solid color-mix(in srgb, var(--line) 58%, var(--accent));
    border-radius: 10px;
    background: var(--surface-2);
  }
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field { display: grid; }
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field > span,
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search label > span { display: inline-flex; }
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field > small,
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search #placeSearchHint { display: block; }
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search label { display: grid; }
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field select,
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search input {
    min-height: 40px;
    height: 40px;
    padding-block: 5px;
  }
  body[data-has-selection="true"][data-desktop-search-open="true"] .quick-fact-field::after { top: 44px; }
  body[data-has-selection="true"][data-desktop-search-open="true"] .place-search::before { top: 35px; left: 25px; }
}


/* V49 R29: narrow desktop gives useful controls space, not an empty icon column. */
@media (min-width: 761px) and (max-width: 1100px) and (pointer: fine) {
  body[data-desktop-search-open="true"] .map-intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
    gap: 8px;
  }
  body[data-desktop-search-open="true"] .desktop-search-toggle {
    width: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 50%;
  }
  body[data-desktop-search-open="true"] .quick-fact-field {
    grid-template-rows: 16px 40px;
  }
  body[data-desktop-search-open="true"] .quick-fact-field > small,
  body[data-desktop-search-open="true"] .place-search #placeSearchHint { display: none; }
  body[data-desktop-search-open="true"] .place-search input { font-size: 11px; }
}

/* Overnight review: persistent facts, honest content height, readable actions.
   This changes framing only, not R31's source coordinates/projection. */
.map-page .workspace { height: auto; min-height: 0; overflow: visible; }
.persistent-facts { flex: 0 0 auto; min-width: 0; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.persistent-fact-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink); font-size: 14px; font-weight: 700; }
.persistent-fact-picker select { min-width: 0; max-width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--ink); border-radius: 7px; color: var(--ink); background: var(--surface); font-size: 1rem; }
.persistent-fact-picker small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.fact-row-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.fact-row-tools span { margin-right: auto; }
.fact-row-tools button { min-width: 44px; min-height: 44px; border: 1px solid var(--ink); border-radius: 7px; color: var(--ink); background: var(--surface-2); font-size: 20px; }
body .persistent-facts .measure-list { display: flex !important; flex-wrap: nowrap !important; width: 100%; min-width: 0; height: auto !important; overflow-x: auto !important; overflow-y: hidden; gap: 8px; padding: 7px 4px 10px !important; scroll-padding: 8px; scrollbar-width: auto; }
body .persistent-facts .measure-list button { flex: 0 0 auto; min-height: 44px !important; height: auto !important; max-width: min(28rem, 90vw); white-space: normal; overflow-wrap: anywhere; padding: 9px 13px !important; border: 1px solid var(--ink); border-radius: 20px; color: var(--ink); background: var(--surface-2); font-size: .95rem; line-height: 1.4; }
body .persistent-facts .measure-list button[aria-pressed="true"] { color: var(--surface); background: var(--ink); text-decoration: underline; text-underline-offset: 4px; font-weight: 800; }
.election-scope-note, .comparison-availability { padding: 12px; border-left: 4px solid var(--gold); background: var(--surface-2); color: var(--ink); font-size: .95rem; line-height: 1.5; }
.compare-panel-tools .scenario-controls, .compare-panel-tools .comparison-availability, .compare-panel-tools > a { grid-column: 1 / -1; min-width: 0; }
.map-page .map-and-panel { height: auto; min-height: 0; flex: 0 0 auto; align-items: start; }
body.map-page[data-compare-open="true"] .map-and-panel { height: auto; min-height: 0; flex: 0 0 auto; }
body.map-page[data-compare-open="true"] .map-stage { height: auto; min-height: 0; flex-shrink: 0; }
body.map-page[data-compare-open="true"] .compare-panel-tools { position: relative; top: auto; margin: 0 0 12px; }
.map-page .map-stage { height: auto; min-height: 0; display: flex; flex-direction: column; }
.map-page .map-command-bar { position: relative; flex: 0 0 auto; height: auto; min-height: 58px; flex-wrap: wrap; }
.map-page .map-canvas { position: relative; width: 100%; height: auto; min-height: 320px; aspect-ratio: 1.35; flex: 0 0 auto; padding: 14px; }
.map-page .map-canvas > svg { width: 100%; height: 100%; min-height: 0; position: absolute; inset: 0; }
.map-page .detail-panel, .map-page .compare-results { max-height: none; overflow: visible; }
.primary-action, .tray-done, .compare-share-action { background: #0b3d2e !important; color: #ffffff !important; border: 2px solid #0b3d2e !important; opacity: 1 !important; }
:root[data-theme="night"] :is(.primary-action, .tray-done, .compare-share-action) { background: #e1b83e !important; color: #172c23 !important; border-color: #e1b83e !important; }
:is(.primary-action, .tray-done, .compare-share-action):hover { text-decoration: underline; text-underline-offset: 3px; }
:is(.primary-action, .tray-done, .compare-share-action):active { box-shadow: inset 0 0 0 2px currentColor; }
:is(.primary-action, .tray-action, .compare-share-action):disabled { opacity: 1 !important; cursor: not-allowed; border-style: dashed !important; text-decoration: none; }
.tray-action:not(.tray-done) { color: var(--ink); background: var(--surface); border: 1px solid var(--ink); }
:is(.primary-action, .tray-action, .compare-share-action):focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; box-shadow: 0 0 0 3px var(--surface); }
.hero-fact[data-party] > strong { font-weight: 900; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.2; overflow-wrap: anywhere; }
.compact-definition { grid-column: 1 / -1; white-space: normal; font-size: .9rem; line-height: 1.5; }
.election-seat { grid-template-columns: 12px minmax(0,1fr) auto; }
.election-seat > small { grid-column: 2 / -1; color: var(--muted); }
.election-seat > strong { font-size: 1.35rem; font-weight: 900; }
.election-history-badge { max-width: 100%; white-space: normal; }
#nativeShare { display: none !important; }
@media (min-width: 907px), (min-width: 761px) and (pointer: fine) {
  body[data-desktop-search-open="true"] .map-intro { height: auto; min-height: 104px; grid-template-columns: minmax(0, 1fr) auto; }
  body[data-desktop-search-open="true"] .place-search { grid-column: 1; }
  body[data-desktop-search-open="true"] .desktop-search-toggle { grid-column: 2; width: auto; min-width: 110px; border-radius: 8px; padding: 8px; }
  body[data-desktop-search-open="true"] .desktop-search-toggle span { position: static; width: auto; height: auto; clip-path: none; }
  .site-header { height: auto; flex-wrap: wrap; }
  .primary-nav { height: auto; flex-wrap: wrap; }
}
@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .persistent-facts { display: grid; grid-template-columns: minmax(0,1fr) 44px 44px; gap: 6px; margin: 8px; padding: 8px; }
  .persistent-fact-picker { display: block; min-width: 0; grid-column: 1; grid-row: 1; }
  .persistent-fact-picker > span, .fact-row-tools > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .persistent-fact-picker small { display: none; }
  .persistent-fact-picker select { width: 100%; }
  .fact-row-tools { display: contents; }
  .fact-row-tools button { grid-row: 1; }
  .fact-row-tools button:first-of-type { grid-column: 2; }
  .fact-row-tools button:last-of-type { grid-column: 3; }
  body .persistent-facts .measure-list { grid-column: 1 / -1; grid-row: 2; scroll-snap-type: x mandatory; }
  .persistent-facts .election-scope-note { grid-column: 1 / -1; }
  body .persistent-facts .measure-list button { flex-basis: calc((100% - 8px) / 2); min-width: 0; max-width: none; scroll-snap-align: start; }
  .map-page .map-and-panel { display: flex; flex-direction: column; }
  .map-page .map-stage, .map-page .map-legend-dock, .map-page .detail-panel, .map-page .compare-results { position: relative; inset: auto; width: 100%; height: auto; max-height: none; transform: none; }
  body.map-page .map-and-panel :is(.detail-panel, .compare-results) { position: relative; inset: auto; width: 100%; height: auto; max-height: none; transform: none; flex-shrink: 0; }
  .map-page .detail-panel, .map-page .compare-results { padding-bottom: 18px; }
  .map-page .map-canvas { min-height: 320px; aspect-ratio: 1; }
  .map-page .map-legend-dock { flex: 0 0 auto; }
  .mobile-map-head { flex-wrap: wrap; height: auto; }
  .mobile-map-actions { flex-wrap: wrap; }
  .site-header { position: relative; }
}
@media (forced-colors: active) {
  :is(.primary-action, .tray-action, .compare-share-action), body .persistent-facts .measure-list button { forced-color-adjust: auto; background: ButtonFace !important; color: ButtonText !important; border: 2px solid ButtonText !important; }
  body .persistent-facts .measure-list button[aria-pressed="true"] { border-style: double !important; border-width: 4px !important; }
  :is(.primary-action, .tray-action, .compare-share-action):focus-visible { outline: 3px solid Highlight; }
}

/* 5.0.1: direct manipulation and comparison controls in real document flow. */
.map-page .map-canvas { overflow: hidden; isolation: isolate; }
.map-camera-surface { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.map-camera-surface > .map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-svg { overflow: visible; }
.map-svg.is-dragging { cursor: grabbing; }
.map-svg.is-dragging .map-region { transition: none; }
.map-svg.is-dragging * { pointer-events: none !important; }
.selected-compare-action { display: block !important; width: 100%; min-height: 48px; margin: 12px 0; padding: 10px 14px; border-radius: 9px; font: inherit; font-weight: 800; cursor: pointer; }
.party-legend, .party-legend > span, .compact-result-value, .election-seat > span { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.compact-result-value { max-width: 100%; line-height: 1.2; }
.place-search-results .search-place-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: stretch; }
.place-search-results .search-place-row > div { min-width: 0; }
.place-search-results .search-place-row :is(strong, span, em) { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.place-search-results .search-place-row button { min-width: 0; width: 100%; height: 100%; min-height: 48px; margin: 0; }
.place-search-results .search-place-row .search-add { min-width: 60px; align-content: center; justify-items: center; padding: 10px; border-radius: 8px; font-size: 14px; }
.search-place-row [aria-selected="true"] > button { outline: 3px solid var(--ink); outline-offset: -3px; }
.search-compare-tools { display: grid; gap: 8px; padding: 12px 0 0; border-top: 1px solid var(--line); color: var(--ink); }
.search-compare-tools > span { overflow-wrap: anywhere; font-size: 13px; }
.search-compare-tools > button { min-height: 48px; font-weight: 800; }
.map-page .compare-tray { min-width: 0; max-width: 100%; }
.slot-link { min-width: 64px; min-height: 44px; }
.map-page .workspace, .map-and-panel > *, .map-page .detail-panel, .map-page .compare-results { box-sizing: border-box; min-width: 0; }
@media (max-width: 760px), (min-width: 761px) and (max-width: 906px) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.map-page .compare-tray { position: relative; inset: auto; display: grid !important; grid-template-columns: minmax(0,1fr); width: auto; max-height: none; overflow: visible; margin: 12px 8px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  body.map-page .compare-tray[hidden] { display: none !important; }
  body.map-page .compare-tray:not(.is-open) .compare-slots { display: grid; grid-template-columns: minmax(0,1fr); overflow: visible; }
  body.map-page .compare-tray:not(.is-open) .compare-slot { width: auto; min-width: 0; }
  body.map-page .compare-add-note { min-width: 0 !important; }
  body.map-page .tray-actions { display: flex; flex-wrap: wrap; }
  body.map-page .tray-actions > button { flex: 1 1 90px; min-height: 44px; }
  body.map-page .map-and-panel { width: 100%; }
  body.map-page[data-compare-open="true"] .compare-results { margin: 6px 0; }
  body.map-page[data-has-selection="true"] #detailPanel { display: block; }
  body.map-page #detailPanel > .result-sheet-toggle { margin: 8px 0 8px auto; font-size: 13px; }
  body.map-page #detailPanel > .source-line { position: relative; inset: auto; clear: both; }
  .map-page .map-canvas { aspect-ratio: .85; }
  .compact-result-summary { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .compact-result-copy small, .compact-result-copy strong { white-space: normal; overflow: visible; line-height: 1.3; }
  .compact-result-copy small { font-size: 12px; }
  .compact-result-copy strong { font-size: 20px; }
  .compact-result-value { font-size: 24px; }
  .place-search-results .search-summary { font-size: 13px; line-height: 1.3; }
  .place-search-results .search-place-row button { padding: 10px; }
  .place-search-results .search-place-row strong { font-size: 15px; line-height: 1.3; }
  .place-search-results .search-place-row span { font-size: 12px; line-height: 1.3; }
  .place-search-results .search-place-row em { display: block; font-size: 12px; line-height: 1.4; }
  .place-search-results .search-place-row i { display: none; }
  .place-search-results { max-height: min(65dvh, 560px); }
  body[data-mobile-search-open="true"] .place-search label { grid-template-rows: 20px 48px; gap: 6px; }
  body[data-mobile-search-open="true"] .place-search label > span { min-height: 20px; height: 20px; border: 0; line-height: 20px; letter-spacing: .04em; }
  body[data-mobile-search-open="true"] .place-search input { min-height: 48px; height: 48px; }
  body[data-mobile-search-open="true"] #placeSearchHint { margin: 8px 0; padding: 8px; font-size: 12px; line-height: 1.4; font-weight: 500; }
  body[data-mobile-search-open="true"] .search-result-group button { min-height: 64px; }
  body[data-mobile-search-open="true"] #searchClose { width: auto; min-width: 100px; height: 44px; min-height: 44px; margin: 0 0 8px auto; background: var(--ink); border-color: var(--ink); }
  body[data-mobile-search-open="true"] #searchClose::after { color: var(--surface); font-size: 13px; }
}
@media (hover: none) { .map-region:hover:not(.is-selected) { filter: none; stroke-width: 1; } }
@media (prefers-reduced-motion: reduce) { .map-page *, .map-page *::before, .map-page *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
/* Marathon 2026-09-21: the map fills the whole stage at every breakpoint.
   Earlier fixed aspect-ratio boxes left a narrow centre strip on wide panels;
   the camera now matches the panel aspect instead (map.mjs aspectBox). */
.map-page .map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; }
