/* style.css — Quiznacht-Design v2 (companion/design-neu/Quiznacht.dc.html)
   Komplett-Port: dunkles Nacht-Blau (--ink), Brand #2E8BFF, Display-Font
   Bricolage Grotesque, UI-Font Space Grotesk (beide self-hosted, latin).
   Mobile-first (390px-Mockup), max-width 520px zentriert, Tap-Flaechen ≥56px. */

/* ---------- Fonts (self-hosted, offline via SW) ---------- */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800; /* variable Font — genutzt: 600/700/800 */
  font-display: swap;
  src: url('fonts/bricolage-grotesque-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700; /* variable Font — genutzt: 400/500/700 */
  font-display: swap;
  src: url('fonts/space-grotesk-latin.woff2') format('woff2');
}

:root {
  --ink: #070A12;
  --ink-2: #04060C;
  --surface: #0E1524;
  --surface-2: #152033;
  --surface-3: #1D2C46;
  --line: #233450;
  --line-soft: #15223A;
  --text: #EAF1FF;
  --text-dim: #8CA0C4;
  --text-mute: #5F7396;
  --brand: #2E8BFF;
  --brand-2: #5FC6FF;
  --ok: #35E08A;
  --wrong: #FF4D67;
  --warn: #FFC24B;
  --gold: #FFD24A;
  --drink: #FF8A3D;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --pill: 999px;
  --disp: 'Bricolage Grotesque', system-ui, sans-serif;
  --ui: 'Space Grotesk', system-ui, sans-serif;
  --tap: 56px;
  --btn-shadow: 0 3px 0 #1A5AC0, 0 6px 14px -7px rgba(0, 0, 0, .5);
}

/* ---------- Keyframes (aus dem Designsystem, qn-*) ---------- */
@keyframes qn-countdown { from { stroke-dashoffset: 0 } to { stroke-dashoffset: 157 } }
@keyframes qn-ready {
  0%, 100% { box-shadow: 0 12px 30px -10px rgba(46, 139, 255, .55); }
  50%      { box-shadow: 0 16px 44px -8px rgba(46, 139, 255, .95); }
}
@keyframes qn-spin { to { transform: rotate(360deg) } }
@keyframes qn-pop { 0% { transform: scale(.7); opacity: 0 } 60% { transform: scale(1.06) } 100% { transform: scale(1); opacity: 1 } }
@keyframes qn-pulse { 0%, 100% { opacity: .4; transform: scale(1) } 50% { opacity: 1; transform: scale(1.25) } }
@keyframes qn-bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
@keyframes qn-wave { 0%, 100% { transform: scaleY(.35) } 50% { transform: scaleY(1) } }
@keyframes qn-shimmer { 0% { background-position: -200% 0 } 100% { background-position: 200% 0 } }
@keyframes qn-blink { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }
@keyframes qn-ring-pulse { 0%, 100% { opacity: .25; transform: scale(1) } 50% { opacity: .7; transform: scale(1.12) } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

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

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(1100px 720px at 50% -6%, rgba(38, 96, 200, .34), transparent 62%),
    radial-gradient(760px 520px at 96% 112%, rgba(120, 54, 180, .14), transparent 60%),
    var(--ink);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 48px) 16px calc(env(safe-area-inset-bottom) + 24px);
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--disp); letter-spacing: -.02em; }
h1 { font-size: 2.15rem; font-weight: 800; margin: 0.2em 0; }
h2 { font-size: 1.45rem; font-weight: 800; margin: 0.2em 0; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.6em; color: var(--text); }

/* ---------- Verbindungsleiste (Design 06c: online / verbindet / getrennt) ---------- */
.connbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; gap: 9px;
  padding: calc(env(safe-area-inset-top) + 8px) 18px 8px;
  font-size: 0.8rem; font-weight: 700;
  background: rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.connbar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--wrong); box-shadow: 0 0 10px currentColor; color: var(--wrong); flex: none; }
