:root {
  --ink: oklch(34% 0.065 210);
  --ink-deep: oklch(25% 0.052 210);
  --teal: oklch(57% 0.104 185);
  --teal-dark: oklch(42% 0.082 185);
  --teal-pale: oklch(94% 0.035 185);
  --gold: oklch(82% 0.13 85);
  --gold-pale: oklch(95% 0.045 85);
  --orange: oklch(63% 0.17 37);
  --red-pale: oklch(94% 0.04 32);
  --green: oklch(52% 0.12 165);
  --green-pale: oklch(94% 0.035 165);
  --text: oklch(32% 0.033 210);
  --muted: oklch(45% 0.026 210);
  --line: oklch(86% 0.018 190);
  --surface: oklch(100% 0 0);
  --canvas: oklch(96% 0.012 190);
  --focus: oklch(82% 0.13 85);
  --z-sticky: 20;
  --z-toast: 50;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 5% 0%, color-mix(in oklch, var(--teal) 13%, transparent), transparent 25rem),
    radial-gradient(circle at 100% 100%, color-mix(in oklch, var(--gold) 18%, transparent), transparent 30rem),
    var(--canvas);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.appbar {
  position: sticky;
  z-index: var(--z-sticky);
  top: 0;
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 10px clamp(14px, 4vw, 46px);
  background: var(--ink);
  color: var(--surface);
}
.connection-wrap { display: flex; align-items: center; gap: 8px; }
.connection-status, .room-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}
.connection-status { background: color-mix(in oklch, var(--surface) 12%, transparent); color: oklch(91% 0.018 190); }
.connection-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.connection-status[data-state="online"] span { background: oklch(78% 0.16 155); }
.connection-status[data-state="offline"] span { background: oklch(70% 0.18 35); }
.room-chip { background: var(--gold); color: var(--ink); letter-spacing: .08em; }
.network-banner {
  position: sticky;
  z-index: calc(var(--z-sticky) - 1);
  top: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 10px clamp(14px, 4vw, 46px);
  background: var(--gold);
  color: var(--ink-deep);
}
.network-banner > div { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.network-banner strong { flex: 0 0 auto; }
.network-banner span { font-size: .82rem; }
.network-retry {
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 900;
}
.network-retry:hover { background: var(--ink); color: var(--surface); }

main { padding: clamp(16px, 4vw, 42px); }
.screen { width: min(1120px, 100%); margin-inline: auto; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.1; letter-spacing: -.028em; text-wrap: balance; }
h1 { font-size: clamp(2.45rem, 7vw, 5.4rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
h3 { font-size: 1.25rem; }
p { text-wrap: pretty; }
.intro { margin: 0 0 7px; color: var(--teal-dark); font-weight: 900; }
.lead { max-width: 64ch; margin: 15px 0 22px; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.lead.compact { margin-bottom: 17px; }

.home-screen {
  display: grid;
  min-height: min(700px, calc(100vh - 146px));
  overflow: hidden;
  grid-template-columns: minmax(0, 1.06fr) minmax(390px, .94fr);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 0 var(--ink);
}
.home-visual { position: relative; min-height: 420px; overflow: hidden; background: var(--ink); }
.home-visual img { width: 100%; height: 100%; object-fit: cover; }
.home-visual::after { position: absolute; inset: 0; content: ""; background: linear-gradient(180deg, transparent 25%, color-mix(in oklch, var(--ink-deep) 90%, transparent)); }
.visual-overlay { position: absolute; z-index: 1; right: clamp(22px, 4vw, 52px); bottom: clamp(24px, 5vw, 54px); left: clamp(22px, 4vw, 52px); color: var(--surface); }
.visual-overlay p { margin: 0 0 12px; color: var(--gold); font-weight: 900; }
.visual-overlay h1 { max-width: 11ch; color: var(--surface); }
.visual-overlay span { display: block; max-width: 47ch; margin-top: 16px; color: oklch(93% 0.015 190); font-size: 1rem; line-height: 1.55; }
.home-actions { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: clamp(27px, 5vw, 58px); }
.choice-list { display: grid; gap: 11px; }
.choice-button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 78px;
  padding: 13px 15px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color 180ms cubic-bezier(.16, 1, .3, 1), transform 180ms cubic-bezier(.16, 1, .3, 1), background-color 180ms ease;
}
.choice-button:hover { border-color: var(--teal); transform: translateY(-2px); }
.choice-primary { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.choice-primary:hover { border-color: var(--ink-deep); background: var(--ink-deep); }
.choice-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 10px; background: var(--teal-pale); color: var(--ink); font-size: 1.35rem; font-weight: 900; }
.choice-primary .choice-icon { background: var(--gold); }
.choice-button strong, .choice-button small { display: block; }
.choice-button strong { font-size: 1rem; }
.choice-button small { margin-top: 3px; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.choice-primary small { color: oklch(88% 0.022 190); }

.entry-form { display: grid; gap: 12px; }
.back-link, .text-button {
  width: fit-content;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 850;
}
.back-link { margin-bottom: 12px; }
.back-link:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.field { display: grid; min-width: 0; gap: 6px; }
.field span { color: var(--ink); font-size: .82rem; font-weight: 900; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}
.field input::placeholder { color: oklch(48% 0.02 210); }
.field input:hover { border-color: color-mix(in oklch, var(--teal) 60%, var(--line)); }
.field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in oklch, var(--teal) 18%, transparent); }
.code-input { text-transform: uppercase; letter-spacing: .18em; font-weight: 900; }
.form-error { margin: -2px 0 0; color: oklch(45% 0.16 35); font-size: .82rem; font-weight: 800; }

.primary, .secondary {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 19px;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 180ms cubic-bezier(.16, 1, .3, 1), background-color 180ms ease, border-color 180ms ease;
}
.primary { border: 2px solid var(--ink); background: var(--ink); color: var(--surface); }
.primary:hover:not(:disabled) { border-color: var(--ink-deep); background: var(--ink-deep); transform: translateY(-2px); }
.primary:disabled { border-color: oklch(77% 0.015 200); background: oklch(77% 0.015 200); color: oklch(40% 0.018 210); }
.secondary { border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary:hover { border-color: var(--teal); transform: translateY(-2px); }
.full-width { width: 100%; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

.room-board {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(23px, 5vw, 44px);
  border-radius: 16px 16px 0 0;
  background: var(--ink);
  color: var(--surface);
}
.board-label { margin: 0 0 7px; color: oklch(86% 0.025 190); font-size: .82rem; font-weight: 800; }
.room-code { display: flex; align-items: flex-end; gap: 16px; padding: 0; border: 0; background: transparent; color: var(--surface); text-align: left; }
.room-code span { color: var(--gold); font-size: clamp(2.6rem, 8vw, 5.5rem); line-height: .9; letter-spacing: .11em; font-weight: 950; }
.room-code small { padding-bottom: 5px; color: oklch(82% 0.02 190); font-size: .72rem; }
.room-entry-options { display: flex; max-width: 56%; align-items: center; justify-content: flex-end; gap: 16px; }
.room-qr { width: 116px; height: 116px; flex: 0 0 auto; border: 7px solid var(--surface); border-radius: 10px; background: var(--surface); }
.join-address { display: grid; min-width: 0; justify-items: end; gap: 4px; text-align: right; }
.join-address span { color: oklch(84% 0.023 190); font-size: .78rem; }
.join-address strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-address .text-button { color: var(--gold); }
.lobby-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; min-height: 450px; background: var(--surface); box-shadow: 0 8px 0 var(--ink); }
.participant-section { min-width: 0; padding: clamp(24px, 4vw, 42px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.count-badge { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; background: var(--teal-pale); color: var(--teal-dark); font-size: .82rem; font-weight: 900; }
.empty-state { display: grid; justify-items: center; margin-top: 50px; color: var(--muted); text-align: center; }
.empty-state strong { margin-top: 15px; color: var(--ink); }
.empty-state p { margin: 7px 0 0; }
.empty-pulse { width: 42px; height: 42px; border: 8px solid var(--teal-pale); border-radius: 50%; background: var(--teal); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px color-mix(in oklch, var(--teal) 0%, transparent); } }
.participant-list { display: flex; flex-wrap: wrap; gap: 9px; margin: 26px 0 0; padding: 0; list-style: none; }
.participant-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px 9px 9px; border-radius: 999px; background: var(--canvas); color: var(--ink); font-weight: 850; }
.participant-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--teal); color: var(--surface); font-size: .76rem; }
.participant-item small { color: var(--muted); font-weight: 750; }
.participant-item[data-connected="false"] { opacity: .58; }
.participant-item[data-answered="true"] { background: var(--green-pale); }
.host-controls { padding: clamp(25px, 4vw, 38px) 28px; background: var(--teal-pale); }
.host-controls p { color: var(--muted); line-height: 1.5; }
.host-controls small { display: block; margin-top: 9px; color: var(--muted); text-align: center; }
.rule-list { display: grid; gap: 9px; margin: 25px 0; padding: 0; list-style: none; }
.rule-list li { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; }
.rule-list span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--surface); color: var(--teal-dark); font-size: .77rem; font-weight: 950; }

