/* Preptician. Colours come from the logo: deep navy and teal. Mobile first: 16px gutters, 48px touch targets. */

:root {
  --bg: #04111c;
  --bg-2: #071a29;
  --surface: #0b2032;
  --surface-2: #10293e;
  --line: rgba(180, 230, 235, 0.09);
  --line-strong: rgba(180, 230, 235, 0.17);
  --text: #eaf6f7;
  --muted: #9fb6bf;
  --faint: #63808c;
  --accent: #3cc7c4;
  --accent-hi: #8fe3e0;
  --accent-ink: #03202f;
  --danger: #f08a7e;
  --ok: #7fd4a8;
  --radius: 18px;
  --radius-sm: 12px;
  --gutter: 20px;
  --nav-h: 72px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --glass: rgba(4, 17, 28, 0.72);
  --nav-bg: rgba(6, 22, 34, 0.9);
  --toast-bg: #0b2032;
  --toast-ink: #eaf6f7;
  --hover: #12304a;
  --shade: rgba(0, 0, 0, 0.7);
  --wash-1: rgba(0, 151, 154, 0.16);
  --wash-2: rgba(0, 48, 80, 0.45);
}

/* Light theme: paper-white with navy text and teal accents. */
:root[data-theme="light"] {
  --bg: #f3f8f9;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7fbfc;
  --line: rgba(0, 48, 80, 0.09);
  --line-strong: rgba(0, 48, 80, 0.17);
  --text: #03202f;
  --muted: #456170;
  --faint: #7f97a2;
  --accent: #00797b;
  --accent-hi: #00b3b0;
  --accent-ink: #ffffff;
  --danger: #b4493c;
  --ok: #2f7d55;
  --glass: rgba(243, 248, 249, 0.85);
  --nav-bg: rgba(255, 255, 255, 0.94);
  --toast-bg: #03202f;
  --toast-ink: #f3f8f9;
  --hover: #eaf4f6;
  --shade: rgba(0, 32, 48, 0.14);
  --wash-1: rgba(0, 151, 154, 0.12);
  --wash-2: rgba(0, 48, 80, 0.06);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f8f9;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7fbfc;
    --line: rgba(0, 48, 80, 0.09);
    --line-strong: rgba(0, 48, 80, 0.17);
    --text: #03202f;
    --muted: #456170;
    --faint: #7f97a2;
    --accent: #00797b;
    --accent-hi: #00b3b0;
    --accent-ink: #ffffff;
    --danger: #b4493c;
    --ok: #2f7d55;
    --glass: rgba(243, 248, 249, 0.85);
    --nav-bg: rgba(255, 255, 255, 0.94);
    --toast-bg: #03202f;
    --toast-ink: #f3f8f9;
    --hover: #eaf4f6;
    --shade: rgba(0, 32, 48, 0.14);
    --wash-1: rgba(0, 151, 154, 0.12);
    --wash-2: rgba(0, 48, 80, 0.06);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(0, 151, 154, 0.10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(120, 140, 255, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
a { color: var(--accent); }

/* ---------- Top bar ---------- */
#bar { position: sticky; top: 0; z-index: 20; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) var(--gutter) 14px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: 0.2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: #ffffff url("/icons/logo-mark.png") center / 82% no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: transparent; font-size: 0;
}
.topbar-end { font-size: 13px; color: var(--muted); }

/* ---------- Page layout ---------- */
.page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px var(--gutter) calc(var(--nav-h) + env(safe-area-inset-bottom) + 40px);
  animation: rise 0.45s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.eyebrow { font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; font-weight: 600; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.12; letter-spacing: -0.4px; margin: 0 0 12px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.2; margin: 0; }
p { margin: 0; }
.lead { color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.spacer { height: 18px; }

/* ---------- Surfaces ---------- */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 12px 20px;
  border-radius: 14px; border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent-hi), var(--accent));
  color: var(--accent-ink); font-weight: 600; font-size: 16px; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
  box-shadow: 0 10px 30px -12px rgba(0, 151, 154, 0.55);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.quiet { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.small { min-height: 40px; font-size: 14px; padding: 8px 14px; width: auto; }
.link {
  background: none; border: 0; color: var(--muted); cursor: pointer; min-height: 44px; padding: 8px;
  text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: var(--text); }

.provider {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--text); font-weight: 500; font-size: 16px; cursor: pointer; text-align: left;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.provider:hover { background: var(--hover); border-color: var(--line-strong); }
.provider:active { transform: scale(.99); }
.provider .ico { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; }
.provider .label { flex: 1; }
.provider .arrow { color: var(--faint); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field > span { font-size: 13.5px; color: var(--muted); }
input, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line-strong); border-radius: 12px;
  outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 151, 154, 0.14); }
