/* ════════════════════════════════════════════════════════════
   PHASE 5 — Animations & Effects
   ════════════════════════════════════════════════════════════ */

/* Loading float (Phase 0) */
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.loading-logo { animation: float 3s ease-in-out infinite; }

/* Menu panel glow (Phase 2) */
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 20px rgba(212,175,55,0.35); }
  50%     { box-shadow: 0 0 40px rgba(212,175,55,0.6); }
}
.menu-panel { animation: glowPulse 6s ease-in-out infinite; }

/* ──────── Flying card (FLIP ghost) ──────── */
.fx-flying-card {
  border-radius: 10px;
  box-shadow: 0 18px 36px rgba(0,0,0,0.55);
  overflow: hidden;
}
.fx-flying-card img,
.fx-flying-card .card { width: 100%; height: 100%; display: block; border-radius: 10px; }
.fx-flying-card .card { box-shadow: none; }

/* ──────── Shuffle ──────── */
.fx-shuffle {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1800;
  pointer-events: none;
  animation: fxFadeIn 180ms ease;
}
.fx-shuffle--out { animation: fxFadeOut 200ms ease forwards; }

.fx-shuffle-card {
  position: absolute;
  width: 80px;
  height: 110px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(212,175,55,0.25) 0 6px, transparent 6px 12px),
    linear-gradient(180deg, #0f5c46, #0a3d2f);
  border: 2px solid var(--gold-dark);
  box-shadow: 0 12px 24px rgba(0,0,0,0.55);
  animation: shuffleSpin 800ms cubic-bezier(.4,.0,.6,1) infinite;
  animation-delay: calc(var(--i) * 60ms);
  transform-origin: center;
}
@keyframes shuffleSpin {
  0%   { transform: translate(-40px,  0)   rotate(-12deg) scale(0.95); }
  50%  { transform: translate( 40px, -8px) rotate( 12deg) scale(1.02); }
  100% { transform: translate(-40px,  0)   rotate(-12deg) scale(0.95); }
}

@keyframes fxFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxFadeOut { to   { opacity: 0; } }

/* ──────── Deal pile (briefly visible center stack) ──────── */
.fx-deal-pile {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 110px;
  margin: -55px 0 0 -40px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(212,175,55,0.25) 0 6px, transparent 6px 12px),
    linear-gradient(180deg, #0f5c46, #0a3d2f);
  border: 2px solid var(--gold-dark);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.5),
    4px -4px 0 -3px var(--gold-dark),
    -4px -4px 0 -3px var(--gold-dark);
  z-index: 1500;
  pointer-events: none;
  animation: dealPilePop 180ms ease;
}
@keyframes dealPilePop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ──────── Trump reveal ──────── */
.fx-trump-overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 1700;
  animation: fxFadeIn 200ms ease;
}
.fx-trump-overlay--out { animation: fxFadeOut 260ms ease forwards; }

.fx-trump-card {
  width: 200px;
  height: 240px;
  background: linear-gradient(160deg, var(--ivory), var(--cream));
  border: 4px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.65),
    0 0 60px rgba(212,175,55,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: trumpPop 600ms cubic-bezier(.2,.7,.3,1.3);
}
.fx-trump-glyph {
  font-size: 140px;
  font-family: serif;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}
.fx-trump-label {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 3px;
  color: #2a1d05;
  font-weight: 700;
}
@keyframes trumpPop {
  0%   { transform: scale(0.3) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(4deg);  opacity: 1; }
  100% { transform: scale(1) rotate(0);        opacity: 1; }
}

/* ──────── Shalam banner ──────── */
.fx-shalam-overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at center,
    rgba(196, 30, 30, 0.35) 0%,
    rgba(0,0,0,0.75) 70%);
  backdrop-filter: blur(3px);
  z-index: 1900;
  animation: fxFadeIn 220ms ease;
}
.fx-shalam-overlay--out { animation: fxFadeOut 280ms ease forwards; }

