/* app.css: the chrome around the map. Every value binds to tokens.css. */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
.i .fill { fill: currentColor; stroke: none }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.noscript { padding: var(--s5); }

/* ---- the map, full screen --------------------------------------------- */

.map { position: fixed; inset: 0; background: var(--map-bg) }
/* A still photo of the map under the live one, for phone session replays (map.js photo). */
.map-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none }
.map.is-picking .maplibregl-canvas { cursor: crosshair }
.map-error {
  position: fixed; left: var(--edge); right: var(--edge);
  top: calc(env(safe-area-inset-top) + var(--header-h) + var(--tap) + var(--s5));
  z-index: var(--z-float);
  background: var(--err-wash); color: var(--err); border: 1px solid var(--err);
  border-radius: var(--r-control); padding: var(--s3) var(--s4); font-size: var(--t-meta);
}

/* ---- top: search pill, base switch, legend ------------------------------ */

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-header);
  padding: calc(env(safe-area-inset-top) + var(--s2)) var(--edge) 0;
  pointer-events: none;
  display: grid; gap: var(--s2); justify-items: start;
}
.top > * { pointer-events: auto }
.search {
  width: 100%; max-width: 560px;
  display: flex; align-items: center; gap: var(--s1);
  height: var(--header-h);
  padding: 0 var(--s1) 0 var(--s4);
  background: var(--glass); border: 1px solid var(--line-mid); border-radius: var(--r-commit);
  box-shadow: var(--lift-2);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.search-ic { color: var(--ink-2) }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: transparent; border: 0; outline: none;
  font-size: var(--t-body); color: var(--ink);
}
.search input::placeholder { color: var(--ink-2); opacity: 1 }
.search input:focus-visible { box-shadow: none }
.search:focus-within { border-color: var(--signal) }
.search input::-webkit-search-cancel-button { display: none }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-commit); color: var(--ink);
}
.icon-btn:active { background: var(--surface-2) }

.suggest {
  width: 100%; max-width: 560px; list-style: none;
  background: var(--paper); border: 1px solid var(--line-mid); border-radius: var(--r-control);
  box-shadow: var(--lift-3); max-height: 52vh; overflow-y: auto; overscroll-behavior: contain;
}
.suggest li + li { border-top: 1px solid var(--line) }
.sg { width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); text-align: left }
.sg .i { color: var(--ink-2) }
.sg-text { display: grid; min-width: 0 }
.sg-name { font-weight: 600 }
.sg-detail { font-size: var(--t-micro); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.sg-status { padding: var(--s3) var(--s4); font-size: var(--t-meta); color: var(--ink-2) }
.sg-err { color: var(--err) }

.bases {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--glass); border: 1px solid var(--line-mid); border-radius: var(--r-commit);
  box-shadow: var(--lift-1);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.base-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 var(--s3);
  border-radius: var(--r-commit);
  font-size: var(--t-micro); color: var(--ink-2);
}
.base-btn .i { width: 18px; height: 18px }
.base-btn[aria-pressed="true"] { background: var(--signal-wash); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--signal) }

.legend {
  background: var(--glass); border: 1px solid var(--line-mid); border-radius: var(--r-control);
  padding: var(--s2) var(--s3); font-size: var(--t-micro); color: var(--ink-2);
  display: grid; gap: 2px; max-width: 280px;
}
.legend-row { display: flex; align-items: center; gap: var(--s2) }
.legend-ramp {
  flex: 1; min-width: 120px; height: 10px; border-radius: var(--r-commit);
  background: linear-gradient(90deg, var(--relief-1), var(--relief-2), var(--relief-3), var(--relief-4), var(--relief-5), var(--relief-6), var(--relief-7));
}
.legend-note { display: flex; align-items: center; gap: var(--s2); color: var(--ink) }
.legend-src { font-size: var(--t-nano); color: var(--ink-3) }
.bank-dots { display: inline-flex; gap: 2px }
.bank-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--map-ring) }
.bank-dots .b0 { background: var(--bank-ok) }
.bank-dots .b1 { background: var(--bank-watch) }
.bank-dots .b2 { background: var(--bank-warn) }
.bank-dots .b3 { background: var(--bank-over) }

/* A full sheet sits right under the search pill: the map controls under
 * the pill would cover its handle, and the map is hidden anyway. */
