/* Accessibility Atlas — Observatory maps style (2026-09 redesign).
   White floating surfaces on a neutral grey map canvas, rounded corners, soft
   shadows, Archivo for UI (Outfit only in the wordmark). Layout: topbar · controls strip · map + right
   panel · footer. Mobile = bottom sheet. Every token below is meant to be copied
   into the other Observatory map sites as-is.

   ============================ TOKENS ============================ */
:root {
  /* surfaces */
  --canvas: #EDEEF0;         /* map / page ground */
  --surface: #FFFFFF;        /* cards, bars, sheets */
  --surface-2: #F3F4F6;      /* segmented tracks, inset rows */
  --surface-3: #F9FAFB;      /* stat tiles */
  --border: #E5E7EB;         /* control outlines, dividers */
  --border-2: #D1D5DB;       /* unchecked boxes */
  /* text */
  --ink: #111827;
  --text-2: #374151;         /* secondary labels, inactive tabs */
  --muted: #6B7280;          /* eyebrows, meta, keys */
  --disabled: #9CA3AF;
  /* accent + data (unchanged from the data model) */
  --accent: #185FA5;
  --accent-hover: #124A80;
  --transit: #20242E;
  --school: #B0870F;
  --park: #2E7D32;
  --toilet: #3C7D8E;
  --band-0: #3C9D8E; --band-1: #B8DDC8; --band-2: #EDDFA9; --band-3: #E07B4F;
  --good: #2E7D32;
  --bad: #C62828;
  --marker: #D85A30;
  /* shape & depth */
  --r-card: 12px;
  --r-ctl: 8px;
  --r-pill: 6px;
  --r-sheet: 20px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
  --shadow-btn: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.08);
  --shadow-pill: 0 1px 2px rgba(0,0,0,.08);
  --shadow-sheet: 0 -8px 32px rgba(0,0,0,.12);
  /* type — Archivo for UI + reading, Archivo Narrow uppercase for eyebrows/tabs,
     Outfit ONLY in the wordmark (Observatory family link) */
  --font-ui: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-narrow: 'Archivo Narrow', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font-brand: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
  --fs-title: 26px; --fs-card: 18px; --fs-body: 14px; --fs-meta: 12px; --fs-eyebrow: 12px;
  /* UI colour is greyscale: buttons, toggles, progress use ink; colour is for map data only */
  --ui-primary: #111827;
  --ui-primary-hover: #374151;
  /* layout */
  --dock-w: 380px;
  /* two card widths only: small (left column: toolbar popovers, legend) and
     large (right: detail card) */
  --w-sm: 300px;
  --w-lg: 360px;
  --topbar-h: 56px;
  --ctl-h: 36px;
  --gap: 12px;
  /* legacy aliases still referenced by inline JS styles */
  --bg: var(--surface);
  --panel2: var(--surface-2);
  --sub: var(--text-2);
  --note: var(--muted);
  --line: var(--border);
  --line-soft: var(--surface-2);
  --accent-soft: #85B7EB;
  --accent-red: var(--muted);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font-ui);
  color: var(--ink); background: var(--canvas); font-size: var(--fs-body); line-height: 1.4;
  -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  padding: 0; gap: 0; }
button { font-family: inherit; }
b, strong { font-weight: 600; }
.mono, .num, .card-meta, table.near td.v, .tile .tv, .qrow b, .stackbar .nums, .kpi .v { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
.blueprint { background-image: none; }   /* old grid texture, retired */

/* shared bits */
.eyebrow, .sclab, .ls-title, .sec-title, .lg-bandtitle, #legend-toggle {
  font-family: var(--font-narrow); font-size: var(--fs-eyebrow); letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; }

/* ============================= TOP BAR ============================= */
#topbar { flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; min-height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); position: relative; z-index: 30; }

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-wm, .brand-sub { white-space: nowrap; }
.brand-logo { width: 28px; height: 28px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; }
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.brand-wm { background: none; border: none; padding: 0; cursor: pointer;
  color: var(--ink); font-family: var(--font-narrow); font-size: 17px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; line-height: 1.1; }
.brand-sub { font-family: var(--font-narrow); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); text-decoration: none; font-weight: 600; }
.brand-sub:hover { color: var(--ink); }

/* segmented nav */
.nav { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-ctl); }
.nav button { border: none; background: transparent; cursor: pointer; border-radius: var(--r-pill);
  padding: 6px 14px; font-family: var(--font-narrow); font-size: var(--fs-body); font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase; color: var(--text-2); transition: .12s; white-space: nowrap; }
.nav button:hover { color: var(--ink); }
.nav button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pill); }

/* ===================== CONTROLS STRIP (below topbar) ============== */
.scopebar { display: flex; align-items: center; gap: 6px; }
.scopebar[hidden] { display: none; }
.scsep { color: var(--disabled); font-size: 11px; }

/* split scope control: [ name | ▾ ] */
.scopelvl { position: relative; display: flex; align-items: stretch;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-ctl);
  height: var(--ctl-h); overflow: hidden; }
.sc-name { border: none; background: transparent; font-family: inherit;
  font-size: var(--fs-body); color: var(--ink); padding: 0 6px 0 12px; cursor: pointer;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-name:hover { background: var(--surface-2); }
.sc-caret { border: none; background: transparent; font-family: inherit; font-size: 10px;
  color: var(--muted); padding: 0 10px 0 6px; cursor: pointer; }
.sc-caret:hover { background: var(--surface-2); color: var(--ink); }
.sc-menu { position: fixed; margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-card); list-style: none; padding: 4px;
  z-index: 60; max-height: 320px; overflow-y: auto; }
.sc-menu[hidden] { display: none; }
.sc-menu li { padding: 8px 12px; font-size: var(--fs-body); cursor: pointer; white-space: nowrap;
  border-radius: var(--r-pill); }
.sc-menu li:hover { background: var(--surface-2); }
.sc-menu li.on { font-weight: 500; background: var(--surface-2); }

