/* Mobile-first and light on slow data: one self-hosted variable font (~40 KB), no images. */
/* Brand typeface: Nunito, a rounded sans-serif close to the PassMark wordmark.
   Self-hosted (SIL Open Font License, see fonts/OFL-Nunito.txt) so it loads fast and works offline. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url(fonts/nunito-latin.woff2) format('woff2-variations'), url(fonts/nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url(fonts/nunito-latin-ext.woff2) format('woff2-variations'), url(fonts/nunito-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Brand palette */
  --brand: #F37021;        /* Primary Sun Orange: fills, buttons, highlights */
  --brand-ink: #A84A0C;    /* darker shade of the orange for text and links on white (5.7:1) */
  --brand-hover: #E5651A;
  --brand-soft: #FFF3EA;   /* orange tint for selected and highlighted areas */
  --brand-line: #FBD3B8;
  --gold: #FDB913;         /* Secondary Warm Gold: accents, streaks, badges */
  --gold-soft: #FFF8E6;
  --gold-ink: #8A5A00;
  --charcoal: #333333;     /* Corporate Charcoal: text and wordmark */
  --on-brand: #1A1A1A;     /* text on orange fills (5.9:1) */
  /* Accent palette (greens): positive states only, never the main action colour */
  --nbs-green-primary: #008542;   /* green text on white (4.7:1) */
  --nbs-green-vibrant: #009739;   /* fills and chart marks */
  --nbs-green-dark: #006633;      /* green text on the light green tint (6.3:1) */
  --nbs-green-light: #e6f4ed;     /* success backgrounds */
  --nbs-accent-lime: #78be20;     /* decoration only: too light for text */
  --nbs-accent-bright: #8dc63f;
  --nbs-bg-surface: #f4f6f8;
  --nbs-border-light: #e2e8f0;
  /* Semantic roles (older names kept so every page picks up the brand) */
  --green: var(--brand-ink);
  --green-dark: #8A3C09;
  --green-soft: var(--brand-soft);
  --blue: var(--brand-ink);
  --ink: var(--charcoal);
  --muted: #555555;
  --line: var(--nbs-border-light);
  --bg: #FFFFFF;           /* Clean Background White */
  --card: #FFFFFF;
  --success: var(--nbs-green-primary);  /* right answers, plans, payments, ticks */
  --success-ink: var(--nbs-green-dark);
  --success-soft: var(--nbs-green-light);
  --surface: var(--nbs-bg-surface);
  --red: #B42318;
  --red-soft: #FDECEA;
  --amber: var(--gold-ink);
  --amber-soft: var(--gold-soft);
  --field-line: #BDBDBD;
  --gold-line: #FCE3A6;
  --success-line: #b7dfc8;
  --red-line: #f4c7c3;
  --track: #F0F0F0;
  --tag-bg: #F2F2F2;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(51, 51, 51, .05), 0 2px 8px rgba(51, 51, 51, .05);
  --shadow-lift: 0 6px 20px rgba(243, 112, 33, .18);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms;
  --t-med: 200ms;
  --tabbar-h: 64px;
  /* Typography: rounded sans to match the wordmark; system fonts as fallback (and for maths symbols Nunito lacks) */
  --font-body: 'Nunito', 'Quicksand', 'Gotham Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: var(--font-body);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 16px/1.55 var(--font-body); color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 1rem 0 .5rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: .25rem 0 .5rem; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 32px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .25rem 0; }
.plain li.test-row { padding: 12px 14px; }
code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: .85em; word-break: break-word; }

/* Top bar */
.topbar { background: var(--card); color: var(--charcoal); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { color: var(--charcoal); letter-spacing: -.2px; font-family: var(--font-display); font-weight: 900; font-size: 1.2rem; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; color: var(--brand); }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav a, .linkbtn { color: var(--charcoal); text-decoration: none; font-size: .95rem; }
.nav a.on { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 3px; text-underline-offset: 8px; font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
main .linkbtn { color: var(--blue); }
.linkbtn.danger { color: var(--red); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.subnav a, .filters a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .9rem; }
.filters a.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out); touch-action: manipulation; background: var(--brand); color: var(--on-brand); border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--brand-hover); }
:focus-visible { outline: 3px solid var(--charcoal); outline-offset: 2px; border-radius: 6px; }

