:root {
  --green-950: #062e23;
  --green-900: #083f2f;
  --green-800: #0b4f3a;
  --green-700: #136b4d;
  --red-800: #8d1f2e;
  --red-700: #b1263a;
  --red-600: #ca3548;
  --gold-600: #c99a2e;
  --gold-400: #e0b74d;
  --cream-100: #fffaf0;
  --cream-200: #f7efdE;
  --white: #ffffff;
  --ink: #1b2521;
  --muted: #5d6b65;
  --line: #d8dfda;
  --success: #17653f;
  --warning: #8a5a00;
  --danger: #9c1f2f;
  --info: #155b83;
  --shadow: 0 16px 50px rgba(5, 45, 33, 0.14);
  --radius: 22px;
  --radius-small: 12px;
  --tap: 48px;
  --base-font-size: 16px;
}

* { box-sizing: border-box; }
html { font-size: var(--base-font-size); color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-rounded, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream-100);
  line-height: 1.5;
}
body.large-text { --base-font-size: 18px; }
body.extra-large-text { --base-font-size: 20px; }
body.high-contrast {
  --green-950: #001a12;
  --green-900: #002b1e;
  --green-800: #003b28;
  --red-700: #8b0018;
  --gold-400: #ffd84d;
  --cream-100: #ffffff;
  --cream-200: #f2f2f2;
  --ink: #000000;
  --muted: #282828;
  --line: #222222;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: var(--green-800); }
img { max-width: 100%; height: auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.15rem; }
small { color: var(--muted); }
:focus-visible { outline: 4px solid var(--gold-400); outline-offset: 3px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.festive-page {
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,.7) 0 4px, transparent 5px),
    radial-gradient(circle at 88% 18%, rgba(255,255,255,.55) 0 3px, transparent 4px),
    linear-gradient(145deg, #eef8f2, var(--cream-100) 45%, #f9ecef);
}
.festive-page::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 9px;
  background: repeating-linear-gradient(90deg, var(--red-700) 0 32px, var(--gold-400) 32px 64px, var(--green-700) 64px 96px);
  z-index: 30;
}
.site-header, .presenter-header, .player-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(7, 61, 45, .12);
  position: relative;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--green-900); text-decoration: none; font-weight: 900; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--red-700); color: white; box-shadow: inset 0 0 0 4px rgba(255,255,255,.25); }
.utility-controls, .admin-nav, .presenter-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-nav a { text-decoration: none; font-weight: 700; padding: 9px 10px; border-radius: 9px; }
.admin-nav a[aria-current="page"] { background: var(--green-800); color: white; }
.inline-form { display: inline; margin: 0; }
.icon-button {
  min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; font-weight: 800; padding: 8px 12px;
}
.danger-icon { color: var(--danger); font-size: 1.5rem; }

.centre-page, .narrow-page { min-height: calc(100vh - 150px); display: grid; place-items: center; padding: clamp(24px, 6vw, 80px) 18px; }
.narrow-page { align-items: start; }
.hero-card, .card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(7, 61, 45, .13);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card { width: min(720px, 100%); padding: clamp(28px, 6vw, 64px); text-align: center; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -80px; bottom: -95px; border-radius: 50%; border: 28px solid rgba(201,154,46,.17); }
.card { padding: clamp(20px, 3vw, 34px); }
.narrow-page > .card { width: min(840px, 100%); }
.hero-icon { font-size: 3.2rem; margin-bottom: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 900; color: var(--red-700); }
.lead { font-size: 1.1rem; color: var(--muted); }
.text-link { display: inline-block; margin-top: 20px; font-weight: 800; }
.empty-state { padding: 28px; border-radius: var(--radius-small); background: var(--cream-200); text-align: center; }
.error-card { max-width: 620px; text-align: center; }

.join-form, .stack-form { display: grid; gap: 12px; width: min(440px, 100%); margin: 24px auto 0; text-align: left; }
label, legend { font-weight: 800; }
input, textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 2px solid #aebbb4;
  border-radius: 11px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 92px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green-700); }
#gameCode { text-transform: uppercase; text-align: center; font-size: 2rem; font-weight: 900; letter-spacing: .18em; }
.field-help { color: var(--muted); font-size: .92rem; }
.field { display: grid; gap: 7px; align-content: start; }
.field-wide { grid-column: 1 / -1; }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }

.button {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  text-decoration: none;
  font-weight: 900;
  line-height: 1.15;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: var(--green-800); color: white; box-shadow: 0 7px 16px rgba(11,79,58,.22); }