#road-viz, #cov-ctrl, #walkshed-ctrl { display: flex; align-items: center; gap: 8px; }
#layer-switcher { gap: 8px; }
.ci { width: 15px; height: 15px; vertical-align: -3px; margin-right: 6px; }
.t2-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.t2-toggle .ci { margin-right: 5px; }
.t2-toggle.off { color: var(--disabled); cursor: default; }
.t2-toggle.off .ci { opacity: .4; }
.t2-show { accent-color: var(--ui-primary); width: 13px; height: 13px; margin: 0 6px 0 0; flex: 0 0 auto; }

.spacer { flex: 1; min-width: 6px; }

/* search — lives in the top bar: open field on desktop, icon that expands on phones */
#search-box { position: relative; display: flex; align-items: center; height: var(--ctl-h);
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface); padding: 0 4px 0 6px; }
#search-toggle { width: 28px; height: 28px; flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
  color: var(--muted); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
#search-toggle:hover { color: var(--ink); }
#search-input { width: 200px; border: none; background: transparent; font-family: inherit; font-size: var(--fs-body);
  outline: none; color: var(--ink); padding: 0 8px 0 2px; }
#search-input::placeholder { color: var(--muted); }
#search-results { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-ctl); box-shadow: var(--shadow-card); padding: 4px;
  max-height: 260px; overflow-y: auto; z-index: 40; }
#search-results.hidden { display: none; }
#search-results div { padding: 8px 12px; font-size: var(--fs-body); cursor: pointer; border-radius: var(--r-pill); }
#search-results div:hover { background: var(--surface-2); }

.topact { display: flex; gap: 8px; }
.topact button { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl);
  width: var(--ctl-h); height: var(--ctl-h); cursor: pointer; font-family: inherit; font-size: 14px;
  line-height: 1; color: var(--text-2); }
.topact button:hover { background: var(--surface-2); color: var(--ink); }
.btn-primary, .topact button.btn-primary { width: auto; padding: 0 14px; background: var(--ui-primary); color: #fff;
  border: none; font-weight: 600; font-size: var(--fs-body); }
.btn-primary:hover, .topact button.btn-primary:hover { background: var(--ui-primary-hover); color: #fff; }

/* ============================== APP =============================== */
#app { flex: 1 1 auto; display: flex; gap: 0; min-height: 0; position: relative; }
#map-wrap { flex: 1 1 auto; position: relative; min-width: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }
#map-overlays { display: contents; }

/* dropdown strip (top-left, desktop): Streets ▾ · Show ▾ */
#ctrlpanel { position: absolute; top: 16px; left: 16px; z-index: 20; display: flex; height: 40px; background: var(--surface);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-btn); }
.dd { position: relative; display: flex; }
.dd + .dd { border-left: 1px solid var(--border); }
.dd-btn { height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: none; background: transparent;
  font-family: inherit; font-size: var(--fs-body); color: var(--text-2); cursor: pointer; white-space: nowrap; border-radius: var(--r-ctl); }
.dd-btn b { color: var(--ink); font-weight: 600; }
.dd-btn:hover, .dd-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.dd-caret { font-size: 10px; color: var(--muted); margin-left: 2px; }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border-radius: var(--r-ctl);
  box-shadow: var(--shadow-card); padding: 4px; display: flex; flex-direction: column; z-index: 30; }
.dd-menu[hidden] { display: none; }
.dd-opt, .dd-check { display: flex; align-items: center; gap: 10px; text-align: left; border: none; background: transparent; font-family: inherit;
  font-size: var(--fs-body); color: var(--ink); padding: 9px 12px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; }
