.map-thumb-wrap {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 40;
  width: 220px;
  height: 160px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid #45475a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-thumb-wrap:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  border-color: #89b4fa;
}

.map-thumb-wrap.hidden {
  display: none;
}

.map-thumb-label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  background: rgba(17, 17, 27, 0.85);
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  color: #cdd6f4;
  pointer-events: none;
}

.map-thumb-expand {
  position: absolute;
  bottom: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 0.375rem;
  background: rgba(17, 17, 27, 0.92);
  color: #89b4fa;
  border: 1px solid #45475a;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.map-thumb-expand:hover {
  background: #313244;
  border-color: #89b4fa;
  color: #cdd6f4;
}

.map-toolbar button.map-save-pipeline-bulk {
  background: #78350f;
  border-color: #b45309;
  color: #fef3c7;
}

.map-toolbar button.map-save-pipeline-bulk:hover {
  background: #92400e;
  border-color: #f59e0b;
}

#map-thumb-inner,
#map-full-inner {
  width: 100%;
  height: 100%;
  background: #1e1e2e;
}

.map-panel {
  display: none !important;
  margin-bottom: 1.5rem;
}

.map-panel.active {
  display: block !important;
}

.map-panel-body-wrap {
  position: relative;
}

.map-panel-inner {
  min-height: 300px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #313244;
}

.map-panel-inner--normal {
  height: 67vh;
}

.map-panel-inner--large {
  height: 90vh;
}

.map-size-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 500;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  border-radius: 0.375rem;
  background: rgba(17, 17, 27, 0.9);
  color: #89b4fa;
  border: 1px solid #45475a;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.map-size-toggle:hover {
  background: #313244;
  border-color: #89b4fa;
  color: #cdd6f4;
}

/* Search page: full-bleed width when map is expanded */
.map-panel--search.active {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
}

.map-score-limit-label {
  font-size: 0.8rem;
  color: #89b4fa;
  margin-bottom: 0.5rem;
}

.map-geocode-banner.geocoding-active {
  color: #89b4fa;
  border-color: #89b4fa55;
}

.map-geocode-banner.map-sample-fallback {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

body.dark .map-geocode-banner.map-sample-fallback {
  background: rgba(234, 88, 12, 0.15);
  border-color: rgba(251, 146, 60, 0.35);
  color: #fdba74;
}

.map-geocode-banner {
  background: #313244;
  border: 1px solid #45475a;
  color: #f9e2af;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.map-toolbar button {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  background: #313244;
  color: #cdd6f4;
  border: 1px solid #45475a;
}

.map-toolbar button:hover {
  background: #45475a;
}

.map-view-toggle {
  background: #0e7490 !important;
  color: #fff !important;
  border-color: #22d3ee !important;
}

.map-view-toggle:hover {
  background: #0891b2 !important;
  border-color: #67e8f9 !important;
}

.map-view-toggle.active {
  background: #0ea5e9 !important;
  color: #fff !important;
  border-color: #7dd3fc !important;
  box-shadow: 0 0 0 1px #0ea5e955;
}

#skip-credits-modal {
  z-index: 20000;
}

/* Keep inline map below app overlays (Leaflet panes use z-index up to ~1000) */
.map-panel,
.map-panel-inner {
  position: relative;
  z-index: 1;
}

.leaflet-container {
  font-family: inherit;
  background: #11111b;
}

.leaflet-popup-content-wrapper {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 0.5rem;
}

.leaflet-popup-tip {
  background: #1e1e2e;
}

.map-panel-inner .leaflet-interactive {
  cursor: pointer;
}

@media (max-width: 640px) {
  .map-thumb-wrap {
    width: 160px;
    height: 120px;
    bottom: 0.75rem;
    right: 0.75rem;
  }
}
