/* The map page (map.html, map.js). Uses the tokens, buttons, chips and dialogs of styles.css: only what's
   new here. Layers, bottom to top: the map, the header, the sheet / preview card, the toast, dialogs. */

/* Opted into page-to-page view transitions (with index.html): the preview card becomes the spot's card (its
   morph is shared, styles.css "Map <-> spot"). Back from a spot: the spot's page fades out while the map
   comes forward under the card, the reverse of leaving it. */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
::view-transition-old(root) { animation: .2s cubic-bezier(.4, 0, 1, 1) both vt-fade-out; }
::view-transition-new(root) { animation: .38s cubic-bezier(.22, 1, .36, 1) both vt-come; }

/* Light by default; dark below. --mp-*-solid: the ground's colour behind white text (the card), a shade
   deeper than the dots' where those don't reach 4.5:1 with white (dry 3.9, puddles 3.4). --mp-t-*: the
   ground's colour as text on its own 15% tint (badges, the count, a fresh report), 4.5:1 or more. */
:root {
  --mp-top: calc(max(10px, env(safe-area-inset-top)) + 46px); /* header bottom edge */
  --mp-ring: #fff;
  --mp-shadow: 0 2px 10px rgb(22 24 29 / .12), 0 0 0 1px rgb(22 24 29 / .04);
  --mp-sheet-shadow: 0 -10px 40px rgb(22 24 29 / .14);
  --mp-dry-solid: #15834f; --mp-puddles-solid: #bf500e;
  --mp-t-dry: #0f6a3f; --mp-t-damp: #6b5200; --mp-t-puddles: #9a3f0a; --mp-t-wet: #a52a2a; --mp-t-none: var(--ink-2);
  /* "Previsão" (the time slider): the radar's blue as text, >= 4.5:1 in both themes */
  --mp-t-rain: color-mix(in srgb, var(--rain) 72%, var(--ink));
  --mp-thumb: var(--surface); /* the time slider's picked segment */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mp-ring: rgb(255 255 255 / .92);
    --mp-shadow: 0 2px 12px rgb(0 0 0 / .45), 0 0 0 1px rgb(255 255 255 / .06);
    --mp-sheet-shadow: 0 -10px 40px rgb(0 0 0 / .5);
    --mp-t-dry: color-mix(in srgb, var(--dry) 72%, var(--ink)); --mp-t-damp: color-mix(in srgb, var(--damp) 72%, var(--ink));
    --mp-t-puddles: color-mix(in srgb, var(--puddles) 72%, var(--ink)); --mp-t-wet: color-mix(in srgb, var(--wet) 72%, var(--ink));
    --mp-thumb: color-mix(in srgb, var(--ink) 15%, var(--chip));
  }
}
[data-theme="dark"] {
  --mp-ring: rgb(255 255 255 / .92);
  --mp-shadow: 0 2px 12px rgb(0 0 0 / .45), 0 0 0 1px rgb(255 255 255 / .06);
  --mp-sheet-shadow: 0 -10px 40px rgb(0 0 0 / .5);
  --mp-t-dry: color-mix(in srgb, var(--dry) 72%, var(--ink)); --mp-t-damp: color-mix(in srgb, var(--damp) 72%, var(--ink));
  --mp-t-puddles: color-mix(in srgb, var(--puddles) 72%, var(--ink)); --mp-t-wet: color-mix(in srgb, var(--wet) 72%, var(--ink));
  --mp-thumb: color-mix(in srgb, var(--ink) 15%, var(--chip));
}
[data-theme="light"] {
  --mp-thumb: var(--surface);
  --mp-ring: #fff;
  --mp-shadow: 0 2px 10px rgb(22 24 29 / .12), 0 0 0 1px rgb(22 24 29 / .04);
  --mp-sheet-shadow: 0 -10px 40px rgb(22 24 29 / .14);
  --mp-t-dry: #0f6a3f; --mp-t-damp: #6b5200; --mp-t-puddles: #9a3f0a; --mp-t-wet: #a52a2a;
}

/* The page never scrolls: the map takes the whole screen, the list scrolls inside the sheet. No browser
   pull-to-reload or bounce fighting the map's pans and pinches. */