.dd-opt:hover, .dd-check:hover { background: var(--surface-2); }
.dd-opt.on { font-weight: 600; }
.dd-opt.on::after { content: "✓"; margin-left: auto; color: var(--muted); font-size: 12px; }
.dd-check input { position: absolute; opacity: 0; pointer-events: none; }
.dd-check .sw { width: 14px; height: 14px; border-radius: 4px; background: var(--c, var(--ink)); flex: 0 0 auto; }
.dd-check .sw-modes { background: conic-gradient(#B3261E 0 120deg, #185FA5 120deg 240deg, #6A1B9A 240deg); }
.dd-check:not(:has(input:checked)) { color: var(--disabled); }
.dd-check:not(:has(input:checked)) .sw { background: transparent; border: 1.5px solid var(--border-2); }
.dd-sel { cursor: default; gap: 8px; }
.dd-sel select { border: none; background: transparent; font-family: inherit; font-size: var(--fs-body); font-weight: 600; color: var(--ink);
  cursor: pointer; outline: none; }
body[data-view="maps"] #road-viz, body[data-view="maps"] #show-layers { display: none; }
body:not([data-view="maps"]) #layer-switcher { display: none; }
body[data-view="transit"] #layer-switcher { display: none; }

/* "Show on map" rows */
.sl-row { display: flex; align-items: center; gap: 10px; height: 32px; cursor: pointer; color: var(--ink); font-size: var(--fs-body); }
.sl-row input { position: absolute; opacity: 0; pointer-events: none; }
.sl-box { width: 16px; height: 16px; border-radius: 4px; flex: 0 0 auto; border: 1.5px solid var(--border-2); background: transparent; }
.sl-row:has(input:checked) .sl-box { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); }
.sl-row:not(:has(input:checked)) { color: var(--disabled); }

/* floating detail card (right) — desktop */
#panel { position: absolute; top: 16px; right: 16px; width: var(--w-lg); z-index: 20; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  max-height: calc(100% - 32px); min-height: 0; }
#panel.empty { display: none; }
#panel { overflow: hidden; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; }

/* card header / tiles / actions */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  position: sticky; top: -16px; z-index: 3; background: var(--surface);
  margin: -16px -18px 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.card-head .pin-x { font-size: 16px; padding: 2px 4px; }
.card-head-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-title { font-size: var(--fs-card); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.card-meta { font-size: var(--fs-meta); color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.tile { background: var(--surface-3); border-radius: var(--r-ctl); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.tile .tv { font-size: var(--fs-card); font-weight: 600; line-height: 1.15; }
.tile .tk { font-size: var(--fs-meta); color: var(--muted); }
.card-acts { display: flex; gap: 8px; padding-top: 4px; }
.btn-secondary { flex: 1; height: var(--ctl-h); display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: var(--fs-body); cursor: pointer; }
.btn-secondary:hover { background: var(--surface-2); }
.pt-explore { width: 100%; margin-bottom: 12px; }

/* footer */
#footbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 0 20px; min-height: 32px; background: var(--surface);
  border-top: 1px solid var(--border); font-size: var(--fs-meta); color: var(--muted); }
#footbar a { color: var(--text-2); text-decoration: none; }
#footbar a:hover { color: var(--ink); }
.foot-mail { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.foot-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }

/* ===================== panel content shared ====================== */
.sec { margin-bottom: 20px; }
.sec-title { padding-bottom: 4px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.hint { font-size: var(--fs-body); color: var(--text-2); line-height: 1.5; }
.hint.caveat { font-size: var(--fs-meta); color: var(--muted); margin: 6px 0 0; }
/* the sentence at the top of a card: the finding in words, before any number */
.verdict { font-size: 15px; line-height: 1.5; color: var(--ink); margin: 0 0 14px; text-wrap: pretty; }
.verdict b { font-weight: 600; }
.rank { font-size: var(--fs-meta); color: var(--muted); margin: -8px 0 16px; }
.rank b { color: var(--ink); font-weight: 600; }
.rowlink { font-size: var(--fs-meta); color: var(--muted); text-decoration: underline; text-underline-offset: 2px; margin-left: 6px; }
.rowlink:hover { color: var(--ink); }
/* ward tooltip (Wards view, zoomed out) */
#ward-tip { position: absolute; z-index: 25; pointer-events: none; background: var(--surface); color: var(--ink);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-card); padding: 8px 10px; font-size: var(--fs-meta); line-height: 1.4;
  max-width: 220px; }
#ward-tip[hidden] { display: none; }

.pt-name { font-size: var(--fs-card); font-weight: 600; line-height: 1.2; margin: 4px 0 12px; }
.pt-explore { margin-top: 14px; }

.panel-acts { display: inline-flex; align-items: center; gap: 8px; }
.pin-x { color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1; }
.pin-x:hover { color: var(--ink); }
.pin-report { font-family: inherit; font-size: var(--fs-meta); font-weight: 500; letter-spacing: 0;
  text-transform: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--r-ctl); padding: 6px 10px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 6px; }
.pin-report:hover { background: var(--surface-2); }
.ic-page { width: 12px; height: 12px; flex: 0 0 auto; }
.src { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 5px;
  vertical-align: 1px; font-weight: 400; }
.bignum { font-size: 32px; font-weight: 300; line-height: 1.05; }
.bignum small { font-size: 13px; font-weight: 400; color: var(--muted); }

/* stat tiles */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.kpi { background: var(--surface-3); border-radius: var(--r-ctl); padding: 10px 12px; }
.kpi .k { font-size: var(--fs-meta); color: var(--muted); line-height: 1.25; }
.kpi .v { font-size: 22px; font-weight: 500; margin-top: 4px; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--muted); }
.kpi .kx { font-size: var(--fs-meta); color: var(--muted); margin-top: 3px; }

/* segmented sub-toggle */
.pilltoggle { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-ctl); }
.pilltoggle button { border: none; background: transparent; cursor: pointer; border-radius: var(--r-pill);
  padding: 5px 12px; font-family: inherit; font-size: var(--fs-body); color: var(--text-2); transition: .12s; }
.pilltoggle button:hover { color: var(--ink); }
.pilltoggle button.on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-pill); }

/* collapsible category groups */
details.group { border-bottom: 1px solid var(--surface-2); }
details.group summary { display: flex; align-items: center; padding: 9px 0; font-size: var(--fs-body);
  font-weight: 500; cursor: pointer; list-style: none; }
details.group summary span:first-of-type { flex: 1; text-align: left; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary .best { font-weight: 400; color: var(--text-2); }
details.group summary::before { content: "▸"; margin-right: 8px; color: var(--muted); }
details.group[open] summary::before { content: "▾"; }
details.group table.near { margin: 0 0 8px 16px; width: calc(100% - 16px); }

/* stacked / single 5-10-15 coverage bars */
.stackbar { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.stackbar .lbl { width: 96px; font-size: var(--fs-body); color: var(--text-2); }
.stackbar .track { flex: 1; min-width: 70px; height: 10px; display: flex; background: var(--surface-2);
  border-radius: 5px; overflow: hidden; }
.stackbar .seg { height: 100%; display: block; }
.stackbar .nums { width: 84px; text-align: right; font-size: var(--fs-meta); color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.stackbar .nums b { color: var(--ink); font-size: var(--fs-body); }
@media (max-width: 420px) {
  .stackbar { flex-wrap: wrap; }
  .stackbar .track { order: 3; flex-basis: 100%; margin-top: 2px; }
}

table.near { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.near td { padding: 7px 0; border-bottom: 1px solid var(--surface-2); }
table.near td.v { text-align: right; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.near td.v .cnt { color: var(--muted); font-weight: 400; font-size: var(--fs-meta); }
.far { color: var(--muted); font-weight: 400 !important; }

.qrow { display: flex; justify-content: space-between; font-size: var(--fs-body); padding: 7px 0;
  border-bottom: 1px solid var(--surface-2); }
.qrow b { font-weight: 500; }
.qrow.qblock { display: block; }
.minibar { display: flex; height: 8px; border-radius: 4px; margin: 8px 0 0; overflow: hidden; background: var(--surface-2); }
.minibar .seg { height: 100%; display: block; }
.roadmix-lg { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 6px; font-size: var(--fs-meta); color: var(--muted); }
.roadmix-lg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.badge { font-size: 11px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted); margin-left: 6px; }

/* ========================= map overlays ========================== */
.map-ui { position: absolute; background: var(--surface); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); font-size: var(--fs-body); z-index: 15; }

/* layer chips (coverage) */
#layer-switcher { display: flex; align-items: center; gap: 10px; }
#ls-options { display: flex; flex-wrap: wrap; gap: 6px; }
#ls-options label { display: inline-flex; align-items: center; cursor: pointer; border: 1px solid var(--border);
  border-radius: var(--r-ctl); padding: 6px 12px; font-size: var(--fs-body); color: var(--text-2);
  transition: .12s; white-space: nowrap; }
#ls-options label:hover { color: var(--ink); }
#ls-options label:has(input:checked) { border-color: var(--ink); color: var(--ink); font-weight: 500; }
#ls-options input { position: absolute; opacity: 0; pointer-events: none; }

/* 5/10/15 band toggle */
#band-toggle, #cov-band { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-ctl); }
#band-toggle button, #cov-band button { border: none; background: transparent; padding: 5px 14px;
  font-family: inherit; font-size: var(--fs-body); cursor: pointer; color: var(--text-2); border-radius: var(--r-pill); }
#band-toggle button.active, #cov-band button.active { background: var(--surface); color: var(--ink);
  font-weight: 500; box-shadow: var(--shadow-pill); }