textarea { resize: none; }
.msg { min-height: 1.3em; color: var(--danger); font-size: 14px; margin-top: 6px; }
.msg.ok { color: var(--ok); }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 18px; }
.seg button {
  min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font-weight: 600; cursor: pointer; transition: all .2s ease;
}
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.35); }

/* ---------- Auth ---------- */
.auth-hero { text-align: center; padding-top: 8px; }
.auth-hero .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; margin: 0 auto 18px; }
.auth-stack { display: grid; gap: 12px; margin-top: 30px; }
.auth-foot { margin-top: 26px; text-align: center; color: var(--faint); font-size: 13px; }

.price-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: rgba(0, 151, 154, 0.1); border: 1px solid rgba(0, 151, 154, 0.25); color: var(--accent-hi); font-size: 13.5px;
}

/* ---------- Tests ---------- */
.test-card { display: grid; gap: 14px; }
.test-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12.5px; padding: 5px 10px; border-radius: 999px; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--muted);
}
.resume { border-color: rgba(0, 151, 154,0.35); }

/* ---------- Runner ---------- */
.runner-head {
  position: sticky; top: 64px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 calc(var(--gutter) * -1) 6px; padding: 14px var(--gutter);
  background: var(--glass); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.clock { font-family: var(--serif); font-size: 26px; color: var(--accent-hi); font-variant-numeric: tabular-nums; }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width .4s ease; }
.qnum { font-size: 12.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.qtext { font-size: 17.5px; line-height: 1.5; margin: 6px 0 16px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 12px 16px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg-2); cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.option:hover { border-color: rgba(0, 151, 154,.45); }
.option input { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: 0 0 18px; accent-color: var(--accent); padding: 0; box-shadow: none; }
.option:has(input:checked) { border-color: var(--accent); background: rgba(0, 151, 154,.08); }
.submit-bar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); margin-top: 22px; }

.score { font-family: var(--serif); font-size: 56px; color: var(--accent-hi); line-height: 1; margin: 6px 0 4px; }

