/* Duara Maps -- the map app.
 *
 * One full-screen map with everything else floating on it, the layout every map app has
 * converged on: search and the side sheet top-left, category chips beside the search, map
 * controls bottom-right, the layers switch bottom-left, legends bottom-centre. On a phone the
 * side sheet becomes a bottom sheet and the chips scroll.
 *
 * Self-contained: the portal's stylesheet is not loaded here, because nothing on this page is
 * portal chrome. The two fonts are the portal's own, bundled in the binary. */

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('/assets/fonts/dm-sans-latin-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('/assets/fonts/material-symbols-rounded.woff2') format('woff2');
}

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --green: #188038;
  --red: #d93025;
  --ink: #202124;
  --ink-2: #3c4043;
  --ink-3: #5f6368;
  --ink-4: #80868b;
  --line: #dadce0;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --shadow-lg: 0 2px 6px rgba(60,64,67,.3), 0 6px 18px 4px rgba(60,64,67,.15);
  --radius: 24px;
  --t-free: #1ea362;
  --t-light: #f7c52b;
  --t-moderate: #f5840c;
  --t-heavy: #e8453c;
  --t-standstill: #8c1d18;
  --nav-green: #0b8043;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
.gm.night {
  --ink: #e8eaed;
  --ink-2: #dadce0;
  --ink-3: #bdc1c6;
  --ink-4: #9aa0a6;
  --line: #3c4043;
  --surface: #202124;
  --surface-2: #2d2f31;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 8px 3px rgba(0,0,0,.25);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 8px 24px 6px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 14px/1.4 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: #e5e3df;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mi {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: var(--mi-size, 24px);
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' var(--mi-fill, 0), 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  vertical-align: middle;
}
.mi-fill { --mi-fill: 1; }
.mi-16 { --mi-size: 16px; }
.mi-18 { --mi-size: 18px; }

.map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale { margin-left: 128px; margin-bottom: 14px; }

/* ------------------------------------------------------------------ search panel */
.panel {
  position: absolute; top: calc(12px + var(--safe-t)); left: 12px; z-index: 5;
  width: 392px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 24px);
  pointer-events: none;
}
.panel > * { pointer-events: auto; }
.searchbar {
  display: flex; align-items: center; height: 48px; padding: 0 4px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.searchbar input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font-size: 15px; padding: 0 6px;
}
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.ic {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-3); text-decoration: none; flex: none;
}
.ic:hover { background: var(--surface-2); }
.ic.sm { width: 32px; height: 32px; }
.ic-dir { color: var(--blue); }

