:root {
  --dry: #1a9850;
  --caution: #d4a017;
  --wet: #d73027;
  --loading: #6b7280;
  --bg: #0f1115;
  --panel-bg: #171a21;
  --border: #2a2e37;
  --text: #e6e8eb;
  --text-dim: #9aa0aa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 1rem 1.25rem 0.5rem;
}

h1 {
  margin: 0;
  font-size: 1.4rem;
}

.subtitle {
  margin: 0.15rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.status-banner {
  margin: 0.75rem 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.status-loading { background: rgba(107,114,128,0.2); color: var(--loading); }
.status-dry { background: rgba(26,150,80,0.18); color: var(--dry); }
.status-caution { background: rgba(212,160,23,0.18); color: var(--caution); }
.status-wet { background: rgba(215,48,39,0.18); color: var(--wet); }
.status-error { background: rgba(215,48,39,0.18); color: var(--wet); }

main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  padding: 0 1.25rem 1.25rem;
  height: calc(100vh - 120px);
}

#map {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 320px;
}

#panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  overflow-y: auto;
}

#refresh-btn {
  width: 100%;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #23272f;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

#refresh-btn:hover { background: #2a2f3a; }
#refresh-btn:disabled { opacity: 0.6; cursor: default; }

#last-updated {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0.4rem 0 1rem;
  text-align: center;
}

h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 1rem 0 0.5rem;
}

.segment {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.segment-name { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-dry { background: var(--dry); }
.dot-caution { background: var(--caution); }
.dot-wet { background: var(--wet); }

.segment-detail {
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

#river-info {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
}

.disclaimer {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 1.25rem;
  line-height: 1.4;
}

@media (max-width: 780px) {
  main { grid-template-columns: 1fr; height: auto; }
  #map { height: 340px; }
}
