/* =============================================================================
   Singapore Electoral Boundaries 2026 — shared MAP-AS-BACKGROUND stylesheet.
   Loaded root-absolute as /assets/app.css on every route
   (/, /data, /scoring, /drawing, /resources).

   LAYOUT MODEL (authoritative): every route is MAP-FIRST with the MAP AS THE
   BACKGROUND filling the viewport. The map (#map) is fixed behind everything.
   ALL explanation is rendered as floating, translucent OVERLAYS layered ON the
   map — never as a side column. Route pages compose overlays out of:

     .overlay-nav        top nav bar (rendered by APP.renderNav)
     .overlay-controls   floating controls strip (plan toggle, layer switches)
     .overlay-card       a translucent, blurred, rounded, shadowed panel
     .overlay-tl         anchor: top-left      (intro / story card)
     .overlay-tr         anchor: top-right      (scorecard / legend)
     .overlay-bl         anchor: bottom-left
     .overlay-br         anchor: bottom-right
     .overlay-bottom     anchor: bottom-centre  (step / "where it sits" controller)
     .overlay-stack      vertical stack helper for multiple cards in one corner

   Overlay anchors are pointer-events:none so the map stays draggable BETWEEN
   cards; each .overlay-card re-enables pointer events for itself.

   Dark theme tokens below are the single source of truth.
   ========================================================================== */

:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #222c38;
  --ink: #e6edf3;
  --muted: #9fb0c0;
  --line: #2d3a48;
  --accent: #4ea1ff;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;

  /* Overlay surface tokens — translucent so the map shows through, but opaque
     enough to stay legible over a busy choropleth. */
  --ov-bg: rgba(18, 24, 32, 0.82);
  --ov-bg-2: rgba(30, 39, 50, 0.78);
  --ov-border: rgba(120, 140, 165, 0.28);
  --ov-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --ov-blur: 12px;

  /* Overlay geometry */
  --ov-gap: 14px;          /* margin from the viewport edge / nav */
  --ov-card-w: 380px;      /* default overlay card width */
  --nav-h: 56px;           /* approximate height of the floating nav bar */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  /* No flex column anymore — the map is fixed and overlays float above it. */
  min-height: 100vh; overflow: hidden;
}
a { color: var(--accent); }
code {
  background: rgba(120, 140, 165, 0.18); padding: 1px 5px; border-radius: 4px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* =============================================================================
   THE MAP IS THE BACKGROUND — fixed, full-viewport, behind every overlay.
   #map (or any element with class .map) fills the screen.
   ========================================================================== */
#map, .map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #11161d;
  z-index: 0;
}
/* Leaflet's own panes/controls sit just above the base map but below overlays. */
.leaflet-container { background: #11161d; }
.leaflet-control-container { z-index: 400; }
/* Nudge Leaflet's default zoom control clear of a top-left overlay card. */
.leaflet-top.leaflet-left { top: calc(var(--nav-h) + var(--ov-gap)); }

/* =============================================================================
   OVERLAY ANCHORS — fixed regions pinned to viewport corners / edges.
   They do NOT capture pointer events (so you can pan the map between cards);
   children (the cards/controls) opt back in to pointer events.
   ========================================================================== */
.overlay-tl, .overlay-tr, .overlay-bl, .overlay-br, .overlay-bottom {
  position: fixed;
  z-index: 600;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - var(--nav-h) - var(--ov-gap) * 2);
}
.overlay-tl { top: calc(var(--nav-h) + var(--ov-gap)); left: var(--ov-gap); align-items: flex-start; }
.overlay-tr { top: calc(var(--nav-h) + var(--ov-gap)); right: var(--ov-gap); align-items: flex-end; }
.overlay-bl { bottom: var(--ov-gap); left: var(--ov-gap); align-items: flex-start; }
.overlay-br { bottom: var(--ov-gap); right: var(--ov-gap); align-items: flex-end; }
.overlay-bottom {
  bottom: var(--ov-gap); left: 50%; transform: translateX(-50%);
  align-items: center; width: min(720px, calc(100vw - var(--ov-gap) * 2));
}
/* Vertical stack helper when several cards share one corner. */
.overlay-stack { display: flex; flex-direction: column; gap: 10px; }