/* ---------- Tutor ---------- */
.chat { display: grid; gap: 10px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.bubble { max-width: 86%; padding: 11px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.bubble.user { justify-self: end; background: linear-gradient(135deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.assistant { justify-self: start; background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }
.composer .btn { width: auto; min-width: 84px; min-height: 50px; }

/* ---------- Plans ---------- */
.plan-hero { position: relative; overflow: hidden; }
.plan-hero::after {
  content: ""; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 151, 154,.25), transparent); pointer-events: none;
}
.price { font-family: var(--serif); font-size: 52px; line-height: 1; color: var(--accent-hi); margin: 14px 0 4px; }
.price small { font-family: var(--sans); font-size: 16px; color: var(--muted); }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.feature-list li { display: flex; gap: 10px; color: var(--muted); }
.feature-list li::before { content: "✓"; color: var(--accent); font-weight: 700; }
.coupon-code {
  display: inline-block; font-family: ui-monospace, Menlo, monospace; letter-spacing: 2px; font-size: 18px;
  padding: 8px 14px; border-radius: 10px; background: var(--bg-2); border: 1px dashed rgba(0, 151, 154,.45); color: var(--accent-hi);
}

/* ---------- Account ---------- */
.avatar {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: 0 0 64px;
  background: linear-gradient(140deg, var(--accent-hi), var(--accent)); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--serif); font-size: 24px; font-weight: 600;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.kv { display: grid; gap: 14px; }
.kv div { display: grid; gap: 2px; }
.kv span { font-size: 12.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .8px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--nav-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bottomnav button {
  display: grid; justify-items: center; gap: 4px; min-height: 56px; border: 0; background: none;
  color: var(--faint); font-size: 11.5px; font-weight: 500; cursor: pointer; border-radius: 12px; transition: color .2s ease;
  white-space: nowrap; min-width: 0;
}
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav button[aria-current="page"] { color: var(--accent-hi); }
.bottomnav button[aria-current="page"] svg { filter: drop-shadow(0 0 8px rgba(0, 151, 154,.45)); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%); z-index: 50; width: min(440px, calc(100% - 32px));
  padding: 14px 18px; border-radius: 14px; background: var(--toast-bg); border: 1px solid var(--line-strong);
  color: var(--toast-ink); box-shadow: var(--shadow); font-size: 15px; text-align: center;
  animation: rise .3s ease both;
}

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Filters, chips and post cards ---------- */
.filters { display: grid; gap: 12px; margin-bottom: 18px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filter-row select, .filters input[type="search"] {
  width: 100%; min-height: 48px; padding: 10px 12px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line-strong); border-radius: 12px; outline: none; font-size: 15px;
}
.filter-row select:focus, .filters input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 151, 154,.14); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--muted); font-size: 13.5px; cursor: pointer;
}
.chip.on { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--accent-ink); }
.post-list { display: grid; gap: 14px; }
.post-card { cursor: pointer; transition: transform .15s ease, border-color .2s ease; }
.post-card:hover { transform: translateY(-2px); border-color: rgba(0, 151, 154,.4); }
.post-card .cover { width: 100%; height: 180px; object-fit: cover; border-radius: 12px; margin-bottom: 14px; display: block; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag.accent { color: var(--accent); border-color: rgba(0, 151, 154,.35); }
.post-title { font-family: var(--serif); font-size: 21px; line-height: 1.25; margin: 0 0 8px; }
.author-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); min-width: 0; }
.author-chip img, .author-initial { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px; }
.author-initial { display: grid; place-items: center; background: linear-gradient(140deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.cover.big { width: 100%; height: auto; max-height: 320px; object-fit: cover; border-radius: var(--radius); margin: 14px 0; }
.article { margin-top: 10px; font-size: 17px; line-height: 1.75; }
.article-p { margin: 0 0 18px; color: var(--text); }
.author-card { display: flex; gap: 16px; align-items: flex-start; }
.author-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: 0 0 72px; font-size: 26px; }
.author-card h2 { margin: 2px 0 4px; }
.card.post-card h2 { margin: 0; }
@media (prefers-reduced-motion: reduce) { .post-card { transition: none; } }

/* ---------- Test feel: answers, feedback, results ---------- */
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes pulse-ok { 0% { box-shadow: 0 0 0 0 rgba(0,151,154,.55); } 100% { box-shadow: 0 0 0 16px rgba(0,151,154,0); } }
@keyframes rise-fb { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fall { 0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; } 100% { transform: translateY(105vh) rotate(540deg); opacity: 0; } }

.q-card { animation: card-in .5s cubic-bezier(.2,.7,.2,1) both; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px;
  text-align: left; color: var(--text); font: inherit; font-size: 16px;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 14px; cursor: pointer;
  transition: transform .15s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.opt:hover:not(:disabled) { border-color: var(--accent); transform: translateX(3px); }
.opt:active:not(:disabled) { transform: scale(.985); }
.opt:disabled { cursor: default; }
.opt-key {
  flex: 0 0 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--accent); background: rgba(0,151,154,.12);
}
.opt.chosen { border-color: var(--accent); border-width: 2px; background: rgba(0,151,154,.10); box-shadow: 0 0 0 3px rgba(0,151,154,.12); }
.opt-radio {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 2px solid var(--line-strong); background: var(--surface, #fff);
}
.opt-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .15s ease; }
.opt.chosen .opt-radio { border-color: var(--accent); }
.opt.chosen .opt-radio::after { transform: scale(1); }
.option-hint { margin: 10px 2px 0; }
/* CHSL: the action buttons sit above the question and wrap onto two rows on a phone */
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 12px; }
.top-actions .btn { flex: 1 1 140px; max-width: 220px; min-height: 44px; }
.top-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
/* Pre-test guidelines */
.rules { margin: 8px 0 0 20px; padding: 0; line-height: 1.6; }
.rules li { margin-bottom: 6px; }
.declare { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; cursor: pointer; }
.declare input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 20px; accent-color: var(--accent); }
.pretest-actions { display: flex; justify-content: center; }
.pretest-actions .btn { min-width: 220px; }
.pretest-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.opt.is-correct { border-color: var(--ok); background: rgba(47,125,85,.12); animation: pulse-ok .9s ease-out; }
.opt.is-correct .opt-key { color: var(--ok); background: rgba(47,125,85,.18); }
.opt.is-wrong { border-color: var(--danger); background: rgba(180,73,60,.10); animation: shake .45s ease; }
.opt.is-wrong .opt-key { color: var(--danger); background: rgba(180,73,60,.16); }

