/* RRFS+HRRR Winter Weather Blender Tool: a light, quiet interface with dark mode. One toolbar of dropdowns over a full-width map; extra controls open as dropdown panels. */
:root {
  --bg: #eef1f5; --surface: #ffffff; --surface-2: #f5f7fa; --border: #d3d9e2; --border-strong: #b9c2cf;
  --text: #1a2230; --muted: #5d6b7d; --accent: #2563d6; --accent-soft: #e3ecfc; --accent-text: #fff;
  --bar: #1c2840; --bar-text: #fff; --map-bg: #cdd5da; --shadow: rgba(16, 24, 40, .22); --legend-bg: rgba(255, 255, 255, .95);
  --tip-bg: rgba(20, 27, 40, .94); --tip-text: #f3f6fa; --halo: #fff; --warn: #b04a00;
  --ctl-hot: #f0f4fa; --chrome: var(--surface); --chrome-2: var(--surface-2);
  --hz1: #c99a00; --hz2: #e07800; --hz3: #d02a1c; --hz4: #9c1478;
  --hz1-bg: rgba(201, 154, 0, .15); --hz2-bg: rgba(224, 120, 0, .14); --hz3-bg: rgba(208, 42, 28, .12); --hz4-bg: rgba(156, 20, 120, .13);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235d6b7d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.dark {
  --bg: #0e1319; --surface: #1a212b; --surface-2: #222b37; --border: #2f3947; --border-strong: #46546a;
  --text: #e8edf4; --muted: #9aa6b6; --accent: #6ea3ff; --accent-soft: #24344f; --accent-text: #0c1320;
  --bar: #121a29; --bar-text: #f1f5fa; --map-bg: #1b1f23; --shadow: rgba(0, 0, 0, .6); --legend-bg: rgba(26, 33, 43, .95);
  --tip-bg: rgba(238, 243, 250, .96); --tip-text: #121a27; --halo: #111; --warn: #ffa860;
  --ctl-hot: #2a3441;
  --hz1: #f2c230; --hz2: #ff9a3c; --hz3: #ff6b5b; --hz4: #e872cf;
  --hz1-bg: rgba(242, 194, 48, .16); --hz2-bg: rgba(255, 154, 60, .16); --hz3-bg: rgba(255, 107, 91, .16); --hz4-bg: rgba(232, 114, 207, .18);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa6b6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
[hidden] { display: none !important; }

/* ---- title bar */
#topbar { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 40px; background: var(--bar); color: var(--bar-text); }
#topbar .app-title { font-weight: 700; font-size: 15px; letter-spacing: .01em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
#topbar button { flex: none; }
#topbar #subtitle { opacity: .72; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar #runinfo { margin-left: auto; font-size: 12.5px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#topbar .flag { display: inline-block; padding: 1px 8px; margin-left: 8px; border-radius: 10px; background: rgba(255, 255, 255, .16); font-size: 11.5px; }
#topbar .flag.live { background: rgba(255, 196, 64, .3); margin-left: 5px; }          /* a run still coming in */
button.quiet { background: transparent; border-color: transparent; color: inherit; padding: 4px 10px; min-height: 30px; border-radius: 8px; }
#topbar button.quiet { color: var(--bar-text); }
#topbar button.quiet:hover { background: rgba(255, 255, 255, .14); }

/* ---- toolbar of dropdowns */
#toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; padding: 8px 12px 9px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.ctl { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.ctl .lab { font-size: 11px; line-height: 1.2; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.ctl.ctx select { border-color: var(--accent); background-color: var(--accent-soft); }          /* the controls that appear only for some products */
/* ---- winter hazards: text in the toolbar, one chip per flagged hazard (worst first), details in a panel */
.ctl.hz { flex: 100 1 190px; min-width: 150px; max-width: 960px; }          /* takes the free space ahead of the spacer, which only pushes Layers and Display to the right */
#btnHaz { width: 100%; justify-content: flex-start; overflow: hidden; }
#hzText { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.hzchip { flex: none; display: inline-flex; align-items: baseline; gap: 4px; padding: 0 8px 0 7px; border: 1px solid var(--border-strong); border-radius: 11px; font-size: 12.5px; line-height: 1.55; }
.hzchip::before { content: ""; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 2px; }
.hzchip small { color: var(--muted); font-size: 11.5px; }
.hzchip.l1 { border-color: var(--hz1); background: var(--hz1-bg); } .hzchip.l1::before { background: var(--hz1); }
.hzchip.l2 { border-color: var(--hz2); background: var(--hz2-bg); } .hzchip.l2::before { background: var(--hz2); }
.hzchip.l3 { border-color: var(--hz3); background: var(--hz3-bg); } .hzchip.l3::before { background: var(--hz3); }
.hzchip.l4 { border-color: var(--hz4); background: var(--hz4-bg); } .hzchip.l4::before { background: var(--hz4); }
#hzText.compact .hzchip small { display: none; }          /* when the chips do not all fit, their times go first */
.hzchip.hzmore { color: var(--muted); } .hzchip.hzmore::before { display: none; }
.hzmsg { color: var(--muted); font-size: 13px; }
.hzprog { flex: none; font-size: 12px; color: var(--accent); font-weight: 600; }
.spacer { flex: 1; }
.prodrow { display: flex; gap: 6px; }
#btnProduct { min-width: 260px; max-width: 420px; }
#btnProduct span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; flex: 1; text-align: left; }
.ibtn { width: 34px; padding: 0; font-weight: 700; font-family: Georgia, "Times New Roman", serif; font-style: italic; border-radius: 50%; }

select, button, input[type=text] { font: inherit; color: var(--text); background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 10px; min-height: 34px; }
select { -webkit-appearance: none; appearance: none; padding-right: 30px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; max-width: 100%; }
button { cursor: pointer; }
button:hover:not(:disabled), select:hover { border-color: var(--accent); }
button:active:not(:disabled) { background-color: var(--ctl-hot); }
button:disabled { opacity: .5; cursor: default; }
button.dd { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 30px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 11px center; text-align: left; }
button.dd[aria-expanded=true], button.ibtn[aria-expanded=true] { border-color: var(--accent); background-color: var(--accent-soft); }
button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); vertical-align: middle; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font: 12px var(--font); padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }

/* ---- map and what floats over it */
#mapwrap { flex: 1; position: relative; min-height: 0; background: var(--map-bg); overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--map-bg); font: inherit; }
.leaflet-container { background: var(--map-bg); font: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar { border: 0 !important; box-shadow: 0 1px 6px var(--shadow) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a { color: #1a2230; }
#mapwrap.busy .wx-raster, #mapwrap.busy .wx-lines { filter: grayscale(.75) opacity(.7); }
#mapwrap .wx-raster, #mapwrap .wx-lines { transition: filter .2s .3s; }

/* hover tooltip beside the cursor */
#tip { position: absolute; left: 0; top: 0; z-index: 1300; display: none; pointer-events: none; max-width: 300px; min-width: 150px; padding: 8px 11px 9px; border-radius: 10px;
  background: var(--tip-bg); color: var(--tip-text); box-shadow: 0 4px 16px var(--shadow); font-size: 12.5px; line-height: 1.35; }
#tip .tt { font-size: 11px; opacity: .72; font-weight: 600; letter-spacing: .02em; margin-bottom: 2px; }
#tip .tv { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
#tip .tv i { width: 13px; height: 13px; border-radius: 4px; flex: none; border: 1px solid rgba(128, 128, 128, .55); }
#tip .tr { display: flex; justify-content: space-between; gap: 14px; margin-top: 2px; }
#tip .tr span:first-child { font-weight: 700; }
#tip .tr small { opacity: .78; }
#tip .tp { margin-top: 5px; padding-top: 4px; border-top: 1px solid rgba(128, 128, 128, .4); font-size: 11px; opacity: .8; }
#tip .th { color: #7fbfef; } #tip .tq { color: #ffa860; }
body.dark #tip .th { color: #1f6fb0; } body.dark #tip .tq { color: #b85410; }
.c-hrrr { color: #1f78b4; } .c-rrfs { color: #d95f02; } body.dark .c-hrrr { color: #7fbfef; } body.dark .c-rrfs { color: #ffa860; }

#loading { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 900; background: var(--legend-bg); border: 1px solid var(--border); padding: 4px 14px; border-radius: 14px; display: none; box-shadow: 0 2px 8px var(--shadow); font-size: 13px; }
#toast { position: absolute; top: 10px; right: 10px; z-index: 900; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 10px; display: none; box-shadow: 0 3px 10px var(--shadow); max-width: 300px; }
#toast button { margin-left: 8px; }
#nodata { position: absolute; inset: 0; z-index: 850; display: none; align-items: center; justify-content: center; text-align: center; padding: 20px; pointer-events: none; }
#nodata div { background: var(--legend-bg); border: 1px solid var(--border); padding: 16px 20px; border-radius: 12px; max-width: 420px; }

/* ---- legend (built by app.js) */
#legend { position: absolute; left: 10px; bottom: 22px; z-index: 800; background: var(--legend-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 11px 9px; max-width: min(380px, calc(100% - 20px)); box-shadow: 0 2px 10px var(--shadow); pointer-events: none; }
#legend.interactive { pointer-events: auto; }
#legend .lt { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
#legend .lu { font-weight: normal; color: var(--muted); }
#legend canvas { display: block; width: 100%; height: 11px; border: 1px solid var(--border); border-radius: 3px; }
#legend .ticks { display: flex; justify-content: space-between; font-size: 11px; margin-top: 2px; }
#legend .lgbar { max-width: 100%; }
#legend .sw { display: flex; flex-wrap: wrap; gap: 3px 11px; }
#legend .sw span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
#legend .sw i { width: 15px; height: 11px; border: 1px solid var(--border-strong); display: inline-block; border-radius: 2px; }
#legend .bk { display: flex; padding: 0 var(--pad, 0px); }
#legend .bk.two { padding-bottom: 12px; }
#legend .bk div { flex: 0 0 var(--cw, 24px); text-align: center; font-size: 10.5px; min-width: 0; white-space: nowrap; }
#legend .bk .bl { display: flex; justify-content: center; position: relative; }
#legend .bk .bl.lo { top: 12px; }
#legend .bk .bl.lo::before { content: ""; position: absolute; left: 50%; top: -11px; width: 1px; height: 8px; background: var(--muted); }
#legend .bk i { display: block; height: 10px; border: 1px solid var(--border); border-left-width: 0; }
#legend .rl .rr { display: flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.35; }
#legend .rl .rr b { width: 56px; white-space: nowrap; font-weight: 600; flex: none; }
#legend .rl .rbar { display: flex; flex: 0 0 var(--rw, 240px); min-width: 0; }
#legend .rl .rbar i { flex: 1; height: 9px; }
#legend .rl .rtk { position: relative; display: block; height: 12px; flex: 0 0 var(--rw, 240px); font-size: 10px; color: var(--muted); min-width: 0; }
#legend .rl .rtk span, #legend .ticks.abs span { position: absolute; transform: translateX(-50%); }
#legend .ticks.abs { display: block; position: relative; height: 18px; margin-top: 0; }
#legend .ticks.abs i.tk { position: absolute; top: 0; width: 1px; height: 4px; background: var(--muted); }
#legend .ticks.abs span { top: 4px; white-space: nowrap; }
#legend .lmin { min-height: 26px; min-width: 26px; padding: 0 5px; line-height: 1; border-radius: 7px; }
#legend .cry { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; }
#legend .cry .cr { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; font-size: 12px; min-height: 30px; }
#legend .cry .cr:hover { background: var(--ctl-hot); border-color: transparent; }
#legend .cry .cr.sel { border-color: var(--accent); background: var(--accent-soft); }
#legend .cry .cr.absent { opacity: .38; }
#legend .cry .cn { flex: 1; line-height: 1.15; }
#legend .cry .cp { color: var(--muted); font-size: 10.5px; min-width: 26px; text-align: right; }
#legend .cry.min { display: flex; flex-wrap: wrap; gap: 3px; }
#legend .cry.min .cr { min-height: 32px; padding: 1px; }
#legend .cnone { font-size: 12px; color: var(--muted); }
#legend .lnote { color: var(--muted); font-size: 11px; margin-top: 4px; max-width: 340px; }
#legend .cov { color: var(--warn); font-size: 11.5px; margin-top: 4px; }
.cico { flex: none; display: block; }

/* ---- point forecast card */
#point { position: absolute; right: 10px; bottom: 22px; z-index: 1100; width: 350px; max-width: calc(100% - 20px); background: var(--legend-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 3px 14px var(--shadow); display: none; overflow: hidden; }
#point .ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px 5px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13px; }
#point .ph button { min-height: 26px; padding: 0 9px; border-radius: 7px; }
#point canvas { display: block; width: 100%; height: 196px; }
#point .pm { display: flex; gap: 3px; flex: none; }
#point .pm button.on, #point .pm button.on:hover:not(:disabled) { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#point .ph #pointTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
#point.snd { width: 440px; }
#point.snd canvas { height: 360px; }
#point .snote { color: var(--muted); margin-top: 2px; font-size: 11px; }
#point .pf { padding: 3px 12px 8px; font-size: 12px; }

/* ---- dropdown panels */
.pop { position: absolute; z-index: 1400; top: 8px; left: 8px; width: 320px; max-width: calc(100% - 16px); max-height: calc(100% - 16px); overflow-y: auto; padding: 10px 12px 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 34px var(--shadow); overscroll-behavior: contain; }
.pop-product { width: 440px; padding: 8px 8px 6px; display: flex; flex-direction: column; }
.pop-info { width: 440px; }
.pophead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pophead b { font-size: 14px; }
.sub { margin: 12px 0 4px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.frow span { color: var(--muted); font-size: 13px; }
.frow select { flex: 0 1 190px; }
.chkgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.chkgrid.one { grid-template-columns: 1fr; }
.chkgrid label, .chk { display: flex; align-items: center; gap: 8px; min-height: 30px; cursor: pointer; font-size: 13.5px; }
.chk label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
#prodQ { width: 100%; min-height: 40px; font-size: 14.5px; padding: 6px 12px; margin-bottom: 6px; }
#prodList { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: min(62vh, 520px); }
#prodList li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
#prodList li.grp { cursor: default; padding: 10px 10px 3px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
#prodList li small { color: var(--muted); white-space: nowrap; font-size: 11.5px; }
#prodList li.cur { font-weight: 700; }
#prodList li.cur::after { content: "\2713"; color: var(--accent); }
#prodList li.sel:not(.grp), #prodList li:not(.grp):hover { background: var(--accent-soft); }
#prodList li.none { cursor: default; color: var(--muted); }
/* hazard details panel */
.pop-haz { width: 500px; }
.hzmeta { color: var(--muted); font-size: 12.5px; margin: -2px 0 8px; }
.hzbar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--border); overflow: hidden; } .hzbar i { display: block; height: 100%; background: var(--accent); }
.hzwarn { color: var(--warn); }
.hzaxis { position: relative; height: 14px; margin: 0 0 1px; font-size: 10.5px; color: var(--muted); } .hzaxis span { position: absolute; top: 0; padding-left: 2px; border-left: 1px solid var(--border-strong); line-height: 14px; }
.hzrow { margin: 0 0 9px; padding: 7px 9px 8px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; background: var(--surface-2); }
.hzrow.l1 { border-left-color: var(--hz1); } .hzrow.l2 { border-left-color: var(--hz2); } .hzrow.l3 { border-left-color: var(--hz3); } .hzrow.l4 { border-left-color: var(--hz4); }
.hzhead { display: flex; align-items: center; gap: 8px; cursor: pointer; } .hzhead b { font-size: 14px; }
.hzdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.hzrow.l1 .hzdot { background: var(--hz1); } .hzrow.l2 .hzdot { background: var(--hz2); } .hzrow.l3 .hzdot { background: var(--hz3); } .hzrow.l4 .hzdot { background: var(--hz4); }
.hzlv { color: var(--muted); font-size: 12px; }
.hzstrip { display: flex; gap: 1px; height: 14px; margin: 6px 0 5px; }
.hzstrip i { flex: 1; min-width: 2px; background: var(--border); border-radius: 1px; cursor: pointer; }
.hzstrip i.c1 { background: var(--hz1); } .hzstrip i.c2 { background: var(--hz2); } .hzstrip i.c3 { background: var(--hz3); } .hzstrip i.c4 { background: var(--hz4); }
.hzstrip i.cur { outline: 2px solid var(--text); outline-offset: 1px; z-index: 1; }
.hzlines { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; } .hzlines small { color: var(--muted); }
.hzlines b.l1 { color: var(--hz1); } .hzlines b.l2 { color: var(--hz2); } .hzlines b.l3 { color: var(--hz3); } .hzlines b.l4 { color: var(--hz4); }
.hzwhen { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
button.lnk { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; border-radius: 3px; }
button.lnk:hover:not(:disabled) { border: 0; }
.hzquiet { font-size: 12.5px; color: var(--text); margin: 4px 0 8px; } .hzquiet small { color: var(--muted); }
.hznote { margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; } .hznote summary { padding: 7px 10px; cursor: pointer; font-weight: 600; } .hznote > div { padding: 0 10px 4px; } .hznote p { margin: 0 0 8px; color: var(--muted); }
.hztab { width: 100%; border-collapse: collapse; margin: 0 0 8px; font-size: 12px; } .hztab th, .hztab td { padding: 2px 5px; text-align: left; border-top: 1px solid var(--border); white-space: nowrap; } .hztab tr:first-child th { border-top: 0; color: var(--muted); font-size: 11px; } .hztab th:first-child { white-space: normal; font-weight: 600; }
#about p { margin: 0 0 8px; }
#about .why { margin: 0 0 8px; }
.note { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
#about .ctab { margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; }
#about .ctab summary { padding: 7px 10px; cursor: pointer; font-weight: 600; }
#about .crow { display: flex; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); font-size: 12.5px; align-items: flex-start; }
#scrim { position: absolute; inset: 0; z-index: 1350; background: rgba(8, 12, 20, .38); display: none; }

/* ---- help dialog */
#dlgHelp { width: min(560px, calc(100vw - 24px)); max-height: min(80vh, 640px); padding: 12px 16px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 14px 44px var(--shadow); }
#dlgHelp::backdrop { background: rgba(8, 12, 20, .45); }
#dlgHelp h4 { margin: 12px 0 4px; font-size: 13px; }
#dlgHelp ul { margin: 0; padding-left: 20px; } #dlgHelp li { margin: 3px 0; }

/* ---- time bar */
#timebar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--surface); border-top: 1px solid var(--border); }
#timebar button { min-width: 38px; border-radius: 8px; }
#timebar #btnPlay { min-width: 72px; }
#timebar #btnPlay.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#timebar input[type=range] { flex: 1; min-width: 60px; }
#timelabel { min-width: 230px; text-align: right; font-size: 13px; font-weight: 600; }
#timelabel small { color: var(--muted); display: block; font-size: 11px; font-weight: 400; }
.lbl-halo { font: bold 11px var(--font); }
@media (prefers-reduced-motion: reduce) { #mapwrap .wx-raster, #mapwrap .wx-lines { transition: none; } }

/* ---- touch screens: bigger targets, and room for the notch and the home bar */
@media (pointer: coarse) {
  select, button, input[type=text] { min-height: 42px; }
  .ibtn { width: 42px; }
  #legend .cry .cr { min-height: 38px; }
  #legend .lmin { min-height: 36px; min-width: 36px; }
  #point .ph button { min-height: 36px; padding: 0 12px; }
  input[type=range] { min-height: 34px; }
  .chkgrid label, .chk { min-height: 40px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .leaflet-bar a { width: 38px; height: 38px; line-height: 38px; }
}
#topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-top: env(safe-area-inset-top); }
#timebar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(7px, env(safe-area-inset-bottom)); }

/* ---- phones: dropdowns in two columns, panels as bottom sheets */
@media (max-width: 760px) {
  #topbar { gap: 6px; min-height: 36px; }
  #topbar #subtitle, #topbar .flag { display: none; }
  #topbar .flag.live { display: inline-block; font-size: 10.5px; padding: 0 6px; margin-left: 4px; }
  #topbar .app-title { font-size: 13px; letter-spacing: 0; flex: 0 0 auto; }
  #topbar #runinfo { font-size: 11px; }
  #topbar button.quiet { padding: 4px 7px; }
  #toolbar { gap: 6px 8px; padding: 7px 8px 8px; }
  .ctl.half { flex: 1 1 calc(50% - 4px); }
  .ctl.ctx, .popwrap { flex: 1 1 72px; }
  .ctl-product { flex: 1 1 100%; }
  .ctl.hz { flex: 1 1 100%; max-width: none; }
  .pop-haz { width: auto; }
  .prodrow #btnProduct { flex: 1; min-width: 0; max-width: none; }
  .spacer { display: none; }
  .popwrap .lab { display: none; }
  .popwrap button { width: 100%; }
  select { width: 100%; }
  .pop, .pop-product, .pop-info { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: 78vh; max-height: 78dvh; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 1400; }
  #prodList { max-height: calc(78dvh - 90px); }
  .frow select { flex: 1 1 55%; }
  #scrim.on { display: block; }
  #legend { bottom: 18px; max-width: 72%; }
  #legend:has(.cry) { max-width: calc(100% - 20px); }
  #legend .cry .cr { font-size: 11px; }
  #point, #point.snd { width: calc(100% - 20px); bottom: 10px; }
  #point.snd canvas { height: 300px; }
  #timebar { flex-wrap: wrap; gap: 5px 6px; padding-top: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  #timebar button { padding: 3px 9px; }
  #timelabel { min-width: 0; flex: 1; font-size: 12px; }
  #timelabel .zt, #timelabel small { display: none; }
  #timebar input[type=range] { order: 5; flex-basis: 100%; min-height: 28px; }
  #tip { max-width: 240px; }
}
@media (max-width: 430px) { #topbar #runinfo { display: none; } #topbar .app-title { flex: 1 1 auto; } }
@media (max-width: 395px) { #topbar .app-title { font-size: 11px; } }

/* ---- where a winter hazard is flagged (outline on the map, the chip above it, the label on the most extreme block) */
.hzfocus { position: absolute; top: 10px; left: 56px; right: 10px; z-index: 790; width: max-content; max-width: calc(100% - 66px); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px;
  background: var(--legend-bg); border: 1px solid var(--border); border-radius: 12px; padding: 6px 8px 6px 11px; font-size: 13px; box-shadow: 0 2px 10px var(--shadow); }
.hzfocus[hidden] { display: none; }
.hzfocus .hzdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--hz1); }
.hzfocus .hzdot.l2 { background: var(--hz2); } .hzfocus .hzdot.l3 { background: var(--hz3); } .hzfocus .hzdot.l4 { background: var(--hz4); }
.hzfocus .hzfm { color: var(--muted); } .hzfocus .hzfn { color: var(--muted); font-size: 12px; }
.hzfocus .hzx { border: 0; background: none; min-height: 0; width: 26px; height: 26px; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 50%; }
.hzfocus .hzx:hover { background: var(--surface-2); color: var(--text); }
.hzpeak span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 700 12px/1.2 system-ui, sans-serif; padding: 2px 8px; border-radius: 10px; color: var(--text);
  background: var(--legend-bg); border: 2px solid var(--hz1); box-shadow: 0 1px 6px var(--shadow); pointer-events: none; }
.hzpeak span.l2 { border-color: var(--hz2); } .hzpeak span.l3 { border-color: var(--hz3); } .hzpeak span.l4 { border-color: var(--hz4); }
.hzshow { margin-left: auto; font-size: 12px; min-height: 0; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--accent); background: none; color: var(--accent); cursor: pointer; }
.hzshow.on { background: var(--accent); color: #fff; }
@media (max-width: 700px) { .hzfocus { left: 10px; top: 84px; right: 10px; max-width: calc(100% - 20px); } }
/* wind scale tags (gale force, storm force, ...) */
.hztag { font-style: normal; font-weight: 600; font-size: 11px; line-height: 1.5; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.hzlines .hzstep { margin-left: 14px; } .hzlines .hzstep small { color: var(--muted); }
#hzText.compact2 .hztag { display: none; }
.hzpeak span { font-weight: 700; }

/* ---- animated GIF export */
.pop-gif { width: 340px; }
.gifnote { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.gifsum { margin: 6px 0 10px; font-size: 12.5px; }
.gifwarn { color: var(--warn); }
.gifmake { width: 100%; min-height: 36px; font-weight: 700; }
#gifResult { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
#gifPrev { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--map-bg); }
.gifmeta { margin: 6px 0 8px; font-size: 12.5px; color: var(--muted); }
.gifdl { display: block; text-align: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 700; text-decoration: none; }
.gifdl:hover { background: var(--accent); color: var(--accent-text); }
#gifBusy { position: fixed; inset: 0; z-index: 3000; background: rgba(8, 12, 20, .12); display: flex; align-items: flex-start; justify-content: center; padding-top: 84px; cursor: progress; }
#gifBusy[hidden] { display: none; }
.gifcard { width: min(360px, calc(100% - 24px)); padding: 12px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 34px var(--shadow); display: flex; flex-direction: column; gap: 8px; cursor: default; }
.gifbar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.gifbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.gifsub { font-size: 12.5px; color: var(--muted); min-height: 1.3em; }
.gifcard button { align-self: flex-end; }

.gifframe { position: absolute; z-index: 900; pointer-events: none; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(8, 12, 20, .28), 0 0 0 1px rgba(0, 0, 0, .55) inset; }
.gifframe[hidden] { display: none; }

/* ---- overlay line key and squall companion chips (under the legend) */
#legend .lkey { margin-top: 6px; display: grid; gap: 2px; font-size: 11px; }
#legend .lkey > div { display: flex; align-items: center; gap: 7px; }
#legend .lkey .lksw { flex: none; display: block; }
#legend .lgchips { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11px; }
#legend .lgchips > span { color: var(--muted); margin-right: 2px; }
#legend .lgchip { min-height: 24px; padding: 0 8px; border-radius: 12px; font-size: 11px; background: var(--surface); }
#legend .lgchip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---- phones: fewer words on the map. The legend keeps its title and color bar; notes, warnings, overlay key and chips open with the button. The hazard card is one line. */
#legend .lmin.warn { position: relative; }
#legend .lmin.warn::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
@media (min-width: 761px) { #legend .lmin.pm { display: none; } }
@media (max-width: 760px) {
  #legend.min .lmore { display: none; }
  #legend .lt { margin-bottom: 2px; }
  #legend .lt .lmin { margin: -3px -4px -3px 0; }
  .hzfocus { flex-wrap: nowrap; gap: 4px 7px; padding: 4px 4px 4px 10px; font-size: 12.5px; white-space: nowrap; width: auto; max-width: calc(100% - 20px); }
  .hzfocus .hzfm, .hzfocus .hzmore { display: none; }
  .hzfocus .hzfn { font-size: 12px; }
  .hzfocus .lnk { white-space: nowrap; font-size: 12px; }
  .hzfocus > b { overflow: hidden; text-overflow: ellipsis; }
}
.hzfocus .hzn { font-weight: 500; }
@media (max-width: 760px) { #legend.phoneint { pointer-events: auto; } #legend { max-height: calc(100% - 24px); overflow-y: auto; } }
