/* =====================================================================
   Effekte & Animationen (Handy + Leinwand). Nutzt die einzelnen
   Transform-Eigenschaften translate/scale/rotate, damit Animationen das
   Layout-Transform (z. B. translateX(-50%)) nicht überschreiben.
   ===================================================================== */

/* Szenenwechsel */
.is-entering { animation: sceneIn .46s cubic-bezier(.2, .9, .3, 1.08) both; }
.is-leaving { animation: sceneOut .24s ease-in both; pointer-events: none; }
@keyframes sceneIn { from { opacity: 0; translate: 32px 0; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes sceneOut { to { opacity: 0; translate: -32px 0; scale: .97; } }

/* Gestaffeltes Einblenden */
.stagger > *:not(.logo) { animation: riseIn .55s cubic-bezier(.2, .9, .3, 1.05) both; animation-delay: calc(min(var(--i, 0), 9) * 65ms + 90ms); }
@keyframes riseIn { from { opacity: 0; translate: 0 18px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* Logo */
.logo { animation: logoIn .75s cubic-bezier(.2, 1.25, .3, 1) both; }
@keyframes logoIn { from { opacity: 0; scale: .55; translate: 0 -12px; } to { opacity: 1; scale: 1; translate: 0 0; } }
.logo__funny { position: relative; }
.logo__funny::after { content: attr(data-text); position: absolute; inset: 0; color: transparent; pointer-events: none; text-shadow: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.85) 50%, transparent 62%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 4.5s ease-in-out infinite; }
@keyframes shine { 0% { background-position: 130% 0; } 35%, 100% { background-position: -130% 0; } }
.logo__crown { animation: crownWiggle 5s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes crownWiggle { 0%, 80%, 100% { rotate: 0deg; } 84% { rotate: -8deg; } 88% { rotate: 8deg; } 92% { rotate: -5deg; } 96% { rotate: 3deg; } }
.logo__sparks { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .55; scale: .9; } 50% { opacity: 1; scale: 1.08; } }
.logo__year { animation: pillGlow 2.6s ease-in-out infinite; }
@keyframes pillGlow { 0%, 100% { box-shadow: 0 0 14px rgba(196, 92, 255, 0.45), inset 0 0 12px rgba(196, 92, 255, 0.25); } 50% { box-shadow: 0 0 28px rgba(196, 92, 255, 0.85), inset 0 0 16px rgba(196, 92, 255, 0.4); } }

/* Primär-Button: Puls + Lichtstreifen */
.btn-primary { position: relative; overflow: hidden; animation: glowPulse 2.4s ease-in-out infinite; }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(170, 60, 255, 0.28), 0 0 30px rgba(196, 92, 255, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(170, 60, 255, 0.4), 0 0 54px rgba(196, 92, 255, 0.95), inset 0 2px 0 rgba(255, 255, 255, 0.25); }
}
.btn-primary::after { content: ""; position: absolute; inset: -2px; pointer-events: none;
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.38) 50%, transparent 68%);
  translate: -130% 0; animation: btnShine 3.4s ease-in-out infinite; }
@keyframes btnShine { 0%, 55% { translate: -130% 0; } 85%, 100% { translate: 130% 0; } }
.btn-primary:disabled { animation: none; }
.btn-primary:disabled::after { display: none; }

