
/* ==========================================================================
   DESIGN SYSTEM TOKENS (DESIGN.md - Classical Academic Red & Warm Paper)
   ========================================================================== */
:root {
  /* 品牌色系：中国红体系 (DESIGN.md) */
  --color-primary: #C21F30;         /* 朱砂红 */
  --color-primary-dark: #851722;    /* 绛红 / 印泥深红 */
  --color-primary-deep: #5A0E16;    /* 极深红底 */
  --color-primary-light: #FBF0F1;   /* 柔浅粉红底 (对齐 DESIGN.md #FBF0F1) */
  --color-primary-border: #F1D4D7;  /* 浅红边框 */
  
  /* 辅助色系：宣香赤金 */
  --color-gold: #C59B27;            /* 典雅赤金 */
  --color-gold-dark: #85620D;       /* 浓金。审计：压暗以在 gold-soft 上达 WCAG AA 4.5:1 */
  --color-gold-soft: #F9F5EA;       /* 浅金柔底 (DESIGN.md #F9F5EA) */
  --color-gold-light: #F9F5EA;      /* 兼容别名 */
  --color-gold-border: #E8D8AF;     /* 金色细线 (DESIGN.md #E8D8AF) */
  
  /* 纸张与背景 (Warm Paper Palette) */
  --color-bg: #FAF8F5;              /* 宣纸暖白 */
  --color-surface: #FFFFFF;         /* 纯白卡片 */
  --color-surface-subtle: #F4EFE6;  /* 次级底色 (DESIGN.md #F4EFE6) */
  
  /* 墨色文字梯阶 (Chinese Ink Hierarchy) */
  --color-text-primary: #1C1917;    /* 焦墨正文 (WCAG 14:1) */
  --color-text-secondary: #57534E;  /* 浓墨次要 (WCAG 5.5:1) */
  --color-text-muted: #6F6A62;      /* 淡墨注释。审计：原 #8A847C 在 11–13px 下仅 3.46–3.70:1，压暗后达 WCAG AA */
  --color-border: #E7E2D8;          /* 宣纸分割线 (DESIGN.md #E7E2D8) */
  --color-border-subtle: #F0ECE4;   /* 弱分割线 */

  /* 功能语义色 (DESIGN.md) */
  --color-success: #15803D;
  --color-warning: #B45309;
  --color-error: #DC2626;
  --color-info: #1D4ED8;
  
  /* 字体系统 */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --font-sans: "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  
  /* 阴影等级 (Elevation) */
  --shadow-sm: 0 1px 3px rgba(28,25,23,0.04), 0 1px 2px rgba(28,25,23,0.02);
  --shadow-md: 0 4px 14px rgba(28,25,23,0.06), 0 1px 4px rgba(28,25,23,0.03);
  --shadow-lg: 0 14px 32px rgba(133,23,34,0.09), 0 4px 14px rgba(28,25,23,0.04);
  --shadow-float: 0 16px 40px rgba(133,23,34,0.2), 0 6px 16px rgba(28,25,23,0.08);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  /* 布局容器 */
  --container-width: 1140px;

  /* 兼容历史数据与内联样式别名 */
  --red: var(--color-primary-dark);
  --red-soft: var(--color-primary-light);
  --line: var(--color-border);
  --ink: var(--color-text-primary);
  --ink-2: var(--color-text-secondary);
  --ink-3: var(--color-text-muted);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.8;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

::selection {
  background: var(--color-primary);
  color: #FFFFFF;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 500;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 15px;
}

/* ==========================================================================
   TOPBAR - FROSTED GLASS & GOLD SUBTLE ACCENT
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(44, 20, 20, 0.03);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(197, 155, 39, 0.35) 50%, transparent 100%);
  pointer-events: none;
}

.topbar-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  flex: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #FFFFFF;
  padding: 2px;
  border: 1.5px solid var(--color-gold);
  box-shadow: 0 2px 10px rgba(133,23,34,0.12);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.brand:hover .brand-mark {
  transform: scale(1.06) rotate(3deg);
  box-shadow: 0 4px 14px rgba(133,23,34,0.22);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  color: var(--color-primary-dark);
  letter-spacing: 0.03em;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title-badge {
  font-size: 11px;
  font-family: var(--font-sans);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-primary-border);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

.searchbox {
  flex: 1;
  /* 实测 380px 下输入区只剩 268px，而 placeholder 文本要 316px，被截成
     「…样板支」。顶栏此时还有 150px 富余，故放宽到 430px（max-width 只是上限，
     flex:1 在窄屏仍会收缩）。 */
  max-width: 430px;
  position: relative;
}

.searchbox input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  padding: 0 74px 0 38px;
  font-size: 13.5px;
  color: var(--color-text-primary);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
  transition: color 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease, opacity 0.22s ease;
}

.searchbox input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.18), 0 3px 12px rgba(133, 23, 34, 0.06);
  background: #FFFFFF;
}

.searchbox .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  pointer-events: none;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  background: rgba(244, 239, 230, 0.85);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 4px;
  flex: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.mode-tabs button {
  min-height: 44px;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  color: var(--color-text-secondary);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  transition: color 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-tabs button.active {
  background: linear-gradient(135deg, #C21F30 0%, #991624 100%);
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(194, 31, 48, 0.32), inset 0 1px 0 rgba(255,255,255,0.22);
  font-weight: 600;
}

.mode-tabs button:not(.active):hover {
  color: var(--color-primary-dark);
  background: rgba(255,255,255,0.7);
}

/* 管理后台入口样式见 PATCH v33（.btn-nav-admin）：描边药丸 + 齿轮 + 文字。
   2026-09-16 的 PATCH v24 曾把它收敛成无文字小齿轮，现已恢复。 */

/* ==========================================================================
   HERO BANNER - IMPERIAL RED, GOLD EMBROIDERY & GLASS STATS
   ========================================================================== */
.hero {
  background: radial-gradient(circle at 75% 15%, #8B1622 0%, #630D16 45%, #3E060A 100%);
  color: #F8F1E8;
  padding: 68px 24px 60px;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid rgba(197, 155, 39, 0.4);
}

.hero::before {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：background-image */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #FFE6A8, transparent);
  opacity: 0.8;
}

.hero-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-crest-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.hero-crest {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #FFFFFF;
  padding: 4px;
  border: 2.5px solid var(--color-gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(197, 155, 39, 0.25);
  flex: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-crest:hover {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：transform */
}

.hero-kicker-badge {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：background, border, border-radius, box-shadow, color, font-size 等 9 项 */
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero h1 {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：text-shadow */
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(32px, 4.8vw, 48px);
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: #FFFFFF;
  margin-bottom: 16px;
}

.hero p {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：color, font-weight, max-width */
  font-size: 16px;
  line-height: 1.85;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #C59B27 0%, #A47D15 100%);
  color: #1A0507 !important;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 16px rgba(197, 155, 39, 0.4), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: color 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 44px;
  cursor: pointer;
}

.btn-hero-primary:hover {
  background: linear-gradient(135deg, #E5BD45 0%, #C59B27 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(197, 155, 39, 0.5);
  color: #1A0507 !important;
}

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF !important;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.32);
  transition: color 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 44px;
  cursor: pointer;
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 230, 168, 0.65);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
















/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 52px 0 26px;
}

.section-title:first-child {
  margin-top: 0;
}

.section-title .badge-no {
  font-family: var(--font-serif);
  color: var(--color-primary);
  font-weight: 900;
  font-size: 20px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.section-title h2 {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 700;
  color: var(--color-primary-dark);
  letter-spacing: 0.02em;
}

.section-title .title-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border), transparent);
}

.section-title .title-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* 红头文号专属铭牌徽章 */
.doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--color-primary-light) 100%);
  border: 1px solid var(--color-primary-border);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(133,23,34,0.06);
  letter-spacing: 0.02em;
  line-height: 1.4;
  vertical-align: middle;
}
.doc-badge::before {
  content: "★";
  color: var(--color-primary);
  font-size: 11px;
}

/* ==========================================================================
   7 大板块网格与精修卡片
   ========================================================================== */
.sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 24px;
}

/* PATCH v18：7 张卡在多列网格下必然剩 1 张孤悬左下，让末张跨满整行补位。
   实测容器 992px 起为 2 列、1052px 起为 3 列（v17_capture 同源探针），
   故阈值取 1040px —— 一进入多列布局就生效；窄屏单列时本规则不参与。
   末张改横向排布：顶部徽章条 → 左标题 / 右描述 → 底部操作条。 */
