/* ========== Reset & Base ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-hover: #f8f9fd;
  --border: #e2e5ed;
  --border-light: #eef0f6;
  --text-primary: #1a1d28;
  --text-secondary: #4a5068;
  --text-tertiary: #8b90a5;
  --accent: #4f6ef7;
  --accent-light: #eef1fe;
  --accent-dark: #3b5ae0;
  --topic-ai: #6366f1;
  --topic-ai-bg: #eef2ff;
  --topic-science: #10b981;
  --topic-science-bg: #ecfdf5;
  --topic-geo: #f59e0b;
  --topic-geo-bg: #fffbeb;
  --topic-econ: #06b6d4;
  --topic-econ-bg: #ecfeff;
  --tag-news: #3b82f6;
  --tag-news-bg: #eff6ff;
  --tag-deep: #8b5cf6;
  --tag-deep-bg: #f5f3ff;
  --tag-drama: #f59e0b;
  --tag-drama-bg: #fffbeb;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --font-cn: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-cn);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Header ========== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(255,255,255,0.94);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 14px;
  border-radius: 11px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-info { display: flex; flex-direction: column; }
.logo-text { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.logo-sub { font-size: 0.72rem; color: var(--text-tertiary); font-weight: 400; }

.header-tagline {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ========== Date Bar ========== */
.date-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 0;
}

.report-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.report-nav::-webkit-scrollbar { display: none; }

.report-nav .nav-item {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.report-nav .nav-item:hover { background: var(--bg); }
.report-nav .nav-item.active {
  background: var(--accent);
  color: #fff;
}

/* ========== Topic Tabs ========== */
.topic-tabs {
  display: flex;
  gap: 6px;
  padding: 20px 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topic-tabs::-webkit-scrollbar { display: none; }

.topic-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-cn);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.topic-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.topic-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(79,110,247,0.25);
}
.topic-tab .tab-icon { font-size: 1rem; }

/* ========== Report Layout ========== */
.report-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

/* ========== TOC Sidebar ========== */
.toc-sidebar {
  position: relative;
}

.toc-sticky {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc-heading {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.toc-list { display: flex; flex-direction: column; gap: 2px; }

.toc-link {
  display: block;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.4;
  border-left: 2px solid transparent;
}
.toc-link:hover {
  background: var(--surface);
  color: var(--accent);
  border-left-color: var(--accent);
}
.toc-link.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ========== Report Article ========== */
.report {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 40px 44px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
  min-height: 400px;
}

.loading {
  text-align: center;
  color: var(--text-tertiary);
  padding: 80px 0;
  font-size: 0.95rem;
}

/* ========== Markdown Content ========== */
.report h1 {
  font-size: 1.85rem;
  font-weight: 900;
  margin-bottom: 6px;
  line-height: 1.3;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.report h1 + p {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border-light);
}

.report h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  scroll-margin-top: 90px;
}

/* Topic-colored h2 */
.report h2.topic-ai { background: var(--topic-ai-bg); color: var(--topic-ai); border-left: 3px solid var(--topic-ai); }
.report h2.topic-science { background: var(--topic-science-bg); color: var(--topic-science); border-left: 3px solid var(--topic-science); }
.report h2.topic-geo { background: var(--topic-geo-bg); color: var(--topic-geo); border-left: 3px solid var(--topic-geo); }
.report h2.topic-economy { background: var(--topic-econ-bg); color: var(--topic-econ); border-left: 3px solid var(--topic-econ); }
.report h2.topic-summary { background: var(--bg); color: var(--text-primary); border-left: 3px solid var(--border); }

.report h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text-primary);
  background: var(--surface-hover);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

.report p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.85;
}

.report strong { color: var(--text-primary); font-weight: 600; }

/* Source badge */
.source-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
  letter-spacing: 0.3px;
}

/* 骡子点评 block */
.comment-label {
  color: var(--topic-geo);
  font-weight: 700;
}

p:has(.comment-label) {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-left: 3px solid var(--topic-geo);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.report blockquote {
  border-left: 3px solid var(--accent);
  padding: 16px 22px;
  margin: 18px 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, #f0f0ff 100%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.report blockquote p { margin: 0; }

.report hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 28px 0;
}

.report ul, .report ol { padding-left: 20px; margin-bottom: 10px; }
.report li { margin-bottom: 5px; color: var(--text-secondary); font-size: 0.93rem; }

.report table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.report thead th {
  background: var(--bg);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
}

.report tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}
.report tbody tr:hover { background: var(--surface-hover); }

.report code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.86em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.report a { color: var(--accent); text-decoration: none; font-weight: 500; }
.report a:hover { text-decoration: underline; }

/* ========== Tags ========== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
  margin-left: 6px;
}
.tag-news { background: var(--tag-news-bg); color: var(--tag-news); }
.tag-deep { background: var(--tag-deep-bg); color: var(--tag-deep); }
.tag-drama { background: var(--tag-drama-bg); color: var(--tag-drama); }

/* ========== Back to Top ========== */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 90;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--accent-dark); transform: translateY(-2px); }

/* ========== Footer ========== */
.site-footer {
  text-align: center;
  padding: 28px 0;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.footer-note { margin-top: 4px; font-size: 0.72rem; }

/* ========== Responsive ========== */
@media (max-width: 860px) {
  .report-layout {
    grid-template-columns: 1fr;
  }
  .toc-sidebar { display: none; }
  .report { padding: 28px 22px; }
  .container-wide { padding: 0 16px; }
}

@media (max-width: 640px) {
  .report { padding: 22px 16px; border-radius: 10px; }
  .report h1 { font-size: 1.35rem; }
  .report h2 { font-size: 1.05rem; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-tagline { display: none; }
  .topic-tab { padding: 7px 14px; font-size: 0.82rem; }
  .report table { font-size: 0.78rem; }
  .report thead th, .report tbody td { padding: 7px 8px; }
}