.suggest, .sheet {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden auto; max-height: calc(100vh - 110px);
  overscroll-behavior: contain;
}
.suggest button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0;
  background: transparent; text-align: left;
}
.suggest button:hover, .suggest button.cur { background: var(--surface-2); }
.suggest .mi { color: var(--ink-4); }
.suggest b { display: block; font-weight: 500; }
.suggest small { color: var(--ink-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

.sheet-head { padding: 16px 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.25; }
.sheet-head .sub { color: var(--ink-3); margin-top: 4px; }
.sheet-close { float: right; margin: -6px -8px 0 8px; }
.cat { color: var(--ink-3); }
.actions { display: flex; gap: 8px; padding: 8px 16px 12px; overflow-x: auto; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px;
  border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 500;
}
.act .mi {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); --mi-size: 20px;
}
.act.primary .mi { background: var(--blue); color: #fff; border-color: var(--blue); }
.rows { border-top: 1px solid var(--line); }
.row { display: flex; gap: 16px; align-items: flex-start; padding: 12px 16px; color: var(--ink-2); }
.row .mi { color: var(--blue); --mi-size: 22px; }
.row small { color: var(--ink-3); }
.list-item {
  display: flex; gap: 12px; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; align-items: center;
}
.list-item:hover { background: var(--surface-2); }
.list-item .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; font-size: 12px; font-weight: 600; }
.list-item b { font-weight: 500; }
.list-item small { color: var(--ink-3); display: block; }
.empty { padding: 20px 16px; color: var(--ink-3); }

/* ------------------------------------------------------------------ directions */
.dir-head { padding: 8px 8px 12px 8px; background: var(--surface); }
.dir-modes { display: flex; justify-content: space-around; padding: 4px 8px 8px; }
.dir-modes button {
  border: 0; background: transparent; border-radius: 16px; padding: 4px 12px; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; font-size: 11px;
}
.dir-modes button.on { background: #e8f0fe; color: var(--blue); }
.gm.night .dir-modes button.on { background: #394457; color: #8ab4f8; }
.dir-fields { display: grid; grid-template-columns: 28px 1fr 36px; gap: 6px 4px; align-items: center; padding: 0 8px; }
.dir-fields .pin { display: grid; place-items: center; color: var(--ink-4); }
.dir-fields input {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface);
  outline: 0; width: 100%;
}
.dir-fields input:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.dir-swap { grid-row: span 2; }
.dir-suggest { margin: 4px 8px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dir-opts { display: flex; gap: 12px; align-items: center; padding: 8px 16px 0; color: var(--ink-3); font-size: 13px; }
.routes { border-top: 8px solid var(--surface-2); }
.route-card {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 4px 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; border-left: 4px solid transparent;
}
.route-card.sel { border-left-color: var(--blue); background: rgba(26,115,232,.04); }
.route-card .mode { color: var(--ink-3); }
.route-card .dur { font-size: 18px; font-weight: 500; }
.route-card .dur.slow { color: var(--t-heavy); }
.route-card .dur.ok { color: var(--nav-green); }
.route-card .dist { color: var(--ink-3); text-align: right; }
.route-card .via { grid-column: 2 / 4; color: var(--ink-3); font-size: 13px; }
.route-card .badges { grid-column: 2 / 4; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.badge.warn { background: #fce8e6; color: #a50e0e; }
.badge.good { background: #e6f4ea; color: #137333; }
.gm.night .badge.warn { background: #5c2b29; color: #f6aea9; }
.gm.night .badge.good { background: #1e3a2a; color: #81c995; }
.route-card .go { grid-column: 2 / 4; display: flex; gap: 8px; margin-top: 6px; }
.btn {
  border: 0; border-radius: 18px; padding: 8px 16px; font-weight: 500; display: inline-flex;
  align-items: center; gap: 6px; background: var(--surface-2); color: var(--blue);
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.steps li:hover { background: var(--surface-2); }
.steps .mi { color: var(--ink-3); }
.steps small { color: var(--ink-3); display: block; }

/* ------------------------------------------------------------------ chips and weather */
.chips {
  position: absolute; top: calc(12px + var(--safe-t)); left: 416px; right: 180px; z-index: 4;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink-2); font-weight: 500; font-size: 13px;
}
.chip .mi { --mi-size: 18px; color: var(--cc, var(--ink-3)); }
.chip { transition: background .15s, color .15s, transform .1s; }
.chip:active { transform: scale(.96); }
.chip.on { background: #e8f0fe; color: var(--blue); }
.chip.on { background: color-mix(in srgb, var(--cc, var(--blue)) 16%, var(--surface)); color: color-mix(in srgb, var(--cc, var(--blue)) 80%, var(--ink)); }
.chip.on .mi { color: var(--cc, var(--blue)); --mi-fill: 1; }
.weather {
  position: absolute; top: calc(16px + var(--safe-t)); right: 12px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0;
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-weight: 500;
}
.weather .mi { --mi-size: 20px; color: #f29900; }

/* ------------------------------------------------------------------ controls */
.ctrls {
  position: absolute; right: 12px; bottom: calc(28px + var(--safe-b)); z-index: 4;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.ctrl {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink-3);
}
.ctrl:hover { color: var(--ink); }
.ctrl.on { color: var(--blue); }
.ctrl-text { font-weight: 600; font-size: 13px; }
.ctrl-zoom { display: flex; flex-direction: column; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.ctrl-zoom .ctrl { box-shadow: none; border-radius: 0; }
.ctrl-zoom .ctrl + .ctrl { border-top: 1px solid var(--line); }
.compass { transition: transform .2s; color: #ea4335; }
#btn-locate.on { color: var(--blue); }
#btn-locate.follow .mi { --mi-fill: 1; }

/* ------------------------------------------------------------------ layers */
.layers-dock { position: absolute; left: 12px; bottom: calc(24px + var(--safe-b)); z-index: 5; }
.mini {
  position: relative; width: 76px; height: 76px; padding: 0; border: 2px solid #fff; border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow-lg); background: #ccc;
}
.mini-thumb { position: absolute; inset: 0; background-size: cover; background-position: center; }
.mini-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 4px 4px; color: #fff; font-size: 12px;
  font-weight: 500; background: linear-gradient(transparent, rgba(0,0,0,.65)); display: flex; align-items: center; gap: 2px; justify-content: center;
}
.layers-pop {
  position: absolute; left: 0; bottom: 88px; width: 344px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 150px); overflow: auto; padding: 12px 16px 16px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.layers-pop h3 { font-size: 14px; font-weight: 500; margin: 12px 0 8px; }
.lp-head { display: flex; justify-content: space-between; align-items: center; }
.lp-head h3 { margin-top: 0; }
.lp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px; }
.lp-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent;
  font-size: 12px; color: var(--ink-2); padding: 0; text-align: center; line-height: 1.2;
}
.lp-opt .ico {
  width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; border: 2px solid transparent;
  background: var(--surface-2); color: var(--ink-3); background-size: cover; background-position: center;
}
.lp-opt.on .ico { border-color: var(--blue); color: var(--blue); background-color: #e8f0fe; }
.gm.night .lp-opt.on .ico { background-color: #394457; }
.lp-opt.on { color: var(--blue); font-weight: 500; }
.lp-opt.na { opacity: .45; cursor: not-allowed; }
.lp-switches { display: flex; gap: 20px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: relative; width: 34px; height: 14px; border-radius: 7px; background: #bdc1c6; flex: none;
}
.switch span::after {
  content: ''; position: absolute; left: -3px; top: -3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s;
}
.switch input:checked + span { background: #8ab4f8; }
.switch input:checked + span::after { transform: translateX(20px); background: var(--blue); }

/* ------------------------------------------------------------------ legends */
.legends {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 4;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.legend {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 6px 14px; border-radius: 8px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13px; position: relative; white-space: nowrap;
}
.legend small { display: block; color: var(--ink-3); font-size: 11px; }
.legend b { font-weight: 500; }
.legend > .mi { color: var(--ink-3); }
.lg-mode { border: 0; background: transparent; display: inline-flex; align-items: center; gap: 2px; padding: 0; font-weight: 500; }
.lg-scale { display: inline-flex; align-items: center; gap: 2px; }
.lg-scale em { font-style: italic; color: var(--ink-3); font-size: 12px; margin: 0 4px; }
.lg-scale i { width: 16px; height: 6px; border-radius: 2px; background: var(--c); }
.lg-scale.aqi i { width: 12px; }
.lg-note { color: var(--ink-3); font-size: 12px; }
.lg-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; background: var(--surface); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 6px 0; min-width: 240px;
}
.lg-menu > button { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 8px 14px; text-align: left; }
.lg-menu > button:hover { background: var(--surface-2); }
.typical { padding: 6px 14px 10px; border-top: 1px solid var(--line); }
.days { display: flex; gap: 4px; margin-bottom: 8px; }
.days button { border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 2px 7px; font-size: 12px; }
.days button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.typical input[type=range] { width: 100%; accent-color: var(--blue); }
.typical-hour { text-align: center; color: var(--ink-3); }

/* ------------------------------------------------------------------ navigation */
.nav { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.nav > * { pointer-events: auto; }
.nav-top { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; max-width: 520px; }
.nav-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px;
  background: var(--nav-green); color: #fff; box-shadow: var(--shadow-lg);
}
.nav-banner.reroute { background: #5f6368; }
.nav-arrow { --mi-size: 52px; }
.nav-dist { font-size: 30px; font-weight: 600; line-height: 1.05; }
.nav-street { font-size: 19px; font-weight: 500; opacity: .95; line-height: 1.2; }
.nav-then {
  display: inline-flex; align-items: center; gap: 6px; margin-top: -4px; margin-left: 10px;
  padding: 10px 14px 6px; background: #0a6a37; color: #fff; border-radius: 0 0 12px 12px; font-weight: 500;
}
.nav-then .mi { --mi-size: 22px; }
.nav-alert {
  margin-top: 8px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
}
.nav-alert .mi { color: var(--t-heavy); }
.nav-alert .vote { margin-left: auto; display: flex; gap: 6px; }
.nav-speed { position: absolute; left: 12px; bottom: calc(112px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; }
.spd {
  width: 64px; height: 64px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.spd b { font-size: 24px; }
.spd small { font-size: 10px; color: var(--ink-3); }
.spd.over b { color: var(--red); }
.limit {
  width: 48px; height: 48px; border-radius: 50%; background: #fff; border: 5px solid #d93025;
  display: grid; place-items: center; font-weight: 700; color: #000; font-size: 17px; box-shadow: var(--shadow);
}
.nav-side { position: absolute; right: 12px; top: 40%; display: flex; flex-direction: column; gap: 10px; }
.nav-side .ctrl { width: 48px; height: 48px; border-radius: 50%; }
.ctrl-report { color: #f29900 !important; }
.nav-recenter {
  position: absolute; left: 12px; bottom: calc(190px + var(--safe-b)); border: 0; border-radius: 20px; padding: 10px 16px;
  background: var(--surface); color: var(--blue); box-shadow: var(--shadow-lg); font-weight: 500; display: flex; gap: 6px; align-items: center;
}
.nav-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px calc(14px + var(--safe-b)); background: var(--surface); box-shadow: 0 -2px 10px rgba(0,0,0,.15);
  border-radius: 16px 16px 0 0;
}
.nav-exit { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fce8e6; color: var(--red); display: grid; place-items: center; }
.gm.night .nav-exit { background: #5c2b29; color: #f6aea9; }
.nav-eta { flex: 1; text-align: center; }
.eta-main b { font-size: 24px; color: var(--nav-green); }
.gm.night .eta-main b { color: #81c995; }
.eta-sub { color: var(--ink-3); font-size: 15px; }
.nav-more { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.nav-sim {
  position: absolute; top: calc(10px + var(--safe-t)); right: 12px; display: flex; align-items: center; gap: 6px;
  background: rgba(32,33,36,.85); color: #fff; padding: 6px 10px; border-radius: 16px; font-size: 12px;
}
.nav-sim button { border: 0; background: rgba(255,255,255,.18); color: #fff; border-radius: 10px; padding: 2px 8px; }
.gm.navigating .panel, .gm.navigating .chips, .gm.navigating .weather, .gm.navigating .layers-dock,
.gm.navigating .ctrls, .gm.navigating .legends { display: none; }
.gm.navigating .maplibregl-ctrl-bottom-left, .gm.navigating .maplibregl-ctrl-bottom-right { bottom: 88px; }
.steps-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 60vh; overflow: auto; z-index: 9;
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------------ menus, dialogs, viewer */
.ctxmenu {
  position: absolute; z-index: 20; min-width: 240px; background: var(--surface); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 6px 0;
}
.ctxmenu .head { padding: 6px 16px 8px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); margin-bottom: 4px; cursor: copy; }
.ctxmenu button { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; padding: 8px 16px; text-align: left; }
.ctxmenu button:hover { background: var(--surface-2); }
.ctxmenu .mi { color: var(--ink-3); --mi-size: 20px; }
.modal { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.35); display: grid; place-items: end center; }
.modal-card {
  width: min(520px, 100%); background: var(--surface); border-radius: 16px 16px 0 0; padding: 16px 16px calc(20px + var(--safe-b));
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 500; }
.modal-sub { color: var(--ink-3); margin: 4px 0 12px; }
.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; margin-bottom: 12px; }
.report-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; font-size: 12px; }
.report-grid .mi { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c); --mi-size: 28px; }
#report-desc { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); }
.viewer { position: absolute; inset: 0; z-index: 25; background: #000; display: flex; flex-direction: column; }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: 8px; color: #fff; background: rgba(0,0,0,.6); }
.viewer-top .ic { color: #fff; }
.viewer-meta { flex: 1; font-size: 13px; }
.viewer-meta small { display: block; opacity: .7; }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.viewer-strip { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: rgba(0,0,0,.6); }
.viewer-strip img { width: 96px; height: 64px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: .7; flex: none; }
.viewer-strip img.cur { opacity: 1; outline: 2px solid #8ab4f8; }
.drawer { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.35); }
.drawer-card {
  position: absolute; top: 0; left: 0; bottom: 0; width: 320px; max-width: 86vw; background: var(--surface);
  padding: 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-lg);
}
.drawer-card a, .drawer-card > button {
  display: flex; gap: 14px; align-items: center; padding: 10px 8px; border-radius: 8px; color: var(--ink-2);
  text-decoration: none; border: 0; background: transparent; text-align: left;
}
.drawer-card a:hover, .drawer-card > button:hover { background: var(--surface-2); }
.drawer-card .brand { font-weight: 600; font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.drawer-card .switch { padding: 10px 8px; }
.fine { color: var(--ink-4); font-size: 11px; margin-top: auto; }
.toast {
  position: absolute; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%) translateY(20px); z-index: 40;
  background: #323232; color: #fff; padding: 10px 16px; border-radius: 6px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.maplibregl-popup-content { border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow-lg); font: 13px/1.4 'DM Sans', system-ui, sans-serif; background: var(--surface); color: var(--ink); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.pop h4 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.pop p { margin: 2px 0; color: var(--ink-3); }
.pop .vote { display: flex; gap: 6px; margin-top: 8px; }
.pop .btn { padding: 5px 10px; font-size: 12px; }


/* ------------------------------------------------------------------ search states
 *
 * A search is never a blank sheet: skeleton rows while nothing is known, the map's own places
 * while the full answer is coming, then the answer -- each row rising in, a beat apart. */
#btn-search { position: relative; }
.searchbar.busy #btn-search::after {
  content: ''; position: absolute; inset: 9px; border-radius: 50%;
  border: 2px solid var(--blue); border-right-color: transparent; animation: spin .7s linear infinite;
}
.searchbar.busy #btn-search .mi { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.sg-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 2px; color: var(--ink-3); font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.sg-head button { border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 500; padding: 2px 4px; }
.suggest .sg-cat .cat-ic .mi { color: #fff; }

.cat-ic {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cc, var(--ink-4)); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.cat-ic .mi { --mi-size: 18px; --mi-fill: 1; color: #fff; }
.cat-ic.lg { width: 40px; height: 40px; }
.cat-ic.lg .mi { --mi-size: 22px; }

.res-head { display: flex; align-items: center; gap: 12px; position: relative; padding-bottom: 12px; }
.res-head > div { flex: 1; min-width: 0; }
.res-head h2 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-head .sheet-close { order: 3; float: none; margin: 0 -8px 0 0; align-self: flex-start; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; background: color-mix(in srgb, var(--blue) 12%, transparent); }
.progress i { position: absolute; top: 0; bottom: 0; width: 40%; background: var(--blue); border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { left: -40%; } to { left: 100%; } }

.results { border-top: 1px solid var(--line); }
.result {
  display: flex; gap: 12px; align-items: center; padding: 11px 8px 11px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; outline: 0; animation: rise .32s cubic-bezier(.2,.7,.3,1) both; animation-delay: var(--d, 0ms);
  transition: background .12s;
}
.result:hover, .result.hl, .result:focus-visible { background: var(--surface-2); }
.result:focus-visible { box-shadow: inset 3px 0 0 var(--blue); }
.result .lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.result b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result small { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .go { color: var(--blue); flex: none; }
.result .go:hover { background: color-mix(in srgb, var(--blue) 12%, transparent); }
em.open, em.shut { font-style: normal; font-weight: 500; }
em.open { color: var(--green); }
em.shut { color: var(--red); }
.gm.night em.open { color: #81c995; }
.gm.night em.shut { color: #f28b82; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.result.skel { cursor: default; }
.result.skel .cat-ic { background: var(--surface-2); box-shadow: none; }
.result.skel .lines i {
  display: block; height: 10px; margin: 4px 0; border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 100%);
  background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; animation-delay: var(--d, 0ms);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.notice {
  display: flex; gap: 10px; align-items: center; margin: 4px 12px 10px; padding: 10px 12px; border-radius: 12px;
  background: #fef7e0; color: #6d4c00;
}
.notice .mi { color: #e37400; }
.notice div { flex: 1; min-width: 0; }
.notice b { display: block; font-weight: 500; }
.notice small { color: inherit; opacity: .85; }
.gm.night .notice { background: #3c3320; color: #fde293; }
.notice.info { background: #e8f0fe; color: #174ea6; }
.notice.info .mi { color: var(--blue); }
.gm.night .notice.info { background: #1f2a3d; color: #aecbfa; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.state { text-align: center; padding: 22px 28px 28px; animation: rise .3s ease both; }
.state-ic {
  --mi-size: 30px; width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--surface-2); color: var(--ink-3); margin-bottom: 10px;
}
.state h3 { margin: 0 0 6px; font-size: 17px; font-weight: 500; }
.state p { margin: 0 0 16px; color: var(--ink-3); }
.state .hint { margin: 14px 0 0; font-size: 12px; color: var(--ink-4); }

.more-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; border: 0;
  background: transparent; color: var(--blue); font-weight: 500;
}
.more-btn:hover { background: var(--surface-2); }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0 10px; padding: 4px 10px 4px 6px; border: 0;
  border-radius: 14px; background: transparent; color: var(--blue); font-size: 13px; font-weight: 500;
  max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.back-btn:hover { background: var(--surface-2); }

.near-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; padding: 8px 12px 14px; border-top: 1px solid var(--line); animation: rise .25s ease both; }
.near-grid h4 { grid-column: 1 / -1; margin: 6px 4px 4px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.near-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border: 0; border-radius: 12px;
  background: transparent; font-size: 12px; color: var(--ink-2);
}
.near-grid button:hover { background: var(--surface-2); }

.area-pill {
  position: absolute; top: calc(62px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 18px;
  background: var(--surface); color: var(--blue); font-weight: 500; box-shadow: var(--shadow-lg);
  animation: drop .25s cubic-bezier(.2,.8,.3,1.2) both;
}
.area-pill:hover { background: var(--surface-2); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.gm.navigating .area-pill { display: none; }

/* With the side sheet open on a desktop, the map controls that live bottom-left move out from
 * under it, and the "Search this area" pill centres on the map that is still visible. */
@media (min-width: 721px) {
  .layers-dock, .maplibregl-ctrl-bottom-left { transition: transform .2s ease; }
  .gm.sheet-open .layers-dock, .gm.sheet-open .maplibregl-ctrl-bottom-left { transform: translateX(404px); }
  .gm.sheet-open .area-pill { left: calc(50% + 202px); }
  .legends { transition: left .2s ease; }
  .gm.sheet-open .legends { left: calc(50% + 250px); }
}

/* ------------------------------------------------------------------ phones */
@media (max-width: 720px) {
  .panel { width: auto; right: 12px; }
  .chips { left: 0; right: 0; top: calc(66px + var(--safe-t)); padding: 4px 12px 8px; }
  .weather { top: calc(112px + var(--safe-t)); }
  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; max-height: 55vh; border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-lg); z-index: 6;
  }
  .sheet.tall { max-height: 88vh; }
  .suggest { max-height: 50vh; }
  .area-pill { top: calc(116px + var(--safe-t)); }
  .gm.sheet-open .area-pill { top: auto; bottom: calc(55vh + 12px); }
  .layers-pop { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-width: none; border-radius: 16px 16px 0 0; }
  .legends { bottom: calc(112px + var(--safe-b)); max-width: calc(100vw - 24px); }
  .legend { white-space: normal; }
  .ctrls { bottom: calc(112px + var(--safe-b)); }
  .nav-dist { font-size: 26px; }
  .nav-street { font-size: 17px; }
  .nav-arrow { --mi-size: 44px; }
  .maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale { display: none; }
  /* The bottom sheet owns the bottom of the screen while it is up. */
  .gm.sheet-open .layers-dock, .gm.sheet-open .ctrls, .gm.sheet-open .legends { display: none; }
  .lg-note { display: none; }
  .legend { padding: 6px 10px; gap: 8px; }
  /* Four layers on used to stack four cards up to the middle of the screen, over the map a
   * tool needs tapping. On a phone each legend is one line, clear of the controls column;
   * only the tool's, which carries its result, may wrap. */
  .legends { left: 12px; right: 76px; transform: none; max-width: none; align-items: flex-start; gap: 6px; }
  .legend { white-space: nowrap; max-width: 100%; padding: 4px 10px; font-size: 12px; }
  .legend > span:not(.mi):not(.lg-scale) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .legend small { display: inline; margin-left: 6px; }
  .legend > .mi { --mi-size: 18px; }
  #legend-tool { white-space: normal; }
  #legend-tool small { display: block; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .result, .state, .near-grid, .area-pill { animation: none !important; }
  .progress i, .result.skel .lines i { animation-duration: 3s !important; }
}
