[hidden] { display: none !important; }
:root {
  --bg: #070a1c;
  --bg2: #10173a;
  --card: rgba(255,255,255,.055);
  --line: rgba(255,255,255,.12);
  --text: #f4f1ea;
  --muted: #a6abc6;
  --gold: #ffcf5a;
  --hot: #ff8a3d;
  --red: #ff3355;
  --accent: var(--gold);
  --k: 0;            /* Intensität 0..1, wird per JS gesetzt */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html { background: var(--bg); }
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%);
}
/* Glühen, das mit der Intensität wächst */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(70% 60% at 50% 40%, var(--accent), transparent 70%);
  opacity: calc(var(--k) * .38);
  transition: background .6s;
}
body.phase-intense { --accent: var(--hot); }
body.phase-extreme { --accent: var(--red); }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#flash { position: fixed; inset: 0; z-index: 50; background: #fff; opacity: 0; pointer-events: none; }
#flash.on { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
#lightshow { position: fixed; inset: 0; z-index: 40; display: none; cursor: pointer; }
body.lightshow #lightshow { display: block; }
#floaters { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.floater { position: absolute; bottom: -60px; font-size: 42px; animation: floatUp 3.2s ease-out forwards; text-align: center; }
.floater small { display: block; font-size: 12px; color: var(--muted); font-family: inherit; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(-75vh) scale(1.25); opacity: 0; } }

