:root {
    --panel-bg: rgba(12, 16, 22, 0.92);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-text: #e6edf3;
    --panel-muted: #92a4b1;
    --accent: #48b2ff;
    --accent-soft: rgba(72, 178, 255, 0.2);
}

#appShell {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 20% 20%, #16212b 0%, #0b0f14 55%, #07090b 100%);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#cesiumContainer {
    position: absolute;
    inset: 0;
}

/* Dual-viewer NEXRAD split: side-by-side panes with a seam in the middle. */
#cesiumContainer2 {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    display: none;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.6);
}
#appShell.dual-split #cesiumContainer {
    inset: 0 50% 0 0;
}
#appShell.dual-split #cesiumContainer2 {
    display: block;
}
/* In dual-split mode, hide the single-viewer split UI — it's replaced by
 * the two side-by-side panes. */
#appShell.dual-split #splitDivider,
#appShell.dual-split #splitLabelLeft,
#appShell.dual-split #splitLabelRight {
    display: none !important;
}

#layersPanel {
    position: absolute;
    top: 74px; /* 24px margin + 42px button row + 8px gap */
    right: 24px;
    width: 320px;
    /* Auto-size to content; cap at viewport-minus-HUD via max-height.
       _syncBottomHudLayout in maps.js overrides max-height when the legend
       or timeline encroaches.  .tree (the scrollable region) needs min-height:0
       so it shrinks inside this flex column once the cap is hit. */
    height: auto;
    max-height: calc(100% - 98px);
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    color: var(--panel-text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    z-index: 4;
    backdrop-filter: blur(6px);
    transition: transform 180ms ease, opacity 180ms ease, max-height 200ms ease;
}

#layersPanel.collapsed {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
}

#layersToggle {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-text);
    font-size: 16px;
    cursor: pointer;
    z-index: 5;
}

#layersPanel .panelHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--panel-border);
    font-size: 16px;
    letter-spacing: 0.4px;
}

#layersPanel .status {
    font-size: 12px;
    color: var(--panel-muted);
    text-transform: uppercase;
}

#layersPanel .panelActions {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--panel-border);
}
#layersPanel .panelActionBtn {
    /* Compact pill — just wide enough for its label.  Previously flex:1
       so it could share a row with the Copy-Link button; with only one
       action left it shouldn't span the whole panel. */
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    color: var(--panel-text);
    font: 500 11px/1 "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
#layersPanel .panelActionBtn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
#layersPanel .panelActionBtn.copied {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

#layersPanel .tree {
    overflow: auto;
    padding: 6px 10px 12px;
    /* Allow the tree to shrink inside the flex column when the panel hits
       its max-height cap; without this, default min-height:auto pins it to
       content-height and the panel's max-height has no effect. */
    min-height: 0;
}

#layersPanel details {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 2px 0;
}

#layersPanel details:last-child {
    border-bottom: none;
}

#layersPanel summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--panel-text);
    outline: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 8px;
    transition: background 120ms ease, color 120ms ease;
}

#layersPanel summary::-webkit-details-marker {
    display: none;
}

#layersPanel summary::before {
    content: "▸";
    font-size: 12px;
    color: var(--accent);
    transform: translateY(-1px);
    transition: transform 120ms ease;
}

#layersPanel details[open] > summary::before {
    transform: rotate(90deg);
}

#layersPanel summary:hover {
    background: rgba(72, 178, 255, 0.08);
    color: #ffffff;
}

#layersPanel .modelNode > summary {
    background: rgba(255, 255, 255, 0.04);
    font-size: 15px;
    letter-spacing: 0.3px;
}

/* Blue indicator dot — real DOM element, hidden by default, shown when
   the parent node has data-has-active="1". */
#layersPanel .activeDot {
    display: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4fc3f7;
    margin-left: 7px;
    vertical-align: middle;
    opacity: 0.9;
    cursor: pointer;
    /* Larger touch target without changing visual size */
    padding: 5px;
    background-clip: content-box;
    -webkit-background-clip: content-box;
}
#layersPanel [data-has-active="1"] > summary > .activeDot {
    display: inline-block;
}

#layersPanel .categoryNode {
    margin-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 8px;
}

#layersPanel .categoryNode > summary {
    font-size: 13px;
    color: var(--panel-muted);
}

#layersPanel .layerItem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 24px;
    font-size: 13px;
    color: var(--panel-muted);
    border-radius: 8px;
    transition: background 120ms ease, color 120ms ease;
}

#layersPanel .layerItem:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--panel-text);
}

#layersPanel .layerItem input {
    accent-color: var(--accent);
}

/* Density slider row beneath the Raster Values toggle */
#layersPanel .densityRow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 8px 24px;
    font-size: 12px;
    color: var(--panel-muted);
}

#layersPanel .densityRow input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    cursor: pointer;
}

/* ─── Saved Views ──────────────────────────────────────────────────────── */
.svContainer {
    padding: 4px 8px 8px;
}

.svSaveBtn {
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 4px;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 6px;
    background: transparent;
    color: var(--panel-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 150ms, border-color 150ms;
}
.svSaveBtn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.svRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 4px;
    border-radius: 5px;
    transition: background 120ms;
}
.svRow:hover {
    background: rgba(255,255,255,0.06);
}
.svRow.svDefault .svName {
    color: var(--accent);
}

