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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #FAFAF8;
}

#map {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  background: #FAFAF8;
}
#map svg { width: 100%; height: 100%; cursor: grab; touch-action: none; will-change: transform; }
#map svg:active { cursor: grabbing; }

/* Country border overlay — sits above region fills, no fill */
.country-border {
  fill: none;
  stroke: rgba(250,250,248,0.85);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* Region fills — always visible, detailed Natural Earth 10m borders */
.region {
  stroke: rgba(250,250,248,0.22);
  stroke-width: 0.4px;
  vector-effect: non-scaling-stroke;
  cursor: default;
  transition: opacity 0.15s;
}
.region.drillable {
  cursor: pointer;
}
.region.drillable:hover {
  opacity: 0.82;
}
.region.gap-fill {
  cursor: default;
}

/* ── Overlays ── */
.overlay {
  position: fixed;
  z-index: 10;
  pointer-events: auto;
}

.overlay-logo { top: 20px; left: 20px; }
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 14px;
}
.logo-mark { font-size: 18px; }
.logo-name { font-size: 15px; font-weight: 700; color: #7A9E6B; }
.logo-sub  { font-size: 12px; color: #6B7280; margin-top: 1px; }

.overlay-top {
  top: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 300px;
}
.map-title {
  font-size: 14px; font-weight: 600;
  color: #1A1A2E;
  letter-spacing: 0.3px; white-space: nowrap;
}
.select-wrap { position: relative; width: 100%; }
.breed-input {
  appearance: none; width: 100%;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border: none; border-radius: 12px;
  padding: 10px 36px 10px 14px;
  font-size: 14px; font-weight: 600; color: #1A1A2E;
  cursor: text; outline: none;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
  box-sizing: border-box;
}
.breed-input::placeholder { color: #9CA3AF; font-weight: 400; }
.breed-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  max-height: 260px; overflow-y: auto;
  z-index: 100; display: none;
}
.breed-dropdown.open { display: block; }
.breed-option {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; cursor: pointer;
  font-size: 13px; color: #1A1A2E;
}
.breed-option:hover, .breed-option.active { background: #EDF3EA; }
.breed-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; margin-top: 3px; }
.breed-option-text { display: flex; flex-direction: column; gap: 1px; }
.breed-option-sub { font-size: 11px; color: #9CA3AF; }
.breed-count { margin-left: auto; font-size: 11px; color: #9CA3AF; white-space: nowrap; }
.select-arrow {
  position: absolute; right: 13px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none; color: #6B7280; font-size: 11px;
}

/* Drill-back button (replaces pettrip.app link when drilled in) */
.overlay-back { top: 20px; right: 20px; }
.back-btn {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 500; color: #1A1A2E;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transition: background 0.15s;
  white-space: nowrap;
  cursor: pointer; border: none;
}
.back-btn:hover { background: rgba(255,255,255,1); }
.back-btn.drill-back { display: none; }
.back-btn.drill-back.visible { display: flex; }
.back-btn.reset-view { display: none; }
.back-btn.reset-view.visible { display: flex; }


/* Country name banner during drill-in */
#country-label {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 5px 16px;
  font-size: 13px; font-weight: 600; color: #1A1A2E;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  white-space: nowrap;
  opacity: 0; transition: opacity 0.3s;
  z-index: 11; pointer-events: none;
}
#country-label.visible { opacity: 1; }

/* Top-left below logo: stats */
.overlay-stats { top: 80px; left: 20px; }
.stats-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  font-size: 12px; color: #1A1A2E;
  display: flex; flex-direction: column; gap: 5px;
  min-width: 195px;
}
.stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.stats-title { font-weight: 700; font-size: 11px; color: #6B7280; }
.info-btn {
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: #9CA3AF; padding: 0 2px; line-height: 1;
}
.info-btn:hover { color: #6B7280; }
.stats-counts { display: none; flex-direction: column; gap: 5px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stat-label { color: #6B7280; }
.stat-value { font-weight: 700; }
.stats-divider { height: 1px; background: rgba(0,0,0,0.08); margin: 2px 0; }
.stat-legend .stat-label { font-size: 11px; color: #9CA3AF; display: flex; align-items: center; gap: 6px; }
.legend-dot-sm {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; flex-shrink: 0;
}
.info-panel {
  display: none; flex-direction: column; gap: 5px;
  margin-top: 4px; padding-top: 7px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 11px; color: #6B7280; line-height: 1.45;
}
.info-panel.open { display: flex; }

/* Loading */
#loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #6B7280; font-size: 15px;
  z-index: 20;
}

/* Tooltip */
#tooltip {
  position: fixed;
  background: rgba(255,255,255,0.97);
  border-radius: 10px; padding: 9px 13px;
  font-size: 13px; pointer-events: none;
  opacity: 0; transition: opacity 0.1s;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  min-width: 150px;
}
.tt-name   { font-weight: 700; color: #1A1A2E; margin-bottom: 4px; font-size: 13px; }
.tt-status { display: flex; align-items: center; gap: 6px; }
.tt-dot    { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.tt-label  { font-size: 12px; color: #6B7280; }
.tt-sub    { font-size: 11px; color: #9CA3AF; margin-top: 3px; }

/* Disclaimer banner — bottom center */
#disclaimer {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.88); backdrop-filter: blur(8px);
  border-radius: 8px; padding: 6px 14px;
  font-size: 11px; color: #6B7280;
  box-shadow: 0 1px 8px rgba(0,0,0,0.15);
  z-index: 10; pointer-events: none;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .overlay-top { top: 14px; min-width: 200px; }
  .overlay-logo { top: 14px; left: 14px; }
  .overlay-back { display: none; }
  .overlay-stats { top: auto; bottom: 40px; left: 14px; }
  .map-title { display: none; }
  .logo-sub { display: none; }
  .breed-input { font-size: 13px; }
  #disclaimer { font-size: 10px; bottom: 8px; }
}
