.map-page {
    height: calc(100vh - 65px); /* fallback: desktop header-bar height */
    position: relative; /* anchors the map canvas + floating zones below */
}

/* The 65px above is a hardcoded guess at the header's height, and every
   floating control on these pages is absolutely positioned against the bottom
   of .map-page — so whenever the real header is taller (any narrow viewport),
   the page overflows and the bottom-anchored controls (mode toggle, legend)
   land below the fold, unreachable. Measure it instead: let the header take
   whatever height it needs and give the map the actual remainder. The calc
   above stays as the fallback for engines without :has(), where dropping to
   `height: auto` would collapse the map to zero. 100dvh (not vh) so mobile
   browser chrome doesn't hide the bottom row either. */
/* `height`, not `min-height`, plus overflow:hidden. A map page is a
   fixed-viewport app screen — nothing on it is meant to scroll, and every
   control is absolutely positioned inside .map-page, so there is nothing below
   the fold to reach. With `min-height: 100dvh` the body settled within a
   *fraction of a pixel* of the viewport (measured: body 673.6 vs viewport 674,
   off a 62.8px fractional header), so anything that nudged the header taller —
   a longer account email, different font metrics, a fractional
   devicePixelRatio — tipped it over and raised a page scrollbar down the side
   of the map. Pinning the height removes the whole margin for error. */
body:has(> .map-page) {
    height: 100dvh;
    overflow: hidden;
}

/* --cookie-h: height of the cookie strip while it shows (cookies.js), so
   the strip sits under the map instead of over its bottom controls. */
body:has(> .map-page) > .map-page {
    height: calc(100dvh - var(--header-h, 52px) - var(--cookie-h, 0px));
    min-height: 0;
}

.map-canvas {
    position: absolute;
    inset: 0;
}

/* Shared translucent-panel treatment (surface + slight blur) so the three
   zones read as one system despite living in different corners — see the
   redesign notes in HELPING-HAND.md-style advisory: split by function
   instead of welding unrelated clusters into one pill. */
.map-mode-zone,
.map-rail-group,
.map-rail-panel,
.map-playback {
    background-color: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* ---------------------------------------------------------------- status
   Read-only (badge, strike count, last-strike time) — no border, no pill,
   no hover state, so it never reads as a clickable control next to the
   actual buttons in the other zones. */
.map-status {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--r-sm);
    background-color: color-mix(in srgb, var(--surface) 80%, transparent);
    /* Clear of the 38px rail and its gap on the right, so the rail never
       covers it; long lines wrap inside the box. */
    max-width: calc(100% - 32px - 48px);
    flex-wrap: wrap;
    row-gap: 2px;
}

/* An open rail panel (268 px, left of the 38 px rail) takes the top right;
   the status line wraps short of it instead of running under it. */
@media (min-width: 641px) {
    .map-page:has(.map-rail-panel:not([hidden])) .map-status {
        max-width: calc(100% - 16px - 332px - 12px);
    }
}

.map-status > * {
    white-space: nowrap;
    max-width: 100%;
}

/* The counts and the trailing readout may break between items when the
   line is narrower than they are (a phone with a long badge), never inside
   one item; they used to stick out of the box and scroll the page. */
.map-status > .map-strike-count,
.map-status > .map-last-strike {
    white-space: normal;
}

.map-count {
    white-space: nowrap;
}

.map-badge {
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background-color: var(--accent-light);
    color: var(--ink);
}

.map-badge-fixture {
    background-color: var(--warn);
}

.map-strike-count,
.map-last-strike {
    font-size: var(--fs-xs);
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.map-badge {
    font-variant-numeric: tabular-nums;
}

/* Counts written by map-chrome.js: the number sits right-aligned in a box
   four digits wide and the label keeps the width of its longer form, so an
   update changes digits only and nothing after it moves. */
.map-num {
    display: inline-block;
    min-width: 4ch;
    text-align: right;
    font-weight: 600;
    color: var(--ink-2);
}

.map-lbl {
    display: inline-grid;
}

.map-lbl > * {
    grid-area: 1 / 1;
}

.map-count .map-lbl-one,
.map-count.is-one .map-lbl-many {
    visibility: hidden;
}

.map-count.is-one .map-lbl-one {
    visibility: visible;
}

/* The trailing readout (map-chrome.js last()): the text and invisible
   samples share one grid cell, so the slot keeps the width of the widest
   sample whatever it shows: a time, the empty-window note or nothing. */
.map-last-strike {
    display: inline-grid;
}

.map-last-strike > * {
    grid-area: 1 / 1;
}

.map-last-sample {
    visibility: hidden;
}

/* ---------------------------------------------------------------- Zone A: mode + date
   Bottom-left. Mode is a labeled segmented control (never icon-only — it's
   the single most consequential choice on this page); the archive date chip
   sits beside it and is removed from flow (not just faded) outside Archive. */
.map-mode-zone {
    position: absolute;
    left: 16px;
    bottom: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: var(--r-pill);
}

/* The flash play bar of the 3-D maps. It starts right of the Live/Archive
   zone (--mode-right, measured by map-chrome.js; it was a fixed 292 px, and
   its width 100% - 380 px left it about 10 px wide on a phone). Under
   820 px it moves onto its own row above the zone (rules below). */
.map-playback {
    position: absolute;
    left: max(calc(var(--mode-right, 276px) + 16px), calc(50% - 260px));
    bottom: 20px;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--r-pill);
    width: min(520px, calc(100% - max(calc(var(--mode-right, 276px) + 16px), calc(50% - 260px)) - 16px));
    box-sizing: border-box;
}

