/* action-effects.css — motion for the equipped action effects drawn by action-effects.js (Piece Standard
 * P5). Every effect is a <g class="ludo-action-effect"> in #action-effects-layer, placed by its own
 * translate() in board units. Its parts animate here, each about its own centre. --fx-ms is the effect's
 * length. Nothing here touches a piece, a token or a tap target.
 *
 * Reduced motion: action-effects.js adds .is-still instead of .is-playing — the effect is still drawn, as
 * one still frame held briefly, and nothing below runs. The media query and the body classes repeat that
 * for an effect that was already playing when the setting changed. */
#action-effects-layer { pointer-events: none; }
.ludo-action-effect { pointer-events: none; }
.ludo-action-effect > * { transform-box: fill-box; transform-origin: center; }

/* ---- shared parts ---- */
.ludo-action-effect.is-playing .fx-shock { animation: fx-shock calc(var(--fx-ms) * .8) cubic-bezier(.2, .7, .3, 1) both; }
.ludo-action-effect.is-playing .fx-shock-late { animation-delay: calc(var(--fx-ms) * .22); }
.ludo-action-effect.is-playing .fx-burst { animation: fx-burst var(--fx-ms) cubic-bezier(.2, 1.4, .4, 1) both; }
.ludo-action-effect.is-playing .fx-burst-inner { animation-delay: 50ms; }
.ludo-action-effect.is-playing .fx-spark { animation: fx-fly calc(var(--fx-ms) * .75) cubic-bezier(.15, .7, .3, 1) both; animation-delay: 70ms; }
.ludo-action-effect.is-playing .fx-core { animation: fx-core var(--fx-ms) cubic-bezier(.2, 1.6, .4, 1) both; }
.ludo-action-effect.is-playing .fx-glow { animation: fx-glow var(--fx-ms) ease-out both; }

@keyframes fx-shock { 0% { transform: scale(.35); opacity: 0; } 12% { opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes fx-burst { 0% { transform: scale(.1) rotate(-25deg); opacity: 0; } 14% { opacity: 1; } 34% { transform: scale(1.18) rotate(6deg); } 60% { transform: scale(1) rotate(0deg); opacity: 1; } 100% { transform: scale(1.08) rotate(0deg); opacity: 0; } }
@keyframes fx-fly { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--fx-dx), var(--fx-dy)); opacity: 0; } }
@keyframes fx-core { 0% { transform: scale(0); opacity: 0; } 22% { transform: scale(1.3); opacity: 1; } 40% { transform: scale(1); } 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(.7); opacity: 0; } }
@keyframes fx-glow { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 70% { transform: scale(1); opacity: .85; } 100% { transform: scale(1.25); opacity: 0; } }