@media (min-width: 1040px) {
  .sec-grid > .sec-card:last-child {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    /* PATCH v31：原先 align-items:center 会把单行标题按两行描述的高度居中，
       标题基线比描述首行低约 12px，读起来是"错位"而不是对齐。
       改 baseline —— 标题与描述首行共基线，才是横排标题/描述该有的样子。 */
    align-items: baseline;
    /* 列间距 44 收到 30：标题与描述之间原有一段没有内容的空档 */
    gap: 16px 30px;
    padding: 22px 26px 18px;
  }
  .sec-grid > .sec-card:last-child .sec-header {
    flex: 0 0 100%;
    /* 跨满整行后，space-between 会把徽章与细则数甩到两端、中间空出一米。
       宽卡里应改回「紧挨着靠左」。 */
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 0;
  }
  .sec-grid > .sec-card:last-child h3 {
    /* PATCH v31：原为 flex:1 1 250px —— 它会吃掉剩余空间，把标题框撑得比文字宽出
       上百像素，视觉上就是"标题和描述之间空了一大段"。改为贴合内容、只允许收缩。 */
    flex: 0 1 auto;
    margin-bottom: 0;
  }
  .sec-grid > .sec-card:last-child p {
    /* 标题不再抢空间后，描述拿满剩余宽度 */
    flex: 1 1 320px;
    margin-bottom: 0;
  }
  .sec-grid > .sec-card:last-child .sec-footer {
    flex: 0 0 100%;
    justify-content: flex-end;
    gap: 18px;
  }
}

.sec-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 26px 24px 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: color 0.24s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.24s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* 卡片顶部赤金渐变流光顶线 */
.sec-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-gold) 65%, var(--color-primary-dark) 100%);
  opacity: 0.9;
  transition: height 0.2s ease;
}

.sec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(194, 31, 48, 0.3);
}

.sec-card:hover::before {
  height: 5px;
}

.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sec-no-tag {
  font-family: var(--font-serif);
  font-size: 11.5px;
  color: #FFFFFF;
  background: linear-gradient(135deg, #C21F30 0%, #991624 100%);
  border: 1px solid rgba(197, 155, 39, 0.4);
  padding: 2.5px 9px;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(133,23,34,0.18);
  letter-spacing: 0.04em;
}

.sec-count {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
}

.sec-card h3 {
  font-family: var(--font-serif);
  font-size: 18.5px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.45;
  margin-bottom: 10px;
  transition: color 0.18s ease;
}

.sec-card:hover h3 {
  color: var(--color-primary-dark);
}

.sec-card p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.75;
  flex: 1;
  margin-bottom: 20px;
}

.sec-footer {
  display: flex;
  align-items: center;
  /* PATCH v31：footer 现在只剩一个胶囊按钮（原「阅读条目全文」是重复文案，已删） */
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px dashed var(--color-border);
  font-size: 13px;
}

.sec-footer .read-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.sec-card:hover .sec-footer .read-arrow {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(194,31,48,0.25);
}

/* ==========================================================================
   大事记时间轴
   ========================================================================== */
.timeline {
  position: relative;
  padding-left: 32px;
  margin: 24px 0;
}

.timeline::before {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：background */
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
}

.tl-item {
  position: relative;
  margin-bottom: 13px;
  /* transform 通道归入场动画独占（[data-rv] → .rv-in），故此处不再声明外观 */
  transition: transform 0.62s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

/* PATCH v17 — 卡片外观与「放大凸出」都归这一层。
   --tl-pop 由 .tl-item.tl-now 下发（默认 1 = 不放大）。

   PATCH v31 — 改两行栅格：
     原先年份 / 标题 / 说明竖排三行，卡片被撑到约 130px 高，而文字只占卡片宽度
     的三分之一，整条时间轴 1498px 几乎全是空白。
     现在第一行「年份徽标 + 标题」，第二行「说明」（与标题左对齐，形成悬挂缩进），
     内边距 18/22 收到 13/18，条目间距 22 收到 13。卡片高度约 75px。 */
.tl-inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
  row-gap: 3px;
  padding: 13px 18px;
  box-shadow: var(--shadow-sm);
  transform: scale(var(--tl-pop, 1));
  /* 放大原点由 JS 下发（按左右可用空间偏置）；默认居中 */
  transform-origin: var(--tl-origin, 50% 50%);
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tl-item:hover {
  transform: translateX(4px);
}

.tl-item:hover .tl-inner {
  border-color: rgba(194, 31, 48, 0.3);
  box-shadow: var(--shadow-md);
}

.tl-item::before {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：background, box-shadow */
  content: "";
  position: absolute;
  left: -30px;
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3.5px solid var(--color-primary);
}

.tl-year {
  grid-column: 1;
  grid-row: 1;
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 13px;
  color: var(--color-primary-dark);
  background: var(--color-gold-soft);
  border: 1px solid var(--color-gold-border);
  border-radius: 4px;
  padding: 2px 9px;
  margin-bottom: 8px;
}

.tl-title {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text-primary);
  line-height: 1.45;
}

.tl-desc {
  grid-column: 2;
  grid-row: 2;
  font-size: 14px;
  color: var(--color-text-secondary);
  /* 行间距交给栅格的 row-gap 统一控制，不再各自加 margin-top */
  margin-top: 0;
  line-height: 1.7;
}

/* 权威来源列表 */
.src-list {
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 26px;
  box-shadow: var(--shadow-sm);
}

.src-list li {
  padding: 7px 0 7px 22px;
  position: relative;
  border-bottom: 1px dashed var(--color-border-subtle);
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.8;
}

.src-list li:last-child {
  border-bottom: none;
}

.src-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--color-gold);
  font-size: 12px;
}

.src-list a {
  color: var(--color-primary-dark);
  font-weight: 500;
}

.src-list a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ==========================================================================
   DETAIL VIEW - ACADEMIC MONOGRAPH PRESENTATION
   ========================================================================== */
.detail {
  display: none;
}
.detail.active {
  display: block;
}

.crumb-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  padding: 8px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  min-height: 42px;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.crumb-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateX(-3px);
}

.detail-hero {
  border-left: 6px solid var(--color-primary);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF7F2 100%);
  border-top: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  border-bottom: 2px solid var(--color-gold-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 30px 32px 26px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.detail-hero .no {
  font-family: var(--font-serif);
  color: var(--color-primary);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.8vw, 34px);
  font-weight: 900;
  color: var(--color-primary-dark);
  margin-top: 8px;
  line-height: 1.35;
}

.detail-hero p {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin-top: 10px;
  max-width: 820px;
  line-height: 1.8;
}

.entry {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: color 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease, opacity 0.22s ease;
}

.entry:hover {
  border-color: rgba(194, 31, 48, 0.4);
  box-shadow: var(--shadow-md);
}

.entry h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  line-height: 1.4;
}

.entry h3 .e-no {
  color: #FFFFFF;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 14px;
  background: linear-gradient(135deg, #851722, #C21F30);
  padding: 2px 10px;
  border-radius: 4px;
  flex: none;
  box-shadow: 0 1px 3px rgba(133,23,34,0.25);
}

.entry .body {
  font-size: 15px;
  color: var(--color-text-primary);
  line-height: 1.88;
}

.entry .body p {
  margin: 10px 0;
}

.entry .body ul, .entry .body ol {
  margin: 10px 0 10px 24px;
}

.entry .body li {
  margin: 6px 0;
}

.entry .body b {
  color: var(--color-primary-dark);
  font-weight: 600;
}

.entry .src {
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  /* PATCH v35：原为 space-between —— 它把「来源：」标签甩到最左、链接甩到最右，
     而整行有 1030px 宽、内容只占约 350px，中间留下约 680px 的空档，
     读起来像布局坏了。来源标注是「标签 + 值」的连续语义，改为左对齐流式排列。 */
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.entry .src a {
  color: var(--color-primary-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.entry .src a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ==========================================================================
   SEARCH RESULTS
   ========================================================================== */
.search-result {
  padding: 10px 0 30px;
}

.search-result .count {
  font-size: 14.5px;
  color: var(--color-text-secondary);
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.search-result .count b {
  color: var(--color-primary);
  font-size: 17px;
}

.sr-group {
  margin-bottom: 30px;
}

.sr-group h4 {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sr-group h4::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.sr-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.sr-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
}

.sr-item .t {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--color-text-primary);
  margin-bottom: 5px;
}

.sr-item .s {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.sr-item mark {
  background: #FFF0C2;
  color: var(--color-primary-dark);
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 600;
}

.sr-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* ==========================================================================
   AI CHAT WORKSPACE - INTELLECTUAL THINK TANK DESIGN (Bento & Modern AI Studio)
   ========================================================================== */
#view-chat {
  display: none;
  height: calc(100vh - 69px);
  background: var(--color-bg);
}

#view-chat.active {
  display: flex;
}

.chat-layout {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  padding: 16px 20px;
  gap: 16px;
  box-sizing: border-box;
}

/* 知识库板块索引侧边栏 */
.chat-side {
  width: 280px;
  flex: none;
  /* PATCH v32：侧栏原先被 align-items:stretch 拉到与对话面板等高（899px），
     但 7 项索引 + 检索范围只有约 650px 内容，中间留下 347px 纯白空档。
     内容量填不满就别硬撑 —— align-self:flex-start 让它按内容收缩。
     窄屏（≤900px）该侧栏是 display:none，所以不会影响堆叠布局。 */
  align-self: flex-start;
  max-height: 100%;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(28,25,23,0.03);
}

.chat-side-head {
  padding: 14px 16px;
  background: #FAF7F2;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-side-head h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-side-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gold-dark);
  background: var(--color-gold-soft);
  border: 1px solid var(--color-gold-border);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.chat-side-list {
  /* 不再 flex:1 —— 撑高只会制造空档；改为按内容高度，超出才滚动 */
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 8px;
}

.chat-side-item {
  /* PATCH v32：10px 偏紧，13px 让每项有 48px 左右的点击高度，接近触控目标建议值 */
  padding: 13px 12px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  transition: color 0.2s cubic-bezier(0.19, 1, 0.22, 1), background-color 0.2s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.2s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.2s cubic-bezier(0.19, 1, 0.22, 1), transform 0.2s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.2s cubic-bezier(0.19, 1, 0.22, 1);
}

.chat-side-item .cs-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--color-surface-subtle);
  color: var(--color-primary-dark);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-serif);
  flex-shrink: 0;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.chat-side-item .cs-info {
  flex: 1;
  min-width: 0;
}

.chat-side-item .cs-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.chat-side-item .cs-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.chat-side-item .cs-arrow {
  color: var(--color-text-muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  font-size: 13px;
}

.chat-side-item:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary-border);
  transform: translateX(3px);
}

.chat-side-item:hover .cs-num {
  background: var(--color-primary);
  color: #FFFFFF;
}

.chat-side-item:hover .cs-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--color-primary);
}

