:root {
  --gold: linear-gradient(170deg, #fff3b0 0%, #ffd34d 30%, #c8901a 55%, #ffe58a 75%, #9a6a0c 100%);
  --silber: linear-gradient(175deg, #ffffff 0%, #c9ced6 40%, #7d8591 60%, #eef1f5 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: #0a0812;
  color: #e8eaf0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Disco-Licht: eine einzige Ebene, die nur per transform rotiert (GPU, kein Repaint). */
.disco {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 200vmax;
  height: 200vmax;
  margin: -100vmax 0 0 -100vmax;
  background: repeating-conic-gradient(
    from 0deg,
    #ff2fb9 0deg 12deg, transparent 12deg 30deg,
    #2fd9ff 30deg 42deg, transparent 42deg 60deg,
    #ffd34d 60deg 72deg, transparent 72deg 90deg,
    #9b5cff 90deg 102deg, transparent 102deg 120deg
  );
  -webkit-mask-image: radial-gradient(closest-side, transparent 8%, #000 40%, transparent 75%);
  mask-image: radial-gradient(closest-side, transparent 8%, #000 40%, transparent 75%);
  opacity: .28;
  animation: drehen 24s linear infinite, farbton 9s linear infinite;
  will-change: transform, filter;
  transition: opacity 2.5s ease-in-out;
}

main {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-block: max(1.25rem, env(safe-area-inset-top, 0px)) max(1.75rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: linear-gradient(90deg,
    #eef1f5, #ffd34d, #ff2fb9, #9b5cff, #2fd9ff, #c9ced6, #eef1f5) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: farbwechsel 6s linear infinite;
}

.buehne {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
}

#zahl, #frage {
  grid-area: 1 / 1;
  font-size: min(62vw, 58vh);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 .06em rgba(255, 200, 60, .55));
}

#frage { display: none; }

.endspurt #zahl { animation: puls .5s ease-in-out infinite alternate; }

.fertig #zahl { display: none; }
.fertig #frage {
  display: block;
  animation: plopp .7s cubic-bezier(.2, 1.7, .4, 1) both,
             wippen 2.4s ease-in-out .7s infinite alternate;
}
.fertig .disco { opacity: .45; }

button {
  font: inherit;
  font-size: clamp(1.15rem, 4.5vw, 1.6rem);
  font-weight: 800;
  letter-spacing: .06em;
  color: #2a1c00;
  background: var(--gold);
  border: 2px solid #fff3b0;
  border-radius: 999px;
  min-height: 3.25rem;
  padding: .7em 2.4em;
  cursor: pointer;
  box-shadow: 0 .35em 1.4em rgba(255, 200, 60, .35);
  transition: transform .12s ease;
  touch-action: manipulation;
}
button:hover { transform: scale(1.04); }
button:active { transform: scale(.96); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

@keyframes drehen { to { transform: rotate(360deg); } }
@keyframes farbton { to { filter: hue-rotate(360deg); } }
/* -150 % bei 300 % Breite = genau eine Verlaufslänge, also nahtlose Schleife. */
@keyframes farbwechsel { to { background-position: -150% 0; } }
@keyframes puls { to { transform: scale(1.08); } }
@keyframes plopp {
  from { transform: scale(0) rotate(-35deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes wippen {
  from { transform: rotate(-5deg) scale(1); }
  to   { transform: rotate(5deg) scale(1.06); }
}

@media (orientation: landscape) and (max-height: 480px) {
  #zahl, #frage { font-size: 52vh; }
  h1 { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .disco, .endspurt #zahl, .fertig #frage { animation: none; }
  h1 { animation: none; }
}