.player-wait, .error-screen { display: grid; min-height: min(650px, calc(100vh - 150px)); place-items: center; align-content: center; padding: 32px; border-radius: 16px; background: var(--surface); text-align: center; box-shadow: 0 8px 0 var(--ink); }
.player-wait h1, .error-screen h1 { max-width: 13ch; font-size: clamp(2.2rem, 6vw, 4.6rem); }
.player-wait > p:last-child, .error-screen p { max-width: 48ch; color: var(--muted); line-height: 1.55; }
.waiting-mark { display: flex; gap: 7px; margin-bottom: 25px; }
.waiting-mark span { width: 13px; height: 13px; border-radius: 50%; background: var(--teal); animation: wait 1.2s ease-in-out infinite; }
.waiting-mark span:nth-child(2) { animation-delay: 120ms; }
.waiting-mark span:nth-child(3) { animation-delay: 240ms; }
@keyframes wait { 50% { transform: translateY(-8px); background: var(--gold); } }
.wait-room { display: inline-flex; align-items: center; gap: 13px; margin: 4px 0 20px; padding: 11px 16px; border-radius: 10px; background: var(--ink); color: var(--surface); }
.wait-room span { color: oklch(85% 0.02 190); font-size: .8rem; }
.wait-room strong { color: var(--gold); letter-spacing: .12em; }

