:root {
  color-scheme: dark;
  --navy: #061827;
  --surface: #09243a;
  --surface-2: #0d304b;
  --line: #254b63;
  --muted: #97b4c8;
  --text: #f1f7fb;
  --aqua: #1cdaea;
  --aqua-soft: #74f0f5;
  --blue: #3b90e6;
  --warm: #ffcf70;
  --missing: #56738a;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(circle at 78% 8%, #103d5c 0, transparent 34rem), var(--navy); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }
.app-shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 40px; }
.overview { border-bottom: 1px solid var(--line); padding: 0 0 25px; }
.brand-row, .title-row, .map-head, .map-footer, .directions { display: flex; align-items: center; }
.brand-row { justify-content: space-between; gap: 18px; }
.brand { color: var(--aqua-soft); text-decoration: none; font-size: 13px; font-weight: 800; letter-spacing: 1.6px; }
.live-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .9px; }
.live-chip span { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 14px var(--aqua); }
.title-row { justify-content: space-between; gap: 24px; margin-top: 34px; }
.eyebrow, .panel-kicker, .map-caption { margin: 0 0 8px; color: var(--aqua); font-size: 11px; font-weight: 800; letter-spacing: 1.35px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(31px, 4vw, 52px); line-height: 1; letter-spacing: 0; }
h1 span { color: var(--muted); font-size: .52em; font-weight: 500; }
.intro { max-width: 645px; margin: 22px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.refresh-button { min-width: 104px; padding: 11px 16px; border: 1px solid #3c7897; border-radius: 4px; background: #0a2a40; color: var(--aqua-soft); font-weight: 750; cursor: pointer; }
.refresh-button:hover, .refresh-button:focus-visible { border-color: var(--aqua); background: #0d354e; outline: none; }
.workspace { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 22px; margin-top: 24px; }
.details-panel, .map-panel { border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 25, 40, .76); box-shadow: 0 18px 44px rgba(0, 0, 0, .17); }
.details-panel { align-self: start; padding: 27px; }
.details-panel h2 { margin: 0; font-size: 28px; line-height: 1.08; letter-spacing: 0; overflow-wrap: anywhere; }
.range { min-height: 22px; margin: 10px 0 27px; color: var(--muted); font-size: 14px; font-weight: 650; }
.water-value { min-height: 129px; padding: 18px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.water-value strong { display: block; color: var(--text); font-size: 38px; line-height: 1; letter-spacing: 0; }
.water-value span { display: block; margin-top: 10px; color: var(--aqua-soft); font-size: 14px; font-weight: 800; }
.water-value.missing strong { color: var(--muted); }
.water-value.missing span { color: var(--muted); }
.facts { margin: 20px 0 0; }
.facts div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid rgba(37, 75, 99, .7); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; color: var(--text); font-size: 13px; font-weight: 800; text-align: right; }
.data-note { margin: 22px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.map-panel { min-width: 0; overflow: hidden; }
.map-head { justify-content: space-between; gap: 20px; padding: 19px 24px; border-bottom: 1px solid var(--line); }
.map-head strong { display: block; color: var(--text); font-size: 14px; }
.directions { gap: 9px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .85px; white-space: nowrap; }
.directions i { display: block; width: 37px; height: 1px; background: var(--aqua); position: relative; }
.directions i::after { content: ""; position: absolute; right: 0; top: -3px; border: 4px solid transparent; border-left-color: var(--aqua); }
.river-stage { position: relative; min-height: 670px; padding: 14px; overflow: hidden; background: linear-gradient(145deg, rgba(9, 40, 62, .76), rgba(3, 18, 31, .3)); }
#riverMap { display: block; width: 100%; height: 670px; overflow: visible; }
.map-footer { justify-content: space-between; gap: 20px; padding: 14px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.route-backdrop { fill: none; stroke: #12374f; stroke-width: 28; stroke-linecap: round; stroke-linejoin: round; }
.route-flow { fill: none; stroke: #1c678e; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; opacity: .76; }
.river-segment { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; transition: stroke .16s ease, stroke-width .16s ease, filter .16s ease; }
.river-segment:hover, .river-segment:focus-visible { stroke: var(--aqua-soft); stroke-width: 17; filter: drop-shadow(0 0 8px rgba(28, 218, 234, .72)); outline: none; }
.river-segment.selected { stroke: var(--aqua); stroke-width: 19; filter: drop-shadow(0 0 12px rgba(28, 218, 234, .92)); }
.gauge-node { fill: #0a2c44; stroke: #9bd8e8; stroke-width: 3; pointer-events: none; }
.gauge-node.selected { fill: var(--aqua); stroke: #e7ffff; }
.gauge-label { fill: #cde2ef; font-size: 13px; font-weight: 800; letter-spacing: 0; pointer-events: none; paint-order: stroke; stroke: #071b2b; stroke-width: 5px; stroke-linejoin: round; }
.gauge-label.selected { fill: #ffffff; }
.endpoint-label { fill: var(--aqua-soft); font-size: 12px; font-weight: 900; letter-spacing: 1px; pointer-events: none; }
.hover-card { position: fixed; z-index: 10; max-width: 230px; padding: 10px 12px; border: 1px solid rgba(116, 240, 245, .8); border-radius: 4px; background: #0a273b; box-shadow: 0 15px 26px rgba(0, 0, 0, .3); color: var(--text); pointer-events: none; }
.hover-card strong { display: block; font-size: 13px; }
.hover-card span { display: block; margin-top: 3px; color: var(--aqua-soft); font-size: 12px; font-weight: 750; }
.error-title { margin: 0 0 7px; color: var(--warm); font-weight: 800; }
.error-copy { margin: 0; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .details-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .details-panel .panel-kicker, .details-panel h2, .details-panel .range, .details-panel .data-note { grid-column: 1 / -1; }
  .water-value { border-bottom: 0; }
  .facts { margin-top: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .app-shell { width: min(100% - 24px, 1480px); padding-top: 20px; }
  .title-row { align-items: flex-start; margin-top: 25px; }
  .refresh-button { min-width: 0; padding: 9px 11px; font-size: 13px; }
  .map-head, .map-footer { padding-left: 16px; padding-right: 16px; }
  .directions { display: none; }
  .river-stage, #riverMap { min-height: 585px; height: 585px; }
  .details-panel { display: block; padding: 22px; }
  .facts { margin-top: 20px; border-top: 0; }
  .water-value { border-bottom: 1px solid var(--line); }
  .map-footer span:last-child { display: none; }
}