.bases, .legend, .ask { transition: opacity var(--t-state) var(--ease) }
body[data-sheet="full"] .bases, body[data-sheet="full"] .legend, body[data-sheet="full"] .ask { opacity: 0; visibility: hidden }

.ask {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--signal); border-radius: var(--r-control);
  padding: var(--s2) var(--s3); box-shadow: var(--lift-2); font-size: var(--t-meta);
  max-width: 560px;
}
.ask-text { flex: 1; min-width: 140px }

/* ---- floating controls, riding on top of the sheet ---------------------- */

.floats {
  position: fixed; left: 0; right: 0; z-index: var(--z-float);
  bottom: calc(var(--sheet-visible, var(--peek-h)) + var(--s3));
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3);
  padding: 0 var(--edge);
  pointer-events: none;
  transition: bottom var(--t-slow) var(--ease), opacity var(--t-state) var(--ease);
}
.floats > * { pointer-events: auto }
body.sheet-dragging .floats { transition: none }
body[data-sheet="full"] .floats { opacity: 0 }
body[data-sheet="full"] .floats > * { pointer-events: none }
.floats .float-stack { display: grid; justify-items: end; gap: var(--s3); margin-left: auto; pointer-events: none }
.floats .float-stack > * { pointer-events: auto }
/* While reporting, the report button would be a second, confusing action. */
body[data-view="flow"] .fab, body[data-view="identity"] .fab { display: none }
.round-btn {
  width: 48px; height: 48px; display: grid; place-items: center;
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--line-mid); border-radius: 50%; box-shadow: var(--lift-2);
}
.round-btn.is-busy .i { animation: spin 1s linear infinite }
.fab {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: var(--fab-h); padding: 0 var(--s5) 0 var(--s4);
  background: var(--signal); color: var(--signal-ink);
  border-radius: var(--r-commit); box-shadow: var(--lift-3);
  font-size: var(--t-body); font-weight: 800; white-space: nowrap;
}
.fab .i { width: 24px; height: 24px; stroke-width: 2.2 }
.fab:active, .round-btn:active, .btn:active, .row:active, .vote:active { transform: scale(.97); transition: transform 60ms linear }
.attrib {
  max-width: 58%; font-size: var(--t-nano); line-height: 1.35; color: var(--ink-2);
  background: var(--glass); border-radius: var(--r-control); padding: 2px var(--s2);
}
.attrib a { color: inherit; text-decoration: none }

/* ---- the sheet ----------------------------------------------------------- */

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
  top: calc(env(safe-area-inset-top) + var(--s2) + var(--header-h) + var(--s2));
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  border-top: 1px solid var(--line-mid); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--lift-3);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translate3d(0, 100%, 0);
  transition: transform var(--t-slow) var(--ease);
  will-change: transform;
}
.sheet.is-dragging { transition: none }
.grab-hint {
  position: absolute; top: 3px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap;
  padding: 0 var(--s3); min-height: 20px; border-radius: var(--r-commit);
  background: var(--signal-wash); border: 1px solid var(--signal); color: var(--ink);
  font-size: var(--t-nano); font-weight: 700; line-height: 1.6;
  pointer-events: none; animation: nudge 1.6s var(--ease) 3;
}
.grab-hint .i { width: 14px; height: 14px }
.sheet:has(.grab-hint) .handle-bar { visibility: hidden }
@keyframes nudge { 50% { transform: translate(-50%, -4px) } }
.sheet-grab { flex: none; padding: 0 var(--s4) var(--s1); touch-action: none; user-select: none; -webkit-user-select: none }
.handle { display: grid; place-items: center; width: 100%; height: 24px; cursor: grab }
.handle-bar { width: 44px; height: 5px; border-radius: var(--r-commit); background: var(--line-strong) }
.peek { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 44px }
.status {
  display: inline-flex; align-items: center; gap: var(--s2); min-width: 0;
  min-height: 36px; padding: 0 var(--s3);
  background: var(--surface-2); border: 1px solid var(--line-mid); border-radius: var(--r-commit);
  font-size: var(--t-micro); color: var(--ink); text-align: left;
}
#status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none }
.status[data-mode="live"] .dot { background: var(--live); animation: pulse 2s var(--ease) infinite }
.status[data-mode="stale"] .dot, .status[data-mode="warn"] .dot { background: var(--stale) }
.status[data-mode="err"] { color: var(--err); border-color: var(--err); background: var(--err-wash) }
.status[data-mode="err"] .dot { background: var(--err) }
.err-tag { font-weight: 800; font-size: var(--t-nano); letter-spacing: .06em; color: var(--paper); background: var(--err); border-radius: 4px; padding: 0 5px }
.counts { display: flex; gap: var(--s1); font-size: var(--t-meta); font-weight: 700; flex: none }
.cnt {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 36px; padding: 0 var(--s2);
  border: 1px solid transparent; border-radius: var(--r-commit);
  font: inherit; font-weight: 700; background: none; cursor: pointer;
}
.cnt[aria-pressed="true"] { border-color: currentColor; background: var(--surface-2) }
.cnt .i { width: 16px; height: 16px; stroke-width: 2.6 }
.cnt-rising { color: var(--rising) }
.cnt-falling { color: var(--falling) }

