/* ============================================
   $STARS PACK OPENING
   Overlay + tear interaction + coin reveal
   ============================================ */

.pack-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.pack-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Belt-and-suspenders: when the overlay isn't open, force every descendant inert so
   stale `pointer-events: auto` on e.g. .pack-cta.is-shown can't intercept clicks
   meant for the pack cards below. */
.pack-overlay:not(.is-open),
.pack-overlay:not(.is-open) * {
  pointer-events: none !important;
}

.pack-stage {
  position: relative;
  width: 380px;
  height: 660px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
}

/* ---------- PACK ---------- */

.pack {
  position: absolute;
  width: 280px;
  height: 420px;
  transform: translate(120vw, -50vh) rotate(35deg) scale(0.6);
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  user-select: none;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(255, 248, 0, 0.18));
  transform-style: preserve-3d;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

.pack.is-entered {
  transform: translate(0, 0) rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) rotate(-3deg);
  animation: pack-float 3.6s ease-in-out infinite;
}

.pack.is-dragging {
  animation: none;
  transition: none;
}

@keyframes pack-float {
  0%, 100% { transform: translate(0, 0) rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) rotate(-3deg); }
  50% { transform: translate(0, -10px) rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) rotate(-1deg); }
}

.pack-top, .pack-bottom {
  position: absolute;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #16181c 0%, #0a0a0c 100%);
  border: 2px solid #26282d;
  overflow: hidden;
  transform-style: preserve-3d;
}

/* Top tear strip (drag left-to-right to open) */
.pack-top {
  top: 0;
  height: 80px;
  border-bottom: 2px dashed rgba(255, 248, 0, 0.55);
  border-radius: 12px 12px 0 0;
  z-index: 2;
  transform-origin: left center;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 18px;
  cursor: grab;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.3);
}

.pack-top.is-dragging { cursor: grabbing; }

.pack-bottom {
  top: 80px;
  bottom: 0;
  border-radius: 0 0 12px 12px;
}

.pack-tear-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 4px;
  color: #fff800;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  font-weight: 700;
}

.pack-tear-label .pack-tear-arrow {
  font-size: 22px;
  animation: tear-bounce 1.1s ease-in-out infinite;
  color: #fff;
}

@keyframes tear-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

/* Grab handle on left edge of strip */
.pack-top::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 38px;
  background: var(--gold, #fff800);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(255, 248, 0, 0.6);
}

.pack-stripe {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #006847 33%, #fff 33%, #fff 66%, #ce1126 66%);
}

.pack-stripe.top { top: 0; }
.pack-stripe.bottom { bottom: 0; }

.pack-body {
  position: absolute;
  inset: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  text-align: center;
  transform-style: preserve-3d;
}

.pack-bg-stars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(6, 1fr);
  opacity: 0.06;
  pointer-events: none;
}

.pack-bg-stars span {
  font-family: 'Anton', sans-serif;
  font-size: 32px;
  color: #fff800;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-12deg);
}

.pack-logo {
  width: 64px;
  height: 64px;
  margin-top: 8px;
  filter: drop-shadow(0 0 14px rgba(255, 248, 0, 0.5));
}

.pack-wordmark {
  font-family: 'Anton', sans-serif;
  font-size: 42px;
  color: #f5f5f5;
  letter-spacing: 2px;
  transform: skew(-4deg);
  margin-top: 8px;
}

.pack-wordmark .dollar {
  display: inline-block;
  transform: translateY(-0.08em);
  margin-right: -0.04em;
  color: #fff800;
}

.pack-title {
  font-family: 'Anton', sans-serif;
  font-size: 22px;
  color: #fff800;
  letter-spacing: 1.5px;
  transform: skew(-4deg);
  margin-top: 4px;
}

.pack-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #aaa;
  text-transform: uppercase;
  margin-top: 16px;
  border: 1px solid #26282d;
  padding: 4px 12px;
}

.pack-stars-row {
  display: flex;
  gap: 16px;
  font-size: 18px;
  color: #fff800;
  margin-bottom: 6px;
}

