/* ============================================================
   Card Nova Corp — pack-opening-3d.css
   Animación original: sobre → rasgado → carta gira → revela web
   ============================================================ */

#pack-opener-3d-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #0f0f1a;
  transition: visibility 0.5s;
  overflow: hidden;
}
#pack-opener-3d-overlay.opening {
  animation: fadeOverlayBg 2.8s forwards cubic-bezier(0.8, 0, 0.2, 1);
}
@keyframes fadeOverlayBg {
  0%,
  55% {
    background-color: #0f0f1a;
  }
  70%,
  100% {
    background-color: rgba(15, 15, 26, 0);
  }
}
#pack-opener-3d-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Energía giratoria */
.energy-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vw;
  height: 200vw;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 240, 255, 0.5) 60deg,
    transparent 120deg,
    rgba(155, 89, 182, 0.5) 200deg,
    transparent 260deg,
    rgba(255, 208, 0, 0.4) 320deg,
    transparent 360deg
  );
  animation: spinEnergy 10s linear infinite;
  z-index: 1;
  mask-image: radial-gradient(circle at center, white 0%, transparent 60%);
  -webkit-mask-image: radial-gradient(
    circle at center,
    white 0%,
    transparent 60%
  );
  will-change: transform;
}
@keyframes spinEnergy {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Anillos de pulso */
.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.5);
  width: 250px;
  height: 250px;
  animation: pulseRingAnim 2.5s infinite cubic-bezier(0.1, 0.5, 0.1, 1);
  z-index: 1;
  will-change: transform, opacity;
}
.pulse-ring:nth-child(3) {
  border-color: rgba(155, 89, 182, 0.4);
  animation-delay: 1.2s;
}
@keyframes pulseRingAnim {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
    border-width: 4px;
  }
  100% {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
    border-width: 1px;
  }
}
#pack-opener-3d-overlay.opening .energy-burst,
#pack-opener-3d-overlay.opening .pulse-ring {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s ease-out,
    visibility 0.5s ease-out;
  animation: none;
}

/* Sobre flotante */
.booster-pack-container {
  position: relative;
  width: 300px;
  height: 440px;
  cursor: pointer;
  perspective: 1000px;
  z-index: 20;
  animation: floatingPack 4s ease-in-out infinite;
  transform-style: preserve-3d;
  transition:
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    filter 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes floatingPack {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -15px;
  }
}
.booster-pack {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.pack-content {
  width: 300px;
  height: 440px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    #1a0050 15%,
    #3a0088 40%,
    #8b22c0 50%,
    #3a0088 60%,
    #1a0050 85%,
    rgba(255, 255, 255, 0.12) 100%
  );
  box-shadow:
    inset 0 30px 20px rgba(0, 0, 0, 0.6),
    inset 0 -30px 20px rgba(0, 0, 0, 0.6),
    0 10px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(0, 240, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 14px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.4s;
  overflow: hidden;
}
/* Crimp superior */
.pack-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.02) 5px,
    rgba(0, 0, 0, 0.8) 5px,
    rgba(0, 0, 0, 0.8) 10px
  );
  border-top: 2px solid #00f0ff;
  border-radius: 14px 14px 0 0;
}
/* Crimp inferior */
.pack-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.02) 5px,
    rgba(0, 0, 0, 0.8) 5px,
    rgba(0, 0, 0, 0.8) 10px
  );
  border-bottom: 2px solid #ffd000;
  border-radius: 0 0 14px 14px;
}
.booster-pack-container:hover {
  transform: scale(1.05) rotateY(8deg);
  filter: drop-shadow(0 0 50px rgba(0, 240, 255, 0.7)) brightness(1.08);
}

/* Logo y texto del sobre */
.pack-logo {
  width: 78%;
  object-fit: contain;
  margin-bottom: 1.5rem;
  mix-blend-mode: screen;
  filter: brightness(1.1) contrast(1.5) saturate(1.3);
  position: relative;
  z-index: 1;
}
.pack-text {
  font-family: "Outfit", sans-serif;
  color: #ffd000;
  font-size: 1rem;
  text-align: center;
  padding: 0 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 1);
  animation: pulseText 2s infinite;
  position: relative;
  z-index: 1;
}
@keyframes pulseText {
  0%,
  100% {
    text-shadow: 0 4px 15px rgba(0, 0, 0, 1);
  }
  50% {
    text-shadow:
      0 0 25px #ffd000,
      0 4px 15px rgba(0, 0, 0, 1);
  }
}

