:root {
  --navy: #1f3864;
  --teal: #0f6e6e;
  --bg: #f7f8fb;
  --card-bg: #ffffff;
  --border: #e1e4ec;
  --text: #222833;
  --muted: #667085;
  --danger: #b23b3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  background: linear-gradient(135deg, var(--navy), #2a4a85);
  color: white;
  padding: 40px 24px 32px;
}
.header-inner { max-width: 1100px; margin: 0 auto; }
header h1 { margin: 0 0 8px; font-size: 2.2rem; }
header .subtitle { margin: 0 0 6px; font-size: 1.05rem; opacity: 0.92; max-width: 700px; }
header .credit { margin: 0; font-size: 0.82rem; opacity: 0.7; }

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--border);
  max-width: 1100px;
  margin: -20px auto 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  position: relative;
  z-index: 2;
}
.stat-box {
  background: var(--card-bg);
  flex: 1 1 180px;
  padding: 16px 20px;
  text-align: left;
}
.stat-box .num { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.stat-box .label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.stats-comparison {
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 0 24px;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  text-align: left;
}

.controls {
  max-width: 1100px;
  margin: 28px auto 12px;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.controls input, .controls select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.92rem;
  background: white;
}
.controls input { flex: 1 1 240px; }
.result-count { font-size: 0.85rem; color: var(--muted); margin-left: auto; }

#map {
  max-width: 1100px;
  margin: 0 auto 28px;
  height: 420px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  position: relative;
  z-index: 0;
  isolation: isolate;
}

main { max-width: 1100px; margin: 0 auto; padding: 0 24px 60px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.10); }
.card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #eee; }
.card-body { padding: 12px 14px; }
.card-title { font-weight: 600; font-size: 0.92rem; margin: 0 0 6px; line-height: 1.25; }
.card-stats { font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 8px;
}
.badge.included { background: #e5f4ee; color: #1a7f56; }
.badge.excluded { background: #fbeaea; color: var(--danger); }

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,20,30,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 12px;
  position: relative;
  padding: 28px;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1.6rem;
  cursor: pointer; color: var(--muted); line-height: 1;
}
.modal img { width: 100%; border-radius: 8px; margin-bottom: 16px; }
.modal h2 { margin: 0 0 4px; font-size: 1.3rem; color: var(--navy); }
.modal .modal-sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  margin-bottom: 16px;
}
.modal-stat .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.modal-stat .value { font-size: 1rem; font-weight: 600; }
.modal-note {
  background: #fbf6e8;
  border-left: 3px solid #d9a441;
  padding: 10px 14px;
  font-size: 0.85rem;
  border-radius: 4px;
  margin-top: 10px;
}
.modal-note.danger { background: #fbeaea; border-left-color: var(--danger); }
.modal-note.fun { background: #eaf3fb; border-left-color: var(--navy); font-style: italic; }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 50px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.leaflet-popup-content { font-size: 0.85rem; }