.option:has(input:focus-visible) { outline: 3px solid var(--charcoal); outline-offset: 2px; }
.btn-ghost { background: var(--card); color: var(--brand-ink); border: 2px solid var(--brand); }
.btn-ghost:hover { background: var(--green-soft); }
.btn-light, .nav .btn { background: var(--brand); color: var(--on-brand); }
.btn-light:hover { background: var(--brand-hover); }
.btn-small { padding: 6px 14px; font-size: .9rem; min-height: 40px; }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.narrow { max-width: 480px; margin: 24px auto; }
.grid2, .grid3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid2 > .card, .grid3 > .card { margin: 0; }
.notice { background: var(--gold-soft); border-color: var(--gold-line); }
.ok-card { background: var(--success-soft); border-color: var(--success-line); color: var(--ink); }
.ok-card a { color: var(--success-ink); }
.crumbs { margin: 16px 0 0; font-size: .9rem; color: var(--muted); }

/* Flash */
.flash { padding: 12px 14px; border-radius: 10px; margin: 16px 0 0; border: 1px solid; }
.flash-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success-ink); }
.flash-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.flash-info { background: var(--surface); border-color: var(--line); }

/* Home */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 2rem; margin-top: 0; }
.lead { font-size: 1.1rem; max-width: 40em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.exam-card { display: block; color: inherit; text-decoration: none; }
.exam-card:hover { border-color: var(--brand); }
.exam-card.highlight { border: 2px solid var(--brand); }
.exam-code { display: inline-block; background: var(--brand); color: var(--on-brand); font-weight: 800; letter-spacing: .5px; padding: 2px 10px; border-radius: 6px; }
.steps { padding-left: 1.2rem; }
.steps li { margin: .4rem 0; }
.plan .price { font-size: 1.8rem; font-weight: 800; margin: 4px 0; }

/* Tests */
.test-list { list-style: none; padding: 0; margin: 0; }
.test-row { min-height: 56px; transition: border-color var(--t-fast), background-color var(--t-fast); touch-action: manipulation; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0; color: inherit; text-decoration: none; }
.test-row:hover { border-color: var(--brand); }
.test-row > span:first-child { display: flex; flex-direction: column; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--tag-bg); color: var(--muted); white-space: nowrap; }
.tag-free { background: var(--success-soft); color: var(--success-ink); }
.tag-lock { background: var(--amber-soft); color: var(--amber); }
.tag-score { background: var(--tag-bg); color: var(--charcoal); }
.status-paid { background: var(--success-soft); color: var(--success-ink); }
.status-failed, .status-cancelled { background: var(--red-soft); color: var(--red); }
.status-pending { background: var(--amber-soft); color: var(--amber); }
.facts { list-style: none; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }

