/* --- LOADER --- */
#confetti-loader {
  position: fixed;
  inset: 0;
  background-color: #fdfbf7;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease-out;
  pointer-events: none;
}
.flower-confetti {
  position: absolute;
  font-size: 20px;
  opacity: 0;
  animation: explode-out 2s forwards;
}
@keyframes explode-out {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(var(--s)) rotate(var(--r));
    opacity: 0;
  }
}

/* --- DECK Y CARTAS (El Mazo) --- */
.oracle-stage {
  perspective: 1200px;
  position: relative;
  height: 380px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  overflow: visible;
}
.crystal-deck-wrapper {
  position: relative;
  width: 240px;
  height: 340px;
  cursor: pointer;
  z-index: 50;
  animation: float 10s ease-in-out infinite;
  transform-style: preserve-3d;
  transition: opacity 1s ease;
}
.glossy-card {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95),
    rgba(245, 240, 255, 0.85)
  );
  border: 1px solid rgba(255, 255, 255, 1);
  box-shadow: 0 15px 35px rgba(139, 92, 246, 0.15),
    inset 0 0 30px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(5px);
  overflow: hidden;
}
.card-title-inside {
  position: absolute;
  top: 15%;
  width: 100%;
  text-align: center;
  font-family: "Pacifico", cursive;
  color: #8b5cf6;
  font-size: 1.6rem;
  z-index: 20;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
  pointer-events: none;
}
.card-instruction-inside {
  position: absolute;
  bottom: 15%;
  width: 100%;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  font-weight: bold;
  color: #f472b6;
  text-transform: uppercase;
  z-index: 20;
  pointer-events: none;
}

/* --- CAPAS DE LAS CARTAS --- */
.layer-1 { transform: translateZ(0px); z-index: 5; }
.layer-2 { transform: translateY(5px) translateZ(-5px) rotate(-2deg); z-index: 4; opacity: 0.9; }
.layer-3 { transform: translateY(10px) translateZ(-10px) rotate(1deg); z-index: 3; opacity: 0.8; }

/* --- ADORNOS DEL MAZO --- */
.deck-ribbon {
  position: absolute;
  top: 50%;
  left: -8px;
  right: -8px;
  height: 28px;
  background: rgba(244, 114, 182, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  transform: translateY(-50%);
  z-index: 10;
  backdrop-filter: blur(2px);
  box-shadow: 0 4px 10px rgba(244, 114, 182, 0.2);
}
.deck-knot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: radial-gradient(circle at 30% 30%, #fff, #f9a8d4);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 11;
}
.star-float {
  position: absolute;
  color: #fcd34d;
  font-size: 1.5rem;
  filter: drop-shadow(0 0 5px rgba(253, 224, 71, 0.8));
  animation: sparkle 2s infinite ease-in-out;
  z-index: 60;
}
@keyframes sparkle {
  0%, 100% { transform: scale(0.8); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* --- MODAL Y FONDO --- */
#revelation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(12px);
}
#revelation-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.aurora-bg-anim {
  background-size: 400% 400%;
  animation: aurora-move 10s ease infinite;
}
@keyframes aurora-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- ANIMACIONES INTERNAS --- */
.chakra-point { transition: all 0.5s ease; }
.revealed-card-inner {
  transform-style: preserve-3d;
  perspective: 1000px;
  animation: float 8s ease-in-out infinite;
  background: #fff;
  border: 4px solid white;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.5);
}

/* --- RESPIRACIÓN (Breath Work) --- */
.breath-circle { position: relative; }
.breath-ball {
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  animation: breathMove 8s ease-in-out infinite;
}
@keyframes breathCycle3Phases {
  0% { top: 85%; transform: translate(-50%, -50%) scale(0.6); } /* Abajo */
  33% { top: 15%; transform: translate(-50%, -50%) scale(1.3); } /* Sube (Inhala) */
  66% { top: 15%; transform: translate(-50%, -50%) scale(1.3); } /* Se queda (Sostén) */
  100% { top: 85%; transform: translate(-50%, -50%) scale(0.6); } /* Baja (Exhala) */
}
.breath-animation-active {
  animation: breathCycle3Phases 12s linear infinite;
}

/* Clase maestra que activa el barajado */
.is-shuffling {
  cursor: wait; /* Cambia el cursor para indicar espera */
}

/* La carta del medio se mueve a la izquierda */
.is-shuffling .layer-2 {
  animation: shuffleMoveLeft 0.4s ease-in-out infinite alternate;
}

/* La carta del fondo se mueve a la derecha */
.is-shuffling .layer-3 {
  animation: shuffleMoveRight 0.4s ease-in-out infinite alternate 0.2s; /* 0.2s de retraso para que no vayan al tiempo */
}

/* La carta de arriba vibra sutilmente */
.is-shuffling .layer-1 {
  animation: shuffleVibrate 0.1s linear infinite;
}

/* KEYFRAMES: Los movimientos */
@keyframes shuffleMoveLeft {
  0% { transform: translateY(5px) translateZ(-5px) rotate(-2deg) translateX(0); }
  100% { transform: translateY(5px) translateZ(-5px) rotate(-8deg) translateX(-40px); }
}

@keyframes shuffleMoveRight {
  0% { transform: translateY(10px) translateZ(-10px) rotate(1deg) translateX(0); }
  100% { transform: translateY(10px) translateZ(-10px) rotate(5deg) translateX(40px); }
}

@keyframes shuffleVibrate {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-1px, 1px) rotate(-1deg); }
  50% { transform: translate(0, 0) rotate(0deg); }
  75% { transform: translate(1px, -1px) rotate(1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* --- ESTADO LISTO (READY) --- */
/* Cuando termina de barajar, brilla */
.is-ready .glossy-card {
  box-shadow: 0 0 30px rgba(244, 114, 182, 0.6), inset 0 0 20px white;
  border-color: #F472B6;
  transition: all 0.5s ease;
}