/* 主交互区 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 4px 20px rgba(28,25,23,0.03);
  position: relative;
}

/* 顶栏控制条 */
.chat-main-header {
  padding: 12px 18px;
  background: #FAF7F2;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cmh-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmh-emblem {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：box-shadow, height, width */
  border-radius: 8px;
  background: linear-gradient(135deg, #851722 0%, #C21F30 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 16px;
}

.cmh-info {
  display: flex;
  flex-direction: column;
}

.cmh-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmh-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.cmh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--color-success);
  background: rgba(21, 128, 61, 0.08);
  border: 1px solid rgba(21, 128, 61, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.cmh-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 5px rgba(21, 128, 61, 0.6);
}

.cmh-sub {
  font-size: 11.5px;
  color: var(--color-text-muted);
}

.cmh-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmh-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--color-text-secondary);
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  min-height: 32px;
}

.cmh-action-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary-border);
}

/* 欢迎展台与 2x2 Bento 推荐卡 */
.chat-welcome-stage {
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeInStage 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInStage {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.cws-hero {
  max-width: 660px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cws-icon-wrap {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：height, margin-bottom, width */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cws-glow-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(194, 31, 48, 0.25) 0%, rgba(197, 155, 39, 0) 70%);
  animation: ringPulse 3s ease-in-out infinite alternate;
}

@keyframes ringPulse {
  0% { transform: scale(0.95); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.cws-emblem-badge {
  /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：border, box-shadow, font-size, height, width */
  position: relative;
  border-radius: 12px;
  background: linear-gradient(135deg, #851722 0%, #B81D2D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cws-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.cws-chip-gold {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gold-dark);
  background: var(--color-gold-soft);
  border: 1px solid var(--color-gold-border);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.cws-chip-red {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.cws-chip-green {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-success);
  background: rgba(21, 128, 61, 0.08);
  border: 1px solid rgba(21, 128, 61, 0.2);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.cws-dot-live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(21, 128, 61, 0.8);
}

.cws-title {
  font-family: var(--font-serif);
  font-size: 18.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.cws-desc {
  font-size: 12.8px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* 2x2 Bento Cards Grid */
.quick-bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 780px;
}

.bento-q-card {
  min-height: 44px;
  padding: 11px 14px;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(28,25,23,0.03);
  transition: color 0.24s cubic-bezier(0.19, 1, 0.22, 1), background-color 0.24s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.24s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.24s cubic-bezier(0.19, 1, 0.22, 1), transform 0.24s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.24s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  overflow: hidden;
}

.bento-q-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-primary) 100%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.bqc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bqc-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.bqc-icon {
  font-size: 14px;
}

.bqc-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.45;
  margin-bottom: 4px;
  transition: color 0.18s ease;
}

.bqc-desc {
  font-size: 11.5px;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin-bottom: 6px;
}

.bqc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  padding-top: 5px;
  border-top: 1px dashed var(--color-border-subtle);
}

.bqc-arrow {
  font-size: 13px;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.bento-q-card:hover {
  border-color: rgba(197, 155, 39, 0.55);
  box-shadow: 0 10px 24px rgba(133, 23, 34, 0.08), 0 2px 8px rgba(0,0,0,0.03);
  transform: translateY(-3px);
  background: #FCFAF7;
}

.bento-q-card:hover::before {
  opacity: 1;
}

.bento-q-card:hover .bqc-title {
  color: var(--color-primary-dark);
}

.bento-q-card:hover .bqc-arrow {
  transform: translateX(4px);
}

/* 消息容器与消息流 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  max-width: 84%;
  font-size: 14.5px;
  line-height: 1.8;
  word-break: break-word;
  animation: popInMsg 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes popInMsg {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #851722 0%, #A61D2B 100%);
  color: #FFFFFF;
  padding: 14px 18px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 4px 14px rgba(133, 23, 34, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.msg.ai {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid #EBE4D6;
  border-radius: 4px 18px 18px 18px;
  padding: 18px 22px;
  color: var(--color-text-primary);
  box-shadow: 0 3px 12px rgba(28,25,23,0.04);
}

.msg.sys {
  align-self: center;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-secondary);
  max-width: 90%;
  text-align: center;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
}

.msg.ai p { margin: 8px 0; }
.msg.ai ul, .msg.ai ol { margin: 8px 0 8px 20px; }
.msg.ai li { margin: 4px 0; }
.msg.ai strong { color: var(--color-primary-dark); font-weight: 600; }
.msg.ai h1, .msg.ai h2, .msg.ai h3 {
  font-family: var(--font-serif);
  margin: 14px 0 8px;
  color: var(--color-primary-dark);
}
.msg.ai h3 {
  font-size: 15.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg.ai h3::before {
  content: "";
  display: inline-block;
  width: 3.5px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 2px;
}

.thinking {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(194, 31, 48, 0.25);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 引用溯源新视觉 */
.ref-block {
  margin-top: 14px;
  padding: 12px 16px;
  background: #FAF7F2;
  border: 1px solid #EBE3D3;
  border-radius: var(--radius-md);
}

.ref-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(197, 155, 39, 0.25);
}

.ref-item {
  font-size: 12.5px;
  margin-bottom: 6px;
  line-height: 1.5;
}

.ref-item:last-child {
  margin-bottom: 0;
}

.ref-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.ref-idx {
  font-family: var(--font-serif);
  font-size: 11.5px;
  color: var(--color-gold-dark);
}

.ref-name {
  color: var(--color-primary-dark);
}

.ref-snip {
  color: #6B655D;
  font-size: 12px;
  padding-left: 18px;
  margin-top: 2px;
}

/* 底部输入坞 (Linear 级毛玻璃一体舱) */
.chat-inputbar {
  border-top: 1px solid var(--color-border);
  padding: 12px 20px 14px;
  background: #FAF8F5;
  flex-shrink: 0;
}

.chat-dock-box {
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px 10px;
  box-shadow: 0 2px 10px rgba(28,25,23,0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-dock-box:focus-within {
  border-color: rgba(197, 155, 39, 0.6);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.12), 0 4px 14px rgba(28,25,23,0.04);
}

.chat-dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 6px;
}

.cdt-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cdt-rag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--color-text-secondary);
  user-select: none;
  font-weight: 500;
}

.cdt-rag-toggle input {
  accent-color: var(--color-primary);
  cursor: pointer;
}

.cdt-sep {
  width: 1px;
  height: 12px;
  background: var(--color-border);
}

.cdt-status-chip {
  cursor: pointer;
  color: var(--color-primary-dark);
  font-weight: 500;
  transition: opacity 0.18s ease;
}

.cdt-status-chip:hover {
  text-decoration: underline;
}

.cdt-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cdt-shortcut {
  font-size: 11px;
  color: var(--color-text-muted);
}

.chat-inputrow {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-inputrow textarea {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 4px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 28px;
  max-height: 140px;
  line-height: 1.6;
  color: var(--color-text-primary);
}

.chat-inputrow textarea::placeholder {
  color: #A8A29E;
}

.chat-send {
  min-height: 44px;
  height: 44px;
  padding: 0 20px;
  background: linear-gradient(135deg, #C21F30 0%, #991624 100%);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  flex: none;
  box-shadow: 0 2px 8px rgba(194,31,48,0.28);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255,255,255,0.15);
}

.chat-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #A81A28 0%, #7A101C 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194,31,48,0.36);
}

.chat-send:active:not(:disabled) {
  transform: scale(0.965);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send.stop {
  background: #57534E;
  box-shadow: 0 2px 8px rgba(87, 83, 78, 0.3);
}

/* ==========================================================================
   FLOATING AI TRIGGER - HIDE IN CHAT MODE
   ========================================================================== */
body.mode-chat .float-ai-trigger { display: none !important; }
.float-ai-trigger {
  display: none;
}

/* ==========================================================================
   SETTINGS MODAL
   ========================================================================== */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-overlay.show {
  display: flex;
}

.settings-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-float);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
}

.settings-box h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
}

