:root {
  --ink: #211116;
  --muted: #6d6264;
  --panel: rgba(252, 248, 242, 0.9);
  --line: rgba(58, 41, 38, 0.12);
  --water: #67a8df;
  --water-edge: #2b6b9d;
  --core: #184f83;
  --fringe: #9ed4f0;
  --road: #8d7f71;
  --road-impact: #6f4d42;
  --building: #ded6cf;
  --building-stroke: #7d7068;
  --place: #3a8f7f;
  --shadow: 0 18px 45px rgba(41, 25, 23, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: #ebe3da;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,255,255,0.45) 0, rgba(255,255,255,0) 28%),
    radial-gradient(circle at 78% 16%, rgba(198, 221, 240, 0.18) 0, rgba(198,221,240,0) 22%),
    radial-gradient(circle at 52% 82%, rgba(240, 249, 255, 0.12) 0, rgba(240,249,255,0) 18%);
}

.title-card,
.control-card,
.legend-card {
  position: fixed;
  z-index: 400;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.title-card {
  top: 24px;
  left: 24px;
  border-radius: 28px;
  padding: 18px 22px 16px;
  width: 340px;
}

.title-card h1 {
  margin: 6px 0 0;
  font-family: "Fraunces", serif;
  font-size: 3.45rem;
  line-height: 0.88;
  letter-spacing: -0.05em;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.control-card {
  top: 24px;
  right: 24px;
  width: 282px;
  border-radius: 24px;
  padding: 16px 16px 14px;
}

.legend-card {
  right: 24px;
  bottom: 24px;
  width: 214px;
  border-radius: 24px;
  padding: 16px;
}

.layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.layer-chip {
  appearance: none;
  border: 1px solid rgba(69, 51, 47, 0.14);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.layer-chip:hover {
  transform: translateY(-1px);
}

.layer-chip.active {
  background: rgba(103, 168, 223, 0.16);
  border-color: rgba(43, 107, 157, 0.34);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  color: #564a46;
  font-size: 0.94rem;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.08);
}

.swatch-water { background: rgba(103, 168, 223, 0.78); }
.swatch-core { background: rgba(24, 79, 131, 0.9); }
.swatch-fringe { background: rgba(158, 212, 240, 0.82); }
.swatch-road { background: rgba(111, 77, 66, 0.8); }
.swatch-building { background: rgba(222, 214, 207, 0.92); }
.swatch-place { background: rgba(58, 143, 127, 0.86); }

.leaflet-container {
  background: #e9e1d6;
}

.leaflet-pane.roads-pane path {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaflet-pane.water-pane path.flood-final {
  fill: rgba(103, 168, 223, 0.32) !important;
  stroke: rgba(43, 107, 157, 0.72) !important;
  stroke-opacity: 0.72 !important;
}

.leaflet-pane.water-pane path.flood-core {
  fill: rgba(24, 79, 131, 0.24) !important;
  stroke: rgba(13, 63, 107, 0.78) !important;
  stroke-opacity: 0.78 !important;
}

.leaflet-pane.water-pane path.flood-fringe {
  fill: rgba(158, 212, 240, 0.14) !important;
  stroke: rgba(110, 174, 216, 0.42) !important;
  stroke-opacity: 0.42 !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  color: var(--ink) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(36, 24, 22, 0.18);
}

.leaflet-popup-content {
  margin: 14px 16px;
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
}

@media (max-width: 980px) {
  .title-card {
    width: 270px;
  }

  .title-card h1 {
    font-size: 2.85rem;
  }

  .control-card {
    width: 240px;
  }
}

@media (max-width: 760px) {
  .title-card,
  .control-card,
  .legend-card {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .title-card {
    top: 12px;
    padding: 14px 16px;
  }

  .title-card h1 {
    font-size: 2.2rem;
  }

  .control-card {
    top: 142px;
  }

  .legend-card {
    bottom: 12px;
  }
}
