:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #ebf0f6;
  --text: #0f1b2d;
  --muted: #58687d;
  --border: #dae2eb;
  --primary: #1d4e89;
  --primary-2: #0f9d8a;
  --primary-hover: #153b69;
  --primary-soft: #e6eef8;
  --grad: linear-gradient(135deg, #12355b 0%, #1d4e89 55%, #0f9d8a 100%);
  --correct: #16a34a;
  --correct-soft: #e7f8ee;
  --wrong: #dc2626;
  --wrong-soft: #fdecec;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 26, 46, .05), 0 8px 24px rgba(20, 26, 46, .06);
  --shadow-lg: 0 18px 40px rgba(18, 53, 91, .16);
  --hero-bg: radial-gradient(1200px 400px at 10% -10%, #dbe8f5 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #d9f2ee 0%, transparent 55%),
             #f3f6fa;
}

:root[data-theme="dark"] {
  --bg: #0a1220;
  --surface: #111c2e;
  --surface-2: #172338;
  --text: #e8eef7;
  --muted: #93a3ba;
  --border: #223148;
  --primary: #5aa9e6;
  --primary-2: #34d3b9;
  --primary-hover: #8cc4f0;
  --primary-soft: #112a44;
  --grad: linear-gradient(135deg, #1d4e89 0%, #2b7bbf 55%, #34d3b9 100%);
  --correct: #4ade80;
  --correct-soft: #12301f;
  --wrong: #f87171;
  --wrong-soft: #3a1a1d;
  --warn: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .45);
  --hero-bg: radial-gradient(1200px 400px at 10% -10%, #11294a 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #0e3436 0%, transparent 55%),
             #0a1220;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 46px;
  height: 38px;
  flex: none;
  background: url("../img/logo-mark.png") center / contain no-repeat;  /* the Ansit.pk logo mark; the old check-mark text is hidden */
  color: transparent;
  font-size: 0;
}
:root[data-theme="dark"] .logo-mark { background-color: #fff; background-origin: content-box; border-radius: 9px; padding: 3px; }  /* the logo is navy, so dark pages give it a light tile */
.logo-accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root[data-theme="dark"] .logo-accent { background: none; color: #7de8d6; }  /* the navy end of the gradient disappears on dark headers */
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform .2s;
}
.icon-btn:hover { transform: rotate(-12deg) scale(1.05); }

/* ---------- Hero ---------- */
.hero {
  background: var(--hero-bg);
  padding: 64px 0 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .18;
  pointer-events: none;
}
.hero::before { width: 220px; height: 220px; background: #1d6fa5; top: 40px; left: -60px; }
.hero::after { width: 260px; height: 260px; background: #0f9d8a; bottom: -120px; right: -60px; }
.hero .container { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  margin: 0 0 14px;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-weight: 800;
}
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin: 0 auto 28px; max-width: 620px; font-size: 1.08rem; }

.search-wrap { position: relative; max-width: 540px; margin: 0 auto; }
.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  opacity: .7;
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 17px 20px 17px 52px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 18%, transparent); }

.stats-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.stat-pill b { color: var(--text); }

/* ---------- Sections & cards ---------- */
.section { margin: 40px 0 48px; --accent: #1d4e89; --accent-soft: #e6eef8; }
.section.accent-1 { --accent: #0f766e; --accent-soft: #e3f4f1; }
.section.accent-2 { --accent: #ea580c; --accent-soft: #fff1e8; }
:root[data-theme="dark"] .section { --accent: #5aa9e6; --accent-soft: #112a44; }
:root[data-theme="dark"] .section.accent-1 { --accent: #2dd4bf; --accent-soft: #0f2f2e; }
:root[data-theme="dark"] .section.accent-2 { --accent: #fb923c; --accent-soft: #3a2213; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.section-head h2 { font-size: 1.35rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.section-head .bar { width: 6px; height: 26px; border-radius: 6px; background: var(--accent); }
.section-head .count {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent, var(--primary));
  opacity: 0;
  transition: opacity .2s;
}
a.card:hover, .card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 45%, var(--border));
  text-decoration: none;
}
.card:hover::before { opacity: 1; }
.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: var(--accent-soft, var(--primary-soft));
  transition: transform .2s;
}
.card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }
.card h3 { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.card .meta { font-size: .85rem; color: var(--muted); margin-top: auto; font-weight: 500; }
.card .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  font-size: .76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.card-go {
  margin-top: auto;
  padding-top: 8px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--accent, var(--primary));
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-go .arrow { transition: transform .2s; }
.card:hover .card-go .arrow { transform: translateX(5px); }

.best { font-size: .85rem; font-weight: 700; }
.best.good { color: var(--correct); }
.best.mid { color: var(--warn); }
.best.low { color: var(--wrong); }
.best-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.best-bar > div { height: 100%; border-radius: 999px; background: currentColor; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--grad);
  background-size: 160% 160%;
  background-position: 0% 50%;
  color: #fff;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(18, 53, 91, .25);
  transition: background-position .35s, transform .15s, box-shadow .2s;
}
.btn:hover { background-position: 100% 50%; text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(18, 53, 91, .32); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.outline { background: transparent; color: var(--primary); border-color: var(--primary); box-shadow: none; }
.btn.outline:hover { background: var(--primary-soft); }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--border); }
.btn.sm { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn.light { background: #fff; color: #12355b; box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
.btn.light:hover { background: #eef4fb; }

/* ---------- Page header (exam page) ---------- */
.breadcrumb { font-size: .9rem; color: var(--muted); margin: 26px 0 14px; }
.exam-hero {
  background: var(--grad);
  color: #fff;
  border-radius: 24px;
  padding: 30px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.exam-hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  right: -80px;
  top: -110px;
}
.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; position: relative; z-index: 1; }
.page-title .card-icon { background: rgba(255, 255, 255, .2); }
.page-title h1 { margin: 0; font-size: clamp(1.6rem, 3.8vw, 2.3rem); letter-spacing: -.02em; font-weight: 800; }
.page-desc { color: rgba(255, 255, 255, .88); margin: 0 0 20px; position: relative; z-index: 1; }

.banner {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.banner h3 { margin: 0 0 2px; }
.banner p { margin: 0; color: rgba(255, 255, 255, .85); font-size: .92rem; }

/* ---------- Chapter-wise subject page ---------- */
.lv {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}
.lv.easy { background: var(--correct-soft); color: var(--correct); }
.lv.medium { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); }
.lv.hard { background: var(--wrong-soft); color: var(--wrong); }

.level-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.level-label { font-weight: 700; color: var(--muted); font-size: .9rem; }
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 700;
  font-size: .88rem;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); background: var(--surface-2); }
.seg button.active { background: var(--primary); color: #fff; }
.seg button.easy.active { background: var(--correct); }
.seg button.medium.active { background: var(--warn); }
.seg button.hard.active { background: var(--wrong); }

.chapters { display: grid; gap: 14px; margin-bottom: 48px; }
.chapter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chapter[open] { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.chapter > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary:hover { background: var(--surface-2); }
.ch-no {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
}
.ch-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ch-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.ch-title { font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; }
.ch-meta { font-size: .85rem; color: var(--muted); }
.ch-meta .best { margin-left: 6px; }
.ch-caret { font-size: 1.2rem; color: var(--muted); transition: transform .2s; }
.chapter[open] .ch-caret { transform: rotate(180deg); }
.ch-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.ch-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0;
}
.ch-actions .lv:first-child, .topic-meta .lv:first-of-type { margin-left: 0; }
.ch-whole { font-size: .85rem; color: var(--muted); align-self: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.topics { display: grid; gap: 10px; }
.topic {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 14px 16px;
}
.topic-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topic-info { min-width: 0; flex: 1 1 260px; }
.topic-title { font-weight: 700; }
.topic-no {
  display: inline-block;
  min-width: 38px;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
}
.topic-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.topic-meta .best { margin-left: 6px; }
.soon { font-size: .85rem; color: var(--muted); font-style: italic; }

.slos { margin-top: 10px; font-size: .88rem; }
.slos summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.slos ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.slos li { margin: 3px 0; }

/* ---------- Quiz ---------- */
.quiz-wrap { max-width: 780px; margin: 28px auto 60px; }
.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.quiz-top .title { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.quiz-top .sub { color: var(--muted); font-size: .9rem; }
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  box-shadow: var(--shadow);
}
.timer.low { color: var(--wrong); border-color: var(--wrong); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress > div { height: 100%; background: var(--grad); border-radius: 999px; transition: width .35s ease; }

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.q-num { color: var(--primary); font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.q-tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 8px;
  font-size: .72rem;
  text-transform: none;
  letter-spacing: 0;
}
.q-left {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 8px;
  font-size: .78rem;
  text-transform: none;
  letter-spacing: 0;
}
.q-text { font-size: 1.25rem; font-weight: 700; margin: 0 0 22px; line-height: 1.45; letter-spacing: -.01em; white-space: pre-wrap; }

.options { display: grid; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .15s;
}
.option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); transform: translateX(4px); }
.option:disabled { cursor: default; }
.option .letter {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-weight: 800;
  font-size: .9rem;
  transition: background .15s, color .15s;
}
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.selected .letter { background: var(--primary); color: #fff; }
.option.correct { border-color: var(--correct); background: var(--correct-soft); }
.option.correct .letter { background: var(--correct); color: #fff; }
.option.wrong { border-color: var(--wrong); background: var(--wrong-soft); animation: shake .3s; }
.option.wrong .letter { background: var(--wrong); color: #fff; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.explain {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
  font-size: .95rem;
  animation: rise .25s ease;
}
.explain b.ok { color: var(--correct); }
.explain b.no { color: var(--wrong); }

.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.palette { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.palette button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  transition: transform .12s;
}
.palette button:hover { transform: translateY(-2px); }
.palette button.answered { background: var(--primary); border-color: var(--primary); color: #fff; }
.palette button.current { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }

.hint { color: var(--muted); font-size: .82rem; margin-top: 16px; text-align: center; }

/* ---------- Results ---------- */
.result-card { text-align: center; }
.result-card .title { font-weight: 700; color: var(--muted); }
.score-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 14px auto 18px;
  display: grid;
  place-items: center;
  font-size: 2.3rem;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
}
.score-ring span {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
}
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 24px; }
.result-stats div {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 8px;
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
}
.result-stats b { display: block; font-size: 1.4rem; color: var(--text); }
.result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.review { margin-top: 32px; display: grid; gap: 12px; }
.review h2 { font-size: 1.3rem; margin: 0 0 4px; font-weight: 800; }
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.review-item.ok { border-left-color: var(--correct); }
.review-item.no { border-left-color: var(--wrong); }
.review-item.skip { border-left-color: var(--warn); }
.review-item .rq { font-weight: 700; margin-bottom: 6px; }
.review-item .ra { font-size: .92rem; }
.review-item .ra .c { color: var(--correct); font-weight: 700; }
.review-item .ra .w { color: var(--wrong); font-weight: 700; }
.review-item .re { color: var(--muted); font-size: .88rem; margin-top: 6px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 26px 0;
  color: var(--muted);
  font-size: .88rem;
  text-align: center;
}

@media (max-width: 560px) {
  .hero { padding: 44px 0 32px; }
  .q-card { padding: 20px; }
  .q-text { font-size: 1.08rem; }
  .quiz-nav .btn { flex: 1; }
  .exam-hero { padding: 24px 20px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Urdu / Arabic content (Islamiyat, Urdu, Tarjuma-tul-Quran): right-to-left with a Nastaliq font */
[dir="auto"]:dir(rtl), bdi:dir(rtl) {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;
  line-height: 2.2;
}
.q-text[dir="auto"]:dir(rtl) { font-size: 1.2rem; }
.option span[dir="auto"]:dir(rtl) { flex: 1; text-align: right; }

/* Quiz setup screen (number of MCQs, mode, time limit) */
.setup-card { display: grid; gap: 22px; }
.setup-head .title { font-weight: 800; font-size: 1.2rem; }
.setup-head .sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.setup-group h3 { margin: 0 0 10px; font-size: .95rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25;
  transition: border-color .15s, background .15s;
}
.pill small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.pill:hover { border-color: var(--primary); }
.pill.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill.on small { color: rgba(255,255,255,.85); }
.setup-card .custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.setup-card .custom input {
  width: 90px; font: inherit; padding: 7px 10px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.setup-card .custom input:focus { outline: none; border-color: var(--primary); }
.setup-summary { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.setup-start { justify-self: start; }
@media (max-width: 560px) { .setup-start { justify-self: stretch; } }

/* ---------- Mastery mode ---------- */
.btn.mastery { background: linear-gradient(135deg, #d97706, #b8892b); color: #fff; border-color: transparent; }
.btn.mastery:hover { filter: brightness(1.08); }
.m-badge { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: #fff4dc; color: #9a6a0c; }
.m-badge.done { background: var(--correct-soft); color: var(--correct); }
.mastery-card { max-width: 760px; margin: 0 auto; }
.m-note { margin: 14px 0; padding: 12px 16px; border-radius: 12px; background: var(--primary-soft); font-weight: 600; }
.m-rounds { display: flex; gap: 14px; justify-content: center; margin: 22px 0; }
.m-round { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.m-round b { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem;
  background: var(--surface-2); border: 2px solid var(--border); color: var(--muted); }
.m-round.now b { border-color: var(--primary); color: var(--primary); }
.m-round.done b { background: var(--correct); border-color: var(--correct); color: #fff; }
.m-label { display: flex; justify-content: space-between; font-size: .9rem; margin: 6px 0; color: var(--muted); }
.m-label b { color: var(--text); }
.progress.thin { height: 6px; }
.m-done { text-align: center; font-size: 1.15rem; font-weight: 700; color: var(--correct); }
.m-rule { font-size: .88rem; color: var(--muted); text-align: center; margin: 12px 0; }
.mastery-card .result-actions { flex-wrap: wrap; justify-content: center; }
.mastery-card .btn small { font-weight: 500; opacity: .85; margin-left: 6px; }
.cert-card { max-width: 760px; margin: 20px auto 0; text-align: center; }
.cert-card input[type="text"] { width: min(320px, 100%); padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; }
.cert-preview { margin: 16px 0; }
.cert-preview img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); }

/* Mastery: single cleared-progress bar */
.progress.m-bar { height: 14px; border-radius: 999px; }
.progress.m-bar > div { background: linear-gradient(90deg, #22c55e, #16a34a); }

/* Board chooser */
.board-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.board-card .card-icon { font-size: 34px; }
.soon-card { opacity: .7; cursor: default; }
.soon-card:hover { transform: none; }

/* MCQ source labels */
.src { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.src.ai { background: #e6eef8; color: #1d4e89; border-color: #bcd3ec; }
.src.past { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.src.model { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.src.specialist { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
[data-theme="dark"] .src.ai { background: #10263f; color: #bcd3ec; border-color: #1d4e89; }
[data-theme="dark"] .src.past { background: #3b2a06; color: #fde68a; border-color: #92400e; }
[data-theme="dark"] .src.model { background: #052e16; color: #bbf7d0; border-color: #166534; }
[data-theme="dark"] .src.specialist { background: #3b0a24; color: #fbcfe8; border-color: #9d174d; }
.review-item .rsrc { margin: 2px 0 4px -6px; }

/* Matric Tech subjects (separate group on the class page) */
.tech-section { margin-top: 34px; padding-top: 22px; border-top: 2px dashed var(--border, #e5e7eb); }
.tech-section .section-head .bar { background: linear-gradient(180deg, #f59e0b, #d97706); }
.tech-banner { background: linear-gradient(135deg, #b45309, #d97706) !important; margin-bottom: 18px; }
.chip.tech-chip { background: #fef3c7; color: #92400e; border-color: #fde68a; }
[data-theme="dark"] .chip.tech-chip { background: #3b2a06; color: #fde68a; border-color: #92400e; }


/* ---------- Modern home ---------- */
.hero-modern {
  background:
    radial-gradient(700px 360px at 85% 10%, rgba(15, 157, 138, .35), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(45, 123, 191, .35), transparent 60%),
    linear-gradient(160deg, #0b1d33 0%, #12355b 100%);
  color: #fff;
  text-align: left;
  padding: 72px 0 80px;
  border-bottom: 0;
}
.hero-modern::before, .hero-modern::after { display: none; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero-modern .hero-badge { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #d7e6f5; box-shadow: none; }
.hero-modern h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.7rem); line-height: 1.05; }
.hero-modern .grad { background: linear-gradient(90deg, #7dd3fc, #34d3b9); -webkit-background-clip: text; background-clip: text; }
.hero-modern p { color: #b8c9dd; margin: 0 0 28px; max-width: 560px; }
.hero-modern .search-wrap { margin: 0; max-width: 560px; }
.hero-modern .search { border: 0; box-shadow: 0 14px 34px rgba(0,0,0,.28); background: #fff; color: #0f1b2d; }
.hero-modern .search:focus { box-shadow: 0 0 0 4px rgba(52, 211, 185, .45), 0 14px 34px rgba(0,0,0,.28); }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quick-link {
  padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  color: #e6f0fa; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  transition: background .2s, transform .2s;
}
.quick-link:hover { background: rgba(255,255,255,.22); transform: translateY(-2px); text-decoration: none; }
.hero-modern .stats-row { justify-content: flex-start; margin-top: 22px; }
.hero-modern .stat-pill { background: transparent; border: 0; box-shadow: none; color: #9fb6cf; padding: 0 14px 0 0; }
.hero-modern .stat-pill b { color: #fff; }

.hero-visual { position: relative; display: flex; justify-content: center; }
.demo-card {
  width: 100%; max-width: 380px; background: #fff; color: #0f1b2d; border-radius: 20px; padding: 22px;
  box-shadow: 0 30px 60px rgba(0,0,0,.4); transform: rotate(2deg);
}
.demo-top { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 700; color: #58687d; }
.demo-timer { color: #0f766e; }
.demo-bar { height: 6px; border-radius: 6px; background: #e6eef8; margin: 12px 0 18px; overflow: hidden; }
.demo-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1d4e89, #0f9d8a); border-radius: 6px; }
.demo-q { font-weight: 800; font-size: 1.05rem; margin-bottom: 14px; }
.demo-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid #dae2eb; border-radius: 12px; margin-bottom: 8px; font-weight: 700; font-size: .85rem; color: #58687d; }
.demo-opt span { color: #0f1b2d; font-weight: 600; flex: 1; }
.demo-opt.ok { border-color: #16a34a; background: #e7f8ee; }
.demo-opt.ok em { color: #16a34a; font-style: normal; font-weight: 800; }
.demo-exp { font-size: .8rem; background: #f3f6fa; border-radius: 10px; padding: 9px 12px; color: #58687d; margin-top: 12px; }
.demo-float { position: absolute; background: #fff; color: #0f1b2d; font-size: .8rem; font-weight: 700; padding: 9px 14px; border-radius: 12px; box-shadow: 0 14px 30px rgba(0,0,0,.3); animation: floaty 5s ease-in-out infinite; }
.demo-float.f1 { top: -14px; left: -4%; }
.demo-float.f2 { bottom: 8%; right: -2%; animation-delay: -2.5s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.how { margin-top: -34px; position: relative; z-index: 2; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.how-item { padding: 22px 26px; }
.how-item + .how-item { border-left: 1px solid var(--border); }
.how-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; font-size: .85rem; margin-bottom: 8px; }
.how-item h3 { margin: 0 0 2px; font-size: 1.02rem; }
.how-item p { margin: 0; color: var(--muted); font-size: .9rem; }

[data-page="home"] .card { border-radius: 18px; padding: 24px; box-shadow: none; }
[data-page="home"] a.card:hover { box-shadow: var(--shadow-lg); }
[data-page="home"] .card-icon { width: 56px; height: 56px; border-radius: 16px; }
[data-page="home"] .section-head h2 { font-size: 1.5rem; }
[data-page="home"] .section-head .bar { display: none; }
.site-footer { border-top: 1px solid var(--border); margin-top: 24px; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .hero-modern { padding: 48px 0 64px; }
  .how-grid { grid-template-columns: 1fr; }
  .how-item + .how-item { border-left: 0; border-top: 1px solid var(--border); }
}

/* ---------- Modern exam + quiz pages ---------- */
.exam-hero {
  background:
    radial-gradient(520px 260px at 90% 0%, rgba(15, 157, 138, .35), transparent 60%),
    linear-gradient(160deg, #0b1d33 0%, #12355b 100%);
  border-radius: 22px;
  padding: 34px 32px;
  box-shadow: 0 20px 44px rgba(11, 29, 51, .28);
}
.exam-hero::after { background: rgba(255, 255, 255, .05); }
.page-title .card-icon { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); }
.page-title h1 { letter-spacing: -.03em; }
.banner { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); backdrop-filter: blur(6px); }
.banner .btn.light { color: #12355b; }
.breadcrumb { font-weight: 500; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

.exam-page .card, [data-page="exam"] .card { box-shadow: none; border-radius: 16px; }
[data-page="exam"] .card:hover { box-shadow: var(--shadow-lg); }
[data-page="exam"] .section-head .bar { display: none; }
[data-page="exam"] .section-head h2 { font-size: 1.4rem; }

.chapter { box-shadow: none; border-radius: 16px; transition: box-shadow .2s, border-color .2s; }
.chapter:hover { box-shadow: var(--shadow); }
.chapter > summary { padding: 16px 20px; }
.ch-no { width: 46px; height: 46px; border-radius: 13px; font-size: 1.1rem; box-shadow: 0 6px 14px rgba(18, 53, 91, .25); }
.ch-label { color: var(--primary-2); }
.topic { background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; transition: border-color .2s, background .2s; }
.topic:hover { border-color: var(--border); background: var(--surface); }
.topic-no { background: var(--primary-soft); }
.seg { box-shadow: none; }

/* quiz */
.quiz-wrap { max-width: 800px; }
.quiz-top { position: sticky; top: 64px; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); padding: 12px 0 4px; margin-bottom: 0; }
.progress { height: 8px; margin: 8px 0 22px; }
.q-card { border-radius: 20px; padding: 32px; box-shadow: 0 10px 30px rgba(15, 27, 45, .07); }
.q-num { color: var(--primary-2); }
.q-text { font-size: 1.3rem; }
.option { padding: 15px 18px; border-radius: 14px; box-shadow: 0 1px 0 rgba(15, 27, 45, .03); }
.option:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(18, 53, 91, .1); }
.option .letter { border-radius: 50%; width: 32px; height: 32px; }
.explain { border-left-color: var(--primary-2); background: color-mix(in srgb, var(--primary-2) 8%, var(--surface)); }
.palette button { border-radius: 50%; width: 36px; height: 36px; font-size: .85rem; }
.timer { background: var(--surface); box-shadow: none; }
.score-ring { box-shadow: 0 16px 40px rgba(18, 53, 91, .22); }
.review-item { box-shadow: none; }
.result-stats div { border: 1px solid var(--border); background: var(--surface); }
@media (max-width: 600px) {
  .q-card { padding: 20px; border-radius: 16px; }
  .q-text { font-size: 1.12rem; }
  .exam-hero { padding: 24px 20px; }
}

/* ---------- Board chooser ---------- */
.board-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.board-card { padding: 28px; border-radius: 20px; box-shadow: none; background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--primary-soft) 55%, var(--surface)) 100%); }
.board-card .card-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 2rem; background: var(--grad); box-shadow: 0 10px 22px rgba(18, 53, 91, .25); }
.board-card h3 { font-size: 1.35rem; letter-spacing: -.02em; }
.board-card .card-go { background: var(--primary); color: #fff; padding: 10px 18px; border-radius: 12px; align-self: flex-start; margin-top: 12px; transition: background .2s, transform .2s; }
.board-card:hover .card-go { background: var(--primary-hover); }
.soon-card .soon { align-self: flex-start; background: var(--surface-2); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-style: normal; }

/* figures attached to MCQs in the admin portal */
.q-fig { display: block; max-width: 100%; max-height: 360px; margin: 12px auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; object-fit: contain; }
.review-item .q-fig { max-height: 220px; margin: 8px 0; }
.src:not(.ai):not(.past):not(.model):not(.specialist) { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* "Register to track your progress" prompt for visitors who are not signed in (see trackPrompt in js/app.js) */
.track-prompt { position: relative; display: flex; align-items: center; gap: 14px; margin: 18px 0; padding: 14px 18px; background: var(--primary-soft); border: 1px solid var(--border); border-left: 4px solid var(--primary-2); border-radius: var(--radius); }
.track-prompt .tp-ico { font-size: 1.7rem; line-height: 1; flex: none; }
.track-prompt .tp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.track-prompt .tp-text b { color: var(--text); font-size: 1.02rem; }
.track-prompt .tp-text span { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.track-prompt .tp-actions { display: flex; align-items: center; gap: 16px; flex: none; }
.track-prompt .tp-signin { font-weight: 700; font-size: .92rem; white-space: nowrap; }
.track-prompt.strip { margin: 14px 0 0; padding: 10px 44px 10px 14px; }
.track-prompt.strip .tp-ico { font-size: 1.4rem; }
.track-prompt .tp-x { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.track-prompt .tp-x:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 700px) {
  .track-prompt { flex-wrap: wrap; align-items: flex-start; }
  .track-prompt .tp-text { flex-basis: calc(100% - 50px); }
  .track-prompt .tp-actions { flex-basis: 100%; }
  .track-prompt.strip .tp-text span { display: none; }
}