.map-playback[hidden] {
    display: none;
}

/* An open date calendar is drawn over everything else on the map (it is a
   popover: on a phone it is wider than the row it opens from and reaches
   the rail, which comes later in the page and was drawn over it). */
.map-bottom-dock:has(.map-date-popover:not([hidden])),
.map-mode-zone:has(.map-date-popover:not([hidden])) {
    z-index: 30;
}

/* The credit line is a long strip along the bottom of the map. While a
   flash is playing it would run underneath the play bar, so lift the whole
   control above that bar. */
.map-page:has(#flashPlayback:not([hidden])) .maplibregl-ctrl-bottom-right {
    bottom: 76px;
}

.map-page:has(#flashPlayback:not([hidden])) .map-rail-zone {
    bottom: calc(76px + var(--ctrl-br-h, 96px));
}

/* Narrow: the play bar on its own row above the Live/Archive zone, the
   corner controls and the rail panels above the bar. */
@media (max-width: 820px) {
    .map-playback {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: var(--bottom-dock-h, 72px);
    }

    .map-page:has(#flashPlayback:not([hidden])) .maplibregl-ctrl-bottom-right {
        bottom: calc(var(--bottom-dock-h, 72px) + var(--playback-h, 52px) + 4px);
    }

    .map-page:has(#flashPlayback:not([hidden])) .map-rail-zone {
        bottom: calc(var(--bottom-dock-h, 72px) + var(--playback-h, 52px) + var(--ctrl-br-h, 96px) + 12px);
    }
}

@media (max-width: 640px) {
    .map-playback {
        left: 12px;
        right: 12px;
    }
}

/* Too short for the rail and the play bar in one column (.map-cramped,
   map-chrome.js): the bar stops left of the rail. */
@media (max-width: 820px) {
    .map-page.map-cramped .map-playback {
        right: 62px;
    }
}

/* Rail and basemap switch would meet (map-chrome.js sets .map-cramped):
   the switch and credits move left of the rail. */
.map-page.map-cramped .maplibregl-ctrl-bottom-right {
    right: 54px;
}

/* Opened with the (i) button, the credit line is a strip that runs left
   from the corner. Let it wrap into a short block instead of running under
   the controls along the bottom of the map. */
.map-page .maplibregl-ctrl-attrib.maplibregl-compact-show {
    max-width: min(420px, calc(100vw - 96px));
}

.map-playback-play,
.map-playback-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    flex: 0 0 auto;
}

.map-playback-play {
    background: var(--ink);
    color: #f5f6f8;
}

.map-playback-icon {
    background: transparent;
    color: var(--ink);
}

.map-playback-icon:hover,
.map-playback-icon.active {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.map-playback-glyph {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-playback-play .map-playback-glyph {
    fill: currentColor;
    stroke: none;
}

.map-playback-play .map-playback-glyph-pause {
    display: none;
}

.map-playback-play.is-playing .map-playback-glyph-play {
    display: none;
}

.map-playback-play.is-playing .map-playback-glyph-pause {
    display: block;
}

.map-playback-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: #f5f6f8;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.map-playback-play:hover .map-playback-tip,
.map-playback-play:focus-visible .map-playback-tip,
.map-playback-icon:hover .map-playback-tip,
.map-playback-icon:focus-visible .map-playback-tip {
    opacity: 1;
}

.map-playback-icon.open .map-playback-tip {
    opacity: 0;
}

.map-playback-menu {
    position: relative;
}

.map-playback-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 160px;
    padding: 10px;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.map-playback-panel[hidden] {
    display: none;
}

.map-playback-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--fs-xs);
    color: var(--muted);
}

.map-playback-field select {
    font: inherit;
    color: var(--ink);
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 4px 6px;
}

.map-playback-track {
    position: relative;
    flex: 1 1 auto;
    min-width: 48px;
    display: flex;
    align-items: center;
}

.map-playback-scrub {
    width: 100%;
    margin: 0;
    accent-color: var(--accent-deep);
}

.map-playback-hoverline {
    position: absolute;
    top: -6px;
    bottom: -6px;
    width: 2px;
    margin-left: -1px;
    background: var(--ink);
    pointer-events: none;
}

.map-playback-hoverline[hidden],
.map-playback-hover[hidden] {
    display: none;
}

.map-playback-hover {
    position: absolute;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 3px 7px;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: #f5f6f8;
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

.map-playback-time {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-xs);
    color: var(--ink-2);
    white-space: nowrap;
}

