/* Layout: one thumb-width column. Status first, evidence below. Status color is the only loud element. */
:root {
  --bg: #e9eef2; --panel: #fbfcfd; --ink: #15212c; --muted: #566575; --line: #d3dce3; --accent: #1d5f8a;
  --quiet: #1c6b57; --aware: #276a9c; --watch: #9a6200; --prepare: #bd4a06; --warning: #c02222; --shelter: #8e0f46; --unknown: #47535f;
  --hail: #0f7ea8; --tornado: #c11c5a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101921; --panel: #19252f; --ink: #edf3f7; --muted: #9dafbd; --line: #2d3c49; --accent: #7cc0e8; --hail: #55c1e8; --tornado: #ff7aa8; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
h1, h2, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand span { color: var(--muted); font-size: 13px; }
#refresh, #share { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 600; }

main { display: grid; gap: 12px; width: 100%; max-width: 560px; margin: 0 auto;
  padding-block: 12px calc(env(safe-area-inset-bottom, 0px) + 28px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main > * { min-width: 0; scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 72px); }

.banner { padding: 10px 12px; border-radius: 8px; background: var(--watch); color: #fff; font-weight: 600; font-size: 14px; }
.banner.test { background: #4b2a86; text-align: center; letter-spacing: .03em; }

#hero { padding: 20px 18px; border-radius: 12px; color: #fff; background: var(--unknown); display: grid; gap: 7px; }
#hero[data-level="quiet"] { background: var(--quiet); }
#hero[data-level="aware"] { background: var(--aware); }
#hero[data-level="watch"] { background: var(--watch); }
#hero[data-level="prepare"] { background: var(--prepare); }
#hero[data-level="warning"] { background: var(--warning); }
#hero[data-level="shelter"] { background: var(--shelter); }
.hero-place { font-size: 13px; opacity: .88; }
#hero h1 { font-size: clamp(30px, 9vw, 40px); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.hero-action { font-size: 17px; line-height: 1.35; }
.hero-warning { margin-top: 3px; padding: 7px 10px; background: rgb(0 0 0 / .24); border-radius: 6px; font-weight: 700; font-size: 15px; }

.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gauge, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.gauge { display: flex; flex-direction: column; gap: 4px; }
.gauge h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gauge-num { font-size: 44px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.gauge-num span { font-size: 21px; font-weight: 700; margin-left: 1px; }
.gauge-cap { font-size: 12px; line-height: 1.25; color: var(--muted); min-height: 30px; }
.bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--hail); }
.gauge:nth-child(2) .bar i { background: var(--tornado); }
.gauge-today { margin-top: 5px; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.gauge-today b { color: var(--ink); }

.panel { display: grid; gap: 9px; }
.panel h2 { font-size: 17px; line-height: 1.2; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }
.conf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.conf-head p { font-variant-numeric: tabular-nums; }
.conf-head b { font-size: 22px; }
.segments { display: flex; gap: 3px; height: 9px; }
.segments span { border-radius: 2px; background: var(--line); }
.segments .on { background: var(--quiet); }
.segments .part { background: var(--watch); }
.segments .off { background: var(--warning); }

.links-primary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.links-primary a { display: grid; place-items: center; min-height: 48px; padding: 6px; text-align: center; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 700; text-decoration: none; font-size: 15px; }

#drivers ul { display: grid; gap: 7px; }
#drivers li { padding-left: 14px; position: relative; font-size: 15px; }
#drivers li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }

.map-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 36px; padding: 0 12px; border: 0; background: transparent; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.map { position: relative; width: 100%; aspect-ratio: 1; max-width: 100%; overflow: hidden; border-radius: 8px; background: #c8d3da; }
#map-base, #map-radar, #map-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-base img { position: absolute; max-width: none; filter: grayscale(.85) contrast(.92) brightness(1.03); }
#map-radar img { width: 100%; height: 100%; opacity: .82; display: block; }
@media (prefers-color-scheme: dark) { .map { background: #24323d; } #map-base img { filter: grayscale(1) invert(.9) contrast(.86) brightness(.92); } }
.ring { fill: none; stroke: #16232e; stroke-width: 2.5; stroke-dasharray: 9 8; opacity: .62; }
.ring-text { font: 700 26px var(--font); fill: #16232e; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 6px; }
.home-halo { fill: #fff; stroke: #15212c; stroke-width: 4; }
.home-dot { fill: #e0162b; }
.poly-tor { fill: rgb(193 28 90 / .2); stroke: #c11c5a; stroke-width: 6; }
.poly-svr { fill: rgb(214 138 0 / .16); stroke: #c87f00; stroke-width: 5; }
.cell { fill: #5d6c78; stroke: #fff; stroke-width: 3; }
.cell-hail { fill: #0f7ea8; stroke: #fff; stroke-width: 4; }
.cell-tor { fill: #c11c5a; stroke: #fff; stroke-width: 4; }
.track { stroke: #15212c; stroke-width: 4; stroke-dasharray: 10 6; }
.cell-tor-line { stroke: #c11c5a; }
.cell-hail-line { stroke: #0f7ea8; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 13px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.k { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.k.home { background: #e0162b; border: 2px solid var(--ink); }
.k.hail { background: #0f7ea8; }
.k.tor { background: #c11c5a; }
.k.line { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed var(--ink); }

.rows { display: grid; }
.rows > li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows > li > div { display: flex; flex-direction: column; min-width: 0; }
.rows span { font-size: 12.5px; color: var(--muted); }
.storm-right, .src-state { text-align: right; align-items: flex-end; flex-shrink: 0; max-width: 55%; }
.tag { font-style: normal; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; margin-left: 4px; display: inline-block; }
.tag.danger { background: var(--shelter); }
.tag.warn { background: var(--prepare); }

.days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.days div { padding: 8px; background: var(--bg); border-radius: 6px; display: flex; flex-direction: column; min-width: 0; border-top: 3px solid var(--line); }
.days span { font-size: 12px; color: var(--muted); }
.days b { font-size: 14px; line-height: 1.15; }
.days [data-rank="2"] { border-top-color: var(--quiet); }
.days [data-rank="3"] { border-top-color: var(--watch); }
.days [data-rank="4"] { border-top-color: var(--prepare); }
.days [data-rank="5"], .days [data-rank="6"] { border-top-color: var(--warning); }
.hours { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; height: 84px; padding-top: 4px; }
.hours div { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; padding-bottom: 17px; }
.hours i { display: block; background: var(--line); border-radius: 2px 2px 0 0; min-height: 2px; max-height: 100%; }
.hours i.storm { background: var(--ink); }
.hours span { position: absolute; bottom: 0; left: 0; font-size: 10.5px; color: var(--muted); white-space: nowrap; }

.hill-num { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; font-size: 15px; }
.hill-num b { font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.hill-num span { color: var(--muted); font-size: 13px; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 6px 7px 0; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
thead th { border-top: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
tbody th span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
tr.old { opacity: .55; }

details.panel summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; min-height: 30px; }
details.panel summary span { color: var(--muted); font-size: 14px; }
.src > li { align-items: center; justify-content: flex-start; }
.src > li > div:nth-child(2) { flex: 1; }
.src a { font-size: 14.5px; font-weight: 600; text-decoration: none; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dot.ok { background: var(--quiet); }
.dot.stale { background: var(--watch); }
.dot.error, .dot.format { background: var(--warning); }

.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.link-grid a { display: flex; align-items: center; min-height: 46px; padding: 6px 10px; background: var(--bg); border-radius: 6px; font-size: 13.5px; line-height: 1.2; font-weight: 600; text-decoration: none; }
.fine p { font-size: 13.5px; color: var(--muted); }
.fine-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#change-location { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-weight: 600; }
.dash { display: grid; gap: 12px; min-width: 0; }
.dash[hidden] { display: none; }
.dash > * { min-width: 0; scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 72px); }
.setup { gap: 13px; padding: 18px; }
.setup h1 { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
.setup form { display: grid; gap: 7px; }
.setup label { font-size: 14px; font-weight: 600; margin-top: 5px; }
.setup input { width: 100%; min-width: 0; min-height: 46px; padding: 0 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.setup .primary { min-height: 50px; border: 0; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 700; }
.search-row { display: flex; gap: 8px; min-width: 0; }
.search-row input { flex: 1; }
.search-row button { flex: none; min-height: 46px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 600; }
.place-results { display: grid; gap: 6px; }
.place-results:empty { display: none; }
.place-results button { width: 100%; min-height: 44px; padding: 8px 12px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 15px; }
#setup-status:empty { display: none; }
@media (prefers-reduced-motion: no-preference) { #hero { transition: background-color .25s; } }
