/* SoCal Hazard Watch: dark glass UI (Apple / Tesla-inspired) */
:root {
  --panel-w: 380px;
  --gap: 12px;
  --radius: 18px;
  --radius-sm: 12px;

  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.72);
  --label-3: rgba(235, 235, 245, 0.46);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.16);
  --sep: rgba(84, 84, 88, 0.55);
  --glass: rgba(22, 22, 24, 0.78);
  --glass-strong: rgba(28, 28, 30, 0.86);
  --row: rgba(44, 44, 46, 0.62);

  --blue: #0a84ff;
  --red: #ff453a;
  --orange: #ff9f0a;
  --green: #30d158;
  --teal: #64d2ff;

  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--label); overflow: hidden;
  font: 14px/1.42 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { display: block; }

#map-wrap { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }

/* ---------- Glass surface ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

/* ---------- Side sheet ---------- */
.sheet { position: fixed; z-index: 3; top: var(--gap); left: var(--gap); bottom: var(--gap); width: var(--panel-w);
  border-radius: 22px; display: flex; flex-direction: column; overflow: hidden; }
.grabber { display: none; }

.brand { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 18px 12px; }
.brand h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.subtitle { color: var(--label-3); font-size: 13px; margin-top: 2px; }
.status { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--fill-2);
  color: var(--label-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: none; }
.status.live .dot { background: var(--green); animation: pulse 2.4s infinite; }
.status.error .dot { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(48,209,88,.55); } 70% { box-shadow: 0 0 0 6px rgba(48,209,88,0); } 100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); } }

/* Search */
.search { position: relative; margin: 0 14px 10px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px;
  height: 38px; border-radius: 11px; background: var(--fill); }
.search .icon { width: 17px; height: 17px; fill: none; stroke: var(--label-3); stroke-width: 2.2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; color: var(--label); font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--label-3); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.locate { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; display: grid; place-items: center; }
.locate svg { width: 16px; height: 16px; fill: var(--blue); }
.locate:hover { background: var(--fill-2); }
.search-results { position: absolute; left: 0; right: 0; top: 44px; margin: 0; padding: 6px; list-style: none; z-index: 5;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border: 0.5px solid rgba(255,255,255,.12); border-radius: 14px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; }
.search-results li { padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--label-2); }
.search-results li:hover { background: var(--fill); color: var(--label); }

/* Region pills */
.regions { display: flex; gap: 6px; padding: 0 14px 12px; overflow-x: auto; scrollbar-width: none; }
.regions::-webkit-scrollbar { display: none; }
.regions button { flex: none; padding: 6px 12px; border-radius: 999px; border: none; background: var(--fill-2); color: var(--label-2);
  font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.regions button:hover { background: var(--fill); color: var(--label); }

.scroll { flex: 1; overflow-y: auto; padding: 2px 14px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }

/* Summary hero */
.summary { margin: 2px 0 14px; padding: 16px; border-radius: var(--radius); position: relative; overflow: hidden;
  background: linear-gradient(145deg, rgba(10,132,255,.22), rgba(10,132,255,.04) 60%), var(--row); }
.summary:empty { display: none; }
.summary.warn { background: linear-gradient(145deg, rgba(255,69,58,.30), rgba(255,159,10,.06) 65%), var(--row); }
.summary .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--label-2); }
.summary .headline { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 2px; line-height: 1.15; }
.summary .when { color: var(--label-2); font-size: 14px; }
.summary .also { margin-top: 6px; font-size: 13px; color: var(--label-3); }
.summary .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.summary .stat { padding: 10px; border-radius: 12px; background: rgba(0,0,0,.25); }
.summary .stat b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.summary .stat span { font-size: 11.5px; color: var(--label-3); }

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: none;
  background: var(--fill-2); font-size: 13px; font-weight: 500; color: var(--label); transition: opacity .15s, background .15s; }
.chip:hover { background: var(--fill); }
.chip.off { opacity: .38; }
.chip b { font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,.35); }

/* Cards */
.card { margin: 0 0 14px; padding: 14px; border-radius: var(--radius); background: var(--row); }
.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.card h3 small { font-size: 12px; font-weight: 400; color: var(--label-3); }
.card p { margin: 0 0 10px; font-size: 13px; color: var(--label-2); }