/* bottom-left stack: legend above, breadcrumb below */
#bl-stack { position: absolute; left: 16px; bottom: 16px; z-index: 15; display: flex; flex-direction: column;
  align-items: flex-start; gap: 8px; max-width: calc(100% - 32px); pointer-events: none; }
#bl-stack > * { pointer-events: auto; }
#legend { position: static; padding: 0; font-size: var(--fs-meta); color: var(--text-2); width: var(--w-sm); }
#legend-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; border: none;
  background: transparent; font-family: inherit; text-align: left; padding: 10px 14px; cursor: pointer; border-radius: var(--r-card); }
.lg-chev { font-size: 11px; color: var(--muted); }
#legend-toggle:hover { color: var(--ink); }
#legend-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.lg-sec + .lg-sec, #lg-road + .lg-sec, #legend-bands + .lg-sec { border-top: 1px solid var(--surface-2); padding-top: 10px; }
.lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.lg-grid span { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--text-2); }
.lg-grid i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
#legend.collapsed #legend-body { display: none; }
.lg-grad { display: block; width: 180px; height: 8px; border-radius: 4px; }
.lg-labels { display: flex; justify-content: space-between; width: 180px; margin: 4px 0 0; }
.lg-dots { display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: 210px; }
.lg-dots i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.lg-swatches { display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: 210px; }
.lg-swatches i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: 2px; }
#legend-bands.hidden { display: none; }
.lg-bandtitle { margin: 0 0 6px; }
.lg-bands { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 6px; }
.lg-bands i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg-range { display: flex; align-items: center; gap: 8px; }
.lg-rings { position: relative; width: 22px; height: 16px; flex: 0 0 auto; }
.lg-rings i { position: absolute; border-color: var(--ink); background: rgba(17,24,39,.07); border-radius: 3px; }
.lg-rings i:nth-child(1) { inset: 0; border: 1.4px dashed; }
.lg-rings i:nth-child(2) { inset: 3px 4px; border: 1px dotted; }
.lg-rings i:nth-child(3) { inset: 6px 8px; border: 1px solid; }
.lg-hint { color: var(--muted); }
body[data-view="maps"] #lg-road, body[data-view="transit"] #lg-road, body[data-view="maps"] .lg-hint,
body[data-view="maps"] .lg-amen, body[data-view="transit"] .lg-hint,
body[data-view="transit"] .lg-range { display: none; }

/* breadcrumb: Hyderabad › Corporation › Zone › Ward */
#bl-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
#bl-row #search-box { height: 40px; border: none; box-shadow: var(--shadow-btn); }
#bl-row #search-results { top: auto; bottom: calc(100% + 6px); }
#crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; background: var(--surface); min-height: 40px;
  border-radius: var(--r-ctl); box-shadow: var(--shadow-btn); padding: 0 6px; font-size: var(--fs-body); }

#crumb[hidden] { display: none; }
.crumb-part { position: relative; display: inline-flex; align-items: center; }
.crumb-sep { color: var(--disabled); padding: 0 2px; }
.crumb-name, .crumb-caret { border: none; background: transparent; font-family: inherit; font-size: var(--fs-body);
  color: var(--text-2); cursor: pointer; border-radius: var(--r-pill); }
