
/* === Material 主题色覆盖（贴近原 SPA 配色） === */
:root {
  --md-primary-fg-color: #2f6f5e;
  --md-primary-fg-color--light: #3a8472;
  --md-primary-fg-color--dark: #265a4c;
  --md-accent-fg-color: #c97b3f;
  --md-accent-fg-color--transparent: rgba(201, 123, 63, 0.1);
  --md-default-bg-color: #f7f5f0;
  --md-default-bg-color--light: #faf8f3;
  --md-default-fg-color: #14171e;
  --md-default-fg-color--light: #3a4256;
  --md-default-fg-color--lighter: #7c7a72;
}

/* === Material 布局适配 === */
/* 内容区加宽（默认 61% 太窄） */
.md-grid { max-width: 1400px; }
.md-content__inner { max-width: 920px; margin: 0 auto; padding: 32px 24px 80px; }

/* 隐藏 Material 默认的 prev/next 底部导航（我们用自定义 .lesson-nav） */
.md-footer__inner.md-typeset + .md-footer-meta { display: none; }

/* 课程内部的 h1 用 hero 风格，h2 用 section 风格 */
.md-content article h1 { display: none; }   /* 隐藏 page title（hero 里有自己的 h1） */
.md-content .hero h1 { display: block; }     /* 但 hero 里的 h1 保留 */

/* 移动端隐藏左侧 sidebar（Material 自己处理） */
@media screen and (max-width: 76.1875em) {
  .md-nav--primary { display: none; }
}

/* === 暗色模式：Material 主题变量 + 自定义变量全量重定义 === */
[data-md-color-scheme="slate"] {
  /* Material 主题变量（让 Material 自己用对的色） */
  --md-primary-fg-color: #5fb09c;
  --md-primary-fg-color--light: #7cc4b1;
  --md-primary-fg-color--dark: #4a9382;
  --md-accent-fg-color: #e0a070;
  --md-accent-fg-color--transparent: rgba(224, 160, 112, 0.15);
  --md-default-bg-color: #1a1b28;
  --md-default-bg-color--light: #232438;
  --md-default-fg-color: #e8e6e0;
  --md-default-fg-color--light: #b0aea8;
  --md-default-fg-color--lighter: #7c7a72;
  --md-default-fg-color--lightest: #4a4d63;
  --md-typeset-color: #e8e6e0;
  --md-typeset-a-color: #7cc4b1;

  /* 自定义变量（让 .hero / .section / .inher-note 等用对的色） */
  --bg: #1a1b28;
  --sidebar-bg: #14151f;
  --sidebar-hover: #1f2030;
  --sidebar-active: #5fb09c;
  --card: #232438;
  --border: #2f3148;
  --border-strong: #3b3d5a;
  --text: #e8e6e0;
  --text-soft: #b0aea8;
  --text-mute: #7c7a72;
  --primary: #5fb09c;
  --primary-dark: #4a9382;
  --primary-soft: rgba(95, 176, 156, 0.14);
  --primary-soft-2: rgba(95, 176, 156, 0.22);
  --accent: #e0a070;
  --accent-soft: rgba(224, 160, 112, 0.14);
  --rose: #d08891;
  --rose-soft: rgba(208, 136, 145, 0.14);
  --code-bg: #14151f;
  --highlight: #3d3520;        /* 暗色"淡黄底"，给 why-callout / inher-note 用 */
  --highlight-soft: #2d2818;
}

/* 暗色模式下的代码块（prism-tomorrow 在暗底上已 OK，但加一点 padding 让它和卡片区分） */
[data-md-color-scheme="slate"] pre[class*="language-"] {
  border: 1px solid var(--border) !important;
}
/* === 原 SPA 样式（原样保留） === */
:root {
  --bg: #f7f5f0;
  --sidebar-bg: #ece5d3;
  --sidebar-hover: #e3dac3;
  --sidebar-active: #2f6f5e;
  --card: #ffffff;
  --border: #e9e3d6;
  --border-strong: #d8d0bc;
  --text: #14171e;
  --text-soft: #3a4256;
  --text-mute: #7c7a72;
  --primary: #2f6f5e;
  --primary-dark: #265a4c;
  --primary-soft: rgba(47, 111, 94, 0.08);
  --primary-soft-2: rgba(47, 111, 94, 0.16);
  --accent: #c97b3f;
  --accent-soft: rgba(201, 123, 63, 0.1);
  --rose: #b06367;
  --rose-soft: rgba(176, 99, 103, 0.1);
  --code-bg: #1e1e2e;
  --highlight: #fff7d6;
  --sidebar-width: 280px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(201, 123, 63, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -200px; left: 50%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(47, 111, 94, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-strong);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 10;
  padding: 24px 0;
}
.sidebar-head {
  padding: 0 24px 20px;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 16px;
}
.sidebar-head .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 4px;
}
.sidebar-head .logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-head .sub {
  font-size: 12px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}
