:root {
  --bg: #dde6ed;
  --panel: rgba(255, 252, 247, 0.9);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --panel-border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.7);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  --accent: #a55d2a;
}

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

body {
  background: radial-gradient(circle at top, #f7f1e7 0%, #e6edf4 48%, #dce6ef 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

#map {
  width: 100%;
}

.legend {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: min(310px, calc(100vw - 40px));
  padding: 14px 16px 15px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.legend-title {
  font-size: 14px;
  font-weight: 800;
}

.legend-subtitle {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.legend-bar {
  height: 14px;
  margin-top: 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(
    90deg,
    rgb(38, 70, 140) 0%,
    rgb(46, 160, 170) 22%,
    rgb(60, 190, 100) 45%,
    rgb(245, 215, 70) 68%,
    rgb(245, 150, 50) 82%,
    rgb(210, 60, 60) 100%
  );
}

.legend-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.legend-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.over-swatch {
  width: 28px;
  height: 10px;
  border-radius: 999px;
  background: rgb(140, 140, 140);
  border: 1px solid rgba(15, 23, 42, 0.08);
  flex: 0 0 auto;
}

.leaflet-top .leaflet-control-zoom {
  margin-top: 20px;
}

.leaflet-left .leaflet-control-zoom {
  margin-left: 20px;
}

.leaflet-bar {
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.leaflet-bar a {
  color: #172554;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
}

@media (max-width: 720px) {
  .legend {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  .legend {
    bottom: 12px;
    padding: 12px 14px 13px;
  }

  .leaflet-top .leaflet-control-zoom {
    margin-top: 12px;
  }

  .leaflet-left .leaflet-control-zoom {
    margin-left: 12px;
  }
}
