:root {
  --hogwarts-gold: #d4af37;
  --gryffindor-red: #740001;
  --slytherin-green: #1a472a;
  --ravenclaw-blue: #0e1a40;
  --parchment: #f0e6d2;
}

body {
  background-color: #050510;
  font-family: "Cinzel", serif;
  overflow-x: hidden;
  color: var(--parchment);
  margin: 0;
  padding: 0;
}

/* --- AJUSTE CSS: VISIBILIDAD CONTROLADA --- */
#swipe-hint {
  transition: opacity 0.5s ease-out;
}

#swipe-hint.run-swipe-anim {
  opacity: 1 !important;
}

.ghost-circle {
  width: 70px;
  height: 70px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
}

.ghost-dot {
  width: 14px;
  height: 14px;
  background-color: var(--hogwarts-gold);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--hogwarts-gold);
  opacity: 0;
}

@keyframes multi-axis-swipe {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  35% {
    transform: translate(-35px, 0);
  }
  50% {
    transform: translate(0, 0);
  }
  65% {
    transform: translate(0, -35px);
  }
  85% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(0, 0);
    opacity: 0;
  }
}

.run-swipe-anim .ghost-dot {
  animation: multi-axis-swipe 2.5s ease-in-out 2 forwards;
}

/* --- ESTILOS PARA LIGHTBOX Y ROTACIÓN INTELIGENTE --- */
.rotate-mobile {
  transform: rotate(90deg);
  width: 100vh !important;
  height: 100vw !important;
  max-width: 100vh !important;
  max-height: 100vw !important;
  object-fit: contain;
}

.pointer-events-auto {
  pointer-events: auto;
}

#lightbox-modal {
  transition:
    opacity 0.3s ease-in-out,
    visibility 0.3s;
}

/* --- PANTALLA DE INTRODUCCIÓN (EL SOBRE) --- */
#intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #050510;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.8s ease-in-out,
    visibility 0.8s;
}

.envelope-container {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.envelope-container:hover {
  transform: scale(1.02);
}

.envelope-open-anim {
  animation: openEnvelopeAnim 1.5s forwards cubic-bezier(0.645, 0.045, 0.355, 1);
}

@keyframes openEnvelopeAnim {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

.envelope {
  width: 320px;
  height: 220px;
  background: #f5deb3;
  background-image: url("https://www.transparenttextures.com/patterns/aged-paper.png");
  position: relative;
  border-radius: 5px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #8b4513;
}

.envelope::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #e3c896;
  z-index: 1;
  clip-path: polygon(10% 10%, 90% 10%, 50% 50%);
  opacity: 0;
  transition: opacity 0.5s;
}
.envelope-opened::after {
  opacity: 1;
}

.envelope::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid #d4b886;
  border-right: 160px solid #d4b886;
  border-bottom: 110px solid #e3c896;
  border-top: 110px solid transparent;
  z-index: 5;
  pointer-events: none;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 120px solid #cfaa76;
  transform-origin: top;
  transition:
    transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
    z-index 0.8s;
  z-index: 6;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}
.flap-open {
  transform: rotateX(180deg);
  z-index: 0;
}

.wax-seal {
  width: 60px;
  height: 60px;
  background: #740001;
  border-radius: 50%;
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #5a0000;
  font-family: "MedievalSharp";
  font-size: 35px;
  color: #d4af37;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.seal-broken {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.5);
}

.recipient {
  position: absolute;
  bottom: 30px;
  width: 100%;
  text-align: center;
  font-family: "Cinzel", serif;
  color: #3e2723;
  z-index: 12;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

/* --- FIN INTRODUCCIÓN --- */

.main-content-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease-in;
}
.reveal-content {
  opacity: 1;
  pointer-events: auto;
}

.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
  z-index: -2;
}
.twinkling {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: -1;
  animation: twinkle 5s infinite;
}
.floating-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.candle {
  position: absolute;
  width: 12px;
  height: 35px;
  background: linear-gradient(#fff, #e4d5b7);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  opacity: 0.8;
}
.flame {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 18px;
  background: radial-gradient(
    ellipse at bottom,
    #ffeb3b 0%,
    #ff9800 50%,
    transparent 100%
  );
  border-radius: 50% 50% 20% 20%;
  animation: flicker 1s infinite alternate;
  filter: blur(1px);
}

.parchment-bg {
  background-color: #f5deb3;
  background-image: url("https://www.transparenttextures.com/patterns/aged-paper.png");
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(212, 175, 55, 0.4);
  border: 2px solid var(--hogwarts-gold);
  color: #2c241b;
}

.photo-frame {
  border: 8px solid var(--hogwarts-gold);
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.5s ease,
    opacity 0.5s ease;
}
.photo-frame::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0px);
  }
}
@keyframes flicker {
  0% {
    opacity: 0.8;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1.1);
  }
}
@keyframes twinkle {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0.3;
  }
}
@keyframes magicFade {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.magical-text {
  font-family: "Great Vibes", cursive;
  text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}
.btn-magic {
  background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
  border: 1px solid var(--hogwarts-gold);
  color: var(--hogwarts-gold);
  transition: all 0.3s ease;
}
.btn-magic:hover {
  box-shadow: 0 0 15px var(--hogwarts-gold);
  transform: translateY(-2px);
  text-shadow: 0 0 8px var(--hogwarts-gold);
}

.music-playing {
  animation: spinSlow 4s linear infinite;
  box-shadow: 0 0 15px var(--hogwarts-gold);
  background: #1a472a;
  color: white;
  border-color: #fff;
}

.countdown-box {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #d4af37;
  padding: 10px;
  border-radius: 8px;
  min-width: 70px;
}
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
  background: var(--hogwarts-gold);
  border-radius: 5px;
}
