/* ============ NG Weather ============ */
:root {
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 18px;
  --t: 1.2s ease;
  /* Theme defaults (partly-cloudy) — overridden per weather theme below */
  --sky1: #5d8fc9; --sky2: #9cc1e6; --sky3: #dbe8f5;
  --card: rgba(255, 255, 255, .58); --card-strong: rgba(255, 255, 255, .78); --border: rgba(255, 255, 255, .55);
  --text: #10223b; --muted: rgba(16, 34, 59, .66); --accent: #1f6fe0; --accent-text: #fff; --warn: #c2410c;
  --grid: rgba(16, 34, 59, .12); --line1: #e8590c; --line2: #1f6fe0; --bar: rgba(31, 111, 224, .45);
  --sun: .55; --clouds: .75; --cloud: #ffffff; --fog: 0; --shadow: 0 10px 30px rgba(15, 35, 70, .15);
  --cloud-speed: 120s;
}

body[data-theme="sunny"]   { --sky1:#2f80d8; --sky2:#6cb6f2; --sky3:#cde8ff; --sun:1; --clouds:.12; --line2:#1f6fe0; }
body[data-theme="hot"]     { --sky1:#f0762b; --sky2:#ffb347; --sky3:#ffe6a3; --text:#3a1800; --muted:rgba(58,24,0,.66); --accent:#d9480f; --sun:1; --clouds:0; --grid:rgba(58,24,0,.12); --bar:rgba(217,72,15,.4); }
body[data-theme="partly-cloudy"] { --sun:.6; --clouds:.75; }
body[data-theme="windy"]   { --sky1:#4f86c6; --sky2:#86b3e0; --sky3:#c6dcf0; --sun:.4; --clouds:.7; --cloud-speed:28s; }
body[data-theme="cloudy"]  { --sky1:#66737f; --sky2:#8f9aa6; --sky3:#c1c8d0; --text:#151d26; --muted:rgba(21,29,38,.68); --accent:#3c5a7a; --sun:0; --clouds:1; --cloud:#e9edf1; --card:rgba(255,255,255,.5); }
body[data-theme="fog"]     { --sky1:#8f98a0; --sky2:#b3bac0; --sky3:#d9dde0; --text:#1b232a; --muted:rgba(27,35,42,.66); --accent:#4a5d70; --sun:0; --clouds:.4; --fog:.95; }
body[data-theme="marine-layer"] { --sky1:#5f7689; --sky2:#8ea4b5; --sky3:#c3d1dc; --text:#12212d; --muted:rgba(18,33,45,.66); --accent:#2f5d80; --sun:.1; --clouds:.6; --cloud:#dfe7ee; --fog:.8; }
body[data-theme="frigid"]  { --sky1:#8dbbe6; --sky2:#c8e1f6; --sky3:#f2f8ff; --text:#0f2236; --accent:#2563a6; --sun:.5; --clouds:.1; }
body[data-theme="snow"]    { --sky1:#a3b3c4; --sky2:#ccd6e0; --sky3:#eef3f7; --text:#132132; --muted:rgba(19,33,50,.66); --accent:#3b6aa3; --sun:0; --clouds:.9; --cloud:#f4f7fa; --card:rgba(255,255,255,.6); }

/* Dark themes */
body[data-theme="clear-night"], body[data-theme="partly-cloudy-night"], body[data-theme="drizzle"], body[data-theme="rain"],
body[data-theme="heavy-rain"], body[data-theme="storm"], body[data-theme="sleet"] {
  --card: rgba(12, 20, 36, .52); --card-strong: rgba(12, 20, 36, .78); --border: rgba(255, 255, 255, .12);
  --text: #eaf1fb; --muted: rgba(234, 241, 251, .66); --accent: #6ea8ff; --accent-text: #08142a;
  --grid: rgba(234, 241, 251, .12); --line1: #ffa94d; --line2: #74c0fc; --bar: rgba(116, 192, 252, .45); --warn: #ffa94d;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); --sun: 0;
}
body[data-theme="clear-night"] { --sky1:#030817; --sky2:#0b1c3d; --sky3:#1a3363; --clouds:0; }
body[data-theme="partly-cloudy-night"] { --sky1:#081429; --sky2:#1a2f52; --sky3:#2f4a73; --clouds:.45; --cloud:#5b6f8c; }
body[data-theme="drizzle"] { --sky1:#4b5967; --sky2:#6b7987; --sky3:#929fac; --clouds:.9; --cloud:#a6b1bc; --fog:.25; }
body[data-theme="rain"]    { --sky1:#28323d; --sky2:#3f4c59; --sky3:#5d6a77; --clouds:1; --cloud:#7a8794; }
body[data-theme="heavy-rain"] { --sky1:#161d25; --sky2:#26303b; --sky3:#3a4652; --clouds:1; --cloud:#5a6773; --fog:.3; }
body[data-theme="storm"]   { --sky1:#0c0a18; --sky2:#221a36; --sky3:#3a2f4f; --clouds:1; --cloud:#4a4060; --accent:#b197fc; }
body[data-theme="sleet"]   { --sky1:#3f4c5a; --sky2:#64727f; --sky3:#8e9aa5; --clouds:1; --cloud:#a9b3bc; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); color: var(--text);
  background: linear-gradient(180deg, var(--sky1), var(--sky2) 55%, var(--sky3));
  background-attachment: fixed; transition: color var(--t);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; margin-top: 1.2em; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; }

/* ---------- Sky / effects ---------- */
#sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#sky::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--sky1), var(--sky2) 55%, var(--sky3)); transition: opacity var(--t); }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; }
.sun { position: absolute; top: -140px; right: -80px; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,247,200,.95) 0 14%, rgba(255,220,120,.55) 22%, rgba(255,200,90,.18) 45%, transparent 68%);
  opacity: var(--sun); transition: opacity var(--t); animation: pulse 8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.clouds { position: absolute; inset: 0; opacity: var(--clouds); transition: opacity var(--t); }
.clouds i { position: absolute; display: block; width: 520px; height: 160px; border-radius: 100px; background: var(--cloud);
  filter: blur(28px); opacity: .75; animation: drift var(--cloud-speed) linear infinite; }
.clouds i:nth-child(1) { top: 4%;  left: -30%; animation-duration: calc(var(--cloud-speed) * 1.0); }
.clouds i:nth-child(2) { top: 16%; left: -60%; width: 680px; animation-duration: calc(var(--cloud-speed) * 1.3); animation-delay: -40s; }
.clouds i:nth-child(3) { top: 30%; left: -40%; width: 420px; animation-duration: calc(var(--cloud-speed) * .9); animation-delay: -70s; opacity: .55; }
.clouds i:nth-child(4) { top: 48%; left: -50%; width: 760px; animation-duration: calc(var(--cloud-speed) * 1.5); animation-delay: -20s; opacity: .45; }
.clouds i:nth-child(5) { top: 64%; left: -30%; animation-duration: calc(var(--cloud-speed) * 1.1); animation-delay: -95s; opacity: .35; }
.clouds i:nth-child(6) { top: 10%; left: -45%; width: 600px; animation-duration: calc(var(--cloud-speed) * 1.7); animation-delay: -60s; opacity: .5; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(220vw); } }
.fog { position: absolute; inset: 0; opacity: var(--fog); transition: opacity var(--t); }
.fog i { position: absolute; left: -50%; width: 200%; height: 40%; background: linear-gradient(180deg, transparent, rgba(235,240,244,.75), transparent);
  filter: blur(18px); animation: fog 60s ease-in-out infinite alternate; }
.fog i:nth-child(1) { top: 20%; }
.fog i:nth-child(2) { top: 45%; animation-duration: 80s; animation-delay: -20s; }
.fog i:nth-child(3) { top: 70%; animation-duration: 70s; animation-delay: -35s; }
@keyframes fog { to { transform: translateX(20%); } }
.flash { position: absolute; inset: 0; background: rgba(230, 225, 255, .85); opacity: 0; }
.flash.on { animation: flash .9s ease-out; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: .9; } 16% { opacity: .1; } 24% { opacity: .7; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .clouds i, .fog i, .sun { animation: none; } }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 1000; display: flex; gap: 14px; align-items: center; padding: 10px 20px;
  background: var(--card-strong); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand b { display: block; font-size: 1.1rem; letter-spacing: .2px; }
.brand small { display: block; font-size: .7rem; color: var(--muted); margin-top: -2px; }
.search { position: relative; flex: 1; display: flex; gap: 6px; max-width: 720px; }
.search input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; }
.search input::placeholder { color: var(--muted); }
.btn { padding: 9px 16px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.icon-btn { display: grid; place-items: center; width: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.suggest { position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--card-strong);
  backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent); color: var(--accent-text); }
.suggest li small { opacity: .7; margin-left: 6px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.units { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.units button { padding: 6px 10px; border: 0; background: transparent; cursor: pointer; }
.units button.active { background: var(--accent); color: var(--accent-text); }
.live { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: #999; }
.live.on .dot { background: #2fb344; box-shadow: 0 0 0 0 rgba(47,179,68,.6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(47,179,68,0); } }

.subnav { position: sticky; top: 61px; z-index: 900; background: var(--card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.sections { display: flex; gap: 4px; overflow-x: auto; padding: 6px 20px; scrollbar-width: none; }

/* Nearby towns strip (sports-tab style pills) */
.towns-wrap { position: relative; display: flex; align-items: center; border-top: 1px solid var(--border); }
.towns { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 8px 20px; scrollbar-width: none; flex: 1; }
.towns::-webkit-scrollbar { display: none; }
.town { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 999px; cursor: pointer;
  background: var(--card-strong); color: var(--text); border: 1px solid var(--border); font: inherit; font-weight: 700; font-size: .86rem; white-space: nowrap;
  transition: background .15s, color .15s, transform .1s; }
.town:hover { transform: translateY(-1px); border-color: var(--accent); }
.town.active { background: var(--text); color: var(--sky1); border-color: transparent; }
.town .ti { width: 22px; height: 22px; display: inline-block; }
.town .ti svg { width: 100%; height: 100%; }
.town .tt { font-variant-numeric: tabular-nums; opacity: .9; }
.town.home { padding-left: 12px; }
.town .tk { font-size: .68rem; font-weight: 600; opacity: .6; text-transform: uppercase; letter-spacing: .4px; }
.towns-arrow { position: absolute; top: 0; bottom: 0; z-index: 2; width: 34px; border: 0; font-size: 1.4rem; font-weight: 700; cursor: pointer; color: var(--text); }
.towns-arrow.left { left: 0; background: linear-gradient(90deg, var(--card-strong) 55%, transparent); }
.towns-arrow.right { right: 0; background: linear-gradient(270deg, var(--card-strong) 55%, transparent); }
.towns-arrow[disabled] { opacity: 0; pointer-events: none; }
html { scroll-padding-top: 170px; }
.sections a { padding: 5px 12px; border-radius: 999px; text-decoration: none; color: var(--text); font-size: .85rem; white-space: nowrap; }
.sections a:hover { background: var(--card-strong); }

main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); box-shadow: var(--shadow); transition: background var(--t); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.loading { padding: 20px; color: var(--muted); }
.loading::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 8px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Welcome ---------- */
.welcome { text-align: center; padding: 12vh 10px; max-width: 760px; margin: 0 auto; }
.welcome h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.welcome p { font-size: 1.1rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); cursor: pointer; text-decoration: none; color: var(--text); font-size: .88rem; }
.chip:hover { background: var(--accent); color: var(--accent-text); }
#sources .chips { justify-content: flex-start; }

/* ---------- Alerts ---------- */
.alert { border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; background: rgba(220, 38, 38, .88); color: #fff; box-shadow: var(--shadow); }
.alert.moderate { background: rgba(234, 88, 12, .9); }
.alert.minor { background: rgba(202, 138, 4, .92); }
.alert summary { cursor: pointer; font-weight: 700; }
.alert pre { white-space: pre-wrap; font: inherit; font-size: .88rem; margin: 8px 0 0; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.where h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.sub { color: var(--muted); }
.temp-row { display: flex; align-items: center; gap: 16px; margin: 10px 0; }
.cond-icon { width: 96px; height: 96px; }
.cond-icon svg { width: 100%; height: 100%; }
.big-temp { font-size: clamp(4rem, 10vw, 6.5rem); font-weight: 200; line-height: .9; letter-spacing: -3px; }
.big-temp sup { font-size: .35em; vertical-align: top; letter-spacing: 0; position: relative; top: .35em; }
.cond { font-size: 1.25rem; font-weight: 600; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: .8rem; background: var(--card-strong); border: 1px solid var(--border); }
.badge.good { background: rgba(47,179,68,.85); color: #fff; border: 0; }
.badge.mid { background: rgba(234,179,8,.9); color: #222; border: 0; }
.badge.bad { background: rgba(220,38,38,.85); color: #fff; border: 0; }
.nowcast h3 { margin-top: 0; }

/* ---------- Metric tiles ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); min-height: 118px; }
.tile .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; justify-content: space-between; }
.tile .value { font-size: 1.7rem; font-weight: 600; margin: 4px 0 2px; }
.tile .value small { font-size: .55em; font-weight: 500; color: var(--muted); }
.tile .detail { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.tile.wide { grid-column: span 2; }
.meter { height: 6px; border-radius: 4px; background: var(--grid); margin: 8px 0 4px; position: relative; overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.aqi-scale { background: linear-gradient(90deg, #00e400, #ffff00 20%, #ff7e00 40%, #ff0000 60%, #8f3f97 80%, #7e0023); }
.aqi-scale > span { background: transparent; border-right: 3px solid var(--text); }
.compass { width: 54px; height: 54px; float: right; }
.sun-arc { width: 100%; height: 70px; }

/* ---------- Forecast ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: .85rem; }
.tabs button.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.metric-picker { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 10px; }
.metric-picker button { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: .8rem; }
.metric-picker button.active { outline: 2px solid var(--accent); }
.chart-box { position: relative; height: 300px; }
.chart-box.short { height: 150px; }
.custom-window { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.custom-window input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-strong); color: var(--text); font: inherit; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; scroll-snap-type: x proximity; }
.fc { flex: 0 0 auto; min-width: 104px; padding: 10px; border-radius: 14px; background: var(--card-strong); border: 1px solid var(--border); text-align: center; scroll-snap-align: start; font-size: .82rem; }
.fc.daily { min-width: 132px; }
.fc .t { font-weight: 600; }
.fc .ic { width: 42px; height: 42px; margin: 4px auto; }
.fc .hi { font-size: 1.15rem; font-weight: 700; }
.fc .lo { color: var(--muted); }
.fc .pp { color: var(--line2); font-weight: 600; }
.fc .mini { color: var(--muted); font-size: .75rem; line-height: 1.4; margin-top: 4px; }
.fc.outlook { opacity: .82; border-style: dashed; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.grid th, table.grid td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.grid th { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
table.grid tr.consensus td { font-weight: 700; background: var(--card-strong); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.daily td { text-align: center; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.status.ok, .status.live { background: rgba(47,179,68,.18); color: #1f8a33; }
.status.needs-key { background: rgba(234,179,8,.22); color: #8a6a00; }
.status.link-only, .status.shared, .status.no-coverage { background: rgba(100,116,139,.2); color: var(--muted); }
.status.error { background: rgba(220,38,38,.2); color: #c53030; }
body[data-theme="clear-night"] .status.ok, body[data-theme="rain"] .status.ok, body[data-theme="storm"] .status.ok, body[data-theme="heavy-rain"] .status.ok,
body[data-theme="partly-cloudy-night"] .status.ok, body[data-theme="drizzle"] .status.ok, body[data-theme="sleet"] .status.ok { color: #69db7c; }
.dev { font-size: .75rem; color: var(--muted); }
.dev.hi { color: var(--warn); font-weight: 600; }

/* ---------- Map ---------- */
.map { height: 440px; border-radius: 14px; overflow: hidden; margin: 6px 0 10px; border: 1px solid var(--border); }
.leaflet-container { font: inherit; background: #aac; }
.st-marker { border-radius: 10px; padding: 2px 6px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.4); text-align: center; }
.st-marker.nws { background: #1f6fe0; }
.st-marker.pws { background: #7048e8; }
.st-marker.buoy { background: #0c8599; }
.st-marker.tide { background: #2b8a3e; }
.st-marker.usgs { background: #a05a00; }
.st-marker.cam { background: #c2255c; }
.st-marker.here { background: #e8590c; }

/* ---------- Station picker ---------- */
.station-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .95fr); gap: 14px; align-items: stretch; }
.station-layout .map { height: 520px; margin: 0; }
.station-list-wrap, .station-detail { background: var(--card-strong); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; min-height: 0; height: 520px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.small-tabs button { padding: 3px 9px; font-size: .76rem; }
.hide-stale { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.station-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.station-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--grid); cursor: pointer; border-radius: 8px; }
.station-list li:hover { background: var(--card); }
.station-list li.selected { background: var(--accent); color: var(--accent-text); }
.station-list li.selected .dev, .station-list li.selected .st-sub { color: inherit; opacity: .85; }
.station-list .st-ic { font-size: 15px; text-align: center; grid-row: span 2; }
.station-list .st-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-list .st-temp { font-weight: 700; font-size: 1rem; grid-row: span 2; text-align: right; font-variant-numeric: tabular-nums; }
.station-list .st-sub { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-list li.mode { grid-template-columns: 22px 1fr auto; }
.station-list li.mode.selected { background: var(--accent); color: var(--accent-text); }
.station-list li.mode .st-name { font-weight: 700; }
.station-list li.stale { opacity: .55; }
.station-detail { overflow-y: auto; }
.station-detail .sd-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.station-detail h3 { margin: 4px 0 2px; font-size: 1.25rem; color: var(--accent); }
.station-detail .sd-big { font-size: 2.6rem; font-weight: 300; line-height: 1; margin: 8px 0 4px; }
.station-detail .chart-box { height: 150px; margin-top: 8px; }
.qc { font-size: .7rem; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.qc.ok { background: rgba(47,179,68,.2); color: #2b8a3e; }
.qc.suspect { background: rgba(220,38,38,.2); color: #c92a2a; }
.qc.stale { background: rgba(100,116,139,.25); color: var(--muted); }
.station-line { margin-top: 8px; font-size: .95rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.station-line b { color: var(--accent); }
.station-line a { font-weight: 700; text-decoration: none; text-transform: uppercase; font-size: .82rem; letter-spacing: .4px; }
.tpin { position: relative; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.9); cursor: pointer; }
.tpin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.tpin.sel { width: 42px; height: 42px; border: 3px solid #111; z-index: 1000; }
.tpin.sel span { font-size: 14px; }
.tpin.suspect { border-style: dashed; opacity: .75; }
.tpin.stale { filter: grayscale(1); opacity: .6; }
.tpin.airport { border-radius: 50% 50% 50% 0; outline: 2px solid rgba(255,255,255,.4); }
.here-pin { width: 18px; height: 18px; border-radius: 50%; background: #e8590c; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(232,89,12,.4), 0 2px 6px rgba(0,0,0,.4); }
@media (max-width: 1100px) {
  .station-layout { grid-template-columns: 1fr 1fr; }
  .station-layout .map { grid-column: 1 / -1; height: 400px; }
  .station-list-wrap, .station-detail { height: 460px; }
}
@media (max-width: 700px) {
  .station-layout { grid-template-columns: 1fr; }
  .station-list-wrap { height: 380px; }
  .station-detail { height: auto; }
}

/* ---------- Water ---------- */
.water-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.panel { background: var(--card-strong); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.panel h3 { margin-top: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.surf-rating { font-size: 1.6rem; font-weight: 700; }
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cam { border-radius: 12px; overflow: hidden; background: #000; position: relative; }
.cam img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.cam span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; }

/* ---------- History ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.summary-grid div { background: var(--card-strong); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.summary-grid b { display: block; font-size: 1.25rem; }
.summary-grid span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.table-details summary { cursor: pointer; margin: 8px 0; }

/* ---------- NWS ---------- */
.periods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.period { background: var(--card-strong); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: .86rem; }
.period b { display: block; margin-bottom: 4px; }
#afd summary { cursor: pointer; margin-top: 14px; font-weight: 600; }
#afd pre { white-space: pre-wrap; font-size: .8rem; max-height: 520px; overflow: auto; background: var(--card-strong); padding: 12px; border-radius: 12px; }

/* ---------- Sources ---------- */
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.source-list div { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 12px; background: var(--card-strong); border-radius: 10px; font-size: .85rem; border: 1px solid var(--border); }
.foot { max-width: 1280px; margin: 0 auto; padding: 0 20px 30px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .top-actions { margin-left: auto; }
  .subnav { top: 108px; }
  .sections { padding: 6px 16px; }
  .towns { padding: 8px 16px; }
  .towns-arrow { display: none; }
  main { padding: 14px 16px 30px; }
  .tile.wide { grid-column: span 1; }
  .map { height: 340px; }
}
@media (max-width: 520px) {
  .search .btn { display: none; }
  .live .txt { display: none; }
  .chart-box { height: 240px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .tile .value { font-size: 1.35rem; }
}

/* Switching between nearby places: keep the page, fade it until new data lands */
#content { transition: opacity .25s ease; }
#content.switching { opacity: .45; pointer-events: none; }
