/* TV / stream screen. A fixed 1920x1080 (or 1080x1920 vertical) stage scaled to the window. */
body.tv { height: 100vh; }

.stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform-origin: center center;
}
.vertical .stage { width: 1080px; height: 1920px; }

/* header */
.tv-head { position: absolute; left: 40px; right: 40px; top: 22px; height: 100px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.tv-head #logo { font-size: 46px; }
.playat { display: flex; flex-direction: column; font-size: 18px; color: var(--grey); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.playat strong { color: var(--ink); font-size: 30px; letter-spacing: 0; text-transform: none; font-weight: 700; }
.clock { justify-self: end; display: flex; align-items: center; gap: 12px; color: var(--red); font-weight: 800; font-size: 54px; font-variant-numeric: tabular-nums; }
.clock-icon svg { width: 46px; height: 46px; display: block; }
.clock small { font-size: 18px; color: var(--grey); font-weight: 600; align-self: flex-end; margin-bottom: 10px; letter-spacing: .08em; text-transform: uppercase; }
.clock.urgent { animation: pulse .5s infinite; }

/* players: one compact column on the left */
.players { position: absolute; left: 40px; top: 136px; width: 380px; display: flex; flex-direction: column; gap: 4px; }
.pl {
  display: grid; grid-template-columns: 44px 1fr auto 30px; align-items: center; gap: 10px;
  padding: 3px 8px 3px 4px; height: 50px; border-radius: 10px;
  transition: background .3s;
  animation: feedIn .4s ease-out;
}
.pl .avatar { width: 44px; height: 44px; border-radius: 9px; }
.pl .nm { font-family: var(--hand); font-size: 25px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .ribbon { font-size: 16px; }
.pl .ic { color: var(--red); display: grid; place-items: center; }
.pl .ic svg { width: 26px; height: 26px; }
.pl.got { background: rgba(210,35,42,.08); }
.pl.got .ic { animation: pop .4s; }
.pl.draw { background: #fff; box-shadow: 0 0 0 2px var(--red); }
.pl .streak { font-family: var(--sans); font-size: 14px; color: #c46a00; font-weight: 800; margin-left: 6px; }
.more { font-size: 17px; color: var(--grey); padding: 4px 10px; font-weight: 600; }

/* canvas */
.canvas-wrap { position: absolute; left: 450px; top: 136px; width: 1020px; }
.canvas-card { position: relative; width: 1020px; height: 765px; overflow: hidden; }
.canvas-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hint { font-size: 60px; margin-top: 22px; min-height: 80px; }
.substatus { text-align: center; color: var(--grey); font-size: 20px; font-weight: 600; letter-spacing: .04em; margin-top: 2px; }
.substatus b { color: var(--red); }
.badge-mult {
  position: absolute; right: 18px; top: 16px; font-weight: 800; font-size: 26px; color: #fff;
  background: var(--red); border-radius: 8px; padding: 4px 12px; display: none;
}
.badge-mult.on { display: block; animation: pop .4s; }

/* overlays inside the canvas */
.overlay { position: absolute; inset: 0; display: none; place-items: center; text-align: center; background: rgba(255,255,255,.94); }
.overlay.on { display: grid; animation: feedIn .3s; }
.ov-title { font-size: 30px; color: var(--grey); font-weight: 300; letter-spacing: .02em; }
.ov-title b { color: var(--ink); font-weight: 700; }
.ov-name { font-family: var(--hand); font-size: 78px; color: var(--red); line-height: 1; margin-top: 8px; }
.ov-avatar { animation: pop .6s; margin: 18px auto 0; }
.ov-avatar .avatar { width: 170px; height: 170px; border-radius: 22px; }
.choose-cards { display: flex; gap: 26px; justify-content: center; margin-top: 34px; }
.choose-cards span {
  width: 150px; height: 96px; border-radius: 12px; background: #9b9b9b; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 34px;
  animation: wiggle 1.2s infinite ease-in-out;
}
.choose-cards span:nth-child(2) { animation-delay: .2s; background: #858585; }
.choose-cards span:nth-child(3) { animation-delay: .4s; background: var(--red); }
@keyframes wiggle { 50% { transform: translateY(-10px) rotate(-2deg); } }

.reveal-word { font-family: var(--hand); font-size: 128px; color: var(--red); line-height: 1; animation: pop .5s; }
.reveal-sub { font-size: 24px; color: var(--grey); margin-top: 10px; }
.reveal-sub b { color: var(--ink); }
.podium { display: flex; gap: 36px; justify-content: center; margin-top: 30px; align-items: flex-end; }
.podium div { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: pop .5s backwards; }
.podium div:nth-child(1) { animation-delay: .25s; } .podium div:nth-child(2) { animation-delay: .45s; } .podium div:nth-child(3) { animation-delay: .65s; }
.podium .avatar { width: 96px; height: 96px; }
.podium .first .avatar { width: 124px; height: 124px; animation: glow 1.2s infinite; }
.podium .nm { font-family: var(--hand); font-size: 30px; }
.podium .pts { font-weight: 800; color: var(--red); font-size: 22px; }
.nobody { font-size: 40px; color: var(--grey); margin-top: 26px; font-family: var(--hand); }

/* qr */
.qr-box { position: absolute; left: 40px; bottom: 34px; width: 380px; display: flex; gap: 18px; align-items: center; background: #fff; padding: 16px; border-radius: 10px; box-shadow: 0 6px 22px rgba(0,0,0,.08); }
.qr-box img { width: 150px; height: 150px; display: block; }
.qr-box strong { display: block; font-family: var(--hand); color: var(--red); font-size: 38px; line-height: 1; }
.qr-box span { color: var(--grey); font-size: 17px; font-weight: 600; }

/* chat: right column, newest at the bottom */
.chat-box { position: absolute; right: 40px; top: 136px; bottom: 34px; width: 380px; display: flex; flex-direction: column;
  background: rgba(255,255,255,.55); border-radius: 12px; padding: 14px 14px 10px; }
.chat-box h3 { margin: 0 0 8px; font-size: 15px; color: var(--grey); text-transform: uppercase; letter-spacing: .14em; display: flex; align-items: center; gap: 8px; }
.chat-box h3::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.chat { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; overflow: hidden; }
.chat li { display: flex; align-items: flex-start; gap: 9px; animation: chatIn .3s ease-out; }
.chat .avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; margin-top: 2px; }
.chat li > div { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.chat b { font-size: 15px; font-weight: 700; color: #555; }
.chat .bubble { margin-top: 2px; background: #fff; border-radius: 4px 14px 14px 14px; padding: 4px 12px 5px; font-family: var(--hand);
  font-size: 25px; line-height: 1.15; box-shadow: 0 1px 2px rgba(0,0,0,.08); max-width: 320px; overflow-wrap: anywhere; }
.chat .c-got .bubble { background: var(--red); color: #fff; font-family: var(--sans); font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 6px; padding: 6px 12px; }
.chat .c-got .bubble svg { width: 18px; height: 18px; }
.chat .c-got em { font-style: normal; background: var(--gold); color: #3a2a00; border-radius: 4px; padding: 0 5px; font-size: 13px; font-weight: 800; }
.chat .c-got i { font-style: normal; color: #ffe08a; }
.chat .c-sys { font-size: 15px; color: var(--grey); padding-left: 39px; }
.chat .c-sys b { color: var(--grey); }
.chat .c-artist { color: var(--red); align-items: center; }
.chat .c-artist svg { width: 16px; height: 16px; flex: none; }
@keyframes chatIn { from { opacity: 0; transform: translateY(10px); } }

/* timer bar */
.timerbar { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(0,0,0,.05); }
.timerbar div { height: 100%; background: var(--red); width: 0; transition: width .25s linear; }

/* ---------- battle splashes (winner + lobby) ---------- */
.splash { position: absolute; inset: 0; z-index: 20; background: rgba(239,238,234,.97); animation: feedIn .4s; overflow: hidden; }
.splash[hidden] { display: none; }
.clock small { line-height: 1.1; text-align: right; }

.ov-battle { font-family: 'Lilita One', var(--sans); font-size: 44px; color: #fff; background: var(--red); display: inline-block;
  padding: 4px 22px; border-radius: 12px; margin-bottom: 18px; animation: pop .5s; }

/* winner */
.splash.winner { display: grid; grid-template-columns: 1fr 560px; gap: 40px; padding: 150px 90px 60px;
  background: radial-gradient(circle at 32% 48%, #fff 0%, #f4efe6 35%, #e8e2d8 100%); }
.splash.winner::before { content: ''; position: absolute; inset: -400px; z-index: -1;
  background: repeating-conic-gradient(from 0deg at 32% 50%, rgba(210,35,42,.10) 0 7deg, transparent 7deg 18deg);
  animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.w-main { text-align: center; position: relative; }
.w-title { font-family: 'Lilita One', var(--sans); font-size: 64px; color: var(--ink); letter-spacing: 1px; }
.w-title b { color: var(--red); font-weight: 400; }
.w-crown { font-size: 120px; line-height: 1; margin-top: 10px; animation: crown 1.4s ease-in-out infinite; }
@keyframes crown { 50% { transform: translateY(-14px) rotate(-6deg); } }
.w-avatar { margin-top: -14px; animation: pop .7s; }
.w-avatar .avatar { width: 230px; height: 230px; border-radius: 36px; background: #fff; box-shadow: 0 0 0 8px var(--gold), 0 20px 50px rgba(0,0,0,.25); animation: glow 1.4s infinite; }
.w-name { font-family: var(--hand); font-size: 110px; color: var(--red); line-height: 1; margin-top: 24px; text-shadow: 0 4px 0 #fff; animation: pop .6s .2s backwards; }
.w-pts { display: inline-block; margin-top: 16px; font: 800 38px var(--sans); background: var(--gold); color: #3a2a00; padding: 6px 26px; border-radius: 14px; animation: pop .6s .4s backwards; }
.w-list { background: rgba(255,255,255,.85); border-radius: 18px; padding: 26px 30px; align-self: center; box-shadow: 0 12px 40px rgba(0,0,0,.1); }
.w-list h3 { margin: 0 0 14px; font-size: 18px; color: var(--grey); text-transform: uppercase; letter-spacing: .12em; }
.w-row { display: grid; grid-template-columns: 54px 48px 1fr auto; gap: 14px; align-items: center; height: 62px; animation: feedIn .4s backwards; }
.w-row:nth-child(n) { animation-delay: calc(var(--i, 0) * 60ms); }
.w-pos { font-family: var(--hand); font-size: 36px; color: var(--red); text-align: center; }
.w-row .avatar { width: 48px; height: 48px; }
.w-nm { font-family: var(--hand); font-size: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-sc { font-weight: 800; font-size: 22px; }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.confetti i { position: absolute; top: -30px; width: 14px; height: 22px; border-radius: 3px; animation: fall linear infinite; }
@keyframes fall { to { top: 110%; transform: translateX(80px) rotate(720deg); } }

/* lobby */
.splash.lobby { display: grid; grid-template-rows: auto 1fr; padding: 130px 70px 50px; gap: 26px; }
.l-head { text-align: center; }
.l-title { font-size: 40px; font-weight: 300; color: var(--grey); }
.l-count { font-family: 'Lilita One', var(--sans); font-size: 230px; line-height: .95; color: var(--red); text-shadow: 0 10px 0 #8f1015, 0 18px 40px rgba(0,0,0,.2); }
.l-count.beat { animation: beat .5s; }
@keyframes beat { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
.l-sub { font-size: 24px; color: var(--grey); font-weight: 600; margin-top: 6px; }
.l-body { display: grid; grid-template-columns: 1fr 380px; gap: 40px; min-height: 0; }
.l-players h3 { margin: 0 0 16px; font-size: 22px; color: var(--grey); text-transform: uppercase; letter-spacing: .1em; }
.l-players h3 span { color: var(--red); font-size: 34px; }
.l-grid { display: flex; flex-wrap: wrap; gap: 14px; align-content: flex-start; }
.l-card { width: 128px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.l-card .avatar { width: 74px; height: 74px; border-radius: 16px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.l-card span { font-family: var(--hand); font-size: 21px; max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-card.new { animation: pop .6s; }
.l-card.new .avatar { box-shadow: 0 0 0 4px var(--gold), 0 4px 12px rgba(0,0,0,.08); }
.l-qr { background: #fff; border-radius: 18px; padding: 26px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.1); align-self: start; }
.l-qr img { width: 300px; height: 300px; display: block; margin: 0 auto; }
.l-qr strong { display: block; font-family: var(--hand); color: var(--red); font-size: 52px; margin-top: 10px; }
.l-qr span { color: var(--grey); font-size: 21px; font-weight: 600; }

.sound-prompt { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 50; border: 0; background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 30px; font-weight: 700; }

/* ---------- vertical layout (TikTok / Shorts) ---------- */
.vertical .tv-head { height: 130px; grid-template-columns: 1fr auto; grid-template-areas: "logo clock" "play play"; }
.vertical .tv-head #logo { grid-area: logo; justify-self: start; font-size: 52px; }
.vertical .clock { grid-area: clock; }
.vertical .playat { display: none; }
.vertical .canvas-wrap { left: 30px; top: 170px; width: 1020px; }
.vertical .players { top: 1090px; left: 30px; width: 1020px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.vertical .qr-box { left: 30px; bottom: 40px; width: 500px; }
.vertical .qr-box img { width: 190px; height: 190px; }
.vertical .chat-box { right: 30px; top: auto; bottom: 40px; width: 490px; height: 300px; }
.vertical .splash.winner { grid-template-columns: 1fr; padding: 170px 50px 40px; }
.vertical .splash.lobby { padding: 170px 40px 40px; }
.vertical .l-body { grid-template-columns: 1fr; }
.vertical .l-qr { display: flex; gap: 24px; align-items: center; text-align: left; }
.vertical .l-qr img { width: 220px; height: 220px; margin: 0; }