.quiz-screen { overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: 0 8px 0 var(--ink); }
.quiz-topline { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 20px; background: var(--ink); color: var(--surface); }
.quiz-topline > div:first-child { display: grid; gap: 2px; }
.quiz-topline span { color: oklch(85% 0.023 190); font-size: .76rem; }
.quiz-topline strong { font-weight: 950; }
.score-wrap { text-align: center; }
.score-wrap strong { display: block; color: var(--gold); font-size: 1.3rem; }
.timer { display: grid; width: 54px; height: 54px; place-items: center; align-content: center; border-radius: 50%; background: var(--gold); color: var(--ink); }
.timer strong { font-size: 1.35rem; line-height: 1; }
.timer span { color: var(--ink); font-size: .58rem; font-weight: 850; }
.timer[data-urgent="true"] { background: var(--orange); color: var(--surface); }
.timer[data-urgent="true"] span { color: var(--surface); }
.timer-track { height: 8px; background: var(--line); }
.timer-track span { display: block; width: 100%; height: 100%; background: var(--gold); transform-origin: left; }
.timer-track span[data-urgent="true"] { background: var(--orange); }
.question-layout { display: grid; grid-template-columns: minmax(330px, .88fr) minmax(440px, 1.12fr); min-height: 570px; }
.question-photo { position: relative; min-width: 0; margin: 0; overflow: hidden; background: var(--line); }
.question-photo img { width: 100%; height: 100%; object-fit: cover; }
.question-photo figcaption { position: absolute; right: 14px; bottom: 14px; left: 14px; padding: 9px 11px; border-radius: 8px; background: color-mix(in oklch, var(--ink-deep) 88%, transparent); color: var(--surface); font-size: .73rem; line-height: 1.4; }
.question-content { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: clamp(24px, 4.5vw, 52px); }
.category { width: fit-content; margin-bottom: 12px; padding: 6px 10px; border-radius: 999px; background: var(--teal-pale); color: var(--teal-dark); font-size: .75rem; font-weight: 900; }
.question-content h2 { margin-bottom: 22px; }
.answer-list { display: grid; gap: 10px; }
.answer-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 62px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 780;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in oklch, var(--teal) 18%, transparent);
  user-select: none;
  transition: border-color 150ms ease, transform 150ms cubic-bezier(.16, 1, .3, 1), background-color 150ms ease;
}
.answer-button > * { pointer-events: none; }
.answer-button:hover:not(:disabled) { border-color: var(--teal); transform: translateX(3px); }
.answer-button:disabled { cursor: default; }
.answer-letter { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 9px; background: var(--canvas); color: var(--ink); font-weight: 950; }
.answer-button[data-selected="true"] { border-color: var(--ink); background: color-mix(in oklch, var(--teal-pale) 58%, var(--surface)); }
.answer-button[data-correct="true"] { border-color: var(--green); background: var(--green-pale); color: oklch(37% 0.09 165); }
.answer-button[data-correct="true"] .answer-letter { background: var(--green); color: var(--surface); }
.answer-button[data-wrong="true"] { border-color: var(--orange); background: var(--red-pale); color: oklch(43% 0.14 35); }
.answer-button[data-wrong="true"] .answer-letter { background: var(--orange); color: var(--surface); }
.answer-button[data-dim="true"] { opacity: .5; }
.answer-status { margin-top: 15px; padding: 13px 14px; border-radius: 10px; background: var(--teal-pale); color: var(--teal-dark); line-height: 1.45; }
.answer-status strong { display: block; margin-bottom: 2px; color: var(--ink); }
.answer-status[data-tone="correct"] { background: var(--green-pale); color: oklch(37% 0.09 165); }
.answer-status[data-tone="wrong"] { background: var(--red-pale); color: oklch(43% 0.14 35); }
.host-progress { margin-top: 22px; }
.host-progress strong { display: block; margin-bottom: 8px; color: var(--ink); }
.host-progress > div { height: 10px; overflow: hidden; border-radius: 999px; background: var(--line); }
.host-progress span { display: block; width: 100%; height: 100%; background: var(--teal); transform: scaleX(0); transform-origin: left; transition: transform 200ms ease; }