.test-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 0 0 10px 10px; padding: 10px 14px; font-size: .9rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.timer-warn { color: var(--amber); }
.timer-low { color: var(--red); }
fieldset.question { border: 1px solid var(--line); }
.question legend { padding: 0; font-weight: 600; margin-bottom: 8px; float: left; width: 100%; }
.question legend + * { clear: both; }
.qnum { color: var(--green); font-weight: 800; }
.qbody { white-space: pre-line; }
.option { transition: border-color var(--t-fast), background-color var(--t-fast); touch-action: manipulation; min-height: 48px; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; cursor: pointer; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.option input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.letter { font-weight: 800; color: var(--muted); min-width: 1.1em; }
.submit-row { position: sticky; bottom: 0; }

/* Results */
.score-row { display: flex; align-items: center; gap: 18px; }
.score-big { font-variant-numeric: tabular-nums; font-size: 3rem; font-weight: 900; color: var(--green); line-height: 1; }
.grade { font-size: 1.6rem; font-weight: 800; }
.bar { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--brand); }
.bar-fill.weak { background: var(--gold); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.review.right { border-left: 5px solid var(--success); }
.review.wrong { border-left: 5px solid var(--red); }
.options-review li { padding: 6px 10px; border-radius: 8px; margin: 3px 0; }
.opt-correct { background: var(--success-soft); }
.opt-wrong { background: var(--red-soft); }
.explain { background: var(--surface); border-radius: 8px; padding: 10px 12px; margin-bottom: 0; }

/* Forms */
.form label { display: block; margin: 10px 0; font-weight: 600; font-size: .95rem; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .searchbar input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 8px; font: inherit; background: var(--card); color: var(--ink); }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form-row { display: grid; gap: 0 12px; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 720px) { .form-row { grid-template-columns: repeat(4, 1fr); } }
.form-row .btn { margin: 10px 0; }
.searchbar { display: flex; gap: 8px; margin: 12px 0; }
.searchbar input { margin: 0; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.card:has(> .table) { overflow-x: auto; }
.stat { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.admin-subject { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.admin-questions li { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 0 10px; }
.admin-questions li > span:first-child { flex: 1 1 100%; }

.footer { border-top: 1px solid var(--line); background: var(--card); padding: 16px 0; }
.footer p { margin: 4px 0; }

/* v2: papers, sections, tiers */
.outof { font-size: 1.3rem; color: var(--muted); font-weight: 700; }
.section-head { margin: 22px 0 6px; padding: 12px 14px; background: var(--brand-soft); border-left: 5px solid var(--brand); border-radius: 8px; }
.section-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.section-head p { margin: 0; font-size: .95rem; }
.section-mini { margin: 20px 0 4px; color: var(--green); }
.instructions { background: var(--surface); border-radius: 8px; padding: 10px 12px; white-space: pre-line; }
.table.compact { margin: 8px 0; max-width: 360px; }
.plan-exam { margin: 0; font-size: .8rem; font-weight: 800; color: var(--green); letter-spacing: .5px; }
.plan .per { font-size: 1rem; font-weight: 600; color: var(--muted); }
.plan-top { border: 2px solid var(--brand); }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.jump a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: .9rem; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; color: var(--ink); }
.subject { scroll-margin-top: 12px; }
details.admin-subject summary { cursor: pointer; padding: 4px 0; }
details.admin-subject[open] { padding-bottom: 8px; }
.legal h2 { font-size: 1.05rem; margin-top: 1.2rem; }
.legal ul { padding-left: 1.2rem; }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 8px 0; }
details.report { margin-top: 8px; }
details.report summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
li.err a { color: var(--red); }
.qimg { display: block; max-width: 100%; height: auto; max-height: 360px; margin: 8px auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.passage { background: var(--gold-soft); border: 1px solid var(--gold-line); border-left: 5px solid var(--gold); border-radius: 10px; padding: 14px 16px; margin: 16px 0 8px; }
.passage h3 { margin: 0 0 8px; font-size: 1rem; }
.passage-body { white-space: pre-line; line-height: 1.65; }
.price-box { background: var(--brand-soft); border-color: var(--brand-line); }
.price-box .price { font-size: 1.8rem; font-weight: 800; }
.strike { text-decoration: line-through; color: var(--muted); }
.joincode { font-size: 2rem; font-weight: 900; letter-spacing: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 4px 0; color: var(--green); }
.codeinput { text-transform: uppercase; letter-spacing: 3px; font-family: ui-monospace, Menlo, Consolas, monospace; }
tr.over td { background: var(--red-soft); }
button[disabled] { opacity: .5; cursor: not-allowed; }
.answerbox { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--field-line); border-radius: 8px; font: inherit; font-size: .95rem; background: var(--card); color: var(--ink); }
.twocol { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .twocol { grid-template-columns: 1fr 1fr; } }
.twocol h4, .question h4 { margin: 8px 0 4px; font-size: .9rem; color: var(--muted); }
.youranswer { white-space: pre-line; background: var(--surface); border-radius: 8px; padding: 10px 12px; min-height: 3em; }
.model { white-space: pre-line; }
.option.point { justify-content: space-between; }
.option.point span:nth-child(2) { flex: 1; }
.status { font-weight: 600; }
.status.off { color: var(--amber); }
.status.on { color: var(--success); }
#offline-app .test-row { cursor: default; }
.secq-box { background: var(--green-soft); border-radius: 8px; padding: 10px 12px; }
[hidden] { display: none !important; }
.challenge-head .code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; color: var(--green); }
.invite { background: var(--surface); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.sharelink { word-break: break-all; }
.btn-whatsapp { background: #1f8f4e; }
.board tr.me td { background: var(--green-soft); font-weight: 600; }
.challenge-box { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.challenge-box summary { cursor: pointer; font-weight: 700; }
.practice-subject summary { cursor: pointer; }
.practice-modes { margin-top: 10px; }
.practice-modes form { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.practice-modes h3 { margin-top: 0; }
.verdict { font-weight: 800; font-size: 1.2rem; margin-top: 0; }
.review.right .verdict { color: var(--success); }
.review.wrong .verdict { color: var(--red); }
.actions-center { justify-content: center; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart { width: 100%; height: auto; display: block; }
.up { color: var(--success); font-size: .8rem; font-weight: 700; }
.down { color: var(--red); font-size: .8rem; font-weight: 700; }
.meter-cell { width: 45%; }
.meter { display: block; height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; }
.meter-fill.weak { background: var(--gold); }
.countdown .big { font-size: 2rem; font-weight: 900; color: var(--green); margin-right: 4px; }
.tasklist .task-subject { margin-top: 12px; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.tasklist .task { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; }
.tasklist .task.done span:last-child { color: var(--muted); text-decoration: line-through; }
.tick { font-weight: 900; color: var(--success); min-width: 1em; }
.subject-picks { border: 1px solid var(--line); border-radius: 8px; columns: 2; }
.subject-picks .pick-group { column-span: all; }
.subject-picks label.check { break-inside: avoid; margin: 4px 0; }
.dash-top { margin-bottom: 8px; }
.dash-top .stat { color: var(--green); }
.small-price { font-size: 1rem; font-weight: 600; }
.promo-bar { max-width: 360px; }
.subject-select { flex: 1; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 8px; font: inherit; background: var(--card); color: var(--ink); }

/* ---- v3: mobile app polish (tab bar, icons, states) ---- */
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.h-icon { width: 1.1em; height: 1.1em; color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lift); }
.skip:focus { top: 8px; }
main:focus { outline: none; }
a, button, summary, label.option { touch-action: manipulation; }

/* Press feedback: colour/scale only, never layout shifts */
.btn:active { transform: scale(.97); }
.test-row:active, .exam-card:active, .stat-tile:active, .quick a:active, .menu-list a:active, .next-card:active { background: var(--green-soft); }
.option:active { background: var(--brand-soft); }

/* Top bar */
.brand-mark .icon { width: 30px; height: 30px; stroke-width: 2.2; }
.topbar-inner { flex-wrap: nowrap; padding-top: env(safe-area-inset-top); }
.nav { flex-wrap: nowrap; gap: 16px; }
.nav-wide { display: none; gap: 16px; }
.has-tabbar .nav { gap: 10px; }
@media (min-width: 768px) {
  .nav-wide { display: inline-flex; align-items: center; }
  .nav a:not(.btn) { padding: 10px 2px; }
}

/* Bottom tab bar (phones); the top bar carries navigation on wide screens */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(51, 51, 51, .06);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
  color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600; border-radius: 12px; transition: color var(--t-fast); }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a.on { color: var(--green); }
.tabbar a.on .icon { stroke-width: 2.4; }
.tabbar a.on span { position: relative; }
.tabbar a.on span::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 16px; height: 3px; margin-left: -8px; border-radius: 3px; background: var(--brand); }
.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.has-tabbar .submit-row { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.in-test .tabbar { display: none; }
.in-test.has-tabbar { padding-bottom: env(safe-area-inset-bottom); }
.in-test.has-tabbar .submit-row { bottom: 0; }
@media (min-width: 768px) {
  .tabbar { display: none; }
  .has-tabbar { padding-bottom: 0; }
  .has-tabbar .submit-row { bottom: 0; }
}

/* Dashboard */
.greet { margin-top: 20px; }
.next-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit;
  position: relative; overflow: hidden; background: linear-gradient(160deg, #3a3a3a 0%, #262626 100%); color: #fff; border: 0; padding: 24px 20px 20px; box-shadow: 0 6px 20px rgba(51, 51, 51, .22); }
.next-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--brand) 0%, var(--gold) 55%, var(--nbs-accent-lime) 100%); }
.next-card .eyebrow .icon { color: var(--gold); }
.next-card .eyebrow { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; opacity: .9; }
.next-card .next-title { font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
.next-card .next-meta { font-size: .9rem; opacity: .9; margin-bottom: 12px; }
.next-card .btn { background: var(--brand); color: var(--on-brand); }
.next-card:hover .btn { background: var(--brand-hover); }
.next-card:active { background: #262626; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat-tile { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 84px; padding: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.stat-val { display: flex; align-items: center; gap: 4px; font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-val small { font-size: 1rem; color: var(--muted); font-weight: 700; }
.stat-val .icon { width: 24px; height: 24px; color: var(--green); }
.stat-label { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.flame { color: #9A9A9A; }
.flame.lit, .stat-val .flame.lit { color: var(--brand); fill: var(--gold); }
.hint { display: flex; align-items: center; gap: 6px; color: var(--amber); margin: 0 0 8px; }
.upsell { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: var(--gold-soft); border-color: var(--gold-line); }
.upsell-cta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.quick a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink);
  font-size: .82rem; font-weight: 600; text-align: center; line-height: 1.25; }
.quick a .icon { width: 26px; height: 26px; color: var(--green); padding: 6px; box-sizing: content-box; background: var(--green-soft); border-radius: 12px; }

/* Empty states */
.empty { text-align: center; padding: 24px 16px; }
.empty > .icon { width: 40px; height: 40px; color: var(--green); padding: 12px; box-sizing: content-box; background: var(--green-soft); border-radius: 50%; }
.empty p { max-width: 32em; margin: 12px auto; }
.empty-inline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; }
.chip-count { font-size: .75rem; font-weight: 700; background: var(--success-soft); color: var(--success-ink); border-radius: 999px; padding: 1px 7px; }
.jump a.soon { color: var(--muted); }
.jump a.soon .chip-count { background: var(--tag-bg); color: var(--muted); font-weight: 600; }

/* Result */
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { display: block; }
.ring-track { fill: none; stroke: var(--track); stroke-width: 12; }
.ring-fill { fill: none; stroke: var(--nbs-green-vibrant); stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray 600ms var(--ease-out); }
.ring-mid .ring-fill { stroke: var(--brand); }
.ring-low .ring-fill { stroke: var(--gold); }
.ring-text { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 38px; }
.ring-mark { font-size: 2.2rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-out { font-size: 1rem; font-weight: 700; color: var(--muted); }
.grade { font-size: 2rem; line-height: 1.1; }
.best-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--gold-soft); color: var(--gold-ink); border: 1px solid var(--gold-line); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; margin: 12px 0 0; }
.best-badge .icon { color: var(--brand); fill: var(--gold); }
.verdict-line { margin: 12px 0 0; }
.h-tight { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.topics { margin-top: 8px; }
.topic-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.topic-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.topic-name { font-weight: 600; overflow-wrap: anywhere; }
.meter-fill.good { background: var(--nbs-green-vibrant); }
td.num { font-variant-numeric: tabular-nums; }

/* Account menu */
.menu-list { padding: 4px 0; }
.menu-list a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.menu-list a:first-child { border-top: 0; }
.menu-list a > .icon:first-child { color: var(--green); }
.menu-list a span { flex: 1; }
.menu-list .chev { color: #9A9A9A; width: 18px; height: 18px; }
.logout-zone { margin: 24px 0 8px; }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .btn:active { transform: none; }
}

.brand, .nav a, .nav .btn { white-space: nowrap; }
@media (max-width: 400px) { .nav .nav-plans { display: none; } .nav { gap: 12px; } }

/* Typeface details */
button, input, select, textarea { font-family: inherit; }
.btn { font-weight: 800; letter-spacing: .1px; }
.tabbar a { font-weight: 700; }
.stat-val, .ring-mark, .score-big, .timer, .price, td.num, .joincode { font-variant-numeric: tabular-nums lining-nums; }

/* Green accents for progress and success */
.ok-text { color: var(--success); display: flex; align-items: center; gap: 6px; }
.task.done .tick .icon, .ok-card > .icon:first-child { color: var(--success); }
.stat-tile.good .stat-val { color: var(--success); }
.best-badge { border-color: var(--gold-line); }

/* Choosing a mobile money network */
.netpick { border: 0; padding: 0; margin: 8px 0 4px; }
.net-option { align-items: flex-start; }
.form.pay-form label.afri-field { display: none; }
.form.pay-form:has(input[name="network"][value="afrimoney"]:checked) label.afri-field { display: block; }
.pay-wait .empty > .icon { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pay-wait .empty > .icon { animation: none; } }

/* Underlined words in questions, as printed on WAEC papers */
.qbody u { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--brand); }

/* Dial-to-pay page */
.ussd-pay h1 { margin-top: 0; }
.ussd-code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.ussd-code { font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.steps { padding-left: 1.25rem; }
.steps li { margin: 8px 0; line-height: 1.5; }
/* Show the right way to pay for the phone in use (set on the server, corrected in pay.js) */
.ussd-pay[data-platform="android"] .only-ios,
.ussd-pay[data-platform="ios"] .only-android,
.ussd-pay[data-platform="ios"] .only-android-inline,
.ussd-pay[data-platform="other"] .only-ios,
.ussd-pay[data-platform="android"] .only-other,
.ussd-pay[data-platform="ios"] .only-other { display: none; }
/* Any phone that is not an iPhone gets the dial button (feature phones, unusual browsers, "desktop site" mode). */
.steps-tight li { margin: 4px 0; }

/* Help chat */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; }
.bubble p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .who { display: block; font-weight: 700; color: var(--muted); }
.bubble-user { align-self: flex-end; background: var(--brand-soft); border-bottom-right-radius: 4px; }
.bubble-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-owner { align-self: flex-start; background: var(--success-soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

/* Scholarship codes */
.code-big{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:1.4rem;letter-spacing:.08em}
.code-input{font-family:ui-monospace,Menlo,Consolas,monospace;letter-spacing:.1em;text-transform:uppercase;font-size:1.15rem}
.report-text{white-space:pre-wrap;background:var(--surface);padding:12px;border-radius:8px;font-size:.9rem}
.slips-page{background:#fff;color:#111;padding:16px}
.slips-help{font-size:.95rem;margin:0 0 12px}
.slips{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:0}
.slip{border:1px dashed #888;padding:12px 14px;break-inside:avoid;font-size:.85rem;line-height:1.35}
.slip-top{font-size:1rem}
.slip-from{color:#444}
.slip-what{margin-top:4px}
.slip-code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:1.5rem;font-weight:700;letter-spacing:.1em;margin:8px 0;text-align:center;border:2px solid #111;border-radius:6px;padding:4px}
.slip-steps{margin:4px 0 4px 18px;padding:0}
.slip-by{color:#444;font-size:.78rem}
@media print{.no-print{display:none}.slips-page{padding:0}.slips{grid-template-columns:repeat(3,1fr)}}

/* Stream picker on the WASSCE page (Sciences / Arts / Commercial) and grouped subject lists */
.stream-picker { margin: 8px 0 16px; }
.stream-picker .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--brand-line); background: var(--card); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; transition: background-color var(--t-fast) var(--ease-out); }
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.subject-group { margin-top: 24px; }
.subject-group[hidden] { display: none; }
.group-title { border-bottom: 3px solid var(--brand-line); padding-bottom: 6px; }
.group-title .small { font-weight: 400; }
.subject-picks .pick-group { margin: 10px 0 4px; font-weight: 700; color: var(--brand-ink); }
.subject-picks .pick-group:first-of-type { margin-top: 0; }
.subject-picks .pick-hint { font-weight: 400; }

/* Question palette and flags in mock papers */
.bar-right { display: inline-flex; align-items: center; gap: 10px; }
.palette-toggle { min-height: 40px; font-variant-numeric: tabular-nums; }
.palette { position: sticky; top: 56px; z-index: 4; max-height: 60vh; overflow: auto; margin-top: 8px; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.pcell { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 8px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; position: relative; }
.pcell.is-answered { background: var(--success-soft); border-color: var(--success); color: var(--success-ink); }
.pcell.is-flagged { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.pcell.is-flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.pcell:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.palette-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.pk { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--line); vertical-align: middle; }
.pk-answered { background: var(--success-soft); border-color: var(--success); }
.pk-flagged { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
fieldset.question { scroll-margin-top: 72px; }
.flag-btn { float: right; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; margin: -4px 0 6px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; touch-action: manipulation; }
.flag-btn .icon { width: 16px; height: 16px; }
.flag-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.flag-btn:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
fieldset.question.q-flagged { border-left: 4px solid var(--brand); }

/* Review filter, save buttons */
.review-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
a.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
a.chip .chip-count { font-variant-numeric: tabular-nums; }
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.review-head > p { margin-top: 0; }
.save-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.save-btn .icon { width: 16px; height: 16px; }
.save-btn[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-ink); font-weight: 700; }
.save-btn[aria-pressed="true"] .icon { fill: currentColor; }
.save-btn:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.flag-note { color: var(--brand-ink); display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.flag-note .icon { width: 16px; height: 16px; }

/* Quick drill row and the 28-day study calendar */
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.quick-row form { margin: 0; }
.quick-card .quick-row { margin-bottom: 0; }
@media (max-width: 380px) { .quick-row { grid-template-columns: 1fr; } }
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0; margin: 10px 0 6px; list-style: none; max-width: 340px; }
.cal-day { display: inline-block; aspect-ratio: 1; min-width: 14px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.cal-grid .cal-day { width: 100%; }
.cal-day.on { background: var(--gold); border-color: var(--gold); }
.cal-day.today { box-shadow: 0 0 0 2px var(--brand-ink); }
.cal-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; }
.cal-key .cal-day { width: 14px; height: 14px; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: .85rem; font-weight: 700; }

/* ---- Hints, notes on wrong answers, spaced review, toast ---- */
.q-hint { margin: 4px 0 10px; border: 1px dashed var(--gold-line); border-radius: 8px; background: var(--gold-soft); }
.q-hint summary { cursor: pointer; padding: 10px 12px; min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--gold-ink); list-style: none; }
.q-hint summary::-webkit-details-marker { display: none; }
.q-hint p { margin: 0; padding: 0 12px 12px; }
.explain.wrong-note { background: var(--red-soft); border-left: 4px solid var(--red); margin: 8px 0; }
.review-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-left: 4px solid var(--brand); }
.review-card > div { flex: 1 1 220px; }
.review-card .pill { margin-left: 6px; vertical-align: middle; }
.rate-form { margin: 12px 0 24px; }
.rate-q { margin: 0 0 10px; }
.rate-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); max-width: min(92vw, 420px);
  background: var(--charcoal); color: var(--card); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lift); font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out; z-index: 1000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.katex { font-size: 1.08em; }
.qbody .katex-display, .options-review .katex-display { margin: .4em 0; }
.option .katex, .options-review .katex { white-space: nowrap; }
code.math-error { color: var(--red); }

/* ---- Dark mode: follows the phone's setting, or the choice on the Account page ---- */
:root { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --brand-ink: #FF9B5C; --brand-hover: #FF8740; --brand-soft: #3A2416; --brand-line: #6B3A1C;
  --gold-soft: #33290F; --gold-ink: #F5C84C;
  --charcoal: #EDEDED; --muted: #B4B4B4;
  --nbs-green-primary: #4CC38A; --nbs-green-dark: #7FDBAA; --nbs-green-light: #14311F;
  --nbs-bg-surface: #2A2A2A; --nbs-border-light: #3A3A3A;
  --green-dark: #FFB27F;
  --bg: #121212; --card: #1E1E1E;
  --red: #FF7A6E; --red-soft: #3A1A17;
  --field-line: #5A5A5A; --tag-bg: #2E2E2E;
    --gold-line: #5C4A1A; --success-line: #245C3E; --red-line: #6B2A24; --track: #333333;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
  --shadow-lift: 0 6px 20px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-ink: #FF9B5C; --brand-hover: #FF8740; --brand-soft: #3A2416; --brand-line: #6B3A1C;
    --gold-soft: #33290F; --gold-ink: #F5C84C;
    --charcoal: #EDEDED; --muted: #B4B4B4;
    --nbs-green-primary: #4CC38A; --nbs-green-dark: #7FDBAA; --nbs-green-light: #14311F;
    --nbs-bg-surface: #2A2A2A; --nbs-border-light: #3A3A3A;
    --green-dark: #FFB27F;
    --bg: #121212; --card: #1E1E1E;
    --red: #FF7A6E; --red-soft: #3A1A17;
    --field-line: #5A5A5A; --tag-bg: #2E2E2E;
    --gold-line: #5C4A1A; --success-line: #245C3E; --red-line: #6B2A24; --track: #333333;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
    --shadow-lift: 0 6px 20px rgba(0, 0, 0, .55);
  }
}
/* Diagrams are drawn for white paper, so they keep a white background in dark mode. */
.qimg { background: #fff; }
.theme-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