.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin-bottom: var(--sheet-hidden, 0px);
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--s4) var(--s6);
}

@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--live) } 70%, 100% { box-shadow: 0 0 0 7px transparent } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes shimmer { to { background-position: -200% 0 } }

/* ---- views --------------------------------------------------------------- */

.view-head {
  position: sticky; top: 0; background: var(--paper);
  display: flex; align-items: center; gap: var(--s1);
  padding: var(--s1) 0 var(--s2); margin-bottom: var(--s1);
  border-bottom: 1px solid var(--line);
}
.back { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 var(--s2) 0 0; color: var(--ink-2); font-size: var(--t-meta); flex: none }
.back .i { width: 20px; height: 20px }
.view-title { flex: 1; min-width: 0; font-size: var(--t-lede); font-weight: 800; line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s1) 0 var(--s2) }
.list-title { font-size: var(--t-lede); font-weight: 800; line-height: var(--lh-tight) }
.count { font-size: var(--t-meta); font-weight: 500; color: var(--ink-2) }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap }
.chip {
  display: inline-flex; align-items: center; gap: var(--s1);
  min-height: 36px; padding: 0 var(--s3);
  background: var(--surface-2); border: 1px solid var(--line-mid); border-radius: var(--r-commit);
  font-size: var(--t-micro); color: var(--ink);
}
.chip .i { width: 16px; height: 16px }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--signal-wash); border-color: var(--signal); font-weight: 700 }
.chip-trend.chip-rising { color: var(--rising); border-color: var(--rising) }
.chip-trend.chip-falling { color: var(--falling); border-color: var(--falling) }
.chip-static { background: transparent; border-color: var(--line); color: var(--ink-2) }
.chip-big { min-height: var(--tap); padding: 0 var(--s4); font-size: var(--t-meta) }

.rows { list-style: none }
.row {
  width: 100%; min-height: 72px; text-align: left;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center;
  padding: var(--s3) 0; border-bottom: 1px solid var(--line);
}
.row.is-low { opacity: .72 }
.row-main { display: grid; gap: 2px; min-width: 0 }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s2); font-size: var(--t-micro); color: var(--ink-2) }
.row-time { color: var(--ink); font-weight: 800 }
.row-sev { color: var(--ink) }

.sw { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-control); font-weight: 800; font-size: var(--t-meta); flex: none }
.sw-sm { width: 24px; height: 24px; font-size: var(--t-micro); border-radius: 6px }
.sw-lg { width: 56px; height: 56px; font-size: var(--t-h1) }
.sev-0 { background: var(--sev-0); color: var(--sev-0-ink) }
.sev-1 { background: var(--sev-1); color: var(--sev-1-ink) }
.sev-2 { background: var(--sev-2); color: var(--sev-2-ink) }
.sev-3 { background: var(--sev-3); color: var(--sev-3-ink) }
.sev-4 { background: var(--sev-4); color: var(--sev-4-ink) }

.thumb { width: var(--thumb); height: var(--thumb); border-radius: var(--r-control); object-fit: cover; background: var(--surface-2); flex: none }
.thumb-video { display: grid; place-items: center; color: var(--ink-2) }

