/* ---------- Big screen dashboard (designed for 16:9, scales with viewport) ---------- */
body.tv { font-size: clamp(14px, 1.05vw, 26px); overflow: hidden; }
.tv-start { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1.2em; padding: 4vh 4vw; text-align: center; }
.tv-start .wordmark { font-family: var(--display); font-weight: 400; font-size: clamp(4rem, 9vw, 9rem); margin: 0; color: var(--marigold); text-shadow: .04em .04em 0 var(--rosa), .08em .08em 0 var(--ink); line-height: 1; }
.tv-start .tagline { color: var(--muted); font-size: 1.4em; margin: 0; }
.start-actions { display: grid; gap: 1em; justify-items: center; margin-top: 1em; }
.watch { display: flex; gap: .6em; }
.watch .input { width: 9em; }
.code-in { text-transform: uppercase; letter-spacing: .3em; font-family: var(--display); font-size: 1.4rem; text-align: center; }

.dash {
  height: 100vh; display: grid; gap: 1.2vw; padding: 1.2vw 1.6vw;
  grid-template-columns: minmax(16em, 22vw) 1fr minmax(16em, 24vw);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top top" "left stage right" "strip strip strip";
}
.dash-top { grid-area: top; display: flex; align-items: center; gap: 1em; }
.dash-mark { font-family: var(--display); font-size: 1.8em; color: var(--marigold); text-shadow: .05em .05em 0 var(--rosa); }
.dash-stats { flex: 1; display: flex; gap: 2em; justify-content: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-stats b { color: var(--text); font-size: 1.15em; }
.dash-top .btn.small { min-height: 2.2em; font-size: .8em; }
.dash-top .btn.on { background: var(--jade); border-color: var(--jade); color: #fff; }

.dash-left, .dash-right { display: flex; flex-direction: column; gap: 1.2vw; min-height: 0; }
.dash-left { grid-area: left; }
.dash-right { grid-area: right; }
.join-box { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r-lg); padding: 1em; display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 1em; align-items: center; box-shadow: 0 .35em 0 var(--ink); }
.qr { width: 8.5em; aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; border-radius: 6px; }
.join-label { margin: 0; font-size: .8em; font-weight: 700; opacity: .7; }
.join-url { margin: 0 0 .5em; font-weight: 800; font-size: .95em; word-break: break-all; line-height: 1.2; }
.join-code { margin: 0; font-family: var(--display); font-size: 2.1em; line-height: 1; letter-spacing: .08em; color: var(--rosa); }
.rules-box { background: var(--night-2); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 1em 1.1em; flex: 1; min-height: 0; overflow: hidden; }
.rules-box h2, .dash-right h2 { margin: 0 0 .6em; font-size: 1em; color: var(--marigold-2); }
.goal-big { display: flex; flex-wrap: wrap; gap: .6em; margin-bottom: .9em; }
.goal-big .gp { display: inline-flex; align-items: center; gap: .5em; background: var(--paper); color: var(--ink); border-radius: 99px; padding: .35em .8em .35em .4em; font-weight: 800; }
.goal-big .gp .mini { width: 1.6em; height: 1.6em; }
.goal-big .gp .mini i { background: rgba(42, 21, 51, .15); }
.goal-big .gp .mini i.on { background: var(--rosa); }
.goal-big .gp.done { opacity: .45; text-decoration: line-through; }
.goal-big .gp.next { opacity: .55; }
.goal-big .gp.now { box-shadow: 0 0 0 3px var(--marigold); }
.rules-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45em; color: var(--muted); font-size: .92em; }
.rules-list b { color: var(--text); }

