/* TV / host screen. Everything is sized in rem; rem scales with the screen. */
html.tv { font-size: clamp(11px, 1vw, 40px); }
@media (max-aspect-ratio: 4/3) { html.tv { font-size: clamp(11px, 1.35vw, 40px); } }
.tv body { overflow: hidden; }

.splash {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2rem; text-align: center; z-index: 5; padding: 2rem;
}
.sunburst {
  position: absolute; width: 140vmax; height: 140vmax; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(rgba(255, 255, 255, .06) 0 8deg, transparent 8deg 16deg);
  animation: spin 60s linear infinite; z-index: -1; border-radius: 50%;
}
.splash-logo { font-size: 13rem; margin: 0; }
.splash-sub { font-size: 2rem; max-width: 50rem; margin: 0; }
.splash-hint { opacity: .75; font-size: 1.3rem; }

#app { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; z-index: 1; }
.tv-top { display: flex; align-items: center; gap: 2rem; padding: 1.2rem 2.4rem .4rem; }
.tv-logo { font-size: 3.4rem; }
.top-join { flex: 1; display: flex; justify-content: center; }
.top-join .pill {
  font-family: var(--head); font-size: 2rem; background: var(--paper); color: var(--ink); border: 4px solid var(--ink);
  border-radius: 999px; padding: .2rem 1.4rem; box-shadow: var(--shadow-sm);
}
.top-join .pill b { color: var(--pink); letter-spacing: .08em; }
.top-right { display: flex; align-items: center; gap: 1rem; font-size: 1.1rem; }
.icon-btn { background: none; border: none; font-size: 2rem; cursor: pointer; opacity: .8; }
.icon-btn:hover { opacity: 1; transform: rotate(30deg); }
.stage { position: relative; padding: 0 2.4rem 2rem; min-height: 0; }

/* Host caption bubble */
.caption {
  position: fixed; left: 2rem; bottom: 1.6rem; max-width: 46rem; display: flex; gap: 1rem; align-items: flex-start;
  background: var(--ink); color: #fff; border: 4px solid #fff; border-radius: 26px 26px 26px 6px; padding: .9rem 1.4rem;
  font-size: 1.45rem; box-shadow: 6px 6px 0 rgba(0, 0, 0, .35); transform: translateY(160%); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1);
  z-index: 20;
}
.caption.show { transform: none; }
.caption b { font-family: var(--head); font-weight: 400; color: var(--yellow); font-size: 1.1rem; letter-spacing: .05em; }
.caption p { margin: .15rem 0 0; line-height: 1.3; }
.caption-mic { font-size: 2.2rem; }

/* Countdown ring */
.timer { position: fixed; right: 2.2rem; bottom: 1.8rem; width: 8.5rem; height: 8.5rem; z-index: 20; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .track { fill: var(--paper); stroke: var(--ink); stroke-width: 9; }
.timer .arc { fill: none; stroke: var(--teal); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 276.5; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer.low .arc { stroke: var(--red); }
.timer.low { animation: wiggle .5s ease-in-out infinite; }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 3.4rem; color: var(--ink); }

.conn { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: .4rem 1.2rem; border-radius: 999px; border: 3px solid var(--ink); z-index: 30; }

/* Settings */
.settings { max-width: 40rem; width: 90vw; font-size: 1.2rem; }
.settings::backdrop { background: rgba(10, 4, 20, .6); }
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .7rem 0; }
.settings .row select { max-width: 60%; }
.settings .row input[type=range] { width: 55%; }
.settings .buttons { flex-wrap: wrap; justify-content: flex-end; margin-top: 1.4rem; }
.settings .btn { font-size: 1.1rem; }
.small { font-size: .95rem; opacity: .75; font-weight: 700; }