html:has(body.mp) { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.mp { position: fixed; inset: 0; min-height: 0; overflow: hidden; overscroll-behavior: none; }

.mp-map { position: absolute; inset: 0; background: var(--bg); touch-action: none; }
.mp-map .maplibregl-canvas { outline: none; opacity: 0; transition: opacity .6s var(--ease-out); }
.mp-map.is-ready .maplibregl-canvas { opacity: 1; }
.mp-map.is-instant .maplibregl-canvas { transition: none; }
/* The globe (intro, or zoomed right out) floats in space, in both themes: deep blue-black, a faint glow
   where the Earth sits, and stars on three tiles of different sizes (no visible repeat). */
.mp-map.is-space {
  background-color: #04060b;
  background-image:
    radial-gradient(42% 34% at 50% 44%, rgb(96 150 255 / .2), rgb(96 150 255 / .06) 60%, transparent 75%),
    radial-gradient(1.3px 1.3px at 23px 41px, rgb(255 255 255 / .95) 50%, transparent 52%),
    radial-gradient(1px 1px at 131px 87px, rgb(255 255 255 / .7) 50%, transparent 52%),
    radial-gradient(1px 1px at 77px 153px, rgb(214 228 255 / .55) 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 190px 22px, rgb(206 222 255 / .85) 50%, transparent 52%),
    radial-gradient(1px 1px at 51px 199px, rgb(255 255 255 / .45) 50%, transparent 52%),
    radial-gradient(1px 1px at 163px 176px, rgb(255 255 255 / .6) 50%, transparent 52%),
    radial-gradient(1px 1px at 61px 37px, rgb(255 255 255 / .5) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 271px 133px, rgb(255 240 222 / .7) 50%, transparent 52%),
    radial-gradient(1px 1px at 103px 289px, rgb(255 255 255 / .55) 50%, transparent 52%),
    radial-gradient(1px 1px at 311px 251px, rgb(255 255 255 / .4) 50%, transparent 52%),
    radial-gradient(1.8px 1.8px at 377px 61px, rgb(255 255 255 / .9) 50%, transparent 52%),
    radial-gradient(1px 1px at 233px 349px, rgb(220 232 255 / .6) 50%, transparent 52%),
    radial-gradient(130% 95% at 50% 44%, #0b1222 0%, #060912 55%, #020306 100%);
  background-size: 100% 100%, 220px 220px, 220px 220px, 220px 220px, 220px 220px, 220px 220px, 220px 220px,
    330px 330px, 330px 330px, 330px 330px, 330px 330px, 410px 410px, 410px 410px, 100% 100%;
}
.mp-map.is-fallback { touch-action: auto; }

/* ---------- Header: the name and round buttons, floating over the map ---------- */
.mp-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.mp-top > * { pointer-events: auto; }
.mp-brand {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 11px; border-radius: 999px;
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 15px; letter-spacing: -.01em;
  box-shadow: var(--mp-shadow); white-space: nowrap;
}
.mp-brand svg { width: 17px; height: 17px; fill: var(--rain); }
.mp-top .top-actions { gap: 6px; }
.mp-top .theme-btn, .mp-top .lang, .mp-btn { box-shadow: var(--mp-shadow); border-color: transparent; }
.mp-top .lang { min-height: 38px; }
.mp-top .theme-btn { width: 38px; height: 38px; }
/* Fingers need 44 px; the round buttons stay 38 px to the eye, with a wider invisible hit area. */
.mp-top .theme-btn, .mp-top .lang, .mp-btn { position: relative; }
.mp-top .theme-btn::after, .mp-top .lang::after, .mp-btn::after { content: ''; position: absolute; inset: -4px -3px; border-radius: 999px; }
.mp-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: 50%; background: var(--surface); color: var(--ink);
  transition: transform .12s var(--ease-out), background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.mp-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mp-btn .mp-fill { fill: currentColor; stroke: none; }
.mp-btn:active { transform: scale(var(--press)); }
.mp-btn:focus-visible, .mp-brand:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 2px; }
.mp-btn[aria-pressed="true"] { background: var(--rain); color: #fff; }
.mp-btn.is-busy svg { animation: mp-spin 1s linear infinite; }
/* The radar button keeps its place until the map can show the radar, then fades in where it is. */
.mp-btn.is-pending { visibility: hidden; opacity: 0; scale: .8; }
#radarBtn { transition: transform .12s var(--ease-out), background-color .2s var(--ease-out), color .2s var(--ease-out), opacity .3s var(--ease-out), scale .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes mp-spin { to { transform: rotate(360deg); } }
/* Inside the apps "locate me" needs the app to handle the location permission: those that do add " geo"
   to their user agent (html[data-geo], map.html). */
html[data-plat="app"]:not([data-geo]) #locateBtn { display: none !important; }
@media (max-width: 359px) { .mp-brand span { display: none; } .mp-brand { padding: 0 11px; } }

/* MapLibre's attribution: a folded "i" tucked under the header's last button; opened, a small box that
   stays in the map's top-right corner (the same credit is always written at the end of the list). */
.mp-map .maplibregl-ctrl-top-right { top: calc(var(--mp-top) + 6px); right: max(10px, env(safe-area-inset-right)); }
.mp-map .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0; }
.mp-map .maplibregl-ctrl-attrib { max-width: min(300px, calc(100vw - 24px)); background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink-2); font: 11px/1.4 var(--font); border-radius: 12px; box-shadow: var(--mp-shadow); }
.mp-map .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) { box-shadow: none; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.mp-map .maplibregl-ctrl-attrib a { color: inherit; }
.mp-map:not(.is-attrib) .maplibregl-ctrl-attrib { display: none; } /* until folded (map.js): appears once, as the small "i" */
.mp-map .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 24px; }
.mp-map .maplibregl-ctrl-attrib-button { background-color: transparent; }
[data-theme="dark"] .mp-map .maplibregl-ctrl-attrib-button,
:root:not([data-theme="light"]) .mp-map .maplibregl-ctrl-attrib-button { filter: invert(1) opacity(.8); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .mp-map .maplibregl-ctrl-attrib-button { filter: none; } }

