:root {
  --ink: #171716;
  --ink-2: #242421;
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --line: #ded9cd;
  --muted: #777369;
  --yellow: #ffcc33;
  --yellow-2: #ffb703;
  --green: #27b983;
  --red: #e94d4d;
  --blue: #55a7ff;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(25, 22, 15, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; letter-spacing: -.04em; }
.brand strong { color: #bf8b00; }
.brand.light { color: #fff; }
.brand.light strong { color: var(--yellow); }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px 10px 10px 3px; background: var(--yellow); color: var(--ink); font-weight: 950; transform: rotate(-4deg); box-shadow: 3px 3px 0 rgba(0,0,0,.22); }
.eyebrow { margin-bottom: 10px; color: #a27100; font-size: 12px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--muted); }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.back-link { color: var(--muted); font-size: 13px; font-weight: 750; }

.btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, opacity .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .4; transform: none; }
.btn.primary { background: var(--yellow); color: var(--ink); box-shadow: 0 8px 24px rgba(255,183,3,.23); }
.btn.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.accent { background: #fff; border-color: var(--yellow); color: #8b6100; box-shadow: inset 0 0 0 2px var(--yellow); }
.btn.wide { width: 100%; }
.btn.large { min-height: 54px; font-size: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label, fieldset legend { color: #4c4942; font-size: 12px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
input, select, textarea { width: 100%; min-height: 44px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #fff; color: var(--ink); transition: border .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #d09a00; box-shadow: 0 0 0 3px rgba(255,183,3,.16); }
.field small, .field-help { margin: 0; color: var(--muted); font-size: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.form-grid, .db-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full, .db-grid .full { grid-column: 1 / -1; }
.form-grid.thirds { grid-template-columns: repeat(3, 1fr); }
fieldset { margin: 0; padding: 0; border: 0; }
fieldset legend { margin-bottom: 4px; }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); }

.alert { margin: 15px 0; padding: 13px 15px; border-radius: 11px; font-size: 14px; font-weight: 650; }
.alert.error { background: #fee7e7; color: #9e2929; }
.alert.success { background: #ddf7ed; color: #137354; }
.toast { position: fixed; z-index: 1000; bottom: 25px; left: 50%; padding: 13px 20px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 12px 40px #0005; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .22s ease; font-weight: 750; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a62c2c; }

/* Authentication and installation */
.auth-page { min-height: 100vh; background: var(--ink); background-image: radial-gradient(circle at 15% 15%, #383421 0, transparent 28%), radial-gradient(circle at 90% 90%, #332b18 0, transparent 25%); }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 32px 20px; }
.auth-card { width: min(720px, 100%); padding: 42px; border-radius: 24px; background: var(--surface); box-shadow: 0 30px 100px #0008; }
.auth-card.compact { width: min(460px, 100%); }
.auth-card .brand { margin-bottom: 42px; }
.auth-card h1 { margin-bottom: 8px; font-size: 42px; line-height: 1; }
.auth-card .back-link { display: block; margin-top: 24px; text-align: center; }
.install-shell .auth-card { margin: 30px auto; }

/* Admin shell */
.topbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 70px; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(244,241,233,.92); backdrop-filter: blur(14px); }
.topbar nav { display: flex; gap: 4px; padding: 5px; border-radius: 12px; background: #e9e5dc; }
.topbar nav a { padding: 8px 15px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 800; }
.topbar nav a.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px #0001; }
.user-menu { display: flex; justify-content: flex-end; gap: 16px; font-size: 13px; font-weight: 700; }
.user-menu a { color: #a26c00; }
.admin-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 70px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(36px, 5vw, 55px); line-height: .95; }
.page-heading p { margin-bottom: 0; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 35px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-strip div { display: flex; min-height: 105px; flex-direction: column; justify-content: center; padding: 22px 30px; border-right: 1px solid var(--line); }
.stat-strip div:last-child { border: 0; }
.stat-strip strong { font-size: 30px; }
.stat-strip span { color: var(--muted); font-size: 13px; font-weight: 650; }
.section-block { margin-top: 32px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.section-title h2, .section-title h3 { margin: 0; }
.section-title.compact { margin-top: 28px; }
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.game-card { display: flex; min-height: 190px; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 20px #18130b08; transition: .18s ease; }
.game-card:hover { border-color: #c9a53c; transform: translateY(-3px); box-shadow: var(--shadow); }
.game-card-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.game-card-top code { margin-left: auto; color: var(--ink); font-family: inherit; letter-spacing: .08em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #27b98320; }
.status-dot.finished { background: #aaa59c; box-shadow: none; }
.game-card h3 { margin: 28px 0 6px; font-size: 22px; }
.game-card p { color: var(--muted); font-size: 13px; }
.game-card-meta { display: flex; gap: 20px; margin-top: auto; color: #58554e; font-size: 12px; font-weight: 700; }
.empty-state { display: grid; min-height: 300px; place-items: center; align-content: center; padding: 35px; border: 1px dashed #c7c0b3; border-radius: var(--radius); text-align: center; }
.empty-state h3 { margin: 8px 0 5px; font-size: 22px; }
.empty-state p { max-width: 440px; color: var(--muted); }
.empty-state .btn { margin-top: 10px; }
.empty-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 17px; background: var(--yellow); font-size: 26px; font-weight: 900; transform: rotate(-3deg); }

/* Dialogs and forms */
.modal { width: min(690px, calc(100% - 30px)); max-height: calc(100vh - 35px); padding: 0; border: 0; border-radius: 22px; background: var(--surface); box-shadow: 0 30px 120px #0008; }
.modal.small { width: min(470px, calc(100% - 30px)); }
.modal::backdrop { background: rgba(20,19,17,.72); backdrop-filter: blur(5px); }
.modal-card { display: flex; flex-direction: column; gap: 22px; padding: 30px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 30px; }
.icon-btn { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: 18px; }
.icon-btn.danger { color: var(--red); }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; font-size: 13px; font-weight: 750; }
.check-chip span::before { width: 7px; height: 7px; border-radius: 50%; background: var(--chip, #bbb); content: ''; }
.check-chip input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.check-chip small { opacity: .6; }
.scoring-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-radius: 12px; background: #f1ecde; font-size: 13px; }
.scoring-note span { color: var(--muted); }
.answers-editor { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.answer-edit { position: relative; }
.answer-edit > span { position: absolute; z-index: 1; top: 8px; left: 8px; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 900; }
.answer-edit input { padding-left: 45px; }

/* Archives */
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.category-card { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 16px; min-height: 105px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.category-swatch { width: 12px; height: 54px; border-radius: 99px; background: var(--category); }
.category-card h3 { margin: 0 0 4px; }
.category-card p { margin: 0; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; }
.filter-bar { display: grid; grid-template-columns: 1fr 240px auto; gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 15px 16px; border-bottom: 1px solid #e8e4da; font-size: 13px; }
.data-table tr:last-child td { border: 0; }
.data-table td:first-child { min-width: 390px; }
.data-table td strong { display: block; margin-bottom: 5px; }
.data-table td small { display: block; overflow: hidden; max-width: 560px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.category-tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 99px; background: color-mix(in srgb, var(--tag) 17%, white); font-weight: 750; white-space: nowrap; }
.category-tag::before { width: 7px; height: 7px; border-radius: 50%; background: var(--tag); content: ''; }
.answer-key { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: #def6ed; color: #147955; font-weight: 900; }

/* Host console */
.console-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.console-head h1 { margin: 8px 0 5px; font-size: 40px; }
.console-head p { margin: 0; }
.console-links { display: flex; gap: 9px; }
.console-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 26px #251d0e0a; }
.console-stage { min-height: 620px; padding: 28px; }
.console-side { display: flex; flex-direction: column; gap: 14px; }
.control-panel, .qr-panel, .rules-panel { padding: 20px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.live-badge span, .pulse-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px #27b98320; }
.room-code-block { display: flex; align-items: center; justify-content: space-between; margin: 19px 0; padding: 13px 15px; border-radius: 12px; background: var(--ink); color: #fff; }
.room-code-block small { color: #aaa89f; }
.room-code-block strong { color: var(--yellow); letter-spacing: .12em; }
.control-hint { margin: 13px 3px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.qr-panel { display: grid; grid-template-columns: 112px 1fr; gap: 15px; align-items: center; }
.qr-small { overflow: hidden; width: 112px; height: 112px; border-radius: 8px; }
.qr-panel strong { display: block; margin-bottom: 5px; }
.qr-panel p { margin: 0 0 5px; color: var(--muted); font-size: 11px; }
.qr-panel small { display: block; overflow: hidden; color: #9b6c00; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.rules-panel h3 { margin-bottom: 16px; }
.rules-panel > div { display: flex; justify-content: space-between; margin: 8px 0; font-size: 13px; }
.rules-panel p { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel-head { display: flex; justify-content: space-between; margin-bottom: 25px; }
.panel-head h2 { margin: 0; font-size: 30px; }
.pulse-label { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.lobby-team-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lobby-team-card { padding: 18px; border: 1px solid var(--line); border-top: 4px solid var(--team); border-radius: 14px; background: #fff; }
.lobby-team-title { display: flex; align-items: center; gap: 10px; }
.lobby-team-title i, .host-team > i { width: 10px; height: 10px; border-radius: 50%; background: var(--team); }
.lobby-team-title h3 { margin: 0; }
.lobby-team-title span { margin-left: auto; padding: 3px 8px; border-radius: 99px; background: #f1eee7; font-size: 11px; font-weight: 800; }
.lobby-team-card ul { margin: 15px 0 0; padding: 0; list-style: none; }
.lobby-team-card li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid #eeebe3; color: #55514a; font-size: 12px; }
.lobby-team-card li button { border: 0; background: transparent; color: #aaa; cursor: pointer; }
.question-meta { display: flex; gap: 8px; align-items: center; }
.question-meta span { padding: 6px 10px; border-radius: 99px; background: #eeeae1; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.question-meta span:first-child { background: color-mix(in srgb, var(--tag) 18%, white); color: var(--ink); }
.host-question { max-width: 850px; margin: 28px 0; font-size: clamp(27px, 3.5vw, 42px); line-height: 1.08; }
.host-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.host-option { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; min-height: 64px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.host-option > b { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--ink); color: #fff; }
.host-option span { font-size: 14px; font-weight: 650; }
.host-option em { color: var(--green); font-size: 10px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.host-option.host-correct { border-color: #8ccdb5; background: #edfbf5; }
.host-option.revealed-correct { border-color: var(--green); background: #e5f9f1; box-shadow: inset 0 0 0 1px var(--green); }
.host-option.dimmed { opacity: .42; }
.host-team-list { display: flex; flex-direction: column; gap: 7px; }
.host-team { display: flex; align-items: center; gap: 11px; min-height: 57px; padding: 10px 13px; border: 1px solid #e5e1d8; border-radius: 12px; background: #fff; }
.host-team.waiting { opacity: .5; filter: grayscale(.8); }
.team-rank { width: 20px; color: var(--muted); font-size: 11px; font-weight: 900; text-align: center; }
.team-main { display: flex; flex: 1; flex-direction: column; }
.team-main small { color: var(--muted); font-size: 10px; }
.team-score { min-width: 50px; font-size: 20px; text-align: right; }
.vote-state { padding: 5px 8px; border-radius: 99px; background: #edeae4; color: #88847a; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.vote-state.done { background: #dff6ed; color: #16805c; }
.round-delta { min-width: 50px; font-size: 13px; font-weight: 900; text-align: right; }
.score-controls { display: flex; gap: 3px; }
.score-controls button { width: 25px; height: 25px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #f5f2eb; cursor: pointer; }
.empty-mini { padding: 40px; color: var(--muted); text-align: center; }
.winner-block { padding: 18px 0 35px; text-align: center; }
.winner-block .trophy { display: grid; width: 70px; height: 70px; place-items: center; margin: 0 auto 17px; border-radius: 25px 25px 25px 7px; background: var(--yellow); font-size: 35px; transform: rotate(-5deg); }
.winner-block h2 { margin: 0; font-size: 48px; }
.winner-block > strong { font-size: 20px; }
.winner-block .prize { display: inline-block; margin: 18px 0 0; padding: 9px 14px; border-radius: 99px; background: #eeeae1; color: #6a655d; }
.loading-state { display: grid; min-height: 300px; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.loading-state.light { color: #aaa69d; }
.spinner { width: 28px; height: 28px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Player mobile */
.join-landing, .player-page { min-height: 100vh; background: var(--ink); color: #fff; }
.join-landing { background-image: radial-gradient(circle at 80% 15%, #42381a 0, transparent 30%), linear-gradient(145deg, #111 0%, #24231f 100%); }
.join-shell { display: flex; width: min(500px, 100%); min-height: 100vh; flex-direction: column; margin: auto; padding: max(25px, env(safe-area-inset-top)) 20px max(25px, env(safe-area-inset-bottom)); }
.join-card { margin: auto 0; color: var(--ink); }
.landing-card h1 { margin: 15px 0; color: #fff; font-size: clamp(55px, 16vw, 82px); line-height: .83; }
.landing-card > p:not(.eyebrow) { color: #aaa69f; }
.room-form input { min-height: 68px; margin: 17px 0 10px; border: 2px solid #4a473e; background: #22221f; color: var(--yellow); font-size: 30px; font-weight: 900; letter-spacing: .18em; text-align: center; text-transform: uppercase; }
.room-form input::placeholder { color: #56534b; }
.host-entry { margin: 25px auto 0; color: #8b887f; font-size: 12px; }
.player-shell { width: min(580px, 100%); min-height: 100vh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, #1e1e1b, #111); }
.player-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.room-pill { display: inline-flex; gap: 8px; align-items: center; padding: 7px 11px; border: 1px solid #44413a; border-radius: 99px; color: #aaa69e; font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.room-pill strong { color: var(--yellow); }
.mobile-card { padding: 25px; border-radius: 22px; background: var(--surface); color: var(--ink); }
.join-flow h1 { margin-bottom: 10px; font-size: 36px; line-height: .98; }
.join-flow form { display: flex; flex-direction: column; gap: 18px; margin-top: 25px; }
.team-choice { display: flex; flex-direction: column; gap: 8px; }
.teams-live-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.teams-live-heading > strong { color: #4c4942; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.teams-live-heading > span { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.teams-live-heading i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #27b98318; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card span { display: block; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; font-size: 13px; font-weight: 800; }
.choice-card input:checked + span { border-color: var(--yellow-2); background: #fff8df; box-shadow: inset 0 0 0 1px var(--yellow-2); }
.existing-teams { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 2px 0 7px; }
.teams-empty { grid-column: 1 / -1; display: flex; min-height: 68px; align-items: center; justify-content: center; gap: 9px; padding: 12px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); text-align: center; }
.teams-empty span { font-size: 20px; }
.teams-empty p { margin: 0; font-size: 11px; }
.create-team-choice { margin-top: 4px; }
.team-radio input { position: absolute; opacity: 0; }
.team-radio > span { display: grid; grid-template-columns: 9px 1fr; gap: 1px 8px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.team-radio i { grid-row: 1 / 3; align-self: center; width: 9px; height: 28px; border-radius: 9px; background: var(--team); }
.team-radio strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.team-radio small { color: var(--muted); font-size: 9px; }
.team-radio input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.mobile-message { display: flex; min-height: calc(100vh - 120px); flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.mobile-message h1 { margin: 5px 0 12px; font-size: 45px; line-height: .95; }
.mobile-message > p { max-width: 390px; color: #aaa69f; line-height: 1.5; }
.big-symbol { font-size: 45px; }
.team-orb { width: 75px; height: 75px; margin-bottom: 25px; border: 10px solid #fff2; border-radius: 50%; background: var(--team); box-shadow: 0 0 50px color-mix(in srgb, var(--team) 45%, transparent); }
.teammates { display: flex; width: min(350px, 100%); flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 25px; }
.teammates strong { width: 100%; margin-bottom: 5px; color: #79766f; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.teammates span { padding: 7px 10px; border: 1px solid #413f39; border-radius: 99px; color: #d7d3c9; font-size: 11px; }
.waiting-dots { display: flex; gap: 5px; margin-top: 35px; }
.waiting-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); animation: blink 1.2s infinite; }
.waiting-dots i:nth-child(2) { animation-delay: .2s; }.waiting-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; transform: translateY(-3px); } }
.mobile-question-head { display: flex; justify-content: space-between; align-items: center; color: #aaa69d; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.mobile-question-head span { padding: 6px 10px; border-radius: 99px; background: color-mix(in srgb, var(--tag) 25%, #222); color: #fff; }
.mobile-question { margin: 24px 0 28px; font-size: clamp(31px, 9vw, 44px); line-height: 1.06; }
.mobile-options { display: flex; flex-direction: column; gap: 10px; }
.mobile-option { display: grid; grid-template-columns: 43px 1fr 25px; align-items: center; gap: 12px; width: 100%; min-height: 70px; padding: 11px; border: 1px solid #46433d; border-radius: 15px; background: #282723; color: #fff; text-align: left; cursor: pointer; }
.mobile-option > b { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 12px; background: #3a3832; color: var(--yellow); }
.mobile-option span { font-size: 15px; font-weight: 650; }
.mobile-option i { color: var(--green); font-size: 19px; font-style: normal; }
.mobile-option.selected { border-color: var(--yellow); background: #38321f; box-shadow: inset 0 0 0 1px var(--yellow); }
.answer-help { margin: 18px auto 0; max-width: 440px; color: #7f7b72; font-size: 11px; line-height: 1.5; text-align: center; }
.result-hero { padding: 30px 0; text-align: center; }
.result-hero > span { display: grid; width: 80px; height: 80px; place-items: center; margin: 0 auto 22px; border-radius: 50%; font-size: 45px; font-weight: 900; }
.result-hero.correct > span { background: var(--green); box-shadow: 0 0 55px #27b98355; }
.result-hero.wrong > span { background: var(--red); box-shadow: 0 0 55px #e94d4d44; }
.result-hero h1 { font-size: 42px; }
.result-card { padding: 20px; border-radius: 18px; background: #292824; }
.result-card > p { margin-bottom: 10px; color: #8f8b82; font-size: 11px; text-transform: uppercase; }
.result-card > strong { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.result-card > strong b { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--green); }
.team-round-result { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 17px; border-top: 1px solid #413f39; color: #b4b0a7; font-size: 12px; }
.team-round-result b { font-size: 21px; }
.mobile-title { padding: 35px 0 20px; text-align: center; }
.mobile-title h1 { margin-bottom: 10px; font-size: 46px; }
.mobile-title > p:last-child { color: #8f8b82; }
.mobile-leaderboard { display: flex; flex-direction: column; gap: 8px; }
.mobile-rank { display: grid; grid-template-columns: 25px 10px 1fr auto; align-items: center; gap: 10px; min-height: 58px; padding: 10px 13px; border: 1px solid #403e38; border-radius: 13px; background: #252421; }
.mobile-rank.mine { border-color: var(--yellow); background: #332f22; }
.mobile-rank > span { color: #77736a; font-size: 11px; font-weight: 900; text-align: center; }
.mobile-rank i { width: 10px; height: 28px; border-radius: 10px; background: var(--team); }
.mobile-rank strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-rank b { color: var(--yellow); font-size: 19px; }
.mobile-winner { padding: 25px 0 28px; text-align: center; }
.mobile-winner > span { display: block; color: var(--yellow); font-size: 60px; }
.mobile-winner h1 { margin-bottom: 10px; font-size: 48px; }
.mobile-winner > p:last-child { color: #aaa69f; }

/* TV display */
.display-page { overflow: hidden; background: #10100f; color: #fff; }
.display-shell { display: flex; min-height: 100vh; flex-direction: column; padding: 2.2vh 3vw 3vh; background-image: radial-gradient(circle at 85% 20%, #302a18 0, transparent 28%), radial-gradient(circle at 5% 90%, #22271f 0, transparent 25%); }
.display-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 6vh; }
.display-head .room-pill { justify-self: end; font-size: clamp(10px, .85vw, 14px); }
.display-progress { color: #8d897f; font-size: clamp(10px, .85vw, 14px); font-weight: 900; letter-spacing: .12em; }
.display-view { display: flex; min-height: 0; flex: 1; flex-direction: column; justify-content: center; }
.display-lobby { display: grid; grid-template-columns: .92fr 1.35fr; gap: 5vw; align-items: center; }
.display-invite h1 { margin: 1.2vh 0 2vh; font-size: clamp(54px, 7.2vw, 125px); line-height: .82; }
.display-invite > p:not(.eyebrow) { max-width: 650px; color: #aaa69f; font-size: clamp(15px, 1.25vw, 23px); }
.display-join-box { display: flex; width: fit-content; align-items: center; gap: 2vw; margin-top: 3vh; padding: 1.3vw; border-radius: 1.4vw; background: #fff; color: var(--ink); box-shadow: 0 25px 90px #0007; }
#display-qr { overflow: hidden; width: min(210px, 12vw); height: min(210px, 12vw); }
#display-qr img, #display-qr canvas { width: 100% !important; height: 100% !important; }
.display-join-box small { display: block; color: var(--muted); font-size: clamp(10px, 1vw, 16px); font-weight: 800; text-transform: uppercase; }
.display-join-box strong { display: block; color: #b47c00; font-size: clamp(33px, 4vw, 68px); letter-spacing: .14em; }
.display-lobby-teams { min-height: 65vh; padding-left: 4vw; border-left: 1px solid #3a3833; }
.lobby-count { display: flex; gap: 2vw; margin-bottom: 2vh; color: #8d897f; font-size: clamp(12px, 1.1vw, 19px); font-weight: 750; }
.tv-team-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1vw; }
.tv-team-grid article { display: grid; grid-template-columns: .7vw 1fr; gap: 0 1vw; min-height: 10vh; align-content: center; padding: 1.2vw; border: 1px solid #3a3833; border-radius: 1.2vw; background: #201f1c; }
.tv-team-grid i { grid-row: 1 / 3; width: .65vw; height: 100%; min-height: 4vh; border-radius: 20px; background: var(--team); }
.tv-team-grid h3 { overflow: hidden; margin: 0; font-size: clamp(17px, 1.7vw, 30px); text-overflow: ellipsis; white-space: nowrap; }
.tv-team-grid p { margin: 3px 0 0; color: #8d897f; font-size: clamp(10px, .9vw, 15px); }
.tv-empty { display: grid; min-height: 55vh; place-items: center; align-content: center; border: 1px dashed #3a3833; border-radius: 1.5vw; color: #706d65; }
.tv-empty span { font-size: 5vw; }
.tv-empty p { font-size: 1.2vw; }
.display-title { margin: 0 auto 4vh; text-align: center; }
.display-title h1 { margin: 0; font-size: clamp(55px, 6vw, 105px); }
.big-leaderboard { display: flex; width: min(1300px, 90vw); flex-direction: column; gap: 1vh; margin: 0 auto; }
.leader-row { display: grid; grid-template-columns: 4vw .8vw 1fr auto 12vw; align-items: center; gap: 1.4vw; min-height: 8vh; padding: .7vw 1.5vw; border: 1px solid #3d3a34; border-radius: 1.1vw; background: #211f1cdd; }
.leader-row.leader { border-color: #7d672b; background: #2c281b; box-shadow: inset .35vw 0 0 var(--yellow); }
.leader-row > span { color: #6f6c64; font-size: clamp(18px, 1.7vw, 32px); font-weight: 900; text-align: center; }
.leader-row > i { width: .7vw; height: 4.5vh; border-radius: 99px; background: var(--team); }
.leader-row > strong { font-size: clamp(20px, 2vw, 36px); }
.leader-row > em { font-size: 1.2vw; font-style: normal; font-weight: 900; }
.leader-row > b { color: var(--yellow); font-size: clamp(28px, 2.8vw, 50px); text-align: right; }
.leader-row > b small { color: #77736b; font-size: .8vw; }
.tv-question-wrap { display: flex; min-height: 82vh; flex-direction: column; justify-content: center; }
.tv-question-meta { display: flex; justify-content: center; gap: 1vw; }
.tv-question-meta span { padding: .5vw .9vw; border-radius: 99px; background: #2d2b27; color: #aaa69c; font-size: clamp(9px, .8vw, 14px); font-weight: 900; text-transform: uppercase; }
.tv-question-meta span:first-child { background: color-mix(in srgb, var(--tag) 28%, #20201d); color: #fff; }
.tv-question-wrap > h1 { max-width: 1500px; margin: 2.8vh auto 4vh; font-size: clamp(40px, 4.2vw, 76px); line-height: 1.06; text-align: center; }
.tv-options { display: grid; width: min(1500px, 93vw); grid-template-columns: repeat(2, 1fr); gap: 1.2vw; margin: 0 auto; }
.tv-option { display: grid; grid-template-columns: 4.2vw 1fr auto; align-items: center; gap: 1.2vw; min-height: 10vh; padding: .8vw 1.2vw; border: 1px solid #403d36; border-radius: 1.1vw; background: #23221f; transition: .35s ease; }
.tv-option > b { display: grid; width: 4vw; height: 4vw; max-height: 7vh; place-items: center; border-radius: 1vw; background: #35332e; color: var(--yellow); font-size: clamp(20px, 1.8vw, 34px); }
.tv-option > span { font-size: clamp(18px, 1.7vw, 31px); font-weight: 700; }
.tv-option em { color: #9ee9cd; font-size: .8vw; font-style: normal; font-weight: 900; }
.tv-option.correct { border-color: var(--green); background: #15392e; box-shadow: 0 0 55px #27b98330, inset 0 0 0 2px var(--green); transform: scale(1.02); }
.tv-option.correct > b { background: var(--green); color: #fff; }
.tv-option.wrong { opacity: .25; filter: grayscale(1); }
.display-team-strip, .round-banner { display: flex; width: min(1500px, 93vw); justify-content: center; gap: .7vw; margin: 3vh auto 0; }
.strip-team, .round-banner > span { display: flex; min-width: 0; flex: 1; align-items: center; gap: .6vw; padding: .65vw .8vw; border-radius: .7vw; background: #22211e; font-size: clamp(9px, .8vw, 14px); }
.strip-team.waiting { opacity: .35; filter: grayscale(1); }
.strip-team > span { color: #6f6b63; }
.strip-team > i, .round-banner i { width: .5vw; height: 1.8vw; border-radius: 99px; background: var(--team); }
.strip-team strong { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
.strip-team b { color: var(--yellow); font-size: 1vw; }
.strip-team em { color: #8c887f; font-size: .65vw; font-style: normal; }
.round-banner > span { justify-content: center; font-weight: 750; }
.round-banner b { margin-left: auto; font-size: 1vw; }
.display-winner { margin: 0 auto 3vh; text-align: center; }
.winner-star { color: var(--yellow); font-size: clamp(50px, 6vw, 100px); filter: drop-shadow(0 0 25px #ffcc3344); }
.display-winner p { margin: 0; color: #aaa69f; font-size: clamp(13px, 1.2vw, 20px); text-transform: uppercase; }
.display-winner h1 { margin: .5vh 0; font-size: clamp(65px, 7.5vw, 130px); line-height: .9; }
.display-winner > strong { color: var(--yellow); font-size: clamp(22px, 2.2vw, 40px); }
.display-prize { display: table; margin: 1.5vh auto 0; padding: .6vw 1.2vw; border-radius: 99px; background: #2d2a22; color: #d9d4c9; font-size: 1.1vw; }
.big-leaderboard.final { width: min(1150px, 85vw); }
.display-message { text-align: center; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  .topbar nav { position: fixed; z-index: 30; right: 12px; bottom: 12px; left: 12px; justify-content: space-around; box-shadow: 0 10px 35px #0003; }
  .user-menu { display: none; }
  .admin-shell { width: min(100% - 26px, 700px); padding-top: 28px; padding-bottom: 95px; }
  .game-grid, .category-grid { grid-template-columns: 1fr 1fr; }
  .console-grid { grid-template-columns: 1fr; }
  .console-side { grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; }
  .control-panel { grid-column: 1 / -1; }
  .console-stage { min-height: 500px; }
}

@media (max-width: 620px) {
  .auth-card { padding: 28px 22px; }
  .db-grid, .form-grid, .form-grid.thirds, .answers-editor { grid-template-columns: 1fr; }
  .split-heading, .console-head { align-items: stretch; flex-direction: column; }
  .game-grid, .category-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip div { min-height: 75px; border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-bar { grid-template-columns: 1fr; }
  .console-links { flex-direction: column; }
  .console-side { grid-template-columns: 1fr; }
  .control-panel { grid-column: auto; }
  .rules-panel { display: none; }
  .lobby-team-grid, .host-options { grid-template-columns: 1fr; }
  .console-stage { padding: 19px; }
  .scoring-note { align-items: flex-start; flex-direction: column; }
  .existing-teams { grid-template-columns: 1fr; }
}