.settings-box .sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.settings-box label {
  display: block;
  font-size: 13.5px;
  color: var(--color-text-secondary);
  margin: 14px 0 6px;
  font-weight: 600;
}

.settings-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}

.settings-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(194,31,48,0.12);
}

.settings-box .actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 26px;
}

.settings-box .actions button {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  min-height: 42px;
}

.settings-box .btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
}
.settings-box .btn-primary:hover {
  background: var(--color-primary-dark);
}
.settings-box .btn-ghost {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}
.settings-box .btn-ghost:hover {
  background: var(--color-surface-subtle);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 36px 24px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.footer .fs {
  font-size: 12px;
  opacity: 0.8;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Flawless Mobile 375px ~ 768px)
   ========================================================================== */
@media (max-width: 900px) {
  
}

@media (max-width: 640px) {
  .topbar-inner {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：flex-wrap, gap, padding */
  }
  .brand {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：gap */
  }
  .brand-mark {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：height, width */
  }
  .brand-title {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：font-size */
  }
  .brand-title-badge {
    display: none;
  }
  .brand-sub {
    display: none !important;
  }
  .mode-tabs {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：margin-left */
  }
  .mode-tabs button {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：font-size, gap, min-height, padding */
  }
  .btn-nav-admin {
    display: none !important;   /* 移动端顶栏空间紧张，后台入口仅桌面可见 */
  }
  .searchbox {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：flex, margin-top, order */
    max-width: 100%;
  }
  body.mode-chat .searchbox {
    display: none !important;
  }
  .searchbox input {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：font-size, height */
  }
  .hero {
    padding: 28px 14px 22px;
  }
  .hero-crest {
    width: 54px;
    height: 54px;
  }
  .hero-kicker-badge {
    font-size: 11px;
    padding: 3px 10px;
  }
  
  
  
  
  .sec-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .chat-side {
    display: none;
  }
  .chat-layout {
    padding: 6px;
    gap: 0;
  }
  .chat-main {
    border-radius: var(--radius-sm);
  }
  .chat-main-header {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：padding */
  }
  .cmh-title {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：font-size */
  }
  .cmh-sub {
    display: none;
  }
  .cmh-action-btn span {
    display: none;
  }
  .cmh-action-btn {
    padding: 6px 8px;
    min-width: 32px;
    justify-content: center;
  }
  .chat-welcome-stage {
    padding: 10px 6px 8px;
  }
  .cws-title {
    font-size: 16px;
  }
  .cws-chips {
    gap: 4px;
    margin-bottom: 6px;
  }
  .cws-chip-gold, .cws-chip-red, .cws-chip-green {
    font-size: 10px;
    padding: 2px 7px;
  }
  .quick-bento-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .chat-messages {
    padding: 10px 8px;
    gap: 10px;
  }
  .msg {
    max-width: 92%;
    padding: 12px 14px;
    font-size: 13.5px;
  }
  .chat-inputbar {
    padding: 8px 10px 10px;
  }
  .chat-dock-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .cdt-sep {
    display: none;
  }
  .cdt-label-text {
    font-size: 11.5px;
  }
  .cdt-status-chip {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：font-size */
  }
  .cdt-shortcut {
    display: none;
  }
  .chat-inputrow textarea {
    min-height: 44px;
    height: 44px;
    font-size: 13.5px;
  }
  .chat-send {
    /* 以下属性由文末「精修区」的同名规则覆盖，此处不再重复声明：padding */
    min-height: 44px;
    height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .chat-side {
    display: none;
  }
  .main {
    padding: 26px 16px 56px;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-hero-primary, .btn-hero-secondary {
    justify-content: center;
    width: 100%;
  }
}

/* ==========================================================================
   ACETERNITY / UIVERSE / ANIME.JS INSPIRED ULTRA-SMOOTH MOTION SYSTEM
   ========================================================================== */
@keyframes heroFadeUp {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-crest-row {
  animation: heroFadeUp 0.85s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.hero h1 {
  animation: heroFadeUp 0.85s cubic-bezier(0.19, 1, 0.22, 1) 0.1s both;
}

.hero p {
  animation: heroFadeUp 0.85s cubic-bezier(0.19, 1, 0.22, 1) 0.2s both;
}

.hero-actions {
  animation: heroFadeUp 0.85s cubic-bezier(0.19, 1, 0.22, 1) 0.3s both;
}



/* 1. Aceternity UI 风格：流动极光星云 (Aurora Ambient Beams) */
.hero::before {
  animation: auroraFloat1 12s infinite ease-in-out;
}
@keyframes auroraFloat1 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translate(30px, -15px) scale(1.12);
    opacity: 0.45;
  }
}

/* 2. Uiverse / Aceternity 风格：Shimmer Button 扫光流光 */
.btn-hero-primary {
  position: relative;
  overflow: hidden;
}
.btn-hero-primary::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -150%;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: rotate(25deg);
  animation: shimmerPass 4.5s infinite cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
@keyframes shimmerPass {
  0%, 65% { left: -150%; }
  100% { left: 200%; }
}

.hero-kicker-badge {
  position: relative;
  overflow: hidden;
}
.hero-kicker-badge::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 242, 209, 0.4), transparent);
  transform: skewX(-20deg);
  animation: badgeShine 5.5s infinite ease-in-out;
  pointer-events: none;
}
@keyframes badgeShine {
  0%, 70% { left: -100%; }
  100% { left: 200%; }
}

/* 3. React Bits 风格：搜索框聚焦流线展开 */
.searchbox {
  transition: max-width 0.38s cubic-bezier(0.19, 1, 0.22, 1);
}
.searchbox:focus-within {
  max-width: 440px;
}
.searchbox input {
  transition: color 0.32s cubic-bezier(0.19, 1, 0.22, 1), background-color 0.32s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.32s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.32s cubic-bezier(0.19, 1, 0.22, 1), transform 0.32s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.32s cubic-bezier(0.19, 1, 0.22, 1);
}
.searchbox input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 4px rgba(197, 155, 39, 0.2), 0 4px 16px rgba(133, 23, 34, 0.08);
}

/* 4. Bento Grid 3D 悬浮位移与柔和深邃阴影 */



.sec-card {
  transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.35s ease, border-color 0.3s ease;
}
.sec-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(133, 23, 34, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  border-color: rgba(194, 31, 48, 0.35);
}

.sec-footer .read-arrow {
  transition: transform 0.28s cubic-bezier(0.19, 1, 0.22, 1);
}
.sec-card:hover .sec-footer .read-arrow {
  transform: translateX(6px);
}

/* 5. Anime.js / iOS Spring 触控回弹 */
button:active, .btn-hero-primary:active, .btn-hero-secondary:active, .sec-card:active, .crumb-btn:active, .quick-q button:active {
  transform: scale(0.965) !important;
  transition: transform 0.08s cubic-bezier(0.34, 1.35, 0.64, 1) !important;
}

/* 6. 视图切换丝滑渐入 */
#view-home, #view-detail, #view-chat {
  animation: viewFadeIn 0.38s cubic-bezier(0.19, 1, 0.22, 1);
}
@keyframes viewFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   PATCH v3 — 规范合规与移动端精修
   图标徽标体系 / 状态指示灯 / 侧栏检索范围 / 移动端断点修复
   ========================================================================== */

/* 1. 图标徽标容器：让 SVG 图标拥有统一、克制的方寸底座 */
.csh-icon,
.bqc-icon,
.cmh-emblem,
.cws-emblem-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.csh-icon,
.bqc-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  transition: color 0.18s ease, background 0.18s ease,
              border-color 0.18s ease, transform 0.18s cubic-bezier(0.19, 1, 0.22, 1);
}

.csh-icon svg,
.bqc-icon svg {
  display: block;
  width: 13px;
  height: 13px;
}

.bento-q-card:hover .bqc-icon {
  color: #FFFFFF;
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.06);
}

.cmh-emblem svg {
  display: block;
  width: 19px;
  height: 19px;
}

.cws-emblem-badge {
  color: #FFFFFF;
}

.cws-emblem-badge svg {
  display: block;
  width: 23px;
  height: 23px;
}

.settings-box h3 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.settings-box h3 .ico-gear {
  width: 19px;
  height: 19px;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* 2. 状态指示灯：改由伪元素承载，避免 JS textContent 覆盖后丢失 */
.cdt-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.cdt-status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(21, 128, 61, 0.55);
  flex-shrink: 0;
}

