/* Layout: Panorama vollflächig, Bedienung schwebt darüber (Titel oben links, Leiste unten). */
:root {
  color-scheme: dark;
  --bg: #0b111a;
  --panel: rgba(11, 18, 30, 0.74);
  --panel-solid: #121b2b;
  --line: rgba(255, 255, 255, 0.16);
  --text: #f2f7f7;
  --muted: #b3c0d4;
  --accent: #2f80ed;        /* Blau */
  --accent-ink: #ffffff;
  --info: #ffffff;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

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

.tour {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#pano {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  outline: none;
}
#pano.dragging { cursor: grabbing; }
#pano:focus-visible { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6); }

.fade {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.fade.on { opacity: 1; }

/* ---------- Titel ---------- */
.tour-title {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  max-width: calc(100% - 32px);
  padding: 8px 14px 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.tour-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-title h1 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.2;
  text-wrap: balance;
}

/* ---------- Hotspots ---------- */
.hotspots { position: absolute; inset: 0; pointer-events: none; }

.hotspot {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
}
.hotspot[hidden] { display: none; }

.hotspot-dot {
  position: relative;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* Szenenwechsel: türkiser Ring mit Pfeil */
.hotspot-scene .hotspot-dot {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(10, 32, 70, 0.55);
  border: 2px solid var(--accent);
  transition: transform 0.15s, background 0.15s;
}
.hotspot-scene .hotspot-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -3px 0 0 -6px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  transform: rotate(45deg);
}
.hotspot-scene:hover .hotspot-dot,
.hotspot-scene:focus-visible .hotspot-dot { transform: scale(1.12); background: rgba(10, 32, 70, 0.8); }

/* Info: weißer Punkt mit Pulsring */
.hotspot-info .hotspot-dot {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid var(--info);
}
.hotspot-info .hotspot-dot::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--info);
}
.hotspot-info .hotspot-dot::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--info);
  animation: pulse 2.2s ease-out infinite;
}

.hotspot-label {
  margin-top: -1px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity 0.15s, transform 0.15s;
}
.hotspot:hover .hotspot-label,
.hotspot:focus-visible .hotspot-label,
.hotspot.active .hotspot-label { opacity: 1; transform: translate(0, -50%); }
.hotspot-scene .hotspot-label { opacity: 0.92; transform: translate(0, -50%); }
.hotspot:focus-visible { outline: none; }
.hotspot:focus-visible .hotspot-dot { outline: 3px solid rgba(255, 255, 255, 0.75); outline-offset: 3px; }

@media (hover: none) {
  .hotspot-label { opacity: 1; transform: translate(0, -50%); }
}

@keyframes pulse {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* ---------- Unten: Steuerung + Szenenleiste ---------- */
.bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }

.controls {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.controls button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.controls button:hover { background: rgba(255, 255, 255, 0.12); }
.controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.controls button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.controls svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-bar {
  display: flex;
  gap: 8px;
  max-width: 100%;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.scene-bar[hidden] { display: none; }

.scene-thumb {
  flex: none;
  width: 128px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 0 6px;
  border: 2px solid transparent;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.scene-thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--panel-solid);
}
.scene-thumb span {
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.scene-thumb:hover { background: rgba(255, 255, 255, 0.12); }
.scene-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scene-thumb.current { border-color: var(--accent); }

/* ---------- Info-Fenster ---------- */
.info {
  position: absolute;
  top: calc(max(16px, env(safe-area-inset-top)) + 72px);
  right: 16px;
  width: min(340px, calc(100% - 32px));
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.info[hidden] { display: none; }
.info h2 { margin: 0 28px 6px 0; font-size: 17px; }
.info p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.info-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.info-close:hover { background: rgba(255, 255, 255, 0.12); }
.info-close:focus-visible { outline: 2px solid var(--accent); }

/* ---------- Bearbeitungsmodus ---------- */
.editor {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(280px, calc(100% - 32px));
  padding: 12px 14px;
  font-size: 13px;
  background: var(--panel-solid);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.editor[hidden] { display: none; }
.editor span { color: var(--muted); }
.editor code {
  padding: 6px 8px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  user-select: text;
  -webkit-user-select: text;
}
.editor button {
  align-self: flex-start;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Loader ---------- */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 24px;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  transition: opacity 0.4s;
}
.loader.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loader.error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .controls button { width: 38px; height: 38px; }
  .scene-thumb { width: 108px; }
  .info { top: auto; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px); left: 16px; right: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .hotspot-info .hotspot-dot::before, .spinner { animation: none; }
  .fade, .loader { transition: none; }
}

/* Hotspots während des Little-Planet-Intros ausblenden */
.hotspots { transition: opacity 0.5s; }
.hotspots.intro-hidden { opacity: 0; pointer-events: none; }
.hotspots.intro-hidden .hotspot { pointer-events: none; }

/* ---------- Ersteller-Hinweis ---------- */
.credit {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s;
}
.credit[hidden] { display: none; }
.credit strong { color: var(--text); font-weight: 600; }
.credit img { height: 18px; width: auto; display: block; }
.credit:not(.no-link):hover { border-color: var(--accent); color: var(--text); }
.credit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.credit.no-link { pointer-events: none; }
/* Bearbeitungsmodus belegt die Ecke */
.editor:not([hidden]) ~ .credit, .credit:has(~ .editor:not([hidden])) { display: none; }
@media (max-width: 520px) {
  .credit { font-size: 11px; padding: 5px 12px; border-radius: 12px; }
  /* Handy: zweizeilig, damit der Hinweis neben dem Titel Platz hat */
  .credit > span { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
  .credit-pre { font-size: 10px; letter-spacing: 0.02em; }
}

/* ---------- Kontakt-Popup ---------- */
.credit { cursor: pointer; }
.credit:hover { border-color: var(--accent); color: var(--text); }
.contact {
  position: absolute;
  top: calc(max(16px, env(safe-area-inset-top)) + 46px);
  right: 16px;
  width: min(320px, calc(100% - 32px));
  padding: 18px 20px 16px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.5;
}
.contact[hidden] { display: none; }
.contact-kicker {
  margin: 0 32px 2px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.contact h2 { margin: 0 32px 2px 0; font-size: 18px; line-height: 1.25; }
.contact-person { margin: 0 0 10px; color: var(--muted); }
.contact-person:empty { display: none; }
.contact-address { margin: 0 0 12px; font-style: normal; color: var(--text); }
.contact-links { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.contact-links li { display: grid; grid-template-columns: 78px 1fr; gap: 8px; min-width: 0; }
.contact-label { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.contact-links span:not(.contact-label) { color: var(--text); overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
/* Links klar als Links erkennbar: Akzentfarbe, Unterstreichung, Pfeil */
.contact-links a, .contact-address a {
  color: #7fb2ff;
  text-decoration: underline;
  text-decoration-color: rgba(127, 178, 255, 0.45);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.contact-links a::after, .contact-address a::after { content: " ›"; color: var(--accent); }
.contact-links a:hover, .contact-address a:hover { color: #fff; text-decoration-color: #fff; }
.contact-address a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.contact-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.contact .info-close { top: 10px; right: 10px; }
@media (max-width: 520px) {
  .contact { left: 16px; right: 16px; width: auto; top: calc(max(16px, env(safe-area-inset-top)) + 70px); }
}

/* ---------- Bodenpfeile (Street-View-Stil) ---------- */
.ground-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.garrow { cursor: pointer; pointer-events: auto; outline: none; }
.garrow-hit { fill: transparent; pointer-events: all; }
.garrow-label { pointer-events: all; }
.garrow-shadow { fill: rgba(0, 0, 0, 0.35); filter: blur(3px); }
.garrow-body {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(0, 0, 0, 0.18);
  stroke-width: 1;
  stroke-linejoin: round;
  transition: fill 0.15s;
}
.garrow:hover .garrow-body,
.garrow:focus-visible .garrow-body { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.garrow-label {
  font: 600 13px var(--font);
  fill: #fff;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.65);
  stroke-width: 4px;
  stroke-linejoin: round;
  opacity: 0.9;
  transition: opacity 0.15s;
  pointer-events: none;
}
.garrow:hover .garrow-label,
.garrow:focus-visible .garrow-label { opacity: 1; }

/* Info-Texte dürfen Zeilenumbrüche enthalten */
.info p { white-space: pre-line; }
.info { max-height: calc(100% - 200px); overflow-y: auto; width: min(380px, calc(100% - 32px)); }
