/* TV / big screen: fixed 1920x1080 stage scaled to fit. All sizes in stage pixels. */
.tv-host { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; }
.tv-stage {
  position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden;
  color: var(--qf-text); font-family: var(--qf-font-body); font-size: calc(30px * var(--qf-tv-scale));
}
.qf-bg { position: absolute; inset: 0; z-index: 0; }
.qf-bg-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background-size: cover; background-position: center; }
.qf-bg-overlay { position: absolute; inset: 0; }
.qf-bg-animated { animation: qf-gradient 18s ease infinite; }
@keyframes qf-gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.tv-layer { position: absolute; inset: 0; z-index: 1; }
.qf-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

.tv-scene { position: absolute; inset: 0; padding: 48px 64px; display: flex; flex-direction: column; gap: 28px; }
.tv-stage[data-transition="fade"] .tv-scene.enter { animation: tv-fade .5s ease both; }
.tv-stage[data-transition="slide"] .tv-scene.enter { animation: tv-slide .55s cubic-bezier(.2,.8,.2,1) both; }
.tv-stage[data-transition="zoom"] .tv-scene.enter { animation: tv-zoom .5s cubic-bezier(.2,.8,.2,1) both; }
.tv-stage[data-transition="flip"] .tv-scene.enter { animation: tv-flip .6s ease both; transform-origin: center; }
.tv-scene.leave { animation: tv-fade-out .35s ease both; pointer-events: none; }
@keyframes tv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tv-fade-out { to { opacity: 0; } }
@keyframes tv-slide { from { opacity: 0; transform: translateX(120px); } to { opacity: 1; transform: none; } }
@keyframes tv-zoom { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes tv-flip { from { opacity: 0; transform: perspective(1600px) rotateY(-70deg); } to { opacity: 1; transform: none; } }

.qf-display { font-family: var(--qf-font-display); }
.tv-header { display: flex; gap: 16px; align-items: center; }
.tv-chip { padding: 8px 20px; border-radius: 999px; background: color-mix(in srgb, var(--qf-surface) 80%, transparent); font-size: .8em; font-weight: 600; color: var(--qf-text-muted); border: 1px solid color-mix(in srgb, var(--qf-text) 10%, transparent); }
.tv-chip-accent { color: var(--qf-text); background: color-mix(in srgb, var(--qf-accent) 45%, transparent); }
.tv-code { margin-left: auto; font-family: var(--qf-font-mono); font-weight: 600; font-size: .9em; padding: 8px 20px; border-radius: 12px; background: color-mix(in srgb, var(--qf-surface) 80%, transparent); letter-spacing: .15em; }
.qf-themed .muted { color: var(--qf-text-muted); }

/* Lobby */
.tv-lobby { flex-direction: row; gap: 56px; }
.tv-lobby-left { width: 760px; display: flex; flex-direction: column; gap: 28px; }
.tv-lobby-right { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.tv-title { font-size: 2.2em; font-weight: 600; line-height: 1.05; }
.tv-join { display: flex; gap: 32px; padding: 32px; align-items: center; }
.tv-qr { width: 300px; height: 300px; flex: none; border-radius: 16px; overflow: hidden; background: #fff; }
.tv-qr svg { width: 100%; height: 100%; }
.tv-join-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tv-join-url { font-size: 1.1em; font-weight: 600; word-break: break-all; }
.tv-big-code { font-size: 4.4em; font-weight: 600; letter-spacing: .12em; line-height: 1; color: var(--qf-accent-2); }
.tv-count { font-size: 1.3em; font-weight: 600; }
.tv-wall { display: flex; flex-wrap: wrap; gap: 22px; align-content: flex-start; overflow: hidden; flex: 1; }
.tv-wall-item { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; }
.tv-wall-item.offline { opacity: .4; }
.tv-wall-name { font-size: .7em; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.tv-lobby-teams { display: flex; gap: 12px; flex-wrap: wrap; }
.tv-team-chip { padding: 8px 18px; border-radius: 999px; background: var(--team); color: #fff; font-weight: 600; font-size: .8em; }

.qf-avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; line-height: 1; box-shadow: 0 4px 14px rgb(0 0 0 / .3); }
.qf-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Round intro */
.tv-intro { align-items: center; justify-content: center; text-align: center; gap: 24px; }
.tv-intro-kicker { font-size: 1em; color: var(--qf-accent-2); font-weight: 600; }
.tv-intro-title { font-size: 3.6em; font-weight: 600; line-height: 1.05; max-width: 1600px; }
.tv-intro-sub { font-size: 1.3em; color: var(--qf-text-muted); }
.tv-intro-text { max-width: 1300px; padding: 24px 36px; font-size: 1.05em; line-height: 1.45; }
.tv-intro .tv-media { max-height: 360px; max-width: 900px; }
.tv-rules { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.tv-rule { padding: 14px 24px; display: flex; gap: 12px; align-items: center; font-weight: 600; font-size: .9em; }

/* Wager */
.tv-wager { align-items: center; }
.tv-wager-title { font-size: 2.6em; font-weight: 600; margin-top: 40px; }
.tv-wager-cat { padding: 22px 40px; font-size: 1.4em; font-weight: 600; }
.tv-wager-hint { color: var(--qf-text-muted); }
.tv-wager-list { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; max-width: 1700px; }
.tv-wager-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: color-mix(in srgb, var(--qf-surface) 85%, transparent); font-weight: 600; font-size: .8em; opacity: .55; }
.tv-wager-item.placed { opacity: 1; box-shadow: 0 0 0 3px var(--qf-correct); }
.tv-wager-mark { color: var(--qf-correct); font-weight: 600; }

/* Question */
.tv-q-top { display: flex; gap: 36px; align-items: center; }
.tv-prompt { flex: 1; font-size: 1.8em; font-weight: 600; line-height: 1.2; }
.tv-q-body { flex: 1; display: flex; flex-direction: column; gap: 24px; min-height: 0; }
.tv-q-body.with-media { flex-direction: row; }
.tv-q-media { flex: 0 0 46%; display: flex; min-height: 0; }
.tv-q-answers { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 0; }
.tv-media { position: relative; flex: 1; border-radius: var(--qf-radius); overflow: hidden; background: rgb(0 0 0 / .35); display: grid; place-items: center; min-height: 0; max-height: 640px; }
.tv-media-el { width: 100%; height: 100%; object-fit: contain; max-height: 640px; transition: filter .25s linear; }
.tv-media-audio { min-height: 260px; }
.tv-video-hidden-until-play video { opacity: .2; }
.tv-audio-viz { color: var(--qf-text-muted); }
.tv-audio-viz .icon { width: 96px; height: 96px; }
.tv-tiles { position: absolute; inset: 0; display: grid; }
.tv-tile { background: var(--qf-card); border: 2px solid var(--qf-bg); display: grid; place-items: center; font-weight: 600; font-size: 1.2em; color: var(--qf-text-muted); transition: opacity .5s, transform .5s; }
.tv-tile.open { opacity: 0; transform: scale(.6) rotate(8deg); }

.tv-answers { display: grid; gap: 22px; }
.tv-answers-grid_2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv-answers-grid_2x2.n-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv-answers-list_vertical { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tv-answers-cards_horizontal { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tv-answers-cards_horizontal .tv-answer { flex-direction: column; text-align: center; justify-content: center; min-height: 260px; }
.tv-answer {
  position: relative; display: flex; align-items: center; gap: 20px; padding: 26px 30px; min-height: 120px; overflow: hidden;
  background: color-mix(in srgb, var(--qf-card) 78%, var(--btn)) !important; color: var(--qf-text); font-weight: 500; font-size: 1.05em; border-left: 8px solid var(--btn) !important;
  transition: opacity .18s var(--ui-ease), border-color .18s var(--ui-ease);
}
.tv-answers-list_vertical .tv-answer { min-height: 84px; padding: 16px 26px; }
.tv-answer-shape { font-size: 1.3em; opacity: .9; flex: none; }
.tv-answer-img { height: 110px; width: 150px; object-fit: cover; border-radius: 10px; flex: none; }
.tv-answer-text { flex: 1; min-width: 0; }
.tv-answer.dim { opacity: .58; }
.tv-answer.correct { outline: 2px solid var(--qf-text); outline-offset: -2px; }
.tv-answer-check { font-size: 1.4em; }
.tv-answer-count { position: relative; min-width: 90px; text-align: right; font-size: 1.1em; z-index: 1; }
.tv-answer-bar { position: absolute; right: -30px; top: -40px; bottom: -40px; background: rgb(255 255 255 / .18); z-index: -1; }
.tv-answer-count .tv-answer-bar { left: auto; }

.tv-axis { position: relative; height: 240px; margin: 40px 40px 0; }
.tv-axis-line { position: absolute; left: 0; right: 0; top: 110px; height: 10px; border-radius: 5px; background: var(--qf-accent); }
.tv-axis-label { position: absolute; top: 140px; font-weight: 600; color: var(--qf-text-muted); }
.tv-axis-label.left { left: 0; } .tv-axis-label.right { right: 0; }
.tv-axis-hint { position: absolute; top: 20px; left: 0; right: 0; text-align: center; color: var(--qf-text-muted); }
.tv-axis-dot { position: absolute; top: 96px; width: 18px; height: 38px; margin-left: -9px; border-radius: 9px; background: color-mix(in srgb, var(--qf-text) 70%, transparent); }
.tv-axis-zone { position: absolute; top: 90px; height: 50px; background: color-mix(in srgb, var(--qf-correct) 22%, transparent); border-radius: 8px; }
.tv-axis-correct { position: absolute; top: 40px; width: 6px; height: 150px; margin-left: -3px; background: var(--qf-correct); border-radius: 3px; }
.tv-axis-correct span { position: absolute; top: -50px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--qf-card); color: var(--qf-text); padding: 4px 16px; border-radius: 10px; font-weight: 600; }

.tv-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tv-order li { display: flex; align-items: center; gap: 20px; padding: 16px 24px; font-weight: 600; }
.tv-order li.correct { border-color: var(--qf-correct) !important; }
.tv-order img { height: 70px; width: 100px; object-fit: cover; border-radius: 8px; }
.tv-order-n { width: 54px; height: 54px; border-radius: 50%; background: var(--qf-surface); display: grid; place-items: center; font-weight: 500; color: var(--qf-text); flex: none; }
.tv-order-pct { font-weight: 600; color: var(--qf-correct); }
.tv-open-hint { padding: 40px; text-align: center; font-size: 1.3em; font-weight: 600; }
.tv-open-reveal { display: flex; flex-direction: column; gap: 20px; }
.tv-open-correct { padding: 24px 32px; font-size: 1.5em; font-weight: 600; border-color: var(--qf-correct) !important; }
.tv-open-top { display: flex; flex-wrap: wrap; gap: 12px; }
.tv-open-item { padding: 10px 18px; border-radius: 999px; font-weight: 600; display: flex; gap: 10px; background: color-mix(in srgb, var(--qf-wrong) 30%, transparent); }
.tv-open-item.correct { background: color-mix(in srgb, var(--qf-correct) 35%, transparent); }
.tv-open-count { opacity: .8; }

.tv-q-footer { display: flex; align-items: center; gap: 24px; min-height: 56px; }
.tv-progress { font-weight: 600; font-size: .9em; color: var(--qf-text-muted); }
.tv-prep-banner { margin-left: auto; padding: 10px 26px; border-radius: 999px; background: var(--qf-surface); color: var(--qf-text); border-left: 4px solid var(--qf-accent); font-weight: 500; }
.tv-arbiter-banner { margin-left: auto; padding: 14px 28px; font-weight: 600; }
@keyframes pulse { 50% { transform: scale(1.05); opacity: .85; } }
.tv-reveal-wrap { flex: 1; display: flex; gap: 32px; min-height: 0; }
.tv-reveal-wrap .tv-q-body { flex: 1.6; }
.tv-reveal-side { flex: 1; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.tv-explanation { padding: 22px 26px; font-size: .85em; line-height: 1.4; }
.tv-expl-title { font-weight: 600; margin-bottom: 8px; color: var(--qf-accent-2); }
.tv-gainers { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.tv-gainer { display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: .85em; }
.tv-delta { font-weight: 600; font-family: var(--qf-font-mono); }
.tv-delta.up { color: var(--qf-correct); } .tv-delta.down { color: var(--qf-wrong); }
.tv-streak { font-weight: 600; color: #ffb020; }
.tv-correct-count { color: var(--qf-text-muted); font-weight: 600; font-size: .85em; }

/* Timer styles */
.qf-timer { flex: none; position: relative; }
.qf-timer.qf-timer-waiting { opacity: .35; }
.qf-timer-circle_ring { width: 170px; height: 170px; }
.qf-timer-circle_ring .ring { width: 100%; height: 100%; }
.qf-timer-circle_ring .ring-bg { stroke: color-mix(in srgb, var(--qf-text) 15%, transparent); }
.qf-timer-circle_ring .ring-fg { stroke: var(--qf-accent); stroke-linecap: round; transition: stroke .3s; }
.qf-timer-circle_ring.urgent .ring-fg { stroke: var(--qf-wrong); }
.qf-timer-circle_ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2em; font-weight: 600; font-family: var(--qf-font-mono); }
.qf-timer-top_bar { width: 520px; display: flex; flex-direction: column; gap: 6px; }
.qf-timer-top_bar .bar-track { height: 22px; border-radius: 11px; background: color-mix(in srgb, var(--qf-text) 15%, transparent); overflow: hidden; }
.qf-timer-top_bar .bar-fill { height: 100%; background: var(--qf-accent); transform-origin: left; }
.qf-timer-top_bar.urgent .bar-fill { background: var(--qf-wrong); }
.qf-timer-top_bar .bar-label { text-align: right; font-weight: 600; font-family: var(--qf-font-mono); font-size: 1.4em; }
.qf-timer-digital_neon .digital-label { font-family: var(--qf-font-mono); font-size: 3.2em; font-weight: 600; color: var(--qf-accent-2); text-shadow: 0 0 10px var(--qf-accent-2), 0 0 30px var(--qf-accent-2); min-width: 170px; text-align: center; }
.qf-timer-digital_neon.urgent .digital-label { color: var(--qf-wrong); text-shadow: 0 0 10px var(--qf-wrong), 0 0 30px var(--qf-wrong); animation: pulse .5s infinite; }
.qf-timer-fuse { width: 520px; display: flex; flex-direction: column; gap: 6px; }
.qf-timer-fuse .fuse-track { position: relative; height: 14px; }
.qf-timer-fuse .fuse-rope { position: absolute; inset: 3px 0; background: repeating-linear-gradient(45deg, #c8a063 0 8px, #8b6a3a 8px 16px); border-radius: 4px; transform-origin: left; }
.qf-timer-fuse .fuse-spark { position: absolute; top: -18px; transform: translateX(-50%); color: #ffcf40; font-size: 36px; text-shadow: 0 0 14px #ff8a00; animation: spark .2s infinite alternate; }
.qf-timer-fuse .fuse-label { font-weight: 600; font-family: var(--qf-font-mono); font-size: 1.4em; text-align: right; }
@keyframes spark { to { transform: translateX(-50%) scale(1.3) rotate(20deg); } }
.qf-timer-idle .ring-fg { stroke-dashoffset: 0 !important; }
.qf-timer-compact.qf-timer-circle_ring { width: 64px; height: 64px; }
.qf-timer-compact.qf-timer-circle_ring .ring-label { font-size: 1.1em; }
.qf-timer-compact.qf-timer-top_bar, .qf-timer-compact.qf-timer-fuse { width: 100%; }
.qf-timer-compact .digital-label { font-size: 1.6em; min-width: 0; }

/* Leaderboard */
.tv-leaderboard { align-items: center; }
.tv-lb-title { font-size: 2.4em; font-weight: 600; text-align: center; }
.tv-lb-wrap { display: flex; gap: 40px; width: 100%; justify-content: center; }
.tv-lb { display: flex; flex-direction: column; gap: 12px; width: 1100px; }
.tv-lb-row { display: flex; align-items: center; gap: 22px; padding: 12px 26px; font-weight: 600; }
.tv-rank { width: 56px; text-align: center; font-size: 1.2em; font-weight: 600; }
.tv-move { width: 70px; font-size: .75em; font-weight: 600; }
.tv-move.up { color: var(--qf-correct); } .tv-move.down { color: var(--qf-wrong); } .tv-move.same { color: var(--qf-text-muted); }
.tv-lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-score { font-family: var(--qf-font-mono); font-size: 1.1em; min-width: 160px; text-align: right; }
.tv-team-board { display: flex; flex-direction: column; gap: 12px; width: 520px; }
.tv-team-row { display: flex; align-items: center; gap: 16px; padding: 16px 22px; font-weight: 600; border-left: 10px solid var(--team) !important; }

/* Final */
.tv-final { align-items: center; }
.tv-podium { display: flex; align-items: flex-end; gap: 40px; margin-top: 20px; }
.tv-podium-col { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 300px; }
.tv-podium-name { font-weight: 600; font-size: 1.1em; text-align: center; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-podium-score { font-family: var(--qf-font-mono); font-weight: 600; color: var(--qf-text-muted); }
.tv-podium-bar { width: 100%; display: grid; place-items: start center; padding-top: 18px; font-size: 2.6em; font-weight: 600; background: var(--qf-card) !important; color: var(--qf-text); }
.place-1 .tv-podium-bar { border-top: 8px solid var(--qf-accent); }
.tv-noms { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.tv-nom { padding: 16px 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 300px; text-align: center; }
.tv-nom-title { font-weight: 600; font-size: .8em; color: var(--qf-accent-2); }
.tv-nom-player { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .85em; }

/* TV overlays */
.tv-reactions { position: absolute; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.tv-reaction { position: absolute; bottom: -80px; font-size: 64px; animation: float-up 3.2s ease-in forwards; }
.tv-reaction small { display: block; font-size: 18px; text-align: center; font-weight: 600; color: var(--qf-text); text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
@keyframes float-up { 0% { transform: translateY(0) scale(.6); opacity: 0; } 10% { opacity: 1; transform: translateY(-80px) scale(1); } 100% { transform: translateY(-1100px) scale(1.2); opacity: 0; } }
.tv-unlock { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgb(0 0 0 / .82); color: var(--ui-text); color-scheme: dark; text-align: center; overflow: auto; padding: 16px; align-items: safe center; grid-template-columns: minmax(0, 1fr); }
.tv-unlock-box { display: flex; flex-direction: column; gap: 16px; align-items: center; padding: 20px; width: min(100%, 480px); background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: 16px; }
.tv-unlock-box h1 { font-size: clamp(1.6rem, 4vw, 3rem); }
.tv-unlock-box > * { margin: 0; }
.tv-code-input { font: 500 2rem var(--ui-mono); letter-spacing: .24em; text-align: center; text-transform: uppercase; }
.tv-unlock button { font-size: clamp(1.1rem, 2.4vw, 1.8rem); padding: 12px 20px; }
.tv-sound-ind .icon { width: 28px; height: 28px; }
.tv-sound-ind { position: absolute; right: 24px; bottom: 18px; z-index: 45; padding: 8px; border-radius: 8px; background: var(--qf-surface); color: var(--qf-text-muted); }
.tv-footer-brand { position: absolute; left: 64px; bottom: 16px; z-index: 45; display: flex; align-items: center; gap: 14px; font-size: 18px; color: var(--qf-text-muted); }
.tv-footer-brand img { height: 44px; width: auto; }
.tv-status { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 6px 18px; border-radius: 999px; background: var(--ui-warning, #f59e0b); color: #111; font-weight: 600; font-size: 18px; }
.tv-cursor-hidden, .tv-cursor-hidden * { cursor: none !important; }
.tv-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 40px; }
