:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1f2937;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --accent-blue: #58a6ff;
  --accent-orange: #f0883e;
  --accent-green: #238636;
  --accent-red: #da3633;
  --accent-yellow: #e3b341;
  --border: #30363d;
  --shadow: rgba(0,0,0,0.3);
}
[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --accent-blue: #0969da;
  --accent-orange: #bc4b00;
  --accent-green: #1a7f37;
  --accent-red: #cf222e;
  --accent-yellow: #7d4e00;
  --border: #d0d7de;
  --shadow: rgba(31,35,40,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  min-height: 100vh;
}
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}
.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.sidebar-header h1 {
  font-size: 1.3rem;
  color: var(--accent-orange);
  margin-bottom: 5px;
}
.sidebar-header p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.nav-group {
  margin-bottom: 15px;
}
.nav-group-title {
  padding: 8px 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-item {
  display: block;
  padding: 8px 20px 8px 35px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background: rgba(88, 166, 255, 0.1);
  border-left-color: var(--accent-blue);
}
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 40px 50px;
  max-width: 900px;
}
h1 { font-size: 2.2rem; margin-bottom: 20px; color: var(--accent-orange); }
h2 { font-size: 1.6rem; margin: 40px 0 20px; color: var(--accent-blue); border-bottom: 2px solid var(--border); padding-bottom: 10px; }
h3 { font-size: 1.2rem; margin: 30px 0 15px; color: var(--accent-yellow); }
h4 { font-size: 1rem; margin: 20px 0 10px; color: var(--text-primary); }
p { margin-bottom: 15px; color: var(--text-primary); }
.tip-box {
  background: rgba(35, 134, 54, 0.15);
  border-left: 4px solid var(--accent-green);
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
}
.tip-box::before { content: '💡 实战要点：'; font-weight: bold; color: var(--accent-green); }
.warning-box {
  background: rgba(218, 54, 51, 0.15);
  border-left: 4px solid var(--accent-red);
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
}
.warning-box::before { content: '⚠️ 风险提示：'; font-weight: bold; color: var(--accent-red); }
.info-box {
  background: rgba(88, 166, 255, 0.15);
  border-left: 4px solid var(--accent-blue);
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
}
.info-box::before { content: '📘 知识卡片：'; font-weight: bold; color: var(--accent-blue); }
.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px 20px;
  margin: 20px 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  margin: 25px 0;
  text-align: center;
}
.candlestick-chart { display: flex; justify-content: center; align-items: flex-end; gap: 8px; height: 200px; padding: 20px 0; }
.candle {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
}
.candle-wick { width: 2px; background: var(--text-secondary); }
.candle-body { width: 16px; border-radius: 2px; }
.candle-green { background: var(--accent-green); }
.candle-red { background: var(--accent-red); }
.candle-label { font-size: 0.65rem; color: var(--text-secondary); margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin: 20px 0; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent-blue); }
.card h4 { color: var(--accent-orange); margin-bottom: 10px; }
.card p { font-size: 0.85rem; color: var(--text-secondary); }
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin: 3px;
  font-weight: 500;
}
.tag-green { background: rgba(35, 134, 54, 0.2); color: var(--accent-green); }
.tag-red { background: rgba(218, 54, 51, 0.2); color: var(--accent-red); }
.tag-blue { background: rgba(88, 166, 255, 0.2); color: var(--accent-blue); }
.tag-orange { background: rgba(240, 136, 62, 0.2); color: var(--accent-orange); }
.progress-bar {
  background: var(--bg-card);
  border-radius: 10px;
  height: 8px;
  margin: 10px 0;
  overflow: hidden;
}
.progress-fill {
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s;
}
.hero-section {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(240, 136, 62, 0.1));
  border-radius: 16px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
}
.hero-section h1 { font-size: 2.5rem; margin-bottom: 15px; }
.hero-section p { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }
.chapter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; margin: 30px 0; }
.chapter-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s;
}
.chapter-card:hover { border-color: var(--accent-blue); transform: translateY(-5px); box-shadow: 0 10px 30px var(--shadow); }

/* 主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--accent-yellow);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 2px 8px var(--shadow);
}
.theme-toggle:hover {
  transform: scale(1.1);
  border-color: var(--accent-blue);
}

/* sidebar 内的主题切换 */
.sidebar .theme-toggle {
  position: static;
  width: auto;
  height: auto;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin: 15px 20px 0;
  gap: 6px;
}
.sidebar .theme-toggle .icon { font-size: 1rem; }
.chapter-card .number { font-size: 2rem; font-weight: bold; color: var(--accent-orange); margin-bottom: 10px; }
.chapter-card h3 { margin: 0 0 10px; color: var(--text-primary); }
.chapter-card p { color: var(--text-secondary); font-size: 0.9rem; }
.chapter-card .topics { margin-top: 15px; }
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; height: auto; }
  .main-content { margin-left: 0; padding: 20px; }
  .layout { flex-direction: column; }
  .chapter-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
