/* Mobile-first "native app" layout: full-screen views switched by a bottom tab
   bar; forecast / places / more scroll inside their view, the map fills it. */
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #0f1b2d;
  --muted: #5b6b80;
  --line: #dde4ee;
  --accent: #0a6cff;
  --accent-soft: #e3eeff;
  --warn: #a8480a;
  --warn-soft: #fdf0e4;
  --good: #0a7148;
  --good-soft: #e3f5ec;
  --rain: #2f7fe8;
  --temp: #e8650f;
  --land: #dfe8d9;
  --land-edge: #9fb3a0;
  --sea: #d6e7f5;
  --tabbar: rgb(255 255 255 / 82%);
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 6px 20px rgb(16 24 40 / 6%);
  --font: "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: calc(62px + var(--safe-bottom));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070d18; --card: #111a2b; --text: #eaf0f8; --muted: #8e9db3; --line: #1f2b40;
    --accent: #4d9bff; --accent-soft: #14284a; --warn: #ffb07a; --warn-soft: #3a2415;
    --good: #6ad7a2; --good-soft: #10301f; --rain: #62a4fb; --temp: #fb923c;
    --land: #22332a; --land-edge: #4a6653; --sea: #0f1b2a; --tabbar: rgb(12 18 30 / 82%);
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070d18; --card: #111a2b; --text: #eaf0f8; --muted: #8e9db3; --line: #1f2b40;
  --accent: #4d9bff; --accent-soft: #14284a; --warn: #ffb07a; --warn-soft: #3a2415;
  --good: #6ad7a2; --good-soft: #10301f; --rain: #62a4fb; --temp: #fb923c;
  --land: #22332a; --land-edge: #4a6653; --sea: #0f1b2a; --tabbar: rgb(12 18 30 / 82%);
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.45;
  overscroll-behavior: none; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
h1, h2 { margin: 0; text-wrap: balance; }
button, input, select { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 14px;
  touch-action: manipulation; transition: transform .12s ease, background-color .15s ease;
}
button:active { transform: scale(.97); }
button:focus-visible, input:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
.badge { font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.badge.live { background: var(--good-soft); color: var(--good); }
.badge.demo { background: var(--warn-soft); color: var(--warn); }

/* ----- shell ----- */
.app { position: fixed; inset: 0; }
.view { position: absolute; inset: 0 0 var(--tab-h) 0; }
.view-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; scroll-behavior: smooth; }
.view.entering { animation: view-in .22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stack { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 28px; max-width: 560px; margin: 0 auto; }
.view-scroll > .stack:first-child { padding-top: calc(var(--safe-top) + 18px); }
.large-title { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; padding: 4px 4px 2px; }
.group-title { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 6px 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); padding: 6px 8px var(--safe-bottom); z-index: 1000;
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--tabbar); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
}
.tabbar button {
  border: 0; background: transparent; border-radius: 12px; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tabbar svg { width: 26px; height: 26px; fill: currentColor; }
.tabbar button[aria-selected="true"] { color: var(--accent); }
.tabbar button:active { transform: scale(.92); }

.toast {
  position: fixed; z-index: 1200; left: 16px; right: 16px; top: calc(var(--safe-top) + 10px); max-width: 520px; margin: 0 auto;
  background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); font-size: .9rem;
}