.sidebar-group {
  padding: 0 16px;
  margin-bottom: 16px;
}
.sidebar-group .group-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 0 8px 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-soft);
  text-decoration: none;
  margin-bottom: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: white;
  font-weight: 500;
}
.sidebar-link .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.6;
  flex-shrink: 0;
}
.sidebar-link.active .num { opacity: 0.9; }
.sidebar-link .title { flex: 1; }
.sidebar-link.coming { color: var(--text-mute); cursor: not-allowed; }
.sidebar-link.coming:hover { background: transparent; color: var(--text-mute); }
.sidebar-link .badge {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(255,255,255,0.6);
  border-radius: 3px;
  font-weight: 600;
  color: var(--text-mute);
}
.sidebar-link.active .badge { background: rgba(255,255,255,0.2); color: white; }
.sidebar-foot {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border-strong);
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.5;
}

/* MOBILE TOGGLE */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 20;
  width: 40px; height: 40px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(47, 111, 94, 0.3);
}

/* MAIN */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  position: relative;
  z-index: 1;
}
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 56px 40px 80px;
}

/* HERO */
.hero { margin-bottom: 56px; }
.hero .label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}
.hero h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 40px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--text);
}
.hero .subtitle {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 720px;
  line-height: 1.6;
}
.hero .why-callout {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--highlight);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  border-left: 3px solid var(--accent);
  max-width: 720px;
  line-height: 1.6;
}
.hero .why-callout strong { color: var(--accent); }
.hero .quick-callout {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--highlight);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  border: 1px solid #f0e3a0;
}
.hero .quick-callout strong { color: var(--primary); }