/* ---------- MYSTERY 3D VISUAL ---------- */

/* Background base — multi-layer dark with subtle yellow undertone */
.pack-bottom {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 248, 0, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 30% 70%, rgba(255, 51, 0, 0.08) 0%, transparent 50%),
    linear-gradient(135deg, #1a1d24 0%, #0a0a0c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 0, 0.18),
    inset 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Embossed pattern of $ and ★ across the back */
.pack-emboss {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  padding: 12px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
}

.pack-emboss span {
  font-family: 'Anton', sans-serif;
  font-size: 64px;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: skew(-4deg) rotate(-8deg);
  text-shadow:
    -1px -1px 0 rgba(255, 248, 0, 0.5),
    1px 1px 0 rgba(0, 0, 0, 0.5),
    0 0 8px rgba(255, 248, 0, 0.15);
}

/* Foil base — metallic linear gradient sweeping diagonally */
.pack-foil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 248, 0, 0) 0%,
    rgba(255, 248, 0, 0.04) 30%,
    rgba(255, 248, 0, 0.2) 48%,
    rgba(255, 255, 255, 0.25) 52%,
    rgba(255, 248, 0, 0.2) 56%,
    rgba(255, 248, 0, 0.04) 75%,
    rgba(255, 248, 0, 0) 100%
  );
  background-size: 300% 100%;
  background-position: 100% 0;
  animation: foil-shimmer 6s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes foil-shimmer {
  0%, 100% { background-position: 130% 0; }
  50% { background-position: -30% 0; }
}

/* Iridescent rainbow conic — extra premium catch */
.pack-iridescent {
  position: absolute;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    rgba(255, 248, 0, 0.18) 0%,
    rgba(255, 51, 0, 0.12) 15%,
    rgba(0, 168, 107, 0.12) 35%,
    rgba(30, 58, 138, 0.14) 55%,
    rgba(255, 51, 0, 0.10) 75%,
    rgba(255, 248, 0, 0.18) 100%
  );
  opacity: 0.25;
  animation: iridescent-spin 9s linear infinite;
  mix-blend-mode: overlay;
  filter: blur(20px);
}

@keyframes iridescent-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Existing pack-shine continues to sweep on top */

/* Corner brand chips */
.pack-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 248, 0, 0.5);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.7);
  box-shadow: 0 0 12px rgba(255, 248, 0, 0.4);
}

.pack-corner svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 4px rgba(255, 248, 0, 0.6));
}

.pack-corner.top-left { top: 14px; left: 14px; }
.pack-corner.top-right { top: 14px; right: 14px; transform: rotate(90deg); }
.pack-corner.bottom-left { bottom: 14px; left: 14px; transform: rotate(-90deg); }
.pack-corner.bottom-right { bottom: 14px; right: 14px; transform: rotate(180deg); }

/* Holographic shine sweep across pack */
.pack-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 248, 0, 0.18) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 150% 0;
  animation: pack-shine-sweep 4.5s ease-in-out infinite;
  mix-blend-mode: screen;
  z-index: 2;
}

@keyframes pack-shine-sweep {
  0%, 100% { background-position: 150% 0; }
  50% { background-position: -50% 0; }
}

.pack-body {
  position: relative;
  z-index: 3;
}

/* Big ? in the center */
.pack-question {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  margin-top: 18px;
  transform-style: preserve-3d;
  transform: translateZ(4px);
}

.pack-question-aura {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 248, 0, 0.55) 0%, rgba(255, 248, 0, 0.2) 30%, transparent 65%);
  filter: blur(8px);
  animation: aura-pulse 2.4s ease-in-out infinite;
}

@keyframes aura-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
}

.pack-question-mark {
  position: relative;
  z-index: 2;
  font-family: 'Anton', sans-serif;
  font-size: 160px;
  line-height: 0.85;
  color: #fff800;
  letter-spacing: 0;
  text-shadow:
    0 0 24px rgba(255, 248, 0, 0.9),
    0 0 48px rgba(255, 248, 0, 0.6),
    0 0 80px rgba(255, 248, 0, 0.4);
  transform: skew(-4deg) translateZ(2px) translateX(-14px);
}

