:root{color-scheme:dark;--bg:#303139;--panel:#1a1a1a;--card:#2c2c2e;--line:#414145;--text:#fff;--muted:#bdbdc3;--green:#16b43b;--gold:#ffcf37;--purple:#7740bf;--pink:#d500ec;--red:#eb263a}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 50% 15%,#3e3e49 0%,var(--bg) 60%,#19191a 100%);color:var(--text);font:18px/1.55 Arial,Tahoma,sans-serif;min-height:100vh}h1,h2,h3,h4,strong,b,label,a,p,button{color:var(--text)}h1,h2,h3,p{margin:0 0 16px}h1{font-size:clamp(30px,4vw,50px);line-height:1.25}h2{font-size:28px;line-height:1.35}h3{font-size:22px}a{overflow-wrap:anywhere}.top{padding:18px 4vw;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--line);background:#19191ae8}.brand{display:flex;align-items:center;gap:12px;font-size:27px;font-weight:800;text-decoration:none}.brand>span{line-height:1.15}.brand small{display:block;font-size:11px;letter-spacing:2px;color:var(--muted);margin-top:7px}.brand:first-letter{color:var(--gold)}.row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.spread{justify-content:space-between}.muted,.hint{color:var(--muted)}small{font-size:14px}.hint{font-size:15px;margin-top:14px}main{max-width:1360px;margin:0 auto;padding:16px 4vw 40px}.entry{max-width:680px;margin:30px auto}.panel{background:var(--panel);border:1px solid var(--line);border-radius:22px;padding:26px;box-shadow:0 8px 20px #0003;margin-bottom:20px}.hero{background:radial-gradient(ellipse at 90% 10%,#9a55e060,transparent 60%),linear-gradient(130deg,#17112b,#35204d);border:1px solid #8b56bf}.hero .kicker,.kicker{color:var(--gold);font-size:15px;font-weight:700;letter-spacing:.04em}.grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:24px}.layout>*,.grid>*{min-width:0}.room-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin:10px 0 24px}.room-code{font:800 26px/1.2 monospace;letter-spacing:4px;color:var(--gold)}button,.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;border:1px solid #7c7c82;border-radius:12px;background:linear-gradient(#707077,#44444c);box-shadow:0 3px 0 #101010;color:#fff;padding:11px 20px;font:700 17px/1.3 Arial,Tahoma,sans-serif;text-decoration:none;cursor:pointer}button:hover,.button:hover{filter:brightness(1.12)}button:disabled{cursor:default;opacity:.5}.primary{background:linear-gradient(#16b43b,#087326);border-color:#169737}.compact{font-size:14px;min-height:40px;padding:8px 12px}.danger{background:#5a2028;border-color:#a04050}.wide{width:100%}.ghost{background:transparent;box-shadow:none;border-color:var(--line)}input,select{display:block;width:100%;padding:14px;margin:7px 0 18px;border-radius:11px;border:1px solid #5b5b61;background:#101012;color:#fff;font:18px Arial,Tahoma,sans-serif;min-height:50px}input::placeholder{color:#aaa}label{display:block;font-size:17px;font-weight:700}input:focus,select:focus,button:focus-visible,a:focus-visible{outline:3px solid var(--gold);outline-offset:3px}#status{min-height:28px;color:var(--gold);margin:8px 4vw;font-size:16px}footer{padding:12px 4vw 24px;color:var(--muted);text-align:center;font-size:14px}.avatar{display:inline-flex;flex:none;width:48px;height:48px;border-radius:50%;background:linear-gradient(#77777c,#343437);border:2px solid #939398;align-items:center;justify-content:center;color:#fff;font-size:23px;font-weight:800;object-fit:cover}.players{list-style:none;padding:0;margin:0}.players li{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid #39393d}.players li:last-child{border:0}.player-name{display:block;color:#fff;font-weight:700;overflow-wrap:anywhere}.player-info{flex:1;min-width:0}.score{color:var(--gold);font-size:25px;font-weight:800;font-variant-numeric:tabular-nums}.rank{font-weight:700;color:var(--muted);width:24px}.badge{border:1px solid #b19448;color:var(--gold);padding:2px 8px;border-radius:20px;font-size:12px}.qr-card{text-align:center}.qr-card svg{width:100%;max-width:240px;height:auto;border-radius:8px;background:#fff}.qr-card .room-code{margin:12px 0}.timer{border:2px solid var(--gold);border-radius:50%;width:76px;height:76px;display:flex;align-items:center;justify-content:center;font-size:26px;font-weight:800;font-variant-numeric:tabular-nums;color:var(--gold);flex:none}.question{font-size:clamp(24px,3vw,40px);line-height:1.6;white-space:pre-line}.option{justify-content:flex-start;text-align:start;min-height:80px;font-size:21px;background:#333338;border-color:#62626a}.question-top{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:20px}.answer-letter{display:inline-grid;place-items:center;background:#5e398a;border-radius:8px;width:36px;height:36px;flex:none}.secret{border:2px solid #c68cf5;background:#29173c;padding:18px;border-radius:12px;font-size:26px;font-weight:800;color:#fff}.board{width:100%;aspect-ratio:10/7;background:#fff;border:3px solid #85858b;border-radius:16px;display:block;touch-action:none;user-select:none}.drawing-toolbar{margin:16px 0}.color-black{background:#151515}.color-red{background:#e03143}.color-blue{background:#166dd9}.color-green{background:#148a3c}.color-choice{width:45px;height:45px;border:2px solid #ddd;padding:0}.color-choice.selected{outline:3px solid var(--gold);outline-offset:2px}.big-letter{font-size:70px;font-weight:900;color:var(--gold);line-height:1.2}.success{color:#7fed9b}.result-stage{background:radial-gradient(ellipse at 50% 0%,#64338a66,transparent 70%),var(--panel)}.podium{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:end;gap:16px;margin:26px 0}.podium-card{background:linear-gradient(#37353d,#222125);border:1px solid #5d5268;border-radius:18px;padding:22px 12px;text-align:center}.podium-card:first-child{border:2px solid var(--gold);background:linear-gradient(#5e472b,#28201d);padding-top:35px}.podium-card .avatar{width:72px;height:72px;font-size:32px;margin:12px 0}.podium-card .score{font-size:40px;display:block}.podium-card .player-name{font-size:24px}.podium-card .position{color:var(--gold);font-weight:800}.gain{color:#7fed9b;font-size:16px;font-weight:700}.score-row{animation:arrive .5s ease-out both}.team-scores{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:20px 0}.team-score{padding:30px;text-align:center;background:#33213f;border:2px solid #78509b;border-radius:18px}.team-score:nth-child(2){background:#1d3b27;border-color:#438e5b}.team-score strong{display:block;font-size:70px;color:var(--gold)}details{margin:18px 0}summary{cursor:pointer;color:var(--muted)}pre{white-space:pre-wrap;overflow-wrap:anywhere}body.tv main{max-width:none;padding:12px 3vw 32px}body.tv .layout{grid-template-columns:minmax(0,1fr) 300px}body.tv .question{font-size:clamp(32px,3.1vw,64px)}body.tv .result-stage h1{font-size:clamp(36px,4vw,72px)}body.tv .result-layout{grid-template-columns:minmax(0,1fr)}body.tv .result-layout>aside{display:none}body.tv .result-stage{min-height:calc(100vh - 230px);padding:32px 5vw}body.tv .result-stage .podium-card .avatar{width:96px;height:96px}body.tv .result-stage .podium-card .player-name{font-size:clamp(24px,2.4vw,44px)}body.tv .result-stage .score{font-size:clamp(32px,3.3vw,64px)}body.tv .result-stage .players{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 32px}body.tv .result-stage .players .score{font-size:30px}body.tv .result-stage .players li{font-size:22px}body.tv .top{padding-block:12px}body.tv .result-stage .gain{font-size:22px}body.tv .timer{width:96px;height:96px;font-size:38px}.empty{padding:25px 0;color:var(--muted)}.photo-label{display:inline-block;position:relative;overflow:hidden;cursor:pointer}.photo-label input{position:absolute;width:1px;height:1px;opacity:0;min-height:0;padding:0;margin:0}.photo-label:focus-within{outline:3px solid var(--gold)}@keyframes arrive{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){*{animation:none!important;scroll-behavior:auto!important}}@media(max-width:850px){.layout,body.tv .layout{grid-template-columns:1fr}.top{align-items:flex-start;flex-wrap:wrap}.top .row{gap:6px}.grid{grid-template-columns:1fr}.panel{padding:20px}.room-heading{align-items:flex-start}.podium{gap:8px}.podium-card{padding:14px 8px}.podium-card .player-name{font-size:18px}.podium-card .avatar{width:52px;height:52px}.podium-card .score{font-size:30px}body.tv .result-stage .players{grid-template-columns:1fr}.brand{font-size:23px}}

#status:empty{display:none}
@media(min-width:851px){body.tv.show-results .room-heading,body.tv.show-results footer{display:none}body.tv.show-results main{padding:12px 24px}body.tv.show-results .result-stage{height:calc(100dvh - 112px);min-height:0;overflow:auto;margin:0;padding:18px 4vw}body.tv.show-results .result-stage h1{font-size:clamp(30px,3.4vw,58px);margin-bottom:8px;line-height:1.2}body.tv.show-results .result-stage>.kicker{margin-bottom:8px}body.tv.show-results .podium{margin:12px 0;gap:18px}body.tv.show-results .podium-card{padding:8px 12px;line-height:1.2}body.tv.show-results .podium-card .avatar{width:clamp(40px,6vh,72px);height:clamp(40px,6vh,72px);margin:5px 0}body.tv.show-results .podium-card .player-name{font-size:clamp(22px,2vw,34px);line-height:1.2}body.tv.show-results .podium-card .score{font-size:clamp(34px,4.5vh,64px);line-height:1.2}body.tv.show-results .podium-card .gain{font-size:16px;line-height:1.2}body.tv.show-results .podium-card .position{font-size:15px}body.tv.show-results .result-stage .players{gap:0 28px}body.tv.show-results .result-stage .players li{padding:8px 0;font-size:20px;min-height:66px}body.tv.show-results .result-stage .players .gain{font-size:14px}body.tv.show-results .result-stage .players .avatar{width:42px;height:42px}body.tv.show-results .result-stage details,body.tv.show-results .result-stage>.hint{display:none}}

.team-members{display:grid;gap:12px;text-align:start}.team-members .row{justify-content:center}.team-members .player-name{font-size:22px}
/* Rank movement: arrow + number, colour is only a second cue. */
.move{display:inline-flex;align-items:center;gap:2px;font-weight:800;font-size:.8em;padding:1px 8px;border-radius:999px;border:1px solid currentColor;margin-inline:6px;font-variant-numeric:tabular-nums}.move.up{color:#7fed9b}.move.down{color:#ff8a96}.move.same{color:var(--muted)}
/* TV stage (lobby + results): one screen, no scrolling, sized in viewport units so 720p, 1080p and 4K look the same. */
body.tv-stage{height:100dvh;overflow:hidden;display:flex;flex-direction:column}
body.tv-stage .top{padding:1vh 3vw;flex:none}body.tv-stage #status{position:fixed;inset-inline-start:3vw;bottom:1vh;margin:0;min-height:0;z-index:5}body.tv-stage footer#footnote{display:none}
body.tv-stage main{flex:1;min-height:0;max-width:none;width:100%;margin:0;padding:2vh 3vw 2.5vh;display:flex}
.tv-screen{flex:1;min-height:0;display:flex;flex-direction:column;gap:2vh;border-radius:2.4vh;border:1px solid #5d4a72;padding:2.5vh 3vw;background:radial-gradient(ellipse at 50% -10%,#7740bf55,transparent 65%),var(--panel)}
.tv-screen h1{font-size:6vh;line-height:1.15;margin:0}.tv-screen .kicker{font-size:2.3vh;margin:0 0 .6vh}.tv-sub{font-size:2.8vh;color:var(--muted);margin:0}
.tv-head{display:flex;justify-content:space-between;align-items:flex-end;gap:3vw;flex:none}.tv-tag{display:flex;flex-direction:column;align-items:flex-end;gap:.5vh;font-size:2.4vh;color:var(--muted)}.tv-tag .room-code{font-size:3.4vh}
/* Podium: 1st in the centre and tallest. Grid areas follow dir, so RTL still centres 1st. */
.tv-podium{flex:1;min-height:0;display:grid;grid-template-rows:minmax(0,1fr);grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:"p2 p1 p3";align-items:end;gap:2.5vw}





.tv-rest{flex:none;list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.2vh 2vw}
.tv-rest li{display:flex;align-items:center;gap:1vw;background:#26252b;border:1px solid #444049;border-radius:1.6vh;padding:.6vh 1.2vw;font-size:2.7vh;min-width:0}.tv-rest .rank{width:auto;color:var(--muted);font-weight:800}.tv-rest .avatar{width:5.5vh;height:5.5vh;font-size:2.8vh}.tv-rest .player-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tv-rest .gain{font-size:2.2vh}.tv-rest .score{font-size:3.6vh}
.tv-foot{flex:none;display:flex;justify-content:space-between;align-items:center;gap:3vw;font-size:2.4vh}.tv-foot p{margin:0}.tv-reveal{font-size:2.8vh}.tv-reveal strong{color:var(--gold)}
/* Charades: two big team panels. */
.tv-teams{flex:1;min-height:0;display:grid;grid-template-columns:1fr 1fr;gap:3vw}
.tv-team{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2vh;border-radius:2.4vh;padding:3vh 2vw;background:#33213f;border:3px solid #78509b;min-height:0;overflow:hidden}.tv-team.team-1{background:#1d3b27;border-color:#438e5b}.tv-team.lead{border-color:var(--gold);box-shadow:0 0 6vh #ffcf3733}
.tv-team h2{font-size:5vh;margin:0}.tv-team .score{font-size:22vh;line-height:1}
/* Lobby: QR on one side, player wall on the other. */
.tv-lobby{flex-direction:row;align-items:stretch;gap:4vw}
.tv-qr{flex:none;width:min(42vh,36vw);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.5vh;text-align:center}.tv-qr svg{width:100%;height:auto;background:#fff;border-radius:2vh}.tv-qr .room-code{font-size:6vh;letter-spacing:.6vh}.tv-qr p{font-size:2.8vh;margin:0}
.tv-lobby-main{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:2vh}
.tv-roster{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:1.5vh 1.5vw}.tv-roster li{display:flex;align-items:center;gap:1vw;background:#00000040;border:1px solid #ffffff22;border-radius:999px;padding-block:.8vh;padding-inline:.8vh 2vw;font-size:3.2vh}.tv-roster .avatar{width:7vh;height:7vh;font-size:3.4vh}
.tv-team .tv-roster{justify-content:center}.tv-team .tv-roster li{font-size:2.8vh}
@media(max-aspect-ratio:1/1){.tv-lobby{flex-direction:column}.tv-qr{width:min(60vw,40vh);margin:0 auto}.tv-rest{grid-template-columns:1fr}}

/* Podium cards size their content from the card itself (container units), so nothing clips on any screen shape. */
.tv-card{container-type:size;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2cqh;text-align:center;border-radius:2.4vh;padding:4cqh 1.2vw;background:linear-gradient(#37353d,#222125);border:2px solid #5d5268;min-height:0;min-width:0;overflow:hidden}
.tv-card.place-1{grid-area:p1;height:100%;border-color:var(--gold);background:linear-gradient(#6a4f2c,#28201d);box-shadow:0 0 6vh #ffcf3733}.tv-card.place-2{grid-area:p2;height:88%}.tv-card.place-3{grid-area:p3;height:78%}
.tv-card .position{font-size:min(8cqh,9cqw);line-height:1;font-weight:800;color:var(--gold);display:flex;align-items:center;gap:4px}
.tv-card .avatar{width:min(30cqh,45cqw);height:min(30cqh,45cqw);font-size:min(15cqh,22cqw);border-width:max(2px,.6cqh);margin:0}
.tv-card .player-name{font-size:min(10cqh,11cqw);line-height:1.1;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-card .score{font-size:min(22cqh,26cqw);line-height:1}
.tv-card .gain{font-size:min(6.5cqh,7cqw);line-height:1}
.tv-card .move{font-size:.75em}
/* Rest-of-field rows: names win. Columns adapt to width; tight rows drop the "+gain" label first. */
.tv-rest{grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr))}
.tv-rest li{container-type:inline-size}
.tv-rest .player-name{min-width:4em}
@container (max-width:330px){.tv-rest li .gain{display:none}.tv-rest li .move{padding:0 5px;margin-inline:2px}}
.tv-rest{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:.8vh 1.2vw}
@media(max-height:820px){.tv-rest li{padding:.3vh .8vw;font-size:clamp(13px,2.4vh,22px)}.tv-rest .avatar{width:4.6vh;height:4.6vh;font-size:2.2vh}.tv-rest .score{font-size:clamp(15px,3vh,26px)}.tv-screen{gap:1.2vh;padding:1.8vh 2.5vw}.tv-screen h1{font-size:5vh}}
/* Fixed column counts by width (auto-fit made tiny cells on wide TVs). */
.tv-rest{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:900px){.tv-rest{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.tv-rest{grid-template-columns:1fr}}
/* Portrait / narrow screens (phone or iPad held upright showing the TV view):
   stack the header, give the podium a real height, and let the page scroll instead of squeezing. */
@media (max-aspect-ratio: 4/5), (max-width: 700px) {
  body.tv-stage{height:auto;min-height:100dvh;overflow:auto}
  body.tv-stage main{display:block;padding:12px 16px 24px}
  .tv-screen{display:flex;gap:16px;padding:18px 16px;border-radius:18px}
  .tv-screen h1{font-size:clamp(26px,7vw,48px)}
  .tv-screen .kicker{font-size:clamp(13px,3.4vw,18px)}
  .tv-head{flex-direction:column;align-items:flex-start;gap:8px}
  .tv-tag{flex-direction:row;align-items:center;gap:12px;font-size:clamp(13px,3.4vw,18px)}
  .tv-tag .room-code{font-size:clamp(18px,5vw,28px)}
  .tv-podium{flex:none;height:clamp(240px,42vh,520px);gap:10px}
  .tv-rest{grid-template-columns:1fr;gap:8px}
  .tv-rest li{padding:8px 12px;font-size:clamp(15px,4.2vw,22px)}
  .tv-rest .avatar{width:40px;height:40px;font-size:18px}
  .tv-rest .score{font-size:clamp(18px,5vw,28px)}
  .tv-foot{flex-direction:column;align-items:flex-start;gap:8px;font-size:clamp(14px,3.8vw,18px)}
  .tv-reveal{font-size:clamp(15px,4vw,20px)}
  .tv-teams{grid-template-columns:1fr;flex:none}
  .tv-team .score{font-size:clamp(64px,18vw,140px)}
  .tv-team h2{font-size:clamp(22px,6vw,36px)}
  .tv-lobby{flex-direction:column;align-items:center}
  .tv-qr{width:min(70vw,360px)}
  .tv-qr .room-code{font-size:clamp(28px,8vw,48px)}
  .tv-roster li{font-size:clamp(15px,4.2vw,22px)}
  .tv-roster .avatar{width:40px;height:40px;font-size:18px}
}
@media (max-aspect-ratio: 4/5), (max-width: 700px) {
  .tv-podium{height:clamp(230px,36vh,480px)}
  .tv-card{padding:3cqh 6px;gap:2.5cqh}
  .tv-card .position{font-size:min(8cqh,13cqw)}
  .tv-card .avatar{width:min(28cqh,60cqw);height:min(28cqh,60cqw);font-size:min(14cqh,28cqw)}
  .tv-card .player-name{font-size:min(10cqh,16cqw)}
  .tv-card .score{font-size:min(20cqh,32cqw)}
  .tv-card .gain{font-size:min(6cqh,10cqw);white-space:nowrap}
}
.tv-help{text-align:start;margin-top:16px;padding:16px;border-radius:14px;background:#26213a;border:1px solid #6b4fa0}.tv-help h3{margin-bottom:10px}.tv-help ol{padding-inline-start:20px;margin:0 0 12px}.tv-help li{margin-bottom:10px;font-size:15px;line-height:1.5}.tv-help code{display:inline-block;max-width:100%;overflow-wrap:anywhere;font-size:12px;background:#0006;padding:4px 6px;border-radius:6px;margin-top:4px}
