:root {
  color-scheme: light;
  --brand-blue: #00aef5;
  --brand-blue-deep: #0098d7;
  --brand-violet: #5846d1;
  --brand-violet-soft: #7868e6;
  --ink: #181818;
  --text: #2f3942;
  --muted: #71808c;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-solid: #ffffff;
  --surface-soft: #f4f8fb;
  --line: rgba(24, 24, 24, 0.10);
  --line-strong: rgba(88, 70, 209, 0.18);
  --shadow: 0 18px 48px rgba(23, 43, 58, 0.18);
  --shadow-soft: 0 8px 28px rgba(23, 43, 58, 0.13);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  background: #dfeaf0;
  color: var(--text);
  font-family: 'Montserrat', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }

.radar-shell, .map { position: fixed; inset: 0; }
.map { z-index: 0; background: #dce8ee; }
.app-surface {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.startup-cover {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.24), transparent 28%),
    radial-gradient(circle at 78% 76%, rgba(255,255,255,.14), transparent 30%),
    linear-gradient(135deg, #5846d1 0%, #3979de 48%, #00aef5 100%);
  transition: opacity .35s ease, visibility .35s ease;
}
.startup-cover__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(13, 35, 49, .12), rgba(13, 35, 49, 0));
}
.startup-cover__content {
  position: relative;
  z-index: 1;
  width: min(500px, calc(100vw - 40px));
  display: grid;
  justify-items: center;
  gap: 7px;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .18);
}
.startup-cover__content strong {
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: clamp(30px, 5vw, 52px);
  line-height: .98;
  font-weight: 800;
  letter-spacing: -.025em;
}
.startup-cover__content > span:last-child { font-size: 13px; opacity: .88; }
.startup-kicker { font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.startup-cover.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.topbar {
  position: fixed;
  z-index: 700;
  top: 16px;
  left: 16px;
  right: 16px;
  min-height: 68px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(90px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 10px 12px 10px 14px;
}
.brand-block { display: flex; align-items: center; gap: 11px; min-width: 0; width: max-content; max-width: 100%; }
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong {
  color: var(--ink);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-violet), var(--brand-blue));
  color: #fff;
  box-shadow: 0 8px 20px rgba(88, 70, 209, .24);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.brand-mark--large {
  width: 62px;
  height: 62px;
  font-size: 19px;
  background: rgba(255,255,255,.96);
  color: var(--brand-violet);
  box-shadow: 0 18px 36px rgba(31, 29, 81, .25);
}

.product-nav { display: flex; align-items: center; gap: 4px; justify-self: center; }
.product-nav__item {
  position: relative;
  padding: 10px 12px;
  color: #4b5862;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.product-nav__item.is-active { color: var(--brand-violet); }
.product-nav__item.is-active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--brand-blue);
}
.product-nav__item.is-planned { color: #9aa6ae; }

.top-actions { justify-self: end; display: flex; gap: 7px; }
.icon-button, .plain-button, .play-button, .latest-button { border: 0; cursor: pointer; }
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--brand-violet);
  font-size: 19px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.icon-button:hover { background: #eaf6fb; color: var(--brand-blue-deep); transform: translateY(-1px); }

.live-card {
  position: fixed;
  z-index: 650;
  left: 16px;
  top: 100px;
  min-width: 200px;
  border-radius: 7px;
  border-left: 4px solid var(--brand-blue);
  padding: 12px 15px 13px;
  display: grid;
  gap: 3px;
  box-shadow: var(--shadow-soft);
}
.live-card__heading { display: flex; align-items: center; gap: 7px; }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(0, 174, 245, .12);
}
.eyebrow { color: var(--brand-violet); font-weight: 800; font-size: 9px; letter-spacing: .13em; }
.live-card strong {
  color: var(--ink);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.05;
}
.live-card > span:last-child { color: var(--muted); font-size: 10px; }
.live-card.is-forecast {
  border-left-color: var(--brand-violet);
}
.live-card.is-forecast .live-dot {
  background: var(--brand-violet);
  box-shadow: 0 0 0 4px rgba(88, 70, 209, .12);
}
.live-card.is-forecast .eyebrow {
  color: var(--brand-violet);
}