.map-mode-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.map-mode-btn {
    border: none;
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 6px 16px;
    cursor: pointer;
}

.map-mode-btn.active {
    background-color: var(--accent-deep);
    color: #fff;
}

.map-date-picker {
    position: relative;
}

.map-date-chip {
    border: 1px solid var(--border);
    background-color: transparent;
    color: var(--ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--r-pill);
    cursor: pointer;
}

.map-date-chip:hover {
    border-color: var(--accent);
}

.map-date-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    /* 312 px: room for "September (12)" and "2026 (123)" side by side; at
       260 px the month box cut off its own label ("October (3"). */
    width: min(312px, calc(100vw - 24px));
    max-height: 50vh;
    overflow-y: auto;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    padding: 8px;
    z-index: 20;
}

.map-date-empty {
    font-size: var(--fs-sm);
    color: var(--muted);
    padding: 8px;
}

/* --- Archive calendar (date-picker.js, shared by /map and /map2d) --------
   A month grid rather than a list: archived days are sparse and cluster into
   storm runs, and only a real calendar layout shows those runs and the gaps
   between them at a glance. Days with no data stay on the grid as disabled
   cells so the gaps read as information rather than as missing rows. */

.map-date-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}

.map-date-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}

/* Month + year as selects rather than a static label: the arrows alone made
   any month outside the data's own range unreachable, and stepping a year is
   12 clicks. Option labels carry the day count, so the dropdown itself shows
   where the data is. */
.map-date-selects {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.map-date-select {
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink);
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 2px 4px;
    min-width: 0;
    cursor: pointer;
}

.map-date-select:hover {
    border-color: var(--accent);
}

.map-date-title-count {
    font-size: var(--fs-xs);
    color: var(--muted);
}

.map-date-nav {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-md);
    line-height: 1;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
}

.map-date-nav:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-deep);
}

/* Disabled = no earlier/later month HAS data. Kept visible rather than
   hidden so the control doesn't shift position at the ends of the archive. */
.map-date-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.map-date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.map-date-weekday {
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
    padding-bottom: var(--sp-1);
}

.map-date-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-xs);
    color: var(--ink-2);
    cursor: pointer;
    padding: 0;
}

.map-date-cell.is-blank {
    cursor: default;
}

.map-date-cell.is-weekend {
    color: var(--muted);
}

/* Has data: filled so the month's active days read as a shape, not a list. */
.map-date-cell.has-data {
    background-color: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent-deep);
    font-weight: 600;
}

.map-date-cell.has-data:hover {
    background-color: color-mix(in srgb, var(--accent) 26%, transparent);
}

.map-date-cell.is-empty {
    color: color-mix(in srgb, var(--muted) 55%, transparent);
    cursor: default;
}

/* Today gets a ring, not a fill — it must not be confused with "selected",
   and on this archive today usually has no data yet. */
.map-date-cell.is-today {
    border-color: var(--muted);
}

.map-date-cell.active {
    background-color: var(--accent-deep);
    border-color: var(--accent-deep);
    color: #fff;
}

.map-date-foot {
    margin-top: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px solid var(--border);
}

.map-date-latest {
    width: 100%;
    text-align: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: var(--sp-1) var(--sp-2);
    cursor: pointer;
}

.map-date-latest:hover {
    border-color: var(--accent);
    color: var(--accent-deep);
}

/* ---------------------------------------------------------------- Zone B: right-edge tool rail
   The OpenStreetMap control pattern (see map-rail.js for the interaction
   contract): a thin icon column welded to the right edge, with exactly ONE
   flyout panel open at a time immediately to its left.

   What this replaced: a 260px column that held every tool button, the grid
   panel and the legend all permanently expanded — i.e. the bottom-right
   quadrant of the map was never visible. Icons + one panel trade a click for
   the whole corner back.

   The zone spans the full map height but is pointer-events:none, so the empty
   space beside a short panel still drags the map; only the rail and the open
   panel take pointer events. Panels are capped at the zone height and scroll
   internally rather than growing past the viewport.

   The alignment here is load-bearing, not incidental. `align-items: stretch`
   gives .map-rail-panels the zone's *definite* height, which is the only way
   the panel's `max-height: 100%` resolves to anything (a percentage max-height
   against an auto-height parent is ignored). .map-rail-panels then re-declares
   `flex-start` so the panel keeps its own content height instead of being
   stretched — a stretched box rounds to whole pixels while its fractional
   content does not, and the leftover sub-pixel was enough to raise a permanent
   phantom scrollbar on a panel with room to spare. .map-rail must opt out of
   the stretch too: a full-height rail box is `pointer-events: auto` down the
   whole column and would swallow map drags below the last button. */
.map-rail-zone {
    position: absolute;
    right: 16px;
    top: 16px;
    /* Stops above MapLibre's bottom-right corner (basemap switch, credits;
       height measured by map-chrome.js), so a long panel never covers it. */
    bottom: max(20px, calc(var(--ctrl-br-h, 0px) + 8px));
    z-index: 10;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: none;
}

.map-rail-panels {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    min-height: 0;
}