.crumb-name { padding: 6px 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-name:hover, .crumb-caret:hover { background: var(--surface-2); color: var(--ink); }
.crumb-name.cur { color: var(--ink); font-weight: 600; cursor: default; }
.crumb-name.cur:hover { background: transparent; }
.crumb-name.ph { color: var(--muted); }
.crumb-caret { font-size: 10px; padding: 6px 6px; color: var(--muted); }
.crumb-caret[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.crumb-list { position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 240px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-ctl); box-shadow: var(--shadow-card); padding: 4px; z-index: 40;
  display: flex; flex-direction: column; }
.crumb-lh { font-family: var(--font-narrow); font-size: var(--fs-eyebrow); letter-spacing: 1.5px; text-transform: uppercase;
  font-weight: 600; color: var(--muted); padding: 8px 10px 6px; position: sticky; top: -4px; background: var(--surface); }
.crumb-opt { text-align: left; border: none; background: transparent; font-family: inherit; font-size: var(--fs-body);
  color: var(--ink); padding: 8px 10px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; }
.crumb-opt:hover { background: var(--surface-2); }
.crumb-opt.on { background: var(--surface-2); font-weight: 600; }

/* desktop: keep map controls clear of the detail card when it is open */
@media (min-width: 769px) {
  #app:has(#panel:not(.empty)) .maplibregl-ctrl-top-right,
  #app:has(#panel:not(.empty)) .maplibregl-ctrl-bottom-right { right: 392px; }
}

/* area select + reach button */
#area-select, .plainsel { width: 100%; font-family: inherit; font-size: var(--fs-body); padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl); margin-bottom: 10px; }
.reach-btn { font-family: inherit; font-size: var(--fs-body); cursor: pointer; background: var(--ui-primary);
  color: #fff; border: none; border-radius: var(--r-ctl); padding: 8px 12px; width: 100%; text-align: left; }
.reach-btn:hover { background: var(--ui-primary-hover); }

/* MapLibre controls: round white buttons */
.maplibregl-ctrl-group, .maplibregl-ctrl-group:not(:empty) { background: transparent !important; box-shadow: none !important;
  border: none !important; border-radius: 0; display: flex; flex-direction: column; gap: 8px; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; border-radius: 50% !important; background: var(--surface) !important;
  box-shadow: var(--shadow-btn) !important; border: none !important; }
.maplibregl-ctrl-group button + button { border-top: none !important; }
.maplibregl-ctrl-top-right { top: 16px; right: 16px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 0 8px 0; }
.maplibregl-ctrl-scale { background: transparent; border: none; border-bottom: 3px solid var(--ink);
  color: var(--muted); font-family: inherit; font-size: 11px; padding: 0 4px 2px 0; }
.maplibregl-ctrl-attrib { font-family: inherit; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.8);
  border-radius: 6px; }

/* stop popup */
.maplibregl-popup-content { font-family: var(--font-ui); background: var(--surface); border: none;
  border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 0; max-height: 320px; overflow-y: auto; min-width: 260px; }
.maplibregl-popup-tip { border-top-color: var(--surface); }
.stop-pop h3 { margin: 0; padding: 12px 14px 8px; font-size: var(--fs-card); font-weight: 500; border-bottom: 1px solid var(--border); }
.stop-pop .dest-group { padding: 8px 14px 4px; }
.stop-pop .dest { font-size: var(--fs-body); font-weight: 500; margin-bottom: 4px; }
.stop-pop .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.chip { font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 10px; border: 1.5px solid; }
.chip.bus { color: #B3261E; border-color: #B3261E; }
.chip.metro { border-color: var(--accent); background: var(--accent); color: #fff; }
.chip.mmts { color: #6A1B9A; border-color: #6A1B9A; }
.stop-pop .freq { font-size: var(--fs-meta); color: var(--muted); text-align: right; margin-top: -20px; }
.stop-pop .svc { font-size: var(--fs-meta); color: var(--muted); margin-bottom: 6px; }
.stop-pop .note { font-size: 11px; color: var(--marker); }

/* ====================== mobile start sheet ====================== */
/* inside #app: the top bar and tabs stay usable above it */
#start-sheet { position: absolute; inset: 0; z-index: 26; background: rgba(17,24,39,.45);
  display: flex; align-items: flex-end; }
#start-sheet[hidden] { display: none; }

.sheet-grip-static { display: flex; justify-content: center; }
.sheet-grip-static span { width: 36px; height: 4px; border-radius: 2px; background: var(--border); }
.start-card { width: 100%; background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet); padding: 0 0 28px; display: flex; flex-direction: column; overflow: hidden; }
.start-brand { display: flex; align-items: center; gap: 12px; }
.start-brand svg { width: 40px; height: 40px; flex: 0 0 auto; }
.start-brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.start-title { font-family: var(--font-brand); font-size: 22px; font-weight: 500; }
.start-sub { font-family: var(--font-narrow); font-size: var(--fs-meta); color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }
.start-lead { margin: 0; font-size: 16px; color: var(--text-2); text-wrap: pretty; }
.start-choices { display: flex; flex-direction: column; gap: 10px; }
.start-choices[hidden] { display: none; }
.start-btn { height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 16px; cursor: pointer; }
.start-btn--primary { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; font-weight: 600; }
.start-btn--cancel { height: 44px; color: var(--text-2); }
.start-browse { margin: -6px 0 0; text-align: center; font-size: 14px; }
.start-browse a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.start-lead b { color: var(--ink); font-weight: 600; }
/* about: the "read the numbers right" box */
.about-box { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px 18px; margin: 18px 0 8px; }
.about-box > b { display: block; margin-bottom: 6px; color: var(--ink); }
.about-box ul { padding-left: 18px; }
.about-box li, .about-box p { font-size: 14px !important; margin-bottom: 4px; }
.about-box p { margin: 8px 0 0 !important; }
.start-loading { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.start-loading[hidden] { display: none; }
.start-row { display: flex; justify-content: space-between; font-size: 15px; }
.start-pct { font-weight: 500; }
.start-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.start-bar > span { display: block; width: 0; height: 6px; background: var(--ui-primary); transition: width .25s ease; }
.start-meta { font-size: 13px; color: var(--muted); }
.start-links { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--muted); padding-top: 4px; }
.start-links a { color: var(--muted); text-decoration: none; }
@media (min-width: 769px) {   /* desktop: a centred card over a dimmed map */
  #start-sheet { align-items: center; justify-content: center; background: rgba(17,24,39,.55); }
  .start-card { width: 520px; border-radius: var(--r-card); padding: 0 0 20px; overflow: hidden; }
  .sheet-grip-static { display: none; }
}

/* ============================ about page ============================ */
#about-page { position: fixed; inset: 0; z-index: 95; background: var(--surface); overflow-y: auto;
  -webkit-overflow-scrolling: touch; }
#about-page[hidden] { display: none; }
.about-inner { max-width: 720px; margin: 0 auto; padding: 48px 24px 64px; position: relative; }
.about-close { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--surface); box-shadow: var(--shadow-btn); font-size: 22px; line-height: 1;
  cursor: pointer; font-family: inherit; color: var(--muted); }