.layers-panel {
  position: fixed;
  z-index: 680;
  top: 100px;
  right: 16px;
  width: min(318px, calc(100vw - 32px));
  max-height: calc(100vh - 248px);
  overflow: auto;
  border-radius: 8px;
  padding: 17px;
  transition: opacity .18s ease, transform .18s ease;
}
.layers-panel.is-hidden { opacity: 0; transform: translateX(24px); pointer-events: none; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 16px; }
.panel-heading > div { display: grid; gap: 4px; }
.panel-heading strong {
  color: var(--ink);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
}
.plain-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.layer-group { display: grid; gap: 7px; margin-top: 14px; }
.layer-group-title { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.layer-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f7fafc;
  border: 1px solid #edf2f5;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.layer-row:hover { border-color: rgba(0, 174, 245, .24); }
.layer-row.active { border-color: rgba(88, 70, 209, .20); background: rgba(88, 70, 209, .055); }
.layer-row.disabled { opacity: .46; cursor: default; }
.layer-row.disabled:hover { border-color: #edf2f5; }
.layer-row input { accent-color: var(--brand-blue); }
.layer-row span { color: #37444e; font-size: 12px; font-weight: 500; }
.layer-row small {
  border-radius: 999px;
  background: #eaf4f9;
  color: #6c818d;
  padding: 3px 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
}
.layer-row.active small { background: var(--brand-blue); color: #fff; }

.timeline {
  position: fixed;
  z-index: 700;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 13px 16px 11px;
}
.timeline-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.play-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 174, 245, .24);
  font-size: 14px;
  font-weight: 900;
  transition: background .18s ease, transform .18s ease;
}
.play-button:hover { background: var(--brand-blue-deep); transform: translateY(-1px); }
.play-button:disabled { opacity: .5; cursor: default; transform: none; }
.timeline-copy { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 1px 8px; min-width: 0; }
.timeline-kicker { color: var(--brand-violet); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.timeline-copy strong {
  color: var(--ink);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.timeline-copy > span:last-child {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.latest-button {
  border-radius: 18px;
  background: var(--brand-violet);
  color: #fff;
  padding: 9px 13px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  transition: background .18s ease, transform .18s ease;
}
.latest-button:hover { background: #4938c2; transform: translateY(-1px); }
.timeline-range {
  width: 100%;
  height: 18px;
  margin: 9px 0 1px;
  background: transparent;
  accent-color: var(--brand-blue);
  cursor: pointer;
}
.timeline-range:disabled { cursor: default; opacity: .45; }
.timeline-labels { display: flex; justify-content: space-between; color: #7d8a94; font-size: 9px; font-weight: 500; }
.source-credit {
  position: fixed;
  z-index: 500;
  right: 18px;
  bottom: 8px;
  color: rgba(29, 44, 55, .78);
  font-size: 8px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255,255,255,.9);
}

.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow-soft) !important; }
.leaflet-control-zoom a {
  background: rgba(255,255,255,.96) !important;
  color: var(--brand-violet) !important;
  border-color: #edf2f5 !important;
}
.leaflet-control-zoom a:hover { background: #f2f8fb !important; color: var(--brand-blue-deep) !important; }
.leaflet-control-attribution { display: none; }

@media (max-width: 880px) {
  .topbar { grid-template-columns: 1fr auto; }
  .product-nav { display: none; }
}

@media (max-width: 720px) {
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    min-height: 58px;
    border-radius: 7px;
    gap: 8px;
    padding: 8px 9px;
  }
  .brand-mark { width: 36px; height: 36px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy small { max-width: 175px; font-size: 9px; }
  .top-actions { gap: 5px; }
  .icon-button { width: 36px; height: 36px; font-size: 17px; }

  .live-card { top: 78px; left: 8px; min-width: 164px; padding: 10px 12px 11px; }
  .live-card strong { font-size: 17px; }

  .layers-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 123px;
    width: auto;
    max-height: 59vh;
    border-radius: 8px;
  }
  .layers-panel.is-hidden { transform: translateY(22px); }

  .timeline {
    bottom: 8px;
    width: calc(100vw - 16px);
    border-radius: 8px;
    padding: 10px 11px 8px;
  }
  .timeline-controls { gap: 9px; }
  .play-button { width: 39px; height: 39px; }
  .timeline-copy strong { font-size: 14px; }
  .timeline-kicker { display: none; }
  .timeline-copy { grid-template-columns: 1fr; }
  .timeline-copy > span:last-child { grid-column: auto; }
  .latest-button { padding: 8px 10px; }
  .source-credit { display: none; }
}

@media (max-width: 430px) {
  .brand-copy small { display: none; }
  .brand-copy strong { max-width: 175px; }
  .live-card { min-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}


/* Unified observed + forecast precipitation timeline */
.timeline {
  --now-position: 25%;
}

.timeline-phases {
  position: relative;
  height: 15px;
  margin: 6px 2px -1px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
}

.timeline-phase,
.timeline-now-marker {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.timeline-phase--observed {
  left: 0;
  color: var(--brand-blue-deep);
}

.timeline-phase--forecast {
  right: 0;
  color: var(--brand-violet);
}

.timeline-now-marker {
  left: var(--now-position);
  transform: translateX(-50%);
  color: var(--ink);
  font-weight: 800;
}

.timeline-now-marker::after {
  content: '';
  position: absolute;
  top: 13px;
  left: 50%;
  width: 1px;
  height: 31px;
  background: rgba(88, 70, 209, .38);
  pointer-events: none;
}

.timeline-labels {
  position: relative;
  display: block;
  min-height: 12px;
}

.timeline-labels > span {
  position: absolute;
  top: 0;
}

.timeline-labels > span:first-child {
  left: 0;
}

.timeline-labels > span:nth-child(2) {
  left: var(--now-position);
  transform: translateX(-50%);
}

.timeline-labels > span:last-child {
  right: 0;
}

@media (max-width: 720px) {
  .timeline-phases {
    font-size: 7px;
    letter-spacing: .04em;
  }

  .timeline-now-marker::after {
    height: 29px;
  }
}
