:root {
  --blue:        #0066ff;
  --blue-dark:   #0050cc;
  --blue-dim:    #e8f0ff;
  --navy:        #0a0f1e;
  --surface:     #ffffff;
  --surface-2:   #f7f9fc;
  --surface-3:   #eef2f8;
  --border:      #dde4f0;
  --text:        #0d1117;
  --text-mid:    #3d4a5c;
  --text-muted:  #7a8a9e;
  --green:       #16a34a;
  --green-dim:   #dcfce7;
  --amber:       #d97706;
  --amber-dim:   #fef3c7;
  --red:         #dc2626;
  --red-dim:     #fee2e2;
  --purple:      #7c3aed;
  --purple-dim:  #ede9fe;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
  --shadow:      0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.10);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NAV ──────────────────────────────────────── */
.site-nav {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 12px;
}
.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 17px; color: #fff;
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.nav-mark {
  width: 26px; height: 26px; background: var(--blue);
  border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700;
  color: #fff; font-family: 'DM Sans', sans-serif;
}
.nav-divider { color: rgba(255,255,255,0.2); }
.nav-crumbs {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: rgba(255,255,255,0.45);
}
.nav-crumbs a { color: inherit; text-decoration: none; transition: color 0.15s; }
.nav-crumbs a:hover { color: rgba(255,255,255,0.8); }
.nav-crumbs .here { color: rgba(255,255,255,0.85); font-weight: 500; }

/* ── HERO ─────────────────────────────────────── */
.hero {
  background: var(--navy);
  padding: 48px 24px 56px;
  text-align: center;
}
.hero-inner {
  max-width: 720px; margin: 0 auto;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 5px 14px;
  font-size: 11px; font-weight: 600; color: var(--blue);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 38px; font-weight: 400;
  color: #fff; line-height: 1.2;
  margin-bottom: 14px;
}
.hero p {
  font-size: 15px; color: rgba(255,255,255,0.55);
  line-height: 1.65; max-width: 540px; margin: 0 auto 24px;
}
.hero-stats {
  display: flex; justify-content: center; gap: 28px;
  margin-top: 6px;
}
.hero-stat {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: rgba(255,255,255,0.45);
}
.hero-stat-num {
  font-family: 'DM Mono', monospace;
  font-weight: 600; font-size: 15px;
  color: rgba(255,255,255,0.85);
}