.badge {
  display: inline-block; font-size: var(--t-nano); font-weight: 700; line-height: 1.5;
  padding: 0 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-mid);
}
.badge-longdo { color: var(--ok) }
.badge-low, .badge-old { color: var(--stale); border-color: var(--stale) }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 700 }
.trend .i { width: 14px; height: 14px; stroke-width: 2.6 }
.trend-rising { color: var(--rising) }
.trend-falling, .trend-receded { color: var(--falling) }
.trend-steady, .trend-unknown { color: var(--ink-2) }

.note { font-size: var(--t-meta); color: var(--ink-2); padding: var(--s2) 0 }
.note-err { color: var(--err) }
.note-warn { color: var(--stale) }
.howto, .hint { font-size: var(--t-micro); color: var(--ink-3) }
.howto { padding: var(--s4) 0 var(--s2) }
.banner {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s3); margin-bottom: var(--s2);
  background: var(--signal-wash); border: 1px solid var(--signal); border-radius: var(--r-control);
  font-size: var(--t-meta);
}
.banner span { flex: 1 }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4);
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-mid); border-radius: var(--r-commit);
  font-size: var(--t-meta); font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink) }
.btn-big { width: 100%; min-height: 52px; font-size: var(--t-body) }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2) }
.btn-small { min-height: 36px; padding: 0 var(--s3); font-size: var(--t-micro) }
.btn:disabled { opacity: .45; cursor: default }
.view > .btn { margin-top: var(--s2) }

.skel {
  display: block; border-radius: var(--r-control);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.skel-row { height: 60px; margin: var(--s2) 0 }
.skel-chart { height: 96px; margin: var(--s2) 0 }
.skel-line { height: 14px; width: 60%; margin: var(--s2) 0 }

/* ---- report detail -------------------------------------------------------- */

.rail-wrap { margin: var(--s1) calc(-1 * var(--s4)) var(--s2) }
.rail { display: flex; gap: var(--s2); overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--s4); scrollbar-width: none }
.rail::-webkit-scrollbar { display: none }
.rail-item { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 3; border-radius: var(--r-media); overflow: hidden; background: var(--surface-2) }
.rail.is-multi .rail-item { flex-basis: 84% }
.rail-item img, .rail-item video { width: 100%; height: 100%; object-fit: cover }
.rail-item video { object-fit: contain; background: var(--map-bg) }
.rail-open { display: block; width: 100%; height: 100% }
.rail-hint { display: flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s4) 0; font-size: var(--t-micro); color: var(--ink-3) }
.rail-hint .i { width: 16px; height: 16px }

.level { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s2) 0 }
.level-word { font-size: var(--t-sec); font-weight: 800; line-height: var(--lh-tight) }
.level-sub { font-size: var(--t-meta); color: var(--ink-2) }

.when { background: var(--paper-2); border: 1px solid var(--line-mid); border-radius: var(--r-media); padding: var(--s3) var(--s4); margin: var(--s1) 0 var(--s2) }
.when-label { font-size: var(--t-micro); color: var(--ink-2) }
.when-stamp { font-size: var(--t-h1); font-weight: 800; line-height: var(--lh-tight) }
.when-ago { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--t-meta) }
.when-recv { font-size: var(--t-micro); color: var(--ink-3) }

.src { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); padding: var(--s1) 0; font-size: var(--t-meta) }
.src-name { font-weight: 700 }
.src-by { color: var(--ink-2) }
.src-link { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--tap); color: var(--signal); font-weight: 700 }
.src-link .i { width: 16px; height: 16px }
.report-text { padding: var(--s2) 0; white-space: pre-wrap; overflow-wrap: anywhere }

.conf { padding: var(--s3) 0; border-top: 1px solid var(--line) }
.conf-head { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--t-meta); color: var(--ink-2) }
.conf-head strong { color: var(--ink) }
.meter { height: 8px; margin: var(--s2) 0; border-radius: var(--r-commit); background: var(--surface-2); overflow: hidden }
.meter span { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--ink-2); border-radius: var(--r-commit) }
.conf[data-band="high"] .meter span { background: var(--ok) }
.conf[data-band="mid"] .meter span { background: var(--signal) }
.conf[data-band="low"] .meter span { background: var(--stale) }
.reasons { list-style: none; display: grid; gap: 2px; font-size: var(--t-micro); color: var(--ink-2) }
.reasons li::before { content: "· " }

