/* ===================================================
   Python Experiments — Design System 2026
   Dark-first, modern, tutorial-grade CSS
   =================================================== */

/* ── Design Tokens ─────────────────────────────── */
:root {
  --bg:           #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #1c2128;
  --bg-overlay:   #21262d;
  --border:       #30363d;
  --border-muted: #21262d;

  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-subtle:  #656d76;

  --accent:       #58a6ff;
  --accent-dim:   #1f6feb;
  --accent-glow:  rgba(88,166,255,.18);

  --green:        #3fb950;
  --green-dim:    #1a4a2e;
  --green-glow:   rgba(63,185,80,.15);

  --yellow:       #e3b341;
  --yellow-dim:   #3d2e00;

  --red:          #f85149;
  --red-dim:      #3d1212;

  --purple:       #bc8cff;
  --purple-dim:   #2d1f45;

  --cyan:         #39d0d8;

  --sidebar-w:    260px;
  --toc-w:        220px;
  --header-h:     56px;
  --content-max:  780px;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.4);
  --shadow:       0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.6);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code",
               "Consolas", "Courier New", monospace;

  --transition: .18s cubic-bezier(.4,0,.2,1);
}

/* Light mode override */
[data-theme="light"] {
  --bg:           #ffffff;
  --bg-surface:   #f6f8fa;
  --bg-elevated:  #eaeef2;
  --bg-overlay:   #e1e4e8;
  --border:       #d0d7de;
  --border-muted: #eaeef2;
  --text:         #1f2328;
  --text-muted:   #57606a;
  --text-subtle:  #6e7781;
  --accent-glow:  rgba(9,105,218,.12);
  --green-glow:   rgba(31,136,61,.12);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.12);
  --shadow:       0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.12);
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}
.sidebar-logo .logo-text {
  font-size: 16px; font-weight: 700; letter-spacing: -.3px;
}
.sidebar-logo .logo-sub {
  font-size: 10px; color: var(--text-muted); display: block; margin-top: 1px;
}

/* Overall progress bar in sidebar */
.sidebar-progress {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-progress-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted); margin-bottom: 7px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.progress-bar {
  height: 6px; background: var(--bg-overlay);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* Sidebar lesson groups */
.sidebar-group {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-muted);
}
.sidebar-group:last-child { border-bottom: none; }

.sidebar-group-label {
  padding: 6px 20px 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-subtle);
  display: flex; align-items: center; gap: 6px;
}
.level-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.level-dot.beginner  { background: var(--green); }
.level-dot.intermediate { background: var(--yellow); }
.level-dot.advanced  { background: var(--red); }

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  position: relative;
}
.sidebar-link:hover {
  color: var(--text);
  background: var(--bg-elevated);
}
.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-link.completed { color: var(--text); }
.sidebar-link.completed .link-check { opacity: 1; }

.link-emoji { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }

.link-check {
  margin-left: auto;
  width: 16px; height: 16px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #0d1117;
  opacity: 0; flex-shrink: 0;
  transition: opacity var(--transition);
}

/* Sidebar theme toggle */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; background: none; border: none;
  color: var(--text-muted); font-family: var(--font);
  padding: 6px 10px; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-overlay); color: var(--text); }