.connbar[data-state="online"] { background: rgba(53, 224, 138, 0.08); border-bottom-color: rgba(53, 224, 138, 0.25); color: var(--ok); }
.connbar[data-state="online"] .dot { background: var(--ok); color: var(--ok); }
.connbar[data-state="connecting"] { background: rgba(255, 194, 75, 0.08); border-bottom-color: rgba(255, 194, 75, 0.3); color: var(--warn); }
.connbar[data-state="connecting"] .dot { background: var(--warn); color: var(--warn); animation: qn-blink 1s infinite; }
.connbar[data-state="offline"] { background: rgba(255, 77, 103, 0.1); border-bottom-color: rgba(255, 77, 103, 0.3); color: var(--wrong); }
.connbar[data-state="offline"] .dot { background: var(--wrong); color: var(--wrong); }
.connbar .conn-room { color: var(--text-dim); font-weight: 500; }

/* ---------- Screens ---------- */
.screen { display: none; }
.screen.active { display: block; animation: fadein 0.25s ease; }

.hero { text-align: center; margin: 14px 0 22px; }
.hero .logo {
  width: 66px; height: 66px; border-radius: 20px; margin: 0 auto 14px;
  background: conic-gradient(from 210deg, var(--brand), #1E5FE0 40%, var(--brand-2) 75%, var(--brand));
  box-shadow: 0 10px 26px -10px rgba(46, 139, 255, .5);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
}
.hero .logo::after {
  content: ""; position: absolute; inset: 0; border-radius: 20px;
  background: radial-gradient(20px 20px at 68% 32%, rgba(255, 255, 255, .9), transparent 60%);
}
.subtitle { color: var(--text-dim); margin-top: 6px; font-size: 0.95rem; }
.center-hint { text-align: center; margin: 10px 0 0; color: var(--text-mute); font-size: 0.8rem; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}
.card.center { text-align: center; border-radius: var(--r-lg); padding: 22px; }

.field-label {
  display: block; font-size: 0.68rem; font-weight: 700; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.12em; margin: 8px 0;
}

.text-input {
  width: 100%; height: var(--tap);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--ui);
  font-size: 1.05rem; font-weight: 700;
  padding: 0 16px;
  margin-bottom: 12px;
}
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(46, 139, 255, 0.14); }
select.text-input { appearance: none; -webkit-appearance: none; }
.code-input {
  font-family: var(--disp);
  text-transform: uppercase; letter-spacing: 0.32em; text-align: center;
  font-weight: 700; font-size: 1.4rem;
}
.code-input::placeholder { color: var(--text-mute); }

/* ---------- Avatar-Picker (Design: Emoji auf farbigem Radial-Tint) ---------- */
.avatar-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.avatar-opt {
  aspect-ratio: 1; font-size: 1.5rem;
  background: radial-gradient(circle at 50% 34%, rgba(140, 160, 196, .22), rgba(140, 160, 196, .07));
  border: none; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.avatar-opt.selected {
  box-shadow: 0 0 0 2.5px var(--brand), 0 0 0 6px rgba(46, 139, 255, .18);
  transform: scale(1.04);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: none; border-radius: 16px;
  font-family: var(--ui);
  font-size: 1.02rem; font-weight: 700;
  color: var(--text); background: var(--surface-2);
  cursor: pointer; user-select: none;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-lg { width: 100%; font-size: 1.08rem; min-height: 58px; margin-top: 8px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--btn-shadow); }
.btn-accent {
  background: linear-gradient(160deg, var(--brand-2), var(--brand));
  color: #04122B;
  box-shadow: var(--btn-shadow);
}
.btn-danger { background: var(--wrong); color: #fff; box-shadow: 0 3px 0 #B62742, 0 6px 14px -7px rgba(0, 0, 0, .5); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }

.btn-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.btn-row .btn { flex: 1; }

.hint { color: var(--text-dim); font-size: 0.85rem; }
.error-text { color: var(--wrong); font-weight: 700; text-align: center; }
.notice {
  background: rgba(255, 194, 75, 0.12); border: 1px solid rgba(255, 194, 75, .4);
  color: var(--warn); padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 0.82rem; font-weight: 500; margin-top: 10px;
}

/* ---------- Host (2-Schritte-Flow) ---------- */
.card-title { margin: 0 0 4px; }
.step-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px;
  font-family: var(--disp); font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em;
}
.card.center .step-title { justify-content: center; }
.step-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  font-family: var(--disp); font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 0 14px -3px rgba(46, 139, 255, .7);
}
.room-code-big { font-size: 2.6rem; margin: 2px 0 6px; }
.player-inline { margin-top: 16px; text-align: left; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 10px 12px; }
.player-inline h3 {
  margin: 0 0 6px; font-family: var(--ui); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute);
}
details.adv summary { cursor: pointer; color: var(--text-dim); font-weight: 700; font-size: 0.9rem; }
details.adv summary strong { color: var(--brand-2); }
details.adv[open] summary { margin-bottom: 12px; }

