/* ==========================================================================
 * 赚钱理论 v1·主样式表
 * 来源：build_money_html.py 中的 CSS 变量（v1.2 升级时提取）
 * 用途：main_money.html + 12 个 supplement HTML 共用
 * 主题：light（默认）· dark · sepia
 * 字号：默认 18px，可通过 .content 的 --font-scale 缩放
 * ========================================================================== */

:root {
  --text: #1c1917;
  --text-muted: #57534e;
  --bg: #fafaf9;
  --panel-bg: #ffffff;
  --border: #e7e5e4;
  --link: #b45309;
  --link-hover: #92400e;
  --quote-bg: #fef3c7;
  --code-inline-bg: #f5f5f4;
  --code-inline-color: #6b3410;
  --nav-bg: #f0e4c8;
  --header-accent: #b45309;
}

/* dark 主题 */
:root[data-theme="dark"] {
  --text: #fafaf9;
  --text-muted: #a8a29e;
  --bg: #0c0a09;
  --panel-bg: #1c1917;
  --border: #44403c;
  --link: #fbbf24;
  --link-hover: #fde68a;
  --quote-bg: #292524;
  --code-inline-bg: #292524;
  --code-inline-color: #fde68a;
  --nav-bg: #292524;
  --header-accent: #fbbf24;
}
:root[data-theme="dark"] .article-header {
  background: linear-gradient(135deg, #44403c 0%, #292524 100%);
}
:root[data-theme="dark"] .money-svg-figure {
  background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
  border-color: #57534e;
}
:root[data-theme="dark"] .content thead { background: #44403c; }
:root[data-theme="dark"] .content tr:nth-child(even) { background: #292524; }
:root[data-theme="dark"] .content tr:hover { background: #44403c; }
:root[data-theme="dark"] .nav a { background: #292524; }
:root[data-theme="dark"] .nav a:hover { background: #44403c; }
:root[data-theme="dark"] .card { background: #1c1917; }
:root[data-theme="dark"] .rs-toggle { box-shadow: 0 4px 12px rgba(0,0,0,0.5); }

/* sepia 主题 */
:root[data-theme="sepia"] {
  --text: #3d2817;
  --text-muted: #8b6f47;
  --bg: #f4e8d0;
  --panel-bg: #faf0dc;
  --border: #d4b896;
  --link: #8b4513;
  --link-hover: #6b3410;
  --quote-bg: #ebd9b5;
  --code-inline-bg: #ebd9b5;
  --code-inline-color: #6b3410;
  --nav-bg: #e8d4a8;
  --header-accent: #8b4513;
}
:root[data-theme="sepia"] .article-header {
  background: linear-gradient(135deg, #8b4513 0%, #6b3410 100%);
}
:root[data-theme="sepia"] .money-svg-figure {
  background: linear-gradient(135deg, #f4e8d0 0%, #ebd9b5 100%);
  border-color: #d4b896;
}
:root[data-theme="sepia"] .content thead { background: #6b3410; }
:root[data-theme="sepia"] .content tr:nth-child(even) { background: #ebd9b5; }
:root[data-theme="sepia"] .content tr:hover { background: #e8d4a8; }
:root[data-theme="sepia"] .nav a { background: #ebd9b5; }
:root[data-theme="sepia"] .nav a:hover { background: #e8d4a8; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  font-size: 18px;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.container { max-width: 1280px; margin: 0 auto; padding: 40px 20px; }

.article-header {
  background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  color: #ffffff;
  padding: 50px 40px;
  border-radius: 16px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}
.article-header h1 { font-size: 2.2em; font-weight: 700; margin-bottom: 16px; letter-spacing: 1px; }
.article-header .meta { font-size: 1em; opacity: 0.92; line-height: 2; }
.article-header .meta a { color: #fde68a; text-decoration: none; }
.article-header .meta a:hover { text-decoration: underline; }
.article-header .meta code { background: rgba(255,255,255,0.18); color: #fff7ed; }

.content {
  background: var(--panel-bg);
  color: var(--text);
  padding: 40px 48px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  font-size: calc(18px * var(--font-scale, 1));
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.content h1, .content h2, .content h3, .content h4 {
  color: var(--text);
  margin: 1.4em 0 0.6em 0;
  font-weight: 700;
  line-height: 1.4;
}
.content h1 { font-size: 2em; border-bottom: 3px solid var(--header-accent); padding-bottom: 12px; }
.content h2 { font-size: 1.6em; border-left: 4px solid var(--header-accent); padding-left: 14px; margin-top: 2em; }
.content h3 { font-size: 1.3em; color: var(--header-accent); }
.content h4 { font-size: 1.1em; color: var(--text-muted); }
.content p { margin: 1em 0; color: var(--text); }
.content strong { color: var(--header-accent); font-weight: 700; }
.content em { color: var(--header-accent); font-style: italic; }
.content a { color: var(--link); text-decoration: none; border-bottom: 1px solid var(--link); }
.content a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
.content ul, .content ol { margin: 0.8em 0 0.8em 1.5em; color: var(--text); }
.content li { margin: 0.4em 0; }
.content blockquote {
  border-left: 4px solid var(--header-accent);
  background: var(--quote-bg);
  padding: 14px 20px;
  margin: 1.2em 0;
  border-radius: 0 8px 8px 0;
  color: var(--text);
}
.content blockquote p { color: var(--text); margin: 0.3em 0; }
.content hr { border: none; border-top: 2px dashed var(--border); margin: 2em 0; }
.content code {
  background: var(--code-inline-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.92em;
  color: var(--code-inline-color);
}
.content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
}
.content pre code { background: none; color: inherit; padding: 0; }
.content .table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.4em 0;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(31, 41, 55, 0.08);
  border: 1px solid var(--border);
}
.content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.96em;
}
.content thead { background: #1c1917; color: #fafaf9; }
.content th, .content td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.content th { font-weight: 700; }
.content tr:nth-child(even) { background: var(--quote-bg); }
.content tr:hover { background: #fde68a; }

.money-svg-figure {
  margin: 1.5em 0;
  padding: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-radius: 12px;
  border: 1px solid #fde68a;
  text-align: center;
}
.money-svg-figure .money-svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.money-svg-figure figcaption {
  margin-top: 12px;
  font-size: 0.92em;
  color: var(--text-muted);
  font-style: italic;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 30px 0;
  padding: 20px 24px;
  background: var(--panel-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.nav a {
  color: var(--link);
  text-decoration: none;
  padding: 8px 14px;
  background: var(--quote-bg);
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  border-bottom: none;
}
.nav a:hover { background: #fde68a; }

.copy-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff7ed;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}
.copy-btn:hover { background: #fde68a; }
.copy-btn .copy-icon { font-size: 16px; line-height: 1; }
.copy-btn .copy-text { line-height: 1; }
.copy-hint { color: #fef3c7; font-size: 0.85em; opacity: 0.85; }

@media (max-width: 720px) {
  .container { padding: 20px 12px; }
  .article-header { padding: 30px 22px; }
  .article-header h1 { font-size: 1.6em; }
  .content { padding: 24px 20px; }
  .content h1 { font-size: 1.5em; }
  .content h2 { font-size: 1.3em; }
  .content table { font-size: 0.88em; display: block; overflow-x: auto; white-space: nowrap; }
  .copy-toolbar { flex-direction: column; align-items: flex-start; }
  .copy-btn { padding: 7px 12px; font-size: 0.9em; }
}

#reading-settings-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  min-width: 220px;
  backdrop-filter: blur(10px);
}
#reading-settings-panel.collapsed { min-width: 0; }
#reading-settings-panel.collapsed .rs-panel { display: none; }
.rs-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d97706, #ea580c);
  color: #fff;
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(234,88,12,0.4);
  font-family: inherit;
}
.rs-toggle:hover { transform: scale(1.05); }
#reading-settings-panel.collapsed .rs-toggle { display: inline-flex; }
.rs-panel { padding: 16px; }
#reading-settings-panel:not(.collapsed) .rs-toggle { display: none; }
.rs-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  cursor: move;
}
.rs-title { font-weight: 700; color: var(--text); font-size: 15px; }
.rs-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
}
.rs-close:hover { color: var(--text); }
.rs-panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rs-label { font-size: 13px; color: var(--text-muted); min-width: 36px; }
.rs-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.rs-btns button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.rs-btns button:hover { background: var(--quote-bg); }
.rs-btns button.active { background: #d97706; color: #fff; border-color: #d97706; }

/* ==========================================================================
 * 左侧固定目录导航（v1.9 升级）
 * 用途：main_money.html 主目录滚动定位
 * 主题：跟随 --bg / --panel-bg / --text / --border 变量自动适配
 * ========================================================================== */

.sidebar-toc {
  position: fixed;
  top: 80px;
  left: 20px;
  width: 240px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  z-index: 9000;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-toc::-webkit-scrollbar { width: 6px; }
.sidebar-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar-toc::-webkit-scrollbar-track { background: transparent; }

.sidebar-toc.collapsed { transform: translateX(-100%); }
.sidebar-toc-toggle {
  position: fixed;
  top: 80px;
  left: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d97706, #ea580c);
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  z-index: 9001;
  display: none;
  box-shadow: 0 4px 12px rgba(234,88,12,0.4);
  font-family: inherit;
  transition: transform 0.2s ease;
}
.sidebar-toc-toggle:hover { transform: scale(1.05); }
.sidebar-toc-toggle.show { display: inline-flex; align-items: center; justify-content: center; }

.sidebar-toc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--header-accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 1px;
}
.sidebar-toc-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
}
.sidebar-toc-close:hover { color: var(--text); }

.sidebar-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-toc-list li {
  margin: 0;
  padding: 0;
}
.sidebar-toc-list a {
  display: block;
  padding: 6px 10px;
  margin: 2px 0;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-bottom: none;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  transition: all 0.15s ease;
}
.sidebar-toc-list a:hover {
  color: var(--text);
  background: var(--quote-bg);
  border-left-color: var(--header-accent);
}
.sidebar-toc-list a.active {
  color: var(--header-accent);
  background: var(--quote-bg);
  border-left-color: var(--header-accent);
  font-weight: 600;
}

/* 主内容给侧边栏让出空间（仅桌面端） */
@media (min-width: 1025px) {
  .container.with-sidebar { padding-left: 280px; }
}
@media (max-width: 1024px) {
  .sidebar-toc { display: none; }
  .sidebar-toc-toggle { display: none; }
}

/* dark/sepia 主题适配 */
:root[data-theme="dark"] .sidebar-toc { box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
:root[data-theme="sepia"] .sidebar-toc { box-shadow: 0 4px 18px rgba(139,69,19,0.15); }