.scar-risk { background: linear-gradient(145deg, rgba(255,69,58,.20), rgba(255,159,10,.05) 70%), var(--row); }
.scar-risk h3 { color: #ffb4a8; }
.scar-risk .scar-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.scar-risk button { padding: 5px 10px; border-radius: 999px; border: none; background: rgba(0,0,0,.28); font-size: 12.5px; font-weight: 500; }
.scar-risk button small { color: var(--label-3); font-weight: 400; margin-left: 2px; }
.scar-risk button:hover { background: rgba(255,69,58,.28); }

.gauge-top h3 { margin-bottom: 8px; }
.gauge-top button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 4px; border: none; background: transparent;
  text-align: left; font-size: 14px; border-top: 0.5px solid var(--sep); border-radius: 0; }
.gauge-top button:first-of-type { border-top: none; }
.gauge-top button:hover { background: rgba(255,255,255,.04); }
.gauge-top button > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gauge-top .v { margin-left: auto; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.gauge-top .hr { color: #ff9f8f; }
.gauge-top small { color: var(--label-3); font-size: 12px; }
.gauge-top > small { display: block; margin-top: 6px; }

.wind-top .arrow, .wind-row .arrow { display: inline-block; width: 16px; text-align: center; font-size: 13px; flex: none; }
.wind-top .v small { font-size: 11px; font-weight: 500; color: var(--label-3); }
.wind-legend { margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--sep); }
.wind-legend[hidden] { display: none; }
.wind-steps { margin-top: 8px; }
.gauge-legend .wind-steps i { width: auto; height: auto; box-shadow: none; font-style: normal; font-size: 12px; transform: rotate(-90deg); }

/* Alert list: inset-grouped rows */
.group { margin: 0 0 16px; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 7px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--label-2); }
.group-head .count { margin-left: auto; color: var(--label-3); font-weight: 500; }
.group-rows { border-radius: var(--radius-sm); overflow: hidden; background: var(--row); }
.alert-item { position: relative; display: block; width: 100%; text-align: left; padding: 11px 32px 11px 16px; border: none;
  background: transparent; border-top: 0.5px solid var(--sep); transition: background .12s; }
.alert-item:first-child { border-top: none; }
.alert-item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, #888); }
.alert-item::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  border-right: 2px solid var(--label-3); border-top: 2px solid var(--label-3); transform: rotate(45deg); }
.alert-item:hover { background: rgba(255,255,255,.05); }
.alert-item .area { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alert-item .meta { margin-top: 4px; font-size: 12.5px; color: var(--label-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--fill); color: var(--label-2); }
.badge.now { background: rgba(255,69,58,.22); color: #ff9f8f; }
.empty { color: var(--label-3); padding: 24px 8px; text-align: center; }

/* Detail view */
.back { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 10px; padding: 4px 2px; border: none; background: none;
  color: var(--blue); font-size: 15px; }
.detail h2 { margin: 0 0 4px; font-size: 26px; font-weight: 700; letter-spacing: -0.025em; display: flex; gap: 10px; align-items: center; }
.detail h2 .swatch { width: 14px; height: 14px; border-radius: 4px; }
.detail .sub { margin: 0 0 14px; color: var(--label-3); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.detail .sub > div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail .zoom-btn { width: 100%; margin: 0 0 16px; padding: 11px; border-radius: 12px; border: none; background: var(--blue);
  color: #fff; font-weight: 600; font-size: 15px; }
.detail .zoom-btn:hover { filter: brightness(1.1); }
.detail .sec { margin: 0 0 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--row); }
.detail .sec h4 { margin: 0 0 4px; font-size: 11.5px; letter-spacing: .07em; color: var(--label-3); font-weight: 600; }
.detail .sec p { margin: 0 0 4px; font-size: 14.5px; line-height: 1.5; }
.detail .sec ul { margin: 6px 0 0; padding-left: 18px; }
.detail .sec li { margin-bottom: 4px; font-size: 14px; color: var(--label-2); }

.disclaimer { margin-top: 18px; padding: 0 4px; font-size: 11px; color: var(--label-3); line-height: 1.5; }

/* ---------- Location detail ---------- */
.loc h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.025em; }
.loc .sub { color: var(--label-3); font-size: 12.5px; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.loc section { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--row); }
.loc section h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--label-2); font-weight: 600;
  display: flex; justify-content: space-between; gap: 8px; }
