/* The live exam room (views/*.ejs). Standalone pages: no site menu or footer, the Optimize lockup in the
   corner. Uses only the tokens in base.css (--brand, --ink, --muted, --line…).
   The big screen (.qz-screen) sizes its type from the viewport so a 720p projector and a 4K TV both
   fit one question with its four options without scrolling; the phone page (.qz-phone) is a single column. */

.qz { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.qz [hidden] { display: none !important; }
.qz ol, .qz ul { list-style: none; }
.qz-muted { color: var(--muted); font-weight: 400; }
.qz .eyebrow { margin-bottom: 12px; }

/* ───────── Top bar ───────── */
.qz-top { display: flex; align-items: center; gap: 16px; padding: 16px clamp(16px, 3vw, 48px); border-bottom: 1px solid var(--line); }
.qz-logo { display: block; flex: none; }
.qz-logo img { display: block; height: clamp(32px, 3vw, 44px); width: auto; }
.qz-top-title { flex: 1; text-align: center; font: 600 clamp(1rem, 1.3vw, 1.375rem)/1.2 var(--font-display); }
.qz-top-code { margin-left: auto; color: var(--muted); font-size: .9375rem; }
.qz-top-code b { color: var(--ink); font-family: var(--font-display); letter-spacing: .08em; }
.qz-ghost { flex: none; background: transparent; color: var(--ink); border: 1px solid #2E2E2E; border-radius: var(--radius-md); padding: 10px 16px;
  font: 600 .9375rem/1.2 var(--font-sans); cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.qz-ghost:hover { border-color: var(--brand); color: var(--brand); }
.qz-ghost.is-ready { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ───────── Shared type ───────── */
.qz-h1 { font: 600 clamp(1.75rem, 3.4vw, 3.25rem)/1.08 var(--font-display); letter-spacing: -.02em; margin: 0 0 16px; }
.qz-h2 { font: 600 1.375rem/1.2 var(--font-display); margin: 32px 0 12px; }
.qz-lead { font-size: clamp(1.0625rem, 1.4vw, 1.375rem); line-height: 1.5; color: var(--muted); margin: 0 0 16px; }
.qz-lead b { color: var(--ink); }
.qz-error { color: var(--danger); font-weight: 600; margin: 12px 0 0; }
.qz-label { display: block; font-weight: 600; margin: 16px 0 8px; }
.qz-input { width: 100%; min-height: 56px; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid #3A3A3A; background: #0D0D0D; color: var(--ink);
  font: 500 1.125rem/1.2 var(--font-sans); }
.qz-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.qz-input-code { text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-display); font-weight: 600; }
.qz-row { display: flex; gap: 12px; }
.qz-row .qz-input { flex: 1; min-width: 0; }

/* ───────── Landing ───────── */
.qz-landing-body { width: 100%; max-width: 1000px; margin: 0 auto; padding: clamp(32px, 7vw, 96px) 24px 64px; }
.qz-landing .qz-lead { max-width: 40em; }
.qz-landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 32px; }
.qz-card { border: 1px solid var(--line); border-radius: 20px; background: #0D0D0D; padding: 28px; display: flex; flex-direction: column; align-items: flex-start; }
.qz-card h2 { font: 600 1.375rem/1.2 var(--font-display); margin: 0 0 8px; }
.qz-card p { color: var(--muted); margin: 0 0 20px; }
.qz-card .qz-label { margin-top: auto; }
.qz-card .qz-row { width: 100%; }

/* ───────── Big screen ───────── */
.qz-screen .qz-view { flex: 1; display: flex; padding: clamp(20px, 3.2vw, 64px); }
.qz-qr { display: block; background: #FFF; border-radius: clamp(12px, 1.6vw, 28px); padding: clamp(10px, 1.2vw, 24px); }
.qz-qr svg { display: block; width: 100%; height: auto; }

.qz-lobby { align-items: center; justify-content: center; gap: clamp(32px, 6vw, 120px); }
.qz-lobby > .qz-qr { width: min(40vw, 62vh); flex: none; }
.qz-lobby-text { max-width: 720px; min-width: 0; }
.qz-lobby .qz-h1 { font-size: clamp(2rem, 3.6vw, 4rem); }
.qz-url { color: var(--ink); white-space: nowrap; }
.qz-code { font: 600 clamp(3.5rem, 8vw, 9rem)/1 var(--font-display); letter-spacing: .14em; color: var(--brand); margin: 8px 0 20px; }
.qz-facts { color: var(--muted); font-size: clamp(1rem, 1.2vw, 1.25rem); margin: 0 0 24px; }
.qz-count { font: 600 clamp(1.125rem, 1.6vw, 1.75rem)/1.2 var(--font-display); margin: 0 0 12px; }
.qz-count b { color: var(--brand); }
.qz-names { display: flex; flex-wrap: wrap; gap: 8px; max-height: 7.5em; overflow: hidden; margin: 0 0 28px; font-size: clamp(.9375rem, 1.05vw, 1.125rem); }
.qz-names li { background: #1C1C1C; border: 1px solid #2E2E2E; border-radius: var(--radius-full); padding: 4px 14px; max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-names .qz-more { background: transparent; color: var(--muted); }
.qz-start { min-width: 260px; }

.qz-screen .qz-question { flex-direction: column; gap: clamp(14px, 2vh, 28px); }
.qz-qhead { display: flex; align-items: center; gap: 16px; }
.qz-qnum { font: 600 clamp(1.125rem, 1.6vw, 1.75rem)/1.2 var(--font-display); }
.qz-qnum b { color: var(--brand); }
.qz-subject { border: 1px solid #2E2E2E; background: #1C1C1C; color: #D6D6D6; border-radius: var(--radius-full); padding: 4px 14px; font-size: clamp(.875rem, 1vw, 1.0625rem); font-weight: 600; }
.qz-subject:empty { display: none; }
.qz-timer { margin-left: auto; font: 600 clamp(2.25rem, 4.6vw, 5.5rem)/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--brand); }
.qz-timer.is-warn { color: var(--danger); }
.qz-bar { height: clamp(8px, 1vh, 14px); border-radius: var(--radius-full); background: #1C1C1C; overflow: hidden; }
.qz-bar span { display: block; height: 100%; width: 100%; background: var(--brand); border-radius: inherit; transition: width .2s linear; }
.qz-qhead:has(.is-warn) + .qz-bar span { background: var(--danger); }
.qz-screen .qz-qtext { font: 600 clamp(1.625rem, 3.3vw, 4rem)/1.18 var(--font-display); letter-spacing: -.015em; margin: clamp(8px, 2vh, 24px) 0; max-width: 34em; text-wrap: balance; }
.qz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 24px); }
.qz-options li { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 24px); border: 1px solid #2E2E2E; background: #0D0D0D; border-radius: clamp(12px, 1.4vw, 24px);
  padding: clamp(14px, 2vh, 28px) clamp(16px, 1.8vw, 32px); font-size: clamp(1.125rem, 2vw, 2.25rem); line-height: 1.25; font-weight: 500; }
.qz-letter { flex: none; display: inline-grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; background: var(--brand); color: var(--on-brand);
  font: 600 1em/1 var(--font-display); }
.qz-opt { min-width: 0; overflow-wrap: anywhere; }
.qz-qfoot { margin-top: auto; display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: clamp(.9375rem, 1.1vw, 1.25rem); }
.qz-answered b { color: var(--ink); }
.qz-minijoin { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.qz-minijoin b { color: var(--ink); }
.qz-qr-mini { width: clamp(56px, 5vw, 96px); padding: 4px; border-radius: 8px; }
.qz-controls { display: flex; gap: 8px; }

.qz-screen .qz-done { flex-direction: column; align-items: center; text-align: center; }
.qz-done .qz-h1 { font-size: clamp(2.25rem, 4.4vw, 4.5rem); }
.qz-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: 10px 32px;
  width: min(100%, 1400px); margin: 16px 0 32px; text-align: left; }
.qz-board.is-short { grid-template-columns: minmax(0, 820px); grid-template-rows: none; grid-auto-flow: row; justify-content: center; }
.qz-board li { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); background: #0D0D0D; border-radius: 16px; padding: clamp(8px, 1.2vh, 16px) 20px;
  font-size: clamp(1.0625rem, 1.6vw, 1.75rem); }
.qz-rank { flex: none; width: 2em; height: 2em; display: grid; place-items: center; border-radius: 50%; background: #1C1C1C; font: 600 .9em/1 var(--font-display); }
.qz-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.qz-pscore { flex: none; font: 600 1em/1 var(--font-display); font-variant-numeric: tabular-nums; }
.qz-board .qz-podium-1 { border-color: var(--brand); }
.qz-board .qz-podium-1 .qz-rank { background: var(--brand); color: var(--on-brand); }
.qz-board .qz-podium-1 .qz-pscore { color: var(--brand); }
.qz-board .qz-podium-2 .qz-rank, .qz-board .qz-podium-3 .qz-rank { background: #2E2E2E; }
.qz-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.qz-done-actions form { margin: 0; }
.qz-key { counter-reset: k; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 32px; width: min(100%, 1400px); margin: 32px 0 0; text-align: left; }
.qz-key li { counter-increment: k; border-top: 1px solid var(--line); padding: 10px 0 0 2.2em; position: relative; font-size: clamp(.9375rem, 1.05vw, 1.125rem); }
.qz-key li::before { content: counter(k) '.'; position: absolute; left: 0; top: 10px; color: var(--muted); font-weight: 600; }
.qz-key-q { display: block; color: var(--muted); }
.qz-key-a { display: block; color: var(--brand); font-weight: 600; margin-top: 2px; }

@media (max-width: 900px) {
  .qz-lobby { flex-direction: column; text-align: center; }
  .qz-lobby > .qz-qr { width: min(80vw, 360px); }
  .qz-names { justify-content: center; }
  .qz-options, .qz-board, .qz-key { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .qz-qfoot { flex-wrap: wrap; }
  .qz-top-title { display: none; }
  .qz-screen .qz-top { justify-content: space-between; }
}

/* ───────── Phone ───────── */
.qz-phone .qz-view { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 20px 48px; }
.qz-phone .qz-h1 { font-size: clamp(1.75rem, 7vw, 2.25rem); }
.qz-center { text-align: center; padding-top: 12vh !important; }
.qz-big-tick { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font: 600 2rem/1 var(--font-display); margin: 0 0 20px; }
.qz-join .btn { width: 100%; margin-top: 16px; }
.qz-phone .qz-qhead { gap: 10px; }
.qz-phone .qz-qnum { font-size: 1.0625rem; }
.qz-phone .qz-subject { font-size: .8125rem; padding: 3px 10px; }
.qz-phone .qz-timer { font-size: 1.75rem; }
.qz-phone .qz-bar { height: 8px; margin: 12px 0 16px; }
.qz-phone .qz-qtext { font: 600 1.25rem/1.35 var(--font-display); margin: 0 0 20px; }
.qz-choices { display: grid; gap: 12px; }
.qz-choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; text-align: left; cursor: pointer;
  border: 2px solid #2E2E2E; background: #0D0D0D; color: var(--ink); border-radius: 16px; font: 500 1.0625rem/1.3 var(--font-sans);
  transition: border-color .15s, background .15s; -webkit-tap-highlight-color: transparent; }
.qz-choice .qz-letter { width: 2.25em; height: 2.25em; background: #1C1C1C; color: var(--ink); border: 1px solid #3A3A3A; }
.qz-choice.is-picked { border-color: var(--brand); background: rgba(181, 230, 29, .12); }
.qz-choice.is-picked .qz-letter { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.qz-choice:disabled { cursor: default; opacity: .55; }
.qz-choice.is-picked:disabled { opacity: 1; }
.qz-status { min-height: 1.5em; margin: 16px 0 0; color: var(--muted); font-size: .9375rem; }
.qz-score { font: 600 clamp(4rem, 22vw, 6rem)/1 var(--font-display); margin: 8px 0 12px; }
.qz-score b { color: var(--brand); }
.qz-score span { color: var(--muted); font-size: .4em; }
.qz-review { display: grid; gap: 12px; }
.qz-review li { border: 1px solid var(--line); border-left: 4px solid var(--danger); border-radius: 12px; padding: 14px 16px; background: #0D0D0D; }
.qz-review li.is-right { border-left-color: var(--brand); }
.qz-review p { margin: 0; }
.qz-rv-q { font-weight: 600; margin-bottom: 6px !important; }
.qz-rv-mine { color: var(--danger); }
.is-right .qz-rv-mine { color: var(--brand); }
.qz-rv-right { color: var(--brand); }
.qz-rv-why { color: var(--muted); font-size: .9375rem; margin-top: 6px !important; }

.qz-offline { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1C1C1C; border: 1px solid #3A3A3A; color: var(--ink);
  padding: 8px 16px; border-radius: var(--radius-full); font-size: .9375rem; z-index: 10; }
