/* =============================================================================
   QuizVerse · stylesheet (student + teacher)
   Designed & built by Arham Ashraf
   ========================================================================== */
:root {
  --bg: #f3f5f9;
  --bg-2: #e9edf4;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #5b6b82;
  --ink-4: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #4f46e5;
  --brand-2: #4338ca;
  --brand-3: #3730a3;
  --brand-soft: #eef2ff;
  --brand-soft-2: #e0e7ff;
  --ok: #047857;
  --ok-2: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-2: #d97706;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-2: #dc2626;
  --bad-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --code-bg: #0b1220;
  --code-ink: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .07);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, "Roboto Mono", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.35rem); font-weight: 750; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.mono { font-family: var(--mono); }
.nums { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.shell { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.shell.narrow { max-width: 640px; }
.shell.mid { max-width: 860px; }
.shell.wide { max-width: 1320px; }
.page { padding-top: 34px; padding-bottom: 70px; }

.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__in { height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none !important; min-width: 0; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #0891b2); color: #fff;
  font: 700 .82rem/1 var(--mono); box-shadow: 0 4px 12px rgba(79, 70, 229, .3);
}
.brand__name { font-weight: 750; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand__sub { font-size: .75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .topnav button {
  border: 0; background: none; padding: 8px 12px; border-radius: 9px; color: var(--ink-2);
  font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.topnav a:hover, .topnav button:hover { background: var(--bg); text-decoration: none; }
.topnav a.on, .topnav button.on { background: var(--brand-soft); color: var(--brand-2); }

.foot { padding: 26px 0 34px; color: var(--ink-4); font-size: .8rem; text-align: center; }
.foot b { color: var(--ink-3); font-weight: 600; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 28px; }
.card.pad-sm { padding: 18px 20px; }
.card + .card { margin-top: 18px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card__body { padding: 20px 22px; }
.kicker { font: 700 .72rem/1 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--brand); }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  border-radius: 11px; padding: 11px 18px; font-weight: 650; font-size: .95rem; line-height: 1.2;
  background: var(--panel); color: var(--ink); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap; user-select: none; -webkit-user-select: none; text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.btn--primary:hover { background: var(--brand-2); }
.btn--ok { background: var(--ok-2); color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .25); }
.btn--ok:hover { background: var(--ok); }
.btn--danger { background: var(--bad-2); color: #fff; box-shadow: 0 6px 16px rgba(220, 38, 38, .22); }
.btn--danger:hover { background: var(--bad); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #1e293b; }
.btn--ghost { background: var(--panel); border-color: var(--line-2); color: var(--ink-2); }
.btn--ghost:hover { background: var(--bg); border-color: var(--ink-4); }
.btn--soft { background: var(--brand-soft); color: var(--brand-2); }
.btn--soft:hover { background: var(--brand-soft-2); }
.btn--bad-soft { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.btn--bad-soft:hover { background: #fee2e2; }
.btn--lg { padding: 14px 24px; font-size: 1.02rem; border-radius: 13px; }
.btn--sm { padding: 7px 12px; font-size: .84rem; border-radius: 9px; }
.btn--xs { padding: 4px 9px; font-size: .78rem; border-radius: 7px; gap: 5px; }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 20px; }
.field__label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 7px; color: var(--ink-2); }
.field__hint { font-size: .8rem; color: var(--ink-3); margin-top: 6px; }
.field__err { font-size: .84rem; color: var(--bad); margin-top: 7px; display: flex; gap: 6px; align-items: flex-start; }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--line-2); background: #fff; border-radius: 11px; padding: 12px 14px;
  font-size: 1rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14); }
.input.err { border-color: var(--bad-2); box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.input--code {
  font: 700 2rem/1 var(--mono); letter-spacing: .42em; text-align: center; padding: 16px 10px 16px calc(10px + .42em);
  border-radius: 14px;
}
.input--sm { padding: 8px 11px; font-size: .9rem; border-radius: 9px; }
.segs { display: flex; flex-wrap: wrap; gap: 8px; }
.seg {
  min-width: 64px; padding: 10px 16px; border-radius: 11px; border: 1.5px solid var(--line-2); background: #fff;
  font-weight: 650; color: var(--ink-2); transition: all .12s;
}
.seg:hover { border-color: var(--brand); color: var(--brand-2); }
.seg.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .25); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; background: #fff; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.check.on { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem;
  font-weight: 650; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip--brand { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-soft-2); }
.chip--ok { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.chip--warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.chip--bad { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.chip--info { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }
.chip--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .5); } 70% { box-shadow: 0 0 0 7px rgba(5, 150, 105, 0); } 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); } }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; font-size: .92rem; border: 1px solid; }
.alert svg { margin-top: 2px; }
.alert--info { background: var(--info-soft); border-color: #bae6fd; color: #0c4a6e; }
.alert--ok { background: var(--ok-soft); border-color: #a7f3d0; color: #065f46; }
.alert--warn { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.alert--bad { background: var(--bad-soft); border-color: #fecaca; color: #7f1d1d; }
.alert b { font-weight: 700; }

/* ---------- toasts & modals ---------- */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 520px); }
.toast {
  pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: .92rem; display: flex; gap: 10px; align-items: center; animation: toastIn .22s ease-out; max-width: 100%;
}
.toast--ok { background: #065f46; } .toast--bad { background: #991b1b; } .toast--warn { background: #92400e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-back {
  position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 20px;
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; animation: modalIn .2s ease-out; }
.modal.wide { width: min(980px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { padding: 22px 24px 0; }
.modal__body { padding: 14px 24px 6px; color: var(--ink-2); }
.modal__foot { padding: 18px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- spinner ---------- */
.spin { width: 22px; height: 22px; border: 3px solid var(--brand-soft-2); border-top-color: var(--brand); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
.spin.lg { width: 54px; height: 54px; border-width: 5px; }
.spin.light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; width: 18px; height: 18px; border-width: 2.5px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- code ---------- */
.code { background: var(--code-bg); color: var(--code-ink); border-radius: 13px; overflow: hidden; border: 1px solid #1e293b; margin: 0; }
.code__bar { display: flex; align-items: center; gap: 7px; padding: 9px 14px; background: #111a2e; border-bottom: 1px solid #1e293b; font: 600 .74rem/1 var(--mono); color: #7c8aa5; }
.code__bar i { width: 10px; height: 10px; border-radius: 50%; background: #334155; display: inline-block; }
.code__bar i:nth-child(1) { background: #f87171; } .code__bar i:nth-child(2) { background: #fbbf24; } .code__bar i:nth-child(3) { background: #34d399; }
.code__bar span { margin-left: 8px; }
.code__body { display: grid; grid-template-columns: auto 1fr; overflow-x: auto; }
.code__ln, .code__src { margin: 0; padding: 16px 0; font: 500 1.08rem/1.65 var(--mono); white-space: pre; }
.code__ln { padding-left: 14px; padding-right: 12px; color: #475569; text-align: right; user-select: none; -webkit-user-select: none; border-right: 1px solid #1e293b; }
.code__src { padding-left: 16px; padding-right: 20px; tab-size: 4; }
.tk-k { color: #c4b5fd; } .tk-b { color: #7dd3fc; } .tk-s { color: #86efac; } .tk-n { color: #fdba74; }
.tk-c { color: #64748b; font-style: italic; } .tk-f { color: #fde68a; } .tk-o { color: #94a3b8; }
code.inline { font-family: var(--mono); background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* =============================================================================
   student: welcome / details / ready
   ========================================================================== */
.hero-card { overflow: hidden; }
.hero-card__top { padding: 30px 30px 24px; background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 55%, #ecfeff 100%); border-bottom: 1px solid var(--line); }
.hero-card__top h1 { margin: 10px 0 10px; }
.hero-card__top p { color: var(--ink-2); max-width: 62ch; }
.hero-card__body { padding: 26px 30px 30px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.fact { background: rgba(255, 255, 255, .78); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fact b { display: block; font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fact span { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.steps { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 0 0 22px; font-size: .8rem; color: var(--ink-4); font-weight: 650; flex-wrap: wrap; }
.steps span { display: inline-flex; align-items: center; gap: 7px; }
.steps b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-3); font-size: .72rem; }
.steps .on { color: var(--brand-2); } .steps .on b { background: var(--brand); color: #fff; }
.steps .done { color: var(--ok); } .steps .done b { background: var(--ok-2); color: #fff; }
.steps i { width: 22px; height: 1.5px; background: var(--line-2); display: inline-block; }
.who-box { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); }
.avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 750; flex-shrink: 0; }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: .82rem; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rules li { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; color: var(--ink-2); }
.rules li .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex-shrink: 0; }
.rules li.warn .ic { background: var(--warn-soft); color: var(--warn); }
.rules li b { color: var(--ink); }
.marks3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 18px; }
.marks3 div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.marks3 b { display: block; font-size: 1.35rem; font-weight: 800; }
.marks3 span { font-size: .78rem; color: var(--ink-3); font-weight: 600; }

/* =============================================================================
   student: the test
   ========================================================================== */
body.in-test { background: #eef1f7; }
body.in-test.lockdown { user-select: none; -webkit-user-select: none; }
.exam-bar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.exam-bar__in { display: flex; align-items: center; gap: 16px; height: 64px; }
.exam-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.exam-who .nm { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.exam-who .cl { font-size: .76rem; color: var(--ink-3); white-space: nowrap; }
.exam-meters { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.meter { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding: 0 4px; }
.meter b { font: 750 1.05rem/1.1 var(--font); font-variant-numeric: tabular-nums; }
.meter span { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); font-weight: 700; }
.meter.alarm b { color: var(--bad); }
.syncpill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--ok-soft); color: var(--ok); border: 1px solid #a7f3d0; white-space: nowrap; }
.syncpill.busy { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }
.syncpill.off { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.strip { display: flex; gap: 3px; height: 7px; margin: 0 0 2px; }
.strip i { flex: 1; border-radius: 3px; background: var(--bg-2); min-width: 2px; }
.strip i.done { background: var(--brand); } .strip i.late { background: var(--warn-2); } .strip i.skip { background: var(--ink-4); }
.strip i.now { background: #fff; box-shadow: inset 0 0 0 2px var(--brand); }
.exam-main { padding: 22px 0 40px; }
.qcard { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.qcard.enter { animation: qIn .28s ease-out; }
@keyframes qIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.qno { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.qno small { color: var(--ink-4); font-weight: 650; font-size: .85rem; }
.qbody { padding: 24px 26px 26px; }
.qtext { font-size: 1.28rem; font-weight: 650; line-height: 1.45; margin-bottom: 18px; color: var(--ink); white-space: pre-wrap; }
.opts { display: grid; gap: 11px; margin-top: 20px; }
.opt {
  display: flex; align-items: center; gap: 15px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; transition: border-color .12s, background .12s, box-shadow .12s;
}
.opt:hover { border-color: #a5b4fc; background: #fafaff; }
.opt__key { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); border: 1.5px solid var(--line-2); font-weight: 800; color: var(--ink-3); flex-shrink: 0; font-size: .95rem; }
.opt__txt { font: 600 1.12rem/1.4 var(--mono); color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.opt__txt.plain { font-family: var(--font); font-size: 1.06rem; font-weight: 600; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.opt.sel .opt__key { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt.locked { border-color: var(--brand-2); background: var(--brand-soft); }
.opt.locked .opt__key { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.opt.dim { opacity: .45; }
.opt[disabled] { cursor: default; }
.exam-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.keyhint { font-size: .8rem; color: var(--ink-3); margin-right: auto; }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: #fff; font: 700 .74rem/1.5 var(--mono); text-align: center; color: var(--ink-2); }

.ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .tr { stroke: var(--bg-2); }
.ring .fl { stroke: var(--brand); stroke-linecap: round; transition: stroke .2s; }
.ring.warn .fl { stroke: var(--warn-2); } .ring.dire .fl { stroke: var(--bad-2); } .ring.late .fl { stroke: var(--warn-2); }
.ring__lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring__lbl b { font: 800 1.2rem/1 var(--font); font-variant-numeric: tabular-nums; }
.ring__lbl span { font-size: .6rem; font-weight: 700; color: var(--ink-4); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.ring.dire .ring__lbl b { color: var(--bad); } .ring.late .ring__lbl b { color: var(--warn); }
.ring.dire { animation: beat 1s infinite; }
@keyframes beat { 50% { transform: scale(1.06); } }

.late-banner { margin: 0 0 16px; }
.waitbox { text-align: center; padding: 60px 24px; }
.waitbox .spin { margin-bottom: 18px; }

.overlay { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .82); display: grid; place-items: center; padding: 20px; }
.overlay__card { background: #fff; border-radius: 20px; padding: 32px; max-width: 520px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.overlay__card .big-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--warn-soft); color: var(--warn); }
.overlay__card h2 { margin-bottom: 10px; }
.overlay__card p { color: var(--ink-2); margin-bottom: 20px; }
.warnbar { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(94vw, 640px); animation: toastIn .2s ease-out; }

/* =============================================================================
   student: submitting / result / scoreboard
   ========================================================================== */
.bigstate { text-align: center; padding: 46px 30px; }
.bigstate .spin { margin-bottom: 22px; }
.bigstate h2 { margin-bottom: 10px; }
.bigstate .ok-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--ok-soft); color: var(--ok-2); }
.score-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.score-ring { position: relative; width: 168px; height: 168px; }
.score-ring svg { width: 168px; height: 168px; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 13; }
.score-ring .tr { stroke: var(--bg-2); }
.score-ring .fl { stroke: url(#scoreGrad); stroke-linecap: round; }
.score-ring__lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring__lbl b { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring__lbl span { font-size: .85rem; color: var(--ink-3); font-weight: 650; margin-top: 5px; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; background: #fff; }
.tile b { display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { font-size: .76rem; font-weight: 650; color: var(--ink-3); }
.tile.ok b { color: var(--ok); } .tile.bad b { color: var(--bad); } .tile.warn b { color: var(--warn); }
.bars { display: grid; gap: 11px; }
.bar__top { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; margin-bottom: 5px; }
.bar__track { height: 9px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.bar__fill.good { background: linear-gradient(90deg, #10b981, #059669); }
.bar__fill.mid { background: linear-gradient(90deg, #f59e0b, #d97706); }
.bar__fill.low { background: linear-gradient(90deg, #f87171, #dc2626); }

.review-q { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; }
.review-q + .review-q { margin-top: 12px; }
.review-q .qtext { font-size: 1.02rem; margin-bottom: 12px; }
.review-q .code__src, .review-q .code__ln { font-size: .9rem; padding-top: 11px; padding-bottom: 11px; }
.ropt { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); margin-top: 7px; font-size: .95rem; }
.ropt .k { font-weight: 800; color: var(--ink-3); width: 18px; }
.ropt .t { font-family: var(--mono); white-space: pre-wrap; flex: 1; }
.ropt .t.plain { font-family: var(--font); }
.ropt.right { border-color: #6ee7b7; background: var(--ok-soft); }
.ropt.wrong { border-color: #fca5a5; background: var(--bad-soft); }
.ropt .tag { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.explain { margin-top: 12px; padding: 11px 14px; border-radius: 10px; background: var(--info-soft); color: #0c4a6e; font-size: .9rem; }
.explain code { font-family: var(--mono); background: rgba(255, 255, 255, .7); padding: 0 4px; border-radius: 4px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 750; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbff; }
.table tr.me td { background: #eef2ff !important; }
.table tr.voided td { opacity: .5; text-decoration: line-through; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--ink); }
.rank { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 9px; background: var(--bg); font-weight: 800; font-size: .86rem; padding: 0 6px; }
.rank.r1 { background: #fef3c7; color: #92400e; } .rank.r2 { background: #e2e8f0; color: #334155; } .rank.r3 { background: #fde4cf; color: #9a3412; }
.cell-name { font-weight: 650; }
.cell-sub { font-size: .76rem; color: var(--ink-3); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { font-size: .78rem; font-weight: 650; color: var(--ink-3); }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); } .stat.brand b { color: var(--brand-2); }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.filters .grp { display: flex; gap: 6px; align-items: center; }
.filters label { font-size: .78rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.pills { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.pills button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: .84rem; font-weight: 650; color: var(--ink-3); }
.pills button.on { background: #fff; color: var(--brand-2); box-shadow: var(--shadow-sm); }
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty .ic { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--bg); color: var(--ink-4); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }

/* =============================================================================
   teacher panel
   ========================================================================== */
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.codebox { text-align: center; padding: 26px 22px; }
.codebox__code { font: 800 3.4rem/1 var(--mono); letter-spacing: .14em; color: var(--ink); margin: 12px 0 10px; padding-left: .14em; }
.codebox__code.off { color: var(--ink-4); }
.codebox__meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.codebox .row { justify-content: center; }
.live-dot { color: var(--ok-2); }
.state-online { color: var(--ok); } .state-idle { color: var(--warn); } .state-offline { color: var(--bad); }
.prog { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.prog__track { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.prog__fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.flag.warn { background: var(--warn-soft); color: var(--warn); } .flag.bad { background: var(--bad-soft); color: var(--bad); } .flag.info { background: var(--info-soft); color: var(--info); } .flag.ok { background: var(--ok-soft); color: var(--ok); }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting h4 { font-size: .96rem; font-weight: 650; }
.setting p { font-size: .84rem; color: var(--ink-3); margin-top: 3px; }
.setting .input { width: 120px; }
.setting .input.wide { width: 280px; }
.toggle { position: relative; width: 48px; height: 28px; border-radius: 99px; background: var(--line-2); border: 0; transition: background .15s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.toggle.on { background: var(--brand); }
.toggle.on::after { transform: translateX(20px); }
.checklist li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok-c { color: var(--ok-2); } .checklist .bad-c { color: var(--bad-2); }
.projector { position: fixed; inset: 0; z-index: 160; background: radial-gradient(circle at 30% 20%, #312e81 0%, #0f172a 55%, #020617 100%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.projector .lbl { font-size: clamp(1rem, 2.2vw, 1.6rem); color: #c7d2fe; font-weight: 650; letter-spacing: .02em; }
.projector .pcode { display: block; font: 800 clamp(5rem, 17vw, 13rem)/1 var(--mono); letter-spacing: .12em; margin: 18px 0 18px; padding-left: .12em; color: #fff; text-shadow: 0 10px 40px rgba(99, 102, 241, .55); }
.projector .url { font: 650 clamp(1.1rem, 2.6vw, 2rem)/1.3 var(--mono); color: #e0e7ff; background: rgba(255, 255, 255, .08); padding: 10px 22px; border-radius: 14px; margin-top: 6px; word-break: break-all; }
.projector .meta { margin-top: 26px; color: #a5b4fc; font-size: clamp(.95rem, 1.8vw, 1.3rem); }
.projector .close { position: absolute; top: 18px; right: 18px; }
.bank-q { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: #fff; }
.bank-q + .bank-q { margin-top: 12px; }
.bank-q .code__src, .bank-q .code__ln { font-size: .88rem; padding-top: 10px; padding-bottom: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.loadbar { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.loadbar div { height: 100%; background: linear-gradient(90deg, #6366f1, #10b981); transition: width .3s; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { padding: 0 16px; }
  .page { padding-top: 20px; padding-bottom: 50px; }
  .card.pad { padding: 20px; }
  .hero-card__top, .hero-card__body { padding-left: 20px; padding-right: 20px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-bar__in { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
  .exam-who .nm { max-width: 150px; }
  .qhead { padding: 14px 16px; }
  .qbody { padding: 18px 16px 20px; }
  .qtext { font-size: 1.12rem; }
  .opt__txt { font-size: 1rem; }
  .code__ln, .code__src { font-size: .92rem; }
  .score-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keyhint { display: none; }
  .codebox__code { font-size: 2.6rem; }
  .setting { grid-template-columns: 1fr; }
  .setting .input.wide { width: 100%; }
  .brand__sub { display: none; }
  .topnav a span, .topnav button span { display: none; }
  .hide-sm { display: none !important; }
}

/* ---------- printing ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print, #toasts, .foot { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
  body.in-test * { visibility: hidden !important; }
  .table th { position: static; }
}
