:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2b2b;
  --ink-soft: #6b6b6b;
  --ink-faint: #9a9a9a;
  --line: #ebe5dc;
  --accent: #4c7a3d;        /* orchard green */
  --accent-strong: #3a6130;
  --accent-soft: #eef4ea;
  --hero-bg: linear-gradient(135deg, #3a6130 0%, #5b8a48 55%, #7da05f 100%);
  --shadow-sm: 0 1px 2px rgba(40, 30, 10, .06), 0 2px 8px rgba(40, 30, 10, .05);
  --shadow-md: 0 4px 16px rgba(40, 30, 10, .10);
  --radius: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Hero ---------- */
.hero {
  background: var(--hero-bg);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 400px at 80% -20%, rgba(255,255,255,.16), transparent 60%);
  pointer-events: none;
}
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 24px 40px;
  position: relative;
  z-index: 1;
}
.badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(4px);
  margin-bottom: 18px;
}
.logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(20, 40, 10, .35);
  margin-bottom: 20px;
  display: block;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: -.01em;
}
.subtitle {
  font-size: 16px;
  color: rgba(255,255,255,.86);
  max-width: 560px;
  margin: 0 0 22px;
  line-height: 1.5;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
}
.stat b { font-size: 17px; font-weight: 700; }

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 14px 24px 12px;
}
.search-wrap {
  position: relative;
  max-width: 640px;
  margin: 0 auto 14px;
}
.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}
#search {
  width: 100%;
  height: 48px;
  padding: 0 44px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#search:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
}
.clear-btn:hover { background: #ddd5c8; }

.filter-group {
  max-width: 640px;
  margin: 0 auto 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.filter-label {
  flex: 0 0 86px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  padding-top: 7px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--ink);
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all .13s;
  user-select: none;
}
.chip:hover { border-color: #cfc5b4; background: var(--accent-soft); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip-color, #999);
}
.chip.active .dot { box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }

.toolbar-bottom {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.result-count {
  font-size: 13px;
  color: var(--ink-soft);
}
.result-count b { color: var(--ink); }
.reset-btn {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .13s;
}
.reset-btn:hover { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
  height: calc(100vh - 320px);
  min-height: 520px;
}
.list-panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 16px;
}
.map-panel {
  position: relative;
  height: 100%;
}
#map {
  width: 100%;
  height: 100%;
  background: #e8e4dd;
}
.map-toggle { display: none; }

/* ---------- Cards ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  scroll-margin: 12px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d9cfbe;
}
.card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 7px;
}
.card-emoji {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  font-size: 21px;
  border-radius: 11px;
  background: var(--accent-soft);
}
.card-title { flex: 1; min-width: 0; }
.card-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.card-title .obstart {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
}
.card-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.card-frucht {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: 0 0 9px;
}
.card-frucht.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.meta-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 7px;
}
.meta-pill.reife { color: #7a5a13; background: #fdf6e3; border-color: #f0e2b6; }
.card-more {
  border: none;
  background: none;
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
  font-family: var(--font);
}
.card-more:hover { text-decoration: underline; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-emoji { font-size: 44px; margin-bottom: 12px; }
.empty p { margin: 0 0 16px; font-size: 15px; }

/* ---------- Map popup / legend ---------- */
.cluster-icon { background: transparent; border: none; }
.cluster-small, .cluster-medium, .cluster-large {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-family: var(--font);
  font-size: 14px;
  border: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.cluster-small { background: #7da05f; }
.cluster-medium { background: #4c7a3d; }
.cluster-large { background: #2f4f27; }

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font); }
.popup h4 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.popup .obstart { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.popup .pop-meta { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.popup .pop-link { font-size: 12.5px; color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.popup .pop-link:hover { text-decoration: underline; }

.marker-icon {
  background: transparent;
  border: none;
}
.marker-pin {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--pin-color, #4c7a3d);
  box-shadow: 0 3px 8px rgba(0,0,0,.28);
  border: 2px solid #fff;
}
.marker-pin span {
  transform: rotate(45deg);
  font-size: 15px;
  line-height: 1;
}

.legend {
  position: absolute;
  z-index: 1000;
  bottom: 58px;
  left: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  font-size: 13px;
  min-width: 170px;
  max-width: 220px;
}
.legend-toggle {
  position: absolute;
  z-index: 1000;
  bottom: 12px;
  left: 12px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  border: 1px solid var(--line);
  transition: all .13s;
}
.legend-toggle:hover { border-color: var(--accent); }
.legend-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.locate-btn {
  position: absolute;
  z-index: 1000;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(0,0,0,.2);
  border-radius: 50%;
  background: #fff;
  color: #1a73e8;
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  cursor: pointer;
  transition: background .13s, transform .13s;
  padding: 0;
}
.locate-btn:hover { background: #f2f2f2; }
.locate-btn:active { transform: scale(.94); }
.locate-btn.locating {
  pointer-events: none;
  animation: locatePulse 1.2s ease-in-out infinite;
}
@keyframes locatePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.user-marker { background: transparent; border: none; }
.user-marker-inner {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(26,115,232,.35), 0 2px 8px rgba(0,0,0,.35);
}
.user-marker-inner::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: rgba(26,115,232,.28);
  animation: userPulse 2s ease-out infinite;
}
@keyframes userPulse {
  0%   { transform: scale(.4); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.toast {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,.92);
  color: #fff;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1200;
  white-space: normal;
  text-align: center;
  max-width: 90%;
  line-height: 1.4;
}
.toast.show { opacity: 1; }
.legend h5 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-faint);
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-weight: 500;
}
.legend-row .l-emoji { font-size: 15px; width: 20px; text-align: center; }
.legend-row .l-count { margin-left: auto; color: var(--ink-faint); font-weight: 400; }

/* ---------- Footer ---------- */
.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 30px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.footer a { color: var(--ink-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-inner { padding: 26px 18px 24px; }
  .hero h1 { font-size: 30px; }
  .logo { width: 60px; height: 60px; border-radius: 15px; }

  .toolbar { position: static; padding: 12px 14px 10px; }

  .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  /* Karte oben, Liste darunter — beides direkt sichtbar */
  .map-panel {
    position: relative;
    inset: auto;
    z-index: auto;
    height: 52vh;
    min-height: 340px;
    order: 1;
    display: block;
  }
  .list-panel {
    order: 2;
    height: auto;
    min-height: 40vh;
    border-right: none;
    border-top: 1px solid var(--line);
    padding: 14px;
  }
  .map-toggle { display: none; }
  .legend { bottom: 12px; }
  .filter-group { flex-direction: column; gap: 6px; }
  .filter-label { padding-top: 0; }
}