/* 3. 徽章永不竖排：防止窄容器内单字换行 */
.cmh-badge {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 4. 侧栏底部检索范围：平衡长列表下方的版式重心 */
.chat-side-foot {
  flex-shrink: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(244, 239, 230, 0.42);
}

.csf-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.csf-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.csf-row b {
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.csf-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--color-border);
  font-size: 11px;
  line-height: 1.6;
  color: var(--color-text-muted);
}

/* 5. 响应式双轨文案：窄屏使用精简标签 */
.cdt-label-short {
  display: none;
}

/* 6. 移动端精修：徽章竖排、标题折行与输入坞溢出 */
@media (max-width: 640px) {
  .chat-main-header {
    padding: 9px 12px;
    gap: 8px;
    align-items: flex-start;
  }
  .cmh-left {
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
  }
  .cmh-info {
    min-width: 0;
  }
  .cmh-title-row {
    flex-wrap: wrap;
    gap: 3px 7px;
  }
  .cmh-title {
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .cmh-emblem {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }
  .cmh-emblem svg {
    width: 16px;
    height: 16px;
  }
  .cmh-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .cdt-left {
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 8px;
  }
  .cdt-label-full {
    display: none;
  }
  .cdt-label-short {
    display: inline;
    white-space: nowrap;
  }
  .cdt-status-chip {
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .chat-inputrow {
    gap: 8px;
  }
  .chat-inputrow textarea {
    min-width: 0;
  }
  .chat-send {
    padding: 0 14px;
    flex: 0 0 auto;
  }
}

/* 7. 修复既有样式中相互抵消的 min-height 声明
      （frontend-design 提示：选择器特异性冲突会让无障碍基线静默失效） */
.mode-tabs button,
.btn-nav-admin {
  min-height: 44px;
}

/* 8. 移动端顶栏：三行压缩为两行，检索框独立成行 */
@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 6px 12px;
    gap: 8px 10px;
    align-items: center;
  }
  .brand {
    flex: 0 1 auto;
    min-width: 0;
    gap: 7px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .brand-info {
    min-width: 0;
  }
  .brand-title {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mode-tabs {
    margin-left: auto;
    flex-shrink: 0;
    padding: 3px;
    gap: 3px;
  }
  .mode-tabs button {
    min-height: 44px;
    padding: 0 9px;
    font-size: 12.5px;
    gap: 3px;
  }
  .mode-tabs button svg {
    width: 13px;
    height: 13px;
  }
  .searchbox {
    flex: 1 1 100%;
    order: 3;
    margin-top: 0;
  }
  .searchbox input {
    height: 36px;
    font-size: 12.5px;
  }
}


/* ===== PATCH v6：Hero 精修 ===== */

/* 1. 砍装饰：去掉金色扫光线，标题只留一层暗投影（原为双层含金色辉光） */
.hero::after {
  display: none;
}
.hero h1 {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* 2. 背景光斑降一档，不与内容抢注意力 */
.hero::before {
  background-image:
    radial-gradient(circle at 82% 12%, rgba(229, 189, 69, 0.20) 0%, transparent 46%),
    radial-gradient(circle at 8% 88%, rgba(197, 155, 39, 0.13) 0%, transparent 44%);
}

/* 3. 校徽去掉旋转，只留克制的放大 */
.hero-crest:hover {
  transform: scale(1.04);
}

/* 4. 年代徽标：胶囊 → 公文体左侧金线批注（去渐变底、去阴影、去字距） */
.hero-kicker-badge {
  background: none;
  border: none;
  border-left: 2px solid var(--color-gold);
  border-radius: 0;
  padding: 1px 0 1px 12px;
  color: #F0DCA8;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}

/* 5. 副标题：中文细体在深底上笔划过细，回到 400；并避免行尾孤字 */
.hero p {
  font-weight: 400;
  color: #E8DACB;
  max-width: 720px;
  text-wrap: pretty;
}

/* 5b. Hero 底边线收细，避免与指标栏下边框形成等重的双线 */
.hero {
  border-bottom-width: 1px;
}

/* 6. 核心改动：四张玻璃卡 → 一条细线分隔的档案指标栏 */
.hero-ledger {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 44px;
  border-top: 1px solid rgba(232, 216, 175, 0.22);
  border-bottom: 1px solid rgba(232, 216, 175, 0.22);
  animation: heroFadeUp 0.85s cubic-bezier(0.19, 1, 0.22, 1) 0.4s both;
}

.hl-item {
  padding: 22px 24px 20px;
  transition: background 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hl-item + .hl-item {
  border-left: 1px solid rgba(232, 216, 175, 0.16);
}

.hl-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.hl-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: #D8B978;
  margin-bottom: 9px;
}

.hl-k::before {
  content: "";
  flex: none;
  width: 12px;
  height: 1px;
  background: var(--color-gold);
  opacity: 0.85;
}

.hl-v {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.08;
  color: #FFF6E4;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.hl-v i {
  font-style: normal;
  font-size: 15px;
  font-weight: 700;
  margin-left: 4px;
  color: #DFC28C;
}

.hl-d {
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(235, 220, 206, 0.72);
  margin-top: 8px;
}

/* 7. 指标栏响应式 */
@media (max-width: 900px) {
  .hero-ledger {
    grid-template-columns: repeat(2, 1fr);
  }
  .hl-item:nth-child(odd) {
    border-left: none;
  }
  .hl-item:nth-child(n+3) {
    border-top: 1px solid rgba(232, 216, 175, 0.16);
  }
}

@media (max-width: 640px) {
  .hero-ledger {
    margin-top: 30px;
  }
  .hl-item {
    padding: 15px 14px 14px;
  }
  .hl-k {
    font-size: 10.5px;
    margin-bottom: 6px;
  }
  .hl-v {
    font-size: 23px;
  }
  .hl-v i {
    font-size: 12.5px;
  }
  .hl-d {
    font-size: 11.5px;
    margin-top: 6px;
  }
}


/* ===== PATCH v7：网址超链接 ===== */
.src-list .src-url {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: rgba(111, 106, 98, 0.5);
  text-underline-offset: 3px;
  /* PATCH v18：弃用 word-break:break-all —— 它把 URL 拦腰断行且行宽不可预测。
     改为单行省略号截断；完整地址由渲染时写入的 title 属性兜底。
     用 overflow-wrap 而非 word-break：只影响超长不可断词，正常文本不受牵连。 */
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.src-list .src-url:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

.footer-link {
  color: var(--color-primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(194, 31, 48, 0.35);
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.footer-link:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

/* 详情页条目的「来源」：名称本身可点 */
.entry .src a.src-name,
.entry .src a {
  color: var(--color-primary-dark);
  text-decoration: underline;
  text-decoration-color: rgba(194, 31, 48, 0.3);
  text-underline-offset: 3px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.entry .src a.src-name:hover,
.entry .src a:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

/* 聊天里的参考来源：网址同样可点。
   PATCH v18：与首页来源列表同法 —— 弃用 break-all，改单行省略号截断，
   完整地址由渲染时写入的 title 兜底。 */
.chat-main .src-url {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}


/* ==========================================================================
   PATCH v11 — 滚动驱动动效体系（补齐"滚动时"这一层）
   曲线沿用 WORKBUDDY_MOTION_GUIDE.md：Fluid-Smooth / Expo-Out
   ========================================================================== */

/* 1. 通用上浮入场 */
[data-rv] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.62s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--rv-d, 0ms);
}
[data-rv].rv-in {
  opacity: 1;
  transform: none;
}

/* 2. 行级遮罩上移：文字从遮罩中"抽"出来 */
[data-rv-mask] {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}
[data-rv-mask] > .mask-in {
  display: block;
  transform: translateY(108%);
  transition: transform 0.68s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--rv-d, 0ms);
}
[data-rv-mask].rv-in > .mask-in {
  transform: none;
}

/* 3. 细线生长 */
[data-rv-line] {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--rv-d, 0ms);
}
[data-rv-line].rv-in {
  transform: scaleX(1);
}

/* 4. Hero 指标栏：改为逐格入场，取消整块淡入 */
.hero-ledger {
  animation: none;
}
.hl-v > [data-count] {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* 5. 大事记：底轨改淡，进度轨在其上生长；节点随入场点亮 */
.timeline::before {
  background: var(--color-border);
}
.tl-fill {
  position: absolute;
  left: 10px;
  top: 6px;
  width: 2px;
  height: calc(100% - 12px);
  border-radius: 1px;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-gold) 100%);
  transform: scaleY(0);
  transform-origin: top center;
  pointer-events: none;
}
.tl-item::before {
  background: #FFFFFF;
  border-color: var(--color-border);
  box-shadow: none;
  transition: border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.tl-item.rv-in::before {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.28), 0 2px 6px rgba(194, 31, 48, 0.22);
}

/* 6. 无障碍：偏好减弱动效时全部退化为静态 */
@media (prefers-reduced-motion: reduce) {
  [data-rv],
  [data-rv].rv-in,
  [data-rv-mask] > .mask-in,
  [data-rv-mask].rv-in > .mask-in,
  [data-rv-line],
  [data-rv-line].rv-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .tl-fill {
    transform: scaleY(1);
  }
}


/* ===== PATCH v12 — 可用性整改（触摸 / 锚点 / 弹窗 / 原生控件）===== */

/* 双击不再等待 300ms 缩放判定 */
a, button, input, textarea, select, [role="button"] {
  touch-action: manipulation;
}

/* 移动端点按反馈：显式设为品牌色淡底，替代浏览器默认的灰色方块 */
html {
  -webkit-tap-highlight-color: rgba(194, 31, 48, 0.12);
}

/* 粘性顶栏会盖住锚点目标，给可聚焦/可跳转目标留出让位 */
#main-content,
h1, h2, h3, h4,
.section-title,
[role="button"] {
  scroll-margin-top: 92px;
}

/* 弹窗打开时不让滚动链传到页面（规范要求 modal/drawer/sheet） */
.settings-overlay {
  overscroll-behavior: contain;
}

/* 声明浅色主题，避免 Windows 深色模式下原生控件/滚动条变成深色 */
:root {
  color-scheme: light;
}

/* 可点但无原生语义的元素要给出指针光标与最小触控热区 */
[role="button"] {
  cursor: pointer;
}

/* 仅供读屏的文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 焦点环对 role=button 的卡片同样生效（全局 :focus-visible 已定义，这里补内缩位） */
[role="button"]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* 触屏设备没有 Ctrl 键，快捷键提示纯占地方（375px 实测它占了 45px 宽） */
@media (hover: none) and (pointer: coarse) {
  .search-kbd {
    display: none;
  }
}


/* ==========================================================================
   PATCH v14 — 丝滑 · 大气（滚动插值 / 分层视差 / 进度指示 / 编排升级）
   ========================================================================== */

/* ① 顶部滚动进度：细金线，随滚动从左生长 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 300;
  pointer-events: none;
  background: linear-gradient(90deg, #C21F30 0%, #C59B27 58%, #FFE6A8 100%);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.85;
}

/* ② ③ 视差与编排：只在允许动效时启用。
      放在 prefers-reduced-motion: no-preference 里而不是直接写 ——
      否则会排在 MOTION_CSS 的 reduce 块之后，把它的降级覆盖掉。 */
@media (prefers-reduced-motion: no-preference) {

  /* Hero 分层视差：--hero-p 由 JS 写入（0→1）。只改 transform，不触发重排。 */
  .hero { --hero-p: 0; }
  .hero-inner {
    transform: translate3d(0, calc(var(--hero-p) * 26px), 0);
  }
  /* 校徽反向位移 + 微缩：读作"浮在前景"，比同向视差更有纵深。
     注意 .hero-crest 自身没有入场动画（动画在 .hero-crest-row 上），
     所以这里可以直接占用它的 transform。 */
  .hero-crest {
    transform: translate3d(0, calc(var(--hero-p) * -30px), 0)
               scale(calc(1 - var(--hero-p) * 0.06));
  }

  /* 入场位移 18→26px 并加极轻微缩放：缩到 0.986 就够，
     再小会显廉价（缩放是弹窗广告的语言），再大又会显笨重。 */
  [data-rv] {
    transform: translateY(26px) scale(0.986);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--rv-d, 0ms);
  }
  [data-rv].rv-in {
    transform: none;
  }

  /* 细线生长也放慢一点，与卡片错峰同步 */
  [data-rv-line] {
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--rv-d, 0ms);
  }
}

/* ④ 背景极光并入滚动：保留原呼吸动效，叠加 --hero-p 的纵向漂移。
      必须并进关键帧 —— 伪元素上的 animation 会独占 transform，
      在外面另写 transform 是无效的（这是 a) 之外最容易踩的一点）。 */
@keyframes auroraFloat1 {
  0%, 100% {
    transform: translate3d(0, calc(var(--hero-p, 0) * 46px), 0) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translate3d(30px, calc(var(--hero-p, 0) * 46px - 15px), 0) scale(1.12);
    opacity: 0.45;
  }
}

/* ⑤ 无障碍：偏好减弱动效时，进度条也不该出现（它本身就是运动指示） */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress {
    display: none;
  }
  .hero-inner,
  .hero-crest {
    transform: none;
  }
}


