:root {
  --bg: #f5f1e8;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #66645f;
  --brand: #174c3c;
  --brand-2: #b78a3b;
  --border: #ded6c7;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

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

.app-header,
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: var(--brand);
  color: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
}

.eyebrow {
  margin: 0 0 .2rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .75rem;
  opacity: .85;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1rem;
  padding: 1rem;
  min-height: calc(100vh - 150px);
}

.map-card,
.station-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-card { position: relative; min-height: 520px; }
#map { width: 100%; height: 100%; min-height: 520px; }

.status {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  max-width: calc(100% - 2rem);
  padding: .7rem .9rem;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  font-size: .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.station-panel {
  padding: 1rem;
  overflow-y: auto;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fbf8f1;
}

.station-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: #eee;
}

.station-category,
.distance {
  color: var(--muted);
  font-size: .9rem;
}

.station-details h2,
.station-list-wrap h2 {
  margin-bottom: .5rem;
}

audio { width: 100%; margin: .8rem 0; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  margin: .8rem 0 1.2rem;
}

.primary-btn,
.secondary-btn,
.station-item {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .7rem .9rem;
  text-decoration: none;
}

.primary-btn { background: var(--brand); color: #fff; }
.secondary-btn { background: #fff; color: var(--brand); border: 1px solid var(--border); }
.app-header .secondary-btn { border-color: rgba(255,255,255,.45); }

.station-list {
  display: grid;
  gap: .65rem;
}

.station-item {
  width: 100%;
  text-align: left;
  padding: .8rem;
  background: #fbf8f1;
  border: 1px solid var(--border);
}

.station-item strong { display: block; }
.station-item span { color: var(--muted); font-size: .88rem; }
.station-item.active { outline: 3px solid rgba(183, 138, 59, .35); border-color: var(--brand-2); }

.custom-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--brand);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
}

.custom-marker span { transform: rotate(45deg); font-weight: 700; font-size: .8rem; }

.user-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2f80ed;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(47,128,237,.18);
}

.app-footer {
  font-size: .82rem;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .app-layout { grid-template-columns: 1fr; }
  .map-card, #map { min-height: 58vh; }
  .station-panel { max-height: none; }
}

/* Leaflet-Notfallregeln: verhindern verschobene Kacheln, falls leaflet.css nicht geladen wird. */
.leaflet-container {
  overflow: hidden;
  position: relative;
  outline-style: none;
  font-family: inherit;
}
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}
.leaflet-tile {
  filter: inherit;
  visibility: hidden;
}
.leaflet-tile-loaded {
  visibility: inherit;
}
.leaflet-zoom-animated {
  transform-origin: 0 0;
}
.leaflet-interactive {
  cursor: pointer;
}
.leaflet-grab {
  cursor: grab;
}
.leaflet-dragging .leaflet-grab {
  cursor: move;
}
.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: visiblePainted;
  pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  display: block;
}
.leaflet-control-zoom a {
  display: block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  text-decoration: none;
  background: #fff;
  border-bottom: 1px solid #ccc;
  color: #000;
}
.leaflet-control-attribution {
  background: rgba(255,255,255,.8);
  padding: 0 5px;
  font-size: 11px;
}
.leaflet-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
  padding: 1px;
  text-align: left;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(0,0,0,.4);
}
.leaflet-popup-content {
  margin: 13px 19px;
  line-height: 1.4;
}
.leaflet-popup-tip-container {
  width: 40px;
  height: 20px;
  position: absolute;
  left: 50%;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}
.leaflet-popup-tip {
  width: 17px;
  height: 17px;
  padding: 1px;
  margin: -10px auto 0;
  transform: rotate(45deg);
  background: white;
  box-shadow: 0 3px 14px rgba(0,0,0,.4);
}
.leaflet-control-attribution .leaflet-attribution-flag {
  display: none !important;
}
.location-panel {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #f4f4f4;
  border-radius: 0.75rem;
}

.location-button {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #064b3b;
  color: #ffffff;
}

.location-button:hover {
  background: #083f33;
}

.location-help {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #444444;
}
.user-location-dot {
  position: relative;
  width: 18px;
  height: 18px;
  background: #1a73e8;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
}

.user-location-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  background: rgba(26, 115, 232, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: locationPulse 1.8s ease-out infinite;
  z-index: -1;
}

@keyframes locationPulse {
  0% {
    width: 18px;
    height: 18px;
    opacity: 0.8;
  }

  100% {
    width: 56px;
    height: 56px;
    opacity: 0;
  }
}