.pack-question-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pack-question-sparks span {
  position: absolute;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 20px rgba(255, 248, 0, 0.7);
  animation: spark-twinkle 2s ease-in-out infinite;
}

.pack-question-sparks span:nth-child(1) { top: 8%; left: 18%; animation-delay: 0s; }
.pack-question-sparks span:nth-child(2) { top: 22%; right: 14%; animation-delay: 0.5s; font-size: 12px; }
.pack-question-sparks span:nth-child(3) { bottom: 18%; left: 22%; animation-delay: 1s; font-size: 14px; }
.pack-question-sparks span:nth-child(4) { bottom: 10%; right: 18%; animation-delay: 1.5s; font-size: 18px; }

@keyframes spark-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0); }
  50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

.pack-mystery-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 6px;
  color: #fff800;
  text-transform: uppercase;
  margin-top: 16px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 248, 0, 0.4);
  background: rgba(0, 0, 0, 0.5);
}

.pack-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  opacity: 0.7;
}

.pack-logo-small {
  width: 22px;
  height: 22px;
}

.pack-wordmark-small {
  font-family: 'Anton', sans-serif;
  font-size: 22px;
  color: #f5f5f5;
  letter-spacing: 1.5px;
  transform: skew(-4deg);
}

.pack-wordmark-small .dollar {
  display: inline-block;
  transform: translateY(-0.08em);
  margin-right: -0.04em;
  color: #fff800;
}

/* ---------- TEARING ---------- */

.pack-top {
  transition: transform 0.05s linear, opacity 0.3s;
}

.pack-top.is-torn {
  transform: translateX(420px) translateY(-30px) rotate(35deg) scale(1.05);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(0.36, 0, 0.66, 0.5), opacity 0.4s ease 0.25s;
}

.pack-bottom.is-bursting {
  animation: pack-burst 0.55s ease-out forwards;
}

@keyframes pack-burst {
  0% { transform: scale(1); }
  40% { transform: scale(1.15) translateY(-10px); }
  100% { transform: scale(0); opacity: 0; }
}

/* ---------- CHAMATIVO EFFECTS ---------- */

/* Full-screen flash on tear commit */
.pack-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 248, 0, 0.8) 0%, rgba(255, 255, 255, 0.4) 30%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.pack-flash.is-firing {
  animation: flash-burst 0.6s ease-out forwards;
}

@keyframes flash-burst {
  0% { opacity: 0; transform: scale(0.6); }
  20% { opacity: 1; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(2.2); }
}

/* Particles (stars) bursting from pack */
.pack-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.pack-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: 'Anton', sans-serif;
  font-size: 32px;
  color: #fff800;
  text-shadow: 0 0 12px rgba(255, 248, 0, 0.8);
  opacity: 0;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.pack-particle.is-firing {
  animation: particle-fly 1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes particle-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--fx, 0px)), calc(-50% + var(--fy, 0px))) scale(0.6) rotate(var(--fr, 180deg));
  }
}

/* Camera shake during commit */
.pack-stage.is-shaking {
  animation: stage-shake 0.5s ease-out;
}

@keyframes stage-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  10% { transform: translate(-6px, -3px) rotate(-0.8deg); }
  25% { transform: translate(7px, 2px) rotate(0.6deg); }
  45% { transform: translate(-4px, 4px) rotate(-0.5deg); }
  65% { transform: translate(5px, -2px) rotate(0.4deg); }
  85% { transform: translate(-2px, 1px) rotate(-0.2deg); }
}

/* ---------- REVEAL ---------- */

.reveal-area {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
  /* leave space at the bottom for the absolutely-positioned Continue button */
  padding: 16px 12px 84px;
}

.reveal-coins-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
}