.loc section h4 span { text-transform: none; letter-spacing: 0; color: var(--label-3); font-weight: 400; font-size: 11.5px; text-align: right; }
.arow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 0.5px solid var(--sep); font-size: 14px; }
.arow:first-of-type { border-top: none; }
.arow > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.arow small { color: var(--label-3); font-size: 12px; }
.arow i { font-style: normal; color: var(--label-3); font-size: 18px; }
.arow.link { cursor: pointer; }
.ok-line { color: var(--green); font-size: 14px; }
.station-sheet h3 { margin: 4px 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.station-sheet .coords { color: var(--label-3); font-size: 12.5px; margin-bottom: 10px; }
.station-sheet .big { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--teal); }
.station-sheet .gauge { margin-top: 6px; font-size: 14px; color: var(--label-2); }
.station-sheet .gauge b { color: var(--teal); }
.station-sheet .wind-row { display: flex; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--row); font-size: 15px; }
.station-sheet .wind-row .arrow { font-size: 20px; }
.station-sheet .wind-row small { color: var(--label-3); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tile { padding: 12px; border-radius: 16px; background: var(--row); display: flex; flex-direction: column; gap: 1px; }
.tile span { font-size: 11.5px; color: var(--label-3); font-weight: 500; }
.tile b { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile b small { font-size: 14px; font-weight: 600; }
.tile > small { font-size: 11px; color: var(--label-3); }
.keys { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.key { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--row); }
.key.warn { background: linear-gradient(145deg, rgba(255,69,58,.22), rgba(255,159,10,.06) 70%), var(--row); }
.key span { font-size: 18px; line-height: 1.2; }
.key p { margin: 0; font-size: 13.5px; color: var(--label-2); line-height: 1.4; }
.key p b { color: var(--label); }
.hourly { display: flex; gap: 2px; overflow-x: auto; margin: 0 -6px; padding: 0 6px 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.hourly .hr { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px; }
.hourly .hr:first-child { background: var(--fill-2); }
.hourly .t { font-size: 11.5px; color: var(--label-3); font-weight: 600; }
.hourly .ic { font-size: 20px; line-height: 1.2; }
.hourly b { font-size: 15px; font-weight: 600; }
.hourly .pp { font-size: 11px; color: var(--teal); min-height: 14px; font-weight: 600; }
.hourly .wd { font-size: 11px; font-weight: 600; }
.hourly-loading { color: var(--label-3); font-size: 13px; }
.lchart { display: block; overflow: visible; }
.lchart text { font-family: var(--font); }
.lchart .ax { font-size: 9.5px; fill: var(--label-3); }
.lchart .ax.mid { text-anchor: middle; }
.lchart .ax.end { text-anchor: end; }
.lchart .day { stroke: rgba(235,235,245,.22); stroke-width: 1; }
.lchart .now { stroke: rgba(255,255,255,.7); stroke-width: 1.2; stroke-dasharray: 2 3; }
.lchart .ref { stroke: rgba(255,159,10,.5); stroke-width: 1; stroke-dasharray: 4 3; }
.lchart .val { font-size: 10px; fill: var(--label); text-anchor: middle; font-weight: 600; }
.lchart .cum { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.5; stroke-dasharray: 3 2; }
.lchart .gust-area { fill: rgba(255,159,10,.22); stroke: rgba(255,159,10,.75); stroke-width: 1; }
.lchart .wind-line { fill: none; stroke: #64d2ff; stroke-width: 2; stroke-linejoin: round; }
.lchart .warrow { font-size: 10px; text-anchor: middle; }
.lchart .temp-line { fill: none; stroke: #ff9f0a; stroke-width: 2; stroke-linejoin: round; }
.lchart .pop-area { fill: rgba(100,210,255,.25); stroke: #64d2ff; stroke-width: 1.5; }
.lchart .band { font-size: 10.5px; fill: #fff; font-weight: 600; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 2.5px; }
.days { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.days .day { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.2); }
.days .dn { font-size: 12px; color: var(--label-3); font-weight: 600; }
.days .ic { font-size: 24px; }
.days b { font-size: 20px; font-weight: 700; }
.days .sf { font-size: 12px; color: var(--label-2); line-height: 1.3; }
.days .dm { font-size: 11px; color: var(--label-3); }
.pop .more-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 12px; padding: 10px; border: none;
  border-radius: 12px; background: var(--blue); color: #fff; font-weight: 600; font-size: 14px; }
.pop .more-btn span { font-size: 18px; line-height: 1; }
.pop .more-btn:hover { filter: brightness(1.1); }

/* ---------- Toolbar (layers) ---------- */
.toolbar { position: fixed; z-index: 2; top: var(--gap); right: 60px; display: flex; align-items: center; gap: 4px; padding: 5px;
  border-radius: 14px; }
.divider { width: 0.5px; height: 22px; background: var(--sep); margin: 0 4px; flex: none; }

.segmented { position: relative; display: flex; padding: 2px; border-radius: 9px; background: var(--fill); flex: none; }
.segmented button { position: relative; padding: 5px 11px; border: none; border-radius: 7px; background: transparent;
  color: var(--label-2); font-size: 13px; font-weight: 500; transition: color .15s, background .2s, box-shadow .2s; white-space: nowrap; }
.segmented button:hover { color: var(--label); }
.segmented button.on { background: #636366; color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.seg-sep { width: 0.5px; margin: 5px 3px; background: var(--sep); flex: none; }
.qpf-steps { display: flex; gap: 9px; margin-top: 8px; }
.qpf-steps[hidden] { display: none; }
.qpf-steps span { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.qpf-steps i { width: 16px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.5); }
#rain-img[hidden] { display: none; }
.segmented.small button { padding: 4px 9px; font-size: 12px; }

.toggle { display: flex; cursor: pointer; user-select: none; flex: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--label-3); transition: background .15s, color .15s; white-space: nowrap; }
.toggle span:hover { background: var(--fill-2); color: var(--label-2); }
.toggle input:checked + span { color: var(--label); background: var(--fill); }
.toggle input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ---------- Radar timeline ---------- */
.radar-bar, .rain-legend { position: fixed; z-index: 2; bottom: 30px; left: calc(var(--panel-w) + var(--gap) + (100vw - var(--panel-w) - var(--gap)) / 2);
  transform: translateX(-50%); }
.radar-bar { display: flex; align-items: center; gap: 14px; padding: 8px 18px 8px 8px; border-radius: 999px; }
.radar-bar[hidden], .rain-legend[hidden], .gauge-legend[hidden] { display: none; }
.play { width: 38px; height: 38px; border-radius: 50%; border: none; background: #fff; display: grid; place-items: center; flex: none;
  transition: transform .12s; }
.play:active { transform: scale(.94); }
.play svg { width: 16px; height: 16px; fill: #000; }
.play .i-play { display: none; margin-left: 2px; }
.play.paused .i-play { display: block; }
.play.paused .i-pause { display: none; }
.radar-time { display: flex; flex-direction: column; min-width: 84px; line-height: 1.15; }
.radar-time span { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.radar-time small { color: var(--label-3); font-size: 12px; }
#radar-scrub { -webkit-appearance: none; appearance: none; width: 240px; height: 4px; border-radius: 4px; background-color: var(--fill); outline: none;
  background-image: linear-gradient(var(--blue), var(--blue)); background-repeat: no-repeat; background-size: var(--p, 100%) 100%; }
#radar-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: grab; }
#radar-scrub::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: grab; }

.radar-bar { border-radius: 22px; padding: 9px 18px 9px 9px; }
.radar-right { display: flex; flex-direction: column; gap: 7px; }
.radar-key { position: relative; display: grid; grid-template-columns: 25fr 25fr 17fr 33fr; width: 240px; padding-top: 7px;
  font-size: 10.5px; color: var(--label-3); letter-spacing: 0; }
.radar-key span:nth-child(3), .radar-key span:nth-child(4) { text-align: center; }
.radar-key span:nth-child(2) { text-align: left; }
.radar-key span:last-child { text-align: right; }
/* 10 to 70 dBZ, IEM N0Q palette */
.radar-key .bar { position: absolute; left: 0; right: 0; top: 0; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, rgb(69,104,166), rgb(96,180,212) 8.3%, rgb(67,214,126) 16.7%, rgb(14,179,20) 25%,
    rgb(11,132,14) 33.3%, rgb(50,115,8) 41.7%, rgb(255,226,0) 50%, rgb(255,172,0) 58.3%, rgb(248,0,0) 66.7%,
    rgb(170,0,0) 75%, rgb(255,234,255) 83.3%, rgb(249,96,250) 91.7%, rgb(164,0,247)); }
.rain-legend { padding: 10px 14px 12px; border-radius: 16px; }
.tl-time { min-width: 150px; }
#tl-scrub { -webkit-appearance: none; appearance: none; width: 240px; height: 4px; border-radius: 4px; background-color: var(--fill); outline: none;
  background-image: linear-gradient(var(--blue), var(--blue)); background-repeat: no-repeat; background-size: var(--p, 0%) 100%; }
#tl-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: grab; }
#tl-scrub::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: grab; }
.tl-ticks { display: flex; width: 240px; justify-content: space-between; }
.tl-ticks span { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 0; font-size: 10.5px; color: var(--label-3); white-space: nowrap; }
.tl-ticks i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.5); transition: transform .15s; }
.tl-ticks span.on i { transform: scale(1.5); box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.tl-ticks span.on { color: var(--label); }
.tl-bar[hidden] { display: none; }
.rain-legend.above { bottom: 104px; }
.rain-legend img { display: block; border-radius: 6px; margin-top: 6px; }

/* ---------- Gauge legend ---------- */
.gauge-legend { position: fixed; z-index: 2; right: var(--gap); bottom: 36px; padding: 12px 14px; border-radius: 16px; }
.legend-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.legend-title small { color: var(--label-3); font-size: 11.5px; }
.gauge-legend .segmented { margin: 9px 0 10px; }
.gauge-legend .steps { display: flex; gap: 8px; margin-bottom: 8px; }
.gauge-legend .steps span { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.gauge-legend .steps i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.6); }
.ring-note { display: flex; align-items: center; gap: 6px; color: var(--label-3); font-size: 11.5px; }
.ring { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; }

.flow-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }
.flow-note { display: block; margin-top: 2px; color: var(--label-3); font-size: 11px; }
.flow-note[hidden] { display: none; }

/* ---------- Map hint, credit, toast ---------- */
.map-hint { position: fixed; z-index: 2; top: 66px; right: 60px; padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--label-2);
  pointer-events: none; transition: opacity .6s; }
.credit { position: fixed; z-index: 1; right: 40px; bottom: 10px; font-size: 10.5px; color: var(--label-3); padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.45); }
.credit a { color: inherit; text-decoration: none; }
.credit a:hover { color: var(--label); }
.toast { position: fixed; z-index: 10; top: 16px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px;
  background: rgba(58, 18, 20, .9); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 0.5px solid rgba(255,69,58,.5);
  color: #ffd0cc; font-size: 13px; box-shadow: var(--shadow); }

/* ---------- MapLibre controls ---------- */
.maplibregl-ctrl-group { background: var(--glass) !important; -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border: 0.5px solid rgba(255,255,255,.12); border-radius: 12px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group button + button { border-top: 0.5px solid var(--sep) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.maplibregl-ctrl-group button:hover { background: rgba(255,255,255,.06) !important; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: var(--gap) var(--gap) 0 0; }
.maplibregl-ctrl-scale { background: rgba(0,0,0,.45) !important; color: var(--label-2) !important; border-color: var(--label-3) !important; font-size: 10px; }
.maplibregl-ctrl-attrib { background: rgba(0,0,0,.7) !important; color: var(--label-3); max-width: min(520px, 60vw); }
.maplibregl-ctrl-attrib a { color: var(--label-2) !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 22px; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }

/* ---------- Popups ---------- */
.maplibregl-popup-content { background: var(--glass-strong); -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
  color: var(--label); border: 0.5px solid rgba(255,255,255,.14); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow);
  min-width: 280px; max-width: 340px; font-family: var(--font);
  max-height: 46vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--glass-strong) !important; }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--glass-strong) !important; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--glass-strong) !important; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--glass-strong) !important; }
