/* CQ 主持人端版面：大螢幕、後台、編輯器、登入。顏色一律用 theme.css 的變數，這裡不寫色碼。 */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font-body); font-weight: 500; line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden], .hidden { display: none !important; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.center { text-align: center; }
.label { font-size: 15px; font-weight: 700; color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- 頂部列 ---------- */
.bar { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 10px; padding-inline: clamp(16px, 3vw, 40px); background: var(--surface); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-num); font-weight: 900; font-size: 26px; color: var(--ink); text-decoration: none; }
.dots { display: flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.bar #title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--muted); }
.bar nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.bar nav a { font-weight: 700; color: var(--muted); text-decoration: none; }
.conn { font-size: 14px; font-weight: 700; color: var(--good); }
.conn.bad { color: var(--bad); }

/* ---------- 按鈕、標籤、表單 ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform 0.08s, border-color 0.15s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--onaccent); box-shadow: var(--press); }
.btn.danger { color: var(--bad); }
.btn.big { padding: 15px 34px; font-size: 21px; border-radius: 18px; }
.btn.quiet { padding: 6px 14px; font-size: 14px; border-radius: 999px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.chip { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 18px; background: var(--surface); color: var(--ink); font-size: clamp(15px, 1.2vw, 22px); font-weight: 700; box-shadow: var(--shadow); }
.chip.hint { background: var(--accent); color: var(--onaccent); font-weight: 900; }

input[type=text], input[type=password], input[type=number], textarea, select { background: var(--surface2); border: 2px solid transparent; border-radius: 12px; padding: 10px 14px; font-size: 17px; font-weight: 500; color: var(--ink); }
input[type=text], input[type=password], textarea { width: 100%; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.6; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
input[type=file] { width: 100%; border: 2px dashed var(--line); border-radius: 12px; padding: 12px; font-size: 14px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; color: var(--onaccent); background: var(--accent); border: 0; border-radius: 10px; padding: 8px 14px; margin-right: 12px; cursor: pointer; }
.field { display: grid; gap: 6px; }
.err { color: var(--bad); min-height: 1.4em; font-size: 15px; font-weight: 700; }
code { font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 13px; background: var(--surface2); padding: 1px 6px; border-radius: 6px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.8; }

/* ---------- 登入 ---------- */
.login { min-height: calc(100vh - 64px); display: grid; place-items: center; padding-inline: 16px; }
.login form { width: min(440px, 100%); display: grid; gap: 20px; background: var(--surface); border-radius: 28px; padding: 32px; box-shadow: var(--shadow); }
.login h1 { font-size: clamp(34px, 6vw, 48px); font-weight: 900; line-height: 1.1; }

/* ---------- 後台與編輯器 ---------- */
.page { max-width: 1080px; margin-inline: auto; padding-block: clamp(24px, 4vw, 48px); padding-inline: clamp(16px, 3vw, 40px); display: grid; gap: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(34px, 4.4vw, 52px); font-weight: 900; line-height: 1.1; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border-radius: 20px; padding: 18px 22px; box-shadow: var(--shadow); }
.list-row .title { font-size: 21px; font-weight: 900; }
.list-row .meta { font-size: 14px; font-weight: 700; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

dialog { margin: auto; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; background: var(--surface); color: var(--ink); border: 0; border-radius: 24px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18, 21, 43, 0.55); }
dialog form { display: grid; gap: 18px; padding: 28px; }
dialog h2 { font-size: 28px; font-weight: 900; }

.editor-head { display: grid; gap: 10px; background: var(--surface); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.editor-head input { font-size: clamp(26px, 3.4vw, 40px); font-weight: 900; }
.add-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.qcard { background: var(--surface); border-radius: 20px; padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.qhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qhead .no { min-width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface2); font-family: var(--font-num); font-weight: 900; }
.qhead .type { border-radius: 999px; background: var(--accent); color: var(--onaccent); padding: 3px 14px; font-size: 14px; font-weight: 900; }
.qhead .spacer { flex: 1; }
.opts { display: grid; gap: 8px; }
.optrow { display: flex; gap: 10px; align-items: center; }
.swatch { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--c); color: var(--cink); display: grid; place-items: center; }
.swatch svg { width: 22px; height: 22px; }
.nums { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
.nums label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.nums input[type=number] { width: 100px; }
.check { display: inline-flex !important; gap: 8px; align-items: center; font-size: 15px; font-weight: 700; }
.status { font-size: 14px; min-height: 1.3em; color: var(--muted); font-weight: 700; }
.status.bad { color: var(--bad); }
.media-file { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- 大螢幕共用 ---------- */
.stage { padding-block: clamp(18px, 2.4vw, 40px); padding-inline: clamp(16px, 3vw, 56px); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-top: clamp(18px, 2.4vw, 36px); }
.hint-line { color: var(--muted); font-size: 16px; font-weight: 700; margin-top: 12px; }

/* ---------- 大廳 ---------- */
.join-card { display: flex; justify-content: space-between; align-items: center; gap: clamp(20px, 4vw, 60px); flex-wrap: wrap; background: var(--surface); border-radius: 32px; padding: clamp(20px, 3vw, 44px); box-shadow: var(--shadow); }
.join-copy { display: grid; gap: 10px; min-width: 0; }
.join-url { font-size: clamp(20px, 1.9vw, 34px); font-weight: 700; }
.join-url strong { color: var(--accent); font-weight: 900; }
.pin { font-family: var(--font-num); font-weight: 900; font-size: clamp(88px, 10vw, 190px); line-height: 0.95; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qr { background: #FFFFFF; padding: 14px; border-radius: 20px; width: clamp(180px, 15vw, 270px); flex: none; box-shadow: var(--shadow); }
.qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.lobby-bar { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: clamp(18px, 2.4vw, 32px); }
.count { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.count b { font-family: var(--font-num); font-weight: 900; font-size: clamp(46px, 4.2vw, 76px); line-height: 1; color: var(--accent); }
.count .big-label { font-size: clamp(18px, 1.4vw, 24px); font-weight: 900; }
.count .muted { font-size: clamp(15px, 1.2vw, 20px); font-weight: 700; }
.names { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.name { appearance: none; border: 0; border-radius: 999px; background: var(--c); color: var(--cink); padding: 9px 20px; font-size: clamp(18px, 1.5vw, 26px); font-weight: 900; cursor: pointer; box-shadow: var(--press); }
.name.new { animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
.name:hover { outline: 3px solid var(--bad); outline-offset: 2px; text-decoration: line-through; }
.name.off { opacity: 0.45; }
.names.small { margin-top: 10px; gap: 6px; }
.names.small .name { font-size: 15px; padding: 4px 12px; }
@keyframes pop { from { transform: scale(0.5); opacity: 0; } }
.teams { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.team { background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); border-top: 6px solid var(--c); }
.team-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 20px; font-weight: 900; }
.team-name small { font-family: var(--font-num); font-size: 15px; color: var(--muted); }
.seats { display: grid; grid-template-columns: repeat(var(--cap, 6), 1fr); gap: 4px; margin-top: 8px; }
.seats i { height: 8px; border-radius: 99px; background: var(--track); display: block; }
.seats i.on { background: var(--c); }
.drawer { margin-top: 24px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding-inline: 22px; }
.drawer summary { cursor: pointer; padding-block: 16px; font-size: 18px; font-weight: 900; list-style: none; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary::before { content: "＋ "; }
.drawer[open] summary::before { content: "－ "; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px 36px; padding-bottom: 22px; }
.settings fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.settings legend { padding: 0; margin-bottom: 6px; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; }

/* ---------- 讀題 ---------- */
.ready { min-height: calc(100vh - 150px); display: grid; align-content: center; justify-items: center; gap: clamp(18px, 2.6vw, 40px); text-align: center; }
.hint-card { display: grid; justify-items: center; gap: 6px; background: var(--accent); color: var(--onaccent); border-radius: 28px; padding: clamp(16px, 2vw, 28px) clamp(28px, 3vw, 52px); box-shadow: var(--press); }
.hint-card .new { font-size: clamp(14px, 1.1vw, 20px); font-weight: 900; background: var(--onaccent); color: var(--accent); border-radius: 999px; padding: 2px 12px; }
.hint-card b { font-size: clamp(30px, 2.8vw, 52px); font-weight: 900; line-height: 1.2; }
.hint-card .long { font-size: clamp(20px, 1.8vw, 34px); font-weight: 700; }
.ready-text { font-size: clamp(40px, 4.4vw, 84px); font-weight: 900; line-height: 1.25; max-width: 24ch; text-wrap: balance; }
.ready-bar { width: min(900px, 80%); height: 14px; border-radius: 99px; background: var(--track); overflow: hidden; }
.ready-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; animation: fill linear forwards; }
@keyframes fill { to { width: 100%; } }

/* ---------- 作答中 ---------- */
.q-text { font-size: clamp(34px, 3.6vw, 68px); font-weight: 900; line-height: 1.22; text-align: center; margin-block: clamp(14px, 1.8vw, 28px); text-wrap: balance; }
.q-text.small { font-size: clamp(26px, 2.6vw, 46px); }
.q-mid { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-block: clamp(10px, 1.6vw, 26px); }
.timer { --p: 1; width: clamp(120px, 10vw, 190px); aspect-ratio: 1; max-width: 100%; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 360deg), var(--track) 0); }
.timer b { width: 80%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-family: var(--font-num); font-weight: 900; font-size: clamp(48px, 4.4vw, 84px); }
.answered { text-align: right; }
.answered b { display: block; font-family: var(--font-num); font-weight: 900; font-size: clamp(60px, 5.4vw, 104px); line-height: 1; }
.answered span { font-size: clamp(16px, 1.3vw, 24px); font-weight: 700; color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { display: flex; align-items: center; gap: 22px; min-height: clamp(96px, 11vh, 150px); padding: 16px 28px; border-radius: 22px; background: var(--c); color: var(--cink); font-size: clamp(24px, 2.4vw, 46px); font-weight: 900; line-height: 1.25; box-shadow: var(--press); }
.tile svg { width: clamp(38px, 3.2vw, 60px); height: auto; flex: none; }
.tile .txt { min-width: 0; overflow-wrap: anywhere; }
.tile .ok { margin-left: auto; font-size: 1.2em; }
.tile.dim { opacity: 0.28; }
.tile.right { outline: 5px solid var(--ink); outline-offset: 4px; }
.order-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.order-list span { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 24px; font-size: clamp(22px, 2vw, 38px); font-weight: 900; display: flex; gap: 14px; align-items: baseline; }
.order-list b { font-family: var(--font-num); color: var(--accent); }
.slider-range { display: flex; align-items: center; gap: 20px; font-family: var(--font-num); font-weight: 900; font-size: clamp(36px, 3vw, 58px); }
.slider-range i { flex: 1; height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--a2), var(--a4), var(--a3), var(--a1)); }

/* ---------- 公布答案 ---------- */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 160px); justify-content: center; gap: clamp(18px, 3vw, 56px); height: clamp(220px, 32vh, 380px); margin-block: 10px 24px; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 8px; min-height: 0; }
.bar-col.dim { opacity: 0.3; }
.bar-n { font-family: var(--font-num); font-weight: 900; font-size: clamp(30px, 2.8vw, 56px); line-height: 1; }
.bar-track { width: 100%; display: flex; align-items: flex-end; min-height: 0; }
.bar-fill { width: 100%; min-height: 8px; border-radius: 16px 16px 6px 6px; background: var(--c); box-shadow: var(--press); transform-origin: bottom; animation: grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes grow { from { transform: scaleY(0); } }
.bar-key { display: flex; align-items: center; gap: 6px; color: var(--c); font-size: clamp(24px, 2vw, 38px); font-weight: 900; }
.bar-key svg { width: clamp(34px, 2.8vw, 54px); height: auto; flex: none; }
.big-answer { display: grid; justify-items: center; gap: 8px; margin-block: 20px; }
.big-answer b { font-family: var(--font-num); font-weight: 900; font-size: clamp(110px, 11vw, 210px); line-height: 1; color: var(--accent); }

/* ---------- 排行榜 ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: clamp(20px, 3vw, 56px); margin-top: clamp(16px, 2.4vw, 40px); }
.board h2 { margin-bottom: 10px; font-size: clamp(20px, 1.6vw, 28px); font-weight: 900; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rows li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 64px; gap: 18px; align-items: center; background: var(--surface); border-radius: 20px; padding: 12px 20px; box-shadow: var(--shadow); font-size: clamp(24px, 2.2vw, 42px); font-weight: 900; animation: slide 0.45s ease-out backwards; }
.rows li:nth-child(2) { animation-delay: 0.08s; }
.rows li:nth-child(3) { animation-delay: 0.16s; }
.rows li:nth-child(4) { animation-delay: 0.24s; }
.rows li:nth-child(5) { animation-delay: 0.32s; }
@keyframes slide { from { transform: translateY(16px); opacity: 0; } }
.rank { width: clamp(44px, 3.6vw, 68px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--track); font-size: 0.8em; }
.rank.r1 { background: var(--gold); color: var(--medal-ink); }
.rank.r2 { background: var(--silver); color: var(--medal-ink); }
.rank.r3 { background: var(--bronze); color: var(--medal-ink); }
.rows .who { display: grid; gap: 6px; min-width: 0; }
.rows .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .who em { display: block; height: 8px; border-radius: 99px; background: var(--accent); width: var(--w); }
.rows .moved { font-size: 0.6em; text-align: right; }
.rows .up { color: var(--good); }
.rows .down { color: var(--bad); }
.rows.compact li { font-size: clamp(18px, 1.5vw, 26px); padding: 8px 16px; animation: none; }
.hush { text-align: center; font-size: clamp(28px, 2.6vw, 48px); font-weight: 900; margin-block: 60px; color: var(--muted); }

/* ---------- 頒獎台 ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 300px)); justify-content: center; align-items: end; gap: clamp(12px, 2vw, 32px); height: clamp(360px, 52vh, 600px); margin-top: 20px; }
.step { display: grid; grid-template-rows: auto auto 1fr; justify-items: center; gap: 6px; height: 100%; min-width: 0; animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.step .who { font-size: clamp(24px, 2.3vw, 44px); font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .score { font-family: var(--font-num); font-weight: 900; font-size: clamp(22px, 1.8vw, 34px); color: var(--muted); }
.step .block { align-self: end; width: 100%; border-radius: 24px 24px 0 0; display: grid; place-items: start center; padding-top: 18px; box-shadow: var(--press); color: var(--medal-ink); }
.step .block span { font-family: var(--font-num); font-weight: 900; font-size: clamp(64px, 6vw, 120px); line-height: 1; }
.step.p1 .block { height: 100%; background: var(--gold); }
.step.p2 .block { height: 70%; background: var(--silver); }
.step.p3 .block { height: 48%; background: var(--bronze); }
.step.p3 { animation-delay: 0.2s; }
.step.p2 { animation-delay: 1.1s; }
.step.p1 { animation-delay: 2s; }
.step.empty { visibility: hidden; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- 影片頁 ---------- */
.media { display: grid; gap: 22px; justify-items: center; text-align: center; }
.media .q-head { width: 100%; }
.media-title { font-size: clamp(32px, 3.6vw, 64px); font-weight: 900; text-wrap: balance; }
.media video { width: min(100%, 1400px); max-height: calc(100dvh - 450px); /* 量過：上方列＋頁碼＋標題＋按鈕約佔 430px，影片再高就把「下一頁」擠出畫面 */ border-radius: 20px; background: #000000; box-shadow: var(--shadow); }
.media-empty { display: grid; justify-items: center; gap: 14px; width: min(900px, 100%); background: var(--surface); border-radius: 28px; padding: clamp(28px, 4vw, 60px); box-shadow: var(--shadow); }
.media-empty .note { font-size: clamp(15px, 1.2vw, 20px); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 開場說明 ---------- */
.intro-title { font-size: clamp(36px, 4vw, 72px); font-weight: 900; line-height: 1.2; text-align: center; margin-top: clamp(12px, 1.6vw, 24px); text-wrap: balance; }
.intro-sub { text-align: center; font-size: clamp(20px, 1.8vw, 32px); font-weight: 700; color: var(--muted); margin-top: 6px; }
.intro-sub b { color: var(--accent); font-size: 1.3em; }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); gap: clamp(16px, 2vw, 32px); margin-top: clamp(18px, 2.4vw, 36px); }
.intro-card { background: var(--surface); border-radius: 28px; padding: clamp(18px, 2vw, 32px); box-shadow: var(--shadow); }
.intro-card h2 { font-size: clamp(22px, 1.8vw, 32px); font-weight: 900; margin-bottom: 14px; }
.type-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.type-list li { display: flex; gap: 16px; align-items: center; }
.type-list b { display: flex; gap: 10px; align-items: baseline; font-size: clamp(20px, 1.7vw, 30px); font-weight: 900; }
.type-list b small { font-size: 0.7em; color: var(--muted); }
.type-list span:not(.type-badge) { display: block; font-size: clamp(16px, 1.3vw, 24px); font-weight: 700; color: var(--muted); }
.type-badge { flex: none; width: clamp(48px, 3.6vw, 64px); aspect-ratio: 1; border-radius: 16px; background: var(--c); color: var(--cink); display: grid; place-items: center; box-shadow: var(--press); }
.type-badge svg { width: 58%; height: auto; }
.rule-list { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; font-size: clamp(18px, 1.5vw, 28px); font-weight: 700; }
.rule-list li::marker { color: var(--accent); font-family: var(--font-num); font-weight: 900; }

/* ---------- 課後報表 ---------- */
.report { display: grid; gap: clamp(16px, 2vw, 28px); }
.report-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border-radius: 22px; padding: 16px 20px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.stat b { font-size: clamp(36px, 3vw, 56px); line-height: 1; color: var(--accent); }
.stat.warn b { color: var(--bad); }
.stat span { font-weight: 700; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.rtable { width: 100%; border-collapse: collapse; font-size: clamp(15px, 1.1vw, 20px); }
.rtable th { text-align: left; font-size: 0.85em; color: var(--muted); font-weight: 900; padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.rtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; vertical-align: top; }
.rtable tr.flag td { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.flag-tag { display: inline-block; border-radius: 999px; padding: 1px 10px; background: var(--bad); color: var(--onbad); font-size: 0.8em; font-weight: 900; white-space: nowrap; }

/* ---------- 手機遙控 QR ---------- */
.remote-qr { justify-self: center; width: 240px; }

/* ---------- 頒獎台逐一揭曉 ---------- */
.step, .step.p1, .step.p2, .step.p3 { animation: none; }
.step.waiting .block { opacity: 0.3; }
.step.waiting .who { color: var(--muted); }
.step.shown .who, .step.shown .score { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.step.shown .block { animation: grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-origin: bottom; }
.finale.revealing { cursor: pointer; }

/* ---------- 頒獎典禮（2026-09-15 改版：舞台燈、頭像、金銀銅台座、完整排名與接下來） ---------- */
.finale { position: relative; isolation: isolate; }
.finale::before { content: ""; position: absolute; left: 50%; top: 40px; width: min(1400px, 100%); height: 78vh; transform: translateX(-50%); background: radial-gradient(ellipse 48% 58% at 50% 52%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%); z-index: -1; pointer-events: none; }
.finale-head { text-align: center; display: grid; gap: 6px; margin-top: clamp(4px, 1vw, 12px); }
.finale-kicker { font-size: clamp(16px, 1.3vw, 24px); font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.finale-title { font-size: clamp(44px, 4.6vw, 88px); font-weight: 900; line-height: 1.1; }
.finale-head .hint-line { margin-top: 0; }
.finale .podium { height: clamp(430px, 56vh, 640px); gap: clamp(18px, 2.6vw, 44px); margin-top: clamp(16px, 2vw, 32px); }
.step { grid-template-rows: auto auto auto 1fr; gap: 8px; }
.step.p1 { --medal: var(--gold); }
.step.p2 { --medal: var(--silver); }
.step.p3 { --medal: var(--bronze); }
.step .avatar { position: relative; width: clamp(76px, 6.2vw, 116px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink); font-size: clamp(34px, 3vw, 56px); font-weight: 900; box-shadow: 0 0 0 7px var(--medal), var(--shadow); }
.step.p1 .avatar { width: clamp(92px, 7.4vw, 136px); }
.step.p1.shown .avatar::before { content: "👑"; position: absolute; top: -0.78em; font-size: 0.62em; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18)); }
.step .who { font-size: clamp(24px, 2.2vw, 42px); }
.step .score { font-family: var(--font-body); font-size: clamp(16px, 1.3vw, 24px); font-weight: 700; color: var(--muted); }
.step .score b { font-family: var(--font-num); font-size: clamp(28px, 2.4vw, 46px); color: var(--ink); }
.step .block { display: grid; align-content: start; justify-items: center; gap: 2px; padding-top: clamp(16px, 2vw, 28px); border-radius: 30px 30px 0 0; background: linear-gradient(180deg, color-mix(in srgb, var(--medal) 72%, #FFFFFF), var(--medal) 55%, color-mix(in srgb, var(--medal) 88%, #000000)); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), inset 0 -14px 24px rgba(0, 0, 0, 0.08), 0 18px 40px color-mix(in srgb, var(--medal) 35%, transparent); }
.step .block .rank-num { font-family: var(--font-num); font-weight: 900; font-size: clamp(72px, 6.6vw, 136px); line-height: 1; }
.step .block .rank-word { font-size: clamp(16px, 1.3vw, 24px); font-weight: 900; opacity: 0.72; }
.step.waiting .avatar { color: var(--muted); box-shadow: 0 0 0 7px var(--track), var(--shadow); animation: breathe 1.8s ease-in-out infinite; }
.step.waiting .who { color: var(--muted); font-size: clamp(18px, 1.5vw, 28px); }
.step.waiting .block { background: var(--track); box-shadow: none; opacity: 0.55; color: var(--muted); }
.step.shown .avatar { animation: pop-avatar 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes breathe { 50% { transform: scale(0.93); opacity: 0.7; } }
@keyframes pop-avatar { from { transform: scale(0.3); opacity: 0; } }
.finale-bottom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: clamp(16px, 2vw, 32px); margin-top: clamp(20px, 2.6vw, 40px); }
@media (max-width: 960px) { .finale-bottom { grid-template-columns: 1fr; } }
.finale-card { background: var(--surface); border-radius: 28px; padding: clamp(18px, 2vw, 30px); box-shadow: var(--shadow); display: grid; gap: 12px; align-content: start; }
.finale-card h2 { font-size: clamp(20px, 1.6vw, 28px); font-weight: 900; }
.finale-card .sub-h { margin-top: 12px; }
.actions-card .btn { width: 100%; }
/* 台座至少裝得下名次數字，不會溢出壓到下方卡片 */
.step .block { min-height: clamp(150px, 17vh, 200px); overflow: hidden; }
.step.p2 .block .rank-num, .step.p3 .block .rank-num { font-size: clamp(56px, 4.8vw, 100px); }

/* ---------- QR code 放大、減隊 ---------- */
button.qr { border: 0; cursor: zoom-in; display: grid; gap: 6px; justify-items: center; font: inherit; transition: transform 0.15s; }
button.qr:hover { transform: scale(1.03); }
.qr-hint { font-size: 13px; font-weight: 700; color: #4E5578; }
.pin[title] { cursor: zoom-in; }
.qr-overlay { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; place-items: center; align-content: center; gap: 2vh; padding: 3vh 16px; cursor: zoom-out; text-align: center; }
.qr-big { background: #FFFFFF; padding: 2.6vh; border-radius: 32px; box-shadow: var(--shadow); width: min(72vh, 90vw); }
.qr-big img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.qr-big-pin { font-weight: 900; font-size: clamp(48px, 8vh, 110px); line-height: 1; letter-spacing: 0.04em; }
.qr-big-url { font-size: clamp(18px, 2.6vh, 32px); font-weight: 700; color: var(--muted); }
.team-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- 題目圖片 ---------- */
.q-media { flex: 1; display: grid; place-items: center; min-width: 0; }
.q-media img { max-width: 100%; max-height: 38vh; border-radius: 20px; background: #FFFFFF; box-shadow: var(--shadow); object-fit: contain; }
.reveal-media img { max-height: 18vh; }
.reveal-media { margin-block: 4px 12px; }
.ready-image { max-width: min(1100px, 90%); max-height: 42vh; border-radius: 24px; background: #FFFFFF; box-shadow: var(--shadow); object-fit: contain; }
.image-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.q-thumb { height: 72px; max-width: 160px; border-radius: 10px; background: #FFFFFF; box-shadow: var(--shadow); object-fit: contain; }

/* 影片庫：編輯器的影片頁選單、大螢幕上方的預載狀態 */
.media-lib { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.media-lib label:first-child { display: grid; gap: 6px; flex: 1 1 320px; min-width: 0; }
.media-lib select { max-width: 100%; }
.media-status.bad { color: var(--bad); }

/* Logo：四格色塊（2026-09-15 Miles 選定 B） */
.brand .logo { width: 1.15em; height: 1.15em; flex: none; }
.ver { font-family: var(--font-num); font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: 0.02em; }

/* 雙倍分數：出題前全螢幕「2×」，不擋作答 */
.double-splash { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 6px; pointer-events: none; background: var(--accent); color: var(--onaccent); animation: splash-fade 2.6s ease both; }
.double-splash b { font-family: var(--font-num); font-weight: 900; font-size: clamp(120px, 22vw, 320px); line-height: 1; text-shadow: 0 8px 0 rgba(0, 0, 0, 0.18); animation: splash-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.double-splash span { font-weight: 900; font-size: clamp(28px, 4vw, 64px); animation: splash-pop 0.7s 0.12s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes splash-pop { from { transform: scale(0.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes splash-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .double-splash, .double-splash b, .double-splash span { animation-duration: 0.01s; } .double-splash { animation: splash-fade 2.6s steps(1, end) both; } }

/* 大螢幕作答畫面：整頁剛好一個螢幕，色塊貼齊底部（2026-09-15） */
.question { display: flex; flex-direction: column; min-height: calc(100dvh - 62px - clamp(36px, 4.8vw, 80px)); }
.question .q-mid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.question .q-mid .answered { grid-column: 3; }
.question .tiles { flex: 1; grid-auto-rows: minmax(clamp(110px, 15vh, 240px), 1fr); margin-top: clamp(10px, 1.6vw, 24px); }
.question .tiles:has(> :nth-child(5)) { grid-auto-rows: minmax(clamp(90px, 11vh, 180px), 1fr); }
.question:not(.has-image) .q-text { font-size: clamp(40px, 4.2vw, 80px); }
.answered { text-align: center; display: grid; justify-items: center; }
.answered span { white-space: nowrap; }

/* 排行榜：隊伍賽以隊伍為主 */
.board.team-first { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.board.team-first .side h2 { color: var(--muted); }
.board.team-first .side .rows li { grid-template-columns: auto minmax(0, 1fr) auto; }
.board.team-first .side .rows .moved { display: none; }
@media (max-width: 1100px) { .board.team-first { grid-template-columns: 1fr; } }
