* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
  background: linear-gradient(160deg, #fff3d6, #ffd9a0);
  color: #3a2a1a;
  text-align: center;
  padding: 1.5rem;
}

main { width: 100%; max-width: 420px; }

section[hidden] { display: none; }

#btn-mute {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: rgba(255,255,255,0.7);
  border-radius: 999px;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.2rem;
  cursor: pointer;
}

#form-check {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#input-nummer {
  font-size: 2rem;
  text-align: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 2px solid #c9862f;
}

#form-check button,
#btn-again {
  font-size: 1.2rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: none;
  background: #c9862f;
  color: white;
  cursor: pointer;
}

#input-error {
  color: #b3261e;
  font-weight: bold;
}

.pokeball {
  width: min(45vw, 190px);
  filter: drop-shadow(0 8px 16px rgba(58, 42, 26, 0.25));
  transform-origin: 50% 88%;
}

@keyframes pokeball-tick {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(calc(var(--dir, 1) * var(--tilt, 16deg))); }
  100% { transform: rotate(0deg); }
}

.pokeball.tick {
  animation: pokeball-tick var(--tick-duration, 260ms) cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes pokeball-escape {
  0% { transform: rotate(0deg) scale(1); opacity: 1; }
  15% { transform: rotate(-22deg) scale(1); }
  30% { transform: rotate(20deg) scale(1); }
  45% { transform: rotate(-16deg) scale(1); }
  60% { transform: rotate(12deg) scale(1); }
  75% { transform: rotate(-6deg) scale(1); }
  100% { transform: rotate(0deg) scale(0.9); opacity: 0.55; }
}

.pokeball.escape {
  animation: pokeball-escape 450ms ease-out forwards;
}

@keyframes pokeball-caught {
  0% { transform: scale(1); filter: drop-shadow(0 8px 16px rgba(58, 42, 26, 0.25)) brightness(1); }
  40% { transform: scale(1.18); filter: drop-shadow(0 8px 16px rgba(58, 42, 26, 0.25)) brightness(1.4); }
  100% { transform: scale(1); filter: drop-shadow(0 8px 16px rgba(58, 42, 26, 0.25)) brightness(1); }
}

.pokeball.caught {
  animation: pokeball-caught 420ms ease-out;
}

#result-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
}

#screen-result { padding-bottom: 260px; }

#result-titel { font-size: 1.8rem; margin-bottom: 0.25rem; }
#result-produkt { font-size: 1.3rem; margin-bottom: 1.5rem; }

#ball-stage {
  position: fixed;
  top: 58vh;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

#ball-stage[hidden] {
  display: none;
}

.lucky-ball-reveal__star {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--size);
  height: var(--size);
  background: #ffcf6b;
  filter: drop-shadow(0 0 2px #3a2a1a);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  opacity: 0;
}

#ball-stage.stars-burst .lucky-ball-reveal__star {
  animation: lbrStarPop 0.6s var(--delay) cubic-bezier(0.34, 1.56, 0.64, 1) both,
    lbrStarTwinkle 1.8s calc(var(--delay) + 0.6s) ease-in-out infinite;
}

@keyframes lbrStarPop {
  0% { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(0) rotate(0deg); opacity: 0; }
  60% { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(1.3) rotate(200deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(1) rotate(360deg); opacity: 0.95; }
}

@keyframes lbrStarTwinkle {
  0%, 100% { opacity: 0.95; transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(1) rotate(360deg); }
  50% { opacity: 0.35; transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(0.8) rotate(360deg); }
}
