:root {
  --bg: #070b14;
  --card: #0f1729;
  --card-2: #152038;
  --line: #213050;
  --text: #e8eefc;
  --muted: #8d9bb9;
  --accent: #4f8cff;
  --accent-2: #8ab8ff;
  --glow: rgba(79, 140, 255, .35);
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --c0: #f87171;
  --c1: #60a5fa;
  --c2: #fbbf24;
  --c3: #34d399;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 50% -12%, rgba(79, 140, 255, .24), transparent 70%),
    radial-gradient(700px 420px at 100% 100%, rgba(79, 140, 255, .09), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.screen { display: none; }
.screen.active { display: flex; animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.logo i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px 4px var(--glow); }
.pill { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(15, 23, 41, .7); color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pill b { color: var(--accent-2); }

.card { background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }

.btn {
  appearance: none; border: 0; cursor: pointer; padding: 14px 28px; border-radius: 14px; font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(180deg, #5f9bff, #3b78ee); color: #fff;
  box-shadow: 0 8px 26px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 34px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); box-shadow: none; }

/* ------------------------------------------------------------ Host */
.host-wrap { min-height: 100vh; display: flex; flex-direction: column; padding: 22px clamp(18px, 4vw, 56px) 28px; gap: 18px; }
.host-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.host-wrap .screen { flex: 1; flex-direction: column; gap: 20px; }

/* Lobby */
.lobby-grid { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 24px; flex: 1; }
.join-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.join-card .label { color: var(--muted); font-size: .95rem; }
.join-url { font-weight: 700; color: var(--accent-2); word-break: break-all; }
.pin { font-size: clamp(3rem, 7vw, 5.4rem); font-weight: 900; letter-spacing: .12em; padding-left: .12em; color: #fff; text-shadow: 0 0 30px var(--glow), 0 0 60px var(--glow); font-variant-numeric: tabular-nums; line-height: 1; }
.qr { width: min(260px, 100%); background: #fff; border-radius: 16px; padding: 10px; box-shadow: 0 0 0 4px rgba(79, 140, 255, .35), 0 10px 40px var(--glow); }
.qr svg { display: block; width: 100%; height: auto; }

.players-card { display: flex; flex-direction: column; gap: 16px; }
.players-head { display: flex; justify-content: space-between; align-items: center; }
.players-head h2 { font-size: 1.3rem; }
.players { display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; flex: 1; }
.empty { color: var(--muted); margin: auto; text-align: center; font-size: 1.1rem; }
.chip { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); animation: pop .4s cubic-bezier(.2, 1.4, .4, 1) both; }
.chip .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(79, 140, 255, .18); font-size: 1.4rem; }
.chip .nm { font-weight: 700; }
.chip.off { opacity: .45; }
.chip .kick { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-weight: 800; line-height: 1; cursor: pointer; display: none; }
.chip:hover .kick { display: block; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.lobby-actions { display: flex; justify-content: flex-end; }
.lobby-actions .btn { font-size: 1.25rem; padding: 16px 44px; }

/* Frage */
.q-top { display: flex; align-items: center; gap: 20px; }
.timer-wrap { flex: 1; height: 12px; border-radius: 99px; background: var(--card-2); overflow: hidden; border: 1px solid var(--line); }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; box-shadow: 0 0 16px var(--glow); }
.timer.low .timer-fill { background: linear-gradient(90deg, #f87171, #fbbf24); box-shadow: 0 0 16px rgba(248, 113, 113, .5); }
.time-left { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 900; background: var(--card); border: 3px solid var(--accent); box-shadow: 0 0 24px var(--glow); font-variant-numeric: tabular-nums; }
.timer.low .time-left { border-color: var(--bad); box-shadow: 0 0 24px rgba(248, 113, 113, .5); }
.q-text { font-size: clamp(1.6rem, 3.4vw, 3rem); font-weight: 800; text-align: center; line-height: 1.25; padding: 28px 24px; margin: auto 0; max-width: 1200px; align-self: center; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.opts.n2 { grid-template-columns: 1fr 1fr; }
.opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-size: clamp(1.05rem, 1.9vw, 1.55rem); font-weight: 600; min-height: 92px; }
.opt::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--c); }
.opt .shape { flex: none; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; color: #0a1020; background: var(--c); }
.opt .txt { flex: 1; }
.opt .cnt { font-size: 1.8rem; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.opt .bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--c); width: 0; transition: width 1s cubic-bezier(.2, .8, .2, 1); opacity: .9; }
.opt.correct { border-color: var(--good); box-shadow: 0 0 0 2px var(--good), 0 0 34px rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .1); }
.opt.correct .cnt { color: var(--good); }
.opt.wrong { opacity: .42; }
.foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.foot b { color: var(--text); font-size: 1.2rem; }
.foot-btns { display: flex; gap: 12px; }

/* Reveal */
.reveal-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; flex: 1; align-items: start; }
.reveal-grid .opts { grid-template-columns: 1fr; }
.reveal-q { font-size: clamp(1.2rem, 2.2vw, 1.8rem); font-weight: 700; margin-bottom: 16px; }
.explain { margin-top: 16px; padding: 16px 20px; border-left: 4px solid var(--accent); background: rgba(79, 140, 255, .1); border-radius: 0 12px 12px 0; color: var(--accent-2); font-size: 1.1rem; }
.lb h2, .rest h2 { font-size: 1.2rem; margin-bottom: 14px; }
.lb-list { display: flex; flex-direction: column; gap: 10px; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; animation: slideIn .5s both; animation-delay: calc(var(--i) * 80ms); }
.lb-row .rk { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; background: var(--card-2); color: var(--accent-2); }
.lb-row:first-child { border-color: var(--accent); box-shadow: 0 0 24px var(--glow); }
.lb-row:first-child .rk { background: var(--accent); color: #fff; }
.lb-row .av { font-size: 1.6rem; }
.lb-row .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent-2); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* Finale */
#s-final { position: relative; align-items: center; }
.final-title { text-align: center; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 900; }
.final-title span { color: var(--accent-2); text-shadow: 0 0 30px var(--glow); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(10px, 2vw, 24px); min-height: 440px; width: 100%; max-width: 960px; }
.pod { flex: 1; max-width: 280px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.pod .who { text-align: center; padding: 0 6px 14px; opacity: 0; transform: translateY(24px) scale(.9); animation: whoIn .7s cubic-bezier(.2, 1.3, .4, 1) forwards; animation-delay: calc(var(--d) + .7s); max-width: 100%; }
.pod .who .av { font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.1; filter: drop-shadow(0 6px 18px var(--glow)); }
.pod .who .nm { font-weight: 800; font-size: clamp(1.1rem, 2.2vw, 1.7rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .who .sc { color: var(--accent-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.pod .block { width: 100%; height: 0; border-radius: 16px 16px 0 0; display: flex; justify-content: center; padding-top: 14px; font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 900; color: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-bottom: 0; animation: rise 1.1s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: var(--d); }
.pod.p1 .block { --h: 280px; background: linear-gradient(180deg, #5f9bff, #1f4fb8); box-shadow: 0 0 60px var(--glow); border-color: var(--accent-2); }
.pod.p2 .block { --h: 205px; background: linear-gradient(180deg, #3a5fa3, #17284a); }
.pod.p3 .block { --h: 150px; background: linear-gradient(180deg, #2a4170, #101b33); }
@keyframes rise { to { height: var(--h); } }
@keyframes whoIn { to { opacity: 1; transform: none; } }
.rest { width: 100%; max-width: 640px; }
.rest .lb-row { animation-delay: calc(3.4s + var(--i) * 60ms); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; }

/* ------------------------------------------------------------ Spieler */
.p-wrap { min-height: 100svh; display: flex; flex-direction: column; padding: 18px 16px 24px; max-width: 560px; margin: 0 auto; }
.p-wrap .screen { flex: 1; flex-direction: column; gap: 16px; }
.p-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.center { align-items: center; justify-content: center; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 1.9rem; font-weight: 900; }
.sub { color: var(--muted); }
.field { width: 100%; padding: 16px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 1.15rem; outline: none; transition: border-color .2s, box-shadow .2s; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 140, 255, .2); }
.field.pin-in { text-align: center; font-weight: 800; letter-spacing: .3em; font-size: 1.5rem; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatars button { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 1.6rem; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.avatars button:hover { transform: scale(1.08); }
.avatars button.sel { border-color: var(--accent); background: rgba(79, 140, 255, .2); box-shadow: 0 0 20px var(--glow); transform: scale(1.08); }
.err { color: var(--bad); min-height: 1.3em; font-weight: 600; text-align: center; }
.me-av { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 4rem; background: rgba(79, 140, 255, .15); border: 2px solid var(--accent); box-shadow: 0 0 40px var(--glow); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 70px var(--glow); } }
.dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.p-timer { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.p-timer .timer-fill { transition: none; }
.p-qnum { display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; }
.p-qtext { font-size: 1.15rem; font-weight: 700; text-align: center; line-height: 1.35; padding: 6px 4px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; }
.answers.n2 { grid-template-columns: 1fr; }
.ans { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px; min-height: 130px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); text-align: center; cursor: pointer; font-weight: 700; font-size: .98rem; line-height: 1.25; overflow: hidden; transition: transform .12s, border-color .15s; }
.ans::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.ans .shape { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: var(--c); color: #0a1020; }
.ans:active { transform: scale(.96); border-color: var(--c); }
.ans.chosen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 26px var(--glow); }
.ans.dim { opacity: .35; pointer-events: none; }

.res-icon { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 3.6rem; font-weight: 900; }
.res-icon.ok { background: rgba(52, 211, 153, .15); color: var(--good); border: 3px solid var(--good); box-shadow: 0 0 50px rgba(52, 211, 153, .35); }
.res-icon.no { background: rgba(248, 113, 113, .12); color: var(--bad); border: 3px solid var(--bad); box-shadow: 0 0 50px rgba(248, 113, 113, .3); }
.points { font-size: 2.6rem; font-weight: 900; color: var(--accent-2); text-shadow: 0 0 24px var(--glow); }
.rank-box { display: flex; gap: 12px; width: 100%; }
.rank-box > div { flex: 1; padding: 14px 8px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.rank-box small { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 4px; }
.rank-box b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.mini-podium { width: 100%; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 900px) {
  .lobby-grid, .reveal-grid { grid-template-columns: 1fr; }
  .opts { grid-template-columns: 1fr; }
  .time-left { width: 60px; height: 60px; font-size: 1.5rem; }
  .podium { min-height: 380px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-delay: 0ms !important; transition: none !important; }
}