.map-rail {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    gap: 10px;
    flex-shrink: 0;
    pointer-events: auto;
}

/* Each group is one rounded card of adjacent icon buttons — the same
   grouping MapLibre uses for its own zoom/compass control (which map.js
   mounts into #mapRailNav as the first group, so the column reads as one
   system instead of two stacks of unrelated chrome). */
/* No `overflow: hidden` here even though it would be the obvious way to clip
   the buttons to the card's rounded corners — it also clips .map-rail-tip,
   which has to escape the card to sit beside it. The corner radii are put on
   the first/last buttons instead (inset by the 1px border), which clips their
   hover/open fills just as well. */
.map-rail-group {
    display: flex;
    flex-direction: column;
    border-radius: var(--r-md);
}

.map-rail-group > :first-child,
.map-rail-group .maplibregl-ctrl-group button:first-child {
    border-top-left-radius: calc(var(--r-md) - 1px);
    border-top-right-radius: calc(var(--r-md) - 1px);
}

.map-rail-group > :last-child,
.map-rail-group .maplibregl-ctrl-group button:last-child {
    border-bottom-left-radius: calc(var(--r-md) - 1px);
    border-bottom-right-radius: calc(var(--r-md) - 1px);
}

.map-rail-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: none;
    border-top: 1px solid var(--border);
    background: transparent;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.map-rail-btn:first-child {
    border-top: none;
}

.map-rail-btn:hover {
    background-color: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--ink);
}

/* Two distinct states that must not be confused:
   .open  = this button's panel is currently showing (chrome state)
   .active = something inside that panel is switched on (data state, set by
             map.js — e.g. the grid is drawn, a layer is visible). */
.map-rail-btn.open {
    background-color: var(--accent-deep);
    color: #fff;
}

.map-rail-btn.active::after {
    content: "";
    position: absolute;
    right: 5px;
    top: 5px;
    width: 6px;
    height: 6px;
    border-radius: var(--r-pill);
    background-color: var(--accent-deep);
}

.map-rail-btn.open.active::after {
    background-color: #fff;
}

.map-rail-icon {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hover label, rendered to the left of the rail. A `title` attribute would
   do the same job but only after the browser's ~1s delay, which is too slow
   for an icon-only control someone is scanning. aria-hidden — the button
   already carries the same string as its aria-label. */
.map-rail-tip {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 9px;
    border-radius: var(--r-sm);
    background-color: var(--ink);
    color: var(--surface);
    font-size: var(--fs-xs);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.map-rail-btn:hover .map-rail-tip,
.map-rail-btn:focus-visible .map-rail-tip {
    opacity: 1;
}

/* The tip is decoration on a control whose panel is already open — showing
   it there just covers the panel it points at. */
.map-rail-btn.open .map-rail-tip {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .map-rail-tip {
        transition: none;
    }
}

/* ---- flyout panel ---- */

/* `line-height: 1.5` against the 12px --fs-xs used throughout this panel is
   an exact 18px, and every fixed dimension below is a whole number, so the
   panel's content height stays integral. That matters more than it looks:
   with `line-height: normal` the rows measured x.4px, and on a display at a
   fractional devicePixelRatio (125% Windows scaling) the interior height and
   the scroll height round in opposite directions — a one-sub-pixel overflow
   that shows a full-height scrollbar on a panel with 800px to spare. */
.map-rail-panel {
    width: 268px;
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--r-md);
    line-height: 1.5;
    overflow-y: auto;
    overscroll-behavior: contain;
    pointer-events: auto;
}

.map-rail-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 8px 9px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background-color: inherit;
}

.map-rail-panel-title {
    margin: 0;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-2);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.map-rail-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: var(--r-xs);
}

.map-rail-close:hover {
    background-color: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--ink);
}

.map-rail-panel-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
}

.map-rail-panel-note {
    margin: 0;
    padding: 0 14px 12px;
    font-size: var(--fs-xs);
    color: var(--muted);
}

/* Stacked full-width toggle rows inside a panel. Deliberately NOT styled as
   `cta-button` (that vocabulary means "site-level action" elsewhere, e.g.
   Log out) and NOT pill-shaped (pills read as one atomic action on this
   page — the mode toggle); a flat row + a value readout demotes these to
   in-map utilities. */
.map-tools {
    display: flex;
    flex-direction: column;
}

/* Explicit line-height, not inherited: the UA stylesheet's `font` shorthand
   on <button> resets line-height to `normal`, so .map-rail-panel's 1.5 never
   reaches these rows — and `normal` is what makes their height fractional.
   See the sub-pixel-scrollbar note on .map-rail-panel. */
.map-tool {
    border: none;
    border-top: 1px solid var(--border);
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1.5;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-tool:first-child {
    border-top: none;
}

.map-tool:hover {
    background-color: color-mix(in srgb, var(--accent) 8%, transparent);
}

.map-tool.active {
    background-color: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--ink);
}

/* Hillshading is subordinate to Terrain — indented so the dependency reads
   structurally, not only through the disabled state below. */
.map-tool-sub {
    padding-left: 26px;
}