/* =============================================================================
   OVERLAY CARD — the reusable translucent, blurred, rounded, shadowed surface
   that all explanatory content lives in.
   ========================================================================== */
.overlay-card {
  pointer-events: auto;
  background: var(--ov-bg);
  -webkit-backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  border: 1px solid var(--ov-border);
  border-radius: 14px;
  box-shadow: var(--ov-shadow);
  padding: 14px 16px;
  width: var(--ov-card-w);
  max-width: calc(100vw - var(--ov-gap) * 2);
  max-height: calc(100dvh - var(--nav-h) - var(--ov-gap) * 2);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
}
/* Width modifiers for cards that need to be narrower / wider / auto. */
.overlay-card.narrow { width: 300px; }
.overlay-card.wide   { width: 440px; }
.overlay-card.auto   { width: auto; }
.overlay-card.full   { width: 100%; }

.overlay-card h2 { font-size: 15px; margin: 0 0 8px; }
.overlay-card h3 { font-size: 13px; margin: 14px 0 6px; color: var(--accent); }
.overlay-card h3:first-child, .overlay-card h2:first-child { margin-top: 0; }
.overlay-card p { font-size: 13px; margin: 0 0 10px; }
.overlay-card p:last-child { margin-bottom: 0; }

/* Optional collapse affordance for dense cards (route pages may use details). */
.overlay-card details > summary {
  cursor: pointer; font-size: 12px; color: var(--muted); list-style: none;
  padding: 2px 0; user-select: none;
}
.overlay-card details > summary::-webkit-details-marker { display: none; }
.overlay-card details > summary::after { content: " ▾"; }
.overlay-card details[open] > summary::after { content: " ▴"; }

/* Subtle, lower-emphasis card variant for secondary captions. */
.overlay-card.subtle { background: var(--ov-bg-2); }
/* A bare floating caption (no full card chrome). */
.overlay-caption {
  pointer-events: auto;
  background: var(--ov-bg-2);
  -webkit-backdrop-filter: blur(var(--ov-blur));
  backdrop-filter: blur(var(--ov-blur));
  border: 1px solid var(--ov-border);
  border-radius: 10px;
  box-shadow: var(--ov-shadow);
  padding: 8px 12px; font-size: 12px; color: var(--muted);
  max-width: min(760px, calc(100vw - var(--ov-gap) * 2));
}
.overlay-caption b { color: var(--ink); }

/* =============================================================================
   FLOATING NAV BAR — fixed across the top, above all overlays.
   ========================================================================== */
.overlay-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  padding: 9px 18px;
  background: linear-gradient(180deg, rgba(12, 16, 22, 0.92), rgba(12, 16, 22, 0.74));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ov-border);
  pointer-events: auto;
}
.overlay-nav .brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.overlay-nav h1 { margin: 0; font-size: 16px; white-space: nowrap; }
.overlay-nav .brand .tag { color: var(--muted); font-size: 11px; }
.overlay-nav nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.overlay-nav nav a {
  text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent;
}
.overlay-nav nav a:hover { color: var(--ink); background: rgba(120, 140, 165, 0.14); }
.overlay-nav nav a.active {
  color: var(--ink); background: rgba(78, 161, 255, 0.16); border-color: var(--accent);
}

/* =============================================================================
   FLOATING CONTROLS STRIP — plan toggle, layer switches, etc.
   Usually anchored just under the nav (top-centre) or inside a corner card.
   ========================================================================== */
.overlay-controls {
  position: fixed; top: calc(var(--nav-h) + var(--ov-gap)); left: 50%;
  transform: translateX(-50%); z-index: 650;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  padding: 8px 12px;
  background: var(--ov-bg);
  -webkit-backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  border: 1px solid var(--ov-border);
  border-radius: 12px; box-shadow: var(--ov-shadow);
  max-width: calc(100vw - var(--ov-gap) * 2);
  pointer-events: auto;
}
.overlay-controls .group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.overlay-controls .spacer { margin-left: auto; }
.overlay-controls label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.overlay-controls .muted-inline { color: var(--muted); }