.votes { padding: var(--s3) 0; border-top: 1px solid var(--line) }
.vote-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s1) }
.vote {
  min-height: 52px; display: flex; align-items: center; justify-content: center; gap: var(--s2);
  background: var(--surface-2); border: 1px solid var(--line-mid); border-radius: var(--r-control);
  font-weight: 700;
}
.vote-still .i { color: var(--rising) }
.vote-gone .i { color: var(--falling) }
.vote-n { color: var(--ink-2); font-weight: 800 }

.blk { padding: var(--s3) 0; border-top: 1px solid var(--line); margin-top: var(--s1) }
.blk-head { display: grid }
.blk-title { font-size: var(--t-meta); font-weight: 800; color: var(--ink); padding-bottom: var(--s1) }
.blk-sub { font-size: var(--t-micro); color: var(--ink-3) }
.area-stats { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); padding: var(--s1) 0 var(--s2); font-size: var(--t-meta); color: var(--ink-2) }
.area-summary { min-height: 32px }

.chart { display: block; width: 100%; height: auto; margin: var(--s1) 0 var(--s2) }
.chart-grid { stroke: var(--line); stroke-width: 1 }
.chart-base { stroke: var(--line-strong); stroke-width: 1 }
.chart-bar { stroke: var(--map-ring-dark); stroke-width: .5 }
.sevf-0 { fill: var(--sev-0) }
.sevf-1 { fill: var(--sev-1) }
.sevf-2 { fill: var(--sev-2) }
.sevf-3 { fill: var(--sev-3) }
.sevf-4 { fill: var(--sev-4) }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 1.5 }
.chart-tick { fill: var(--ink-3); font-size: 10px; font-family: var(--ui) }

.tl { list-style: none }
.tl-item + .tl-item { border-top: 1px solid var(--line) }
.tl-btn { width: 100%; min-height: 60px; text-align: left; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s2) 0 }
.tl-item.is-current .tl-btn { background: var(--signal-wash); border-radius: var(--r-control); padding: var(--s2) }
.tl-time { display: grid; line-height: var(--lh-tight) }
.tl-time time { font-weight: 800; font-size: var(--t-meta) }
.tl-ago { font-size: var(--t-nano); color: var(--ink-3) }
.tl-main { display: grid; gap: 2px; min-width: 0 }
.tl-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--t-meta) }
.tl-meta { font-size: var(--t-micro) }
.tl-sev { font-weight: 700 }

/* ---- place, route --------------------------------------------------------- */

.place-detail { font-size: var(--t-meta); color: var(--ink-2); padding-bottom: var(--s2) }
.place .btn-big { margin: var(--s2) 0 }
.route-to { display: flex; align-items: center; gap: var(--s2); font-weight: 700; padding: var(--s1) 0 var(--s3) }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-commit) }
.seg-btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); padding: 0 var(--s2); border-radius: var(--r-commit); font-size: var(--t-meta); color: var(--ink-2) }
.seg-btn .i { width: 18px; height: 18px }
.seg-btn[aria-pressed="true"] { background: var(--signal-wash); color: var(--ink); font-weight: 800; box-shadow: inset 0 0 0 1px var(--signal) }
.from-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s3) 0 var(--s1) }
.from-search { display: grid; gap: var(--s1); margin: 0 0 var(--s2) }
.from-input {
  width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-mid); border-radius: var(--r-control);
}
.from-input::placeholder { color: var(--ink-2); opacity: 1 }
.from-results:empty { display: none }
.from-results { border: 1px solid var(--line-mid); border-radius: var(--r-control); background: var(--paper); overflow: hidden }
.from-results .sg + .sg { border-top: 1px solid var(--line) }
.from-row .seg-btn { min-height: var(--tap); border: 1px solid var(--line-mid); line-height: var(--lh-tight); text-align: center }
.route-sum { display: grid; gap: var(--s2); padding: var(--s2) 0 }
.route-head { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lede); font-weight: 800; line-height: var(--lh-tight) }
.route-ok .route-head { color: var(--ok) }
.route-warn .route-head { color: var(--stale) }
.route-nums { font-size: var(--t-sec); font-weight: 800 }
.legend-list { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font-size: var(--t-micro); color: var(--ink-2) }
.legend-list li { display: inline-flex; align-items: center; gap: var(--s1) }
.lg { display: inline-block; width: 22px; border-top: 5px solid var(--route-safe); border-radius: 2px }
.lg-plain { border-top: 3px dashed var(--route-plain) }
.lg-hit { width: 11px; height: 11px; border: 2px solid var(--map-ring); border-radius: 50%; background: var(--route-hit) }
.credit { font-size: var(--t-nano); color: var(--ink-3); padding-top: var(--s1) }
.credit a { color: var(--ink-2); text-decoration: underline }

