*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

/* ── Map ── */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#map.pick-mode,
#map.pick-mode .leaflet-container {
  cursor: crosshair !important;
}

/* ── Vue overlay ── */
#app {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}

/* ── Top bar ── */
.top-bar {
  pointer-events: auto;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  max-width: calc(100vw - 20px);
  flex-wrap: wrap;
}

.app-title {
  font-weight: 600;
  color: #222;
  margin-right: 2px;
}

.top-bar select {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}


.pick-btn-wrap {
  position: relative;
}

.pick-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.93);
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 600;
}

.pick-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(26, 26, 46, 0.93);
}

.btn-pick {
  padding: 4px 11px;
  border: none;
  border-radius: 4px;
  background: #3498db;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.btn-pick.active  { background: #e74c3c; }
.btn-pick:hover   { opacity: 0.88; }

.count-badge {
  background: #eee;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  color: #666;
}

/* ── Legend ── */
.legend {
  pointer-events: auto;
  position: absolute;
  bottom: 28px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.6;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 3px solid #1a1a2e;
}

/* ── Export card ── */
.export-card {
  pointer-events: none;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.97);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
  padding: 18px 24px 20px;
  width: 300px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.export-card.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.export-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.export-card-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.slider-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  width: 100%;
  max-width: 320px;
}
.slider-label strong {
  font-size: 22px;
  color: #222;
}

.slider {
  width: 100%;
  accent-color: #3498db;
  cursor: pointer;
}

.btn-download {
  padding: 8px 18px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.btn-download:disabled       { background: #aaa; cursor: not-allowed; }
.btn-download:hover:not(:disabled) { opacity: 0.87; }

.btn-close {
  padding: 7px 16px;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
}
.btn-close:hover { background: #f5f5f5; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .top-bar   { top: 8px; padding: 5px 10px; gap: 6px; }
  .app-title { display: none; }
}
