/* ========================================
   股票投资课程 — 共享样式表 v2.0
   设计理念：温暖纸感 · 护眼阅读 · 优雅克制
   灵感来源：Tufte CSS · iA Writer · Apple Books
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ────────── 色彩系统 ────────── */
:root {
  /* 主色调：温暖墨绿 — 沉稳、知性、不刺眼 */
  --accent:        #2d5f4f;
  --accent-light:  #3d8b6e;
  --accent-soft:   #e8f0ec;

  /* 文字 */
  --text:          #2a2a28;
  --text-secondary:#5c5c58;
  --text-tertiary: #8a8a85;

  /* 背景 */
  --bg:            #faf8f4;
  --bg-card:       #ffffff;
  --bg-code:       #f3f1ec;

  /* 语义色 */
  --green:         #2d7a4e;
  --green-soft:    #e6f3ec;
  --red:           #c45a4a;
  --red-soft:      #fcebe8;
  --gold:          #a87b2a;
  --gold-soft:     #faf3e3;

  /* 边框 */
  --border:        #e4e0d8;
  --border-light:  #efece5;

  /* 阴影 */
  --shadow-sm:     0 1px 3px rgba(42, 42, 40, 0.04);
  --shadow-md:     0 4px 14px rgba(42, 42, 40, 0.06);
  --shadow-lg:     0 8px 28px rgba(42, 42, 40, 0.08);

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
}

/* ────────── 暗色模式 ────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --accent:        #5fb88f;
    --accent-light:  #7dd0a8;
    --accent-soft:   #1a3329;

    --text:          #dcd9d2;
    --text-secondary:#a8a59e;
    --text-tertiary: #6e6c67;

    --bg:            #151615;
    --bg-card:       #1e1f1e;
    --bg-code:       #28292a;

    --green:         #6ec896;
    --green-soft:    #1a2e22;
    --red:           #e07a6b;
    --red-soft:      #2e1f1c;
    --gold:          #d4a955;
    --gold-soft:     #2a2419;

    --border:        #2f302e;
    --border-light:  #252625;

    --shadow-sm:     0 1px 3px rgba(0,0,0,0.2);
    --shadow-md:     0 4px 14px rgba(0,0,0,0.3);
    --shadow-lg:     0 8px 28px rgba(0,0,0,0.35);
  }
}

/* ────────── 基础重置 ────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Serif SC', 'Songti SC', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  color: var(--text);
  background: var(--bg);
  max-width: 780px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ────────── 排版 ────────── */
h1, h2, h3, h4 {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 0.6rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
h1::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

h2 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-top: 3rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.15rem;
  color: var(--text);
  margin-top: 2rem;
  font-weight: 600;
}

h4 {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 600;
}

p {
  margin-bottom: 1.15rem;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
}
a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

strong { font-weight: 700; }
em { font-style: italic; color: var(--text); }

/* ────────── 列表 ────────── */
ul, ol {
  margin-bottom: 1.15rem;
  padding-left: 1.6rem;
}
li { margin-bottom: 0.5rem; }
li::marker { color: var(--accent); }

/* ────────── 课头信息条 ────────── */
.lesson-meta {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.7rem 1.1rem;
  margin-bottom: 2.2rem;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  line-height: 1.6;
}
.lesson-meta .module {
  color: var(--accent);
  font-weight: 600;
}
.lesson-meta a {
  color: var(--text-secondary);
  border-bottom: 1px dotted var(--text-tertiary);
}

/* ────────── Callout 提示框 ────────── */
.callout {
  border: none;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 1rem 1.4rem;
  margin: 1.8rem 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  position: relative;
}
.callout.warn {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}
.callout.danger {
  border-left-color: var(--red);
  background: var(--red-soft);
}
.callout .label {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.4rem;
}
.callout .label.info   { color: var(--accent); }
.callout .label.warn   { color: var(--gold); }
.callout .label.danger { color: var(--red); }

/* ────────── 代码 ────────── */
code {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--text);
}
pre {
  background: var(--bg-code);
  padding: 1.1rem 1.3rem;
  border-radius: var(--r-sm);
  overflow-x: auto;
  margin: 1.2rem 0;
  border: 1px solid var(--border-light);
}
pre code { background: none; padding: 0; }

/* ────────── 表格 ────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8rem 0;
  font-size: 0.93rem;
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.9rem;
  text-align: left;
}
th {
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
}
tr:nth-child(even) { background: var(--bg-card); }
tr:hover td { background: var(--accent-soft); transition: background 0.15s; }

/* ────────── 语义色 ────────── */
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red);   font-weight: 600; }

.keyterm {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 600;
  color: var(--accent);
}

