/* =========================================================================
   Gefuehrte Tour (public/js/tour.js)
   ========================================================================= */
.tour { position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: 0; transition: opacity .25s; }
.tour.open { opacity: 1; }
.tr-veil { position: absolute; inset: 0; pointer-events: auto; }
.tour.interactive .tr-veil { pointer-events: none; }
.tr-spot {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(3, 6, 16, .74), 0 0 0 2px var(--cyan), 0 0 26px 4px rgba(47, 224, 228, .45);
  transition: top .38s cubic-bezier(.3, 1.2, .4, 1), left .38s cubic-bezier(.3, 1.2, .4, 1), width .38s, height .38s;
}
.tr-spot[hidden] { display: block; top: 50% !important; left: 50% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(3, 6, 16, .8); }
.tour.interactive .tr-spot { animation: trPulse 1.4s ease-in-out infinite; }
@keyframes trPulse { 50% { box-shadow: 0 0 0 9999px rgba(3, 6, 16, .74), 0 0 0 3px var(--gold), 0 0 34px 8px rgba(245, 166, 35, .55); } }

/* Sprechblase */
.tr-bubble {
  position: fixed; width: min(440px, calc(100vw - 24px)); display: flex; gap: 14px; padding: 16px 16px 14px;
  pointer-events: auto; border-radius: 18px; color: var(--text);
  background: linear-gradient(160deg, rgba(22, 30, 52, .97), rgba(10, 14, 26, .97));
  border: 1px solid rgba(47, 224, 228, .35);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 40px rgba(47, 224, 228, .08);
  transition: top .38s cubic-bezier(.3, 1.2, .4, 1), left .38s cubic-bezier(.3, 1.2, .4, 1);
}
.tr-bubble { overflow-y: auto; overscroll-behavior: contain; }
.tr-bubble.center { top: 50% !important; left: 50% !important; bottom: auto !important; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.tr-bubble.pop { animation: trPop .35s cubic-bezier(.3, 1.5, .5, 1); }
.tr-bubble.center.pop { animation: trPopC .35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes trPop { from { opacity: .3; scale: .94; } }
@keyframes trPopC { from { opacity: .3; transform: translate(-50%, -46%) scale(.94); } }
.tr-body { flex: 1; min-width: 0; }
.tr-head { display: flex; align-items: center; gap: 8px; font-size: .72rem; letter-spacing: 1.4px; text-transform: uppercase; color: var(--cyan); font-family: var(--font-display); }
.tr-count { color: var(--text-dim); }
.tr-x { margin-left: auto; background: none; border: 0; color: var(--text-dim); font-size: .95rem; cursor: pointer; padding: 2px 4px; }
.tr-x:hover { color: var(--text-bright); }
.tr-title { margin: 4px 0 6px; font-size: 1.12rem; color: var(--text-bright); font-family: var(--font-display); }
.tr-text { font-size: .92rem; line-height: 1.55; min-height: 3.2em; cursor: default; }
.tr-text b { color: var(--text-bright); }
.tr-text kbd { font-size: .75rem; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--bg-slot); }
.tr-caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--cyan); animation: trBlink .7s steps(2) infinite; }
@keyframes trBlink { 50% { opacity: 0; } }
.tr-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.tr-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.tr-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(125, 138, 163, .35); transition: all .25s; }
.tr-dots i.d { background: var(--cyan-dim); }
.tr-dots i.on { background: var(--cyan); width: 16px; border-radius: 3px; box-shadow: 0 0 8px var(--cyan); }
.tr-btns { display: flex; gap: 6px; flex-shrink: 0; }
.tr-next[hidden] { display: none; }