.round-leaderboard-screen { min-height: min(680px, calc(100vh - 150px)); padding: clamp(26px, 5vw, 54px); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 0 var(--ink); }
.round-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.round-heading h1 { font-size: clamp(2.1rem, 5vw, 4.2rem); }
.round-heading .lead { margin-bottom: 0; }
.next-countdown { display: grid; width: 108px; height: 108px; flex: 0 0 auto; place-items: center; align-content: center; border-radius: 50%; background: var(--gold); color: var(--ink); text-align: center; }
.next-countdown strong { font-size: 2.35rem; line-height: 1; }
.next-countdown span { margin-top: 3px; font-size: .72rem; font-weight: 850; }
.round-self-result { margin: 22px 0 16px; padding: 13px 15px; border-radius: 10px; background: var(--teal-pale); color: var(--teal-dark); font-weight: 850; }
.round-self-result[data-tone="correct"] { background: var(--green-pale); color: oklch(37% 0.09 165); }
.round-self-result[data-tone="wrong"] { background: var(--red-pale); color: oklch(43% 0.14 35); }
.round-board-wrap { max-width: 850px; margin: 26px auto 0; overflow: hidden; border-radius: 12px; background: var(--canvas); }
.round-leaderboard-list { margin: 0; padding: 0; list-style: none; }
.round-leaderboard-list .leaderboard-row { grid-template-columns: 72px minmax(0, 1fr) 110px; }
.round-leaderboard-list .leaderboard-row:nth-child(-n+3) { background: var(--gold-pale); }
.round-next-label { margin: 18px 0 0; color: var(--muted); font-size: .86rem; font-weight: 800; text-align: center; }