.svName {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: none;
    background: transparent;
    color: var(--panel-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.svName:hover {
    color: var(--accent);
}

.svActions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.svActions button {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--panel-muted);
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.svActions button:hover {
    background: rgba(255,255,255,0.1);
    color: var(--panel-text);
}

/* ─── Entity hover tooltip ─────────────────────────────────────────────── */
.entityTooltip {
    position: absolute;
    display: none;
    padding: 6px 10px;
    border-radius: 5px;
    background: rgba(12,16,22,0.92);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e6edf3;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    pointer-events: none;
    z-index: 10;
    max-width: 320px;
    backdrop-filter: blur(4px);
}
.entityTooltip .ttTitle { font-weight: 700; font-size: 13px; }
.entityTooltip .ttSub   { opacity: 0.7; font-size: 11px; }
.entityTooltip .ttRow   { white-space: nowrap; }

/* ─── Hazards menu section ────────────────────────────────────────────── */
#layersPanel .hazardsCount {
    margin-left: 6px;
    font-size: 12px;
    color: var(--panel-muted);
    font-weight: 500;
}
#layersPanel .hazardsCount.hot {
    color: #ff6b35;
    font-weight: 700;
}
.hazardsBody {
    padding: 6px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Product toggle pills — one per Hazards overlay, with live count badge. */
.hazPills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.hazPill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 6px;
    font: 600 11px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.02em;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.02);
    color: var(--panel-muted);
    cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.hazPill:hover {
    color: var(--panel-text);
    border-color: rgba(255,255,255,0.25);
}
.hazPill.on {
    color: var(--panel-text);
    background: rgba(255,255,255,0.06);
}
.hazPillDot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.55;
}
.hazPill.on .hazPillDot { opacity: 1; }
.hazPillLabel { white-space: nowrap; }
.hazPillCount {
    font: 700 10px ui-monospace, "SF Mono", Menlo, monospace;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.10);
    color: var(--panel-text);
    min-width: 18px;
    text-align: center;
}
.hazPillCount.muted {
    background: rgba(255,255,255,0.04);
    color: var(--panel-muted);
    opacity: 0.55;
}
.hazFilters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.hazFilterChip {
    padding: 3px 8px;
    font: 600 11px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.04em;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent;
    color: var(--panel-muted);
    cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.hazFilterChip:hover {
    color: var(--panel-text);
    border-color: rgba(255,255,255,0.25);
}
.hazFilterChip.on {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.hazProbRow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--panel-muted);
}
.hazProbRow input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    cursor: pointer;
}
.hazSection {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hazSectionHead {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--panel-muted);
    opacity: 0.7;
    padding: 4px 0 2px;
}
.hazSectionHeadWarn,
.hazSectionHeadPS {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 1;
    flex-wrap: wrap;
}
.hazSectionTitle {
    opacity: 0.7;
}
.hazSectionFilters {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}
.hazSectionFilters .hazFilterChip {
    padding: 1px 6px;
    font: 600 9px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 999px;
}
.hazPsSort {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}
.hazPsSortChip {
    padding: 1px 6px;
    font: 600 9px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent;
    color: var(--panel-muted);
    cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.hazPsSortChip:hover {
    color: var(--panel-text);
    border-color: rgba(255,255,255,0.25);
}
.hazPsSortChip.on {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
/* Slim collapsible state group header — caret + state code + count + tier dot. */
button.hazSubHead {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 3px 4px;
    margin: 2px 0 0;
    border: 0;
    background: transparent;
    color: var(--panel-muted);
    font: 700 10px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
}
button.hazSubHead:hover { background: rgba(255,255,255,0.04); color: var(--panel-text); }
button.hazSubHead.open  { color: var(--panel-text); }
.hazSubHeadCaret { width: 9px; opacity: 0.7; font-size: 9px; }
.hazSubHeadDot   { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; }
.hazSection > .hazSubHead:first-of-type { margin-top: 0; }
.hazState {
    margin-left: 4px;
    padding: 1px 5px;
    font: 700 9px "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: 0.05em;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    color: var(--panel-muted);
}
.hazList {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
}
button.hazRow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 3px 6px 3px 8px;
    margin: 0;
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 3px solid #555;
    border-radius: 5px;
    background: rgba(255,255,255,0.02);
    color: var(--panel-text);
    cursor: pointer;
    font: 11px/1.3 "IBM Plex Sans", "Segoe UI", sans-serif;
    transition: background 120ms, border-color 120ms;
}
/* Warning rows are single-line — no chip row, no where line. */
button.hazRow.hazRowWarn { padding: 4px 6px 4px 8px; }
.hazRow:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.18);
}
.hazRowHead {
    display: flex;
    align-items: center;
    gap: 6px;
}
.hazTag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0a0a0a;
    padding: 1px 6px;
    border-radius: 3px;
}
.hazTitle {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hazExpiry {
    font-variant-numeric: tabular-nums;
    color: var(--panel-muted);
    font-size: 11px;
}
.hazChips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.hazChip {
    background: #2a2a2a;
    color: #e8e8e8;
    border: 1px solid #555;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}
.hazChipUrgent {
    background: #aa0000;
    color: #fff;
    border-color: #aa0000;
    font-weight: 700;
}
/* Inline condensed threat readout — sits in the row head, not its own row. */
.hazThreats {
    display: inline-flex;
    gap: 3px;
    flex-shrink: 0;
}
.hazThreat {
    padding: 0 4px;
    border-radius: 2px;
    font: 700 9px ui-monospace, "SF Mono", Menlo, monospace;
    letter-spacing: 0.02em;
    background: rgba(255,255,255,0.06);
    color: var(--panel-muted);
    white-space: nowrap;
    line-height: 1.5;
}
.hazThreatUrgent {
    background: #aa0000;
    color: #fff;
}
.hazPsGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
    margin-top: 2px;
}
.hazPsCell {
    display: grid;
    grid-template-columns: 30px 1fr 32px;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}
.hazPsLbl {
    color: var(--panel-muted);
}
.hazPsTrack {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
.hazPsFill {
    display: block;
    height: 100%;
    border-radius: 2px;
}
.hazPsVal {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.hazEmpty {
    font-size: 11px;
    color: var(--panel-muted);
    line-height: 1.5;
    padding: 8px 4px;
    opacity: 0.7;
}

/* Alert highlight on recently-fired ProbSevere rows */
button.hazRow.alerted {
    background: rgba(255, 60, 200, 0.12);
    border-color: rgba(255, 60, 200, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 60, 200, 0.35) inset, 0 0 12px rgba(255, 60, 200, 0.18);
    animation: hazAlertPulse 1.6s ease-out 0s 4;
}
@keyframes hazAlertPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255, 60, 200, 0.35) inset, 0 0 8px rgba(255, 60, 200, 0.18); }
    50%      { box-shadow: 0 0 0 1px rgba(255, 60, 200, 0.7) inset, 0 0 18px rgba(255, 60, 200, 0.45); }
}