.feedback { min-height: 0; }
.feedback.show { animation: rise-fb .35s ease both; margin-top: 14px; padding: 14px 16px; border-radius: 14px; }
.feedback.show.ok { background: rgba(47,125,85,.10); border: 1px solid rgba(47,125,85,.35); }
.feedback.show.no { background: rgba(180,73,60,.08); border: 1px solid rgba(180,73,60,.30); }
.verdict { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.no .verdict { color: var(--danger); }
.explain { margin-top: 6px; color: var(--muted); }

.ring { position: relative; width: 210px; height: 210px; margin: 6px auto 4px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line-strong); stroke-width: 9; }
.ring-arc { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2,.7,.2,1); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-family: var(--serif); font-size: 52px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.ring-of { font-size: 14px; color: var(--muted); margin-top: 4px; }
.result-line { text-align: center; font-family: var(--serif); font-size: 19px; margin: 6px 0 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { display: grid; gap: 2px; justify-items: center; padding: 12px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.stat-v { font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12px; color: var(--muted); }
.review-list { display: grid; gap: 10px; margin-top: 10px; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.review summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; min-height: 40px; }
.review summary::-webkit-details-marker { display: none; }
.review-mark { font-size: 13px; font-weight: 600; }
.review.ok .review-mark { color: var(--ok); }
.review.no .review-mark { color: var(--danger); }
.review[open] { border-color: var(--line-strong); }
.review .qtext { margin: 8px 0 10px; }
.good { color: var(--ok); }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; border-radius: 3px; z-index: 60; pointer-events: none; animation: fall 1.9s ease-in forwards; }

@media (prefers-reduced-motion: reduce) {
  .q-card, .opt.is-correct, .opt.is-wrong, .feedback.show, .confetti { animation: none !important; }
  .ring-arc { transition: none; }
}

/* ---------- Laptop and desktop: use the full screen ---------- */
@media (min-width: 900px) {
  .page { max-width: 1080px; }
  body.has-nav { padding-left: 240px; }
  body.has-nav .bottomnav {
    top: 0; bottom: 0; right: auto; width: 240px;
    grid-template-columns: 1fr; align-content: start; gap: 6px;
    padding: 88px 14px 20px; border-top: 0; border-right: 1px solid var(--line);
  }
  body.has-nav .bottomnav button {
    display: flex; align-items: center; justify-items: unset; gap: 12px;
    min-height: 48px; padding: 0 14px; font-size: 15px; border-radius: 12px; text-align: left;
  }
  body.has-nav .bottomnav button[aria-current="page"] { background: var(--hover); box-shadow: none; }
  body.has-nav .toast { left: calc(50% + 120px); }
  .cards-grid, .post-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .cards-grid > .card, .post-list > .card { margin: 0; }
  .auth-mode {
    display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
    min-height: 82vh; max-width: 1080px;
  }
  .auth-mode .auth-hero { text-align: left; }
  .auth-mode .auth-hero .brand-mark { margin: 0 0 18px; }
  .auth-mode .auth-stack { margin-top: 0; }
  .auth-mode .auth-foot { grid-column: 1 / -1; text-align: left; }
}

@media (min-width: 900px) {
  .cards-grid, .post-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* ---------- Exam picker ---------- */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.exam-choice {
  min-height: 60px; padding: 12px 14px; border-radius: 16px; font: inherit; font-weight: 600; text-align: left;
  background: var(--surface); color: inherit; border: 1px solid var(--line); cursor: pointer;
}
.exam-choice:hover { border-color: var(--accent); }
.exam-choice.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* ---------- Test details and time per question ---------- */
.test-info { margin-top: 4px; }
.test-info summary { cursor: pointer; font-size: 14px; color: var(--accent); }
.test-info p { margin-top: 8px; }
.time-analysis { margin-top: 26px; }
.time-bars { margin-top: 10px; }
.time-row { display: grid; grid-template-columns: 40px 1fr 72px; gap: 10px; align-items: center; margin-top: 8px; font-size: 14px; }
.time-track { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; display: block; }
.time-track > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); }
.time-v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Test mode: the question and nothing else ---------- */
body.exam-mode #bar,
body.exam-mode #nav,
body.exam-mode .bottomnav { display: none !important; }
body.exam-mode,
body.exam-mode.has-nav { padding-left: 0 !important; }
body.exam-mode .toast { left: 50%; }
.q-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.q-nav .btn { margin: 0; }
body.exam-mode .submit-bar { position: static; margin-top: 14px; }
body.exam-mode .submit-bar .btn { width: 100%; }
body.exam-mode .page { padding-top: 0 !important; }
body.exam-mode .runner-head { top: 0; }
.runner-head .small { display: block; margin-top: 2px; }