/* Shading is subordinate to Terrain — dimmed/unclickable whenever terrain
   itself is off, same treatment as .map-grid-origin.disabled. */
.map-tool:disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.map-tool-value {
    color: var(--muted);
    font-weight: 600;
}

.map-tool-value.value-accent {
    color: var(--accent-deep);
}

.map-tool-value.value-mid {
    color: var(--ink-2);
}

/* ---------------------------------------------------------------- grid panel contents
   Lives in the rail's "Coordinate grid" flyout (.map-rail-panel-body supplies
   the card, padding and row gap) — these rules are only the controls inside. */
.map-grid-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-grid-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-2);
}

.map-grid-segmented {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
}

.map-grid-seg-btn {
    flex: 1;
    border: none;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1.5;
    font-weight: 600;
    padding: 6px 4px;
    cursor: pointer;
}

.map-grid-seg-btn:first-child {
    border-left: none;
}

.map-grid-seg-btn:hover {
    background-color: color-mix(in srgb, var(--accent) 8%, transparent);
}

.map-grid-seg-btn.active {
    background-color: var(--accent-deep);
    color: #fff;
}

.map-grid-origin {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-grid-origin.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.map-grid-origin-caption {
    font-size: var(--fs-xs);
    color: var(--muted);
}

.map-grid-origin-inputs {
    display: flex;
    gap: 8px;
}

.map-grid-origin-inputs label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--fs-xs);
    color: var(--ink-2);
}

.map-grid-origin-inputs input {
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background-color: var(--page);
    color: var(--ink);
    font-size: var(--fs-xs);
    line-height: 1.5;
    padding: 4px 6px;
    width: 100%;
}

.map-grid-origin-inputs input.map-grid-input-error {
    border-color: var(--warn);
}

.map-grid-reset {
    align-self: flex-start;
    border: none;
    background: transparent;
    color: var(--accent-deep);
    font-size: var(--fs-xs);
    line-height: 1.5;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.map-grid-reset:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------- legend / histogram
   Lives in the rail's "Legend" flyout, which is the one panel that opens by
   default (see defaultPanel in map.js/map2d.js): in Archive mode the
   histogram IS the primary drill-down control, not a reference legend, so
   starting it behind a click would add a step to the main interaction. */
.map-legend-breadcrumb {
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-bottom: 6px;
}

.map-legend-crumb {
    background: transparent;
    border: none;
    color: var(--accent-deep);
    font-size: var(--fs-xs);
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.map-legend-crumb-current {
    color: var(--ink-2);
    font-weight: 600;
}

.map-legend-scale {
    height: 10px;
    border-radius: var(--r-pill);
}

.map-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: 4px;
}

/* Clickable density histogram — doubles as the legend and the drill-down
   control (click a bar to zoom into that hour / 5-min bucket). Fixed height
   regardless of bar count (24 hourly vs. 12 five-min) so drilling in/out
   doesn't visibly resize the panel. Bars are all drawn at the same height —
   color (qualitative jet palette) encodes each bucket's recency/position,
   oldest=navy to newest=dark red — one distinct jet hue per bucket, not a
   continuous gradient — matching the archive scatter map — so every
   bucket has a full-size click target, not just the tallest ones. The color key isn't a
   separate legend: .map-histogram-chart wraps the bars and the gradient
   .map-histogram-scale strip flush together (no gap, shared rounded card),
   so the strip reads as the chart's own colored baseline/axis. */
.map-histogram-chart {
    border-radius: var(--r-xs);
    overflow: hidden;
}

.map-histogram {
    display: flex;
    align-items: stretch;
    height: 48px;
    gap: 1px;
}

.map-histogram-bar {
    flex: 1;
    min-width: 2px;
    height: 100%;
    border: none;
    cursor: pointer;
    padding: 0;
}

.map-histogram-bar:disabled {
    cursor: default;
}

.map-histogram-bar:not(:disabled):hover {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.map-histogram-readout {
    font-size: var(--fs-xs);
    color: var(--ink-2);
    height: 14px;
    margin-bottom: 2px;
}

.map-histogram-scale {
    height: 5px;
}

.map-histogram-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: 2px;
}

.map-histogram-ticks {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: 4px;
}

.station-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--muted); /* unknown/loading — briefly, before the first status fetch resolves */
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
}

/* Live mode: currently online/offline (from /api/sites, heartbeat
   reachability). Archive mode: did the station actually contribute to a
   localized point in the day/hour/window being viewed (from each strike's
   `sites` list — see map.js's updateArchiveSiteStatus()) — not "is it
   online right now." */
.station-marker.online {
    background-color: var(--good);
}

.station-marker.offline {
    background-color: #000;
}

/* MapLibre's own zoom/compass control is mounted inside the rail (see
   #mapRailNav in map.js) so the right edge is one column, not two stacks.
   Strip the control's own card chrome — the .map-rail-group wrapper already
   supplies it — and grow its 29px buttons to the rail's 38px hit target so
   the two groups line up. */
