/* ============================================================
   Học GitHub cho Unreal Engine — stylesheet
   Content-first, calm, with a light/dark theme via CSS vars.
   ============================================================ */

:root {
  --accent: #6c47ff;
  --accent-strong: #5636d6;
  --accent-soft: #efeaff;
  --ok: #1a9d5a;
  --ok-soft: #e6f6ec;
  --warn: #b8860b;
  --danger: #d1453b;

  --bg: #f6f7fb;
  --bg-panel: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-code: #f2f2f7;
  --bg-inline-code: #eeeaf9;
  --text: #1f2430;
  --text-soft: #5a6273;
  --text-faint: #8b93a3;
  --border: #e6e8ef;
  --border-strong: #d5d8e2;
  --shadow: 0 1px 3px rgba(20, 22, 40, 0.06), 0 8px 24px rgba(20, 22, 40, 0.05);

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 300px;
  --content-w: 1180px;
  --read-w: 880px;

  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", ui-monospace, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --accent: #9b83ff;
  --accent-strong: #b3a1ff;
  --accent-soft: #2a2350;
  --ok: #46c07f;
  --ok-soft: #17321f;
  --warn: #e0b64a;
  --danger: #ff6b61;

  --bg: #0f1117;
  --bg-panel: #171a22;
  --bg-sidebar: #14161d;
  --bg-code: #0c0e14;
  --bg-inline-code: #262233;
  --text: #e6e8ef;
  --text-soft: #a5adbd;
  --text-faint: #727a8b;
  --border: #262a35;
  --border-strong: #333846;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.2s ease;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff; border-radius: 11px; font-size: 22px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--text-faint); font-size: 12px; }

.sidebar-progress { padding: 0 20px 14px; }
.sp-bar {
  height: 8px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.sp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 99px; transition: width 0.4s ease;
}
.sp-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-soft); margin-top: 7px;
}

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.nav-module { margin-bottom: 6px; }
.nav-module-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint);
  padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: 14px;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav-link.active {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  font-weight: 600;
}
.nav-ico { font-size: 15px; width: 18px; text-align: center; flex: none; }
.nav-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-check {
  flex: none; width: 18px; height: 18px; border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; font-size: 11px; color: transparent;
}
.nav-link.done .nav-check {
  background: var(--ok); border-color: var(--ok); color: #fff;
}

.sidebar-footer { padding: 12px 20px; border-top: 1px solid var(--border); }
.link-btn {
  background: none; border: none; color: var(--text-faint);
  font-size: 13px; cursor: pointer; padding: 4px 0;
}
.link-btn:hover { color: var(--danger); }

.sidebar-toggle {
  position: fixed; top: 14px; left: 14px; z-index: 50;
  display: none; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; width: 40px; height: 40px; font-size: 18px; cursor: pointer;
  color: var(--text); box-shadow: var(--shadow);
}

/* ---------------- Main ---------------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.crumb { color: var(--text-soft); font-size: 14px; }
.crumb b { color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.xp-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 12px; font-size: 13px;
}
.xp-level { font-weight: 700; color: var(--accent); }
.xp-val { color: var(--text-soft); }

.icon-btn {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; width: 38px; height: 38px; font-size: 17px;
  cursor: pointer; color: var(--text);
}
.icon-btn:hover { border-color: var(--border-strong); }

.content {
  max-width: var(--content-w);
  margin: 0 auto; padding: 34px 32px 20px;
  outline: none;
}

.page-nav {
  max-width: var(--content-w); margin: 0 auto;
  padding: 10px 32px 60px;
  display: flex; justify-content: space-between; gap: 16px;
}
.page-nav a {
  flex: 1; max-width: 48%;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; background: var(--bg-panel);
  display: flex; flex-direction: column; gap: 2px;
}
.page-nav a:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.page-nav a.next { text-align: right; align-items: flex-end; }
.page-nav .pn-label { font-size: 12px; color: var(--text-faint); }
.page-nav .pn-title { color: var(--text); font-weight: 600; font-size: 15px; }

/* ---------------- Lesson two-column layout ---------------- */
.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  gap: 52px;
  align-items: start;
}
.lesson-grid.no-rail { grid-template-columns: 1fr; }
.lesson-main { min-width: 0; max-width: var(--read-w); }
.lesson-grid.no-rail .lesson-main { max-width: 980px; }