header.top, main, footer { position: relative; z-index: 2; }
header.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; margin-right: auto; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); border-radius: 99px; padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 480px) { .brand span { display: none; } }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: #888; }
.badge.ok i { background: #3ddc84; box-shadow: 0 0 8px #3ddc84; }
.badge.busy i { background: var(--gold); animation: blink 1s infinite; }
.badge.fail i { background: var(--red); }
@keyframes blink { 50% { opacity: .3; } }
.langs { display: flex; gap: 6px; }
.langs button { background: none; border: 2px solid transparent; border-radius: 4px; padding: 1px; cursor: pointer; line-height: 0; opacity: .55; }
.langs button.active { border-color: var(--gold); opacity: 1; }

/* ---------- Bühne ---------- */
.stage {
  min-height: calc(100svh - 70px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px 16px 28px; gap: 6px;
}
.date { color: var(--muted); font-size: clamp(14px, 2.4vw, 18px); letter-spacing: .02em; }
.clock {
  font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1;
  font-size: clamp(52px, 16.5vw, 220px);
  white-space: nowrap;
  text-shadow: 0 0 40px rgba(255,207,90,.15);
}
.cd { margin-top: 18px; }
.cd-label { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 13px; font-weight: 600; }
.cd-small { font-size: clamp(34px, 8vw, 72px); font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.ny { color: var(--muted); margin-top: 14px; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.ny b { color: var(--text); }

.ring-wrap { display: none; position: relative; width: min(78vw, 58svh, 520px); aspect-ratio: 1; margin: 6px 0 4px; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 565.49; filter: drop-shadow(0 0 calc(4px + var(--k) * 14px) var(--accent)); transition: stroke .5s; }
.big {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.05em; line-height: 1;
  font-size: calc(min(78vw, 58svh, 520px) * .46);
  color: var(--text);
  text-shadow: 0 0 calc(10px + var(--k) * 50px) var(--accent);
}
.phase-text {
  position: absolute; left: 0; right: 0; bottom: 17%; font-weight: 800; text-transform: uppercase;
  letter-spacing: .16em; font-size: clamp(12px, 2.6vw, 20px); color: var(--accent);
}

.celebrate { display: none; }
.celebrate .year {
  font-weight: 900; font-size: clamp(90px, 28vw, 300px); line-height: .95; letter-spacing: -.05em;
  background: linear-gradient(180deg, #fff 10%, var(--gold) 60%, var(--hot));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop 1.2s cubic-bezier(.2,1.6,.4,1) both;
}
.celebrate .msg { font-size: clamp(26px, 6vw, 56px); font-weight: 800; animation: pop 1.2s .2s both; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Phasen-Layout */
body:is(.phase-calm, .phase-intense, .phase-extreme) .clock { font-size: clamp(34px, 10vw, 84px); opacity: .9; }
body:is(.phase-calm, .phase-intense, .phase-extreme) .cd,
body.phase-celebrate .cd { display: none; }
body:is(.phase-calm, .phase-intense, .phase-extreme) .ring-wrap { display: block; }
body.phase-celebrate .celebrate { display: block; }
body.phase-celebrate .clock { font-size: clamp(30px, 7vw, 64px); opacity: .8; }

/* Herzschlag pro Sekunde – je Phase stärker */
.beat .big { animation: beatCalm .9s ease-out; }
body.phase-intense .beat .big { animation: beatIntense .7s cubic-bezier(.2,1.8,.4,1); }
body.phase-extreme .beat .big { animation: beatExtreme .6s cubic-bezier(.2,2,.3,1); }
body.phase-extreme .beat { animation: shake .45s; }
body.phase-extreme .beat .ring { animation: ringPulse .6s ease-out; }
@keyframes beatCalm { 0% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes beatIntense { 0% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes beatExtreme { 0% { transform: scale(1.55); filter: brightness(2); } 100% { transform: scale(1); filter: none; } }
@keyframes ringPulse { 0% { transform: rotate(-90deg) scale(1.08); } 100% { transform: rotate(-90deg) scale(1); } }
@keyframes shake {
  0%,100% { transform: translate(0,0); } 15% { transform: translate(-9px,4px) rotate(-.6deg); }
  30% { transform: translate(8px,-5px) rotate(.6deg); } 45% { transform: translate(-6px,3px); }
  60% { transform: translate(5px,-2px); } 80% { transform: translate(-2px,1px); }
}
body.phase-intense .phase-text { animation: blink .5s infinite; }
body.phase-extreme .phase-text { animation: blink .25s infinite; }
@media (prefers-reduced-motion: reduce) {
  .beat, .beat .big, .beat .ring { animation: none !important; }
}

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.ctl {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
  backdrop-filter: blur(8px);
}
.ctl:hover { border-color: var(--gold); }
.ctl.on { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.ctl svg, h2 svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctl svg path:first-child { }
#btnSound:not(.on) .wave { opacity: .25; }
body:is(.phase-calm, .phase-intense, .phase-extreme) .controls { opacity: .35; }

/* ---------- Panels ---------- */
.panels {
  max-width: 1100px; margin: 0 auto; padding: 0 16px 30px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px;
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; backdrop-filter: blur(10px); min-width: 0; }
.panel h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.field { display: block; margin: 10px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,.3); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.btn.ghost { background: none; }
.join { display: flex; gap: 8px; margin-top: 12px; }
.join input { text-transform: uppercase; letter-spacing: .2em; font-weight: 800; }
.err { color: #ff8b9c; min-height: 1em; margin: 8px 0 0; font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tog { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.tog input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }

.room-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.room-title { font-size: 20px; font-weight: 800; }
.code { font-weight: 900; letter-spacing: .2em; color: var(--gold); }
.qr { background: #fff; border-radius: 8px; padding: 4px; line-height: 0; flex: none; }
.qr svg { width: 96px; height: 96px; }
.members { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.members span { background: rgba(255,255,255,.08); border-radius: 99px; padding: 4px 10px; font-size: 13px; }
.members span.me { outline: 1px solid var(--gold); }
.reacts { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.reacts button { font-size: 24px; padding: 8px 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); cursor: pointer; color: var(--text); }
.reacts button:active { transform: scale(.92); }
.reacts button.rocket svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.msgform { display: flex; gap: 8px; margin-top: 10px; }
.feed { list-style: none; padding: 0; margin: 10px 0 0; max-height: 180px; overflow: auto; font-size: 14px; }
.feed li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.feed b { color: var(--gold); }
.host { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.host .small { width: 100%; }

.world { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.world li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.world li:hover .city { color: var(--gold); }
.world .t { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.world li.done .t { color: #3ddc84; }
.world li.next .city { font-weight: 800; color: var(--gold); }
.world li.next .t { color: var(--text); font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 8px; }
.stats div { background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.foot { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 20px 16px 34px; font-size: 13px; }
.foot a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 60;
  background: #fff; color: #111; padding: 10px 16px; border-radius: 99px; font-weight: 600; transition: .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Während des Countdowns zählt nur die Bühne */
body:is(.phase-calm, .phase-intense, .phase-extreme, .phase-celebrate) .panels,
body:is(.phase-calm, .phase-intense, .phase-extreme, .phase-celebrate) .foot { opacity: .25; }
body.fs header.top { opacity: .35; }
