:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 255, 255, 0.75);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --text: #2c261f;
  --muted: #6b6258;
  --line: #d8cdbf;
  --accent: #5c7c5b;
  --accent-soft: #dfe9df;
  --saved: #c95f3a;
  --shadow: 0 18px 50px rgba(58, 44, 29, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #fdf8ee, transparent 30%),
    linear-gradient(180deg, #f4eee3 0%, #f8f4ec 100%);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}

.hero, .controls, .panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin-bottom: 12px; }
.lede { color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  min-width: 110px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.stat span { display: block; font-size: 2rem; font-weight: 700; }
.stat small { color: var(--muted); }

.controls {
  margin-top: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

input, select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fffefc;
}

.layout,
.detail-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.panel { overflow: hidden; }
.panel-header {
  padding: 18px 18px 10px;
  border-bottom: 1px solid rgba(216, 205, 191, 0.7);
}
.map-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.legend-dot.saved { background: #c95f3a; }
.legend-dot.beauty { background: #7c5cff; }
.legend-dot.family { background: #3d8c6d; }
.legend-dot.default { background: #5c7c5b; }
.panel-header p { color: var(--muted); margin-bottom: 0; }
.detail-back { margin-top: 14px; margin-bottom: 0; }
.detail-back a { color: var(--accent); text-decoration: none; font-weight: 600; }
.detail-back a:hover { text-decoration: underline; }
#map { height: min(70vh, 760px); width: 100%; }
.cards {
  padding: 12px;
  display: grid;
  gap: 12px;
  max-height: 70vh;
  overflow: auto;
}
.detail-content {
  padding: 18px;
}
.detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-paragraph {
  color: var(--text);
  line-height: 1.6;
}
.detail-section + .detail-section {
  margin-top: 20px;
}
.detail-section h3 {
  margin-bottom: 8px;
}
.detail-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}
.detail-section li + li {
  margin-top: 6px;
}
.detail-section a {
  color: var(--accent);
}
.card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover,
.card.active {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(58, 44, 29, 0.12);
  border-color: #bfae97;
}
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.card h3 { margin-bottom: 6px; font-size: 1.1rem; }
.meta, .notes { color: var(--muted); font-size: 0.93rem; }
.badges, .scores { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.badge, .score {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #fffefc;
}
.badge.saved {
  background: #fff1eb;
  border-color: #efc3b3;
  color: var(--saved);
}
.score strong { color: var(--accent); }
.notes { line-height: 1.45; }
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.leaflet-popup-content-wrapper { border-radius: 14px; }
.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-meta { color: #5f5a50; font-size: 0.9rem; }

@media (max-width: 1200px) {
  .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .controls, .layout, .detail-layout { grid-template-columns: 1fr; }
  .map-header { flex-direction: column; }
  #map, .cards { max-height: none; }
  #map { height: 52vh; }
}