.lesson-rail { position: sticky; top: 88px; align-self: start; }
.toc { border-left: 2px solid var(--border); padding-left: 2px; }
.toc-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-faint); padding: 0 0 8px 16px;
}
.toc-nav { display: flex; flex-direction: column; }
.toc-link {
  color: var(--text-soft); font-size: 13.5px; line-height: 1.45;
  padding: 5px 0 5px 16px; margin-left: -2px;
  border-left: 2px solid transparent;
}
.toc-link:hover { color: var(--text); text-decoration: none; }
.toc-link.toc-sub { padding-left: 28px; font-size: 13px; color: var(--text-faint); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-practice {
  display: block; margin: 14px 0 0 16px; font-weight: 600; font-size: 13.5px;
  color: var(--accent-strong);
}
.toc-practice:hover { text-decoration: none; opacity: 0.8; }

/* ---------------- Practice section (clear separation) ---------------- */
.practice { margin-top: 60px; padding-top: 32px; border-top: 2px dashed var(--border-strong); }
.practice-head { margin-bottom: 20px; }
.practice-eyebrow {
  color: var(--accent); font-weight: 700; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.practice-head h2 { margin: 8px 0 4px; font-size: 25px; }
.practice-head p { color: var(--text-soft); margin: 0; font-size: 15.5px; }

/* in-content prev/next (aligned with the reading column) */
.page-nav.in-content { max-width: none; margin: 0; padding: 26px 0 48px; }

/* heading scroll offset under the sticky top bar */
.article h2, .article h3 { scroll-margin-top: 88px; }
#luyen-tap { scroll-margin-top: 78px; }

/* ---------------- Lesson content typography ---------------- */
.lesson h1 { font-size: 30px; line-height: 1.25; margin: 0 0 6px; }
.lesson .lesson-kicker { color: var(--accent); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.article { font-size: 16.5px; }
.article h2 { font-size: 23px; margin: 34px 0 12px; padding-top: 8px; }
.article h3 { font-size: 19px; margin: 26px 0 10px; }
.article h4 { font-size: 16px; margin: 22px 0 8px; color: var(--text-soft); }
.article p { margin: 12px 0; }
.article ul, .article ol { margin: 12px 0; padding-left: 26px; }
.article li { margin: 5px 0; }
.article strong { color: var(--text); font-weight: 700; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.article a { text-decoration: underline; text-underline-offset: 2px; }

.article code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--bg-inline-code); color: var(--accent-strong);
  padding: 2px 6px; border-radius: 6px;
}
.article pre {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; overflow-x: auto;
  margin: 16px 0; position: relative;
}
.article pre code {
  background: none; color: var(--text); padding: 0; font-size: 13.5px; line-height: 1.6;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text-soft); border-radius: 6px; font-size: 12px;
  padding: 3px 9px; cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.article pre:hover .copy-btn { opacity: 1; }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

/* tables */
.article table {
  width: 100%; border-collapse: collapse; margin: 18px 0;
  font-size: 14.5px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: table;
}
.article thead { background: var(--bg); }
.article th, .article td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article th { font-weight: 700; font-size: 13px; color: var(--text-soft); }
.article tr:last-child td { border-bottom: none; }
.article td code { white-space: nowrap; }

/* callouts */
.callout {
  border: 1px solid var(--border); border-left: 4px solid var(--text-faint);
  background: var(--bg-panel); border-radius: var(--radius);
  padding: 12px 16px; margin: 18px 0;
}
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.callout-icon { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.callout-body > :first-child { margin-top: 4px; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-note { border-left-color: var(--accent); }
.callout-note .callout-title { color: var(--accent-strong); }
.callout-note .callout-icon { background: var(--accent); }
.callout-tip { border-left-color: var(--ok); }
.callout-tip .callout-title { color: var(--ok); }
.callout-tip .callout-icon { background: var(--ok); }
.callout-important { border-left-color: var(--accent-strong); }
.callout-important .callout-title { color: var(--accent-strong); }
.callout-important .callout-icon { background: var(--accent-strong); }
.callout-warning { border-left-color: var(--warn); }
.callout-warning .callout-title { color: var(--warn); }
.callout-warning .callout-icon { background: var(--warn); }
.callout-caution { border-left-color: var(--danger); }
.callout-caution .callout-title { color: var(--danger); }
.callout-caution .callout-icon { background: var(--danger); }

/* details / answer reveal */
.article details {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 16px; margin: 16px 0; background: var(--bg-panel);
}
.article details[open] { border-color: var(--accent); }
.article summary {
  cursor: pointer; font-weight: 600; padding: 10px 0; color: var(--accent-strong);
  list-style: none;
}
.article summary::-webkit-details-marker { display: none; }
.article summary::before { content: "▸ "; }
.article details[open] summary::before { content: "▾ "; }

/* practice heading (🧪) gets a subtle highlight */
.article h4:has(+ p),
.article h4 { }

/* ---------------- Interactive: quiz ---------------- */
.widget {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-panel); box-shadow: var(--shadow);
  padding: 22px 24px; margin: 26px 0;
}
.widget-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.widget-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #fff; background: var(--accent); padding: 3px 10px; border-radius: 99px;
}
.widget-badge.cmd { background: var(--ok); }
.widget h3.widget-title { margin: 0; font-size: 18px; }
.widget-sub { color: var(--text-soft); font-size: 14px; margin: 2px 0 16px; }

.quiz-q { margin: 18px 0; padding-top: 16px; border-top: 1px dashed var(--border); }
.quiz-q:first-of-type { border-top: none; padding-top: 0; }
.quiz-prompt { font-weight: 600; margin-bottom: 12px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; cursor: pointer; font-size: 15px; background: var(--bg);
  transition: border-color 0.12s, background 0.12s;
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt .opt-key {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border-strong); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-soft);
}
.quiz-opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.quiz-opt.correct .opt-key { background: var(--ok); color: #fff; border-color: var(--ok); }
.quiz-opt.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.quiz-opt.wrong .opt-key { background: var(--danger); color: #fff; border-color: var(--danger); }
.quiz-opt.locked { cursor: default; opacity: 0.85; }
.quiz-opt.locked:hover { border-color: var(--border); }
.quiz-opt.correct.locked:hover { border-color: var(--ok); }
.quiz-explain {
  margin-top: 10px; font-size: 14px; color: var(--text-soft);
  background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px;
  border-left: 3px solid var(--ok); display: none;
}
.quiz-explain.show { display: block; }

/* ---------------- Interactive: command challenge ---------------- */
.cmd-item { margin: 16px 0; padding-top: 16px; border-top: 1px dashed var(--border); }
.cmd-item:first-of-type { border-top: none; padding-top: 0; }
.cmd-task { font-weight: 600; margin-bottom: 10px; }
.cmd-input-row { display: flex; align-items: stretch; gap: 8px; }
.cmd-prompt-sign {
  font-family: var(--mono); color: var(--ok); font-weight: 700;
  display: flex; align-items: center; padding-left: 4px;
}
.cmd-input {
  flex: 1; font-family: var(--mono); font-size: 14px;
  background: var(--bg-code); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.cmd-input:focus { outline: none; border-color: var(--accent); }
.cmd-input.ok { border-color: var(--ok); }
.cmd-input.no { border-color: var(--danger); }
.cmd-btn {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); padding: 0 16px; font-weight: 600; cursor: pointer;
}
.cmd-btn:hover { background: var(--accent-strong); }
.cmd-feedback { font-size: 13.5px; margin-top: 8px; min-height: 18px; }
.cmd-feedback.ok { color: var(--ok); }
.cmd-feedback.no { color: var(--danger); }
.cmd-feedback .cmd-hint { color: var(--text-soft); }
.cmd-reveal { font-family: var(--mono); background: var(--bg-code); padding: 2px 6px; border-radius: 5px; }

/* mark-complete bar */
.complete-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 34px 0 10px; padding: 18px 22px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg-panel);
}
.complete-bar .cb-text b { display: block; }
.complete-bar .cb-text span { color: var(--text-soft); font-size: 14px; }
.btn {
  border: none; border-radius: var(--radius-sm); padding: 11px 20px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); }