section { margin-bottom: 56px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.section-head h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--text);
}
.section-why {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.section-intro {
  color: var(--text-soft);
  margin-bottom: 20px;
  max-width: 760px;
  font-size: 15px;
}
.star-tag {
  display: inline-block;
  padding: 1px 7px;
  background: #fff3d1;
  color: #8a6300;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}

/* CODE */
pre[class*="language-"] {
  border-radius: 12px !important;
  font-size: 13px !important;
  margin: 14px 0 !important;
  padding: 18px 20px !important;
  border: 1px solid rgba(255,255,255,0.05) !important;
}
code[class*="language-"] {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 13px !important;
}
:not(pre) > code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

/* Lesson nav (prev/next) */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.lesson-nav a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 45%;
}
.lesson-nav a:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(47, 111, 94, 0.1);
}
.lesson-nav a.next { text-align: right; align-items: flex-end; margin-left: auto; }
.lesson-nav a .dir {
  font-size: 11px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.lesson-nav a .ttl {
  font-weight: 500;
  color: var(--primary);
}
.lesson-nav a.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ====== LESSON 01 COMPONENTS ====== */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.compare-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.compare-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}
.compare-card.c { border-top: 3px solid #3a4256; }
.compare-card.java { border-top: 3px solid var(--primary); }
.compare-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.lang-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
}
.compare-card.c .lang-tag { background: rgba(58, 66, 86, 0.1); color: #3a4256; }
.compare-card.java .lang-tag { background: var(--primary-soft); color: var(--primary); }
.compare-card .desc {
  font-size: 13px;
  color: var(--text-mute);
}
.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
}
.flow-step {
  background: #fafaf6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  min-width: 76px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.flow-step small {
  display: block;
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 400;
  margin-top: 3px;
  font-family: 'Outfit', sans-serif;
}
.flow-step.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(47, 111, 94, 0.25);
}
.flow-step.active small { color: rgba(255,255,255,0.85); }
.flow-step.passed {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(47, 111, 94, 0.2);
}
.flow-step.passed small { color: var(--primary); opacity: 0.7; }
.compare-card.c .flow-step.active {
  background: #3a4256;
  border-color: #3a4256;
  box-shadow: 0 8px 20px rgba(58, 66, 86, 0.25);
}
.compare-card.c .flow-step.passed {
  background: rgba(58, 66, 86, 0.08);
  color: #3a4256;
  border-color: rgba(58, 66, 86, 0.2);
}
.compare-card.c .flow-step.passed small { color: #3a4256; }
.flow-arrow {
  color: var(--text-mute);
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.flow-note {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 8px;
  padding-left: 2px;
}
.flow-note strong { color: var(--primary); font-weight: 600; }
.compare-card.c .flow-note strong { color: #3a4256; }

.jdk-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.jdk-layer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-left: var(--indent, 0);
  position: relative;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 18px;
}
.jdk-layer:hover {
  transform: translateX(6px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.05);
}
.jdk-layer.l1 { --indent: 0px; }
.jdk-layer.l2 { --indent: 32px; border-left: 3px solid var(--primary); }
.jdk-layer.l3 { --indent: 64px; border-left: 3px solid var(--accent); }
.jdk-layer.l4 { --indent: 96px; border-left: 3px solid var(--rose); }
.jdk-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.jdk-layer.l1 .jdk-icon { background: var(--text); }
.jdk-layer.l2 .jdk-icon { background: var(--primary); }
.jdk-layer.l3 .jdk-icon { background: var(--accent); }
.jdk-layer.l4 .jdk-icon { background: var(--rose); }
.jdk-content { flex: 1; }
.jdk-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.jdk-layer.l1 .jdk-label { color: var(--text); }
.jdk-layer.l4 .jdk-label { color: var(--rose); }
.jdk-desc {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}
.jdk-desc strong { color: var(--text); font-weight: 600; }

.demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.demo-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.demo-title::before {
  content: '';
  width: 8px; height: 8px;
  background: #a6e3a1;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(166, 227, 161, 0.25);
}
.demo-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(47, 111, 94, 0.1);
}
.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn.primary:hover {
  background: var(--primary-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(47, 111, 94, 0.3);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}
.demo-terminal {
  background: var(--code-bg);
  color: #cdd6f4;
  border-radius: 10px;
  padding: 18px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.85;
  min-height: 240px;
  overflow: hidden;
}
.demo-terminal .line {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo-terminal .line.show { opacity: 1; transform: translateY(0); }
.demo-terminal .prompt { color: #a6e3a1; }
.demo-terminal .cmd { color: #f9e2af; }
.demo-terminal .file { color: #89b4fa; }
.demo-terminal .success { color: #a6e3a1; font-weight: 500; }
.demo-terminal .muted { color: #6c7086; font-style: italic; }
.demo-terminal .hl { color: #fab387; }

.diff-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0 4px;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.diff-table th, .diff-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.diff-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.diff-table tr:last-child td { border-bottom: none; }
.diff-table td.row-label {
  font-weight: 600;
  color: var(--text);
  width: 100px;
}
.diff-table td.code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--text-soft);
}
.diff-table td.code strong { color: var(--primary); font-weight: 600; }
.diff-table .arrow-col {
  text-align: center;
  width: 40px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
}

/* ====== LESSON 02 COMPONENTS ====== */
.life-example {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
}
.life-example h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.life-example p { color: var(--text-soft); font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
.life-example .compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin: 16px 0;
  font-size: 14px;
}
.life-example .compare .col { padding: 14px; background: #fafaf6; border-radius: 10px; }
.life-example .compare .col.bad { border-left: 3px solid var(--rose); }
.life-example .compare .col.good { border-left: 3px solid var(--primary); }
.life-example .compare .arrow { color: var(--text-mute); font-size: 18px; }

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 8px;
}
.pillar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pillar:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.06);
}
.pillar-num {
  position: absolute;
  top: 12px; right: 16px;
  font-family: 'DM Serif Display', serif;
  font-size: 48px;
  color: var(--primary-soft-2);
  line-height: 1;
}
.pillar-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 14px;
}
.pillar.encap .pillar-icon { background: var(--primary); }
.pillar.inher .pillar-icon { background: var(--accent); }
.pillar.poly .pillar-icon { background: var(--rose); }
.pillar h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 6px;
  color: var(--text);
}
.pillar .pillar-en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.pillar p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.55;
}
.pillar .analogy {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-mute);
  font-style: italic;
}

.encap-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
}
.encap-class {
  background: #fafaf6;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.encap-line { display: flex; align-items: center; padding: 4px 0; }
.encap-mod {
  display: inline-block;
  width: 80px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 12px;
  font-size: 11px;
  text-align: center;
}
.encap-mod.private { background: var(--rose-soft); color: var(--rose); }
.encap-mod.default { background: rgba(124, 122, 114, 0.15); color: var(--text-mute); }
.encap-mod.protected { background: var(--accent-soft); color: var(--accent); }
.encap-mod.public { background: var(--primary-soft); color: var(--primary); }
.encap-name { color: var(--text); }
.encap-vis { margin-left: auto; font-size: 11px; color: var(--text-mute); font-family: 'Outfit', sans-serif; }
.encap-vis .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }

.mod-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  font-size: 13px;
}
.mod-table th, .mod-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.mod-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mod-table tr:last-child td { border-bottom: none; }
.mod-table .mod-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}
.mod-table .mod-pill.private { background: var(--rose-soft); color: var(--rose); }
.mod-table .mod-pill.default { background: rgba(124, 122, 114, 0.15); color: var(--text-mute); }
.mod-table .mod-pill.protected { background: var(--accent-soft); color: var(--accent); }
.mod-table .mod-pill.public { background: var(--primary-soft); color: var(--primary); }
.mod-table td.yes { color: var(--primary); text-align: center; font-weight: 600; }
.mod-table td.no { color: var(--rose); text-align: center; }

.inher-diagram {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin: 20px 0;
}
.inher-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.inher-level {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  padding-bottom: 18px;
}
.inher-box {
  background: #fafaf6;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  min-width: 130px;
  position: relative;
}
.inher-box.parent { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.inher-box.child { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.inher-level:not(:last-child) .inher-box::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 18px;
  background: var(--border);
}
.inher-level:not(:last-child) .inher-box::before {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}
.inher-note {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--highlight);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  border-left: 3px solid var(--accent);
  line-height: 1.6;
}
.inher-note strong { color: var(--accent); }

.poly-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
}
.poly-stage {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 10px;
  padding: 18px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.85;
  min-height: 180px;
  margin-bottom: 16px;
}
.poly-stage .line { opacity: 0; transform: translateY(6px); transition: all 0.3s ease; }
.poly-stage .line.show { opacity: 1; transform: translateY(0); }
.poly-stage .kw { color: #cba6f7; }
.poly-stage .cls { color: #89b4fa; }
.poly-stage .str { color: #a6e3a1; }
.poly-stage .op { color: #fab387; }
.poly-stage .var { color: #f9e2af; }
.poly-stage .out { color: #a6e3a1; font-weight: 500; }
.poly-stage .note { color: #6c7086; font-style: italic; }
.poly-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.poly-btn {
  padding: 12px 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  color: var(--text);
}
.poly-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(47, 111, 94, 0.15);
}
.poly-btn .emoji { display: block; font-size: 20px; margin-bottom: 4px; }

.ai-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.ai-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mute);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}
.ai-tab:hover { color: var(--text); }
.ai-tab.active { color: var(--primary); }
.ai-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
}
.ai-panel { display: none; }
.ai-panel.active { display: block; }
.ai-compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 24px;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  font-size: 13px;
}
.ai-compare-table th, .ai-compare-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ai-compare-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.ai-compare-table td.abstract-col { background: rgba(47, 111, 94, 0.03); }
.ai-compare-table td.interface-col { background: rgba(201, 123, 63, 0.03); }
.ai-compare-table td:first-child { font-weight: 600; color: var(--text); width: 140px; }
.ai-compare-table code { font-size: 12px; }

/* Practice */
.practice {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--accent-soft) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-top: 12px;
}
.practice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.practice-head h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
}
.practice-list { list-style: none; counter-reset: practice; }
.practice-list li {
  counter-increment: practice;
  padding: 14px 0 14px 40px;
  position: relative;
  border-bottom: 1px dashed rgba(47, 111, 94, 0.15);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.practice-list li:last-child { border-bottom: none; padding-bottom: 4px; }
.practice-list li::before {
  content: counter(practice);
  position: absolute;
  left: 0; top: 14px;
  width: 26px; height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
.footer .brand { font-weight: 600; color: var(--primary); }

/* ====== LESSON 03 COMPONENTS ====== */
/* Static counter demo */
.static-demo {
  background: var(--code-bg);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.static-counter {
  text-align: center;
  padding: 18px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  margin-bottom: 14px;
}
.static-counter .counter-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #6c7086;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.static-counter .counter-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 42px;
  font-weight: 600;
  color: #a6e3a1;
  line-height: 1;
  transition: transform 0.2s ease;
}
.static-counter .counter-num.bump {
  transform: scale(1.18);
}
.static-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.static-controls .btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #cdd6f4;
}
.static-controls .btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: white;
}
.static-controls .btn.primary {
  background: #a6e3a1;
  border-color: #a6e3a1;
  color: #1e1e2e;
}
.static-controls .btn.primary:hover {
  background: #b9ecb3;
  border-color: #b9ecb3;
  color: #1e1e2e;
}
.static-list {
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 56px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #cdd6f4;
}
.static-list .static-item {
  padding: 4px 0;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.static-list .static-empty {
  color: #6c7086;
  text-align: center;
  font-style: italic;
  padding: 12px 0;
}

/* Equals demo */
.equals-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.equals-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 6px;
}
.eq-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.eq-card .eq-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.eq-card .eq-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}
.eq-card .eq-hash {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--code-bg);
  color: #fab387;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

