:root {
  --bg: #07112d;
  --bg-deep: #03091c;
  --surface: rgba(14, 28, 72, 0.88);
  --surface-2: rgba(21, 40, 96, 0.84);
  --line: rgba(164, 188, 255, 0.18);
  --line-strong: rgba(164, 188, 255, 0.32);
  --text: #f7f8ff;
  --muted: #aeb9d8;
  --gold: #f3c84b;
  --gold-deep: #d89f13;
  --blue: #3378ff;
  --blue-light: #6ea0ff;
  --green: #54d49b;
  --red: #ff7d89;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 2%, rgba(42, 98, 228, 0.34), transparent 30rem),
    radial-gradient(circle at 92% 18%, rgba(113, 56, 202, 0.22), transparent 28rem),
    linear-gradient(145deg, var(--bg), var(--bg-deep) 68%);
  background-attachment: fixed;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(110, 160, 255, 0.72); outline-offset: 2px; }
[hidden] { display: none !important; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  min-height: 68px; padding: 10px clamp(16px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(4, 11, 31, 0.82); backdrop-filter: blur(18px);
}
.brand-button { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; font-size: 18px; font-weight: 800; cursor: pointer; }
.brand-mark, .login-logo { display: grid; place-items: center; background: linear-gradient(145deg, var(--gold), #f8e184); color: #1d2450; font-weight: 900; letter-spacing: -0.05em; box-shadow: 0 9px 24px rgba(243, 200, 75, 0.18); }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.header-score { display: flex; align-items: baseline; gap: 5px; margin-left: auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); }
.header-score strong { color: var(--green); font-size: 18px; }
.header-score span { color: var(--muted); }
.header-nav { display: flex; gap: 4px; }
.header-nav button { border: 0; background: transparent; padding: 9px 10px; color: var(--muted); border-radius: 9px; cursor: pointer; }
.header-nav button:hover { color: var(--text); background: rgba(255,255,255,.06); }

main { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.screen { min-height: calc(100vh - 68px); padding: clamp(30px, 6vw, 72px) 0 80px; }
.centered-screen { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.site-header:not([hidden]) + main .centered-screen { min-height: calc(100vh - 68px); }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 62px); line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: 6px; font-size: 21px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 9px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.muted, .field-help { color: var(--muted); line-height: 1.55; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading .muted { max-width: 660px; margin-bottom: 0; }

.primary-button, .secondary-button, .ghost-button, .danger-button, .upload-button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 11px 18px;
  border-radius: 12px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .16s ease, filter .16s ease, border-color .16s ease, background .16s ease;
}
.primary-button { border: 1px solid #4d88ff; background: linear-gradient(180deg, #3d7fff, #245cd8); box-shadow: 0 10px 28px rgba(30, 90, 220, .28); }
.secondary-button, .upload-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.06); }
.ghost-button { border: 1px solid transparent; background: transparent; color: var(--muted); }
.danger-button { border: 1px solid rgba(255,125,137,.4); background: rgba(255,125,137,.13); color: #ffd6da; }
.primary-button:hover, .secondary-button:hover, .ghost-button:hover, .danger-button:hover, .upload-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .6; transform: none; }
.full-width { width: 100%; }
.text-button { padding: 5px 0; border: 0; background: none; color: var(--blue-light); cursor: pointer; font-weight: 700; }
.link-button { width: 100%; }

.loader { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
#loadingScreen p { margin: 18px 0 0; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translateX(-50%); max-width: min(520px, calc(100% - 30px)); padding: 12px 17px; border: 1px solid var(--line-strong); border-radius: 999px; background: #111d43; box-shadow: var(--shadow); text-align: center; }

.login-card, .error-card, .complete-card { width: min(460px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(20,39,91,.96), rgba(8,18,50,.98)); box-shadow: var(--shadow); }
.login-card { text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 18px; font-size: 24px; }
.login-card h1 { font-size: 44px; }
.stack-form { display: grid; gap: 16px; margin-top: 24px; text-align: left; }
label > span, .stack-form label > span { display: block; margin-bottom: 7px; color: #dce4ff; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 47px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); background: rgba(2,8,27,.55); }
input::placeholder { color: #7f8bab; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9eb0de 50%), linear-gradient(135deg, #9eb0de 50%, transparent 50%); background-position: calc(100% - 16px) 20px, calc(100% - 11px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }
.form-error { margin: 0; padding: 11px 13px; border: 1px solid rgba(255,125,137,.32); border-radius: 10px; color: #ffd2d7; background: rgba(255,125,137,.1); }
.setup-warning { margin: 18px 0 0; color: var(--gold); font-size: 13px; }

.setup-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(9,21,57,.78); box-shadow: var(--shadow); }
.setup-section { display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 20px; padding: 28px; border-bottom: 1px solid var(--line); }
.section-number { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); font-weight: 900; background: rgba(255,255,255,.04); }
.section-heading { margin-bottom: 18px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.mode-grid, .answer-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.answer-mode-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.focus-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.choice-card { position: relative; display: block; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card > span { display: flex; flex-direction: column; min-height: 116px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); transition: .16s ease; }
.choice-card.compact > span { min-height: 94px; }
.choice-card strong { margin-bottom: 6px; }
.choice-card small { color: var(--muted); line-height: 1.4; }
.choice-card input:checked + span { border-color: rgba(88,139,255,.8); background: linear-gradient(145deg, rgba(50,111,244,.22), rgba(255,255,255,.045)); box-shadow: inset 0 0 0 1px rgba(88,139,255,.24); }
.choice-card input:focus-visible + span { outline: 3px solid rgba(110,160,255,.72); outline-offset: 2px; }
.subject-area { margin-top: 18px; }
.search-control { position: relative; }
.search-control input { padding-right: 46px; font-size: 17px; }
.search-control > span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 23px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); color: #cad5f5; cursor: pointer; }
.chip:hover { border-color: var(--blue-light); }
.suggestions-panel { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(2,8,27,.65); }
.suggestions-panel > p { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.suggestion { display: flex; justify-content: space-between; gap: 14px; width: 100%; padding: 10px; border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer; }
.suggestion:hover { background: rgba(255,255,255,.06); }
.suggestion small { color: var(--muted); }
.field-help { display: block; margin-top: 9px; font-size: 12px; }
.filter-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.start-button { width: calc(100% - 56px); margin: 25px 28px 28px; min-height: 54px; font-size: 17px; }
.setup-card > .form-error { margin: 24px 28px 0; }

.metric-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { min-height: 136px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(25,47,107,.78), rgba(10,23,61,.9)); }
.metric-card > span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { display: block; margin: 13px 0 8px; font-size: 28px; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); line-height: 1.35; }
.insight-strip { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 3px; }
.insight-strip span { flex: 0 0 auto; padding: 10px 13px; border: 1px solid rgba(243,200,75,.25); border-radius: 999px; color: #f7e6ad; background: rgba(243,200,75,.08); font-size: 13px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(10,23,61,.78); box-shadow: 0 18px 50px rgba(0,0,0,.16); }
.panel.wide { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.panel-heading span { color: var(--muted); font-size: 13px; }
.activity-chart { display: grid; grid-template-columns: repeat(35,1fr); align-items: end; gap: 4px; height: 190px; padding-top: 15px; }
.activity-day { display: grid; grid-template-rows: 1fr 18px; align-items: end; height: 100%; min-width: 0; }
.activity-day i { display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--gold), #d9831e); }
.activity-day span { overflow: hidden; color: #7885a8; font-size: 9px; text-align: center; }
.stat-bars, .rank-list { display: grid; gap: 11px; }
.stat-bar > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; }
.stat-bar small { color: var(--muted); }
.bar-track { overflow: hidden; height: 8px; margin-bottom: 5px; border-radius: 999px; background: rgba(255,255,255,.07); }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #397dff, #70a3ff); }
.rank-item { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rank-item:last-child { border-bottom: 0; padding-bottom: 0; }
.rank-item div { min-width: 0; }
.rank-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.rank-item span { color: var(--muted); font-size: 12px; }
.rank-item b { color: var(--gold); }

.board-topline, .clue-topline { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 16px; }
.board-status { display: flex; gap: 8px; }
.board-status span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.board-card { overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(155deg, rgba(20,61,160,.95), rgba(7,25,85,.98)); box-shadow: var(--shadow); }
.board-heading { padding: 30px 24px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.14); }
.board-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px,5vw,54px); letter-spacing: .015em; text-shadow: 0 3px 0 rgba(0,0,0,.28); }
.board-heading p:last-child { margin: 10px 0 0; color: #b8c7ef; }
.value-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 2px; padding: 2px; background: rgba(0,0,0,.26); }
.value-tile { position: relative; min-height: 148px; border: 0; background: linear-gradient(145deg, #1145b5, #082a84); cursor: pointer; text-shadow: 0 3px 0 rgba(0,0,0,.5); transition: .14s ease; }
.value-tile:hover { filter: brightness(1.17); z-index: 1; }
.value-tile strong { display: block; color: var(--gold); font-family: Georgia, serif; font-size: clamp(26px,4vw,48px); }
.value-tile span { display: block; margin-top: 8px; color: #aabce9; font-size: 11px; text-shadow: none; }
.value-tile.non-focus:not(.answered) { filter: saturate(.55) brightness(.72); }
.value-tile.favorite::after { content: "★"; position: absolute; top: 9px; right: 10px; color: var(--gold); text-shadow: none; }
.value-tile.answered { cursor: pointer; background: rgba(3,12,39,.85); }
.value-tile.answered strong { color: transparent; text-shadow: none; }
.value-tile.answered strong::after { content: "✓"; color: var(--green); }
.value-tile.answered.incorrect strong::after { content: "✕"; color: var(--red); }
.board-actions, .complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.shortcut-hint { margin: 13px 0 0; color: #7887aa; font-size: 12px; text-align: center; }

.timer-display { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 999px; }
.timer-display span { color: var(--muted); font-size: 12px; }
.timer-display strong { font-variant-numeric: tabular-nums; }
.timer-display.urgent { border-color: rgba(255,125,137,.65); color: var(--red); animation: pulse .8s infinite alternate; }
@keyframes pulse { to { transform: scale(1.04); } }
.clue-card { overflow: hidden; width: min(980px,100%); margin: 0 auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(150deg, rgba(14,49,143,.98), rgba(6,23,77,.98)); box-shadow: var(--shadow); }
.clue-card-header { display: flex; justify-content: space-between; gap: 20px; padding: 17px 22px; border-bottom: 1px solid rgba(255,255,255,.13); font-weight: 800; }
.clue-card-header span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clue-card-header strong { color: var(--gold); }
.clue-body { display: grid; justify-items: center; min-height: 450px; padding: clamp(28px,6vw,70px); text-align: center; }
.clue-flags { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 32px; }
.daily-double, .focus-badge, .question-id { padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.daily-double { color: #241b00; background: var(--gold); }
.focus-badge { color: #bdeed9; background: rgba(84,212,155,.16); border: 1px solid rgba(84,212,155,.32); }
.question-id { color: #aebde5; border: 1px solid rgba(255,255,255,.13); }
.favorite-button { width: 34px; height: 34px; padding: 0; border: 1px solid rgba(243,200,75,.3); border-radius: 50%; color: var(--gold); background: rgba(243,200,75,.06); cursor: pointer; font-size: 20px; }
.favorite-button.active { background: rgba(243,200,75,.17); }
.clue-text { max-width: 820px; margin: 36px 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px,4vw,44px); line-height: 1.25; text-shadow: 0 3px 0 rgba(0,0,0,.24); }
.reveal-button { min-width: 210px; }
.typed-answer-form { width: min(650px,100%); text-align: left; }
.typed-answer-form > label { display: block; margin-bottom: 8px; font-weight: 800; }
.typed-answer-form > div { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.typed-answer-form input { min-height: 54px; font-size: 18px; }
.typed-answer-form small { display: block; margin-top: 7px; color: #9eadcf; }
.response-box { width: min(720px,100%); margin-top: 5px; padding: 20px; border: 1px solid rgba(243,200,75,.33); border-radius: 15px; background: rgba(243,200,75,.08); }
.response-box > span { color: var(--gold); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.response-box > p { margin: 9px 0 0; font-size: clamp(23px,3vw,34px); font-weight: 800; }
.typed-comparison { margin-top: 15px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); text-align: left; }
.typed-comparison p { margin: 9px 0 5px; }
.typed-comparison small { color: var(--muted); }
.grade { display: inline-block; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.grade.correct { color: #c7f7e2; background: rgba(84,212,155,.16); }
.grade.incorrect { color: #ffd3d7; background: rgba(255,125,137,.15); }
.self-score { margin-top: 22px; }
.self-score > p { margin-bottom: 10px; color: #d8e1fb; }
.score-buttons { display: flex; justify-content: center; gap: 10px; }
.correct-button, .incorrect-button { min-height: 46px; padding: 10px 18px; border-radius: 11px; font-weight: 800; cursor: pointer; }
.correct-button { border: 1px solid rgba(84,212,155,.42); color: #bff2da; background: rgba(84,212,155,.1); }
.incorrect-button { border: 1px solid rgba(255,125,137,.38); color: #ffd0d5; background: rgba(255,125,137,.09); }
.correct-button.selected { background: rgba(84,212,155,.3); box-shadow: inset 0 0 0 2px rgba(84,212,155,.4); }
.incorrect-button.selected { background: rgba(255,125,137,.26); box-shadow: inset 0 0 0 2px rgba(255,125,137,.34); }
.clue-footer { display: flex; justify-content: center; gap: 10px; padding: 18px; border-top: 1px solid rgba(255,255,255,.12); background: rgba(1,8,31,.28); }

.complete-card { text-align: center; }
.completion-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 50%; color: #062917; background: var(--green); font-size: 30px; font-weight: 900; }
.complete-card h1 { font-size: clamp(30px,5vw,48px); }
.complete-score { color: var(--muted); font-size: 19px; }
.target-message { padding: 10px; border: 1px solid rgba(243,200,75,.28); border-radius: 10px; color: #f5dfa0; background: rgba(243,200,75,.07); }
.summary-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 18px; }
.summary-stats article { padding: 21px; border: 1px solid var(--line); border-radius: 16px; background: rgba(10,23,61,.78); }
.summary-stats span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.summary-stats strong { display: block; margin-top: 8px; font-size: 31px; }
.answer-list { display: grid; gap: 8px; }
.answer-row { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.answer-result { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #092318; background: var(--green); font-weight: 900; }
.answer-row.incorrect .answer-result { color: #31080c; background: var(--red); }
.answer-copy { min-width: 0; }
.answer-copy strong, .answer-copy span, .typed-history { display: block; }
.answer-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-copy span, .typed-history { margin-top: 3px; color: var(--muted); font-size: 12px; }
.typed-history { color: #cfdaff; }

.history-list { display: grid; gap: 9px; margin-bottom: 18px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(10,23,61,.7); text-align: left; cursor: pointer; }
.history-item:hover { border-color: var(--line-strong); background: rgba(18,36,85,.78); }
.history-item > div:first-child { min-width: 0; }
.history-item strong, .history-item span { display: block; }
.history-item > div:first-child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.history-score { flex: 0 0 auto; text-align: right; }
.history-score strong { color: var(--gold); font-size: 20px; }
.admin-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.admin-actions { display: grid; gap: 10px; }
.admin-actions small { color: var(--muted); line-height: 1.45; }
.danger-panel { border-color: rgba(255,125,137,.26); }
.danger-panel p { color: var(--muted); line-height: 1.5; }
.danger-panel .danger-button { width: 100%; margin-top: 12px; }
.empty-state { margin: 0; padding: 14px; color: var(--muted); text-align: center; }
.error-card { text-align: center; }
.error-card h1 { font-size: 34px; }

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(3,1fr); }
  .filter-grid { grid-template-columns: repeat(3,1fr); }
  .mode-grid, .focus-grid { grid-template-columns: repeat(2,1fr); }
  .value-tile { min-height: 125px; }
}
@media (max-width: 720px) {
  main { width: min(100% - 20px, 1240px); }
  .site-header { padding: 9px 11px; gap: 9px; }
  .brand-button > span:last-child { display: none; }
  .header-score { margin-left: 0; }
  .header-nav { margin-left: auto; overflow-x: auto; }
  .header-nav button { padding: 8px 7px; font-size: 12px; }
  .screen { padding-top: 28px; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading h1 { font-size: 42px; }
  .setup-section { grid-template-columns: 1fr; padding: 20px; }
  .section-number { display: none; }
  .mode-grid, .answer-mode-grid, .focus-grid, .filter-grid, .metric-grid, .dashboard-grid, .admin-grid { grid-template-columns: 1fr; }
  .choice-card > span { min-height: auto; }
  .start-button { width: calc(100% - 40px); margin: 20px; }
  .setup-card > .form-error { margin: 20px 20px 0; }
  .metric-card { min-height: 112px; }
  .panel.wide { grid-column: auto; }
  .activity-chart { gap: 2px; height: 150px; }
  .activity-day span { display: none; }
  .board-topline, .clue-topline { align-items: flex-start; }
  .board-status { flex-direction: column; align-items: end; }
  .value-grid { grid-template-columns: 1fr; }
  .value-tile { min-height: 92px; }
  .value-tile strong { font-size: 35px; }
  .board-actions, .complete-actions { display: grid; }
  .clue-body { min-height: 400px; padding: 28px 18px; }
  .clue-text { margin: 28px 0; font-size: 29px; }
  .typed-answer-form > div { grid-template-columns: 1fr; }
  .score-buttons, .clue-footer { flex-direction: column; width: 100%; }
  .score-buttons button, .clue-footer button { width: 100%; }
  .summary-stats { grid-template-columns: repeat(2,1fr); }
  .history-item { align-items: flex-start; }
}

/* Quizzo invitation management */
.generated-credentials { margin-top: 1rem; padding: 1rem; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; background: rgba(255,255,255,.05); }
.generated-credentials > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; margin: .75rem 0; }
.generated-credentials label { display:flex; flex-direction:column; gap:.35rem; }
.generated-credentials code { padding:.75rem; border-radius:10px; background:rgba(0,0,0,.28); overflow-wrap:anywhere; user-select:all; }
.user-list { display:grid; gap:.5rem; margin-top:1rem; }
.user-row { display:flex; justify-content:space-between; gap:1rem; align-items:center; padding:.75rem 0; border-top:1px solid rgba(255,255,255,.1); }
.user-row div { display:flex; flex-direction:column; gap:.15rem; }
.user-row span,.user-row small { opacity:.72; }
@media (max-width: 650px) { .generated-credentials > div { grid-template-columns:1fr; } }

/* Quizzo v4 user creation and clue metadata */
.generated-actions { display:flex; flex-wrap:wrap; gap:.65rem; align-items:center; }
.generated-credentials input:disabled { opacity:.78; cursor:not-allowed; }
.generated-credentials button:disabled { opacity:.5; cursor:not-allowed; }
.question-id { white-space:normal; line-height:1.35; }

/* Quizzo v5: full boards, account controls, preferences, and responsive polish */
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

.busy-bar { position: fixed; inset: 0 0 auto; z-index: 200; height: 3px; overflow: hidden; background: rgba(255,255,255,.08); }
.busy-bar span { display: block; width: 38%; height: 100%; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: busy-slide .9s ease-in-out infinite; }
@keyframes busy-slide { from { transform: translateX(-110%); } to { transform: translateX(370%); } }

.full-board-card { overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(155deg, rgba(20,61,160,.98), rgba(7,25,85,.99)); box-shadow: var(--shadow); }
.full-board-heading { padding: 20px 24px 14px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.14); }
.full-board-heading h1 { margin: 0; color: #fff; font-size: clamp(26px,4vw,46px); }
.full-board-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding: 3px; background: rgba(0,0,0,.28); scrollbar-color: var(--gold) rgba(0,0,0,.25); }
.full-board-grid { display: grid; grid-template-columns: repeat(6, minmax(132px, 1fr)); min-width: 880px; gap: 3px; }
.full-category-header { display: grid; place-items: center; min-height: 112px; padding: 12px 9px; color: #fff; background: linear-gradient(145deg,#103eaa,#082676); font-family: Georgia,"Times New Roman",serif; font-size: clamp(15px,1.7vw,23px); font-weight: 800; line-height: 1.1; text-align: center; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0,0,0,.38); overflow-wrap: anywhere; }
.full-value-tile { position: relative; min-height: 96px; border: 0; color: var(--gold); background: linear-gradient(145deg,#1145b5,#082a84); cursor: pointer; transition: filter .14s ease, transform .14s ease; }
.full-value-tile:hover { filter: brightness(1.18); transform: translateY(-1px); z-index: 1; }
.full-value-tile strong { font-family: Georgia,serif; font-size: clamp(24px,3vw,39px); text-shadow: 0 3px 0 rgba(0,0,0,.55); }
.full-value-tile.favorite::after { content: "★"; position: absolute; top: 7px; right: 8px; color: var(--gold); font-size: 13px; }
.full-value-tile.answered { background: rgba(3,12,39,.92); }
.full-value-tile.answered strong { color: transparent; text-shadow: none; }
.full-value-tile.answered strong::after { content: "✓"; color: var(--green); }
.full-value-tile.answered.incorrect strong::after { content: "✕"; color: var(--red); }

html[data-clue-size="large"] .clue-text { font-size: clamp(31px,5vw,52px); max-width: 900px; }
html[data-clue-size="xlarge"] .clue-text { font-size: clamp(37px,6vw,62px); max-width: 960px; line-height: 1.18; }

.preference-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.owner-user-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 16px 0; }
.owner-user-metrics .metric-card { min-height: 105px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 15px 0; border-top: 1px solid var(--line); }
.user-row.disabled { opacity: .68; }
.user-copy { display: grid !important; gap: 3px !important; min-width: 0; }
.user-copy strong { font-size: 16px; }
.user-copy span,.user-copy small { color: var(--muted); opacity: 1; }
.user-actions { display: flex !important; flex-direction: row !important; flex-wrap: wrap; justify-content: flex-end; gap: 7px !important; flex: 0 0 auto; }
.compact-button { min-height: 38px; padding: 8px 11px; font-size: 12px; }
.system-info { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.system-info > div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.system-info span { color: var(--muted); }
.system-info strong { text-align: right; overflow-wrap: anywhere; }

.shortcuts-dialog { width: min(560px,calc(100% - 28px)); padding: 24px; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--text); background: #0c1940; box-shadow: var(--shadow); }
.shortcuts-dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-size: 28px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.shortcut-grid span { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
kbd { min-width: 42px; padding: 5px 7px; border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 7px; color: var(--text); background: rgba(255,255,255,.07); font: 700 12px ui-monospace,SFMono-Regular,Menlo,monospace; text-align: center; }

html[data-theme="light"] {
  --bg: #eef3ff; --bg-deep: #dde6fb; --surface: rgba(255,255,255,.94); --surface-2: rgba(244,247,255,.96);
  --line: rgba(26,54,112,.15); --line-strong: rgba(26,54,112,.28); --text: #101a34; --muted: #58647d;
  --shadow: 0 24px 70px rgba(35,55,95,.18);
}
html[data-theme="light"] body { background: radial-gradient(circle at 16% 2%,rgba(87,133,238,.2),transparent 30rem),linear-gradient(145deg,var(--bg),var(--bg-deep) 68%); }
html[data-theme="light"] .site-header { background: rgba(250,252,255,.9); }
html[data-theme="light"] .setup-card, html[data-theme="light"] .panel, html[data-theme="light"] .metric-card, html[data-theme="light"] .summary-stats article, html[data-theme="light"] .history-item { background: rgba(255,255,255,.8); }
html[data-theme="light"] .login-card, html[data-theme="light"] .error-card, html[data-theme="light"] .complete-card { background: linear-gradient(145deg,rgba(255,255,255,.98),rgba(237,242,255,.98)); }
html[data-theme="light"] input, html[data-theme="light"] select { color: var(--text); background-color: rgba(255,255,255,.88); }
html[data-theme="light"] label > span, html[data-theme="light"] .stack-form label > span { color: #243354; }
html[data-theme="light"] .chip { color: #293d6b; background: rgba(255,255,255,.65); }
html[data-theme="light"] .suggestions-panel { background: rgba(255,255,255,.94); }
html[data-theme="light"] .suggestion:hover { background: rgba(40,76,155,.07); }
html[data-theme="light"] .toast { color: #fff; background: #17264b; }
html[data-theme="light"] .shortcuts-dialog { background: #f8faff; }
html[data-theme="light"] .generated-credentials code { color: #fff; background: #19284d; }

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    color-scheme: light;
    --bg: #eef3ff; --bg-deep: #dde6fb; --surface: rgba(255,255,255,.94); --surface-2: rgba(244,247,255,.96);
    --line: rgba(26,54,112,.15); --line-strong: rgba(26,54,112,.28); --text: #101a34; --muted: #58647d;
    --shadow: 0 24px 70px rgba(35,55,95,.18);
  }
  html[data-theme="system"] body { background: radial-gradient(circle at 16% 2%,rgba(87,133,238,.2),transparent 30rem),linear-gradient(145deg,var(--bg),var(--bg-deep) 68%); }
  html[data-theme="system"] .site-header { background: rgba(250,252,255,.9); }
  html[data-theme="system"] .setup-card, html[data-theme="system"] .panel, html[data-theme="system"] .metric-card, html[data-theme="system"] .summary-stats article, html[data-theme="system"] .history-item { background: rgba(255,255,255,.8); }
  html[data-theme="system"] .login-card, html[data-theme="system"] .error-card, html[data-theme="system"] .complete-card { background: linear-gradient(145deg,rgba(255,255,255,.98),rgba(237,242,255,.98)); }
  html[data-theme="system"] input, html[data-theme="system"] select { color: var(--text); background-color: rgba(255,255,255,.88); }
  html[data-theme="system"] label > span, html[data-theme="system"] .stack-form label > span { color: #243354; }
  html[data-theme="system"] .chip { color: #293d6b; background: rgba(255,255,255,.65); }
  html[data-theme="system"] .suggestions-panel { background: rgba(255,255,255,.94); }
  html[data-theme="system"] .shortcuts-dialog { background: #f8faff; }
}

@media (max-width: 820px) {
  .full-board-grid { min-width: 760px; grid-template-columns: repeat(6,126px); }
  .full-category-header { min-height: 96px; font-size: 15px; }
  .full-value-tile { min-height: 82px; }
  .owner-user-metrics,.preference-grid,.system-info { grid-template-columns: 1fr; }
  .user-row { align-items: flex-start; flex-direction: column; }
  .user-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .site-header { flex-wrap: wrap; }
  .header-nav { width: 100%; order: 3; justify-content: space-between; }
  .header-nav button { flex: 1 1 auto; }
  .full-board-scroll { margin-inline: -1px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .shortcut-hint { display: none; }
  .user-actions { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .user-actions .danger-button { grid-column: 1 / -1; }
}


/* Quizzo v6: simplified navigation and Admin dashboard actions */
.page-heading-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
@media (max-width: 720px) { .page-heading-actions { width:100%; justify-content:flex-start; } }
@media (max-width: 520px) { .page-heading-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } }


/* Quizzo v7: Coryat coaching, no-buzz scoring, and one-screen mobile play */
.mobile-help { display: none; }
.coryat-card { margin-bottom: 16px; padding: 22px; border: 1px solid rgba(243,200,75,.34); border-radius: 18px; background: linear-gradient(135deg,rgba(243,200,75,.12),rgba(68,102,204,.1)); cursor: pointer; }
.coryat-card:focus-visible { outline: 3px solid rgba(243,200,75,.55); outline-offset: 3px; }
.coryat-heading { display:flex; justify-content:space-between; gap:18px; align-items:end; }
.coryat-heading > div:first-child span { display:block; color:var(--muted); font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.coryat-heading > div:first-child strong { display:block; margin-top:4px; color:var(--gold); font-size:clamp(34px,5vw,52px); }
.coryat-goal-control { display:flex; align-items:center; gap:10px; cursor:default; }
.coryat-goal-control label { color:var(--muted); font-size:12px; font-weight:800; text-transform:uppercase; }
.coryat-goal-control select { min-width:190px; }
.coryat-progress { height:13px; margin-top:18px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.1); }
.coryat-progress i { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--blue),var(--gold)); transition:width .35s ease; }
.coryat-progress-copy { display:flex; justify-content:space-between; gap:12px; margin-top:8px; color:var(--muted); font-size:12px; }
.coryat-details { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
.coryat-details > div { padding:12px; border-radius:12px; background:rgba(0,0,0,.14); }
.coryat-details span,.coryat-details strong { display:block; }
.coryat-details span { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.coryat-details strong { margin-top:6px; font-size:22px; }
.coryat-details p { grid-column:1/-1; margin:2px 0 0; color:var(--muted); font-size:12px; }
.correct-button, .incorrect-button, .no-buzz-button { min-height:46px; padding:10px 18px; border-radius:11px; font-weight:800; cursor:pointer; }
.no-buzz-button { border:1px solid rgba(118,153,255,.42); color:#d5dfff; background:rgba(118,153,255,.1); }
.no-buzz-button.selected { background:rgba(118,153,255,.28); box-shadow:inset 0 0 0 2px rgba(118,153,255,.36); }
.answer-row.no_buzz .answer-result { color:#071533; background:#8ca8ff; }
.mobile-help-steps { color:var(--text); line-height:1.5; }
.mobile-help-steps p { margin:.75rem 0; }

@media (max-width: 720px), (pointer: coarse) {
  .desktop-help { display:none !important; }
  .mobile-help { display:block; }
}
@media (max-width: 720px) {
  .coryat-heading { align-items:stretch; flex-direction:column; }
  .coryat-goal-control { justify-content:space-between; }
  .coryat-goal-control select { min-width:0; flex:1; }
  .coryat-details { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.clue-active { overflow:hidden; overscroll-behavior:none; }
  body.clue-active main { width:100%; height:calc(100dvh - var(--live-header-height, 58px)); margin:0; overflow:hidden; }
  body.clue-active .clue-screen { box-sizing:border-box; height:100%; min-height:0; padding:5px 10px 7px; display:flex; flex-direction:column; overflow:hidden; }
  body.clue-active .clue-topline { flex:0 0 auto; min-height:30px; }
  body.clue-active .clue-card { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
  body.clue-active .clue-card-header { flex:0 0 auto; padding:8px 12px; }
  body.clue-active .clue-body { flex:1 1 auto; min-height:0; padding:8px 12px; display:flex; flex-direction:column; justify-content:center; overflow:hidden; }
  body.clue-active .clue-flags { flex:0 0 auto; }
  body.clue-active .clue-text { flex:0 1 auto; max-height:34dvh; margin:8px 0; padding:0 2px; overflow:auto; font-size:clamp(20px,6.5vw,29px); line-height:1.15; }
  body.clue-active .response-box { flex:0 1 auto; max-height:24dvh; margin-top:6px; padding:8px 10px; overflow:auto; }
  body.clue-active .response-box p { margin:3px 0; font-size:clamp(18px,5.5vw,25px); }
  body.clue-active .self-score { flex:0 0 auto; width:100%; margin-top:7px; }
  body.clue-active .self-score > p { margin:0 0 5px; }
  body.clue-active .score-buttons { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; width:100%; }
  body.clue-active .score-buttons button { width:100%; min-height:42px; padding:7px 4px; font-size:12px; }
  body.clue-active .clue-footer, body.clue-active > main .shortcut-hint { display:none !important; }
  body.clue-active .typed-answer-form { width:100%; margin-top:6px; }
  body.clue-active .typed-answer-form > div { display:grid; grid-template-columns:1fr auto; gap:6px; }
  body.clue-active .typed-answer-form small { display:none; }
  body.clue-active .reveal-button { min-height:43px; }
}
@media (max-height: 680px) and (max-width: 720px) {
  body.clue-active .clue-topline { display:none; }
  body.clue-active .clue-card-header { padding:5px 10px; }
  body.clue-active .clue-flags { font-size:10px; }
  body.clue-active .clue-text { max-height:30dvh; margin:5px 0; font-size:clamp(18px,5.6vw,24px); }
  body.clue-active .response-box { max-height:20dvh; }
}


/* Quizzo v8: real champion-level comparisons */
.champion-dashboard-panel { margin-bottom:18px; }
.champion-headline { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.champion-headline > div { padding:15px; border:1px solid var(--line); border-radius:14px; background:rgba(0,0,0,.13); }
.champion-headline span,.champion-headline strong { display:block; }
.champion-headline span { color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; }
.champion-headline strong { margin-top:7px; font-size:clamp(18px,2.5vw,27px); }
.champion-level-counts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; max-height:360px; overflow:auto; }
.champion-count-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:rgba(0,0,0,.1); }
.champion-count-row strong,.champion-count-row span { display:block; }
.champion-count-row span { margin-top:3px; color:var(--muted); font-size:11px; }
.champion-count-row b { flex:0 0 auto; color:var(--gold); }
.summary-champion-card { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:18px; border-color:rgba(243,200,75,.38); background:linear-gradient(135deg,rgba(243,200,75,.12),rgba(68,102,204,.1)); }
.summary-champion-card h2 { margin:.3rem 0; font-size:clamp(27px,4vw,42px); color:var(--gold); }
.champion-session-metrics,.champion-popup-metrics { display:grid; grid-template-columns:repeat(3,minmax(90px,1fr)); gap:9px; }
.champion-session-metrics span,.champion-popup-metrics span { padding:11px; border-radius:11px; background:rgba(0,0,0,.16); color:var(--muted); font-size:11px; text-align:center; text-transform:uppercase; }
.champion-session-metrics b,.champion-popup-metrics b { display:block; margin-bottom:4px; color:var(--text); font-size:20px; text-transform:none; }
.champion-popup { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:20px; background:rgba(1,5,18,.78); backdrop-filter:blur(8px); }
.champion-popup[hidden] { display:none; }
.champion-popup-card { position:relative; width:min(520px,100%); padding:34px; border:1px solid rgba(243,200,75,.45); border-radius:22px; background:linear-gradient(145deg,rgba(22,42,96,.99),rgba(6,15,43,.99)); box-shadow:0 30px 100px rgba(0,0,0,.55); text-align:center; }
.champion-popup-card h2 { margin:8px 0; color:var(--gold); font-size:clamp(32px,7vw,54px); }
.champion-popup-card > p:not(.eyebrow) { color:var(--muted); line-height:1.5; }
.champion-popup-metrics { margin:22px 0; }
.champion-popup-close { position:absolute; top:10px; right:12px; width:38px; height:38px; border:0; color:var(--muted); background:transparent; font-size:28px; cursor:pointer; }
.coryat-details { grid-template-columns:repeat(6,minmax(0,1fr)); }
@media (max-width:900px) { .coryat-details { grid-template-columns:repeat(3,minmax(0,1fr)); } .champion-level-counts { grid-template-columns:1fr; } }
@media (max-width:720px) { .champion-headline { grid-template-columns:1fr; } .summary-champion-card { align-items:stretch; flex-direction:column; } .champion-session-metrics,.champion-popup-metrics { grid-template-columns:repeat(3,1fr); } .coryat-details { grid-template-columns:repeat(2,minmax(0,1fr)); } }


/* Quizzo v9: spacious performance goal card and desktop/mobile scoring parity */
.coryat-heading {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 390px);
  align-items: center;
  gap: clamp(24px, 4vw, 52px);
}
.coryat-heading > div:first-child { min-width: 0; }
.coryat-goal-control {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, .13);
}
.coryat-goal-control label { margin: 0; }
.coryat-goal-control select { width: 100%; min-width: 0; }
@media (max-width: 960px) {
  .coryat-heading { grid-template-columns: 1fr; gap: 18px; align-items: stretch; }
}