/* ─── Alerts sub-section inside Hazards body ─────────────────────────── */
.alertsNode {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
}
.alertsSummary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: var(--panel-text);
    font-size: 12px;
    font-weight: 600;
}
.alertsSummary::-webkit-details-marker { display: none; }
.alertsSummary::before {
    content: "▸";
    font-size: 10px;
    color: var(--panel-muted);
    transition: transform 120ms;
}
details[open] > .alertsSummary::before { transform: rotate(90deg); }
.alertOnChip {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    color: var(--panel-muted);
}
.alertOnChip.on {
    background: var(--accent);
    color: #0a0a0a;
}
.alertsBody {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 10px;
}
.alertMasterBtn {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: transparent;
    color: var(--panel-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms, border-color 120ms, color 120ms;
}
.alertMasterBtn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.alertMasterBtn.on {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.alertNotifRow {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--panel-muted);
}
.alertSmallBtn {
    padding: 2px 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    background: transparent;
    color: var(--panel-muted);
    font-size: 11px;
    cursor: pointer;
}
.alertSmallBtn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.alertNotifHelp {
    flex: 1 0 100%;
    font-size: 10.5px;
    color: var(--panel-muted);
    line-height: 1.4;
    padding: 4px 0 0;
    opacity: 0.85;
}
.alertSection {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.alertSectionHead {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--panel-muted);
    opacity: 0.7;
    padding-top: 4px;
}
.alertPresetChips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.alertPresetChip {
    padding: 4px 9px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    background: transparent;
    color: var(--panel-text);
    font-size: 11px;
    cursor: pointer;
    transition: background 120ms, border-color 120ms, color 120ms;
}
.alertPresetChip:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.alertEditorPresetHead { padding-top: 0; }
.alertRuleList {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.alertRuleRow {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    font-size: 11.5px;
}
.alertRuleLbl {
    font-weight: 600;
    color: var(--panel-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alertRuleDet {
    color: var(--panel-muted);
    font-variant-numeric: tabular-nums;
    font-size: 10.5px;
    white-space: nowrap;
}
.alertRuleDel {
    background: none;
    border: none;
    color: var(--panel-muted);
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.alertRuleDel:hover { color: #ff6b6b; }
.alertRuleEmpty {
    font-size: 11px;
    color: var(--panel-muted);
    opacity: 0.7;
    padding: 4px 0;
}
.alertAddBtn {
    width: 100%;
    padding: 5px;
    margin-top: 4px;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 5px;
    background: transparent;
    color: var(--panel-muted);
    font-size: 11.5px;
    cursor: pointer;
    transition: color 120ms, border-color 120ms;
}
.alertAddBtn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.alertEditor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    margin-top: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    min-width: 0;
    overflow: hidden;
}
.alertField {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    color: var(--panel-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 0;
}
.alertEditorInput {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    background: rgba(0,0,0,0.25);
    color: var(--panel-text);
    font: 11.5px "IBM Plex Sans", "Segoe UI", sans-serif;
    min-width: 0;
}
.alertSliderRow {
    display: grid;
    grid-template-columns: 14px 36px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    min-width: 0;
}
.alertSliderRow input[type="range"] {
    accent-color: var(--accent);
    height: 4px;
    width: 100%;
    min-width: 0;
}
.alertSliderRow input[type="checkbox"] {
    accent-color: var(--accent);
    margin: 0;
}
.alertSliderLbl { color: var(--panel-text); }
.alertSliderVal {
    text-align: right;
    color: var(--panel-muted);
    font-variant-numeric: tabular-nums;
    font-size: 10.5px;
}
.alertBtnRow {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.alertSaveBtn, .alertCancelBtn {
    flex: 1;
    padding: 5px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: var(--panel-text);
}
.alertSaveBtn {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.alertSaveBtn:hover { background: var(--accent); color: #0a0a0a; }
.alertCancelBtn:hover { color: var(--panel-text); border-color: rgba(255,255,255,0.3); }

/* Section divider inside the Map Overlays accordion (e.g. "Labels" sub-heading) */
#layersPanel .overlayGroupHeader {
    padding: 8px 10px 4px 24px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--panel-muted);
    opacity: 0.65;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
}

#timelinePanel {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* JS ResizeObserver overrides this dynamically */
    display: grid;
    grid-template-columns: auto auto auto auto auto 1fr auto auto auto;
    /* prev | play | lookback | next | run-select | scrubber | label | live | rec */
    gap: 8px 10px;
    align-items: center;
    padding: 8px 10px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    color: var(--panel-text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    z-index: 3;
    backdrop-filter: blur(6px);
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Transport icon buttons — shared base */
#timelinePanel .tlBtn {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--panel-border);
    color: var(--panel-text);
    border-radius: 7px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: background 120ms, color 120ms;
    font-family: inherit;
}
#timelinePanel .tlBtn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Play/pause button */
#timelinePanel .tlBtn.play {
    background: var(--accent);
    border-color: transparent;
    color: #04121f;
    font-size: 14px;
}
#timelinePanel .tlBtn.play::before {
    content: "\25B6\FE0E"; /* ▶ text variant */
}
#timelinePanel .tlBtn.play.active::before {
    content: "\23F8\FE0E"; /* ⏸ text variant */
}
#timelinePanel .tlBtn.play.loading::before {
    content: "\2022\2022\2022"; /* ··· */
    font-size: 10px;
    letter-spacing: 3px;
}
#timelinePanel .tlBtn.play.buffering::before {
    content: "\25B6\FE0E"; /* ▶ text variant — same as idle but pulses */
}
#timelinePanel .tlBtn.play.buffering {
    background: #48b2ff;
    animation: btnPulse 0.8s ease-in-out infinite;
}
@keyframes btnPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
#timelinePanel .tlBtn.play:hover {
    background: #72c8ff;
}
#timelinePanel .tlBtn.play.active {
    background: #22d69f;
    color: #052016;
}