/* Memory compare box */
.mem-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.mem-box {
  background: #fafaf6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.mem-box .mem-icon { font-size: 28px; margin-bottom: 6px; }
.mem-box .mem-addr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.mem-box .mem-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

/* Final position cards */
.final-positions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.final-pos {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  transition: transform 0.2s ease;
}
.final-pos:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.05);
}
.final-pos .fp-icon { font-size: 26px; margin-bottom: 6px; }
.final-pos .fp-where {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.final-pos .fp-means {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

/* Exception demo (Lesson 06) - 5 个常见异常切换 */
.ex-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.ex-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ex-tab {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ex-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.ex-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.ex-code, .ex-error {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #cdd6f4;
  margin: 8px 0;
  white-space: pre-wrap;
}
.ex-code { border-left: 3px solid #89b4fa; }
.ex-error {
  border-left: 3px solid #f38ba8;
  color: #f38ba8;
  background: rgba(243, 139, 168, 0.08);
  font-size: 12px;
  max-height: 200px;
  overflow: auto;
}

/* Set demo (Lesson 05) - ArrayList vs HashSet 可视化 */
.set-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.set-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.set-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.set-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.set-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.set-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.set-col-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.set-col-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}
.set-col-sub {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
}
.set-list {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 80px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #cdd6f4;
  margin-bottom: 8px;
}
.set-list .set-item {
  display: inline-block;
  background: rgba(166, 227, 161, 0.15);
  color: #a6e3a1;
  padding: 2px 10px;
  border-radius: 12px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  animation: fadeIn 0.3s ease;
}
.set-list .set-empty {
  color: #6c7086;
  text-align: center;
  font-style: italic;
  padding: 24px 0;
}
.set-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-soft);
  text-align: right;
}
@media (max-width: 600px) {
  .set-cols { grid-template-columns: 1fr; }
}

/* Home page (overview) */
.home-overview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
}
.home-overview h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 16px;
}
.home-overview p { color: var(--text-soft); font-size: 15px; margin-bottom: 20px; line-height: 1.6; }
.home-overview .progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--primary-soft);
  border-radius: 10px;
  margin-bottom: 20px;
}
.home-overview .progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(47, 111, 94, 0.15);
  border-radius: 4px;
  overflow: hidden;
}
.home-overview .progress-bar .fill {
  height: 100%;
  background: var(--primary);
  width: 10%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.home-overview .progress-text {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.roadmap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.roadmap-card {
  background: #fafaf6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  cursor: pointer;
}
.roadmap-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.roadmap-card.done { border-left: 3px solid var(--primary); }
.roadmap-card.current { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.roadmap-card.future { opacity: 0.7; }
.roadmap-card .rm-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.roadmap-card .rm-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.roadmap-card .rm-meta {
  font-size: 12px;
  color: var(--text-mute);
}
.roadmap-card .rm-status {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 600;
}
.roadmap-card.done .rm-status { background: var(--primary-soft); color: var(--primary); }
.roadmap-card.current .rm-status { background: var(--accent); color: white; }
.roadmap-card.future .rm-status { background: rgba(124, 122, 114, 0.15); color: var(--text-mute); }

/* Responsive */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .container { padding: 32px 24px 60px; }
  .hero h1 { font-size: 30px; }
  .section-head h2 { font-size: 22px; }
}
@media (max-width: 768px) {
  .compare-grid { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: 1fr; }
  .poly-choices { grid-template-columns: 1fr; }
  .roadmap { grid-template-columns: 1fr; }
  .mod-table, .ai-compare-table, .diff-table { font-size: 12px; }
  .mod-table th, .mod-table td, .ai-compare-table th, .ai-compare-table td, .diff-table th, .diff-table td { padding: 8px 10px; }
  .ai-compare-table td:first-child { width: 100px; }
  .diff-table td.row-label { width: 80px; font-size: 13px; }
  .diff-table td.code { font-size: 12px; }
  .life-example .compare { grid-template-columns: 1fr; }
  .life-example .compare .arrow { transform: rotate(90deg); justify-self: center; }
}