.map-rail-group .maplibregl-ctrl {
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.map-rail-group .maplibregl-ctrl-group button {
    width: 38px;
    height: 38px;
    background-color: transparent;
}

.map-rail-group .maplibregl-ctrl-group button + button {
    border-top-color: var(--border);
}

.map-rail-group .maplibregl-ctrl-group button:hover {
    background-color: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* "3D" / "2D" under the compass (map.js, tilt and turn by tap): the one-tap
   tilt a touchscreen otherwise lacks. */
.map-rail-group .maplibregl-ctrl-group button.map-tilt-3d {
    color: var(--ink-2);
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1;
}

.map-rail-group .maplibregl-ctrl-group button.map-tilt-3d.active {
    color: var(--accent-deep);
}

/* View panel: Tilt -/+ and Turn steps, a label with its readout over a
   two-button segmented row (the grid panel's .map-grid-segmented). */
.map-cam-step {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
}

.map-cam-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-xs);
    line-height: 1.5;
    font-weight: 600;
    color: var(--ink-2);
}

/* Own class, not .map-grid-seg-btn: map.js binds the grid mode to every
   .map-grid-seg-btn, so a step button with that class switched the grid on. */
.map-cam-btn {
    flex: 1;
    border: none;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1.5;
    font-weight: 600;
    padding: 8px 4px;
    cursor: pointer;
}

.map-cam-btn:first-child {
    border-left: none;
}

.map-cam-btn:hover {
    background-color: color-mix(in srgb, var(--accent) 8%, transparent);
}

.map-cam-btn:active {
    background-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* One-time note on a touchscreen about the two-finger gestures (map.js). */
.map-touch-hint {
    position: absolute;
    left: 16px;
    bottom: 84px;
    z-index: 11;
    max-width: 340px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: var(--fs-xs);
    line-height: 1.45;
    text-align: left;
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.15);
    cursor: pointer;
}

@media (max-width: 640px) {
    .map-touch-hint {
        left: 12px;
        right: 62px; /* clear of the rail */
        bottom: 76px;
        max-width: none;
    }
}

/* Narrow screens: the rail stays a right-edge column (it's only 38px wide),
   but its panel spans the remaining width instead of a fixed 268px, and the
   zone clears the status readout above and the mode toggle below. */
@media (max-width: 640px) {
    .map-mode-zone {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: center;
    }

    /* The zone spans the width here and hid the (i) credit button. */
    .map-page:has(> .map-mode-zone) .maplibregl-ctrl-bottom-right {
        bottom: var(--bottom-dock-h, 64px);
    }

    .map-rail-zone {
        right: 12px;
        left: 12px;
        top: 12px; /* the status line stops short of the rail (max-width above) */
        /* clears the mode zone's row and the basemap switch with the credits above it */
        bottom: calc(var(--bottom-dock-h, 64px) + var(--ctrl-br-h, 90px));
    }

    /* The rail's icons sit beside the status line; an open panel starts
       under it, so the status stays readable with the legend open. */
    .map-rail-panels {
        flex: 1 1 auto;
        /* under the status line, however many rows it wraps to (map-chrome.js) */
        margin-top: calc(var(--status-bottom, 60px) - 4px);
    }

    /* A panel on a phone covers at most a bit over half the map, so the
       map stays in view with the legend open. */
    .map-rail-panel {
        width: 100%;
        max-height: min(100%, 52dvh);
    }

    .map-status {
        left: 12px;
        top: 12px;
        max-width: calc(100% - 24px - 48px);
    }
}

/* Click-popup detail rows (strikes, CG pins, power grid features) — one
   consistent "label: value" list style across every clickable map feature. */
.map-popup-row {
    font-size: var(--fs-xs);
    margin-top: 2px;
}

.map-popup-label {
    color: var(--muted);
}

.map-popup-footer {
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: 6px;
}

/* ---- Strike source popup (2D + 3D maps) ---- */
.maplibregl-popup.strike-popup-tip .maplibregl-popup-content {
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18), 0 1px 3px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    min-width: 260px;
    max-width: 300px;
}

.maplibregl-popup.strike-popup-tip .maplibregl-popup-close-button {
    font-size: var(--fs-lg);
    width: 28px;
    height: 28px;
    line-height: 26px;
    color: var(--muted);
    padding: 0;
    right: 4px;
    top: 4px;
}