/* ---------- Markers ---------- */
/* Not before the map itself is drawn (no dot floating in empty space while the globe loads). */
.mp-map:not(.is-ready) .mk-wrap { visibility: hidden; }
/* MapLibre moves the outer element (its transform); everything that animates is inside it. */
.mk-anchor { width: 0; height: 0; }
.mk {
  --c: var(--none); --s: 1;
  position: absolute; left: 0; top: 0; translate: -50% -50%; scale: var(--s);
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: var(--c); color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 2px var(--mp-ring), 0 0 0 6px color-mix(in srgb, var(--c) 22%, transparent), 0 0 22px 4px color-mix(in srgb, var(--c) 45%, transparent);
  transition: scale .28s cubic-bezier(.22, 1, .36, 1), box-shadow .28s var(--ease-out), background-color .4s var(--ease-in-out), opacity .3s;
}
/* A bigger invisible hit area (fingers, not pixels) */
.mk::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.mk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mk[data-cond="dry"] { --c: var(--dry); }
.mk[data-cond="damp"] { --c: var(--damp); color: #241b00; }
.mk[data-cond="puddles"] { --c: var(--puddles); }
.mk[data-cond="wet"] { --c: var(--wet); }
/* No data yet: a smaller, quieter dot without the glow. */
.mk[data-cond="none"] { --s: .82; box-shadow: 0 0 0 2px var(--mp-ring), 0 2px 6px rgb(0 0 0 / .25); }
/* A fresh report (last hour): one soft ring leaves the dot as it appears, then a still halo stays (no
   endless loop; with reduced motion or on a slow phone, just the halo). */
.mk[data-fresh]::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--c); z-index: -1;
  transform: scale(1.55); opacity: .3;
  animation: mk-pulse 2.4s cubic-bezier(.22, 1, .36, 1) .2s backwards;
}
@keyframes mk-pulse {
  0% { transform: scale(1); opacity: .5; }
  60% { transform: scale(2.6); opacity: 0; }
  61% { transform: scale(1); opacity: 0; }
  100% { transform: scale(1.55); opacity: .3; }
}
.mp-map.is-far .mk:not(.is-on) { --s: .74; }
.mp-map.is-far .mk[data-cond="none"]:not(.is-on) { --s: .62; }
@media (hover: hover) { .mk:hover { --s: 1.12; } } /* never stuck on a phone after a tap */
.mk:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.mk.is-on { --s: 1.45; z-index: 2; box-shadow: 0 0 0 2.5px var(--mp-ring), 0 0 0 8px color-mix(in srgb, var(--c) 28%, transparent), 0 0 30px 8px color-mix(in srgb, var(--c) 55%, transparent); }
.mk-wrap.is-on { z-index: 2; }
/* The name beside the dot once the map is close enough to have room (and always for the selected one). */
.mk-name {
  position: absolute; left: 18px; top: 0; translate: 0 -50%; white-space: nowrap; pointer-events: none; max-width: 170px; overflow: hidden; text-overflow: ellipsis;
  padding: 3px 8px; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 700;
  box-shadow: var(--mp-shadow); opacity: 0; transform: translateX(-4px); transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}
/* Only the names MapLibre found room for (map.js showNames: no two run into each other), and the picked one. */
.mp-map.is-near .mk-wrap.has-name .mk-name, .mk-wrap.is-on .mk-name { opacity: 1; transform: none; }
.mk-wrap.is-on .mk-name { left: 24px; }
/* Right to left: the name on the dot's other side (as the hidden name layer places it), cut at its end. */
[dir="rtl"] .mk-name { left: auto; right: 18px; transform: translateX(4px); }
[dir="rtl"] .mk-wrap.is-on .mk-name { left: auto; right: 24px; }
/* A group of spots (zoomed out): how many, and a ring split by their conditions. */
.mkc {
  position: absolute; left: 0; top: 0; translate: -50% -50%;
  display: grid; place-items: center; width: var(--d, 40px); height: var(--d, 40px); padding: 0; border: 0; border-radius: 50%;
  background: var(--ring-bg); cursor: pointer; color: var(--ink); font: 800 13px/1 var(--font); -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 2px var(--mp-ring), 0 0 26px 6px color-mix(in srgb, var(--glow, var(--dry)) 42%, transparent);
  transition: scale .25s var(--ease-out);
}
.mkc::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.mkc span { position: relative; }
@media (hover: hover) { .mkc:hover { scale: 1.08; } }
.mkc:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
/* A spot imported from OpenStreetMap that nobody has reported from yet: a step quieter than the others (a
   smaller dot, no glow round it, a dashed edge), still in its ground's colour. */