.fx-shalam-banner {
  position: relative;
  text-align: center;
  padding: 28px 56px;
  animation: shalamSlam 700ms cubic-bezier(.2,.7,.3,1.3);
}
.fx-shalam-title {
  font-family: var(--font-display);
  font-size: 90px;
  font-weight: 900;
  letter-spacing: 18px;
  background: linear-gradient(180deg, #ffe27a, #d4af37, #8a1313);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 0 30px rgba(212, 175, 55, 0.6),
    0 0 60px rgba(196, 30, 30, 0.5);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.7));
}
.fx-shalam-sub {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 8px;
  color: var(--gold-light);
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.fx-shalam-spark {
  width: 60%;
  height: 2px;
  margin: 14px auto;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  animation: sparkPulse 1.4s ease-in-out infinite;
}
@keyframes shalamSlam {
  0%   { transform: scale(2) rotate(-8deg); opacity: 0; }
  50%  { transform: scale(0.92) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes sparkPulse {
  0%,100% { opacity: 0.4; }
  50%     { opacity: 1; }
}

/* ──────── Confetti (round win) ──────── */
.fx-confetti-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1600;
  overflow: hidden;
}
.fx-confetti {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.6;
  }
}

/* ──────── Round loss shake ──────── */
@keyframes screenShake {
  0%,100% { transform: translate(0,0); }
  20%     { transform: translate(-6px, 2px); }
  40%     { transform: translate(6px, -2px); }
  60%     { transform: translate(-4px, 1px); }
  80%     { transform: translate(4px, -1px); }
}
.fx-screen-shake { animation: screenShake 380ms ease; }

/* ──────── Character overlays (Joker / Queen) ──────── */
.fx-character-overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 2100;
  animation: fxFadeIn 220ms ease;
}
.fx-character-overlay--out { animation: fxFadeOut 260ms ease forwards; }

.fx-character-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.92) 90%);
  backdrop-filter: blur(4px);
}

.fx-character--win .fx-character-backdrop {
  background: radial-gradient(circle at center,
    rgba(212, 175, 55, 0.25) 0%,
    rgba(0,0,0,0.9) 70%);
}
.fx-character--loss .fx-character-backdrop {
  background: radial-gradient(circle at center,
    rgba(196, 30, 30, 0.3) 0%,
    rgba(0,0,0,0.92) 70%);
}

.fx-character-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px;
  max-width: 90vw;
}

.fx-character-img-wrap {
  width: min(300px, 70vw);
  height: min(360px, 60vh);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 24px 50px rgba(0,0,0,0.7));
  animation: characterEnter 700ms cubic-bezier(.2,.7,.3,1.2);
}
.fx-character--win  .fx-character-img-wrap { animation-name: characterEnterWin; }
.fx-character--loss .fx-character-img-wrap { animation-name: characterEnterLoss; }

.fx-character-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.fx-character-img--joker { animation: jokerWiggle 2.4s ease-in-out infinite 600ms; }
.fx-character-img--queen { animation: queenFloat  3.2s ease-in-out infinite 600ms; }

@keyframes characterEnterWin {
  0%   { transform: scale(0.4) translateY(60px); opacity: 0; }
  60%  { transform: scale(1.08) translateY(-8px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes characterEnterLoss {
  0%   { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  50%  { transform: scale(1.08) rotate(4deg);  opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes jokerWiggle {
  0%,100% { transform: rotate(0deg); }
  25%     { transform: rotate(-3deg); }
  75%     { transform: rotate(3deg); }
}
@keyframes queenFloat {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.fx-character-bubble {
  position: relative;
  background: var(--ivory);
  color: #2a1d05;
  padding: 14px 22px;
  border-radius: 16px;
  border: 2px solid var(--gold);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  max-width: 90vw;
  box-shadow: 0 14px 30px rgba(0,0,0,0.5);
  animation: bubblePop 500ms cubic-bezier(.2,.7,.3,1.3) 400ms backwards;
}
.fx-character-bubble::after {
  content: '';
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: var(--gold);
}
.fx-character-bubble::before {
  content: '';
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-bottom-color: var(--ivory);
  z-index: 1;
}
.fx-character-bubble--joker { color: #6b1212; }
.fx-character-bubble--queen { color: #1e3a6b; }

@keyframes bubblePop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.fx-character-close {
  margin-top: 6px;
  animation: bubblePop 500ms cubic-bezier(.2,.7,.3,1.3) 700ms backwards;
}

/* ──────── Mobile tweaks ──────── */
@media (max-width: 600px) {
  .fx-trump-card    { width: 150px; height: 190px; }
  .fx-trump-glyph   { font-size: 96px; }
  .fx-trump-label   { font-size: 11px; letter-spacing: 2px; }

  .fx-shalam-title  { font-size: 56px; letter-spacing: 10px; }
  .fx-shalam-sub    { font-size: 13px; letter-spacing: 4px; }

  .fx-character-bubble { font-size: 14px; padding: 10px 16px; }
}