.maplibregl-popup.strike-popup-tip .maplibregl-popup-close-button:hover {
    background: transparent;
    color: var(--text, #1a1a1a);
}

.strike-popup {
    font-size: var(--fs-xs);
    line-height: 1.45;
    color: var(--text, #1a1a1a);
}

.strike-popup-head {
    padding: 12px 36px 10px 14px;
    background: color-mix(in srgb, var(--accent) 6%, var(--elevated, #fff));
    border-bottom: 1px solid color-mix(in srgb, var(--border, #e2e8f0) 80%, transparent);
}

.strike-popup-time {
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.strike-popup-sub {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.strike-popup-badge {
    display: inline-block;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #8a5a00;
    background: color-mix(in srgb, #f0c14a 22%, transparent);
    border: 1px solid color-mix(in srgb, #f0c14a 45%, transparent);
    border-radius: var(--r-xs);
    padding: 1px 6px;
}

.strike-popup-badge.is-3d {
    color: color-mix(in srgb, var(--accent) 85%, #000);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.strike-popup-body {
    padding: 10px 14px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.strike-popup-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.strike-popup-section-title {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.strike-popup-stations {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.strike-popup-station-count {
    font-weight: 600;
    font-size: var(--fs-xs);
    margin-right: 2px;
}

.strike-popup-chip {
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--r-xs);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: color-mix(in srgb, var(--accent) 90%, #000);
}

.strike-popup-empty {
    color: var(--muted);
    font-style: italic;
}

.strike-popup-kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    align-items: baseline;
}

.strike-popup-kv dt {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-xs);
}

.strike-popup-kv dd {
    margin: 0;
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--fs-xs);
    word-break: break-all;
}

.strike-popup-peaks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.strike-popup-peaks li {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 8px;
    align-items: baseline;
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--fs-xs);
}

.strike-popup-peaks .site {
    font-weight: 600;
    color: color-mix(in srgb, var(--accent) 90%, #000);
}

.strike-popup-peaks .t {
    color: var(--text, #1a1a1a);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.strike-popup-foot {
    padding: 8px 14px 12px;
}

.strike-popup-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: #fff !important;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-decoration: none !important;
    transition: filter 0.12s ease, transform 0.12s ease;
}

.strike-popup-cta:hover {
    filter: brightness(1.06);
}

.strike-popup-cta:active {
    transform: translateY(1px);
}

.strike-popup-cta-arrow {
    opacity: 0.85;
    font-size: var(--fs-base);
    line-height: 1;
}

/* Touch: the 14 px station dot gets a 34 px hit area without growing. */
@media (pointer: coarse) {
    .station-marker::after {
        content: "";
        position: absolute;
        inset: -10px;
        border-radius: 50%;
    }
}

/* Flash view with channel lines on: what the lines are (map.js buildChannelNote). */
.map-legend-note {
    margin: 8px 0 0;
    font-size: var(--fs-xs);
    line-height: 1.4;
    color: var(--muted);
}

/* ---- Popups docked on the left of the map (map-popup-dock.js) ----
   MapLibre places a popup with an inline transform at the clicked point;
   here it sits in a fixed column instead, whole on the page, and its
   content scrolls when it is taller than the room between the status line
   and the Live/Archive switch (--popup-top / --popup-bottom, measured by
   the script). */
.maplibregl-popup.map-popup-docked {
    transform: none !important;
    left: 16px;
    top: var(--popup-top, 60px);
    max-width: min(340px, calc(100% - 32px)) !important;
    max-height: calc(100% - var(--popup-top, 60px) - var(--popup-bottom, 90px));
    display: flex;
    flex-direction: column;
    z-index: 11;
}

.maplibregl-popup.map-popup-docked .maplibregl-popup-tip {
    display: none;
}

/* The content box keeps its rounded corners and its close button in place;
   what is inside it scrolls. */
.maplibregl-popup.map-popup-docked .maplibregl-popup-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18), 0 1px 3px rgba(15, 23, 42, 0.08);
}

.maplibregl-popup.map-popup-docked .maplibregl-popup-content > :not(button) {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* The place the open popup is about. map-popup-dock.js sets the transform on
   every frame (on the source, at its height on the 3-D pages). A number badge
   (.map-popup-place-num) names a return stroke when a flash has several. */
.map-popup-place {
    position: absolute;
    left: 0;
    top: 0;
    will-change: transform;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--accent-deep, #1c7ed6);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(15, 23, 42, 0.25);
    box-sizing: border-box;
    pointer-events: none;
}

.map-popup-place-num {
    position: absolute;
    top: -9px;
    right: -11px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent-deep, #1c7ed6);
    color: #fff;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95);
    font: 700 10px/16px var(--font-body, system-ui, sans-serif);
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .maplibregl-popup.map-popup-docked {
        left: 8px;
        max-width: calc(100% - 16px) !important;
        max-height: min(55%, calc(100% - var(--popup-top, 60px) - var(--popup-bottom, 90px)));
    }
}

/* Flashes rail panel (flash-list.js), on every map page: every flash of the view,
   newest first, one row per flash (moved from map2d-vhf-falma.css). */
.flash-list {
    list-style: none;
    margin: 0;
    padding: 2px 8px 8px;
    max-height: 46vh;
    overflow-y: auto;
    font-size: var(--fs-xs);
}

.flash-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.flash-list li:hover,
.flash-list li:focus {
    background: var(--elevated);
    outline: none;
}

.flash-list .flash-list-empty {
    cursor: default;
    color: var(--muted);
}

.flash-list-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
    border: 1px solid rgba(0, 0, 0, 0.25);
}

.flash-list li.is-far {
    color: var(--muted);
}

.flash-list-cgtag {
    margin-left: auto;
    font-weight: 700;
}

.flash-list-cgtag.neg { color: var(--critical-text); }
.flash-list-cgtag.pos { color: var(--warn-text); }

.flash-list-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 6px;
    font-size: var(--fs-xs);
    color: var(--muted);
    cursor: pointer;
}

.flash-list-filter[hidden] {
    display: none;
}

/* The flash on view: accent bar, tint, bold time, eye; opened before: a small check. */
.flash-list li.is-current {
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    box-shadow: inset 3px 0 0 var(--accent-deep);
    color: inherit;
    font-weight: 600;
}

.flash-list li.is-current:hover,
.flash-list li.is-current:focus {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
}

.flash-list-mark {
    display: inline-flex;
    align-items: center;
    flex: none;
    margin-left: auto;
}

.flash-list-cgtag + .flash-list-mark {
    margin-left: 0;
}

.flash-list-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flash-list li.is-current .flash-list-icon {
    stroke: none;
    fill: var(--accent-deep);
}

.flash-list-note {
    margin: 0;
    padding: 0 14px 6px;
    color: var(--muted);
    font-size: var(--fs-xs);
}

/* ---------------------------------------------------------------- 2D map family
   /map2d, /map2d-vhf-falma and /efm-map: one product with different inputs,
   so one set of chrome. Moved here from map2d.css and map2d-vhf-falma.css
   (2026-10-22), where it was duplicated rule for rule. Day arrows beside the
   date chip, the weather time bar (Play / Loop / Speed / Window / slider),
   and the empty-window note. The 3-D pages use none of these classes. */

.m2k-daynav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.m2k-daynav[hidden] {
    display: none;
}

.m2k-daynav .map-date-picker {
    position: relative;
}

.m2k-step {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--elevated);
    color: var(--ink);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.m2k-step:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Bottom dock of the 2D pages (2026-10-23): the Live/Archive zone and the
   time bar in one flex row along the bottom of the map. The time bar was
   centred on its own with a fixed width, so between about 900 and 1100 px it
   ran over the date chip, its time label stuck out of the pill, and the
   credit line ran under it. In one row the time bar takes the room the zone
   leaves; when it no longer fits (under 560 px) it wraps onto a row above
   the zone (wrap-reverse). map-chrome.js measures the dock (--bottom-dock-h)
   and the basemap switch with the credits sit above it. */
.map-bottom-dock {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 20px;
    z-index: 10;
    display: flex;
    flex-wrap: wrap-reverse;
    align-items: center;
    gap: 8px 12px;
    pointer-events: none; /* the gaps still drag the map */
}

.map-bottom-dock > * {
    pointer-events: auto;
}

/* In the dock the zone is in the flow; above the time bar so the date
   calendar, which opens upward, is never under it. */
.map-bottom-dock > .map-mode-zone {
    position: relative;
    inset: auto;
    z-index: 2;
    flex: none;
}

.map-page:has(> .map-bottom-dock) .maplibregl-ctrl-bottom-right {
    bottom: var(--bottom-dock-h, 76px);
}

.map-page:has(> .map-bottom-dock) .map-rail-zone {
    bottom: calc(var(--bottom-dock-h, 76px) + var(--ctrl-br-h, 96px));
}

.m2k-timebar {
    position: relative;
    flex: 1 1 560px;
    max-width: 760px;
    min-width: 0;
    margin-inline: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 22px;
    background-color: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: var(--fs-xs);
    color: var(--ink-2);
}

.m2k-play {
    width: 32px;
    height: 32px;
    flex: none;
    border: none;
    border-radius: 50%;
    background: var(--accent-deep);
    color: #ffffff;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.m2k-play svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.m2k-loop {
    width: 32px;
    height: 32px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--elevated);
    color: var(--ink-2);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.m2k-loop svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.m2k-loop[aria-pressed="true"] {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
    color: #ffffff;
}

.m2k-loop:disabled,
.m2k-play:disabled {
    opacity: 0.4;
    cursor: default;
}

.m2k-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-weight: 600;
}

.m2k-select {
    padding: 3px 4px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background: var(--elevated);
    color: var(--ink);
    font: inherit;
    font-weight: 400;
}

.m2k-slider {
    flex: 1;
    min-width: 80px;
    accent-color: var(--accent-deep);
}

.m2k-window {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink);
    min-width: 116px;
    text-align: right;
}

@media (max-width: 640px) {
    .map-bottom-dock {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .map-bottom-dock > .map-mode-zone {
        flex: 1 1 100%;
    }

    .m2k-timebar {
        flex-basis: 100%;
        max-width: none;
    }

    /* Two rows: buttons and lists, then the slider with its time label. */
    .m2k-slider {
        flex: 1 1 120px;
        order: 5;
    }

    .m2k-window {
        order: 6;
        min-width: 0;
    }

    /* Panels stop above the basemap switch and credits as on a wide screen;
       at 360 x 640 an open legend hid both. */
    .map-page:has(> .map-bottom-dock) .map-rail-zone {
        bottom: calc(var(--bottom-dock-h, 166px) + var(--ctrl-br-h, 90px));
    }
}