.about-close:hover { color: var(--ink); }
#about-page h1 { font-family: var(--font-brand); font-size: var(--fs-title); font-weight: 500; margin: 6px 0 12px; }
#about-page h2 { font-size: var(--fs-card); font-weight: 600; margin: 32px 0 8px; }
#about-page p, #about-page li { font-size: 15px; line-height: 1.6; color: var(--text-2); }
#about-page p { margin: 0 0 10px; }
#about-page ul { padding-left: 20px; margin: 0; }
#about-page li { margin-bottom: 6px; }
#about-page b { color: var(--ink); }
.about-lead { font-size: 17px !important; color: var(--ink) !important; }
.about-links { margin-top: 20px !important; }

.sheet-grip { display: none; }
#sheet-controls { display: none; }
.m-only, .tab-short { display: none; }


/* road colour options: one row per option with its own key */
.rv-list { display: flex; flex-direction: column; gap: 4px; }
.rv-opt { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left; border: 1px solid transparent;
  background: transparent; border-radius: var(--r-ctl); padding: 8px 10px; font-family: inherit; cursor: pointer; color: var(--text-2); }
.rv-opt:hover { background: var(--surface-3); }
.rv-opt.on { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.rv-name { font-size: var(--fs-body); font-weight: 500; }
.rv-opt:not(.on) .rv-sw, .rv-opt:not(.on) .rv-grad { opacity: .75; }
.rv-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; font-size: var(--fs-meta); color: var(--text-2); }
.rv-sw i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.rv-grad { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-meta); color: var(--text-2); }
.rv-grad > i { display: block; height: 6px; border-radius: 3px; }
.rv-lohi { display: flex; justify-content: space-between; }

/* zoom-in hint (Explore, zoomed out) */
/* a quiet watermark across the map, not a button */
#zoom-hint { position: absolute; inset: 0; z-index: 18; pointer-events: none; display: flex; align-items: center;
  justify-content: center; }
#zoom-hint span { font-family: var(--font-narrow); font-size: 22px; letter-spacing: 3px; text-transform: uppercase;
  font-weight: 600; color: rgba(17,24,39,.28); text-align: center; padding: 0 24px; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
#zoom-hint[hidden] { display: none; }

/* card scroll cue */
#scroll-cue { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; border: none; cursor: pointer; z-index: 4;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-family: inherit;
  font-size: var(--fs-meta); color: var(--text-2); border-radius: 0 0 var(--r-card) var(--r-card);
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 70%); }
#scroll-cue[hidden] { display: none; }
#scroll-cue:hover { color: var(--ink); }
/* the matching cue at the top: a small pill under the sticky card header */
#scroll-cue-top { position: absolute; left: 50%; top: 78px; transform: translateX(-50%); z-index: 4;
  height: 26px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: var(--fs-meta); color: var(--text-2); background: var(--surface);
  box-shadow: var(--shadow-card); }
#scroll-cue-top[hidden] { display: none; }
#scroll-cue-top:hover { color: var(--ink); }
#panel { position: absolute; }

/* pointer in "walk from here": a crosshair says "click somewhere" */
.walk-cursor { cursor: crosshair; }
.btn-plain, .topact button.btn-plain { width: auto; padding: 0 12px; }
.crumb-note { color: var(--muted); font-size: var(--fs-meta); padding: 0 6px; }

/* detail card: more air */
.panel-body { line-height: 1.55; }
.verdict { font-size: 15px; line-height: 1.6; margin: 4px 0 20px; }
.sec { margin-bottom: 26px; }
.sec-title { margin-bottom: 10px; }
table.near td { padding: 10px 0; }
table.near td.v .cnt { display: block; margin-top: 2px; }
.hint { line-height: 1.6; }
.hint.caveat { margin-top: 10px; }
.tiles { gap: 10px; margin-bottom: 12px; }
.tile { padding: 12px; }
details.group summary { padding: 12px 0; }
.stackbar { margin: 9px 0; }
.card-acts { padding-top: 8px; }
@media (max-width: 768px) { #zoom-hint span { font-size: 16px; } }
table.near td.v .tag { color: var(--muted); font-weight: 400; font-size: var(--fs-meta); }
#legend.tucked { visibility: hidden; }
#btn-share { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.share-msg { position: absolute; top: calc(100% + 6px); right: 0; background: var(--ui-primary); color: #fff; font-size: var(--fs-meta);
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.share-msg[hidden] { display: none; }
.lg-explain { display: flex; gap: 10px; align-items: center; }
.lg-explain svg { flex: 0 0 auto; }
.lg-explain p { margin: 0; font-size: var(--fs-meta); line-height: 1.45; color: var(--text-2); }
.lg-explain b { color: var(--ink); font-weight: 600; }
body[data-view="maps"] .lg-explain, body[data-view="transit"] .lg-explain { display: none; }
body[data-view="maps"] .lg-sec:has(.lg-explain), body[data-view="transit"] .lg-sec:has(.lg-explain) { display: none; }
.start-graphic { position: relative; margin: 0; }
.start-graphic img { display: block; width: 100%; height: auto; }
.start-graphic svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.start-actions { padding: 18px 24px 0; }
.start-actions .start-btn { width: 100%; }
.start-graphic[hidden] { display: none; }
.start-graphic svg { width: 100%; height: auto; display: block; }
.start-graphic text { font-family: var(--font-ui); font-size: 13px; font-weight: 700; fill: #111827; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.start-graphic .ring { transform-origin: 253.4px 172px; animation: ringIn .7s cubic-bezier(.2,.8,.2,1) both; }
.start-graphic .r5 { animation-delay: .3s; } .start-graphic .r10 { animation-delay: .9s; } .start-graphic .r15 { animation-delay: 1.5s; }
@keyframes ringIn { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: scale(1); } }
.start-row2 { display: flex; gap: 10px; }
.start-row2 .start-btn { flex: 1; height: 44px; font-size: 15px; }
.lg-range { display: flex; align-items: center; gap: 8px; }
.start-loading { padding: 0 24px; }
.ci-head { width: 22px; height: 22px; vertical-align: -4px; margin-right: 8px; }
.pt-explore { width: 100%; margin: 0 0 16px; }
.eyebrow-sep { margin: 0 8px; color: var(--border-2); font-weight: 400; }
.routes-link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.routes-link:hover { text-decoration-color: var(--ink); }
/* Bus & Metro notice: same place and size as the landing card, map dimmed behind */
/* covers the map area only (#app is the containing block), so the tabs and the
   top bar stay usable: you can leave the section without dismissing it */
#transit-notice, #compare-notice { position: absolute; inset: 0; z-index: 25; background: rgba(17,24,39,.55);
  display: flex; align-items: center; justify-content: center; }
