/* Layout: one forecast column on phones (map as its own tab); on wide screens the
   forecast column sits on the left and the live map fills the rest of the window. */
:root {
  --bg: #F1F4F7;          /* snowfield grey */
  --surface: #FFFFFF;
  --sunken: #E5EAF0;
  --ink: #16202B;         /* basalt */
  --ink-2: #536274;
  --ink-3: #8794A3;
  --line: #D6DDE5;
  --accent: #C23A61;      /* alpenglow */
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(194, 58, 97, 0.10);
  --sun: #EBA223;
  --moon: #C4B58A;
  --cloud: #C5CED8;
  --cloud2: #93A1B0;
  --rain: #2B78CC;
  --snow: #8571DA;
  --band: rgba(22, 32, 43, 0.085);
  --mask: rgba(241, 244, 247, 0.74);
  --warn-yellow: #E2B714;
  --warn-orange: #E8761A;
  --warn-red: #CF3128;
  --warn-yellow-bg: #FBF3CF;
  --warn-orange-bg: #FCE4CF;
  --warn-red-bg: #F9D9D6;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.06), 0 6px 20px rgba(22, 32, 43, 0.08);
  --tile-filter: saturate(0.85);

  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --gutter: 18px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D131A; --surface: #151D27; --sunken: #1C2632; --ink: #E5EBF1; --ink-2: #A2B0BF; --ink-3: #6E7C8C;
    --line: #253242; --accent: #FF7C9F; --accent-ink: #1B0A10; --accent-soft: rgba(255, 124, 159, 0.14);
    --sun: #F5B83E; --moon: #E2D5A6; --cloud: #8796A7; --cloud2: #5F6D7C; --rain: #5EA7F1; --snow: #A794F6;
    --band: rgba(229, 235, 241, 0.10); --mask: rgba(13, 19, 26, 0.68);
    --warn-yellow-bg: #3A3214; --warn-orange-bg: #3D2714; --warn-red-bg: #3F1A18;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --tile-filter: invert(1) hue-rotate(185deg) brightness(0.82) contrast(0.92) saturate(0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D131A; --surface: #151D27; --sunken: #1C2632; --ink: #E5EBF1; --ink-2: #A2B0BF; --ink-3: #6E7C8C;
  --line: #253242; --accent: #FF7C9F; --accent-ink: #1B0A10; --accent-soft: rgba(255, 124, 159, 0.14);
  --sun: #F5B83E; --moon: #E2D5A6; --cloud: #8796A7; --cloud2: #5F6D7C; --rain: #5EA7F1; --snow: #A794F6;
  --band: rgba(229, 235, 241, 0.10); --mask: rgba(13, 19, 26, 0.68);
  --warn-yellow-bg: #3A3214; --warn-orange-bg: #3D2714; --warn-red-bg: #3F1A18;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --tile-filter: invert(1) hue-rotate(185deg) brightness(0.82) contrast(0.92) saturate(0.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* No double-tap zoom on the app UI (pinch zoom stays available). The map handles its own gestures. */
html, body, .view, .sheet, button, a, label, input, select, summary { touch-action: manipulation; }
/* iOS zooms into focused form fields smaller than 16px; keep them at 16px on touch screens. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--font-body); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.wx { display: block; overflow: visible; }

.h-sec {
  margin: 0; font: 720 26px/1.1 var(--font-display); font-variation-settings: 'opsz' 48;
  letter-spacing: -0.015em; text-wrap: balance;
}
.h-small { margin: 18px 0 6px; font: 600 12px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.eyebrow { font: 500 11px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); white-space: nowrap; }
.lede { margin: 8px 0 14px; max-width: 62ch; color: var(--ink); text-wrap: pretty; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px;
  padding: 9px 18px; background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] svg path { fill: var(--accent); }

/* ---------- app frame ---------- */
.app { min-height: 100%; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 900;
  display: flex; align-items: center; gap: 4px; height: var(--topbar-h);
  padding-inline: calc(var(--gutter) - 8px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.place {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  border: 0; background: none; padding: 4px 8px; border-radius: 10px; line-height: 1.15;
}
.place:hover { background: var(--sunken); }
.place-name { font: 700 18px/1.15 var(--font-display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-sub { font-size: 12.5px; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-sub svg { vertical-align: -2px; margin-right: 3px; color: var(--accent); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -1px 0 var(--line);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: none; padding: 4px 0; color: var(--ink-3); font-size: 12px; font-weight: 600;
}
.tab.active { color: var(--accent); }
.tab-ic { display: grid; place-items: center; height: 24px; }
.tab-dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--warn-orange); }

.panes { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
.view { display: none; padding-inline: var(--gutter); }
.view.active { display: block; }
.view:not(.view-map) > * { max-width: 640px; margin-inline: auto; }

.view-map { padding: 0; }
.view-map.active {
  position: fixed; left: 0; right: 0; z-index: 10;
  top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* ---------- blocks ---------- */
.block { padding-block: 22px 26px; }
.block + .block { border-top: 1px solid var(--line); }
#warn-banner:empty { display: none; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* Right now */
.now { padding-top: 10px; }
.now-main { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 14px; margin-top: 12px; }
.now-icon { width: 84px; height: 84px; }
.now-icon svg { width: 84px; height: 84px; }
.now-temp {
  font: 700 84px/0.9 var(--font-display); font-variation-settings: 'opsz' 96;
  letter-spacing: -0.045em; margin-right: 4px;
}
.now-meta { min-width: 0; }
.now-meta p { margin: 0; }
.now-cond { font: 650 19px/1.2 var(--font-display); }
.now-sub { font-size: 14.5px; color: var(--ink-2); }
.now-obs { margin: 12px 0 0; font-size: 13.5px; color: var(--ink-2); }
.now-obs b { color: var(--ink); font-weight: 600; }
.more {
  margin-top: 10px; border: 0; background: none; padding: 4px 0; color: var(--accent);
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px;
}
.more .chev { display: inline-grid; transition: transform 0.2s; }
.more[aria-expanded="true"] .chev { transform: rotate(180deg); }
.details {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 14px;
  background: var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--line);
}
.detail { background: var(--surface); padding: 12px 14px; min-width: 0; }
.detail .eyebrow { display: block; }
.detail .val { font: 650 22px/1.2 var(--font-display); margin-top: 4px; }
.detail .sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
@media (min-width: 560px) { .details { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Warnings banner */
.warn-banner {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px;
  margin: 8px auto 4px; max-width: 640px; padding: 12px 14px; border-radius: var(--radius);
  border: 0; width: 100%; text-align: left; color: var(--ink);
}
.warn-banner + .warn-banner { margin-top: 6px; }
.warn-banner .t { font-weight: 650; }
.warn-banner .s { font-size: 13.5px; color: var(--ink-2); }
.lvl1-bg { background: var(--warn-yellow-bg); }
.lvl2-bg { background: var(--warn-orange-bg); }
.lvl3-bg { background: var(--warn-red-bg); }
.chip-lvl { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1a1205; }
.chip-lvl.lvl1 { background: var(--warn-yellow); }
.chip-lvl.lvl2 { background: var(--warn-orange); }
.chip-lvl.lvl3 { background: var(--warn-red); color: #fff; }

/* Charts */
.chart-wrap { width: 100%; overflow: hidden; touch-action: pan-y; }
.chart-wrap.tall { min-height: 250px; margin-top: 12px; }
#nc-chart { min-height: 132px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-body); }
.c-div { stroke: var(--line); stroke-width: 1; }
.c-part { font-size: 12.5px; font-weight: 650; fill: var(--ink); }
.c-pop { font-size: 11.5px; font-weight: 600; fill: var(--rain); }
.c-drop { fill: var(--rain); }
.c-band { fill: var(--band); }
.c-alt { fill: none; stroke: var(--ink-3); stroke-width: 1.2; opacity: 0.65; }
.c-main { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
.c-main.past { stroke: var(--ink-3); stroke-width: 2.2; }
.c-main.thin { stroke-width: 1.6; stroke: var(--ink-2); }
.c-sub { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.c-dot { fill: var(--ink); stroke: var(--bg); stroke-width: 2; }
.c-dot.past { fill: var(--ink-3); }
.c-val { font-size: 13px; font-weight: 650; fill: var(--ink); }
.c-val.small { font-size: 11.5px; font-weight: 600; fill: var(--ink-2); }
.c-axis { font: 500 11px var(--font-mono) !important; fill: var(--ink-3); }
.mid { text-anchor: middle; }
.end { text-anchor: end; }
.start { text-anchor: start; }
.c-now { stroke: var(--accent); stroke-width: 1.5; }
.c-now-label { font: 600 11px var(--font-mono) !important; fill: var(--accent); }
.c-cursor { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.c-bar { fill: var(--rain); }
.c-bar.snow { fill: var(--snow); }
.c-bar.ghost { opacity: 0.28; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-base { stroke: var(--ink-3); stroke-width: 1; }
.c-pop-line { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-dasharray: 1.5 3.5; stroke-linecap: round; }
.c-cloud { fill: var(--cloud); opacity: 0.55; }
.c-sun { fill: var(--sun); opacity: 0.85; }
.c-arrow { fill: var(--ink-2); }
.nc-area { fill: var(--rain); opacity: 0.22; }
.nc-line { fill: none; stroke: var(--rain); stroke-width: 2.2; }
.nc-area.snow { fill: var(--snow); }
.nc-line.snow { stroke: var(--snow); }

.seg {
  display: inline-flex; gap: 2px; padding: 3px; margin-top: 2px; border-radius: 999px; background: var(--sunken);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.readout { min-height: 22px; margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.readout b { color: var(--ink); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.lg-main { background: var(--ink); height: 3px !important; }
.lg-alt { background: var(--ink-3); height: 1.5px !important; opacity: 0.8; }
.lg-band { background: var(--band); height: 10px !important; box-shadow: inset 0 0 0 1px var(--line); }
.lg-sub { background: repeating-linear-gradient(90deg, var(--ink-2) 0 4px, transparent 4px 7px); height: 2px !important; }
.lg-bar { background: var(--rain); width: 8px !important; height: 12px !important; }
.lg-bar.ghost { opacity: 0.3; }
.lg-dots { background: repeating-linear-gradient(90deg, var(--ink-2) 0 2px, transparent 2px 5px); height: 2px !important; }
.lg-cloud { background: var(--cloud); height: 10px !important; }
.lg-sun { background: var(--sun); width: 8px !important; height: 12px !important; }

/* Map teaser */
.teaser-frame { position: relative; margin-top: 12px; }
.teaser-map {
  height: 210px; border-radius: var(--radius); overflow: hidden; background: var(--sunken);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; position: relative; z-index: 0;
}
.teaser-status {
  position: absolute; inset: 0; z-index: 1; margin: 0; display: grid; place-items: center;
  padding: 16px; text-align: center; font-size: 14px; color: var(--ink-2); pointer-events: none;
}

/* Days */
.days { list-style: none; margin: 14px 0 0; padding: 0; }
.day {
  display: grid; grid-template-columns: minmax(78px, 1.1fr) 34px 46px 34px minmax(70px, 3fr) 34px;
  align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line);
}
.day:first-child { border-top: 0; }
.day-name { font-weight: 650; line-height: 1.2; }
.day-name small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.day-pop { font-size: 12.5px; font-weight: 600; color: var(--rain); line-height: 1.15; }
.day-pop small { display: block; font-weight: 500; color: var(--ink-3); }
.day-t { font-weight: 650; text-align: right; }
.day-t.lo { color: var(--ink-2); }
.day-t.hi { text-align: left; }
.bar { position: relative; height: 10px; border-radius: 999px; background: var(--sunken); }
.bar > span { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.bar .rng { opacity: 0.35; }
.day-sub { grid-column: 1 / -1; margin: -2px 0 0; font-size: 13px; color: var(--ink-2); }

/* Footer */
.attrib { padding-block: 18px 8px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); }
.attrib p { margin: 0 0 6px; }
.attrib a { color: var(--ink-2); }

/* ---------- map view ---------- */
.map-shell { position: relative; height: 100%; min-height: 320px; }
.map { position: absolute; inset: 0; background: var(--sunken); }
.map-top {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 800;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; pointer-events: none;
}
/* Chips and the stations switch share one wrapping row, so nothing is hidden behind anything. */
.chips { display: contents; }
.chip {
  flex: none; border: 0; padding: 7px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 650;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); pointer-events: auto;
}
.chip[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.toggle {
  pointer-events: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 600;
}
.toggle input { accent-color: var(--accent); margin: 0; }
@media (max-width: 560px) {
  .map-top { top: 8px; left: 8px; right: 8px; gap: 5px; }
  .chip, .toggle { padding: 5px 10px; font-size: 12.5px; }
  .toggle { gap: 5px; }
}
.map-bottom {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 800;
  max-width: 520px; padding: 10px 14px 10px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.timeline { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; margin-bottom: 6px; }
.timeline .play { width: 36px; height: 36px; background: var(--ink); color: var(--bg); }
.timeline .play:hover { background: var(--ink); color: var(--bg); opacity: 0.9; }
#time-slider { width: 100%; accent-color: var(--accent); }
#time-label { font: 600 13px var(--font-mono); white-space: nowrap; min-width: 9ch; text-align: right; }
.map-legend { display: block; margin-top: 0; }
.legend-bar { height: 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.legend-labels { position: relative; height: 16px; font: 500 10.5px var(--font-mono); color: var(--ink-2); }
.legend-labels span { position: absolute; top: 3px; transform: translateX(-50%); }
.legend-labels span:first-child { transform: none; }
.legend-labels span:last-child { transform: translateX(-100%); }
.legend-title { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.legend-row { display: flex; gap: 14px; font-size: 13px; }
.lg i.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.sw.lvl1 { background: var(--warn-yellow); } .sw.lvl2 { background: var(--warn-orange); } .sw.lvl3 { background: var(--warn-red); }
.map-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.map-loading {
  position: absolute; top: calc(var(--map-top-h, 40px) + 20px); left: 50%; transform: translateX(-50%); z-index: 800;
  padding: 6px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600;
}

/* Leaflet theming */
.leaflet-container { font-family: var(--font-body); background: var(--sunken); }
.basemap-tiles { filter: var(--tile-filter); }
.leaflet-pane path.at-mask { fill: var(--mask); }
.leaflet-pane path.at-outline { stroke: var(--ink); }
.leaflet-pane path.warn-area { fill-opacity: 0.38; stroke-opacity: 0.9; }
.leaflet-pane path.warn-area.lvl1 { fill: var(--warn-yellow); stroke: var(--warn-yellow); }
.leaflet-pane path.warn-area.lvl2 { fill: var(--warn-orange); stroke: var(--warn-orange); }
.leaflet-pane path.warn-area.lvl3 { fill: var(--warn-red); stroke: var(--warn-red); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3); }
.leaflet-tooltip { background: var(--surface); color: var(--ink); border: 0; box-shadow: var(--shadow); font-size: 13px; }
.leaflet-tooltip-top::before { border-top-color: var(--surface); }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--ink-3); font-size: 10.5px; }
.leaflet-control-attribution a { color: var(--ink-2); }
.leaflet-top.leaflet-left { top: calc(var(--map-top-h, 40px) + 14px); }
@media (pointer: coarse) { .view-map .leaflet-control-zoom { display: none; } }
.pop-coord { margin: 0 0 8px; font: 500 12px var(--font-mono); color: var(--ink-2); }
.pop-note { margin: 0; }
.pin-dot {
  display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--surface), 0 0 0 9px var(--accent-soft);
}
.stn span {
  display: inline-block; min-width: 32px; padding: 1px 6px; border-radius: 999px; text-align: center;
  font: 650 12px/18px var(--font-body); background: var(--c, var(--surface)); color: var(--fg, var(--ink));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.18); white-space: nowrap;
}
.wind-arrow svg path { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bolt svg circle { fill: var(--sun); stroke: var(--surface); stroke-width: 1.5; }
.bolt svg path { fill: #1B1405; }
.field-img { image-rendering: auto; }

/* ---------- stations ---------- */
.stations { list-style: none; margin: 0; padding: 0; }
.stn-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--line);
}
.stn-row:first-child { border-top: 0; }
.stn-name { font-weight: 650; min-width: 0; }
.stn-meta { font-size: 12.5px; color: var(--ink-3); }
.stn-t { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 700 28px/1 var(--font-display); }
.stn-vals { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.extremes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ext { padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.ext .val { font: 700 26px/1.1 var(--font-display); margin: 4px 0 2px; }
.ext .where { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- alerts ---------- */
.warn-item { padding: 14px 0; border-top: 1px solid var(--line); }
.warn-item:first-child { border-top: 0; }
.warn-item h3 { margin: 0 0 4px; font: 650 17px/1.25 var(--font-display); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.warn-item p { margin: 6px 0 0; font-size: 14.5px; max-width: 64ch; white-space: pre-line; }
.warn-item details { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.warn-item summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.empty { padding: 14px 16px; border-radius: var(--radius); background: var(--sunken); color: var(--ink-2); font-size: 14.5px; margin-top: 12px; }

.notify-card { display: grid; gap: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.switch-row span small { display: block; font-size: 12.5px; color: var(--ink-3); }
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + i { opacity: 0.5; }

.rule-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; padding: 14px;
  border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.rule-form label { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; }
.rule-form select, .rule-form input {
  padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); min-width: 0;
}
.rule-form input { width: 90px; }
.rf-actions { display: flex; gap: 8px; width: 100%; }
.rules { list-style: none; margin: 10px 0 0; padding: 0; }
.rule { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.rule .txt { font-weight: 600; min-width: 0; }
.rule .hits { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.rule .hits.on { color: var(--accent); }

.labs { display: grid; gap: 10px; margin-top: 12px; }
.lab { display: grid; grid-template-columns: 44px 1fr; gap: 4px 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.lab .ic { grid-row: 1 / span 3; }
.lab h3 { margin: 0; font: 650 16px/1.3 var(--font-display); }
.lab .big { font: 700 20px/1.2 var(--font-display); }
.lab p { margin: 0; font-size: 14px; color: var(--ink-2); }
.meter { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- dialogs ---------- */
.sheet {
  width: min(560px, calc(100% - 24px)); max-height: min(720px, calc(100dvh - 48px));
  margin: max(24px, env(safe-area-inset-top, 0px)) auto auto; padding: 14px 18px 20px;
  border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  overflow: auto;
}
.sheet::backdrop { background: rgba(8, 12, 18, 0.42); backdrop-filter: blur(2px); }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-head .h-sec { flex: 1; font-size: 22px; }
#search-input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); font-size: 16px;
}
.row-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 6px; border: 0; background: none;
  color: var(--accent); font-weight: 650; border-radius: 10px; text-align: left;
}
.row-btn:hover { background: var(--sunken); }
.results { list-style: none; margin: 0; padding: 0; }
.results li button {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; width: 100%; padding: 10px 6px; border: 0; background: none;
  text-align: left; border-radius: 10px;
}
.results li button:hover, .results li button:focus-visible { background: var(--sunken); }
.results .nm { font-weight: 650; }
.results .sb { font-size: 13px; color: var(--ink-2); min-width: 0; }
.capitals .sb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .rm { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.capitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.opt { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.opt legend { padding: 0; margin-bottom: 6px; font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.opt label { display: inline-flex; align-items: center; gap: 6px; }
.opt input { accent-color: var(--accent); }
.about { font-size: 13.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; }
.about p { margin: 0 0 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 2000;
  transform: translate(-50%, 10px); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; opacity: 0;
  transition: opacity 0.2s, transform 0.2s; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { color: transparent !important; background: var(--sunken); border-radius: 8px; }

/* ---------- wide screens: forecast column + map ---------- */
@media (min-width: 1040px) {
  html, body { height: 100%; }
  body { overflow: hidden; }
  .app {
    height: 100%; display: grid;
    grid-template-columns: minmax(440px, 560px) 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "top map" "tabs map" "pane map";
  }
  .topbar { grid-area: top; position: relative; top: 0; background: var(--bg); }
  .tabbar {
    grid-area: tabs; position: static; display: flex; gap: 4px; padding: 0 var(--gutter) 10px;
    background: var(--bg); box-shadow: 0 1px 0 var(--line); backdrop-filter: none;
  }
  .tab { flex-direction: row; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 14px; }
  .tab.active { background: var(--accent-soft); }
  .tab-map { display: none; }
  .tab-dot { top: 6px; left: auto; right: 4px; }
  .panes { display: contents; }
  .view { grid-area: pane; overflow-y: auto; padding-bottom: 24px; }
  .view-map, .view-map.active { display: block; grid-area: map; position: relative; inset: auto; padding: 0; overflow: hidden; }
  .teaser { display: none; }
  .toast { bottom: 24px; left: 280px; }
  .map-bottom { right: auto; width: 460px; }
}

@media (max-width: 380px) {
  :root { --gutter: 16px; }
  .now-temp { font-size: 70px; }
  .now-icon, .now-icon svg { width: 64px; height: 64px; }
  .day { grid-template-columns: 70px 30px 40px 30px minmax(50px, 1fr) 30px; gap: 6px; }
}

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