/* ===== 小李减重 4.0 课程审阅 - Linear 风格 ===== */

:root {
  --bg: #0e0e10;
  --bg-elevated: #18181b;
  --bg-card: #1c1c1f;
  --bg-hover: #27272a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent: #5e6ad2;
  --accent-hover: #7077dc;
  --accent-glow: rgba(94, 106, 210, 0.15);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.08);
  --success-border: rgba(16, 185, 129, 0.25);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --warning-border: rgba(245, 158, 11, 0.25);

  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.08);
  --error-border: rgba(239, 68, 68, 0.25);

  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.08);
  --info-border: rgba(59, 130, 246, 0.25);

  --sidebar-width: 280px;
  --header-height: 56px;
  --content-max: 920px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

::selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* ===== 顶部固定 Header ===== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(14, 14, 16, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.header-brand .logo {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--accent), #8b8fdc);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.header-tabs {
  display: flex;
  gap: 4px;
  margin-left: 32px;
}

.header-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.header-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.header-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.header-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.header-meta .pill {
  padding: 3px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ===== 主体布局 ===== */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ===== 左侧栏 ===== */

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
  padding: 24px 16px 48px;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 4px 12px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.12s ease;
  border-left: 2px solid transparent;
  margin-left: 0;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-glow);
  color: var(--text);
  border-left-color: var(--accent);
}

.sidebar-link.indent {
  padding-left: 28px;
  font-size: 12.5px;
}

.sidebar-link .badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}

/* ===== 主内容区 ===== */

.main {
  padding: 48px 56px 96px;
  min-width: 0;
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ===== 排版 ===== */

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 24px);
}

h1 {
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 22px;
  line-height: 1.3;
  margin: 48px 0 16px;
  padding-top: 8px;
  position: relative;
}

h2::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 18px;
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

h3 {
  font-size: 17px;
  line-height: 1.4;
  margin: 28px 0 10px;
}

h4 {
  font-size: 14px;
  line-height: 1.4;
  margin: 18px 0 8px;
  font-weight: 600;
  color: var(--text);
}

p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

p strong, li strong {
  color: var(--text);
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

ul, ol {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 4px;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

pre {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ===== Hero / 首页用 ===== */

.hero {
  padding: 64px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero-eyebrow {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-glow);
  border: 1px solid rgba(94, 106, 210, 0.3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-hover);
  margin-bottom: 20px;
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.hero-title {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.5;
}

/* ===== Cards 网格 ===== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  transition: all 0.18s ease;
  display: block;
  color: var(--text);
  text-decoration: none;
}

a.card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.card-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== 状态徽章 ===== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge.warn {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge.err {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.badge.neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ===== Callout / 信息块 ===== */

.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  border-left: 3px solid;
  background: var(--bg-elevated);
}

.callout-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-body {
  font-size: 14px;
  color: var(--text-secondary);
}

.callout-body p { margin-bottom: 6px; color: var(--text-secondary); }
.callout-body p:last-child { margin-bottom: 0; }

.callout.ok {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.callout.warn {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.callout.err {
  border-left-color: var(--error);
  background: var(--error-bg);
}

.callout.info {
  border-left-color: var(--info);
  background: var(--info-bg);
}

.callout.accent {
  border-left-color: var(--accent);
  background: var(--accent-glow);
}

/* ===== 表格 ===== */

.table-wrap {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table th {
  text-align: left;
  background: var(--bg-elevated);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background: var(--bg-elevated);
}

/* 评分表特殊 */
table .rating-col { white-space: nowrap; width: 80px; }

/* ===== 章节锚点列表（可视化骨架） ===== */

.tree {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 16px 0;
  line-height: 1.85;
  color: var(--text-secondary);
  overflow-x: auto;
}

.tree .branch {
  color: var(--accent);
}

.tree .key {
  color: var(--text);
  font-weight: 600;
}

.tree .note {
  color: var(--text-tertiary);
}

/* ===== Stats 数字卡 ===== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-value.ok { color: var(--success); }
.stat-value.warn { color: var(--warning); }
.stat-value.err { color: var(--error); }
.stat-value.accent { color: var(--accent-hover); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* ===== Section ===== */

.section {
  margin-bottom: 48px;
  padding-top: 24px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

/* ===== 节点列表 (审阅条目) ===== */

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.entry {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.entry-tag {
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
}

.entry-tag.ok { color: var(--success); }
.entry-tag.warn { color: var(--warning); }
.entry-tag.err { color: var(--error); }

.entry-body { flex: 1; min-width: 0; }
.entry-body strong { color: var(--text); }

/* ===== 双列对照 ===== */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

@media (max-width: 720px) {
  .compare { grid-template-columns: 1fr; }
}

.compare-pane {
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.compare-pane.left { background: var(--success-bg); border-color: var(--success-border); }
.compare-pane.right { background: var(--error-bg); border-color: var(--error-border); }

.compare-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.compare-pane.left .compare-title { color: var(--success); }
.compare-pane.right .compare-title { color: var(--error); }

/* ===== 底部页脚 ===== */

.footer {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.7;
}

/* ===== 响应式 ===== */

@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
  .main { padding: 40px 32px 80px; }
  .header-tabs .label-long { display: none; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: 280px;
    z-index: 90;
    transition: left 0.2s;
    background: var(--bg-elevated);
  }
  .sidebar.open { left: 0; }
  .main { padding: 32px 20px 64px; }
  .hero-title { font-size: 32px; }
  .hero { padding: 32px 0 24px; }
  .header { padding: 0 16px; }
  .header-tabs { gap: 0; }
  .header-tab { padding: 6px 10px; font-size: 12px; }
}

/* ===== 锚点提示 ===== */

.anchor-link {
  margin-left: 8px;
  opacity: 0;
  font-size: 14px;
  color: var(--text-tertiary);
  transition: opacity 0.15s;
}

h2:hover .anchor-link, h3:hover .anchor-link {
  opacity: 1;
}

/* ===== 进度条 (顶部固定阅读进度) ===== */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #8b8fdc);
  z-index: 200;
  width: 0%;
  transition: width 0.05s linear;
}

/* ===== Term Pill (术语徽章) ===== */

.term {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  margin: 0 2px;
}

/* ===== 章节首图占位 ===== */

.chapter-banner {
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.1) 0%, rgba(94, 106, 210, 0.02) 100%);
  border: 1px solid rgba(94, 106, 210, 0.2);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 32px;
}

.chapter-banner .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--accent-hover);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.chapter-banner h1 {
  margin-bottom: 8px;
}

.chapter-banner .meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chapter-banner .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