/* "Zum Spiel" pulsiert, sobald das Video erkannt ist -> naechster Schritt klar */
.btn.ready { animation: qn-ready 2s ease-in-out infinite; }

.code-badge {
  font-family: var(--disp); color: var(--brand-2); letter-spacing: 0.14em;
  font-weight: 800; text-shadow: 0 0 30px rgba(46, 139, 255, .5);
}
.qr-box { display: flex; justify-content: center; margin: 12px auto; }
.qr-box img, .qr-box canvas {
  width: 200px; height: 200px; image-rendering: pixelated;
  border-radius: 16px; background: #fff; padding: 12px;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
}

/* ---------- Sync-Karte, Schritt-2-Zustaende (Design 2b/2c/2d) ---------- */
.sync-card { border-color: var(--line-soft); border-radius: var(--r-lg); }
.sync-card[data-state="synced"] { border-color: rgba(53, 224, 138, .35); background: linear-gradient(180deg, rgba(53, 224, 138, .08), var(--surface)); }
.sync-card[data-state="searching"] { border-color: rgba(255, 194, 75, .3); }
.sync-card[data-state="coasting"] { border-color: rgba(255, 194, 75, .3); background: linear-gradient(180deg, rgba(255, 77, 103, .06), var(--surface)); }

.sync-stage { text-align: center; padding: 14px 4px 4px; }
.stage-visual {
  position: relative; width: 116px; height: 116px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
}
.stage-ring {
  position: absolute; border-radius: 50%; border: 2px solid var(--warn);
  opacity: 0; pointer-events: none;
}
.stage-ring.r1 { inset: 0; }
.stage-ring.r2 { inset: 15px; }
.stage-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.stage-icon::after { content: "🎧"; }
.sync-card[data-state="searching"] .stage-icon {
  background: rgba(255, 194, 75, .14); border-color: var(--warn);
}
.sync-card[data-state="searching"] .stage-icon::after { content: "👂"; }
.sync-card[data-state="searching"] .stage-ring { animation: qn-ring-pulse 2.4s ease-in-out infinite; }
.sync-card[data-state="searching"] .stage-ring.r2 { animation-delay: .3s; }
.sync-card[data-state="synced"] .stage-icon {
  background: rgba(53, 224, 138, .16); border: 2px solid var(--ok);
  box-shadow: 0 0 40px -6px rgba(53, 224, 138, .6);
  animation: qn-pop .5s ease-out;
  color: var(--ok); font-weight: 800;
}
.sync-card[data-state="synced"] .stage-icon::after { content: "✓"; }
.sync-card[data-state="coasting"] .stage-icon {
  background: rgba(255, 77, 103, .14); border: 2px solid var(--wrong);
}
.sync-card[data-state="coasting"] .stage-icon::after { content: "🔇"; }

.wavebars { display: flex; gap: 5px; align-items: flex-end; justify-content: center; height: 30px; margin: 6px 0 10px; }
.wavebars span { width: 5px; height: 100%; border-radius: 3px; background: var(--surface-3); transform: scaleY(.35); }
.sync-card[data-state="searching"] .wavebars span { background: var(--warn); animation: qn-wave 1s ease-in-out infinite; }
.sync-card[data-state="synced"] .wavebars span { background: var(--ok); animation: qn-wave 1.4s ease-in-out infinite; }
.sync-card[data-state="searching"] .wavebars span:nth-child(2),
.sync-card[data-state="synced"] .wavebars span:nth-child(2) { animation-delay: .15s; }
.sync-card[data-state="searching"] .wavebars span:nth-child(3),
.sync-card[data-state="synced"] .wavebars span:nth-child(3) { animation-delay: .3s; }
.sync-card[data-state="searching"] .wavebars span:nth-child(4),
.sync-card[data-state="synced"] .wavebars span:nth-child(4) { animation-delay: .45s; }
.sync-card[data-state="searching"] .wavebars span:nth-child(5),
.sync-card[data-state="synced"] .wavebars span:nth-child(5) { animation-delay: .6s; }

