/* FX compartido (desktop + mobile) · Joker Poker Real v2.0.0 · cargado por fx.js */
/* ============================================================
   FX · Victorias por niveles y Joker  (clases añadidas por fx.js)
   ============================================================ */

/* La animación original de .card-win (pulso + barrido) se sustituye por
   el sistema por niveles: la carta ganadora queda con aro dorado estático
   y fx.js aplica .fx-hit con la intensidad correspondiente. */
.card-win { animation: none !important; }
.card-win::after { animation: none !important; transform: translateX(-160%) !important; }

/* --- SMALL: pulso dorado corto + elevación 5px --- */
.fx-hit { will-change: transform, box-shadow; }
.fx-hit-small:not(.card-back):not(.card-joker) { animation: fxHitSmall 0.55s cubic-bezier(.3,.7,.3,1) 1 !important; }
.fx-hit-small.card-joker { animation: fxHitSmallJ 0.55s cubic-bezier(.3,.7,.3,1) 1 !important; }
@keyframes fxHitSmall {
  0%   { transform: translateY(0);    box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 30px rgba(255,210,77,.55); }
  40%  { transform: translateY(-5px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 6px 6px rgba(0,0,0,.3), 0 18px 28px rgba(0,0,0,.5), 0 0 0 4px #ffd24d, 0 0 46px rgba(255,210,77,.95), 0 0 90px rgba(255,210,77,.4); }
  100% { transform: translateY(0);    box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 30px rgba(255,210,77,.55); }
}
@keyframes fxHitSmallJ {
  0%   { transform: translateY(0);    box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55); }
  40%  { transform: translateY(-5px); box-shadow: 0 14px 28px rgba(0,0,0,.5), 0 0 0 4px #ffd24d, 0 0 46px rgba(255,210,77,.95), 0 0 90px rgba(255,210,77,.4); }
  100% { transform: translateY(0);    box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55); }
}

/* --- MEDIUM: pulso más fuerte + barrido dorado --- */
.fx-hit-medium:not(.card-back):not(.card-joker) { animation: fxHitMedium 0.8s cubic-bezier(.3,.7,.3,1) 1 !important; }
.fx-hit-medium.card-joker { animation: fxHitMediumJ 0.8s cubic-bezier(.3,.7,.3,1) 1 !important; }
.fx-hit-medium::after, .fx-hit-big::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,232,160,.75) 50%, transparent 70%);
  transform: translateX(-160%);
  animation: fxSweep 0.6s ease-in-out 0.12s 1 forwards !important;
}
@keyframes fxSweep { to { transform: translateX(160%); } }
@keyframes fxHitMedium {
  0%   { transform: translateY(0) scale(1);       box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 30px rgba(255,210,77,.55); }
  35%  { transform: translateY(-7px) scale(1.035); box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 8px 8px rgba(0,0,0,.3), 0 22px 34px rgba(0,0,0,.5), 0 0 0 4px #ffe066, 0 0 60px rgba(255,210,77,1), 0 0 120px rgba(255,190,60,.55); }
  100% { transform: translateY(0) scale(1);       box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 30px rgba(255,210,77,.55); }
}
@keyframes fxHitMediumJ {
  0%   { transform: translateY(0) scale(1);        box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55); }
  35%  { transform: translateY(-7px) scale(1.035); box-shadow: 0 18px 34px rgba(0,0,0,.5), 0 0 0 4px #ffe066, 0 0 60px rgba(255,210,77,1), 0 0 120px rgba(255,190,60,.55); }
  100% { transform: translateY(0) scale(1);        box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55); }
}