.theme-toggle .toggle-track {
  width: 32px; height: 18px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 9px; position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.theme-toggle .toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
[data-theme="light"] .toggle-track { background: var(--accent-dim); }
[data-theme="light"] .toggle-thumb { left: 16px; background: white; }

.coffee-link {
  font-size: 12px; text-decoration: none;
  color: var(--text-muted);
  padding: 6px 10px; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.coffee-link:hover { background: var(--yellow-dim); color: var(--yellow); }

/* ── Mobile sidebar overlay ────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.visible { display: block; }

/* ── Main layout ───────────────────────────────── */
.page-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 0 40px 80px;
  max-width: calc(var(--content-max) + 80px);
}

/* ── Top bar (mobile) ──────────────────────────── */
.topbar {
  display: none;
  position: sticky; top: 0;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  align-items: center; gap: 12px;
  padding: 0 16px;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.topbar-title {
  font-size: 15px; font-weight: 600;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.menu-btn:hover { background: var(--bg-overlay); }
.menu-btn svg { width: 20px; height: 20px; }

/* ── Lesson header ─────────────────────────────── */
.lesson-hero {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 36px;
}
.lesson-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.level-badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.level-badge.beginner  { background: var(--green-dim);  color: var(--green); }
.level-badge.intermediate { background: var(--yellow-dim); color: var(--yellow); }
.level-badge.advanced  { background: var(--red-dim);    color: var(--red); }

.lesson-time {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}

.lesson-title {
  font-size: 32px; font-weight: 800;
  letter-spacing: -.5px; line-height: 1.2;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--text) 60%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lesson-desc {
  font-size: 16px; color: var(--text-muted); max-width: 600px;
  line-height: 1.6;
}

/* ── Breadcrumb ────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-subtle);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }

/* ── Section: concept block ────────────────────── */
.concept {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin: 24px 0;
  position: relative;
  transition: border-color var(--transition);
}
.concept:hover { border-color: var(--border-muted); }

.concept h2 {
  font-size: 19px; font-weight: 700;
  margin-bottom: 12px; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 8px;
}
.concept h2::before {
  content: '';
  display: inline-block; width: 4px; height: 18px;
  background: var(--accent);
  border-radius: 2px; flex-shrink: 0;
}

.concept p {
  color: var(--text-muted); margin-bottom: 16px; font-size: 15px;
}
.concept p:last-child { margin-bottom: 0; }

.concept ul, .concept ol {
  color: var(--text-muted); padding-left: 20px; font-size: 15px;
}
.concept li { margin-bottom: 6px; }
.concept li strong { color: var(--text); }

/* ── Code blocks ───────────────────────────────── */
.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1117;
}

.code-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-surface);
  padding: 2px 8px; border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}
.code-actions { display: flex; gap: 6px; }

.btn-icon {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-muted); padding: 4px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 11px; font-family: var(--font);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-overlay); color: var(--text); border-color: var(--text-subtle); }
.btn-icon.copied { color: var(--green); border-color: var(--green); }
.btn-icon.running { color: var(--yellow); border-color: var(--yellow); }
.btn-icon svg { width: 12px; height: 12px; }

.code-block pre {
  margin: 0; padding: 18px 20px;
  overflow-x: auto; font-size: 13.5px;
  line-height: 1.7;
  font-family: var(--font-mono);
}