.sync-headline {
  font-family: var(--disp); font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em;
  margin: 4px 0 6px; color: var(--text-dim);
}
.sync-card[data-state="searching"] .sync-headline { color: var(--warn); }
.sync-card[data-state="synced"] .sync-headline { color: var(--ok); }
.sync-card[data-state="coasting"] .sync-headline { color: var(--warn); }
.stage-hint { max-width: 300px; margin: 0 auto 8px; }

.sync-stats { display: flex; gap: 10px; margin: 12px 0 4px; }
.sync-stats .stat {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 12px 14px; text-align: left;
}
.stat-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; color: var(--text-mute);
  text-transform: uppercase; margin-bottom: 8px;
}
.stat-val { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.sync-pos {
  font-family: var(--disp); font-size: 1.35rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--text-dim);
}
.sync-card[data-state="synced"] .sync-pos { color: var(--text); }
.sync-card[data-state="searching"] .sync-pos { color: var(--warn); }
.sync-card[data-state="coasting"] .sync-pos { color: var(--warn); }

.ampel { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); box-shadow: 0 0 12px currentColor; color: transparent; flex: none; }
.ampel[data-level="green"] { background: var(--ok); color: var(--ok); }
.ampel[data-level="yellow"] { background: var(--warn); color: var(--warn); }
.ampel[data-level="red"] { background: var(--wrong); color: var(--wrong); }
.ampel-word { font-weight: 700; font-size: 0.95rem; }
.ampel-word::after { content: "–"; color: var(--text-mute); }
.ampel[data-level="green"] + .ampel-word::after { content: "Stark"; color: var(--ok); }
.ampel[data-level="yellow"] + .ampel-word::after { content: "Wackelig"; color: var(--warn); }
.ampel[data-level="red"] + .ampel-word::after { content: "Kein Ton"; color: var(--wrong); }

.manual-round {
  flex: 0 0 auto; min-width: 52px; text-align: center;
  font-family: var(--disp); font-weight: 800; font-size: 1.25rem; color: var(--brand-2);
}

/* ---------- Spielerlisten (Host-Setup + Lobby) ---------- */
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.player-list li:last-child { border-bottom: none; }
.player-list .p-av {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  background: radial-gradient(circle at 50% 34%, rgba(140, 160, 196, .25), rgba(140, 160, 196, .08));
  box-shadow: inset 0 0 0 1.5px rgba(140, 160, 196, .4);
}
.player-list .p-name { flex: 1; font-weight: 700; }
.player-list .p-badge {
  font-size: 0.66rem; color: var(--brand-2); background: rgba(46, 139, 255, .16);
  padding: 4px 9px; border-radius: var(--pill); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
}
.player-list .p-on { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.player-list .p-off { font-size: 0.75rem; color: var(--text-mute); }
.player-list li.offline { opacity: 0.45; }
.count, .score-tag .count { color: var(--brand-2); }

/* ---------- Spiel-Kopfzeile (Design 03: Runde · TV-Uhr · Dein Rang) ---------- */
.game-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 10px 14px;
  position: relative;
}
.gt-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gt-left { align-items: flex-start; }
.gt-mid { align-items: center; flex: 1; }
.gt-right { align-items: flex-end; }
.gt-label {
  font-size: 0.6rem; color: var(--text-mute); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.gt-left .gt-label { letter-spacing: 0.16em; }
.round-tag {
  font-family: var(--disp); font-weight: 800; font-size: 0.95rem;
  background: linear-gradient(160deg, #6FD3FF, #2E7BFF); color: #04122B;
  padding: 5px 11px; border-radius: 9px;
  box-shadow: 0 0 16px -4px rgba(46, 139, 255, .6);
  white-space: nowrap;
}
.game-clock {
  font-variant-numeric: tabular-nums; color: var(--text-dim);
  font-family: var(--disp); font-weight: 700; font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.4s ease;
}
/* Sync-Frische-Punkt vor der Uhr (Design: farbcodierter Dot an der TV-Uhr) */
.game-clock::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface-3); box-shadow: 0 0 8px currentColor;
}
.game-clock.sync-ok { color: var(--ok); }
.game-clock.sync-ok::before { background: var(--ok); }
.game-clock.sync-stale { color: var(--warn); }
.game-clock.sync-stale::before { background: var(--warn); }
.game-clock.sync-dead { color: var(--wrong); }
.game-clock.sync-dead::before { background: var(--wrong); }
.gt-rank { display: inline-flex; align-items: baseline; gap: 6px; }
.gt-av {
  align-self: center;
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem;
}
.rank-num { font-family: var(--disp); font-weight: 800; font-size: 1.05rem; color: var(--brand-2); }
.score-tag { font-family: var(--disp); font-weight: 800; font-size: 0.8rem; color: var(--ok); white-space: nowrap; }

