:root {
  color-scheme: light;
  --canvas: #f4efe2;
  --glow: #fdfaf2;
  --surface: #fbf7ea;
  --ink: #2c2740;
  --secondary: #6f6887;
  --faint: #a29cb8;
  --outline: #ddd6c3;
  --rule: #e4ddcb;
  --accent: #b07f1e;
  --accent-text: #825c12;
  --coral: #c05038;
  --slate: #50779e;
  --sage: #3f7659;
  --berry: #815276;
  --shadow: 0 24px 80px rgb(44 39 64 / .08);
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  --sans: Avenir Next, Avenir, Inter, ui-sans-serif, system-ui, sans-serif;
}

[data-theme="midnight"] {
  color-scheme: dark;
  --canvas: #0d0f1e;
  --glow: #1b2038;
  --surface: #171a2c;
  --ink: #f0ecda;
  --secondary: #8f86ae;
  --faint: #5f5980;
  --outline: #2d3250;
  --rule: #232741;
  --accent: #e8b34b;
  --accent-text: #f2ca72;
  --coral: #e0705a;
  --slate: #7d9fc4;
  --sage: #6da783;
  --berry: #b17da8;
  --shadow: 0 24px 80px rgb(0 0 0 / .24);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 72% 18%, var(--glow), transparent 32rem), var(--canvas); font: 400 16px/1.5 var(--sans); }
