:root {
  --bg: #0b1a24;
  --card: #122a38;
  --card-border: #1e3d52;
  --text: #e8f1f5;
  --muted: #8aa8b8;
  --accent: #2a9fd6;
  --accent-hover: #3bb5ef;
  --water: rgba(30, 120, 200, 0.55);
  --water-border: rgba(40, 140, 220, 0.85);
  --dry: rgba(180, 150, 100, 0.25);
  --success: #3ecf8e;
  --warning: #f0a030;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

header {
  background: linear-gradient(135deg, #0d2130 0%, #163a4f 100%);
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 1.25rem;
}

.header-inner h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

main {
  display: flex;
  height: calc(100vh - 110px);
  min-height: 420px;
}

.sidebar {
  width: 320px;
  min-width: 280px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: #0a1620;
  border-right: 1px solid var(--card-border);
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
  color: #b8d4e4;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pegel-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.pegel-unit {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.pegel-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.pegel-select {
  margin-top: 0.9rem;
}

.pegel-select label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #0d1f2b;
  color: var(--text);
  font-size: 0.9rem;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.55rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #1a3344;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.hint.small {
  font-size: 0.75rem;
  margin-top: 0.6rem;
}

label[for="level-slider"] {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.legend {
  list-style: none;
  font-size: 0.85rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
}

.swatch {
  width: 18px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.swatch.water {
  background: var(--water);
  border: 1px solid var(--water-border);
}

.swatch.dry {
  background: var(--dry);
  border: 1px solid rgba(160, 130, 80, 0.5);
}

.swatch.contour {
  background: transparent;
  border: 2px solid #6ab0d0;
}

.swatch.station {
  background: #e74c3c;
  border-radius: 50%;
  width: 12px;
  height: 12px;
}

.disclaimer p {
  font-size: 0.75rem;
  color: var(--muted);
}

.disclaimer a {
  color: var(--accent);
}

#map-container {
  flex: 1;
  position: relative;
  min-height: 320px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #0a1520;
}

.map-overlay {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(10, 22, 32, 0.85);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
  border: 1px solid var(--card-border);
}

footer {
  padding: 0.55rem 1.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--card-border);
  background: #081018;
}

/* Leaflet overrides for dark theme */
.leaflet-control-zoom a {
  background: var(--card) !important;
  color: var(--text) !important;
  border-color: var(--card-border) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 22, 32, 0.8) !important;
  color: var(--muted) !important;
  font-size: 0.65rem !important;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.leaflet-popup-tip {
  background: var(--card);
}

.leaflet-popup-content {
  margin: 0.6rem 0.8rem;
  font-size: 0.85rem;
}

/* Wassertiefen-Tooltip unter dem Mauszeiger */
.depth-tooltip {
  background: rgba(10, 30, 48, 0.92) !important;
  border: 1px solid #2a9fd6 !important;
  color: #e8f1f5 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.8rem !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

.depth-tooltip::before {
  border-top-color: rgba(10, 30, 48, 0.92) !important;
}

.water-poly {
  transition: fill-opacity 0.15s ease, fill 0.15s ease;
}

/* Responsive */
@media (max-width: 800px) {
  main {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 100px);
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
  }

  #map-container {
    height: 55vh;
    min-height: 320px;
  }
}