.mk[data-unv]:not(.is-on) { --s: .8; box-shadow: 0 0 0 2px var(--mp-ring), 0 1px 4px rgb(0 0 0 / .22); opacity: .88; }
.mk[data-unv]:not(.is-on) { outline: 1.5px dashed color-mix(in srgb, var(--ink) 55%, transparent); outline-offset: 2px; }
.mk[data-unv][data-cond="none"]:not(.is-on) { --s: .68; }
.mp-map.is-far .mk[data-unv]:not(.is-on) { --s: .62; outline: 0; }
.mp-map.is-far .mk[data-unv][data-cond="none"]:not(.is-on) { --s: .52; }
/* An estimate from the coarse forecast only (its zone's own forecast is on its way, POST /api/zones/warm): the
   same colour, washed out, and no glow: approximate, not wrong. */
.mk[data-approx]:not(.is-on) { background: color-mix(in srgb, var(--c) 58%, var(--surface)); box-shadow: 0 0 0 2px var(--mp-ring), 0 1px 4px rgb(0 0 0 / .2); }
/* A block's bubble: how many spots are there that the map hasn't asked for yet (zoom in, or tap it). No
   condition, so no colour: the surface's own, like a group's middle. */
.mkb {
  position: absolute; left: 0; top: 0; translate: -50% -50%;
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--ink-2); cursor: pointer; font: 800 12.5px/1 var(--font); font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 2px var(--mp-ring), 0 0 0 5px color-mix(in srgb, var(--ink) 9%, transparent), 0 2px 8px rgb(0 0 0 / .22);
  transition: scale .25s var(--ease-out), opacity .2s;
}
.mkb::after { content: ''; position: absolute; inset: -7px; border-radius: 999px; }
.mkb.is-busy { opacity: .6; }
@media (hover: hover) { .mkb:hover { scale: 1.08; } }
.mkb:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
/* Where you are (after "locate me") */
.mk-me { position: absolute; left: 0; top: 0; translate: -50% -50%; width: 16px; height: 16px; border-radius: 50%; background: var(--rain); box-shadow: 0 0 0 3px var(--mp-ring), 0 0 0 9px color-mix(in srgb, var(--rain) 22%, transparent); pointer-events: none; }
.mk-in { animation: mk-in .45s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes mk-in { from { opacity: 0; scale: .6; } }
/* The intro's landing (map.js land()): each marker gives one beat and sends one ring out, the nearest the
   middle first. */
.mk-wrap.mk-land > .mk, .mk-wrap.mk-land > .mkc { animation: mk-beat .5s cubic-bezier(.22, 1, .36, 1) var(--land-delay, 0ms) both; }
.mk-wrap.mk-land::before {
  content: ''; position: absolute; left: 0; top: 0; width: 30px; height: 30px; translate: -50% -50%; border-radius: 50%;
  border: 2px solid var(--land-c, var(--mp-ring)); pointer-events: none;
  animation: mk-land .9s cubic-bezier(.22, 1, .36, 1) var(--land-delay, 0ms) both;
}
@keyframes mk-beat { 40% { transform: scale(1.16); } }
/* A spot's ground changed on a refresh (map.js paintSpot): its colour glides to the new one (the dot's
   transition) and one soft ring goes out in that colour. Once, never a loop. */
.mk-wrap.mk-shift::before {
  content: ''; position: absolute; left: 0; top: 0; width: 28px; height: 28px; translate: -50% -50%; border-radius: 50%;
  border: 2px solid var(--land-c, var(--mp-ring)); pointer-events: none;
  animation: mk-land 1s cubic-bezier(.22, 1, .36, 1) .2s both;
}
.mk-wrap.mk-shift > .mk { animation: mk-beat .55s cubic-bezier(.22, 1, .36, 1) .1s both; }
@keyframes mk-land { from { transform: scale(.7); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }

/* ---------- The list: a sheet on phones ---------- */
.mp-sheet {
  --peek: 271px; /* = map.js visibleOf("peek") (title, time slider, search, chips, one row): no jump when it takes over */
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  height: calc(100% - var(--mp-top) - 10px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; box-shadow: var(--mp-sheet-shadow);
  transform: translateY(var(--y, calc(100% - var(--peek))));
  transition: transform var(--snap-ms, 450ms) var(--ease-sheet);
  will-change: transform;
}
.mp-sheet.is-dragging { transition: none; }
/* The intro will play (map.html head): out of sight from the first paint; map.js lets it rise. If map.js
   never runs, it comes up by itself after 12 s (the intro brings it in by ~10 s at the latest). */
html.intro-wait .mp-sheet { transform: translateY(105%); transition: none; animation: mp-intro-safety 0s 12s forwards; }
@keyframes mp-intro-safety { to { transform: translateY(calc(100% - var(--peek))); } }
.mp-sheet.is-away { transform: translateY(105%); transition-duration: .3s; }
/* Grab bar: shows the sheet drags; a tap cycles it open / closed. */
.mp-grab { flex: none; height: 22px; width: 100%; border: 0; padding: 0; background: none; touch-action: none; }
.mp-grab::before { content: ''; display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--line); }
.mp-grab:focus-visible { outline: none; }
.mp-grab:focus-visible::before { background: var(--ink-2); }
.mp-head { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 2px 18px 8px; touch-action: none; }
.mp-head h1 { margin: 0; font-size: 21px; line-height: 1.2; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.mp-count { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mp-count b { color: var(--mp-t-dry); }
.mp-fc { color: var(--mp-t-rain); font-weight: 800; }

/* The time slider: four segments on one track, the picked one lifted onto a thumb that glides between
   them (220 ms, ease-out; at once with reduced motion). 36 px to the eye, 44 px to the finger. */
.mp-when {
  --slot: 0;
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 14px; padding: 3px; height: 38px;
  border-radius: 12px; background: var(--chip); touch-action: manipulation;
}
.mp-when[hidden] { display: none; }
.mp-when-thumb {
  position: absolute; top: 3px; bottom: 3px; inset-inline-start: 3px; width: calc((100% - 6px) / 4); border-radius: 9px;
  background: var(--mp-thumb); box-shadow: 0 1px 3px rgb(22 24 29 / .14), 0 0 0 .5px rgb(22 24 29 / .06);
  transform: translateX(calc(var(--slot) * 100%)); transition: transform .22s cubic-bezier(.25, 1, .5, 1), background-color .22s var(--ease-out);
}
[dir="rtl"] .mp-when-thumb { transform: translateX(calc(var(--slot) * -100%)); }
.mp-when button {
  position: relative; z-index: 1; min-width: 0; padding: 0 4px; border: 0; border-radius: 9px; background: none; color: var(--ink-2);
  font: 700 13.5px/1 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-tap-highlight-color: transparent;
  transition: color .18s var(--ease-out);
}
.mp-when button::after { content: ''; position: absolute; inset: -6px 0; }
.mp-when button[aria-checked="true"] { color: var(--ink); }
/* A later moment: the picked segment in the forecast's blue, so it never reads as "now". */
.mp-when button[aria-checked="true"]:not([data-slot="0"]) { color: var(--mp-t-rain); }
.mp-when button:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 1px; }
@media (hover: hover) { .mp-when button:not([aria-checked="true"]):hover { color: var(--ink); } }
/* The list after a move of the slider: one quick settle instead of rows jumping. */
.mp-list.mp-shift { animation: mp-shift .24s var(--ease-out); }
@keyframes mp-shift { from { opacity: .4; } }
.mp-tools { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.mp-search { display: flex; align-items: center; gap: 8px; margin: 0 14px; padding: 0 12px; height: 42px; border-radius: 12px; background: var(--chip); color: var(--ink-2); }
.mp-search:focus-within { outline: 2px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.mp-search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mp-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font-size: 16px; outline: none; }
.mp-search input::placeholder { color: var(--ink-2); opacity: 1; }
.mp-search input::-webkit-search-cancel-button { filter: grayscale(1); }
.mp-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px; scrollbar-width: none; }
.mp-chips::-webkit-scrollbar { display: none; }
.mp-chips .chip { position: relative; flex: none; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.mp-chips .chip::after { content: ''; position: absolute; inset: -4px -3px; border-radius: 999px; } /* 44 px to the finger */
.mp-chips { padding-block: 4px; margin-block: -4px; } /* room for the chips' wider hit areas */
.mp-chips .chip[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.mp-chips .chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 2px; }

/* Search said nothing, or found more in the other kinds: right under the chips (above the keyboard). */
.mp-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 2px 14px 0; color: var(--ink-2); font-size: 14px; text-align: center; }
.mp-hint[hidden], .mp-hint [hidden] { display: none; }
.mp-hint-btn { min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 14px/1.2 var(--font); }
.mp-hint-btn, .mp-brand, .mp-skip, .mp-empty button { transition: transform .12s var(--ease-out); }
.mp-hint-btn:active, .mp-brand:active, .mp-empty button:active { transform: scale(var(--press)); }
.mp-hint-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 2px; }

.mp-scroll { flex: 1; min-height: 0; padding-bottom: var(--kb, 0px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.mp-list { margin: 0; padding: 4px 0 0; list-style: none; }
/* The list is grouped by condition: one heading per group (its condition, the line most of its rows share,
   how many) instead of a pill and the same words on every row. */
.mp-group {
  --c: var(--none); --t: var(--mp-t-none);
  display: flex; align-items: baseline; gap: 8px; padding: 14px 18px 4px; font-size: 13px; line-height: 1.3; color: var(--ink-2);
}
.mp-group + .mp-group, li + .mp-group { margin-top: 6px; border-top: 1px solid var(--line); }
.mp-group[data-cond="dry"] { --c: var(--dry); --t: var(--mp-t-dry); }
.mp-group[data-cond="damp"] { --c: var(--damp); --t: var(--mp-t-damp); }
.mp-group[data-cond="puddles"] { --c: var(--puddles); --t: var(--mp-t-puddles); }
.mp-group[data-cond="wet"] { --c: var(--wet); --t: var(--mp-t-wet); }
.mp-group-dot { flex: none; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }
.mp-group-name { flex: none; color: var(--t); font-weight: 800; }
.mp-group-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-group-line:not(:empty)::before { content: '· '; }
.mp-group-n { margin-inline-start: auto; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.mp-credit { margin: 20px 18px calc(16px + env(safe-area-inset-bottom)); color: var(--ink-2); font-size: 12px; line-height: 1.5; text-align: center; }
.mp-credit a { color: inherit; text-underline-offset: 2px; }
/* The first rows rise into place one after another (first load, or with the sheet after the intro). */
.mp-rise { animation: mp-rise .46s cubic-bezier(.22, 1, .36, 1) calc(var(--i, 0) * 45ms) both; }
@keyframes mp-rise { from { opacity: 0; transform: translateY(14px); } }
.mp-row {
  --c: var(--none); --t: var(--mp-t-none);
  position: relative; width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 12px;
  min-height: 64px; padding: 9px 16px; border: 0; background: none; color: inherit; text-align: start; font: inherit;
  transition: background-color .15s var(--ease-out);
}
@media (hover: hover) { .mp-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); } }
.mp-row:active { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.mp-row:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: -3px; border-radius: 12px; }
.mp-row[aria-current="true"] { background: color-mix(in srgb, var(--c) 12%, transparent); }
.mp-row[data-cond="dry"] { --c: var(--dry); --t: var(--mp-t-dry); }
.mp-row[data-cond="damp"] { --c: var(--damp); --t: var(--mp-t-damp); }
.mp-row[data-cond="puddles"] { --c: var(--puddles); --t: var(--mp-t-puddles); }
.mp-row[data-cond="wet"] { --c: var(--wet); --t: var(--mp-t-wet); }
.mp-dot { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c); color: #fff; transition: background-color .24s var(--ease-out), color .24s var(--ease-out); }
.mp-row[data-cond="damp"] .mp-dot { color: #241b00; }
.mp-row[data-cond="none"] .mp-dot { background: var(--chip); color: var(--ink-2); }
/* Not verified yet (imported): the dot a size down with a dashed edge, as on the map. */
.mp-row[data-unv] .mp-dot { scale: .84; outline: 1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent); outline-offset: 2px; }
.mp-row[data-approx] .mp-dot { background: color-mix(in srgb, var(--c) 58%, var(--surface)); }
.mp-dot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.mp-row[data-fresh] .mp-dot::after { content: ''; position: absolute; top: 0; right: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); filter: brightness(1.15); }
.mp-txt { min-width: 0; }
.mp-name { display: block; font-weight: 700; font-size: 15.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-sub { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A report from the last hour: what someone just saw, in the ground's colour. */
.mp-live { color: var(--t); font-weight: 700; }
/* Right to left, a Latin name (dir=auto) still sits at the reading start, and is cut at its own end. */
[dir="rtl"] .mp-name, [dir="rtl"] .mp-prev-name { text-align: right; }
/* The row's condition, read out by screen readers (seen in its group's heading and its dot). */
.mp-cond { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mp-skel { height: 64px; margin: 0 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 5%, transparent), transparent) 0 0 / 200% 100%; animation: mp-shine 1.4s linear infinite; }
@keyframes mp-shine { to { background-position: -200% 0; } }
.mp-empty, .mp-note { margin: 16px 18px; color: var(--ink-2); font-size: 14px; text-align: center; }
.mp-empty[hidden], .mp-note[hidden] { display: none; }
.mp-note { margin-top: 0; }
.mp-empty button { display: block; margin: 10px auto 0; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 700; }
.mp-sheet .mp-foot { flex: none; }

/* ---------- One spot ---------- */
.mp-prev {
  --c: var(--none);
  position: absolute; z-index: 3; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  padding: 16px 18px 16px; border-radius: var(--radius); background: var(--c); color: #fff;
  box-shadow: 0 16px 44px rgb(0 0 0 / .28);
  transition: background-color .4s var(--ease-in-out);
}
.mp-prev[data-cond="dry"] { --c: var(--mp-dry-solid); }
.mp-prev[data-cond="damp"] { --c: var(--damp); color: #241b00; }
.mp-prev[data-cond="puddles"] { --c: var(--mp-puddles-solid); }
.mp-prev[data-cond="wet"] { --c: var(--wet); }
.mp-prev.m-in { animation: mp-prev-in .42s var(--ease-sheet) both; }
.mp-prev.m-out { animation: mp-prev-out .2s cubic-bezier(.4, 0, 1, 1) both; }
@keyframes mp-prev-in { from { transform: translateY(calc(100% + 24px)); } }
@keyframes mp-prev-out { to { transform: translateY(calc(100% + 24px)); opacity: .6; } }
.mp-prev-x {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .16); color: inherit; font-size: 22px; line-height: 1;
}
.mp-prev-x::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; } /* 44 px to the finger */
.mp-prev[data-cond="damp"] .mp-prev-x { background: rgb(36 27 0 / .12); }
.mp-prev-x:focus-visible, .mp-prev-open:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.mp-prev-cond { margin: 0 0 2px; margin-inline-end: 44px; font-size: 14px; font-weight: 700; }
.mp-prev-name { margin: 0 0 4px; margin-inline-end: 44px; font-size: 24px; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.mp-prev-line { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 600; }
.mp-prev-line:empty { display: none; }
.mp-prev-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.mp-prev-badges span { padding: 4px 10px; border-radius: 999px; background: rgb(0 0 0 / .16); font-size: 12.5px; font-weight: 700; }
.mp-prev[data-cond="damp"] .mp-prev-badges span { background: rgb(36 27 0 / .1); }
.mp-prev-open {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; min-height: 48px; border-radius: 14px;
  background: #fff; color: #16181d; font-weight: 800; font-size: 16px; text-decoration: none;
  transition: transform .12s var(--ease-out);
}
.mp-prev-open:active { transform: scale(var(--press)); }
.mp-prev-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mp-prev.vt { view-transition-name: spot-card; }
.mp-prev.vt .mp-prev-name { view-transition-name: spot-name; }

/* ---------- The rain radar's timeline (radar.js): under the header, while the radar is on ---------- */
.rb {
  position: absolute; z-index: 4; top: calc(var(--mp-top) + 8px);
  left: max(12px, env(safe-area-inset-left)); right: calc(max(10px, env(safe-area-inset-right)) + 34px); max-width: 360px;
  display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 10px; align-items: center;
  padding: 7px 14px 6px 7px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); box-shadow: var(--mp-shadow);
  opacity: 0; transform: translateY(-6px); transition: opacity .24s var(--ease-out), transform .3s var(--ease-out);
}
.rb.is-on { opacity: 1; transform: none; }
.rb[hidden] { display: none; }
body.sg-on .rb { display: none; } /* placing a suggestion: the map stays clear */
.rb-play {
  grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: var(--rain); color: #fff; -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease-out), opacity .2s var(--ease-out);
}
.rb-play:disabled { opacity: .45; }
.rb-play:active:not(:disabled) { transform: scale(var(--press)); }
.rb-play:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 2px; }
.rb-play svg { width: 18px; height: 18px; fill: currentColor; grid-area: 1 / 1; }
/* Play and pause swap with a quick blur-scale (one icon in, the other out). */
.rb-play .rb-i-play, .rb-play .rb-i-pause { transform-box: fill-box; transform-origin: center; transition: opacity .18s var(--ease-out), scale .22s var(--ease-out), filter .18s var(--ease-out); }
.rb-play[aria-pressed="true"] .rb-i-play, .rb-play[aria-pressed="false"] .rb-i-pause { opacity: 0; scale: .5; filter: blur(2px); }
.rb-range {
  --p: 1;
  grid-column: 2; width: 100%; height: 26px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer;
  touch-action: pan-y; /* a sideways drag moves the slider, not the map */
}
.rb-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--rain) calc(var(--p) * 100%), color-mix(in srgb, var(--ink) 16%, transparent) 0);
}
.rb-range::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 16%, transparent); }
.rb-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--rain); }
.rb-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border: 0; border-radius: 50%;
  background: var(--surface); box-shadow: 0 0 0 2px var(--rain), 0 1px 4px rgb(0 0 0 / .25);
  transition: scale .15s var(--ease-out);
}
.rb-range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--rain), 0 1px 4px rgb(0 0 0 / .25); }
.rb-range:active::-webkit-slider-thumb { scale: 1.15; }
.rb-range:focus-visible { outline: 3px solid color-mix(in srgb, var(--ink) 40%, transparent); outline-offset: 2px; border-radius: 8px; }
.rb-foot { grid-column: 2; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: -1px 0 0; font-size: 12.5px; line-height: 1.3; }
/* The time never jitters as the digits change; a forecast frame says so in the radar's colour. */
.rb-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb[data-forecast] .rb-time { color: var(--rain); }
.rb-credit { flex: none; color: var(--ink-2); font-size: 11.5px; text-decoration: none; }
/* What it means for the spots (map.js radarSummary), under the timeline, across. */
.rb-sum { grid-column: 1 / -1; margin: 5px 0 1px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.35; font-weight: 600; color: var(--ink-2); }
.rb-sum:empty { display: none; }
[dir="rtl"] .rb { right: max(12px, env(safe-area-inset-right)); left: calc(max(10px, env(safe-area-inset-left)) + 34px); }
.rb-credit:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }

