:root {
  /* Canonical TBLive palette: the artwork background is the site background. */
  --bg: #57bab4;
  --tblive-tv-chrome-safe-top: max(24px, env(safe-area-inset-top));
  --bg-deep: #239a98;
  --ink: #20243a;
  --muted: rgba(32, 36, 58, .68);
  --line: rgba(32, 36, 58, .25);
  --panel: rgba(255, 255, 255, .16);
  --panel-strong: rgba(255, 255, 255, .24);
  --accent: #ffac44;
  --success: #62c78c;
  --danger: #a13d55;
  --white: #fffaf1;
}

@font-face {
  font-family: Raleway;
  src: url('/assets/fonts/Raleway-Medium.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; font-family: Raleway, Inter, system-ui, sans-serif; }
body.no-scroll { height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

.page { width: min(100%, 1180px); min-height: 100dvh; margin: 0 auto; padding: clamp(12px, 3vw, 36px) clamp(12px, 4vw, 54px); display: flex; flex-direction: column; gap: clamp(12px, 2vw, 24px); }
.page.narrow { width: min(100%, 780px); }
.page.wide { width: min(100%, 1600px); }
.page.tv-page { width: 100%; max-width: none; height: 100dvh; overflow: hidden; padding-top: max(clamp(18px, 3vw, 54px), var(--tblive-tv-chrome-safe-top)); padding-right: clamp(20px, 4vw, 76px); padding-bottom: max(clamp(18px, 3vw, 54px), env(safe-area-inset-bottom)); padding-left: clamp(20px, 4vw, 76px); }

.brandbar { position: relative; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 54px; flex: 0 0 auto; text-align: center; }
.brandbar.border { padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.brand { width: min(48vw, 250px); height: auto; display: block; }
.surface-brand-lockup { display: inline-grid; justify-items: center; align-items: center; gap: 4px; }
.surface-brand-lockup .surface-icon { width: clamp(28px, 4vw, 42px); aspect-ratio: 1; object-fit: contain; }
.surface-brand-lockup .brand { width: min(42vw, 220px); }
.brand.small { width: min(42vw, 205px); }
.brandbar > .eyebrow,
.brandbar > .room-status,
.brandbar > div:not(.brand) { position: absolute; right: 0; top: 50%; transform: translateY(-50%); text-align: right; }
.brandbar > .eyebrow { margin: 0; }
.host-brandbar { display: grid; justify-items: center; gap: 4px; flex: 0 0 auto; text-align: center; }
.host-icon { width: clamp(72px, 18vw, 118px); aspect-ratio: 1; object-fit: contain; }
.host-wordmark { width: min(54vw, 238px); max-height: 42px; object-fit: contain; }
.host-brandbar .eyebrow { margin: 7px 0 0; }
.home-brand-lockup, .display-brand-lockup, .tv-brand-lockup { display: grid; justify-items: center; gap: 6px; text-align: center; }
.home-icon, .display-icon, .tv-icon { width: clamp(72px, 18vw, 128px); aspect-ratio: 1; object-fit: contain; }
.home-wordmark, .display-wordmark, .tv-wordmark { width: min(56vw, 250px); max-height: 46px; object-fit: contain; }
.eyebrow { margin: 0 0 7px; font-size: .7rem; font-weight: 900; letter-spacing: .18em; line-height: 1.2; text-transform: uppercase; }
.muted { color: var(--muted); }
.fine { font-size: .78rem; color: var(--muted); }
.error { min-height: 1.3em; margin-top: 9px; color: var(--danger); font-weight: 700; }
.sub { margin: 0 0 18px; line-height: 1.42; }
.hidden { display: none !important; }

.home-page { align-items: center; justify-content: center; text-align: center; }
.home-content { width: min(100%, 690px); display: flex; flex-direction: column; align-items: center; }
.home-brand-lockup { gap: 5px; margin: 0 auto 14px; }
.home-icon { width: clamp(76px, 18vw, 122px); }
.home-wordmark { width: min(58vw, 260px); max-height: 48px; }
.home-page h1 { max-width: 680px; margin: 0; font-size: clamp(2.8rem, 8vw, 6.8rem); line-height: .9; letter-spacing: -.075em; }
.home-page .lead { max-width: 480px; margin: 18px auto 24px; line-height: 1.4; }
.home-actions { width: min(100%, 420px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile, .choice-card, .cta { border: 2px solid var(--ink); border-radius: 14px; background: var(--accent); color: var(--ink); font-weight: 950; text-decoration: none; }
.tile { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 16px; font-size: clamp(1rem, 2.8vw, 1.35rem); }
.tile.secondary, .choice-card.secondary, .cta.secondary { background: var(--panel); }
.tile svg { width: 38px; height: 38px; fill: currentColor; }
.home-foot { margin-top: 18px; color: var(--muted); font-size: .78rem; }

.surface-panel { width: 100%; padding: clamp(16px, 3vw, 28px); border: 2px solid var(--ink); border-radius: 18px; background: var(--panel); }
.surface-panel h1, .surface-panel h2 { margin: 0 0 8px; letter-spacing: -.055em; line-height: .98; }
.surface-panel h1 { font-size: clamp(2rem, 6vw, 4.4rem); }
.surface-panel h2 { font-size: clamp(1.5rem, 4vw, 2.6rem); }
.stack { display: grid; gap: 12px; }
.setup-step { display: grid; gap: 12px; }
.setup-step.mobile-hidden { display: none; }
.setup-nav { display: grid; grid-template-columns: minmax(90px, .65fr) minmax(0, 1.35fr); gap: 10px; align-items: stretch; }
.setup-nav .cta { width: 100%; }
label { display: grid; gap: 7px; font-size: .82rem; font-weight: 900; }
input { width: 100%; height: 48px; border: 2px solid var(--ink); border-radius: 10px; background: var(--white); color: var(--ink); padding: 0 13px; }
input.code-input { text-transform: uppercase; letter-spacing: .16em; font-weight: 950; }
.cta { min-height: 50px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.cta.secondary { color: var(--ink); }
.cta.large { width: 100%; min-height: 58px; font-size: 1.05rem; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1 1 180px; }
.link-button { color: var(--ink); font-weight: 900; }

.choice-section { display: grid; gap: 9px; }
.choice-label { margin: 0; font-size: .76rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.choice-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card { min-height: 58px; padding: 11px 8px; display: grid; place-items: center; text-align: center; font-size: .9rem; }
.choice-card[aria-pressed="true"] { background: var(--ink); color: var(--white); box-shadow: 0 0 0 3px var(--white) inset; }

.room-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.room-code { display: inline-block; padding: 7px 14px; border: 2px solid var(--ink); border-radius: 999px; font-size: clamp(2rem, 8vw, 4.6rem); font-weight: 950; letter-spacing: .18em; line-height: 1; }
.room-status { font-size: .75rem; font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.join-hero { display: grid; grid-template-columns: minmax(160px, 230px) 1fr; align-items: center; gap: clamp(16px, 3vw, 34px); }
.join-qr { width: 100%; aspect-ratio: 1; padding: 10px; border-radius: 12px; background: #fff; border: 2px solid var(--ink); object-fit: contain; }
.join-qr.small { width: min(45vw, 200px); }
.join-url { overflow-wrap: anywhere; color: var(--muted); font-size: .76rem; line-height: 1.25; }
.players-panel { min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.players { display: grid; gap: 8px; min-height: 0; }
.players.scroll { max-height: 38vh; overflow: auto; padding-right: 2px; }
.player-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 9px 12px; border-radius: 10px; background: var(--panel-strong); }
.player-rank { flex: 0 0 28px; text-align: center; font-weight: 950; }
.player-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 850; }
.player-score { flex: 0 0 auto; font-weight: 950; }
.empty-state { min-height: 100px; display: grid; place-items: center; padding: 20px; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }

.countdown-panel { flex: 1; display: grid; place-items: center; text-align: center; }
.countdown-number { margin: 0; font-size: clamp(8rem, 25vw, 18rem); font-weight: 950; line-height: .8; letter-spacing: -.08em; }
.status-line { min-height: 1.4em; color: var(--muted); font-weight: 800; }
.game-shell { min-height: 0; flex: 1; display: grid; grid-template-rows: auto auto 1fr; gap: 12px; }
.game-top { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.streak { font-size: clamp(2.8rem, 9vw, 5.8rem); font-weight: 950; line-height: .85; }
.question-card { min-height: 0; padding: clamp(15px, 3vw, 28px); border-radius: 16px; background: var(--panel); display: flex; flex-direction: column; }
.question { margin: 0 0 16px; font-size: clamp(1.45rem, 4.4vw, 3.1rem); font-weight: 950; line-height: 1.05; letter-spacing: -.045em; }
.answer-grid { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answer { min-height: 62px; border: 2px solid var(--ink); border-radius: 12px; background: var(--panel-strong); color: var(--ink); padding: 10px; font-weight: 900; text-align: left; }
.answer.correct { background: var(--success); }
.answer.wrong { background: #ef8e8e; }
.answer:disabled { opacity: 1; cursor: default; }

.winner-panel { text-align: center; }
.winner-name { margin: 5px 0 20px; font-size: clamp(2rem, 8vw, 5rem); font-weight: 950; line-height: .95; letter-spacing: -.06em; }

.tv-lobby { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 32vw) 1fr; gap: clamp(22px, 5vw, 70px); align-items: center; }
.tv-qr-column { display: grid; justify-items: center; gap: 12px; text-align: center; }
.tv-qr-column .join-qr { width: min(31vw, 420px); }
.tv-qr-column .room-code { font-size: clamp(2.4rem, 6vw, 5rem); }
.tv-copy h1 { margin: 0 0 12px; font-size: clamp(2.8rem, 7vw, 7.5rem); line-height: .9; letter-spacing: -.07em; }
.tv-copy p { max-width: 600px; margin: 0 0 18px; font-size: clamp(1rem, 2vw, 1.55rem); line-height: 1.35; }
.tv-copy .players { margin-top: 20px; }
.tv-copy .player-row { min-height: 52px; padding: 10px 15px; font-size: clamp(1rem, 1.7vw, 1.35rem); }
.tv-copy .cta { width: min(100%, 420px); min-height: 64px; font-size: 1.2rem; }
.tv-scoreboard { min-height: 0; flex: 1; display: grid; grid-template-rows: auto 1fr auto; gap: 15px; }
.scoreboard-head { display: flex; justify-content: space-between; align-items: end; gap: 15px; }
.scoreboard-head h1 { margin: 0; font-size: clamp(2.2rem, 5.5vw, 6rem); line-height: .9; letter-spacing: -.07em; }
.scoreboard-head .room-code { font-size: clamp(1.7rem, 3.4vw, 3rem); }
.scoreboard-list { min-height: 0; display: grid; align-content: start; gap: 10px; overflow: hidden; }
.score-row { display: grid; grid-template-columns: 48px minmax(130px, 25%) 1fr 120px; align-items: center; gap: 15px; min-height: clamp(52px, 8vh, 82px); padding: 10px 16px; border: 2px solid var(--ink); border-radius: 13px; background: var(--panel); }
.score-row .rank { font-size: clamp(1.3rem, 2.5vw, 2.1rem); font-weight: 950; text-align: center; }
.score-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(1rem, 2vw, 1.65rem); font-weight: 900; }
.score-track { height: 17px; border-radius: 999px; background: rgba(32,36,58,.18); overflow: hidden; }
.score-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.score-value { text-align: right; font-size: clamp(1rem, 2vw, 1.5rem); font-weight: 950; }
.race-board { min-height: 0; display: grid; align-content: start; gap: clamp(12px, 2vh, 20px); overflow: hidden; }
.race-lane { display: grid; gap: 8px; text-align: center; }
.race-lane-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.race-rank { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--panel-strong); font-size: 1.25rem; font-weight: 950; }
.race-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: clamp(1.15rem, 2.6vw, 2rem); font-weight: 950; }
.race-score { min-width: 78px; font-size: clamp(1rem, 2vw, 1.45rem); }
.race-track { position: relative; min-height: clamp(34px, 5vh, 52px); border: 2px solid var(--ink); border-radius: 999px; background: rgba(32,36,58,.12); overflow: visible; }
.race-track::before { content: ''; position: absolute; inset: 0 12px 0 0; border-radius: inherit; background: repeating-linear-gradient(90deg, transparent 0 9.5%, rgba(32,36,58,.13) 9.5% 10%); pointer-events: none; }
.race-track-fill { position: relative; z-index: 1; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffbf4f); transition: width .45s ease; }
.race-runner { position: absolute; z-index: 2; top: 50%; width: 30px; height: 30px; display: grid; place-items: center; transform: translate(-50%, -50%); border: 3px solid var(--ink); border-radius: 50%; background: var(--white); transition: left .45s ease; }
.race-runner::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.race-finish { position: absolute; z-index: 3; top: 50%; right: -9px; width: 18px; height: 34px; transform: translateY(-50%); border: 2px solid var(--ink); border-radius: 4px; background: repeating-linear-gradient(0deg, var(--ink) 0 5px, var(--white) 5px 10px), repeating-linear-gradient(90deg, transparent 0 5px, rgba(255,255,255,.8) 5px 10px); background-blend-mode: difference; }
.tv-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .85rem; }
.tv-footer .cta { min-width: 220px; }
.host-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.host-controls .cta { width: 100%; }
.tv-winner { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 30px; background: rgba(87,186,181,.96); text-align: center; }
.tv-winner-card { width: min(100%, 760px); padding: clamp(28px, 6vw, 70px); border: 2px solid var(--ink); border-radius: 24px; background: var(--panel-strong); }
.tv-winner-card h1 { margin: 5px 0 28px; font-size: clamp(3.2rem, 10vw, 9rem); line-height: .86; letter-spacing: -.08em; }
.tv-winner-card .cta { min-width: min(100%, 360px); min-height: 62px; }
.display-intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 30px; background: var(--bg); color: var(--ink); text-align: center; transition: opacity .35s ease; }
.display-intro.is-hidden { opacity: 0; pointer-events: none; }
.display-intro-splash, .display-intro-rules { width: min(100%, 820px); display: grid; justify-items: center; gap: 14px; }
.display-brand-lockup { gap: 5px; }
.display-icon { width: clamp(78px, 13vw, 132px); }
.display-wordmark { width: min(34vw, 280px); max-height: 52px; }
.display-intro-splash p { margin: 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.4rem); }
.display-intro-rules h1 { margin: 0; font-size: clamp(2.5rem, 6vw, 6rem); line-height: .9; letter-spacing: -.07em; }
.display-intro-rules > p:not(.eyebrow) { max-width: 600px; margin: 0 0 12px; font-size: clamp(1rem, 2vw, 1.45rem); line-height: 1.35; }
.display-intro-rules .cta { min-width: 240px; }
.tv-overlay-page { align-items: center; justify-content: center; text-align: center; }
.tv-splash { display: grid; justify-items: center; gap: 18px; animation: tv-fade-in .45s ease both; }
.tv-splash .tv-brand-lockup { gap: 8px; }
.tv-splash .tv-icon { width: clamp(100px, 16vw, 180px); }
.tv-splash .tv-wordmark { width: min(38vw, 360px); max-height: 68px; }
.tv-splash p { margin: 0; font-size: clamp(1rem, 2vw, 1.5rem); color: var(--muted); }
.tv-rules { width: min(100%, 1080px); display: grid; justify-items: center; gap: 16px; }
.tv-rules .tv-brand-lockup { margin-bottom: 10px; }
.tv-rules .tv-icon { width: clamp(84px, 11vw, 132px); }
.tv-rules .tv-wordmark { width: min(30vw, 280px); max-height: 52px; }
.tv-rules h1 { max-width: 850px; margin: 0 0 10px; font-size: clamp(2.5rem, 6vw, 6.4rem); line-height: .9; letter-spacing: -.07em; }
.tv-rule-grid { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 18px; }
.tv-rule { min-height: 145px; padding: 18px; display: grid; align-content: center; justify-items: center; gap: 8px; border: 2px solid var(--ink); border-radius: 16px; background: var(--panel); }
.tv-rule span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); border: 2px solid var(--ink); font-weight: 950; }
.tv-rule strong { font-size: clamp(1rem, 1.8vw, 1.35rem); }
.tv-rule small { color: var(--muted); font-size: .85rem; }
.tv-rules .cta { width: min(100%, 380px); }
.tv-launcher { display: grid; gap: 14px; }
.tv-existing { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-top: 4px; }
.tv-existing .cta { min-height: 48px; }
@keyframes tv-fade-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }

.admin-page { width: min(100%, 1000px); }
.admin-card { padding: 18px; border-radius: 16px; background: rgba(11,95,90,.92); color: var(--white); }
.admin-card .muted { color: #a8eee7; }
.admin-card .cta { border-color: var(--white); background: var(--accent); }
.admin-table-wrap { overflow: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid rgba(255,250,241,.18); text-align: left; vertical-align: top; }
th { color: #a8eee7; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }

@media (max-width: 700px) {
  .brandbar { min-height: 48px; }
  .brandbar > .eyebrow,
  .brandbar > .room-status,
  .brandbar > div:not(.brand) { position: static; transform: none; }
  .brandbar > .room-status { position: absolute; right: 0; top: 50%; transform: translateY(-50%); max-width: 34%; font-size: .68rem; }
  .brandbar > .eyebrow { display: none; }
  .brand { width: min(58vw, 220px); }
  .host-controls { grid-template-columns: 1fr; }
  .page { padding: 10px 12px 12px; gap: 10px; }
  .page.mobile-locked { height: 100dvh; overflow: hidden; }
  .brandbar.border { padding-bottom: 7px; border-bottom: 0; }
  .host-brandbar { gap: 2px; }
  .host-icon { width: clamp(64px, 18vw, 92px); }
  .host-wordmark { width: min(48vw, 190px); max-height: 34px; }
  .host-brandbar .eyebrow { margin-top: 5px; }
  .brand { width: min(58vw, 240px); }
  .home-page { padding: 10px 12px 12px; }
  .home-brand-lockup { gap: 3px; margin-bottom: 9px; }
  .home-icon { width: clamp(64px, 21vw, 96px); }
  .home-wordmark { width: min(54vw, 210px); max-height: 38px; }
  .home-page h1 { font-size: clamp(2.45rem, 11vw, 4.8rem); }
  .home-page .lead { margin: 12px auto 16px; font-size: .9rem; }
  .home-actions { width: min(100%, 330px); gap: 8px; }
  .tile { border-radius: 12px; padding: 10px; font-size: .93rem; }
  .tile svg { width: 29px; height: 29px; }
  .surface-panel { padding: 16px; border-radius: 15px; }
  .surface-panel h1 { font-size: clamp(1.9rem, 9vw, 3rem); }
  #setupView { padding-top: 8px; padding-bottom: 8px; gap: 8px; }
  #setupView .surface-panel { padding: 13px; }
  #setupView .surface-panel h1 { font-size: clamp(1.9rem, 8vw, 2.7rem); }
  #setupView .surface-panel .sub { margin-bottom: 10px; font-size: .84rem; }
  #setupView .stack { gap: 9px; }
  #setupView .choice-section { gap: 6px; }
  #setupView .choice-grid { gap: 7px; }
  #setupView .choice-card { min-height: 46px; padding: 8px 6px; }
  #setupView label { gap: 5px; }
  #setupView input { height: 44px; }
  #setupView .cta.large { min-height: 48px; }
  #setupView > .link-button { font-size: .82rem; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-card { min-height: 52px; font-size: .82rem; }
  .join-hero { grid-template-columns: minmax(92px, 30vw) 1fr; gap: 13px; }
  .join-qr { padding: 7px; }
  .room-code { font-size: clamp(1.7rem, 9vw, 3.3rem); }
  .players.scroll { max-height: 30vh; }
  .game-shell { gap: 8px; }
  .question-card { padding: 13px; }
  .question { margin-bottom: 10px; font-size: clamp(1.25rem, 6vw, 2rem); }
  .answer-grid { gap: 7px; }
  .answer { min-height: 54px; padding: 8px; font-size: .86rem; }
  .tv-page { padding: 14px; }
  .display-intro { padding: 18px; }
  .display-brand-lockup { gap: 3px; }
  .display-icon { width: clamp(70px, 21vw, 100px); }
  .display-wordmark { width: min(52vw, 220px); max-height: 40px; }
  .tv-splash .tv-icon { width: clamp(76px, 24vw, 120px); }
  .tv-splash .tv-wordmark { width: min(58vw, 250px); max-height: 44px; }
  .tv-lobby { grid-template-columns: 33vw 1fr; gap: 14px; }
  .tv-qr-column .join-qr { width: 31vw; }
  .tv-copy h1 { font-size: clamp(2rem, 7vw, 3.6rem); }
  .tv-copy p { font-size: .9rem; }
  .tv-copy .player-row { min-height: 42px; font-size: .9rem; }
  .score-row { grid-template-columns: 26px minmax(78px, 23%) 1fr 62px; gap: 7px; min-height: 45px; padding: 7px 8px; }
  .score-track { height: 11px; }
  .score-row .name, .score-value { font-size: .82rem; }
  .tv-footer { font-size: .7rem; }
  .tv-footer .cta { min-width: 150px; min-height: 46px; font-size: .85rem; }
  .tv-rule-grid { grid-template-columns: 1fr; gap: 8px; margin: 4px 0 10px; }
  .tv-rule { min-height: 0; padding: 11px; grid-template-columns: 34px 1fr; justify-items: start; text-align: left; }
  .tv-rule span { grid-row: span 2; }
  .tv-rule small { font-size: .75rem; }
  .tv-existing { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .join-hero { grid-template-columns: 1fr; text-align: center; }
  .join-qr.small, .join-hero .join-qr { width: min(52vw, 180px); margin: 0 auto; }
  .join-hero .room-code { font-size: 2.5rem; }
  .home-page h1 { font-size: clamp(2.3rem, 12vw, 3.7rem); }
}

@media (max-height: 700px) and (max-width: 700px) {
  .home-page .lead { margin: 8px auto 10px; }
  .home-foot { margin-top: 8px; }
  .surface-panel { padding: 12px; }
  .choice-card { min-height: 44px; }
}

/* TriviaDash visual pass: use the standalone canonical wordmark at its intrinsic ratio. */
.brand,
.host-wordmark,
.home-wordmark,
.display-wordmark,
.tv-wordmark {
  object-fit: contain;
  object-position: center;
}
.brand { height: clamp(32px, 4vw, 40px); }
.host-wordmark { height: clamp(30px, 4vw, 38px); }
.home-wordmark { height: clamp(36px, 5vw, 48px); }
.display-wordmark { height: clamp(38px, 5vw, 50px); }
.tv-wordmark { height: clamp(44px, 6vw, 60px); }

.surface-panel,
.question-card,
.countdown-panel,
.game-shell,
.tv-copy,
.tv-lobby,
.tv-scoreboard,
.winner-panel {
  text-align: center;
}
.surface-panel > *,
.question-card > *,
.tv-copy > *,
.winner-panel > * { margin-left: auto; margin-right: auto; }
label { text-align: center; }
input { text-align: center; }
.room-head,
.game-top,
.scoreboard-head { justify-content: center; text-align: center; }
.room-head > *,
.game-top > *,
.scoreboard-head > * { align-items: center; }
.button-row,
.setup-nav { justify-content: center; }
.button-row > *,
.setup-nav > * { flex: 0 1 320px; }

.cta,
.tile,
.choice-card,
.answer {
  box-shadow: 0 4px 0 rgba(32, 36, 58, .22);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.cta:hover:not(:disabled),
.tile:hover,
.choice-card:hover,
.answer:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(32, 36, 58, .22);
}
.cta:active:not(:disabled),
.tile:active,
.choice-card:active,
.answer:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(32, 36, 58, .22);
}
.cta { background: var(--accent); color: var(--ink); }
.cta.secondary,
.tile.secondary,
.choice-card.secondary { background: rgba(255, 250, 241, .28); }
.choice-card[aria-pressed="true"] { background: var(--ink); color: var(--white); }

.question-card { justify-content: center; }
.question { max-width: 900px; text-align: center; }
.answer-grid {
  width: 100%;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, 1fr);
  align-content: stretch;
  gap: clamp(10px, 1.8vw, 18px);
}
.answer {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2vw, 24px);
  text-align: center;
  font-size: clamp(1.15rem, 3.2vw, 2.15rem);
  line-height: 1.08;
}
.player-row,
.score-row { text-align: center; }
.player-row .player-name,
.score-row .name { text-align: center; }

@media (max-width: 700px) {
  .surface-panel,
  .question-card { padding: 16px; }
  .answer-grid { gap: 10px; grid-auto-rows: minmax(108px, 1fr); }
  .answer { min-height: 108px; font-size: clamp(1.15rem, 5.2vw, 1.7rem); }
  .question { font-size: clamp(1.5rem, 6.5vw, 2.3rem); }
  .cta.large { min-height: 56px; font-size: 1.05rem; }
  .choice-card { min-height: 58px; font-size: .98rem; }
  .tv-copy { text-align: center; }
}

/* The host is also a player: keep live play and its controls inside one phone viewport. */
@media (max-width: 700px) {
  #gameView {
    gap: 5px;
    padding-top: 5px;
    padding-bottom: 6px;
  }
  #gameView .host-brandbar { gap: 0; }
  #gameView .host-icon { width: 48px; }
  #gameView .host-wordmark { width: min(42vw, 160px); height: 24px; }
  #gameView .host-brandbar .room-status { font-size: .62rem; line-height: 1; }
  #gameView .game-shell {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 6px;
  }
  #gameView .game-top { min-height: 58px; }
  #gameView .game-top .eyebrow { margin-bottom: 3px; font-size: .62rem; }
  #gameView .streak { font-size: clamp(2.35rem, 10vw, 3.8rem); }
  #gameView .game-top .status-line { font-size: .84rem; }
  #gameView #gameError { margin: 0; }
  #gameView .question-card { padding: 10px; overflow: hidden; }
  #gameView .question { margin-bottom: 7px; font-size: clamp(1.16rem, 5.3vw, 1.65rem); line-height: 1.02; }
  #gameView .answer-grid { gap: 7px; grid-auto-rows: minmax(58px, 1fr); }
  #gameView .answer { min-height: 58px; padding: 7px; font-size: clamp(1rem, 4.8vw, 1.35rem); }
  #gameView .host-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 0; }
  #gameView .host-controls .cta { min-height: 46px; padding: 0 7px; font-size: .86rem; }
}