/* ---------- Test drill-down: breadcrumb and folder cards ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 4px 0 18px; font-size: 14px; }
.crumbs > * + *::before { content: '›'; margin: 0 8px; color: var(--faint); }
.crumb { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--accent); cursor: pointer; }
.crumb.current { color: var(--muted); }
.folder { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.folder:hover { border-color: var(--accent); }

/* ---------- Test screen: fixed text, navigation pinned to the bottom ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.exam-mode { padding-bottom: 104px !important; }
.qnum { font-size: 13px; }
.qtext { font-size: 18px !important; line-height: 1.5; font-weight: 400; font-family: inherit; }
.opt-text { font-size: 16px; font-family: inherit; }
.test-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}
.test-bar-inner { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 10px; }
.test-nav-btn { margin: 0; min-height: 50px; font-size: 15px; }
body.exam-mode .submit-bar, body.exam-mode .q-nav { display: none; }
/* The page's entrance animation leaves a transform behind, which would hold the bottom bar away from the screen edge. */
body.exam-mode .page { animation: none; transform: none; }
.test-nav-btn { white-space: nowrap; font-size: 15px; padding-left: 8px; padding-right: 8px; }
.test-bar-inner { grid-template-columns: 1fr 1.4fr 1fr; }
/* No entrance animation on the question itself, so the text does not move when the next question appears. */
body.exam-mode .q-card { animation: none; }

/* ---------- Mentor notes on the result screen ---------- */
.mentor { margin-top: 26px; }
.mistakes { display: grid; gap: 12px; margin-top: 12px; }
.mistake { margin: 0; }
.focus-list { display: grid; gap: 12px; margin-top: 10px; }
.focus-card { margin: 0; }

/* ---------- Progress charts ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.tile-v { font-family: var(--serif); font-size: 26px; color: var(--accent-hi); font-variant-numeric: tabular-nums; }
.tile-l { font-size: 12.5px; color: var(--muted); }
.chart-card { margin-top: 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line-strong); stroke-width: 1; }
.chart-tick { font-size: 10px; fill: var(--muted); font-family: inherit; }
.chart-line { stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.chart-dot { fill: var(--accent-hi); stroke: var(--surface); stroke-width: 1.5; }
.bar-row { grid-template-columns: minmax(0, 1.25fr) 1.6fr 48px; }
.bar-label { font-size: 13.5px; line-height: 1.3; min-width: 0; }
.slow-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }

/* ---------- Coins ---------- */
.coin-line { margin: 0 0 16px; color: var(--muted); }
.coin-line strong { color: var(--accent-hi); font-weight: 600; }
.tag-cost { border-color: var(--accent); }

