:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #20342e;
  background: #f5f7f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #176d4d;
  --green-dark: #10533b;
  --line: #d8e1d9;
  --soft: #edf3ed;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
.shell {
  width: min(900px, calc(100% - 36px)); min-height: 240px; margin: 42px auto;
  padding: clamp(22px, 4vw, 38px); background: #fff; border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 10px 34px #22382b0b;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.8rem, 5vw, 2.5rem); letter-spacing: -.035em; }
h2 { margin-bottom: 12px; font-size: 1.25rem; letter-spacing: -.015em; }
p { line-height: 1.55; }
.brand { font-size: 1rem; font-weight: 850; letter-spacing: -.025em; }
.muted { color: #66736c; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 30px; }
.status { color: #66736c; font-size: .88rem; font-weight: 650; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 8px 1px 0; border-radius: 50%; background: #9aa69e; }
.status.online::before { background: #19885a; }
.status.offline::before { background: #b36c40; }
form { display: grid; gap: 17px; }
label { display: grid; gap: 7px; font-weight: 650; }
input, textarea, button { font: inherit; }
input, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #bdc9c0; border-radius: 9px; background: #fff; color: inherit; }
textarea { min-height: 82px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 3px solid #7bb89a66; outline-offset: 2px; border-color: var(--green); }
button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--green); border-radius: 9px; background: var(--green); color: #fff; font-weight: 750; cursor: pointer; transition: background .15s, transform .15s; }
button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
button:disabled { opacity: .52; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--green-dark); }
button.secondary:hover:not(:disabled) { background: var(--soft); }
button.danger { border-color: #ae5849; background: #ae5849; color: white; }
button.danger.secondary { background: #fff; color: #99483c; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions > button { flex: 0 0 auto; }
.error { margin: 0 0 18px; padding: 12px 14px; border: 1px solid #e5b7ae; border-radius: 9px; color: #873d31; background: #fff5f2; }
.notice { padding: 14px 16px; border: 1px solid #d4e4d6; border-radius: 10px; background: #f0f7f0; color: #315a43; }
.card, .current-progress { margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.current-progress { background: #f8faf7; }
.host-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; margin: 18px 0; }
.state-pill, .prompt-count { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; background: #eaf3eb; color: #286047; font-size: .88rem; font-weight: 750; }
.prompt-count { margin-bottom: 12px; }
.choice-preview { display: grid; gap: 7px; padding-left: 25px; }
.editor-list { display: grid; gap: 14px; }
.question-editor { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.question-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.question-editor-head h2 { margin: 0; }
.choice-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 11px; margin-top: 11px; }
.correct-picker { display: flex; min-height: 46px; align-items: center; gap: 7px; white-space: nowrap; font-size: .9rem; }
.correct-picker input { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
.unsaved { margin: 0; color: #92542c; font-weight: 700; }
.join-url { overflow-wrap: anywhere; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8faf7; font-family: ui-monospace, monospace; }
.player-list, .leaderboard { display: grid; gap: 8px; padding: 0; margin: 12px 0 0; list-style: none; }
.player-list li, .leaderboard li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: #f5f8f4; }
.presence { color: #738078; font-size: .9em; }
.answer-list { display: grid; gap: 10px; margin: 20px 0; }
.answer-choice { width: 100%; min-height: 58px; padding: 14px 17px; text-align: left; border-color: #cbd8ce; background: #f8fbf7; color: #244c39; }
.answer-choice:hover:not(:disabled) { border-color: var(--green); background: #edf5ed; }
.answer-choice.answer-selected { border-color: #176d4d; background: #dcefe0; box-shadow: inset 0 0 0 3px #176d4d; }
.answer-choice:disabled { opacity: 1; cursor: default; }
.answer-choice.answer-selected:disabled { opacity: 1; }
.answer-choice.answer-selected:disabled { border-color: #176d4d; background: #dcefe0; color: #183c29; }
.answer-result { font-size: 1.15rem; font-weight: 800; }
.result-correct { border-color: #8fc99b; background: #e6f5e8; color: #21643d; }
.result-incorrect { border-color: #e2a399; background: #fff0ed; color: #98483d; }
.result-skipped { border-color: #dfd2b6; background: #f7f0e2; color: #796441; }
.revealed-answers { pointer-events: none; }
.revealed-choice { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; border: 2px solid #cbd8ce; color: #244c39; }
.revealed-choice-label { padding: 3px 7px; border-radius: 999px; background: #fff9; color: inherit; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.revealed-choice.revealed-correct { border-color: #287b45; background: #dff1e2; color: #1d5c35; box-shadow: inset 0 0 0 2px #287b45; }
.revealed-choice.revealed-selected:not(.revealed-correct) { border-color: #a44f42; background: #fbe9e5; color: #843a32; }
.question-prompt { margin: 12px 0 20px; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.3; }
.leaderboard { counter-reset: rank; }
.leaderboard li { gap: 20px; }
.leaderboard .score { color: #55655c; text-align: right; font-size: .92rem; font-variant-numeric: tabular-nums; }
.footer-actions { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.grid-card { padding: 18px 0 0; overflow: hidden; }
.grid-card h2 { padding: 0 18px; }
.table-scroll { overflow-x: auto; width: 100%; }
.answer-grid { width: 100%; min-width: 680px; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.answer-grid th, .answer-grid td { min-width: 115px; padding: 9px; border-top: 1px solid #e5ebe5; border-right: 1px solid #e5ebe5; text-align: center; vertical-align: middle; }
.answer-grid thead th { position: sticky; top: 0; background: #f6f8f5; }
.answer-grid th:first-child { position: sticky; left: 0; z-index: 1; min-width: 145px; text-align: left; background: #f6f8f5; }
.answer-grid .row-name { font-weight: 700; }
.answer-grid .current-column { background: #f0f7ef; }
.answer-cell { display: grid; gap: 3px; min-width: 90px; padding: 7px 8px; border-radius: 7px; font-weight: 720; }
.cell-detail { color: #627168; font-size: .78rem; font-weight: 500; }
.cell-correct { background: #e4f3e7; color: #21643d; }
.cell-incorrect { background: #fbe9e5; color: #98483d; }
.cell-skipped { background: #f2eee7; color: #796441; }
.cell-waiting { background: #edf1f4; color: #526879; }
.cell-not-reached { background: #f4f5f3; color: #77817a; }
.hidden { display: none !important; }
@media (max-width: 600px) {
  .shell { width: 100%; min-height: 100vh; margin: 0; padding: 23px 17px 32px; border: 0; border-radius: 0; }
  .topline { margin-bottom: 23px; }
  .choice-row { grid-template-columns: minmax(0, 1fr); }
  .correct-picker { min-height: 30px; }
  .actions > button { flex: 1 1 100%; }
  .leaderboard li { align-items: flex-start; flex-direction: column; gap: 4px; }
  .leaderboard .score { text-align: left; }
}

.bear-avatar { object-fit: cover; border-radius: 50%; vertical-align: middle; margin-right: .6rem; flex-shrink: 0; }
.bear-picker { border: 0; padding: 0; margin: 1rem 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.bear-picker legend { margin-bottom: .65rem; font-weight: 600; }
.bear-option { display: flex; align-items: center; gap: .35rem; border: 2px solid #d3d9de; border-radius: .8rem; padding: .6rem; cursor: pointer; }
.bear-option:has(input:checked) { border-color: #24704f; background: #eaf5ee; }
.bear-option input { width: auto; margin: 0; }
.bear-option .bear-avatar { margin: 0; width: 48px; height: 48px; }

/* Participant quiz cards: warm paper, orange trim and chunky 1970s type. */
@font-face { font-family: Fraunces; src: url('/assets/fraunces.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
body.participant-theme { background: #f2e4c9; color: #492511; --green: #8c360f; --green-dark: #672407; --line: #d7b98a; --soft: #f7e4b9; }
.participant-theme .shell { max-width: 680px; background: #fff4da; border: 3px solid #663619; border-radius: 28px; outline: 7px solid #e77920; outline-offset: -13px; box-shadow: 0 7px 0 #d8bc8a; padding: clamp(30px, 5vw, 44px); }
.participant-theme .topline { flex-wrap: wrap; border-bottom: 6px double #e77920; padding-bottom: 20px; margin-bottom: 24px; gap: 10px; }
.participant-theme .brand { font-family: Fraunces, Georgia, serif; font-size: clamp(2rem, 7vw, 3rem); font-weight: 900; font-variation-settings: "SOFT" 100, "WONK" 1; letter-spacing: -.055em; line-height: 1.1; }
.participant-theme h1, .participant-theme h2, .participant-theme .answer-choice, .participant-identity { font-family: Fraunces, Georgia, serif; font-weight: 800; font-variation-settings: "SOFT" 100, "WONK" 1; }
.participant-theme h1 { font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -.035em; }
.participant-theme .question-prompt { font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.15; margin-bottom: 22px; }
.participant-theme .muted, .participant-theme .status, .participant-theme .presence, .participant-theme .score { color: #76523b; }
.participant-theme .status { font-size: .8rem; }
.participant-theme button { border: 2px solid #643315; border-radius: 18px; background: #ed8b28; color: #492511; box-shadow: 0 3px 0 #643315; font-weight: 800; }
.participant-theme button:hover:not(:disabled) { background: #e8a44e; }
.participant-theme button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #643315; }
.participant-theme button.secondary { background: #f8e8c6; }
.participant-theme .answer-list { gap: 14px; }
.participant-theme .answer-choice { min-height: 66px; padding: 13px 22px; border-radius: 23px; background: #f2bb32; font-size: 1.45rem; text-align: center; overflow-wrap: anywhere; }
.participant-theme .answer-choice:nth-child(even) { background: #f08a26; }
.participant-theme .answer-choice:hover:not(:disabled) { background: #f8cd67; border-color: #492511; }
.participant-theme .answer-choice.answer-selected { border-color: #623415; background: #ffe18a; box-shadow: inset 0 0 0 3px #623415, 0 3px 0 #623415; }
.participant-theme .answer-choice:disabled { color: #492511; }
.participant-theme .answer-result { text-align: center; font-family: Fraunces, Georgia, serif; font-size: 1.35rem; }
.participant-theme .result-correct { background: #e4f2be; color: #325d2b; }
.participant-theme .result-incorrect { background: #f9d3b2; color: #78351d; }
.participant-theme .result-skipped { background: #f3e5c9; color: #70552e; }
.participant-theme .notice.result-correct { background: #e4f2be; border-color: #8eb671; color: #325d2b; }
.participant-theme .notice.result-incorrect { background: #f9d3b2; border-color: #d89d73; color: #78351d; }
.participant-theme .notice.result-skipped { background: #f3e5c9; border-color: #c9ad7b; color: #70552e; }
.participant-theme .revealed-choice { color: #492511; }
.participant-theme .revealed-choice { border: 2px solid #b68a5a; }
.participant-theme .revealed-choice.revealed-correct { border-color: #496b32; background: #dcebb3; color: #355322; box-shadow: inset 0 0 0 2px #496b32; }
.participant-theme .revealed-choice.revealed-selected:not(.revealed-correct) { border-color: #8b3d24; background: #f7d6c0; color: #71351e; }
.participant-theme input { border: 2px solid #b68a5a; background: #fffaf0; border-radius: 12px; }
.participant-theme input:focus, .participant-theme button:focus-visible { outline: 3px solid #7a3f16; outline-offset: 4px; }
.participant-theme .bear-option { border-color: #d9b68a; background: #fff8e9; border-radius: 15px; }
.participant-theme .bear-option:has(input:checked) { border-color: #8c360f; background: #f9d98e; }
.participant-theme .bear-option input { accent-color: #8c360f; }
.participant-theme .bear-avatar { border: 2px solid #b26b2d; }
.participant-theme .notice { background: #fae4b3; color: #663719; border-color: #c99b60; border-radius: 16px; }
.participant-theme .card { background: #fff8e8; border-color: #d7b98a; border-radius: 18px; }
.participant-theme .player-list li, .participant-theme .leaderboard li { background: #f7e7c8; border-radius: 14px; }
.participant-identity { display: flex; align-items: center; gap: 9px; margin: 20px 0; font-size: 1.3rem; }
.participant-identity .bear-avatar { width: 56px; height: 56px; margin: 0; }
@media (max-width: 600px) {
  .participant-theme .shell { width: calc(100% - 20px); margin: 14px auto; min-height: calc(100svh - 28px); padding: 29px 22px; border-radius: 24px; }
  .participant-theme .topline { margin-bottom: 20px; }
  .participant-theme .bear-option { padding: .5rem; font-size: .85rem; flex: 1 1 120px; }
  .participant-theme .bear-option .bear-avatar { width: 38px; height: 38px; }
}
html:has(body.participant-theme) { background: #f2e4c9; }
.participant-theme .player-list li { justify-content: flex-start; }
.participant-theme .leaderboard strong { flex: 1; }

.topline { justify-content: flex-end; }

.bear-option { position: relative; }
.bear-option input[type="radio"] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.bear-option:has(input:focus-visible) { outline: 3px solid #7a3f16; outline-offset: 4px; }

.confetti-celebration { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -16px; left: var(--x); width: 9px; height: 14px; border-radius: 2px; background: var(--color); opacity: 0; animation: confetti-fall 1.65s var(--delay) ease-out forwards; }
@keyframes confetti-fall { 0% { transform: translate3d(0, -5vh, 0) rotate(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translate3d(28px, 110vh, 0) rotate(var(--spin)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti-celebration { display: none; } }

.host-progress { position: sticky; top: 8px; z-index: 3; margin: 18px 0; padding: 14px; background: #fff; border: 2px solid var(--green); border-radius: 14px; box-shadow: 0 4px 14px #20342e14; }
.host-sequence { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0 0 12px; }
.flow-step { display: grid; gap: 5px; padding: 10px; border-radius: 8px; color: #66736c; background: #f3f5f2; }
.flow-step small { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.current-step { background: #e2f0e5; color: #204d35; outline: 2px solid #176d4d; }
.host-progress > button { width: 100%; }
.connection-warning { gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
@media (max-width: 600px) { .host-progress { top: 4px; padding: 10px; } .flow-step { padding: 8px 5px; font-size: .85rem; } }

/* Reserve one feedback slot throughout a question so answers never jump. */
.answer-feedback { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.answer-waiting { margin: 0; color: #76523b; text-align: center; font-size: .95rem; }
.answer-stamp { margin: 0; padding: 7px 18px; max-width: 100%; border: 4px double currentColor; font-family: Fraunces, Georgia, serif; font-weight: 900; font-size: 1.4rem; line-height: 1.2; text-align: center; }
.stamp-correct { color: #315d2b; background: #eef4d5; transform: rotate(-4deg); text-transform: uppercase; letter-spacing: .06em; border-radius: 5px; }
.stamp-incorrect { color: #492511; background: #ffe056; border: 3px solid #492511; border-radius: 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 1.1rem; transform: rotate(-2deg); }
.stamp-skipped { color: #76523b; border: 0; font-size: 1rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.answer-choice { position: relative; }
.participant-theme .answer-choice.revealed-choice { display: block; opacity: 1; box-shadow: 0 3px 0 #643315; transform: none; }
.revealed-choice-label { position: absolute; right: 10px; bottom: 3px; font-size: .62rem; line-height: 1.15; padding: 1px 5px; }
.participant-theme .answer-choice:hover:not(:disabled) { transform: none; }

.question-move-controls { display: flex; gap: 4px; flex-shrink: 0; }
.question-move-controls button { min-height: 34px; padding: 4px 8px; }
.question-drag-handle { cursor: grab; }
.question-drag-handle:active { cursor: grabbing; }
.question-editor-head h2 { flex: 1; }
.question-editor.dragging { opacity: .5; }
.question-editor.drop-before { box-shadow: 0 -4px 0 var(--green); }
.question-editor.drop-after { box-shadow: 0 4px 0 var(--green); }
.leaderboard li { display: grid; grid-template-columns: 2ch 32px minmax(0, 1fr) auto; flex-direction: row; align-items: center; gap: 10px; border: 1px solid transparent; }
.leaderboard .bear-avatar { width: 32px; height: 32px; margin: 0; }
.leaderboard-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-rank { font-weight: 850; font-variant-numeric: tabular-nums; }
.leaderboard .score { text-align: right; white-space: nowrap; }
.leaderboard li.medal-gold { background: #f5dc8b; border-color: #c89b37; color: #51390f; }
.leaderboard li.medal-silver { background: #e1e5e9; border-color: #a6afb9; color: #34414f; }
.leaderboard li.medal-bronze { background: #e8bea0; border-color: #b97e54; color: #603b22; }
@media (max-width: 600px) {
  .question-editor-head { flex-wrap: wrap; }
  .leaderboard li { gap: 7px; padding: 10px 8px; font-size: .88rem; }
  .leaderboard .score { font-size: .8rem; }
}

.answer-overlay-stamp { position: absolute; z-index: 1; top: 0; right: 12px; max-width: calc(100% - 24px); padding: 5px 10px; border-width: 2px; font-size: .85rem; line-height: 1.2; white-space: nowrap; transform: translateY(-45%) rotate(-3deg); pointer-events: none; }

.stamp-annotation { background: #eef4d5; color: #315d2b; border: 2px solid #315d2b; border-radius: 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .75rem; white-space: normal; }

.participant-rankings li { grid-template-columns: 5ch minmax(0, 1fr) 5ch; min-height: 76px; gap: 8px; padding: 14px 12px; font-size: clamp(1rem, 3.8vw, 1.5rem); }
.participant-rankings .leaderboard-rank, .participant-rankings .leaderboard-name { font-family: Fraunces, Georgia, serif; font-weight: 850; }
.leaderboard-identity { display: flex; justify-content: center; align-items: center; gap: 10px; min-width: 0; }
.participant-rankings .leaderboard-name { flex: 0 1 auto; text-align: center; }
.participant-rankings .bear-avatar { width: 42px; height: 42px; flex-shrink: 0; }
.participant-rankings .score { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 1em; font-weight: 400; color: inherit; }
@media (max-width: 600px) {
  .participant-rankings li { grid-template-columns: 3.5ch minmax(0, 1fr) 3.5ch; gap: 5px; padding: 12px 8px; }
  .participant-rankings .bear-avatar { width: 30px; height: 30px; }
  .leaderboard-identity { gap: 6px; }
  .participant-rankings .score { font-size: .95em; }
}
.participant-theme .participant-rankings .leaderboard-name { flex: 0 1 auto; }

/* Square image answers retain their shape while loading and across reveal states. */
.answer-list.image-answer-list, .choice-preview.image-answer-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
  gap: 14px; padding-left: 0; list-style: none;
}
.image-answer-list > .image-answer-card,
.participant-theme .image-answer-list > .image-answer-card {
  display: flex; flex-direction: column; justify-content: flex-start; gap: 0;
  min-width: 0; padding: 8px; border-radius: 16px; text-align: left;
  font-size: 1rem; overflow: visible;
}
.answer-image-frame { display: block; position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eee5d6; }
.answer-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.answer-image[hidden], .image-load-error[hidden], .image-preload-status[hidden] { display: none; }
.image-load-error { position: absolute; inset: 0; display: grid; place-content: center; padding: 12px; text-align: center; color: #603f27; font: .9rem/1.4 ui-sans-serif, system-ui, sans-serif; }
.image-answer-caption { display: flex; align-items: baseline; gap: 8px; padding: 8px 4px 3px; overflow-wrap: anywhere; }
.image-answer-letter { font-weight: 800; flex-shrink: 0; }
.image-answer-text { font: .95rem/1.35 ui-sans-serif, system-ui, sans-serif; }
.image-answer-card:focus-visible { outline: 4px solid #244c39; outline-offset: 4px; }
.image-answer-card.answer-selected .image-answer-letter::after { content: ' ✓'; }
.image-answer-card .answer-overlay-stamp { position: static; display: block; align-self: stretch; max-width: none; white-space: normal; transform: none; margin-top: 6px; font-size: .75rem; text-align: center; }
.image-answer-card .revealed-choice-label { position: static; align-self: flex-start; margin-top: 6px; white-space: normal; }
.choice-preview .image-answer-card { border: 2px solid #cbd8ce; background: #fff; }
.choice-preview .image-answer-card.correct { border-color: #287b45; }
.host-correct-label { font-weight: 800; color: #287b45; padding: 5px; }
.image-preload-status, .image-upload-status { font: .85rem/1.4 ui-sans-serif, system-ui, sans-serif; color: #64523f; }
.image-editor-preview { display: block; width: 100%; max-width: 180px; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #eee5d6; }
.image-choice-editor { display: grid; gap: 10px; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr); align-items: start; }
.image-crop-dialog { width: calc(100% - 32px); max-width: 520px; max-height: 90dvh; overflow-y: auto; border: 2px solid #9b7853; border-radius: 18px; padding: 18px; }
.image-crop-dialog::backdrop { background: #25180db3; }
.image-crop-dialog canvas { display: block; width: 100%; aspect-ratio: 1; touch-action: none; border-radius: 8px; }
.image-crop-controls { display: grid; gap: 10px; margin-block: 14px; }
.image-crop-controls label { display: grid; gap: 4px; }
.image-crop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (min-width: 900px) {
  .answer-list.image-answer-list, .choice-preview.image-answer-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .answer-list.image-answer-list { gap: 8px; }
  .participant-theme .image-answer-list > .image-answer-card { padding: 5px; border-radius: 12px; }
  .image-choice-editor { grid-template-columns: 1fr; }
}

/* Give desktop picture rounds the viewport, rather than the narrow text card. */
@media (min-width: 900px) {
  .participant-theme .shell.image-question {
    width: calc(100% - 36px); max-width: none; min-height: calc(100dvh - 36px);
    margin: 18px auto; padding: 28px;
  }
  .participant-theme .image-question .image-answer-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  }
  .participant-theme .image-question .answer-image-frame {
    aspect-ratio: auto; height: max(220px, calc((100dvh - 270px) / 2));
  }
  .participant-theme .image-question .image-answer-list:has(> :last-child:nth-child(2)) .answer-image-frame {
    height: max(320px, calc(100dvh - 230px));
  }
  .participant-theme .image-question .image-answer-caption { font-size: 1.15rem; }
}

@media (min-width: 1280px) {
  .participant-theme .image-question .image-answer-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.participant-quiz-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 16px; margin-bottom: 16px;
}
.participant-theme .participant-quiz-title {
  margin: 0; font-size: clamp(1rem, 2vw, 1.5rem); letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.participant-quiz-progress { text-align: center; white-space: nowrap; font-size: .95rem; }
.participant-quiz-header .participant-identity {
  justify-content: flex-end; min-width: 0; margin: 0; font-size: 1.1rem;
}
.participant-quiz-header .participant-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-quiz-header .bear-avatar { width: 38px; height: 38px; flex-shrink: 0; }
@media (max-width: 600px) {
  .participant-quiz-header { gap: 8px; margin-bottom: 12px; }
  .participant-quiz-progress, .participant-quiz-header .participant-identity { font-size: .8rem; }
  .participant-quiz-header .bear-avatar { width: 30px; height: 30px; }
}

.live-quiz-layout { display: flex; flex-direction: column; gap: 24px; }
.live-question-content { min-width: 0; }
.live-leaderboard { min-width: 0; padding: 16px; border: 2px solid #d9b58a; border-radius: 16px; align-self: stretch; }
.live-leaderboard h2 { font-size: 1.15rem; margin-bottom: 12px; }
.live-leaderboard-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.live-rank { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px; border-radius: 9px; }
.live-rank .bear-avatar { width: 32px; height: 32px; margin: 0; flex-shrink: 0; }
.live-rank-number { min-width: 24px; }
.live-rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-rank-score { font-weight: 400; }
.live-rank-updated { animation: rank-reorder .65s ease-out both; }
@keyframes rank-reorder {
  from { transform: translateY(var(--rank-shift)); background: #f8d987; }
  to { transform: translateY(0); background: transparent; }
}
@media (min-width: 1280px) {
  .participant-theme .shell.live-question { width: calc(100% - 36px); max-width: none; }
  .live-quiz-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
  .live-question-content { grid-column: 2; grid-row: 1; }
  .live-leaderboard { grid-column: 1; grid-row: 1; position: sticky; top: 18px; }
}
@media (prefers-reduced-motion: reduce) { .live-rank-updated { animation: none; } }

.current-question-status { margin: 16px 0; }
.current-question-status h3 { margin-bottom: 6px; font-size: 1rem; }
.current-question-status p { margin-bottom: 10px; }
.current-answer-status { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.current-answer-status li { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 10px; background: #edf0eb; }
.current-answer-status .bear-avatar { width: 28px; height: 28px; margin: 0; }
.current-answer-status li span:last-child { font-size: .75rem; color: #66736c; }
.current-answer-status .has-answered { background: #d9eedb; }
.current-answer-status .has-answered span:last-child { color: #176d4d; }

.question-picture-editor { display: grid; gap: 10px; margin-block: 14px; }
.question-picture { margin: 0 0 16px; }
.question-picture .answer-image-frame { aspect-ratio: auto; height: min(38vh, 360px); background: transparent; }
@media (min-width: 900px) {
  .has-question-picture .question-picture .answer-image-frame { height: clamp(140px, 27dvh, 320px); }
  .has-question-picture .answer-list:not(.image-answer-list) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .participant-theme .image-question .has-question-picture .image-answer-list .answer-image-frame { height: max(130px, calc((100dvh - 480px) / 2)); }
  .participant-theme .has-question-picture .question-prompt { font-size: 1.7rem; margin-bottom: 12px; }
}
@media (min-width: 900px) {
  .participant-theme .shell:has(.has-question-picture) { margin: 18px auto; padding: 28px; }
}