/* --- BIG: explosión premium --- */
.fx-hit-big:not(.card-back):not(.card-joker) { animation: fxHitBig 1.1s cubic-bezier(.25,.8,.3,1) 1 !important; }
.fx-hit-big.card-joker { animation: fxHitBigJ 1.1s cubic-bezier(.25,.8,.3,1) 1 !important; }
@keyframes fxHitBig {
  0%   { transform: translateY(0) scale(1);        box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 30px rgba(255,210,77,.55); }
  30%  { transform: translateY(-10px) scale(1.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,1), 0 10px 10px rgba(0,0,0,.3), 0 30px 46px rgba(0,0,0,.5), 0 0 0 5px #fff1a8, 0 0 80px rgba(255,220,90,1), 0 0 170px rgba(255,180,50,.7); }
  60%  { transform: translateY(-4px) scale(1.03);  box-shadow: inset 0 0 0 1px rgba(255,255,255,.95), 0 6px 6px rgba(0,0,0,.3), 0 20px 30px rgba(0,0,0,.5), 0 0 0 4px #ffd24d, 0 0 60px rgba(255,210,77,.95), 0 0 120px rgba(255,180,50,.5); }
  100% { transform: translateY(0) scale(1);        box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 2px 3px rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.5), 0 0 0 3px rgba(255,210,77,.9), 0 0 40px rgba(255,210,77,.7); }
}
@keyframes fxHitBigJ {
  0%   { transform: translateY(0) scale(1);        box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55); }
  30%  { transform: translateY(-10px) scale(1.07); box-shadow: 0 30px 46px rgba(0,0,0,.5), 0 0 0 5px #fff1a8, 0 0 80px rgba(255,220,90,1), 0 0 170px rgba(255,180,50,.7); }
  60%  { transform: translateY(-4px) scale(1.03);  box-shadow: 0 20px 30px rgba(0,0,0,.5), 0 0 0 4px #ffd24d, 0 0 60px rgba(255,210,77,.95), 0 0 120px rgba(255,180,50,.5); }
  100% { transform: translateY(0) scale(1);        box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 40px rgba(255,210,77,.7); }
}
/* resplandor alrededor de las cinco cartas */
.fx-big-glow::before {
  animation: fxBigGlow 2.2s ease-out 1 !important;
}
@keyframes fxBigGlow {
  0%   { background: radial-gradient(ellipse at 50% 50%, rgba(255,215,90,.0) 0%, rgba(215,40,115,.6) 40%, rgba(60,4,26,0) 82%); filter: blur(calc(var(--u) * 1.1)) brightness(1); }
  18%  { background: radial-gradient(ellipse at 50% 50%, rgba(255,225,120,.95) 0%, rgba(255,170,60,.7) 30%, rgba(215,40,115,.55) 58%, rgba(60,4,26,0) 85%); filter: blur(calc(var(--u) * 1.4)) brightness(1.35); }
  100% { background: radial-gradient(ellipse at 50% 50%, rgba(215,40,115,.78) 0%, rgba(175,25,90,.6) 26%, rgba(125,12,60,.36) 50%, rgba(80,6,36,.12) 68%, rgba(60,4,26,0) 82%); filter: blur(calc(var(--u) * 1.1)) brightness(1); }
}
.fx-screen-flash {
  position: fixed; inset: 0; z-index: 25; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(255,230,150,.55) 0%, rgba(255,120,180,.25) 40%, rgba(0,0,0,0) 75%);
  animation: fxFlash 0.85s ease-out 1 forwards;
}
@keyframes fxFlash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.fx-particles { position: fixed; inset: 0; z-index: 26; pointer-events: none; }

/* --- paytable row --- */
.paytable-panel tr td { transition: background .25s ease, color .25s ease, text-shadow .25s ease; }
.fx-row-lit td { animation: fxRowSmall 0.9s ease-out 1; }
.fx-row-medium td { animation: fxRowMedium 1.1s ease-out 1; }
.fx-row-big td { animation: fxRowBig 1.6s ease-out 1; }
@keyframes fxRowSmall {
  0%   { background: rgba(255,45,120,.22); }
  25%  { background: rgba(255,210,77,.55); color: #fff9e0; text-shadow: 0 0 10px rgba(255,220,100,1); }
  100% { background: rgba(255,45,120,.22); }
}
@keyframes fxRowMedium {
  0%   { background: rgba(255,45,120,.22); }
  20%  { background: rgba(255,210,77,.75); color: #2a1c00; text-shadow: none; }
  45%  { background: rgba(255,210,77,.45); color: #fff9e0; text-shadow: 0 0 12px rgba(255,220,100,1); }
  100% { background: rgba(255,45,120,.22); }
}
@keyframes fxRowBig {
  0%   { background: rgba(255,45,120,.22); }
  12%  { background: #ffe066; color: #2a1c00; text-shadow: none; box-shadow: 0 0 20px rgba(255,220,100,.9); }
  30%  { background: rgba(255,210,77,.55); color: #fff9e0; text-shadow: 0 0 14px rgba(255,220,100,1); }
  48%  { background: #ffe066; color: #2a1c00; text-shadow: none; }
  70%  { background: rgba(255,210,77,.5); color: #fff9e0; text-shadow: 0 0 14px rgba(255,220,100,1); }
  100% { background: rgba(255,45,120,.22); }
}

/* --- WIN counter --- */
.ctrl-value { font-variant-numeric: tabular-nums; transition: transform .2s ease; }
.fx-count { color: #fff3b0 !important; text-shadow: 0 0 14px rgba(255,210,77,1), 0 0 30px rgba(255,190,60,.6) !important; }
.fx-count-small { animation: fxCountSmall 0.65s ease-out 1; }
.fx-count-medium { animation: fxCountMedium 0.85s ease-out 1; }
.fx-count-big { animation: fxCountBig 1.5s ease-out 1; }
@keyframes fxCountSmall { 0% { transform: scale(1); } 30% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes fxCountMedium { 0% { transform: scale(1); } 30% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes fxCountBig {
  0% { transform: scale(1); }
  15% { transform: scale(1.45); color: #fff; text-shadow: 0 0 24px #ffe066, 0 0 60px rgba(255,190,60,.9); }
  40% { transform: scale(1.3); }
  70% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* --- banner --- */
.fx-banner-small { animation: fxBannerSmall 0.7s ease-out 1; }
.fx-banner-medium { animation: fxBannerMedium 0.9s ease-out 1; }
.fx-banner-big { animation: fxBannerBig 0.9s ease-out 1; }
@keyframes fxBannerSmall { 0%,100% { transform: scale(1); } 30% { transform: scale(1.04); box-shadow: 0 0 30px rgba(255,200,40,.7); } }
@keyframes fxBannerMedium { 0%,100% { transform: scale(1); } 30% { transform: scale(1.06); box-shadow: 0 0 40px rgba(255,200,40,.9); background: rgba(70,30,0,.7); } }
@keyframes fxBannerBig { 0%,100% { transform: scale(1); } 25% { transform: scale(1.1); box-shadow: 0 0 60px rgba(255,200,40,1); background: rgba(120,60,0,.8); color: #fff; } }

/* --- JOKER reveal: destello magenta/dorado + pulso del arte --- */
.card-joker { position: relative; }
.fx-joker-flash {
  animation: fxJokerPulse 0.9s cubic-bezier(.2,.8,.3,1) 1 !important;
  z-index: 3;
  overflow: visible;
}
@keyframes fxJokerPulse {
  0%   { transform: scale(1);                    filter: brightness(1); }
  22%  { transform: scale(1.09) rotate(-1.2deg); filter: brightness(1.35) saturate(1.3); }
  45%  { transform: scale(1.04) rotate(0.6deg);  filter: brightness(1.15) saturate(1.15); }
  100% { transform: scale(1) rotate(0);          filter: brightness(1); }
}
/* anillo de luz: pseudo-elemento por delante, con máscara radial para que sea
   un halo alrededor del arte (el centro queda transparente) */
.fx-joker-flash::before {
  content: ''; position: absolute; inset: -18%; border-radius: 50%; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255,255,255,0) 0%, rgba(255,255,255,0) 40%,
    rgba(255,230,140,.95) 52%, rgba(255,80,170,.9) 62%,
    rgba(255,45,120,.35) 74%, rgba(255,45,120,0) 88%);
  filter: blur(3px);
  animation: fxJokerRing 0.9s ease-out 1 forwards;
}
@keyframes fxJokerRing {
  0%   { opacity: 0; transform: scale(.75); }
  20%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.55); }
}
/* barrido de luz recortado a la propia carta */
.fx-joker-flash::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, transparent 28%, rgba(255,245,200,.85) 47%, rgba(255,120,190,.7) 53%, transparent 72%);
  background-size: 300% 100%;
  background-position: 120% 0;
  animation: fxJokerSweep 0.6s ease-in-out 0.1s 1 forwards;
}
@keyframes fxJokerSweep { to { background-position: -20% 0; } }

/* Nivel global (para posibles ajustes por tier del fondo) */
.fx-win-big .bg-vignette { animation: fxVignetteBig 2s ease-out 1; }
@keyframes fxVignetteBig { 0% { opacity: 1; } 15% { opacity: .55; } 100% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .fx-hit, .fx-joker-flash, .fx-count, .fx-row-lit td { animation: none !important; }
  .fx-particles, .fx-screen-flash { display: none !important; }
}

/* Aro dorado persistente en cartas ganadoras (marcadas por fx.js) */
.fx-win-card:not(.card-back):not(.card-joker) {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.9),
    0 2px 3px rgba(0,0,0,.35),
    0 10px 20px rgba(0,0,0,.5),
    0 0 0 3px rgba(255,210,77,.9),
    0 0 30px rgba(255,210,77,.55);
  border-color: rgba(255, 220, 130, 0.9);
}
.fx-win-card.card-joker {
  box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 3px rgba(255,210,77,.9), 0 0 26px rgba(255,210,77,.55);
}
/* la animación de entrada (draw) no debe pisar al pulso de victoria */
.fx-hit.card-draw-anim, .fx-hit.card-deal-anim { animation-name: fxHitSmall; }
