:root{--bg:#eef2f6;--panel:#fff;--panel-2:#f5f8fa;--ink:#132e42;--muted:#5a7183;--line:#cbd7df;--header:#0f2436;--header-ink:#eef4f9;--header-muted:#a9c1d3;--accent:#1c6fb8;--accent-soft:#e2eef8;--focus:#1687be;--map-bg:#dbe6ee;color-scheme:light}
@media(prefers-color-scheme:dark){:root{--bg:#0d151d;--panel:#131f2a;--panel-2:#0f1a24;--ink:#e6eef5;--muted:#93a9ba;--line:#2a3b49;--header:#0a1620;--header-ink:#e6eef5;--header-muted:#8ba4b6;--accent:#4aa3e0;--accent-soft:#16344a;--focus:#5ab0e6;--map-bg:#0a1219;color-scheme:dark}}
*{box-sizing:border-box}
html,body{margin:0;max-width:100%}
body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--ink)}
button,select,input{font:inherit;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:8px 10px}
button{cursor:pointer}
button:disabled{opacity:.45;cursor:default}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.topbar{display:flex;align-items:center;gap:18px;min-height:52px;padding:6px 16px;background:var(--header);color:var(--header-ink)}
.brand{display:flex;flex-direction:column;line-height:1.15}
.wordmark{font-size:16px;font-weight:700;letter-spacing:.02em}
.subtitle{font-size:11px;color:var(--header-muted)}
.runbar{display:flex;align-items:center;gap:10px}
.pill{background:var(--accent);color:#fff;font-size:12px;font-weight:700;letter-spacing:.04em;padding:4px 10px;border-radius:999px;text-transform:uppercase}
.topbar .field{color:var(--header-muted)}
.topbar .field select{background:rgba(255,255,255,.1);color:var(--header-ink);border-color:rgba(255,255,255,.28);min-width:230px;padding:5px 8px}
/* The open menu is drawn by the browser on its own (light) surface: give the options the panel colours instead of the
   header's near-white ink, which was unreadable on white. */
.topbar .field select option{background:var(--panel);color:var(--ink)}
.topmeta{margin-left:auto;display:flex;align-items:center;gap:12px;font-size:12px;color:var(--header-muted)}
.badge{border:1px solid currentColor;border-radius:999px;padding:3px 8px;font-size:11px}
.topmeta a{color:var(--header-ink);text-decoration:none;border-bottom:1px dotted}
.controls{display:flex;gap:14px;align-items:flex-end;padding:10px 16px;background:var(--panel);border-bottom:1px solid var(--line)}
.field{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:600;color:var(--muted)}
.field select{color:var(--ink);background:var(--panel-2);font-weight:500;min-width:150px}
.field.compact{font-size:11px}
.field.compact select{min-width:auto;padding:6px 8px}
.check{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
.check input{margin:0}
.layout{display:grid;grid-template-columns:240px minmax(0,1fr);align-items:stretch}
.sidebar{background:var(--panel-2);border-right:1px solid var(--line);padding:16px 14px 28px}
.side-heading{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);margin:0 0 8px}
.side-heading:not(:first-child){margin-top:16px}
.group-heading{font-size:11px;font-weight:700;color:var(--muted);margin:10px 0 5px}
.chip-column{display:flex;flex-direction:column;gap:6px}
.chip{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;text-align:left;padding:8px 10px}
.chip-name{font-size:13px;font-weight:600}
.chip-legend{font-size:11px;color:var(--muted)}
.chip.active{border-color:var(--accent);background:var(--accent-soft)}
.chip-region{align-items:center;font-size:13px;font-weight:600;padding:7px 10px}
.viewer{max-width:1600px;padding:14px 20px 30px}
.times{min-height:20px;margin:2px 0 12px;font-size:14px;font-weight:600}
.map{margin:0;background:var(--panel);border:1px solid var(--line);border-radius:10px;overflow:hidden;min-height:200px;display:flex;flex-direction:column;justify-content:center}
.map img{display:block;width:100%;height:auto;aspect-ratio:16/10;object-fit:contain;background:var(--map-bg)}
/* A hidden (unavailable) frame keeps its box, so the controls below never move while scrubbing. */
.map img[hidden]{display:block;visibility:hidden}
.map figcaption{padding:12px 16px;color:var(--muted);font-size:13px}
.playback{display:flex;gap:12px;align-items:stretch;margin:14px 0 6px}
.transport{display:flex;flex:none;align-items:center;gap:6px}
.transport button{min-width:38px;padding:8px 10px}
#play{min-width:66px}
.strip{display:flex;flex:1 1 auto;gap:6px;overflow-x:auto;padding:2px;scrollbar-width:thin}
.lead-chip{display:flex;flex:none;flex-direction:column;align-items:center;gap:1px;min-width:52px;padding:6px 8px}
.lead-label{font-size:12px;font-weight:600}
.lead-valid{font-size:10px;color:var(--muted)}
.lead-chip.current{border-color:var(--accent);background:var(--accent-soft);box-shadow:inset 0 -2px 0 var(--accent)}
.lead-chip.unavailable{opacity:.5}
.attribution{color:var(--muted);font-size:12px;line-height:1.6}
header:not(.topbar){display:flex;align-items:center;justify-content:space-between;padding:18px 22px;background:var(--header);color:var(--header-ink)}
header:not(.topbar) h1{margin:0;font-size:22px}
header:not(.topbar) a{color:var(--header-ink)}
.admin-controls{display:grid;gap:14px;max-width:700px;padding:18px}
pre{white-space:pre-wrap;word-break:break-word;background:var(--panel);padding:18px;border-radius:8px}
@media(max-width:999px){
 .topbar{flex-wrap:wrap;min-height:52px;gap:10px 14px}
 .topbar .field select{min-width:0;max-width:100%}
 .topmeta{font-size:11px}
 .controls{flex-wrap:wrap;gap:8px 10px}
 .field{flex:1 1 30%}
 .field select{min-width:0;width:100%}
 .layout{display:block}
 .sidebar{display:flex;flex-direction:row;align-items:center;gap:8px;overflow-x:auto;border-right:0;border-bottom:1px solid var(--line);padding:8px 12px}
 .side-heading,.group-heading{display:none}
 .chip-column{flex-direction:row;gap:8px}
 .chip{width:auto;white-space:nowrap}
 .chip-legend{display:none}
 .viewer{padding:12px}
 .playback{flex-wrap:wrap}
 .strip{order:2;width:100%}
}

/* Keep the forecast-hour strip on screen: the map shrinks (letterboxed) to the viewport height on desktop. */
@media (min-width:1000px){.map img{max-height:calc(100vh - 330px);min-height:320px}}

/* Hour slider: scrub through forecast hours (snaps to available leads). */
.scrub{display:flex;align-items:center;gap:12px;margin:2px 0 8px}
.scrub input[type=range]{flex:1;min-width:0;accent-color:var(--accent,#1d6fd6);height:28px;cursor:pointer}
.scrub output{min-width:118px;font-variant-numeric:tabular-nums;font-size:13px;color:var(--muted);text-align:right}
.preload-status{font-size:11px;color:var(--muted);white-space:nowrap}
.preload-status[hidden]{display:none}

/* The slider gets its own full-width row above the transport + hour strip. */
.playback{flex-wrap:wrap}
.scrub{flex:1 1 100%;order:-1;margin:0 0 4px}