.btn.done { background: var(--ok); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---------------- Dashboard ---------------- */
.hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff; border-radius: 18px; padding: 32px 34px; margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero p { margin: 0 0 20px; opacity: 0.92; max-width: 60ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn { background: #fff; color: var(--accent-strong); }
.hero-cta .btn:hover { background: #f0edff; }
.hero-cta .btn.ghost { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.5); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px;
}
.stat-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-align: center;
}
.stat-num { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }

.panel {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; margin-bottom: 22px;
}
.panel h2 { margin: 0 0 4px; font-size: 19px; }
.panel .panel-sub { color: var(--text-soft); font-size: 14px; margin: 0 0 14px; }

.ring-wrap { display: flex; align-items: center; gap: 22px; }
.ring { --p: 0; width: 120px; height: 120px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-txt {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 26px; font-weight: 800; color: var(--text);
}
.level-info .lv-title { font-size: 20px; font-weight: 800; }
.level-info .lv-sub { color: var(--text-soft); font-size: 14px; margin: 2px 0 12px; }
.xp-track { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; width: 240px; max-width: 100%; }
.xp-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: 99px; }
.level-info .lv-next { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.module-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 0;
  border-top: 1px solid var(--border); cursor: pointer;
}
.module-row:first-child { border-top: none; }
.module-row:hover .mr-name { color: var(--accent); }
.mr-name { flex: 1; font-weight: 600; }
.mr-bar { width: 120px; height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.mr-bar > i { display: block; height: 100%; background: var(--ok); }
.mr-count { font-size: 13px; color: var(--text-soft); width: 42px; text-align: right; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.badge {
  text-align: center; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 8px; background: var(--bg); opacity: 0.45; filter: grayscale(1);
}
.badge.earned { opacity: 1; filter: none; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge .b-ico { font-size: 28px; }
.badge .b-name { font-size: 12px; font-weight: 600; margin-top: 4px; }
.badge .b-desc { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ---------------- Cheatsheet search ---------------- */
.cheat-search {
  width: 100%; font-size: 15px; padding: 12px 16px; margin: 4px 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-panel); color: var(--text); font-family: var(--sans);
}
.cheat-search:focus { outline: none; border-color: var(--accent); }
.cheat-hint { font-size: 13px; color: var(--text-faint); margin-bottom: 8px; }
tr.cheat-hidden { display: none; }
.cheat-group-title { font-size: 15px !important; margin: 22px 0 6px !important; color: var(--accent-strong); }
.cheat-table td:first-child { width: 42%; }
.cheat-table td:first-child code { white-space: nowrap; background: var(--bg-inline-code); }

/* ---------------- Graduation checklist ---------------- */
.grad-list { list-style: none; padding: 0; margin: 8px 0 0; }
.grad-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px;
  cursor: pointer; background: var(--bg);
}
.grad-item:hover { border-color: var(--accent); }
.grad-item.checked { background: var(--ok-soft); border-color: var(--ok); }
.grad-box {
  flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-strong);
  display: grid; place-items: center; color: transparent; font-size: 14px; margin-top: 1px;
}
.grad-item.checked .grad-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.grad-item.checked .grad-text { text-decoration: line-through; color: var(--text-soft); }

/* ---------------- Daily review: sidebar link ---------------- */
.nav-review {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 8px 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.nav-review:hover { text-decoration: none; border-color: var(--accent); }
.nav-review.active { box-shadow: 0 0 0 2px var(--accent) inset; }
.nr-ico { font-size: 18px; }
.nr-main { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.nr-main b { font-size: 14px; }
.nr-sub { font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.nr-badge.zero { background: var(--ok); }

/* ---------------- Daily review: dashboard banner ---------------- */
.review-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; margin-bottom: 22px; border-radius: var(--radius);
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
}
.review-banner:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); }
.review-banner.due { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.rb-ico { font-size: 26px; flex: none; }
.rb-text { flex: 1; display: flex; flex-direction: column; }
.rb-text b { font-size: 15.5px; }
.rb-text span { font-size: 13.5px; color: var(--text-soft); }
.rb-cta { flex: none; font-weight: 700; color: var(--accent); }

/* ---------------- Daily review: page ---------------- */
.review-wrap { max-width: 860px; margin: 0 auto; }

.review-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff; border-radius: 18px; padding: 30px 32px; margin-bottom: 22px;
}
.rh-eyebrow { font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.9; }
.rh-left h1 { margin: 8px 0; font-size: 27px; }
.rh-left p { margin: 0 0 18px; opacity: 0.92; max-width: 52ch; }
.rh-actions .btn { background: #fff; color: var(--accent-strong); }
.rh-actions .btn:hover { background: #f0edff; }
.rh-actions .btn.ghost { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.55); }
.rh-streak { flex: none; text-align: center; }
.streak-flame { font-size: 44px; filter: grayscale(1) opacity(0.55); }
.streak-flame.on { filter: none; }
.streak-num { font-size: 30px; font-weight: 800; line-height: 1; }
.streak-lbl { font-size: 12px; opacity: 0.9; }

.review-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.review-done .review-stats { grid-template-columns: repeat(3, 1fr); max-width: 480px; margin: 20px auto 24px; }

.mastery-track { height: 12px; background: var(--border); border-radius: 99px; overflow: hidden; }
.mastery-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: 99px; transition: width 0.4s; }
.mastery-lbl { margin-top: 8px; font-size: 13.5px; color: var(--text-soft); }
ul.review-how { margin: 0; padding-left: 20px; color: var(--text-soft); font-size: 14.5px; line-height: 1.85; }
ul.review-how b { color: var(--text); }

/* review card session */
.review-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px;
}
.rt-quit { background: none; border: none; color: var(--text-faint); font-size: 14px; cursor: pointer; padding: 6px 2px; }
.rt-quit:hover { color: var(--danger); }
.rt-progress { flex: 1; display: flex; align-items: center; gap: 12px; }
.rt-bar { flex: 1; max-width: 420px; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.rt-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.rt-progress span { font-size: 13px; color: var(--text-soft); white-space: nowrap; }
.rt-streak { font-weight: 700; font-size: 14px; }

.review-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 30px; min-height: 260px;
}
.rc-source { font-size: 12.5px; color: var(--text-faint); margin-bottom: 16px; }
.rc-prompt { font-size: 19px; font-weight: 600; line-height: 1.45; margin-bottom: 20px; }
.review-card .quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.rc-explain { margin-top: 14px; }
.rc-reveal { display: block; margin-top: 12px; }
.rc-foot { margin-top: 24px; display: flex; justify-content: flex-end; }
.rc-next:disabled { opacity: 0.5; cursor: default; }

.review-done { text-align: center; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 40px 32px; box-shadow: var(--shadow); }
.rd-emoji { font-size: 56px; }
.review-done h1 { margin: 8px 0; font-size: 27px; }
.review-done > p { color: var(--text-soft); }
.rd-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.rd-tip { margin-top: 20px; font-size: 13.5px; color: var(--text-faint); }

@media (max-width: 720px) {
  .review-hero { flex-direction: column; align-items: flex-start; }
  .review-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 22px; border-radius: 99px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .t-ico { margin-right: 8px; }

/* confetti */
.confetti-piece {
  position: fixed; width: 9px; height: 14px; top: -20px; z-index: 90;
  pointer-events: none; border-radius: 2px;
}

/* ---------------- highlight.js tokens (theme-aware) ---------------- */
.hljs-comment, .hljs-quote { color: var(--text-faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name, .hljs-section { color: var(--accent-strong); }
.hljs-string, .hljs-attr, .hljs-template-tag { color: var(--ok); }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-title { color: var(--warn); }
.hljs-meta, .hljs-symbol, .hljs-bullet { color: var(--danger); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------------- Responsive (desktop-first; graceful narrow) ---------------- */
@media (max-width: 1240px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-rail { display: none; }
  .lesson-main { max-width: 980px; margin: 0 auto; }
}
@media (max-width: 1080px) {
  .dash-cols { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .topbar { padding-left: 66px; }
  .content, .page-nav { padding-left: 20px; padding-right: 20px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