#resyncBtn {
  position: absolute; top: -12px; right: 8px;
  font-family: var(--ui); font-size: 11px !important; font-weight: 700;
  padding: 3px 9px !important; border-radius: 9px !important;
  background: var(--surface-2) !important; color: var(--text-dim) !important;
  border: 1px solid var(--line) !important; cursor: pointer;
}

.game-view { min-height: 60vh; }
.big-center { text-align: center; padding-top: 8vh; }
.spinner-emoji { font-size: 3.4rem; animation: qn-bob 2.2s ease-in-out infinite; display: inline-block; }
.lobby-hint { max-width: 280px; margin: 8px auto 0; }
.pulse-dots { display: flex; gap: 7px; align-items: center; justify-content: center; margin: 18px 0 8px; }
.pulse-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: qn-pulse 1.2s ease-in-out infinite; }
.pulse-dots span:nth-child(2) { animation-delay: .2s; }
.pulse-dots span:nth-child(3) { animation-delay: .4s; }
.lobby-players { margin-top: 18px; padding: 10px 14px; }
.lp-head {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; color: var(--text-mute);
  text-transform: uppercase; padding: 6px 0 8px;
}

.q-head { display: flex; align-items: center; justify-content: space-between; min-height: 54px; }
.phase-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--brand-2);
}

/* Countdown-Ring: SVG-Kreis wie im Design; Fortschritt setzt app.js per
   stroke-dashoffset (synchron zum Video-Countdown, HV-25 Punkt 3). */
.countdown-ring { position: relative; width: 54px; height: 54px; }
.countdown-ring svg { width: 54px; height: 54px; transform: rotate(-90deg); display: block; }
.countdown-ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 4; }
.countdown-ring .ring-fg {
  fill: none; stroke: var(--brand); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 157;
  /* Der Render-Tick setzt den Bogen nur alle ~100 ms — die Transition laesst den
     Compositor dazwischen interpolieren (smooth statt 10-fps-Ruckeln, Feld 19.07.).
     0.14s > Tick-Abstand, linear passend zum gleichmaessigen Ablauf. */
  transition: stroke-dashoffset 0.14s linear;
}
.countdown-ring #countdownNum {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--disp); font-weight: 800; font-size: 1.25rem; color: var(--brand-2);
}
.countdown-ring.urgent .ring-fg { stroke: var(--wrong); }
.countdown-ring.urgent #countdownNum { color: var(--wrong); animation: qn-blink 0.6s infinite; }
/* Marge-Fenster (Deadline erreicht, Video zaehlt noch): Zaehler laeuft synchron
   zum TV weiter, aber sichtbar "zu" — grau statt rot-pulsierend. */
.countdown-ring.locked-out .ring-fg { stroke: var(--text-mute); }
.countdown-ring.locked-out #countdownNum { color: var(--text-mute); animation: none; }
.countdown-ring.locked-out { opacity: 0.7; }
/* Ohne diese Regel wuerde ein Autor-display gegen das UA-[hidden] gewinnen ->
   die rote Countdown-"1" blieb frueher sichtbar kleben (HV-25 Punkt 3). */