/* Der Guide: ein kleiner Holo-Mond mit Gesicht */
.tr-guide { position: relative; width: 54px; height: 54px; flex-shrink: 0; }
.tr-guide.big { width: 92px; height: 92px; margin: 0 auto 8px; }
.tr-moon {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #effcff 0 8%, #9ff3f5 22%, #2fb7c9 55%, #0d4a63 100%);
  box-shadow: 0 0 18px rgba(47, 224, 228, .55), inset -6px -8px 14px rgba(0, 20, 40, .55);
  animation: trFloat 3.2s ease-in-out infinite;
}
.tr-moon::before { content: ''; position: absolute; width: 18%; height: 18%; left: 62%; top: 20%; border-radius: 50%; background: rgba(13, 74, 99, .35); box-shadow: -18px 22px 0 -2px rgba(13, 74, 99, .25); }
.tr-moon b { position: absolute; top: 40%; width: 11%; height: 15%; border-radius: 50%; background: #06202c; animation: trEye 4s infinite; }
.tr-moon b:first-child { left: 32%; } .tr-moon b:nth-child(2) { left: 57%; }
.tr-moon em { position: absolute; left: 38%; top: 62%; width: 24%; height: 10%; border: 2px solid #06202c; border-top: 0; border-radius: 0 0 12px 12px; }
.tr-guide[data-mood="talk"] .tr-moon em { animation: trTalk .5s ease-in-out infinite alternate; }
.tr-guide[data-mood="happy"] .tr-moon em { height: 16%; background: #06202c; }
.tr-guide[data-mood="wave"] .tr-moon { animation: trFloat 3.2s ease-in-out infinite, trWave 1.2s ease-in-out 2; }
.tr-ring { position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed rgba(47, 224, 228, .45); animation: trSpin 14s linear infinite; }
.tr-ring::after { content: ''; position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
@keyframes trFloat { 50% { transform: translateY(-4px); } }
@keyframes trEye { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes trTalk { to { height: 4%; } }
@keyframes trWave { 25% { rotate: -10deg; } 75% { rotate: 10deg; } }
@keyframes trSpin { to { transform: rotate(360deg); } }

/* Abschluss: Feedback */
.tr-fb { display: grid; gap: 8px; margin-top: 10px; }
.tr-lbl { font-size: .8rem; color: var(--text-dim); } .tr-lbl small { opacity: .7; }
.tr-stars { display: flex; gap: 4px; }
.tr-stars button { font-size: 1.9rem; line-height: 1; background: none; border: 0; cursor: pointer; color: rgba(125, 138, 163, .4); transition: transform .12s, color .15s; padding: 0 2px; }
.tr-stars button:hover { transform: scale(1.15); }
.tr-stars button.on { color: var(--gold); text-shadow: 0 0 12px rgba(245, 166, 35, .6); }
.tr-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tr-chips button { font: inherit; font-size: .76rem; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--text); background: var(--bg-slot); border: 1px solid var(--line); }
.tr-chips button.on { border-color: var(--cyan); color: var(--text-bright); background: rgba(47, 224, 228, .14); }
.tr-txt { width: 100%; resize: vertical; min-height: 64px; font-size: .88rem; }
.tr-send { width: 100%; }
.tr-skip { background: none; border: 0; color: var(--text-dim); font: inherit; font-size: .78rem; cursor: pointer; text-decoration: underline; justify-self: center; padding: 4px; }
.tr-skip:hover { color: var(--text); }
.tr-reward {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(168, 85, 247, .16), rgba(245, 166, 35, .14)); border: 1px solid rgba(245, 166, 35, .4);
}
.tr-reward .egg { font-size: 1.9rem; filter: drop-shadow(0 0 10px rgba(245, 166, 35, .7)); animation: trFloat 2.4s ease-in-out infinite; }
.tr-reward div { display: grid; } .tr-reward b { color: var(--text-bright); } .tr-reward small { font-size: .72rem; color: var(--text-dim); }
.tr-reward .plus { color: var(--gold); font-weight: 700; }

.tr-got { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 0 6px; text-align: center; }
.tr-got small { color: var(--text-dim); font-size: .78rem; }
.tr-egg { font-size: 3.4rem; animation: trEggIn .7s cubic-bezier(.3, 1.6, .5, 1), trFloat 2.4s ease-in-out .7s infinite; filter: drop-shadow(0 0 18px rgba(245, 166, 35, .8)); }
.tr-lc { font-family: var(--font-display); font-size: 1.3rem; color: var(--gold); text-shadow: 0 0 14px rgba(245, 166, 35, .5); }
.tr-burst { position: absolute; top: 4px; left: 50%; width: 140px; height: 140px; margin-left: -70px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(245, 166, 35, .22) 0 10deg, transparent 10deg 24deg); animation: trSpin 9s linear infinite; mask: radial-gradient(circle, #000 30%, transparent 70%); }
@keyframes trEggIn { from { transform: scale(.2) rotate(-30deg); opacity: 0; } }

/* Angebot fuer Bestandsspieler */
.tr-offer { text-align: center; display: grid; gap: 10px; }
.tr-offer h2 { margin: 0; }
.tr-offer p { margin: 0; color: var(--text); line-height: 1.5; }
.tr-offer .tr-reward { justify-content: center; text-align: left; }
.tr-okick { font-size: .72rem; letter-spacing: 1.6px; text-transform: uppercase; color: var(--cyan); font-family: var(--font-display); }
.tr-fine { font-size: .76rem; color: var(--text-dim) !important; }
.tr-offer .modal-actions { justify-content: center; }

/* HUD-Knopf */
.hud-tour {
  position: relative; display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; padding: 6px 12px; border-radius: 999px;
  cursor: pointer; font: inherit; font-family: var(--font-display); font-weight: 700; color: var(--text-bright); white-space: nowrap;
  background: linear-gradient(180deg, rgba(168, 85, 247, .3), rgba(168, 85, 247, .08)); border: 1px solid rgba(168, 85, 247, .6);
  animation: trGlow 2.2s ease-in-out infinite;
}
@keyframes trGlow { 50% { box-shadow: 0 0 16px rgba(168, 85, 247, .55); } }

/* Einstiegskarte auf "Erste Schritte" */
.tr-entry { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 16px; border-radius: 16px;
  background: linear-gradient(120deg, rgba(47, 224, 228, .12), rgba(168, 85, 247, .1)); border: 1px solid rgba(47, 224, 228, .3); }
.tr-entry .tr-guide { width: 58px; height: 58px; }
.tr-entry div.tx { flex: 1; } .tr-entry b { color: var(--text-bright); font-size: 1.02rem; } .tr-entry p { margin: 2px 0 0; color: var(--text-dim); font-size: .86rem; }

/* Dev-Panel */
.tfb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tfb-kpi { padding: 10px 12px; border-radius: 12px; background: var(--bg-panel); border: 1px solid var(--line); display: grid; }
.tfb-kpi small { color: var(--text-dim); font-size: .72rem; } .tfb-kpi b { font-size: 1.15rem; color: var(--text-bright); }
.tfb-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tfb-bar { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 8px; font-size: .8rem; margin: 5px 0; }
.tfb-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tfb-bar i { height: 8px; border-radius: 4px; background: rgba(125, 138, 163, .15); position: relative; overflow: hidden; }
.tfb-bar i::after { content: ''; position: absolute; inset: 0; width: var(--w); background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); border-radius: 4px; }
.tfb-bar em { font-style: normal; text-align: right; color: var(--text-dim); }
.tfb-row { padding: 10px 0; border-top: 1px solid var(--line); }
.tfb-row:first-of-type { border-top: 0; }
.tfb-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tfb-top small { margin-left: auto; color: var(--text-dim); font-size: .74rem; }
.tfb-st { color: var(--gold); letter-spacing: 1px; } .tfb-st i { font-style: normal; color: rgba(125, 138, 163, .3); }
.tfb-un { font-size: .78rem; color: var(--cyan); margin-top: 3px; }
.tfb-row p { margin: 4px 0 0; font-size: .88rem; line-height: 1.45; white-space: pre-wrap; }

@media (max-width: 900px) {
  .tr-bubble { padding: 12px 12px 10px; gap: 10px; }
  .tr-guide { width: 40px; height: 40px; }
  .tr-text { font-size: .88rem; }
  .hud-tour .lb { display: none; }
  .hud-tour { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-spot, .tr-bubble { transition: none; }
  .tr-moon, .tr-ring, .tr-burst, .tr-egg, .tr-reward .egg, .hud-tour, .tour.interactive .tr-spot { animation: none; }
}

/* Popups, die waehrend der Tour aufgehen, warten bis danach */
body.tour-on #overlay.open { visibility: hidden; }
