/* 3D Holographic Trading Card Gacha Reveal (inspired by pokemon-cards-css) */
.gacha-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 42%, rgba(200, 255, 0, 0.14), transparent 58%),
    radial-gradient(circle at 50% 50%, rgba(16, 22, 38, 0.94), rgba(6, 9, 16, 0.98));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: gachaFadeIn 0.25s ease-out;
  overflow-y: auto;
}

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

.gacha-header {
  text-align: center;
}

.gacha-header h2 {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #f4ff9e;
  text-shadow: 0 0 24px rgba(200, 255, 0, 0.45);
}

.gacha-header p {
  margin: 6px 0 0;
  font-size: 13px;
  color: #a9c0dc;
}

.gacha-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  max-width: 1120px;
  width: 100%;
  perspective: 1200px;
}

.gacha-stage.multi {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 196px));
  gap: 14px;
  justify-content: center;
}

/* 3D Interactive Holographic Card */
.holo-wrap {
  perspective: 900px;
  cursor: pointer;
}

.holo-card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  --hyp: 0;
  position: relative;
  width: 280px;
  aspect-ratio: 0.716;
  border-radius: 18px;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
  animation: cardFlipIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: var(--delay, 0ms);
  user-select: none;
}

.gacha-stage.multi .holo-card {
  width: 100%;
  border-radius: 14px;
}

@keyframes cardFlipIn {
  0% {
    opacity: 0;
    transform: translateY(34px) rotateY(180deg) scale(0.82);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) rotateY(-10deg) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateY(0deg) scale(1);
  }
}

.holo-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  box-sizing: border-box;
  background: linear-gradient(155deg, #161d2f 0%, #0d121f 55%, #19243a 100%);
  border: 2.5px solid rgba(140, 175, 220, 0.45);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65);
}

/* Rarity Borders & Ambient Glow */
.holo-card.rarity-s .holo-inner {
  border: 3px solid #ffe45e;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 215, 64, 0.32), transparent 62%),
    linear-gradient(155deg, #2d1e08 0%, #140f1d 52%, #2c1738 100%);
  box-shadow: 0 0 36px rgba(255, 215, 64, 0.55), 0 22px 48px rgba(0, 0, 0, 0.78);
}

.holo-card.rarity-a .holo-inner {
  border: 2.5px solid #4be4ff;
  background:
    radial-gradient(circle at 50% 28%, rgba(75, 228, 255, 0.25), transparent 62%),
    linear-gradient(155deg, #0c2233 0%, #0f1628 55%, #1d1536 100%);
  box-shadow: 0 0 28px rgba(75, 228, 255, 0.4), 0 18px 40px rgba(0, 0, 0, 0.72);
}

.holo-card.rarity-gold .holo-inner {
  border: 2.5px solid #ffb800;
  background: linear-gradient(155deg, #332409 0%, #191208 100%);
  box-shadow: 0 0 24px rgba(255, 184, 0, 0.42);
}

.holo-card.rarity-coin .holo-inner {
  border: 1.5px solid rgba(130, 155, 190, 0.35);
}

/* Top Foil Header */
.holo-top {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.holo-rank {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: rgba(15, 22, 36, 0.85);
  color: #cfe4ff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.holo-card.rarity-s .holo-rank {
  background: linear-gradient(90deg, #ffe45e, #ff9f1c);
  color: #161004;
  border-color: #fff3b0;
}

.holo-card.rarity-a .holo-rank {
  background: linear-gradient(90deg, #4be4ff, #9b6dff);
  color: #08121e;
  border-color: #c2f4ff;
}

.holo-new {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  background: #c8ff00;
  color: #10141c;
}

/* Character Portrait Window */
.holo-art {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  min-height: 0;
}

.holo-art img {
  max-width: 96%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.65));
}

.holo-coin-emblem {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(255, 215, 64, 0.6));
}

/* Bottom Info Plate */
.holo-meta {
  position: relative;
  z-index: 3;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(9, 13, 22, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}

.holo-meta strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
}

.gacha-stage.multi .holo-meta strong {
  font-size: 13px;
}

.holo-meta small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #a9c2e0;
  line-height: 1.35;
}

/* === Authentic Pokemon-Cards-CSS Holographic Foil Layers === */
.holo-shine {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: color-dodge;
  opacity: calc(0.28 + var(--hyp) * 0.62);
  background-image:
    repeating-linear-gradient(
      115deg,
      rgba(255, 0, 128, 0.55) 0%,
      rgba(255, 230, 0, 0.55) 14%,
      rgba(0, 255, 195, 0.55) 28%,
      rgba(0, 162, 255, 0.55) 42%,
      rgba(175, 70, 255, 0.55) 56%,
      rgba(255, 0, 128, 0.55) 70%
    );
  background-size: 260% 260%;
  background-position: var(--mx) var(--my);
  filter: brightness(0.88) contrast(1.45) saturate(1.35);
  transition: opacity 0.18s ease;
}

.holo-card.rarity-coin .holo-shine {
  opacity: calc(0.08 + var(--hyp) * 0.25);
}

.holo-sparkle {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: screen;
  opacity: calc(0.25 + var(--hyp) * 0.55);
  background-image:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.9) 0 1.2px, transparent 2px),
    radial-gradient(circle at 78% 18%, rgba(255, 240, 140, 0.9) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 64% 72%, rgba(140, 245, 255, 0.9) 0 1.3px, transparent 2.2px),
    radial-gradient(circle at 32% 80%, rgba(255, 180, 255, 0.85) 0 1.4px, transparent 2.4px),
    radial-gradient(circle at 86% 56%, rgba(200, 255, 0, 0.9) 0 1.2px, transparent 2.2px);
  background-size: 90px 90px;
  background-position: calc(var(--mx) * 0.4) calc(var(--my) * 0.4);
}

.holo-card.rarity-coin .holo-sparkle {
  display: none;
}

.holo-glare {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: overlay;
  opacity: calc(0.2 + var(--hyp) * 0.65);
  background: radial-gradient(
    farthest-corner circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.85) 5%,
    rgba(255, 255, 255, 0.35) 28%,
    rgba(0, 0, 0, 0.45) 85%
  );
}

/* Action Bar */
.gacha-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

.gacha-actions button {
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.gacha-btn-primary {
  background: #c8ff00;
  color: #10141c;
  border: 2px solid #c8ff00;
  box-shadow: 0 0 20px rgba(200, 255, 0, 0.4);
}

.gacha-btn-secondary {
  background: rgba(20, 28, 44, 0.92);
  color: #e6f2ff;
  border: 1.5px solid rgba(154, 184, 224, 0.45);
}

@media (max-width: 820px) {
  .gacha-stage.multi {
    grid-template-columns: repeat(2, minmax(136px, 175px));
    gap: 10px;
  }
  .holo-card {
    width: 240px;
  }
}