.reveal-coin {
  width: 165px;
  height: 225px;
  background: var(--accent-color, #16181c);
  border: 2px solid var(--accent-color, #fff800);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.1) rotate(-180deg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  perspective: 800px;
  transform-style: preserve-3d;
}

.reveal-coin.is-revealed {
  animation: coin-fly-in 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes coin-fly-in {
  0% {
    opacity: 0;
    transform: scale(0.05) rotateY(-540deg) translateY(80px);
    filter: blur(12px) brightness(2.5) saturate(2);
  }
  25% {
    opacity: 0.6;
    transform: scale(0.7) rotateY(-180deg) translateY(20px);
    filter: blur(4px) brightness(1.8) saturate(1.6);
  }
  55% {
    opacity: 1;
    transform: scale(1.22) rotateY(20deg) translateY(-18px) rotate(8deg);
    filter: blur(0) brightness(1.4) saturate(1.2);
  }
  78% {
    transform: scale(0.92) rotateY(-6deg) translateY(4px) rotate(-3deg);
    filter: brightness(1.1) saturate(1);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg) translateY(0) rotate(0deg);
    filter: brightness(1) saturate(1);
  }
}

/* Spotlight pulse when each coin lands */
.reveal-coin::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  background: radial-gradient(circle, var(--accent-color, #fff800) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.reveal-coin.is-revealed::after {
  animation: coin-spotlight 1.4s ease-out 0.5s forwards;
}

@keyframes coin-spotlight {
  0% { opacity: 0; transform: scale(0.6); }
  30% { opacity: 0.9; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(2); }
}

.reveal-coin-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reveal-coin-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 7px 8px 8px;
  background: rgba(10, 10, 12, 0.95);
  font-family: 'Anton', sans-serif;
  font-size: 16px;
  color: #f5f5f5;
  letter-spacing: 0.8px;
  text-align: center;
  border-top: 2px solid #fff800;
  line-height: 1.1;
}

.reveal-coin-supply {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff800;
  margin-top: 4px;
  text-transform: uppercase;
}

.reveal-coin-value {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #f5f5f5;
  margin-top: 2px;
}

/* In-flow under the coin grid; the inner .reveal-total-pill carries the chrome. */
.reveal-total {
  display: flex;
  justify-content: center;
  width: 100%;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.reveal-total.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-total-pill {
  background: #0a0a0c;
  border: 1px solid #fff800;
  border-radius: 999px;
  padding: 9px 22px;
  font-family: 'Anton', sans-serif;
  font-size: 17px;
  letter-spacing: 0.08em;
  color: #fff800;
  white-space: nowrap;
  text-align: center;
}
.reveal-total-pill small {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #b8b8c0;
  margin-top: 2px;
  text-transform: uppercase;
}

.reveal-coin-flag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 18px;
}

.reveal-coin-rank {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #fff800;
  color: #0a0a0c;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  transform: rotate(5deg);
}

/* ---------- CLOSE / CTA ---------- */

.pack-cta {
  position: absolute;
  bottom: 22px;
  left: 50%;
  padding: 12px 26px;
  background: #fff800;
  color: #0a0a0c;
  border: 0;
  font-family: 'Anton', sans-serif;
  font-size: 18px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.2s;
  transform: translateX(-50%) skew(-4deg);
  z-index: 10;
}

.pack-cta.is-shown {
  pointer-events: auto;
}

.pack-cta.is-shown {
  opacity: 1;
}

.pack-cta:hover {
  transform: translateX(-50%) skew(-4deg) translateY(-2px);
}

/* ---------- DEMO TRIGGER (only for pack-demo.html) ---------- */

.pack-demo-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  padding: 40px;
}

.pack-demo-trigger h1 {
  font-family: 'Anton', sans-serif;
  font-size: 56px;
  color: var(--white, #f5f5f5);
  text-align: center;
  letter-spacing: 1px;
  transform: skew(-4deg);
}

.pack-demo-trigger p {
  color: var(--grey, #8a8a8a);
  text-align: center;
  max-width: 520px;
  line-height: 1.6;
  font-size: 15px;
}