.result-screen { padding: clamp(28px, 5vw, 58px); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 0 var(--ink); }
.result-heading { text-align: center; }
.result-heading h1 { font-size: clamp(2.2rem, 6vw, 4.5rem); }
.result-heading h1 span { color: var(--teal-dark); letter-spacing: .04em; }
.result-heading .lead { margin-inline: auto; }
.podium { display: flex; min-height: 240px; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 16px); margin: 28px auto 38px; }
.podium-item { display: grid; width: min(210px, 30%); min-height: var(--podium-height); align-content: start; justify-items: center; padding: 19px 12px 14px; border-radius: 12px 12px 0 0; background: var(--canvas); text-align: center; }
.podium-item[data-rank="1"] { background: var(--gold-pale); }
.podium-rank { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 10px; border-radius: 50%; background: var(--ink); color: var(--surface); font-weight: 950; }
.podium-item[data-rank="1"] .podium-rank { background: var(--gold); color: var(--ink); }
.podium-item strong { max-width: 100%; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.podium-item small { margin-top: 3px; color: var(--muted); }
.podium-item b { margin-top: 13px; color: var(--teal-dark); font-size: 1.25rem; }
.leaderboard-wrap { max-width: 850px; margin-inline: auto; overflow: hidden; border-radius: 12px; background: var(--canvas); }
.leaderboard-head, .leaderboard-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 90px 110px; align-items: center; gap: 12px; }
.leaderboard-head { padding: 11px 17px; background: var(--ink); color: var(--surface); font-size: .73rem; font-weight: 850; }
.leaderboard-head span:nth-child(n+3) { text-align: right; }
.leaderboard-list { margin: 0; padding: 0; list-style: none; }
.leaderboard-row { min-height: 65px; padding: 9px 17px; border-bottom: 1px solid var(--line); }
.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row[data-self="true"] { background: var(--teal-pale); }
.leaderboard-position { color: var(--ink); font-size: 1.1rem; font-weight: 950; }
.leaderboard-person { min-width: 0; }
.leaderboard-person strong, .leaderboard-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-person strong { color: var(--ink); }
.leaderboard-person small { margin-top: 2px; color: var(--muted); }
.leaderboard-stat { text-align: right; font-weight: 850; }
.leaderboard-score { color: var(--teal-dark); font-size: 1.05rem; font-weight: 950; text-align: right; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 28px; }

.error-screen > span { display: grid; width: 64px; height: 64px; margin-bottom: 20px; place-items: center; border-radius: 50%; background: var(--red-pale); color: var(--orange); font-size: 2rem; font-weight: 950; }
.error-screen h1 { font-size: clamp(2.1rem, 6vw, 4rem); }
.toast { position: fixed; z-index: var(--z-toast); right: 16px; bottom: 16px; max-width: calc(100vw - 32px); padding: 12px 15px; border-radius: 10px; background: var(--ink-deep); color: var(--surface); font-weight: 800; box-shadow: 0 6px 0 color-mix(in oklch, black 18%, transparent); }

