:root {
  --bg: #f5f0e8;
  --surface: #fff;
  --border: #d8d0c0;
  --accent: #c8392a;
  --accent-dark: #8b1f14;
  --text: #1a1612;
  --muted: #7a6e60;
  --code-bg: #1a1612;
  --code-text: #e8e0d0;
  --tag-bg: rgba(200,57,42,0.1);
  --done: #2d6a2d;
  --mono: 'IBM Plex Mono', monospace;
  --serif: 'Fraunces', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  min-height: 100vh;
  display: flex;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.n-badge {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}

.progress-wrap {
  margin-top: 4px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--muted);
}

.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { border-left-color: var(--accent); background: var(--tag-bg); color: var(--accent); font-weight: 600; }
.nav-item.completed { color: var(--done); }
.nav-item.completed .nav-dot { background: var(--done); }

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.nav-item.active .nav-dot { background: var(--accent); }

.nav-num {
  font-family: var(--mono);
  font-size: 10px;
  color: inherit;
  opacity: 0.6;
  flex-shrink: 0;
}

/* CONTENT */
.content {
  flex: 1;
  padding: 48px 60px;
  max-width: 820px;
  overflow-y: auto;
  height: 100vh;
}

.lesson-header {
  margin-bottom: 40px;
}

.lesson-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.lesson-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  font-style: italic;
  line-height: 1.2;
  margin-bottom: 12px;
}

.lesson-desc {
  font-size: 17px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.6;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* LESSON CONTENT */
.lesson-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}

.lesson-body h3 {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin: 24px 0 8px;
  text-transform: uppercase;
}

.lesson-body p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 16px;
}

.lesson-body ul {
  margin: 0 0 16px 0;
  padding-left: 20px;
}

.lesson-body li {
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 6px;
}

.lesson-body strong {
  font-weight: 700;
  color: var(--accent-dark);
}

/* CODE BLOCKS */
.code-block {
  background: var(--code-bg);
  border-radius: 10px;
  margin: 20px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-lang {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.copy-btn:hover { color: white; background: rgba(255,255,255,0.1); }

pre {
  padding: 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--code-text);
}

.kw { color: #c084fc; }
.fn { color: #60a5fa; }
.str { color: #86efac; }
.cm { color: #6b7280; font-style: italic; }
.tp { color: #fcd34d; }
.num { color: #fb923c; }
.dec { color: #f472b6; }

/* CALLOUT */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--tag-bg);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}

.callout p { margin: 0; font-size: 15px; }
.callout-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* QUIZ */
.quiz-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
}

.quiz-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.quiz-question {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--mono);
  transition: all 0.15s;
  background: var(--bg);
}

.quiz-option:hover { border-color: var(--muted); }
.quiz-option.correct { border-color: var(--done); background: rgba(45,106,45,0.08); color: var(--done); }
.quiz-option.wrong { border-color: var(--accent); background: rgba(200,57,42,0.06); color: var(--accent); }

.quiz-feedback {
  margin-top: 12px;
  font-size: 14px;
  display: none;
  padding: 10px 14px;
  border-radius: 6px;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: rgba(45,106,45,0.08); color: var(--done); }
.quiz-feedback.fail { background: rgba(200,57,42,0.06); color: var(--accent); }

/* BOTTOM NAV */
.bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.btn-primary:hover { background: var(--accent-dark); }

.btn:disabled { opacity: 0.3; cursor: default; }

.complete-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1.5px solid var(--done);
  color: var(--done);
  background: rgba(45,106,45,0.06);
  cursor: pointer;
  transition: all 0.2s;
}

.complete-btn.done-state {
  background: var(--done);
  color: white;
}

/* MOBILE */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 150;
    transition: left 0.3s;
    width: 260px;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
  .content { padding: 64px 20px 40px; }
}