.maplibregl-popup-close-button { top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--fill); color: var(--label-2);
  font-size: 17px; line-height: 24px; padding: 0; }
.maplibregl-popup-close-button:hover { background: rgba(118,118,128,.4); color: var(--label); }
.pop h3 { margin: 0 32px 2px 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.pop .coords { color: var(--label-3); font-size: 12px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.pop .row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; border-top: 0.5px solid var(--sep); }
.pop .coords + .row { border-top: none; }
.pop .row small { color: var(--label-3) !important; font-size: 12px; }
.pop .row .swatch { width: 12px; height: 12px; border-radius: 4px; }
.pop .row.link { cursor: pointer; }
.pop .row.link:hover b { color: var(--blue); }
.pop .ok { color: var(--green); font-size: 14px; font-weight: 500; padding: 4px 0; }
.pop .scar { margin-top: 10px; padding: 9px 11px; border-radius: 12px; font-size: 13px; line-height: 1.45;
  background: rgba(255,69,58,.16); color: #ffd6d0; }
.pop .scar.far { background: var(--fill-2); color: var(--label-2); }
.pop .gauge { margin-top: 8px; font-size: 13px; color: var(--label-2); line-height: 1.45; }
.pop .gauge b { color: var(--teal); font-variant-numeric: tabular-nums; }
.pop .big { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--teal); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pop .wind-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 9px 11px; border-radius: 12px; background: var(--fill-2); font-size: 13.5px; }
.pop .wind-row .arrow { font-size: 18px; line-height: 1.2; }
.pop .wind-row small { color: var(--label-3); }
.pop .rain { margin-top: 8px; font-size: 13px; color: var(--label-2); display: flex; gap: 10px; flex-wrap: wrap; }
.pop .rain b { color: var(--teal); }
.pop .fx { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--fill-2); }
.pop .fx-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.pop .fx-head small { color: var(--label-3); font-size: 11px; }
.pop .fx-tot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 6px; }
.pop .fx-tot div { display: flex; flex-direction: column; }
.pop .fx-tot span { font-size: 11px; color: var(--label-3); }
.pop .fx-tot b { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pop .fx-tot b small { font-size: 11px; font-weight: 500; color: var(--label-3); }
.pop .fx-chart { display: block; overflow: visible; }
.pop .fx-chart text { font-family: var(--font); fill: var(--label-3); }
.pop .fx-chart .amt { font-size: 9px; fill: var(--label-2); text-anchor: middle; font-weight: 600; }
.pop .fx-chart .pp { font-size: 8.5px; text-anchor: middle; fill: rgba(100,210,255,.75); }
.pop .fx-chart .tl { font-size: 9px; }
.pop .fx-note { margin-top: 6px; font-size: 12px; color: var(--label-2); }
.pop .fx-note b { color: var(--label); }
.pop .fc { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--sep); font-size: 13px; }
.pop .fc b { font-weight: 600; }
.pop .fc p { margin: 3px 0 10px; color: var(--label-2); line-height: 1.45; }
.pop .fc p:last-child { margin-bottom: 0; }