.countdown-ring[hidden] { display: none; }

.q-text {
  font-family: var(--disp); font-weight: 800;
  font-size: 1.55rem; line-height: 1.22; letter-spacing: -.01em;
  text-wrap: pretty;
  margin: 14px 0 20px;
}

.answer-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.answer-btn {
  display: flex; align-items: center; gap: 14px;
  min-height: 66px; width: 100%;
  padding: 0 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px;
  font-family: var(--ui); font-size: 1.08rem; font-weight: 700; text-align: left;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.answer-btn .key {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(160deg, #6FD3FF, #2E7BFF); color: #04122B;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--disp); font-weight: 800; font-size: 0.95rem;
}
.answer-btn:active { transform: scale(0.98); }
.answer-btn.selected {
  border: 1.5px solid var(--brand); background: rgba(46, 139, 255, .10);
  box-shadow: 0 0 26px -4px rgba(46, 139, 255, .55), inset 0 0 0 1px rgba(95, 198, 255, .45);
}
.answer-btn.selected .key { background: linear-gradient(160deg, #9BE4FF, #2E7BFF); color: #04122B; }
.answer-btn.selected::after { content: "✓"; margin-left: auto; color: var(--brand-2); font-size: 1.15rem; }
.answer-btn.correct {
  border: 1.5px solid var(--ok); background: rgba(53, 224, 138, .12);
  box-shadow: 0 0 26px -4px rgba(53, 224, 138, .55), inset 0 0 0 1px rgba(53, 224, 138, .5);
  opacity: 1;
}
.answer-btn.correct .key { background: var(--ok); color: #08130C; }
.answer-btn.correct::after { content: "✓"; margin-left: auto; color: var(--ok); font-size: 1.15rem; }
.answer-btn.wrong {
  border: 1.5px solid var(--wrong); background: rgba(255, 77, 103, .12);
  box-shadow: 0 0 26px -4px rgba(255, 77, 103, .5), inset 0 0 0 1px rgba(255, 77, 103, .5);
  opacity: 1;
}
.answer-btn.wrong .key { background: var(--wrong); color: #fff; }
.answer-btn.locked { pointer-events: none; }
.answer-btn:disabled { pointer-events: none; opacity: 0.55; }
.answer-btn:disabled.selected { opacity: 1; }

/* HV-27 Anti-Cheat: Marge-Luecke (Deadline erreicht, Video-Reveal noch nicht) —
   Eingabe sichtbar gesperrt, damit niemand die im TV auftauchende Loesung noch
   am Handy nachtippen kann. */
.answer-grid.locked-out { opacity: 0.55; filter: grayscale(0.35); }
.answer-grid.locked-out .answer-btn { border-style: dashed; }
#qPhaseLabel.locked-out { color: var(--wrong); font-weight: 800; }

.answered-line {
  text-align: center; font-size: 0.82rem; color: var(--brand-2); font-weight: 700;
  margin: 12px 0 0;
}

/* ---------- Live-Rangliste unter den Antworten (Design 05a) ---------- */
.live-rank { margin-top: 18px; }
.live-rank-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; color: var(--text-mute);
  text-transform: uppercase;
}
.lr-more { text-transform: none; letter-spacing: 0; font-weight: 500; }
.live-rank-chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.live-rank-chips::-webkit-scrollbar { display: none; }
.lr-chip {
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--pill); padding: 6px 15px 6px 7px;
}
.lr-chip.me { background: rgba(46, 139, 255, .16); border: 1.5px solid var(--brand); }
.lr-rank { font-family: var(--disp); font-weight: 800; font-size: 0.8rem; color: var(--text-dim); width: 14px; text-align: center; }
.lr-chip:first-child .lr-rank { color: var(--gold); }
.lr-chip.me .lr-rank { color: var(--text); }
.lr-av {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.lr-name { font-weight: 700; font-size: 0.85rem; white-space: nowrap; color: var(--text); }
.lr-score { font-family: var(--disp); font-weight: 800; font-size: 0.85rem; color: var(--ok); }
.lr-chip.lb-offline { opacity: 0.5; }

/* ---------- Reveal (Design 04) ---------- */
#viewReveal.ok { background-image: radial-gradient(500px 300px at 50% 0%, rgba(53, 224, 138, .14), transparent 60%); }
#viewReveal.bad { background-image: radial-gradient(500px 300px at 50% 0%, rgba(255, 77, 103, .12), transparent 60%); }
.reveal-banner { text-align: center; padding: 20px 0 14px; }
.reveal-icon {
  width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; font-size: 2.9rem;
  animation: qn-pop 0.5s ease-out;
}
#viewReveal.ok .reveal-icon {
  background: rgba(53, 224, 138, 0.14); color: var(--ok);
  border: 2px solid var(--ok);
  box-shadow: 0 0 60px -8px rgba(53, 224, 138, .7);
}
#viewReveal.bad .reveal-icon {
  background: rgba(255, 77, 103, 0.14); color: var(--wrong);
  border: 2px solid var(--wrong);
}
#revealTitle { font-size: 2rem; letter-spacing: -.02em; }
#viewReveal.ok #revealTitle { color: var(--ok); }
#viewReveal.bad #revealTitle { color: var(--wrong); }
.reveal-tease { color: var(--text); font-size: 0.95rem; font-weight: 500; margin: 8px auto 0; max-width: 300px; }
.points-pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid rgba(53, 224, 138, .3);
  border-radius: var(--pill); padding: 8px 20px; margin-top: 14px;
}
.points-pill strong { font-family: var(--disp); font-weight: 800; font-size: 1.3rem; color: var(--ok); }
.points-pill span { color: var(--text-dim); font-weight: 500; font-size: 0.9rem; }
.points-pill[hidden] { display: none; }
.reveal-correct {
  text-align: left; color: var(--text-mute);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 14px 18px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
}
.reveal-correct strong {
  display: block; margin-top: 6px;
  color: var(--text); font-family: var(--disp); font-weight: 700;
  font-size: 1.1rem; text-transform: none; letter-spacing: 0;
}
.hint-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 14px 16px; margin: 12px 0;
  color: var(--text-dim); font-size: 0.85rem;
}
.hint-box .hb-icon { font-size: 1.2rem; flex: none; }
.hint-box[hidden] { display: none; }
.next-cta {
  margin-top: 16px; min-height: 58px; border-radius: 16px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.02rem;
  box-shadow: var(--btn-shadow);
}

/* ---------- Boards ---------- */
.mini-board, .leaderboard { list-style: none; margin: 14px 0 0; padding: 0; }
.mini-board .row, .leaderboard li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 15px; margin-bottom: 9px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.leaderboard li.me {
  border: 1.5px solid var(--brand);
  background: linear-gradient(90deg, rgba(46, 139, 255, .2), rgba(46, 139, 255, .06));
  box-shadow: 0 0 0 4px rgba(46, 139, 255, .1);
}
.leaderboard .rank { font-family: var(--disp); font-weight: 800; color: var(--text-dim); min-width: 26px; font-size: 1.05rem; }
#viewBoard:not(.ended) .leaderboard li:nth-child(1) .rank { color: var(--gold); }
.lb-av {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: radial-gradient(circle at 50% 34%, rgba(140, 160, 196, .25), rgba(140, 160, 196, .08));
  box-shadow: inset 0 0 0 1.5px rgba(140, 160, 196, .4);
}
.lb-name { flex: 1; font-weight: 700; }
.lb-name .du-badge {
  font-size: 0.62rem; color: var(--brand-2); background: rgba(46, 139, 255, .22);
  padding: 2px 8px; border-radius: var(--pill); margin-left: 4px; font-weight: 700;
}
.lb-name .flame { margin-left: 6px; }
.lb-score { font-family: var(--disp); font-weight: 800; color: var(--ok); font-size: 1.2rem; min-width: 34px; text-align: right; }
.lb-offline { opacity: 0.5; }
.board-title { text-align: center; }

/* ---------- Endstand: Platz-1-Moment (Design 05b) ---------- */
#viewBoard.ended { background-image: radial-gradient(520px 320px at 50% 0%, rgba(255, 210, 74, .16), transparent 62%); }
.podium { text-align: center; padding-top: 8px; }
.podium[hidden] { display: none; }
.podium-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; color: var(--gold);
  text-transform: uppercase; margin-bottom: 12px;
}
.podium-trophy { font-size: 2.4rem; animation: qn-bob 2.4s ease-in-out infinite; }
.podium-avatar {
  width: 96px; height: 96px; border-radius: 26px; margin: 8px auto 0;
  display: flex; align-items: center; justify-content: center; font-size: 3.1rem;
  background: radial-gradient(circle at 50% 34%, rgba(140, 160, 196, .3), rgba(140, 160, 196, .1));
  border: 2px solid var(--gold);
  box-shadow: 0 0 44px -6px rgba(255, 210, 74, .7);
}
.podium-name { font-family: var(--disp); font-weight: 800; font-size: 1.75rem; letter-spacing: -.02em; margin-top: 10px; }
.podium-score { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 4px; }
.podium-score strong { font-family: var(--disp); font-weight: 800; font-size: 1.25rem; color: var(--gold); }
.podium-score span { color: var(--text-dim); font-size: 0.9rem; }
.end-actions { margin-top: 18px; }
.end-actions[hidden] { display: none; }
.end-actions #rematchBtn { flex: 1.4; }