/* Schweben, Wackeln, Zittern, Stempel, Pop */
.float { animation: float 3.2s ease-in-out infinite; }
@keyframes float { 0%, 100% { translate: 0 0; rotate: 0deg; } 50% { translate: 0 -9px; rotate: 1.2deg; } }
.wobble { animation: wobble .7s cubic-bezier(.3, 1.4, .5, 1) both !important; }
@keyframes wobble { 0% { rotate: 0deg; scale: 1; } 25% { rotate: -7deg; scale: 1.08; } 50% { rotate: 6deg; scale: 1.05; } 75% { rotate: -3deg; } 100% { rotate: 0deg; scale: 1; } }
.shake { animation: shake .5s ease both !important; }
@keyframes shake { 10%, 90% { translate: -2px 0; } 20%, 80% { translate: 4px 0; } 30%, 50%, 70% { translate: -6px 0; } 40%, 60% { translate: 6px 0; } }
.stamp { animation: stamp .55s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp { from { opacity: 0; scale: 1.8; rotate: -5deg; } 60% { opacity: 1; scale: .96; rotate: 1deg; } to { scale: 1; rotate: 0deg; } }
.pop { animation: popNum .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes popNum { 0% { scale: 1; } 40% { scale: 1.4; color: #fff; } 100% { scale: 1; } }
.bounce-in { animation: bounceIn .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes bounceIn { from { opacity: 0; scale: .3; } 60% { opacity: 1; scale: 1.08; } to { scale: 1; } }
.flip-in { animation: flipIn .75s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes flipIn { from { opacity: 0; rotate: y 90deg; scale: .7; } 60% { opacity: 1; rotate: y -12deg; scale: 1.04; } to { rotate: y 0deg; scale: 1; } }
.drop-in { animation: dropIn .6s .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes dropIn { from { opacity: 0; translate: 0 -40px; scale: 1.4; } 70% { opacity: 1; translate: 0 4px; } to { translate: 0 0; scale: 1; } }

/* Haken zeichnen */
.check-draw path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .35s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.check-big { animation: bounceIn .6s cubic-bezier(.2, 1.4, .4, 1) both, haloPulse 2s 1s ease-in-out infinite; }
@keyframes haloPulse { 0%, 100% { box-shadow: 0 0 0 6px rgba(196, 92, 255, 0.25), 0 0 40px rgba(196, 92, 255, 0.55); } 50% { box-shadow: 0 0 0 12px rgba(196, 92, 255, 0.12), 0 0 60px rgba(196, 92, 255, 0.9); } }

/* Timer: Endspurt */
.timer.is-low::before { animation: lowGlow .8s ease-in-out infinite; }
@keyframes lowGlow { 0%, 100% { box-shadow: inset 0 0 24px rgba(196, 92, 255, 0.35); } 50% { box-shadow: inset 0 0 36px rgba(255, 90, 200, 0.75); } }
.timer.is-low .timer__bar { filter: drop-shadow(0 0 10px rgba(255, 100, 220, 0.9)) saturate(1.6) hue-rotate(-30deg); }
.timer.is-low { animation: timerBeat 1s ease-in-out infinite; }
@keyframes timerBeat { 0%, 100% { scale: 1; } 50% { scale: 1.05; } }
.dot.is-current { animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { box-shadow: 0 0 10px rgba(196, 92, 255, 0.5); } 50% { box-shadow: 0 0 24px rgba(196, 92, 255, 1); } }

/* Funken */
.spark { position: fixed; width: var(--s, 6px); height: var(--s, 6px); border-radius: 50%; background: var(--c, #ffd978); pointer-events: none; z-index: 80;
  box-shadow: 0 0 8px var(--c, #ffd978); animation: sparkFly .8s cubic-bezier(.1, .8, .3, 1) forwards; }
@keyframes sparkFly { from { opacity: 1; translate: -50% -50%; scale: 1; } to { opacity: 0; translate: calc(-50% + var(--dx)) calc(-50% + var(--dy)); scale: 0; } }

/* Sieger-Strahlen */
.rays { position: absolute; inset: -45%; border-radius: 50%; pointer-events: none; z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 220, 110, 0.4) 0deg 10deg, rgba(255, 220, 110, 0) 10deg 26deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%);
  animation: spin 16s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* QR-Kasten atmet, Hinweis-Pille hüpft */
.qr-box { animation: qrPulse 3.2s ease-in-out infinite; }
@keyframes qrPulse { 0%, 100% { scale: 1; box-shadow: 0 0 0 3px rgba(196, 92, 255, 0.35), 0 0 30px rgba(196, 92, 255, 0.5); } 50% { scale: 1.025; box-shadow: 0 0 0 5px rgba(196, 92, 255, 0.5), 0 0 48px rgba(196, 92, 255, 0.85); } }
.bob { animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* Sound-Schalter */
.sound-toggle { position: fixed; z-index: 90; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(40, 12, 75, 0.65); border: 1.5px solid rgba(196, 92, 255, 0.55); color: #e9d5ff; box-shadow: 0 0 12px rgba(196, 92, 255, 0.3); }
.sound-toggle .ico { width: 20px; height: 20px; }
.sound-toggle.is-off { color: #9f86c4; border-color: rgba(255, 255, 255, 0.2); }

@media (prefers-reduced-motion: reduce) {
  .is-entering, .is-leaving, .stagger > *, .logo, .float, .btn-primary, .rays, .qr-box, .bob { animation: none !important; }
}
