:root {
  --navy: #0B2545;
  --navy-2: #13315C;
  --navy-3: #1D4E89;
  --gold: #C9A227;
  --gold-soft: #F6EDCF;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --text: #0B2545;
  --muted: #5B6B82;
  --line: #DCE2EB;
  --ok: #1E7F4F;
  --ok-bg: #E3F4EA;
  --warn: #8A5F00;
  --warn-bg: #FFF4D6;
  --bad: #B3261E;
  --bad-bg: #FBE7E5;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 16px; line-height: 1.5; min-height: 100vh; }
a { color: var(--navy-3); }
button, input, select, textarea { font: inherit; }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--navy); color: #fff; }
.boot b { color: var(--gold); font-size: 24px; letter-spacing: .03em; }

/* ---------- top bar ---------- */
.bar { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(11,37,69,.18); }
.bar .brand { font-weight: 800; letter-spacing: .03em; font-size: 16px; color: #fff; text-decoration: none; white-space: nowrap; }
.bar .brand span { color: var(--gold); }
.bar .grow { flex: 1; min-width: 0; }
.bar .who { font-size: 13.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar button.link { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13.5px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 18px 16px 60px; }
.narrow { max-width: 440px; }
h1 { font-size: 24px; margin: 4px 0 6px; line-height: 1.25; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border: 0; }
.hero .muted { color: rgba(255,255,255,.75); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { justify-content: space-between; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14.5px; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel] {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font-size: 16px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14.5px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 12px 18px; font-weight: 700; cursor: pointer;
  background: var(--navy); color: #fff; min-height: 46px; text-decoration: none; font-size: 15.5px; }
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.gold:hover { background: #b8931f; }
.btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.secondary:hover { background: #EEF2F8; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: none; color: var(--navy-3); min-height: 40px; padding: 8px 10px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- badges / notes ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #E7EEF8; color: var(--navy-2); }
.badge.gold { background: var(--gold-soft); color: #7a5d0a; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.note { padding: 12px 14px; border-radius: 10px; background: #E7EEF8; margin: 10px 0; font-size: 14.5px; }
.note.ok { background: var(--ok-bg); color: #145c39; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- dashboard ---------- */
.exam-card { display: flex; flex-direction: column; gap: 8px; }
.exam-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.exam-card .actions { margin-top: auto; padding-top: 6px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.instructions li { margin: 6px 0; }

/* ---------- exam ---------- */
.exam-bar { background: var(--navy); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center; box-shadow: 0 2px 10px rgba(11,37,69,.2); }
.exam-bar .title { flex: 1; min-width: 0; }
.exam-bar .title b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-bar .title span { font-size: 12.5px; opacity: .8; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; background: rgba(255,255,255,.12); padding: 6px 12px; border-radius: 8px; min-width: 96px; text-align: center; }
.timer.low { background: var(--gold); color: var(--navy); }
.timer.critical { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .75; } }
@media (prefers-reduced-motion: reduce) { .timer.critical { animation: none; } }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 16px; }
@media (max-width: 900px) { .exam-layout { grid-template-columns: 1fr; padding: 12px; } }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.qnum { font-weight: 800; font-size: 17px; }
.qbody { font-size: 18px; font-weight: 500; white-space: pre-wrap; margin: 6px 0 16px; overflow-wrap: anywhere; }
.passage { background: #F7F9FC; border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; margin-bottom: 12px; font-size: 15.5px; max-height: 320px; overflow: auto; }
.qimg { max-width: 100%; max-height: 360px; display: block; margin: 0 auto 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; font-size: 16.5px; color: var(--text); min-height: 54px; transition: border-color .12s, background .12s; }
.opt:hover:not([disabled]) { border-color: var(--navy-3); background: #F7F9FD; }
.opt .k { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.opt .t { flex: 1; padding-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.opt.sel { border-color: var(--navy); background: #EAF0F8; box-shadow: inset 0 0 0 1px var(--navy); }
.opt.sel .k { background: var(--navy); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.navrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.savestate { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; min-height: 20px; }
.savestate.bad { color: var(--bad); font-weight: 600; }
.palette { position: sticky; top: 76px; }
@media (max-width: 900px) { .palette { position: static; } }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin: 10px 0; }
.pbtn { height: 42px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; color: var(--text); position: relative; font-size: 14.5px; }
.pbtn.ans { background: var(--navy); color: #fff; border-color: var(--navy); }
.pbtn.mark::after { content: ''; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 1px solid #fff; }
.pbtn.cur { outline: 3px solid var(--gold); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1.5px solid var(--line); background: #fff; position: relative; }
.legend i.ans { background: var(--navy); border-color: var(--navy); }
.legend i.mark { background: var(--gold); border-color: var(--gold); border-radius: 50%; }
.subhead { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 8px; }
.reveal { margin-top: 14px; border-left: 4px solid var(--ok); background: var(--ok-bg); padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; }
.reveal.no { border-color: var(--bad); background: var(--bad-bg); }
.kbd { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
@media (max-width: 900px) { .kbd { display: none; } }

/* ---------- results ---------- */
.score-ring { font-size: 46px; font-weight: 900; line-height: 1; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13.5px; }
.stat.ok .v { color: var(--ok); }
.stat.bad .v { color: var(--bad); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--text); }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.review-q { border-left: 5px solid var(--line); }
.review-q.correct { border-left-color: var(--ok); }
.review-q.wrong { border-left-color: var(--bad); }
.review-q.unanswered { border-left-color: var(--gold); }
.answer-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 600; margin: 10px 0 4px; font-size: 15px; }
.explain { background: #F7F9FC; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.explain b { display: block; margin-bottom: 4px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 15px; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-size: 13px; font-weight: 700; }

/* ---------- modal / toast / overlay ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(11,37,69,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; max-width: 460px; width: 100%; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 8px; }
.modal .row { margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 15px; }
.toast.bad { background: var(--bad); }
.overlay { position: fixed; inset: 0; background: rgba(255,255,255,.92); z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 20px; font-size: 18px; font-weight: 700; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--navy); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- UTME subject picker ---------- */
.subj-count { font-weight: 700; margin: 4px 0 10px; color: var(--warn); }
.subj-count.done { color: var(--ok); }
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.subj { display: flex !important; align-items: center; gap: 10px; margin: 0 !important; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 500 !important; min-height: 48px; }
.subj input { width: 20px; height: 20px; flex: none; accent-color: var(--navy); }
.subj .nm { flex: 1; }
.subj.on { border-color: var(--navy); background: #EAF0F8; font-weight: 700 !important; }
.subj.locked { cursor: default; }
.subj.off { opacity: .5; cursor: not-allowed; }
.choose-first { border: 2px solid var(--gold); background: var(--gold-soft); }

/* ---------- subscription ---------- */
.bar a.link { color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; text-decoration: none; }
@media (max-width: 420px) { .bar .who { display: none; } }
.sub-status { border-left: 6px solid var(--gold); }
.sub-status.on { border-left-color: var(--ok); background: var(--ok-bg); }
.plans .plan { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.plan.picked { border: 2px solid var(--gold); box-shadow: 0 4px 16px rgba(201,162,39,.25); }
.price { font-size: 26px; font-weight: 900; color: var(--navy); }
.feats { padding-left: 18px; margin: 8px 0 12px; }
.feats li { margin: 3px 0; }
.bar button.link, .bar a.link { white-space: nowrap; }
