/*
 * My Company Trivia: the game itself. Host big screen, players' phones, join pages.
 * Every colour and font comes from the theme variables at the bottom of this file.
 */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 400; font-display: swap; src: url(fonts/bricolage-grotesque-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700 900; font-display: swap; src: url(fonts/bricolage-grotesque-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700 900; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 400; font-display: swap; src: url(fonts/chakra-petch-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 700 900; font-display: swap; src: url(fonts/chakra-petch-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Patrick Hand'; font-weight: 400 900; font-display: swap; src: url(fonts/patrick-hand-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Righteous'; font-weight: 400 900; font-display: swap; src: url(fonts/righteous-latin-400-normal.woff2) format('woff2'); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 17px/1.45 var(--font-body); -webkit-tap-highlight-color: transparent; }
h1, .q-prompt, .lobby-code, .lobby-site, .board-title, .result-big, .msg-big, .pod-name, .timer, .p-prompt, .sp-q, .join-title { font-family: var(--font-display); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.mark { width: 30px; height: 30px; flex-shrink: 0; }
.ltr { display: inline-grid; place-items: center; flex-shrink: 0; width: 1.7em; height: 1.7em; border-radius: .35em; background: rgba(255, 255, 255, .24); font-weight: 900; line-height: 1; font-family: var(--font-display); }
.t0 { --c: var(--a0); } .t1 { --c: var(--a1); } .t2 { --c: var(--a2); }
.t3 { --c: var(--a3); } .t4 { --c: var(--a4); } .t5 { --c: var(--a5); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Answer tiles. "Solid" themes fill the tile with colour; "card" themes use a coloured edge and letter. */
.tile, .p-tile, .sp-opt { background: var(--c); color: var(--tile-ink); border-radius: var(--radius); }
.tiles-card .tile, .tiles-card .p-tile, .tiles-card .sp-opt { background: var(--surface); color: var(--text); border: 2px solid var(--line); border-left: 12px solid var(--c); box-shadow: none; }
.tiles-card .ltr { background: var(--c); color: var(--tile-ink); }

/* ---------- join and start pages ---------- */
.join-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px 48px; gap: 26px; }
.join-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.join-card { width: 100%; max-width: 380px; background: #fff; color: #17181B; border-radius: 20px; padding: 26px 22px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .5); font-family: var(--font-body); }
.join-card-wide { max-width: 520px; }
.join-card label { display: block; font-weight: 700; margin-bottom: 8px; }
.join-card p { margin: 0 0 14px; }
.join-title { margin: 0 0 10px; font-size: 1.5rem; line-height: 1.2; }
.join-code, .join-name { width: 100%; font: inherit; font-size: 28px; font-weight: 800; text-align: center; padding: 12px; border: 2px solid #CFCCC4; border-radius: 12px; color: #17181B; margin-bottom: 14px; letter-spacing: .08em; }
.join-name { font-size: 22px; letter-spacing: 0; }
.join-code:focus, .join-name:focus { border-color: #1F5FD1; outline: none; }
.join-btn { display: block; width: 100%; padding: 15px; border: 0; border-radius: 12px; background: #17181B; color: #fff; font: inherit; font-weight: 700; font-size: 19px; text-align: center; text-decoration: none; cursor: pointer; }
.join-btn:hover { background: #000; }
.join-err { background: #FEF3F2; color: #B42318; border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.join-small { font-size: 14px; color: #5B6170; margin-top: 12px !important; }
.join-game { font-size: 15px; color: #5B6170; }

/* ---------- player phone ---------- */
.play { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.play-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--surface); font-weight: 700; }
.play-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-score { background: var(--bg); padding: 4px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.play-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); gap: 16px; }
.play-wait, .msg-box { text-align: center; }
.msg-big { font-size: 30px; font-weight: 800; margin: 0 0 8px; }
.msg-small { color: var(--muted); margin: 0; }
.p-q { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.p-q-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; }
.p-timer { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.p-prompt { font-size: 20px; font-weight: 700; margin: 0; }
.p-ready { display: none; font-size: 26px; font-weight: 800; text-align: center; margin: 12px 0; font-family: var(--font-display); }
.is-ready .p-ready { display: block; animation: pulse 1s ease-in-out infinite alternate; }
.is-ready .p-tiles, .is-ready .p-typed, .is-ready .p-submit, .is-ready .p-hint { visibility: hidden; }
.p-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 40vh; }
.p-tiles-2 { grid-template-columns: 1fr; }
.p-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 0; font: inherit; font-weight: 700; font-size: 17px; padding: 12px 8px; cursor: pointer; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18); text-align: center; overflow-wrap: anywhere; }
.p-tile .ltr { font-size: 22px; }
.p-tile:active { transform: translateY(2px); }
.p-tile.is-picked { outline: 4px solid var(--text); outline-offset: -4px; }
.p-hint { color: var(--muted); text-align: center; margin: 0; font-size: 15px; }
.p-submit { display: block; width: 100%; padding: 15px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 800; font-size: 19px; cursor: pointer; text-align: center; text-decoration: none; margin-top: 8px; }
.p-submit:disabled { opacity: .4; }
.p-typed { display: flex; flex-direction: column; gap: 10px; }
.p-typed input { font: inherit; font-size: 22px; padding: 14px; border-radius: 12px; border: 0; text-align: center; }
.p-img { display: block; max-width: 100%; max-height: 24vh; margin: 0 auto; border-radius: 12px; }
.p-media { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.p-media video { width: 100%; max-height: 34vh; border-radius: 12px; background: #000; }
.p-sound { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 12px 16px; width: 100%; font-weight: 700; }
.p-sound.is-playing::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse .6s ease-in-out infinite alternate; }
.p-replay { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.p-load { display: flex; flex-direction: column; gap: 8px; align-items: stretch; margin-top: 18px; }
.p-load-bar { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.p-load-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.p-load-note { font-size: 14px; color: var(--muted); margin: 0; }
.result { text-align: center; border-radius: 18px; padding: 28px 18px; color: #fff; }
.result-good { background: var(--good); }
.result-bad { background: var(--bad); }
.result-poll, .result-final { background: var(--surface); color: var(--text); }
.result-big { font-size: 34px; font-weight: 900; margin: 0 0 8px; }
.result-pts { font-size: 24px; font-weight: 800; margin: 0; }
.result-streak { display: inline-block; background: rgba(0, 0, 0, .2); padding: 4px 12px; border-radius: 999px; font-weight: 700; margin: 10px 0 0; }
.result-rank { margin: 16px 0 0; font-weight: 700; opacity: .92; }
.result-why { background: rgba(0, 0, 0, .18); padding: 10px 12px; border-radius: 10px; font-size: 15px; text-align: left; }
.p-top { text-align: left; max-width: 260px; margin: 18px auto; }
.state-reveal .result, .state-finished .result { animation: pop .35s ease-out; }

/* self-paced attempt */
.sp-form { display: flex; flex-direction: column; gap: 14px; }
.sp-q { font-size: 21px; font-weight: 700; margin: 0; }
.sp-media { display: block; width: 100%; max-height: 40vh; object-fit: contain; border-radius: 12px; background: #000; }
.sp-media-audio { width: 100%; background: transparent; }
.sp-opts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.sp-opt { display: flex; align-items: center; gap: 12px; border: 0; font: inherit; font-weight: 700; padding: 15px 14px; cursor: pointer; text-align: left; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.sp-opt .ltr { font-size: 15px; }
.sp-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.sp-opt:has(input:checked) { outline: 4px solid var(--text); outline-offset: -4px; }

/* ---------- host big screen ---------- */
.host { min-height: 100vh; display: flex; flex-direction: column; }
.host-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px; background: var(--surface); flex-wrap: wrap; }
.host-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; min-width: 0; }
.host-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.host-count { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.hbtn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.hbtn:hover { background: var(--surface-2); }
.hbtn:disabled { opacity: .4; cursor: default; }
.hbtn-quiet { border-color: transparent; color: var(--muted); }
.hbtn-go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 19px; padding: 12px 26px; font-weight: 800; }
.hbtn-go:hover { background: var(--accent); filter: brightness(1.08); }
.host-main { flex: 1; display: flex; flex-direction: column; padding: 28px 40px 36px; gap: 24px; }

.lobby { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; background: var(--surface); border-radius: 24px; padding: 34px 40px; }
.lobby-how { margin: 0; color: var(--muted); font-size: 22px; }
.lobby-site { margin: 0 0 14px; font-size: clamp(28px, 3.4vw, 46px); font-weight: 800; }
.lobby-code { margin: 4px 0 0; font-size: clamp(64px, 9vw, 128px); font-weight: 900; letter-spacing: .04em; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.lobby-qr { background: #fff; border-radius: 18px; padding: 14px 14px 8px; text-align: center; }
.lobby-qr img { width: clamp(180px, 20vw, 280px); height: auto; display: block; image-rendering: pixelated; }
.lobby-qr-hint { color: #17181B; margin: 6px 0 0; font-weight: 700; }
.lobby-players { flex: 1; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.lobby-count { font-size: 26px; font-weight: 800; margin: 0; }
.lobby-note { color: var(--muted); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; }
.chip button { background: var(--hi); color: var(--hi-ink); border: 0; border-radius: 6px; padding: 10px 16px; font: inherit; font-weight: 800; font-size: 20px; cursor: pointer; }
.chip button:hover { text-decoration: line-through; }
.chip-new { animation: pop .4s ease-out; }

.qscreen { display: flex; flex-direction: column; gap: 22px; flex: 1; }
.q-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 20px; }
.q-double { background: var(--hi); color: var(--hi-ink); font-weight: 800; padding: 4px 14px; border-radius: 6px; }
.q-prompt { margin: 0; font-size: clamp(28px, 3.6vw, 52px); line-height: 1.15; background: var(--prompt-bg); color: var(--prompt-ink); border-radius: var(--radius); padding: 24px 30px; text-align: center; }
.q-mid { display: flex; justify-content: space-between; align-items: center; min-height: 110px; }
.timer { width: 110px; height: 110px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 50px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.is-low { background: var(--hi); color: var(--hi-ink); animation: pulse .5s ease-in-out infinite alternate; }
.q-ready { font-size: 40px; font-weight: 900; font-family: var(--font-display); }
.answered { display: flex; flex-direction: column; align-items: center; background: var(--surface); border-radius: 16px; padding: 10px 22px; }
.answered strong { font-size: 44px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.answered span { color: var(--muted); }
.is-ready .timer { visibility: hidden; }
.is-ready .tiles, .is-ready .q-typed { opacity: .15; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { position: relative; display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 16px 22px; font-size: clamp(20px, 2.2vw, 32px); font-weight: 800; overflow: hidden; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18); transition: opacity .3s; }
.tile .ltr { font-size: .9em; }
.tile-text { flex: 1; }
.tile.is-wrong { opacity: .3; }
.tile.is-right { outline: 5px solid var(--text); outline-offset: -5px; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(0, 0, 0, .2); }
.tile.is-right .tile-bar { left: 5px; right: 5px; bottom: 5px; }
.tile-bar span { display: block; height: 100%; background: currentColor; opacity: .85; transition: width .6s ease-out; }
.tile-n { font-size: 28px; font-variant-numeric: tabular-nums; }
.q-typed { text-align: center; font-size: 30px; color: var(--muted); }
.typed-result { text-align: center; }
.typed-answer { display: inline-block; font-size: 44px; font-weight: 900; background: var(--good); color: #fff; padding: 14px 34px; border-radius: 14px; margin: 0; }
.typed-split { color: var(--muted); font-size: 22px; }
.q-expl { background: var(--surface); border-left: 6px solid var(--accent); border-radius: 10px; padding: 16px 20px; font-size: 22px; margin: 0; }
.q-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: auto; }

.h-media { display: flex; justify-content: center; align-items: center; gap: 16px; position: relative; }
.h-media img, .h-media video { display: block; max-width: 100%; max-height: 34vh; border-radius: 14px; background: #000; }
.h-media video { width: min(62vw, 100%); aspect-ratio: 16 / 9; }
.is-reveal .h-media img { max-height: 24vh; }
.h-media-audio { flex-direction: column; background: var(--surface); border-radius: 16px; padding: 18px 24px; }
.h-media audio { width: min(560px, 80vw); }
.h-audio-icon { font-size: 28px; font-weight: 800; color: var(--accent); }
.h-on-phones { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0, 0, 0, .7); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 15px; font-weight: 700; white-space: nowrap; }
.h-media-audio .h-on-phones { position: static; transform: none; }
.needs-tap::before { content: 'Press play to start'; color: var(--hi); font-weight: 800; font-size: 22px; }
.has-media { gap: 16px; }
.has-media .q-prompt { font-size: clamp(24px, 2.8vw, 40px); padding: 14px 24px; }
.has-media .tile { min-height: 76px; }
.has-media .q-ready { font-size: 26px; color: var(--hi); }
.media-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; align-items: center; gap: 20px; }
.media-row .timer { justify-self: start; }
.media-row .answered { justify-self: end; }

.board, .podium-wrap { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.board-title { margin: 0; text-align: center; font-size: clamp(30px, 3.4vw, 48px); }
.board-list { list-style: none; padding: 0; margin: 0 auto; width: min(900px, 100%); display: flex; flex-direction: column; gap: 10px; }
.board-row { position: relative; display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-radius: 12px; background: var(--surface); font-size: 24px; font-weight: 800; overflow: hidden; animation: slide .45s ease-out both; }
.board-row::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); opacity: .16; }
.board-row > * { position: relative; }
.board-rank { width: 40px; color: var(--accent); }
.board-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-variant-numeric: tabular-nums; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; min-height: 360px; margin-top: 20px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(240px, 30vw); animation: rise .7s ease-out both; }
.pod-name { font-size: 28px; font-weight: 900; text-align: center; overflow-wrap: anywhere; }
.pod-score { color: var(--muted); font-size: 20px; }
.pod-step { width: 100%; display: grid; place-items: center; border-radius: 14px 14px 0 0; font-size: 60px; font-weight: 900; font-family: var(--font-display); }
.pod-1 .pod-step { height: 220px; background: var(--a0); color: var(--tile-ink); }
.pod-2 .pod-step { height: 160px; background: var(--a1); color: var(--tile-ink); }
.pod-3 .pod-step { height: 110px; background: var(--a2); color: var(--tile-ink); }
.rest { margin: 0 auto; columns: 2; font-size: 20px; color: var(--muted); }

@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 900px) {
    .host-main { padding: 18px; }
    .lobby { grid-template-columns: minmax(0, 1fr); padding: 24px; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
    .tile { min-height: 64px; }
    .media-row { grid-template-columns: 80px minmax(0, 1fr) 80px; gap: 10px; }
}

/* ---------- countdown and scores panel ---------- */
.h-next { margin: 0 auto 0 0; align-self: center; font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.host-body { flex: 1; display: flex; min-height: 0; }
.host-body .host-main { flex: 1; min-width: 0; }
.h-scores { width: 290px; flex-shrink: 0; background: var(--surface); padding: 22px 18px; overflow-y: auto; max-height: calc(100vh - 64px); position: sticky; top: 0; }
.h-scores h2 { margin: 0 0 12px; font-size: 20px; color: var(--muted); font-family: var(--font-display); }
.h-scores-list { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.h-score { counter-increment: rank; display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }
.h-score::before { content: counter(rank); width: 26px; color: var(--muted); font-variant-numeric: tabular-nums; }
.h-score-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.h-score-pts { font-variant-numeric: tabular-nums; }
.h-score.is-in .h-score-name::after { content: ' \2713'; color: var(--accent); }
.p-expl { background: var(--surface); border-left: 5px solid var(--accent); border-radius: 10px; padding: 12px 14px; margin: 0; font-size: 16px; }
.p-next { text-align: center; color: var(--accent); font-weight: 800; font-size: 20px; margin: 4px 0 0; font-variant-numeric: tabular-nums; font-family: var(--font-display); min-height: 1.4em; }
.p-board { background: var(--surface); border-radius: 18px; padding: 18px; animation: pop .3s ease-out; }
.p-board-title { margin: 0 0 10px; font-size: 22px; font-weight: 900; text-align: center; font-family: var(--font-display); }
.p-board-list { list-style: none; padding: 0; margin: 0; }
.p-board-list li { display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 10px; font-weight: 700; }
.p-board-list li.is-me { background: var(--accent); color: var(--accent-ink); }
.pb-rank { width: 22px; opacity: .7; }
.pb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-score { font-variant-numeric: tabular-nums; }
.pb-you { margin: 12px 0 0; text-align: center; color: var(--muted); }
@media (max-width: 1100px) { .h-scores { width: 220px; } }
@media (max-width: 800px) { .host-body { flex-direction: column; } .h-scores { width: auto; max-height: none; position: static; } }

/* ---------- trophy screen ---------- */
.winners { display: flex; justify-content: center; align-items: flex-end; gap: clamp(16px, 4vw, 60px); margin: 10px 0 6px; }
.win { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; animation: rise .7s ease-out both; }
.win-1 { animation-delay: .6s; }
.win-3 { animation-delay: .3s; }
.win-art svg { display: block; }
.win-1 .trophy { width: clamp(150px, 16vw, 240px); height: auto; filter: drop-shadow(0 10px 24px rgba(242, 193, 78, .35)); }
.win-2 .medal, .win-3 .medal { width: clamp(80px, 8vw, 120px); height: auto; }
.win-label { font-size: 18px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.win-1 .win-label { color: var(--accent); }
.win-name { font-size: clamp(22px, 2.4vw, 40px); font-weight: 900; font-family: var(--font-display); max-width: 18ch; overflow-wrap: anywhere; }
.win-1 .win-name { font-size: clamp(30px, 3.4vw, 56px); }
.win-score { color: var(--muted); font-size: 18px; font-variant-numeric: tabular-nums; }
.win-art-big .trophy { width: 180px; height: auto; margin: 10px auto; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 10px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 110vh; transform: translateX(40px) rotate(540deg); } }

/* ---------- Auto Quiz break ---------- */
.break { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 28px; flex: 1; align-items: start; }
.break-win { background: var(--surface); border-radius: 22px; padding: 22px 18px 26px; text-align: center; }
.break-kicker { margin: 0 0 6px; font-size: 22px; font-weight: 800; color: var(--accent); font-family: var(--font-display); }
.break-win .winners { gap: 18px; }
.break-win .win-1 .trophy { width: clamp(120px, 11vw, 180px); }
.break-win .win-2 .medal, .break-win .win-3 .medal { width: 70px; }
.break-win .win-name { font-size: 22px; }
.break-win .win-1 .win-name { font-size: 32px; }
.break-hello { font-size: 22px; color: var(--muted); }
.boards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lb { background: var(--surface); border-radius: 18px; padding: 16px 16px 10px; min-width: 0; }
.lb-title { margin: 0 0 10px; font-size: 20px; color: var(--accent); font-family: var(--font-display); }
.lb-empty { color: var(--muted); margin: 0 0 8px; }
.lb-list { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.lb-list li { counter-increment: r; display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.lb-list li::before { content: counter(r); width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-list li:first-child { font-weight: 800; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; }
.break-bar { display: flex; align-items: center; gap: 24px; background: var(--surface); border-radius: 20px; padding: 14px 20px; margin-top: 4px; }
.break-join { display: flex; align-items: center; gap: 14px; flex: 1; }
.break-join img { width: 96px; height: 96px; background: #fff; border-radius: 10px; padding: 6px; image-rendering: pixelated; }
.break-join-text { display: flex; flex-direction: column; font-size: 20px; color: var(--muted); }
.break-code { font-size: 44px; color: var(--accent); letter-spacing: .04em; line-height: 1.05; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.break-count { display: flex; flex-direction: column; align-items: flex-end; }
.break-count-label { color: var(--muted); font-size: 18px; }
.break-count-time { font-size: 56px; line-height: 1; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .break { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .boards { grid-template-columns: minmax(0, 1fr); } .break-bar { flex-wrap: wrap; } }

/* phone */
.p-art { display: flex; justify-content: center; margin-bottom: 6px; }
.p-art .trophy { width: 120px; height: auto; }
.p-art .medal { width: 72px; height: auto; }
.p-break { text-align: center; }
.p-break .result-big { font-size: 28px; }
.p-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.p-tab { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 10px; padding: 8px; font: inherit; font-weight: 700; cursor: pointer; }
.p-tab.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- timer bar ---------- */
.tbar { position: relative; height: 48px; border-radius: 12px; background: rgba(0, 0, 0, .35); overflow: hidden; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.tbar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: #22A35A; transition: width .2s linear; }
.tbar.is-low .tbar-fill { background: #1B8A4B; animation: barpulse .5s ease-in-out infinite alternate; }
.tbar-static .tbar-fill { background: rgba(255, 255, 255, .08); }
.tbar-text, .tbar-secs { position: relative; color: #fff; font-weight: 800; font-size: 22px; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); font-family: var(--font-body); white-space: pre; }
.tbar-secs { font-variant-numeric: tabular-nums; font-size: 24px; }
.tbar-phone { height: 38px; padding: 0 12px; border-radius: 10px; }
.tbar-phone .tbar-text { font-size: 16px; }
.tbar-phone .tbar-secs { font-size: 17px; }
.is-ready .tbar-fill { opacity: .55; }
@keyframes barpulse { from { opacity: 1; } to { opacity: .7; } }
.media-row .q-ready { justify-self: start; }

/* ---------- logo splash ---------- */
.splash { flex: 1; display: grid; place-items: center; animation: pop .5s ease-out; }
.splash img { max-width: min(70vw, 900px); max-height: 60vh; object-fit: contain; }
.p-splash { text-align: center; }
.p-splash img { max-width: 80%; max-height: 40vh; object-fit: contain; margin-bottom: 14px; }

/* ---------- prize ---------- */
.prize { display: flex; align-items: center; gap: 14px; margin: 14px auto 0; width: fit-content; max-width: 100%; background: var(--hi); color: var(--hi-ink); border-radius: 14px; padding: 12px 22px; font-weight: 800; font-size: 22px; }
.prize-label { text-transform: uppercase; font-size: 14px; letter-spacing: .1em; background: rgba(0, 0, 0, .12); padding: 4px 10px; border-radius: 6px; }
.prize-phone { font-size: 16px; padding: 10px 14px; gap: 10px; margin-top: 12px; }
.prize-phone .prize-label { font-size: 11px; }

/* ---------- teams ---------- */
.team-board { width: min(900px, 100%); margin: 0 auto 6px; display: flex; flex-direction: column; gap: 8px; }
.team-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-radius: 12px; background: var(--surface); font-size: 24px; font-weight: 900; overflow: hidden; border-left: 10px solid var(--c); }
.team-row::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); opacity: .22; }
.team-row > * { position: relative; }
.team-rank { width: 30px; color: var(--muted); }
.team-name { flex: 1; }
.team-meta { font-size: 15px; font-weight: 600; color: var(--muted); }
.team-score { font-variant-numeric: tabular-nums; }
.team-note { margin: 2px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.team-win { text-align: center; font-size: clamp(26px, 3vw, 44px); font-weight: 900; margin: 0; color: var(--c); font-family: var(--font-display); }
.h-teams { list-style: none; padding: 0 0 12px; margin: 0 0 12px; border-bottom: 2px solid var(--line); }
.h-team { display: flex; gap: 10px; padding: 6px 8px; margin-bottom: 4px; border-radius: 8px; border-left: 6px solid var(--c); background: var(--surface-2); font-weight: 800; }
.h-score.has-team .h-score-name { box-shadow: inset 4px 0 0 var(--c); padding-left: 8px; }
.chip.has-team button { box-shadow: inset 0 -5px 0 var(--c); }
.play-team { margin-left: auto; margin-right: 8px; padding: 3px 10px; border-radius: 999px; background: var(--c); color: var(--tile-ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
.p-teams { margin-top: 12px; }
.result-team { font-weight: 800; margin: 12px 0 0; }
.join-teams { border: 0; padding: 0; margin: 4px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.join-teams legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.join-team { display: flex !important; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 2px solid #E4E2DC; border-left: 10px solid var(--c, #CFCCC4); font-weight: 700; margin: 0 !important; cursor: pointer; }
.join-team:has(input:checked) { border-color: #17181B; }
.join-team.any { --c: #CFCCC4; }

/* ---------- themes ---------- */

/* Harbour, the default: deep sea blue, sunny yellow, card tiles. */
body, .theme-harbour {
    --bg: #0F2A36; --surface: #173A4A; --surface-2: #21495B; --line: #2D5A6D;
    --text: #F4F1E8; --muted: #A9C0C8; --accent: #F2C14E; --accent-ink: #1B1A14;
    --hi: #F2C14E; --hi-ink: #1B1A14; --prompt-bg: #F4F1E8; --prompt-ink: #0F2A36;
    --good: #2E8B6E; --bad: #C2553D;
    --a0: #4FB3BF; --a1: #F28C6B; --a2: #A3C95A; --a3: #C9A0F0; --a4: #F2C14E; --a5: #7FA7E6; --tile-ink: #0F2A36;
    --font-display: 'Bricolage Grotesque', system-ui, sans-serif; --font-body: 'Bricolage Grotesque', system-ui, sans-serif;
    --radius: 16px;
}

/* Office: bright, clean and calm. For training. */
.theme-office {
    --bg: #F3F5F8; --surface: #FFFFFF; --surface-2: #E8ECF2; --line: #D5DCE5;
    --text: #172033; --muted: #5C6779; --accent: #1F5FD1; --accent-ink: #FFFFFF;
    --hi: #FFE9A8; --hi-ink: #172033; --prompt-bg: #FFFFFF; --prompt-ink: #172033;
    --good: #1E7F52; --bad: #B4402F;
    --a0: #1F5FD1; --a1: #0E8A7E; --a2: #B85C00; --a3: #8A3FA8; --a4: #3D4E66; --a5: #B8325A; --tile-ink: #FFFFFF;
    --font-display: 'Inter', system-ui, sans-serif; --font-body: 'Inter', system-ui, sans-serif;
    --radius: 12px;
}
.theme-office .q-prompt, .theme-office .lobby-qr { border: 2px solid var(--line); }

/* Chalkboard: green board, chalk colours, handwriting. */
.theme-chalk {
    --bg: #1E3A2F; --surface: #28493B; --surface-2: #33574A; --line: #4A6E5F;
    --text: #F1EEE4; --muted: #BCC9BF; --accent: #F7E08A; --accent-ink: #1E3A2F;
    --hi: #F4A9C8; --hi-ink: #1E3A2F; --prompt-bg: #28493B; --prompt-ink: #F1EEE4;
    --good: #5E9E6B; --bad: #C76B5B;
    --a0: #F7E08A; --a1: #F4A9C8; --a2: #9ED5F2; --a3: #C2E59A; --a4: #F5C08E; --a5: #D3BDF0; --tile-ink: #1E3A2F;
    --font-display: 'Patrick Hand', 'Comic Sans MS', cursive; --font-body: 'Patrick Hand', 'Comic Sans MS', cursive;
    --radius: 6px;
}
.theme-chalk .q-prompt { border: 3px dashed var(--muted); }
.theme-chalk.tiles-card .tile, .theme-chalk.tiles-card .p-tile { border-style: dashed; border-left-style: solid; }

/* Arcade: dark screen, neon colours, techy type. */
.theme-arcade {
    --bg: #12161C; --surface: #1C232C; --surface-2: #26303B; --line: #33404E;
    --text: #EAF6FF; --muted: #93A6B8; --accent: #2EE6D6; --accent-ink: #062320;
    --hi: #FFE14D; --hi-ink: #12161C; --prompt-bg: #1C232C; --prompt-ink: #EAF6FF;
    --good: #19B36B; --bad: #E2445C;
    --a0: #2EE6D6; --a1: #FF5C8A; --a2: #FFE14D; --a3: #8CFF66; --a4: #FF9F43; --a5: #5CA8FF; --tile-ink: #12161C;
    --font-display: 'Chakra Petch', ui-monospace, monospace; --font-body: 'Chakra Petch', system-ui, sans-serif;
    --radius: 4px;
}
.theme-arcade .q-prompt { border: 2px solid var(--accent); box-shadow: 0 0 24px -6px var(--accent); }
.theme-arcade .tile { box-shadow: 0 0 18px -8px var(--c); }

/* Retro: 70s browns, orange and mustard, rounded display type. */
.theme-retro {
    --bg: #3A2418; --surface: #4D3122; --surface-2: #5E3D2B; --line: #6E4A35;
    --text: #FBEBD0; --muted: #D9BC9A; --accent: #F2A33A; --accent-ink: #2B1A10;
    --hi: #E9D46B; --hi-ink: #2B1A10; --prompt-bg: #FBEBD0; --prompt-ink: #3A2418;
    --good: #6B9E5E; --bad: #C9503C;
    --a0: #E9762B; --a1: #E9C23B; --a2: #7FAE6E; --a3: #D4584A; --a4: #5E9EA0; --a5: #B98AC2; --tile-ink: #2B1A10;
    --font-display: 'Righteous', system-ui, sans-serif; --font-body: 'Inter', system-ui, sans-serif;
    --radius: 22px;
}

/* Midnight: navy and sky with jewel-tone tiles. */
.theme-midnight {
    --bg: #111827; --surface: #1E293B; --surface-2: #334155; --line: #334155;
    --text: #F8FAFC; --muted: #A5B4C8; --accent: #BFE3F5; --accent-ink: #111827;
    --hi: #FFE9A8; --hi-ink: #111827; --prompt-bg: #FFFFFF; --prompt-ink: #17181B;
    --good: #1E8A57; --bad: #C2553D;
    --a0: #4F46E5; --a1: #0D9488; --a2: #BE185D; --a3: #C2410C; --a4: #0369A1; --a5: #4D7C0F; --tile-ink: #FFFFFF;
    --font-display: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --radius: 14px;
}

/* ---------- look preview page ---------- */
.preview { padding: 0 0 30px; }
.pv-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 14px 24px; background: var(--surface); }
.pv-top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pv-top a { color: var(--text); text-decoration: none; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 15px; }
.pv-top a[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pv-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding: 28px 24px 0; align-items: start; }
.pv-host { border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.pv-host .qscreen { gap: 18px; }
.pv-host .q-prompt { font-size: clamp(22px, 2.6vw, 36px); }
.pv-host .tile { min-height: 76px; font-size: clamp(18px, 1.8vw, 26px); }
.pv-phone { border: 10px solid #000; border-radius: 34px; overflow: hidden; height: 620px; }
.pv-phone .play { min-height: 100%; height: 100%; }
.pv-phone .p-tile { min-height: 0; }
.pv-about { text-align: center; color: var(--muted); margin-top: 22px; }
@media (max-width: 900px) { .pv-wrap { grid-template-columns: minmax(0, 1fr); } .pv-phone { max-width: 340px; margin: 0 auto; } }

/* Light tiles need a darker letter badge. */
.theme-chalk .ltr, .theme-arcade .ltr, .theme-retro .ltr { background: rgba(0, 0, 0, .14); }
.theme-chalk.tiles-card .ltr, .theme-arcade.tiles-card .ltr, .theme-retro.tiles-card .ltr { background: var(--c); }