/* ---------------------------------------------------------------- lobby */
.lobby { height: 100%; display: grid; grid-template-columns: 23rem 1fr 25rem; gap: 2.2rem; align-items: start; }
.join-card { text-align: center; }
.join-card .step { font-size: 1.25rem; margin: 0 0 .4rem; color: var(--muted); }
.join-card .url { font-family: var(--head); font-size: 2.1rem; color: var(--ink); word-break: break-all; line-height: 1.1; }
.join-card .code-label { margin-top: 1rem; font-size: 1.15rem; color: var(--muted); }
.join-card .code { font-family: var(--head); font-size: 6.4rem; letter-spacing: .12em; color: var(--pink); line-height: 1; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.qr { background: #fff; border: 4px solid var(--ink); border-radius: 16px; padding: .6rem; margin: 1rem auto 0; width: 15rem; height: 15rem; }
.qr svg { width: 100%; height: 100%; display: block; }

.center-col { display: flex; flex-direction: column; gap: 1.3rem; min-width: 0; }
.players-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0; }
.players-title h2 { font-family: var(--head); font-weight: 400; font-size: 2.6rem; margin: 0; text-shadow: 3px 3px 0 var(--ink); }
.players-title span { font-size: 1.3rem; opacity: .85; }
.players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6rem 1rem; margin-top: 1.4rem; }
.pslot { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.pslot .avatar { width: 5.4rem; height: 5.4rem; }
.pslot .nm { font-size: 1.35rem; background: var(--ink); padding: .1rem .8rem; border-radius: 999px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pslot.off { opacity: .4; }
.pslot.empty .ghost { width: 5.4rem; height: 5.4rem; border: 4px dashed rgba(255, 255, 255, .35); border-radius: 50%; display: grid; place-items: center; font-size: 2rem; opacity: .6; }
.pslot .kick { font-size: .9rem; background: none; border: none; color: #fff; opacity: 0; cursor: pointer; }
.pslot:hover .kick { opacity: .7; }
.audience-line { font-size: 1.2rem; opacity: .85; }

.games { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.game-card { cursor: pointer; position: relative; transition: transform .15s; padding: 1.1rem 1.3rem; }
.game-card:hover { transform: translateY(-4px) rotate(-.6deg); }
.game-card h3 { font-size: 2.2rem; margin: 0 0 .3rem; }
.game-card p { margin: 0; font-size: 1.2rem; color: var(--muted); }
.game-card.sel { outline: 6px solid var(--yellow); outline-offset: 4px; }
.game-card .stripe { position: absolute; inset: 0 auto 0 0; width: 1.1rem; border-radius: 18px 0 0 18px; }
.game-card .tag { position: absolute; top: -1rem; right: 1rem; font-size: 1rem; }
.game-card .inner { padding-left: 1rem; }

.start-row { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.start-row .hint { font-size: 1.2rem; opacity: .85; }
.settings-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; font-size: 1rem; }
.settings-row select { width: auto; font-size: 1rem; }
.settings-row .btn.mini { font-size: 1rem; padding: .25rem .8rem; border-width: 3px; }
.settings-row label { display: inline-flex; gap: .5rem; align-items: center; background: rgba(0, 0, 0, .25); padding: .3rem .8rem; border-radius: 12px; }

.side { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.tabs { display: flex; gap: .5rem; }
.tabs button { flex: 1; font-family: var(--head); font-size: 1.15rem; padding: .4rem; border-radius: 14px; border: 3px solid var(--ink); background: rgba(255, 255, 255, .2); color: #fff; cursor: pointer; }
.tabs button.on { background: var(--yellow); color: var(--ink); }
.side .card { font-size: 1.15rem; max-height: 50vh; overflow: hidden; }
.side h3 { font-size: 1.7rem; }
.rowlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.rowlist li { display: flex; align-items: center; gap: .7rem; }
.rowlist .avatar { width: 2.4rem; height: 2.4rem; flex: none; }
.rowlist .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlist .num { font-family: var(--head); color: var(--pink); }
.lore-item { border-bottom: 3px dashed rgba(26, 15, 46, .15); padding: .4rem 0; }
.lore-item:last-child { border: none; }
.lore-item b { display: block; font-size: 1.25rem; }
.lore-item small { color: var(--muted); font-weight: 700; }
.heat { color: var(--orange); letter-spacing: -.1em; }
.quote { font-style: italic; }
.empty-note { color: var(--muted); font-weight: 700; }
.podium-mini { display: flex; align-items: flex-end; justify-content: center; gap: .8rem; margin: 2rem 0 1rem; }
.podium-mini .p { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.podium-mini .blk { background: var(--ink); color: var(--yellow); font-family: var(--head); width: 4.6rem; display: grid; place-items: center; border-radius: 10px 10px 0 0; }
.podium-mini .avatar { width: 3.4rem; height: 3.4rem; }

.start-row .btn.mini { font-size: 1.1rem; padding: .35rem .9rem; border-width: 3px; }
.room-settings { font-size: 1.05rem; padding: .9rem 1.2rem; }
.room-settings h3 { font-size: 1.4rem; margin-bottom: .5rem; }
.room-settings label { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: .35rem 0; }
.room-settings select { width: auto; font-size: 1rem; }
.room-settings input[type=checkbox] { width: 1.3rem; height: 1.3rem; }
.side .card.room-settings { max-height: none; overflow: visible; }

/* More games installed -> smaller picker cards so Start stays on screen. */
.games.many { grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.games.many .game-card { padding: .8rem 1rem; }
.games.many .game-card h3 { font-size: 1.6rem; }
.games.many .game-card p { font-size: .95rem; }
.games.lots { grid-template-columns: repeat(4, 1fr); }
.games.lots .game-card p { display: none; }
.games.lots .game-card.sel p { display: block; }
.games.many .game-card .tag { font-size: .8rem; top: -1.3rem; right: .4rem; padding: .1rem .5rem; }
