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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: rgba(15, 15, 30, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

#branding {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

#title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

#subtitle {
  font-size: 0.72rem;
  color: #888;
}

#controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

#controls label {
  font-size: 0.82rem;
  color: #aaa;
}

#date-filter {
  background: #222240;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}

#date-filter:focus {
  border-color: #6c8ebf;
}

#count-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: #2a2a4a;
  color: #8ab4f8;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── Nature filter ─────────────────────────────────────────────────────────── */

#nature-filter-wrap {
  position: relative;
}

#nature-filter-btn {
  background: #222240;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

#nature-filter-btn:hover {
  border-color: #6c8ebf;
}

#nature-filter-btn.nature-filtered {
  border-color: #8ab4f8;
  color: #8ab4f8;
}

#nature-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1100;
  background: #16162a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.4rem 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

#nature-panel.hidden {
  display: none;
}

.nature-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  color: #ccc;
  cursor: pointer;
  user-select: none;
}

.nature-row:hover {
  background: rgba(255,255,255,0.05);
}

.nature-row.nature-all {
  font-weight: 600;
  color: #eee;
}

.nature-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nature-divider {
  border: none;
  border-top: 1px solid #333;
  margin: 0.3rem 0;
}

/* ── Map ───────────────────────────────────────────────────────────────────── */

#map {
  position: fixed;
  top: 48px;   /* height of top bar */
  left: 0;
  right: 0;
  bottom: 32px; /* height of footer bar */
}

/* ── Footer bar ────────────────────────────────────────────────────────────── */

#footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #888;
  background: rgba(15, 15, 30, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#footer-bar a {
  color: #8ab4f8;
  text-decoration: none;
}

#footer-bar a:hover {
  text-decoration: underline;
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.82);
  backdrop-filter: blur(4px);
  transition: opacity 0.4s;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-box {
  text-align: center;
  padding: 2rem 2.5rem;
  background: #16162a;
  border: 1px solid #333;
  border-radius: 10px;
  min-width: 240px;
}

#loading-msg {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #ccc;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #333;
  border-top-color: #6c8ebf;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Leaflet popup overrides ───────────────────────────────────────────────── */

.leaflet-popup-content-wrapper {
  background: #1e1e30;
  color: #eee;
  border: 1px solid #333;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

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

.popup strong {
  font-size: 0.95rem;
  color: #8ab4f8;
}

.popup-addr {
  font-size: 0.82rem;
  color: #ccc;
}

.popup-date {
  font-size: 0.78rem;
  color: #aaa;
  display: block;
  margin-top: 2px;
}

.popup-disp {
  font-size: 0.75rem;
  color: #888;
  display: block;
}

.popup-id {
  font-size: 0.7rem;
  color: #555;
  display: block;
  margin-top: 2px;
}
