/* Due Maglie — "juice" (assets/js/fx.js): pixel bursts, confetti, card shine/glow, GOL! banner, press feedback.
   Pixel look: square particles, steps() timing, crisp edges. Reduced motion: no particles, only short fades. */

/* ---------- overlay for effects outside dialogs ---------- */
.fx-layer { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; overflow: hidden; }
.fx-burst { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 20; }
.fx-px {
  position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  background: var(--c); box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .28);
  animation: fx-fly var(--d, .7s) steps(8, end) forwards;
}
@keyframes fx-fly {
  0% { transform: translate(0, 0); opacity: 1; }
  55% { transform: translate(var(--mx), var(--my)); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* ---------- perfect grid: pixel confetti ---------- */
.fx-confetti { position: absolute; inset: 0; }
.fx-conf {
  position: absolute; top: -12px; left: var(--x); width: var(--w); height: var(--h); background: var(--c);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .25);
  animation: fx-fall var(--d) steps(26, end) var(--dl) forwards, fx-flutter var(--fl) steps(2, jump-none) var(--dl) infinite alternate;
}
@keyframes fx-fall { from { transform: translate(0, 0); } to { transform: translate(var(--sx), calc(100vh + 24px)); } }
@keyframes fx-flutter { from { scale: 1 1; } to { scale: .35 1; } }

/* ---------- pixel banners ("GOL!", "PERFETTA!") ---------- */
.fx-banner {
  position: absolute; left: 50%; top: 50%; z-index: 30; width: min(64%, 260px); pointer-events: none;
  transform: translate(-50%, -50%); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .55));
  animation: fx-banner 1.8s steps(1, end) forwards;
}
.fx-banner-perfect { width: min(86vw, 520px); top: 38%; }
.fx-ptext { display: block; width: 100%; height: auto; image-rendering: pixelated; overflow: visible; }
@keyframes fx-banner {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
  6% { transform: translate(-50%, -50%) scale(.7); }
  12% { transform: translate(-50%, -50%) scale(1.2); }
  18% { transform: translate(-50%, -50%) scale(1); }
  48% { opacity: 1; } 54% { opacity: 0; } 60% { opacity: 1; } 66% { opacity: 0; } 72% { opacity: 1; }
  92% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.fx-banner.is-still { animation: fx-fade 1.6s ease-out forwards; }
@keyframes fx-fade { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- match: goal flash on the scoreboard ---------- */
.scoreboard { position: relative; }
.scoreboard.goal { animation: fx-goalflash 2.6s ease-out; }
@keyframes fx-goalflash {
  0% { box-shadow: 0 0 0 2px var(--gc, #3cf2ff), 0 0 34px color-mix(in srgb, var(--gc, #3cf2ff) 60%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 transparent; }
}
.scoreboard.goal .sb-score { animation: fx-digits .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes fx-digits { from { transform: scale(1.35); } to { transform: scale(1); } }
/* "GOL!" band: club colours, scorer and minute; slides in, holds, slides out */
.sb-goal {
  position: absolute; left: -4px; right: -4px; top: 50%; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12% 12px;
  background: linear-gradient(100deg, var(--g1) 0 72%, var(--g2) 72% 76%, var(--g1) 76%);
  color: var(--gt); box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  transform: translateY(-50%) skewY(-4deg); animation: sb-goal 2.6s cubic-bezier(.2, .8, .2, 1) forwards;
}
.sb-goal-w { font: italic 800 clamp(44px, 13vw, 76px)/.9 var(--display); letter-spacing: .02em; text-transform: uppercase; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.sb-goal-who { font: 800 clamp(16px, 4.6vw, 22px)/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; opacity: .92; }
@keyframes sb-goal {
  0% { clip-path: inset(0 100% 0 0); }
  14% { clip-path: inset(0 0 0 0); }
  82% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 100%); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-goal { animation: fx-fade 2.4s ease-out forwards; }
  .scoreboard.goal, .scoreboard.goal .sb-score { animation: none; }
}
.match-result:not([hidden]) > span { display: inline-block; animation: fx-stamp .45s steps(4, end) both; }
@keyframes fx-stamp { from { transform: scale(1.9); opacity: 0; } 50% { opacity: 1; } to { transform: scale(1); opacity: 1; } }

/* ---------- grid: correct cell flash ---------- */
.cell > .fx-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; animation: fx-flash .66s steps(1, end) forwards; }
@keyframes fx-flash {
  0% { background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 3px var(--fx-c); }
  16% { background: rgba(255, 241, 184, .45); box-shadow: inset 0 0 0 6px var(--fx-c); }
  33% { background: transparent; box-shadow: inset 0 0 0 3px var(--fx-c); }
  50% { box-shadow: inset 0 0 0 6px var(--fx-c); }
  66%, 100% { box-shadow: inset 0 0 0 0 transparent; background: transparent; }
}

/* ---------- card reveal: tinted flare, glow by tier, shine sweep ---------- */
.dlg-reveal[data-fx-tier="bronzo"] .reveal-flare { background: radial-gradient(circle, rgba(230, 180, 138, .32), rgba(230, 180, 138, 0) 60%); }
.dlg-reveal[data-fx-tier="argento"] .reveal-flare { background: radial-gradient(circle, rgba(244, 245, 246, .36), rgba(244, 245, 246, 0) 60%); }
.dlg-reveal[data-fx-tier="oro"] .reveal-flare { background: radial-gradient(circle, rgba(255, 215, 94, .5), rgba(255, 215, 94, 0) 62%); }
.dlg-reveal[data-fx-tier="unica"] .reveal-flare { background: conic-gradient(from 0deg, rgba(255, 106, 213, .35), rgba(139, 233, 253, .35), rgba(124, 252, 154, .35), rgba(255, 241, 184, .4), rgba(255, 106, 213, .35)); -webkit-mask: radial-gradient(circle, #000 20%, transparent 62%); mask: radial-gradient(circle, #000 20%, transparent 62%); }
.fx-t-bronzo { --fx-g: rgba(230, 160, 100, .75); }
.fx-t-argento { --fx-g: rgba(230, 240, 255, .8); }
.fx-t-oro { --fx-g: rgba(255, 210, 80, .95); }
.fx-t-unica { --fx-g: rgba(255, 140, 230, .95); }
.pc-wrap.fx-glow { animation: fx-glow 1.8s steps(6, end) .5s both; }
@keyframes fx-glow {
  0% { filter: drop-shadow(0 0 0 transparent); }
  25% { filter: drop-shadow(0 0 22px var(--fx-g)); }
  100% { filter: drop-shadow(0 0 10px var(--fx-g)); }
}
.pc > .fx-shine {
  position: absolute; inset: -10% -40%; z-index: 4; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .55) 40%, rgba(255, 255, 255, .55) 46%, rgba(255, 255, 255, .25) 46%, rgba(255, 255, 255, .25) 50%, transparent 50%);
  transform: translateX(-80%); opacity: 0;
  animation: fx-shine .8s steps(10, end) .62s 1 both;
}
.pc > .fx-shine.is-twice { animation-iteration-count: 2; }
@keyframes fx-shine { 0% { transform: translateX(-80%); opacity: 1; } 99% { opacity: 1; } 100% { transform: translateX(80%); opacity: 0; } }

/* ---------- score tick-up end pop ---------- */
.end-num { display: inline-block; }
.end-num.fx-pop { animation: fx-pop .4s steps(4, end); }
@keyframes fx-pop { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- press feedback (pixel "click": drops 2px, no easing) ---------- */
.btn:active:not(:disabled) { transform: translateY(2px); filter: brightness(.92); transition: none; }
.btn-gold:active:not(:disabled) { box-shadow: 0 2px 10px rgba(224, 180, 58, .2), inset 0 2px 0 rgba(0, 0, 0, .18); }
.icon-btn:active:not(:disabled), .lang-btn:active:not(:disabled) { transform: translateY(2px); background: rgba(241, 245, 239, .14); }
.tab:active .ico { transform: translateY(2px); }
.cell.is-open:active { transform: translateY(2px); background: rgba(241, 245, 239, .14); transition: none; }
.res:active:not(:disabled) { transform: translateY(2px); transition: none; }
.club-chip:active:not(:disabled), .club-btn-main:active:not(:disabled) { filter: brightness(1.15); }

/* ---------- sound toggle: pixel speaker in the header (wide screens) and a switch in the account dialog ---------- */
.fx-ico { width: 22px; height: 22px; image-rendering: pixelated; }
.fx-snd-btn[aria-pressed="true"] .fx-x, .fx-snd-btn[aria-pressed="false"] .fx-w { display: none; }
.fx-snd-btn[aria-pressed="false"] { color: var(--muted); }
.fx-snd-btn { display: none; }
@media (min-width: 430px) { .fx-snd-btn { display: inline-grid; } }
.fx-snd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(241, 245, 239, .04); }
.fx-snd-l { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fx-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 6px; border: 2px solid var(--line-2); border-radius: 6px; background: #030805; font-weight: 700; font-size: 14px; }
.fx-switch-k { width: 26px; height: 16px; background: #1b2a21; box-shadow: inset 0 0 0 2px #39503f; position: relative; }
.fx-switch-k::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; background: #6f8076; transition: transform .12s steps(2, end); }
.fx-switch[aria-checked="true"] .fx-switch-k { background: #2e8b3e; box-shadow: inset 0 0 0 2px var(--oro-2); }
.fx-switch[aria-checked="true"] .fx-switch-k::after { transform: translateX(10px); background: var(--oro-1); }
.fx-switch[aria-checked="true"] .fx-off, .fx-switch[aria-checked="false"] .fx-on { display: none; }
.fx-switch[aria-checked="false"] { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .fx-px, .fx-conf, .fx-shine { display: none !important; }
  .pc-wrap.fx-glow { animation: none; filter: drop-shadow(0 0 10px var(--fx-g)); }
  .btn:active:not(:disabled), .icon-btn:active:not(:disabled), .lang-btn:active:not(:disabled), .cell.is-open:active, .res:active:not(:disabled), .tab:active .ico { transform: none; }
}
.fx-snd-l .fx-x { display: none; }
@media (prefers-reduced-motion: reduce) {
  /* keep the banner as a short fade (app.css shortens every animation under reduced motion) */
  .fx-banner.is-still { animation-duration: 1.6s !important; }
}