/* ===== PATCH v15 — 智脑徽标改用校徽实图（白底托片 + 金边，与 .hero-crest 同一语言）===== */
.cmh-emblem,
.cws-emblem-badge {
  border-radius: 50%;
  background: #FFFFFF;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.cmh-emblem {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1.5px solid var(--color-gold-border);
  box-shadow: 0 2px 8px rgba(133, 23, 34, 0.16);
}
.cws-icon-wrap {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
}
.cws-emblem-badge {
  width: 54px;
  height: 54px;
  padding: 3px;
  border: 2px solid var(--color-gold);
  box-shadow: 0 6px 18px rgba(133, 23, 34, 0.20), 0 0 0 4px rgba(197, 155, 39, 0.16);
  font-size: 0;
}
.emblem-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}


/* ===== PATCH v16 — 大事记「焦点年」：滚动到哪一年，就放大哪一年 ===== */
@media (prefers-reduced-motion: no-preference) {

  /* 年份徽标是主角。默认态先声明过渡，否则切换时缩放会"瞬跳"。
     transform-origin 取左端：放大时向右生长，视觉锚点仍钉在卡片左缘。 */
  .tl-year {
    transform-origin: left center;
    transition: transform 0.52s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* 焦点年：放大 1.26，底色由「淡金纸片」翻成「朱砂实章」 */
  .tl-item.tl-now .tl-year {
    transform: scale(1.26);
    color: #FFFFFF;
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(194, 31, 48, 0.26);
  }

  /* 卡片跟着"凸出来"：整体放大 + 投影加深。
     注意目标是 .tl-inner 而非 .tl-item —— .tl-item 的 transform 归入场动画所有，
     两边同时占用会互相覆盖（见下方 PATCH v17 的通道拆分）。

     放大倍数与原点由 JS 按实测可用空间下发（--tl-pop / --tl-origin）。
     这里的 1.03 / 50% 只是 JS 未就位时的兜底值。 */
  .tl-item.tl-now {
    --tl-pop: 1.03;
    --tl-origin: 50% 50%;
    z-index: 2;                 /* 抬起，让投影盖在相邻卡片上，读作"离眼睛更近" */
  }
  .tl-item.tl-now .tl-inner {
    border-color: rgba(194, 31, 48, 0.34);
    box-shadow: 0 20px 44px rgba(133, 23, 34, 0.17),
                0 6px 16px rgba(133, 23, 34, 0.07),
                0 0 0 1px rgba(197, 155, 39, 0.18);
  }

  /* 节点圆点：补上 transform 过渡（v11 只过渡了描边与阴影），
     焦点年放大 1.2 并长出外圈金环 */
  .tl-item::before {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .tl-item.tl-now::before {
    transform: scale(1.2);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 5px rgba(197, 155, 39, 0.30), 0 3px 10px rgba(194, 31, 48, 0.30);
  }
}


/* ===== PATCH v19 — 板块卡片 hover 放大 ===== */
@media (prefers-reduced-motion: no-preference) {
  /* 入场完成后切到 hover 专用过渡：0.4s 跟手，并清掉 --rv-d 错峰延迟 */
  .sec-grid > .sec-card.rv-in {
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1),
                box-shadow 0.36s cubic-bezier(0.19, 1, 0.22, 1),
                border-color 0.3s ease;
    transition-delay: 0ms;
  }
  /* 选择器必须到 (0,3,0)，否则会被 [data-rv].rv-in 的 transform: none 覆盖 */
  .sec-grid > .sec-card:hover,
  .sec-grid > .sec-card:focus-visible {
    transform: translateY(-6px) scale(1.035);
    z-index: 3;
  }
}


/* 管理后台入口：红描边药丸 + 齿轮 + 文字。
   初代的原始样式是内联的「红描边药丸」，用的是当时的旧令牌（红色主色 / 浅纸底）。
   中间一代改成了中性描边（--color-border + 纯白底），但中性描边放在白色顶栏上
   **几乎看不见**，实际退化成一行普通文字 —— 这版回到初代的红描边观感，
   旧令牌映射到当前令牌表：红色主色 -> --color-primary，浅纸底 -> --color-primary-light。
   图标沿用 SVG 齿轮（不用初代的 emoji：DESIGN.md 明令禁止 emoji 当图标）。
   注意：这段注释里不要出现旧令牌的 var() 字面写法 —— verify_redesign.py 会
   统计旧令牌的残留次数，注释里写了会被判成未定义令牌引用（已踩过一次）。 */
.btn-nav-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 15px;
  min-height: 44px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
  white-space: nowrap;
  flex: none;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease,
              box-shadow .2s ease, transform .2s ease;
}
.btn-nav-admin:hover,
.btn-nav-admin:focus-visible {
  color: #FFFFFF;
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(194, 31, 48, 0.25);
  outline: none;
}
.btn-nav-admin svg { display: block; flex: none; }
@media (prefers-reduced-motion: reduce) {
  .btn-nav-admin { transition: none; }
  .btn-nav-admin:hover { transform: none; }
}