/* ── PROGRESS BAR ─────────────────────────────── */
.course-progress {
  max-width: 1200px; margin: -24px auto 0;
  padding: 0 24px;
  position: relative; z-index: 10;
}
.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px;
}
.prog-label {
  font-size: 12px; font-weight: 600; color: var(--text-mid);
  white-space: nowrap;
}
.prog-track {
  flex: 1; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.prog-fill {
  height: 100%; background: var(--blue);
  border-radius: 3px; transition: width 0.4s ease;
}
.prog-pct {
  font-family: 'DM Mono', monospace;
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}

/* ── PAGE LAYOUT ──────────────────────────────── */
.page {
  max-width: 1200px; margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: 1fr 288px;
  gap: 22px;
  align-items: start;
}
.main { min-width: 0; }
.aside {
  position: sticky; top: 74px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── TOPIC CARD ───────────────────────────────── */
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.topic-card:hover {
  box-shadow: var(--shadow);
  border-color: #c5d0e0;
}
.topic-head {
  padding: 18px 22px 16px;
  display: flex; align-items: flex-start; gap: 14px;
  cursor: pointer;
  user-select: none;
}
.topic-num {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--blue); color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topic-info { flex: 1; min-width: 0; }
.topic-title {
  font-family: 'DM Serif Display', serif;
  font-size: 19px; font-weight: 400;
  color: var(--text); line-height: 1.3;
  margin-bottom: 4px;
}
.topic-meta {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 12px;
}
.topic-meta-item {
  display: flex; align-items: center; gap: 4px;
}
.topic-chevron {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s, background 0.15s;
  margin-top: 4px;
}
.topic-card.open .topic-chevron {
  transform: rotate(180deg);
  background: var(--blue-dim);
  color: var(--blue);
}
.topic-prog {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.topic-prog-track {
  flex: 1; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.topic-prog-fill {
  height: 100%; border-radius: 2px;
  background: var(--blue);
  transition: width 0.3s;
}
.topic-prog-label {
  font-size: 11px; color: var(--text-muted);
  font-weight: 500; white-space: nowrap;
}

/* ── UNIT LIST (inside topic) ─────────────────── */
.topic-body {
  border-top: 1px solid var(--border);
  padding: 0;
  display: none;
}
.topic-card.open .topic-body {
  display: block;
}
.unit-list {
  list-style: none;
}
.unit-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  text-decoration: none; color: inherit;
}
.unit-item:last-child { border-bottom: none; }
.unit-item:hover { background: var(--surface-2); }
.unit-num {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.unit-item.done .unit-num {
  background: var(--green); color: #fff;
}
.unit-item.active .unit-num {
  background: var(--blue); color: #fff;
}
.unit-body { flex: 1; min-width: 0; }
.unit-title {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  line-height: 1.35;
}
.unit-item.done .unit-title { color: var(--text-mid); }
.unit-item.active .unit-title { color: var(--blue); font-weight: 600; }
.unit-detail {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 2px;
}
.unit-status {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.unit-status.s-done {
  background: var(--green-dim); color: var(--green);
}
.unit-status.s-active {
  background: var(--blue-dim); color: var(--blue);
}
.unit-status.s-locked {
  background: var(--surface-3); color: var(--text-muted);
}
.unit-arrow {
  color: var(--text-muted); font-size: 14px;
  flex-shrink: 0; opacity: 0;
  transition: opacity 0.15s;
}
.unit-item:hover .unit-arrow { opacity: 1; }

/* ── SIDEBAR ──────────────────────────────────── */
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.side-head {
  padding: 11px 15px; border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.side-body { padding: 13px 14px; }

/* sidebar topic nav */
.side-topic-list {
  display: flex; flex-direction: column; gap: 2px;
}
.side-topic {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 7px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.side-topic:hover { background: var(--surface-2); color: var(--text-mid); }
.side-topic.st-active {
  background: var(--blue-dim); color: var(--blue); font-weight: 600;
}
.side-topic-num {
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.side-topic.st-active .side-topic-num {
  background: var(--blue); color: #fff;
}

/* sidebar spec card */
.spec-list {
  display: flex; flex-direction: column; gap: 4px;
}
.spec-item {
  font-size: 12px; color: var(--text-mid);
  padding: 4px 0; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 6px;
}
.spec-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
  margin-top: 7px;
}

/* sidebar resources */
.res-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-mid);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.res-link:hover { background: var(--surface-2); color: var(--blue); }
.res-icon {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}

/* ── TAG ──────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: 0.02em;
}
.tag-blue  { background: var(--blue-dim);  color: var(--blue); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-amber { background: var(--amber-dim); color: var(--amber); }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
  }
  .aside {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .hero h1 { font-size: 28px; }
  .hero-stats { gap: 16px; flex-wrap: wrap; }
}
@media (max-width: 540px) {
  .aside {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 24px; }
  .hero-stats { flex-direction: column; gap: 8px; }
  .topic-head { padding: 14px 16px 12px; }
  .unit-item { padding: 11px 16px; }
}

/* ── STAGE TAGS ───────────────────────────────── */
.stage-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: 0.02em;
}
.stage-intro { background: var(--purple-dim); color: var(--purple); }
.stage-1 { background: var(--blue-dim); color: var(--blue); }
.stage-2 { background: var(--amber-dim); color: var(--amber); }
.stage-3 { background: var(--green-dim); color: var(--green); }
.unit-item.passage .unit-num { background: var(--purple); color: #fff; font-size: 9px; }