/* ---------- The intro's way out ---------- */
.mp-skip {
  position: absolute; z-index: 5; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); translate: -50% 0;
  min-height: 40px; padding: 8px 20px; border: 1px solid rgb(255 255 255 / .22); border-radius: 999px;
  background: rgb(10 14 24 / .55); color: #fff; font: 700 14px/1.2 var(--font); letter-spacing: .01em;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(8px); transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.mp-skip:not(.is-on) { pointer-events: none; }
.mp-skip.is-on { opacity: 1; transform: none; transition-delay: .6s; }
.mp-skip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Wide screens: the list is a panel on the left ---------- */
@media (min-width: 900px) {
  .mp-sheet {
    left: max(16px, env(safe-area-inset-left)); right: auto; top: calc(var(--mp-top) + 12px); bottom: 16px; width: 380px; height: auto;
    border-radius: 20px; transform: none !important; transition: opacity .3s var(--ease-out);
    box-shadow: 0 10px 40px rgb(0 0 0 / .16);
  }
  .mp-sheet.is-away { opacity: 1; }
  .mp-grab { display: none; }
  .mp-head { padding-top: 16px; }
  .mp-credit { margin-bottom: 14px; }
  .mp-prev { left: calc(max(16px, env(safe-area-inset-left)) + 396px); right: auto; bottom: 24px; width: 360px; }
  .mp-map .maplibregl-ctrl-top-right { top: calc(var(--mp-top) + 8px); }
  .rb { left: calc(max(16px, env(safe-area-inset-left)) + 396px); }
  /* Right to left: the panel on the right, the card and the radar's timeline beside it on its left. */
  [dir="rtl"] .mp-sheet { left: auto; right: max(16px, env(safe-area-inset-right)); }
  [dir="rtl"] .mp-prev { left: auto; right: calc(max(16px, env(safe-area-inset-right)) + 396px); }
  [dir="rtl"] .rb { left: calc(max(10px, env(safe-area-inset-left)) + 34px); right: calc(max(16px, env(safe-area-inset-right)) + 396px); }
}
/* Right to left: the credits' "i" under the header's last button, which is on the left. */
[dir="rtl"] .mp-map .maplibregl-ctrl-top-right { right: auto; left: max(10px, env(safe-area-inset-left)); }

