/* 《股票投资全景课》共享样式 · 每章一文件版 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #23272F;
  --muted: #5C6270;
  --bg: #FAF9F5;
  --card: #FFFFFF;
  --line: #E3E0D6;
  --accent: #4A6FA5;
  --up: #D64545;
  --down: #2E9E63;
  --formula-bg: #F1EFE7;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.75;
}

/* ============ 章节页顶部导航条 ============ */
.chapbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  background: #1C222E; color: #C9CEDB;
  padding: 12px 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.chapbar a {
  color: #AFC6E8; text-decoration: none; font-weight: 800; font-size: 14px;
  padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.08);
  white-space: nowrap;
}
.chapbar a:hover { background: rgba(255,255,255,.18); color: #fff; }
.chapbar .title { font-weight: 900; font-size: 15px; color: #fff; flex: 1; }
.chapbar .part {
  font-size: 11px; font-weight: 900; letter-spacing: 2px;
  color: #1C222E; background: var(--accent);
  padding: 4px 12px; border-radius: 999px; white-space: nowrap;
}

/* ============ 页面主体 ============ */
main { max-width: 980px; margin: 0 auto; padding: 0 22px 30px; }

section {
  padding: 46px 0 34px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
}
section:last-child { border-bottom: none; }
section.wide { max-width: 1080px; align-self: stretch; }

/* 章首 hero */
.chap-head { text-align: center; padding-top: 54px; }
.chap-head .kicker { display: inline-block; }
.chap-head .ch-emoji { font-size: clamp(52px, 8vw, 84px); margin: 14px 0 8px; }
.chap-head h2 { font-size: clamp(26px, 4vw, 40px); }
.chap-head .lede { font-size: clamp(15.5px, 2vw, 18.5px); }

.kicker {
  font-size: 13px; font-weight: 900; letter-spacing: 3px;
  color: var(--accent); margin-bottom: 12px; text-align: center;
}
h2 { font-size: clamp(22px, 3.2vw, 32px); font-weight: 900; line-height: 1.4; text-align: center; width: 100%; }
.lede { font-size: clamp(15px, 1.9vw, 17.5px); color: var(--muted); text-align: center; margin: 14px 0 24px; max-width: 740px; }

.panel {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 18px; padding: 24px 28px; width: 100%;
  box-shadow: 0 2px 10px rgba(35,39,47,.05);
  margin-bottom: 14px;
}
.panel h3 { font-size: 17.5px; font-weight: 900; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.panel h3 .em { font-size: 21px; }
.panel p { font-size: 15px; margin-bottom: 9px; }
.panel p:last-child { margin-bottom: 0; }
.panel b { color: var(--ink); }
.hl { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 32%, transparent) 62%); padding: 0 2px; font-weight: 800; }
.r { color: var(--up); font-weight: 800; }
.g { color: var(--down); font-weight: 800; }

.formula {
  background: var(--formula-bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 18px; margin: 11px 0;
  font-family: Consolas, "SF Mono", Menlo, monospace;
  font-size: 15px; text-align: center; letter-spacing: .5px;
  overflow-x: auto; white-space: nowrap;
}
.formula .cmt { color: var(--muted); }

.case {
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, #fff);
  border-radius: 0 12px 12px 0;
  padding: 13px 17px; margin: 11px 0; font-size: 14.5px;
}
.case .cap { font-weight: 900; font-size: 13px; letter-spacing: 2px; color: var(--accent); display: block; margin-bottom: 5px; }

.trap {
  border-left: 4px solid #C0392B;
  background: #FDF3F2; border-radius: 0 12px 12px 0;
  padding: 13px 17px; margin: 11px 0; font-size: 14.5px;
}
.trap .cap { font-weight: 900; font-size: 13px; letter-spacing: 2px; color: #C0392B; display: block; margin-bottom: 5px; }

table.nice { border-collapse: collapse; width: 100%; font-size: 14px; margin: 9px 0; }
table.nice th { background: var(--ink); color: #fff; padding: 8px 13px; text-align: left; font-weight: 800; }
table.nice th:first-child { border-radius: 8px 0 0 0; } table.nice th:last-child { border-radius: 0 8px 0 0; }
table.nice td { padding: 8px 13px; border-bottom: 1px solid var(--line); }
table.nice tr:last-child td { border-bottom: none; }
table.nice td:first-child { font-weight: 700; }
.num-cell { font-family: Consolas, Menlo, monospace; font-weight: 700; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; width: 100%; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; width: 100%; }
.grid2 .panel, .grid3 .panel { margin: 0; }

svg.fig { width: 100%; height: auto; display: block; margin: 7px 0; }
.fig-cap { font-size: 13px; color: var(--muted); text-align: center; margin-top: 3px; }

.timeline { display: flex; width: 100%; gap: 0; margin: 13px 0; flex-wrap: wrap; }
.tseg { flex: 1; min-width: 145px; border-top: 3px solid var(--ink); padding: 9px 11px 0; position: relative; }
.tseg::before { content: ''; position: absolute; top: -6px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.tseg .t { font-family: Consolas, Menlo, monospace; font-weight: 700; font-size: 13.5px; }
.tseg .d { font-size: 12.5px; color: var(--muted); }
.tseg.hi { border-top-color: var(--accent); }
.tseg.hi::before { background: var(--accent); }

.flow { display: flex; align-items: stretch; gap: 9px; flex-wrap: wrap; justify-content: center; margin: 11px 0; }
.flow .node {
  border: 2px solid var(--ink); border-radius: 12px; background: #fff;
  padding: 9px 15px; font-size: 13.5px; font-weight: 800; text-align: center;
  display: flex; flex-direction: column; justify-content: center; min-width: 115px;
}
.flow .node small { font-weight: 600; color: var(--muted); font-size: 12px; margin-top: 2px; }
.flow .op { display: flex; flex-direction: column; justify-content: center; font-weight: 900; font-size: 17px; color: var(--accent); }

.tag-row { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }
.pill { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 16px; font-size: 13.5px; font-weight: 800; }
.pill.up { color: var(--up); border-color: var(--up); }
.pill.down { color: var(--down); border-color: var(--down); }

.fin { font-size: clamp(19px, 2.8vw, 27px); font-weight: 900; margin-top: 14px; text-align: center; }
.fin small { display: block; font-size: 14.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }

/* ============ 本章小结与自测 ============ */
.summary-card {
  background: #fff; border: 1.5px solid var(--line); border-radius: 18px;
  padding: 24px 28px; width: 100%;
  box-shadow: 0 2px 10px rgba(35,39,47,.05);
}
.summary-card h3 { font-weight: 900; font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.summary-card ol, .summary-card ul { padding-left: 22px; }
.summary-card li { font-size: 15px; margin-bottom: 7px; }

.quiz {
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 16px 20px; margin: 10px 0; width: 100%;
}
.quiz .q { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.quiz .q .qno {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 900; border-radius: 999px;
  padding: 2px 10px; margin-right: 8px;
}
.quiz details { margin-top: 6px; }
.quiz summary {
  cursor: pointer; font-size: 13.5px; font-weight: 800; color: var(--accent);
  user-select: none; display: inline-block; padding: 3px 0;
}
.quiz details[open] summary { margin-bottom: 6px; }
.quiz .ans {
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  padding: 10px 14px; font-size: 14px;
}

/* ============ 底部翻页 ============ */
.navbottom {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  padding: 26px 22px 40px; flex-wrap: wrap;
}
.navbottom a {
  text-decoration: none; font-weight: 800; font-size: 14.5px;
  padding: 10px 22px; border-radius: 12px;
  border: 2px solid var(--ink); color: var(--ink); background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .1s;
}
.navbottom a:hover { transform: translate(-1px,-1px); }
.navbottom a.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent) 45%, #000); }
.navbottom span.dim { color: var(--muted); font-size: 13px; font-weight: 700; padding: 0 4px; }

/* ============ index 总目录 ============ */
.index-hero { text-align: center; padding: 64px 20px 40px; }
.index-hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 900; }
.index-hero .sub { color: var(--muted); margin: 14px auto 0; max-width: 720px; font-size: clamp(15px, 2vw, 17.5px); }
.index-wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px 60px; }
.part-title {
  font-size: 13px; font-weight: 900; letter-spacing: 4px;
  margin: 34px 0 14px; padding-left: 4px;
  color: var(--ink);
}
.part-title b { color: var(--pc, var(--accent)); }
.chapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.chapcard {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 18px 20px; box-shadow: 0 2px 8px rgba(35,39,47,.05);
  border-top: 4px solid var(--pc, var(--accent));
  transition: transform .12s, box-shadow .12s;
}
.chapcard:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(35,39,47,.12); }
.chapcard .cc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chapcard .cc-num { font-family: Consolas, Menlo, monospace; font-weight: 700; font-size: 13px; color: var(--muted); }
.chapcard .cc-emoji { font-size: 26px; }
.chapcard .cc-title { font-weight: 900; font-size: 17px; }
.chapcard .cc-desc { font-size: 13.5px; color: var(--muted); line-height: 1.65; }

@media (max-width: 640px) {
  .chapbar { padding: 10px 12px; gap: 8px; }
  .chapbar .title { font-size: 13.5px; }
  .chapbar .part { display: none; }
  main { padding: 0 14px 20px; }
  section { padding: 38px 0 28px; }
  .panel { padding: 20px 18px; }
}