/* Output panel */
.code-output {
  border-top: 1px solid var(--border);
  background: #070b0f;
  display: none;
}
.code-output.visible { display: block; }
.output-header {
  padding: 6px 14px;
  font-size: 11px; font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: space-between;
}
.output-body {
  padding: 12px 18px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--green); white-space: pre-wrap;
  line-height: 1.6;
}
.output-body.error { color: var(--red); }
.output-loading {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; font-size: 12px; color: var(--text-muted);
}
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Callouts (tip, warning, danger) ──────────── */
.callout {
  display: flex; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  margin: 16px 0; font-size: 14.5px; line-height: 1.6;
}
.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.callout-body strong { display: block; margin-bottom: 3px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.callout.tip     { background: var(--green-dim);  border-left: 3px solid var(--green);  color: #9be9a8; }
.callout.tip strong   { color: var(--green); }
.callout.warning { background: var(--yellow-dim); border-left: 3px solid var(--yellow); color: #ffd57c; }
.callout.warning strong { color: var(--yellow); }
.callout.danger  { background: var(--red-dim);    border-left: 3px solid var(--red);    color: #ffa198; }
.callout.danger strong  { color: var(--red); }
.callout.info    { background: var(--purple-dim); border-left: 3px solid var(--purple); color: #d2a8ff; }
.callout.info strong    { color: var(--purple); }

/* ── Comparison table ──────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 13.5px;
}
.data-table th {
  background: var(--bg-overlay); color: var(--text-muted);
  padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-overlay); }
.tag { font-family: var(--font-mono); font-size: 12px;
       background: var(--bg-overlay); padding: 2px 6px; border-radius: 4px;
       border: 1px solid var(--border); color: var(--accent); }

/* ── Quiz ──────────────────────────────────────── */
.quiz-section {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px; margin: 36px 0;
}
.quiz-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.quiz-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-dim), var(--purple-dim));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.quiz-header h3 { font-size: 17px; font-weight: 700; margin: 0; }
.quiz-header p  { font-size: 12px; color: var(--text-muted); margin: 0; }

.quiz-question { margin-bottom: 24px; }
.quiz-question p {
  font-size: 15px; font-weight: 600; margin-bottom: 12px;
  color: var(--text);
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }

.quiz-option {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer; font-size: 14px;
  transition: all var(--transition);
  color: var(--text);
}
.quiz-option:hover:not(.locked) { border-color: var(--accent); background: var(--accent-glow); }
.quiz-option.correct { border-color: var(--green); background: var(--green-glow); color: var(--green); }
.quiz-option.wrong   { border-color: var(--red);   background: var(--red-dim);    color: var(--red); }
.quiz-option.locked  { cursor: not-allowed; opacity: .7; }

.option-radio {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.quiz-option.correct .option-radio { border-color: var(--green); background: var(--green); }
.quiz-option.wrong   .option-radio { border-color: var(--red);   background: var(--red); }

.quiz-explanation {
  margin-top: 10px; padding: 10px 14px;
  background: var(--bg-overlay); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted); display: none;
  border-left: 3px solid var(--accent);
}
.quiz-explanation.visible { display: block; }

.quiz-score {
  display: none; text-align: center;
  padding: 20px; background: var(--bg);
  border-radius: var(--radius); border: 1px solid var(--border);
  margin-top: 16px;
}
.quiz-score.visible { display: block; }
.score-big { font-size: 48px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.score-label { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-dim); color: white;
  border: none; padding: 10px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: all var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); padding: 10px 20px;
  border-radius: var(--radius); font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: var(--font); transition: all var(--transition);
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* ── Lesson navigation ─────────────────────────── */
.lesson-nav {
  display: flex; gap: 12px; margin-top: 48px;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-surface);
  text-decoration: none; color: var(--text);
  transition: all var(--transition);
}
.nav-btn:hover { border-color: var(--accent); background: var(--accent-glow); }
.nav-btn.next { text-align: right; }
.nav-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.nav-title { font-size: 14px; font-weight: 600; }

/* ── Right TOC ─────────────────────────────────── */
.toc-panel {
  width: var(--toc-w);
  flex-shrink: 0;
  padding: 40px 0 40px 0;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.toc-inner {
  padding: 0 20px;
  flex: 1;
}
.toc-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-subtle); margin-bottom: 10px;
  padding-top: 4px;
}
.toc-list { list-style: none; }
.toc-item a {
  display: block; padding: 4px 8px;
  font-size: 12.5px; color: var(--text-muted);
  text-decoration: none; border-radius: 4px;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.4;
}
.toc-item a:hover { color: var(--text); background: var(--bg-elevated); }
.toc-item a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-item.h3 a { padding-left: 18px; font-size: 12px; }

/* ── Inline code ───────────────────────────────── */
:not(pre) > code {
  font-family: var(--font-mono);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 4px;
  font-size: .88em; color: var(--accent);
}

/* ── Completion banner ─────────────────────────── */
.completion-banner {
  display: none;
  background: linear-gradient(135deg, var(--green-dim), rgba(63,185,80,.05));
  border: 1px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 20px 24px; margin-top: 28px;
  align-items: center; gap: 16px;
}
.completion-banner.visible { display: flex; }
.completion-icon { font-size: 28px; flex-shrink: 0; }
.completion-text h4 { font-size: 16px; color: var(--green); margin-bottom: 2px; }
.completion-text p { font-size: 13px; color: var(--text-muted); }
.completion-text a { color: var(--accent); }

/* ── Index page specific ───────────────────────── */
.index-body { display: block; margin-left: 0; padding: 0; max-width: 100%; }
.index-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
}
.index-nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.index-nav-logo .logo-icon { width: 28px; height: 28px; font-size: 15px; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--purple)); }
.index-nav-right { display: flex; align-items: center; gap: 10px; }

