/* 5.0.39: map-first layout. This stylesheet never transforms map geometry. */
body.map-first [hidden] { display:none !important; }
body.map-first { min-width:0; }
body.map-first .site-header { min-height:64px; height:auto; padding:10px 20px; gap:16px; flex-wrap:wrap; }
body.map-first .brand { flex:0 1 auto; min-width:0; gap:10px; height:auto; }
body.map-first .brand-mark { width:42px; height:42px; object-fit:contain; }
body.map-first .brand > span { display:grid; grid-template-columns:minmax(0,auto) auto; align-items:center; column-gap:10px; min-width:0; }
body.map-first .brand strong { font-size:21px; line-height:1.2; letter-spacing:0; white-space:normal; }
body.map-first .brand small { grid-column:1/-1; line-height:1.4; font-size:12px; }
body.map-first .brand-version { font:700 12px/1.4 system-ui,sans-serif; border:1px solid currentColor; border-radius:4px; padding:2px 5px; }
body.map-first .primary-nav { position:relative; gap:6px; margin-left:auto; }
body.map-first :is(button,select,input,summary) { min-height:44px; }
body.map-first :is(button,select,input,a,summary):focus-visible { outline:3px solid var(--ink); outline-offset:3px; }
body.map-first :is(button,select,input) { max-width:100%; }
body.map-first .place-navigation { display:grid; grid-template-columns:minmax(240px,1fr) minmax(280px,.7fr); gap:6px 16px; padding:6px 16px; border-block:1px solid var(--line); background:var(--surface); color:var(--ink); position:relative; z-index:35; }
body.map-first .place-search { position:relative; width:auto; min-width:0; grid-column:auto; padding:0; background:none; border:0; }
/* The retired icon was positioned below the input, over the Canada hit area. */
body.map-first .place-search::before { content:none; display:none; pointer-events:none; }
body.map-first .place-search label { display:block; height:auto; min-height:0; }
body.map-first .place-search label > span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
body.map-first .place-search input { width:100%; min-width:0; height:44px; padding:10px 14px; font:16px/1.4 system-ui,sans-serif; border:1px solid var(--ink); border-radius:8px; background:var(--surface); color:var(--ink); }
body.map-first #searchClose { display:none; }
body.map-first #placeSearchHint { display:none; }
body.map-first .place-search-results { position:absolute; z-index:70; top:calc(100% + 6px); left:0; right:0; width:auto; max-height:min(65dvh,560px); overflow:auto; padding:12px; background:var(--surface); border:2px solid var(--ink); border-radius:10px; box-shadow:0 12px 32px #0003; }
body.map-first .place-context { display:flex; gap:10px; align-items:center; min-width:0; }
body.map-first .place-context .country-field { flex:0 0 auto; width:auto; min-width:0; }
body.map-first .place-context #countryButton { width:auto; min-width:78px; padding:8px 12px; }
body.map-first .place-context :is(label,.geo-field) { display:flex; gap:8px; align-items:center; min-width:0; margin:0; }
body.map-first .place-context .country-field > span { display:none; }
body.map-first .place-context .province-field { flex:1 1 0; width:auto; min-width:0; }
/* WebKit's native select paint retained its intrinsic width on rotation even
   when the flex box was smaller. Give the real select a bounded grid track and
   an explicit arrow; do not hide page overflow or crop surrounding controls. */
body.map-first .place-context .province-field { display:grid; grid-template-columns:minmax(0,1fr); gap:4px; }
body.map-first .place-context .province-field select { width:100%; min-width:0; appearance:none; -webkit-appearance:none; padding-right:28px; background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%); background-position:calc(100% - 15px) 50%,calc(100% - 10px) 50%; background-size:5px 5px; background-repeat:no-repeat; }
body.map-first .place-context .province-field > span { max-width:none; font-size:11px; }
body.map-first .province-field > span { font-size:12px; max-width:90px; line-height:1.3; }
body.map-first .province-field select { width:100%; min-width:0; padding:8px; font-size:14px; }
body.map-first .app-shell { display:grid; grid-template-columns:252px minmax(0,1fr); min-width:0; max-width:none; }
body.map-first .topic-rail { display:flex; flex-direction:column; min-height:0; height:auto; overflow:visible; padding:14px 12px; background:var(--surface); color:var(--ink); border-right:1px solid var(--line); }
body.map-first .rail-heading { margin:0 0 8px; }
body.map-first .rail-note { display:none; }
body.map-first .topic-list { display:grid; grid-template-columns:1fr; gap:6px; margin:0 0 14px; }
body.map-first .topic-list button { height:auto; padding:10px 12px; text-align:left; color:var(--ink); background:var(--surface-2); font-size:15px; border:1px solid var(--line); border-radius:7px; }
body.map-first .topic-list button[aria-pressed=true] { color:var(--surface); background:var(--ink); font-weight:800; text-decoration:underline; text-underline-offset:4px; }
body.map-first .workspace { display:flex; flex-direction:column; min-width:0; padding:8px 14px; height:auto; }
body.map-first .control-deck { display:block; position:static; transform:none; max-height:none; overflow:visible; padding:0; margin:0 0 8px; border:0; background:none; color:var(--ink); box-shadow:none; }
body.map-first .workspace-topline { display:block; }
body.map-first .geo-controls { display:grid; grid-template-columns:minmax(0,1fr); width:100%; gap:8px; }
body.map-first .geo-controls label { display:grid; gap:4px; font-size:13px; min-width:0; }
/* Override the legacy 24vw district field inside the 223px rail. Bounding
   only the select leaves its parent wider than the actual component. */