.button-primary:hover { background: var(--green-700); }
.button-secondary { background: white; color: var(--green-900); border-color: var(--green-800); }
.button-danger { background: var(--red-700); color: white; }
.button-quiet { background: transparent; color: var(--green-900); border-color: transparent; }
.button-large { min-height: 58px; font-size: 1.1rem; }
.button-small { min-height: 40px; padding: 7px 12px; font-size: .9rem; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compact-buttons { gap: 6px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 12px; margin: 14px 0; font-weight: 700; }
.alert-error { background: #fff0f1; color: #761220; border: 2px solid #d97583; }
.alert-success { background: #eaf8ef; color: #0e5432; border: 2px solid #6cb98e; }
.alert-info { background: #eaf5fb; color: #104c6d; border: 2px solid #6ca7c7; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: var(--cream-200); font-size: .82rem; font-weight: 900; text-transform: capitalize; }

.player-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 24px; }
.player-choice { min-height: 130px; display: grid; place-items: center; gap: 4px; padding: 18px; border: 3px solid var(--green-800); border-radius: 18px; background: white; color: var(--ink); font-weight: 900; font-size: 1.1rem; }
.player-choice:hover:not(:disabled) { background: #eef8f2; transform: translateY(-2px); }
.player-choice.is-busy { border-color: #a5aca8; background: #f1f2f1; }
.player-avatar { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--red-700); color: white; font-size: 1.5rem; }

.site-footer { padding: 24px; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0; }
.snow-layer { pointer-events: none; position: fixed; inset: 0; overflow: hidden; z-index: 50; }
.snowflake { position: absolute; top: -20px; color: rgba(255,255,255,.9); text-shadow: 0 0 5px rgba(10,60,45,.45); animation: snowfall linear infinite; }
@keyframes snowfall { to { transform: translate3d(var(--drift), 105vh, 0) rotate(360deg); } }
body.snow-off .snow-layer { display: none; }

.admin-page { background: #f4f7f5; }
.admin-main { width: min(1480px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 70px; display: grid; gap: 24px; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.page-heading h1, .section-heading h2 { margin-bottom: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.summary-card { display: grid; align-content: start; gap: 7px; }
.summary-number { font-size: clamp(1.8rem, 4vw, 3.2rem); font-weight: 950; color: var(--green-800); line-height: 1; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.compact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check-card { display: flex; gap: 12px; padding: 15px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.check-card input, .compact-check input { width: 22px; min-height: 22px; flex: 0 0 22px; }
.check-card span { display: grid; gap: 3px; }
.check-card small { font-weight: 500; }
.inline-add-form { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr auto; align-items: end; gap: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.sortable-list { display: grid; gap: 10px; }
.sortable-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: white; }
.sortable-item.dragging { opacity: .45; }
.drag-handle { width: 44px; min-height: 44px; border: 0; background: var(--cream-200); border-radius: 10px; font-size: 1.3rem; cursor: grab; }
.player-edit-form { display: grid; grid-template-columns: minmax(140px, 1fr) auto auto; align-items: center; gap: 10px; flex: 1; }
.compact-check { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.designer-layout { width: min(1680px, calc(100% - 32px)); }
.designer-grid { display: grid; grid-template-columns: minmax(330px, .85fr) minmax(500px, 1.45fr); gap: 20px; align-items: start; }
.question-list-panel { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; }
.question-list-item { align-items: stretch; }
.question-summary { flex: 1; display: grid; gap: 5px; text-align: left; border: 0; background: transparent; padding: 4px; color: inherit; }
.question-summary strong { line-height: 1.25; }
.question-summary small { font-weight: 600; }
.type-badge { justify-self: start; padding: 3px 8px; border-radius: 999px; background: #e8f3ed; color: var(--green-900); font-size: .72rem; font-weight: 900; text-transform: capitalize; }
.question-actions { display: flex; align-items: center; gap: 5px; }
.question-editor { display: grid; gap: 18px; }
.editor-fieldset { border: 2px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.editor-fieldset legend { padding: 0 7px; }
.option-row { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; }
.option-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--green-800); color: white; font-weight: 900; }
.option-correct { display: inline-flex; align-items: center; gap: 6px; }
.option-correct input { width: 23px; min-height: 23px; }
.image-preview-wrap { display: grid; gap: 10px; justify-items: start; }
.image-preview-wrap img { max-height: 300px; border-radius: 14px; border: 2px solid var(--line); }
.sticky-editor-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); padding: 14px 0 0; border-top: 1px solid var(--line); }

.preview-page { background: var(--green-900); color: white; min-height: 100vh; }
.preview-main { width: min(1100px, calc(100% - 28px)); margin: 0 auto; padding: 38px 0; }
.preview-card { color: var(--ink); min-height: 70vh; display: grid; grid-template-rows: auto 1fr auto; }
.preview-progress { color: var(--muted); font-weight: 800; }
.preview-question { display: grid; align-content: center; gap: 20px; text-align: center; }
.preview-question img { max-height: 360px; margin: 0 auto; border-radius: 18px; }
.preview-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.preview-option { padding: 17px; border: 2px solid var(--green-800); border-radius: 14px; font-weight: 900; }
.preview-controls { justify-content: space-between; }

.player-page { background: #eff7f2; padding-bottom: 92px; }
.player-header { position: sticky; top: 0; min-height: 66px; background: var(--green-900); color: white; padding: 10px 14px; }
.player-name { font-size: 1.15rem; font-weight: 900; }
.player-stats { display: flex; gap: 14px; font-size: .9rem; }
.player-header .icon-button { color: white; border-color: rgba(255,255,255,.5); background: transparent; }
.connection-strip { min-height: 34px; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 5px 12px; background: #eaf8ef; color: #0e5432; font-weight: 800; font-size: .88rem; }
.connection-strip[data-status="reconnecting"] { background: #fff5d8; color: #684600; }
.connection-strip[data-status="submitted"] { background: #e7f4fb; color: #104c6d; }
.connection-strip[data-status="ended"] { background: #f1ebf8; color: #4d2871; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.player-main { width: min(760px, 100%); margin: 0 auto; padding: 18px 14px; }
.player-screen { min-height: calc(100vh - 210px); display: grid; align-content: center; }
.waiting-card { text-align: center; }
.spinner { width: 48px; height: 48px; border: 6px solid #d5e4db; border-top-color: var(--green-800); border-radius: 50%; margin: 0 auto 18px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-question-card { display: grid; gap: 18px; }
.question-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-weight: 800; }
.timer-pill { min-width: 62px; padding: 7px 12px; border-radius: 999px; background: var(--red-700); color: white; text-align: center; font-size: 1.2rem; }
.player-question-image { max-height: 330px; width: 100%; object-fit: contain; border-radius: 16px; background: var(--cream-200); }
.answer-options { display: grid; gap: 12px; }
.answer-option { position: relative; }
.answer-option input { position: absolute; opacity: 0; pointer-events: none; }
.answer-option label { min-height: 64px; display: flex; align-items: center; gap: 12px; border: 3px solid #94aaa0; border-radius: 15px; padding: 14px; background: white; cursor: pointer; }
.answer-option input:checked + label { border-color: var(--green-800); background: #eaf7ef; box-shadow: inset 0 0 0 2px var(--green-800); }
.answer-letter { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--green-800); color: white; font-weight: 900; }
.answer-bar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 12px max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 25px rgba(0,0,0,.08); }
.answer-bar .button { width: min(730px, 100%); margin: 0 auto; display: flex; }
.submitted-card, .result-card, .podium-card { text-align: center; }
.result-icon { font-size: 4rem; }
.result-card.correct { border: 4px solid #248455; }
.result-card.incorrect { border: 4px solid #b22e41; }
.result-label { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-weight: 900; }
.correct .result-label { background: #e4f7eb; color: #0e5432; }
.incorrect .result-label { background: #fff0f1; color: #761220; }
.dialog-card { width: min(500px, calc(100% - 28px)); border: 0; border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.dialog-card::backdrop { background: rgba(0,0,0,.55); }

.presenter-page { background: var(--green-950); color: white; min-height: 100vh; padding-bottom: 98px; }
.presenter-header { position: sticky; top: 0; background: rgba(6,46,35,.97); color: white; border-color: rgba(255,255,255,.15); }
.presenter-header .brand { color: white; }
.presenter-header .button-quiet { color: white; }
.presenter-main { padding: 24px; }
.presenter-stage { min-height: calc(100vh - 190px); display: grid; align-content: center; }
.presenter-lobby { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.3fr); gap: 24px; width: min(1400px, 100%); margin: auto; }
.lobby-join-card { background: white; color: var(--ink); border-radius: 26px; padding: 28px; text-align: center; box-shadow: var(--shadow); }
.join-address { font-size: 1.15rem; word-break: break-word; }
.game-code-label { margin: 15px 0 0; color: var(--muted); font-weight: 900; }
.game-code { font-size: clamp(3rem, 8vw, 6.4rem); font-weight: 950; letter-spacing: .11em; color: var(--green-900); line-height: 1.1; }
.qr-code { width: min(260px, 70%); border-radius: 14px; }
.lobby-player-card { color: var(--ink); }
.presenter-player-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 18px; }
.presenter-player { display: grid; gap: 5px; padding: 12px; border: 2px solid var(--line); border-radius: 13px; background: white; }
.presenter-player.connected { border-color: #48a878; }
.presenter-player.disconnected { border-color: #d59a2a; }
.presenter-player.available { opacity: .68; }
.player-status-line { display: flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 800; text-transform: capitalize; }
.player-status-line::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #a0aaa5; }
.connected .player-status-line::before { background: #248455; }
.disconnected .player-status-line::before { background: #d0911d; }
.presenter-controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; min-height: 88px; padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: rgba(255,255,255,.97); color: var(--ink); box-shadow: 0 -10px 30px rgba(0,0,0,.25); }
.answer-count { font-weight: 900; min-width: 140px; }
.presenter-question { width: min(1350px, 100%); margin: auto; display: grid; gap: 18px; text-align: center; }
.presenter-question h1 { font-size: clamp(2.4rem, 5.5vw, 5rem); }
.presenter-question img { max-height: 43vh; margin: 0 auto; border-radius: 22px; }
.presenter-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.presenter-option { min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; border: 3px solid rgba(255,255,255,.55); border-radius: 18px; background: rgba(255,255,255,.12); font-size: clamp(1.2rem, 2.3vw, 2rem); font-weight: 900; }
.presenter-option.correct { background: #166442; border-color: white; }
.presenter-option.incorrect { opacity: .55; }
.presenter-timer { justify-self: center; min-width: 110px; padding: 9px 18px; border-radius: 999px; background: var(--red-700); font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 950; }
.distribution { width: min(1100px, 100%); margin: 0 auto; display: grid; gap: 10px; }
.distribution-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(120px, 3fr) 60px; align-items: center; gap: 12px; text-align: left; }
.distribution-track { height: 34px; background: rgba(255,255,255,.16); border-radius: 9px; overflow: hidden; }
.distribution-bar { height: 100%; width: var(--bar-width); background: var(--gold-400); }
.leaderboard-screen { width: min(1000px, 100%); margin: auto; }
.leaderboard-list { display: grid; gap: 10px; }
.leaderboard-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 14px; padding: 16px 20px; border-radius: 15px; background: rgba(255,255,255,.12); font-size: clamp(1.1rem, 2.4vw, 1.8rem); }
.leaderboard-rank { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-400); color: #2e2300; font-weight: 950; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: end; margin: 30px 0; }
.podium-place { border-radius: 18px 18px 0 0; background: rgba(255,255,255,.14); padding: 22px; text-align: center; }
.podium-place.first { min-height: 260px; background: rgba(224,183,77,.3); }
.podium-place.second { min-height: 210px; }
.podium-place.third { min-height: 175px; }
.podium-number { font-size: 3rem; font-weight: 950; }

.difficulty-list { display: grid; gap: 10px; padding-left: 24px; }
.difficulty-list li { display: flex; justify-content: space-between; gap: 18px; padding: 10px; border-bottom: 1px solid var(--line); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.mini-report { border: 2px solid var(--line); border-radius: 14px; padding: 16px; }
.mini-report p:last-child { margin-bottom: 0; }

@media (max-width: 1000px) {
  .admin-header { align-items: flex-start; }
  .admin-nav { justify-content: flex-end; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .designer-grid { grid-template-columns: 1fr; }
  .question-list-panel { position: static; max-height: none; }
  .presenter-lobby { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header { padding: 12px 14px; }
  .site-header .brand span:last-child { display: none; }
  .admin-header { display: grid; }
  .admin-header .brand span:last-child { display: inline; }
  .admin-nav { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; width: 100%; padding-bottom: 4px; }
  .admin-nav a { white-space: nowrap; }
  .admin-main, .designer-layout { width: min(100% - 20px, 100%); padding-top: 20px; }
  .settings-grid, .compact-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .inline-add-form { grid-template-columns: 1fr; }
  .sortable-item { align-items: flex-start; }
  .player-edit-form { grid-template-columns: 1fr; }
  .player-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-stats { display: grid; gap: 0; text-align: right; }
  .presenter-main { padding: 14px; }
  .presenter-controls { display: grid; min-height: 122px; padding: 9px 12px; }
  .presenter-controls .button-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .presenter-page { padding-bottom: 135px; }
  .presenter-option-grid, .preview-options { grid-template-columns: 1fr; }
  .distribution-row { grid-template-columns: 110px 1fr 45px; }
  .podium { grid-template-columns: 1fr; align-items: stretch; }
  .podium-place.first, .podium-place.second, .podium-place.third { min-height: 0; border-radius: 16px; }
}

@media (max-width: 460px) {
  .hero-card { padding: 28px 18px; }
  .player-choice-grid { grid-template-columns: 1fr; }
  .player-header { gap: 8px; }
  .player-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .question-meta { align-items: center; }
  .option-row { grid-template-columns: 32px 1fr; }
  .option-correct { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behaviour: auto !important; transition-duration: .01ms !important; }
  .snow-layer { display: none !important; }
}

@media print {
  .admin-header, .site-footer, .button, .snow-layer { display: none !important; }
  body { background: white !important; color: black; }
  .admin-main { width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #777; break-inside: avoid; }
  table { font-size: 10pt; }
}
.presenter-player-dialog { width: min(900px, calc(100% - 28px)); max-height: 86vh; overflow: auto; color: var(--ink); }
.presenter-player-dialog .presenter-player-list { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* July 2026 live quiz display and control refinements */
.site-header,
.presenter-header,
.player-header {
  min-height: 54px;
  padding: 7px clamp(12px, 2.2vw, 28px);
  gap: 12px;
}

.compact-header { min-height: 52px; }
.brand-mark { width: 30px; height: 30px; }
.icon-button { min-height: 40px; min-width: 40px; padding: 6px 9px; }
.site-footer { padding: 9px 14px; font-size: .8rem; }
.centre-page,
.narrow-page { min-height: calc(100vh - 92px); padding: clamp(16px, 3vw, 34px) 14px; }
.compact-page { align-items: center; }
.name-entry-card { width: min(620px, 100%) !important; text-align: center; }
.name-entry-card .stack-form { margin-top: 18px; }

.code-wrap,
.join-address,
.game-code,
.summary-number,
.submitted-answer {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.player-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.97);
}
.player-points { font-weight: 900; white-space: nowrap; }
.compact-leave { font-size: .82rem; }
.player-main { padding-top: 14px; }
.simple-score { font-size: clamp(1.3rem, 6vw, 2rem); margin-bottom: 0; }

.polished-waiting { text-align: center; overflow: hidden; position: relative; }
.loading-wreath {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 10px dotted var(--green-700);
  box-shadow: inset 0 0 0 7px rgba(201,154,46,.22);
  animation: wreath-turn 3.2s linear infinite;
}
.loading-wreath.large { width: 132px; height: 132px; border-width: 14px; font-size: 2rem; }
.loading-wreath span { animation: wreath-counter-turn 3.2s linear infinite; color: var(--gold-600); font-size: 1.6rem; }
.loading-dots { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.loading-dots span { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: dot-pulse 1.2s infinite ease-in-out; }
.loading-dots span:nth-child(2) { animation-delay: .16s; }
.loading-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes wreath-turn { to { transform: rotate(360deg); } }
@keyframes wreath-counter-turn { to { transform: rotate(-360deg); } }
@keyframes dot-pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.75); } 40% { opacity: 1; transform: scale(1); } }

.presenter-page {
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 34px;
}
.presenter-header { position: relative; height: 52px; }
.presenter-header .status-badge { color: #fff; border: 2px solid rgba(255,255,255,.55); }
.presenter-connected { background: #f7fff9 !important; color: #06462e !important; border-color: #77d49f !important; }
.presenter-reconnecting { background: #fff4d8 !important; color: #5b3a00 !important; border-color: #e3ad37 !important; }
.presenter-display-main,
.presenter-main { min-height: 0; padding: clamp(8px, 1.4vw, 18px); overflow: hidden; }
.presenter-stage {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  align-content: stretch;
}
.presenter-display-status {
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.96);
  color: var(--green-950);
  font-weight: 900;
  font-size: .92rem;
}
.presenter-lobby {
  height: 100%;
  width: min(1420px, 100%);
  grid-template-columns: minmax(260px, .72fr) minmax(360px, 1.28fr);
  gap: clamp(10px, 1.5vw, 20px);
  align-items: stretch;
}
.lobby-join-card,
.lobby-player-card { min-height: 0; padding: clamp(14px, 2vw, 24px); overflow: hidden; }
.lobby-join-card { display: grid; align-content: center; justify-items: center; gap: 4px; }
.qr-code { width: min(235px, 30vh); max-height: 30vh; }
.join-address { font-size: clamp(.72rem, 1.1vw, 1rem); margin: 4px 0; }
.game-code { font-size: clamp(2.4rem, 6vw, 5rem); letter-spacing: .08em; }
.lobby-player-card { display: flex; flex-direction: column; }
.lobby-player-card h1 { font-size: clamp(2rem, 4vw, 4rem); margin-bottom: 8px; }
.presenter-player-chips {
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-content: start;
  gap: 8px;
  overflow: hidden;
}
.presenter-player-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-areas: "icon name" "icon status";
  align-items: center;
  gap: 0 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  color: #173329;
  border: 2px solid #b8c5bf;
}
.presenter-player-chip.connected { border-color: #2b8e5a; background: #effcf4; }
.presenter-player-chip.disconnected { border-color: #d59a2a; background: #fff7e3; }
.presenter-player-chip .connection-icon { grid-area: icon; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #17653f; color: #fff; font-weight: 900; }
.presenter-player-chip.disconnected .connection-icon { background: #8a5a00; }
.presenter-player-chip strong { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presenter-player-chip span:last-child { grid-area: status; font-size: .78rem; font-weight: 800; color: #354f45; }
.empty-player-message { color: var(--muted); }

.presenter-question {
  height: 100%;
  width: min(1450px, 100%);
  margin: 0 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 1.4vh, 16px);
  overflow: hidden;
}
.presenter-question h1 { font-size: clamp(2rem, 4.6vw, 4.8rem); margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.presenter-question img { max-height: 30vh; max-width: min(68vw, 900px); object-fit: contain; }
.presenter-body-text { font-size: clamp(1.2rem, 2.3vw, 2.1rem); margin: 0; }
.presenter-explanation { font-size: clamp(.95rem, 1.55vw, 1.35rem); margin: 0; }
.presenter-option-grid { width: 100%; gap: clamp(7px, 1vw, 13px); }
.presenter-option { min-height: clamp(60px, 10vh, 92px); padding: 10px 14px; font-size: clamp(1.05rem, 2vw, 1.8rem); overflow-wrap: anywhere; }
.correct-label { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: #fff; color: #0d5432; font-size: .72em; }
.presenter-timer { min-width: 88px; padding: 5px 14px; font-size: clamp(1.4rem, 3.2vw, 2.4rem); }
.reveal-layout { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .7fr); align-items: center; text-align: left; }
.reveal-answer-panel { min-width: 0; display: grid; justify-items: center; gap: 8px; text-align: center; }
.distribution { min-width: 0; width: 100%; gap: 6px; }
.distribution h2 { margin-bottom: 6px; }
.distribution-row { grid-template-columns: minmax(80px, 1fr) minmax(70px, 2fr) 34px; gap: 7px; font-size: .88rem; }
.distribution-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.distribution-track { height: 25px; }

.major-leaderboard {
  width: min(1180px, 100%);
  max-height: 100%;
  display: grid;
  align-content: center;
  text-align: center;
  overflow: hidden;
}
.major-leaderboard h1 { font-size: clamp(2.8rem, 7vw, 6rem); margin-bottom: 12px; text-shadow: 0 5px 20px rgba(0,0,0,.3); }
.leaderboard-crown { font-size: clamp(2.2rem, 5vw, 4.6rem); color: var(--gold-400); line-height: 1; }
.major-leaderboard .leaderboard-list { margin: 0; padding: 0; }
.major-leaderboard .leaderboard-row {
  min-height: 0;
  padding: clamp(7px, 1.2vh, 14px) 16px;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.leaderboard-row.rank-1 { background: linear-gradient(90deg, rgba(224,183,77,.48), rgba(255,255,255,.2)); transform: scale(1.025); }
.leaderboard-row.rank-2 { background: rgba(230,235,238,.22); }
.leaderboard-row.rank-3 { background: rgba(181,113,61,.25); }
.leaderboard-points { font-weight: 900; }
.full-leaderboard .leaderboard-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; }
.full-leaderboard .leaderboard-row { font-size: clamp(.88rem, 1.5vw, 1.35rem); grid-template-columns: 48px 1fr auto; }
.full-leaderboard .leaderboard-rank { width: 38px; height: 38px; }

.results-preparing {
  position: relative;
  width: min(1000px, 100%);
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  overflow: hidden;
}
.results-preparing h1 { font-size: clamp(2.6rem, 6.5vw, 6rem); margin-bottom: 12px; }
.results-preparing p { font-size: clamp(1rem, 2vw, 1.6rem); }

.winner-reveal {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  overflow: hidden;
}
.winner-reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background: radial-gradient(circle at 50% 55%, rgba(255,226,105,.28), transparent 42%), linear-gradient(#061d17, #083f2f);
}
.spotlight {
  position: absolute;
  top: -18%;
  width: 38%;
  height: 135%;
  z-index: -2;
  background: linear-gradient(to bottom, rgba(255,247,193,.82), rgba(255,222,93,.08));
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
  filter: blur(5px);
  animation: spotlight-sweep 4s ease-in-out infinite alternate;
}
.spotlight-left { left: 3%; transform: rotate(16deg); transform-origin: top center; }
.spotlight-right { right: 3%; transform: rotate(-16deg); transform-origin: top center; animation-delay: -.9s; }
.winner-stars { font-size: clamp(2rem, 5vw, 4rem); color: var(--gold-400); letter-spacing: .35em; animation: winner-sparkle 1.7s ease-in-out infinite; }
.winner-medal { width: clamp(74px, 10vw, 128px); height: clamp(74px, 10vw, 128px); display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff4a8, var(--gold-400) 45%, #9a6f12); color: #3e2b00; border: 7px solid #fff2a1; font-size: clamp(2.4rem, 5vw, 4.8rem); font-weight: 950; box-shadow: 0 0 55px rgba(255,218,77,.72); }
.winner-reveal h1 { font-size: clamp(4rem, 12vw, 10rem); margin: 8px 0; text-shadow: 0 7px 32px rgba(0,0,0,.45); max-width: 95%; overflow-wrap: anywhere; }
.winner-score { font-size: clamp(1.8rem, 4vw, 3.4rem); font-weight: 950; color: #ffe783; }
.winner-runners-up { display: flex; gap: 28px; flex-wrap: wrap; justify-content: center; font-size: clamp(1rem, 1.8vw, 1.5rem); }
@keyframes spotlight-sweep { to { transform: rotate(-6deg); } }
@keyframes winner-sparkle { 50% { transform: scale(1.08); filter: brightness(1.35); } }

.player-winner-card { text-align: center; position: relative; overflow: hidden; }
.player-winner-card.you-won { border: 5px solid var(--gold-400); box-shadow: 0 0 40px rgba(224,183,77,.4); }
.player-winner-card .winner-medal { margin: 0 auto 15px; }

.control-main { padding-top: 18px; }
.compact-heading h1 { margin-bottom: 0; }
.control-panel-card { display: grid; gap: 15px; }
.control-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.control-status-grid > div { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: var(--cream-200); }
.control-status-grid strong { font-size: 1.15rem; }
.control-action-row { align-items: stretch; }
.control-grid { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr); gap: 18px; align-items: start; }
.controller-player-list,
.controller-answer-list { display: grid; gap: 9px; }
.controller-player-row,
.answer-override-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 13px; background: #fff; }
.controller-player-row.connected { border-color: #65b98b; }
.controller-player-row.disconnected { border-color: #dca33b; background: #fffaf0; }
.controller-player-row > div:first-child,
.answer-override-copy { min-width: 0; display: grid; gap: 3px; }
.status-with-icon { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; font-weight: 800; }
.status-with-icon span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--green-700); color: #fff; }
.disconnected .status-with-icon span { background: var(--warning); }
.answer-override-row.is-overridden { border-color: var(--gold-600); background: #fffbeb; }
.submitted-answer { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; }
.override-result { font-weight: 900; }
.correct-text { color: #0f643a; }
.incorrect-text { color: #8b1d2e; }

@media (max-width: 1000px) {
  .presenter-lobby { grid-template-columns: .8fr 1.2fr; }
  .reveal-layout { grid-template-columns: 1fr; }
  .reveal-layout .distribution { display: none; }
  .control-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header,
  .player-header { min-height: 48px; padding: 5px 9px; }
  .site-footer { padding: 7px 10px; }
  .player-name { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .player-points { font-size: .9rem; }
  .control-status-grid { grid-template-columns: 1fr; }
  .controller-player-row,
  .answer-override-row { align-items: flex-start; flex-direction: column; }
  .controller-player-row .button-row,
  .answer-override-row .button-row { width: 100%; }
  .controller-player-row .button,
  .answer-override-row .button { flex: 1; }
}

@media (max-height: 720px) and (min-width: 721px) {
  .presenter-page { grid-template-rows: 46px minmax(0, 1fr) 28px; }
  .presenter-header { height: 46px; min-height: 46px; }
  .presenter-display-status { height: 28px; font-size: .78rem; }
  .qr-code { width: min(180px, 27vh); }
  .game-code { font-size: clamp(2rem, 5vw, 4rem); }
  .presenter-question img { max-height: 24vh; }
  .presenter-option { min-height: 52px; }
  .major-leaderboard h1 { font-size: clamp(2.3rem, 5vw, 4.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-wreath,
  .loading-wreath span,
  .loading-dots span,
  .spotlight,
  .winner-stars { animation: none !important; }
}

/* Presenter display hotfix, July 2026 */
.lobby-join-card {
  container-type: inline-size;
  min-width: 0;
}

.lobby-join-card > * {
  min-width: 0;
  max-width: 100%;
}

.game-code {
  width: 100%;
  max-width: 100%;
  font-size: clamp(2rem, 4vw, 4.25rem);
  font-size: clamp(2rem, 10cqw, 4.25rem);
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
}

.join-address {
  width: 100%;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.presenter-lobby,
.presenter-lobby > *,
.presenter-question,
.reveal-layout,
.reveal-answer-panel,
.distribution {
  min-width: 0;
  max-width: 100%;
}

@media (max-height: 760px) and (min-width: 721px) {
  .lobby-join-card,
  .lobby-player-card { padding: 10px 14px; }
  .qr-code { width: min(170px, 24vh); max-height: 24vh; }
  .join-address { font-size: .72rem; }
  .game-code-label { margin-top: 6px; }
  .game-code {
    font-size: clamp(1.8rem, 3.7vw, 3.6rem);
    font-size: clamp(1.8rem, 9cqw, 3.6rem);
  }
}

/* Final viewport layout, scoring and transition controls, July 2026 */
.question-type-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: .38em .85em;
  border-radius: 999px;
  background: var(--red-700);
  color: #fff;
  font-size: clamp(.72rem, 1.2vw, 1rem);
  font-weight: 950;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.intro-template { margin: 0; font-size: clamp(1rem, 2.2vw, 1.8rem); font-weight: 850; }
.intro-countdown {
  width: clamp(62px, 8vw, 112px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red-700);
  color: #fff;
  border: clamp(4px, .5vw, 8px) solid var(--gold-400);
  font-size: clamp(2rem, 5vw, 4.8rem);
  font-weight: 950;
  box-shadow: 0 0 0 7px rgba(255,255,255,.12), 0 16px 38px rgba(0,0,0,.25);
}

body.presenter-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-rows: 6% 90% 4%;
}
.presenter-page .presenter-header {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 2%;
  overflow: hidden;
}
.presenter-page .presenter-header .brand { min-width: 0; font-size: clamp(.9rem, 1.6vw, 1.35rem); }
.presenter-page .presenter-header .brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presenter-page .presenter-header-actions { display: flex; gap: 1vw; align-items: center; flex: 0 0 auto; }
.presenter-page .presenter-header .button { min-height: 0; padding: .55em 1em; font-size: clamp(.72rem, 1.05vw, .98rem); }
.presenter-page .presenter-header .status-badge { padding: .45em .8em; font-size: clamp(.68rem, 1vw, .9rem); }
.presenter-page .presenter-display-main {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 1.25% 1.4%;
  overflow: hidden;
}
.presenter-page .presenter-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: stretch;
  overflow: hidden;
}
.presenter-page .presenter-display-status {
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: clamp(.68rem, 1vw, .9rem);
  overflow: hidden;
}
.presenter-page .presenter-lobby {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 35% 63.5%;
  gap: 1.5%;
  align-items: stretch;
  overflow: hidden;
}
.presenter-page .lobby-join-card,
.presenter-page .lobby-player-card {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 4%;
  border-radius: clamp(16px, 1.7vw, 30px);
  overflow: hidden;
}
.presenter-page .lobby-join-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2%;
}
.presenter-page .lobby-join-card .eyebrow { margin: 0; flex: 0 0 auto; font-size: clamp(.68rem, 1vw, 1rem); }
.presenter-page .qr-code {
  width: auto;
  height: 42%;
  max-width: 72%;
  max-height: 42%;
  min-height: 0;
  object-fit: contain;
  flex: 0 1 auto;
}
.presenter-page .join-address { margin: 0; max-height: 7%; font-size: clamp(.62rem, 1vw, 1rem); line-height: 1.05; }
.presenter-page .game-code-label { margin: 1% 0 0; font-size: clamp(.7rem, 1.1vw, 1rem); line-height: 1; }
.presenter-page .game-code {
  width: 100%;
  max-height: 18%;
  margin: 0;
  font-size: clamp(1.8rem, 4.5vw, 5.2rem);
  line-height: .95;
  letter-spacing: .015em;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
}
.presenter-page .lobby-player-card { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 2%; align-content: stretch; }
.presenter-page .lobby-player-card .eyebrow,
.presenter-page .lobby-player-card p,
.presenter-page .lobby-player-card h1 { margin: 0; }
.presenter-page .lobby-player-card h1 {
  font-size: clamp(2rem, 4.7vw, 5rem);
  line-height: .98;
  max-height: 2.05em;
  overflow: hidden;
}
.presenter-page .lobby-instruction { font-size: clamp(.85rem, 1.5vw, 1.35rem); }
.presenter-page .presenter-player-chips {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 28%), 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 1.5%;
  align-content: stretch;
  overflow: hidden;
}
.presenter-page .presenter-player-chip { min-height: 0; height: 100%; padding: 3% 4%; overflow: hidden; }
.presenter-page .presenter-player-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presenter-page .more-players { grid-column: 1 / -1; font-weight: 900; }

.presenter-page .question-intro-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3%;
  padding: 2% 5%;
  text-align: center;
  overflow: hidden;
}
.presenter-page .question-intro-screen h1 {
  width: 100%;
  max-height: 2.4em;
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 6.5rem);
  line-height: 1.02;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.presenter-page .question-intro-screen p { margin: 0; }
.presenter-page .intro-help { font-size: clamp(.9rem, 1.5vw, 1.35rem); }

.presenter-page .presenter-question {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 1%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2%;
  overflow: hidden;
}
.presenter-page .question-topline {
  width: 100%;
  height: 9%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2%;
}
.presenter-page .question-topline .question-type-banner { justify-self: start; }
.presenter-page .question-number-label { justify-self: center; font-weight: 900; font-size: clamp(.7rem, 1.2vw, 1rem); }
.presenter-page .question-topline .presenter-timer { justify-self: end; min-width: 0; padding: .35em .75em; font-size: clamp(1.2rem, 2.5vw, 2.7rem); }
.presenter-page .presenter-question-image {
  width: auto;
  max-width: 75%;
  height: auto;
  max-height: 25%;
  min-height: 0;
  object-fit: contain;
  flex: 0 1 25%;
}
.presenter-page .presenter-question h1 {
  width: 100%;
  max-height: 2.25em;
  margin: 0;
  font-size: clamp(1.8rem, 4.3vw, 4.8rem);
  line-height: 1.03;
  overflow: hidden;
  overflow-wrap: anywhere;
  flex: 0 1 auto;
}
.presenter-page .presenter-option-grid {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 1.5%;
  overflow: hidden;
}
.presenter-page .presenter-option-grid.option-count-2 { grid-template-rows: repeat(1, minmax(0, 1fr)); }
.presenter-page .presenter-option-grid.option-count-3,
.presenter-page .presenter-option-grid.option-count-4 { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.presenter-page .presenter-option-grid.option-count-5,
.presenter-page .presenter-option-grid.option-count-6 { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.presenter-page .presenter-option {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 2%;
  font-size: clamp(.9rem, 1.8vw, 1.9rem);
  line-height: 1.08;
  overflow: hidden;
}
.presenter-page .presenter-option > span:nth-child(2) {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.presenter-page .presenter-typing-message { margin: 0; font-size: clamp(1.1rem, 2.4vw, 2.3rem); }
.presenter-page .presenter-body-text,
.presenter-page .presenter-explanation { margin: 0; max-height: 3.2em; overflow: hidden; }
.presenter-page .reveal-layout { display: grid; grid-template-columns: 66% 32%; gap: 2%; align-items: stretch; }
.presenter-page .reveal-answer-panel { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5%; overflow: hidden; }
.presenter-page .reveal-answer-panel .presenter-option-grid { max-height: 45%; }
.presenter-page .distribution { width: 100%; height: 100%; min-height: 0; align-content: center; overflow: hidden; }
.presenter-page .distribution h2 { margin: 0 0 2%; font-size: clamp(1rem, 2vw, 2rem); }
.presenter-page .distribution-row { min-height: 0; font-size: clamp(.68rem, 1vw, .95rem); }

.presenter-page .major-leaderboard {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 1% 3%;
  display: grid;
  grid-template-rows: 8% 7% 14% minmax(0, 1fr);
  align-content: stretch;
  overflow: hidden;
}
.presenter-page .leaderboard-crown { font-size: clamp(1.7rem, 3.2vw, 3.5rem); line-height: 1; }
.presenter-page .major-leaderboard .eyebrow { margin: 0; align-self: center; }
.presenter-page .major-leaderboard h1 { margin: 0; font-size: clamp(2.2rem, 5.4vw, 5.8rem); line-height: 1; }
.presenter-page .major-leaderboard .leaderboard-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--leaderboard-columns, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--leaderboard-rows, 10), minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 1.2%;
  overflow: hidden;
}
.presenter-page .major-leaderboard .leaderboard-row {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 1% 2%;
  grid-template-columns: minmax(32px, 8%) minmax(0, 1fr) auto;
  gap: 2%;
  font-size: clamp(.75rem, 1.35vw, 1.45rem);
  overflow: hidden;
}
.presenter-page .leaderboard-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presenter-page .leaderboard-rank { width: min(4.2vh, 42px); height: min(4.2vh, 42px); min-width: 28px; min-height: 28px; }
.presenter-page .results-preparing,
.presenter-page .winner-reveal { width: 100%; height: 100%; min-height: 0; overflow: hidden; }

body.player-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 8% 5% 87% 0%;
  background: #eff7f2;
}
body.player-page.answer-open { grid-template-rows: 8% 5% 75% 12%; }
.player-page .player-header {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 3%;
  overflow: hidden;
}
.player-page .player-name { max-width: 37%; font-size: clamp(.76rem, 3.5vw, 1.05rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-page .player-points { font-size: clamp(.72rem, 3.2vw, 1rem); }
.player-page .compact-leave { min-width: 0; min-height: 0; height: 70%; padding: 0 3%; font-size: clamp(.66rem, 2.8vw, .85rem); }
.player-page .connection-strip { width: 100%; height: 100%; min-height: 0; padding: 0 3%; font-size: clamp(.68rem, 2.8vw, .85rem); overflow: hidden; }
.player-page .player-main {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 2%;
  overflow: hidden;
}
.player-page .player-screen { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.player-page .player-screen > .card,
.player-page .player-screen > section {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 4%;
  border-radius: clamp(14px, 4vw, 22px);
  overflow: hidden;
}
.player-page .answer-bar {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 2% 3% calc(2% + env(safe-area-inset-bottom));
  display: grid;
  place-items: stretch;
  box-shadow: 0 -4px 14px rgba(0,0,0,.08);
  overflow: hidden;
}
.player-page .answer-bar.hidden { display: none; }
.player-page .answer-bar .button { width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0 3%; }
.player-page .waiting-card,
.player-page .submitted-card,
.player-page .result-card,
.player-page .player-winner-card,
.player-page .player-intro-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3%;
  text-align: center;
}
.player-page .waiting-card h1,
.player-page .submitted-card h1,
.player-page .result-card h1,
.player-page .player-winner-card h1,
.player-page .player-intro-card h1 {
  margin: 0;
  max-height: 2.4em;
  font-size: clamp(1.6rem, 8vw, 3rem);
  line-height: 1.05;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.player-page .waiting-card p,
.player-page .submitted-card p,
.player-page .result-card p,
.player-page .player-intro-card p { margin: 0; max-height: 4.5em; overflow: hidden; }
.player-page .loading-wreath { width: min(20vh, 82px); height: min(20vh, 82px); margin: 0; flex: 0 1 auto; }
.player-page .loading-dots { margin: 1% 0 0; }
.player-page .player-intro-card .intro-countdown { width: min(20vh, 96px); }

.player-page .player-question-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2%;
  overflow: hidden;
}
.player-page .question-meta {
  width: 100%;
  min-height: 8%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 2%;
  flex: 0 0 auto;
  font-size: clamp(.64rem, 2.7vw, .82rem);
}
.player-page .question-meta .question-type-banner { justify-self: start; font-size: clamp(.56rem, 2.4vw, .72rem); padding: .45em .7em; }
.player-page .timer-pill { min-width: 0; padding: .35em .65em; font-size: clamp(.88rem, 4vw, 1.2rem); }
.player-page .player-question-image { width: auto; max-width: 100%; height: auto; max-height: 20%; object-fit: contain; margin: 0 auto; flex: 0 1 20%; }
.player-page .player-question-card h1 {
  width: 100%;
  max-height: 2.35em;
  margin: 0;
  font-size: clamp(1.25rem, 5.8vw, 2.2rem);
  line-height: 1.08;
  overflow: hidden;
  overflow-wrap: anywhere;
  flex: 0 0 auto;
}
.player-page .player-blank-template { margin: 0; max-height: 2.3em; overflow: hidden; font-size: clamp(.9rem, 4vw, 1.25rem); }
.player-page .player-answer-area { width: 100%; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1.5%; overflow: hidden; }
.player-page .answer-options {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 1.5%;
  overflow: hidden;
}
.player-page .answer-option { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.player-page .answer-option label {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 1.5% 3%;
  border-width: 2px;
  font-size: clamp(.76rem, 3.5vw, 1.05rem);
  line-height: 1.08;
  overflow: hidden;
}
.player-page .answer-option label > span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.player-page .answer-letter { min-width: min(9vw, 38px); width: min(9vw, 38px); height: min(9vw, 38px); flex: 0 0 auto; }
.player-page .player-answer-help { margin: 0; flex: 0 0 auto; font-size: clamp(.62rem, 2.6vw, .78rem); }
.player-page .player-typed-field { width: 100%; height: 100%; min-height: 0; margin: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 2%; }
.player-page .player-typed-field input { width: 100%; height: 100%; min-height: 52px; font-size: clamp(1rem, 5vw, 1.5rem); }
.player-page .compact-alert { margin: 0; padding: 2%; font-size: clamp(.65rem, 2.6vw, .8rem); }
.player-page #answer-error { margin: 0; max-height: 18%; padding: 2%; font-size: clamp(.64rem, 2.6vw, .8rem); overflow: hidden; flex: 0 0 auto; }
.player-page .result-icon { font-size: min(14vh, 4rem); line-height: 1; }
.player-page .simple-score { margin: 0; }
.player-page .result-explanation { font-size: clamp(.75rem, 3.2vw, 1rem); }
.player-page .player-slide-card .player-question-image { max-height: 35%; }

.player-page .player-leaderboard {
  padding: 3%;
  grid-template-rows: 8% 7% 13% minmax(0, 1fr);
}
.player-page .major-leaderboard h1 { font-size: clamp(1.7rem, 8vw, 2.8rem); margin: 0; }
.player-page .major-leaderboard .leaderboard-crown { font-size: clamp(1.5rem, 7vw, 2.5rem); }
.player-page .major-leaderboard .leaderboard-list { min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 1.2%; overflow: hidden; }
.player-page .major-leaderboard .leaderboard-row {
  width: 100%; height: 100%; min-height: 0; padding: 1% 2%;
  grid-template-columns: minmax(30px, 10%) minmax(0, 1fr) auto;
  gap: 2%; font-size: clamp(.68rem, 3vw, .9rem); overflow: hidden;
}
.player-page .major-leaderboard .leaderboard-rank { width: min(8vw, 34px); height: min(8vw, 34px); }
.player-page .major-leaderboard .leaderboard-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-page .winner-medal { width: min(20vh, 100px); height: min(20vh, 100px); }
.player-page .winner-score { font-size: clamp(1.3rem, 6vw, 2rem); }

.live-options-card { display: grid; gap: 12px; }
.live-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.live-options-grid .leaderboard-label-field { min-width: 0; }
.live-options-grid .button { height: fit-content; }
.score-rule-card { display: flex; align-items: center; gap: 12px; }
.score-rule-card > span:first-child { color: var(--gold-600); font-size: 1.7rem; }

@media (max-width: 760px) {
  .presenter-page .presenter-header { padding: 0 2%; }
  .presenter-page .presenter-header .brand-mark { width: 25px; height: 25px; }
  .presenter-page .presenter-lobby { grid-template-columns: 40% 58.5%; }
  .presenter-page .lobby-join-card,
  .presenter-page .lobby-player-card { padding: 4%; }
  .presenter-page .qr-code { height: 36%; max-height: 36%; }
  .presenter-page .join-address { display: none; }
  .presenter-page .lobby-player-card h1 { font-size: clamp(1.35rem, 5vw, 2.5rem); }
  .presenter-page .presenter-player-chips { grid-template-columns: 1fr; }
  .presenter-page .presenter-player-chip { font-size: .72rem; }
  .presenter-page .reveal-layout { grid-template-columns: 1fr; }
  .presenter-page .reveal-layout .distribution { display: none; }
  .live-options-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) and (orientation: portrait) {
  body.presenter-page { grid-template-rows: 7% 89% 4%; }
  .presenter-page .presenter-lobby { grid-template-columns: 1fr; grid-template-rows: 48% 50.5%; gap: 1.5%; }
  .presenter-page .lobby-join-card { padding: 2%; gap: 1%; }
  .presenter-page .qr-code { height: 48%; max-height: 48%; }
  .presenter-page .game-code { font-size: clamp(1.5rem, 10vw, 3rem); }
  .presenter-page .lobby-player-card { padding: 3%; }
  .presenter-page .lobby-player-card h1 { max-height: 1.2em; }
  .presenter-page .lobby-instruction { display: none; }
  .presenter-page .presenter-player-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .presenter-page .presenter-option-grid { grid-template-columns: 1fr; }
  .presenter-page .presenter-option-grid.option-count-2 { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .presenter-page .presenter-option-grid.option-count-3 { grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .presenter-page .presenter-option-grid.option-count-4,
  .presenter-page .presenter-option-grid.option-count-5,
  .presenter-page .presenter-option-grid.option-count-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
}

@media (max-height: 620px) {
  .presenter-page .presenter-header .brand-mark { width: 24px; height: 24px; }
  .presenter-page .qr-code { height: 35%; max-height: 35%; }
  .presenter-page .lobby-player-card h1 { font-size: clamp(1.4rem, 4vw, 3rem); }
  .presenter-page .presenter-question-image { max-height: 18%; }
  .presenter-page .presenter-question h1 { font-size: clamp(1.4rem, 3.6vw, 3.4rem); }
  .player-page .loading-wreath { width: min(15vh, 65px); height: min(15vh, 65px); border-width: 7px; }
  .player-page .player-question-card h1 { font-size: clamp(1rem, 4.6vw, 1.65rem); }
  .player-page .player-question-image { max-height: 15%; }
}
