/* DOM effects for HUD / result screens. Restart an animation with:
   el.classList.remove('fx-slam'); void el.offsetWidth; el.classList.add('fx-slam');
   Every motion is upward or scale-from-the-feet, so nothing pushes past the screen edge (no scrollbar flicker). */

/* a word pops in with a little overshoot (captions, "上出来！", banners) */
@keyframes fx-pop { 0% { transform: scale(.4) rotate(-4deg); opacity: 0; } 70% { transform: scale(1.08) rotate(1deg); opacity: 1; } 100% { transform: none; } }
.fx-pop { animation: fx-pop .32s cubic-bezier(.2, 1.6, .4, 1) both; }

/* a stamp / rank letter slams down: big and tilted, lands with a squash */
@keyframes fx-slam { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 55% { transform: scale(.92) rotate(-6deg); opacity: 1; }
  75% { transform: scale(1.06) rotate(-8deg); } 100% { transform: scale(1) rotate(-8deg); } }
.fx-slam { animation: fx-slam .42s cubic-bezier(.2, .9, .3, 1.2) both; }

/* a card prints out of a slot (results slip) */
@keyframes fx-print { from { transform: translateY(-40%); clip-path: inset(40% 0 0 0); } to { transform: none; clip-path: inset(0 0 0 0); } }
.fx-print { animation: fx-print .7s steps(14) both; }

/* the card jolts when the stamp lands */
@keyframes fx-thud { 0% { transform: translateY(0); } 30% { transform: translateY(6px) scale(1.01, .98); } 100% { transform: none; } }
.fx-thud { animation: fx-thud .25s ease-out; }

/* a banner sweeps across ("ゾーン突入！", act titles) */
@keyframes fx-banner { 0% { transform: translateX(-110%) skewX(-12deg); } 18%, 78% { transform: translateX(0) skewX(-12deg); } 100% { transform: translateX(110%) skewX(-12deg); } }
.fx-banner { animation: fx-banner 1.6s cubic-bezier(.2, .8, .2, 1) both; }

/* "+120" floats up and fades */
@keyframes fx-float { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }
.fx-float { animation: fx-float .9s ease-out both; pointer-events: none; }

/* a character hops when tapped or when it speaks (up only, from the feet) */
@keyframes fx-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-14px) scale(.97, 1.04); } 60% { transform: translateY(0) scale(1.03, .97); } }
.fx-hop { animation: fx-hop .38s ease-out; transform-origin: 50% 100%; }

/* a gentle breathing idle */
@keyframes fx-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.01, 1.025); } }
.fx-breathe { animation: fx-breathe 2.6s ease-in-out infinite; transform-origin: 50% 100%; }

/* an urgent warning pulses */
@keyframes fx-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.fx-pulse { animation: fx-pulse .5s ease-in-out infinite; }

/* a full-screen flash layer: set --fx-flash-color and toggle .on */
.fx-flash { position: fixed; inset: 0; pointer-events: none; background: var(--fx-flash-color, #fff); opacity: 0; }
.fx-flash.on { animation: fx-flash .3s ease-out both; }
@keyframes fx-flash { from { opacity: .9; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .fx-pop, .fx-slam, .fx-print, .fx-thud, .fx-banner, .fx-float, .fx-hop, .fx-pulse { animation-duration: .01s !important; }
  .fx-breathe { animation: none; }
  .fx-flash.on { animation: none; }
}
