/* Bods Journey — Onboarding Tour styles */

/* Replay tour floating button (bottom-left of main screen) */
.replay-tour-btn {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(180deg, rgba(26,15,8,0.92) 0%, rgba(10,5,3,0.95) 100%);
  border: 2px solid #d4af37;
  border-radius: 6px;
  color: #f4e8c1;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 0 30px rgba(212,175,55,0.25),
    0 6px 18px rgba(0,0,0,0.6),
    inset 0 0 20px rgba(212,175,55,0.06);
  transition: all 0.25s ease;
}

.replay-tour-btn:hover {
  background: linear-gradient(180deg, rgba(212,175,55,0.2) 0%, rgba(139,0,0,0.35) 100%);
  transform: translateY(-2px);
  box-shadow:
    0 0 40px rgba(212,175,55,0.5),
    0 10px 24px rgba(0,0,0,0.7);
  color: #fff8e0;
}

.replay-tour-icon {
  color: #d4af37;
  font-size: 1.1rem;
  text-shadow: 0 0 12px rgba(212,175,55,0.8);
}

@media (max-width: 768px) {
  .replay-tour-btn {
    bottom: 1rem;
    left: 1rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.72rem;
  }
  .replay-tour-label { display: none; }
  .replay-tour-icon { font-size: 1.3rem; }
}

/* Hide replay button while tour is active */
body:has(#tour-overlay) .replay-tour-btn { display: none; }

/* Debug mode coord tooltip */
.tour-debug-coord {
  position: fixed;
  z-index: 99999;
  background: #000;
  color: #0f0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid #0f0;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}

.tour-debug-pin {
  position: fixed;
  z-index: 99999;
  transform: translate(-50%, -50%);
  background: #0f0;
  color: #000;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(0,255,0,0.8);
  pointer-events: none;
  animation: debugPin 1.5s ease forwards;
  white-space: nowrap;
}

@keyframes debugPin {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); }
}



.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #0a0503;
  animation: tourFadeIn 0.6s ease forwards;
  font-family: 'Cinzel', serif;
  overflow: hidden;
}

@keyframes tourFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tour-overlay.tour-fade-out {
  animation: tourFadeOut 0.5s ease forwards;
}

@keyframes tourFadeOut {
  to { opacity: 0; }
}

.tour-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.tour-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  --spot-x: 50%;
  --spot-y: 50%;
  --spot-scale: 1;
  background: transparent;
  transition: background 0.7s ease;
}

.tour-spotlight.active {
  background: radial-gradient(
    circle at var(--spot-x) var(--spot-y),
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,0) calc(7% * var(--spot-scale)),
    rgba(0,0,0,0.35) calc(13% * var(--spot-scale)),
    rgba(0,0,0,0.75) calc(22% * var(--spot-scale)),
    rgba(0,0,0,0.92) calc(40% * var(--spot-scale)),
    rgba(0,0,0,0.96) 100%
  );
  box-shadow: inset 0 0 120px rgba(212,175,55,0.12);
}

.tour-spotlight.active::after {
  content: '';
  position: absolute;
  left: var(--spot-x);
  top: var(--spot-y);
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: 0 0 60px 20px rgba(212,175,55,0.25);
  animation: spotPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes spotPulse {
  0%, 100% { box-shadow: 0 0 60px 20px rgba(212,175,55,0.2); }
  50% { box-shadow: 0 0 90px 30px rgba(212,175,55,0.38); }
}

.tour-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.6) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 60%, rgba(10,5,3,0.85) 100%);
  pointer-events: none;
}

.tour-skip {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 5;
  background: rgba(10,5,3,0.75);
  border: 1px solid rgba(212,175,55,0.5);
  color: #e8d9a8;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.tour-skip:hover {
  background: rgba(139,0,0,0.5);
  color: #f4e8c1;
  border-color: #d4af37;
}

.tour-progress {
  position: absolute;
  top: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  background: rgba(10,5,3,0.7);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 40px;
}

