/* BaQT v3.0.0 (Quiz & Test by Barderian) — Barderian Enterprises
   Structure: tokens, base, feedback (progress, toasts, modals), controls,
   public site, sign-in, student, exam, staff console, print. */

/* ---------- Tokens ---------- */
/* ---------- Theme tokens ----------
   Three themes × light and dark. <html data-theme="azure|midnight|adire" data-scheme="light|dark">
   is set before the first paint (index.html) and kept in sync by js/core/theme.js.
   Every screen uses only these names; print (slips, booklets) keeps its own fixed light colours. */
:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --pat-size: auto;
  --adire-pattern: radial-gradient(circle at 30px 30px, rgba(255,255,255,.2) 0 6px, transparent 7px), radial-gradient(circle at 90px 90px, rgba(255,255,255,.13) 0 14px, transparent 15px), repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 4px, transparent 4px 24px), repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 4px, transparent 4px 24px);
  color-scheme: light;
}
/* 1 · Azure Pro (default) */
:root, [data-theme="azure"] {
  --brand: #134ed0; --brand-deep: #0c3a9e; --brand-tint: #e9effc; --on-brand: #ffffff; --link: #134ed0; --link-deep: #0c3a9e;
  --navy: #0b1f4a; --ink: #0f1e3d; --ink-2: #33425e; --muted: #56657f;
  --bg: linear-gradient(160deg, #dfe8f8 0%, #eef2f9 45%, #e6edf8 100%); --paper: #f3f5f9; --surface: #ffffff; --surface-2: #f2f6fd; --hover: #f5f8ff;
  --line: #dce2ec; --line-strong: #c4cddc; --track: #e6ebf3; --frame-line: #c9d6ec;
  --ok: #0e7c55; --ok-tint: #e2f3eb; --ok-ink: #0b5c40; --ok-solid: #0e7c55;
  --warn: #8a4b00; --warn-tint: #fcf0dc; --warn-solid: #b45309;
  --bad: #b93427; --bad-tint: #fbe7e4; --bad-ink: #8a2219; --bad-solid: #b93427;
  --accent: #ffb020; --accent-ink: #3a2600; --toast-bg: #0b1f4a;
  --focus: rgba(19, 78, 208, .45); --focus-soft: rgba(19, 78, 208, .14);
  --head-bg: linear-gradient(135deg, #134ed0 0%, #0c3a9e 100%); --head-solid: #134ed0;
  --hero-bg: radial-gradient(circle at 85% -20%, #4f86ff 0%, transparent 45%), linear-gradient(135deg, #134ed0 0%, #0c3a9e 60%, #0a2a73 100%);
  --hero-bg-2: linear-gradient(160deg, #0c3a9e 0%, #0b1f4a 100%);
  --side-bg: linear-gradient(180deg, #134ed0 0%, #0c3a9e 70%, #0a2f80 100%);
  --head-ink: #ffffff; --head-muted: rgba(255, 255, 255, .8); --head-soft: rgba(255, 255, 255, .14); --head-line: rgba(255, 255, 255, .28);
  --head-accent: #bcd2ff; --head-ok: #8ef0c2; --head-bad: #ffd2cc; --head-warn: #ffe08a;
  --side-ink: rgba(255, 255, 255, .9); --side-active-bg: #ffffff; --side-active-ink: #134ed0; --side-active-shadow: 0 4px 14px rgba(0, 0, 0, .15);
  --timer-bg: rgba(0, 0, 0, .28); --timer-ink: #ffffff;
  --shadow: 0 1px 2px rgba(15, 30, 61, .06), 0 8px 24px rgba(15, 30, 61, .06); --shadow-lg: 0 24px 60px rgba(11, 31, 74, .22);
  --frame-shadow: 0 30px 70px -30px rgba(11, 31, 74, .35);
  --theme-color: #134ed0;
}
[data-theme="azure"][data-scheme="dark"] {
  color-scheme: dark;
  --brand: #2f62e0; --brand-deep: #2553c4; --brand-tint: #1b2d57; --on-brand: #ffffff; --link: #8db0ff; --link-deep: #b5ccff;
  --navy: #0a1222; --ink: #eaf0fb; --ink-2: #c3cee6; --muted: #97a6c6;
  --bg: linear-gradient(160deg, #070d19 0%, #0a1222 50%, #0c1630 100%); --paper: #0a1222; --surface: #121d33; --surface-2: #1a2742; --hover: #17233d;
  --line: #2a3a5c; --line-strong: #3a4d74; --track: #26365a; --frame-line: #22314f;
  --ok: #4ade80; --ok-tint: #0f2e22; --ok-ink: #86efac; --ok-solid: #15803d;
  --warn: #fbbf24; --warn-tint: #35290a; --warn-solid: #b45309;
  --bad: #f87171; --bad-tint: #3a1414; --bad-ink: #fca5a5; --bad-solid: #dc2626;
  --toast-bg: #1a2742; --focus: rgba(141, 176, 255, .55); --focus-soft: rgba(141, 176, 255, .2);
  --head-bg: linear-gradient(135deg, #16244a 0%, #0f1b33 100%); --head-solid: #16244a;
  --hero-bg: radial-gradient(circle at 85% -20%, rgba(79, 134, 255, .4) 0%, transparent 45%), linear-gradient(135deg, #1b2d57 0%, #121d33 100%);
  --hero-bg-2: linear-gradient(160deg, #16244a 0%, #0a1222 100%);
  --side-bg: linear-gradient(180deg, #121d33 0%, #0f1b33 100%);
  --head-ink: #eaf0fb; --head-muted: rgba(234, 240, 251, .75); --head-soft: rgba(255, 255, 255, .07); --head-line: rgba(255, 255, 255, .12);
  --head-accent: #8db0ff; --head-ok: #86efac;
  --side-ink: #c3cee6; --side-active-bg: #1b2d57; --side-active-ink: #b5ccff; --side-active-shadow: none;
  --timer-bg: rgba(255, 255, 255, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5); --frame-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8);
  --theme-color: #0f1b33;
}
/* 2 · Midnight Hall */
[data-theme="midnight"] {
  color-scheme: dark;
  --brand: #2563eb; --brand-deep: #1d4ed8; --brand-tint: #13244a; --on-brand: #ffffff; --link: #7db3ff; --link-deep: #a9cbff;
  --navy: #060b1a; --ink: #e6edff; --ink-2: #b4c2e4; --muted: #8593b8;
  --bg: radial-gradient(circle at 50% -10%, #12204a 0%, #060b1a 55%); --paper: #060b1a; --surface: #0b1226; --surface-2: #101a33; --hover: #0f1830;
  --line: #1e2b4d; --line-strong: #2b3b66; --track: #1e2b4d; --frame-line: #1e2b4d;
  --ok: #4ade80; --ok-tint: #0e2a1e; --ok-ink: #86efac; --ok-solid: #15803d;
  --warn: #fbbf24; --warn-tint: #3a2a06; --warn-solid: #b45309;
  --bad: #f87171; --bad-tint: #3a1414; --bad-ink: #fca5a5; --bad-solid: #dc2626;
  --accent: #fbbf24; --accent-ink: #2a1c00; --toast-bg: #101a33;
  --focus: rgba(96, 165, 250, .6); --focus-soft: rgba(96, 165, 250, .22);
  --head-bg: #060b1a; --head-solid: #060b1a;
  --hero-bg: radial-gradient(circle at 85% -20%, rgba(59, 130, 246, .5) 0%, transparent 50%), linear-gradient(135deg, #0f1a3a 0%, #0b1226 100%);
  --hero-bg-2: radial-gradient(circle at 20% 0%, rgba(59, 130, 246, .35) 0%, transparent 50%), #0b1226;
  --side-bg: #0b1226;
  --head-ink: #e6edff; --head-muted: rgba(230, 237, 255, .72); --head-soft: rgba(255, 255, 255, .06); --head-line: #1e2b4d;
  --head-accent: #60a5fa; --head-ok: #86efac; --head-bad: #fca5a5; --head-warn: #fde68a;
  --side-ink: #b4c2e4; --side-active-bg: #13244a; --side-active-ink: #a9cbff; --side-active-shadow: 0 0 18px rgba(59, 130, 246, .35);
  --timer-bg: rgba(96, 165, 250, .14); --timer-ink: #e6edff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6); --frame-shadow: 0 0 0 1px rgba(59, 130, 246, .08), 0 30px 80px -30px rgba(37, 99, 235, .45);
  --theme-color: #060b1a;
}
[data-theme="midnight"][data-scheme="light"] {
  color-scheme: light;
  --brand: #2563eb; --brand-deep: #1d4ed8; --brand-tint: #e3ebfe; --on-brand: #ffffff; --link: #1d4ed8; --link-deep: #1e3a8a;
  --navy: #0a1330; --ink: #0a1330; --ink-2: #2e3a5c; --muted: #56627f;
  --bg: radial-gradient(circle at 50% -10%, #dbe6ff 0%, #f3f6fd 55%); --paper: #f3f6fd; --surface: #ffffff; --surface-2: #f1f4fb; --hover: #eef3fe;
  --line: #d3dcef; --line-strong: #b9c6e2; --track: #e3e9f6; --frame-line: #d3dcef;
  --ok: #0e7c55; --ok-tint: #e2f3eb; --ok-ink: #0b5c40; --ok-solid: #0e7c55;
  --warn: #8a4b00; --warn-tint: #fdefd3;
  --bad: #b93427; --bad-tint: #fbe7e4; --bad-ink: #8a2219; --bad-solid: #b93427;
  --accent: #ffb020; --accent-ink: #3a2600; --toast-bg: #0a1330;
  --focus: rgba(37, 99, 235, .45); --focus-soft: rgba(37, 99, 235, .14);
  --head-bg: linear-gradient(180deg, #ffffff 0%, #eef3fd 100%); --head-solid: #0a1330;
  --hero-bg: radial-gradient(circle at 85% -20%, rgba(37, 99, 235, .28) 0%, transparent 50%), linear-gradient(135deg, #e3ebfe 0%, #f7f9fe 100%);
  --hero-bg-2: radial-gradient(circle at 20% 0%, rgba(37, 99, 235, .22) 0%, transparent 50%), #eef3fd;
  --side-bg: #ffffff;
  --head-ink: #0a1330; --head-muted: #46526f; --head-soft: rgba(10, 19, 48, .05); --head-line: #d3dcef;
  --head-accent: #1d4ed8; --head-ok: #0e7c55; --head-bad: #b93427; --head-warn: #8a4b00;
  --side-ink: #2e3a5c; --side-active-bg: #e3ebfe; --side-active-ink: #1d4ed8; --side-active-shadow: 0 0 14px rgba(37, 99, 235, .18);
  --timer-bg: #e3ebfe; --timer-ink: #0a1330;
  --shadow: 0 1px 2px rgba(10, 19, 48, .06), 0 8px 24px rgba(10, 19, 48, .06); --shadow-lg: 0 24px 60px rgba(10, 19, 48, .2); --frame-shadow: 0 30px 70px -30px rgba(37, 99, 235, .3);
  --theme-color: #f3f6fd;
}
/* 6 · Adire Indigo */
[data-theme="adire"] {
  --brand: #1a2f7a; --brand-deep: #13235c; --brand-tint: #e3e8f7; --on-brand: #ffffff; --link: #1a2f7a; --link-deep: #13235c;
  --navy: #0e1838; --ink: #0e1838; --ink-2: #3a456b; --muted: #5f6478;
  --bg: linear-gradient(160deg, #ede7da 0%, #f6f3ec 50%, #ede7da 100%); --paper: #f6f3ec; --surface: #ffffff; --surface-2: #faf8f3; --hover: #f3efe6;
  --line: #e2dccd; --line-strong: #cfc6b2; --track: #ebe5d6; --frame-line: #ddd5c3;
  --ok: #1f6b3a; --ok-tint: #e1f0e6; --ok-ink: #17532c; --ok-solid: #1f6b3a;
  --warn: #8a4b00; --warn-tint: #fde7c3; --warn-solid: #b45309;
  --bad: #b93427; --bad-tint: #fbe7e4; --bad-ink: #8a2219; --bad-solid: #b93427;
  --accent: #d97706; --accent-ink: #ffffff; --toast-bg: #0e1838;
  --focus: rgba(26, 47, 122, .45); --focus-soft: rgba(26, 47, 122, .14);
  --pat-size: 120px 120px;
  --head-bg: var(--adire-pattern), #1a2f7a; --head-solid: #1a2f7a;
  --hero-bg: var(--adire-pattern), #1a2f7a; --hero-bg-2: var(--adire-pattern), #13235c;
  --side-bg: var(--adire-pattern), #1a2f7a;
  --head-ink: #ffffff; --head-muted: rgba(255, 255, 255, .82); --head-soft: rgba(255, 255, 255, .14); --head-line: rgba(255, 255, 255, .25);
  --head-accent: #fcd9a8; --head-ok: #a7f3d0; --head-bad: #ffd2cc; --head-warn: #fde68a;
  --side-ink: rgba(255, 255, 255, .9); --side-active-bg: #f6f3ec; --side-active-ink: #1a2f7a; --side-active-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  --timer-bg: rgba(14, 24, 56, .55); --timer-ink: #ffffff;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px rgba(40, 30, 10, .06); --shadow-lg: 0 24px 60px rgba(14, 24, 56, .25); --frame-shadow: 0 30px 70px -30px rgba(14, 24, 56, .35);
  --theme-color: #1a2f7a;
}
[data-theme="adire"][data-scheme="dark"] {
  color-scheme: dark;
  --brand: #e9e3d3; --brand-deep: #d9d1bc; --brand-tint: #222d63; --on-brand: #1a2f7a; --link: #b9c6ff; --link-deep: #d3dcff;
  --navy: #0c1230; --ink: #f1efe8; --ink-2: #cdd1ea; --muted: #a3a9cc;
  --bg: linear-gradient(160deg, #090e26 0%, #0c1230 50%, #111a42 100%); --paper: #0c1230; --surface: #151d45; --surface-2: #1b2552; --hover: #19224d;
  --line: #2c3874; --line-strong: #3b4890; --track: #2c3874; --frame-line: #222d63;
  --ok: #6ee7a0; --ok-tint: #12321f; --ok-ink: #a7f3c4; --ok-solid: #15803d;
  --warn: #fbbf24; --warn-tint: #3a2a06;
  --bad: #f87171; --bad-tint: #3a1414; --bad-ink: #fca5a5; --bad-solid: #dc2626;
  --accent: #f59e0b; --accent-ink: #1f1300; --toast-bg: #1b2552;
  --focus: rgba(185, 198, 255, .55); --focus-soft: rgba(185, 198, 255, .2);
  --head-bg: var(--adire-pattern), #162363; --head-solid: #162363;
  --hero-bg: var(--adire-pattern), #162363; --hero-bg-2: var(--adire-pattern), #101845;
  --side-bg: var(--adire-pattern), #101845;
  --head-ink: #f1efe8; --head-muted: rgba(241, 239, 232, .78);
  --side-ink: #cdd1ea; --side-active-bg: #e9e3d3; --side-active-ink: #1a2f7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55); --frame-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8);
  --theme-color: #101845;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; display: flow-root; min-height: 100vh; font: 400 16.5px/1.6 var(--font); color: var(--ink); background: var(--bg); background-attachment: fixed; transition: background-color .3s; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon { flex: none; display: block; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: .01em; }
.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 14px; margin-top: 6px; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }

/* ---------- Spinner & progress ---------- */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; flex: none; opacity: .9; }
.spinner-sm { width: 13px; height: 13px; border-width: 2px; }
.boot .spinner { color: var(--link); width: 24px; height: 24px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Floating layers (loading bar, toasts, dialogs) stay inside the portal frame, never across
   the whole browser window. --frame-x / --frame-y match the frame's side and top margins. */
:root { --frame-x: max(20px, calc((100% - 1280px) / 2)); --frame-y: 20px; }
#progress { position: fixed; top: var(--frame-y); left: var(--frame-x); right: var(--frame-x); height: 4px; z-index: 100; pointer-events: none; border-radius: 22px 22px 0 0; overflow: hidden; }
#progress::before { content: ""; position: absolute; inset: 0 100% 0 0; background: linear-gradient(90deg, var(--brand), var(--link)); box-shadow: 0 0 8px var(--focus); transition: right 8s cubic-bezier(.1, .8, .1, 1), opacity .3s; opacity: 0; }
#progress.active::before { right: 15%; opacity: 1; }
#progress.done::before { right: 0; transition: right .25s ease, opacity .3s .2s; opacity: 0; }

.loading-block { min-height: 50vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.loading-block .spinner { color: var(--link); width: 28px; height: 28px; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; right: calc(var(--frame-x) + 20px); bottom: calc(var(--frame-y) + 20px); z-index: 90; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 14px 18px; font-size: 15.5px; border-radius: var(--r); background: var(--toast-bg); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; transform: translateY(12px); opacity: 0; transition: transform .25s var(--ease), opacity .25s; pointer-events: auto; }
.toast.show { transform: none; opacity: 1; }
.toast .icon { margin-top: 2px; }
.toast-success .icon { color: #6ee0ad; }
.toast-error { background: var(--bad-solid); }
.toast-info .icon { color: #9dbcff; }

/* ---------- Modals ---------- */
.overlay { position: fixed; top: var(--frame-y); bottom: var(--frame-y); left: var(--frame-x); right: var(--frame-x); border-radius: 22px; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(3, 8, 22, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s; }
.overlay.show { opacity: 1; }
.modal { width: 100%; max-height: calc(100vh - 80px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform .22s var(--ease); }
.overlay.show .modal { transform: none; }
.modal-sm { max-width: 440px; } .modal-md { max-width: 620px; } .modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.modal-head h2 { font-size: 22px; font-weight: 700; }
.modal-body { padding: 16px 22px; overflow: auto; }
.modal-text { color: var(--ink-2); }
.modal-text + .field { margin-top: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.is-busy { opacity: 1; cursor: progress; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-deep); }
.btn-success { background: var(--ok-solid); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.92); }
.btn-danger { background: var(--bad-solid); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--link); color: var(--link); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); transition: background-color .15s, color .15s; }
.btn-icon:hover { background: var(--brand-tint); color: var(--link); }
.btn-icon.danger:hover { background: var(--bad-tint); color: var(--bad); }
.text-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--link); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ---------- Form fields ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .select-sm, .search input, .score-input input {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px; color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus, .select-sm:focus, .search input:focus, .score-input input:focus { border-color: var(--link); box-shadow: 0 0 0 3px var(--focus-soft); }
.field input:disabled, .field select:disabled { background: var(--paper); color: var(--muted); }
.field .invalid, input.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(185, 52, 39, .12) !important; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.secret { position: relative; display: block; }
.secret input { padding-right: 46px; font-family: var(--mono); letter-spacing: .08em; }
.secret input::placeholder { font-family: var(--font); letter-spacing: 0; }
.secret-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: var(--r-sm); }
.secret-toggle:hover { color: var(--link); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; user-select: none; }
.toggle input { width: 16px; height: 16px; accent-color: var(--link); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ok-tint); color: var(--ok-ink); margin-top: 14px; }
.callout-error { background: var(--bad-tint); color: var(--bad-ink); }
.callout .icon { margin-top: 3px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-released { background: var(--ok-tint); color: var(--ok); }
.badge-locked { background: var(--warn-tint); color: var(--warn); }
.badge-closed { background: var(--bad-tint); color: var(--bad); }
.badge-draft { background: var(--surface-2); color: var(--muted); }

/* ---------- Public site frame ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px clamp(16px, 3vw, 36px); background: var(--head-bg); background-size: var(--pat-size); color: var(--head-ink); border-bottom: 1px solid var(--head-line); }
.site-head .brand img { background: #fff; border-radius: 50%; padding: 2px; }
.site-head .brand small { color: var(--head-muted); }
.site-head .clock { background: var(--head-soft); border-color: var(--head-line); color: var(--head-ink); }
.site-head .btn-ghost { background: var(--head-soft); border-color: var(--head-line); color: var(--head-ink); }
.site-head .btn-ghost:hover:not(:disabled) { background: var(--head-ink); color: var(--head-solid); border-color: var(--head-ink); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.site-head-end { display: flex; align-items: center; gap: 12px; }
.clock { font-variant-numeric: tabular-nums; font-size: 14.5px; color: var(--ink-2); font-weight: 500; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); white-space: nowrap; }
.site-main { flex: 1; }
.site-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding: 12px clamp(16px, 3vw, 36px); border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 14px; }
.site-foot-links { display: flex; flex-wrap: wrap; gap: 18px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--link); }
.ver { font-family: var(--mono); font-size: 12px; }
.empty-page { max-width: 520px; margin: 12vh auto; padding: 0 20px; display: grid; gap: 14px; justify-items: start; }

/* ---------- Home ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: clamp(32px, 7vh, 84px) clamp(16px, 4vw, 48px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.home h1 { font-size: clamp(34px, 4.3vw, 54px); font-weight: 800; letter-spacing: -.025em; line-height: 1.08; max-width: 15ch; }
.lede { margin-top: 18px; font-size: 19px; color: var(--ink-2); max-width: 46ch; }
.home { position: relative; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--brand-tint); color: var(--link-deep); font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 18px; }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.btn-primary.btn-lg { box-shadow: 0 10px 22px -10px var(--focus); }
.btn-primary.btn-lg:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -10px var(--focus); }
.btn-outline { background: transparent; color: var(--link); border: 2px solid var(--link); }
.btn-outline:hover:not(:disabled) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: #f29f00; }
.trial-strip { display: flex; align-items: center; gap: 14px; max-width: 560px; padding: 12px 14px; margin-bottom: 18px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line-strong); }
.trial-strip > div { flex: 1; min-width: 0; }
.trial-strip b { display: block; font-size: 15.5px; }
.trial-strip small { display: block; color: var(--muted); font-size: 13.5px; }
.trial-badge { flex: none; padding: 4px 10px; border-radius: 8px; background: var(--warn-tint); color: var(--warn); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.home-copy, .logo-float { position: relative; z-index: 1; }
/* Large dotted Barderian mark, bottom left, very faint. */
.dot-mark { color: var(--link); position: absolute; z-index: 0; left: -150px; bottom: -210px; width: 620px; height: 620px; opacity: .11; pointer-events: none; }
.home-links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.chip-demo { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; font-weight: 800 !important; }
.chip-demo.big { display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: 14px; }
.verdict.warn { background: var(--warn-tint); color: var(--warn); }
.demo-mark { position: absolute; z-index: 3; left: 50%; top: 52%; transform: translate(-50%, -50%) rotate(-32deg); font-size: 44pt; font-weight: 800; letter-spacing: .06em; white-space: nowrap; color: rgba(185, 52, 39, .16); border: 2.5mm solid rgba(185, 52, 39, .16); padding: 2mm 8mm; border-radius: 4mm; pointer-events: none; }
.archive-card { display: grid; gap: 12px; align-content: start; }
.archive-card .panel-title { display: flex; align-items: center; gap: 8px; }
.file-btn { position: relative; overflow: hidden; justify-self: start; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slip { break-after: page; }
.slip:last-child { break-after: auto; }
.req-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nav-badge { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-style: normal; font-size: 12.5px; font-weight: 800; display: grid; place-items: center; }
.data td.msg { min-width: 120px; max-width: 220px; font-size: 13.5px; color: var(--ink-2); display: table-cell; }
.data td.msg { overflow: hidden; }

/* Home logo: the vector Barderian mark, gently floating. */
.logo-float { position: relative; justify-self: center; width: min(400px, 100%); aspect-ratio: 1; display: grid; place-items: center; }
.logo-float svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 22px 34px rgba(11, 31, 74, .22)); animation: float 5s ease-in-out infinite; }
.logo-shadow { position: absolute; bottom: -18px; left: 25%; width: 50%; height: 18px; border-radius: 50%; background: radial-gradient(closest-side, rgba(11, 31, 74, .22), transparent); animation: float-shadow 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes float-shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.8); opacity: .55; } }

/* ---------- Services ----------
   Compact horizontal cards so all nine fit on one laptop screen without scrolling.
   Artwork is shown whole (never cropped); its edges are softened because the source
   PNGs themselves are cut off at the edges. */
.site:has(.services) .site-main { display: flex; }
.services { width: 100%; max-width: 1160px; margin: auto; padding: 30px clamp(16px, 3vw, 40px); }
.services-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.services-head h1 { font-size: clamp(28px, 3.2vw, 36px); font-weight: 800; letter-spacing: -.02em; }
.services-head p { margin-top: 2px; color: var(--muted); font-size: 16px; }
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.service { position: relative; display: grid; grid-template-columns: clamp(84px, 7.5vw, 104px) minmax(0, 1fr); align-items: center; gap: 14px; padding: 14px 16px 14px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); cursor: default; outline: none; transition: border-color .15s, box-shadow .2s; }
.service:hover, .service:focus-within, .service:focus { border-color: var(--link); box-shadow: var(--shadow); z-index: 5; }
.service-art { aspect-ratio: 16 / 10; display: grid; place-items: center; background: #fff; border-radius: 10px; }
.service-art img { width: 100%; height: 100%; object-fit: contain; display: block;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 90%, transparent), linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 90%, transparent), linear-gradient(to right, transparent, #000 6%, #000 94%, transparent); mask-composite: intersect; }
.service-body h2 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.service-body p { margin-top: 4px; color: var(--muted); font-size: 14.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Hover (or tap) a service: a larger card with the whole image and full description. */
.service-pop { --tx: -50%; --ty: -50%; position: absolute; z-index: 30; left: 50%; top: 50%; width: 380px; padding: 16px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transform: translate(var(--tx), var(--ty)) scale(.94); transition: opacity .18s, transform .22s var(--ease); }
.service:hover .service-pop, .service:focus .service-pop { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1); }
.service:nth-child(3n + 1) .service-pop { left: 0; --tx: 0; }
.service:nth-child(3n) .service-pop { left: auto; right: 0; --tx: 0; }
.service:nth-child(-n + 3) .service-pop { top: 0; --ty: 0; }
.service:nth-child(n + 7) .service-pop { top: auto; bottom: 0; --ty: 0; }
.service-pop img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; display: block; border-radius: 12px; background: #fff; }
.service-pop h3 { margin-top: 10px; font-size: 19px; font-weight: 800; color: var(--link-deep); }
.service-pop p { margin-top: 6px; font-size: 15px; color: var(--ink-2); line-height: 1.55; }
@media (hover: none) { .service { cursor: pointer; } }

/* ---------- Sign-in ---------- */
.auth { max-width: 960px; margin: clamp(24px, 6vh, 64px) auto; display: grid; grid-template-columns: .85fr 1fr; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-aside { padding: 36px 32px; background: var(--hero-bg); background-size: var(--pat-size); color: var(--head-ink); display: flex; flex-direction: column; gap: 12px; }
.auth-staff .auth-aside { background: var(--hero-bg-2); background-size: var(--pat-size); }
.auth-aside img { background: #fff; border-radius: 50%; padding: 4px; margin-bottom: 10px; }
.auth-aside h2 { font-size: 27px; font-weight: 700; }
.auth-aside p { color: var(--head-muted); }
.auth-steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
.auth-steps li { display: flex; gap: 10px; align-items: flex-start; color: var(--head-ink); font-size: 15.5px; }
.auth-steps .icon { color: var(--head-accent); margin-top: 4px; }
.auth-card { background: var(--surface); padding: 36px clamp(22px, 4vw, 44px); }
.auth-card.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-form { display: grid; gap: 16px; }
.auth-form h1 { font-size: 27px; font-weight: 700; margin-bottom: 4px; }
.auth-form .btn-block { min-height: 52px; margin-top: 4px; font-size: 17px; font-weight: 700; }
.form-alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-tint); color: var(--bad-ink); font-size: 14px; }
.form-alert[hidden] { display: none; }
.form-alert .icon { margin-top: 2px; }
.db-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.db-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.db-status[data-state="checking"] .dot { animation: pulse 1s infinite alternate; }
.db-status[data-state="ok"] .dot { background: var(--ok); }
.db-status[data-state="error"] { color: var(--bad); }
.db-status[data-state="error"] .dot { background: var(--bad); }
@keyframes pulse { to { opacity: .3; } }

/* ---------- Panels (shared) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-title { font-size: 18px; font-weight: 700; }
.panel-title.spaced { margin-top: 22px; margin-bottom: 4px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.details > div { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); }
.details dt { font-size: 14px; color: var(--muted); }
.details dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: break-word; word-break: break-word; }
.details-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: left; }
.details dd.mono { white-space: nowrap; font-size: 14px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: 22px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* ---------- Student profile & result ---------- */
/* Student profile: branded hero + exam card + detail tiles + rules */
.sp { max-width: 1120px; margin: 0 auto; padding: 24px clamp(14px, 3vw, 32px) 40px; }
.sp-hero { position: relative; overflow: hidden; border-radius: 22px; padding: clamp(22px, 3vw, 34px); color: var(--head-ink); background: var(--hero-bg); background-size: var(--pat-size); box-shadow: 0 20px 44px -18px rgba(11, 31, 74, .55); }
.wm { position: absolute; fill: currentColor; pointer-events: none; }
.sp-hero .wm { right: -60px; top: -70px; width: 340px; height: 340px; color: var(--head-soft); animation: spin 60s linear infinite; }
.sp-id { position: relative; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.sp-avatar { width: 96px; height: 96px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 800; background: #fff; color: #134ed0; box-shadow: 0 0 0 6px var(--head-soft); }
.sp-who { flex: 1; min-width: 240px; }
.sp-greet { font-size: 18px; font-weight: 500; color: var(--head-muted); }
.sp-who h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; letter-spacing: -.01em; margin: 2px 0 12px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-chips span { padding: 6px 14px; border-radius: 999px; background: var(--head-soft); border: 1px solid var(--head-line); font-weight: 600; font-size: 15px; white-space: nowrap; }
.sp-logout { background: var(--head-soft); color: var(--head-ink); border: 1px solid var(--head-line); align-self: flex-start; }
.sp-logout:hover { background: var(--head-ink); color: var(--head-solid); }
.sp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; margin-top: 20px; }
.sp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.sp-card h2 { font-size: 22px; font-weight: 800; color: var(--ink); }
.sp-exam { border-top: 6px solid var(--brand); display: grid; gap: 14px; align-content: start; }
.sp-exam h2 { font-size: 25px; }
.sp-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sp-facts div { text-align: center; padding: 14px 6px; border-radius: 14px; background: var(--brand-tint); }
.sp-facts b { display: block; font-size: 30px; font-weight: 800; color: var(--link-deep); line-height: 1.1; }
.sp-facts span { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.sp-note { font-size: 16.5px; color: var(--ink-2); }
.sp-go { min-height: 60px; font-size: 19px; font-weight: 800; border-radius: 12px; }
.sp-go:disabled { background: var(--brand); color: var(--on-brand); opacity: .7; }
.sp-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
.sp-tile { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.sp-tile.wide { grid-column: 1 / -1; }
.sp-tile-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--link); }
.sp-tile > div { min-width: 0; }
.sp-tile dt { font-size: 14px; color: var(--muted); font-weight: 500; }
.sp-tile dd { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; color: var(--muted); font-size: 14.5px; }
.sp-hint .icon { margin-top: 3px; color: var(--warn); }
.sp-rules { grid-column: 1 / -1; }
.sp-rules ol { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sp-rules li { display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: 14px; background: linear-gradient(180deg, var(--brand-tint), var(--surface)); border: 1px solid var(--line); }
.sp-rules li > span { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); }
.sp-rules b { font-size: 16.5px; }
.sp-rules small { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }

/* Public verification */
.verify { max-width: 760px; margin: 0 auto; padding: 32px clamp(14px, 3vw, 32px); }
.verify-card { display: grid; gap: 14px; padding: 28px; }
.verify-card h1 { font-size: 28px; font-weight: 800; }
.verify-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.verify-form .field { flex: 1 1 320px; }
.verify-form input { font-family: var(--mono); text-transform: uppercase; }
.verdict { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 14px; margin-top: 6px; }
.verdict b { display: block; font-size: 19px; }
.verdict.ok { background: var(--ok-tint); color: var(--ok); }
.verdict.bad { background: var(--bad-tint); color: var(--bad); }
.verdict span { color: var(--ink-2); }
.loading-block.small { min-height: 120px; }

.result { max-width: 760px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 32px) 56px; }
.result-card { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 36px clamp(20px, 4vw, 40px); }
.result-card h1 { font-size: 24px; font-weight: 600; margin-top: 10px; }
.result-sub { color: var(--muted); }
.result-card .details { width: 100%; margin-top: 18px; }
.result-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.dial { --score: 0; width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--link) calc(var(--score) * 1%), var(--track) 0); animation: dial-in .9s var(--ease); }
.dial > div { width: 136px; height: 136px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; }
.dial strong { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dial small { color: var(--muted); }
@keyframes dial-in { from { transform: scale(.9); opacity: 0; } }

/* ---------- Exam ---------- */
.exam { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.exam-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(14px, 3vw, 28px); background: var(--head-bg); background-size: var(--pat-size); color: var(--head-ink); border-bottom: 1px solid var(--head-line); }
.exam-bar .exam-title img { background: #fff; border-radius: 50%; padding: 2px; }
.exam-bar .exam-title small, .exam-bar .save-state, .exam-bar .warn-count { color: var(--head-muted); }
.exam-bar .save-state[data-state="saved"] .icon { color: var(--head-ok); }
.exam-bar .save-state[data-state="error"] { color: var(--head-bad); }
.exam-bar .warn-count.has { color: var(--head-warn); }
.exam-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.exam-title strong { display: block; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-title small { display: block; color: var(--muted); font-size: 13px; }
.exam-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.save-state, .warn-count { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.save-state[data-state="saved"] .icon { color: var(--ok); }
.save-state[data-state="error"] { color: var(--bad); }
.warn-count.has { color: var(--warn); font-weight: 600; }
.exam-timer { font-family: var(--mono); font-size: 24px; font-weight: 700; padding: 6px 16px; border-radius: 8px; background: var(--timer-bg); color: var(--timer-ink); font-variant-numeric: tabular-nums; min-width: 96px; text-align: center; }
.exam-timer.low { background: var(--warn-solid); color: #fff; }
.exam-timer.critical { background: var(--bad-solid); color: #fff; animation: pulse .6s infinite alternate; }
.exam-body { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px clamp(14px, 3vw, 32px); display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.exam-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(20px, 3vw, 36px); }
.exam-main.enter .question-text, .exam-main.enter .options { animation: q-in .28s var(--ease); }
@keyframes q-in { from { opacity: 0; transform: translateY(6px); } }
.question-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--link); font-size: 16px; font-weight: 700; }
.question-text { font-size: clamp(22px, 2.5vw, 28px); font-weight: 800; line-height: 1.4; margin: 14px 0 24px; letter-spacing: -.01em; }
.options { display: grid; gap: 12px; }
.option { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 18px; text-align: left; border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--surface); transition: border-color .12s, background-color .12s; }
.option:hover { border-color: var(--link); background: var(--hover); }
.option-key { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); font-weight: 700; font-size: 17px; color: var(--muted); transition: all .15s; }
.option-text { font-size: 18.5px; font-weight: 600; }
.option.selected { border-color: var(--link); background: var(--brand-tint); }
.option.selected .option-key { background: var(--brand); border-color: var(--brand); color: var(--on-brand); animation: pop .25s var(--ease); }
@keyframes pop { 50% { transform: scale(1.15); } }
.exam-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.kbd-hint { color: var(--muted); font-size: 13px; }
.palette-wrap { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; }
.palette-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.palette-head strong { font-size: 18px; }
.palette-head span { color: var(--muted); font-size: 14px; }
.exam-progress { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.exam-progress i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width .3s var(--ease); }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 46vh; overflow: auto; padding: 3px; }
.pal { aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 15px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pal:hover { border-color: var(--link); }
.pal.answered { background: var(--brand-tint); border-color: color-mix(in srgb, var(--link) 50%, transparent); color: var(--link-deep); }
.pal.current { outline: 2px solid var(--link); outline-offset: 1px; }
.palette-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.palette-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-strong); }
.lg-answered { background: var(--brand-tint); border-color: var(--line-strong); }
.lg-current { outline: 2px solid var(--link); outline-offset: 1px; }

/* ---------- Staff console ---------- */
.console { display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.side { display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; background: var(--side-bg); background-size: var(--pat-size); color: var(--side-ink); border-right: 1px solid var(--head-line); overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--head-ink); text-decoration: none; }
.side-brand img { background: #fff; border-radius: 50%; padding: 2px; }
.side-brand strong { display: block; font-size: 19px; font-weight: 800; }
.side-brand small { display: block; font-size: 13px; color: var(--head-muted); }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-foot a, .side-foot button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 600; font-size: 16.5px; border: 0; background: none; text-align: left; width: 100%; transition: background-color .12s, color .12s; }
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--head-soft); color: var(--head-ink); }
.side-nav a.active { background: var(--side-active-bg); color: var(--side-active-ink); font-weight: 700; box-shadow: var(--side-active-shadow); }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 14px; border-top: 1px solid var(--head-line); }
.side-foot small { padding: 8px 12px 0; color: var(--head-muted); font-family: var(--mono); font-size: 11.5px; }
.side-scrim { display: none; }
.console-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.console-head { display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.console-title { flex: 1; min-width: 0; }
.console-title h1 { font-size: 22px; font-weight: 800; color: var(--link-deep); }
.greet { color: var(--muted); font-size: 15px; font-weight: 500; }
.console-tools { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.course-switch { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--muted); }
.course-switch select { border: 0; background: transparent; min-height: 34px; max-width: 260px; font-weight: 600; color: var(--ink); outline: none; }
.course-chip { padding: 6px 12px; border-radius: 999px; background: var(--brand-tint); color: var(--link-deep); font-weight: 600; font-size: 13.5px; font-family: var(--mono); }
#refresh-btn.spinning .icon { animation: spin .8s linear infinite; }
.clock-sm { font-size: 12.5px; padding: 6px 10px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.who-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console-body { flex: 1; overflow-y: auto; padding: 26px 28px 48px; }
.console-body > * + * { margin-top: 18px; }

.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.015em; }
.panel-head p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 2px; }
.stat span { color: var(--muted); font-size: 15px; font-weight: 600; }
.stat b { font-size: 34px; font-weight: 800; color: var(--link-deep); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat b i { font-style: normal; font-size: 16px; color: var(--muted); font-weight: 500; }
.stat small { color: var(--muted); font-size: 13.5px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-top: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.seg { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 0; border-radius: 7px; background: transparent; font-weight: 600; color: var(--ink-2); transition: background-color .15s, color .15s, box-shadow .15s; }
.seg:hover:not(.on) { background: var(--surface); }
.seg.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); cursor: default; }
.seg-locked.on { color: var(--warn); } .seg-released.on { color: var(--ok); } .seg-closed.on { color: var(--bad); }
.seg.is-busy { opacity: .6; pointer-events: none; }
.meter { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width .6s var(--ease); }
.recent { list-style: none; padding: 0; margin: 8px 0 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recent li:last-child { border-bottom: 0; }
.recent b { display: block; font-weight: 600; }
.recent small { color: var(--muted); font-size: 12.5px; }
.recent strong { font-variant-numeric: tabular-nums; }

/* Toolbars, tables, paging */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; min-height: 40px; }
.select-sm { width: auto; min-height: 36px; padding: 6px 10px; }
.filter-tabs { display: flex; gap: 4px; padding: 3px; background: var(--paper); border-radius: 8px; border: 1px solid var(--line); }
.filter-tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 6px; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.filter-tabs button span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.filter-tabs button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .16); color: var(--ink); }
.bulkbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand-tint); border-bottom: 1px solid var(--line); animation: q-in .2s var(--ease); }
.bulkbar[hidden] { display: none; }
.bulkbar > span { font-weight: 600; color: var(--link-deep); }
.bulkbar > div { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.table-wrap { overflow: hidden; }
/* Stacked layout used when a table would not fit its container (no sideways scrolling). */
.table-wrap.stacked table, .table-wrap.stacked tbody { display: block; width: 100%; }
.table-wrap.stacked thead { display: none; }
.table-wrap.stacked tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 18px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table-wrap.stacked td { display: block; padding: 4px 0; border: 0; text-align: left !important; white-space: normal; min-width: 0 !important; }
.table-wrap.stacked td::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.table-wrap.stacked td.col-check::before, .table-wrap.stacked td.col-actions::before { content: none; }
.table-wrap.stacked td.col-actions { width: auto; }
.table-wrap.stacked td.wrap { grid-column: 1 / -1; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 700; font-size: 14.5px; color: var(--ink-2); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.data td.wrap { white-space: normal; min-width: 150px; }
.data td .badge + small { margin-top: 4px; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: var(--hover); }
.data tr.is-current { background: var(--hover); }
.data td small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.data th.num { text-align: right; }
.col-check { width: 44px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--link); }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-actions .btn-icon { width: 32px; height: 32px; }
.q-text { font-weight: 700; font-size: 16.5px; max-width: 70ch; }
.q-options { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; color: var(--ink-2); font-size: 15px; }
.q-options b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; margin-right: 6px; font-size: 11.5px; background: var(--surface-2); color: var(--muted); }
.q-options li.correct { color: var(--ok); font-weight: 600; }
.q-options li.correct b { background: var(--ok-solid); color: #fff; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.pager > div { display: flex; align-items: center; gap: 10px; }
.pager-at { font-variant-numeric: tabular-nums; }
.empty { padding: 48px 20px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.empty strong { font-size: 16px; }
.empty p { color: var(--muted); max-width: 46ch; }
.danger-zone { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.danger-zone summary { padding: 14px 18px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.danger-zone > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 0 18px 18px; }
.danger-zone > div > div { display: grid; gap: 6px; justify-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.danger-zone p { color: var(--muted); font-size: 13.5px; }

.credentials { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; padding: 16px; background: var(--paper); border-radius: var(--r-sm); }
.credentials dt { color: var(--muted); }
.credentials dd { margin: 0; font-family: var(--mono); font-weight: 600; font-size: 16px; }

/* Import dialog */
.import { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.modal-body > * { min-width: 0; }
.dropzone { position: relative; display: grid; justify-items: center; gap: 6px; padding: 28px 20px; border: 2px dashed var(--line-strong); border-radius: var(--r); background: var(--paper); text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone strong { color: var(--ink); }
.dropzone .icon { color: var(--link); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--link); background: var(--brand-tint); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-tint); }
.preview { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 10px; }
.report { display: grid; gap: 16px; }
.report-head { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.report-head.ok .icon { color: var(--ok); }
.report-head.warn .icon { color: var(--warn); }
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.report-stats > div { padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); display: grid; }
.report-stats b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-stats span { color: var(--muted); font-size: 13px; }
.report-stats .bad b { color: var(--bad); }
.report .table-wrap { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }

/* Grouping & scores */
.group-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.group-chip { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.group-chip > span { margin-right: 8px; }
.group-chip b { display: block; font-size: 16px; }
.group-chip small { display: block; color: var(--muted); font-size: 12.5px; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.score-card { display: grid; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.score-card b { display: block; font-size: 16px; }
.score-card small { color: var(--muted); font-size: 13px; }
.score-input { display: flex; gap: 8px; }
.score-input input { min-height: 40px; font-variant-numeric: tabular-nums; }

/* Analytics */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 220px; margin-top: 14px; }
.bar { height: 100%; display: grid; grid-template-rows: auto 1fr auto; align-items: end; justify-items: center; gap: 6px; }
.bar i { width: 100%; max-width: 44px; min-height: 3px; background: var(--brand); border-radius: 6px 6px 2px 2px; animation: rise .6s var(--ease); transform-origin: bottom; }
@keyframes rise { from { transform: scaleY(0); } }
.bar-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-l { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.hbars { display: grid; gap: 10px; margin-top: 14px; }
.hbars > div { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 12px; }
.hbars b { text-align: right; font-variant-numeric: tabular-nums; }
.hbar { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.hbar-label { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 700; font-size: 13px; background: var(--surface-2); }
.grade-A { background: var(--ok-tint); color: var(--ok); }
.grade-B { background: var(--brand-tint); color: var(--link-deep); }
.grade-C { background: var(--surface-2); color: var(--ink-2); }
.grade-D { background: var(--warn-tint); color: var(--warn); }
.grade-F { background: var(--bad-tint); color: var(--bad); }
.top5 { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 10px; }
.top5 li { padding-left: 4px; }
.top5 b { float: right; font-variant-numeric: tabular-nums; }

.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.settings form.panel { display: grid; gap: 16px; justify-items: start; }
.settings .form-grid { width: 100%; }

/* ---------- Centred app frame ----------
   Every screen sits in a centred card (max 1280px) instead of filling the window.
   On phones the frame relaxes to the full width. */
.site, .console, .exam {
  width: min(1280px, calc(100% - 40px));
  margin: 20px auto;
  min-height: calc(100vh - 40px);
  border-radius: 22px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--frame-line);
  box-shadow: var(--frame-shadow);
}
.console { height: calc(100vh - 40px); }
.console-main { height: 100%; }
.exam { background: var(--paper); }

/* Greeting, course bar, notifications */
.greet { margin-bottom: 2px; }
.course-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--link); border-radius: var(--r); }
.course-bar label { font-weight: 700; color: var(--link-deep); }
.course-bar select { min-height: 42px; padding: 6px 12px; border: 1.5px solid var(--line-strong); border-radius: 8px; font-weight: 600; background: var(--surface); max-width: 100%; }
.course-bar span { color: var(--muted); font-size: 14.5px; }
.panel-pad { padding: 18px 20px 6px; }
.segmented-sm { margin-top: 0; padding: 3px; }
.segmented-sm .seg { min-height: 36px; padding: 0 10px; font-size: 14px; }
.mini-meter { display: block; width: 120px; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.mini-meter i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.btn-retake { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-retake:hover:not(:disabled) { background: var(--bad-tint); color: var(--bad); border-color: var(--bad); }
.bell-wrap { position: relative; }
.bell { position: relative; width: 44px; height: 44px; color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 50%; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 99px; background: var(--bad-solid); color: #fff; font-size: 12px; font-weight: 700; display: none; place-items: center; line-height: 21px; }
.bell.has .bell-count { display: grid; }
.bell.has { animation: ring .6s ease 2; }
@keyframes ring { 25% { transform: rotate(14deg); } 50% { transform: rotate(-12deg); } 75% { transform: rotate(6deg); } }
.bell-pop { position: absolute; right: 0; top: 52px; z-index: 40; width: min(340px, 86vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.bell-pop[hidden] { display: none; }
.bell-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bell-head small { color: var(--muted); font-size: 13px; }
#bell-list { list-style: none; margin: 0; padding: 6px 0; max-height: 360px; overflow-y: auto; }
#bell-list li { display: flex; gap: 10px; padding: 10px 16px; align-items: flex-start; }
#bell-list li.unread { background: var(--brand-tint); }
#bell-list li b { display: block; font-size: 15px; }
#bell-list li small { color: var(--muted); font-size: 13.5px; }
#bell-list .bell-empty { color: var(--muted); font-size: 14.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock-sm { display: none; }
}
@media (max-width: 920px) {
  .home { grid-template-columns: 1fr; }
  .home h1 { max-width: none; }
  .logo-float { width: min(300px, 80%); }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; margin-left: 16px; margin-right: 16px; }
  .auth-aside { padding: 26px; }
  .auth-steps { display: none; }
  .sp-grid, .dash-grid, .settings { grid-template-columns: 1fr; }
  .sp-rules ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-body { grid-template-columns: 1fr; }
  .palette-wrap { position: static; }
  .palette { grid-template-columns: repeat(10, 1fr); max-height: none; }
  .console { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.open { transform: none; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(3, 8, 22, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side-scrim.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .console-head { padding: 10px 16px; }
  .console-body { padding: 18px 16px 40px; }
}
@media (max-width: 640px) {
  :root { --frame-x: 0px; --frame-y: 0px; }
  .overlay, #progress { border-radius: 0; }
  body { font-size: 16px; }
  .site, .console, .exam { width: 100%; margin: 0; border-radius: 0; border: 0; min-height: 100vh; box-shadow: none; }
  .console { height: 100vh; }
  .console-head { flex-wrap: wrap; gap: 10px 12px; padding: 10px 14px; }
  .console-title { order: 3; flex-basis: 100%; }
  .console-title h1 { font-size: 20px; }
  .console-tools { margin-left: auto; gap: 8px; }
  .course-chip { display: none; }
  .question-text { font-size: 21px; }
  .option-text { font-size: 17px; }
  .site-head .clock { display: none; }
  .home-actions .btn-lg { flex: 1 1 100%; }
  .trial-strip { flex-wrap: wrap; }
  .dot-mark { width: 420px; height: 420px; left: -120px; bottom: -140px; }
  .service-pop, .service:nth-child(n) .service-pop { left: 0; right: 0; top: 0; bottom: auto; width: auto; --tx: 0; --ty: 0; }
  .service-grid { grid-template-columns: 1fr; }
  .form-grid, .details, .details-3 { grid-template-columns: 1fr; }
  .sp-tiles, .sp-rules ol { grid-template-columns: 1fr; }
  .sp-avatar { width: 72px; height: 72px; font-size: 26px; }
  .exam-bar { flex-wrap: wrap; }
  .exam-title small, .kbd-hint { display: none; }
  .palette { grid-template-columns: repeat(7, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat b { font-size: 24px; }
  .console-tools .btn span { display: none; }
  .course-switch select { max-width: 140px; }
  .q-options { grid-template-columns: 1fr; }
  #toast-root { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
  .toast { max-width: none; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
}

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


/* ---------- BaQT v3: brand, header nav, appearance menu ---------- */
.wordmark { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.wordmark .qt { color: var(--head-accent); }
.brand .wordmark + small { margin-top: 1px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { padding: 8px 12px; border-radius: 999px; color: var(--head-ink); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--head-soft); }
.soon { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .03em; vertical-align: 1px; }
.appearance-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--head-line); background: var(--head-soft); color: var(--head-ink); transition: background-color .15s, transform .15s; }
.appearance-btn:hover { transform: rotate(-12deg); }
.console-tools .appearance-btn, .sp .appearance-btn { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.ap-pop { position: fixed; z-index: 120; width: 340px; padding: 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: ap-in .18s var(--ease); }
@keyframes ap-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.ap-head b { display: block; font-size: 16px; }
.ap-head small { color: var(--muted); font-size: 13px; }
.ap-label { margin: 14px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ap-themes, .ap-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ap-theme { display: grid; gap: 8px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); text-align: left; font-size: 13px; font-weight: 600; }
.ap-sw { display: flex; gap: 4px; }
.ap-sw i { width: 18px; height: 18px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .35); }
.ap-mode { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.ap-theme[aria-pressed="true"], .ap-mode[aria-pressed="true"] { border-color: var(--link); background: var(--brand-tint); color: var(--link-deep); }
.ap-theme:hover, .ap-mode:hover { border-color: var(--link); }

/* ---------- Home art: one markup, three looks ---------- */
.home { overflow: hidden; }
.home-art { position: relative; z-index: 1; justify-self: center; width: min(440px, 100%); aspect-ratio: 1; display: grid; place-items: center; }
.home-art > * { grid-area: 1 / 1; }
.home-art .logo-float { width: 64%; }
.ring { position: relative; width: 100%; height: 100%; border-radius: 50%; pointer-events: none; }
.ring-1 { border: 2px dashed color-mix(in srgb, var(--link) 40%, transparent); animation: spin 40s linear infinite; }
.ring-1 i { display: none; position: absolute; top: -6px; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--link); box-shadow: 0 0 14px var(--link); }
.ring-2 { width: 78%; height: 78%; border: 1.5px solid color-mix(in srgb, var(--link) 25%, transparent); }
.art-panel { display: none; width: 92%; height: 92%; border-radius: 40px; background: var(--hero-bg); background-size: var(--pat-size); box-shadow: var(--shadow-lg); animation: drift 30s linear infinite; }
@keyframes drift { to { background-position: 240px 240px, 240px 240px, 240px 240px, 240px 240px, 0 0; } }
.art-chip { align-self: start; justify-self: end; z-index: 2; display: grid; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13.5px; animation: chip 5s ease-in-out infinite; }
.art-chip b { color: var(--ok); }
.art-chip small { color: var(--muted); }
.art-chip-2 { align-self: end; justify-self: start; animation-delay: 1.5s; }
.art-chip-2 b { color: var(--link); }
@keyframes chip { 50% { transform: translateY(-8px); } }
.grid-floor { display: none; position: absolute; z-index: 0; left: -10%; right: -10%; bottom: -12%; height: 52%; pointer-events: none;
  background-image: linear-gradient(color-mix(in srgb, var(--link) 22%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--link) 22%, transparent) 1px, transparent 1px);
  background-size: 60px 60px; transform: perspective(500px) rotateX(60deg); transform-origin: bottom; animation: floor 3s linear infinite; mask-image: linear-gradient(to top, #000 30%, transparent); -webkit-mask-image: linear-gradient(to top, #000 30%, transparent); }
@keyframes floor { to { background-position: 0 60px; } }
.t-adire { display: none; }
[data-theme="adire"] .t-adire { display: inline; }
[data-theme="adire"] .t-default { display: none; }
/* Midnight Hall: glowing logo, orbiting dot, moving floor */
[data-theme="midnight"] .grid-floor { display: block; }
[data-theme="midnight"] .ring-1 { border: 1px solid color-mix(in srgb, var(--link) 45%, transparent); animation-duration: 14s; }
[data-theme="midnight"] .ring-1 i { display: block; }
[data-theme="midnight"] .ring-2, [data-theme="midnight"] .art-chip { display: none; }
[data-theme="midnight"] .home-art .logo-float svg { animation: float 5s ease-in-out infinite, glow 3s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 46px color-mix(in srgb, var(--brand) 80%, transparent)); } }
[data-theme="midnight"] .home h1 { background: linear-gradient(90deg, var(--ink) 0%, var(--link) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Adire Indigo: pattern panel behind the logo */
[data-theme="adire"] .art-panel { display: block; }
[data-theme="adire"] .ring { display: none; }
[data-theme="adire"] .home-art .logo-float { width: 56%; }
[data-theme="adire"] .home-art .logo-shadow { display: none; }
[data-theme="adire"] .home h1 { color: var(--link-deep); }
[data-theme="adire"] .dot-mark { opacity: .06; }

/* ---------- v3.0.1: each theme gets its own nav bar style ----------
   Azure Pro: blue gradient band, rounded pill links, white active pill (the classic look).
   Midnight Hall: dark glass bar with a glowing edge, spaced capital links, glowing underline and accent rail.
   Adire Indigo: adire-pattern band with an amber stripe, underlined links, cream active tab with an amber notch. */
.console-head { position: relative; }
[data-theme="azure"] .console-head { box-shadow: inset 0 -3px 0 var(--brand); }
[data-theme="azure"][data-scheme="dark"] .console-head { box-shadow: inset 0 -3px 0 var(--link); }

[data-theme="midnight"] .site-head { position: relative; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 0; }
[data-theme="midnight"] .site-head::after, [data-theme="midnight"] .console-head::after, [data-theme="midnight"] .exam-bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--link) 30%, var(--link) 70%, transparent); box-shadow: 0 0 12px var(--link); pointer-events: none; }
[data-theme="midnight"] .exam-bar { position: sticky; }
[data-theme="midnight"] .site-nav a { border-radius: 0; padding: 10px 12px; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); background: none !important; position: relative; }
[data-theme="midnight"] .site-nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--link); box-shadow: 0 0 10px var(--link); transform: scaleX(0); transition: transform .2s var(--ease); }
[data-theme="midnight"] .site-nav a:hover, [data-theme="midnight"] .site-nav a[aria-current="page"] { color: var(--link); text-shadow: 0 0 14px color-mix(in srgb, var(--link) 60%, transparent); }
[data-theme="midnight"] .site-nav a:hover::after, [data-theme="midnight"] .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
[data-theme="midnight"] .site-head .brand .wordmark { letter-spacing: .06em; text-transform: uppercase; }
[data-theme="midnight"] .appearance-btn { border-radius: 50%; border-color: color-mix(in srgb, var(--link) 50%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--link) 35%, transparent); }
[data-theme="midnight"] .console-head { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 0; }
[data-theme="midnight"] .side { border-right: 1px solid var(--line); }
[data-theme="midnight"] .side-nav a { position: relative; border-radius: 8px; font-size: 15.5px; }
[data-theme="midnight"] .side-nav a.active { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 35%, transparent), 0 0 18px color-mix(in srgb, var(--link) 25%, transparent); }
[data-theme="midnight"] .side-nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--link); box-shadow: 0 0 12px var(--link); }
[data-theme="midnight"] .side-group { letter-spacing: .2em; color: var(--link); opacity: .8; }

[data-theme="adire"] .site-head, [data-theme="adire"] .console-head { border-bottom: 0; box-shadow: inset 0 -4px 0 var(--accent); }
[data-theme="adire"] .exam-bar { box-shadow: inset 0 -4px 0 var(--accent); }
[data-theme="adire"] .site-nav a { border-radius: 0; padding: 8px 4px; margin: 0 8px; background: none !important; border-bottom: 3px solid transparent; }
[data-theme="adire"] .site-nav a:hover { border-bottom-color: color-mix(in srgb, var(--accent) 60%, transparent); }
[data-theme="adire"] .site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }
[data-theme="adire"] .appearance-btn { border-radius: 10px 10px 10px 2px; }
[data-theme="adire"] .console-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--head-bg); background-size: var(--pat-size); }
[data-theme="adire"] .console-head { padding-top: 22px; }
[data-theme="adire"] .side-nav a { border-radius: 10px 10px 10px 2px; }
[data-theme="adire"] .side-nav a.active { position: relative; }
[data-theme="adire"] .side-nav a.active::after { content: ""; position: absolute; right: -14px; top: 50%; width: 10px; height: 10px; background: var(--accent); transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
[data-theme="adire"] .side-group { color: #fcd9a8; }
[data-theme="adire"][data-scheme="dark"] .side-group { color: var(--accent); }

/* ---------- Console sidebar groups ---------- */
.side-group { margin: 12px 0 2px; padding: 0 14px; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--head-muted); }
.side-nav .side-group:first-child { margin-top: 0; }
.side-nav a .soon { margin-left: auto; }

/* ---------- BaQT Live (coming soon) ---------- */
.live-soon { max-width: 760px; margin: 0 auto; padding: clamp(32px, 7vh, 72px) clamp(16px, 4vw, 40px); display: grid; gap: 16px; justify-items: start; }
.live-soon h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.live-soon p { font-size: 18px; color: var(--ink-2); max-width: 56ch; }
.live-feats { list-style: none; padding: 0; margin: 6px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.live-feats li { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.live-feats .icon { color: var(--link); }

@media (max-width: 920px) {
  .site-nav a:not(.keep) { display: none; }
  .home-art { width: min(320px, 86%); }
}
@media (max-width: 640px) {
  .ap-pop { left: 10px !important; right: 10px; bottom: 10px; top: auto !important; width: auto; }
  .live-feats { grid-template-columns: 1fr; }
  .art-chip { display: none; }
}

/* ---------- Printable result slip (A4) ----------
   The page itself has no printer margin; the slip is exactly A4 and carries its own
   15 mm margins, so nothing touches the paper edge whatever the browser's margin setting. */
/* Printing: documents are rendered into #print-root, which alone prints.
   The slip uses a named page with no printer margin (it carries its own 16 mm margins);
   the booklet flows on normal A4 pages with 14 mm margins. */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 14mm 13mm; }
  @page slip { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .slip, .bk-page { page: slip; }
}
.slip-page { position: relative; width: 210mm; height: 296mm; padding: 16mm 16mm 14mm; box-sizing: border-box; overflow: hidden; color: #0f1e3d; font-size: 10.5pt; display: flex; flex-direction: column; background: #fff; }
.slip .wm { left: 50%; top: 54%; width: 120mm; height: 120mm; transform: translate(-50%, -50%); color: rgba(19, 78, 208, .045); }
.slip-head { display: grid; grid-template-columns: auto 1fr auto; gap: 5mm; align-items: center; padding-bottom: 3mm; border-bottom: 1mm solid #134ed0; }
.slip-org strong { display: block; font-size: 19pt; font-weight: 800; color: #134ed0; letter-spacing: .02em; line-height: 1.15; }
.slip-org span { display: block; color: #33425e; font-size: 10.5pt; }
.slip-qr { display: grid; justify-items: center; gap: 1mm; }
.slip-qr svg { width: 23mm; height: 23mm; }
.slip-qr small { font-size: 8pt; font-weight: 700; }
.slip-title { margin-top: 3.5mm; padding: 2mm 4mm; background: #134ed0; color: #fff; display: flex; justify-content: space-between; align-items: center; border-radius: 2mm; }
.slip-title b { font-size: 13pt; letter-spacing: .05em; }
.slip-title span { font-size: 10pt; }
.slip-course { margin-top: 3.5mm; text-align: center; }
.slip-course > b { display: block; font-size: 15pt; font-weight: 800; letter-spacing: .02em; }
.slip-course dl { display: flex; justify-content: center; gap: 0; margin: 2mm 0 0; }
.slip-course dl div { padding: 0 5mm; border-left: .3mm solid #c4cddc; }
.slip-course dl div:first-child { border-left: 0; }
.slip-course dt { font-size: 8.5pt; color: #5e6e89; }
.slip-course dd { margin: 0; font-weight: 700; font-size: 10.5pt; }
.slip-serial { margin-top: 3.5mm; display: flex; justify-content: space-between; gap: 4mm; padding: 2.5mm 4mm; border: .4mm dashed #134ed0; border-radius: 2mm; }
.slip-serial .r { text-align: right; }
.slip-serial span { display: block; font-size: 8.5pt; color: #5e6e89; }
.slip-serial b { font-family: var(--mono); font-size: 11.5pt; white-space: nowrap; }
.slip-sec { margin-top: 4.5mm; }
.slip-sec h3 { display: flex; align-items: center; gap: 3mm; font-size: 11pt; color: #134ed0; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 2mm; }
.slip-sec h3 span { padding: .8mm 2.5mm; border-radius: 1mm; background: #134ed0; color: #fff; font-size: 9pt; letter-spacing: .04em; }
.slip table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.slip th, .slip td { text-align: left; padding: 1.8mm 2.5mm; border: .3mm solid #c4cddc; vertical-align: middle; font-size: 10pt; }
.slip th { background: #eef3fd; font-weight: 600; white-space: nowrap; }
.slip td { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-sign { position: relative; margin-top: auto; padding-top: 4mm; display: grid; grid-template-columns: 1fr 1fr 34mm; gap: 8mm; align-items: end; }
.slip-sign-line i { display: block; border-bottom: .4mm solid #0f1e3d; height: 12mm; }
.slip-sign-line span { font-size: 9pt; color: #5e6e89; }
.slip-stamp { justify-self: end; }
.stamp { width: 34mm; height: 34mm; color: #1a3fa8; opacity: .82; transform: rotate(-12deg); mix-blend-mode: multiply; }
.slip-foot { margin-top: 5mm; padding: 3mm 4mm; border-radius: 2mm; background: #0b1f4a; color: #fff; }
.slip-foot p { font-size: 8.5pt; color: #dbe5ff; margin: 0; }
.slip-dev { margin-top: 1.5mm !important; display: flex; flex-wrap: wrap; gap: 1mm 6mm; }
.slip-dev b { color: #fff; font-size: 9.5pt; }

/* Question-and-answer booklet: fixed A4 pages with their own 15 mm margins (like the slip). */
.booklet { color: #0f1e3d; font-family: var(--font); font-size: 10pt; }
.bk-page { position: relative; width: 210mm; height: 296mm; padding: 15mm; box-sizing: border-box; display: flex; flex-direction: column; gap: 3mm; overflow: hidden; background: #fff; break-after: page; }
.bk-page:last-child { break-after: auto; }
.bk-probe { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.bk-probe .bk-m-first, .bk-probe .bk-m-run, .bk-probe .bk-m-foot { display: flex; flex-direction: column; gap: 3mm; }
.bk-cols { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7mm; align-items: start; min-height: 0; }
.bk-col { display: grid; gap: 3mm; align-content: start; }
.bk-run { display: flex; gap: 6mm; align-items: baseline; padding-bottom: 2mm; border-bottom: .6mm solid #134ed0; font-size: 9pt; color: #33425e; }
.bk-run b { color: #0f1e3d; font-size: 10pt; }
.bk-run span:last-child { margin-left: auto; color: #134ed0; font-weight: 700; }
.bk-head { display: grid; grid-template-columns: auto 1fr auto; gap: 4mm; align-items: center; padding-bottom: 3mm; border-bottom: .8mm solid #134ed0; }
.bk-head strong { display: block; font-size: 15pt; font-weight: 800; color: #134ed0; line-height: 1.1; }
.bk-head span { display: block; font-size: 8.5pt; color: #33425e; }
.bk-title { text-align: right; }
.bk-title b { display: block; font-size: 12pt; }
.bk-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2mm 4mm; margin-top: 0; padding: 3mm 4mm; border: .3mm solid #c4cddc; border-radius: 2mm; background: #f5f8fe; }
.bk-info span { display: block; font-size: 7.5pt; color: #5e6e89; }
.bk-info .w2 { grid-column: span 2; }
.bk-info b { display: block; font-size: 9.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-note { margin: 0; font-size: 8.5pt; color: #5e6e89; }
.bk-q { break-inside: avoid; margin: 0; padding: 2.2mm 3mm; border: .3mm solid #d5deec; border-radius: 2mm; }
.bk-qhead { display: grid; grid-template-columns: auto 1fr auto; gap: 2mm; align-items: start; }
.bk-no { min-width: 6mm; height: 6mm; border-radius: 1.5mm; background: #0b1f4a; color: #fff; font-weight: 800; font-size: 8.5pt; display: grid; place-items: center; }
.bk-qhead p { margin: .3mm 0 0; font-weight: 700; font-size: 9.5pt; line-height: 1.35; }
.bk-qhead i { font-style: normal; font-weight: 800; font-size: 12pt; }
.bk-qhead i.ok { color: #0e7c55; } .bk-qhead i.bad { color: #b93427; }
.bk-q ul { list-style: none; margin: 1.8mm 0 0; padding: 0; display: grid; gap: .8mm; }
.bk-q ul li { display: grid; grid-template-columns: 5mm 1fr auto; gap: 1.5mm; align-items: center; padding: .6mm 1.5mm; border-radius: 1.2mm; font-size: 9pt; }
.bk-q ul li b { width: 4.6mm; height: 4.6mm; border-radius: 50%; border: .3mm solid #9aa7bd; display: grid; place-items: center; font-size: 7.5pt; }
.bk-q ul li em { display: inline-block; font-style: normal; font-size: 7pt; font-weight: 700; text-decoration: none; }
.bk-q ul li.mine { background: #e9effc; } .bk-q ul li.mine b { background: #134ed0; border-color: #134ed0; color: #fff; }
.bk-q ul li.ok { background: #e2f3eb; color: #0b5c40; } .bk-q ul li.ok b { background: #0e7c55; border-color: #0e7c55; color: #fff; }
.bk-q ul li.bad { background: #fbe7e4; color: #8a2219; } .bk-q ul li.bad span { text-decoration: line-through; } .bk-q ul li.bad b { background: #b93427; border-color: #b93427; color: #fff; }
.bk-q ul li.bad em { text-decoration: none; }
.bk-skip { display: block; margin-top: 1mm; font-size: 7.5pt; color: #9a5a00; font-weight: 700; }
.bk-foot { display: flex; justify-content: space-between; gap: 4mm; padding-top: 2mm; border-top: .3mm solid #c4cddc; font-size: 7.5pt; color: #5e6e89; }
.bk-foot b { color: #0f1e3d; white-space: nowrap; }