/* ① 管理后台按钮：流光扫光（与 .btn-hero-primary 共用 shimmerPass 关键帧）
   按钮底色是浅红，扫光用较高不透明度的白才在浅底上看得见。 */
.btn-nav-admin {
  position: relative;
  overflow: hidden;
}
.btn-nav-admin::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -150%;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: rotate(25deg);
  animation: shimmerPass 4.5s infinite cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.btn-nav-admin:hover::after,
.btn-nav-admin:focus-visible::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

/* ② 搜索框：聚焦时流体展开（先把品牌文字腾出来，否则没有可展开的余地） */
.brand-info {
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .5s cubic-bezier(0.16, 1, 0.3, 1),
              opacity .28s ease,
              margin-left .5s cubic-bezier(0.16, 1, 0.3, 1);
}
.topbar:has(.searchbox:focus-within) .brand-info {
  max-width: 0;
  opacity: 0;
  margin-left: -12px;
}
.searchbox {
  transition: max-width .5s cubic-bezier(0.16, 1, 0.3, 1);
}
.topbar:has(.searchbox:focus-within) .searchbox {
  max-width: 600px;
}

/* ③ 指标栏：悬浮抬升 + 提亮 */
.hl-item {
  transition: transform .5s cubic-bezier(0.16, 1, 0.3, 1),
              background .25s cubic-bezier(0.16, 1, 0.3, 1);
}
.hl-v, .hl-k, .hl-d {
  transition: color .3s ease;
}
.hl-item:hover {
  transform: translateY(-3px);
}
.hl-item:hover .hl-v { color: #FFFFFF; }
.hl-item:hover .hl-k { color: #F0DCA8; }
.hl-item:hover .hl-d { color: rgba(246, 236, 224, 0.95); }

@media (prefers-reduced-motion: reduce) {
  .btn-nav-admin::after { animation: none; display: none; }
  .brand-info,
  .searchbox,
  .hl-item,
  .hl-v, .hl-k, .hl-d { transition: none; }
  .topbar:has(.searchbox:focus-within) .brand-info {
    max-width: none; opacity: 1; margin-left: 0;
  }
  .topbar:has(.searchbox:focus-within) .searchbox { max-width: 430px; }
  .hl-item:hover { transform: none; }
}



/* ==========================================================================
   PATCH v31 — 对话页右上操作按钮（新对话 / 接口配置）
   --------------------------------------------------------------------------
   改的四件事，逐条可验证：

   ① 底色写死 #FFFFFF → 改用 --color-surface 令牌。
      本项目踩过一次：改令牌治不到硬编码字面量，那是漏网主因。

   ② 补按压反馈。原来只有 :hover，按下去毫无反应，手感发"死"。
      沿用动效规范的 Spring-Pop 曲线（cubic-bezier(.34,1.35,.64,1)）。

   ③ 两个按钮原来是**完全等重**的：一个"新对话"是常用动作，
      一个"接口配置"是低频设置项，却长得一模一样 —— 这会让顶栏显得杂乱、
      视线没有落点。现在把低频的设置项降级为 ghost（无边框、透明底），
      把描边留给常用动作，形成主次层级。

   ④ 触屏命中区：视觉 32px 远低于 DESIGN.md 的「触控目标 ≥ 44×44px」硬性要求。
      ⚠️ 这里**没有**用 ::after{inset:-Npx} 撑命中区 —— 两个按钮 gap 只有 8px，
      伪元素外扩会让相邻命中区互相重叠，反而更容易点错。直接在触屏上把按钮做到 44px。
   ========================================================================== */

/* ① + ③：主次分层 */
.cmh-action-btn {
  background: var(--color-surface);
  font-weight: 500;
}
.cmh-action-btn[data-act="open-settings"] {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}

/* ③：hover / active（两个按钮共用品牌浅红反馈） */
.cmh-action-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary-border);
}
.cmh-action-btn[data-act="open-settings"]:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-border);
  color: var(--color-primary-dark);
}

@media (prefers-reduced-motion: no-preference) {
  .cmh-action-btn {
    transition: color .18s ease, background-color .18s ease,
                border-color .18s ease, box-shadow .18s ease,
                transform .18s cubic-bezier(0.34, 1.35, 0.64, 1);
  }
  .cmh-action-btn:active {
    transform: scale(0.965);
  }
  /* 常用动作给一点极轻的抬升，克制——不加发光、不加渐变 */
  .cmh-action-btn[data-act="clear-chat"]:hover {
    box-shadow: 0 2px 8px rgba(133, 23, 34, 0.08);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cmh-action-btn { transition: none; }
  .cmh-action-btn:active { transform: none; }
}

/* ④ 触屏：直接做到 44×44 */
@media (hover: none) and (pointer: coarse) {
  .cmh-action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0 11px;
    justify-content: center;
  }
}

/* ④-补：触屏没有 hover，无边框的图标按钮会看不出"可点"，补一圈淡描边。
   桌面保留 ghost 形态 —— 那里有 hover 反馈足以表明它是按钮。 */
@media (hover: none) and (pointer: coarse) {
  .cmh-action-btn[data-act="open-settings"] {
    border-color: var(--color-border);
  }
}

/* ==========================================================================
   PATCH v32 — 指针驱动的 3D 倾斜（鼠标移到哪个模块，那个模块就朝指针方向倾倒）
   --------------------------------------------------------------------------
   分工：**JS 只写 --tilt-x / --tilt-y 两个角度变量，变换全部在 CSS 里合成。**

   为什么不直接在 JS 里写 transform：
     1. 页面已有滚动入场（[data-rv] → .rv-in 的 transform: none）和卡片 hover 抬升，
        transform 是多方争抢的属性，JS 内联会直接盖掉它们（DESIGN.md 记过这个坑）；
     2. 合成放在 CSS 里，才能整段落进 @media (prefers-reduced-motion) 的保护范围。

   角度上限 6°：再大就不是"倾倒"而是"翻牌"，在这个庄重典雅的定位下会显轻浮。
   .is-tilt 由 JS 在「有鼠标 + 允许动效」时才加，触屏与 reduce 用户整段不生效。
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  /* 抬升量沿用各自原有的 hover 值，倾斜只是叠加上去，不改写既有手感 */
  .sec-grid > .sec-card.is-tilt:hover,
  .sec-grid > .sec-card.is-tilt:focus-visible {
    transform: perspective(900px)
               rotateX(var(--tilt-x, 0deg))
               rotateY(var(--tilt-y, 0deg))
               translateY(-6px) scale(1.035);
  }
  .hl-item.is-tilt:hover {
    transform: perspective(900px)
               rotateX(var(--tilt-x, 0deg))
               rotateY(var(--tilt-y, 0deg))
               translateY(-3px);
  }

  /* 跟随期把过渡压短：卡片入场后是 0.4s，指针实时跟随会拖泥带水。
     ⚠️ 选择器必须到 (0,3,0)：上面 PATCH v19 的 `.sec-grid > .sec-card.rv-in`
     把 transform 过渡定成 0.4s，同样是 (0,3,0)，比它低会被压过去 ——
     第一版写成 `.sec-card.is-tilt` (0,2,0) 就是这么失效的（实测 duration 仍是 0.4s）。 */
  .sec-grid > .sec-card.is-tilt,
  .hl-item.is-tilt {
    transition: transform .16s cubic-bezier(0.19, 1, 0.22, 1),
                box-shadow .18s ease, background-color .18s ease;
  }
  .is-tilt { will-change: transform; }
}

/* PATCH v34 — responsive shell, reader-safe chat scrolling, concise references */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-info { min-width: 0; max-width: 100%; }
  .mode-tabs { margin-left: auto; }
  .searchbox { order: 3; flex: 1 1 100%; max-width: none; }
}
@media (max-width: 640px) {
  .search-kbd { display: none; }
}
#view-chat {
  height: calc(100dvh - 69px);
  min-height: 480px;
}
.chat-layout,
.chat-main,
.chat-messages { min-height: 0; }
.chat-messages { overscroll-behavior: contain; scrollbar-gutter: stable; }
.ref-block { margin-top: 14px; padding: 12px 16px; background: #FAF7F2; border: 1px solid #EBE3D3; border-radius: var(--radius-md); }
.ref-block ol { margin: 6px 0 0 18px; padding: 0; }
.ref-head { flex-wrap: wrap; }
.ref-link { margin-left: auto; color: var(--color-primary); font-size: 12px; white-space: nowrap; }
.ref-source { color: var(--color-text-muted); font-size: 12px; font-weight: 400; }
@media (max-width: 640px) {
  #view-chat { min-height: 520px; }
  .chat-inputbar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .ref-block { padding: 10px 12px; }
  .ref-link { margin-left: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .ref-link { transition: none; }
}

/* PATCH v35 - warm-paper content composition inspired by the reference layout */
.content-section {
  position: relative;
}

.content-section-taxonomy {
  padding-block: 6px 78px;
}

.content-section-timeline {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 74px max(24px, calc((100vw - var(--container-width)) / 2)) 88px;
  background: linear-gradient(180deg, #FBF0F1 0%, #F9ECEE 100%);
}

.content-section-references {
  padding-block: 76px 28px;
}

.content-section > .section-title {
  max-width: var(--container-width);
  margin: 0 auto 34px;
}

.section-title {
  align-items: end;
  gap: 16px;
}

.section-title .no {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--color-primary);
  border-radius: 8px;
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(194, 31, 48, 0.18), 2px 2px 0 rgba(194, 31, 48, 0.12);
  transform: rotate(-3deg);
}

.section-title h2 {
  font-size: clamp(27px, 3.2vw, 38px);
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.section-title .line {
  flex: 1;
  min-width: 24px;
  height: 1px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--color-border), transparent);
}

.section-title .hint {
  flex: none;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--color-gold);
  color: var(--color-text-muted);
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.sec-card {
  min-height: 208px;
  border-radius: 14px;
  padding: 24px 24px 20px;
}

.sec-no-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--color-primary-dark);
}

