:root {
  --bg: #101233;
  --bg2: #171a45;
  --panel: rgba(255, 255, 255, .06);
  --panel2: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .14);
  --ink: #f4f2ff;
  --muted: #a9a6d2;
  --gold: #ffd23f;
  --pink: #ff5d8f;
  --coral: #f4511e;
  --blue: #1e88e5;
  --green: #43d17c;
  --red: #ff4d5e;
  --app-height: 100vh;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: var(--app-height);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(255, 93, 143, .22), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(30, 136, 229, .20), transparent 55%),
    linear-gradient(165deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  overscroll-behavior: none;
}
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.hidden { display: none !important; }

.shell { min-height: var(--app-height); display: flex; flex-direction: column; }
.shell.is-room { background: rgba(8, 10, 30, .55); }
.top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: .98rem; }
.brand .brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6d28d9, var(--pink)); font-size: .78rem;
}
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-tools .small { color: var(--muted); font-size: .8rem; }
.audio-toggle, .fullscreen-toggle { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 7px 12px; font-size: .82rem; }
.screen-slot { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 24px; }
.footer { color: var(--muted); font-size: .78rem; text-align: center; padding: 10px 16px 26px; }
.footer a { color: var(--pink); text-decoration: none; }

.hero { text-align: center; max-width: 620px; margin: auto; padding: 24px 0; width: 100%; }
.hero h1 { font-size: clamp(2.4rem, 9vw, 4rem); margin: 10px 0 6px; letter-spacing: .01em;
  background: linear-gradient(120deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.round-badge {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #ffd9a8; background: rgba(255, 93, 143, .18); border: 1px solid rgba(255, 93, 143, .45);
  padding: 5px 12px; border-radius: 999px; margin: 0;
}
.claim { color: var(--muted); font-size: 1rem; line-height: 1.5; margin: 14px auto 22px; max-width: 460px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; max-width: 640px; margin: auto; width: 100%;
}
.card h2 { margin: 0 0 6px; font-size: 1.35rem; }
.card h3 { margin: 18px 0 6px; font-size: 1.02rem; color: var(--gold); }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 4px 0 14px; }
.error { color: #ffb3bc; font-size: .88rem; margin: 6px 0; }
.public-note { color: #c9ffd9; font-size: .88rem; margin: 6px 0; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: .76rem; margin-top: 5px; }
.fields { display: flex; flex-direction: column; gap: 2px; }
.fieldset { display: flex; gap: 10px; flex-wrap: wrap; }
.fieldset .field { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.actions.full > .button { flex: 1; }
.compact-actions { margin-top: 4px; }

.rules-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 10px; }
.rule-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.rule-block h3 { margin: 0 0 4px; font-size: 1rem; color: var(--gold); }
.rule-block p { margin: 6px 0 0; line-height: 1.55; font-size: .93rem; }

.button {
  display: inline-block; border: 1px solid var(--line); background: var(--panel2);
  color: var(--ink); border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: .95rem;
  text-align: center; text-decoration: none; transition: transform .12s, filter .15s;
}
.button:hover:not(:disabled) { filter: brightness(1.12); }
.button:active:not(:disabled) { transform: scale(.98); }
.button.primary { background: linear-gradient(135deg, #6d28d9, #9b4dff); border-color: transparent; }
.button.coral { background: linear-gradient(135deg, var(--coral), #ff7043); border-color: transparent; }
.button.gold { background: linear-gradient(135deg, #d9a400, var(--gold)); color: #3a2c00; border-color: transparent; }
.button.warn { background: linear-gradient(135deg, #b91c1c, #ef4444); border-color: transparent; }
.button.ghost { background: transparent; }
.button.slim { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }
.button.full { width: 100%; }
.button.on { background: linear-gradient(135deg, #0e7a3e, #2ecc71); border-color: transparent; }

.room-screen { display: flex; flex-direction: column; gap: 12px; max-width: 980px; margin: 0 auto; width: 100%; }
.room-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.room-code { font-weight: 900; letter-spacing: .08em; color: var(--gold); font-size: 1.05rem; }
.room-code .display { color: var(--pink); }
.room-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voice-toggle { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.voice-toggle .voice-hint { font-size: .62rem; line-height: 1.2; color: var(--muted); }
.device-pill { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; }
.device-pill.host { color: var(--gold); border-color: rgba(255, 210, 63, .5); }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-score { border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); }
.team-score.blue { background: rgba(30, 136, 229, .22); }
.team-score.coral { background: rgba(244, 81, 30, .24); }
.team-score .name { font-weight: 800; }
.team-score .value { font-size: 1.5rem; font-weight: 900; color: var(--gold); }

.panel-shell { display: flex; flex-direction: column; gap: 12px; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.panel-actions .button { flex: 1; min-width: 150px; }
.room-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.room-nav .button.room-tab { flex: 1; min-width: 130px; }
.room-nav .button.room-tab.active { background: linear-gradient(135deg, #6d28d9, #9b4dff); border-color: transparent; }

.waiting-strip { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: .88rem; color: var(--muted); }
.waiting-strip.pending { color: var(--gold); }
.online-dot { width: 10px; height: 10px; border-radius: 50%; background: #666; flex: none; }
.online-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(67, 209, 124, .8); }

/* ---------- Quizbühne ---------- */
.show-stage {
  background:
    radial-gradient(900px 500px at 50% -20%, rgba(109, 40, 217, .35), transparent 60%),
    linear-gradient(180deg, #0d1030, #1a1e4d);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.question-text { text-align: center; line-height: 1.35; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.question-text .q-meta { font-size: .8rem; font-weight: 600; color: var(--muted); }
.question-text .q-main { font-size: clamp(1.5rem, 4.4vw, 2.5rem); font-weight: 900; }
.question-text .q-main::before { content: '❓ '; }
.category-tag { text-align: center; }
.board { display: flex; flex-direction: column; gap: 10px; }
.team-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-strip .team-head { border-radius: 14px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); }
.team-strip .team-head.is-active { border-color: rgba(255, 210, 63, .9); }
.tile {
  min-height: 74px; border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--panel); position: relative;
}
.tile.blue { background: linear-gradient(135deg, rgba(30, 136, 229, .35), rgba(30, 136, 229, .12)); }
.tile.coral { background: linear-gradient(135deg, rgba(244, 81, 30, .38), rgba(244, 81, 30, .12)); }
.tile.revealed { background: linear-gradient(135deg, #d9a400, var(--gold)); color: #3a2c00; border-color: transparent; }
.tile .rank { font-weight: 900; font-size: 1.05rem; opacity: .75; min-width: 26px; text-align: center; }
.tile .text { font-weight: 800; font-size: clamp(.95rem, 2.6vw, 1.2rem); flex: 1; }
.tile .points { font-weight: 900; font-size: 1.1rem; }
.tile.covered { opacity: .6; }
.tile.covered .rank, .tile.covered .points { opacity: .7; }
.tile.covered .text { color: var(--muted); font-weight: 600; }
.tile.covered:hover { opacity: .85; }
.tile.tappable { cursor: pointer; }
.tile.tappable:hover { filter: brightness(1.15); }
.tile.winner { box-shadow: 0 0 0 3px rgba(67, 209, 124, .9); }
.strike-x {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255, 77, 94, .16); border: 1px dashed rgba(255, 77, 94, .55);
  color: var(--red); font-weight: 900; font-size: 1rem;
}
.strike-x.filled { background: linear-gradient(135deg, #b91c1c, #ef4444); border-color: transparent; color: #fff; }
.team-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.team-head .name { font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-head .base { font-weight: 900; color: var(--gold); font-size: 1.1rem; flex: none; }
.head-strikes { display: flex; gap: 4px; flex: none; }
.strike-x.small { width: 22px; height: 22px; border-radius: 6px; font-size: .72rem; }

.turn-banner {
  text-align: center; font-weight: 900; font-size: clamp(1.1rem, 4vw, 1.5rem);
  border-radius: 14px; padding: 10px 14px; color: #fff;
}
.turn-banner.blue { background: linear-gradient(135deg, #0d5cb6, #1e88e5); }
.turn-banner.coral { background: linear-gradient(135deg, #c63d12, #f4511e); }
.turn-banner { animation: turnPulse 1.6s ease-in-out infinite; }
@keyframes turnPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, .14); } }

.round-meta { text-align: center; color: var(--muted); font-size: .88rem; }

.buzzer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.buzzer-btn { padding: 30px 12px; font-size: 1.15rem; border-radius: 16px; font-weight: 900; color: #fff; border: none; }
.buzzer-btn.blue { background: linear-gradient(135deg, #0d5cb6, #1e88e5); }
.buzzer-btn.coral { background: linear-gradient(135deg, #c63d12, #f4511e); }
.buzzer-btn:active { transform: scale(.96); }

.display-share { display: grid; gap: 10px; }
.display-share h3 { margin: 0; }
.display-share-row { display: flex; gap: 14px; align-items: flex-start; }
.display-share-actions { flex: 1; min-width: 0; }
.display-share .qr { width: min(150px, 34vw); height: auto; aspect-ratio: 1; border-radius: 12px; background: #fff; padding: 8px; }
.share-status { min-height: 1.25em; margin: 6px 0 0; color: var(--gold); font-size: .84rem; }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
@media (max-width: 560px) {
  .display-share-row { flex-direction: column; align-items: center; text-align: center; }
  .display-share-actions { width: 100%; }
  .display-share-actions .guess-row { flex-wrap: wrap; justify-content: center; }
}
.steal-box { text-align: center; padding: 10px 0; }
.steal-box h3 { color: var(--pink); margin: 0 0 8px; }

.result-summary { text-align: center; }
.result-summary h3 { margin: 0 0 6px; color: var(--gold); }
.result-summary .big { font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 900; margin: 4px 0; }
.team-pill { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 800; }
.team-pill.blue { background: rgba(30, 136, 229, .3); }
.team-pill.coral { background: rgba(244, 81, 30, .35); }

/* ---------- Finalrunde ---------- */
.final-stage { text-align: center; }
.final-player { font-size: clamp(1.2rem, 4vw, 1.8rem); font-weight: 900; color: var(--gold); }
.timer {
  font-size: clamp(2.4rem, 10vw, 4rem); font-weight: 900; font-variant-numeric: tabular-nums;
  color: var(--gold); line-height: 1;
}
.timer.timer-final { color: var(--pink); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.final-answers { display: flex; flex-direction: column; gap: 8px; margin: 10px auto; max-width: 520px; }
.final-answer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.final-answer.hit { background: linear-gradient(135deg, #0e7a3e, #2ecc71); border-color: transparent; }
.final-answer.covered { opacity: .6; cursor: pointer; }
.final-answer.covered .text { color: var(--muted); }
.final-answer.covered:hover { opacity: .85; }
.final-answer .text { font-weight: 800; }
.member-select { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.member-chip { border-radius: 999px; padding: 8px 14px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; }
.member-chip.selected { background: linear-gradient(135deg, #6d28d9, #9b4dff); border-color: transparent; }
.final-target { color: var(--muted); font-size: .88rem; }

/* ---------- Ansagen ---------- */
.announce-bar { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.announce-bar h3 { color: var(--gold); }
.announce-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.announce-buttons .button { font-size: .8rem; padding: 8px 12px; flex: 0 0 auto; }
.announce-current { background: rgba(255, 210, 63, .1); border: 1px solid rgba(255, 210, 63, .4); border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.announce-current .speaking { color: var(--gold); font-weight: 800; }

/* ---------- Display-Ansicht ---------- */
body.display-view { background: radial-gradient(1200px 800px at 50% -20%, rgba(109, 40, 217, .5), transparent 60%), linear-gradient(165deg, #0d1030, #1a1e4d); }
.display-stage { display: flex; flex-direction: column; gap: 18px; max-width: 1200px; margin: 0 auto; width: 100%; padding: 10px 4px; }
.display-head { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.display-title { font-size: clamp(1.5rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: .02em; }
.display-title.is-active { color: var(--gold); text-shadow: 0 0 24px rgba(255, 210, 63, .65); }
.display-title.gold { background: linear-gradient(120deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.display-board { display: grid; gap: 14px; flex: 1; min-height: 0; align-content: stretch; }
.display-board .display-team-strip { grid-column: 1 / -1; }
.display-team-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.display-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 900; font-size: clamp(1.1rem, 3vw, 1.7rem); padding: 6px 10px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
}
.display-col-head.is-active { animation: displayColGlow 1.6s ease-in-out infinite; }
.display-col-head .base { color: var(--gold); }
@keyframes displayColGlow {
  50% { box-shadow: 0 0 0 3px rgba(255, 210, 63, .8), 0 0 30px rgba(255, 210, 63, .5); }
}
.display-tile { min-height: clamp(46px, 8.5vh, 120px); border-radius: 18px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border: 1px solid var(--line); font-weight: 900; font-size: clamp(1.1rem, 3.4vw, 2rem); }
.display-tile.blue { background: linear-gradient(135deg, rgba(30, 136, 229, .4), rgba(30, 136, 229, .12)); }
.display-tile.coral { background: linear-gradient(135deg, rgba(244, 81, 30, .45), rgba(244, 81, 30, .14)); }
.display-tile.revealed { background: linear-gradient(135deg, #d9a400, var(--gold)); color: #3a2c00; border-color: transparent; }
.display-tile.covered { opacity: .55; color: var(--muted); }
.tile.pop .text, .display-tile.pop .text { animation: reveal-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.35s backwards; }
@keyframes reveal-pop { from { opacity: 0; transform: scale(0.55); } to { opacity: 1; transform: scale(1); } }
.display-tile .rank { opacity: .7; min-width: 30px; text-align: center; }
.display-tile .pts { opacity: .85; }
.display-status { text-align: center; color: var(--muted); font-size: clamp(1rem, 2.6vw, 1.4rem); font-weight: 700; }
.display-question {
  font-size: clamp(1.6rem, 5.5vw, 3.2rem); font-weight: 900; text-align: center; line-height: 1.35;
  color: var(--gold); text-shadow: 0 0 22px rgba(255, 210, 63, .45); margin-top: 6px;
}
.display-score { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.display-team { border-radius: 16px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; font-weight: 900; font-size: clamp(1.1rem, 3vw, 1.6rem); }
.display-team.blue { background: rgba(30, 136, 229, .3); }
.display-team.coral { background: rgba(244, 81, 30, .35); }
.display-team.is-active { animation: displayColGlow 1.6s ease-in-out infinite; }
.display-team .val { color: var(--gold); }
.display-buzzer { display: grid; place-items: center; flex: 1; min-height: 0; padding: 20px 0 40px; }
.display-buzzer-img { width: clamp(160px, 34vw, 380px); height: auto; animation: buzzerPulse 1.4s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(255, 80, 40, .35)); }
@keyframes buzzerPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.display-announce {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: linear-gradient(135deg, #6d28d9, #9b4dff); border-radius: 999px;
  padding: 14px 26px; font-weight: 800; font-size: clamp(1rem, 2.6vw, 1.4rem);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45); text-align: center; max-width: 90vw;
}
.display-wait { text-align: center; padding: 40px 0; }
.display-wait .code { font-size: clamp(3rem, 12vw, 6rem); font-weight: 900; color: var(--gold); letter-spacing: .12em; }
.display-wait .small { color: var(--muted); }

.display-result { display: grid; gap: 22px; place-items: center; padding: 14px 0; text-align: center; }
.result-title { font-size: clamp(1.8rem, 6vw, 3.4rem); font-weight: 900; color: var(--gold); text-shadow: 0 0 26px rgba(255, 210, 63, .5); }
.result-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 760px; }
.result-team { border-radius: 20px; padding: 20px 16px; background: var(--panel); border: 2px solid var(--line); display: grid; gap: 8px; place-items: center; }
.result-team.blue { background: linear-gradient(160deg, rgba(30, 136, 229, .35), rgba(30, 136, 229, .1)); }
.result-team.coral { background: linear-gradient(160deg, rgba(244, 81, 30, .4), rgba(244, 81, 30, .12)); }
.result-team.winner { border-color: rgba(255, 210, 63, .95); box-shadow: 0 0 34px rgba(255, 210, 63, .35); }
.result-team-name { font-weight: 900; font-size: clamp(1.2rem, 3.4vw, 1.9rem); }
.result-score { font-weight: 900; font-size: clamp(2rem, 7vw, 3.4rem); color: var(--gold); line-height: 1.1; }
.result-members { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.result-member { background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: clamp(.95rem, 2.4vw, 1.3rem); }
.result-final { color: var(--muted); font-weight: 700; }
.result-thanks { color: var(--muted); font-size: clamp(.95rem, 2.4vw, 1.25rem); }

@media (max-width: 600px) {
  .shell { height: var(--app-height); overflow: hidden; }
  .screen-slot { overflow-y: auto; min-height: 0; padding: 6px 10px 20px; -webkit-overflow-scrolling: touch; }
  .card { padding: 16px; }
  .board { gap: 8px; }
  .tile { min-height: 62px; padding: 10px; }
  .buzzer-btn { padding: 24px 8px; font-size: 1rem; }
}

/* Display-Gerät (TV / Notebook am Beamer): volle Fläche ohne Seitenleiste, alles auf einem Bildschirm */
@media (min-width: 901px) {
  .shell.is-display .top, .shell.is-display .footer { display: none; }
  .shell.is-display .screen-slot { height: var(--app-height); overflow: hidden; display: flex; padding: 12px 3vw; }
  .shell.is-display .display-stage { flex: 1; min-height: 0; max-width: none; padding: 0; }
}