/* Below ~1540px the bottom-center bar (about 460px) and the gauge legend (about 330px) can't sit side by side */
@media (max-width: 1540px) and (min-width: 821px) {
  .gauge-legend { bottom: 112px; }
}

/* ---------- Narrow screens: bottom sheet ---------- */
@media (max-width: 820px) {
  :root { --panel-w: 0px; --sheet-h: 46vh; --sheet-h: 46dvh; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h); border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom); transition: height .3s ease; }
  .sheet.expanded { height: 64vh; height: 64dvh; }
  /* Place card open: give the sheet's full height to the card */
  .sheet.expanded .brand, .sheet.expanded .search, .sheet.expanded .regions { display: none; }
  .sheet.expanded #detail-view { padding-top: 6px; }
  .grabber { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 8px auto 0; }
  .brand { padding: 8px 16px 10px; }
  .brand h1 { font-size: 22px; }
  /* Toolbar: two rows across the full width; pinch-zoom replaces the zoom buttons */
  .maplibregl-ctrl-top-right { display: none; }
  .toolbar { left: var(--gap); right: var(--gap); top: max(var(--gap), env(safe-area-inset-top)); flex-wrap: wrap; justify-content: space-between; row-gap: 5px; }
  .toolbar .segmented#precip { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar .segmented#precip::-webkit-scrollbar { display: none; }
  .toolbar .segmented#precip button { flex: 1 0 auto; padding: 6px 10px; }
  .toolbar .divider { display: none; }
  .toggle span { padding: 5px 8px; font-size: 12.5px; }
  /* Bottom bars float just above the sheet; hidden when the sheet is expanded */
  .radar-bar, .rain-legend { left: 50%; bottom: calc(var(--sheet-h) + 22px); max-width: calc(100vw - 24px); }
  .rain-legend.above { bottom: calc(var(--sheet-h) + 94px); }
  .radar-bar { gap: 10px; padding: 7px 14px 7px 7px; }
  .play { width: 34px; height: 34px; }
  .radar-time { min-width: 70px; }
  .radar-time span { font-size: 15px; }
  #radar-scrub, .radar-key, #tl-scrub, .tl-ticks { width: 140px; }
  .tl-time { min-width: 96px; }
  .radar-key span:nth-child(3), .radar-key span:nth-child(4) { visibility: hidden; }
  body:has(.sheet.expanded) .radar-bar, body:has(.sheet.expanded) .rain-legend, body:has(.sheet.expanded) .credit { display: none; }
  .gauge-legend { display: none; }
  .map-hint { display: none; }
  .credit { bottom: calc(var(--sheet-h) + 2px); right: 6px; }
  .summary .stat span { font-size: 11px; }
  .summary .headline { font-size: 24px; }
}