/* Live jump button */
#timelineLive {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0 8px;
    width: auto;
    min-width: 38px;
    white-space: nowrap;
}
#timelineLive.at-live {
    min-width: 54px;
    background: #22d69f;
    border-color: transparent;
    color: #052016;
    box-shadow: 0 0 8px rgba(34, 214, 159, 0.4);
}
#timelineLive.at-live::before {
    content: "\25CF\00A0"; /* ● non-breaking-space */
    font-size: 7px;
    vertical-align: middle;
}

#timelineScrubber {
    grid-column: 6;
    width: 100%;
    --track-fill-pct: 0%;
    /* Reset browser defaults so we can style the track uniformly. */
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Track — WebKit / Blink */
#timelineScrubber::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right,
        rgba(72, 178, 255, 0.7) var(--track-fill-pct),
        rgba(255, 255, 255, 0.18) var(--track-fill-pct));
    transition: background 80ms linear;
}

/* Track — Firefox */
#timelineScrubber::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right,
        rgba(72, 178, 255, 0.7) var(--track-fill-pct),
        rgba(255, 255, 255, 0.18) var(--track-fill-pct));
    transition: background 80ms linear;
}

/* Thumb — WebKit / Blink */
#timelineScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #48b2ff;
    border: 2px solid rgba(0, 0, 0, 0.45);
    margin-top: -5px;
    cursor: pointer;
    transition: transform 100ms ease;
}
#timelineScrubber::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* Thumb — Firefox */
#timelineScrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.45);
    background: #48b2ff;
    cursor: pointer;
}

#timelineRun {
    background: rgba(255, 255, 255, 0.06);
    color: var(--panel-text);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    min-width: 170px;
}
#playLookback {
    background: rgba(255, 255, 255, 0.06);
    color: var(--panel-text);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 11px;
    min-width: 0;
    width: auto;
}

#timelineLabel {
    grid-column: 7;
    font-size: 12px;
    color: var(--panel-muted);
    justify-self: end;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 34vw;
}

#cesiumCredits {
    display: none;
}

#paletteLegend {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(12,16,22,0.9);
    color: #e6edf3;
    z-index: 3;
    display: none;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

