/* ============================================================
   TOUR — Funktionseinführung mit Spotlight (js/tour.js)

   Dunkelt den Bildschirm ab, schneidet ein Loch um ein echtes
   Element und zeigt per Linie aus der Sprechblase darauf.
   ============================================================ */

html.tour-open,
html.tour-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.tour-root {
  position: fixed;
  inset: 0;
  /* z-index wird in JS gesetzt (über .modal-overlay) */
  -webkit-tap-highlight-color: transparent;
}

/* Fängt alle Klicks ab — sonst navigiert die globale
   [data-page]-Delegation aus app.js unter der Tour weg. */
.tour-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.tour-dim {
  fill: rgba(12, 8, 4, 0.74);
  transition: opacity 0.2s ease;
}

/* Beim Schrittwechsel: Blase gedämpft stehen lassen statt ausblenden —
   sonst starrt man bis zu 3,5 s (Anker-Timeout) auf einen leeren Schirm.
   pointer-events aus, damit Doppelklicks den Wechsel nicht anstoßen. */
.tour-root.is-loading .tour-bubble {
  opacity: 0.5;
  pointer-events: none;
}
.tour-root.is-loading .tour-line,
.tour-root.is-loading .tour-dot { opacity: 0; }

/* Leuchtring um das Loch */
.tour-ring {
  stroke: var(--c-primary);
  stroke-width: 2.5;
  opacity: 0.9;
  filter: drop-shadow(0 0 8px rgba(196, 132, 58, 0.55));
  animation: tour-ring-pulse 2s ease-in-out infinite;
}

@keyframes tour-ring-pulse {
  0%, 100% { opacity: 0.85; stroke-width: 2.5; }
  50%      { opacity: 1;    stroke-width: 3.5; }
}

/* Verbindungslinie Blase → Loch (die saubere Fassung des Pfeils) */
.tour-line {
  stroke: var(--c-primary);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.95;
  filter: drop-shadow(0 0 6px rgba(196, 132, 58, 0.5));
  transition: opacity 0.18s ease;
}

.tour-dot {
  fill: var(--c-primary);
  filter: drop-shadow(0 0 6px rgba(196, 132, 58, 0.7));
  transition: opacity 0.18s ease;
}

/* ---------- Sprechblase ---------- */
/* Höhe wird in JS auf den Viewport begrenzt (_position). Der Text scrollt
   dann innen, Kopf und Fuß bleiben stehen — sonst rutschen bei langem Text
   oder großer Systemschrift die Buttons aus dem Bild und die Tour hängt
   unrettbar fest, weil das Overlay alle Klicks schluckt. */
.tour-bubble {
  position: absolute;
  width: max-content;
  max-width: 360px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 14px;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg, 1rem);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  outline: none;
  transition: top 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              left 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tour-bubble.is-in { animation: tour-bubble-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.4); }

@keyframes tour-bubble-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.tour-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.tour-step-no {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-primary);
}

.tour-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full, 9999px);
  background: transparent;
  color: var(--c-text);
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.tour-close:hover { opacity: 0.9; background: rgba(128, 128, 128, 0.14); }
.tour-close svg   { width: 17px; height: 17px; }

.tour-title {
  margin: 0 0 5px;
  font-size: 1.02rem;
  font-weight: 750;
  line-height: 1.3;
  flex-shrink: 0;
}

/* Der einzige Bereich, der bei Platzmangel schrumpft und scrollt.
   min-height:0 ist Pflicht — sonst ignoriert ein Flex-Kind sein overflow. */
.tour-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.85;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-shrink: 0;
}

/* Kein Umbruch: ab ~12 Schritten rutschten die Punkte sonst in eine
   zweite Zeile und die Fußleiste sah kaputt aus. Lieber eng als zweizeilig. */
.tour-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  max-width: 50%;
  min-width: 0;
}

.tour-dot-i {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--c-text);
  opacity: 0.22;
  transition: opacity 0.2s ease, width 0.2s ease, background 0.2s ease;
}

.tour-dot-i.is-on {
  width: 14px;
  border-radius: 3px;
  background: var(--c-primary);
  opacity: 1;
}

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

.tour-btn {
  padding: 8px 15px;
  font-size: 0.86rem;
  font-weight: 650;
  font-family: inherit;
  color: var(--c-text);
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}
.tour-btn:hover:not(:disabled)  { background: rgba(128, 128, 128, 0.12); }
.tour-btn:active:not(:disabled) { transform: scale(0.97); }
.tour-btn:disabled              { opacity: 0.3; cursor: default; }

.tour-btn--primary {
  color: #fff;
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.tour-btn--primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--c-primary); }

/* Schmale Geräte: Aktionen dürfen umbrechen */
@media (max-width: 380px) {
  .tour-bubble { padding: 14px 15px 12px; }
  .tour-foot   { flex-wrap: wrap; }
  .tour-dots   { max-width: 100%; order: 2; }
  .tour-actions{ order: 1; width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-ring   { animation: none; }
  .tour-bubble { transition: none; }
  .tour-bubble.is-in { animation: none; }
}