/* Keep the host room start surface inside a phone viewport. */
@media (max-width: 700px) {
  #lobbyView {
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  #lobbyView .host-brandbar { gap: 1px; }
  #lobbyView .host-icon { width: 64px; }
  #lobbyView .host-wordmark { width: min(44vw, 170px); height: 27px; }
  #lobbyView .host-brandbar .eyebrow { margin-top: 2px; font-size: .62rem; }
  #lobbyView .surface-panel { min-height: 0; padding: 11px; overflow: hidden; }
  #lobbyView .room-head { gap: 8px; }
  #lobbyView .room-head .eyebrow { margin-bottom: 3px; }
  #lobbyView .room-code { padding: 5px 11px; font-size: clamp(1.55rem, 8vw, 2.55rem); }
  #lobbyView .room-status { font-size: .64rem; }
  #lobbyView .join-hero,
  #lobbyView .join-hero .join-qr { width: auto; }
  #lobbyView .join-hero {
    grid-template-columns: minmax(128px, 42vw) minmax(0, 1fr);
    gap: 10px;
    margin-top: 9px !important;
  }
  #lobbyView .join-hero .join-qr {
    width: 100%;
    max-width: 164px;


   }
}

/* TBLive create CTA standard: TV mirrors the phone create flow. */
.tv-create-chrome{position:relative;justify-content:center;min-height:clamp(56px,8vh,88px)}
.tv-create-chrome .brand{width:min(260px,34vw);max-height:58px;object-fit:contain}
.tv-back{position:absolute;left:0;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:46px;height:46px;border-radius:14px;background:rgba(255,255,255,.10);color:inherit;text-decoration:none;font-size:2rem;font-weight:900}
.tv-back:focus-visible{outline:4px solid currentColor;outline-offset:4px}
.tv-launcher{display:grid;gap:clamp(14px,2.2vh,24px)}
.tv-launcher .choice-section{display:grid;gap:8px}
.tv-launcher .choice-label{margin:0;font-weight:900;letter-spacing:.08em;text-transform:uppercase}
.tv-launcher .choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.tv-launcher .choice-card{min-height:74px;border:2px solid rgba(255,255,255,.18);border-radius:18px;background:rgba(255,255,255,.07);color:inherit;font:inherit;font-weight:850;cursor:pointer;transition:transform .15s,background .15s,border-color .15s}
.tv-launcher .choice-card[aria-pressed="true"]{background:var(--accent,#f3c969);border-color:var(--accent,#f3c969);color:#17100b;box-shadow:0 0 0 3px rgba(255,255,255,.18)}
.tv-launcher .choice-card:focus-visible{outline:4px solid #fff;outline-offset:4px;transform:scale(1.03)}
.tv-launcher .cta.large{min-height:60px;font-size:1.08rem;font-weight:950}
.tv-create-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:6px;padding-top:16px;border-top:1px solid rgba(255,255,255,.16);color:rgba(255,255,255,.68);font-size:.8rem}
.tv-create-footer .cta{min-width:110px}
@media(max-width:700px){.tv-launcher .choice-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.tv-launcher .choice-card{min-height:64px;font-size:.88rem}.tv-create-footer span{display:none}}

/* TBLive TriviaDash TV completion */
.tv-body{min-height:100dvh;overflow:hidden;/* safe-area token is defined at :root and updated by viewport.js */}.tv-lobby-rules{margin-top:18px;padding:14px 16px;border:2px solid rgba(255,255,255,.18);border-radius:18px;background:rgba(255,255,255,.08);text-align:left}.tv-lobby-rules .eyebrow{margin:0 0 8px}.tv-lobby-rules p{margin:5px 0;color:var(--muted)}.tv-winner-actions{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}.tv-winner-actions .cta{min-width:180px}@media(max-width:700px){.tv-lobby-rules{margin-top:10px;padding:10px 12px;font-size:.82rem}.tv-winner-actions{gap:8px}.tv-winner-actions .cta{min-width:145px}}

