:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d2327;
  --muted: #5a656d;
  --line: #e2e0d9;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --link: #1f6feb;
  --chip: #eef3fb;
  /* severity: fills/lines on the map */
  --lv-clear: #2e9e6a;
  --lv-light: #a8c43a;
  --lv-moderate: #e3a21a;
  --lv-heavy: #e0662b;
  --lv-storm: #c2304f;
  /* severity: backgrounds behind white text (≥ 4.5:1) and text on the panel */
  --lv-clear-strong: #23825a;
  --lv-heavy-strong: #c2501a;
  --lv-storm-ink: #b42a47;
  --lv-heavy-ink: #a8431a;
  --pin-from: #1e8a4f;
  --pin-to: #c62f3e;
  --pin-stop: #e07b00;
  --flood-bg: #e8f1ff;
  --me-row: rgb(31 111 235 / .08);
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121518; --panel: #1a1f23; --ink: #e7ecef; --muted: #a3afb6; --line: #2b3238;
    --accent: #1f6feb; --link: #8ab4ff; --chip: #1f2a38; --shadow: 0 1px 2px rgb(0 0 0 / .4);
    --lv-storm-ink: #ff6b81; --lv-heavy-ink: #ff9a5c; --flood-bg: #1c2a3f; --me-row: rgb(138 180 255 / .12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121518; --panel: #1a1f23; --ink: #e7ecef; --muted: #a3afb6; --line: #2b3238;
  --accent: #1f6feb; --link: #8ab4ff; --chip: #1f2a38; --shadow: 0 1px 2px rgb(0 0 0 / .4);
  --lv-storm-ink: #ff6b81; --lv-heavy-ink: #ff9a5c; --flood-bg: #1c2a3f; --me-row: rgb(138 180 255 / .12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65; /* room for Thai tone marks */
}
:lang(zh-CN) body, html:lang(zh-CN) { font-family: "Noto Sans SC", "IBM Plex Sans Thai", system-ui, sans-serif; }
a { color: var(--link); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.layout { display: grid; grid-template-columns: 390px 1fr; height: 100vh; }
.panel {
  overflow-y: auto; padding: 20px 20px 16px; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px;
}
.map-wrap { position: relative; }
#map { position: absolute; inset: 0; background: var(--bg); }

/* ---------- header ---------- */
.brand { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.brand h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.brand p { margin: 0; color: var(--muted); }
.brand-tools { display: flex; flex-direction: column; align-items: end; gap: 4px; flex: none; }
.lang-pick select { width: auto; min-height: 40px; padding: 4px 8px; font-size: 16px; }
.support-link { font-size: 13px; text-decoration: none; white-space: nowrap; padding: 4px 0; }

/* ---------- tabs ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--chip); border-radius: 12px; }
.tabs [role="tab"] {
  font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.tab-panel { display: flex; flex-direction: column; gap: 14px; }

/* ---------- place weather ---------- */
.pw-items { display: flex; flex-direction: column; gap: 10px; }
.pw-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pin-dot.pin-place { background: #0e8a8a; }
.pin-place svg path { fill: #0e8a8a; }
.pw-pin-wx { position: absolute; left: 22px; top: -8px; width: 24px; height: 24px; background: #fff; border-radius: 50%; padding: 1px; box-shadow: 0 1px 3px rgb(0 0 0 / .35); }
.pw-results { display: flex; flex-direction: column; gap: 12px; }
.pw-results[aria-busy="true"] { opacity: .45; }
.pw-card {
  border-radius: 12px; padding: 12px 14px; background: var(--chip); border-left: 6px solid var(--lv-clear); cursor: pointer;
}
.pw-card[data-level="moderate"] { border-left-color: var(--lv-moderate); }
.pw-card[data-level="storm"] { border-left-color: var(--lv-storm); }
.pw-card header { display: flex; gap: 10px; align-items: start; }
.pw-card h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.pw-when { margin: 0; font-size: 14px; color: var(--muted); }
.pin-badge {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: #0e8a8a; color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 2px;
}
.pw-head { margin: 8px 0 0; display: flex; align-items: center; gap: 6px; font-size: 16px; }
.pw-tip { margin: 2px 0 0; font-size: 14px; }
.pw-card .meta { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.pw-low { margin: 6px 0 0; font-size: 13px; color: var(--lv-heavy-ink); font-weight: 500; }
.pw-fresh { font-size: 13px; color: var(--muted); margin: 0; }
.pw-hours {
  list-style: none; margin: 10px -4px 0; padding: 0 4px 6px; display: flex; gap: 6px;
  overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; cursor: default;
}
.pw-hours li {
  flex: 0 0 64px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 2px; border-radius: 10px; background: var(--panel); border-top: 4px solid var(--lv-clear); font-size: 12px;
}
.pw-hours li[data-level="light"] { border-top-color: var(--lv-light); }
.pw-hours li[data-level="moderate"] { border-top-color: var(--lv-moderate); }
.pw-hours li[data-level="heavy"] { border-top-color: var(--lv-heavy); }
.pw-hours li[data-level="storm"] { border-top-color: var(--lv-storm); }
.pw-hours .h-t { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.pw-hours .h-temp { font-weight: 600; font-size: 14px; }
.pw-hours .h-mm, .pw-hours .h-p { color: var(--muted); white-space: nowrap; }

/* ---------- form ---------- */
.trip-form { display: flex; flex-direction: column; gap: 12px; }
.places { display: flex; flex-direction: column; gap: 10px; }
#stops { display: contents; }
.field { display: flex; flex-direction: column; gap: 4px; position: relative; min-width: 0; flex: 1; }
.field.narrow { flex: 0 0 104px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.row { display: flex; gap: 10px; }
input, select {
  font: inherit; font-size: 16px; /* ≥16px stops iOS zooming on focus */
  color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; min-height: 44px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.place-row { display: flex; gap: 6px; }
.place.is-set input { border-color: var(--lv-clear); }
.btn-icon {
  flex: 0 0 44px; min-height: 44px; font-size: 18px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); border-radius: 8px; cursor: pointer;
}
.btn-icon.remove { font-size: 15px; color: var(--muted); }
.link-btn {
  align-self: flex-start; font: inherit; font-size: 14px; color: var(--link); background: none; border: 0;
  padding: 0; min-height: 44px; cursor: pointer;
}
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; margin: 4px 0 0; padding: 4px;
  list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); max-height: 280px; overflow-y: auto;
}
.suggest li { padding: 11px 12px; border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1.45; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--chip); }

.pin-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); flex: none; }
.pin-dot.pin-from { background: var(--pin-from); }
.pin-dot.pin-to { background: var(--pin-to); }
.pin-dot.pin-stop { background: var(--pin-stop); }

.vehicles { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vehicles legend { grid-column: 1 / -1; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; padding: 0; }
.vehicles label { position: relative; cursor: pointer; }
.vehicles input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.vehicles span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px;
  padding: 4px 6px; border-radius: 10px; font-size: 14px; line-height: 1.3;
  border: 1px solid var(--line); background: var(--bg);
}
.vehicles input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.vehicles input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint { margin: 0; font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-primary {
  font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 9px 18px; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-primary:disabled { opacity: .7; cursor: progress; }
.chip {
  font: inherit; font-size: 14px; background: var(--chip); color: var(--ink); text-decoration: none;
  border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}

.trip-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--chip); border-radius: 12px;
}
.trip-bar p { margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }

.status { margin: 0; color: var(--muted); font-size: 14px; }
.status:empty { display: none; }
.status:not(:empty) {
  position: sticky; bottom: 8px; z-index: 5; background: var(--panel); padding: 8px 12px;
  border-radius: 10px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.status.error { color: var(--lv-storm-ink); }

/* ---------- result ---------- */
.result { display: flex; flex-direction: column; gap: 4px; transition: opacity .2s; }
.result[aria-busy="true"] { opacity: .45; pointer-events: none; }
.result h2 { font-size: 16px; font-weight: 600; margin: 16px 0 4px; }

.summary {
  border-radius: 12px; padding: 12px 14px; background: var(--chip); border-left: 6px solid var(--lv-clear);
  scroll-margin-top: 12px; outline: none;
}
.summary[data-level="moderate"] { border-left-color: var(--lv-moderate); }
.summary[data-level="storm"] { border-left-color: var(--lv-storm); }
.summary .sum-verdict { margin: 0 0 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.summary .sum-route { font-size: 14px; color: var(--muted); font-weight: 500; }
.summary strong { display: block; font-size: 18px; line-height: 1.45; }
.summary .meta { display: block; color: var(--muted); font-size: 14px; }
.summary .flood-line { color: var(--lv-storm-ink); font-weight: 500; }
.summary .fresh { margin-top: 6px; font-size: 13px; }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }

.disclaimer {
  margin-top: 6px; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  border: 1px dashed var(--lv-moderate); background: color-mix(in srgb, var(--lv-moderate) 8%, transparent);
}
.disclaimer strong { font-size: 14px; }
.disclaimer p { margin: 2px 0 0; color: var(--muted); }

.verdict { display: inline-block; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 0 10px; margin-right: 4px; color: #fff; }
.verdict.ok { background: var(--lv-clear-strong); }
.verdict.caution { background: var(--lv-moderate); color: #1d2327; }
.verdict.avoid { background: var(--lv-storm); }
.verdict.best { background: var(--accent); }

.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.nav-go { flex: 1 1 100%; min-height: 48px; font-size: 16px; }
.nav-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.nav-note.bad { color: var(--lv-storm-ink); font-weight: 500; }
.warnings { margin-top: 8px; font-size: 13px; color: var(--lv-heavy-ink); }

.alt-routes { margin-top: 12px; }
.alt-routes > summary {
  cursor: pointer; font-weight: 600; font-size: 16px; min-height: 44px; display: flex; align-items: center;
}
.routes { display: flex; flex-direction: column; gap: 6px; }
.routes [role="radio"] {
  width: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
}
.routes [aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.routes .r-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.routes .r-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.routes .r-meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.routes-note { margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--link); }
.routes-note.bad { color: var(--lv-storm-ink); }

/* ---------- lists: timeline, events, cameras ---------- */
.timeline, .items { list-style: none; margin: 0; padding: 0; }
.timeline li, .items li {
  display: grid; grid-template-columns: 56px 26px 1fr; gap: 8px; padding: 8px 6px;
  border-radius: 8px; cursor: pointer; align-items: start; border-left: 4px solid transparent;
}
.timeline li:hover, .items li:hover { background: var(--chip); }
.timeline li:focus-visible, .items li:focus-visible, .routes [role="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.timeline li[data-level="light"] { border-left-color: var(--lv-light); }
.timeline li[data-level="moderate"] { border-left-color: var(--lv-moderate); }
.timeline li[data-level="heavy"] { border-left-color: var(--lv-heavy); }
.timeline li[data-level="storm"] { border-left-color: var(--lv-storm); }
.timeline li.stop-row { cursor: default; background: color-mix(in srgb, var(--pin-stop) 10%, transparent); }
.timeline .t, .items .t { font-variant-numeric: tabular-nums; font-weight: 500; font-size: 14px; }
.timeline .w, .items .w { min-width: 0; overflow-wrap: anywhere; }
.items .ic, .timeline .ic { font-size: 17px; line-height: 1.5; text-align: center; }
.items .w small { display: block; color: var(--muted); font-size: 13px; }
.items li.empty { display: block; cursor: default; color: var(--muted); }
.items li.blocked { background: color-mix(in srgb, var(--lv-storm) 10%, transparent); }
.items li.ev-flood .w > span { color: var(--lv-storm-ink); font-weight: 500; }

.rain-name { font-weight: 600; }
.rain-advice { display: block; font-size: 14px; color: var(--ink); }
.rain-sub { display: block; font-size: 13px; color: var(--muted); }
.rain-help { margin: 0 0 6px; font-size: 14px; }
.rain-help summary { cursor: pointer; color: var(--link); padding: 10px 0; }
.rain-help p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.rain-scale { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.rain-scale th, .rain-scale td { text-align: left; vertical-align: top; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
.rain-scale th { font-weight: 600; color: var(--muted); }
.rain-scale td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.count { color: var(--muted); font-weight: 400; }

/* ---------- map marks ---------- */
.wx-badge {
  display: block; width: 34px; height: 34px; padding: 2px; border-radius: 50%;
  background: #fff; border: 3px solid var(--lv-clear); box-shadow: 0 1px 4px rgb(0 0 0 / .35);
}
.lv-ring-light { border-color: var(--lv-light); }
.lv-ring-moderate { border-color: var(--lv-moderate); }
.lv-ring-heavy { border-color: var(--lv-heavy); }
.lv-ring-storm { border-color: var(--lv-storm); }
/* light disc so dark storm clouds stay visible in dark mode */
.wx-inline { display: inline-block; width: 26px; height: 26px; vertical-align: middle; background: #fff; border-radius: 50%; padding: 1px; }
.popup-wx { float: left; width: 36px; height: 36px; margin-right: 6px; }

.pin { position: relative; display: block; width: 30px; height: 40px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .35)); }
.pin svg { width: 30px; height: 40px; display: block; }
.pin svg path { stroke: #fff; stroke-width: 2; }
.pin b { position: absolute; top: 6px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; font-weight: 700; line-height: 16px; }
.pin-from svg path { fill: var(--pin-from); }
.pin-to svg path { fill: var(--pin-to); }
.pin-stop svg path { fill: var(--pin-stop); }

.map-badge {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); box-shadow: var(--shadow); font-size: 13px;
}
.map-badge.ev { border-color: var(--lv-heavy); }
.map-badge.ev-flood { border-color: var(--lv-storm); background: var(--flood-bg); }
.map-badge.adv-ok { border-color: var(--lv-clear); }
.map-badge.adv-slow { border-color: var(--lv-moderate); }
.map-badge.adv-risky { border-color: var(--lv-heavy); border-width: 3px; }
.map-badge.adv-no { border-color: var(--lv-storm); border-width: 3px; }
.adv-tag {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; line-height: 1.5; font-weight: 600; padding: 0 5px; border-radius: 4px;
  background: var(--lv-storm); color: #fff; pointer-events: none;
}
.adv-slow .adv-tag { background: var(--lv-moderate); color: #1d2327; }
.adv-risky .adv-tag { background: var(--lv-heavy-strong); }
.adv-chip { display: inline-block; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 0 8px; color: #fff; }
.adv-chip.adv-ok { background: var(--lv-clear-strong); }
.adv-chip.adv-slow { background: var(--lv-moderate); color: #1d2327; }
.adv-chip.adv-risky { background: var(--lv-heavy-strong); }
.adv-chip.adv-no { background: var(--lv-storm); }
.adv-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.adv-dot.adv-ok { background: var(--lv-clear); }
.adv-dot.adv-slow { background: var(--lv-moderate); }
.adv-dot.adv-risky { background: var(--lv-heavy); }
.adv-dot.adv-no { background: var(--lv-storm); }
.adv-table { border-collapse: collapse; margin: 6px 0; width: 100%; font-size: 13px; }
.adv-table th { text-align: left; font-weight: 500; padding: 4px 8px 4px 0; white-space: nowrap; vertical-align: top; }
.adv-table td { padding: 4px 0; }
.adv-table tr.me { background: var(--me-row); }
.adv-table tr.me th::after { content: ' ◀'; color: var(--accent); font-size: 11px; }

/* ---------- map overlay (layers + legend) ---------- */
.map-overlay {
  position: absolute; z-index: 500; top: 10px; right: 10px; max-width: min(340px, calc(100% - 70px));
  background: var(--panel); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px;
}
.map-overlay > summary {
  cursor: pointer; padding: 0 14px; min-height: 44px; display: flex; align-items: center; font-weight: 500; list-style: none;
}
.map-overlay > summary::-webkit-details-marker { display: none; }
.map-overlay[open] > summary { border-bottom: 1px solid var(--line); }
.layer-toggles { padding: 6px 12px; display: flex; flex-direction: column; }
.layer-toggles label { display: flex; gap: 8px; align-items: center; cursor: pointer; min-height: 40px; }
.layer-toggles input { width: 20px; height: 20px; min-height: 0; }
#radar-time { color: var(--muted); }
.legend { padding: 6px 12px 10px; display: flex; gap: 6px 12px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i.wx-inline { width: 22px; height: 22px; }
.legend-sep { flex-basis: 100%; height: 0; }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }

/* ---------- dialogs ---------- */
.player {
  width: min(720px, calc(100vw - 32px)); max-height: 92svh; overflow: auto; padding: 0; border: 0; border-radius: 12px;
  background: var(--panel); color: var(--ink); box-shadow: 0 10px 40px rgb(0 0 0 / .35);
}
.player::backdrop, .qr-dialog::backdrop { background: rgb(0 0 0 / .55); }
.player header { display: flex; gap: 10px; align-items: start; justify-content: space-between; padding: 12px 14px; }
.player h3 { margin: 0; font-size: 16px; font-weight: 600; }
.player-media { background: #000; height: min(56vw, 62svh); display: grid; place-items: center; overflow: hidden; }
.player-media video, .player-media img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.player-msg { color: #ddd; margin: 0; padding: 16px; text-align: center; }
.player-meta { margin: 0; padding: 10px 14px 14px; font-size: 13px; color: var(--muted); }

.qr-dialog {
  border: 0; border-radius: 14px; padding: 18px; text-align: center; background: #fff; color: #1d2327;
  width: min(360px, calc(100vw - 32px)); max-height: 92svh; overflow: auto;
}
.qr-dialog h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.qr-dialog img { width: 100%; height: auto; display: block; }
.qr-dialog p { margin: 10px 0 12px; font-weight: 500; }
.qr-dialog .chip { background: #eef3fb; color: #1d2327; }
.dialog-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.nav-qr { background: #fff; padding: 8px; line-height: 0; }
.nav-qr svg { width: 100%; height: auto; display: block; }

/* ---------- support + footer ---------- */
.support { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); }
.support h2 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.support > p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.support-body { display: flex; gap: 14px; align-items: center; }
.qr-thumb { flex: none; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: zoom-in; line-height: 0; }
.qr-thumb img { width: 112px; height: 112px; display: block; }
.bank { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; min-width: 0; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; }
.acct { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.acct span { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; }
.support .feedback { margin: 10px 0 0; font-size: 14px; color: var(--ink); }

.credits { margin-top: auto; font-size: 13px; color: var(--muted); }
.credits p { margin: 0 0 6px; }

.leaflet-popup-content { font-family: inherit; line-height: 1.6; }

@media (pointer: coarse) {
  #nav-phone { display: none; } /* a QR to scan with the same phone is useless */
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 46svh auto; height: auto; }
  .map-wrap { grid-row: 1; height: 46svh; position: sticky; top: 0; z-index: 1; transition: height .2s; }
  .panel { grid-row: 2; border-right: 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* while typing, shrink the map so the keyboard and suggestions fit */
  body:has(.trip-form :focus) .map-wrap { position: relative; height: 22svh; }
  .suggest { max-height: 40svh; }
  .summary { scroll-margin-top: calc(46svh + 8px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