button.layerbtn {
  background: rgba(30, 39, 50, 0.7); color: var(--ink); border: 1px solid var(--ov-border);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
button.layerbtn.active { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }
button.layerbtn:hover { border-color: var(--accent); }
button.layerbtn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Missing-artifact banner (floats centred at the very top, under nav) ---- */
.banner {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 700;
  background: var(--warn); color: #1a1200; padding: 7px 18px; font-size: 13px;
  display: none; text-align: center;
}

/* =============================================================================
   COMPONENT BLOCKS — these render INSIDE .overlay-card surfaces. Kept as their
   own classes so route pages and the shared JS (renderConstCard, legend,
   histograms, change-log) can drop them into any overlay.
   ========================================================================== */

/* ---- Overall-score scalar box ---- */
.scalar-box {
  background: var(--ov-bg-2); border: 1px solid var(--ov-border); border-radius: 10px;
  padding: 12px; margin-bottom: 12px; text-align: center;
}
.scalar-box .num { font-size: 32px; font-weight: 700; line-height: 1; }
.scalar-box .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.gates { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.gate { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--ov-border); }
.gate.pass { color: var(--good); border-color: var(--good); }
.gate.fail { color: var(--bad); border-color: var(--bad); }

/* ---- Per-criterion bars ---- */
.bar-row { margin: 8px 0; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.bar-row .top .w { color: var(--muted); font-size: 10px; }
.bar-track { background: rgba(255, 255, 255, 0.08); border-radius: 4px; height: 16px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.note { font-size: 11px; color: var(--muted); }

/* One-line plain-language definition under each criterion bar (for laypeople) */
.crit-blurb { margin-top: 3px; line-height: 1.35; }

/* ---- Legend ---- */
.legend { font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; margin: 2px 8px 2px 0; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(255,255,255,.2); }

/* ---- Ensemble histograms ---- */
.hist { margin: 14px 0; }
.hist .hl { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.hist svg { width: 100%; height: 60px; display: block; background: rgba(255, 255, 255, 0.05); border-radius: 6px; }

/* =============================================================================
   PER-CONSTITUENCY SCORECARD — appears on map click/hover, as a top-right
   overlay card. The shared APP.renderConstCard fills #ccCard. When used as a
   standalone overlay card, wrap it: <div class="overlay-card cc-overlay">…</div>
   ========================================================================== */
.cc-card { /* now a bare content block; the overlay-card supplies the chrome */
  margin-bottom: 6px;
}
/* Backward-compatible standalone styling when .cc-card is NOT inside an
   .overlay-card (e.g. a route not yet migrated): give it card chrome. */
.cc-card:not(.overlay-card .cc-card) { }
.cc-card .cc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cc-card .cc-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.cc-card .cc-type { font-size: 11px; color: var(--muted); }
.cc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 10px 0; }
.cc-stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cc-stat .v { font-size: 14px; font-weight: 600; }
.cc-dev.in { color: var(--good); }
.cc-dev.near { color: var(--warn); }
.cc-dev.out { color: var(--bad); }
.cc-card .cc-empty { font-size: 12px; color: var(--muted); }
.cc-mini { margin-top: 6px; }
.cc-mini .top { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 2px; }
.cc-mini .bar-track { height: 10px; }

/* Pin controls (shown above the per-constituency card once a division is pinned) */
.cc-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.linkbtn {
  background: none; border: 1px solid var(--ov-border); color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 2px 9px; border-radius: 20px;
}
.linkbtn:hover { color: var(--ink); border-color: var(--accent); }

/* =============================================================================
   CHANGE-LOG (transparency overlay, never scored)
   ========================================================================== */
.changelog {
  background: var(--ov-bg-2); border: 1px dashed var(--warn); border-radius: 10px;
  padding: 12px; margin-bottom: 12px;
}
.changelog .cl-tag {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #1a1200; background: var(--warn);
  padding: 2px 6px; border-radius: 4px; margin-bottom: 6px;
}
.changelog h4 { margin: 8px 0 4px; font-size: 12px; color: var(--ink); }
.changelog ul { margin: 2px 0 6px; padding-left: 16px; }
.changelog li { font-size: 12px; }
.changelog .add { color: var(--good); }
.changelog .rm { color: var(--bad); }
.changelog .cl-sum { font-size: 12px; }

/* =============================================================================
   GENERIC OVERLAY-CARD BUILDING BLOCKS for /data, /scoring, /drawing,
   /resources — let each route compose compact, visual, illustrated cards.
   ========================================================================== */
.kicker {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 4px;
}
.lead { font-size: 13px; color: var(--ink); margin: 0 0 12px; }
.lead .muted { color: var(--muted); }

.statline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.stat-mini {
  background: var(--ov-bg-2); border: 1px solid var(--ov-border); border-radius: 10px; padding: 10px 12px;
}
.stat-mini .num { font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat-mini .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; border: 1px solid var(--ov-border); color: var(--muted);
  vertical-align: middle;
}
.pill.live { color: var(--accent); border-color: var(--accent); }
.pill.fallback { color: var(--warn); border-color: var(--warn); }
.pill.good { color: var(--good); border-color: var(--good); }
.pill.bad { color: var(--bad); border-color: var(--bad); }

.callout {
  border-left: 3px solid var(--accent); background: var(--ov-bg-2);
  padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 12.5px; margin: 12px 0;
}
.callout.warn { border-left-color: var(--warn); }
.callout.good { border-left-color: var(--good); }
.callout b { color: var(--ink); }

.tilelist { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tilelist li { font-size: 11px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--ov-border); color: var(--muted); }
.tilelist li.yes { border-color: var(--good); color: var(--good); }
.tilelist li.no { border-color: var(--bad); color: var(--bad); }

/* =============================================================================
   STEP / "WHERE IT SITS" CONTROLLER — bottom-centre overlay (drawing route's
   step-through, ensemble scrubber, etc.). Built on .overlay-card.
   ========================================================================== */
.step-controller { /* place inside .overlay-bottom > .overlay-card.full */
  display: flex; flex-direction: column; gap: 8px;
}
.step-controller .step-row { display: flex; align-items: center; gap: 10px; }
.step-controller .step-row .grow { flex: 1 1 auto; }
.step-dots { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.step-dot {
  width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.22);
  border: none; padding: 0; cursor: pointer;
}
.step-dot.active { background: var(--accent); }
.step-controller .step-label { font-size: 13px; font-weight: 600; }
.step-controller .step-body { font-size: 12px; color: var(--muted); }

/* =============================================================================
   Footer — as a low-key bottom overlay caption when a route wants one.
   ========================================================================== */
footer.site, .overlay-footer {
  font-size: 12px; color: var(--muted);
}
footer.site a, .overlay-footer a { color: var(--accent); }

/* ---- Leaflet popup theming (shared) ---- */
.leaflet-popup-content-wrapper {
  background: var(--ov-bg); color: var(--ink);
  -webkit-backdrop-filter: blur(var(--ov-blur)); backdrop-filter: blur(var(--ov-blur));
  border: 1px solid var(--ov-border);
}
.leaflet-popup-tip { background: var(--ov-bg); }
.leaflet-popup-content { font-size: 12px; }
.pd-pop b { color: var(--accent); }
.muted-inline { color: var(--muted); }

/* =============================================================================
   LEGACY SHIM — routes not yet converted to overlays use .controls / .app /
   .panel / .mapcaption. Re-style them so they still read as floating overlays
   (rather than the old side column) until each route page is migrated. This
   keeps the site coherent during the staged conversion.
   ========================================================================== */
header.site {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  padding: 9px 18px;
  background: linear-gradient(180deg, rgba(12, 16, 22, 0.92), rgba(12, 16, 22, 0.74));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ov-border);
}
header.site .brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
header.site h1 { margin: 0; font-size: 16px; }
header.site .brand .tag { color: var(--muted); font-size: 11px; }
header.site nav { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
header.site nav a {
  text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent;
}
header.site nav a:hover { color: var(--ink); background: rgba(120, 140, 165, 0.14); }
header.site nav a.active { color: var(--ink); background: rgba(78, 161, 255, 0.16); border-color: var(--accent); }

.controls {
  position: fixed; top: calc(var(--nav-h) + var(--ov-gap)); left: 50%;
  transform: translateX(-50%); z-index: 650;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  padding: 8px 12px; background: var(--ov-bg);
  -webkit-backdrop-filter: blur(var(--ov-blur)); backdrop-filter: blur(var(--ov-blur));
  border: 1px solid var(--ov-border); border-radius: 12px; box-shadow: var(--ov-shadow);
  max-width: calc(100vw - var(--ov-gap) * 2);
}
.controls:empty { display: none; }
.controls .group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.controls .spacer { margin-left: auto; }
.controls label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.controls .muted-inline { color: var(--muted); }

/* Legacy .app grid becomes an overlay anchor on the right; map fills behind. */
.app {
  position: static; display: block; height: auto;
}
.app .map { /* the map element already fixed full-viewport above */ }
.app .panel, aside.panel {
  position: fixed; z-index: 600;
  top: calc(var(--nav-h) + var(--ov-gap) + 52px);
  right: var(--ov-gap);
  width: var(--ov-card-w); max-width: calc(100vw - var(--ov-gap) * 2);
  max-height: calc(100dvh - var(--nav-h) - var(--ov-gap) * 2 - 52px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--ov-bg);
  -webkit-backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  backdrop-filter: blur(var(--ov-blur)) saturate(140%);
  border: 1px solid var(--ov-border); border-left: 1px solid var(--ov-border);
  border-radius: 14px; box-shadow: var(--ov-shadow);
  padding: 14px 16px;
}
.panel h2 { font-size: 15px; margin: 0 0 8px; border-bottom: 1px solid var(--ov-border); padding-bottom: 6px; }
.panel h3 { font-size: 13px; margin: 16px 0 6px; color: var(--accent); }
.panel p { font-size: 13px; }
.panel p:first-of-type { margin-top: 0; }

.mapcaption {
  position: fixed; z-index: 600; left: 50%; bottom: var(--ov-gap); transform: translateX(-50%);
  width: min(760px, calc(100vw - var(--ov-gap) * 2));
  font-size: 12px; color: var(--muted); padding: 8px 14px;
  background: var(--ov-bg-2);
  -webkit-backdrop-filter: blur(var(--ov-blur)); backdrop-filter: blur(var(--ov-blur));
  border: 1px solid var(--ov-border); border-radius: 10px; box-shadow: var(--ov-shadow);
}
.mapcaption b { color: var(--ink); }

/* =============================================================================
   RESPONSIVE — on narrow screens overlay cards become full-width sheets pinned
   to top / bottom, but the map STAYS the full-viewport background behind them.
   ========================================================================== */
@media (max-width: 720px) {
  :root { --ov-gap: 8px; --nav-h: 92px; }

  .overlay-tl, .overlay-tr, .overlay-bl, .overlay-br {
    left: var(--ov-gap); right: var(--ov-gap); align-items: stretch;
  }
  .overlay-tl, .overlay-tr { top: calc(var(--nav-h) + var(--ov-gap)); }
  .overlay-bl, .overlay-br { bottom: var(--ov-gap); }
  .overlay-bottom { left: var(--ov-gap); right: var(--ov-gap); transform: none; width: auto; }

  .overlay-card, .overlay-card.narrow, .overlay-card.wide {
    width: 100%; max-height: 46dvh;
  }
  .overlay-controls { left: var(--ov-gap); right: var(--ov-gap); transform: none; }

  .overlay-nav { flex-direction: column; align-items: flex-start; gap: 6px; }
  .overlay-nav nav { margin-left: 0; }

  /* Legacy shim on mobile */
  .app .panel, aside.panel {
    top: auto; bottom: var(--ov-gap); left: var(--ov-gap); right: var(--ov-gap);
    width: auto; max-height: 46dvh;
  }
  .controls, header.site { left: var(--ov-gap); right: var(--ov-gap); transform: none; }
  header.site { left: 0; right: 0; }
  .mapcaption { left: var(--ov-gap); right: var(--ov-gap); transform: none; width: auto; display: none; }
}

/* Respect reduced-motion / reduced-transparency users: drop blur, raise opacity. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --ov-bg: rgba(18, 24, 32, 0.97);
    --ov-bg-2: rgba(30, 39, 50, 0.97);
    --ov-blur: 0px;
  }
}