/* ---------- Getrennt / Wiederverbindung (Design 06b) ---------- */
.reconnect-overlay {
  position: fixed; inset: 0; z-index: 60;
  background:
    radial-gradient(600px 380px at 50% 20%, rgba(255, 77, 103, .12), transparent 62%),
    var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 32px 24px;
}
.reconnect-overlay[hidden] { display: none; }
.reconnect-overlay h2 { color: var(--wrong); margin: 0; }
.reconnect-overlay .hint { max-width: 280px; }
.ro-visual { position: relative; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; }
.ro-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--wrong); opacity: .2;
  animation: qn-ring-pulse 2s ease-in-out infinite;
}
.ro-icon {
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(255, 77, 103, .12); border: 1px solid var(--wrong);
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
}
.ro-status {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--pill); padding: 9px 18px;
  font-size: 0.85rem; font-weight: 700; color: var(--warn);
}
.ro-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--warn);
  animation: qn-spin .8s linear infinite;
}
.reconnect-overlay .btn-lg { max-width: 320px; }

/* ---------- Desktop: nichts kaputt, nur zentriert mit etwas Luft ---------- */
@media (min-width: 720px) {
  #app { padding-top: calc(env(safe-area-inset-top) + 56px); }
  .game-view { min-height: 50vh; }
}

