/* ==========================================================================
   CompTIA Academy — design system
   Dark, calm, high-contrast study UI. No external assets (fully offline).
   ========================================================================== */

:root {
  --bg: #080c17;
  --bg-2: #0b1120;
  --surface: #101a2e;
  --surface-2: #14203a;
  --surface-3: #1a2846;
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .26);
  --text: #e7ecf6;
  --text-2: #b6c2d9;
  --muted: #8593ad;
  --dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --gold: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, .85);
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 256px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
/* The hidden attribute must beat any class that sets display (.pill, .lab-card, .cert-card, .empty):
   without this the lab and path filters hide nothing and the drill shows an empty pill. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(56, 189, 248, .10), transparent 60%),
    radial-gradient(800px 500px at 88% 4%, rgba(129, 140, 248, .10), transparent 62%),
    radial-gradient(700px 600px at 50% 110%, rgba(52, 211, 153, .05), transparent 64%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
::selection { background: rgba(56, 189, 248, .3); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #2a3a5c transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #26344f; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #33456a; background-clip: padding-box; }

/* ============================== layout ================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 21, 38, .96), rgba(8, 12, 23, .96));
  backdrop-filter: blur(14px);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: radial-gradient(circle at 30% 20%, rgba(56, 189, 248, .22), rgba(129, 140, 248, .10)); border: 1px solid rgba(56, 189, 248, .25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 15.5px; letter-spacing: .14em; font-weight: 800; }
.brand-text small { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 10px;
  color: var(--text-2); font-weight: 560; font-size: 14px;
  border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
}
.nav-item .ni { width: 20px; text-align: center; font-size: 15px; filter: saturate(.9); }
.nav-item:hover { background: rgba(148, 163, 184, .07); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(56, 189, 248, .16), rgba(56, 189, 248, .04)); border-color: rgba(56, 189, 248, .22); color: #eaf6ff; }
.nav-item.active .ni { filter: none; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(148, 163, 184, .10); padding: 1px 7px; border-radius: 99px; }

.side-block { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-title { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); font-weight: 700; padding: 0 10px; }
.side-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(16, 26, 46, .7); padding: 12px; display: grid; gap: 9px; }
.side-card .row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.side-card b { color: var(--text); font-variant-numeric: tabular-nums; }
.side-foot { display: flex; flex-direction: column; gap: 5px; padding: 2px 10px 0; }
.side-link { font-size: 12px; color: var(--muted); }
.side-link:hover { color: var(--accent); }
.side-note { font-size: 10.5px; color: #55637c; line-height: 1.4; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 23, .82);
  backdrop-filter: blur(16px);
}
.menu-btn { display: none; }
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dim); font-size: 16px; pointer-events: none; }
.search {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(16, 26, 46, .72); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
  font-size: 13.5px;
}
.search::placeholder { color: #68758e; }
.search:focus { border-color: rgba(56, 189, 248, .45); box-shadow: 0 0 0 3px rgba(56, 189, 248, .10); background: rgba(16, 26, 46, .95); }
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 420px; overflow: auto;
  background: #0e1728; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 60;
}
.sr-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.sr-item:hover, .sr-item.sel { background: rgba(56, 189, 248, .10); }
.sr-ico { font-size: 15px; width: 20px; text-align: center; }
.sr-main { min-width: 0; }
.sr-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 11px; color: var(--muted); }
.sr-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(16, 26, 46, .7);
  font-size: 12.5px; color: var(--text-2); white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--line-strong); }
.chip.streak b { color: var(--gold); }
.chip.level { position: relative; overflow: hidden; }
.chip.level i { position: absolute; left: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; }
.chip.lab-chip { border-color: rgba(52, 211, 153, .22); background: rgba(52, 211, 153, .08); color: #b7f7df; }
.chip.lab-chip:hover { background: rgba(52, 211, 153, .14); }

.view { padding: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 44px) 70px; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; }
.view > * { animation: rise .34s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================== typography ============================== */
.eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.eyebrow.green { color: var(--good); }
h1.h1 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.03em; }
.h2 { font-size: clamp(20px, 2.2vw, 26px); font-weight: 750; letter-spacing: -.02em; }
.h3 { font-size: 16.5px; font-weight: 700; }
.lede { color: var(--text-2); font-size: 15.5px; max-width: 70ch; margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }

/* ============================== buttons ================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(20, 32, 58, .8); color: var(--text);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: rgba(26, 40, 70, .95); border-color: rgba(148, 163, 184, .38); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #2ea8e0, #1d7fb8); border-color: #38bdf8; color: #04121c; box-shadow: 0 6px 22px -10px rgba(56, 189, 248, .8); }
.btn.primary:hover { background: linear-gradient(180deg, #4dc0f2, #2288c4); }
.btn.good { background: linear-gradient(180deg, #34d399, #10a97a); border-color: #34d399; color: #032018; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: rgba(148, 163, 184, .07); }
.btn.danger { border-color: rgba(248, 113, 113, .35); color: #fecaca; background: rgba(248, 113, 113, .08); }
.btn.danger:hover { background: rgba(248, 113, 113, .15); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================== cards / grids =========================== */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(18, 29, 51, .9), rgba(13, 21, 38, .9));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}
.card.pad { padding: 18px; }
.card.hover { transition: transform .16s var(--ease), border-color .16s, background .16s; }
.card.hover:hover { transform: translateY(-2px); border-color: var(--line-strong); background: linear-gradient(180deg, rgba(22, 35, 60, .95), rgba(15, 24, 43, .95)); }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head .h2 { display: flex; align-items: center; gap: 10px; }
.link-more { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.link-more:hover { text-decoration: underline; }

/* hero */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid rgba(56, 189, 248, .2);
  background:
    radial-gradient(700px 300px at 88% -20%, rgba(129, 140, 248, .22), transparent 60%),
    radial-gradient(600px 320px at 10% 120%, rgba(56, 189, 248, .16), transparent 60%),
    linear-gradient(140deg, #101c33, #0b1322 60%);
  padding: clamp(22px, 3vw, 34px);
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 26px; align-items: center;
  box-shadow: var(--shadow);
}
.hero:after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(circle at 80% 20%, #000 0%, transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero .h1 { font-size: clamp(25px, 3vw, 36px); }
.hero .lede { margin-top: 10px; font-size: 14.5px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hstat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(8, 13, 24, .5); }
.hstat .v { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hstat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 3px; }
.hstat.good .v { color: var(--good); }
.hstat.blue .v { color: var(--accent); }
.hstat.gold .v { color: var(--gold); }

/* continue card */
.continue-card { display: flex; align-items: center; gap: 16px; }
.continue-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 23px; background: rgba(56, 189, 248, .10); border: 1px solid rgba(56, 189, 248, .22); flex: none; }

/* track card */
.tcard { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow: hidden; }
.tcard:before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--tc, var(--accent)); opacity: .8; }
.tcard-top { display: flex; align-items: flex-start; gap: 12px; }
.tcard-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; background: color-mix(in srgb, var(--tc, var(--accent)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tc, var(--accent)) 30%, transparent); flex: none; }
.tcard-top > div { min-width: 0; }
.tcard-top > .badge { flex: none; }
.tcard-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: break-word; hyphens: auto; }
.tcard-code { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.tcard-blurb { font-size: 12.5px; color: var(--text-2); line-height: 1.5; min-height: 38px; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 11.5px; color: var(--muted); }
.tcard .badge { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: rgba(148, 163, 184, .1); color: var(--text-2); }
.tcard .badge.done { background: rgba(52, 211, 153, .12); color: #6ee7b7; }

/* progress bars */
.bar { position: relative; height: 6px; border-radius: 99px; background: rgba(148, 163, 184, .14); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease); }
.bar.good > i { background: linear-gradient(90deg, #34d399, #22d3ee); }
.bar.sm { height: 4px; }
.bar.lg { height: 9px; }

/* rings */
.ring { --v: 0; --sz: 54px; width: var(--sz); height: var(--sz); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--rc, var(--good)) calc(var(--v) * 1%), rgba(148, 163, 184, .12) 0);
}
.ring > span { width: calc(var(--sz) - 8px); height: calc(var(--sz) - 8px); border-radius: 50%; background: #0d1524; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* pills & tags */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; background: rgba(148, 163, 184, .10); border: 1px solid var(--line); font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.pill.blue { background: rgba(56, 189, 248, .10); border-color: rgba(56, 189, 248, .24); color: #9adeff; }
.pill.green { background: rgba(52, 211, 153, .10); border-color: rgba(52, 211, 153, .24); color: #86efc7; }
.pill.gold { background: rgba(251, 191, 36, .10); border-color: rgba(251, 191, 36, .22); color: #fde68a; }
.pill.red { background: rgba(248, 113, 113, .10); border-color: rgba(248, 113, 113, .24); color: #fecaca; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ============================== cert catalog ============================ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn { height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: rgba(16, 26, 46, .6); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.filter-btn:hover { border-color: var(--line-strong); color: var(--text); }
.filter-btn.active { background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .35); color: #bae6fd; }

/* ============================== track page ============================== */
.track-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 26px; }
.exam-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fact { border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 13, 24, .4); padding: 10px 12px; }
.fact .k { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.fact .v { font-size: 13.5px; font-weight: 650; margin-top: 2px; }

.domain { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(14, 23, 41, .6); overflow: hidden; margin-bottom: 10px; }
.domain-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; user-select: none; }
.domain-head:hover { background: rgba(148, 163, 184, .04); }
.domain-n { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: rgba(56, 189, 248, .1); color: var(--accent); border: 1px solid rgba(56, 189, 248, .18); flex: none; }
.domain-title { font-weight: 650; font-size: 14.5px; }
.domain-weight { font-size: 11px; color: var(--muted); margin-top: 2px; }
.domain-progress { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.domain-progress .bar { width: 90px; }
.caret { color: var(--dim); transition: transform .2s; }
.domain.open .caret { transform: rotate(90deg); }
.lesson-list { display: none; padding: 4px 10px 10px; }
.domain.open .lesson-list { display: block; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid transparent; }
.lesson-row:hover { background: rgba(148, 163, 184, .06); border-color: var(--line); }
.lesson-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; color: transparent; flex: none; }
.lesson-row.done .lesson-check { background: var(--good); border-color: var(--good); color: #032018; }
.lesson-row .lr-main { min-width: 0; flex: 1; }
.lesson-row .lr-title { display: block; font-size: 13.5px; font-weight: 600; }
.lesson-row.done .lr-title { color: var(--text-2); }
.lesson-row .lr-sum { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-row .lr-min { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ============================== lesson page ============================ */
.lesson-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 30px; align-items: start; }
.lesson-body { max-width: 760px; }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: #3b4a63; }
.lesson-head { margin-bottom: 22px; }
.lesson-head .h1 { font-size: clamp(23px, 2.6vw, 31px); }
.lesson-meta { display: flex; gap: 14px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.objectives { border-left: 2px solid rgba(56, 189, 248, .45); padding: 2px 0 2px 14px; margin: 20px 0 26px; }
.objectives .lab { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.objectives ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.objectives li { margin: 3px 0; }

.lesson-body .h2 { margin: 30px 0 10px; font-size: 19px; }
.lesson-body p { color: #cbd5e6; margin: 12px 0; font-size: 14.6px; line-height: 1.68; }
.lesson-body ul, .lesson-body ol { color: #cbd5e6; margin: 10px 0; padding-left: 22px; font-size: 14.4px; line-height: 1.65; }
.lesson-body li { margin: 5px 0; }
.lesson-body strong { color: #fff; font-weight: 680; }
.lesson-body code, .inline-code { font-family: var(--mono); font-size: .88em; background: rgba(56, 189, 248, .10); border: 1px solid rgba(56, 189, 248, .16); color: #a5e3ff; padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.lesson-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.codeblock { position: relative; margin: 16px 0; border: 1px solid var(--line); border-radius: 11px; background: #070c16; overflow: hidden; }
.codeblock-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); background: rgba(148, 163, 184, .04); }
.codeblock-head .dots { display: flex; gap: 4px; }
.codeblock-head .dots i { width: 7px; height: 7px; border-radius: 50%; background: #334155; }
.codeblock pre { margin: 0; padding: 14px 16px; overflow: auto; font-family: var(--mono); font-size: 12.6px; line-height: 1.65; color: #cfe3ff; }
.codeblock pre .cm { color: #64748b; }
.codeblock pre .pr { color: #34d399; }
.copy-btn { margin-left: auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 2px 7px; cursor: pointer; }
.copy-btn:hover { color: var(--text); border-color: var(--line-strong); }

.callout { display: flex; gap: 11px; padding: 13px 15px; border-radius: 11px; margin: 16px 0; font-size: 13.8px; line-height: 1.6; border: 1px solid; }
.callout .ci { font-size: 15px; line-height: 1.3; }
.callout p { margin: 0; color: inherit; font-size: inherit; }
.callout.note { background: rgba(56, 189, 248, .07); border-color: rgba(56, 189, 248, .22); color: #c7e9fb; }
.callout.tip { background: rgba(52, 211, 153, .06); border-color: rgba(52, 211, 153, .22); color: #c3f3e1; }
.callout.warn { background: rgba(251, 191, 36, .07); border-color: rgba(251, 191, 36, .24); color: #fbecc0; }
.callout.exam { background: rgba(129, 140, 248, .08); border-color: rgba(129, 140, 248, .26); color: #d5d9ff; }
.callout.exam .ci { filter: grayscale(0); }

.table-wrap { margin: 16px 0; border: 1px solid var(--line); border-radius: 11px; overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; padding: 10px 12px; background: rgba(148, 163, 184, .07); color: var(--text-2); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(148, 163, 184, .08); color: #cbd5e6; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td code { white-space: nowrap; }

.aside { position: sticky; top: 78px; display: grid; gap: 12px; }
.aside-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(14, 23, 41, .7); padding: 14px; }
.aside-card .k { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 700; margin-bottom: 9px; }
.toc { display: grid; gap: 2px; max-height: 44vh; overflow: auto; }
.toc a { font-size: 12px; color: var(--muted); padding: 5px 8px; border-radius: 6px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--text); background: rgba(148, 163, 184, .06); }
.lesson-nav { display: flex; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.lesson-nav .btn { flex: 1; min-width: 0; white-space: normal; height: auto; min-height: 38px; padding: 8px 16px; text-align: center; }
.complete-card { display: flex; flex-direction: column; gap: 10px; }
.complete-card .row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }

/* ============================== quiz ==================================== */
.quiz { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(14, 23, 41, .65); padding: 20px; margin-top: 26px; }
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.quiz-q { font-size: 15.5px; font-weight: 650; line-height: 1.5; margin-bottom: 14px; }
.qopts { display: grid; gap: 8px; }
.qopt {
  display: flex; align-items: flex-start; gap: 11px; text-align: left;
  padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(8, 13, 24, .45); color: var(--text-2); cursor: pointer;
  font-size: 13.5px; line-height: 1.5; transition: border-color .15s, background .15s, color .15s;
}
.qopt:hover:not([disabled]) { border-color: rgba(56, 189, 248, .35); color: var(--text); background: rgba(56, 189, 248, .06); }
.qopt .ql { width: 21px; height: 21px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: rgba(148, 163, 184, .12); color: var(--muted); flex: none; margin-top: 1px; }
.qopt.correct { border-color: rgba(52, 211, 153, .55); background: rgba(52, 211, 153, .10); color: #d9fbec; }
.qopt.correct .ql { background: var(--good); color: #032018; }
.qopt.wrong { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .09); color: #fee2e2; }
.qopt.wrong .ql { background: var(--bad); color: #2c0505; }
.qopt[disabled] { cursor: default; }
.explain { margin-top: 13px; padding: 12px 14px; border-radius: 10px; background: rgba(56, 189, 248, .07); border: 1px solid rgba(56, 189, 248, .18); font-size: 13px; color: #cfe9fa; line-height: 1.6; display: none; }
.explain.show { display: block; animation: rise .25s var(--ease); }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.quiz-score { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================== terminal ================================ */
.lab-shell { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.term-card { border: 1px solid rgba(148, 163, 184, .18); border-radius: var(--radius); overflow: hidden; background: #05080f; box-shadow: var(--shadow); }
.term-toolbar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: linear-gradient(180deg, #101a2c, #0b1220); border-bottom: 1px solid var(--line); }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #334155; }
.term-dots i:nth-child(1) { background: #ef4444; }
.term-dots i:nth-child(2) { background: #f59e0b; }
.term-dots i:nth-child(3) { background: #22c55e; }
.term-title { font-family: var(--mono); font-size: 11.5px; color: #8b9bb7; display: flex; align-items: center; gap: 8px; }
.term-badge { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #6ee7b7; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .22); padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.term-tools { margin-left: auto; display: flex; gap: 6px; }
.term-tool { border: 1px solid var(--line); background: rgba(148, 163, 184, .05); color: #93a4c0; border-radius: 6px; font-size: 10.5px; padding: 3px 8px; cursor: pointer; }
.term-tool:hover { color: #e2e8f0; border-color: var(--line-strong); }
.term {
  height: min(58vh, 560px); min-height: 320px; overflow-y: auto; padding: 14px 16px 18px;
  font-family: var(--mono); font-size: 12.8px; line-height: 1.62; color: #c9d6ea;
  cursor: text; background:
    radial-gradient(600px 200px at 50% 0%, rgba(56, 189, 248, .045), transparent 70%),
    #05080f;
}
.term-out { white-space: pre-wrap; word-break: break-word; }
.term-out .ok { color: #4ade80; }
.term-out .err { color: #fb7185; }
.term-out .dim { color: #64748b; }
.term-out .warn { color: #fbbf24; }
.term-out .path { color: #7dd3fc; }
.term-out .hl { color: #a5b4fc; }
.term-cmd-echo { color: #e2e8f0; }
.term-input-row { display: flex; align-items: baseline; gap: 0; white-space: pre-wrap; word-break: break-all; scroll-margin-bottom: 18px; }
.term-prompt { color: #4ade80; white-space: nowrap; }
.term-prompt .p-host { color: #38bdf8; }
.term-prompt .p-user { color: #4ade80; }
.term-prompt .p-path { color: #a5b4fc; }
.term-input {
  flex: 1; min-width: 4px; background: transparent; border: 0; outline: none; padding: 0;
  font-family: var(--mono); font-size: inherit; line-height: inherit; color: #f1f5f9; caret-color: #4ade80;
}
.term-hint { color: #4b5b75; font-style: italic; }
.term-resize { height: 6px; cursor: ns-resize; background: transparent; }

.task-panel { display: grid; gap: 12px; position: sticky; top: 78px; }
.task-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(14, 23, 41, .72); padding: 14px; }
.task-card .k { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.task-list { display: grid; gap: 8px; margin-top: 10px; }
.task { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: rgba(8, 13, 24, .4); transition: border-color .2s, background .2s; }
.task.active { border-color: rgba(56, 189, 248, .4); background: rgba(56, 189, 248, .06); }
.task.done { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .06); }
.task-top { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.task.done .task-top { color: #a7f3d0; }
.task-num { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10px; font-weight: 800; background: rgba(148, 163, 184, .12); color: var(--muted); flex: none; margin-top: 1px; }
.task.done .task-num { background: var(--good); color: #032018; }
.checks { display: grid; gap: 4px; margin: 8px 0 0 26px; }
.check { display: flex; gap: 6px; align-items: flex-start; font-size: 11px; color: var(--dim); line-height: 1.45; }
.check .ci { font-size: 10px; margin-top: 1px; }
.check.ok { color: #6ee7b7; }
.hint-btn { border: 0; background: transparent; color: var(--accent); font-size: 11px; cursor: pointer; padding: 6px 0 0 26px; }
.hint-text { font-size: 11.5px; color: #fde68a; padding: 6px 0 0 26px; line-height: 1.5; }
.lab-complete { border: 1px solid rgba(52, 211, 153, .4); background: linear-gradient(160deg, rgba(52, 211, 153, .12), rgba(16, 26, 46, .9)); border-radius: 12px; padding: 14px; }
.lab-complete .t { font-weight: 750; color: #a7f3d0; margin-bottom: 4px; }

/* lab cards */
.lab-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.lab-card-top { display: flex; align-items: center; gap: 10px; }
.lab-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .2); }
.lab-card .t { font-size: 14px; font-weight: 650; }
.lab-card .d { font-size: 12px; color: var(--muted); line-height: 1.5; }
.lab-state { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: rgba(148, 163, 184, .1); color: var(--muted); }
.lab-state.done { background: rgba(52, 211, 153, .12); color: #6ee7b7; }
.lab-state.prog { background: rgba(56, 189, 248, .12); color: #7dd3fc; }

/* ============================== drill =================================== */
.drill-wrap { max-width: 780px; margin: 0 auto; }
.drill-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.drill-progress { display: flex; gap: 5px; }
.drill-progress i { width: 26px; height: 4px; border-radius: 99px; background: rgba(148, 163, 184, .16); }
.drill-progress i.on { background: var(--accent); }
.drill-progress i.ok { background: var(--good); }
.drill-progress i.no { background: var(--bad); }
.drill-q { font-size: 19px; font-weight: 650; line-height: 1.45; margin-bottom: 18px; letter-spacing: -.01em; }
.drill-source { font-size: 11.5px; color: var(--dim); margin-bottom: 8px; }

/* ============================== stats / progress ======================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 12px; background: rgba(14, 23, 41, .65); padding: 15px; }
.stat .v { font-size: 25px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat .sub { font-size: 11px; color: var(--dim); margin-top: 6px; }
.mastery-row { display: grid; grid-template-columns: 210px minmax(0, 1fr) 54px; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid rgba(148, 163, 184, .08); }
.mastery-row:last-child { border-bottom: 0; }
.mastery-name { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; min-width: 0; }
.mastery-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mastery-pct { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: repeat(26, 1fr); gap: 3px; margin-top: 10px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: rgba(148, 163, 184, .08); }
.heat i.l1 { background: rgba(52, 211, 153, .25); }
.heat i.l2 { background: rgba(52, 211, 153, .5); }
.heat i.l3 { background: rgba(52, 211, 153, .78); }
.heat i.l4 { background: #34d399; }

/* ============================== misc ==================================== */
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); font-size: 13.5px; }
.kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--text-2); background: rgba(148, 163, 184, .07); }
.hr { height: 1px; background: var(--line); border: 0; margin: 22px 0; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.grow { flex: 1; min-width: 0; }

.toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: 11px; border: 1px solid rgba(52, 211, 153, .35);
  background: linear-gradient(180deg, #122a30, #0c1a24); color: #d1fae5;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  animation: toastIn .3s var(--ease), toastOut .3s var(--ease) 3.2s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
.toast.xp { border-color: rgba(251, 191, 36, .4); background: linear-gradient(180deg, #2a2412, #191408); color: #fde68a; }

.modal-root { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: rgba(2, 6, 15, .7); backdrop-filter: blur(6px); }
.modal { width: min(560px, 100%); background: #0e1728; border: 1px solid var(--line-strong); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal p { font-size: 13.5px; color: var(--text-2); }
.modal .btn-row { margin-top: 18px; justify-content: flex-end; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(2, 6, 15, .6); z-index: 35; backdrop-filter: blur(2px); }

/* ============================== responsive ============================== */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .lab-shell { grid-template-columns: minmax(0, 1fr); }
  .task-panel { position: static; }
  .lesson-wrap { grid-template-columns: minmax(0, 1fr); }
  .aside { display: none; }
  .track-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .24s var(--ease); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; }
  .menu-btn { display: inline-flex; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-body { max-width: none; }
  .view { padding-top: 18px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .chip.lab-chip { display: none; }
}
@media (max-width: 640px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .hero-actions .btn { white-space: normal; height: auto; min-height: 38px; padding: 8px 16px; text-align: center; max-width: 100%; }
  .drill-progress { flex: 1; min-width: 0; }
  .drill-progress i { flex: 1; width: auto; min-width: 0; }
  .hstat { padding: 9px; }
  .hstat .v { font-size: 17px; }
  .hstat .k { font-size: 9px; letter-spacing: .06em; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .mastery-row { grid-template-columns: 120px minmax(0, 1fr) 42px; gap: 8px; }
  .lesson-body p, .lesson-body li { font-size: 14px; }
  .search-wrap { max-width: none; }
  .chip.streak, .chip.level { padding: 0 9px; }
  .lesson-nav { flex-direction: column; }
  .term { font-size: 11.8px; height: 52vh; }
  .exam-facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   Exam prep: mission, mock exams, Mistake Vault, arcade
   ========================================================================== */

/* ---- accessibility: visible keyboard focus, skip link ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.view:focus-visible, .search:focus-visible { outline: none; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 9px 14px; border-radius: 10px; background: var(--accent); color: #04121c; font-weight: 700; font-size: 13px; transition: top .15s; }
.skip-link:focus { top: 12px; }

/* ---- shared bits ---- */
.select { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: #101a2e; color: var(--text); font-size: 13.5px; max-width: 100%; color-scheme: dark; }
.select.sm { height: 30px; font-size: 12px; border-radius: 8px; padding: 0 8px; }
.nav + .nav { margin-top: -6px; }
.nav .side-title { margin: 4px 0 4px; }
.nav-badge.hot { background: rgba(251, 191, 36, .16); color: #fde68a; }
.nav-badge.live { background: rgba(248, 113, 113, .16); color: #fecaca; text-transform: uppercase; letter-spacing: .08em; font-size: 9.5px; }
.nav-badge:empty { display: none; }
.callout-inline { margin-top: 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, .28); background: rgba(251, 191, 36, .07); color: #fde68a; font-size: 12.5px; }

/* ---- mission card ---- */
.mission { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--tc, var(--accent)) 35%, transparent); background: linear-gradient(110deg, color-mix(in srgb, var(--tc, var(--accent)) 12%, #101a2e), #0d1526 55%); }
.mission-count { flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 2px solid color-mix(in srgb, var(--tc, var(--accent)) 60%, transparent); background: rgba(8, 12, 23, .55); }
.mission-count b { font-size: 36px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.mission-count small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.mission .h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mission-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.mission-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.prep-card { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.prep-ico { font-size: 24px; width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(148, 163, 184, .08); border: 1px solid var(--line); }
.prep-stat { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--accent); }
.prep-card.due { border-color: rgba(251, 191, 36, .4); }
.prep-card.due .prep-stat { color: var(--gold); }

/* ---- mock exam: lobby and setup ---- */
.exam-list { padding: 6px; }
.exam-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; border-left: 3px solid var(--tc); }
.exam-row + .exam-row { margin-top: 2px; }
.exam-row:hover { background: rgba(148, 163, 184, .06); }
.exam-row.live { background: rgba(248, 113, 113, .07); }
.exam-row-ico { font-size: 20px; width: 28px; text-align: center; flex: none; }
.exam-row-name { display: block; font-weight: 650; font-size: 14.5px; }
.exam-row-sub { display: block; font-size: 12px; color: var(--muted); }
.exam-row-score { text-align: right; flex: none; min-width: 84px; line-height: 1.15; }
.exam-row-score b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.exam-row-score b.ok { color: var(--good); }
.exam-row-score b.no { color: var(--warn); }
.exam-row-score small { font-size: 10.5px; color: var(--muted); }

.exam-setup { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.exam-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.exam-size { display: grid; gap: 2px; padding: 16px 12px; text-align: center; border-radius: 12px; cursor: pointer; border: 1px solid var(--line-strong); background: rgba(8, 13, 24, .5); transition: border-color .15s, background .15s, transform .12s; }
.exam-size:hover { border-color: var(--accent); background: rgba(56, 189, 248, .08); transform: translateY(-2px); }
.exam-size b { font-size: 15px; }
.exam-size span { font-size: 12px; color: var(--muted); }
.exam-size.rec { border-color: rgba(56, 189, 248, .5); }
.exam-rules { margin: 20px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; display: grid; gap: 6px; }
.exam-bp { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-2); padding: 5px 0; border-bottom: 1px dashed var(--line); }
.exam-bp:last-child { border-bottom: 0; }
.exam-hist { position: relative; height: 130px; display: flex; align-items: flex-end; gap: 6px; padding-top: 18px; }
.exam-hist-bar { flex: 1; max-width: 44px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.exam-hist-bar i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; background: var(--warn); opacity: .75; min-height: 3px; }
.exam-hist-bar.ok i { background: var(--good); }
.exam-hist-bar span { position: absolute; bottom: 4px; font-size: 10px; font-weight: 700; color: #06101c; font-variant-numeric: tabular-nums; }
.exam-hist-mark { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(231, 236, 246, .5); pointer-events: none; }
.exam-hist-mark span { position: absolute; right: 0; top: -15px; font-size: 10px; color: var(--muted); }

/* ---- mock exam: sitting ---- */
.exam-bar { position: sticky; top: 63px; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(11, 17, 32, .94); backdrop-filter: blur(10px); margin-bottom: 14px; }
.exam-bar-name { font-weight: 700; font-size: 14px; }
.exam-bar-sub { font-size: 12px; color: var(--muted); }
.exam-clock { font-family: var(--mono); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 4px 12px; border-radius: 8px; background: rgba(148, 163, 184, .08); border: 1px solid var(--line); }
.exam-clock.low { color: #fecaca; border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }
.exam-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: start; }
.exam-q .quiz-foot { flex-wrap: wrap; }
.qopt.picked { border-color: var(--accent); background: rgba(56, 189, 248, .12); color: var(--text); }
.qopt.picked .ql { background: var(--accent); color: #04121c; }
.btn.flagged { border-color: rgba(251, 191, 36, .5); background: rgba(251, 191, 36, .12); color: #fde68a; }
.exam-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.exam-grid button { aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--line); background: rgba(8, 13, 24, .5); color: var(--muted); font-size: 11.5px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; padding: 0; }
.exam-grid button.a { background: rgba(56, 189, 248, .16); border-color: rgba(56, 189, 248, .4); color: #bae6fd; }
.exam-grid button.f { border-color: var(--gold); box-shadow: inset 0 -3px 0 var(--gold); }
.exam-grid button.cur { outline: 2px solid var(--text); outline-offset: 1px; color: var(--text); }
.exam-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 10.5px; color: var(--muted); }
.exam-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--line-strong); margin-right: 4px; vertical-align: -1px; }
.exam-legend i.a { background: rgba(56, 189, 248, .4); border-color: transparent; }
.exam-legend i.f { box-shadow: inset 0 -3px 0 var(--gold); border-color: var(--gold); }

/* ---- mock exam: result ---- */
.exam-result { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius-lg); }
.exam-result.pass { border-color: rgba(52, 211, 153, .4); background: linear-gradient(120deg, rgba(52, 211, 153, .12), #0d1526 60%); }
.exam-result.fail { border-color: rgba(251, 191, 36, .35); background: linear-gradient(120deg, rgba(251, 191, 36, .09), #0d1526 60%); }
.exam-result .eyebrow { color: var(--warn); }
.exam-result.pass .eyebrow { color: var(--good); }
.exam-score { flex: none; width: 210px; text-align: center; }
.exam-score-num { font-size: 68px; font-weight: 800; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.exam-score-of { font-size: 12px; color: var(--muted); margin-top: 6px; }
.exam-gauge { position: relative; height: 8px; border-radius: 99px; background: rgba(148, 163, 184, .16); margin-top: 14px; }
.exam-gauge i { display: block; height: 100%; border-radius: 99px; background: var(--warn); }
.exam-result.pass .exam-gauge i { background: var(--good); }
.exam-gauge b { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--text); }
.exam-review { display: grid; gap: 6px; }
.exam-rev { border: 1px solid var(--line); border-radius: 10px; background: rgba(13, 21, 38, .8); }
.exam-rev summary { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; font-size: 13.5px; list-style: none; }
.exam-rev summary::-webkit-details-marker { display: none; }
.exam-rev-n { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: rgba(52, 211, 153, .14); color: #86efc7; }
.exam-rev.no .exam-rev-n { background: rgba(248, 113, 113, .14); color: #fecaca; }
.exam-rev-tag { flex: none; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.exam-rev.no .exam-rev-tag { color: #fca5a5; }
.exam-rev-body { padding: 4px 12px 14px 50px; display: grid; gap: 6px; }
.exam-rev-opt { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.exam-rev-opt .ql { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: rgba(148, 163, 184, .12); }
.exam-rev-opt.right { color: #d9fbec; }
.exam-rev-opt.right .ql { background: var(--good); color: #032018; }
.exam-rev-opt.wrong { color: #fee2e2; }
.exam-rev-opt.wrong .ql { background: var(--bad); color: #2c0505; }
.exam-rev-opt em { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-left: 6px; }

/* ---- Mistake Vault ---- */
.vault-eyebrow { color: var(--gold); }
.vault-boxes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.vault-box { position: relative; padding: 14px 12px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(13, 21, 38, .8); opacity: .6; overflow: hidden; }
.vault-box:before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: hsl(calc(8 + var(--i) * 34) 85% 62%); }
.vault-box.has { opacity: 1; border-color: var(--line-strong); }
.vault-box-n { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.vault-box-name { font-size: 11.5px; font-weight: 650; margin-top: 6px; color: var(--text-2); }
.vault-box-when { font-size: 10.5px; color: var(--muted); }
.vault-stage { max-width: 780px; margin: 0 auto; }
.vault-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.vault-empty { text-align: center; padding: 22px 0; display: grid; gap: 10px; justify-items: center; }
.vault-empty-ico { font-size: 42px; line-height: 1; }
.vault-empty p { max-width: 52ch; }

/* ---- arcade (deliberately its own world) ---- */
.arcade { --hue: 190; --neon: hsl(var(--hue) 95% 62%); --neon-dim: hsl(var(--hue) 80% 62% / .18); font-family: var(--mono); }
.arcade-marquee { text-align: center; padding: 26px 16px 30px; }
.arcade-sign { display: inline-block; font-size: clamp(40px, 9vw, 86px); font-weight: 800; letter-spacing: .22em; padding-left: .22em; line-height: 1; color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 18px hsl(320 100% 60%), 0 0 44px hsl(320 100% 55%), 0 0 90px hsl(280 100% 55%); animation: neon-flicker 5s linear infinite; }
@keyframes neon-flicker { 0%, 91%, 94%, 97%, 100% { opacity: 1; } 92%, 96% { opacity: .55; } }
.arcade-marquee p { max-width: 62ch; margin: 18px auto 0; color: var(--text-2); font-size: 13px; }
.cab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.cab { --neon: hsl(var(--hue) 95% 62%); display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 14px; border-radius: 16px 16px 8px 8px; border: 2px solid hsl(var(--hue) 70% 45% / .55); background: linear-gradient(180deg, hsl(var(--hue) 45% 12%), #070b14 70%); transition: transform .16s var(--ease), box-shadow .16s, border-color .16s; }
.cab:hover, .cab:focus-visible { transform: translateY(-4px); border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 18px 50px -18px var(--neon); }
.cab-screen { position: relative; height: 112px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 40%, hsl(var(--hue) 80% 30% / .7), #04070d 75%); border: 1px solid hsl(var(--hue) 70% 50% / .4); }
.cab-screen:after, .cab-stage:after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px); }
.cab-ico { font-size: 46px; filter: drop-shadow(0 0 14px var(--neon)); }
.cab-name { font-size: 16px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--neon); text-shadow: 0 0 12px hsl(var(--hue) 95% 62% / .6); }
.cab-blurb { font-family: var(--sans); font-size: 12.5px; color: var(--text-2); flex: 1; }
.cab-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted); padding-top: 8px; border-top: 1px dashed hsl(var(--hue) 60% 50% / .3); }
.cab-best { color: var(--gold); font-weight: 700; white-space: nowrap; }

.cab-stage { position: relative; max-width: 760px; margin: 0 auto; padding: clamp(18px, 3vw, 30px); border-radius: 22px; overflow: hidden; border: 2px solid var(--neon); background: radial-gradient(ellipse at 50% 0%, hsl(var(--hue) 70% 16%), #04070d 70%); box-shadow: 0 0 0 4px #04070d, 0 0 60px -12px var(--neon), inset 0 0 80px rgba(0, 0, 0, .6); min-height: 470px; }
.cab-stage > * { position: relative; z-index: 1; }
.cab-stage.shake { animation: cab-shake .3s; }
@keyframes cab-shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.cab-attract, .cab-over { text-align: center; display: grid; gap: 14px; justify-items: center; }
.cab-big { font-size: 60px; filter: drop-shadow(0 0 18px var(--neon)); }
.cab-title { font-size: clamp(26px, 5vw, 42px); letter-spacing: .12em; text-transform: uppercase; color: var(--neon); text-shadow: 0 0 18px hsl(var(--hue) 95% 62% / .7); }
.cab-attract p { font-family: var(--sans); color: var(--text-2); max-width: 46ch; }
.cab-how { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); text-align: left; }
.cab-how li:before { content: "> "; color: var(--neon); }
.cab-how b { color: var(--text); }
.cab-start { font-family: var(--mono); font-size: 15px; font-weight: 800; letter-spacing: .14em; padding: 14px 26px; border-radius: 10px; cursor: pointer; color: #04070d; background: var(--neon); border: 0; box-shadow: 0 0 26px -4px var(--neon); animation: cab-pulse 1.4s ease-in-out infinite; }
.cab-start .kbd { color: #04070d; border-color: rgba(4, 7, 13, .5); background: rgba(4, 7, 13, .12); margin-left: 8px; }
@keyframes cab-pulse { 50% { box-shadow: 0 0 44px 0 var(--neon); } }
.cab-hi { font-size: 12px; letter-spacing: .16em; color: var(--gold); }
.cab-hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.cab-hud small { display: block; font-size: 10px; letter-spacing: .2em; color: var(--muted); }
.cab-hud b { font-size: 26px; font-variant-numeric: tabular-nums; color: var(--neon); text-shadow: 0 0 12px hsl(var(--hue) 95% 62% / .6); }
.cab-hud b.low { color: var(--bad); text-shadow: 0 0 12px rgba(248, 113, 113, .7); }
.cab-timebar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); margin-top: 10px; overflow: hidden; }
.cab-timebar i { display: block; height: 100%; background: var(--neon); box-shadow: 0 0 12px var(--neon); transition: width .1s linear; }
.cab-pips { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.cab-pips i { width: 26px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.cab-pips i.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.cab-q { margin-top: 22px; text-align: center; }
.cab-sub { font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.cab-prompt { font-size: clamp(28px, 6vw, 46px); font-weight: 800; margin: 10px 0 22px; color: #fff; text-shadow: 0 0 16px hsl(var(--hue) 95% 62% / .55); overflow-wrap: anywhere; line-height: 1.15; }
.cab-prompt.wide { font-family: var(--sans); font-size: clamp(18px, 3vw, 24px); font-weight: 650; line-height: 1.35; min-height: 2.7em; }
.cab-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cab-opts.long { grid-template-columns: 1fr; }
.cab-opt { position: relative; font-family: var(--mono); font-size: 17px; font-weight: 700; padding: 16px 12px 16px 40px; min-height: 58px; border-radius: 12px; cursor: pointer; color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid hsl(var(--hue) 70% 55% / .4); overflow-wrap: anywhere; }
.cab-opts.long .cab-opt { font-family: var(--sans); font-size: 14.5px; text-align: left; font-weight: 600; }
.cab-opt span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 5px; font-family: var(--mono); }
.cab-opt:hover { background: var(--neon-dim); border-color: var(--neon); }
.cab-opt.right { background: rgba(52, 211, 153, .22); border-color: var(--good); color: #d9fbec; }
.cab-opt.wrong { background: rgba(248, 113, 113, .2); border-color: var(--bad); color: #fee2e2; }
.cab-final { font-size: clamp(48px, 11vw, 88px); font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 0 22px var(--neon); font-variant-numeric: tabular-nums; }
.cab-final.best { color: var(--gold); text-shadow: 0 0 26px rgba(251, 191, 36, .8); }
.cab-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 520px; }
.cab-stats b { display: block; font-size: 20px; color: var(--neon); }
.cab-stats small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cab-misses { width: 100%; display: grid; gap: 6px; text-align: left; }
.cab-misses .cab-sub { text-align: center; margin-bottom: 4px; }
.cab-miss { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .04); font-size: 12px; }
.cab-miss b { color: #fecaca; overflow-wrap: anywhere; }
.cab-miss span { font-family: var(--sans); color: var(--text-2); }

@media (max-width: 1100px) {
  .exam-setup { grid-template-columns: minmax(0, 1fr); }
  .exam-body { grid-template-columns: minmax(0, 1fr); }
  .exam-grid { grid-template-columns: repeat(10, 1fr); }
}
@media (max-width: 860px) {
  .exam-bar { top: 59px; }
  .vault-boxes { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .vault-box { padding: 12px 8px 10px; }
  .vault-box-when { display: none; }
  .vault-box-name { font-size: 10px; }
}
@media (max-width: 640px) {
  .mission { flex-direction: column; align-items: stretch; }
  .mission-count { align-self: center; }
  .mission-actions { flex-direction: row; flex-wrap: wrap; }
  .mission-form > * { flex: 1 1 100%; }
  .exam-row { flex-wrap: wrap; gap: 10px; }
  .exam-row-score { text-align: left; min-width: 0; }
  .exam-sizes { grid-template-columns: 1fr; }
  .exam-bar { flex-wrap: wrap; gap: 8px; }
  .exam-clock { font-size: 16px; }
  .exam-grid { grid-template-columns: repeat(7, 1fr); }
  .exam-score { width: 100%; }
  .exam-rev-body { padding-left: 12px; }
  .exam-rev summary { align-items: flex-start; }
  .drill-top { flex-wrap: wrap; }
  .vault-box-n { font-size: 21px; }
  .cab-opts { grid-template-columns: 1fr; }
  .cab-stats { grid-template-columns: repeat(2, 1fr); }
  .cab-miss { grid-template-columns: 1fr; gap: 2px; }
  .cab-stage { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .arcade-sign, .cab-start, .cab-stage.shake { animation: none !important; }
}

/* ================= phones, foldables and installed (PWA / Android) ================= */
/* Loaded last on purpose: these rules adjust the ones above and must win the cascade.
   env(safe-area-inset-*) is 0 unless the page is drawn under a notch, status bar or
   gesture bar (viewport-fit=cover), so desktop and the Windows app window are unchanged. */
.app { min-height: 100dvh; }
.sidebar {
  height: 100dvh; /* 100vh is taller than the visible area while a mobile URL bar shows */
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
}
.topbar {
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-left: max(clamp(16px, 3vw, 38px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 3vw, 38px), env(safe-area-inset-right, 0px));
}
.view {
  padding-left: max(clamp(16px, 3vw, 44px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 3vw, 44px), env(safe-area-inset-right, 0px));
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}
.toast-root {
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
}
.modal-root {
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
.task-panel { top: calc(78px + env(safe-area-inset-top, 0px)); }
.exam-bar { top: calc(63px + env(safe-area-inset-top, 0px)); }
@media (max-width: 860px) {
  .sidebar { width: calc(280px + env(safe-area-inset-left, 0px)); max-width: 88vw; }
  .topbar {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .exam-bar { top: calc(59px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 640px) {
  /* Cover screen (about 360 px): six across keeps every question button above 40 px. */
  .exam-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .toast-root { left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); max-width: none; }
}
/* Fingers, at any width: nothing you have to hit mid-exam or mid-lab is smaller than about 40 px. */
@media (pointer: coarse) {
  .exam-grid button { min-height: 40px; font-size: 12.5px; }
  .cab-opt { min-height: 60px; }
  .btn.sm, .filter-btn { height: 38px; }
  .btn.icon { width: 40px; height: 40px; }
  .term-tool { padding: 9px 11px; font-size: 11.5px; }
  .copy-btn { padding: 8px 11px; }
}
