/* 传统经典解读知识库 — 现代青年阅读风格 v2
 * 四套主题 + 移动优先响应式 + 侧边TOC + Hero区
 * 断点：≤640 手机 / 641-1024 平板 / ≥1025 桌面 / ≥1440 宽屏
 */

/* ============ 主题变量 ============ */
:root, :root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f7f7f8;
  --bg-card: #fafafa;
  --bg-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text: #1a1a1a;
  --text-soft: #555;
  --text-muted: #888;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --accent: #f97316;
  --accent-soft: #fed7aa;
  --border: #e5e7eb;
  --code-bg: #f3f4f6;
  --quote-bg: #f9fafb;
  --quote-border: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
  --header-bg: rgba(255,255,255,0.85);
  --header-text: #1a1a1a;
  --header-border: #e5e7eb;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --selection: #dbeafe;
  --gradient-1: linear-gradient(135deg, #667eea, #764ba2);
  --gradient-2: linear-gradient(135deg, #f093fb, #f5576c);
  --gradient-3: linear-gradient(135deg, #4facfe, #00f2fe);
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #161922;
  --bg-card: #1a1e28;
  --bg-hero: linear-gradient(135deg, #1a1e28 0%, #2a2f3a 100%);
  --text: #e4e6eb;
  --text-soft: #b0b3bb;
  --text-muted: #6b7280;
  --primary: #60a5fa;
  --primary-soft: rgba(96,165,250,0.15);
  --accent: #fb923c;
  --accent-soft: rgba(251,146,60,0.15);
  --border: #2a2f3a;
  --code-bg: #1a1e28;
  --quote-bg: #161922;
  --quote-border: #60a5fa;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
  --header-bg: rgba(15,17,21,0.85);
  --header-text: #e4e6eb;
  --header-border: #2a2f3a;
  --link: #60a5fa;
  --link-hover: #93c5fd;
  --selection: rgba(96,165,250,0.25);
  --gradient-1: linear-gradient(135deg, #667eea, #764ba2);
  --gradient-2: linear-gradient(135deg, #f093fb, #f5576c);
  --gradient-3: linear-gradient(135deg, #4facfe, #00f2fe);
}

:root[data-theme="sepia"] {
  --bg: #f4ecd8;
  --bg-soft: #ede4c8;
  --bg-card: #f7f0dc;
  --bg-hero: linear-gradient(135deg, #8b5a2b 0%, #c2410c 100%);
  --text: #3d2b1f;
  --text-soft: #6b5239;
  --text-muted: #9c8b6f;
  --primary: #8b5a2b;
  --primary-soft: #e8d9b8;
  --accent: #c2410c;
  --accent-soft: #f4e4d3;
  --border: #d9c9a3;
  --code-bg: #ede4c8;
  --quote-bg: #f0e6cc;
  --quote-border: #8b5a2b;
  --shadow: 0 1px 3px rgba(61,43,31,0.08);
  --shadow-lg: 0 10px 30px rgba(61,43,31,0.12);
  --shadow-xl: 0 20px 60px rgba(61,43,31,0.18);
  --header-bg: rgba(244,236,216,0.9);
  --header-text: #3d2b1f;
  --header-border: #d9c9a3;
  --link: #8b5a2b;
  --link-hover: #a0522d;
  --selection: #e8d9b8;
  --gradient-1: linear-gradient(135deg, #8b5a2b, #c2410c);
  --gradient-2: linear-gradient(135deg, #d97706, #92400e);
  --gradient-3: linear-gradient(135deg, #a16207, #713f12);
}

:root[data-theme="minimal"] {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-card: #ffffff;
  --bg-hero: #000;
  --text: #000000;
  --text-soft: #444;
  --text-muted: #999;
  --primary: #000000;
  --primary-soft: #f0f0f0;
  --accent: #000000;
  --accent-soft: #f0f0f0;
  --border: #e0e0e0;
  --code-bg: #f7f7f7;
  --quote-bg: #fafafa;
  --quote-border: #000;
  --shadow: none;
  --shadow-lg: none;
  --shadow-xl: none;
  --header-bg: rgba(255,255,255,0.9);
  --header-text: #000;
  --header-border: #e0e0e0;
  --link: #000;
  --link-hover: #555;
  --selection: #f0f0f0;
  --gradient-1: #000;
  --gradient-2: #000;
  --gradient-3: #000;
}

/* ============ 字号与字体 ============ */
:root {
  --font-size: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --radius: 12px;
  --radius-sm: 6px;
  --radius-xs: 4px;
}

/* ============ 基础重置 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

::selection { background: var(--selection); }

img { max-width: 100%; height: auto; display: block; }

/* ============ 布局宽度 ============ */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 641px) { .container { padding: 0 24px; } }
@media (min-width: 1025px) { .container { max-width: 1100px; } }
@media (min-width: 1440px) { .container { max-width: 1240px; } }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--header-border);
  transition: background 0.3s, border-color 0.3s;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: 8px;
}
@media (min-width: 641px) { .site-header .container { height: 56px; gap: 16px; } }

.site-logo {
  color: var(--header-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (min-width: 641px) { .site-logo { font-size: 17px; } }

/* ============ 站内搜索 ============ */
.site-search {
  position: relative;
  flex: 1;
  max-width: 280px;
  margin: 0 auto;
}
.site-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 17px;
  background: var(--bg-soft, #f5f0e5);
  color: var(--text, #333);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.site-search input:focus {
  border-color: var(--accent, #8b6914);
  box-shadow: 0 0 0 2px rgba(139,105,20,0.15);
}
.site-search input::placeholder { color: var(--text-muted, #999); }
.site-search-results {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 4px;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text, #333);
  transition: background 0.15s;
}
.search-result-item:hover {
  background: var(--bg-soft, #f5f0e5);
}
.search-result-cat {
  font-size: 11px;
  color: var(--accent, #8b6914);
  font-weight: 500;
}
.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #333);
}
.search-result-desc {
  font-size: 12px;
  color: var(--text-muted, #888);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 13px;
}
@media (max-width: 640px) {
  .site-search {
    max-width: none;
    margin: 0 4px;
  }
  .site-search input { font-size: 14px; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
@media (min-width: 641px) { .site-nav { gap: 16px; } }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}
@media (min-width: 641px) { .site-nav a { font-size: 14px; } }
.site-nav a:hover { color: var(--primary); }

/* ============ 主题切换器 ============ */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
}
@media (min-width: 641px) { .theme-switcher { gap: 4px; padding: 4px; } }

.theme-btn {
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  cursor: pointer; background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  transition: all 0.2s; color: var(--text-muted); padding: 0;
}
@media (min-width: 641px) { .theme-btn { width: 26px; height: 26px; font-size: 13px; } }
.theme-btn:hover { background: var(--bg-card); color: var(--text); }
.theme-btn[data-theme="light"]   { background: #fff; border: 1px solid #e5e7eb; }
.theme-btn[data-theme="dark"]    { background: #0f1115; border: 1px solid #2a2f3a; }
.theme-btn[data-theme="sepia"]   { background: #f4ecd8; border: 1px solid #d9c9a3; }
.theme-btn[data-theme="minimal"] { background: #fff; border: 1px solid #000; }
.theme-btn.active { outline: 2px solid var(--primary); outline-offset: 1px; }

.font-size-control {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 999px; flex-shrink: 0;
}
@media (min-width: 641px) { .font-size-control { padding: 4px; } }
.font-size-btn {
  width: 24px; height: 24px; border: none; border-radius: 50%;
  cursor: pointer; background: transparent; color: var(--text-muted);
  font-size: 10px; font-weight: 600; transition: all 0.2s; padding: 0;
}
@media (min-width: 641px) { .font-size-btn { width: 26px; height: 26px; font-size: 12px; } }
.font-size-btn:hover { background: var(--bg-card); color: var(--text); }

/* ============ Breadcrumb ============ */
.breadcrumb {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: break-word;
}
@media (min-width: 641px) { .breadcrumb { padding: 14px 24px; font-size: 13px; } }
.breadcrumb a { color: var(--text-soft); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 4px; opacity: 0.5; }
@media (min-width: 641px) { .breadcrumb .sep { margin: 0 6px; } }

/* ============ 页面布局（main + aside TOC） ============ */
.page-layout {
  display: block;
  padding: 24px 16px 60px;
}
@media (min-width: 1025px) {
  .page-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 40px;
    padding: 32px 24px 80px;
    align-items: start;
  }
}
@media (min-width: 1440px) {
  .page-layout { grid-template-columns: 1fr 240px; gap: 48px; }
}

.page-main { min-width: 0; }
.page-aside { display: none; }
@media (min-width: 1025px) {
  .page-aside {
    display: block;
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}

/* 无 TOC 时隐藏 aside */
body:not(.has-toc) .page-aside { display: none; }
@media (min-width: 1025px) {
  body:not(.has-toc) .page-layout { display: block; }
}

/* ============ TOC 侧边目录 ============ */
.page-toc {
  font-size: 13px;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.page-toc h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.page-toc ul { list-style: none; margin: 0; }
.page-toc li { margin-bottom: 6px; }
.page-toc li.toc-l3 { margin-left: 14px; font-size: 12px; }
.page-toc a {
  color: var(--text-soft);
  text-decoration: none;
  display: block;
  padding: 3px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  transition: all 0.2s;
}
.page-toc a:hover {
  color: var(--primary);
  border-left-color: var(--primary);
}

/* ============ Main 内容 ============ */
main h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  line-height: 1.3;
}
@media (min-width: 641px) { main h1 { font-size: 1.875rem; margin-bottom: 24px; } }
@media (min-width: 1025px) { main h1 { font-size: 2rem; } }

main h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
  position: relative;
  padding-left: 14px;
}
main h2::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 4px;
  background: var(--gradient-1);
  border-radius: 2px;
}
@media (min-width: 641px) { main h2 { font-size: 1.35rem; margin-top: 36px; } }

main h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 22px;
  margin-bottom: 8px;
}
@media (min-width: 641px) { main h3 { font-size: 1.1rem; margin-top: 24px; } }

main h4 {
  font-size: 1rem; font-weight: 600;
  margin-top: 18px; margin-bottom: 8px;
}

main p { margin-bottom: 14px; color: var(--text); overflow-wrap: break-word; }

main a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
main a:hover { border-bottom-color: var(--link); color: var(--link-hover); }

main ul, main ol { margin: 0 0 14px 20px; }
@media (min-width: 641px) { main ul, main ol { margin-left: 24px; } }
main li { margin-bottom: 6px; }

main blockquote {
  background: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
  font-size: 0.95em;
}
main blockquote p { margin-bottom: 6px; }
main blockquote p:last-child { margin-bottom: 0; }

main code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
}

main pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
main pre code { background: none; padding: 0; color: var(--text); font-size: 0.85em; }

/* 表格 */
main table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.9em;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
}
@media (min-width: 641px) { main table { display: table; font-size: 0.95em; } }
main th, main td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  word-break: break-word;
}
main th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-soft);
}
main tr:nth-child(even) { background: var(--bg-soft); }

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

/* ============ Mermaid ============ */
.mermaid {
  text-align: center;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============ Hero 区（首页） ============ */
.hero {
  background: var(--bg-hero);
  color: #fff;
  padding: 48px 20px;
  margin: -24px -16px 32px;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}
@media (min-width: 641px) {
  .hero { padding: 72px 32px; margin: -32px -24px 40px; border-radius: 0; }
}
@media (min-width: 1025px) {
  .hero { padding: 96px 40px; margin: -32px -24px 48px; }
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; max-width: 680px; }
.hero h1 {
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding-left: 0;
}
.hero h1::before { display: none; }
@media (min-width: 641px) { .hero h1 { font-size: 2.5rem; } }
@media (min-width: 1025px) { .hero h1 { font-size: 3rem; } }
.hero .hero-slogan {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffd966;
  letter-spacing: 0.15em;
  margin: 8px 0 16px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
@media (min-width: 641px) { .hero .hero-slogan { font-size: 1.5rem; } }
.hero .hero-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 24px;
  line-height: 1.6;
}
@media (min-width: 641px) { .hero .hero-subtitle { font-size: 1.125rem; } }
.hero .hero-author {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 16px;
  letter-spacing: 0.1em;
}
.hero .hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.hero .hero-tag {
  padding: 4px 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  font-size: 0.8rem;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.hero .hero-tag:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}
.hero .hero-tag.selected {
  background: rgba(255,215,0,0.3);
  border-color: rgba(255,215,0,0.6);
  color: #ffd700;
  font-weight: 600;
}
@media (min-width: 641px) { .hero .hero-tag { font-size: 0.875rem; } }
.hero .hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
  border-bottom: none;
}
.hero .hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  border-bottom: none;
  color: #1a1a1a;
}
.hero .hero-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  margin-left: 12px;
  transition: all 0.2s;
  border-bottom: none;
}
.hero .hero-cta-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
  border-bottom: none;
  color: #fff;
}

/* ============ 卡片网格 ============ */
.classics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 24px 0;
}
@media (min-width: 641px) { .classics-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }
@media (min-width: 1025px) { .classics-grid { grid-template-columns: 1fr 1fr 1fr; gap: 24px; } }

.classic-card {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.classic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity 0.25s;
}
.classic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
  color: var(--text);
}
.classic-card:hover::before { opacity: 1; }
.classic-card h3 {
  margin-top: 0; margin-bottom: 8px;
  font-size: 1.15rem; font-weight: 700;
}
@media (min-width: 641px) { .classic-card h3 { font-size: 1.25rem; } }
.classic-card p {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.6;
}
@media (min-width: 641px) { .classic-card p { font-size: 0.95rem; } }
.classic-card .badge {
  display: inline-block;
  padding: 3px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
@media (min-width: 641px) { .classic-card .badge { font-size: 0.75rem; } }
.classic-card .card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}

/* ============ 八类入口网格 ============ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
}
@media (min-width: 641px) { .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 1025px) { .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }

.category-card {
  display: block;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: all 0.25s;
  position: relative;
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.category-card .cat-num {
  display: inline-block;
  width: 36px; height: 36px;
  line-height: 36px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.category-card .cat-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.category-card .cat-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============ 精读条目特殊样式 ============ */
main section[id] { scroll-margin-top: 80px; }

/* 条目元信息条 */
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.entry-meta .meta-item {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.entry-meta .meta-item strong {
  color: var(--text-soft);
  font-weight: 600;
}

/* Grill Me 区块（兼容旧条目） */
.grill-me {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 28px 0;
}
@media (min-width: 641px) { .grill-me { padding: 24px; } }
.grill-me > h2 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.grill-me > h2::before { display: none; }
.grill-me > h2 .fire { font-size: 1.3em; }
.grill-q {
  margin: 14px 0;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
  transition: border-color 0.2s;
}
.grill-q:hover { border-left-color: var(--primary); }
.grill-q h3 {
  color: var(--accent);
  margin-top: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
@media (min-width: 641px) { .grill-q h3 { font-size: 1rem; } }

/* ============ 思辩区块（七神兽评审团） ============ */
.debate-panel {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 32px 0;
  position: relative;
}
@media (min-width: 641px) { .debate-panel { padding: 28px; } }

.debate-panel > h2 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 1.25rem;
}
@media (min-width: 641px) { .debate-panel > h2 { font-size: 1.4rem; padding: 16px 20px; } }
.debate-panel > h2::before { display: none; }
.debate-panel > h2 .debate-icon { font-size: 1.3em; }

/* 思辩区块引用提示 */
.debate-panel > blockquote {
  margin-bottom: 20px;
  border-left-color: var(--primary);
  font-size: 0.9rem;
}

/* 各角色发言区块 */
.debate-section {
  margin: 16px 0;
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--text-muted);
  transition: border-color 0.2s, transform 0.2s;
}
.debate-section:hover { transform: translateX(2px); }
.debate-section h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (min-width: 641px) { .debate-section h3 { font-size: 1rem; } }
.debate-section h3::before {
  content: attr(data-beast);
  font-size: 1.2em;
}
.debate-section p { font-size: 0.92rem; margin-bottom: 10px; }
.debate-section p:last-child { margin-bottom: 0; }

/* 七神兽角色配色 */
.beast-baize {
  border-left-color: #6366f1;
  background: linear-gradient(90deg, rgba(99,102,241,0.05), var(--bg-card) 30%);
}
.beast-baize h3 { color: #6366f1; }
.beast-baize h3::before { content: "🔮"; }

.beast-qilin {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,0.05), var(--bg-card) 30%);
}
.beast-qilin h3 { color: #b45309; }
.beast-qilin h3::before { content: "🦌"; }

.beast-xuanwu {
  border-left-color: #0ea5e9;
  background: linear-gradient(90deg, rgba(14,165,233,0.05), var(--bg-card) 30%);
}
.beast-xuanwu h3 { color: #0369a1; }
.beast-xuanwu h3::before { content: "🐢"; }

.beast-chongming {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.05), var(--bg-card) 30%);
}
.beast-chongming h3 { color: #dc2626; }
.beast-chongming h3::before { content: "👁"; }

.beast-qinglong {
  border-left-color: #22c55e;
  background: linear-gradient(90deg, rgba(34,197,94,0.05), var(--bg-card) 30%);
}
.beast-qinglong h3 { color: #16a34a; }
.beast-qinglong h3::before { content: "🐉"; }

.beast-zhulong {
  border-left-color: #a855f7;
  background: linear-gradient(90deg, rgba(168,85,247,0.05), var(--bg-card) 30%);
}
.beast-zhulong h3 { color: #9333ea; }
.beast-zhulong h3::before { content: "🕯"; }

.beast-pixiu {
  border-left-color: #f97316;
  background: linear-gradient(90deg, rgba(249,115,22,0.05), var(--bg-card) 30%);
}
.beast-pixiu h3 { color: #ea580c; }
.beast-pixiu h3::before { content: "🦁"; }

/* 思辩结论/分歧/感性/新主张 样式增强 */
.debate-panel h3:not([class]) {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

/* 关联链接 */
main .关联 + ul,
main ul:has(a[href*="../../"]) {
  list-style: none;
  margin-left: 0;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
main .关联 + ul li,
main ul:has(a[href*="../../"]) li {
  margin-bottom: 10px;
  font-size: 0.9rem;
}
@media (min-width: 641px) {
  main .关联 + ul li, main ul:has(a[href*="../../"]) li { font-size: 0.95rem; }
}
main .关联 + ul li::before,
main ul:has(a[href*="../../"]) li::before {
  content: '→ ';
  color: var(--primary);
  font-weight: 700;
}

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 40px;
}
@media (min-width: 641px) { .site-footer { font-size: 13px; } }

/* ============ 回到顶部 ============ */
.back-to-top {
  position: fixed;
  right: 16px; bottom: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 641px) { .back-to-top { right: 24px; bottom: 24px; } }
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); }

/* ============ 焦点可见 ============ */
a:focus-visible, button:focus-visible,
.theme-btn:focus-visible, .font-size-btn:focus-visible,
.classic-card:focus-visible, .back-to-top:focus-visible,
.category-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============ 阅读进度条 ============ */
.read-progress {
  position: fixed; top: 0; left: 0;
  height: 3px;
  background: var(--gradient-1);
  width: 0; z-index: 200;
  transition: width 0.1s;
}

/* ============ 减少动画 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ 横屏 ============ */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header .container { height: 44px; }
  .hero { padding: 32px 20px; }
}

/* ============ 黄帝知要精要对话浮动提示 ============ */
.debate-float {
  position: fixed;
  top: -400px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  max-height: 70vh;
  z-index: 150;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-xl);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: top 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s;
  opacity: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@media (min-width: 641px) {
  .debate-float { max-width: 520px; font-size: 15px; padding: 16px 22px; }
}
@media (min-width: 1025px) {
  .debate-float { max-width: 560px; }
}
.debate-float.show {
  top: 80px;
  opacity: 0.7;
}
@media (min-width: 1025px) {
  .debate-float.show { top: 90px; }
}
.debate-float.show:hover {
  opacity: 1;
}
.debate-float:hover {
  border-left-color: var(--accent);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

/* 关闭按钮 */
.debate-float-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  color: var(--text-muted, #888);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s;
}
.debate-float-close:hover {
  background: rgba(0,0,0,0.2);
  color: var(--text, #333);
}

/* 对话容器：可滚动 */
.debate-float-dialog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(70vh - 48px);
  overflow-y: auto;
}

/* 单条对话 */
.debate-float-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.debate-float-line.in {
  opacity: 1;
  transform: translateY(0);
}

/* 圣者台词：左边框金色 */
.debate-float-line.speaker-sage,
.debate-float-line.speaker-huangdi {
  border-left: 3px solid #d4a017;
  background: rgba(212, 160, 23, 0.08);
}
/* 学生台词：左边框紫色 */
.debate-float-line.speaker-student,
.debate-float-line.speaker-zhiyao {
  border-left: 3px solid #7c5cbf;
  background: rgba(124, 92, 191, 0.08);
}
/* 神兽收尾台词：左边框青色（白泽等感性洞察） */
.debate-float-line.speaker-beast {
  border-left: 3px solid #2a9d8f;
  background: rgba(42, 157, 143, 0.10);
  font-style: italic;
}

/* 角色标签 */
.debate-float-speaker {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.debate-float-line.speaker-sage .debate-float-speaker,
.debate-float-line.speaker-huangdi .debate-float-speaker { color: #b8860b; }
.debate-float-line.speaker-student .debate-float-speaker,
.debate-float-line.speaker-zhiyao .debate-float-speaker { color: #6a4fa0; }
.debate-float-line.speaker-beast .debate-float-speaker { color: #2a9d8f; }

/* 台词正文 */
.debate-float-line-text {
  flex: 1 1 auto;
  word-break: break-word;
}

/* 收藏按钮 */
.debate-float-bookmark {
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
  color: var(--text-muted, #888);
  transition: background 0.2s, color 0.2s;
}
.debate-float-bookmark:hover {
  background: rgba(0,0,0,0.06);
  color: var(--primary);
}
.debate-float-bookmark.saved {
  color: var(--primary);
}

/* 底部提示 */
.debate-float-hint {
  flex-shrink: 0;
  align-self: flex-end;
  font-size: 12px;
  color: var(--primary);
  white-space: nowrap;
  margin-top: 2px;
}
@media (max-width: 640px) {
  .debate-float-hint { display: none; }
}

.debate-float:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 尊重减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .debate-float { transition: opacity 0.2s; }
  .debate-float-line { transition: opacity 0.2s; transform: none; }
}

/* ============ 账号体系 UI ============ */
.auth-area {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.auth-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
}
.auth-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.auth-btn.logout { border-color: var(--accent); color: var(--accent); }
.user-greeting {
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .auth-btn { padding: 4px 8px; font-size: 12px; }
  .user-greeting { max-width: 60px; }
}

/* ============ Modal 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--bg);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: slideUp 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-box-large { max-width: 640px; }
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-title {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--text);
}
.modal-hint {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: 8px;
}
#authForm input, .modal-box textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
#authForm input:focus, .modal-box textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.modal-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-submit:hover { background: var(--link-hover); }
.modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.modal-switch a { color: var(--primary); text-decoration: none; }
.modal-switch a:hover { text-decoration: underline; }

/* ============ Toast ============ */
.zhiyao-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
.zhiyao-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ 我的空间 ============ */
.myspace-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.myspace-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.myspace-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.myspace-tab:hover { color: var(--primary); }
.myspace-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.myspace-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.myspace-quote {
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  margin: 0 0 8px 0;
  background: var(--quote-bg);
  font-size: 14px;
  color: var(--text-soft);
  border-radius: 0 8px 8px 0;
}
.myspace-reflection {
  font-size: 14px;
  color: var(--text);
  margin: 4px 0 8px 0;
}
.myspace-history-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.5;
}
.myspace-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.myspace-link {
  color: var(--primary);
  text-decoration: none;
}
.myspace-link:hover { text-decoration: underline; }
.del-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.del-btn:hover { background: var(--accent-soft); }
.loading, .empty-state, .error-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.error-state { color: var(--accent); }

/* ============ 思辩堂聊天室 ============ */
.chat-room { display: flex; flex-direction: column; }
.chat-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.chat-messages {
  flex: 1 1 auto;
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 12px;
}
.chat-msg {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: 10px;
  border-left: 3px solid var(--border);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.chat-msg.liked {
  border-left-color: var(--accent);
  box-shadow: 0 0 8px rgba(249,115,22,0.15);
}
.chat-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.chat-msg-author {
  font-weight: 600;
  font-size: 13px;
}
.chat-msg-author.role-huangdi,
.chat-msg-author.role-sage { color: #b8860b; }
.chat-msg-author.role-zhiyao,
.chat-msg-author.role-student { color: #6a4fa0; }
.chat-msg-author.role-user { color: var(--text); }
.chat-msg-time {
  font-size: 11px;
  color: var(--text-muted);
}
.chat-quote {
  border-left: 2px solid var(--primary);
  padding: 4px 8px;
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--primary-soft);
  border-radius: 0 6px 6px 0;
}
.chat-msg-content {
  font-size: 14px;
  line-height: 1.6;
  margin: 4px 0;
  word-break: break-word;
}
.chat-msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.chat-like-btn, .chat-reflect-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.chat-like-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-reflect-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-source-link {
  margin-left: auto;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 16px;
  border: 1px solid var(--primary);
  transition: all 0.2s;
}
.chat-source-link:hover {
  background: var(--primary);
  color: #fff;
}
.chat-input-area {
  display: flex;
  gap: 8px;
}
#chatInput {
  flex: 1 1 auto;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
#chatInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.chat-send {
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send:hover { background: var(--link-hover); }

/* ============ 感悟弹窗 ============ */
.reflection-quote {
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--quote-bg);
  font-size: 14px;
  color: var(--text-soft);
  border-radius: 0 8px 8px 0;
}
#reflectionContent {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* ============ 思辩堂页面级 ============ */
.chat-room-page {
  max-width: 720px;
  margin: 0 auto;
}
.chat-room-page .chat-messages {
  max-height: 60vh;
  min-height: 300px;
}
.chat-guest-hint {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 15px;
}
.chat-guest-hint a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.chat-guest-hint a:hover { text-decoration: underline; }

/* 神兽角色样式 */
.chat-msg-author.role-beast { color: #2a7a2a; }

/* ============ 感悟室 ============ */
.rooms-section {
  margin-top: 32px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.rooms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.rooms-header h3 {
  font-size: 18px;
  margin: 0;
}
.room-create-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.room-create-btn:hover { background: var(--link-hover); }
.rooms-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 641px) {
  .rooms-list { grid-template-columns: 1fr 1fr; }
}
.room-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.room-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.room-name {
  font-size: 16px;
  margin: 0 0 4px 0;
}
.room-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}
.room-beasts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.room-beast {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.room-beast.host {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.room-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.room-join-btn {
  margin-left: auto;
  padding: 4px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.room-join-btn:hover { background: var(--link-hover); }

/* 我的感悟室 */
.my-room-section {
  margin-top: 32px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding: 16px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: var(--primary-soft);
}
.my-room-section h3 {
  font-size: 18px;
  margin: 0 0 12px 0;
}
.my-room-section .chat-messages {
  max-height: 40vh;
  min-height: 200px;
}
.room-leave-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.room-leave-btn:hover { background: var(--accent-soft); }

/* 神兽选择网格 */
.beast-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .beast-select-grid { grid-template-columns: 1fr; }
}
.beast-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.beast-checkbox:hover { border-color: var(--primary); }
.beast-checkbox input { margin: 0; }
.beast-checkbox span { font-size: 14px; }
.form-label {
  font-size: 14px;
  color: var(--text-soft);
  margin: 12px 0 8px 0;
}

/* ============ 神兽语录推送 ============ */
.beast-quote-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 360px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 350;
  opacity: 0;
  transform: translateX(400px);
  transition: opacity 0.4s, transform 0.4s cubic-bezier(0.22,1,0.36,1);
}
.beast-quote-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.beast-quote-close {
  position: absolute;
  top: 8px; right: 12px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.beast-quote-close:hover { background: var(--bg-soft); color: var(--text); }
.beast-quote-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.beast-quote-icon { font-size: 20px; }
.beast-quote-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.beast-quote-role {
  font-size: 12px;
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-soft);
}
.beast-quote-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0 0 8px 0;
  cursor: pointer;
  transition: color 0.2s;
}
.beast-quote-text:hover { color: var(--primary); }
.beast-quote-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.beast-quote-link:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .beast-quote-toast {
    left: 16px; right: 16px;
    bottom: 16px;
    max-width: none;
  }
}

/* ============ 打印 ============ */
@media print {
  .site-header, .site-footer, .breadcrumb, .back-to-top,
  .read-progress, .theme-switcher, .font-size-control, .site-nav,
  .site-search,
  .page-aside, .hero, .debate-float, .auth-area, .modal-overlay,
  .zhiyao-toast, .beast-quote-toast, .ask-beast { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .page-layout { display: block !important; }
  main { padding: 0 !important; }
  main h1, main h2, main h3 { color: #000 !important; }
  main a { color: #000 !important; text-decoration: underline; }
  main blockquote { border-left-color: #000 !important; background: none !important; }
  .grill-me, .grill-q, .debate-panel, .debate-section { background: none !important; border-color: #000 !important; }
}


/* ============ 问神兽 ============ */
.ask-beast {
  margin: 24px 0;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-card, #f8f6f1);
  border: 1px solid var(--border, #e0d8cc);
}
.ask-beast-title {
  font-size: 18px;
  margin: 0 0 4px;
}
.ask-beast-hint {
  font-size: 13px;
  color: var(--text-muted, #888);
  margin: 0 0 16px;
}
.ask-beast-beasts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.ask-beast-beast-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  min-width: 60px;
  min-height: 60px;
  border: 2px solid var(--border, #e0d8cc);
  border-radius: 10px;
  background: var(--bg-input, #fff);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: 12px;
}
.ask-beast-beast-btn:hover {
  border-color: var(--accent, #8b6914);
}
.ask-beast-beast-btn.selected {
  border-color: var(--accent, #8b6914);
  background: var(--bg-accent-soft, #f0ebe0);
}
.ask-beast-beast-icon {
  font-size: 20px;
}
.ask-beast-beast-name {
  font-size: 11px;
  color: var(--text, #333);
}
.ask-beast-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ask-beast-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 8px;
  background: var(--bg-input, #fff);
  color: var(--text, #333);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 44px;
}
.ask-beast-input:focus {
  outline: 2px solid var(--accent, #8b6914);
  outline-offset: -1px;
}
.ask-beast-send {
  padding: 10px 20px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--accent, #8b6914);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.ask-beast-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ask-beast-send:not(:disabled):hover {
  opacity: 0.85;
}
.ask-beast-answer {
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-accent-soft, #f0ebe0);
  border-left: 3px solid var(--accent, #8b6914);
}
.ask-beast-answer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ask-beast-answer-icon {
  font-size: 20px;
}
.ask-beast-answer-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text, #333);
}
.ask-beast-answer-role {
  font-size: 12px;
  color: var(--text-muted, #888);
}
.ask-beast-answer-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text, #333);
  white-space: pre-wrap;
}
.ask-beast-loading {
  text-align: center;
  padding: 12px;
  color: var(--text-muted, #888);
  font-size: 14px;
}
.ask-beast-error {
  color: #c33;
  font-size: 14px;
  margin: 0;
}
@media (min-width: 641px) {
  .ask-beast-beast-btn { min-width: 70px; }
}

/* ============ 思辩 banner ============ */
.debate-banner {
  margin: 16px 0 24px;
  padding: 0;
  border: none;
  background: none;
}
.debate-banner-text {
  font-size: 15px;
  color: var(--text-muted, #888);
  margin: 0 0 12px;
  padding: 0;
  line-height: 1.6;
}
.debate-banner-text a {
  color: var(--accent, #8b6914);
}
.debate-banner::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--primary, #2c5f7c), var(--accent, #8b6914), var(--primary, #2c5f7c));
  border-radius: 2px;
  margin-bottom: 12px;
}

/* ============ 思辩过程内联问神兽按钮 ============ */
.ask-beast-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  padding: 2px 10px;
  min-height: 28px;
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 14px;
  background: var(--bg-input, #fff);
  color: var(--accent, #8b6914);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  transition: background 0.2s, border-color 0.2s;
}
.ask-beast-inline:hover {
  background: var(--bg-accent-soft, #f0ebe0);
  border-color: var(--accent, #8b6914);
}
.ask-beast-inline:focus-visible {
  outline: 2px solid var(--accent, #8b6914);
  outline-offset: 1px;
}
@media (max-width: 640px) {
  .ask-beast-inline {
    display: flex;
    margin: 8px 0 0;
    width: fit-content;
    min-height: 32px;
    padding: 4px 14px;
    font-size: 13px;
  }
}

/* ============ 首页：七神兽卡片 ============ */
.beasts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
}
@media (min-width: 641px) { .beasts-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 1025px) { .beasts-grid { grid-template-columns: repeat(7, 1fr); gap: 12px; } }
.beast-card {
  padding: 16px 12px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.beast-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.1));
}
.beast-card-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}
.beast-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #333);
}
.beast-card-role {
  font-size: 0.75rem;
  color: var(--primary, #8b6914);
  margin: 2px 0 6px;
}
.beast-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted, #888);
  line-height: 1.4;
}

/* ============ 首页：知识库结构 ============ */
.kb-structure {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 24px 0;
}
@media (min-width: 641px) { .kb-structure { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1025px) { .kb-structure { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.kb-card {
  display: block;
  padding: 20px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text, #333);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.kb-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.1));
  border-color: var(--primary, #8b6914);
  color: var(--text, #333);
}
.kb-card-icon {
  font-size: 24px;
  margin-bottom: 8px;
}
.kb-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.kb-card-desc {
  font-size: 0.82rem;
  color: var(--text-soft, #666);
  line-height: 1.5;
  margin-bottom: 10px;
}
.kb-card-count {
  font-size: 0.75rem;
  color: var(--primary, #8b6914);
  font-weight: 600;
}

/* ============ 首页布局 ============ */
.home-layout .hero {
  margin: -32px -24px 32px;
}
@media (min-width: 1025px) {
  .home-layout .hero {
    margin: -32px -24px 48px;
  }
}


/* ============ 注解日常示例 (details 展开) ============ */
.annotation-example {
  margin: 4px 0 8px 20px;
  border: none;
  border-left: 2px solid var(--border, #e0d8cc);
  border-radius: 0;
  padding: 0;
  font-size: 13px;
  transition: border-color 0.2s;
}
.annotation-example[open] {
  border-left-color: var(--accent, #8b6914);
}
.annotation-example summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 8px;
  color: var(--text-muted, #888);
  font-size: 12px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.annotation-example summary::-webkit-details-marker {
  display: none;
}
.annotation-example summary::before {
  content: '▸';
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
}
.annotation-example[open] summary::before {
  transform: rotate(90deg);
}
.annotation-example summary:hover {
  background: var(--bg-accent-soft, #f0ebe0);
  color: var(--accent, #8b6914);
}
.annotation-example .example-content {
  padding: 6px 10px;
  margin: 4px 0 0;
  color: var(--text, #333);
  line-height: 1.7;
  font-size: 13px;
  background: var(--bg-accent-soft, #f5f0e5);
  border-radius: 0 6px 6px 0;
}
.annotation-example .example-content em {
  color: var(--accent, #8b6914);
  font-style: normal;
  font-weight: 500;
}
@media (max-width: 640px) {
  .annotation-example {
    margin-left: 12px;
  }
  .annotation-example .example-content {
    font-size: 14px;
  }
}

/* ============ 经典目录·体系层级 ============ */
.classics-system {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 24px 0;
}
.system-layer {
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 12px;
  padding: 20px;
  background: var(--bg-soft, #faf8f5);
  position: relative;
  overflow: hidden;
}
.system-layer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary, #b8860b), transparent);
}
.layer-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.layer-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary, #b8860b);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.layer-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #333);
}
.layer-desc {
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  padding: 2px 10px;
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 999px;
}
.layer-classics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 641px) {
  .layer-classics { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.layer-classic {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 8px;
  background: var(--bg, #fff);
  text-decoration: none;
  transition: all 0.2s;
}
.layer-classic:hover {
  border-color: var(--primary, #b8860b);
  box-shadow: 0 2px 8px rgba(184,134,11,0.15);
  transform: translateY(-1px);
}
.layer-classic h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--primary, #b8860b);
}
.layer-classic p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  line-height: 1.5;
}
.layer-meta {
  font-size: 0.78rem;
  color: var(--text-muted, #999);
}
.layer-classic .badge {
  align-self: flex-start;
  margin-bottom: 4px;
}

/* ============ 思辩堂·六进庭院 ============ */
.courtyard-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}
.courtyard {
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 12px;
  padding: 20px;
  background: var(--bg-soft, #faf8f5);
  position: relative;
  overflow: hidden;
}
.courtyard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary, #b8860b), transparent);
}
.courtyard-1::before { background: linear-gradient(90deg, #4a90d9, transparent); }
.courtyard-2::before { background: linear-gradient(90deg, #7a9b5e, transparent); }
.courtyard-3::before { background: linear-gradient(90deg, #c97b4a, transparent); }
.courtyard-4::before { background: linear-gradient(90deg, #8b5cf6, transparent); }
.courtyard-5::before { background: linear-gradient(90deg, #d97b9b, transparent); }
.courtyard-6::before { background: linear-gradient(90deg, #c9a04a, transparent); }
.courtyard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.courtyard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary, #b8860b);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.courtyard-1 .courtyard-num { background: #4a90d9; }
.courtyard-2 .courtyard-num { background: #7a9b5e; }
.courtyard-3 .courtyard-num { background: #c97b4a; }
.courtyard-4 .courtyard-num { background: #8b5cf6; }
.courtyard-5 .courtyard-num { background: #d97b9b; }
.courtyard-6 .courtyard-num { background: #c9a04a; }
.courtyard-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #333);
}
.courtyard-sub {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  padding: 2px 10px;
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 999px;
}
.courtyard-desc {
  font-size: 0.9rem;
  color: var(--text-muted, #666);
  margin: 0 0 16px 0;
  line-height: 1.6;
}
.sub-courtyards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 641px) {
  .sub-courtyards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
.sub-courtyard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border, #e0d5c5);
  border-radius: 8px;
  background: var(--bg, #fff);
  text-decoration: none;
  transition: all 0.2s;
  min-height: 44px;
}
.sub-courtyard:hover {
  border-color: var(--primary, #b8860b);
  box-shadow: 0 2px 8px rgba(184,134,11,0.15);
  transform: translateY(-1px);
}
.sub-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary, #b8860b);
}
.sub-classic {
  font-size: 0.85rem;
  color: var(--text, #333);
  font-weight: 600;
}
.sub-desc {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
}

/* ============ 页脚版权 ============ */
.site-footer-slogan {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary, #b8860b);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.site-footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted, #888);
  margin-top: 4px;
}


/* ============ 黄帝知要对话 loading ============ */
.debate-float-loading {
  opacity: 0.7;
}
.debate-float-loading .debate-float-line-text {
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .debate-float-loading .debate-float-line-text { animation: none; }
}
