:root {
  --night: #0b1016;
  --ink: #eef1f4;
  --muted: #9aa6b2;
  --amber: #ffb04a;
  --glass: rgba(12, 18, 26, 0.72);
  --line: rgba(255, 255, 255, 0.10);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); font-family: var(--sans); }
#map { position: fixed; inset: 0; }

/* ---------- Infopanel ---------- */
.panel {
  position: fixed; top: 20px; left: 20px; z-index: 2;
  padding: 18px 22px 16px; width: 320px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  animation: rise 900ms cubic-bezier(.2,.7,.2,1) both 300ms;
}
.kicker {
  margin: 0 0 6px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
h1 {
  margin: 0; font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1; letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 0%, #ffd9a3 140%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.coords { margin: 8px 0 14px; font-size: 12px; color: var(--amber); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.stats dt { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Steuerung ---------- */
.controls {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
  display: flex; gap: 4px; padding: 5px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: rise 900ms cubic-bezier(.2,.7,.2,1) both 500ms;
}
.controls button {
  appearance: none; border: 0; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; font: 600 13px/1 var(--sans); letter-spacing: 0.02em;
  color: var(--ink); background: transparent; transition: background 160ms, color 160ms;
}
.controls button:hover { background: rgba(255, 255, 255, 0.08); }
.controls button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.controls button[aria-pressed="true"] { background: var(--amber); color: #1b1207; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 3; pointer-events: none;
  padding: 8px 11px; border-radius: 10px; font-size: 12px; line-height: 1.35;
  background: rgba(8, 12, 18, 0.9); border: 1px solid rgba(94, 225, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); white-space: nowrap;
  transform: translate(14px, 14px);
}
.tooltip b { display: block; font-size: 13px; color: #5ee1ff; }
.tooltip small { color: var(--muted); }

/* ---------- Legende ---------- */
.legend {
  position: fixed; left: 20px; bottom: 30px; z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  font-size: 11px; color: var(--muted); letter-spacing: 0.06em;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.legend i { width: 90px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #efe6d6, #f6c27a, #ff7a33); }

/* ---------- MapLibre-Anpassungen ---------- */
.maplibregl-ctrl-attrib {
  background: rgba(11, 16, 22, 0.78) !important; color: #c3ccd5; font-size: 10px;
}
.maplibregl-ctrl-group { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.maplibregl-ctrl-attrib a { color: #c9d1d9; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }

.fallback { position: fixed; inset: auto 0 50% 0; text-align: center; color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.controls { animation-name: rise-c; }
@keyframes rise-c { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .panel { top: 12px; left: 12px; right: 12px; width: auto; padding: 14px 16px 12px; }
  h1 { font-size: 34px; }
  .coords { margin: 6px 0 10px; }
  .stats dd { font-size: 16px; }
  .legend { display: none; }
  .maplibregl-ctrl-top-right { display: none; }   /* mobil: Gesten statt Buttons */
  .controls { bottom: calc(44px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); }
  .controls button { padding: 9px 12px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .controls { animation: none; }
}