.admin-body {
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--teal-pale) 72%, white), var(--canvas) 48%, color-mix(in oklch, var(--gold-pale) 48%, white));
}
.admin-main { padding: clamp(16px, 3vw, 36px); }
.admin-body .appbar { min-height: 58px; border-bottom: 1px solid var(--line); background: color-mix(in oklch, var(--surface) 90%, var(--canvas)); color: var(--ink); }
.admin-body .connection-status { background: var(--green-pale); color: var(--ink); }
.admin-body .room-chip { background: var(--gold-pale); color: var(--ink); }
.admin-header-button { min-height: 38px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .8rem; font-weight: 850; }
.admin-header-button:hover { border-color: var(--teal); background: var(--teal-pale); color: var(--ink-deep); }
.admin-auth-panel { display: grid; width: min(820px, 100%); min-height: 440px; margin: clamp(18px, 6vh, 60px) auto; grid-template-columns: minmax(0, 1fr) minmax(300px, 350px); align-items: center; gap: clamp(30px, 5vw, 56px); padding: clamp(30px, 4.5vw, 52px); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 0 var(--ink); }
.admin-auth-panel > div { min-width: 0; }
.admin-auth-panel h1 { max-width: 9ch; font-size: clamp(2.4rem, 5vw, 3.8rem); }
.admin-auth-panel .lead { margin-bottom: 0; }
.admin-auth-form { align-content: start; padding: 22px; border-radius: 12px; background: var(--teal-pale); }
#adminLoading { min-height: 280px; grid-template-columns: 1fr; justify-items: center; text-align: center; }
#adminLoading h1 { max-width: 15ch; }
.admin-shell {
  display: grid;
  width: min(1420px, 100%);
  min-height: calc(100vh - 126px);
  margin-inline: auto;
  grid-template-columns: 250px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--line) 85%, transparent);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 45px color-mix(in oklch, var(--ink) 12%, transparent);
}
.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--surface);
}
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand-mark { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--gold); color: var(--ink-deep); font-size: .78rem; font-weight: 950; letter-spacing: -.02em; }
.admin-brand > div { min-width: 0; }
.admin-brand .intro { margin-bottom: 3px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-sidebar h2 { color: var(--surface); font-size: 1.15rem; line-height: 1.25; }
.admin-sidebar .intro { color: var(--gold); }
.admin-nav { display: grid; gap: 8px; }
.admin-nav button { display: flex; min-height: 48px; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: oklch(88% 0.02 190); font-weight: 850; text-align: left; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.admin-nav-icon { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: color-mix(in oklch, var(--surface) 9%, transparent); font-size: .95rem; }
.admin-nav button:hover { border-color: color-mix(in oklch, var(--surface) 14%, transparent); background: color-mix(in oklch, var(--surface) 7%, transparent); color: var(--surface); }
.admin-nav button[data-active="true"] { border-color: color-mix(in oklch, var(--teal) 52%, transparent); background: color-mix(in oklch, var(--teal) 30%, transparent); color: var(--surface); }
.admin-nav button[data-active="true"] .admin-nav-icon { background: var(--teal); color: var(--ink-deep); }
.admin-sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid color-mix(in oklch, var(--surface) 15%, transparent); }
.admin-sidebar-footer p { margin: 0 0 12px; color: oklch(79% 0.02 190); font-size: .78rem; line-height: 1.5; }
.admin-participant-link { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; color: var(--gold); font-size: .84rem; font-weight: 900; text-underline-offset: 4px; }
.admin-participant-link:hover { color: var(--surface); }
.admin-content { min-width: 0; padding: clamp(25px, 4vw, 48px); background: color-mix(in oklch, var(--canvas) 38%, var(--surface)); }
.admin-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.admin-page-heading h1 { font-size: clamp(2rem, 3.4vw, 3rem); }
.admin-page-heading .lead { margin-top: 10px; font-size: .98rem; }
.admin-create-button { min-height: 46px; white-space: nowrap; }
.admin-create-button span { font-size: 1.3rem; line-height: 0; }
.admin-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 34px; }
.admin-summary article { position: relative; min-width: 0; overflow: hidden; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-summary article::after { position: absolute; top: -32px; right: -25px; width: 88px; height: 88px; border-radius: 50%; background: color-mix(in oklch, var(--teal-pale) 72%, transparent); content: ""; }
.admin-summary span, .admin-summary small, .admin-summary strong { position: relative; z-index: 1; display: block; }
.admin-summary span { color: var(--muted); font-size: .76rem; font-weight: 850; }
.admin-summary strong { margin-top: 8px; color: var(--ink); font-size: 2rem; line-height: 1; }
.admin-summary small { margin-top: 6px; color: var(--muted); font-size: .72rem; }
.admin-list-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.admin-list-heading h2, .admin-list-heading p { margin: 0; }
.admin-list-heading h2 { font-size: 1.35rem; }
.admin-list-heading p { margin-top: 5px; color: var(--muted); font-size: .85rem; }
.admin-list-heading > span { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; background: var(--teal-pale); color: var(--teal-dark); font-size: .75rem; font-weight: 900; }
.quiz-admin-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.results-admin-list { display: grid; gap: 10px; }
.quiz-admin-row { display: flex; min-width: 0; min-height: 210px; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 12px color-mix(in oklch, var(--ink) 5%, transparent); transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.quiz-admin-row:hover { border-color: color-mix(in oklch, var(--teal) 65%, var(--line)); transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in oklch, var(--ink) 9%, transparent); }
.quiz-admin-info { min-width: 0; }
.quiz-admin-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.quiz-status { display: inline-flex; min-height: 28px; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: var(--gold-pale); color: var(--ink-deep); font-size: .7rem; font-weight: 900; text-transform: capitalize; }
.quiz-status::before { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); content: ""; }
.quiz-status[data-status="published"] { background: var(--green-pale); color: var(--green); }
.quiz-status[data-status="published"]::before { background: var(--green); }
.quiz-question-count { color: var(--muted); font-size: .76rem; font-weight: 800; }
.quiz-admin-row h3, .quiz-admin-row p { margin: 0; }
.quiz-admin-row h3 { font-size: 1.2rem; line-height: 1.3; }
.quiz-admin-row p { margin-top: 8px; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.quiz-admin-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) 44px; gap: 8px; margin-top: auto; padding-top: 20px; }
.quiz-admin-actions .primary, .quiz-admin-actions .secondary { min-height: 44px; padding: 9px 12px; }
.quiz-delete-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid color-mix(in oklch, var(--orange) 25%, var(--line)); border-radius: 50%; background: var(--surface); color: oklch(45% 0.16 35); font-size: 0; transition: border-color 160ms ease, background-color 160ms ease; }
.quiz-delete-button::before { content: "×"; font-size: 1.25rem; font-weight: 900; }
.quiz-delete-button:hover { border-color: var(--orange); background: var(--red-pale); }
.result-admin-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.danger-text { color: oklch(45% 0.16 35); }
.admin-empty { grid-column: 1 / -1; padding: 56px 18px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); text-align: center; }
.admin-empty strong { color: var(--ink); font-size: 1.1rem; }
.quiz-editor-form { display: grid; gap: 26px; }
.quiz-editor-form > .quiz-meta-fields { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.quiz-meta-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.field select, .field textarea { width: 100%; padding: 11px 13px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); outline: 0; resize: vertical; }
.field select { min-height: 50px; }
.field select:hover, .field textarea:hover { border-color: color-mix(in oklch, var(--teal) 60%, var(--line)); }
.field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in oklch, var(--teal) 18%, transparent); }
.question-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.question-editor-heading p { margin: 6px 0 0; color: var(--muted); }
.question-editor-list { display: grid; gap: 18px; }
.question-editor-item { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 12px color-mix(in oklch, var(--ink) 4%, transparent); }
.question-editor-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.question-editor-title strong { color: var(--ink); font-size: 1.05rem; }
.option-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.editor-actions { position: sticky; z-index: 3; bottom: 12px; display: flex; flex-wrap: wrap; gap: 9px; width: fit-content; padding: 9px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in oklch, var(--surface) 92%, transparent); box-shadow: 0 8px 24px color-mix(in oklch, var(--ink) 12%, transparent); backdrop-filter: blur(12px); }
.save-state { color: var(--teal-dark); font-weight: 850; }
.result-admin-row > div { display: grid; gap: 4px; }
.result-admin-row span { color: var(--muted); font-size: .84rem; }
.result-admin-row b { color: var(--teal-dark); text-transform: capitalize; }
.result-admin-row > div:last-child { display: flex; align-items: center; gap: 12px; }
.result-detail { margin-top: 30px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); scroll-margin-top: 90px; }
.result-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.result-detail-heading h2, .result-detail-heading p { margin: 0; }
.result-detail-heading p { margin-top: 5px; color: var(--muted); }
.stored-result-list { overflow: hidden; border-radius: 12px; background: var(--canvas); }
.admin-secondary-action { margin-top: 9px; }