/* ─── Product bar (below gradient) ───────────────────────────────────────── */
#paletteLegend .activeProducts {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 2px 2px;
    flex-wrap: wrap;
}
.productBarSide {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.productBarRight { justify-content: flex-end; }
.productBarVs {
    align-self: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--panel-muted);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    padding: 0 2px;
}
.productGroup {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.productGroupLabel {
    font-size: 9px;
    font-weight: 800;
    color: var(--panel-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}
#paletteLegend .activeProduct {
    display: inline-flex;
    align-items: stretch;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.05);
    color: #d9e6ef;
    overflow: hidden;
}
#paletteLegend .activeProduct.isCurrent {
    border-color: rgba(72, 178, 255, 0.55);
    background: rgba(72, 178, 255, 0.14);
    color: #f1f8ff;
}
#paletteLegend .activeProduct.splitRight {
    border-color: rgba(34, 214, 159, 0.45);
    background: rgba(34, 214, 159, 0.1);
    color: #d0f5e8;
}
#paletteLegend .activeProductSelect {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    text-align: left;
    line-height: 1.2;
    white-space: nowrap;
}
#paletteLegend .activeProductSelect:hover { color: #ffffff; }
#paletteLegend .activeProductRemove,
#paletteLegend .compareBtn {
    border: none;
    border-left: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: var(--panel-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    font-size: 13px;
    opacity: 1;
    flex-shrink: 0;
    transition: color 120ms, background 120ms;
}
#paletteLegend .activeProductRemove:hover { color: #ff7b7b; background: rgba(255,100,100,0.12); }
#paletteLegend .compareBtn:hover { opacity: 1; color: var(--accent); }

/* RT overlay pills — amber tint to distinguish from data layers */
#paletteLegend .rtPill {
    border-color: rgba(255, 191, 64, 0.35);
    background: rgba(255, 191, 64, 0.10);
    color: #ffe0a6;
}
#paletteLegend .rtGroup {
    margin-left: auto;
}

#paletteLegend .paletteTitle {
    font-size: 11px;
    color: #b6c6d3;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#paletteLegend .paletteGradient {
    height: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.16);
    overflow: hidden;
    margin-bottom: 3px;
}

#paletteLegend .paletteSteps {
    position: relative;
    height: 18px;
}

#paletteLegend .stepTick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    background: rgba(255,255,255,0.5);
}

#paletteLegend .stepLabel {
    position: absolute;
    top: 7px;
    transform: translateX(-50%);
    font-size: 9px;
    color: #d6e2ea;
    white-space: nowrap;
}

#appShell.timeline-hidden #paletteLegend {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* ─── Record button (lives in the timeline as a .tlBtn) ──────────────────── */
.recDot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e05555;
    box-shadow: 0 0 0 2px rgba(224,85,85,0.25);
    transition: background 180ms, box-shadow 180ms;
}
#timelinePanel #recBtn:hover .recDot {
    background: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255,107,107,0.3);
}
#timelinePanel #recBtn.recording .recDot {
    background: #ff4d4d;
    animation: recDotPulse 1.2s ease-in-out infinite;
}
@keyframes recDotPulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(255,77,77,0.0); }
    50%       { box-shadow: 0 0 0 6px rgba(255,77,77,0.4); }
}
#timelinePanel #recBtn.recording {
    border-color: rgba(255, 77, 77, 0.45);
}

/* ─── Right-edge tool rail ──────────────────────────────────────────────────
   Vertical stack of map controls down the right side, sitting BELOW the
   hamburger (which lives solo in the corner as the layers-panel toggle).
   The rail is anchored to the same right edge so the column reads as a
   single set of related tools, not a satellite of the hamburger.
   When the layers panel is open the rail slides off-screen right — the
   hamburger handles closing the panel, and the panel itself is the
   active workspace, so the rail is redundant in that state.
*/
#sceneModeBtn,
#windBarbBtn,
#radar3dBtn {
    position: absolute;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-text);
    font-weight: 700;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    cursor: pointer;
    z-index: 5;
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 180ms ease, transform 180ms ease,
                color 180ms, border-color 180ms, background 180ms;
}
#windBarbBtn   { top: 68px;  font-size: 14px; } /* hamburger(24) + 36 + 8 */
#sceneModeBtn  { top: 112px; font-size: 12px; } /* windBarbBtn(68) + 36 + 8 */
#radar3dBtn    { top: 156px; font-size: 10px; } /* sceneModeBtn(112) + 36 + 8 */
#radar3dBtn.hidden { display: none; }

#sceneModeBtn:hover  { border-color: var(--accent); color: var(--accent); }
#windBarbBtn:hover   { border-color: var(--accent); color: var(--accent); }
#radar3dBtn:hover    { border-color: var(--accent); color: var(--accent); }
#windBarbBtn.active,
#radar3dBtn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Slide rail off-screen right when the layers panel is open so the rail
   tools never float over the panel content. */
#appShell:not(.layers-collapsed) #sceneModeBtn,
#appShell:not(.layers-collapsed) #windBarbBtn,
#appShell:not(.layers-collapsed) #radar3dBtn,
#appShell:not(.layers-collapsed) #radar3dControls {
    opacity: 0;
    pointer-events: none;
    transform: translateX(60px);
}

/* Threshold flyout for the 3D radar volume — appears to the left of the
   RVOL button only while RVOL is active.  Three small numeric inputs let
   power users retune the marching-cubes isosurface levels (e.g. 30/45/55
   for tornadic supercells, 10/20/30 for stratiform). */
#radar3dControls {
    position: absolute;
    top: 158px;          /* aligned with #radar3dBtn (top:156, h:36) */
    right: 68px;         /* radar3dBtn(24) + 36 + 8 */
    display: none;
    gap: 4px;
    align-items: center;
    z-index: 3;
    transition: opacity 180ms ease, transform 180ms ease;
}
#radar3dControls.visible { display: flex; }
/* Auto-faded after a few seconds of no interaction, restored on hover of the
   RVOL button or the controls themselves.  Keeps the chrome out of the way
   for screenshots without losing the controls outright. */
