/* =========================================================================
 * 方证研读（学习层）· 样式 —— 复用全站 --ziwu-* 节律色板
 * 配色：宣纸底 / 墨字 / 朱砂红(警示·主色) / 古铜金(编号·进度) / 黛绿(已读)
 * ========================================================================= */

/* ----- 双 Tab 容器 ----- */
.fh-wrap { display: flex; flex-direction: column; gap: 14px; }
.fh-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.fh-tab {
  font: 600 15px/1 var(--serif, "Noto Serif SC", serif);
  color: var(--ziwu-muted, #8a7a63);
  background: var(--ziwu-surface, #f3ecd9);
  border: 1px solid var(--ziwu-line, #e3d8c2);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all .18s ease;
}
.fh-tab:hover { color: var(--ziwu-ink, #3a2f23); border-color: var(--ziwu-gold, #b8902f); }
.fh-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--ziwu-cinnabar, #b23a2e), var(--ziwu-cinnabar-deep, #8c2b22));
  border-color: var(--ziwu-cinnabar-deep, #8c2b22);
  box-shadow: 0 4px 14px rgba(140, 43, 34, .22);
}
.fh-body { min-height: 200px; }

/* ----- 研读主页 ----- */
.fs-wrap { display: flex; flex-direction: column; gap: 18px; }
.fs-head { display: flex; flex-direction: column; gap: 8px; }
.fs-head .ph { margin: 0; }
.fs-head .hint { margin: 0; }
.fs-progress { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.fs-bar {
  flex: 1; height: 10px; max-width: 420px;
  background: var(--ziwu-surface, #f1e9d8);
  border: 1px solid var(--ziwu-line, #e3d8c2);
  border-radius: 999px; overflow: hidden;
}
.fs-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ziwu-gold, #b8902f), var(--ziwu-cinnabar, #b23a2e));
  transition: width .35s ease;
}
.fs-prog-txt { font: 600 13px/1 var(--serif, serif); color: var(--ziwu-muted, #8a7a63); white-space: nowrap; }

/* ----- 章内快速导航（侧栏 sticky：≥980px 竖排 / 移动端退回横向 sticky） ----- */
.fs-body { display: flex; flex-direction: column; gap: 14px; }
.fs-side {
  align-self: stretch;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 4px;
  background: var(--ziwu-page, #faf6ec);
  border-bottom: 1px solid var(--ziwu-line, #e3d8c2);
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.fs-side::-webkit-scrollbar { height: 4px; }
.fs-side::-webkit-scrollbar-thumb { background: var(--ziwu-line, #e3d8c2); border-radius: 4px; }
.fs-navchip {
  display: inline-flex; align-items: center; gap: 5px;
  flex: none;
  font: 500 12.5px/1 var(--serif, serif); color: var(--ziwu-ink, #3a2f23);
  background: var(--ziwu-surface, #f3ecd9);
  border: 1px solid var(--ziwu-line, #e3d8c2);
  border-radius: 8px; padding: 6px 9px; cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.fs-navchip b {
  display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; background: var(--ziwu-gold, #b8902f); border-radius: 50%;
}
.fs-navchip small { color: var(--ziwu-muted, #8a7a63); font-size: 11px; }
.fs-navchip:hover { border-color: var(--ziwu-gold, #b8902f); transform: translateY(-1px); }
.fs-navchip.active {
  background: linear-gradient(135deg, var(--ziwu-cinnabar, #b23a2e), var(--ziwu-cinnabar-deep, #8c2b22));
  border-color: var(--ziwu-cinnabar-deep, #8c2b22);
  color: #fff;
  box-shadow: 0 4px 12px rgba(140, 43, 34, .22);
}
.fs-navchip.active b { background: rgba(255,255,255,.18); }
.fs-navchip.active small { color: rgba(255,255,255,.78); }

/* ≥980px（与全局侧栏阈值一致）— 把章节 chip 改为左侧竖排 sticky */
@media (min-width: 980px) {
  .fs-body {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 22px;
    align-items: flex-start;
  }
  .fs-side {
    position: sticky;
    top: 14px;
    z-index: 1;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    padding: 12px 10px;
    background: var(--ziwu-surface, #f3ecd9);
    border: 1px solid var(--ziwu-line, #e3d8c2);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: thin;
  }
  .fs-side::-webkit-scrollbar { width: 6px; }
  .fs-side::-webkit-scrollbar-thumb { background: var(--ziwu-line, #e3d8c2); border-radius: 6px; }
  .fs-navchip {
    width: 100%;
    text-align: left;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.35;
    border-radius: 9px;
    border-color: transparent;
    background: transparent;
  }
  .fs-navchip > span.fchip-text { display: block; min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; line-height: 1.3; }
  .fs-navchip small { flex: none; }
  .fs-navchip:hover { background: rgba(184, 144, 47, .1); border-color: var(--ziwu-line, #e3d8c2); transform: none; }
}

/* ----- 系统章节 ----- */
.fs-sec { scroll-margin-top: 64px; }
.fs-sec-h { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.fs-sec-h h3 {
  font: 700 19px/1.2 var(--serif, serif); color: var(--ziwu-ink, #3a2f23);
  margin: 0; padding-left: 12px; border-left: 4px solid var(--ziwu-cinnabar, #b23a2e);
}
.fs-sec-desc { flex: 1; min-width: 180px; margin: 0; color: var(--ziwu-muted, #8a7a63); font-size: 13px; }
.fs-sec-all { margin-left: auto; }

/* ----- 方证研读卡 ----- */
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.fs-grid-flat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
/* 章节标题跨整行 */
.fs-chap-head { scroll-margin-top: 78px; margin: 22px 0 4px; }
.fs-chap-head:first-child { margin-top: 8px; }
.fs-chap-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #faf3e2, #fbf7eb);
  border: 1px solid var(--ziwu-line, #e3d8c2);
  border-left: 5px solid var(--ziwu-cinnabar, #b23a2e);
  border-radius: 12px;
}
.fs-chap-no {
  display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ziwu-cinnabar, #b23a2e), var(--ziwu-cinnabar-deep, #8c2b22));
  color: #fff; border-radius: 50%; font: 700 14px/1 var(--serif, serif); flex: none;
  box-shadow: 0 4px 10px rgba(178, 58, 46, .25);
}
.fs-chap-bar h3 {
  margin: 0; font: 700 18px/1.3 var(--serif, "Noto Serif SC", serif);
  color: var(--ziwu-ink, #3a2f23); flex: none;
}
.fs-chap-desc { flex: 1; min-width: 200px; margin: 0; color: var(--ziwu-muted, #8a7a63); font-size: 13px; }
.fs-chap-bar .fs-sec-all { margin-left: 0; }
.fs-card {
  background: var(--ziwu-surface, #f6f0e1);
  border: 1px solid var(--ziwu-line, #e3d8c2);
  border-left: 4px solid var(--ziwu-gold, #b8902f);
  border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(58, 47, 35, .05);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.fs-card:hover { box-shadow: 0 6px 18px rgba(58, 47, 35, .1); }
.fs-card.fs-done { border-left-color: var(--ziwu-jade, #4f8a6b); background: #f3f6ef; }

.fs-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fs-formulas { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-fchip {
  font: 600 15px/1.3 var(--serif, serif); color: var(--ziwu-cinnabar-deep, #8c2b22);
  background: #fbeeea; border: 1px solid #f0d4cd; border-radius: 7px; padding: 4px 9px;
}
.fs-fchip-muted { color: var(--ziwu-muted, #8a7d6b); background: #f3efe7; border-color: #e6dfd2; font-weight: 500; }
.fs-read { flex: none; font-size: 12px; padding: 6px 12px; }
.fs-card.fs-done .fs-read { color: var(--ziwu-jade, #4f8a6b); border-color: var(--ziwu-jade, #4f8a6b); }

.fs-row { display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--ziwu-line, #e9e0cd); }
.fs-row:first-of-type { border-top: 0; }
.fs-k { font: 600 13px/1.5 var(--serif, serif); color: var(--ziwu-muted, #8a7a63); }
.fs-v { font: 400 14px/1.6 var(--kai, "KaiTi", "STKaiti", serif); color: var(--ziwu-ink, #3a2f23); }
.fs-note .fs-v { color: #6b5836; }
.fs-toxic { background: #fbeeec; border-radius: 7px; margin: 4px 0; padding: 6px 8px; border: 1px solid #f0cfc8; }
.fs-toxic .fs-k { color: var(--ziwu-cinnabar, #b23a2e); }
.fs-toxic .fs-v { color: var(--ziwu-cinnabar-deep, #8c2b22); font-weight: 600; }
.fs-src { margin-top: 2px; }
.fs-src .fs-v { font-size: 12.5px; color: var(--ziwu-muted, #8a7a63); }
.fs-src-link {
  color: var(--ziwu-cinnabar, #b23a2e);
  text-decoration: underline;
  text-decoration-color: rgba(178, 58, 46, .35);
  cursor: pointer;
  transition: all .15s ease;
}
.fs-src-link:hover { color: var(--ziwu-cinnabar-deep, #8c2b22); text-decoration-color: rgba(178, 58, 46, .85); }

.fs-expand {
  width: 100%; margin-top: 10px;
  background: transparent; color: var(--ziwu-muted, #8a7a63);
  border: 1px dashed var(--ziwu-line, #e3d8c2);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; cursor: pointer;
  transition: all .15s ease;
}
.fs-expand:hover, .fs-expand.expanded {
  color: var(--ziwu-ink, #3a2f23);
  border-color: var(--ziwu-gold, #b8902f);
  background: rgba(184, 144, 47, .06);
}
/* 统一正文/引用字体，避免楷体·宋体混排观感杂乱 */
.fs-card-body {
  margin-top: 14px; padding: 18px 20px;
  background: var(--ziwu-surface, #fbf7ef);
  border: 1px solid var(--ziwu-line, #e6dcc7);
  border-radius: 12px;
  font: 400 15px/1.95 "Noto Serif SC", "KaiTi", "STKaiti", serif;
  color: var(--ziwu-ink, #3a2f23);
  letter-spacing: .01em;
}
.fs-card-body[hidden] { display: none; }
/* 小节标题：作为分隔线，不再像警示红块 */
.fs-body-hl {
  margin: 18px 0 8px; padding-bottom: 6px;
  font: 700 16px/1.4 "Noto Serif SC", serif;
  color: var(--ziwu-ink, #3a2f23);
  border-bottom: 1px solid var(--ziwu-line, #e6dcc7);
}
.fs-body-hl b { color: var(--ziwu-cinnabar-deep, #8c2b22); }
/* 原文引用：独立成块 + 「原文」小标签，清晰可辨 */
.fs-body-quote {
  position: relative;
  margin: 16px 0; padding: 12px 16px 12px 18px;
  background: #f7f1e6; border-left: 3px solid var(--ziwu-gold, #b8902f);
  border-radius: 0 8px 8px 0;
  font: 500 15.5px/1.85 "Noto Serif SC", serif;
  color: #463722;
}
.fs-body-quote::before {
  content: "原 文"; display: block; margin-bottom: 8px;
  font: 600 12px/1 "Noto Serif SC", serif; letter-spacing: .18em;
  color: var(--ziwu-gold, #b8902f);
}
.fs-body-tip {
  margin: 14px 0; padding: 11px 14px;
  background: #f1f5ee; border-left: 3px solid var(--ziwu-jade, #4f8a6b);
  border-radius: 0 8px 8px 0; color: #3e5a48; font-size: 14px;
}
.fs-body-p { margin: 12px 0; }
.fs-body-p b { color: var(--ziwu-cinnabar, #b23a2e); font-weight: 700; }
.fs-body-p p { margin: 8px 0; }
.fs-body-p ul { margin: 8px 0; padding-left: 1.4em; }
.fs-body-p li { margin: 5px 0; line-height: 1.85; }
.fs-body-p li b { color: var(--ziwu-cinnabar, #b23a2e); }
.fs-body-empty { color: var(--ziwu-muted, #8a7a63); font-style: italic; }

@media (max-width: 1100px) { .fs-grid-flat { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .fs-grid-flat { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .fs-grid { grid-template-columns: 1fr; }
  .fs-row { grid-template-columns: 64px 1fr; }
}
