.map-card {
  position: relative;
  overflow: hidden;
}

#map {
  position: relative;
  width: 100%;
  height: min(72vh, 680px);
  min-height: 460px;
}

#map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

#map circle {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.25px;
  fill-opacity: 0.8;
  pointer-events: auto;
}

.legend {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(214, 222, 234, 0.95);
  box-shadow: 0 8px 24px rgba(20, 33, 52, 0.12);
  font-size: 0.9rem;
  z-index: 3;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
}

.departures {
  background: #2f7de1;
}

.balanced {
  background: #7b8793;
}

.arrivals {
  background: #f08b32;
}

.maplibregl-popup-content {
  padding: 0.8rem 0.9rem;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.maplibregl-popup {
  z-index: 4;
}

.maplibregl-popup-content h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.maplibregl-popup-content p {
  margin: 0.2rem 0;
  color: #394655;
}

@media (max-width: 700px) {
  #map {
    min-height: 400px;
    height: 60vh;
  }

  .legend {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    border-radius: 16px;
  }
}
