:root {
  color-scheme: dark;
  --bg: #050b16;
  --bg-deep: #02050b;
  --panel: rgba(10, 24, 45, .82);
  --panel-solid: #0b1a30;
  --line: rgba(146, 178, 225, .18);
  --line-strong: rgba(146, 178, 225, .32);
  --text: #f2f7ff;
  --muted: #9fb0c8;
  --cyan: #59ddff;
  --blue: #6a8cff;
  --violet: #9b7cff;
  --gold: #ffc966;
  --green: #55dda5;
  --red: #ff7087;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  --radius: 20px;
  --font: "Inter", system-ui, sans-serif;
  --display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; }
html { min-width: 300px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 15% 5%, rgba(52, 95, 177, .23), transparent 30%), radial-gradient(circle at 85% 35%, rgba(124, 62, 182, .14), transparent 28%), linear-gradient(180deg, transparent, var(--bg-deep)); z-index: -2; }
.starfield { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .65; background-image: radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.5px), radial-gradient(circle, rgba(105,220,255,.55) 0 1px, transparent 1.5px); background-position: 0 0, 32px 47px; background-size: 83px 83px, 127px 127px; mask-image: linear-gradient(to bottom, #000, transparent 85%); }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(89, 221, 255, .42); outline-offset: 3px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .75rem 1rem; border-radius: 8px; background: #fff; color: #000; transition: top .2s; }
.skip-link:focus { top: 1rem; }

.topbar { width: min(1440px, calc(100% - 40px)); height: 82px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .8rem; text-decoration: none; }
.brand__mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(89,221,255,.4); border-radius: 12px; color: var(--cyan); background: rgba(47,149,200,.12); box-shadow: 0 0 30px rgba(89,221,255,.16); }
.brand span:last-child { display: grid; line-height: 1.25; }
.brand strong { font: 700 1rem var(--display); letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: .73rem; }
.topbar nav { display: flex; align-items: center; gap: .45rem; }
.topbar nav a { padding: .55rem .8rem; border-radius: 9px; color: var(--muted); font-size: .88rem; text-decoration: none; transition: .2s; }
.topbar nav a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.page-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }

.hero-grid { min-height: calc(100vh - 176px); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .72fr); align-items: center; gap: clamp(40px, 7vw, 100px); }
.eyebrow { margin: 0 0 .55rem; color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; }
.hero-copy h1 { max-width: 760px; margin: 0 0 1.25rem; font-size: clamp(2.55rem, 5.4vw, 5.6rem); letter-spacing: -.045em; }
.hero-copy__lead { max-width: 660px; color: #bdc9db; font-size: clamp(1rem, 1.45vw, 1.22rem); }
.feature-row { display: flex; gap: 32px; margin-top: 34px; }
.feature-row div { display: grid; }
.feature-row strong { color: var(--gold); font: 700 1.8rem var(--display); }
.feature-row span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.orbit-visual { position: relative; width: min(340px, 80%); aspect-ratio: 2 / 1; margin: 55px 0 0 6%; }
.star-core { position: absolute; left: 50%; top: 50%; width: 76px; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffe293 15%, #ff9f43 50%, rgba(255,92,50,.08) 73%); box-shadow: 0 0 22px #ffb85b, 0 0 65px rgba(255,136,61,.7), 0 0 120px rgba(255,91,49,.3); }
.orbit { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(106,140,255,.38); border-radius: 50%; transform: translate(-50%,-50%) rotate(-12deg); }
.orbit--one { width: 240px; height: 105px; animation: orbit-pulse 6s ease-in-out infinite; }
.orbit--two { width: 340px; height: 155px; animation: orbit-pulse 6s 1s ease-in-out infinite reverse; }
.orbit span { position: absolute; top: 50%; left: 0; width: 8px; aspect-ratio: 1; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
@keyframes orbit-pulse { 50% { opacity: .55; transform: translate(-50%,-50%) rotate(-7deg) scale(1.03); } }

.glass-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,37,67,.89), rgba(7,17,33,.91)); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.registration-card, .login-card { padding: clamp(24px, 4vw, 38px); }
.card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.card-heading h1, .card-heading h2 { margin: 0; font-size: 1.6rem; }
.step-badge { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 13px; background: linear-gradient(135deg, rgba(89,221,255,.18), rgba(155,124,255,.16)); color: var(--cyan); font-weight: 800; border: 1px solid rgba(89,221,255,.25); }
form label:not(.consent-row):not(.switch-row):not(.search-box) { display: block; margin: 14px 0 7px; color: #d7e2f3; font-size: .83rem; font-weight: 650; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select { width: 100%; min-height: 46px; padding: 0 13px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(2,8,18,.56); transition: border-color .2s, box-shadow .2s; }
input:hover, select:hover { border-color: rgba(89,221,255,.44); }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(89,221,255,.1); }
input::placeholder { color: #708199; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; margin: 19px 0 5px; color: #b9c6d8; font-size: .84rem; cursor: pointer; }
.consent-row input { margin-top: 3px; accent-color: var(--cyan); }
.privacy-note { margin: 17px 0 0; color: #8497b1; font-size: .72rem; line-height: 1.45; }
.form-error { min-height: 1.3rem; margin: 8px 0; color: #ff9baa; font-size: .8rem; }
.button { min-height: 44px; padding: .7rem 1.05rem; border: 1px solid transparent; border-radius: 10px; color: var(--text); font-weight: 750; cursor: pointer; transition: transform .16s, filter .16s, background .16s, border-color .16s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.09); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button--wide { width: 100%; }
.button--primary { background: linear-gradient(135deg, #247ca8, #7359cf); border-color: rgba(124,198,255,.35); }
.button--secondary { background: rgba(111,139,183,.1); border-color: var(--line-strong); }
.button--ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.button--danger { background: rgba(179,53,75,.18); border-color: rgba(255,112,135,.4); color: #ffc5ce; }
.notice { margin: 1rem 0; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(50,87,126,.15); color: #c4d4e8; font-size: .84rem; }
.notice--warning { border-color: rgba(255,201,102,.35); background: rgba(169,112,29,.12); color: #ffe1a8; }

.quiz-layout { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 26px; align-items: start; }
.quiz-sidebar { position: sticky; top: 20px; padding: 22px; }
.timer-card { padding: 17px; border-radius: 14px; background: rgba(1,7,17,.5); border: 1px solid var(--line); }
.timer-card > span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .11em; }
.timer-card strong { display: block; margin: 5px 0 10px; font: 700 2rem var(--display); font-variant-numeric: tabular-nums; }
.timer-card.is-urgent strong { color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .62; } }
.timer-track, .overall-progress { height: 5px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.09); }
.timer-track span, .overall-progress span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width .35s; }
.student-chip { display: flex; align-items: center; gap: 10px; padding: 18px 2px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; background: rgba(89,221,255,.12); color: var(--cyan); font-size: .8rem; font-weight: 800; }
.student-chip > span:last-child { display: grid; min-width: 0; }
.student-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.student-chip small { color: var(--muted); font-size: .7rem; }
.palette-heading, .section-heading, .table-card__heading, .dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.palette-heading h2 { margin: 18px 0 12px; font-size: .9rem; }
.text-button { border: 0; background: none; color: var(--cyan); font-size: .72rem; cursor: pointer; }
.question-palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.question-palette button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: rgba(3,9,19,.56); color: var(--muted); font-weight: 700; cursor: pointer; }
.question-palette button.is-answered { color: #d9fff1; border-color: rgba(85,221,165,.45); background: rgba(85,221,165,.16); }
.question-palette button.is-flagged { color: #fff0bf; border-color: rgba(255,201,102,.55); box-shadow: inset 0 -3px 0 rgba(255,201,102,.45); }
.question-palette button.is-current { color: #06101f; background: var(--cyan); border-color: var(--cyan); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 15px 0 19px; color: var(--muted); font-size: .65rem; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend__dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--line-strong); }
.legend__dot--current { background: var(--cyan); }
.legend__dot--answered { background: var(--green); }
.legend__dot--flagged { background: var(--gold); }
.question-panel { min-height: 660px; padding: clamp(24px, 4vw, 48px); }
.question-topline { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.question-index { color: var(--muted); font-size: .77rem; font-weight: 700; }
.topic-pill { margin-left: 8px; padding: .3rem .55rem; border: 1px solid rgba(155,124,255,.35); border-radius: 999px; color: #cabdff; background: rgba(155,124,255,.1); font-size: .68rem; }
.flag-button { padding: .5rem .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); cursor: pointer; }
.flag-button[aria-pressed="true"] { color: var(--gold); border-color: rgba(255,201,102,.45); background: rgba(255,201,102,.08); }
.overall-progress { margin: 18px 0 45px; }
.overall-progress span { width: 5%; }
.question-content { max-width: 850px; min-height: 420px; }
.question-content h2 { margin: 0 0 28px; font-size: clamp(1.18rem, 2vw, 1.65rem); line-height: 1.48; font-weight: 600; }
.question-content .katex-display { overflow-x: auto; overflow-y: hidden; padding: 8px 0; }
.question-figure { margin: 0 0 25px; }
.mini-hr { display: block; width: min(520px,100%); margin: auto; }
.options-list { display: grid; gap: 11px; padding: 0; margin: 0; border: 0; }
.option { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 12px; align-items: center; min-height: 58px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3,10,21,.45); cursor: pointer; transition: .18s; }
.option:hover { border-color: rgba(89,221,255,.42); background: rgba(44,106,144,.09); }
.option:has(input:checked) { border-color: var(--cyan); background: rgba(42,139,181,.15); box-shadow: 0 0 0 2px rgba(89,221,255,.08); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option__letter { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--muted); font-weight: 800; font-size: .78rem; }
.option:has(input:checked) .option__letter { color: #04101d; background: var(--cyan); border-color: var(--cyan); }
.option__text { color: #d7e2f2; font-size: .94rem; }
.question-actions { display: grid; grid-template-columns: 1fr auto 1fr; gap: 15px; align-items: center; padding-top: 26px; margin-top: 24px; border-top: 1px solid var(--line); }
.question-actions .button:last-child { justify-self: end; }
.save-status { color: var(--muted); font-size: .69rem; text-align: center; }

.dialog-card { width: min(460px, calc(100% - 28px)); padding: 28px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 18px; background: #0b192c; box-shadow: var(--shadow); }
.dialog-card::backdrop { background: rgba(0,4,10,.74); backdrop-filter: blur(6px); }
.dialog-card h2 { margin: 12px 0 8px; }
.dialog-card p { color: var(--muted); }
.dialog-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; color: var(--green); border: 1px solid rgba(85,221,165,.4); background: rgba(85,221,165,.12); font-weight: 800; }
.dialog-icon--danger { color: var(--red); border-color: rgba(255,112,135,.45); background: rgba(255,112,135,.1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.result-shell { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.result-card { width: min(710px, 100%); padding: clamp(28px, 6vw, 60px); text-align: center; }
.result-star { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; color: var(--gold); font-size: 2rem; background: rgba(255,201,102,.08); border: 1px solid rgba(255,201,102,.28); box-shadow: 0 0 45px rgba(255,201,102,.16); }
.result-card h1 { margin: 5px 0; font-size: clamp(2rem, 5vw, 3.5rem); }
.result-message { color: var(--muted); }
.score-display { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin: 24px 0; }
.score-display strong { font: 800 clamp(3rem, 10vw, 6rem) var(--display); color: var(--cyan); }
.score-display span { color: var(--muted); font-size: 1.2rem; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 0 0 28px; }
.result-stats div { display: grid; gap: 3px; padding: 14px 8px; border-radius: 10px; background: rgba(255,255,255,.035); }
.result-stats span { color: var(--muted); font-size: .7rem; }
.result-stats strong { font-size: 1.05rem; }

.leaderboard-shell { max-width: 1100px; }
.leaderboard-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 34px; }
.leaderboard-header h1, .dashboard-heading h1 { margin: 0; font-size: clamp(2.3rem, 5vw, 4.3rem); }
.leaderboard-header p:last-child { color: var(--muted); }
.live-indicator { display: flex; align-items: center; gap: 8px; padding: .55rem .8rem; border: 1px solid rgba(85,221,165,.28); border-radius: 999px; color: #aaf3d3; background: rgba(85,221,165,.08); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.live-indicator span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); animation: pulse 1.6s infinite; }
.podium { min-height: 190px; display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; align-items: end; margin-bottom: 28px; }
.podium-card { position: relative; display: grid; justify-items: center; gap: 5px; padding: 25px 15px 20px; text-align: center; border: 1px solid var(--line); border-radius: 16px; background: rgba(12,28,51,.76); }
.podium-card--1 { min-height: 188px; border-color: rgba(255,201,102,.36); background: linear-gradient(180deg, rgba(255,201,102,.1), rgba(12,28,51,.78)); order: 2; }
.podium-card--2 { min-height: 162px; order: 1; }
.podium-card--3 { min-height: 146px; order: 3; }
.podium-rank { color: var(--gold); font: 800 1.5rem var(--display); }
.podium-name { font-weight: 750; }
.podium-score { color: var(--cyan); font: 700 1.1rem var(--display); }
.table-card { padding: clamp(18px, 3vw, 30px); }
.table-card__heading { margin-bottom: 18px; }
.table-card__heading h2 { margin: 0; }
.table-card__heading p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: .84rem; }
th { color: #8295af; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
td { color: #d8e2f1; }
tbody tr:hover { background: rgba(255,255,255,.024); }
.rank-badge { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.05); font-weight: 800; }
.score-cell { color: var(--cyan); font-weight: 800; }
.empty-state { padding: 35px; color: var(--muted); text-align: center; }

.login-shell { min-height: calc(100vh - 210px); display: grid; place-items: center; }
.login-card { width: min(440px,100%); }
.login-card > p { color: var(--muted); }
.login-card code { color: var(--cyan); }
.admin-shell { max-width: 1440px; }
.dashboard-heading { margin-bottom: 28px; }
.dashboard-heading p { margin: 6px 0 0; }
.heading-actions { display: flex; gap: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; margin-bottom: 22px; }
.metric-card { display: grid; gap: 5px; min-height: 135px; padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(17,37,67,.76), rgba(7,17,33,.82)); }
.metric-card span { color: var(--muted); font-size: .75rem; }
.metric-card strong { align-self: center; color: var(--cyan); font: 700 2.2rem var(--display); }
.metric-card small { color: #7487a0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(330px,.72fr) minmax(400px,1.28fr); gap: 18px; margin-bottom: 18px; }
.settings-panel, .analytics-panel { padding: 25px; }
.section-heading h2 { margin: 0; font-size: 1.25rem; }
.section-heading--spaced { margin-top: 24px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--line); color: #d5e0ef; font-size: .84rem; }
input[role="switch"] { width: 42px; height: 23px; accent-color: var(--cyan); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin: 9px 0 18px; }
.analytics-bars { display: grid; gap: 12px; margin-top: 19px; }
.analytics-bars--scroll { max-height: 210px; overflow-y: auto; padding-right: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(95px, .7fr) minmax(140px, 2fr) 46px; align-items: center; gap: 10px; font-size: .73rem; }
.bar-row__track { height: 8px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.08); }
.bar-row__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--blue),var(--cyan)); }
.attempts-card { margin-bottom: 18px; }
.table-tools { display: flex; gap: 8px; }
.table-tools input { width: 220px; }
.table-tools select { width: 170px; }
.status-pill { display: inline-block; padding: .25rem .48rem; border-radius: 999px; font-size: .65rem; font-weight: 750; text-transform: capitalize; }
.status-pill--completed { color: #aaf3d3; background: rgba(85,221,165,.12); }
.status-pill--active { color: #a9dfff; background: rgba(89,221,255,.12); }
.status-pill--timed-out { color: #ffe0a5; background: rgba(255,201,102,.12); }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); color: var(--muted); cursor: pointer; }
.row-actions { display: flex; gap: 6px; }
.row-button { min-height: 32px; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.035); color: #cbd8e9; cursor: pointer; font-size: .7rem; }
.row-button--danger { color: #ffabb8; border-color: rgba(255,112,135,.25); }
.dialog-card--wide { width: min(900px, calc(100% - 28px)); padding: 0; }
.dialog-scroll { max-height: min(82vh,900px); overflow-y: auto; padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-heading h2 { margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; margin: 22px 0; }
.detail-grid div { padding: 12px; border-radius: 9px; background: rgba(255,255,255,.035); }
.detail-grid span { display: block; color: var(--muted); font-size: .66rem; }
.detail-grid strong { font-size: .85rem; }
.response-list { display: grid; gap: 8px; }
.response-item { display: grid; grid-template-columns: 54px minmax(100px,1fr) minmax(180px,2fr) 80px; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: .72rem; }
.response-item.is-correct { border-left: 3px solid var(--green); }
.response-item.is-incorrect { border-left: 3px solid var(--red); }
.response-item.is-unanswered { border-left: 3px solid #6e7e93; }

.loading-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; align-content: center; gap: 15px; background: rgba(2,6,14,.78); backdrop-filter: blur(7px); }
.loading-overlay p { color: #c5d3e7; }
.spinner { width: 45px; height: 45px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; width: min(380px,calc(100% - 36px)); }
.toast { padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: #10223d; color: #dce7f6; box-shadow: 0 12px 35px rgba(0,0,0,.35); transform: translateY(12px); opacity: 0; transition: .25s; font-size: .82rem; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast--error { border-color: rgba(255,112,135,.42); }
.toast--success { border-color: rgba(85,221,165,.42); }
.noscript { position: fixed; inset: auto 0 0; padding: 1rem; text-align: center; background: #7d2739; color: #fff; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; padding-top: 30px; }
  .orbit-visual { display: none; }
  .registration-card { max-width: 620px; }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .quiz-sidebar .student-chip { grid-column: 2; grid-row: 1; border: 0; padding: 0 8px; }
  .palette-heading, .question-palette, .legend, .quiz-sidebar > .button { grid-column: 1 / -1; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .topbar { width: calc(100% - 24px); height: 68px; }
  .brand small { display: none; }
  .topbar nav a { padding: .45rem; font-size: .75rem; }
  .page-shell { width: calc(100% - 24px); padding: 30px 0 60px; }
  .hero-grid { min-height: auto; gap: 32px; }
  .hero-copy h1 { font-size: 2.6rem; }
  .feature-row { gap: 17px; }
  .feature-row strong { font-size: 1.45rem; }
  .feature-row span { font-size: .62rem; }
  .quiz-sidebar { grid-template-columns: 1fr; padding: 14px; }
  .quiz-sidebar .student-chip { grid-column: auto; grid-row: auto; }
  .palette-heading, .question-palette, .legend, .quiz-sidebar > .button { grid-column: auto; }
  .question-panel { min-height: auto; padding: 20px 16px; }
  .question-topline { align-items: flex-start; }
  .topic-pill { display: block; width: fit-content; margin: 5px 0 0; }
  .flag-button { font-size: .72rem; }
  .overall-progress { margin-bottom: 30px; }
  .question-content { min-height: 390px; }
  .question-actions { grid-template-columns: 1fr 1fr; }
  .save-status { grid-column: 1 / -1; grid-row: 2; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .leaderboard-header { align-items: flex-start; }
  .podium { grid-template-columns: 1fr; align-items: stretch; }
  .podium-card, .podium-card--1, .podium-card--2, .podium-card--3 { min-height: auto; order: initial; grid-template-columns: 45px 1fr auto; align-items: center; justify-items: start; text-align: left; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 115px; padding: 15px; }
  .metric-card strong { font-size: 1.7rem; }
  .dashboard-heading { align-items: flex-start; }
  .heading-actions { flex-direction: column; }
  .table-card__heading { align-items: flex-start; flex-direction: column; }
  .table-tools { width: 100%; flex-direction: column; }
  .table-tools input, .table-tools select { width: 100%; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .response-item { grid-template-columns: 45px 1fr; }
  .response-item span:nth-child(3), .response-item span:nth-child(4) { grid-column: 2; }
}

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

@media (prefers-contrast: more) {
  :root { --line: rgba(220,235,255,.44); --line-strong: rgba(235,245,255,.7); --muted: #c1cee0; }
}

/* Zero-backend GitHub Pages edition */
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.answer-review { margin: 24px 0; text-align: left; }
.review-item { margin: 9px 0; padding: 14px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; background: rgba(255,255,255,.025); }
.review-item.is-correct { border-left-color: var(--green); }
.review-item.is-incorrect { border-left-color: var(--red); }
.review-item p { margin: 5px 0; color: var(--muted); font-size: .82rem; }
.local-badge { padding: .55rem .8rem; border: 1px solid rgba(89,221,255,.3); border-radius: 999px; color: var(--cyan); background: rgba(89,221,255,.08); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.import-card { margin-bottom: 26px; padding: clamp(20px,4vw,32px); }
.import-card h2 { margin: 0 0 7px; }
.import-card p { margin: 0; color: var(--muted); }
.import-card code { color: var(--cyan); }
.import-grid { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone { margin-top: 22px; padding: 30px 15px; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); text-align: center; cursor: pointer; transition: .2s; }
.drop-zone:hover, .drop-zone.is-dragging { color: var(--text); border-color: var(--cyan); background: rgba(89,221,255,.07); }
.static-warning { margin-top: 20px; }
@media (max-width: 620px) { .import-grid { grid-template-columns: 1fr; gap: 16px; } .heading-actions { width: 100%; } .heading-actions .button { width: 100%; } }