.hero {
  text-align: center; padding: 80px 40px 60px;
  max-width: 700px; margin: 0 auto;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-glow); border: 1px solid var(--accent-dim);
  color: var(--accent); padding: 5px 14px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 52px; font-weight: 900; line-height: 1.1;
  letter-spacing: -1.5px; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 70%, var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 32px;
}
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn-hero {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; text-decoration: none;
  transition: all var(--transition);
}
.btn-hero.primary {
  background: linear-gradient(135deg, var(--accent-dim), #0055cc);
  color: white; box-shadow: 0 0 24px rgba(88,166,255,.3);
}
.btn-hero.primary:hover { transform: translateY(-2px); box-shadow: 0 0 32px rgba(88,166,255,.5); }
.btn-hero.secondary {
  background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-hero.secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* Stats row */
.stats-row {
  display: flex; justify-content: center; gap: 0;
  margin: 0 40px 48px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.stat-item {
  flex: 1; text-align: center; padding: 24px 20px;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

/* Path section */
.path-section { padding: 0 40px 60px; }
.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.section-header p  { color: var(--text-muted); font-size: 14px; }

.level-group { margin-bottom: 36px; }
.level-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-subtle);
  margin-bottom: 14px;
}
.level-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

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

.lesson-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 10px;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.lesson-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0; transition: opacity var(--transition);
}
.lesson-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.lesson-card:hover::before { opacity: 1; }
.lesson-card.done { border-color: var(--green); }
.lesson-card.done::before { background: linear-gradient(135deg, var(--green-glow), transparent); opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.card-emoji { font-size: 22px; }
.card-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 3px 8px; border-radius: 12px; }
.card-badge.beginner  { background: var(--green-dim);  color: var(--green); }
.card-badge.intermediate { background: var(--yellow-dim); color: var(--yellow); }
.card-badge.advanced  { background: var(--red-dim);    color: var(--red); }
.card-done-mark { color: var(--green); font-size: 16px; }

.card-title { font-size: 15px; font-weight: 700; }
.card-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.card-time  { font-size: 11px; color: var(--text-subtle); margin-top: auto; display: flex; align-items: center; gap: 4px; }

/* Big overall progress bar on index */
.progress-section {
  margin: 0 40px 48px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 28px;
}
.progress-section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.progress-section-header h3 { font-size: 15px; font-weight: 700; }
.progress-section-header .pct { font-size: 28px; font-weight: 800; color: var(--accent); }
.progress-bar-lg { height: 10px; background: var(--bg-overlay); border-radius: 5px; overflow: hidden; margin-bottom: 14px; }
.progress-fill-lg {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.progress-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-subtle); }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 1200px) {
  .toc-panel { display: none; }
}
@media (max-width: 900px) {
  .main-content { padding: 0 24px 80px; }
  .lesson-title { font-size: 26px; }
  .hero h1 { font-size: 38px; }
  .hero { padding: 48px 24px 40px; }
  .stats-row { margin: 0 24px 36px; }
  .path-section { padding: 0 24px 48px; }
  .progress-section { margin: 0 24px 36px; }
  .index-nav { padding: 0 24px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .page-wrapper { margin-left: 0; }
  .topbar { display: flex; }
  .concept { padding: 20px; }
  .quiz-section { padding: 20px; }
  .stats-row { flex-wrap: wrap; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-item:last-child { border-bottom: none; }
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-nav { flex-direction: column; }
}

/* ── Prism.js overrides ────────────────────────── */
.code-block code[class*="language-"],
.code-block pre[class*="language-"] {
  background: transparent !important;
  font-family: var(--font-mono) !important;
  font-size: 13.5px !important;
  line-height: 1.7 !important;
  tab-size: 4;
}
.token.comment { color: #6a9955; font-style: italic; }
.token.keyword { color: #569cd6; }
.token.string  { color: #ce9178; }
.token.number  { color: #b5cea8; }
.token.function { color: #dcdcaa; }
.token.class-name { color: #4ec9b0; }
.token.builtin { color: #4ec9b0; }
.token.operator { color: #d4d4d4; }
.token.punctuation { color: #808080; }
.token.decorator { color: #c586c0; }
.token.boolean { color: #569cd6; }
.token.parameter { color: #9cdcfe; }

/* ── Quiz score breakdown on index ────────────── */
.score-breakdown {
  display: none;
  margin-top: 12px;
}
.score-breakdown.visible { display: block; }
.score-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border-muted);
  font-size: 13px;
}
.score-row:last-child { border-bottom: none; }
.score-row-name { color: var(--text-muted); }
.score-row-val { font-weight: 600; font-family: var(--font-mono); font-size: 12px; }
.score-row-bar { flex: 1; margin: 0 12px; height: 4px; background: var(--bg-overlay); border-radius: 2px; overflow: hidden; }
.score-row-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width .6s ease; }

/* ── Certificate banner ────────────────────────── */
.cert-unlock-banner {
  display: none;
  background: linear-gradient(135deg, #2d1f45, #1a4a2e);
  border: 1px solid var(--purple);
  border-radius: var(--radius-lg);
  padding: 16px 20px; margin-top: 16px;
  align-items: center; gap: 14px;
}
.cert-unlock-banner.visible { display: flex; }
.cert-unlock-banner .cert-icon { font-size: 28px; flex-shrink: 0; }
.cert-unlock-banner h4 { font-size: 15px; color: var(--purple); margin-bottom: 3px; }
.cert-unlock-banner p { font-size: 13px; color: var(--text-muted); }
.cert-unlock-banner a { color: var(--purple); font-weight: 600; }

/* ── Certificate page ──────────────────────────── */
.cert-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: var(--bg);
}
.cert-card {
  background: var(--bg-surface);
  border: 2px solid var(--purple);
  border-radius: 20px;
  padding: 60px;
  max-width: 700px; width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(188,140,255,.15);
  position: relative; overflow: hidden;
}
.cert-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(188,140,255,.08), transparent 60%);
  pointer-events: none;
}
.cert-seal { font-size: 72px; margin-bottom: 16px; }
.cert-from { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--purple); font-weight: 700; margin-bottom: 24px; }
.cert-title { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.cert-name { font-size: 42px; font-weight: 900; letter-spacing: -1px; margin-bottom: 24px;
  background: linear-gradient(135deg, var(--text), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.cert-desc { font-size: 15px; color: var(--text-muted); line-height: 1.7; max-width: 480px; margin: 0 auto 28px; }
.cert-score { display: inline-flex; align-items: center; gap: 8px; background: var(--purple-dim); border: 1px solid var(--purple); padding: 8px 20px; border-radius: 20px; font-size: 14px; color: var(--purple); font-weight: 700; margin-bottom: 28px; }
.cert-date { font-size: 12px; color: var(--text-subtle); margin-bottom: 32px; }
.cert-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.cert-locked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center; padding: 40px;
}
.cert-locked h2 { font-size: 24px; margin: 16px 0 8px; }
.cert-locked p  { color: var(--text-muted); margin-bottom: 24px; }

/* ── Animations ────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .4s cubic-bezier(.4,0,.2,1) both; }
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .10s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .20s; }

/* ── Misc ──────────────────────────────────────── */
h1, h2, h3 { line-height: 1.3; }
a { color: var(--accent); }
strong { color: var(--text); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Mark lesson complete button */
.mark-complete-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-dim); color: var(--green);
  border: 1px solid var(--green); padding: 8px 16px;
  border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  transition: all var(--transition); margin-top: 8px;
}
.mark-complete-btn:hover { background: rgba(63,185,80,.25); }
.mark-complete-btn.done { background: var(--green); color: #0d1117; }
.mark-complete-btn.done:hover { background: var(--green); cursor: default; }