.tour-progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(212,175,55,0.2);
  border: 1px solid rgba(212,175,55,0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tour-progress-dot.visited {
  background: rgba(212,175,55,0.5);
}

.tour-progress-dot.active {
  background: #d4af37;
  border-color: #f4e8c1;
  box-shadow: 0 0 12px rgba(212,175,55,0.9);
  transform: scale(1.3);
}

.tour-anciao {
  position: absolute;
  bottom: 0;
  left: 2rem;
  height: 62vh;
  max-height: 640px;
  z-index: 3;
  filter: drop-shadow(0 0 30px rgba(0,0,0,0.8)) drop-shadow(0 0 60px rgba(212,175,55,0.25));
  animation: ancianoFloat 4s ease-in-out infinite, ancianoEnter 0.8s ease 0.3s backwards;
  pointer-events: none;
}

@keyframes ancianoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes ancianoEnter {
  from { opacity: 0; transform: translateX(-60px) translateY(20px); }
  to { opacity: 1; transform: translateX(0) translateY(0); }
}

.tour-dialog {
  position: absolute;
  width: clamp(340px, 45vw, 620px);
  background:
    linear-gradient(180deg, rgba(26,15,8,0.95) 0%, rgba(10,5,3,0.98) 100%);
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 2rem 2.5rem;
  color: #f4e8c1;
  box-shadow:
    0 0 60px rgba(212,175,55,0.25),
    0 20px 60px rgba(0,0,0,0.7),
    inset 0 0 40px rgba(212,175,55,0.05);
  z-index: 4;
  animation: dialogEnter 0.7s ease 0.4s backwards;
  transition: top 0.5s ease, bottom 0.5s ease, left 0.5s ease, right 0.5s ease;
}

/* Position variants — avoid covering the highlighted tower */
.tour-dialog.pos-br { bottom: 3rem; right: 3rem; top: auto; left: auto; }
.tour-dialog.pos-tr { top: 5.5rem; right: 3rem; bottom: auto; left: auto; }
.tour-dialog.pos-tl { top: 5.5rem; left: 3rem; bottom: auto; right: auto; }
.tour-dialog.pos-bc { bottom: 3rem; left: 50%; right: auto; top: auto; transform: translateX(-30%); }

.tour-dialog::before,
.tour-dialog::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid #d4af37;
}

.tour-dialog::before {
  top: -2px; left: -2px;
  border-right: none; border-bottom: none;
}

.tour-dialog::after {
  bottom: -2px; right: -2px;
  border-left: none; border-top: none;
}

@keyframes dialogEnter {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-dialog-title {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: #d4af37;
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(212,175,55,0.5);
}

.tour-dialog-body {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 1.3rem;
  line-height: 1.55;
  color: #e8d9a8;
  font-style: italic;
  margin-bottom: 1.8rem;
}

.tour-dialog-body strong {
  color: #d4af37;
  font-weight: 700;
  font-style: normal;
}

.fade-in {
  animation: fadeInText 0.5s ease;
}

@keyframes fadeInText {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212,175,55,0.25);
}

.tour-counter {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #b89a5e;
  letter-spacing: 0.1em;
}

.tour-nav {
  display: flex;
  gap: 0.8rem;
}

.tour-btn {
  min-width: 56px;
  height: 48px;
  padding: 0 1.2rem;
  background: linear-gradient(180deg, rgba(212,175,55,0.2) 0%, rgba(139,0,0,0.3) 100%);
  border: 2px solid #d4af37;
  border-radius: 6px;
  color: #f4e8c1;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.tour-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(212,175,55,0.4) 0%, rgba(139,0,0,0.5) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212,175,55,0.3);
}

.tour-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tour-btn-next {
  background: linear-gradient(180deg, rgba(212,175,55,0.35) 0%, rgba(139,0,0,0.5) 100%);
}

/* Mobile */
@media (max-width: 768px) {
  .tour-anciao {
    height: 42vh;
    left: 50%;
    transform: translateX(-50%);
    bottom: auto;
    top: 4rem;
  }

  .tour-dialog,
  .tour-dialog.pos-br,
  .tour-dialog.pos-tr,
  .tour-dialog.pos-tl,
  .tour-dialog.pos-bc {
    left: 1rem;
    right: 1rem;
    bottom: 1.5rem;
    top: auto;
    width: auto;
    padding: 1.5rem 1.5rem;
    transform: none;
  }

  .tour-dialog-title {
    font-size: 1.4rem;
  }

  .tour-dialog-body {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
  }

  .tour-btn {
    min-width: 48px;
    height: 44px;
    font-size: 1rem;
  }

  .tour-skip {
    top: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    padding: 0.45rem 0.9rem;
  }

  .tour-progress {
    top: 1rem;
  }

  @keyframes ancianoFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-6px); }
  }

  @keyframes ancianoEnter {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}