.sec-no-tag b {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.sec-no-tag i {
  color: var(--color-text-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.sec-count {
  padding: 4px 10px;
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 11.5px;
}

.sec-footer {
  justify-content: flex-start;
  padding-top: 16px;
  border-top: 0;
}

.sec-footer .read-arrow {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
}

.sec-footer .read-arrow span {
  display: inline-block;
  transition: transform 0.18s ease;
}

.sec-card:hover .sec-footer .read-arrow {
  background: none;
  color: var(--color-primary);
  border-color: transparent;
  box-shadow: none;
}

.sec-card:hover .sec-footer .read-arrow span {
  transform: translateX(4px);
}

.sec-grid > .sec-card:last-child {
  min-height: 232px;
  background: linear-gradient(124deg, var(--color-primary-dark), #6E1019);
  border-color: transparent;
  color: #FFF8EE;
}

.sec-grid > .sec-card:last-child::before {
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold), transparent);
  opacity: 1;
}

.sec-grid > .sec-card:last-child .sec-no-tag,
.sec-grid > .sec-card:last-child .sec-no-tag i {
  color: #E4C76F;
}

.sec-grid > .sec-card:last-child .sec-count {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #FFF8EE;
}

.sec-grid > .sec-card:last-child h3 {
  color: #FFF8EE;
}

.sec-grid > .sec-card:last-child p {
  color: rgba(255, 248, 238, 0.78);
}

.sec-grid > .sec-card:last-child .sec-footer .read-arrow {
  color: #E4C76F;
}

.sec-feature-facts {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 9px;
  margin-left: auto;
}

.sec-feature-facts span {
  min-width: 172px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF8EE;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

/* Reference-style alternating timeline */
.content-section-timeline .section-title {
  margin-bottom: 42px;
}

.content-section-timeline .section-title h2,
.content-section-timeline .section-title .hint {
  color: var(--color-primary-dark);
}

.timeline {
  max-width: var(--container-width);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  gap: 30px 0;
  padding: 0;
  margin: 0 auto;
}

.timeline::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  translate: -50% 0;
  background: #E5D1AF;
}

.tl-fill {
  left: 50%;
  top: 0;
  height: 100%;
  translate: -50% 0;
  background: linear-gradient(180deg, var(--color-primary), var(--color-gold));
}

.tl-item {
  min-height: 132px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  grid-column: 1 / -1;
  align-items: center;
  margin: 0;
}

.tl-inner {
  grid-column: 1;
  width: 100%;
  display: block;
  padding: 18px 24px;
  border-radius: 14px;
  background: var(--color-surface);
  text-align: right;
}

.tl-item:nth-child(even) .tl-inner {
  grid-column: 3;
  text-align: left;
}

.tl-item::before {
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 14px;
  height: 14px;
  translate: -50% -50%;
  border: 3px solid var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.tl-year {
  display: block;
  width: max-content;
  padding: 0;
  margin: 0 0 5px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--color-primary);
  font-size: 28px;
  line-height: 1.1;
}

.tl-item:nth-child(odd) .tl-year {
  margin-left: auto;
}

.tl-title {
  font-size: 16px;
  line-height: 1.5;
}

.tl-desc {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.tl-item.tl-now .tl-inner {
  border-color: rgba(194, 31, 48, 0.62);
  box-shadow: 0 12px 28px rgba(133, 23, 34, 0.1);
}

.tl-item.tl-now::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light), 0 0 0 7px rgba(194, 31, 48, 0.16);
}

/* Reference list stays readable while long URLs remain hidden */
.src-list {
  max-width: var(--container-width);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
  margin: 0 auto;
  padding: 8px 26px;
  border-radius: 14px;
}

.src-list li {
  min-width: 0;
  padding: 14px 4px 14px 22px;
}

.src-list a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1040px) {
  .sec-grid > .sec-card:last-child {
    align-items: center;
    gap: 10px 30px;
    padding: 28px 26px 22px;
  }

  .sec-grid > .sec-card:last-child .sec-header {
    flex: 0 0 100%;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 0;
  }

  .sec-grid > .sec-card:last-child h3 {
    flex: 0 1 auto;
    margin-bottom: 0;
  }

  .sec-grid > .sec-card:last-child p {
    flex: 1 1 320px;
    margin-bottom: 0;
  }

  .sec-grid > .sec-card:last-child .sec-feature-facts {
    order: 3;
  }

  .sec-grid > .sec-card:last-child .sec-footer {
    flex: 0 0 100%;
    order: 4;
  }
}

@media (max-width: 900px) {
  .content-section-timeline {
    padding-inline: 24px;
  }

  .timeline {
    grid-template-columns: 30px minmax(0, 1fr);
    display: block;
    padding-left: 30px;
  }

  .timeline::before,
  .tl-fill {
    left: 8px;
    translate: 0;
  }

  .tl-item {
    min-height: 0;
    display: block;
    padding-bottom: 18px;
  }

  .tl-inner,
  .tl-item:nth-child(even) .tl-inner {
    text-align: left;
  }

  .tl-item .tl-year {
    margin-left: 0;
  }

  .tl-item::before {
    left: 8px;
    top: 50%;
    translate: -50% -50%;
  }

  .sec-feature-facts {
    flex-direction: row;
    flex-wrap: wrap;
    margin-left: 0;
  }
}

@media (max-width: 860px) {
  .src-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 640px) {
  .content-section-taxonomy,
  .content-section-references {
    padding-block: 12px 58px;
  }

  .content-section-timeline {
    padding-block: 58px 64px;
    padding-inline: 20px;
  }

  .content-section > .section-title {
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
  }

  .section-title .no {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .section-title h2 {
    font-size: 27px;
  }

  .section-title .line {
    display: none;
  }

  .section-title .hint {
    margin-left: auto;
    font-size: 12px;
  }

  .sec-grid > .sec-card:last-child {
    min-height: 0;
  }

  .sec-feature-facts span {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sec-footer .read-arrow span {
    transition: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .tl-item.tl-now .tl-year {
    transform: scale(1.08);
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--color-primary);
  }

  .tl-item.tl-now::before {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

@media (max-width: 900px) {
  .content-section-timeline .tl-item:nth-child(n) .tl-year {
    margin-left: 0;
  }
}

/* PATCH v36 - keep the seventh taxonomy card on the light paper surface */
.sec-grid > .sec-card:last-child {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

.sec-grid > .sec-card:last-child::before {
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
  opacity: 0.9;
}

.sec-grid > .sec-card:last-child .sec-no-tag,
.sec-grid > .sec-card:last-child .sec-no-tag i {
  color: var(--color-primary-dark);
}

.sec-grid > .sec-card:last-child .sec-count {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.sec-grid > .sec-card:last-child h3 {
  color: var(--color-text-primary);
}

.sec-grid > .sec-card:last-child p {
  color: var(--color-text-secondary);
}

.sec-grid > .sec-card:last-child .sec-footer .read-arrow {
  color: var(--color-primary);
}

.sec-feature-facts span {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* PATCH v37 - keep the welcome emblem in view on short chat windows */
.cws-hero {
  margin-bottom: 8px;
}

.cws-desc {
  max-width: 620px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

@media (max-height: 760px) and (min-width: 901px) {
  .chat-welcome-stage {
    padding: 8px 12px 6px;
  }

  .cws-icon-wrap {
    width: 54px;
    height: 54px;
    margin-bottom: 6px;
  }

  .cws-emblem-badge {
    width: 50px;
    height: 50px;
  }

  .cws-chips {
    gap: 4px;
    margin-bottom: 4px;
  }

  .cws-title {
    margin-bottom: 2px;
    font-size: 17px;
  }

  .cws-desc {
    font-size: 12px;
    line-height: 1.4;
  }

  .quick-bento-grid {
    gap: 8px;
  }

  .bento-q-card {
    padding: 9px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cws-glow-ring {
    animation: none;
  }
}