@media (max-width: 850px) {
  .home-screen, .question-layout { grid-template-columns: 1fr; }
  .home-visual { min-height: 380px; }
  .home-actions { min-height: 470px; }
  .question-photo { min-height: 260px; max-height: 330px; }
  .question-layout { min-height: auto; }
  .lobby-layout { grid-template-columns: 1fr; }
  .host-controls { border-top: 1px solid var(--line); }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .admin-nav { display: flex; }
  .admin-sidebar-footer { margin-top: 0; padding-top: 0; border-top: 0; }
  .admin-sidebar-footer p { display: none; }
  .admin-participant-link { padding-inline: 10px; }
}

@media (max-width: 620px) {
  main { padding: 12px; }
  .network-banner { top: 62px; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .network-banner > div { display: grid; gap: 2px; }
  .connection-status { width: 12px; height: 12px; padding: 0; overflow: hidden; background: transparent; color: transparent; }
  .connection-status span { flex: 0 0 auto; }
  .room-board { align-items: flex-start; flex-direction: column; }
  .room-code { align-items: flex-start; flex-direction: column; gap: 5px; }
  .room-code span { font-size: clamp(2.5rem, 16vw, 4.5rem); }
  .room-entry-options { width: 100%; max-width: none; align-items: center; justify-content: flex-start; }
  .room-qr { width: 104px; height: 104px; }
  .join-address { max-width: calc(100% - 120px); justify-items: start; text-align: left; }
  .join-address strong { max-width: 82vw; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .quiz-topline { gap: 10px; padding-inline: 14px; }
  .score-wrap { margin-left: auto; }
  .question-content { padding: 23px 16px; }
  .question-content h2 { font-size: 1.7rem; }
  .answer-button { grid-template-columns: 39px minmax(0, 1fr) auto; }
  .result-screen { padding-inline: 13px; }
  .podium { gap: 5px; }
  .podium-item { width: 32%; padding-inline: 6px; }
  .leaderboard-head, .leaderboard-row { grid-template-columns: 51px minmax(0, 1fr) 68px; gap: 7px; padding-inline: 10px; }
  .leaderboard-head span:nth-child(3), .leaderboard-stat { display: none; }
  .round-heading { align-items: center; }
  .next-countdown { width: 82px; height: 82px; }
  .next-countdown strong { font-size: 1.8rem; }
  .round-leaderboard-list .leaderboard-row { grid-template-columns: 48px minmax(0, 1fr) 88px; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .admin-main { padding: 12px; }
  .admin-auth-panel { min-height: 0; margin-block: 12px 20px; grid-template-columns: 1fr; align-content: center; gap: 24px; padding: 28px 18px; }
  .admin-auth-panel h1 { max-width: 12ch; font-size: 2.65rem; }
  .admin-auth-panel .lead { margin-bottom: 4px; }
  .admin-auth-form { padding: 18px 14px; }
  .admin-sidebar { align-items: flex-start; flex-direction: column; }
  .admin-nav { width: 100%; }
  .admin-nav button { flex: 1; text-align: center; }
  .admin-nav button { justify-content: center; }
  .admin-sidebar-footer { width: 100%; padding-top: 15px; border-top: 1px solid color-mix(in oklch, var(--surface) 15%, transparent); }
  .admin-content { padding: 23px 14px; }
  .admin-page-heading, .question-editor-heading { align-items: stretch; flex-direction: column; }
  .admin-create-button { width: 100%; }
  .admin-summary { gap: 7px; margin-bottom: 28px; }
  .admin-summary article { padding: 13px 11px; }
  .admin-summary strong { font-size: 1.65rem; }
  .admin-summary small { display: none; }
  .admin-list-heading { align-items: flex-start; }
  .quiz-admin-list { grid-template-columns: 1fr; }
  .quiz-admin-row { min-height: 0; }
  .quiz-meta-fields, .option-editor-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .question-editor-item { padding: 17px 12px; }
}

@media (max-width: 440px) {
  .room-entry-options { align-items: flex-start; flex-direction: column; }
  .join-address { max-width: 100%; }
  .round-heading { align-items: flex-start; }
  .next-countdown { width: 72px; height: 72px; }
  .admin-summary { grid-template-columns: 1fr; }
  .admin-summary article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .admin-summary strong { margin-top: 0; }
  .admin-list-heading { flex-direction: column; }
  .quiz-admin-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 44px; }
}

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