/* ---- report flow ------------------------------------------------------------ */

.flow-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s1) 0 var(--s2) }
.flow-step { font-size: var(--t-micro); color: var(--ink-2) }
.dots { display: flex; gap: 4px }
.dots span { width: 18px; height: 4px; border-radius: 2px; background: var(--line-mid) }
.dots span.on { background: var(--signal) }
.flow-title { font-size: var(--t-sec); font-weight: 800; line-height: var(--lh-tight); padding-bottom: var(--s2) }
.flow-actions {
  position: sticky; bottom: 0; background: var(--paper);
  display: grid; grid-template-columns: auto 1fr; gap: var(--s2);
  padding: var(--s3) 0 var(--s2); margin-top: var(--s2);
}
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-bottom: var(--s3) }
.level-btn {
  display: grid; justify-items: center; align-content: start; gap: 2px;
  min-height: 118px; padding: var(--s2) var(--s1) var(--s2);
  background: var(--surface-2); border: 2px solid var(--line-mid); border-radius: var(--r-media);
}
.level-btn[aria-checked="true"] { border-color: var(--signal); background: var(--signal-wash) }
.sevb-0 { box-shadow: inset 0 -5px 0 var(--sev-0) }
.sevb-1 { box-shadow: inset 0 -5px 0 var(--sev-1) }
.sevb-2 { box-shadow: inset 0 -5px 0 var(--sev-2) }
.sevb-3 { box-shadow: inset 0 -5px 0 var(--sev-3) }
.sevb-4 { box-shadow: inset 0 -5px 0 var(--sev-4) }
.picto { width: 34px; height: 54px }
.picto-body { fill: var(--ink-2) }
.picto-water { fill: var(--rain-2); opacity: .7 }
.picto-wave { fill: none; stroke: var(--rain-1); stroke-width: 1.5 }
.picto-ground { fill: none; stroke: var(--sev-0); stroke-width: 3; stroke-linecap: round }
.level-name { font-weight: 800; font-size: var(--t-meta) }
.level-range { font-size: var(--t-nano); color: var(--ink-2); text-align: center; line-height: 1.3 }
.chips-wrap { margin-bottom: var(--s2) }
.media-pick { display: grid; gap: var(--s2); margin: var(--s3) 0 var(--s1) }
label.btn { cursor: pointer }
.preview { border-radius: var(--r-media); overflow: hidden; background: var(--surface-2); margin: var(--s2) 0 }
.preview img, .preview video { width: 100%; max-height: 240px; object-fit: contain; background: var(--map-bg) }
.preview .hint { padding: var(--s1) var(--s3) }
.field {
  display: block; width: 100%; padding: var(--s3);
  background: var(--paper-2); color: var(--ink);
  border: 1px solid var(--line-mid); border-radius: var(--r-control);
  font-size: var(--t-body);
}
.field::placeholder { color: var(--ink-3) }
.field:focus { outline: none; border-color: var(--signal) }
textarea.field { resize: vertical; min-height: 84px; margin-bottom: var(--s3) }
.idfield { display: grid; gap: var(--s1); padding: var(--s2) 0 }
.idform { display: grid; gap: var(--s3); padding-top: var(--s2) }

/* ---- sources ----------------------------------------------------------------- */

.feeds { list-style: none }
.feed { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line) }
.feed-main { display: grid; min-width: 0 }
.feed-name { font-weight: 700 }
.feed-meta { font-size: var(--t-micro); color: var(--ink-2) }
.pill { min-width: 52px; text-align: center; font-size: var(--t-nano); font-weight: 800; letter-spacing: .04em; border-radius: var(--r-commit); padding: 2px var(--s2); border: 1px solid currentColor }
.pill-ok { color: var(--ok) }
.pill-err { color: var(--err); background: var(--err-wash) }

/* ---- menu -------------------------------------------------------------------- */