/* ---------- Video-Dock: eingebetteter YouTube-Player (Host, "In der App") ----------
   Sticky ueber den Screens, damit der Player beim Antworten sichtbar bleibt
   (YouTube-ToS: Player nie verstecken/ueberdecken, mind. 200x200 px — bei
   390px-Viewport ist das 16:9-Dock 390x219, passt). Kein Minimieren anbieten. */
#ytDock {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 36px); /* unter der fixen Connbar */
  z-index: 40;
  margin: 0 0 14px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .8);
}
.yt-ratio { position: relative; padding-top: 56.25%; }
.yt-ratio iframe,
.yt-ratio > div {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* ---------- Modus-Wahl des Hosts: TV+Mikro vs. YouTube in der App ---------- */
.mode-switch { display: flex; gap: 10px; }
.mode-btn {
  flex: 1; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px;
  font-family: var(--ui); font-weight: 700; font-size: 1rem;
  padding: 10px 12px; cursor: pointer;
}
.mode-btn small { font-weight: 500; font-size: .75rem; color: var(--text-dim); }
.mode-btn.selected {
  border-color: var(--brand);
  background: rgba(46, 139, 255, .14);
  box-shadow: inset 0 0 0 1px var(--brand);
}

/* Host im Video-Modus: Fragetext ausblenden (steht im Video im Dock darueber),
   Antwort-Buttons/Countdown/Reveal bleiben — kompakt, damit Player + Buttons
   zusammen auf einen Schirm passen. */
#screen-game.video-mode #qText { display: none; }
#screen-game.video-mode .q-head { margin-bottom: 10px; }
#screen-game.video-mode .game-top { margin-bottom: 10px; }