#transit-notice[hidden], #compare-notice[hidden] { display: none; }
/* Compare areas intro: a still of the breadcrumb with its ward list open, the
   highlight walking down the list so it reads as "pick one here" */
.crumb-demo { position: relative; background: var(--surface-3); border-radius: var(--r-card); padding: 18px 18px 14px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 2px 0 4px; }
.crumb-demo-list { background: var(--surface); border-radius: var(--r-ctl); box-shadow: var(--shadow-card);
  padding: 6px; min-width: 200px; display: flex; flex-direction: column; }
.crumb-demo-list .crumb-lh { padding: 4px 8px 6px; }
.crumb-demo-list .crumb-opt { padding: 6px 8px; border-radius: 6px; animation: crumbPick 4.8s infinite; }
.crumb-demo-list .crumb-opt:nth-child(2) { animation-delay: 0s; }
.crumb-demo-list .crumb-opt:nth-child(3) { animation-delay: 1.2s; }
.crumb-demo-list .crumb-opt:nth-child(4) { animation-delay: 2.4s; }
.crumb-demo-list .crumb-opt:nth-child(5) { animation-delay: 3.6s; }
@keyframes crumbPick { 0%, 20% { background: var(--surface-2); font-weight: 600; } 25%, 100% { background: transparent; font-weight: 400; } }
.crumb-demo-bar { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border-radius: var(--r-ctl);
  box-shadow: var(--shadow-card); padding: 8px 12px; font-size: var(--fs-body); color: var(--text-2); }