/* ----- cards & lists ----- */
.card { background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.sec { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.note { margin: 6px 0 0; color: var(--muted); font-size: .78rem; }
.footnote { text-align: center; color: var(--muted); font-size: .78rem; margin: 4px 0 0; }
.list { background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; text-align: left;
  border: 0; border-radius: 0; background: transparent;
}
.list > * + *, .pin-list > * + * { border-top: 1px solid var(--line); }
.row:active { transform: none; background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 600; }
.row-main small { color: var(--muted); font-size: .8rem; }
.row-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem; background: var(--accent-soft); color: var(--accent); }
.row-icon.gps { background: #1a73e8; color: #fff; }
.row-icon.star { background: #f59e0b; color: #fff; }
.row-icon.add { background: var(--good-soft); color: var(--good); }
.row-end { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.chev { flex: none; color: var(--muted); font-size: 1.3rem; }
.credits { padding: 12px 16px; color: var(--muted); font-size: .8rem; }
.credits p { margin: 4px 0; }
.segmented { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 2px; }
.segmented button { border: 0; background: transparent; border-radius: 8px; padding: 6px 10px; font-size: .82rem; }
.segmented button[aria-checked="true"] { background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 15%); font-weight: 600; }

.search-field { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow); }
.search-field svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 0; font-size: 1rem; outline: none; }

/* pins as list rows */
.pin-list { display: flex; flex-direction: column; }
.pin-empty { display: block; padding: 14px 16px; color: var(--muted); font-size: .88rem; }
.pin-chip { display: flex; align-items: stretch; }
.pin-chip.active { background: color-mix(in srgb, #f59e0b 12%, transparent); }
.pin-chip button { border: 0; border-radius: 0; background: transparent; }
.pin-go { flex: 1; text-align: left; padding: 14px 16px; font-weight: 600; min-height: 52px; }
.pin-go::first-letter { color: #f59e0b; }
.pin-del { flex: none; width: 52px; color: var(--muted); font-size: 1.3rem; }
.pin-form { gap: 8px; flex-wrap: wrap; }
.pin-form input { flex: 1 1 10rem; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }

.rain-soon {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 16px; border: 0; border-radius: 16px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb); color: #fff; font-weight: 600; box-shadow: var(--shadow);
}
.hero-bell {
  position: absolute; top: calc(var(--safe-top) + 12px); right: 14px; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 0; background: rgb(255 255 255 / 18%); color: #fff; font-size: 1.1rem;
}
.hero-bell.on { background: #fbbf24; color: #1f1300; }
.row-icon.rain { background: #2563eb; color: #fff; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 30%); transition: transform .2s; }
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .45; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.alert-actions { gap: 8px; flex-wrap: wrap; }
.alert-actions button { flex: 1 1 auto; font-size: .85rem; }
.alert-status { color: var(--muted); }
.install-steps small { line-height: 1.5; }
.stale-note { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: .86rem; }
.meter { flex: none; width: 88px; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #f59e0b, #ef4444); background-size: 88px 100%; }
.setup-steps { text-align: left; margin: 16px auto 0; max-width: 30rem; padding-left: 1.3em; display: grid; gap: 8px; font-size: .92rem; }

/* ----- forecast hero ----- */
.hero {
  --sky1: #3a8ef6; --sky2: #8cc4ff;
  position: relative; color: #fff; padding: calc(var(--safe-top) + 26px) 22px 26px; text-align: center;
  background: linear-gradient(180deg, var(--sky1), var(--sky2)); border-radius: 0 0 30px 30px; overflow: hidden;
}
.hero[data-sky="night"] { --sky1: #0b1a3a; --sky2: #28406e; }
.hero[data-sky="cloudy"] { --sky1: #5b7089; --sky2: #9fb2c6; }
.hero[data-sky="cloudy-night"] { --sky1: #1d2736; --sky2: #3d4c63; }
.hero[data-sky="rain"] { --sky1: #34485f; --sky2: #6f8aa6; }
.hero[data-sky="storm"] { --sky1: #1e2233; --sky2: #4b4a6b; }
.hero-skeleton { padding: 60px 0; opacity: .8; }
.hero-place { font-size: 1.6rem; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 8px rgb(0 0 0 / 20%); }
.hero-sub { font-size: .9rem; opacity: .9; }
.hero-where { display: inline-block; margin-top: 6px; font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: rgb(255 255 255 / 18%); }
.hero-temp { font-size: 6rem; font-weight: 300; line-height: 1; margin: 14px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.hero-cond { font-size: 1.15rem; font-weight: 500; display: flex; justify-content: center; align-items: center; gap: 8px; }
.hero-cond img { width: 34px; height: 34px; }
.hero-hl { font-size: .95rem; opacity: .95; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero-tag { display: inline-block; margin-top: 10px; font-size: .74rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgb(0 0 0 / 22%); }
.hero-tag.future { background: #f59e0b; color: #1f1300; }
.hero-time { font-size: .8rem; opacity: .85; margin-top: 6px; }

/* ----- time scrubber ----- */
.timebar-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.timebar-when { min-width: 0; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .05em; color: var(--accent); }
.eyebrow.future { color: var(--temp); }
.clock { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.rel { color: var(--muted); font-size: .8rem; min-height: 1.2em; }
.pill-btn { border-radius: 999px; padding: 7px 16px; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; flex: none; }
.pill-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
#timeSlider { width: 100%; margin: 12px 0 0; accent-color: var(--accent); height: 30px; cursor: pointer; }
.ticks { position: relative; height: 18px; font-size: .68rem; color: var(--muted); margin: 0 6px; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.steps button { padding: 8px 0; font-size: .82rem; background: var(--bg); border-color: transparent; font-variant-numeric: tabular-nums; }

/* ----- location banner ----- */
.loc-banner { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; background: var(--accent-soft); }
.loc-icon { font-size: 1.6rem; }
.loc-text { flex: 1 1 14rem; min-width: 0; }
.loc-text p { margin: 2px 0 0; color: var(--muted); font-size: .84rem; }
.loc-actions { display: flex; gap: 8px; width: 100%; }
.loc-actions button { flex: 1; }

/* ----- hourly strip ----- */
.hourly-strip { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px; scroll-snap-type: x proximity; }
.hourly-strip::-webkit-scrollbar { display: none; }
.hour {
  flex: 0 0 58px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border: 0; border-radius: 16px;
  background: transparent; font-size: .8rem; font-variant-numeric: tabular-nums; scroll-snap-align: start;
}
.hour.selected { background: var(--accent-soft); }
.hour .icon { font-size: 1.5rem; height: 30px; display: grid; place-items: center; }
.hour .icon img { width: 30px; height: 30px; }
.hour .t { font-weight: 700; font-size: .95rem; }
.hour .r { color: var(--rain); font-size: .72rem; }

/* ----- 7 days: list with temperature range bars ----- */
.daily { display: flex; flex-direction: column; }
.day {
  display: grid; grid-template-columns: 3.4rem 2rem 2.6rem 2.2rem 1fr 2.2rem; align-items: center; gap: 8px;
  width: 100%; padding: 10px 2px; border: 0; border-radius: 0; background: transparent; text-align: left; font-variant-numeric: tabular-nums;
}
.day + .day { border-top: 1px solid var(--line); }
.day.selected { background: var(--accent-soft); border-radius: 12px; }
.day .name { font-weight: 600; }
.day .icon { font-size: 1.4rem; text-align: center; }
.day .icon img { width: 28px; height: 28px; }
.day .rain { color: var(--rain); font-size: .75rem; font-weight: 600; }
.day .lo { color: var(--muted); text-align: right; }
.day .hi { font-weight: 700; }
.day .bar { position: relative; height: 6px; border-radius: 3px; background: var(--bg); }
.day .bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, #5ab0ff, #ffcb3d, #ff7a2f); }

/* ----- detail tiles ----- */
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: 20px; padding: 12px 14px; box-shadow: var(--shadow); min-height: 108px; display: flex; flex-direction: column; }
.tile .k { font-size: .74rem; font-weight: 600; color: var(--muted); letter-spacing: .03em; }
.tile .v { font-size: 1.7rem; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .s { font-size: .8rem; color: var(--muted); margin-top: auto; }
.tile .compass { display: inline-block; transition: transform .3s ease; }

/* ----- insights ----- */
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--accent-soft); font-size: .92rem; }
.insights li.warn { background: var(--warn-soft); color: var(--warn); }
.insights li.good { background: var(--good-soft); color: var(--good); }

.chart-wrap { position: relative; height: 220px; }

/* ----- map view ----- */
.view-map { overflow: hidden; }
.map-top { position: absolute; z-index: 850; top: calc(var(--safe-top) + 10px); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.search-pill {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border-radius: 16px; text-align: left; color: #f1f5f9; font-weight: 600;
}
.search-pill svg { width: 20px; height: 20px; fill: #cbd5e1; flex: none; }
.search-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* bottom sheet on the map (place card) */
.sheet {
  position: absolute; z-index: 900; left: 10px; right: 10px; bottom: 108px; max-width: 520px; margin: 0 auto;
  border-radius: 22px; padding: 8px 16px 14px; color: #f1f5f9; animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: rgb(255 255 255 / 30%); margin: 0 auto 8px; }
.sheet-close { position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: rgb(255 255 255 / 12%); color: #e2e8f0; font-size: 1.2rem; }
.sheet-open .map-legend { display: none; }
.pp { display: grid; gap: 8px; }
.pp-title { font-weight: 700; font-size: 1.1rem; padding-right: 36px; }
.pp-sub { color: #94a3b8; font-size: .82rem; }
.pp-where { color: #fca5a5; font-size: .8rem; }
.pp-where.gps { color: #93c5fd; }
.pp-now { display: flex; align-items: center; gap: 10px; }
.pp-icon { font-size: 1.8rem; }
.pp-temp { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pp-cond { color: #cbd5e1; font-size: .9rem; }
.pp-stats { color: #cbd5e1; font-size: .82rem; }
.pp-save { display: flex; gap: 6px; }
.pp-save input { flex: 1; min-width: 0; font-size: .9rem; padding: 8px 10px; border-radius: 12px; border: 1px solid #334155; background: #1e293b; color: #f1f5f9; }
.pp-save button { flex: none; font-size: .88rem; padding: 8px 12px; }
.pp-saved { color: #fbbf24; font-weight: 600; font-size: .88rem; }
.pp-actions { display: flex; gap: 8px; }
.pp-actions button { flex: 1; border-radius: 12px; }
.pp-actions .secondary { background: rgb(255 255 255 / 10%); border-color: transparent; color: #f1f5f9; }

/* map: full-width radar map with overlay controls */
.map-wrap { position: absolute; inset: 0; overflow: hidden; background: var(--sea); isolation: isolate; }
.map { position: absolute; inset: 0; }
.map svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.map svg:active { cursor: grabbing; }
.map.leaflet-mode { background: #0e1621; }
.map path, .map circle { vector-effect: non-scaling-stroke; }
.map .land-other { fill: var(--card); opacity: .55; stroke: var(--line); stroke-width: .6; }
.map .land-th { fill: var(--land); stroke: var(--land-edge); stroke-width: 1; }
.map .heat { pointer-events: none; }
.map .wind-arrow { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.map .city { cursor: pointer; }
.map .city circle { fill: var(--card); stroke: var(--accent); stroke-width: 1.6; }
.map .city text { fill: var(--text); font: 600 9px var(--font); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .city:hover circle, .map .city.active circle { fill: var(--accent); }
.map .city:hover text, .map .city.active text { fill: var(--card); }
.map .d-other { fill: var(--land); stroke: var(--land-edge); stroke-width: .8; }
.map .d-name { fill: var(--muted); font: 500 8px var(--font); text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: var(--land); stroke-width: 2.5px; stroke-linejoin: round; }
.map .d-name.self { fill: var(--text); font-weight: 700; font-size: 9.5px; }
.map .district-sel { fill: var(--temp); fill-opacity: .18; stroke: var(--temp); stroke-width: 2; pointer-events: none; }
.map .pin { fill: none; stroke: var(--temp); stroke-width: 2.5; pointer-events: none; }

/* Leaflet overlays */
.leaflet-container { font-family: var(--font); }
/* Standard OSM tiles have no dark style: invert them into a dark street map. */
.basemap-css-dark .basemap-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
.leaflet-control-attribution { font-size: 10px; background: rgb(0 0 0 / 45%) !important; color: #cbd5e1 !important; }
.leaflet-control-attribution a { color: #e2e8f0 !important; }
.gps-dot { fill: #1a73e8; fill-opacity: 1; stroke: #fff; stroke-width: 3; }
.gps-accuracy { fill: #1a73e8; fill-opacity: .15; stroke: #1a73e8; stroke-opacity: .35; stroke-width: 1; }
.place-pin span { display: block; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / 45%); position: relative; }
.place-pin span::after { content: ""; position: absolute; inset: 7px; border-radius: 50% 50% 50% 0; background: #111827; transform: rotate(-45deg); }
.district-selected { fill: #f59e0b; fill-opacity: .08; stroke: #f59e0b; stroke-width: 2.5; stroke-dasharray: 6 4; }
.district-other { fill: none; stroke: #94a3b8; stroke-opacity: 0; stroke-width: 1; }
.show-districts .district-other { stroke-opacity: .45; }
.city-chip { display: none !important; }
.show-cities .city-chip { display: block !important; }
.city-chip span { display: inline-block; transform: translate(-50%, -50%); padding: 1px 7px; border-radius: 999px; font: 700 11px var(--font); color: #0f172a; background: rgb(255 255 255 / 88%); box-shadow: 0 1px 4px rgb(0 0 0 / 35%); cursor: pointer; white-space: nowrap; }
.wind-particles { position: absolute; inset: 0; z-index: 425; pointer-events: none; }
.heat-overlay { filter: blur(1.5px); }
.wind-icon svg { width: 20px; height: 20px; overflow: visible; opacity: .9; filter: drop-shadow(0 0 1.5px rgb(0 0 0 / 80%)); }
.wind-icon path { fill: #fff; stroke: #111827; stroke-width: 1.2; stroke-linejoin: round; }

/* glass controls over the map */
.glass {
  background: rgb(22 30 44 / 78%); color: #f1f5f9; border: 1px solid rgb(255 255 255 / 12%);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 4px 18px rgb(0 0 0 / 30%);
}
.map-ctl { position: absolute; z-index: 800; top: calc(var(--safe-top) + 122px); right: 12px; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; }
.map-ctl svg { width: 20px; height: 20px; fill: currentColor; }
#locateBtn[aria-pressed="true"] { color: #60a5fa; }
.map-ctl button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: 1.2rem; line-height: 1; }
.map-ctl button + button { border-top: 1px solid rgb(255 255 255 / 12%); }
.map-ctl button:hover { background: rgb(255 255 255 / 10%); }
.map-status { position: absolute; z-index: 800; top: calc(var(--safe-top) + 126px); left: 12px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.map-status.radar { color: #86efac; }
.map-status.forecast { color: #fcd34d; }
.map-timeline { color-scheme: dark; position: absolute; z-index: 800; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 12px; align-items: center; padding: 10px 14px 8px; border-radius: 22px; }
.map-timeline .play { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 15%); background: rgb(255 255 255 / 8%); color: #60a5fa; font-size: 1.35rem; padding: 0; }
.map-timeline .play[aria-pressed="true"] { color: #fbbf24; }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; justify-content: center; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.tl-head strong { font-size: 1.15rem; }
.tl-head span { font-size: .78rem; color: #cbd5e1; }
.tl-track { position: relative; }
#mapSlider { width: 100%; margin: 4px 0 0; accent-color: var(--layer); cursor: pointer; height: 26px; background: transparent; }
.tl-now { position: absolute; top: 6px; width: 2px; height: 18px; background: #f8fafc; opacity: .7; transform: translateX(-1px); pointer-events: none; }
.tl-scale { display: flex; justify-content: space-between; font-size: .75rem; color: #cbd5e1; }
.map-wrap {
  --layer: #3b82f6;
}
.map-wrap[data-layer="temp"] { --layer: #f97316; }
.map-wrap[data-layer="humidity"] { --layer: #14b8a6; }
.map-wrap[data-layer="wind"] { --layer: #a855f7; }
.map-wrap[data-layer="off"] { --layer: #64748b; }

/* layer picker: always-visible chips across the top of the map */
.layer-chips {
  display: flex; gap: 4px; align-items: center; justify-content: space-between;
  padding: 5px; border-radius: 18px; overflow-x: auto; scrollbar-width: none;
}
.layer-chips::-webkit-scrollbar { display: none; }
.layer-chips button {
  flex: 1 0 auto; justify-content: center; display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: #e2e8f0; font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.layer-chips button span { font-size: 1.1rem; line-height: 1; }
.layer-chips button:hover { background: rgb(255 255 255 / 10%); }
.layer-chips button[aria-checked="true"] { background: var(--layer); color: #fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--layer) 55%, transparent); }
.layer-chips .chip-off { font-weight: 500; color: #94a3b8; }
.legend-toggle { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgb(255 255 255 / 12%); color: #e2e8f0; cursor: pointer; }
.legend-toggle input { accent-color: var(--layer); width: 16px; height: 16px; }
@media (max-width: 520px) {
  .layer-chips button { padding: 8px 7px; font-size: .84rem; gap: 4px; }
  .layer-chips button span { font-size: 1rem; }
  .layer-chips .chip-off { flex-grow: 0; }
}
.has-values .city-chip { display: none !important; }

/* legend inside the map, tinted with the active layer colour */
.map-legend {
  position: absolute; z-index: 800; left: 12px; bottom: 108px; max-width: min(22rem, calc(100% - 24px));
  padding: 8px 12px; border-radius: 14px; border-left: 4px solid var(--layer); font-size: .78rem; color: #cbd5e1;
}
.map-legend:has(#mapLegend:empty) #mapLegend { display: none; }
.legend-box { min-width: 12rem; }
.legend-title { font-weight: 700; color: #f8fafc; font-size: .85rem; }
.legend-bar { height: 10px; border-radius: 5px; margin: 4px 0 2px; border: 1px solid rgb(255 255 255 / 20%); }
.legend-scale { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.legend-note { margin-top: 4px; }

.drop-pin { position: relative; }
.drop-pin-head {
  position: absolute; left: 3px; top: 0; width: 24px; height: 24px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: #ef4444; border: 3px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 50%); cursor: grab;
}
.drop-pin-head::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.drop-pin-shadow { position: absolute; left: 9px; bottom: 0; width: 12px; height: 5px; border-radius: 50%; background: rgb(0 0 0 / 35%); }
.leaflet-dragging .drop-pin-head { cursor: grabbing; }
.saved-pin { display: inline-flex !important; align-items: center; gap: 4px; white-space: nowrap; }
.saved-pin b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f59e0b; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 5px rgb(0 0 0 / 45%); font-size: 12px; cursor: pointer; }
.saved-pin span { padding: 1px 7px; border-radius: 8px; background: rgb(15 23 42 / 80%); color: #fde68a; font: 600 11px var(--font); }
.value-label span {
  display: inline-block; transform: translate(-50%, -50%); padding: 2px 7px; border-radius: 8px; white-space: nowrap;
  font: 700 12px var(--font); color: #fff; background: rgb(15 23 42 / 62%); border: 1px solid color-mix(in srgb, var(--layer) 70%, transparent);
}


/* wider screens: keep the phone-like column centred */
@media (min-width: 900px) {
  .hero { max-width: 560px; margin: 0 auto; border-radius: 0 0 30px 30px; }
  .tabbar { left: 50%; right: auto; width: 520px; transform: translateX(-50%); bottom: 12px; height: 64px; border-radius: 22px; border: 1px solid var(--line); padding-bottom: 6px; box-shadow: var(--shadow); }
  .view { bottom: 0; }
  .view-scroll > .stack:last-child { padding-bottom: 100px; }
  .map-timeline { max-width: 720px; margin: 0 auto; bottom: 90px; }
  .map-legend { bottom: 188px; }
  .sheet { bottom: 188px; }
  .map-top { max-width: 720px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