#radar3dControls.idle {
    opacity: 0;
    transform: translateX(12px);
    pointer-events: none;
}
#radar3dControls .r3dLabel {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--panel-muted);
    padding: 0 4px 0 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}
#radar3dControls .r3dThresh {
    width: 44px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-text);
    font-size: 12px;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(6px);
    padding: 0 4px;
    -moz-appearance: textfield;
}
#radar3dControls .r3dThresh::-webkit-outer-spin-button,
#radar3dControls .r3dThresh::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#radar3dControls .r3dThresh:focus {
    outline: none;
    border-color: var(--accent);
    color: var(--accent);
}

#windBarbControls {
    position: absolute;
    /* Anchored to the rail's wind button — appears as a flyout to its left
       so the level + style pickers feel attached to the button that owns
       them, not floating in random screen space. */
    top: 70px;            /* vertically centred against windBarbBtn (top:68, h:36) */
    right: 68px;          /* windBarbBtn(24) + 36 + 8 */
    display: none;
    gap: 4px;
    align-items: center;
    z-index: 3; /* below layersPanel (z:4) */
    transition: opacity 180ms ease, transform 180ms ease;
}
#windBarbControls.visible { display: flex; }
/* Hide the wind controls when the layers panel is open — they belong to
   the rail's wind button and the rail itself slides off-screen in that
   state.  Without this they'd float disconnected over the map. */
#appShell:not(.layers-collapsed) #windBarbControls {
    opacity: 0;
    pointer-events: none;
    transform: translateX(60px);
}

#windBarbControls select,
#windBarbControls .wbStyleBtn {
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-text);
    font-size: 12px;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    backdrop-filter: blur(6px);
    padding: 0 8px;
    cursor: pointer;
}
#windBarbControls .wbStyleBtn {
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 120ms, color 120ms;
}
#windBarbControls .wbStyleBtn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ─── Record dialog (opens above the timeline near the rec button) ───────── */
#recDialog {
    position: absolute;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    right: 24px;
    width: 220px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 14px 16px 16px;
    color: var(--panel-text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 13px;
    z-index: 6;
    backdrop-filter: blur(6px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    display: none;
}
#recDialog.open {
    display: block;
    animation: recDialogIn 120ms ease forwards;
}
@keyframes recDialogIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.recDialogTitle {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--panel-muted);
    margin-bottom: 10px;
}
.recModeRow {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--panel-text);
    cursor: pointer;
    line-height: 1.3;
}
.recModeRow input[type="checkbox"] {
    margin-top: 1px;
    accent-color: var(--accent);
}
#recTimedOptions.hidden {
    display: none;
}
.recPresets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.recPresets button {
    flex: 1;
    min-width: 38px;
    padding: 5px 4px;
    border-radius: 7px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--panel-text);
    font-size: 12px;
    cursor: pointer;
    transition: background 100ms;
}
.recPresets button:hover { background: rgba(255, 255, 255, 0.12); }
.recPresets button.active {
    border-color: var(--accent);
    color: var(--accent);
}
.recCustomRow {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--panel-muted);
}
#recDurInput {
    flex: 1;
    width: 0;
    min-width: 0;
    padding: 5px 7px;
    border-radius: 7px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.07);
    color: var(--panel-text);
    font-size: 13px;
}
#recStartBtn {
    width: 100%;
    padding: 8px 0;
    border-radius: 9px;
    border: none;
    background: #b71c1c;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 120ms;
}
#recStartBtn:hover { background: #e53935; }

/* ─── Frame-load progress bar (replaces scrubber-track loading hack) ─────── */
#timelineLoadBar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 150ms;
}
#timelineLoadBar.active { opacity: 1; }
#timelineLoadBar::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--load-pct, 0%);
    background: var(--accent);
    transition: width 80ms linear;
}

/* ─── Recording active — hide all UI except the globe ───────────────────── */
#appShell.rec-active #layersPanel,
#appShell.rec-active #layersToggle,
#appShell.rec-active #recDialog,
#appShell.rec-active #paletteLegend,
#appShell.rec-active #cesiumCredits,
#appShell.rec-active #lutDebugPanel,
#appShell.rec-active .valueProbePopup,
#appShell.rec-active #splitDivider,
#appShell.rec-active .splitLabel,
#appShell.rec-active #splitCloseBtn,
#appShell.rec-active #splitProductPicker,
#appShell.rec-active #splitRunPicker {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
}