/* ---- capture.thunder-strike ---- */
.ludo-action-effect.is-playing .fx-bolt { transform-origin: 50% 0%; animation: fx-bolt var(--fx-ms) steps(1, end) both; }
.ludo-action-effect.is-playing .fx-bolt-fork { animation-delay: 60ms; }
.ludo-action-effect.is-playing .fx-flash { animation: fx-flash var(--fx-ms) ease-out both; }
@keyframes fx-bolt { 0% { opacity: 0; } 6% { opacity: 1; } 18% { opacity: .25; } 26% { opacity: 1; } 44% { opacity: .5; } 52% { opacity: 1; } 68% { opacity: 0; } 100% { opacity: 0; } }
@keyframes fx-flash { 0% { transform: scale(.4); opacity: 0; } 8% { transform: scale(1.3); opacity: 1; } 30% { transform: scale(1); opacity: .5; } 46% { opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

/* ---- home.classic-glow ---- */
.ludo-action-effect.is-playing .fx-beam { transform-origin: 50% 100%; animation: fx-beam var(--fx-ms) cubic-bezier(.2, .8, .3, 1) both; }
.ludo-action-effect.is-playing .fx-mote { animation: fx-fly calc(var(--fx-ms) * .7) ease-out both; animation-delay: var(--fx-delay, 0ms); }
@keyframes fx-beam { 0% { transform: scaleY(0) scaleX(.5); opacity: 0; } 22% { transform: scaleY(1.12) scaleX(1); opacity: 1; } 38% { transform: scaleY(1) scaleX(1); } 72% { opacity: 1; } 100% { transform: scaleY(1.3) scaleX(.7); opacity: 0; } }

/* ---- home.portal-burst ---- */
.ludo-action-effect.is-playing .fx-ring-a { animation: fx-ring-cw var(--fx-ms) ease-out both; }
.ludo-action-effect.is-playing .fx-ring-b { animation: fx-ring-ccw var(--fx-ms) ease-out both; }
.ludo-action-effect.is-playing .fx-ring-c { animation: fx-ring-cw var(--fx-ms) ease-out both; animation-delay: 60ms; }
@keyframes fx-ring-cw { 0% { transform: scale(.2) rotate(0deg); opacity: 0; } 20% { opacity: 1; } 70% { transform: scale(1) rotate(260deg); opacity: 1; } 100% { transform: scale(1.3) rotate(340deg); opacity: 0; } }
@keyframes fx-ring-ccw { 0% { transform: scale(.2) rotate(0deg); opacity: 0; } 20% { opacity: 1; } 70% { transform: scale(1) rotate(-300deg); opacity: 1; } 100% { transform: scale(1.3) rotate(-380deg); opacity: 0; } }

/* ---- victory.classic-confetti / victory.crown-storm ---- */
.ludo-action-effect.is-playing .fx-paper { animation: fx-paper var(--fx-ms) cubic-bezier(.12, .7, .3, 1) both; animation-delay: var(--fx-delay, 0ms); }
.ludo-action-effect.is-playing .fx-ray { animation: fx-ray var(--fx-ms) ease-in-out both; }
.ludo-action-effect.is-playing .fx-ray:nth-of-type(even) { animation-delay: 120ms; }
.ludo-action-effect.is-playing .fx-crown { animation: fx-crown var(--fx-ms) cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes fx-paper {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  45% { transform: translate(var(--fx-dx), var(--fx-dy)) rotate(calc(var(--fx-rot) * .55)); opacity: 1; }
  100% { transform: translate(var(--fx-dx), calc(var(--fx-dy) + var(--fx-fall))) rotate(var(--fx-rot)); opacity: 0; }
}
/* A ray keeps its own rotate() attribute (its place on the halo), so only its opacity moves. */
.ludo-action-effect .fx-ray { transform-box: view-box; transform-origin: 0 0; }
@keyframes fx-ray { 0% { opacity: 0; } 18% { opacity: .95; } 45% { opacity: .45; } 65% { opacity: .9; } 100% { opacity: 0; } }
@keyframes fx-crown { 0% { transform: translateY(26px) scale(.2); opacity: 0; } 20% { transform: translateY(-8px) scale(1.15); opacity: 1; } 34% { transform: translateY(0) scale(1); } 60% { transform: translateY(-5px) scale(1); } 82% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-10px) scale(1.05); opacity: 0; } }

/* ---- the still frame: drawn, not moving ---- */
.ludo-action-effect.is-still > * { animation: none !important; }
.ludo-action-effect.is-still .fx-spark,
.ludo-action-effect.is-still .fx-mote { transform: translate(calc(var(--fx-dx) * .45), calc(var(--fx-dy) * .45)); opacity: .9; }
.ludo-action-effect.is-still .fx-paper { transform: translate(var(--fx-dx), var(--fx-dy)) rotate(calc(var(--fx-rot) * .2)); }
.ludo-action-effect.is-still .fx-shock { transform: scale(1.5); opacity: .6; }
.ludo-action-effect.is-still .fx-ray { opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  .ludo-action-effect > * { animation: none !important; }
}
body.calm .ludo-action-effect > *,
body.performance-mode .ludo-action-effect > * { animation: none !important; }