/* ────────── 测验 ────────── */
.quiz {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.6rem 1.5rem;
  margin: 2.2rem 0;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}
.quiz h3 {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.quiz .q {
  margin-bottom: 1.3rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--border-light);
}
.quiz .q:last-child { border-bottom: none; }
.quiz .q-text {
  font-weight: 600;
  margin-bottom: 0.7rem;
  color: var(--text);
}
.quiz .options { list-style: none; padding-left: 0; }
.quiz .options li {
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.quiz .options li:hover {
  background: var(--accent-soft);
  border-color: var(--accent-light);
  color: var(--text);
  transform: translateX(2px);
}
.quiz .options li.correct {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--text);
  font-weight: 500;
}
.quiz .options li.wrong {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--text);
}
.quiz .feedback {
  display: none;
  margin-top: 0.6rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  background: var(--bg-code);
  line-height: 1.6;
}
.quiz .options li.correct ~ .feedback,
.quiz .options li.wrong ~ .feedback { display: block; }

/* ────────── 导航 ────────── */
.nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
}
.nav a {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.88rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border);
}
.nav a:hover {
  background: var(--accent-soft);
  border-color: var(--accent-light);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ────────── 实操练习 ────────── */
.practice {
  border: 1px solid var(--accent-light);
  border-radius: var(--r-md);
  padding: 1.3rem 1.5rem;
  margin: 2rem 0;
  background: var(--green-soft);
}
.practice .label {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  color: var(--green);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5rem;
}

/* ────────── 首页模块卡片 ────────── */
.module-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.6rem 1.8rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.module-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.module-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0;
}
.module-card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.lesson-list { list-style: none; padding-left: 0; }
.lesson-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: padding-left 0.2s ease;
}
.lesson-list li:hover { padding-left: 0.4rem; }
.lesson-list li:last-child { border-bottom: none; }
.lesson-list a {
  font-weight: 500;
  border-bottom: none;
}
.lesson-list a:hover { color: var(--accent); }

/* ────────── 首页 Hero ────────── */
.intro-box {
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem;
  margin: 1rem 0 2rem;
  position: relative;
  overflow: hidden;
}
.intro-box::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.intro-box h1 {
  border: none;
  color: #fff;
  font-size: 2rem;
}
.intro-box h1::after { display: none; }
.intro-box p {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 0.3rem;
}

/* ────────── 速查卡片（参考手册） ────────── */
.metric-card,
.val-card,
.strategy-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.3rem 1.5rem;
  margin: 1.2rem 0;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.metric-card:hover,
.val-card:hover,
.strategy-card:hover {
  box-shadow: var(--shadow-md);
}
.metric-card .formula,
.val-card .formula {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-code);
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-sm);
  margin: 0.6rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--border-light);
}

/* ────────── 术语表 ────────── */
.glossary-section { margin-bottom: 2.5rem; }
.glossary-section h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.term {
  margin-bottom: 1rem;
  padding: 0.8rem 1.1rem;
  border-left: 3px solid var(--accent-light);
  background: var(--bg-card);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: border-left-color 0.2s, transform 0.2s;
}
.term:hover {
  border-left-color: var(--accent);
  transform: translateX(2px);
}
.term .word {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.02rem;
}
.term .en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-left: 0.5rem;
}

/* ────────── 策略标签 ────────── */
.tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 600;
}
.tag.easy   { background: var(--green-soft); color: var(--green); }
.tag.medium { background: var(--gold-soft);  color: var(--gold); }
.tag.hard   { background: var(--red-soft);   color: var(--red); }

/* ────────── 阅读进度条 ────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  width: 0%;
  z-index: 999;
  transition: width 0.1s ease;
  border-radius: 0 2px 2px 0;
}

/* ────────── 响应式 ────────── */
@media (max-width: 640px) {
  body {
    font-size: 16px;
    padding: 1.5rem 1rem 4rem;
  }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
  .module-card { padding: 1.2rem; }
  .intro-box { padding: 1.8rem 1.4rem; }
  .intro-box h1 { font-size: 1.6rem; }
  .nav { flex-direction: column; }
  .nav a { text-align: center; }
}

/* ────────── 打印 ────────── */
@media print {
  body { max-width: none; font-size: 12pt; color: #000; background: #fff; }
  .quiz .options li { cursor: default; }
  .nav, .reading-progress { display: none; }
  .callout, .practice { break-inside: avoid; }
  .module-card, .metric-card, .val-card, .strategy-card {
    box-shadow: none;
    break-inside: avoid;
  }
  a { color: #000; border-bottom: none; }
  th { background: #f0f0f0; color: #000; }
}

/* ────────── 回到顶部 ────────── */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 998;
  font-size: 1.2rem;
  color: var(--accent);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}
