.viz-root {
  color-scheme: light;
  --page: #f9f9f7; --surface-1: #fcfcfb; --surface-2: #f3f2ef;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --div-neg: #e34948; --div-mid: #f0efec; --div-pos: #2a78d6;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --band-outer: rgba(42,120,214,0.16); --band-inner: rgba(42,120,214,0.30);
  --temp-band: rgba(235,104,52,0.18); --sky-clear: #eceae4; --sky-ovc: #8f8d86; --night: rgba(30,40,70,0.07); --night-tile: #eceef4; --temp-band-key: #f3b49c; --band-key: #a9c9ef; --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5;
    --band-outer: rgba(57,135,229,0.20); --band-inner: rgba(57,135,229,0.38);
    --temp-band: rgba(217,89,38,0.26); --sky-clear: #2a2a28; --sky-ovc: #8a8984; --night: rgba(0,0,0,0.35); --night-tile: #15171f; --temp-band-key: #7d4a33; --band-key: #2c5687; --accent: #3987e5;
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5;
  --band-outer: rgba(57,135,229,0.20); --band-inner: rgba(57,135,229,0.38);
  --temp-band: rgba(217,89,38,0.26); --sky-clear: #2a2a28; --sky-ovc: #8a8984; --night: rgba(0,0,0,0.35); --night-tile: #15171f; --temp-band-key: #7d4a33; --band-key: #2c5687; --accent: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #f9f9f7; }
:root[data-theme="dark"] body { background: #0d0d0d; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) body { background: #0d0d0d; } }
.viz-root { background: var(--page); color: var(--text-primary); min-height: 100vh; display: flex; flex-direction: column;
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
.muted { color: var(--text-muted); } .small { font-size: 12px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }

/* header */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--ring); background: var(--surface-1); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); text-decoration: none; }
.mark svg { display: block; width: 24px; height: 24px; } .mark rect { fill: var(--accent); } .mark path { fill: #fff; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--ring); border-radius: 999px; padding: 1px 8px; }
nav#tabs { display: flex; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav#tabs::-webkit-scrollbar { display: none; }
nav#tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-top: 2px solid transparent; color: var(--text-secondary); padding: 0 12px; cursor: pointer; white-space: nowrap; }
nav#tabs button:hover { color: var(--text-primary); }
nav#tabs button.on { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--surface-1); color: var(--text-secondary); border: 1px solid var(--ring); border-radius: 8px; cursor: pointer; flex: none; }
.iconbtn:hover { background: var(--surface-2); color: var(--text-primary); }
.iconbtn.play { width: 40px; background: var(--accent); color: #fff; border-color: transparent; }
.iconbtn.play:hover { filter: brightness(1.08); background: var(--accent); color: #fff; }
header.top .iconbtn { background: none; border-color: transparent; }

.warn { display: flex; gap: 8px; align-items: center; padding: 5px 16px; background: var(--surface-2); border-bottom: 1px solid var(--ring); flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.warn-icon { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--warning); color: #0b0b0b; font-weight: 700; font-size: 10px; flex: none; }
.warn a { font-weight: 600; }
main { padding: 16px; width: 100%; max-width: 1560px; margin: 0 auto; flex: 1; }
.tab { display: none; } .tab.on { display: block; }

/* controls */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inline { display: inline-flex; gap: 5px; align-items: center; color: var(--text-secondary); font-size: 13px; white-space: nowrap; cursor: pointer; }
.inline input { accent-color: var(--accent); margin: 0; }
select, input[type=search] { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--ring); border-radius: 8px; padding: 6px 9px; font: inherit; }
.btn { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--ring); border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; max-width: 100%; }
.seg button { background: none; border: 0; border-radius: 7px; padding: 5px 11px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; font-size: 13px; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 0 0 1px var(--ring); }
.seg.scrollx { overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; display: flex; width: fit-content; }
.seg.scrollx::-webkit-scrollbar { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
#nearestList { margin: -4px 0 12px; } #nearestList:empty { display: none; }
.chip { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--ring); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.startchips { margin-top: 12px; }
.togglechips { margin-bottom: 10px; }
.chip.toggle { display: inline-flex; align-items: center; color: var(--text-muted); font-size: 12px; }
.chip.toggle .swatch { opacity: 0.25; }
.chip.toggle.on { color: var(--text-primary); background: var(--surface-2); }
.chip.toggle.on .swatch { opacity: 1; }

/* station search */
.stnbox { position: relative; width: min(100%, 340px); }
.stnbox input { width: 100%; padding-left: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 15px; background-position: 9px center; }
.stnlist { display: none; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface-1); border: 1px solid var(--ring); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); padding: 4px; max-height: 340px; overflow-y: auto; }
.stnrow { display: flex; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; text-align: left; }
.stnrow span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stnrow:hover, .stnrow.on { background: var(--surface-2); }

/* cards */
.card { background: var(--surface-1); border: 1px solid var(--ring); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; }
.grid2 > .card { margin-bottom: 0; } .tab > .grid2 { margin-bottom: 14px; }
.empty { color: var(--text-muted); padding: 28px; text-align: center; }
.loading { opacity: 0.55; transition: opacity 0.15s; }

/* map */
.maprow { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 14px; align-items: start; }
.mapcard { margin-bottom: 0; padding-bottom: 10px; }
.maphead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 4px; }
.ctitle { font-size: 15px; font-weight: 600; }
.mapopts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mapwrap { width: 100%; min-height: 240px; }
#map .border { fill: none; stroke: var(--surface-1); stroke-width: 0.8; stroke-opacity: 0.85; stroke-linejoin: round; }
#map .border.outer { stroke: var(--axis); stroke-width: 1; stroke-opacity: 1; }
.stn { stroke: var(--surface-1); stroke-width: 1; }
.stn.none { fill: none; stroke: var(--axis); }
.stn.dim { opacity: 0.12; }
.loc { fill: var(--text-primary); opacity: 0.3; } .loc.dim { opacity: 0.04; }
.hit { fill: none; stroke: var(--text-primary); stroke-width: 2; pointer-events: none; }
.cities text { text-anchor: middle; paint-order: stroke; stroke: var(--surface-1); stroke-linejoin: round; pointer-events: none; }
.cities .cv { fill: var(--text-primary); font-weight: 700; stroke-width: 3px; font-variant-numeric: tabular-nums; }
.cities .cn { fill: var(--text-secondary); font-weight: 500; stroke-width: 2.5px; }
.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.legend .unit { font-weight: 600; }
.warnline { color: var(--text-primary); font-weight: 500; }
.right-auto { margin-left: auto; font-size: 11px; }
.steps { display: inline-flex; align-items: flex-start; padding-bottom: 15px; }
.step { position: relative; display: inline-flex; flex-direction: column; cursor: default; }
.step i { display: block; width: 30px; height: 11px; margin-right: 1px; }
.steps .step:first-child i { border-radius: 3px 0 0 3px; } .steps .step:last-child i { border-radius: 0 3px 3px 0; margin-right: 0; }
.steps .step b { position: absolute; top: 12px; right: -1px; transform: translateX(50%); font-weight: 400; font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.step.keynone { flex-direction: row; align-items: center; gap: 5px; margin-bottom: 15px; }
.step i.hollow { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--axis); margin: 0; }
.scrub { display: flex; align-items: flex-start; gap: 14px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--grid); }
.scrubbtns { display: flex; gap: 4px; flex: none; }
.track { position: relative; flex: 1; min-width: 120px; padding-top: 7px; }
.track input { display: block; width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ticks { position: relative; height: 18px; margin: 2px 8px 0; }
.ticks span { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.ticks i { width: 1px; height: 5px; background: var(--axis); } .ticks b { font-size: 10px; font-weight: 500; color: var(--text-muted); }
.when { flex: none; min-width: 170px; text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.when b { font-size: 14px; font-weight: 600; }
.gate { margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .gate:empty { display: none; }
.extremes { margin-bottom: 0; padding: 12px; }
.extremes h3 { margin: 0 0 4px; font-size: 12px; } .extremes h3.sp { margin-top: 14px; }
.extrow { display: flex; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; border-radius: 6px; padding: 4px 6px; font-size: 12px; cursor: pointer; text-align: left; }
.extrow:hover { background: var(--surface-2); }
.extname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.extrow b { font-variant-numeric: tabular-nums; flex: none; }

/* tooltip */
.tip { position: fixed; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--ring); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); display: none; z-index: 40; max-width: 340px; }
.tip b { font-weight: 600; }
.tip .row { display: flex; gap: 14px; justify-content: space-between; font-variant-numeric: tabular-nums; }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.swatch.box { height: 10px; width: 14px; }
.ramp { display: inline-block; width: 200px; height: 10px; border-radius: 3px; vertical-align: middle; }
.axis text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis path, .axis line { stroke: var(--axis); }
.axis.noline path, .axis.noline line { display: none; }
.gridline line { stroke: var(--grid); }
.gridline path { display: none; }
.baseline { stroke: var(--axis); }
.cross { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.hovermark { stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
.nowline { stroke: var(--text-primary); stroke-width: 1; opacity: 0.55; }
.nowlabel { fill: var(--text-secondary); font-size: 10px; font-weight: 600; }
.night { fill: var(--night); }
.tick-h { fill: var(--text-muted); font-size: 10px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.tick-d { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
thead th { position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; }
td.wrap { white-space: normal; min-width: 120px; }
.tablewrap { overflow-x: auto; }
.heat td.cell { text-align: center; border: 2px solid var(--surface-1); border-radius: 4px; min-width: 72px; }
.status { display: inline-flex; gap: 6px; align-items: center; }
.status .dot { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.status.ok .dot { background: var(--good); } .status.stale .dot { background: var(--warning); color: #0b0b0b; } .status.missing .dot, .status.error .dot { background: var(--critical); }
.bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.bar > span.stale { background: var(--warning); } .bar > span.error { background: var(--critical); }
details.card summary { cursor: pointer; color: var(--text-secondary); font-weight: 600; font-size: 13px; }
details.card[open] summary { margin-bottom: 10px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; min-width: 0; }
.tile.card { margin-bottom: 0; }
.tile > span { font-size: 11px; color: var(--text-muted); }
.tile > b { font-size: 18px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile > em { font-style: normal; font-size: 12px; color: var(--text-secondary); }
.tiles.inner { margin: 0; gap: 8px 18px; grid-template-columns: repeat(4, minmax(84px, auto)); justify-content: start; }

/* forecast page */
.headrow { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stname { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.right { text-align: right; }
.badge { background: var(--surface-2); border: 1px solid var(--ring); border-radius: 4px; padding: 0 5px; color: var(--text-secondary); }
.headgrid { display: flex; justify-content: space-between; gap: 18px 40px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.now { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.now .big { font-size: 52px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(100px, auto)); gap: 4px 20px; }
.kv div { display: flex; flex-direction: column; } .kv span { font-size: 11px; color: var(--text-muted); } .kv b { font-weight: 500; }
.glance { padding-left: 24px; border-left: 1px solid var(--grid); }
.glancehead { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
#pointTimeline { overflow-x: auto; }
#pointTimeline svg { min-width: 760px; }
.timeline .daysep { stroke: var(--axis); stroke-width: 1; }
.timeline .ptitle { fill: var(--text-secondary); font-size: 11px; }
.timeline .ln { fill: none; stroke-width: 2; } .timeline .ln.thin { stroke-width: 1.25; }
.timeline .obsdot { fill: var(--text-primary); stroke: var(--surface-1); stroke-width: 1; }
.timeline .hl { fill: var(--text-primary); font-size: 11px; font-weight: 600; text-anchor: middle; paint-order: stroke; stroke: var(--surface-1); stroke-width: 2.5px; }
.timeline .popbar { fill: var(--series-1); }
.dname { display: flex; flex-direction: column; line-height: 1.25; } .dname > span.muted { font-size: 11px; }
.popmini { display: inline-block; width: 34px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: none; }
.popmini i { display: block; height: 100%; background: var(--series-1); }
.phead, .pday { display: grid; grid-template-columns: 76px repeat(4, minmax(0, 1fr)); gap: 8px; }
.phead { padding: 0 4px 6px; border-bottom: 1px solid var(--axis); font-size: 12px; position: sticky; top: 52px; background: var(--surface-1); z-index: 2; }
.phead > div { display: flex; flex-direction: column; padding-left: 4px; } .phead span { font-size: 11px; }
.pday { padding: 8px 4px; border-bottom: 1px solid var(--grid); align-items: start; }
.pday:last-child { border-bottom: 0; }
.hilo { margin-top: 4px; font-variant-numeric: tabular-nums; }
.pcell { font-size: 12px; min-width: 0; border-radius: 6px; padding: 2px 4px; }
.pcell[data-d]:hover { background: var(--surface-2); }
.plabel { display: none; font-size: 11px; color: var(--text-muted); }
.ptop { display: flex; align-items: center; gap: 6px; }
.ptemp { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prain { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.ic-sun { fill: var(--series-4); } .ic-ray line { stroke: var(--series-4); stroke-width: 1.6; stroke-linecap: round; }
.ic-moon { fill: var(--text-muted); }
.ic-cloud { fill: var(--surface-1); stroke: var(--text-muted); stroke-width: 1.4; } .ic-cloud.dark { fill: var(--sky-ovc); stroke: var(--sky-ovc); }
.ic-drop line { stroke: var(--series-1); stroke-width: 1.8; stroke-linecap: round; }

footer { width: 100%; max-width: 1560px; padding: 12px 16px 20px; margin: 0 auto; border-top: 1px solid var(--ring); font-size: 11px; }
footer .small { font-size: 11px; } footer div div { margin-bottom: 2px; }

@media (max-width: 1100px) {
  .maprow { grid-template-columns: 1fr; }
  .extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; grid-auto-flow: column; grid-template-rows: auto repeat(6, auto); }
  .extremes h3.sp { margin-top: 0; }
}
@media (max-width: 760px) {
  main { padding: 10px; }
  header.top { gap: 8px; padding: 0 10px; height: 46px; }
  .tag { display: none; }
  nav#tabs button { padding: 0 8px; font-size: 13px; }
  .warn { padding: 4px 10px; font-size: 11px; line-height: 1.3; }
  .card { padding: 12px; border-radius: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .scrub { flex-wrap: wrap; gap: 8px; } .track { order: 3; flex-basis: 100%; }
  .when { flex: 1; min-width: 0; }
  .right-auto { margin-left: 0; }
  .step i { width: 24px; }
  .headgrid { flex-direction: column; align-items: stretch; }
  .glance { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--grid); }
  .tiles.inner { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .right { text-align: left; }
  .phead { display: none; }
  .pday { grid-template-columns: 1fr 1fr; }
  .pday .dname { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
  .pday .hilo { margin: 0 0 0 auto; }
  .plabel { display: block; }
  .empty-cell { display: none; }
}

/* consumer layout */
.textbtn { background: none; border: 0; color: var(--text-secondary); cursor: pointer; font-size: 13px; white-space: nowrap; padding: 6px 8px; border-radius: 6px; }
.textbtn:hover { color: var(--text-primary); background: var(--surface-2); } .textbtn.on { color: var(--text-primary); font-weight: 600; }
.datanav { margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 650; letter-spacing: -0.005em; }
.stnbox.big { width: min(100%, 460px); } .stnbox.big input { padding: 9px 12px 9px 34px; font-size: 15px; background-position: 11px center; }
.stnrow { align-items: baseline; }
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; } .alerts:empty { display: none; }
.alert { background: var(--surface-1); border: 1px solid var(--ring); border-left: 5px solid var(--warning); border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; }
details.alert { display: block; }
details.alert summary { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; list-style: none; }
details.alert summary::-webkit-details-marker { display: none; }
details.alert summary::after { content: "Details"; margin-left: auto; font-size: 12px; color: var(--text-muted); flex: none; align-self: center; }
details.alert[open] summary::after { content: "Hide"; }
.alicon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warning); color: #0b0b0b; font-weight: 800; font-size: 13px; flex: none; }
.altext { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; font-size: 15px; } .altext b { font-weight: 650; }
.alsrc { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.alert.sev-high { border-left-color: var(--critical); } .sev-high .alicon { background: var(--critical); color: #fff; }
.alert.sev-mod { border-left-color: var(--serious); } .sev-mod .alicon { background: var(--serious); color: #0b0b0b; }
.alert.unavailable { border-left-color: var(--warning); }
.albody { margin: 8px 0 0 30px; font-size: 13px; color: var(--text-secondary); max-width: 90ch; } .albody p { margin: 0 0 8px; } .albody b { color: var(--text-primary); }
.allclear { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); padding: 0 2px; }
.nowtext { display: flex; flex-direction: column; font-size: 13px; color: var(--text-secondary); } .nowtext b { font-size: 16px; color: var(--text-primary); font-weight: 600; }
.tiles.inner { grid-template-columns: repeat(3, minmax(84px, auto)); }
.dname { gap: 0; } .dayword { font-size: 15px; font-weight: 650; }
.hilo { margin-top: 5px; display: flex; gap: 6px; align-items: baseline; }
.hl-h { font-size: 18px; font-weight: 650; } .hl-l { font-size: 15px; color: var(--text-muted); }
.ptemp { font-size: 14px; }
.psky { color: var(--text-secondary); }
.pwind { color: var(--text-primary); font-weight: 500; }
.sevbadge { margin-top: 5px; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 5px; width: fit-content; line-height: 1.3; }
.sevbadge.r1, .sevbadge.r2 { background: var(--serious); color: #0b0b0b; } .sevbadge.r3 { background: var(--critical); color: #fff; }
.riskpoly { fill-opacity: 0.88; stroke: rgba(0,0,0,0.25); stroke-width: 0.6; }
.warnpoly { fill-opacity: 0.22; stroke-width: 1.6; pointer-events: none; }
.w-tor { fill: var(--critical); stroke: var(--critical); } .w-svr { fill: var(--series-2); stroke: var(--series-2); } .w-ffw { fill: var(--series-3); stroke: var(--series-3); } .w-oth { fill: var(--text-secondary); stroke: var(--text-secondary); }
.w-plain { fill: rgba(16,19,15,0.05); stroke: #10130f; stroke-width: 0.7; stroke-opacity: 0.55; }
:root[data-theme="dark"] .w-plain { fill: rgba(255,255,255,0.06); stroke: #fff; }
.riskkey { display: inline-flex; align-items: center; gap: 5px; } .riskkey i { width: 14px; height: 11px; border-radius: 2px; display: inline-block; border: 1px solid var(--ring); }
.riskkey i.wk { background: none; border: 2px solid; }
.riskkey i.w-tor { border-color: var(--critical); } .riskkey i.w-svr { border-color: var(--series-2); } .riskkey i.w-ffw { border-color: var(--series-3); }
.tipwarn { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--grid); }
.extrow.static { cursor: default; } .extrow.static:hover { background: none; }
footer summary { cursor: pointer; color: var(--text-muted); font-size: 12px; }
footer details[open] summary { margin-bottom: 6px; }
@media (max-width: 760px) {
  .textbtn { font-size: 12px; padding: 4px; }
  .tiles.inner { grid-template-columns: repeat(3, 1fr); }
  .pday .sevbadge { margin: 0; }
}

/* map stage: canvas under SVG, same size, on every browser */
.mapstage { position: relative; width: min(100%, calc((100vh - 330px) * 975 / 610)); min-width: min(100%, 384px); aspect-ratio: 975 / 610; margin: 0 auto; }
.mapstage canvas, .mapstage #map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map { touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.tiphint { margin-top: 4px; font-size: 11px; }
.steps.dense .step i { width: 13px; margin-right: 0; }
.steps.dense .step b { font-size: 10px; }

/* color coded temperature */
.tchip { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10); display: inline-block; min-width: 2.35em; padding: 1px 6px; border-radius: 6px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.35; }
.tchip.big { font-size: 40px; font-weight: 650; padding: 4px 14px; border-radius: 14px; letter-spacing: -0.02em; line-height: 1.1; }
.now { gap: 14px; }
.wxicon { display: block; flex: none; }
.tile > b .tchip { font-size: 18px; }
#pointHead { position: relative; }

/* next 24 hours */
.hourstrip { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; margin-top: 14px; overflow: hidden; }
.hr { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 1px; border-radius: 10px; background: var(--surface-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.hr .wxicon { width: min(32px, 100%); height: auto; }
.hr .tchip { min-width: 0; padding: 1px 4px; }
.hr.night { background: var(--night-tile); }
.hrt { font-weight: 600; color: var(--text-secondary); font-size: 11px; }
.hrp, .hrw { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; min-height: 14px; }
.hrw { color: var(--text-secondary); }
.hrp i, .hrw i, .hrkey i, .pwind i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.hrp i { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.hrkey { display: flex; gap: 14px; margin-top: 8px; } .hrkey span { display: inline-flex; align-items: center; gap: 5px; }

/* 10 days */
.phead, .pday { grid-template-columns: 112px repeat(4, minmax(0, 1fr)); gap: 6px; }
.pday { padding: 7px 0; }
.dname { display: flex; flex-direction: column; padding: 2px 4px; }
.dtop { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; } .dtop .muted { font-size: 11px; }
.hilo { margin-top: 5px; gap: 4px; }
.drange { position: relative; height: 5px; border-radius: 3px; background: var(--grid); margin-top: 8px; }
.drange i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.pcell { display: flex; flex-direction: column; gap: 3px; text-align: left; font: inherit; font-size: 12px; color: var(--text-primary); border: 1px solid var(--ring); border-top: 3px solid var(--tc); border-radius: 10px; padding: 6px 8px 7px; background: linear-gradient(180deg, var(--tint), transparent 70%), var(--surface-1); cursor: pointer; min-width: 0; -webkit-tap-highlight-color: transparent; }
.pcell.p2, .pcell.p3 { background: linear-gradient(180deg, var(--tint), transparent 70%), var(--night-tile); }
.pcell[data-d]:hover { background: linear-gradient(180deg, var(--tint), var(--tint)), var(--surface-1); }
.pcell.empty-cell { border: 0; background: none; cursor: default; }
.ptop { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ptwrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ptemp { font-size: 15px; font-weight: 700; white-space: nowrap; }
.pgrad { display: block; height: 4px; border-radius: 2px; }
.psky { color: var(--text-secondary); }
.prain { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 5px; font-weight: 500; }
.prain.dry { color: var(--text-muted); font-weight: 400; }
.dropic { width: 10px; height: 13px; flex: none; }
.pct { font-weight: 700; font-variant-numeric: tabular-nums; } .prain.dry .pct { font-weight: 400; }
.pbar { flex: 1 1 100%; display: block; height: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 2px; }
.pamt { color: var(--text-secondary); font-weight: 400; flex-basis: 100%; }
.pwind { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.ph2 b::before, .ph3 b::before, .ph0 b::before, .ph1 b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.ph0 b::before { background: #f7c46a; } .ph1 b::before { background: #f9b81f; } .ph2 b::before { background: #8d7fc9; } .ph3 b::before { background: #4b5a93; }
.timeline .ln.bold { stroke-width: 3; stroke-linecap: round; }

/* touch and Safari */
input, select, textarea { -webkit-appearance: none; appearance: none; }
input[type=checkbox] { -webkit-appearance: checkbox; appearance: auto; }
input[type=range] { -webkit-appearance: auto; appearance: auto; }
select { padding-right: 22px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 13px) 55%, calc(100% - 8px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
main, header.top, .warn, footer { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
@media (pointer: coarse) {
  input[type=search], .stnbox.big input, select { font-size: 16px; }   /* smaller text makes iOS zoom the page on focus */
  .iconbtn { width: 44px; height: 44px; } .iconbtn.play { width: 52px; }
  .seg button { padding: 9px 13px; } .chip, .btn { padding: 8px 14px; }
  nav#tabs button { padding: 0 14px; }
  .inline { min-height: 36px; }
  .track input { height: 34px; }
  .stnrow { padding: 11px 8px; }
  .extrow { padding: 9px 6px; }
  .ticks { margin-top: -4px; }
}
@media (hover: none) { .chip:hover, .btn:hover, .extrow:hover, .stnrow:hover, .iconbtn:hover { background: var(--surface-1); } .iconbtn.play:hover { background: var(--accent); } }
@media (max-width: 1100px) and (min-width: 761px) { .phead, .pday { grid-template-columns: 96px repeat(4, minmax(0, 1fr)); } .ptemp { font-size: 13px; } .wxicon { width: 30px; height: 28px; } }
@media (max-width: 760px) {
  .pday { grid-template-columns: 1fr 1fr; }
  .pday .dname { flex-direction: column; grid-column: 1 / -1; }
  .pday .dtop { order: 0; } .pday .hilo { margin: 4px 0 0; } .pday .drange { margin-top: 6px; }
  .plabel { display: block; font-weight: 600; color: var(--text-secondary); }
  .tchip.big { font-size: 34px; }
}
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .w-plain { fill: rgba(255,255,255,0.12); stroke: #fff; } }
#pointHead .muted { color: var(--text-secondary); }

/* forecast: the map's exact colors, solid, on neutral cards */
#pointHead { border-top: 6px solid var(--nowc, var(--ring)); }
.pcell, .pcell.p2, .pcell.p3 { background: var(--surface-1); border: 1px solid var(--ring); padding-top: 0; overflow: hidden; }
.pcell.p2, .pcell.p3 { background: var(--night-tile); }
.pcell[data-d]:hover { background: var(--surface-2); }
/* Safari does not stretch the children of a button, so widths are explicit */
.pcell[data-d] > * { width: 100%; }
.pcell[data-d] > .pband { display: block; flex: none; height: 7px; width: calc(100% + 16px); max-width: none; margin: 0 -8px 5px; }
.ptemps { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pto { font-size: 11px; color: var(--text-muted); }
.pcell .tchip { font-size: 14px; }
.tchip { font-weight: 800; box-shadow: none; }
.pbar { height: 5px; }
.drange { height: 7px; border-radius: 4px; } .drange i { border-radius: 4px; }
.iconbtn.play { background: #ff5a00; } .iconbtn.play:hover { background: #ff5a00; }
.hr { border: 1px solid var(--ring); }
.timeline .ln.casing { stroke: var(--text-primary); stroke-opacity: 0.55; stroke-width: 5; stroke-linecap: round; }
.timeline .ln.casing.thin2 { stroke-width: 3.5; }

/* every period card names its period and hours */
.pcell[data-d] > .plabel { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 8px; font-size: 11px; color: var(--text-secondary); }
.plabel b { font-size: 12px; font-weight: 700; color: var(--text-primary); }