.crumb-demo-bar b { color: var(--ink); font-weight: 600; }
.crumb-demo-caret { font-size: 10px; color: var(--muted); margin-left: 2px; }
@media (max-width: 768px) { .crumb-demo { padding: 14px; } .crumb-demo-list { min-width: 170px; } }
.notice-card { width: 520px; max-width: calc(100% - 32px); background: var(--surface); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.notice-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); }
.notice-card p.hint { font-size: var(--fs-body); color: var(--text-2); }
.notice-card .start-btn { margin-top: 6px; }
.back-x { font-size: 18px; margin-right: 10px; }
.disclaimer { border-top: 1px solid var(--surface-2); padding-top: 12px; margin-top: 12px; }
.disclaimer b { color: var(--text-2); font-weight: 600; }
.disclaimer + .disclaimer { border-top: 0; padding-top: 0; margin-top: 8px; }
.amhead, .amrow { display: grid; grid-template-columns: 20px 1fr 40px 90px 44px; align-items: center; gap: 8px; }
.amhead { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-family: var(--font-narrow); font-weight: 600; margin: 4px 0 2px; }
.amhead span:nth-child(3) { text-align: right; }
.amhead span:nth-child(5) { text-align: right; }
.amrow { padding: 7px 0; border-bottom: 1px solid var(--surface-2); font-size: var(--fs-body); }
.amrow .ci { width: 18px; height: 18px; margin: 0; }
.amrow .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-meta); }
.amrow .track { height: 8px; display: flex; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.amrow .pct { text-align: right; font-variant-numeric: tabular-nums; }
.crumb-up { color: var(--muted); text-decoration: none; }
.crumb-up:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
body[data-view="maps"] .lg-range { display: none !important; }

/* ===================== phone: the map with one sheet under it ====================== */
@media (max-width: 768px) {
  .m-only { display: block; }
  .m-only[hidden] { display: none; }
  .tab-long { display: none; }
  .tab-short { display: inline; }

  /* header: brand + reset + menu on one row, the tabs on the next; never taller */
  #topbar { flex-wrap: wrap; gap: 8px 8px; padding: 10px 12px 8px; }
  .brand-sub { display: none; }
  .brand-wm { font-size: 15px; }
  .spacer { display: none; }
  .nav { order: 3; flex: 1 1 100%; }
  .nav button { flex: 1; text-align: center; padding: 9px 4px; white-space: nowrap; font-size: 12px; letter-spacing: 1.2px; }
  .topact { margin-left: auto; position: relative; }
  .topact button { width: 44px; height: 44px; }
  #btn-about, #btn-share { display: none; }
  #btn-menu { font-size: 18px; }
  #m-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; background: var(--surface); border-radius: var(--r-ctl);
    box-shadow: var(--shadow-card); padding: 6px; z-index: 60; }
  #m-menu button { display: block; width: 100%; text-align: left; border: none; background: transparent; font-family: inherit;
    font-size: 15px; padding: 11px 12px; border-radius: 7px; color: var(--ink); cursor: pointer; }
  #m-menu button:active { background: var(--surface-2); }

  /* floating desktop furniture goes away */
  #ctrlpanel, #bl-stack { display: none; }

  /* map fills; the sheet slides over it */
  #app { position: relative; flex-direction: column; }
  #map-wrap { flex: 1 1 auto; position: relative; }
  #panel { position: absolute; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: none; z-index: 20;
    border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-sheet); display: flex; flex-direction: column;
    overflow: hidden; margin: 0; }
  #panel.anim { transition: height .28s cubic-bezier(.2,.8,.2,1); }
  #panel.empty { display: flex; }
  .sheet-grip { display: flex; justify-content: center; align-items: center; position: static; height: 22px; flex: 0 0 auto;
    cursor: grab; touch-action: none; }
  .sheet-grip span { width: 40px; height: 4px; border-radius: 2px; background: #D1D5DB; }
  .panel-body { padding: 4px 16px 24px; }
  #panel:not(.expanded) .panel-body { overflow: hidden; touch-action: none; }
  #panel.expanded .panel-body { touch-action: pan-y; }
  #scroll-cue, #scroll-cue-top { display: none; }
  .card-head { top: -4px; }
  .m-instr { font-size: 15px; line-height: 1.5; margin: 2px 0 12px; }
  .m-instr b { font-weight: 600; }

  /* the control row at the top of the sheet: Colour · Layers · Show */
  #sheet-controls { display: flex; flex-direction: row; gap: 6px; padding: 0 14px 8px; border: none; overflow-x: auto;
    scrollbar-width: none; flex: 0 0 auto; }
  #sheet-controls::-webkit-scrollbar { display: none; }
  #sheet-controls[hidden] { display: none; }
  #sheet-controls > * { width: auto; flex: 0 0 auto; }
  #sheet-controls > [hidden] { display: none; }
  #sheet-controls .dd + .dd { border-left: none; }
  #sheet-controls .dd-btn { height: 40px; border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 0 12px; font-size: 13px; }
  #sheet-controls .dd-btn b { font-weight: 600; }
  #sheet-controls .dd-menu { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-width: 0; border-radius: 16px 16px 0 0;
    padding: 12px 12px 20px; z-index: 65; box-shadow: 0 -8px 32px rgba(0,0,0,.2); }
  #sheet-controls .dd-opt, #sheet-controls .dd-check { min-height: 44px; font-size: 15px; }
  #sheet-controls .dd-sel select { font-size: 15px; }

  /* map furniture */
  .maplibregl-ctrl-top-right { top: 10px; right: 10px; }
  .maplibregl-ctrl-group button { width: 44px; height: 44px; }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
  .m-fab { position: absolute; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,.22); display: grid; place-items: center; color: var(--ink); cursor: pointer; z-index: 5; padding: 0; }
  #m-search { top: 158px; }
  #m-crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 1.5px solid var(--ink);
    border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.5); z-index: 5; }
  #m-crosshair::before, #m-crosshair::after { content: ""; position: absolute; background: var(--ink); }
  #m-crosshair::before { left: -5px; right: -5px; top: 50%; height: 1.5px; margin-top: -.75px; }
  #m-crosshair::after { top: -5px; bottom: -5px; left: 50%; width: 1.5px; margin-left: -.75px; }
  .m-pill { position: absolute; height: 44px; border: none; border-radius: 999px; padding: 0 16px; background: var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,.22); font-family: inherit; font-size: 14px; color: var(--ink); display: inline-flex;
    align-items: center; gap: 6px; z-index: 15; cursor: pointer; white-space: nowrap; bottom: 160px; }
  .m-pill[hidden] { display: none; }
  #m-legend-pill { left: 10px; }
  #m-pin { right: 10px; padding: 0 26px; }
  .m-pill--dark { background: var(--ink); color: #fff; font-weight: 600; }
  #zoom-hint { top: 0; bottom: 150px; }

  /* cards that rise from the bottom over a dimmed map */
  .m-overlay { position: absolute; inset: 0; background: rgba(17,24,39,.55); z-index: 30; display: flex; align-items: flex-end; }
  .m-overlay[hidden] { display: none; }
  .m-card { margin: 0 10px 10px; width: calc(100% - 20px); background: var(--surface); border-radius: 16px; padding: 14px 16px 18px;
    box-shadow: var(--shadow-card); max-height: 70%; overflow-y: auto; }
  .m-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .m-card-body #legend-body { padding: 0; }
  .m-x { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--muted); font-size: 16px;
    display: grid; place-items: center; cursor: pointer; font-family: inherit; flex: 0 0 auto; }
  #transit-notice, #compare-notice { align-items: flex-end; }
  #start-sheet { background: rgba(17,24,39,.55); }
  #start-sheet .start-card { width: auto; margin: 0 10px 10px; border-radius: 16px; overflow: hidden; padding-bottom: 16px; }
  .notice-card { width: auto; max-width: none; margin: 0 10px 10px; border-radius: 16px; padding: 18px 18px 16px; }
  .notice-card p { font-size: 14px; }

  /* the picker: search or browse, full height */
  #m-picker { position: absolute; inset: 0; z-index: 40; background: var(--surface); display: flex; flex-direction: column; }
  #m-picker[hidden] { display: none; }
  .m-picker-head { display: flex; gap: 8px; align-items: center; padding: 12px 12px; border-bottom: 1px solid var(--border); }
  .m-picker-head input { flex: 1; height: 44px; font: inherit; font-size: 16px; padding: 0 12px; border: 1px solid var(--border);
    border-radius: var(--r-ctl); outline: none; background: var(--surface); color: var(--ink); }
  .m-plist { flex: 1; overflow-y: auto; padding: 6px 8px 24px; -webkit-overflow-scrolling: touch; }
  .m-plist .m-lh { font-family: var(--font-narrow); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600;
    color: var(--muted); padding: 14px 10px 4px; }
  .m-plist button { display: block; width: 100%; text-align: left; border: none; background: transparent; font-family: inherit;
    font-size: 15px; color: var(--ink); padding: 12px 10px; border-bottom: 1px solid var(--surface-2); cursor: pointer; border-radius: 8px; }
  .m-plist button:active { background: var(--surface-2); }
  .m-plist button small { color: var(--muted); font-size: 12px; margin-left: 6px; }

  /* transit route rows: chips wrap instead of running off the sheet */
  .dest-group .chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
  body[data-view="transit"] #sheet-controls #road-viz { display: none; }
  .lg-dots { max-width: 200px; }
}
