.page-map {
  overflow: hidden;
}

.page-map .site-header {
  position: relative;
  z-index: 1000;
}

.map-page {
  position: relative;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
}

.kingdom-map {
  width: 100%;
  height: 100%;
  background: var(--bg-navy);
  z-index: 1;
}

.map-legend {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  width: min(280px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: rgba(3, 6, 7, 0.92);
  border: 1px solid rgba(243, 189, 69, 0.25);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}

.map-legend h2 {
  font-size: 0.75rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
  letter-spacing: 0.1em;
}

.map-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.map-legend-item:hover,
.map-legend-item.is-active {
  border-color: rgba(243, 189, 69, 0.35);
  background: rgba(243, 189, 69, 0.06);
  color: var(--text);
}

.map-legend-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.map-legend-name {
  font-weight: 600;
  color: var(--gold-muted);
  display: block;
}

.leaflet-container {
  font-family: var(--font-body);
  background: var(--bg-deep);
}

.leaflet-marker-pane {
  z-index: 650;
}

.leaflet-overlay-pane {
  z-index: 450;
}

.kingdom-range-circle {
  pointer-events: none;
  fill: none !important;
  fill-opacity: 0 !important;
}

.kingdom-range-circle--hub {
  stroke-dasharray: 10 8;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid rgba(243, 189, 69, 0.3);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-content {
  margin: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.leaflet-popup-content h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
}

.leaflet-control-attribution {
  background: rgba(3, 6, 7, 0.85) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
}

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

.leaflet-marker-icon.garmlandia-map-marker {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

/* Marker: display size on map (source PNGs are 512px for sharpness) */
.garmlandia-marker-wrap {
  --marker-icon: 200px;
  position: relative;
  width: var(--marker-icon);
  height: var(--marker-icon);
  pointer-events: none;
  overflow: visible;
  background: transparent;
}

.garmlandia-marker-img {
  display: block;
  width: var(--marker-icon);
  height: var(--marker-icon);
  object-fit: contain;
  object-position: bottom center;
  background: none !important;
  background-color: transparent !important;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.garmlandia-marker-wrap--coming-soon .garmlandia-marker-img {
  filter: brightness(0.72) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.garmlandia-marker-soon {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.map-legend-soon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.map-legend-item--soon .map-legend-name {
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .map-page {
    height: calc(100dvh - var(--header-h) - var(--safe-top));
  }

  .map-legend {
    top: auto;
    bottom: calc(0.75rem + var(--safe-bottom));
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-height: 38%;
    padding: 0.85rem 1rem;
  }

  .map-legend-item {
    min-height: 44px;
    padding: 0.65rem 0.75rem;
  }

  .garmlandia-marker-wrap {
    --marker-icon: 120px;
  }

  .garmlandia-marker-soon {
    width: 52px;
    height: 52px;
  }

  .leaflet-control-zoom {
    margin-bottom: calc(0.5rem + var(--safe-bottom)) !important;
  }
}