@media (max-width: 900px) {
    #layersPanel {
        width: 240px;
        right: 16px;
        top: 66px; /* 16px margin + 42px button row + 8px gap */
        max-height: calc(100% - 90px);
        font-size: 12px;
    }

    #layersPanel .panelHeader {
        font-size: 13px;
        padding: 10px 14px;
    }

    #layersPanel summary {
        font-size: 12px;
        padding: 6px 8px;
    }

    #layersPanel .modelNode > summary {
        font-size: 12px;
    }

    #layersPanel .categoryNode > summary {
        font-size: 11px;
    }

    #layersPanel .layerItem {
        font-size: 11px;
        padding: 5px 8px 5px 18px;
    }

    #layersPanel .densityRow {
        font-size: 11px;
        padding: 3px 8px 6px 18px;
    }

    #layersToggle {
        top: 16px;
        right: 16px;
    }

    #windBarbBtn {
        top: 60px; /* layersToggle(16 + 36 + 8) */
        right: 16px;
    }

    #sceneModeBtn {
        top: 104px; /* windBarbBtn(60) + 36 + 8 */
        right: 16px;
    }

    #radar3dBtn {
        top: 148px; /* sceneModeBtn(104) + 36 + 8 */
        right: 16px;
    }

    #radar3dControls {
        top: 150px;
        right: 60px; /* radar3dBtn(16) + 36 + 8 */
    }

    #windBarbControls {
        top: 60px;
        right: 60px; /* windBarbBtn(16) + 36 + 8 */
    }

    #recDialog {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        right: 16px;
    }

    #timelinePanel {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        /* Row 1: [⏮][▶][⏭][run-select flex][label][LIVE][REC]
           Row 2: [――――——scrubber full width————――]           */
        grid-template-columns: auto auto auto 1fr auto auto auto;
        grid-template-rows: auto auto;
        gap: 5px 8px;
        padding: 6px 8px 7px;
    }
    #playLookback { display: none !important; }

    #timelinePanel .tlBtn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    #timelinePanel .tlBtn.play {
        font-size: 13px;
    }

    #timelineRun {
        grid-column: 4;
        grid-row: 1;
        min-width: 0;
        width: 100%;
        padding: 5px 6px;
        font-size: 11px;
    }

    #timelineLabel {
        grid-column: 5;
        grid-row: 1;
        justify-self: end;
        max-width: 110px;
        font-size: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #timelineLive {
        grid-column: 6;
        grid-row: 1;
        font-size: 10px;
        min-width: 32px;
        padding: 0 5px;
        white-space: nowrap;
    }
    #timelineLive.at-live {
        min-width: 48px;
    }

    #timelineScrubber {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    #paletteLegend {
        left: 8px;
        right: 8px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding: 3px 7px 4px;
    }

    #paletteLegend .activeProducts {
        gap: 6px;
        padding: 5px 2px 2px;
    }

    #paletteLegend .activeProductSelect {
        font-size: 13px;
        padding: 7px 12px;
    }

    #paletteLegend .activeProductRemove,
    #paletteLegend .compareBtn {
        width: 40px;
        font-size: 15px;
    }

    .productGroupLabel {
        font-size: 10px;
    }

    #paletteLegend .paletteGradient {
        height: 8px;
    }

    #paletteLegend .paletteTicks {
        height: 13px;
    }

    #paletteLegend .paletteTickLabel {
        font-size: 8px;
    }

    #paletteLegend .paletteEndLabel {
        font-size: 8px;
    }

    #paletteRangeRow {
        font-size: 9px;
        margin-top: 2px;
    }
}

/* ─── Tablet (touch) compaction ─────────────────────────────────────────────
   iPad Pro / iPad Air landscape sit between the phone (≤900) and desktop
   tiers — wide enough that the timeline can stay single-row, but vertical
   real estate is precious (1024 px on 12.9").  Trim the bottom HUD chrome
   without shrinking transport buttons below 32 px (Apple HIG floor).        */
@media (min-width: 901px) and (max-width: 1400px) and (pointer: coarse) {
    #paletteLegend {
        padding: 3px 8px 4px;
    }
    #paletteLegend .activeProducts {
        gap: 6px;
        padding: 4px 2px 2px;
    }
    #paletteLegend .activeProductSelect {
        font-size: 11px;
        padding: 4px 8px;
    }
    #paletteLegend .activeProductRemove,
    #paletteLegend .compareBtn {
        width: 28px;
        font-size: 12px;
    }
    .productGroupLabel {
        font-size: 8px;
    }
    #paletteLegend .paletteTitle {
        font-size: 10px;
        margin-bottom: 2px;
    }
    #paletteLegend .paletteGradient {
        height: 8px;
        margin-bottom: 2px;
    }
    #paletteLegend .paletteSteps {
        height: 14px;
    }
    #paletteLegend .stepTick {
        height: 5px;
    }
    #paletteLegend .stepLabel {
        top: 6px;
        font-size: 8px;
    }

    #timelinePanel {
        padding: 6px 10px;
        gap: 6px 10px;
    }
    #timelineLabel {
        font-size: 11px;
    }
    #timelineRun {
        padding: 5px 7px;
        font-size: 11px;
        min-width: 150px;
    }
}

/* ─── Split-view divider */
#splitDivider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
    cursor: col-resize;
    z-index: 6;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(72, 178, 255, 0.4);
    display: none;
}
#splitDivider.active {
    display: block;
}
#splitDivider::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--panel-bg);
    border: 2px solid var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
#splitDivider::before {
    content: "⇔";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    color: var(--accent);
    font-size: 14px;
    pointer-events: none;
}