button, input, textarea, select { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 20; top: -4rem; left: 1rem; padding: .7rem 1rem; background: var(--ink); color: var(--canvas); }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-header, .presenter-header { height: 76px; padding: 0 clamp(18px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.wordmark { text-decoration: none; font-family: var(--serif); font-size: 1.45rem; letter-spacing: -.03em; }
.wordmark span { color: var(--accent); }
.text-link { color: var(--secondary); font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; text-decoration: none; }
.eyebrow, .field-label { display: block; margin: 0 0 12px; color: var(--secondary); font-size: .7rem; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
.home-layout { width: min(1180px, calc(100% - 36px)); min-height: calc(100vh - 76px); margin: auto; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: clamp(3rem, 8vw, 9rem); }
.intro-copy h1 { margin-bottom: 28px; font-size: clamp(3.3rem, 7vw, 7rem); line-height: .94; }
.lede { max-width: 39rem; color: var(--secondary); font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.55; }
.join-card, .auth-panel { padding: clamp(28px, 4vw, 48px); border: 1px solid var(--outline); border-radius: 14px; background: color-mix(in srgb, var(--surface), transparent 8%); box-shadow: var(--shadow); }
.code-row { display: flex; gap: 10px; }
input, textarea, select { width: 100%; border: 1px solid var(--outline); border-radius: 8px; background: transparent; padding: .82rem .9rem; }
textarea { resize: vertical; min-height: 90px; }
.code-row input { min-width: 0; font-size: 1.35rem; letter-spacing: .15em; text-transform: uppercase; }
button { padding: .82rem 1.12rem; border-radius: 8px; background: var(--ink); color: var(--canvas); font-size: .78rem; font-weight: 650; letter-spacing: .06em; }
button:hover { opacity: .88; }
button:disabled { cursor: not-allowed; opacity: .45; }
.field-help, .form-error { margin: 10px 0 0; color: var(--secondary); font-size: .78rem; }
.form-error { min-height: 1.2em; color: var(--coral); }
.center-layout { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 24px; }
.auth-panel { width: min(430px, 100%); }
.auth-panel h1 { font-size: 3rem; }
.auth-panel button { width: 100%; margin-top: 20px; }
.header-actions { display: flex; gap: 8px; }
.quiet-button, .icon-button, .small-button { background: transparent; color: var(--secondary); border: 1px solid var(--outline); }
.icon-button { width: 40px; padding-inline: 0; }
.small-button { padding: .55rem .8rem; color: var(--ink); }
.admin-layout { min-height: calc(100vh - 76px); display: grid; grid-template-columns: minmax(260px, 330px) 1fr; }
.quiz-index { padding: 36px 24px; border-right: 1px solid var(--rule); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading h1 { margin: 0 0 24px; font-size: 2rem; }
.quiz-list { display: grid; gap: 6px; }
.quiz-list-item { width: 100%; display: block; padding: 14px; text-align: left; background: transparent; color: var(--ink); border: 1px solid transparent; }
.quiz-list-item:hover, .quiz-list-item.active { opacity: 1; border-color: var(--outline); background: var(--surface); }
.quiz-list-item strong { display: block; font-family: var(--serif); font-size: 1.05rem; font-weight: 400; }
.quiz-list-item span { color: var(--secondary); font-size: .72rem; }
.editor { padding: clamp(28px, 5vw, 72px); }
.empty-state { display: grid; place-items: center; text-align: center; color: var(--secondary); }
.empty-mark { display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 20px; border: 1px solid var(--outline); border-radius: 50%; color: var(--accent); font: 2.4rem var(--serif); }
.editor-head { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; padding-bottom: 32px; border-bottom: 1px solid var(--rule); }
.title-input { padding: 0; border: 0; border-radius: 0; font: 400 clamp(2.2rem, 4vw, 4rem)/1 var(--serif); letter-spacing: -.04em; }
.title-input:focus { outline: 0; border-bottom: 1px solid var(--accent); }
.description-input { margin-top: 14px; padding-left: 0; min-height: 42px; border: 0; color: var(--secondary); }
.editor-actions { display: flex; gap: 8px; }
.sequence-head { margin: 38px 0 18px; display: flex; align-items: center; justify-content: space-between; }
.sequence-head h2 { margin: 0; font-size: 1.6rem; }
.add-menu { display: flex; gap: 6px; }
.add-menu button { color: var(--ink); background: transparent; border: 1px solid var(--outline); }
.block-list { display: grid; }
.block-row { min-width: 0; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 18px 4px; border-top: 1px solid var(--rule); }
.block-number { color: var(--faint); font: 1.1rem var(--serif); text-align: center; }
.block-copy { min-width: 0; }
.block-kind { color: var(--secondary); font-size: .64rem; font-weight: 650; text-transform: uppercase; letter-spacing: .12em; }
.block-copy h3 { margin: 3px 0; overflow: hidden; font-family: var(--serif); font-size: 1.2rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.block-note { color: var(--secondary); font-size: .75rem; }
.block-actions { display: flex; gap: 4px; }
.block-actions button { padding: .5rem .65rem; background: transparent; color: var(--secondary); border: 1px solid transparent; }
.block-actions button:hover { border-color: var(--outline); opacity: 1; }
.repeat-move-control { position: fixed; z-index: 25; padding: .5rem .65rem; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent-text); background: var(--surface); box-shadow: 0 5px 18px rgb(44 39 64 / .16); }
dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--outline); border-radius: 14px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(13 15 30 / .6); backdrop-filter: blur(3px); }
.report-dialog { width: min(1380px, calc(100% - 32px)); height: min(860px, calc(100vh - 32px)); max-height: none; padding: 0; overflow: hidden; }
.report-dialog #report-content { height: 100%; padding: 28px; overflow: auto; }
.participants-dialog { width: min(680px, calc(100% - 32px)); padding: 0; overflow: hidden; }
.participants-dialog #participants-content { max-height: calc(100vh - 48px); padding: 28px; overflow: auto; }
.participant-manager-help { margin: 12px 0 24px; color: var(--secondary); font-size: .8rem; }
.participant-rename-list { display: grid; gap: 8px; }
.participant-rename-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.participant-rename-row input { width: 100%; }
.participant-rename-row .form-error { grid-column: 1 / -1; margin: -2px 0 4px; }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.report-head h2 { margin: 0; font-size: 2.4rem; }
.report-head-actions { display: flex; gap: 6px; }
.report-toolbar { margin: 24px 0 16px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.report-toolbar label { width: min(360px, 100%); }
.report-toolbar p { margin: 0; color: var(--secondary); font-size: .8rem; }
.report-matrix-wrap { overflow: auto; border: 1px solid var(--outline); border-radius: 10px; }
.report-matrix { min-width: 900px; width: 100%; border-collapse: collapse; font-size: .76rem; }
.report-matrix th, .report-matrix td { height: 42px; padding: 6px 10px; border-bottom: 1px solid var(--rule); text-align: center; }
.report-matrix thead th { position: sticky; z-index: 2; top: 0; color: var(--secondary); background: var(--surface); }
.report-matrix th:first-child { position: sticky; z-index: 1; left: 0; min-width: 190px; text-align: left; background: var(--surface); }
.report-matrix thead th:first-child { z-index: 3; }
.report-matrix tbody tr.selected { background: color-mix(in srgb, var(--accent), transparent 91%); }
.report-matrix tbody th button { width: 100%; padding: 4px 0; color: var(--ink); background: transparent; text-align: left; }
.report-answer { width: 24px; height: 24px; margin: auto; display: grid; place-items: center; border: 1px solid var(--outline); border-radius: 50%; }
.report-answer.correct { color: var(--sage); border-color: var(--sage); }
.report-answer.wrong { color: var(--coral); border-color: color-mix(in srgb, var(--coral), transparent 30%); }
.report-answer.unanswered { color: var(--faint); }
.report-detail { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--rule); }
.report-detail-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.report-detail-head h3 { margin: 0; font: 400 2.3rem/1 var(--serif); }
.report-detail-head > strong { color: var(--accent-text); font: 400 1.7rem var(--serif); }
.report-question-list { margin-top: 20px; display: grid; gap: 8px; }
.report-question-list article { padding: 14px 16px; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.2fr); align-items: center; gap: 24px; border: 1px solid var(--outline); border-radius: 8px; }
.report-question-list article.correct { border-left: 3px solid var(--sage); }
.report-question-list article.wrong { border-left: 3px solid var(--coral); }
.report-question-list article.unanswered { border-left: 3px solid var(--faint); }
.report-question-list article h4 { margin: 2px 0 0; font: 400 1rem/1.3 var(--serif); }
.report-question-list article > div:first-child > span { color: var(--secondary); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; }
.report-answer-detail { display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(130px, 1fr) 70px 78px; align-items: center; gap: 12px; color: var(--secondary); font-size: .74rem; }
.report-answer-detail > strong { color: var(--ink); text-align: right; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 24px; }
.dialog-head h2 { margin: 0; font-size: 2rem; }
.dialog-close { padding: .35rem .55rem; color: var(--secondary); background: transparent; }
.form-grid { display: grid; gap: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice-editor { display: grid; gap: 8px; }
.choice-row { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; }
.choice-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.media-preview { max-width: 100%; max-height: 220px; border-radius: 8px; }
.upload-status { color: var(--secondary); font-size: .75rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.danger-button { color: var(--coral); background: transparent; border: 1px solid color-mix(in srgb, var(--coral), transparent 60%); }
.session-pill { padding: .45rem .75rem; border: 1px solid var(--outline); border-radius: 10px; color: var(--secondary); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.session-pill strong { color: var(--ink); letter-spacing: .14em; }
.presenter { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-rows: 76px minmax(0, 1fr); overflow: hidden; }
.stage { min-height: 0; padding: clamp(24px, 5vw, 76px); display: grid; align-items: center; overflow: auto; }
.stage.lobby-stage { padding-block: clamp(20px, 3vw, 40px); }
.stage-loading { margin: auto; color: var(--secondary); text-align: center; }
.pulse { display: block; width: 20px; height: 20px; margin: 0 auto 16px; border: 1px solid var(--accent); border-radius: 50%; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .35; } }
.lobby { width: min(1220px, 100%); margin: auto; display: grid; grid-template-columns: minmax(400px, 1fr) minmax(520px, 650px); grid-template-rows: auto 1fr; align-items: start; column-gap: clamp(36px, 5vw, 72px); row-gap: 20px; }
.lobby-copy { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.lobby h1 { margin-bottom: 20px; font-size: clamp(3rem, 6vw, 6.8rem); line-height: .95; }
.join-instruction { color: var(--secondary); font-size: 1.15rem; }
.join-code { display: inline-block; margin-top: 28px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); font: 300 clamp(2.6rem, 5vw, 5rem)/1 var(--sans); letter-spacing: .15em; }
.qr-frame { width: min(310px, 30vw); padding: 18px; grid-column: 2; grid-row: 1; justify-self: end; border: 1px solid var(--outline); border-radius: 14px; background: #fdfaf2; }
.qr-frame img { display: block; width: 100%; }
.lobby.dense .qr-frame { width: min(250px, 25vw); padding: 14px; }
.lobby.compact .qr-frame { width: min(210px, 22vw); padding: 12px; }
.room-count { margin-top: 30px; color: var(--secondary); }
.room-count strong { color: var(--ink); font-size: 1.2rem; }
.participant-cloud-wrap { min-height: 220px; grid-column: 2; grid-row: 2; padding-top: 8px; }
.participant-cloud-wrap .eyebrow { margin-bottom: 10px; }
.participant-cloud { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; }
.participant-chip { padding: .42rem .72rem; border: 1px solid var(--outline); border-radius: 10px; color: var(--ink); background: color-mix(in srgb, var(--surface), transparent 18%); font-size: .78rem; }
.participant-cloud.dense { gap: 4px 6px; }
.participant-cloud.dense .participant-chip { padding: .24rem .48rem; font-size: .68rem; line-height: 1.2; }
.participant-cloud.compact { gap: 4px; }
.participant-cloud.compact .participant-chip { padding: .22rem .45rem; font-size: .64rem; line-height: 1.15; }
.participant-chip.new { animation: participant-arrive .32s ease-out both; border-color: color-mix(in srgb, var(--accent), var(--outline) 45%); }
.participant-cloud-empty { color: var(--secondary); font: italic .9rem var(--serif); }
@keyframes participant-arrive { from { opacity: 0; transform: translateY(5px); } }
.question-layout, .media-layout, .results-layout { width: min(1200px, 100%); margin: auto; }
.question-meta { display: flex; justify-content: space-between; margin-bottom: 22px; color: var(--secondary); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.question-layout h1 { max-width: 1050px; margin-bottom: 38px; font-size: clamp(2.5rem, 5.5vw, 6rem); line-height: 1.02; }
.presenter-media { width: min(760px, 100%); max-height: 42vh; margin: 0 0 32px; object-fit: contain; border-radius: 8px; background: #000; }
.video-unlock { position: fixed; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1rem 1.4rem; box-shadow: var(--shadow); }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-tile { min-height: 82px; padding: 18px 22px; display: flex; align-items: center; gap: 16px; border: 1px solid var(--outline); border-radius: 10px; background: color-mix(in srgb, var(--surface), transparent 20%); font-family: var(--serif); font-size: clamp(1.05rem, 2vw, 1.55rem); }
.answer-letter { color: var(--accent); font: .74rem var(--sans); letter-spacing: .08em; }
.answer-tile.correct { border-color: var(--sage); background: color-mix(in srgb, var(--sage), transparent 86%); }
.response-meter { margin-top: 28px; color: var(--secondary); font-size: .8rem; }
.presenter-controls { min-height: 76px; padding: 12px clamp(18px, 4vw, 64px); display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; border-top: 1px solid var(--rule); background: color-mix(in srgb, var(--canvas), transparent 5%); }
.presenter-controls .secondary { background: transparent; color: var(--secondary); border: 1px solid var(--outline); }
.controller { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-rows: 76px minmax(0, 1fr) auto; overflow: hidden; }
.controller-header .header-actions { align-items: center; }
.controller-stage { min-height: 0; overflow: auto; padding: clamp(24px, 4vw, 56px); }
.controller-layout { width: min(1180px, 100%); margin: auto; display: grid; grid-template-columns: minmax(280px, .7fr) minmax(420px, 1.3fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.controller-status h1 { margin-bottom: 32px; font-size: clamp(2.5rem, 5vw, 5rem); line-height: .95; }
.controller-stat { display: flex; align-items: baseline; gap: 12px; }
.controller-stat strong { font: 400 clamp(3rem, 6vw, 5.5rem)/1 var(--serif); }
.controller-stat span, .controller-time { color: var(--secondary); }
.controller-time { margin-top: 12px; }
.controller-notice { margin-top: 24px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent-text); }
.controller-card { padding: clamp(24px, 4vw, 42px); border: 1px solid var(--outline); border-radius: 14px; background: color-mix(in srgb, var(--surface), transparent 10%); }
.controller-card h2 { margin-bottom: 26px; font-size: clamp(1.8rem, 3.4vw, 3.4rem); line-height: 1.05; }
.controller-options, .controller-participants { display: flex; flex-wrap: wrap; gap: 8px; }
.controller-options span, .controller-participants span, .controller-flags span { padding: .48rem .7rem; border: 1px solid var(--outline); border-radius: 8px; color: var(--secondary); font-size: .78rem; }
.controller-participants em { color: var(--secondary); font-family: var(--serif); }
.controller-flags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.controller-flags span.active { border-color: var(--sage); color: var(--sage); }
.controller-controls { min-height: 76px; padding: 12px clamp(18px, 4vw, 64px); display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; border-top: 1px solid var(--rule); background: var(--canvas); }
.controller-controls .secondary { background: transparent; color: var(--secondary); border: 1px solid var(--outline); }
.controller-controls .danger { color: var(--coral); }
.controller-media-controls { margin-right: auto; display: flex; align-items: center; gap: 6px; }
.controller-media-controls button { padding-inline: .72rem; }
.controller-media-controls .media-jump { min-width: 48px; }
.media-seek { width: 190px; display: grid; gap: 1px; }
.media-seek input { width: 100%; padding: 0; accent-color: var(--accent); }
.media-seek output { color: var(--secondary); font-size: .66rem; text-align: center; font-variant-numeric: tabular-nums; }
.controller-time-controls { margin-right: auto; display: flex; align-items: center; gap: 6px; }
.controller-media-controls + .controller-time-controls { margin-right: 0; }
.controller-time-controls label { display: flex; align-items: center; gap: 6px; color: var(--secondary); font-size: .7rem; }
.controller-time-controls select { width: auto; min-width: 84px; padding: .65rem .7rem; }
.controller-final-layout { width: min(1180px, 100%); margin: auto; display: grid; grid-template-columns: minmax(280px, .7fr) minmax(460px, 1.3fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.controller-final-card { padding-bottom: 24px; }
.controller-final-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.controller-final-list > div { padding: 10px 0; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; border-top: 1px solid var(--rule); }
.controller-final-list > div > span { color: var(--secondary); font-size: .76rem; }
.controller-final-list > div.place-1 { color: var(--accent-text); border-color: var(--accent); }
.media-layout { text-align: center; }
.media-layout h1 { font-size: clamp(2.4rem, 5vw, 5rem); }
.media-layout .presenter-media { width: auto; max-width: 100%; max-height: 58vh; margin-inline: auto; }
.caption { color: var(--secondary); font-family: var(--serif); font-size: 1.1rem; }
.result-bars { display: grid; gap: 12px; }
.result-row { position: relative; overflow: hidden; min-height: 66px; padding: 14px 18px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--outline); border-radius: 8px; }
.result-fill { position: absolute; inset: 0 auto 0 0; z-index: -1; background: color-mix(in srgb, var(--slate), transparent 78%); }
.result-row.correct { border-color: var(--sage); }
.result-row.correct .result-fill { background: color-mix(in srgb, var(--sage), transparent 76%); }
.leaderboard { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--rule); }
.leaderboard-list { display: flex; flex-wrap: wrap; gap: 8px; }
.leader-chip { padding: .45rem .7rem; border: 1px solid var(--outline); border-radius: 10px; color: var(--secondary); font-size: .75rem; }
.leader-chip:first-child { color: var(--accent-text); border-color: var(--accent); }
.scorecard-layout { width: min(1080px, 100%); margin: auto; }
.scorecard-layout > h1 { margin-bottom: 42px; font-size: clamp(4rem, 8vw, 8rem); line-height: .9; }
.scorecard-leaders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.scorecard-leader { min-height: 180px; padding: 26px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--outline); border-radius: 14px; background: color-mix(in srgb, var(--surface), transparent 12%); }
.scorecard-leader.place-1 { min-height: 230px; border-color: var(--accent); order: -1; }
.scorecard-leader strong { overflow: hidden; margin: 10px 0 4px; font: 400 clamp(1.4rem, 2.5vw, 2.2rem)/1.1 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.scorecard-leader > span:last-child { color: var(--secondary); font-size: .8rem; }
.scorecard-place { color: var(--accent); font: 2.2rem var(--serif); }
.scorecard-rest { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.scorecard-rest > div { padding: 10px 0; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; border-top: 1px solid var(--rule); }
.scorecard-rest span { color: var(--secondary); font-size: .8rem; }
.finished { max-width: 750px; margin: auto; text-align: center; }
.finished h1 { font-size: clamp(3.5rem, 8vw, 8rem); }
.final-waiting { max-width: 980px; }
.final-reveal { width: min(1100px, 100%); margin: auto; text-align: center; }
.final-reveal h1, .final-ranking > h1 { margin-bottom: 46px; font-size: clamp(4rem, 8vw, 8rem); line-height: .9; }
.final-podium { display: flex; justify-content: center; align-items: stretch; gap: 14px; }
.final-place { width: min(320px, 31%); min-height: 220px; padding: 28px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--outline); border-radius: 14px; background: color-mix(in srgb, var(--surface), transparent 10%); animation: final-place-arrive .45s ease-out both; }
.final-place.place-1 { min-height: 280px; border-color: var(--accent); }
.final-place > span { color: var(--accent); font: 3rem/1 var(--serif); }
.final-place strong { margin: 18px 0 6px; font: 400 clamp(1.5rem, 3vw, 2.7rem)/1.05 var(--serif); }
.final-place small { color: var(--secondary); }
@keyframes final-place-arrive { from { opacity: 0; transform: translateY(18px); } }
.podium { margin-top: 38px; display: grid; gap: 8px; text-align: left; }
.podium-row { padding: 14px 0; display: grid; grid-template-columns: 40px 1fr auto; border-top: 1px solid var(--rule); }
.participant { min-height: calc(100vh - 76px); padding: 24px 18px 40px; }
.participant-stage { width: min(560px, 100%); min-height: calc(100vh - 140px); margin: auto; display: grid; align-items: center; }
.join-form h1, .participant-message h1 { font-size: clamp(2.8rem, 13vw, 4.5rem); line-height: .96; }
.join-form button { width: 100%; margin-top: 12px; }
.participant-question .question-meta { margin-bottom: 18px; }
.participant-question h1 { margin-bottom: 30px; font-size: clamp(2rem, 9vw, 3.4rem); line-height: 1.06; }
.participant-media { width: 100%; max-height: 30vh; margin-bottom: 24px; object-fit: contain; border-radius: 8px; background: #000; }
.participant-answers { display: grid; gap: 10px; }
.participant-answer { min-height: 66px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--outline); background: var(--surface); color: var(--ink); font-family: var(--serif); font-size: 1.05rem; }
.participant-answer.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent), transparent 88%); }
.participant-answer.correct { border-color: var(--sage); background: color-mix(in srgb, var(--sage), transparent 86%); }
.participant-answer.wrong { border-color: var(--coral); }
.participant-confirm { margin-top: 18px; padding-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border-top: 1px solid var(--rule); }
.participant-confirm p { margin: 0; color: var(--secondary); font-size: .82rem; }
.participant-confirm strong { color: var(--ink); }
.participant-confirm button { min-width: 190px; }
.participant-message { text-align: center; }
.participant-message .status-ring { width: 92px; height: 92px; margin: 0 auto 24px; display: grid; place-items: center; border: 1px solid var(--outline); border-radius: 50%; color: var(--accent); font: 2rem var(--serif); }
.toast { position: fixed; z-index: 30; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 16px; border-radius: 8px; color: var(--canvas); background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 760px) {
  .home-layout { padding: 56px 0; display: block; }
  .join-card { margin-top: 54px; }
  .admin-layout { display: block; }
  .quiz-index { border-right: 0; border-bottom: 1px solid var(--rule); }
  .editor { padding: 28px 18px; }
  .editor-head { grid-template-columns: 1fr; }
  .editor-actions { flex-wrap: wrap; }
  .sequence-head { align-items: flex-start; gap: 12px; }
  .add-menu { flex-wrap: wrap; justify-content: flex-end; }
  .block-row { grid-template-columns: 32px 1fr; }
  .block-actions { grid-column: 2; }
  .lobby { display: block; text-align: center; }
  .lobby-copy { display: block; }
  .qr-frame { width: min(260px, 80vw); margin: 36px auto 0; }
  .participant-cloud-wrap { margin-top: 32px; text-align: left; }
  .answer-grid { grid-template-columns: 1fr; }
  .scorecard-leaders { grid-template-columns: 1fr; }
  .scorecard-leader, .scorecard-leader.place-1 { min-height: 120px; order: initial; }
  .scorecard-rest { grid-template-columns: 1fr; }
  .participant-confirm { grid-template-columns: 1fr; }
  .participant-confirm button { width: 100%; }
  .final-podium { flex-direction: column; }
  .final-place, .final-place.place-1 { width: 100%; min-height: 120px; }
  .presenter-controls { justify-content: center; }
  .controller-header .session-pill { display: none; }
  .controller-header .quiet-button { padding-inline: .7rem; font-size: .68rem; }
  .controller-stage { padding: 24px 18px; }
  .controller-layout { grid-template-columns: 1fr; }
  .controller-final-layout { grid-template-columns: 1fr; }
  .controller-final-list { grid-template-columns: 1fr; }
  .controller-controls { justify-content: center; }
  .controller-media-controls { width: 100%; margin-right: 0; justify-content: center; }
  .controller-time-controls { width: 100%; margin-right: 0; justify-content: center; }
  .media-seek { width: min(170px, 35vw); }
  .field-row { grid-template-columns: 1fr; }
  .report-dialog { width: calc(100% - 12px); height: calc(100vh - 12px); }
  .report-dialog #report-content { padding: 18px; }
  .report-toolbar, .report-detail-head { align-items: stretch; flex-direction: column; }
  .report-question-list article { grid-template-columns: 1fr; gap: 10px; }
  .report-answer-detail { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
