* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-0: #000000;
  --bg-1: #050510;
  --bg-2: #181824;
  --text: #f5f5f5;
  --text-soft: rgba(210, 210, 255, 0.72);
  --accent: #c8a6ff;
  --accent-dim: rgba(180, 170, 255, 0.65);
  --ok: #8dffb0;
  --err: #ff6b81;
  --mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

html { background: var(--bg-0); }

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
  background: radial-gradient(circle at 10% 0%, var(--bg-2) 0, var(--bg-1) 40%, #020208 70%, var(--bg-0) 100%);
  background-size: 140% 140%;
  background-attachment: fixed;
  animation: bg-shift 32s ease-in-out infinite alternate;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

@keyframes bg-shift {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 80% 40%; }
  100% { background-position: 40% 80%; }
}

/* ---------- Boot-Sequenz ---------- */
.init-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #050609 0, #010103 55%, #000 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  padding: 16px;
  transition: opacity 0.8s ease-out;
}
.init-overlay.hidden { opacity: 0; pointer-events: none; }

.init-box {
  padding: 18px 22px 14px;
  border-radius: 14px;
  background: radial-gradient(circle at top, rgba(255,255,255,0.06), rgba(0,0,0,0.9));
  border: 1px solid rgba(180,180,255,0.3);
  box-shadow: 0 0 30px rgba(0,0,0,0.95);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #e8e8ff;
  width: min(360px, 100%);
}
.init-line { min-height: 1.2em; margin-bottom: 4px; white-space: pre; overflow: hidden; }
.init-line.active::after {
  content: "";
  display: inline-block;
  width: 0.6ch;
  height: 1em;
  margin-left: 3px;
  vertical-align: -2px;
  background: rgba(240,240,255,0.9);
  animation: cursor-blink 1s steps(2, start) infinite;
}

/* ---------- Hintergrund ---------- */
.char-field { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.flying-char {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  animation: float-char linear forwards;
}
@keyframes float-char {
  0%   { transform: translate3d(var(--start-x), 100vh, 0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate3d(var(--end-x), -10vh, 0); opacity: 0; }
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='noStitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  z-index: 1;
}

/* ---------- Panels ---------- */
.stack {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  position: relative;
  padding: 24px 26px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.06), rgba(0,0,0,0.6)),
    rgba(4, 4, 10, 0.92);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 0 40px rgba(0,0,0,0.95);
  text-align: center;
}
.panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(190,120,255,0.22);
  opacity: 0.45;
  pointer-events: none;
}
.panel-tight { padding: 18px 22px; }
.panel-confirmed { border-color: rgba(140,255,210,0.35); }
.panel-confirmed .label { color: #8bf0c6; }

.label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 14px;
}

.msg { font-size: 1.05rem; line-height: 1.6; }
.msg-main { display: inline-block; animation: flicker 3.8s infinite ease-in-out; }
.msg-sub {
  display: block;
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-soft);
  animation: pulse 6s infinite ease-in-out;
}
.cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1em;
  margin-top: 6px;
  background: rgba(240,240,255,0.9);
  animation: cursor-blink 1.1s steps(2, start) infinite;
}

/* ---------- Roster ---------- */
.roster { list-style: none; font-family: var(--mono); font-size: 0.82rem; text-align: left; }
.slot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.slot:last-child { border-bottom: none; }
.slot-id { color: var(--accent-dim); }
.slot-state { color: rgba(220,220,255,0.4); letter-spacing: 0.04em; }
.slot.confirmed .slot-state { color: var(--ok); }
.slot.lost .slot-state { color: rgba(255,107,129,0.55); }
.slot.open .slot-state { animation: pulse 3s infinite ease-in-out; }
.roster { max-height: 260px; overflow-y: auto; }

/* ---------- Formular ---------- */
form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dim);
  padding-left: 14px;
}
input {
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.65);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
input::placeholder { color: rgba(200,200,200,0.3); letter-spacing: 0.1em; }
input:focus { border-color: var(--accent); box-shadow: 0 0 18px rgba(200,166,255,0.3); }
input.invalid { border-color: rgba(255,107,129,0.7); }

button {
  margin-top: 4px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(200,166,255,0.6);
  background: linear-gradient(135deg, #281842, #140b24);
  color: var(--text);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 0 16px rgba(200,166,255,0.35); }
button:disabled { opacity: 0.5; cursor: wait; transform: none; }

.message {
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.message.show { opacity: 1; }
.message.error { color: var(--err); }
.message.success { color: var(--ok); }

.foot {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(200,200,255,0.3);
}

/* ---------- Animationen ---------- */
@keyframes flicker {
  0%, 100% { opacity: 0.9; text-shadow: 0 0 6px rgba(255,255,255,0.3); }
  10% { opacity: 0.2; }
  11% { opacity: 1; }
  12% { opacity: 0.4; }
  13% { opacity: 1; }
  57% { opacity: 0.3; }
  60% { opacity: 1; }
}
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }
@keyframes cursor-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.shake { animation: shake 0.26s ease-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .char-field { display: none; }
}