/* Split-view floating side labels */
.splitLabel {
    position: absolute;
    top: 76px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--panel-text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 12px;
    line-height: 1.4;
    z-index: 5;
    backdrop-filter: blur(6px);
    max-width: 42vw;
    display: none;
    pointer-events: none;
}
.splitLabel.active {
    display: block;
}
.splitLabel.left {
    left: 14px;
    border-left: 3px solid var(--accent);
}
.splitLabel.right {
    right: 360px;
    border-right: 3px solid #22d69f;
    text-align: right;
    pointer-events: auto;
    cursor: pointer;
}
.splitLabel .splitLabelTitle {
    display: block;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.splitLabel .splitLabelDetail {
    display: block;
    font-size: 10px;
    color: var(--panel-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Run picker dropdown for compare side */
#splitRunPicker {
    position: absolute;
    top: 130px;
    right: 360px;
    z-index: 10;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 160px;
    max-height: 240px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    display: none;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}
#splitRunPicker.active { display: block; }
#splitRunPicker .runPickerTitle {
    padding: 4px 12px 6px;
    font-size: 10px;
    color: var(--panel-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 4px;
}
#splitRunPicker .runPickerOption {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--panel-text);
    cursor: pointer;
    white-space: nowrap;
}
#splitRunPicker .runPickerOption:hover {
    background: rgba(255,255,255,0.06);
}
#splitRunPicker .runPickerOption.selected {
    color: #22d69f;
    font-weight: 600;
}


#splitCloseBtn {
    position: absolute;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-text);
    font-size: 14px;
    cursor: pointer;
    z-index: 7;
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
}
#splitCloseBtn.active {
    display: flex;
}
#splitCloseBtn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Split-view product picker dropdown */
#splitProductPicker {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-height: 50vh;
    overflow-y: auto;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 12px;
    color: var(--panel-text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 13px;
    z-index: 8;
    backdrop-filter: blur(6px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    display: none;
}
#splitProductPicker.active {
    display: block;
    animation: recDialogIn 120ms ease forwards;
}

#splitProductPicker .pickerTitle {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--panel-muted);
    margin-bottom: 10px;
}

#splitProductPicker .pickerTabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

#splitProductPicker .pickerTab {
    flex: 1;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.06);
    color: var(--panel-text);
    font-size: 11px;
    cursor: pointer;
    text-align: center;
    transition: background 100ms;
}
#splitProductPicker .pickerTab:hover {
    background: rgba(255,255,255,0.12);
}
#splitProductPicker .pickerTab.active {
    border-color: var(--accent);
    color: var(--accent);
}

#splitProductPicker .pickerOption {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 120ms, color 120ms;
    color: var(--panel-muted);
}
#splitProductPicker .pickerOption:hover {
    background: rgba(72, 178, 255, 0.08);
    color: #fff;
}

/* ─── Collapse tabs (timeline & legend) ───────────────────────────────────── */
.collapseTab {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    min-width: 48px;
    height: 20px;
    padding: 0 10px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--panel-muted);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    backdrop-filter: blur(6px);
    transition: background 120ms, color 120ms;
}
.collapseTab:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
/* Tab on top of the timeline panel */
.collapseTab.top {
    top: -19px;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}
/* Tab on bottom of the legend panel (sticks down from the legend) */
.collapseTab.bottom {
    bottom: -19px;
    border-radius: 0 0 8px 8px;
    border-top: none;
}

/* ─── Collapsed states ────────────────────────────────────────────────────── */
#timelinePanel.collapsed > *:not(.collapseTab) {
    display: none !important;
}
#timelinePanel.collapsed {
    padding: 0;
    border: none;
    background: none;
    backdrop-filter: none;
    grid-template-columns: 1fr;
    z-index: 5;
    gap: 0;
    min-height: 0;
}
#timelinePanel.collapsed .collapseTab.top {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 auto;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    height: 26px;
    font-size: 11px;
    color: var(--panel-text);
    z-index: 5;
}

#paletteLegend.collapsed > *:not(.collapseTab):not(.activeProducts) {
    display: none !important;
}
#paletteLegend.collapsed {
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(12,16,22,0.9);
    border-radius: 10px;
    min-height: 0 !important;
}
#paletteLegend.collapsed .activeProducts {
    display: flex !important;
    padding-top: 0;
}
#paletteLegend.collapsed .paletteTitle {
    display: none !important;
}
#paletteLegend.collapsed .collapseTab.top {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 0 auto;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    height: 26px;
    font-size: 11px;
    color: var(--panel-text);
}

@media (max-width: 900px) {
    .splitLabel {
        top: 56px;
        font-size: 11px;
        padding: 5px 8px;
        max-width: 38vw;
    }
    .splitLabel.left {
        left: 8px;
    }
    .splitLabel.right {
        right: 66px;
    }
    .splitLabel .splitLabelTitle {
        font-size: 12px;
    }
    .splitLabel .splitLabelDetail {
        font-size: 9px;
    }
    #splitRunPicker {
        top: 105px;
        right: 66px;
        max-width: 200px;
    }
    #splitRunPicker .runPickerOption {
        padding: 8px 12px;
        min-height: 32px;
    }
    #splitCloseBtn {
        top: 66px;
    }
    #splitProductPicker {
        top: 102px;
        width: calc(100vw - 32px);
        max-width: 320px;
        max-height: 45vh;
    }
    #splitProductPicker .pickerTitle {
        font-size: 12px;
    }
    #splitProductPicker .pickerTab {
        font-size: 12px;
        padding: 8px 8px;
    }
    #splitProductPicker .pickerOption {
        padding: 10px 10px;
        font-size: 13px;
        min-height: 36px;
    }
    #splitDivider::after {
        width: 36px;
        height: 36px;
    }
    #splitDivider::before {
        font-size: 16px;
    }
    .collapseTab {
        min-width: 40px;
        height: 18px;
        font-size: 10px;
    }
}