.menu { position: fixed; inset: 0; z-index: var(--z-menu) }
.menu-scrim { position: absolute; inset: 0; background: var(--scrim) }
.menu-panel {
  position: absolute; top: calc(env(safe-area-inset-top) + var(--s2)); right: var(--edge); left: var(--edge);
  margin-left: auto; max-width: 380px; max-height: calc(100dvh - var(--s6)); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line-mid); border-radius: var(--r-sheet);
  box-shadow: var(--lift-3); padding: var(--s2) var(--s4) var(--s4);
}
.menu-head { display: flex; align-items: center; justify-content: space-between }
.menu-head h2 { font-size: var(--t-lede); font-weight: 800 }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line) }
.menu-row-label { display: inline-flex; align-items: center; gap: var(--s3) }
.menu-row .seg { min-width: 180px }
.menu-label { font-size: var(--t-micro); font-weight: 800; color: var(--ink-3); padding: var(--s3) 0 var(--s1) }
.switch-row, .menu-link {
  width: 100%; min-height: 50px; text-align: left; text-decoration: none;
  display: flex; align-items: center; gap: var(--s3);
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.switch-row > span:first-of-type, .menu-link > span:first-of-type { flex: 1 }
.switch { position: relative; width: 44px; height: 26px; flex: none; border-radius: var(--r-commit); background: var(--line-mid); transition: background var(--t-state) var(--ease) }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform var(--t-state) var(--ease) }
.switch-row[aria-checked="true"] .switch { background: var(--signal) }
.switch-row[aria-checked="true"] .switch::after { transform: translateX(18px); background: var(--signal-ink) }
.contact { color: var(--signal); font-size: var(--t-meta); font-weight: 700 }
.contact + .i { width: 18px; height: 18px; color: var(--ink-3) }
.disclaimer { padding-top: var(--s3); font-size: var(--t-micro); color: var(--ink-2) }
.made-by {
  display: flex; align-items: center; gap: var(--s3); min-height: 56px;
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.made-by-logo { width: 40px; height: 40px; flex: none }
.made-by-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25 }
.made-by-kicker { font-size: var(--t-micro); color: var(--ink-3) }
.made-by-name { font-size: var(--t-meta); font-weight: 800 }
.made-by .i { width: 18px; height: 18px; color: var(--ink-3) }

/* ---- map markers, toast, viewer ---------------------------------------------- */

.pin, .dest { width: 44px; height: 44px; filter: drop-shadow(0 2px 3px var(--map-ring-dark)) }
.pin { cursor: grab }
/* Fill goes on the <use> host: selectors cannot reach inside the sprite. */
.pin .i, .dest .i { width: 44px; height: 44px; stroke-width: 1.4 }
.pin .i { fill: var(--pin); stroke: var(--map-ring-dark) }
.dest .i { fill: var(--route-safe); stroke: var(--map-ring) }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  top: calc(env(safe-area-inset-top) + var(--s2) + var(--header-h) + var(--s2) + 48px + var(--s2));
  width: max-content; max-width: min(92vw, 420px);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  box-shadow: var(--lift-3); padding: var(--s2) var(--s4); font-size: var(--t-meta);
}
.toast[data-kind="err"] { border-color: var(--err); color: var(--err) }
.toast[data-kind="ok"] { border-color: var(--ok) }
.toast[data-kind="warn"] { border-color: var(--stale) }

.viewer { position: fixed; inset: 0; z-index: var(--z-viewer); background: var(--map-bg); display: grid; place-items: center }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain }
.viewer-close { position: absolute; top: calc(env(safe-area-inset-top) + var(--s2)); right: var(--s2); background: var(--glass) }

/* MapLibre's own controls, rebound to the tokens. */
.maplibregl-ctrl-attrib { display: none }

/* ---- wide screens: the sheet becomes a side panel ---------------------------- */

@media (min-width: 900px) {
  .sheet { left: var(--edge); right: auto; width: var(--sheet-w); border: 1px solid var(--line-mid); border-bottom: 0 }
  .floats { left: calc(var(--sheet-w) + var(--edge)) }
}

/* Location help: numbered steps, readable at arm's length. */
.lochelp .steps { margin: var(--s2) 0 var(--s3); padding-left: var(--s5); display: grid; gap: var(--s2); color: var(--ink) }
.lochelp .steps li { line-height: var(--lh-body) }
