/* =====================================================================
   FideLearn - student interface
   White theme, high contrast, Inter typeface (bundled), no dark mode.
   ===================================================================== */
:root {
  color-scheme: light only;
  --canvas: #f6f8fb;
  --surface: #ffffff;
  --soft: #f3f6fa;
  --text: #0b1324;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e4e9f0;
  --border-strong: #cfd8e3;
  --primary: #1d4ed8;
  --primary-600: #2563eb;
  --primary-dark: #1e3a8a;
  --primary-weak: #eef3ff;
  --primary-ring: rgba(37, 99, 235, .18);
  --ok: #047857;
  --ok-500: #10b981;
  --ok-weak: #e7f8f0;
  --warn: #b45309;
  --warn-500: #f59e0b;
  --warn-weak: #fff6e5;
  --danger: #c81e1e;
  --danger-weak: #fdecec;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 6px -2px rgba(15, 23, 42, .05), 0 12px 24px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 64px -12px rgba(15, 23, 42, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--text);
  font: 400 17px/1.6 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
/* Icon sizing only - never touch MathJax's SVG equations. */
/* Font Awesome icons (bundled locally in static/vendor/fontawesome) */
:where(.xh, .btn, .icon-btn, .flag-btn, .save-status, .opt-check, .modal-icon, .kbd-help, .close-x, .xside) i[class*="fa-"] { font-size: 1rem; width: 1.2em; text-align: center; flex: none; line-height: 1; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  font-weight: 600; font-size: .95rem; text-decoration: none; letter-spacing: -.005em;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .06s; user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(29, 78, 216, .3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 1px 2px rgba(4, 120, 87, .3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-ok:hover { background: #065f46; border-color: #065f46; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost-strong { background: #fff; border-color: var(--border-strong); }
.btn-block { width: 100%; }
kbd, .kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: #fff;
  font: 600 .7rem/1 var(--mono); color: var(--muted);
}
.btn kbd { margin-left: 2px; }
.btn-primary kbd, .btn-ok kbd, .btn-danger kbd { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.flash { animation: flash .4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .5); } 100% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); } }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  background: var(--soft); border: 1px solid var(--border); font-size: .76rem; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.chip-subject { background: var(--primary-weak); border-color: #d6e2ff; color: var(--primary); }
.chip-ok { background: var(--ok-weak); color: var(--ok); border-color: #bfe8d6; }
.chip-bad { background: var(--danger-weak); color: var(--danger); border-color: #f5c2c2; }
.chip-warn { background: var(--warn-weak); color: var(--warn); border-color: #f6dca5; }

/* =====================================================================
   Simple pages: login / done / result
   ===================================================================== */
.center-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #eaf0ff 0%, rgba(234,240,255,0) 70%), var(--canvas);
}
.card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); padding: 34px; width: 100%; max-width: 440px; }
.card-wide { max-width: 880px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand-lockup img { width: 44px; height: 44px; }
.brand-lockup .bn { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.brand-lockup .bs { font-size: .85rem; color: var(--muted); }
.card h1 { font-size: 1.35rem; margin: 22px 0 4px; letter-spacing: -.015em; }
.field { display: block; margin: 18px 0 0; }
.field span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--text-2); }
.field input {
  width: 100%; min-height: 54px; padding: 12px 14px; font-size: 1.08rem; border: 1px solid var(--border-strong);
  border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--primary-600); outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.field input.key { text-transform: uppercase; letter-spacing: .18em; font-family: var(--mono); }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-size: .94rem; }
.alert-error { background: var(--danger-weak); color: var(--danger); border: 1px solid #f5c2c2; }
.alert-ok { background: var(--ok-weak); color: var(--ok); border: 1px solid #bfe8d6; }
.alert-info { background: var(--primary-weak); color: var(--primary-dark); border: 1px solid #d6e2ff; }
.field span i { color: var(--muted); width: 1.2em; text-align: center; margin-right: 2px; }
.btn i { font-size: .95em; }
.success-icon i { font-size: 2rem; }
.alert a i { font-size: .85em; margin-left: 2px; }
.foot-note i { margin-right: 2px; }
.foot-note { margin-top: 18px; font-size: .82rem; color: var(--muted); text-align: center; }

.success-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--ok-weak); color: var(--ok); display: grid; place-items: center; margin: 12px auto 14px; font-size: 2.2rem; font-weight: 800; box-shadow: 0 0 0 10px #f2fbf7; }
.done-msg { text-align: center; font-size: 1.15rem; font-weight: 600; margin: 4px auto 6px; max-width: 520px; letter-spacing: -.01em; }
.student-strip { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--soft); margin: 18px 0; flex-wrap: wrap; }
.student-strip .passport { width: 56px; height: 56px; }
.passport { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: center 30%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); background: var(--soft); flex: none; }
.result-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.result-hero div { border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; background: #fff; }
.result-hero b { display: block; font-size: 1.8rem; line-height: 1.2; letter-spacing: -.02em; }
.result-hero span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
table.simple { width: 100%; border-collapse: collapse; font-size: .97rem; }
table.simple th, table.simple td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.simple th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.simple td.num, table.simple th.num { text-align: right; font-variant-numeric: tabular-nums; }
.review { margin-top: 24px; display: grid; gap: 14px; }
.rv-item { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.rv-item header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.rv-item .qtext { font-size: 1.04rem; }
.rv-options { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.rv-options li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.rv-options li .opt-letter { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--border-strong); font-weight: 700; font-size: .82rem; }
.rv-options li.mine { border-color: var(--primary-600); background: var(--primary-weak); }
.rv-options li.correct { border-color: #86d3b2; background: var(--ok-weak); }
.rv-options li.wrong { border-color: #f09a9a; background: var(--danger-weak); }
.rv-tag { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.rv-tag.ok { color: var(--ok); margin-left: 6px; }
.rv-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; margin-top: 10px; }
.rv-label { font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-top: 3px; }
.rv-ans { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--soft); }
.rv-expl { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--primary-600); background: var(--primary-weak); border-radius: 0 10px 10px 0; font-size: .95rem; }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary-600); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Exam screen
   ===================================================================== */
body.exam-page { background: var(--canvas); font-size: 15px; --tap: 40px; --qs: 1; }
body.exam-page.ts-md { --qs: 1.12; }
body.exam-page.ts-lg { --qs: 1.26; }
body.exam-page .btn { font-size: .86rem; padding: 7px 14px; border-radius: 10px; }
body.exam-page .chip { font-size: .7rem; padding: 2px 8px; }
body.exam-page .flag-btn { min-height: 32px; padding: 4px 11px; font-size: .78rem; }
body.exam-page .cand-name { font-size: .95rem; }
body.exam-page .pbtn { height: 36px; font-size: .8rem; border-radius: 8px; }
body.exam-page .timer { padding: 5px 13px 5px 10px; min-width: 128px; border-radius: 12px; }
body.exam-page .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
body.exam-page .xh-progress { width: 210px; }

/* ---------- header ---------- */
.xh { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.xh-inner { max-width: 1360px; margin: 0 auto; padding: 7px 20px; display: flex; align-items: center; gap: 14px; }
.xh-brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.xh-brand img { width: 32px; height: 32px; flex: none; }
.xh-brand-text { min-width: 0; padding-left: 12px; border-left: 1px solid var(--border); }
.xh-name { font-weight: 800; font-size: .92rem; letter-spacing: -.02em; line-height: 1.2; }
.xh-exam { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xh-progress { width: 240px; }
.xh-progress-text { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.xh-progress-text #progPct { color: var(--text); }
.bar { height: 6px; border-radius: 999px; background: #e9eef5; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary-600), #4f8bff); transition: width .35s ease; }
.icon-btn i { font-size: 1.05rem; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: #fff; color: var(--muted); }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.timer {
  display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 12px; border-radius: 14px;
  background: #0b1324; color: #fff; box-shadow: var(--shadow-sm); min-width: 150px;
}
.timer .timer-ico { font-size: 1.35rem; width: auto; color: #93b4ff; }
.timer > div { display: flex; flex-direction: column; line-height: 1.1; }
.timer .t-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; font-weight: 700; }
.timer .t-val { font: 700 1.15rem/1.15 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer.warn { background: var(--warn-weak); color: var(--warn); box-shadow: inset 0 0 0 1px #f6cf7c; }
.timer.warn .timer-ico, .timer.warn .t-label { color: var(--warn); }
.timer.danger { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
.timer.danger .timer-ico, .timer.danger .t-label { color: #fee2e2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(200, 30, 30, .18); } }
.xh-candidate { display: none; }

/* ---------- layout ---------- */
.xw { max-width: 1360px; margin: 0 auto; padding: 14px 20px 28px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.xmain { min-width: 0; }

/* ---------- subject tabs ---------- */
.subject-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs); overflow-x: auto; scrollbar-width: none; }
.subject-tabs::-webkit-scrollbar { display: none; }
.subject-tab {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 38px; padding: 4px 14px;
  border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: .84rem; color: var(--muted); position: relative;
}
.subject-tab:hover { color: var(--text); background: var(--soft); }
.subject-tab .cnt { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.subject-tab .mini { position: absolute; left: 16px; right: 16px; bottom: 4px; height: 3px; border-radius: 3px; background: #e9eef5; overflow: hidden; }
.subject-tab .mini i { display: block; height: 100%; background: var(--ok-500); border-radius: inherit; }
.subject-tab.done .cnt { background: var(--ok-weak); color: var(--ok); }
.subject-tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(29, 78, 216, .3); }
.subject-tab.active .cnt { background: rgba(255,255,255,.18); color: #fff; }
.subject-tab.active .mini { background: rgba(255,255,255,.25); }
.subject-tab.active .mini i { background: #fff; }

/* ---------- question card ---------- */
.qcard { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
.qbody { padding: 18px 24px 20px; min-height: 0; min-width: 0; }
.q-head { display: flex; align-items: flex-start; gap: 12px; }
.qnum { margin: 0; font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: -.01em; }
.qnum b { font-size: 1.3rem; color: var(--text); font-weight: 800; margin: 0 2px; letter-spacing: -.03em; }
.qnum span { font-weight: 500; }
.q-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 12px; }
.flag-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: #fff; font-weight: 600; font-size: .85rem; color: var(--muted); white-space: nowrap;
}
.flag-btn i { font-size: .9rem; }
.flag-btn:hover { background: var(--soft); color: var(--text); }
.flag-btn.on { background: var(--warn-weak); border-color: #f6cf7c; color: var(--warn); }
.qtext { font-size: calc(.98rem * var(--qs, 1)); line-height: 1.62; color: var(--text); overflow-wrap: anywhere; }
.qimg { display: block; max-width: 100%; max-height: 340px; margin: 12px 0 2px; cursor: zoom-in; border: 1px solid var(--border); border-radius: 12px; }

.options { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.opt {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 44px;
  padding: 6px 14px 6px 7px; border: 1px solid var(--border-strong); border-radius: 11px; background: #fff;
  font-size: calc(.93rem * var(--qs, 1)); line-height: 1.5; transition: border-color .12s, background .12s, box-shadow .12s;
}
.opt:hover { border-color: #9db7f5; background: #fafcff; box-shadow: var(--shadow-xs); }
.opt-letter {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--soft); border: 1px solid var(--border); font-weight: 700; font-size: .82rem; color: var(--text-2);
  transition: background .12s, color .12s, border-color .12s;
}
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-check { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: transparent; transition: all .12s; }
.opt-check i { font-size: .72rem; width: auto; }
.opt.selected { border-color: var(--primary-600); background: var(--primary-weak); box-shadow: 0 0 0 3px var(--primary-ring); }
.opt.selected .opt-letter { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt.selected .opt-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.short-answer {
  width: 100%; min-height: 130px; margin-top: 14px; padding: 12px 14px; font-size: calc(.95rem * var(--qs, 1)); line-height: 1.6;
  border: 1px solid var(--border-strong); border-radius: 14px; resize: vertical; background: #fff;
}
.short-answer:focus { border-color: var(--primary-600); outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.qhelp { margin-top: 10px; font-size: .84rem; color: var(--muted); }
.clear-link { background: none; border: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: .85rem; padding: 8px 0 0; margin-top: 6px; }
.clear-link:hover { color: var(--danger); }

/* MathJax: wide display equations scroll horizontally instead of overflowing */
mjx-container[display="true"] { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
mjx-container { max-width: 100%; }
.opt mjx-container[display="true"] { margin: 4px 0 !important; }

/* ---------- card footer: save status + navigation ---------- */
/* Navigation stays pinned to the bottom of the screen while a long passage scrolls. */
.qfoot { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 20px; border-top: 1px solid var(--border); background: rgba(251,252,254,.97); backdrop-filter: blur(6px); border-radius: 0 0 16px 16px; }
.save-status { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); min-width: 0; }
.save-status i { font-size: .95rem; }
.save-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-status.ok { color: var(--ok); }
.save-status.err { color: var(--danger); font-weight: 600; }
.nav-btns { display: flex; gap: 10px; }
.nav-btns .btn { min-width: 112px; }
.palette-toggle, .submit-mobile, .lbl-short { display: none !important; }

/* ---------- sidebar ---------- */
.xside { position: sticky; top: 66px; display: grid; gap: 12px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); }
.cand-card { display: flex; gap: 12px; padding: 12px; align-items: center; }
.cand-photo { width: 60px; height: 80px; border-radius: 12px; object-fit: cover; object-position: center 30%; background: var(--soft); border: 1px solid var(--border); flex: none; }
.cand-info { min-width: 0; }
.cand-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--muted); }
.cand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; letter-spacing: -.01em; margin: 2px 0; overflow-wrap: anywhere; }
.cand-id { font: 600 .82rem var(--mono); color: var(--text-2); }
.cand-dept { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.cand-dept:empty { display: none; }
.nav-panel { padding: 14px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel-kicker { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--muted); }
.panel-head h2 { margin: 2px 0 0; font-size: 1.02rem; letter-spacing: -.01em; }
.panel-count { font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; max-height: 38vh; overflow-y: auto; padding: 3px; }
.pbtn {
  position: relative; height: 42px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: #fff; font-weight: 700; font-size: .88rem; color: var(--text-2); font-variant-numeric: tabular-nums;
  transition: transform .06s, border-color .12s;
}
.pbtn:hover { border-color: var(--primary-600); color: var(--primary); }
.pbtn.answered { background: var(--ok-weak); border-color: #86d3b2; color: var(--ok); }
.pbtn.flagged { background: var(--warn-weak); border-color: #f2c264; color: var(--warn); }
.pbtn.flagged::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-500); }
.pbtn.current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 3px var(--primary-ring); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; margin-top: 16px; font-size: .76rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); background: #fff; flex: none; }
.legend i.l-cur { background: var(--primary); border-color: var(--primary); }
.legend i.l-ans { background: var(--ok-weak); border-color: #86d3b2; }
.legend i.l-flag { background: var(--warn-weak); border-color: #f2c264; }
.psummary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.psummary b { display: block; font-size: 1.02rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.psummary span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.submit-main { min-height: 44px; font-size: .92rem; border-radius: 12px; }
.drawer-close { display: none; }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(11, 19, 36, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease-out; }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 470px; padding: 30px; max-height: 92vh; overflow-y: auto; animation: rise .18s ease-out; }
.modal-wide { max-width: 620px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-size: 1.35rem; letter-spacing: -.02em; }
.modal p { margin: 8px 0; color: var(--text-2); }
.modal-lead { font-weight: 500; }
.modal-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-weak); color: var(--primary); margin-bottom: 14px; }
.modal-icon i { font-size: 1.3rem; width: auto; }
.modal-icon.ok { background: var(--ok-weak); color: var(--ok); }
.modal-icon.danger { background: var(--danger-weak); color: var(--danger); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.small-note { font-size: .86rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 8px; }
.stat-row div { border-radius: 12px; padding: 12px 8px; text-align: center; background: var(--soft); }
.stat-row b { display: block; font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-row .s-ok b { color: var(--ok); }
.stat-row .s-warn b { color: var(--danger); }
.stat-row .s-flag b { color: var(--warn); }
.instructions-text { white-space: pre-wrap; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: .97rem; line-height: 1.65; }

/* ---------- keyboard help ---------- */
.kbd-help { position: fixed; right: max(24px, calc((100vw - 1360px) / 2 + 24px)); bottom: 24px; z-index: 50; width: 340px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px; font-size: .85rem; animation: rise .2s ease-out; }
.kbd-help h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .95rem; }
.kbd-help table { width: 100%; border-collapse: collapse; }
.kbd-help td { padding: 4px 0; vertical-align: middle; color: var(--text-2); }
.kbd-help td:first-child { width: 96px; white-space: nowrap; }
.kbd-help .close-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: none; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.kbd-help .close-x:hover { background: var(--soft); }
.kbd-note { color: var(--muted); margin: 10px 0 12px; font-size: .78rem; }
.kbd-help .btn { min-height: 40px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .xh-progress { width: 170px; }
  .kbd-help { width: 300px; right: 18px; }
  .xw { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; padding: 18px 18px 40px; }
}
@media (max-width: 900px) {
  /* Sidebar becomes a slide-in drawer; navigation becomes a bottom action bar. */
  .xw { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 104px; }
  .xside {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 90vw); z-index: 90; align-content: start;
    padding: 56px 14px 20px; background: var(--canvas); overflow-y: auto; box-shadow: var(--shadow-lg);
    transform: translateX(105%); visibility: hidden; transition: transform .24s ease, visibility 0s linear .24s;
  }
  .xside.open { transform: none; visibility: visible; transition: transform .24s ease; }
  .pgrid { max-height: none; }
  .drawer-close { display: inline-grid; position: absolute; top: 10px; right: 12px; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(11, 19, 36, .45); }
  .xh-progress, #kbdBtn, .kbd-help { display: none !important; }
  .xh-candidate { display: flex; align-items: center; gap: 10px; max-width: 1360px; margin: 0 auto; padding: 8px 14px; border-top: 1px solid var(--border); }
  .xh-candidate .passport { width: 34px; height: 34px; }
  .xh-cand-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
  .xh-cand-text strong { font-size: .92rem; }
  .xh-cand-text span { font: 600 .74rem var(--mono); color: var(--muted); }
  .qfoot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -4px 16px rgba(15,23,42,.06); }
  .save-status { display: none; }
  .nav-btns { flex: 1; gap: 8px; }
  .nav-btns .btn { flex: 1; min-width: 0; padding: 8px 10px; }
  .palette-toggle, .submit-mobile { display: inline-flex !important; }
  .nav-btns kbd { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .xh-inner { padding: 8px 12px; gap: 10px; }
  .xh-brand img { width: 32px; height: 32px; }
  .xh-brand-text { padding-left: 10px; }
  .xh-name { font-size: .95rem; }
  .xh-exam { font-size: .72rem; }
  .timer { min-width: 0; padding: 6px 12px 6px 10px; border-radius: 12px; }
  .timer .timer-ico { font-size: 1.1rem; }
  .timer .t-val { font-size: 1.15rem; }
  .timer .t-label { font-size: .56rem; }
  .subject-tabs { margin-bottom: 12px; border-radius: 12px; }
  .subject-tab { flex: 0 0 auto; padding: 6px 12px; min-height: 42px; font-size: .86rem; }
  .qbody { padding: 14px 14px 16px; min-height: 0; }
  .qnum b { font-size: 1.25rem; }
  .flag-btn .flag-txt { display: none; }
  .flag-btn { padding: 6px 12px; }
  .qtext { font-size: calc(1rem * var(--qs, 1)); }
  .opt { gap: 10px; padding: 8px 12px 8px 8px; font-size: calc(.95rem * var(--qs, 1)); min-height: 48px; }
  .opt-letter { width: 32px; height: 32px; }
  .opt-check { display: none; }
  .lbl-long { display: none; }
  .lbl-short { display: inline !important; }
  .nav-btns .btn { font-size: .9rem; gap: 5px; }
  .nav-btns .btn i { font-size: .85rem; }
  .card { padding: 24px 18px; }
  .result-hero b { font-size: 1.35rem; }
  .rv-row { grid-template-columns: 1fr; gap: 4px; }
  .stat-row b { font-size: 1.3rem; }
  .modal { padding: 22px; }
}
@media (max-width: 360px) {
  .xh-exam { display: none; }
  .nav-btns .btn i { display: none; }
}


/* =====================================================================
   Text size button + calculator
   ===================================================================== */
.icon-btn .aa { font-weight: 800; font-size: .95rem; letter-spacing: -.04em; color: var(--text-2); }
.icon-btn .aa small { font-size: .68em; font-weight: 700; }
.icon-btn.on { background: var(--primary-weak); border-color: #c9d9ff; color: var(--primary); }

.calc {
  position: fixed; right: 24px; top: 120px; z-index: 60; width: 272px; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .16s ease-out; outline: none;
}
.calc:focus-within { box-shadow: var(--shadow-lg), 0 0 0 3px var(--primary-ring); }
.calc-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: #0b1324; color: #fff;
  font-weight: 700; font-size: .82rem; cursor: grab; user-select: none; touch-action: none; }
.calc-head:active { cursor: grabbing; }
.calc-head i.fa-calculator { color: #93b4ff; }
.calc-x { margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; }
.calc-x:hover { background: rgba(255,255,255,.12); color: #fff; }
.calc-screen { padding: 10px 14px 8px; background: #f3f6fa; border-bottom: 1px solid var(--border); text-align: right; }
.calc-expr { min-height: 18px; font: 500 .78rem/1.4 var(--mono); color: var(--muted); white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.calc-val { font: 700 1.55rem/1.25 var(--mono); color: var(--text); white-space: nowrap; overflow-x: auto; scrollbar-width: none; font-variant-numeric: tabular-nums; }
.calc-val.err { color: var(--danger); }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px; }
.ck { height: 40px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font: 600 .95rem var(--font); color: var(--text); }
.ck:hover { background: var(--soft); }
.ck:active { transform: translateY(1px); }
.ck.fn { background: #f3f6fa; color: var(--text-2); font-size: .85rem; }
.ck.op { background: var(--primary-weak); color: var(--primary); border-color: #d6e2ff; font-size: 1.05rem; }
.ck.eq { grid-column: span 2; background: var(--primary); border-color: var(--primary); color: #fff; font-size: 1.1rem; }
.ck.eq:hover { background: var(--primary-dark); }
.calc-hint { padding: 0 12px 10px; font-size: .68rem; color: var(--muted); text-align: center; }
.calc-hint kbd { height: 18px; min-width: 18px; font-size: .62rem; }
@media (max-width: 900px) {
  .calc { left: 8px !important; right: 8px !important; top: auto !important; bottom: 74px !important; width: auto; max-width: 420px; margin: 0 auto; }
  .calc-head { cursor: default; }
  .calc-hint { display: none; }
  .ck { height: 42px; }
}

@media (max-width: 640px) {
  .xh-name { white-space: nowrap; }
  .xh-exam { display: none; }
  body.exam-page .icon-btn { width: 34px; height: 34px; }
  body.exam-page .xh-inner { gap: 8px; }
  .ck { height: 38px; }
  .calc-val { font-size: 1.35rem; }
}
@media (max-width: 640px) {
  .timer .timer-ico { display: none; }
  .xh-brand { gap: 8px; }
  .xh-brand-text { border-left: 0; padding-left: 0; }
}
@media (max-width: 350px) {
  .xh-brand-text { display: none; }
}

/* =====================================================================
   "Before you start" page: instructions + biodata confirmation
   ===================================================================== */
body.start-page { background: var(--canvas); font-size: 15px; }
.clock-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); font-weight: 700; font-size: .9rem; }
.clock-chip i { color: var(--primary); }
.clock-chip small { font-weight: 500; color: var(--muted); font-size: .72rem; margin-left: 4px; }
.sp-wrap { max-width: 1040px; margin: 0 auto; padding: 18px 18px 40px; }
.stepper { list-style: none; display: flex; gap: 8px; margin: 0 0 16px; padding: 0; counter-reset: s; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--border); font-weight: 600; font-size: .86rem; color: var(--muted); }
.stepper li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--border-strong); font-size: .78rem; font-weight: 800; flex: none; }
.stepper li.on { color: var(--primary); border-color: #c9d9ff; background: var(--primary-weak); }
.stepper li.on span { background: var(--primary); color: #fff; border-color: var(--primary); }
.stepper li.done { color: var(--ok); }
.stepper li.done span { background: var(--ok); color: #fff; border-color: var(--ok); font-size: 0; }
.stepper li.done span::before { content: "\f00c"; font: 900 .72rem "Font Awesome 6 Free"; }
.sp-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 22px 24px; }
.sp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.sp-head h1 { margin: 0; font-size: 1.3rem; letter-spacing: -.02em; }
.sp-head p { margin: 2px 0 0; font-size: .9rem; }
.sp-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-weak); color: var(--primary); font-size: 1.25rem; flex: none; }
.sp-summary { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.sp-summary > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); }
.sp-summary i { grid-row: span 2; color: var(--primary); font-size: 1.1rem; }
.sp-summary b { font-size: .98rem; line-height: 1.2; }
.sp-summary span { font-size: .74rem; color: var(--muted); }
.sp-teacher { border: 1px solid #f6dca5; background: var(--warn-weak); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.sp-teacher-title { font-weight: 700; color: var(--warn); margin-bottom: 4px; font-size: .88rem; }
#teacherText { white-space: pre-wrap; font-size: .92rem; }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guide article { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.guide h2 { margin: 0 0 6px; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.guide h2 i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-weak); color: var(--primary); font-size: .85rem; }
.guide ul { margin: 0; padding-left: 18px; font-size: .87rem; line-height: 1.6; color: var(--text-2); }
.guide li { margin: 3px 0; }
.tag { padding: 0 6px; border-radius: 5px; font-weight: 700; font-size: .8em; }
.tag.amber { background: var(--warn-weak); color: var(--warn); }
.tag.red { background: var(--danger-weak); color: var(--danger); }
.mini-tab { display: inline-flex; gap: 5px; align-items: center; padding: 1px 8px; border-radius: 7px; background: var(--soft); font-size: .78rem; font-weight: 600; color: var(--muted); }
.mini-tab i { font-style: normal; font-size: .9em; }
.mini-tab.on { background: var(--primary); color: #fff; }
.mini-opt { display: inline-flex; gap: 6px; align-items: center; padding: 1px 8px 1px 3px; border-radius: 7px; border: 1px solid var(--primary-600); background: var(--primary-weak); font-size: .8rem; }
.mini-opt b { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: .7rem; }
.mini-opt i { color: var(--primary); }
.mini-btn { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 7px; border: 1px solid var(--border-strong); background: #fff; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.mini-btn small { font-size: .7em; }
.mini-btn.blue { background: var(--primary); border-color: var(--primary); color: #fff; }
.mini-btn.green { background: var(--ok); border-color: var(--ok); color: #fff; }
.ok-text { color: var(--ok); font-weight: 600; }
.legend-line .lg { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: .72rem; font-weight: 700; margin: 0 2px 0 6px; vertical-align: middle; }
.lg.cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.lg.ans { background: var(--ok-weak); color: var(--ok); border-color: #86d3b2; }
.lg.flag { background: var(--warn-weak); color: var(--warn); border-color: #f2c264; }
.shortcuts { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.shortcuts summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.shortcuts table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: .84rem; }
.shortcuts td { padding: 4px 6px; color: var(--text-2); }
.sp-rules { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: .88rem; }
.sp-rules i { color: var(--primary); font-size: 1.1rem; margin-top: 2px; }
.sp-agree { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px; border: 1.5px solid var(--primary-600); border-radius: 12px; background: var(--primary-weak); font-weight: 600; cursor: pointer; }
.sp-agree input { width: 20px; height: 20px; accent-color: var(--primary); }
.sp-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.sp-actions .btn { min-height: 44px; font-size: .9rem; }
.sp-actions .btn-primary, .sp-actions .btn-ok { min-width: 230px; }
.biodata { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: start; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(180deg, #fbfcff, #fff); }
.bio-photo { margin: 0; text-align: center; }
.bio-photo img { width: 170px; height: 226px; object-fit: cover; object-position: center 30%; border-radius: 12px; border: 4px solid #fff; box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-md); background: var(--soft); }
.bio-photo figcaption { margin-top: 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.bio-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.bio-list > div { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.bio-list > div.wide { grid-column: 1 / -1; }
.bio-list dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.bio-list dd { margin: 3px 0 0; font-weight: 600; font-size: .98rem; }
.bio-list dd.big { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.bio-list dd.mono { font-family: var(--mono); }
.bio-list .chip { margin: 2px 2px 0 0; }
.sp-sub { font-size: 1rem; margin: 18px 0 8px; display: flex; gap: 8px; align-items: center; }
.sp-sub i { color: var(--primary); }
.paper-wrap { display: grid; grid-template-columns: 1fr 200px; gap: 14px; align-items: stretch; }
table.paper { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; border-collapse: separate; border-spacing: 0; }
table.paper th, table.paper td { padding: 8px 12px; font-size: .9rem; }
table.paper tfoot th { border-top: 2px solid var(--border-strong); border-bottom: 0; font-size: .9rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.paper-time { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 12px; background: #0b1324; color: #fff; text-align: center; padding: 12px; }
.paper-time i { font-size: 1.4rem; color: #93b4ff; }
.paper-time b { font-size: 1.35rem; }
.paper-time span { font-size: .75rem; color: #cbd5e1; }
.sp-warn { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-weak); border: 1px solid #f6dca5; color: #7c3a06; font-size: .9rem; }
.sp-warn i { color: var(--warn); font-size: 1.1rem; margin-top: 2px; }
@media (max-width: 860px) {
  .sp-summary { grid-template-columns: 1fr 1fr; }
  .guide { grid-template-columns: 1fr; }
  .biodata { grid-template-columns: 1fr; justify-items: center; }
  .bio-list { width: 100%; }
  .paper-wrap { grid-template-columns: 1fr; }
  .desk-only { display: none !important; }
}
@media (max-width: 560px) {
  .stepper li { font-size: 0; justify-content: center; padding: 8px; }
  .stepper li span { font-size: .78rem; }
  .stepper li.on { font-size: .8rem; flex: 2; }
  .sp-card { padding: 16px 14px; }
  .bio-list { grid-template-columns: 1fr; }
  .sp-actions .btn { flex: 1 1 100%; }
  .clock-chip small { display: none; }
}

/* Instructions link: header icon on computers, drawer button on phones */
.help-link { min-height: 40px; font-size: .86rem; }
@media (min-width: 901px) { #helpBtn2 { display: none; } }
@media (max-width: 640px) { #helpBtn { display: none; } }
a.icon-btn { text-decoration: none; }

/* =====================================================================
   Student dashboard (syllabus progress + results)
   ===================================================================== */
body.dash-page { background: var(--canvas); font-size: 15px; }
.dash { max-width: 1180px; margin: 0 auto; padding: 18px 18px 48px; }
.dash-nb { margin-left: auto; }
.xh-inner .btn { min-height: 38px; font-size: .84rem; padding: 6px 12px; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; margin-bottom: 16px; }
.dash-profile { display: flex; gap: 18px; align-items: center; background: linear-gradient(120deg, #0f2a5f, #1d4ed8); color: #fff;
  border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow-md); }
.dash-photo { width: 92px; height: 122px; border-radius: 14px; object-fit: cover; object-position: center 30%; border: 3px solid rgba(255,255,255,.85); background: #dbe4f5; flex: none; }
.dash-hello { font-size: .8rem; opacity: .8; }
.dash-who h1 { margin: 2px 0 6px; font-size: 1.45rem; letter-spacing: -.02em; }
.dash-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; opacity: .95; }
.dash-meta i { opacity: .75; margin-right: 3px; }
.dept-pill { padding: 1px 10px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); font-weight: 600; }
.dash-combo { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dash-combo .chip { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.28); }
.dash-exam { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: center; }
.dash-exam h3 { margin: 6px 0 2px; font-size: 1.05rem; }
.dash-exam p { margin: 0 0 12px; font-size: .86rem; }
.ex-live, .ex-done, .ex-idle { display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.ex-live { color: var(--ok); }
.ex-done { color: var(--primary); }
.ex-idle { color: var(--muted); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok-500); box-shadow: 0 0 0 0 rgba(16,185,129,.6); animation: pulse2 1.6s infinite; }
@keyframes pulse2 { 70% { box-shadow: 0 0 0 9px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }
.awaiting { margin-top: 12px; padding: 8px 10px; border-radius: 10px; background: var(--warn-weak); color: var(--warn); font-size: .8rem; }
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr) 1.4fr; gap: 12px; margin-bottom: 16px; }
.dash-stats > div { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-xs); display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.dash-stats i { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-weak); color: var(--primary); }
.dash-stats b { font-size: 1.25rem; letter-spacing: -.02em; }
.dash-stats span { font-size: .74rem; color: var(--muted); }
.dash-stats em { font-style: normal; font-weight: 700; margin-left: 4px; }
.dash-stats em.up { color: var(--ok); }
.dash-stats em.down { color: var(--danger); }
.dash-stats .cov .bar { grid-column: 1 / -1; margin-top: 8px; }
.dash-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 16px; }
.dash-card-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.dash-card h2 { margin: 0; font-size: 1.1rem; display: flex; gap: 8px; align-items: center; }
.dash-card h2 i { color: var(--primary); }
.dash-card-head p { margin: 4px 0 0; font-size: .84rem; }
.legend-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.lv { padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.lv.strong, .t-badge.strong { background: var(--ok-weak); color: var(--ok); }
.lv.fair, .t-badge.fair { background: #e8f0ff; color: #1e40af; }
.lv.weak, .t-badge.weak { background: var(--danger-weak); color: var(--danger); }
.lv.untested, .t-badge.untested { background: var(--soft); color: var(--muted); }
.lv-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.lv-dot.strong { background: #10b981; } .lv-dot.fair { background: #3b82f6; } .lv-dot.weak { background: #ef4444; } .lv-dot.untested { background: #cbd5e1; }
.subj-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.subj-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: .86rem; color: var(--text-2); }
.subj-tab small { color: var(--muted); font-weight: 600; }
.subj-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.subj-tab.on small { color: #dbe6ff; }
.subj-summary { display: grid; grid-template-columns: auto auto 1fr; gap: 18px; align-items: center; padding: 12px; border-radius: 14px; background: var(--soft); margin-bottom: 12px; }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(var(--primary) calc(var(--p) * 1%), #dfe6f2 0); }
.ring b { font-size: 1.1rem; line-height: 1; }
.ring span { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.subj-nums { display: grid; gap: 8px; }
.subj-nums b { display: block; font-size: 1.1rem; }
.subj-nums span { font-size: .74rem; color: var(--muted); }
.lvt.strong { color: var(--ok); } .lvt.fair { color: #1e40af; } .lvt.weak { color: var(--danger); } .lvt.untested { color: var(--muted); }
.subj-filter { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fchip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.fchip b { margin-left: 3px; }
.fchip.on { background: var(--text); border-color: var(--text); color: #fff; }
.topic-group { margin-bottom: 12px; }
.tg-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 6px 4px; }
.topic-row { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 6px; background: #fff; }
.topic-row summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) 160px 52px 104px; gap: 12px; align-items: center; padding: 9px 12px; cursor: pointer; }
.topic-row summary::-webkit-details-marker { display: none; }
.topic-row[open] { box-shadow: var(--shadow-xs); border-color: var(--border-strong); }
.t-title { font-weight: 600; font-size: .9rem; }
.t-title em { font-style: normal; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.t-bar { height: 7px; border-radius: 999px; background: #e9eef5; overflow: hidden; }
.t-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary-600); }
.topic-row.strong .t-bar span { background: #10b981; } .topic-row.fair .t-bar span { background: #3b82f6; } .topic-row.weak .t-bar span { background: #ef4444; }
.t-pct { font-weight: 700; font-size: .86rem; text-align: right; font-variant-numeric: tabular-nums; }
.t-badge { justify-self: end; padding: 2px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.t-more { padding: 0 14px 12px 34px; font-size: .82rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.t-more i { color: var(--muted); }
.t-obj { flex-basis: 100%; }
.t-obj ul { margin: 4px 0 0; padding-left: 18px; }
.res-card { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.res-main { display: flex; gap: 16px; align-items: flex-start; flex: 1; min-width: 280px; }
.res-score { width: 92px; height: 92px; border-radius: 16px; display: grid; place-items: center; align-content: center; flex: none; background: var(--soft); }
.res-score b { font-size: 1.4rem; line-height: 1.1; }
.res-score span { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.res-score.strong { background: var(--ok-weak); color: var(--ok); } .res-score.fair { background: #e8f0ff; color: #1e40af; } .res-score.weak { background: var(--danger-weak); color: var(--danger); }
.res-info h3 { margin: 0; font-size: 1rem; }
.res-info p { margin: 2px 0 6px; font-size: .8rem; }
.res-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .84rem; font-weight: 600; margin-bottom: 8px; }
.res-facts i { color: var(--primary); }
.res-subjects { display: grid; gap: 4px; max-width: 420px; }
.res-subjects > div { display: grid; grid-template-columns: 120px 1fr 52px; gap: 8px; align-items: center; font-size: .78rem; }
.res-subjects b { text-align: right; font-variant-numeric: tabular-nums; }
.res-actions { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.res-actions .btn { min-height: 40px; font-size: .84rem; justify-content: flex-start; }
@media (max-width: 960px) {
  .dash-top { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-stats .cov { grid-column: 1 / -1; }
  .subj-summary { grid-template-columns: auto 1fr; }
  .subj-filter { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .dash { padding: 12px 12px 40px; }
  .dash-profile { padding: 16px; gap: 14px; }
  .dash-photo { width: 72px; height: 96px; }
  .dash-who h1 { font-size: 1.15rem; }
  .xh-inner .btn span { display: none; }
  .topic-row summary { grid-template-columns: auto minmax(0, 1fr) 46px; }
  .topic-row summary .t-bar, .topic-row summary .t-badge { display: none; }
  .t-more { padding-left: 14px; }
  .res-actions { min-width: 0; width: 100%; }
  .res-subjects > div { grid-template-columns: 96px 1fr 44px; }
  .dash-card { padding: 14px; }
}


/* ---------- dashboard: my biodata ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pf-sec { border: 1px solid var(--border, #e2e7ef); border-radius: 12px; padding: 12px 14px; }
.pf-sec h3 { margin: 0 0 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #5b6475); }
.pf-sec dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.pf-sec dt { font-size: .72rem; color: var(--muted, #5b6475); }
.pf-sec dd { margin: 1px 0 0; font-size: .86rem; font-weight: 600; overflow-wrap: anywhere; }
.pf-sec dd.empty { color: #b6bfcc; font-weight: 400; font-style: italic; }
.profile-pct { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted, #5b6475); }
.pp-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, #fff 78%, transparent 80% 100%), conic-gradient(#16a34a calc(var(--p) * 1%), #e5e9f0 0); }
.pp-ring b { font-size: .72rem; color: #0f172a; }
@media (max-width: 760px) { .profile-grid, .pf-sec dl { grid-template-columns: 1fr; } }


/* ---------- dashboard: exam batch ---------- */
.ex-sched, .ex-missed { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 99px; }
.ex-sched { background: #eaf1ff; color: #1d4ed8; }
.ex-missed { background: #fdeaea; color: #c81e1e; }
.slot-box { border: 1px dashed #b9c6dc; border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #f8fafd; }
.slot-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #5b6475; margin-bottom: 6px; }
.slot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot-grid .wide { grid-column: 1 / -1; }
.slot-grid span { display: block; font-size: .72rem; color: #5b6475; }
.slot-grid b { font-size: 1.05rem; }
.cd { margin: 6px 0 2px; font-size: .9rem; }
.cd b { font-variant-numeric: tabular-nums; color: #1d4ed8; }


/* ---------- exam integrity / lockdown ---------- */
body.exam-locked { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.exam-locked textarea, body.exam-locked input, body.copy-allowed { -webkit-user-select: text; user-select: text; }
body.exam-locked img { -webkit-user-drag: none; pointer-events: auto; }
.lock-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .86); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.lock-overlay.hidden { display: none; }
.lock-card { background: #fff; border-radius: 18px; max-width: 520px; width: 100%; padding: 28px 26px 24px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.lock-card h2 { margin: 10px 0 8px; font-size: 1.35rem; }
.lock-card p { margin: 0 0 10px; color: #334155; line-height: 1.5; }
.lock-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
  background: #eaf1ff; color: #1d4ed8; font-size: 1.6rem; }
.lock-icon.warn { background: #fdeaea; color: #c81e1e; }
.lock-count { background: #fff3d6; color: #7a3e06; border-radius: 10px; padding: 8px 10px; font-size: .9rem; }
.lock-small { font-size: .8rem; color: #64748b !important; }
.lock-msg { font-size: 1.05rem; font-weight: 600; background: #f1f5f9; border-radius: 10px; padding: 12px; }
.lock-card .btn-lg { margin-top: 8px; padding: 12px 22px; font-size: 1rem; }
@media print { body.exam-page * { display: none !important; } body.exam-page::after { content: "Printing the exam is not allowed."; display: block; padding: 40px; font: 20px sans-serif; } }


/* ---------- shared comprehension / cloze passage ---------- */
.passage-panel { border: 1px solid var(--border, #e2e7ef); border-left: 4px solid var(--primary, #1d4ed8);
  border-radius: 10px; background: var(--soft, #f7f9fc); margin: 2px 0 14px; overflow: hidden; }
.passage-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border, #e2e7ef); background: #fff; }
.passage-tag { font-weight: 700; font-size: .82rem; color: var(--primary, #1d4ed8); display: inline-flex; gap: 6px; align-items: center; }
.passage-range { font-size: .78rem; color: var(--muted, #5b6475); }
.passage-title { margin: 10px 12px 0; font-size: 1rem; }
/* The passage itself scrolls, so long comprehension/cloze text never pushes the options off-screen. */
.passage-body { max-height: 40vh; overflow-y: auto; padding: 10px 12px 12px; white-space: pre-wrap;
  font-size: calc(.96rem * var(--qs, 1)); line-height: 1.7; color: var(--text, #0f172a); overflow-wrap: anywhere; -webkit-overflow-scrolling: touch; }
.passage-body::-webkit-scrollbar { width: 10px; }
.passage-body::-webkit-scrollbar-thumb { background: #c9d2df; border-radius: 6px; }
body.ts-lg .passage-body, body.ts-md .passage-body { max-height: 46vh; }
@media (max-width: 760px) { .passage-body { max-height: 38vh; } }


/* ---------- webcam proctoring (student) ---------- */
.proctor-badge { position: fixed; left: 12px; bottom: 12px; z-index: 9000; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  background: #fff; border: 1px solid var(--border, #e2e7ef); color: #0f172a; }
.proctor-badge.live { background: #fff5f5; border-color: #f3c0c0; color: #b42318; }
.proctor-badge.off { background: #f1f5f9; color: #475569; }
.proctor-badge.denied { background: #fff3d6; border-color: #f4dca0; color: #7a3e06; cursor: pointer; }
.proctor-badge.starting { color: #475569; }
.proctor-badge .pb-dot { width: 9px; height: 9px; border-radius: 50%; background: #e11d48; animation: pbpulse 1.4s infinite; }
@keyframes pbpulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
#proctorSay { position: fixed; inset: 0; z-index: 9500; display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15,23,42,.55); }
#proctorSay.show { display: flex; }
#proctorSay .ps-card { background: #fff; border-radius: 16px; max-width: 460px; width: 100%; padding: 22px 24px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
#proctorSay .ps-head { font-weight: 700; color: #1d4ed8; display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 8px; }
#proctorSay p { font-size: 1.1rem; line-height: 1.5; margin: 0 0 16px; }
#proctorSay button { padding: 10px 22px; border: 0; border-radius: 10px; background: #1d4ed8; color: #fff; font-size: 1rem; cursor: pointer; }


/* teacher is speaking to this student */
.proctor-badge.talking { background: #eaf1ff; border-color: #c9d9ff; color: #1d4ed8; }
.proctor-badge.talking::after { content: " \00b7 teacher speaking"; }

/* ---------- payments / fees (dashboard) ---------- */
.pay-now { margin-top: 4px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pay-grid > div { background: var(--surface, #fff); border: 1px solid var(--border, #e6e9f0); border-radius: 12px; padding: 10px 12px; }
.pay-grid span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #64748b); }
.pay-grid b { font-size: 1.08rem; }
.pay-bal.warn, .pay-tag.warn { color: var(--warn); }
.pay-bal.err, .pay-tag.err { color: var(--danger); }
.pay-bal.ok, .pay-tag.ok { color: var(--ok); }
.pay-tag { display: inline-block; }
.pay-subh { margin: 16px 0 6px; font-size: .95rem; }
.pay-hist { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border, #eef1f6); flex-wrap: wrap; }
.pay-hist-right { display: flex; align-items: center; gap: 10px; }

/* claim modal */
.pay-modal { position: fixed; inset: 0; background: rgba(8, 19, 36, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.pay-modal.hidden { display: none; }
.pay-modal-box { background: var(--surface, #fff); border-radius: 16px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pay-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border, #e6e9f0); }
.pay-modal-head h3 { margin: 0; font-size: 1.05rem; }
.pm-x { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted, #64748b); }
.pay-modal-body { padding: 16px 18px; }
.pm-field { display: block; margin-bottom: 12px; }
.pm-field > span { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 4px; color: var(--muted, #475569); }
.pm-field input, .pm-field select { width: 100%; padding: 9px 11px; border: 1px solid var(--border, #cbd5e1); border-radius: 10px; font: inherit; background: #fff; }
.pm-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- sign-up / multi-field forms ---------- */
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid2 .wide { grid-column: 1 / -1; }
.field.req > span::after { content: " *"; color: var(--danger); }
.field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border, #cbd5e1); border-radius: 12px;
  font: inherit; background: #fff; color: var(--text, #0b1324);
}
.field select:focus, .field textarea:focus { border-color: var(--primary-600); outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.field input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--border, #cbd5e1); border-radius: 12px; background: #fff; }
@media (max-width: 620px) { .form-grid2 { grid-template-columns: 1fr; } }
.pm-sec { font-weight: 700; font-size: .9rem; margin: 14px 0 6px; color: var(--primary-dark, #1e3a8a); border-bottom: 1px solid var(--border, #e6e9f0); padding-bottom: 4px; }
