:root {
  --accent-a: #5b8cff;   /* blau  */
  --accent-b: #a86bff;   /* violett */
  --accent-c: #d46bff;   /* magenta */
  --text: #f1f1f5;
  --text-dim: #7c7c88;
  --bg-0: #000005;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Hintergrund: Sterne + Glow ---------- */
.stars {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(130% 90% at 50% 46%, #0b0b16 0%, #05050b 55%, #000005 100%);
}
.stars svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.glow {
  position: fixed;
  top: 50%; left: 50%;
  width: 120vw; height: 120vw;
  max-width: 640px; max-height: 640px;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle,
    rgba(120, 110, 255, 0.14) 0%,
    rgba(150, 90, 255, 0.07) 34%,
    transparent 62%);
  filter: blur(4px);
}

.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: calc(env(safe-area-inset-top) + 34px) 24px calc(env(safe-area-inset-bottom) + 40px);
}

/* ---------- Kopf ---------- */
.head { text-align: center; padding-top: 6px; }
.brand {
  font-size: clamp(26px, 7.6vw, 38px);
  font-weight: 300;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: #f3f3f7;
}

/* ---------- Bühne / Loch ---------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.hole {
  position: relative;
  width: min(66vw, 300px);
  aspect-ratio: 1;
  background: none;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
}
.hole:active { transform: scale(0.97); }

.ring { width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }

/* Ruhering – kühl, dünn, Hauch Blau */
.ring-idle {
  stroke: rgba(150, 170, 220, 0.5);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(110, 130, 220, 0.18));
  transition: opacity 0.4s ease;
}

/* Fortschrittsring – blau→violette Akkretionsscheibe */
.ring-progress {
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 653.45;      /* 2·π·104 */
  stroke-dashoffset: 653.45;
  opacity: 0;
  /* Fix: um den eigenen Mittelpunkt rotieren (nicht exzentrisch) */
  transform-box: fill-box;
  transform-origin: center;
  transition: stroke-dashoffset 0.25s linear, opacity 0.4s ease;
  filter: drop-shadow(0 0 8px rgba(120, 110, 255, 0.65))
          drop-shadow(0 0 18px rgba(150, 90, 255, 0.35));
}

.percent {
  position: absolute;
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 200;
  letter-spacing: 0.02em;
  color: #f2f2f6;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-variant-numeric: tabular-nums;
}

.hint {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-align: center;
  min-height: 18px;
  transition: color 0.3s ease;
}

/* ----- Zustände ----- */
.hole.active .ring-idle,
.hole.busy   .ring-idle { opacity: 0; }
.hole.active .ring-progress { opacity: 1; }
.hole.active .percent { opacity: 1; }

/* unbestimmte Phase (Server holt Video): ruhig rotierender Arc */
.hole.busy .ring-progress {
  opacity: 1;
  stroke-dasharray: 150 503;
  stroke-dashoffset: 0;
  animation: spin 1.2s linear infinite;
}
.hole.busy .percent { opacity: 0; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* sanftes Atmen des Kerns während Aktivität */
.hole.active .ring-core, .hole.busy .ring-core {
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { filter: drop-shadow(0 0 2px rgba(110,100,255,.15)); }
  50%     { filter: drop-shadow(0 0 16px rgba(130,90,255,.4)); }
}

.hole.done .ring-progress {
  opacity: 1;
  stroke-dashoffset: 0;
  stroke: #7de0a0;
  filter: drop-shadow(0 0 10px rgba(90, 220, 150, 0.6));
  animation: none;
}
.hole.error .ring-progress {
  opacity: 1;
  stroke: #c96b6b;
  animation: none;
}
.hint.err { color: #c98b8b; }

/* ---------- Fuß ---------- */
.foot { display: flex; justify-content: center; align-items: flex-end; }
.claim {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #55566a;
}

/* ---------- Paste-Sheet ---------- */
.paste-sheet {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 20;
  animation: fade 0.2s ease;
}
.paste-sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.paste-card {
  width: 100%; max-width: 460px;
  background: #101018;
  border: 1px solid rgba(140,150,255,0.12);
  border-radius: 22px 22px 0 0;
  padding: 24px 20px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 16px;
  animation: rise 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.paste-label { font-size: 14px; letter-spacing: 0.12em; color: var(--text-dim); }
.paste-input {
  width: 100%;
  background: #06060c;
  border: 1px solid rgba(140,150,255,0.16);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.paste-input:focus { border-color: var(--accent-b); }
.paste-actions { display: flex; gap: 12px; }
.btn {
  flex: 1; padding: 14px; border-radius: 12px; border: none;
  font-size: 15px; font-weight: 500; letter-spacing: 0.04em; cursor: pointer;
}
.btn.ghost { background: rgba(255,255,255,0.06); color: var(--text); }
.btn.primary {
  background: linear-gradient(120deg, var(--accent-a), var(--accent-c));
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
