.map-app {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  color: var(--ink);
}

.map-panel {
  flex: 0 0 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  padding: 1rem 1.1rem 1.25rem;
  border-right: 2px solid var(--seal);
  background: var(--paper);
  overflow: auto;
}

.map-panel-head .crumbs {
  margin-bottom: 0.35rem;
}

.map-panel-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.map-lead {
  color: var(--muted);
  font-size: 0.95rem;
}

.map-search input,
.map-check,
.map-layer-actions button,
.map-styles button,
.map-tools button,
.map-filters-toggle {
  font: inherit;
  color: inherit;
}

.map-search {
  position: relative;
}

.map-search label {
  display: block;
}

.map-search input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  background: var(--search-bg);
  color: var(--ink);
}

.map-progress {
  font-size: 0.82rem;
  color: var(--faint);
}

.map-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
}

.map-styles,
.map-layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.map-styles button,
.map-layer-actions button,
.map-tools button,
.map-filters-toggle {
  min-height: 2.4rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
}

.map-styles button.is-active,
.map-cat input:focus-visible + span,
.map-styles button:focus-visible,
.map-tools button:focus-visible,
.map-filters-toggle:focus-visible,
.map-layer-actions button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.map-styles button.is-active {
  background: var(--seal);
  color: var(--seal-ink);
  border-color: var(--seal);
  font-weight: 700;
}

.map-filters {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: 1rem;
}

.map-group h2 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--seal);
}

.map-cat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.map-cat .map-swatch {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
}

.map-cat .map-swatch svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

.map-cat .map-count {
  margin-left: auto;
  color: var(--faint);
  font-size: 0.78rem;
}

.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: #0d2b4f;
}

.map-board {
  position: absolute;
  inset: 0;
}

.map-board.leaflet-container {
  width: 100%;
  height: 100%;
  background: transparent;
  font: inherit;
  color: inherit;
}

.map-pin {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}

.map-pin svg {
  display: block;
  width: 22px;
  height: 22px;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.65));
}

.map-pin.is-found {
  opacity: 0.42;
}

.map-hud-coords {
  position: absolute;
  left: 0.8rem;
  bottom: calc(0.8rem + var(--safe-bottom));
  z-index: 1100;
  margin: 0;
  padding: 0.35rem 0.6rem;
  background: rgb(13 13 13 / 0.82);
  border: 1px solid var(--line);
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  pointer-events: none;
}

.map-hud-coords[hidden] {
  display: none;
}

.map-tools {
  position: absolute;
  right: 0.8rem;
  bottom: calc(0.8rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 1100;
}

.map-tools button {
  min-width: 2.6rem;
}

.map-filters-toggle {
  display: none;
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 1100;
  background: var(--paper);
}

.map-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--seal);
  border-radius: 0;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
}

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

.map-leaflet-popup .leaflet-popup-content {
  margin: 0;
}

.map-popup-media {
  margin: 0;
}

.map-popup-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #1a2428;
}

.map-popup-media[hidden] {
  display: none;
}

.map-leaflet-popup h2 {
  font-size: 1.05rem;
  margin: 0.7rem 0.95rem 0.35rem;
}

.map-leaflet-popup p,
.map-leaflet-popup button {
  font-size: 0.88rem;
}

.map-leaflet-popup p {
  margin: 0 0.95rem 0.4rem;
}

.map-popup-coords {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.map-popup-coords span {
  color: var(--muted);
  margin-inline-end: 0.15rem;
}

.leaflet-popup-pane {
  z-index: 800;
}

.map-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.65rem 0.95rem 0.9rem;
}

.map-popup-actions button {
  min-height: 2.3rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: inherit;
  cursor: pointer;
}

.map-popup-actions button.is-found {
  background: var(--seal);
  color: var(--seal-ink);
  border-color: var(--seal);
}

.leaflet-control-attribution {
  background: rgb(13 13 13 / 0.72) !important;
  color: var(--faint);
  font-size: 0.7rem;
}

.leaflet-control-attribution a {
  color: var(--seal);
}

.map-hits {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  z-index: 8;
  max-height: 14rem;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--line);
}

.map-hits button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.map-hits button:hover,
.map-hits button:focus-visible {
  background: var(--bg-2);
}

.map-loading {
  color: var(--faint);
}

@media (max-width: 879px) {
  .map-app {
    display: block;
  }

  .map-panel {
    position: absolute;
    z-index: 6;
    inset: 0 auto 0 0;
    width: min(22rem, 92vw);
    transform: translateX(-105%);
    transition: transform var(--dur) var(--ease);
    box-shadow: 8px 0 24px rgb(0 0 0 / 0.35);
  }

  .map-app.is-panel .map-panel {
    transform: none;
  }

  .map-stage {
    height: 100%;
  }

  .map-filters-toggle {
    display: inline-flex;
    align-items: center;
  }
}

.map-panel-read {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  font-size: 0.92rem;
}
.map-panel-read h2 { font-size: 1.05rem; }
.map-styles[hidden] { display: none !important; }
