/*
 * Motion — gentle, always-on movement that keeps the party screen alive without stealing focus.
 * Rules: small amplitudes (≤ 4px, ≤ 2°), slow loops (2–5s), quick feedback (≤ 0.5s).
 * Everything is switched off by prefers-reduced-motion (base.css).
 * Idle loops use the individual `translate` / `rotate` / `scale` properties so they compose
 * with the `transform` used for tilts and the card flip.
 */

/* ---------- screens ---------- */
section:not([hidden]) { animation: screen-in 0.35s var(--ease-out) both; }

/* ---------- floating letters (logo, crazy title, winner) ---------- */
.word { display: inline-block; white-space: nowrap; }
.letter {
  display: inline-block;
  animation: letter-float 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.14s);
}
.logo .pink { animation: neon-flicker 7s linear infinite; }

/* ---------- player list ---------- */
.player-list li { transition: transform 0.2s var(--ease-out), box-shadow 0.2s, scale 0.2s; }
.player-list li.is-dragging { transition: box-shadow 0.2s, scale 0.2s; }
.player-list li.is-dropping { transition: transform 0.18s var(--ease-out), box-shadow 0.2s, scale 0.2s; }
.player-list li.row-enter { animation: row-in 0.35s var(--ease-bounce) both; }

/* ---------- buttons ---------- */
button { transition: scale 0.12s ease, background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s; }
button:active:not(:disabled) { scale: 0.95; }
.primary-button:not(:disabled) { animation: glow-pulse 2.4s ease-in-out infinite; }
.choice-button[aria-pressed='true'] { animation: pop 0.3s var(--ease-bounce); }

/* ---------- the card ---------- */
.card { animation: card-float 5s ease-in-out infinite; }
.card-enter { animation: card-flip 0.45s var(--ease-out), card-float 5s ease-in-out 0.45s infinite; }
.card-enter .card-points-value { animation: pop 0.45s var(--ease-bounce) 0.25s backwards; }
.spice svg.is-active { animation: pepper-sway 3s ease-in-out infinite; animation-delay: calc(var(--i) * -0.4s); }
.card-enter .spice svg.is-active {
  animation: pop 0.35s var(--ease-bounce) backwards, pepper-sway 3s ease-in-out infinite;
  animation-delay: calc(0.3s + var(--i) * 0.08s), calc(var(--i) * -0.4s);
}
.card-crazy { animation: crazy-in 0.5s var(--ease-bounce) backwards, card-float 5s ease-in-out 0.5s infinite; }

/* ---------- race ---------- */
.race-lane.is-current .race-token { animation: token-pulse 1.6s ease-in-out infinite; }

/* ---------- finished ---------- */
.ranking li { animation: row-in 0.4s var(--ease-bounce) backwards; animation-delay: calc(0.25s + var(--i) * 0.09s); }

/* ---------- keyframes ---------- */
@keyframes screen-in {
  from { opacity: 0; translate: 0 12px; }
}
@keyframes letter-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -4px; rotate: -2deg; }
}
@keyframes neon-flicker {
  0%, 90%, 92%, 95%, 100% { opacity: 1; }
  91% { opacity: 0.55; }
  94% { opacity: 0.75; }
}
@keyframes row-in {
  from { opacity: 0; translate: 0 10px; scale: 0.96; }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 16px var(--button-glow); }
  50% { box-shadow: 0 0 30px var(--button-glow-strong); }
}
@keyframes pop {
  0% { scale: 1; }
  40% { scale: 1.08; }
  100% { scale: 1; }
}
@keyframes card-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -5px; rotate: 0.6deg; }
}
@keyframes card-flip {
  from { transform: rotate(var(--card-tilt)) perspective(800px) rotateY(90deg); opacity: 0; }
  to { transform: rotate(var(--card-tilt)) perspective(800px) rotateY(0); opacity: 1; }
}
@keyframes crazy-in {
  from { opacity: 0; scale: 0.85; rotate: -3deg; }
}
@keyframes pepper-sway {
  0%, 100% { rotate: -6deg; }
  50% { rotate: 6deg; }
}
@keyframes token-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--player-color); scale: 1; }
  50% { box-shadow: 0 0 16px var(--player-color); scale: 1.12; }
}
