:root {
  --accent: #0f4c3a;
  --state: #2e7d32;
  --national: #8d5524;
  --town: #1565c0;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --text: #1c2321;
  --muted: #66716c;
  --radius: 12px;
  --shadow: 0 2px 14px rgba(0,0,0,.12);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Header ---------- */
header {
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 1200;
  box-shadow: var(--shadow);
}
header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: .2px; }
header .tagline { font-size: .78rem; opacity: .85; display: block; font-weight: 400; }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

#search {
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: .9rem;
  width: 230px;
  outline: none;
}

.chips { display: flex; gap: 6px; }

.chip {
  border: 2px solid rgba(255,255,255,.55);
  background: transparent;
  color: #fff;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  user-select: none;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot, #fff); }
.chip.active { background: #fff; color: var(--accent); border-color: #fff; }
.chip:hover { border-color: #fff; }

#listToggle {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
#listToggle:hover { background: rgba(255,255,255,.28); }

/* ---------- Layout ---------- */
main { flex: 1; display: flex; position: relative; min-height: 0; }

#map { flex: 1; height: 100%; z-index: 1; background: #dfe6e2; }

/* ---------- List panel ---------- */
#listPanel {
  width: 330px;
  background: var(--panel);
  border-left: 1px solid #e2e6e3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1100;
}
#listPanel.hidden { display: none; }

#listMeta {
  padding: 10px 16px;
  font-size: .8rem;
  color: var(--muted);
  border-bottom: 1px solid #eef0ee;
}

#parkList { overflow-y: auto; flex: 1; }

.park-item {
  padding: 10px 16px;
  border-bottom: 1px solid #f2f4f2;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .1s;
}
.park-item:hover { background: #f0f6f2; }
.park-item img { width: 26px; height: 26px; flex-shrink: 0; }
.park-item .pi-name { font-size: .88rem; font-weight: 600; line-height: 1.25; }
.park-item .pi-sub { font-size: .75rem; color: var(--muted); }

/* ---------- Badges / popups ---------- */
.badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge.state { background: var(--state); }
.badge.national { background: var(--national); }
.badge.town { background: var(--town); }

.leaflet-popup-content { margin: 14px 18px; min-width: 190px; }
.popup-name { font-weight: 700; font-size: .98rem; margin: 6px 0 2px; }
.popup-sub { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.popup-links { display: flex; gap: 8px; flex-wrap: wrap; }
.popup-links a {
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 3px 10px;
}
.popup-links a:hover { background: var(--accent); color: #fff; }

/* ---------- Clusters ---------- */
.cluster-icon {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.3);
}

/* ---------- Status toast ---------- */
#status {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,30,26,.88);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: .8rem;
  z-index: 1300;
  display: none;
  white-space: nowrap;
}

/* ---------- Footer credit ---------- */
#credit {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 1000;
  font-size: .62rem;
  background: rgba(255,255,255,.75);
  padding: 2px 6px;
  color: var(--muted);
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  header { padding: 8px 12px; gap: 8px; }
  header h1 { font-size: 1rem; }
  .tagline { display: none !important; }
  #search { width: 100%; order: 3; }
  .controls { width: 100%; margin-left: 0; }
  #listPanel {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: min(85vw, 320px);
    box-shadow: -4px 0 18px rgba(0,0,0,.2);
  }
}