body.map-first .geo-controls :is(label,#localField,#dataAreaField) { width:100%; max-width:100%; min-width:0; grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(44px,auto); }
body.map-first .geo-controls select { min-width:0; width:100%; height:auto; font-size:14px; }
body.map-first .geo-controls select { appearance:none; -webkit-appearance:none; padding-right:28px; background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%); background-position:calc(100% - 15px) 50%,calc(100% - 10px) 50%; background-size:5px 5px; background-repeat:no-repeat; }
body.map-first :is(.mobile-measure-field,#filterSheetClose,.measure-heading) { display:none; }
body.map-first .geo-help { display:block; margin:4px 0; font-size:12px; line-height:1.5; color:var(--muted); }
body.map-first .breadcrumb { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:4px; font-size:13px; }
body.map-first .fact-library { min-width:0; border-top:1px solid var(--line); padding-top:12px; }
body.map-first .fact-library > summary { font-size:16px; font-weight:820; padding:9px 0; border-bottom:1px solid var(--line); }
body.map-first .fact-library-body { padding-top:10px; }
body.map-first .fact-library label { display:grid; gap:6px; font-size:13px; }
body.map-first .fact-library input { width:100%; min-width:0; font:16px system-ui,sans-serif; padding:8px; color:var(--ink); background:var(--surface); border:1px solid var(--ink); border-radius:6px; }
body.map-first .fact-library summary { display:flex; align-items:center; cursor:pointer; font-weight:750; font-size:14px; padding:6px 0; }
body.map-first .fact-library summary::before { content:'▸'; margin-right:7px; }
body.map-first .fact-library details[open] > summary::before { content:'▾'; }
body.map-first .fact-library select { width:100%; min-width:0; height:auto; max-height:300px; padding:4px; font:14px/1.5 system-ui,sans-serif; color:var(--ink); background:var(--surface); }
body.map-first .fact-library option { padding:10px 4px; white-space:normal; overflow-wrap:anywhere; }
body.map-first .library-group-list { max-height:320px; overflow:auto; display:grid; gap:4px; padding:4px; }
body.map-first .library-fact { display:grid; text-align:left; padding:10px 8px; gap:4px; height:auto; white-space:normal; overflow-wrap:anywhere; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:4px; }
body.map-first .library-fact strong { font-size:13px; line-height:1.4; }
body.map-first .library-fact small { font-size:11px; color:var(--muted); }
body.map-first .library-fact[aria-pressed=true] { border:2px solid var(--ink); text-decoration:underline; text-underline-offset:3px; }
body.map-first .catalogue-count,body.map-first .source-inventory { font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
body.map-first .source-inventory ul { padding-left:18px; }
body.map-first .source-inventory { max-height:400px; overflow:auto; }
body.map-first .source-gaps { font-size:13px; line-height:1.5; overflow-wrap:anywhere; border-top:1px solid var(--line); }
body.map-first .source-definition-list { max-height:320px; overflow:auto; padding:8px 8px 8px 22px; }
body.map-first .source-definition-list li { margin-bottom:12px; }
body.map-first .persistent-facts { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 10px; margin:0 0 6px; padding:6px 10px; }
body.map-first #activeFactContext { font-weight:750; line-height:1.45; font-size:14px; margin:0; align-self:center; min-width:0; overflow-wrap:anywhere; }
body.map-first .fact-row-tools { display:flex; margin:0; gap:4px; }
body.map-first .fact-row-tools > span { display:none; }
body.map-first .persistent-facts .measure-list { grid-column:1/-1; grid-row:auto; padding:4px 0 !important; margin:0; }
body.map-first .persistent-facts .measure-list button { flex:0 0 auto; width:auto; max-width:min(26rem,85vw); font-size:14px; padding:8px 12px !important; }
body.map-first .election-levels { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:8px; }
body.map-first .election-levels button { padding:8px 12px; border:2px solid var(--ink); border-radius:8px; color:var(--ink); background:var(--surface); font-weight:750; }
body.map-first .election-levels button[aria-pressed=true] { background:var(--ink); color:var(--surface); text-decoration:underline; text-underline-offset:4px; }
body.map-first .election-scope-note { grid-column:1/-1; margin:4px 0; padding:6px 8px; font-size:12px; }
body.map-first .map-and-panel { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto; gap:10px; min-width:0; height:auto; min-height:0; align-items:start; flex:0 0 auto; }
body.map-first .map-stage { width:100%; height:auto; min-height:0; }
body.map-first .map-command-bar { min-height:42px; padding:4px 10px; gap:8px; flex-wrap:wrap; }
body.map-first .map-instruction { max-width:42rem; font-size:12px; line-height:1.4; }
body.map-first .map-toolbar { flex-wrap:wrap; min-width:0; }
body.map-first .map-toolbar button { min-width:44px; width:auto; padding:8px 10px; height:auto; font-size:13px; }
/* The camera may draw beyond its own SVG box while panning. Contain its paint
   at the actual map viewport, not at the document or over adjacent controls. */
body.map-first .map-canvas { aspect-ratio:14/9; height:auto; min-height:340px; padding:0; contain:paint; }
body.map-first .map-label,body.map-first .map-label-name { font-family:system-ui,sans-serif; font-weight:800; }
body.map-first .map-label-name { font-size:inherit !important; }
body.map-first .map-legend-dock { position:static; width:min(100%,340px); max-width:340px; min-width:0; height:auto; padding:0; }
body.map-first .legend { display:grid; grid-template-columns:minmax(0,1fr); width:100%; min-width:0; gap:6px; margin:0; padding:10px 12px; background:var(--surface); color:var(--ink); border:1px solid var(--ink); border-radius:8px; }
body.map-first .legend-heading { display:flex; flex-wrap:wrap; gap:4px 10px; align-items:center; }
body.map-first .legend-heading strong { font-size:13px; }
body.map-first .legend-heading small { font-size:11px; color:var(--muted); }
body.map-first .legend-gradient { display:block; width:100%; height:10px; border:1px solid var(--ink); }
body.map-first .legend-values { display:flex; width:100%; justify-content:space-between; gap:6px; font-size:12px; }
body.map-first .legend-values > span { flex:1; min-width:0; white-space:normal; overflow-wrap:anywhere; }
body.map-first .legend-values b { display:block; font-size:11px; }
body.map-first .legend-missing-wrap { display:flex; gap:6px; align-items:center; font-size:12px; }
body.map-first .legend > * { grid-column:1; grid-row:auto; min-width:0; }
body.map-first .legend-heading strong { white-space:normal; overflow-wrap:anywhere; }
body.map-first .legend-missing { border:1px solid var(--ink); }
body.map-first .party-legend { max-width:340px; display:flex; gap:8px; flex-wrap:wrap; padding:10px; font-size:12px; }
body.map-first .party-legend > strong { flex-basis:100%; }
body.map-first :is(.detail-panel,.compare-results) { position:static; width:100%; min-width:0; max-height:none; height:auto; overflow:visible; transform:none; }
body.map-first #detailPanel:empty { display:none; }
body.map-first .coverage-table { border-collapse:collapse; width:100%; font-size:13px; line-height:1.5; }
body.map-first .coverage-table :is(th,td) { padding:10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; overflow-wrap:anywhere; }
body.map-first .coverage-table caption { text-align:left; padding:10px; font-weight:750; }
body.map-first :is(.primary-action,.tray-done,.compare-share-action,.search-add,.compare-number) { background:#e1b83e !important; color:#172c23 !important; border-color:#172c23 !important; opacity:1 !important; }
body.map-first :is(.primary-action,.tray-done,.compare-share-action):disabled { color:#172c23 !important; border-style:dashed !important; }
body.map-first #nativeShare { display:inline-flex !important; min-height:48px; background:#0b3d2e; color:#fff; padding:10px 14px; font-weight:800; border:2px solid #fff; border-radius:8px; }
body.map-first .mobile-map-head { display:none; }
body.map-first .all-facts-trigger { display:none; }
body.map-first .census-source-notes { font-size:14px; line-height:1.55; margin-top:12px; overflow-wrap:break-word; }
body.map-first .census-source-notes summary { display:flex; align-items:center; cursor:pointer; font-weight:750; }
body.map-first .census-source-notes p { white-space:pre-line; }
@media(min-width:907px) {
  body.map-first .topic-rail { position:sticky; top:8px; align-self:start; max-height:calc(100dvh - 150px); overflow-y:auto; }
}
body.map-first .compare-tray { min-width:0; margin:10px 0 0; }
body.map-first :is(.compare-slots,.tray-actions,.compare-panel-tools,.compare-grid,.panel-actions) { min-width:0; }
body.map-first :is(.compare-card,.compare-slot,.slot-copy,.tray-actions,.panel-actions) { min-width:0; max-width:100%; overflow-wrap:anywhere; }
body.map-first .tray-actions { display:flex; flex-wrap:wrap; }
body.map-first .tray-actions > button { flex:1 1 90px; min-width:0; white-space:normal; }
body.map-first .library-more { width:100%; height:auto; padding:8px; white-space:normal; color:var(--ink); background:var(--surface-2); border:1px solid var(--line); }
body.map-first #profileLoadStatus { grid-column:1/-1; font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
body.map-first #profileLoadStatus button { margin:6px; padding:6px 12px; }
body.map-first .national-profile-fact { font-size:13px; overflow-wrap:anywhere; }
body.map-first .national-profile-fact h2 { font-size:18px; }
body.map-first .national-profile-value { font-size:24px; font-weight:800; }
body.map-first :is(.hero-fact,.result-details,.panel-title,.compare-card) { overflow-wrap:anywhere; }
body.map-first .compare-source-receipt { grid-column:1/-1; grid-row:6; min-width:0; font-size:13px; }
body.map-first .compare-source-receipt summary { cursor:pointer; display:flex; align-items:center; font-weight:750; }
body.map-first .compare-source-receipt p { font-size:13px; line-height:1.5; }
body.map-first .compare-panel-tools { position:static; margin:0 0 12px; padding:8px; display:flex; flex-wrap:wrap; }
body.map-first .compare-panel-tools strong { flex:1 1 160px; min-width:0; overflow-wrap:anywhere; }
body.map-first :is(.slot-copy strong,.compare-card h3) { white-space:normal; overflow-wrap:anywhere; }
@media(min-width:907px) and (max-width:1279px) {
  body.map-first .site-header { flex-wrap:wrap; }
  body.map-first .primary-nav { flex-wrap:wrap; max-width:100%; }
  body.map-first .compare-tray { grid-template-columns:minmax(0,1fr) !important; }
}
@media(min-width:1280px) {
  body.map-first[data-has-selection=true] .map-and-panel { grid-template-columns:minmax(0,1fr) minmax(300px,360px); }
  body.map-first[data-has-selection=true] .map-stage { grid-column:1; grid-row:1; }
  body.map-first[data-has-selection=true] .map-legend-dock { grid-column:1; grid-row:2; }
  body.map-first[data-has-selection=true] :is(.detail-panel,.compare-results) { grid-column:2; grid-row:1/3; }
}
@media(max-width:906px) {
  body.map-first .site-header { padding:8px 12px; min-height:58px; flex-wrap:nowrap; }
  body.map-first .brand strong { font-size:17px; }
  body.map-first .brand-mark { width:32px; height:32px; }
  body.map-first .brand > span { column-gap:6px; }
  body.map-first .brand small { font-size:11px; }
  body.map-first .brand-version { font-size:10px; }
  body.map-first .mobile-nav-trigger { display:block; margin-left:auto; min-width:54px; }
  body.map-first .primary-nav { display:none; }
  body.map-first[data-mobile-nav-open=true] .primary-nav { display:flex; flex-wrap:wrap; position:absolute; z-index:80; top:58px; left:8px; right:8px; padding:12px; background:var(--surface); color:var(--ink); border:1px solid var(--ink); }
  body.map-first .place-navigation { grid-template-columns:minmax(0,1fr); padding:8px 12px; gap:6px; }
  body.map-first .province-field > span { display:none; }
  body.map-first .place-context { gap:8px; }
  body.map-first .app-shell { display:block; }
  body.map-first .workspace { padding:8px; }
  body.map-first .mobile-map-head { display:none; }
  body.map-first .all-facts-trigger { display:block; flex:0 0 auto; padding:8px; font-size:13px; border:1px solid var(--ink); border-radius:7px; color:var(--ink); background:var(--surface-2); }
  body.map-first .mobile-map-head > div:first-child { display:none; }
  body.map-first .mobile-map-actions { width:100%; display:flex; gap:8px; }
  body.map-first .mobile-map-actions button { flex:1; font-size:13px; }
  body.map-first #mobileSearchButton { display:none; }
  body.map-first .topic-rail { display:none; position:fixed; inset:8px; z-index:75; overflow:auto; max-height:calc(100dvh - 16px); border:2px solid var(--ink); border-radius:12px; padding:14px; transform:none; box-shadow:0 0 0 20px #0005; }
  body.map-first:is([data-mobile-topics-open=true],[data-mobile-filters-open=true]) .topic-rail { display:flex; }
  body.map-first .topic-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.map-first #topicDrawerClose { display:block; align-self:flex-end; min-width:110px; }
  body.map-first .control-deck { position:static; transform:none; border:0; }
  body.map-first .persistent-facts { grid-template-columns:minmax(0,1fr) auto; padding:6px 8px; }
  body.map-first .persistent-facts .measure-list button { flex:0 0 calc((100% - 16px)/3); max-width:none; font-size:13px; padding:6px !important; }
  body.map-first .fact-row-tools button { grid-column:auto; grid-row:auto; }
  body.map-first .map-and-panel { display:flex; flex-direction:column; gap:8px; }
  /* Match the source viewBox aspect. The old square added blank sky/sea above
     and below the same uniformly fitted map. No axis or path is stretched. */
  body.map-first .map-canvas { aspect-ratio:14/9; min-height:0; }
  body.map-first .map-instruction,body.map-first .map-camera-status { display:none; }
  body.map-first .map-command-bar { min-height:44px; padding:4px; }
  body.map-first .map-toolbar { width:100%; gap:4px; justify-content:flex-start; }
  body.map-first .map-toolbar button { font-size:12px; padding:6px; }
  body.map-first #detailPanel { padding-bottom:calc(16px + env(safe-area-inset-bottom)); border-radius:12px 12px 0 0; }
  body.map-first .place-search-results .search-place-row em { display:block; }
}
/* Component widths, not document overflow, govern these stacked disclosures.
   Reset legacy fixed legend caps and narrow election grids in every state. */
body.map-first .map-legend-dock :is(.legend,.party-legend),
body.map-first:is([data-has-selection=true],[data-result-expanded=true]) .map-legend-dock :is(.legend,.party-legend) { position:static; inset:auto; height:auto; min-height:0; max-height:none; overflow:visible; width:100%; margin:0; }
body.map-first .map-legend-dock :is(.legend-heading,.legend-values,.legend-missing-wrap) { display:flex; }
body.map-first .map-legend-dock .legend-gradient { display:block; }
body.map-first .map-legend-dock .legend-values span { overflow:visible; text-overflow:clip; }
body.map-first .party-legend { color:var(--ink); font-size:13px; line-height:1.5; }
body.map-first .party-legend > span { flex:1 1 140px; overflow-wrap:normal; word-break:normal; }
body.map-first .party-legend i { flex:0 0 12px; }
body.map-first .election-seat-grid { grid-template-columns:minmax(0,1fr); }
body.map-first .election-seat { font-size:14px; line-height:1.45; grid-template-columns:12px minmax(0,1fr) auto; }
body.map-first .election-seat > span { overflow-wrap:normal; word-break:normal; }
body.map-first .election-seat > small { font-size:13px; }
body.map-first .election-seat > strong { font-size:21px; white-space:nowrap; }
body.map-first :is(.detail-panel,.national-election-summary,.panel-title,.hero-fact,.scenario-controls,.result-details) { min-width:0; max-width:100%; word-break:normal; overflow-wrap:break-word; }
body.map-first .detail-panel :is(select,input) { width:100%; min-width:0; font-size:16px; }
body.map-first :is(.source-line,.source-line.r13-source,.result-details,.panel-title p,.compact-definition,.election-history-badge) { font-size:14px; line-height:1.55; color:var(--ink); }
body.map-first :is(.source-chip,.hero-fact small,.library-fact small,.legend-heading small,.geo-help) { font-size:13px; line-height:1.5; }
body.map-first :is(.panel-title > small,.rail-heading small,.geo-help,.source-geography-selection) { font-size:13px; line-height:1.5; color:var(--ink); letter-spacing:normal; }
body.map-first .source-geography-selection { white-space:normal; overflow-wrap:break-word; }
body.map-first :is(.place-search input,.fact-library input)::placeholder { color:var(--ink); opacity:1; }
body.map-first .coverage-table { display:block; }
body.map-first .coverage-table :is(tbody,tr) { display:block; }
body.map-first .coverage-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
body.map-first .coverage-table tr { padding:12px 0; border-bottom:1px solid var(--line); }
body.map-first .coverage-table :is(th,td) { display:block; padding:4px 0; border:0; overflow-wrap:break-word; }
body.map-first .coverage-table th { font-size:16px; }
body.map-first[data-compare-open=true] .map-label:not(.is-compared-label) { opacity:1; }
:root[data-theme=night] body.map-first .map-label { fill:#fff5df; stroke:#14251f; }
@media(max-width:906px) {
  body.map-first .site-header { padding:6px 8px; min-height:54px; }
  body.map-first .place-navigation { padding:6px 8px; }
  body.map-first .workspace { padding:6px 4px; }
  body.map-first .persistent-facts { margin-bottom:6px; padding:4px 6px; }
  body.map-first .place-context #countryButton { min-width:64px; padding:8px; }
  body.map-first .place-context #countryButton { font-size:14px; }
  body.map-first .map-legend-dock { width:100%; max-width:none; align-self:stretch; }
  body.map-first .place-context .province-field > span { display:none; }
  body.map-first .place-context .province-field select { font-size:13px; }
  body.map-first .map-stage { border-radius:8px; }
  body.map-first .topic-rail { inset:4px; max-height:calc(100dvh - 8px); padding:12px; }
}
/* The results live in a narrow side panel, not a two-card desktop canvas. */
body.map-first[data-compare-open="true"] .compare-grid { grid-template-columns:minmax(0,1fr); gap:12px; }
body.map-first[data-compare-open="true"] .compare-card { display:block; padding:14px; }
body.map-first[data-compare-open="true"] .compare-card h3 { margin:6px 0; font-size:20px; line-height:1.3; word-break:normal; overflow-wrap:break-word; }
body.map-first[data-compare-open="true"] .compare-value { display:block; margin:8px 0; font-size:28px; line-height:1.25; word-break:normal; overflow-wrap:normal; }
body.map-first[data-compare-open="true"] .compare-card :is(small,p) { font-size:13px; line-height:1.5; }
body.map-first[data-compare-open="true"] .compare-card > small { display:block; }
body.map-first[data-compare-open="true"] .compare-card > p { margin:8px 0; }
body.map-first[data-compare-open="true"] .compare-card .text-button { display:inline-flex; align-items:center; max-width:100%; min-height:44px; margin-top:12px; padding:8px 12px; font-size:13px; line-height:1.35; }
body.map-first[data-compare-open="true"] .compare-source-receipt { margin-top:10px; }
body.map-first .place-search-results .search-place-row .search-add { min-width:76px; background:#e1b83e !important; color:#172c23 !important; }
body.map-first .place-search-results .search-place-row .search-add:is(:hover,:focus,:focus-visible,:active) { background:#e1b83e !important; color:#172c23 !important; }
@media(forced-colors:active) {
  body.map-first .place-search-results .search-place-row .search-add,
  body.map-first .place-search-results .search-place-row .search-add:is(:hover,:focus,:focus-visible,:active) { background:ButtonFace !important; color:ButtonText !important; }
  body.map-first :is(button,select,input) { forced-color-adjust:auto; }
  body.map-first :is(.primary-action,.tray-done,.compare-share-action,.search-add) { background:ButtonFace !important; color:ButtonText !important; border-color:ButtonText !important; }
}

/* Let enlarged words determine the control height and wrapping. */
body.map-first .site-header{flex-wrap:wrap}
body.map-first .brand>span{display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px}
body.map-first .brand small{flex-basis:100%}
body.map-first .brand-version{max-width:100%;white-space:normal;overflow-wrap:break-word}
body.map-first .primary-nav{height:auto;min-height:46px}
body.map-first .nav-link{height:auto;min-height:44px;white-space:normal;line-height:1.35}
body.map-first .place-search input{height:auto;min-height:44px;padding:.55em .7em}
body.map-first .persistent-facts{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
body.map-first #activeFactContext{flex:1 1 10em}
body.map-first .persistent-facts .measure-list{display:flex;flex-wrap:wrap;width:100%;overflow:visible}
body.map-first .persistent-facts .measure-list button{flex:0 1 auto;max-width:100%;height:auto;min-height:44px;white-space:normal;line-height:1.4;overflow-wrap:break-word}
body.map-first :is(.all-facts-trigger,.fact-row-tools button,.mobile-nav-trigger){height:auto;white-space:normal;line-height:1.35}
@media(max-width:906px){body.map-first .brand{flex:1 1 11em;max-width:100%}body.map-first .primary-nav{top:100%}body.map-first .persistent-facts .measure-list button{flex-basis:auto;max-width:100%}}
body.map-first .map-legend-dock .legend-values{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,11ch),1fr));gap:8px}
body.map-first .map-legend-dock .legend-values>span{width:auto;max-width:100%;white-space:normal;overflow-wrap:anywhere}
body.map-first .place-context{flex-wrap:wrap}
body.map-first .place-context .province-field{flex:1 1 12em}
body.map-first .place-context .province-field>.selected-region-name{display:block;max-width:100%;font-size:13px;white-space:normal;overflow-wrap:break-word}
body.map-first .persistent-facts .measure-list button{flex:0 0 auto!important;width:max-content!important;max-width:100%;min-width:0;word-break:normal!important;overflow-wrap:break-word!important;white-space:normal!important}
body.map-first .place-context .country-field{gap:4px;flex-wrap:wrap}
body.map-first #usCountryButton{width:auto;min-width:44px;padding:8px;font-size:14px}
body.map-first #usCountryButton[aria-pressed=true]{background:var(--accent);color:var(--surface)}
/* Polish steps (September 2026): the popular-fact chips wrap instead of scrolling, so
   no chip is ever clipped at an edge. The six metrics stay visible. */
body.map-first .persistent-facts .measure-list { flex-wrap: wrap !important; overflow: visible !important; }
@media (max-width: 906px) {
  body.map-first .persistent-facts .measure-list button { flex: 0 0 calc((100% - 16px)/3) !important; width: auto !important; }
}
@media (max-width: 480px) {
  body.map-first .persistent-facts .measure-list button { flex: 0 0 calc((100% - 8px)/2) !important; width: auto !important; }
}
/* Polish steps (September 2026): the map scale stays visible on first paint on desktop
   as a floating card; phones keep the existing in-flow placement below the map. */
@media (min-width: 907px) {
  body.map-first .map-legend-dock { position: fixed; left: 280px; bottom: 16px; z-index: 40; width: min(340px, 30vw); max-height: 44vh; overflow: auto; }
}
/* Polish steps (September 2026): a compact result cue on phones so the selected place
   and value are visible without scrolling; tapping it opens the full sheet. */
.mobile-result-pill { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 65; display: flex; align-items: center; justify-content: center; padding: 12px 16px; border: 1px solid var(--ink); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px #00000038; }
.mobile-result-pill[hidden] { display: none !important; }
@media (min-width: 907px) { .mobile-result-pill { display: none !important; } }
/* Map-hero layout (2026-09-20): keep the full map in the first screen and
   shrink the first-visit consent banner to a slim bar on map pages. */
body.map-first .corbot-consent--inline { padding: 8px 12px; gap: 10px; border-radius: 12px; }
body.map-first .corbot-consent--inline .corbot-consent__copy > p { display: none; }
body.map-first .corbot-consent--inline details { display: none; }
body.map-first .place-navigation { padding-top: 4px; padding-bottom: 4px; }
body.map-first .persistent-facts { padding-top: 4px; padding-bottom: 4px; }
@media (min-width: 907px) {
  body.map-first .map-canvas { height: calc(100vh - 372px); width: min(100%, calc((100vh - 372px) * var(--hm-map-aspect, 1.5556))); margin-inline: auto; min-height: 340px; }
}
@media (max-width: 906px) {
  body.map-first .place-navigation { padding-top: 2px; padding-bottom: 2px; }
  body.map-first #activeFactContext { display: none; }
}
/* Map-hero layout pass 2: cap the map against the measured chrome and compact
   the phone context row so the map reaches the first screen on phones too. */
@media (min-width: 907px) {
  body.map-first .map-canvas { height: calc(100vh - 444px); width: min(100%, calc((100vh - 444px) * var(--hm-map-aspect, 1.5556))); }
}
@media (max-width: 906px) {
  body.map-first .place-navigation { padding: 2px 6px; }
  body.map-first .place-context { flex-wrap: nowrap; gap: 6px; }
  body.map-first .place-context select { max-width: 52vw; }
  body.map-first .persistent-facts { padding-top: 2px; padding-bottom: 2px; }
}
/* Map-hero layout pass 3: on very small phones the map leads and the fact
   chips follow, so the first screen still shows the map in full. */
@media (max-width: 380px) {
  body.map-first .workspace { display: flex; flex-direction: column; }
  body.map-first .workspace > * { order: 2; }
  body.map-first .workspace > .persistent-facts { order: 3; }
  body.map-first .workspace > .map-and-panel { order: 1; }
}
/* Map-hero layout pass 4: keep the map toolbar to one row on very small
   phones so the map still fits the first screen. */
@media (max-width: 380px) {
  body.map-first .map-command-bar { min-height: 40px; padding: 2px; }
  body.map-first .map-toolbar { flex-wrap: nowrap; overflow-x: auto; }
  body.map-first .map-toolbar button { font-size: 11px; padding: 5px 7px; }
}
/* North America view (2026-09-20): the combined continental base renders the
   U.S. states as context and the Canadian provinces as choosable regions; the
   map aspect follows the rendered frame so nothing is ever cropped. */
body.map-first .us-state-context { stroke: var(--map-line); stroke-width: .35; }
body.map-first .na-province { stroke: var(--map-line); stroke-width: .4; }
body.map-first .map-region:focus-visible { outline: none; }
body.map-first .us-state-context:hover { fill: hsl(var(--map-hue) 24% 90%); }

/* North America view: the base .map-label halo (5px surface stroke) already
   keeps the country labels readable; no extra override is applied here. */

/* Night polish (2026-09-20): one visual system for the geography controls,
   the map toolbar, and the instruction strip; the legend sits inside the map
   card. */
@media (min-width: 907px) {
  body.map-first .place-context #countryButton,
  body.map-first .place-context #naCountryButton,
  body.map-first .place-context #usCountryButton {
    min-width: 0; min-height: 44px; padding: 8px 12px; font-size: 14px; line-height: 1;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer;
  }
  body.map-first .place-context :is(#countryButton,#naCountryButton,#usCountryButton)[aria-pressed="true"] {
    background: var(--accent); border-color: var(--accent); color: var(--surface);
  }
  body.map-first .place-context :is(select,input) { min-height: 44px; border-radius: 10px; }
  body.map-first .map-instruction { font-size: 13px; line-height: 1.35; }
  body.map-first .map-toolbar :is(#resetMapButton,#focusMapButton,#backMapButton) {
    border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; min-height: 44px; background: var(--surface); color: var(--ink);
  }
  body.map-first .map-legend-dock { bottom: 34px; }
  body.map-first #topicRail .breadcrumb { margin: 0 0 10px 2px; }
}
/* Night polish: align the region dropdown with the country buttons on
   desktop (the visible field label pushed the select down). */
@media (min-width: 907px) {
  body.map-first .place-context .province-field { display: flex; align-items: center; grid-template-rows: none; }
  body.map-first .place-context .province-field > span { display: none; }
  body.map-first .place-context select { height: 44px; padding-block: 0; }
}
@media (min-width: 907px) {
  body.map-first .map-legend-dock { bottom: 46px; }
}
/* Owner review fixes: pointer feedback on every map region plus a small name
   tip that follows the cursor. The map is the page, so the wheel zooms. */
body.map-first .map-region.is-hover { stroke: var(--accent-strong); stroke-width: 1.6; }
.hm-hover-tip { position: fixed; z-index: 96; max-width: 240px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 12px/1.35 system-ui, sans-serif; box-shadow: 0 6px 18px rgba(6,42,32,.19); pointer-events: none; }
.hm-hover-tip[hidden] { display: none !important; }
/* Owner review fix 2026-09-21: the map must fill the whole stage at every
   breakpoint. The fixed aspect-ratio box (14/9, then 1.35/1/.85 in the older
   sheet) left a narrow centre strip on wide panels; the camera now matches the
   panel aspect (map.mjs aspectBox), so the canvas fills instead. */
body.map-first .map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; padding: 0; contain: paint; }
body.map-first .map-and-panel { grid-template-rows: minmax(0, 1fr); }
/* Map First 2026-09-27: the stage constant includes the measured chrome (header
   + consent bar + navigation + facts row + toolbar) so the whole map, top to
   bottom, stays in the first screen instead of running below the fold. */
body.map-first .map-stage { height: calc(100dvh - 366px); min-height: 380px; }
@media (max-width: 760px) { body.map-first .map-stage { height: calc(100dvh - 250px); min-height: 320px; } }

/* Density pass 2026-09-28 (owner direction: "way less on the screen at the
   same time"): on desktop the rail becomes one slim horizontal strip so the
   map owns the full width and height. No feature is removed: every topic stays
   one visible click, the All facts library and the geography selectors move
   into the strip, and the fact strip stays a single row. */
@media (min-width: 907px) {
  body.map-first .app-shell { display: block; }
  body.map-first .topic-rail { display: flex; flex-direction: row; align-items: center; gap: 6px 12px; width: 100%; height: auto; min-height: 0; padding: 6px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: visible; flex-wrap: nowrap; }
  body.map-first .topic-rail .sheet-close,
  body.map-first .topic-rail .rail-heading,
  body.map-first .topic-rail .rail-note,
  body.map-first .topic-rail .persistent-fact-picker { display: none; }
  body.map-first .topic-list { display: flex; flex-direction: row; align-items: center; gap: 6px; width: auto; height: auto; overflow: visible; flex: 0 0 auto; }
  body.map-first .topic-list button { width: auto; min-width: 0; white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  body.map-first .topic-rail #filterSheet { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-left: auto; padding: 0; border: 0; background: none; flex: 0 0 auto; }
  body.map-first .topic-rail #filterSheet .sheet-close,
  body.map-first .topic-rail #filterSheet .geo-help,
  body.map-first .topic-rail #filterSheet .mobile-measure-field,
  body.map-first .topic-rail #filterSheet .breadcrumb { display: none; }
  body.map-first .topic-rail #filterSheet .workspace-topline { margin: 0; gap: 8px; }
  body.map-first .topic-rail #filterSheet .geo-controls { gap: 6px; }
  body.map-first .topic-rail #filterSheet .geo-controls .geo-field > span,
  body.map-first .topic-rail #filterSheet .geo-controls label > span { display: none; }
  body.map-first .topic-rail #filterSheet button,
  body.map-first .topic-rail #filterSheet select { min-height: 32px; height: 32px; padding: 0 8px; font-size: 12px; }
  body.map-first .topic-rail details.fact-library { margin: 0; }
  body.map-first .topic-rail details.fact-library > summary { display: inline-flex; align-items: center; height: 32px; margin: 0; white-space: nowrap; padding: 0 12px; }
  body.map-first .persistent-facts { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px 12px; padding: 6px 10px; margin: 0 0 6px; }
  body.map-first .persistent-facts .fact-row-tools { display: flex; flex-direction: row; align-items: center; gap: 4px; flex: 0 0 auto; }
  body.map-first .persistent-facts .fact-row-tools > span { display: none; }
  body.map-first .persistent-facts #activeFactContext { margin: 0; font-size: 13px; flex: 0 0 auto; }
  body.map-first .persistent-facts .measure-list { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin-left: auto; flex: 1 1 auto; min-width: 0; }
  body.map-first .corbot-consent--inline { margin: 4px auto 0; }
}
.map-instruction.is-dismissed { display: none; }

/* Density pass 2026-09-28 part 2 (panel review): comparison card opens on
   demand on desktop; phones keep it expanded. Contextual toolbar buttons
   (Focus/Back) are hidden by app.mjs until they can do something. */
body.map-first .headtohead-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.map-first .headtohead-head h2 { margin: 0; }
body.map-first .headtohead-toggle { font-size: 12px; padding: 4px 10px; white-space: nowrap; }
@media (min-width: 907px) { body.map-first .country-headtohead.is-collapsed .headtohead-body { display: none; } }
@media (max-width: 906px) { body.map-first .headtohead-toggle { display: none; } }
/* Density pass 2026-09-28 part 3: the legend/sources dock was viewport-fixed
   at the old 280px sidebar offset, so it sat over land and swallowed map
   clicks. Hug the true corner and let clicks pass through to the map except
   on its links/buttons. */
body.map-first .map-legend-dock { position: fixed; left: 10px; bottom: 10px; top: auto; width: auto; max-width: 340px; pointer-events: none; }
body.map-first .map-legend-dock a,
body.map-first .map-legend-dock button { pointer-events: auto; }
/* Owner review 2026-09-28: the comparison card is open by default; when the
   reader collapses it the column shrinks so the map takes the width. Expanded
   cards are a touch narrower than before. */
@media(min-width:1280px) {
  body.map-first[data-has-selection=true] .map-and-panel { grid-template-columns:minmax(0,1fr) minmax(300px,330px); }
  body.map-first[data-has-selection=true] .map-and-panel:has(.country-headtohead.is-collapsed) { grid-template-columns:minmax(0,1fr) minmax(180px,240px); }
}
/* Owner review 2026-09-28 part 4: on phones the floating dock sat over the
   south of the provinces and could swallow map taps (even navigating to
   Sources). Phones get the dock in flow under the map instead. */
@media (max-width: 906px) {
  body.map-first .map-legend-dock { position: static; left: auto; bottom: auto; margin: 8px 10px 0; width: auto; max-width: none; pointer-events: auto; }
}

/* Density pass 2026-09-28 part 5 (r37 overnight): comparison-card typography
   polish and button cohesion (cycle-37 backlog #3). The card keeps every
   fact, year, source and the honesty note; only the type scale, the loading
   status weight and the control proportions change. */
body.map-first .headtohead-head h2 { flex: 1 1 auto; min-width: 0; letter-spacing: .045em; }
body.map-first .headtohead-toggle { font-size: 11px; line-height: 1; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }
body.map-first .headtohead-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }
body.map-first .country-headtohead { padding: 12px 14px; gap: 7px; }
body.map-first .country-headtohead-row { gap: 12px; }
body.map-first .country-headtohead-row small { flex: 1 1 auto; min-width: 0; }
body.map-first .country-headtohead-row strong { flex: 0 0 auto; max-width: 58%; text-align: right; overflow-wrap: anywhere; }
body.map-first .country-headtohead-row.is-loading strong { font-size: 12px; font-weight: 650; opacity: .75; }
body.map-first .country-headtohead-note { font-size: 12px; line-height: 1.55; opacity: .88; margin: 4px 0 0; }
body.map-first .panel-actions { gap: 7px; margin: 12px 0 2px; }
body.map-first .panel-actions button { min-height: 40px; font-size: 13px; }