/* Rasgado del sobre */
.pack-top-rip {
  z-index: 21;
  transform-origin: top center;
}
.pack-bottom-rip {
  z-index: 20;
}

#pack-opener-3d-overlay.opening .pack-top-rip {
  clip-path: polygon(
    0 0,
    100% 0,
    100% 12%,
    95% 15%,
    90% 11%,
    85% 16%,
    80% 11%,
    75% 16%,
    70% 11%,
    65% 16%,
    60% 11%,
    55% 16%,
    50% 11%,
    45% 16%,
    40% 11%,
    35% 16%,
    30% 11%,
    25% 16%,
    20% 11%,
    15% 16%,
    10% 11%,
    5% 16%,
    0 12%
  );
  animation: tearFoilOff 1.5s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}
#pack-opener-3d-overlay.opening .pack-bottom-rip {
  clip-path: polygon(
    100% 12%,
    95% 15%,
    90% 11%,
    85% 16%,
    80% 11%,
    75% 16%,
    70% 11%,
    65% 16%,
    60% 11%,
    55% 16%,
    50% 11%,
    45% 16%,
    40% 11%,
    35% 16%,
    30% 11%,
    25% 16%,
    20% 11%,
    15% 16%,
    10% 11%,
    5% 16%,
    0 12%,
    0 100%,
    100% 100%
  );
  animation: packRipDown 2.5s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}
@keyframes tearFoilOff {
  0% {
    transform: translateY(0) rotateZ(0deg);
    opacity: 1;
    filter: brightness(1.2);
  }
  30% {
    transform: translateY(-60px) rotateZ(-12deg);
    opacity: 1;
    filter: brightness(2);
  }
  100% {
    transform: translateY(-350px) translateX(-60px) rotateZ(-35deg);
    opacity: 0;
  }
}
@keyframes packRipDown {
  0% {
    transform: translateY(0);
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.4));
  }
  10% {
    transform: translateY(5px);
    filter: brightness(1.2);
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Carta revelada */
.revealed-card-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 336px;
  opacity: 0;
  display: none;
  pointer-events: none;
  z-index: 10;
  perspective: 1000px;
}
.revealed-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
}
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
}
.card-back {
  background: radial-gradient(circle at 50% 50%, #1e133e 0%, #070314 100%);
  border: 6px solid #ffd000;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(0, 240, 255, 0.5);
  transform: rotateY(0deg);
}
.card-back::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(255, 208, 0, 0.4);
  border-radius: 6px;
}
.card-back .back-logo {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.9));
  animation: floatLogo 3s ease-in-out infinite;
  mix-blend-mode: screen;
  z-index: 10;
}
@keyframes floatLogo {
  0%,
  100% {
    transform: translateY(0);
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.9));
  }
  50% {
    transform: translateY(-6px);
    filter: drop-shadow(0 0 25px rgba(155, 89, 182, 0.9));
  }
}
.card-front {
  background: linear-gradient(135deg, #0a0020, #1a0050);
  transform: rotateY(180deg);
  border: 4px solid #00f0ff;
  border-radius: 12px;
  box-shadow:
    inset 0 0 50px rgba(0, 240, 255, 0.3),
    0 0 60px rgba(0, 240, 255, 0.5);
}

/* Animación carta: emerge → gira → sale disparada → revela web */
#pack-opener-3d-overlay.opening .revealed-card-container {
  display: block;
  animation: cardEmergeFlipZoom 2.8s cubic-bezier(0.3, 0, 0.1, 1) forwards;
}
@keyframes cardEmergeFlipZoom {
  0%,
  25% {
    transform: translate(-50%, -50%) translateY(80px);
    opacity: 0;
    visibility: hidden;
    z-index: 10;
  }
  35% {
    transform: translate(-50%, -50%) translateY(0) rotateY(0deg);
    opacity: 1;
    z-index: 10;
    visibility: visible;
  }
  55% {
    transform: translate(-50%, -50%) translateY(0) rotateY(180deg) scale(1.6);
    opacity: 1;
    z-index: 30;
    visibility: visible;
  }
  85%,
  100% {
    transform: translate(-50%, -200vh) rotateY(180deg) scale(1.6);
    opacity: 0;
    z-index: 30;
    visibility: hidden;
  }
}

/* Botón skip */
.pack3d-skip-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.8rem;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
}
.pack3d-skip-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.07);
}

@media (max-width: 480px) {
  .booster-pack-container {
    width: 240px;
    height: 352px;
  }
  .pack-content {
    width: 240px;
    height: 352px;
  }
  .revealed-card-container {
    width: 190px;
    height: 266px;
  }
}
