:root {
  color-scheme: dark;
  --bg: #101417;
  --panel: #182026;
  --panel-strong: #202a31;
  --text: #eef3f1;
  --muted: #9fb0ab;
  --line: #314047;
  --accent: #65d0a7;
  --accent-2: #f0c35a;
  --danger: #f26d6d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(101, 208, 167, 0.12), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 6px;
  font-size: clamp(2.2rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

.status,
.panel-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.alert {
  border: 1px solid rgba(242, 109, 109, 0.5);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: rgba(242, 109, 109, 0.12);
  padding: 12px 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 32, 38, 0.92);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.hero-panel {
  grid-column: span 2;
}

.wide {
  grid-column: span 3;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.weather-now {
  display: flex;
  align-items: center;
  gap: 18px;
}

.weather-now img {
  width: 88px;
  height: 88px;
}

.temperature {
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 850;
  line-height: 0.9;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}

.facts div,
.metric,
.forecast-card,
.river-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

dt,
small,
.muted {
  color: var(--muted);
}

dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 92px;
  align-content: center;
}

.metric span {
  font-size: 1.6rem;
  font-weight: 800;
}

.forecast,
.river-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.forecast-card {
  min-height: 160px;
}

.forecast-card img {
  width: 52px;
  height: 52px;
}

.forecast-card strong,
.river-title strong {
  display: block;
  margin-bottom: 8px;
}

.river-list {
  grid-template-columns: 1fr;
}

.river-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.river-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.river-metrics b {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.river-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.range-buttons button {
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12191e;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 8px 10px;
}

.range-buttons button:hover,
.range-buttons button.active {
  border-color: rgba(101, 208, 167, 0.8);
  background: rgba(101, 208, 167, 0.14);
  color: var(--text);
}

.chart-wrap {
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12191e;
  padding: 12px;
}

.chart-meta,
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.water-chart {
  display: block;
  width: 100%;
  height: 220px;
  margin: 8px 0;
}

.water-chart line {
  stroke: rgba(159, 176, 171, 0.3);
  stroke-width: 1;
}

.water-chart polyline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.stage-line {
  stroke: var(--accent);
}

.flow-line {
  stroke: var(--accent-2);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.stage-key {
  background: var(--accent);
}

.flow-key {
  background: var(--accent-2);
}

@media (max-width: 820px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .grid,
  .forecast,
  .river-list {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .wide {
    grid-column: span 1;
  }

  .facts,
  .river-metrics {
    grid-template-columns: 1fr;
  }

  .river-title {
    display: block;
  }
}