.stage { grid-area: stage; position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3vw; padding: 0 2vw; min-height: 0; }
.stage-card { width: min(26vw, calc((100vh - 18em) * .714)); }
.stage-card .card { width: 100%; box-shadow: 0 0 0 3px var(--ink), 0 .6em 0 3px rgba(0, 0, 0, .35), 0 0 6em rgba(242, 162, 12, .25); }
.stage-card .placeholder { aspect-ratio: 5/7; border: 4px dashed var(--line); border-radius: 18px; display: grid; place-items: center; color: var(--muted); font-size: 1.2em; padding: 1em; text-align: center; }
.stage-text { min-width: 0; }
.stage-intro { margin: 0; font-size: 1.6em; font-weight: 800; color: var(--marigold-2); }
.stage-name { margin: .1em 0 0; font-family: var(--display); font-size: clamp(3rem, 5.6vw, 7.5rem); line-height: .98; letter-spacing: -.01em; }
.stage-name.hidden-name { color: transparent; text-shadow: 0 0 .35em rgba(255, 243, 214, .8); }
.stage-alt { margin: .3em 0 0; font-size: 1.4em; color: var(--muted); font-weight: 600; }
.stage-verse { margin: 1em 0 0; font-size: 1.8em; line-height: 1.3; max-width: 26ch; font-weight: 500; }
.stage-verse::before { content: '“'; color: var(--rosa); font-family: var(--display); }
.stage-verse::after { content: '”'; color: var(--rosa); font-family: var(--display); }
.stage-verse:empty::before, .stage-verse:empty::after { content: none; }
.paused-banner { display: inline-block; background: var(--rosa); color: #fff; font-weight: 800; padding: .3em .9em; border-radius: 99px; font-size: .9em; margin-left: .6em; vertical-align: middle; font-family: var(--ui); }

.lobby-stage { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 1.2em; }
.lobby-stage .big-code { font-family: var(--display); font-size: clamp(4rem, 9vw, 11rem); line-height: .9; color: var(--marigold); text-shadow: .03em .03em 0 var(--rosa), .06em .06em 0 var(--ink); letter-spacing: .06em; margin: 0; }
.lobby-stage .lead { font-size: 1.5em; margin: 0; color: var(--muted); }
.lobby-stage .lead b { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: .6em; justify-content: center; max-width: 46em; }
.chip { display: inline-flex; align-items: center; gap: .5em; padding: .3em .9em .3em .3em; border-radius: 99px; background: var(--night-2); border: 1.5px solid var(--line); font-weight: 700; font-size: 1.1em; animation: pop .4s cubic-bezier(.3, .9, .4, 1.4) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.chip .avatar { width: 2.2em; height: 2.2em; font-size: .7em; }
.stage.is-lobby .stage-card, .stage.is-lobby .stage-text { visibility: hidden; }

.lb ol, .close ul, .wins ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45em; }
.lb { background: var(--night-2); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 1em 1.1em; }
.lb li { display: grid; grid-template-columns: 1.6em auto 1fr auto; align-items: center; gap: .6em; padding: .35em .5em; border-radius: 12px; transition: background .3s; }
.lb li.first { background: var(--paper); color: var(--ink); }
.lb .rank { font-family: var(--display); text-align: center; color: var(--muted); }
.lb li.first .rank { color: var(--rosa); }
.lb .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .nm small { font-weight: 600; opacity: .65; margin-left: .3em; }
.lb .sc { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.15em; }
.lb .avatar { width: 2.2em; height: 2.2em; font-size: .62em; }
.lb .speaking .avatar { box-shadow: 0 0 0 3px var(--jade), 0 0 12px var(--jade); }
.close, .wins { background: var(--night-2); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 1em 1.1em; min-height: 0; overflow: hidden; }
.wins { flex: 1; }
.close li { display: flex; align-items: center; gap: .6em; font-weight: 700; }
.close li .need { margin-left: auto; color: var(--marigold-2); font-variant-numeric: tabular-nums; }
.close li.one { animation: throb 1s ease-in-out infinite; }
@keyframes throb { 50% { color: var(--marigold-2); } }
.wins li { display: flex; gap: .6em; align-items: center; font-size: .92em; color: var(--muted); }
.wins li b { color: var(--text); }
.wins .mini { width: 1.4em; height: 1.4em; }
.empty-note { color: var(--muted); font-size: .9em; }

.strip { grid-area: strip; display: grid; grid-template-columns: repeat(27, 1fr); gap: .35vw; }
.strip .slot { position: relative; }
.strip .card { width: 100%; opacity: .16; filter: grayscale(1); transition: opacity .5s, filter .5s, transform .5s; box-shadow: 0 0 0 1px var(--ink); }
.strip .card .card-name { display: none; }
.strip .slot.called .card { opacity: 1; filter: none; }
.strip .slot.last .card { transform: translateY(-14%); box-shadow: 0 0 0 1px var(--ink), 0 0 0 3px var(--marigold), 0 0 14px rgba(242, 162, 12, .7); }
.strip .ord { position: absolute; right: 2px; bottom: 2px; font-size: .55em; font-weight: 800; background: var(--ink); color: var(--paper); border-radius: 4px; padding: 0 3px; font-variant-numeric: tabular-nums; }

.floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floaty { position: absolute; bottom: 0; font-size: 3.6em; animation: tvFloat 3s ease-out forwards; text-align: center; }
.floaty small { display: block; font-size: .28em; font-weight: 800; color: var(--text); }
@keyframes tvFloat { from { transform: translateY(20%) scale(.5); opacity: 0; } 12% { opacity: 1; transform: translateY(-10%) scale(1); } to { transform: translateY(-70vh); opacity: 0; } }

#tvOverlay { position: fixed; inset: 0; z-index: 60; background: rgba(12, 10, 45, .88); display: grid; place-items: center; text-align: center; animation: fade .25s; }
.tvo { display: grid; gap: 1.2em; justify-items: center; }
.tvo-title { font-family: var(--display); font-size: clamp(5rem, 12vw, 14rem); line-height: .95; margin: 0; color: var(--marigold); text-shadow: .03em .03em 0 var(--rosa), .06em .06em 0 var(--ink); }
.tvo-title.mid { font-size: clamp(3.5rem, 7vw, 8rem); }
.tvo-sub { font-size: 2em; margin: 0; }
.tvo .winners { display: flex; gap: .8em; flex-wrap: wrap; justify-content: center; }
.tvo .wchip { display: inline-flex; align-items: center; gap: .6em; padding: .4em 1.2em .4em .4em; border-radius: 99px; background: var(--paper); color: var(--ink); font-weight: 800; font-size: 2em; border: 3px solid var(--ink); }
.tvo .wchip .avatar { width: 1.6em; height: 1.6em; font-size: .6em; }
.tvo .wchip em { font-style: normal; color: var(--rosa); }
.tvo .pat { display: inline-flex; gap: .6em; align-items: center; font-size: 1.4em; color: var(--muted); }
.tvo .pat .mini { width: 2em; height: 2em; }
.tvo .final { display: grid; gap: .4em; min-width: 26em; font-size: 1.3em; }
.tvo .final > div { display: flex; gap: .7em; align-items: center; background: var(--night-2); padding: .4em .9em; border-radius: 14px; text-align: left; }
.tvo .final > div b { flex: 1; }
.tvo .final > div.lead { background: var(--paper); color: var(--ink); }
.tvo .countdown { font-size: 1.4em; color: var(--muted); }

.sound-gate { position: fixed; inset: auto 0 2vh; display: grid; place-items: center; z-index: 70; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 65; }

@media (max-aspect-ratio: 4/3) {
  body.tv { overflow: auto; }
  .dash { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-areas: "top" "stage" "left" "right" "strip"; }
  .stage { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 2em 0; }
  .stage-card { width: min(60vw, 340px); }
  .strip { grid-template-columns: repeat(9, 1fr); }
  .lobby-stage { position: relative; padding: 2em 0; }
}