/* ---------- A slow phone or Data Saver (html.lowfx, map.html head) ----------
   Space without the stars (a dozen gradients to paint behind the globe), dots without their wide glow
   (blurred shadows on every marker while the map moves), the fresh report's ring still rather than a loop,
   the intro's button without the frosted glass. */
.lowfx .mp-map.is-space { background-image: radial-gradient(130% 95% at 50% 44%, #0b1222 0%, #060912 55%, #020306 100%); background-size: 100% 100%; }
.lowfx .mk { box-shadow: 0 0 0 2px var(--mp-ring), 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
.lowfx .mk.is-on { box-shadow: 0 0 0 2.5px var(--mp-ring), 0 0 0 8px color-mix(in srgb, var(--c) 32%, transparent); }
.lowfx .mkc { box-shadow: 0 0 0 2px var(--mp-ring), 0 2px 8px rgb(0 0 0 / .25); }
.lowfx .mk[data-fresh]::before { animation: none; }
.lowfx .mp-skip { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(10 14 24 / .82); }

@media (prefers-reduced-motion: reduce) {
  .mp-sheet, .mk, .mkc, .mk-name, .mp-prev, .mp-map .maplibregl-canvas, #radarBtn, .mp-skip, .rb, .rb-play, .rb-play *, .rb-range::-webkit-slider-thumb,
  .mp-hint-btn, .mp-brand, .mp-empty button, .mp-when-thumb, .mp-when button, .mp-dot { transition: none; }
  .mp-list.mp-shift { animation: none; }
  .mk-wrap.mk-shift::before, .mk-wrap.mk-shift > .mk, .mk[data-fresh]::before, .mk-in, .mp-prev.m-in, .mp-prev.m-out, .mp-skel, .mp-btn.is-busy svg, .mp-rise,
  .mk-wrap.mk-land > .mk, .mk-wrap.mk-land > .mkc, .mk-wrap.mk-land::before { animation: none; }
}