/* ---------- Site footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin: 0 auto; padding: 28px var(--gutter) calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); background: var(--bg-2); color: var(--muted); font-size: 14px; }
.footer-inner { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--text); }
.footer-tag, .footer-fine { margin: 0; }
.footer-fine { font-size: 12.5px; color: var(--faint); }
.footer-links { margin: 0; }
.footer-links a, .site-footer a { color: var(--accent-hi); text-decoration: none; }
.social { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.social a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-weight: 500; }
.social a:hover { border-color: var(--accent); }
.social svg { color: var(--accent-hi); }
body.exam-mode .site-footer { display: none; }
@media (min-width: 900px) {
  body.has-nav .site-footer { padding-bottom: 28px; }
}

/* ---------- Outcomes per test ---------- */
.tile-wide { grid-column: 1 / -1; }
.outcome-list { display: grid; gap: 10px; margin-top: 8px; }
.outcome-row { display: grid; gap: 4px; }
.outcome-label { font-size: 13px; color: var(--muted); }
.outcome-bar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; background: var(--line); }
.seg-correct { background: var(--ok, #2f7d55); }
.seg-wrong { background: var(--danger, #b4493c); }
.seg-skip { background: var(--faint, #63808c); opacity: .55; }

/* ---------- Test analysis report ---------- */
.report { margin-top: 18px; }
.report-tiles { margin-bottom: 14px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: 0 0 auto; }
.donut-track { stroke: var(--line); }
.seg-correct-ring { stroke: var(--ok, #2f7d55); }
.seg-wrong-ring { stroke: var(--danger, #b4493c); }
.seg-skip-ring { stroke: var(--faint, #63808c); opacity: .6; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-correct { background: var(--ok, #2f7d55); }
.dot-wrong { background: var(--danger, #b4493c); }
.dot-skip { background: var(--faint, #63808c); opacity: .6; }
.report-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.report-table th, .report-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.report-table tr.st-correct td:nth-child(6) { color: var(--ok, #2f7d55); font-weight: 600; }
.report-table tr.st-incorrect td:nth-child(6) { color: var(--danger, #b4493c); font-weight: 600; }
.report-table tr.st-unattempted td:nth-child(6) { color: var(--muted); }
.clock-wrap { display: flex; flex-direction: column; align-items: flex-end; }

/* ---------- Footer social links, in each brand's own colours ---------- */
.footer-follow { margin: 10px 0 2px; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); }
.social-link { background: var(--surface); color: var(--text) !important; border: 1px solid var(--line-strong); padding: 10px 16px 10px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.social-link svg { flex: 0 0 auto; }
.social-link:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.footer-inner { max-width: 620px; }
/* Four buttons in the test bar: Previous, Save & next, Next section and Submit. */
.test-bar-inner { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.test-bar-inner .test-nav-btn { font-size: 14px; padding-left: 6px; padding-right: 6px; }
.test-bar-inner .test-nav-btn { white-space: normal; line-height: 1.2; min-height: 52px; }
/* Test bar: the four buttons sit in one centred row, on phone and laptop alike. */
.test-bar-inner { display: flex; justify-content: center; align-items: stretch; gap: 10px; max-width: 760px; margin: 0 auto; grid-template-columns: none; }
.test-bar-inner .test-nav-btn { flex: 1 1 0; max-width: 200px; margin: 0; }
@media (min-width: 900px) { .test-bar-inner .test-nav-btn { max-width: 220px; } }

/* ---------- Question palette (SSC-style colours) ---------- */
.runner-body { display: block; }
.runner-side { margin-top: 14px; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px; margin-top: 8px; }
.pal { height: 38px; border: 0; border-radius: 9px; color: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.pal-blue { background: #2563eb; }
.pal-green { background: #16a34a; }
.pal-red { background: #dc2626; }
.pal-yellow { background: #eab308; color: #1b1400; }
.pal.is-current { outline: 3px solid var(--accent-hi); outline-offset: 2px; }
.pal-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.palette-legend { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.mark-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.mark-btn { min-width: 150px; }
@media (min-width: 900px) {
  .runner-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
  .runner-side { margin-top: 0; position: sticky; top: 88px; }
}
/* Para-jumble questions: each numbered sentence on its own line */
.qtext-list { display: grid; gap: 6px; }
.qtext-list .qline { margin: 0; }

/* Test mode: the page does not scroll. The header, progress bar and CHSL action buttons stay on screen,
   and only the question area scrolls. The Previous / Save & next / Submit bar is fixed at the bottom. */
body.exam-mode { height: 100%; overflow: hidden; padding-bottom: 0 !important; }
body.exam-mode #app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.exam-mode .runner-head, body.exam-mode .progress { flex: 0 0 auto; }
body.exam-mode .runner-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: 120px; }
body.exam-mode .top-actions { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0 8px; }
