:root {
  --accent: #00a392;
  --bg: #121417;
  --surface: rgba(22, 24, 28, 0.94);
  --surface-2: #23262c;
  --text: #f2f2f2;
  --muted: #a9adb4;
  --topbar-h: 64px;
  --panel-w: min(440px, 92vw);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.leaflet-container {
  background: var(--bg);
  font: inherit;
}

.spot-shape {
  transition: fill-opacity 0.15s, stroke-width 0.15s;
}

.leaflet-tooltip.spot-tooltip {
  background: var(--surface);
  color: var(--text);
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  padding: 6px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.leaflet-tooltip.spot-tooltip::before {
  display: none;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(18, 20, 23, 0.92), rgba(18, 20, 23, 0.7));
  backdrop-filter: blur(6px);
  z-index: 1000;
  user-select: none;
}

.brand {
  min-width: 0;
}

.site-title {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 15px;
}

.btn:hover,
.btn.active {
  border-color: var(--accent);
}

.btn.active {
  background: var(--accent);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.lang-switch {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.lang-switch button {
  background: var(--surface-2);
  border: 0;
  padding: 10px 12px;
  min-height: 44px;
  min-width: 48px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.lang-switch button.active {
  background: var(--accent);
}

/* ---------- Zoom ---------- */

.zoom-controls {
  position: absolute;
  left: 16px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
}

.zoom-controls button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: var(--surface);
  font-size: 26px;
  line-height: 1;
}

.hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 18px;
  border-radius: 24px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  z-index: 800;
  pointer-events: none;
  transition: opacity 0.4s;
}

.hint.faded {
  opacity: 0;
}

/* ---------- Legende ---------- */

.legend {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  left: 8px;
  bottom: 8px;
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 12px;
  z-index: 1100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px 18px;
}

.legend-head h2 {
  margin: 0;
  font-size: 18px;
}

.close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.close:hover {
  background: rgba(255, 255, 255, 0.08);
}

#legend-search {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

#legend-list {
  list-style: none;
  margin: 0;
  padding: 0 6px 12px;
  overflow-y: auto;
  flex: 1;
}

#legend-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
}

#legend-list button:hover,
#legend-list button.active {
  background: rgba(0, 163, 146, 0.25);
}

/* ---------- Info-Panel ---------- */

.panel {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 8px;
  bottom: 8px;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 12px;
  z-index: 1100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slide-in 0.2s ease-out;
}

@keyframes slide-in {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
}

.panel > .close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface-2);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.panel-body h2 {
  margin: 0 48px 16px 0;
  font-size: 22px;
  line-height: 1.25;
}

.panel-images {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-images:empty {
  display: none;
}

.panel-images figure {
  margin: 0;
}

.panel-images img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
}

.panel-images figcaption,
.lightbox figcaption {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.panel-text {
  font-size: 16px;
  line-height: 1.6;
}

.panel-text p {
  margin: 0 0 0.9em;
}

.panel-text a {
  color: var(--accent);
}

.panel-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

#panel-count {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Kartenauswahl ---------- */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 13, 0.85);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.overlay-inner {
  width: min(1100px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px;
  padding-bottom: 18px;
}

.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 8px 18px;
}

.map-card {
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.map-card.active,
.map-card:hover {
  border-color: var(--accent);
}

.map-card .thumb {
  aspect-ratio: 4 / 3;
  background: #000 center / cover no-repeat;
}

.map-card span {
  display: block;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: absolute;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  text-align: center;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
}

.lightbox > .close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
}

.message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--muted);
  z-index: 1400;
  background: var(--bg);
}

/* ---------- Schmale Bildschirme / Hochformat ---------- */

@media (max-width: 760px) {
  :root {
    --topbar-h: 58px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .site-title {
    display: none;
  }

  .btn {
    padding: 8px 10px;
    font-size: 14px;
  }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 58vh;
    border-radius: 14px 14px 0 0;
    animation-name: slide-up;
  }

  @keyframes slide-up {
    from {
      transform: translateY(30px);
      opacity: 0;
    }
  }

  .hint {
    bottom: 90px;
  }
}

body.kiosk {
  user-select: none;
  -webkit-user-select: none;
}
