/* ==================================================================
   AI Space — 静态站样式表
   设计基调：浅色为主、低饱和背景、靛紫渐变点缀
   支持 data-theme="dark" 深色模式（localStorage 记忆）
   ================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e5e8ef;
  --border-strong: #d5dae5;

  --text: #1a1d29;
  --text-mid: #4c5266;
  --text-soft: #767d92;
  --text-faint: #9aa1b4;

  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --accent-soft: #eeecfe;
  --accent-text: #4f46e5;

  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 2px 8px rgba(20, 24, 40, 0.04);
  --shadow-md: 0 2px 6px rgba(20, 24, 40, 0.05), 0 12px 28px rgba(20, 24, 40, 0.07);
  --shadow-lg: 0 8px 20px rgba(20, 24, 40, 0.08), 0 24px 56px rgba(20, 24, 40, 0.1);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --maxw: 1160px;
  --header-h: 64px;

  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas,
    "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0d0f16;
  --bg-soft: #141824;
  --surface: #161a26;
  --surface-2: #1c2130;
  --border: #262c3d;
  --border-strong: #333b52;

  --text: #e8ebf2;
  --text-mid: #b3bacb;
  --text-soft: #8b93a7;
  --text-faint: #6b7387;

  --accent: #8b8bf0;
  --accent-2: #a78bfa;
  --accent-soft: #232042;
  --accent-text: #a5b4fc;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ---------- 3. 布局 ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 48px 0;
}

/* 首页：搜索框已在 Hero 里，列表区收紧顶部留白，让吸顶标签栏贴近 Hero */
body[data-page="home"] .section {
  padding-top: 12px;
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- 4. 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface); /* 不支持 color-mix 时的降级 */
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.nav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text-mid);
  font-weight: 500;
  transition: all 0.2s;
}

.nav a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav a.active {
  color: var(--accent-text);
  background: var(--accent-soft);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-mid);
  border: 1px solid var(--border);
  transition: all 0.2s;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-soft);
}

/* ---------- 5. Hero ---------- */
.hero {
  padding: 56px 0 28px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% 20% auto -10%;
  height: 420px;
  background: radial-gradient(
    60% 60% at 30% 40%,
    color-mix(in srgb, var(--accent) 16%, transparent) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero > .container {
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  margin-bottom: 18px;
}

.dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero p.lead {
  font-size: 17px;
  color: var(--text-mid);
  max-width: 620px;
  margin: 0;
}

/* 个人主页的统计块仍复用这两个类 */
.stat-num {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-soft);
}

/* ---------- 6. 搜索与筛选 ---------- */
/* 筛选栏吸顶：浏览长列表时不用回到顶部才能换标签 */
.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  margin-bottom: 26px;
  padding: 10px 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.search-box {
  position: relative;
  max-width: 420px;
  width: 100%;
}

/* 导航栏里的全局搜索：任何页面都能搜，回车跳到首页结果。
   靠右成组、紧挨「文章」链接，而不是贴着左侧 LOGO。 */
.site-header .search-box {
  flex: 1;
  min-width: 0;
  max-width: 300px;
  margin-left: auto;
  margin-right: -8px; /* 抵掉一部分容器间距，与导航组更贴合 */
}

/* 推右的活交给搜索框，导航组紧跟其后不再自动撑开 */
.site-header .nav {
  margin-left: 0;
  flex: none;
}

.site-header .search-box input {
  height: 38px;
  font-size: 14px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box input::placeholder {
  color: var(--text-faint);
}

/* 快捷键提示：聚焦后淡出，避免干扰输入 */
.kbd-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.15s;
}

.search-box input:focus + .kbd-hint,
.search-box input:not(:placeholder-shown) + .kbd-hint {
  opacity: 0;
}

/* 搜索框隐藏原生清除按钮，避免与快捷键提示重叠 */
.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* 标签行：所有标签一次铺开，放不下就换行。
   不做横向滚动——那样会把一部分标签藏起来，读者根本不知道还有哪些主题。 */
.tag-filter {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  gap: 10px 8px;
}

.tag-chip {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text-mid);
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 色点：与卡片封面渐变、卡片内小标签共用同一色相 */
.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 46%);
  flex: none;
}

.tag-chip.is-all .tag-dot {
  background: var(--text-faint);
}

[data-theme="dark"] .tag-dot {
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 68%);
}

.tag-chip:hover {
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 55%);
  color: var(--text-strong);
}

.tag-chip.is-all:hover {
  border-color: var(--accent);
}

.tag-chip.active {
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 46%);
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 46%);
  color: #fff;
}

.tag-chip.is-all.active {
  background: var(--accent);
  border-color: var(--accent);
}

.tag-chip.active .tag-dot {
  background: rgba(255, 255, 255, 0.9);
}

.tag-chip.active .count {
  opacity: 0.85;
}

.tag-chip .count {
  opacity: 0.6;
  margin-left: 0;
  font-size: 12px;
}

/* ---------- 首页：专题 + 最近更新 + 文章列表 ---------- */
.home-hero {
  padding-bottom: 34px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.18s;
}

.home-cta:hover {
  filter: brightness(1.08);
}

.home-cta.is-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-mid);
}

.home-cta.is-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  max-width: 640px;
}

.hero-stat {
  font-size: 12.5px;
  color: var(--text-soft);
}

.hero-stat b {
  margin-right: 3px;
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--text);
}

.home-main {
  padding-top: 10px;
}

/* 知识地图 */
.home-map {
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.section-note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-soft);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 18px;
  border: 1px solid var(--border);
  border-top: 3px solid hsl(var(--topic-h) 65% 55%);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.topic-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.topic-card h3 {
  margin: 10px 0 6px;
  font-size: 18px;
  line-height: 1.3;
  color: var(--text);
}

.topic-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-soft);
}

.topic-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}

.topic-keywords span {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-soft);
  font-size: 10.5px;
  color: var(--text-soft);
}

.topic-series {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: hsl(var(--topic-h) 45% 42%);
}

.topic-cta {
  margin-top: auto;
  padding-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
}

.topic-cta span {
  display: inline-block;
  transition: transform 0.18s;
}

.topic-card:hover .topic-cta span {
  transform: translateX(3px);
}

/* 最近更新：一行放完 */
.latest-strip-wrap {
  margin: 14px 0 34px;
}

.latest-strip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.latest-label {
  flex: none;
  padding-top: 1px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.latest-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
}

.latest-links a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-mid);
}

.latest-links a:hover {
  color: var(--accent-text);
}

.latest-links b {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
}

/* 文章库：主题分组 */
.topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.topic-head:first-child {
  margin-top: 0;
}

.topic-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.topic-head h3 span {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-faint);
}

.topic-more {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
}

.topic-more:hover {
  text-decoration: underline;
}

.topic-more-block {
  display: block;
  width: 100%;
  padding: 10px 0;
  text-align: center;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
}

.topic-more-block:hover {
  color: var(--accent-text);
  background: var(--surface-2);
}

.series-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 5px;
  background: var(--accent-soft);
  font-size: 10.5px;
  color: var(--accent-text);
}

#topics,
#latest,
#all-posts {
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.home-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 22px;
  margin-bottom: 54px;
  align-items: stretch;
}

.feature-card {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.series-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  background:
    radial-gradient(100% 80% at 20% 10%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(150deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
  color: #fff;
}

.series-cover .eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.series-cover h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.series-cover p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
}

.series-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 18px;
}

.series-flow span {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
}

.series-flow i {
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.series-cover-meta {
  margin-top: 16px !important;
  font-family: var(--font-mono);
  font-size: 10.5px !important;
  color: rgba(255, 255, 255, 0.66) !important;
}

.series-body {
  padding: 20px 22px;
  min-width: 0;
}

.series-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
}

.series-group h3 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.series-group h3 span {
  font-family: var(--font-mono);
  color: var(--accent-text);
}

.series-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.series-group li + li {
  margin-top: 4px;
}

.series-group a {
  display: flex;
  gap: 7px;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-mid);
}

.series-group a:hover {
  color: var(--accent-text);
}

.series-group a b {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-faint);
}

.latest-panel {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-head a {
  font-size: 12px;
  color: var(--accent-text);
}

.latest-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.latest-list li {
  padding: 13px 0;
  border-top: 1px dashed var(--border);
}

.latest-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.latest-list a {
  display: block;
}

.latest-date {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.latest-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.latest-list a:hover .latest-title {
  color: var(--accent-text);
}

.latest-list p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
}

.home-list {
  padding-top: 4px;
}

.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.list-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.list-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-soft);
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cat-filter-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-mid);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}

.cat-filter-chip span {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.cat-filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.cat-filter-chip.is-on {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.cat-filter-chip.is-on span {
  color: var(--accent-text);
}

.tag-filter-wrap {
  margin-bottom: 22px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.tag-filter-wrap summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
  list-style: none;
}

.tag-filter-wrap summary::-webkit-details-marker {
  display: none;
}

.tag-filter-wrap summary em {
  font-style: normal;
  color: var(--accent-text);
}

.tag-filter-wrap summary em::after {
  content: ' ▾';
  font-size: 10px;
  color: var(--text-faint);
}

.tag-filter-wrap[open] summary em::after {
  content: ' ▴';
}

.tag-filter-wrap[open] summary {
  margin-bottom: 10px;
}

.post-list {
  display: flex;
  flex-direction: column;
}

.month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 2px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.month-head:first-child {
  margin-top: 0;
}

.month-head span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
}

.month-head i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.post-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 92px;
  gap: 18px;
  padding: 17px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.post-row:hover .row-title a {
  color: var(--accent-text);
}

.row-date b {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.row-date span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.row-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
}

.row-title a {
  color: var(--text);
  transition: color 0.18s;
}

.row-desc {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 2px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
}

.load-more {
  display: block;
  margin: 26px auto 0;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-mid);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}

.load-more:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.load-more[hidden] {
  display: none;
}

@media (max-width: 1100px) {
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topic-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .home-feature {
    grid-template-columns: minmax(0, 1fr);
  }
  .feature-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .series-cover {
    min-height: 180px;
  }
}

@media (max-width: 720px) {
  .home-hero {
    padding-top: 38px;
  }
  .hero-stats {
    gap: 10px 18px;
  }
  .series-groups {
    grid-template-columns: minmax(0, 1fr);
  }
  .post-row {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    padding: 15px 0;
  }
  .row-date b {
    font-size: 13px;
  }
  .row-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding-top: 0;
  }
  .row-title {
    font-size: 16px;
  }
  .row-desc {
    -webkit-line-clamp: 3;
  }
  .list-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* ---------- 7. 文章卡片 ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.post-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
  animation: fadeUp 0.4s ease backwards;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-cover {
  height: 116px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 14px 16px;
  overflow: hidden;
}

/* 程序化生成的主题插画（SVG），配色由主标签色相派生 */
.cover-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* 键盘可达性：标签类按钮的焦点样式 */
.mini-tag:focus-visible,
.tag-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.28));
}

/* 分类标记：中性色，与可点标签明显区分，不可点 */
.cat-chip {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-faint);
  font-weight: 500;
  line-height: 1.5;
  cursor: default;
  white-space: nowrap;
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.card-title {
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title a {
  color: inherit;
}

/* 整卡可点：标题链接的伪元素撑满整张卡 */
.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card:hover .card-title {
  color: var(--accent-text);
}

.card-excerpt {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.7;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap; /* 元素多时整行换行，别把单个 span 压成竖排 */
  align-items: center;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--text-faint);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* 卡片上的「含交互演示」标记 */
.card-viz {
  color: var(--accent-text) !important;
  font-weight: 500;
}

/* 卡片上的「已更新」标记：与正文区分，提示文末有更新记录 */
.card-updated {
  color: #0a8a5a !important;
  font-weight: 500;
}

[data-theme="dark"] .card-updated {
  color: #4ade80 !important;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  /* 高于整卡热区，保证小标签自身可点 */
  position: relative;
  z-index: 2;
}

.mini-tag {
  font: inherit;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.16s;
  /* 与同一标签在封面 / 顶部胶囊里共用 --tag-h 色相 */
  color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 38%);
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 50% / 0.1);
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 45% / 0.25);
}

[data-theme="dark"] .mini-tag {
  color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 74%);
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 60% / 0.16);
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 58% / 0.3);
}

.mini-tag:hover {
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 50% / 0.2);
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 45% / 0.55);
}

[data-theme="dark"] .mini-tag:hover {
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 60% / 0.32);
}

.mini-tag.is-active {
  background: hsl(var(--tag-h, 250) var(--tag-s, 62%) 46%);
  border-color: hsl(var(--tag-h, 250) var(--tag-s, 62%) 46%);
  color: #fff;
}

/* 空状态的清除筛选按钮 */
.reset-filter {
  margin-top: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}

.reset-filter:hover {
  background: var(--accent);
  color: #fff;
}

/* 独立统计块（关于页复用，不带 hero 的上边框） */
.stat-box {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding: 22px 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-soft);
}

.empty-state .icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ---------- 8. 文章详情 ---------- */
.article-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

.article-wrap {
  max-width: 780px;
  margin: 0 auto;
}

.article-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 12px 0 18px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-soft);
}

.breadcrumb {
  font-size: 13.5px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a:hover {
  color: var(--accent-text);
}

/* 正文排版 */
.prose {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--text-mid);
}

.prose h2 {
  font-size: 24px;
  font-weight: 750;
  color: var(--text);
  margin: 44px 0 16px;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.prose h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  margin-right: 10px;
  vertical-align: -3px;
}

.prose h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.prose h4 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 26px 0 10px;
}

.prose p {
  margin: 0 0 18px;
}

.prose strong {
  color: var(--text);
  font-weight: 650;
}

.prose a {
  color: var(--accent-text);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: all 0.15s;
}

.prose a:hover {
  background: var(--accent-soft);
}

.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

.prose li::marker {
  color: var(--accent);
}

.prose blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-mid);
  font-size: 15.5px;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  color: var(--accent-text);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.prose pre {
  position: relative;
  background: #14161f !important;
  border: 1px solid #232838;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  overflow-x: auto;
  margin: 22px 0;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .prose pre {
  background: #0b0d14 !important;
  border-color: var(--border);
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: #d8dce8;
  font-size: 13.5px;
  line-height: 1.7;
}

.prose pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #6b7387;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prose .table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--surface);
}

/* 首列常是短标签（层 / 索引 / 规模），auto 布局会把它压成一字一行 */
.prose table th:first-child,
.prose table td:first-child {
  min-width: 6em;
}

.prose th {
  background: var(--surface-2);
  font-weight: 650;
  color: var(--text);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.prose td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose img {
  border-radius: var(--radius-sm);
  margin: 20px 0;
}

.prose .task-item {
  list-style: none;
  margin-left: -18px;
}

/* 文章底部 */
.article-footer {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

/* ---------- 8.5 阅读进度条 & 详情页布局 ---------- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}

.article-layout {
  display: grid;
  /* minmax(0,1fr) 而非 1fr：防止代码块 / 可视化组件把列撑出视口 */
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  padding-bottom: 20px;
}

/* 左侧文章树：桌面显示，窄屏用折叠面板 */
.article-nav {
  display: none;
}

.article-nav-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article-nav-group {
  margin: 0;
}

.article-nav-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}

.article-nav-group summary span::before {
  content: '▸';
  display: inline-block;
  width: 12px;
  color: var(--text-faint);
}

.article-nav-group[open] summary span::before {
  content: '▾';
}

.article-nav-group summary::-webkit-details-marker {
  display: none;
}

.article-nav-group summary:hover {
  color: var(--text);
}

.article-nav-group[open] summary {
  color: var(--text);
}

.article-nav-group summary i {
  flex: none;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.article-nav-links {
  display: flex;
  flex-direction: column;
  margin-left: 2px;
  border-left: 2px solid var(--border);
}

.article-nav-series + .article-nav-series {
  margin-top: 6px;
}

.article-nav-series-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 2px 12px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.article-nav-series-head i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.article-nav-stage {
  font-size: 10px;
  color: var(--text-faint);
}

.article-nav-stage > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 2px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.article-nav-stage > summary::-webkit-details-marker {
  display: none;
}

.article-nav-stage > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 3.5px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform 0.15s ease;
}

.article-nav-stage[open] > summary::before {
  transform: rotate(90deg);
}

.article-nav-stage > summary i {
  margin-left: auto;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.article-nav-stage-body .article-nav-link {
  padding-left: 22px;
}

.article-nav-link {
  display: block;
  padding: 6px 8px 6px 12px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.article-nav-link:hover {
  color: var(--text);
}

.article-nav-link.is-current {
  color: var(--accent-text);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-weight: 600;
}

/* 窄屏折叠目录 */
.article-nav-mobile {
  margin: 0 0 26px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.article-nav-mobile summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
}

.article-nav-mobile[open] summary {
  margin-bottom: 8px;
}

.article-nav-mobile .article-nav-group summary {
  padding: 7px 2px;
}

.toc-wrap {
  display: none;
}

.article-back {
  display: inline-block;
  font-size: 13.5px;
  color: var(--text-soft);
}

.article-back:hover {
  color: var(--accent-text);
}

/* ---------- 文章页 UI：对齐文档站的左右布局 ---------- */
body.article-page {
  background: var(--surface);
}

.article-page .article-header {
  padding: 28px 0 22px;
  border-bottom: 0;
  margin-bottom: 28px;
}

.article-page .article-title {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.4vw, 34px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.article-page .article-meta {
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.article-page .card-tags {
  margin-top: 10px;
}

.article-page .prose {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-mid);
}

.article-page .prose h2 {
  margin: 42px 0 14px;
  font-size: 25px;
  font-weight: 700;
}

.article-page .prose h2::before {
  display: none;
}

.article-page .prose h3 {
  margin: 30px 0 10px;
  font-size: 19px;
}

body.article-page .article-nav-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.article-page .article-nav-link.is-current {
  background: none !important;
  border-radius: 0;
}

.article-page .article-footer {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.article-page .toc-title {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

@media (min-width: 1080px) {
  .article-page .article-nav {
    border-right: 1px solid var(--border);
    padding-right: 20px;
  }
  .article-page .article-nav-body {
    margin-top: 0;
  }
  .article-page .article-main {
    max-width: 720px;
  }
  .article-page .article-nav-group summary {
    font-size: 12px;
    color: var(--text-faint);
  }
  .article-page .article-nav-link {
    font-size: 12.5px;
  }
  .article-page .article-nav-link.is-current {
    background: transparent;
    color: var(--accent-text);
    border-left-color: var(--accent);
  }
  .article-page .article-nav-series-head {
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--text-faint);
  }
}

@media (max-width: 1079px) {
  .article-page .article-nav-mobile {
    margin: 0 0 26px;
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
  }
  .article-page .article-nav-mobile summary {
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--text-soft);
  }
}

@media (min-width: 1080px) {
  .article-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }
  .article-nav {
    display: block;
    /* sticky 挂在 grid 子项本身，父级高度由正文撑开 */
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 10px;
  }
  .article-nav-mobile {
    display: none;
  }
  .article-main {
    max-width: 780px;
  }
}

@media (min-width: 1240px) {
  .article-layout {
    grid-template-columns: 220px minmax(0, 1fr) 190px;
    gap: 28px;
  }
  .toc-wrap {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 56px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 8px;
  }
}

.toc {
  padding-right: 2px;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.toc nav {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--border);
}

.toc-link {
  padding: 6px 0 6px 12px;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.5;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: all 0.18s;
}

.toc-link:hover {
  color: var(--text);
}

.toc-link.toc-h3 {
  padding-left: 22px;
  font-size: 13px;
}

.toc-link.active {
  color: var(--accent-text);
  border-left-color: var(--accent);
  font-weight: 600;
}


/* ---------- 9. 关于 / 个人主页 ---------- */
.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  padding: 36px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(110% 130% at 100% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 56%),
    var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.about-intro {
  display: flex;
  align-items: center;
  gap: 22px;
}

.about-intro .avatar {
  width: 80px;
  height: 80px;
  font-size: 30px;
}

.about-copy {
  min-width: 0;
}

.about-intro h1 {
  margin: 0 0 6px;
  font-size: clamp(32px, 4.6vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  word-break: break-word;
}

.about-role {
  margin: 0 0 18px;
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
}

.about-lede {
  max-width: 860px;
  margin: 0;
  color: var(--text-mid);
  font-size: 16px;
  line-height: 1.85;
}

.about-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}

.about-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  margin: 4px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.about-facts > div {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-top: 0;
  font-size: 13px;
}

.about-facts > div:first-child {
  padding-left: 0;
}

.about-facts > div + div {
  border-left: 1px solid var(--border);
}

.about-facts dt {
  flex-shrink: 0;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.about-facts dd {
  margin: 0;
  color: var(--text-mid);
  text-align: left;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  word-break: normal;
}

.about-facts a {
  color: var(--accent-text);
}

.about-facts a:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-mid);
  font-weight: 500;
  transition: all 0.2s;
}

.social-links a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  transform: translateY(-1px);
}

/* 板块标题 */
.about-section {
  margin-top: 52px;
}

.about-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.about-section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.about-section-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

/* 项目列表（截图 + 说明） */
.work-list {
  display: grid;
  gap: 16px;
}

.work-item {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}

.work-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.work-media {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.work-media img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  max-height: 230px;
  object-fit: cover;
  object-position: top;
}

.work-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2px 0;
}

.work-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.work-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.work-status.done {
  background: var(--bg-soft);
  color: var(--text-soft);
}

.work-body h3 {
  margin: 6px 0 7px;
  font-size: 18.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.work-body h3 a:hover {
  color: var(--accent-text);
}

.work-body p {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.75;
}

.work-body .skill-tags {
  margin-bottom: 14px;
}

/* 更早的项目：横屏截图占一列，说明在右 */
.older-list .work-item {
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
}

.older-list .work-media {
  align-self: start;
}

.older-list .work-media img {
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 16 / 10;
  object-position: center;
}

.older-list .work-media-wide img {
  object-position: left center;
}

/* 同期的服务端：用紧凑列表，避免再堆一排卡片 */
.older-services {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.older-services-title {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.older-service-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.older-service-list li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.older-service-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.older-service-list li:last-child {
  padding-bottom: 0;
}

.older-service-list strong {
  font-size: 14px;
}

.older-service-list span {
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.65;
}

/* 能力：两列卡片 */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.about-cell {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.about-cell:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.about-cell h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.about-cell p {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

.skill-tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.skill-tag {
  padding: 4px 11px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}

.skill-tag.plain {
  background: var(--bg-soft);
  color: var(--text-mid);
  border-color: var(--border);
}

.card-more {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-text);
}

@media (max-width: 900px) {
  .about-hero {
    gap: 24px;
    padding: 30px;
  }

  .about-facts {
    grid-template-columns: 1fr;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .about-facts > div {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0 0;
    border-top: 1px solid var(--border);
  }

  .about-facts > div + div {
    border-left: 0;
    padding-left: 0;
  }

  .about-facts dd {
    text-align: right;
  }
}

@media (max-width: 720px) {
  .about-hero {
    padding: 24px 20px;
  }

  .about-intro {
    align-items: flex-start;
    gap: 14px;
  }

  .about-intro .avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  .about-lede {
    font-size: 15px;
  }

  .work-item,
  .older-list .work-item {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .work-media img {
    height: 220px;
    min-height: 0;
  }

  .older-list .work-media img {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .older-service-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-section {
    margin-top: 40px;
  }

  .about-section-head {
    display: block;
  }

  .about-section-head p {
    margin-top: 6px;
  }

  .about-card {
    padding: 20px;
  }

  .about-facts {
    flex-basis: 100%;
  }
}

/* ---------- 9.1 项目展示页 ---------- */
.proj-hero {
  padding: 40px 0 4px;
}

.proj-kicker {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-text);
  margin-bottom: 10px;
}

.proj-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.proj-lead {
  margin: 0 0 18px;
  max-width: 760px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-mid);
}

.proj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.proj-meta span {
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
}

/* 商店入口：图标 + 文字，压在 meta 下面，不跟标题抢注意力 */
.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}

.store-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.store-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.store-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.store-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}

.store-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.store-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.store-copy small {
  color: var(--text-faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-copy strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

.proj-links-note {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.6;
}

/* 截图廊：竖屏手机截图，等高排列，窄屏自动换行 */
.proj-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 22px 0 6px;
}

.proj-shot {
  margin: 0;
}

.proj-shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 18;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.proj-shot figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-soft);
  text-align: center;
}

.proj-shot figcaption b {
  display: block;
  color: var(--text-mid);
  font-weight: 600;
}

/* 横屏截图：桌面端作品用，按比例裁切，避免把界面拉变形 */
.proj-gallery.landscape {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.proj-shot.landscape img {
  aspect-ratio: 16 / 10;
  object-position: center;
  border-radius: 12px;
}

.proj-shot.landscape figcaption {
  text-align: left;
}

/* 超宽截图排成一列，避免在双列里把左右界面裁掉 */
.proj-gallery.landscape.stacked {
  grid-template-columns: 1fr;
}

.proj-shot.landscape.stacked img {
  aspect-ratio: auto;
  object-fit: contain;
  background: var(--surface-2);
}

.proj-shot.compact {
  max-width: 760px;
  justify-self: center;
}

/* 看板只取顶部统计区，避免生成图占掉太多版面 */
.proj-shot.landscape.stacked.crop-top img {
  aspect-ratio: 16 / 5;
  object-fit: cover;
  object-position: top;
}

@media (max-width: 720px) {
  .proj-shot.compact {
    max-width: none;
  }

  .proj-shot.landscape.stacked.crop-top img {
    aspect-ratio: auto;
  }
}

/* 功能清单：一行一个，粗句 + 一句说明 */
.feat {
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.feat li {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.feat li:last-child {
  border-bottom: 0;
}

.feat strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
}

.feat span {
  display: block;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-mid);
}

/* 项目详情：分节更像作品页，功能条目改成可扫读的卡片 */
.proj-prose {
  font-size: 16px;
}

.proj-prose h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 52px 0 20px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0;
}

.proj-prose h2:first-of-type {
  margin-top: 36px;
}

.proj-prose h2::before {
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  margin: 0;
  vertical-align: 0;
}

.proj-prose h2::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-left: 2px;
  background: var(--border);
}

.proj-prose .proj-gallery {
  margin: 18px 0 4px;
}

.proj-prose .proj-gallery + h2 {
  margin-top: 50px;
}

.proj-prose .feat {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}

.proj-prose .feat li {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.proj-prose .feat li:last-child {
  border-bottom: 1px solid var(--border);
}

.proj-prose .feat strong {
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.45;
}

.proj-prose .feat span {
  font-size: 13.5px;
  line-height: 1.75;
}

@media (max-width: 720px) {
  .proj-prose h2 {
    margin-top: 42px;
    font-size: 20px;
  }

  .proj-prose h2:first-of-type {
    margin-top: 32px;
  }

  .proj-prose .proj-gallery + h2 {
    margin-top: 42px;
  }

  .proj-prose .feat {
    grid-template-columns: 1fr;
  }

  .proj-prose .feat li {
    padding: 16px 18px;
  }
}

@media (max-width: 520px) {
  .proj-prose .proj-gallery {
    grid-template-columns: 1fr;
  }
}

/* ---------- 10. 页脚 ---------- */
.site-footer {
  margin-top: 72px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-soft);
}

/* ---------- 11. 回到顶部 ---------- */
#backTop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  color: var(--text-mid);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s;
  z-index: 90;
}

#backTop.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#backTop:hover {
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ---------- 12. 文章内嵌可视化组件 ---------- */
/* 文章里写 <figure data-viz="sampling">，样式与交互都在这里收口 */
.prose figure[data-viz] {
  margin: 30px 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.viz-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 14px;
}

.viz-head strong {
  font-weight: 600;
  color: var(--text);
}

.viz-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.viz-body {
  padding: 18px;
}

.viz-caption {
  padding: 0 18px 14px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.7;
}

/* 控制区 ---------- */
.viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  margin-bottom: 16px;
}

.viz-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-mid);
}

.viz-field span {
  white-space: nowrap;
}

.viz-field input[type="range"] {
  width: 132px;
  accent-color: var(--accent);
}

.viz-field output {
  min-width: 38px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-text);
}

.viz-field select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.viz-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

.viz-btn:hover {
  filter: brightness(1.08);
}

.viz-btn:active {
  transform: scale(0.97);
}

/* 输入 ---------- */
.viz-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.viz-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* 概率条 ---------- */
.viz-prompt {
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--text-mid);
}

.viz-prompt code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
}

.viz-q {
  color: var(--accent-text);
  font-weight: 700;
}

.viz-bars {
  display: grid;
  gap: 7px;
}

.viz-bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.viz-bar-label {
  color: var(--text-mid);
  text-align: right;
  white-space: nowrap;
}

.viz-bar-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.viz-bar-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.viz-bar-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
  text-align: right;
}

.viz-bar-row.is-dropped {
  opacity: 0.42;
}

.viz-bar-row.is-dropped .viz-bar-label {
  text-decoration: line-through;
}

/* token 色块 ---------- */
.viz-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 14px 0 4px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 44px;
}

.viz-tk {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  border: 1px solid transparent;
  animation: vizPop 0.28s ease-out both;
  cursor: default;
}

.viz-tk:hover {
  filter: brightness(1.12);
}

.viz-tk-zh-word {
  background: hsl(210 70% 55% / 0.16);
  border-color: hsl(210 70% 55% / 0.35);
}

.viz-tk-zh-char {
  background: hsl(210 40% 55% / 0.1);
  border-color: hsl(210 40% 55% / 0.22);
}

.viz-tk-en-sub {
  background: hsl(150 55% 45% / 0.16);
  border-color: hsl(150 55% 45% / 0.34);
}

.viz-tk-en-char {
  background: hsl(35 80% 55% / 0.14);
  border-color: hsl(35 80% 55% / 0.32);
}

.viz-tk-num {
  background: hsl(280 55% 60% / 0.14);
  border-color: hsl(280 55% 60% / 0.32);
}

.viz-tk-punct {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}

@keyframes vizPop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 采样结果托盘 ---------- */
.viz-tray:not(:empty) {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.viz-tray-title {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.viz-tray-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.viz-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  animation: vizPop 0.3s ease-out both;
}

.viz-chip b {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
}

/* 统计读数 ---------- */
.viz-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.viz-stat {
  flex: 1 1 120px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.viz-stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent-text);
  line-height: 1.4;
}

.viz-stat span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-soft);
}

.viz-hint {
  flex: 1 1 100%;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-soft);
}

.viz-hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* 因果掩码矩阵 ---------- */
.viz-matrix {
  display: grid;
  grid-template-columns: repeat(var(--n, 8), 1fr);
  gap: 3px;
  max-width: 380px;
  margin: 4px auto 0;
}

.viz-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  animation: vizPop 0.25s ease-out both;
  transition: transform 0.15s, box-shadow 0.15s;
}

.viz-cell.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.viz-cell.off {
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.viz-cell.is-hot {
  transform: scale(1.22);
  box-shadow: 0 0 0 2px var(--accent-soft);
  z-index: 1;
}

/* 流程图（pipeline）：垂直链路，每步带真实中间数据 ---------- */
.viz-flow {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.viz-step {
  position: relative;
  padding: 0 0 20px 40px;
}

/* 连接线 + 箭头，最后一步不需要 */
.viz-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.viz-step::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 4px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--border);
}

.viz-step:last-child::before,
.viz-step:last-child::after {
  display: none;
}

.viz-step-no {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.viz-step-title b {
  display: block;
  font-size: 14.5px;
  line-height: 1.5;
}

.viz-step-title span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-soft);
}

.viz-step-body {
  margin-top: 9px;
}

.viz-step-note {
  margin: 9px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-soft);
}

.viz-step-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* 步骤里的数值 chips */
.viz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.viz-chip-sm {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
  transition: opacity 0.2s;
}

.viz-chip-sm em {
  font-style: normal;
}

.viz-chip-sm b {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-soft);
}

/* 被 top-p 砍掉的长尾 */
.viz-chip-sm.is-off {
  opacity: 0.4;
  background: var(--bg-soft);
  border-color: var(--border);
  text-decoration: line-through;
}

/* 抽签命中的那个 */
.viz-chip-sm.is-hit {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 55%, transparent);
}

/* 抽签数轴：段长 = 概率，指针 = 随机数 r */
.viz-ruler {
  position: relative;
  display: flex;
  height: 32px;
  margin: 20px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.viz-seg {
  height: 100%;
}

.viz-seg:first-child {
  border-radius: 7px 0 0 7px;
}

.viz-seg:last-child {
  border-radius: 0 7px 7px 0;
}

.viz-needle {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  box-shadow: 0 0 0 1px var(--bg);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.viz-needle::after {
  content: "r";
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
}

.viz-out-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.viz-out-text code {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 14px;
}

.viz-out-new {
  padding: 6px 11px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: var(--c);
  animation: vizPop 0.3s ease-out both;
}

/* 本轮输出 */
.viz-final {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--accent-soft);
}

.viz-final-label {
  font-size: 11.5px;
  color: var(--text-soft);
}

.viz-final code {
  font-family: var(--font-mono);
  font-size: 15px;
}

.viz-final b {
  color: var(--c);
}

/* 结构图（tfblock）：SVG 画的 Transformer Block ---------- */
.viz-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viz-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}

.viz-btn:hover {
  color: var(--text);
  border-color: var(--accent-soft);
}

.viz-btn.is-on {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
  font-weight: 600;
}

.vzb-stage {
  margin-top: 16px;
}

.vzb-svg {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  margin: 0 auto;
}

.vzb-svg text {
  font-family: var(--font-sans);
  font-size: 13px;
  fill: var(--text);
}

.vzb-arrowhead {
  fill: var(--text-soft);
}

.vzb-line,
.vzb-res {
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.5;
}

/* 残差通路用虚线，和主干区分开 */
.vzb-res {
  stroke: var(--accent);
  stroke-dasharray: 5 3;
}

.vzb-res-label {
  font-size: 11px !important;
  fill: var(--accent-text) !important;
}

.vzb-node rect {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: all 0.18s;
}

.vzb-node text {
  pointer-events: none;
}

.vzb-node {
  cursor: pointer;
}

.vzb-node:focus {
  outline: none;
}

/* 归一化：次级色 */
.n-norm rect {
  fill: color-mix(in srgb, var(--accent-2) 12%, transparent);
  stroke: color-mix(in srgb, var(--accent-2) 45%, transparent);
}

/* 核心计算子层：主色 */
.n-sub rect {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: var(--accent);
}

/* 加法：虚线边框，对应"通路"的语义 */
.n-add rect {
  fill: var(--surface-2);
  stroke-dasharray: 5 3;
}

/* 输入输出：中性 */
.n-io rect {
  fill: var(--surface-2);
}

.vzb-node:hover rect {
  stroke: var(--accent);
  stroke-width: 2;
}

.vzb-node.is-active rect {
  stroke: var(--accent);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 0 3px var(--accent-soft));
}

.vzb-node.is-active text {
  font-weight: 600;
}

.vzb-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.vzb-note-head {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}

.vzb-note .viz-hint {
  margin: 0;
}

.vzb-note .viz-hint + .viz-hint {
  margin-top: 6px;
}

/* 切片演示 ---------- */
.viz-chunks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viz-chunk {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.viz-chunk-no {
  flex: none;
  width: 52px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-text);
}

.viz-chunk-no i {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-soft);
}

.viz-chunk-txt {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mid);
  word-break: break-all;
}

/* 与上一块重叠的部分 */
.viz-ov {
  font-style: normal;
  border-radius: 3px;
  padding: 1px 0;
  color: var(--accent-text);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* 混合检索排名 ---------- */
.viz-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.viz-col-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.viz-col.is-main .viz-col-title {
  color: var(--accent-text);
}

.viz-rank {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: r;
}

.viz-rank-item {
  position: relative;
  padding: 8px 10px 8px 26px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-mid);
  counter-increment: r;
}

.viz-rank-item::before {
  content: counter(r);
  position: absolute;
  left: 8px;
  top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
}

.viz-rank-item i {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-soft);
}

.viz-col.is-main .viz-rank-item {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--text);
}

.viz-col.is-main .viz-rank-item i {
  color: var(--accent-text);
}

/* ReAct 演示日志 ---------- */
.viz-progress {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
}

.viz-log {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
}

.viz-log-line {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mid);
  border-bottom: 1px dashed var(--border);
}

.viz-log-line:last-child {
  border-bottom: 0;
}

.viz-log-k {
  flex: none;
  width: 34px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.viz-log-line.k-action .viz-log-k,
.viz-log-line.k-action {
  color: var(--accent-text);
}

.viz-log-line.k-finish .viz-log-k {
  color: var(--accent-text);
}

/* 显存堆叠条 ---------- */
.viz-stack-bar {
  position: relative;
  display: flex;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.viz-stack-bar i {
  height: 100%;
}

/* 超出显卡容量的那一段 */
.viz-stack-over {
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, #e5484d 55%, transparent),
    color-mix(in srgb, #e5484d 55%, transparent) 5px,
    transparent 5px,
    transparent 10px
  );
}

.viz-stack-axis {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-soft);
}

.viz-stack-gpu {
  position: absolute;
  transform: translateX(-50%);
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
}

.viz-stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.viz-stack-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.viz-stack-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.viz-stack-legend b {
  font-family: var(--font-mono);
  color: var(--text);
}

/* 决策向导 ---------- */
.viz-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.viz-pick-label {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.viz-verdict {
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid transparent;
}

.viz-verdict-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.viz-verdict-main span {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft);
}

.viz-verdict-main b {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  color: var(--accent-text);
}

.viz-verdict .viz-hint {
  margin: 10px 0 0;
  color: var(--text);
}

/* 统计卡片的好 / 坏状态 */
.viz-stat.is-good b {
  color: #30a46c;
}

.viz-stat.is-bad b {
  color: #e5484d;
}

[data-theme="dark"] .viz-stat.is-good b {
  color: #4cc38a;
}

[data-theme="dark"] .viz-stat.is-bad b {
  color: #ff6369;
}

/* 尊重系统的「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  .viz-tk,
  .viz-chip,
  .viz-chip-sm,
  .viz-out-new,
  .viz-cell {
    animation: none;
  }
  .viz-bar-track i,
  .viz-needle {
    transition: none;
  }
}

/* LoRA 参数账：读数里的长文本提示 ---------- */
.viz-readout .viz-hint {
  flex: 1 1 100%;
}

/* 相似度度量（cosine） ---------- */
.vzc-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.vzc-stage {
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.vzc-stage svg {
  display: block;
  width: 100%;
  height: auto;
}

.vzc-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.vzc-lab {
  font-family: var(--font-mono);
  font-size: 10.5px;
  fill: var(--text-soft);
}

.vzc-lab-q {
  font-weight: 600;
  fill: var(--accent-text);
}

.vzc-q {
  stroke: var(--accent);
}

.vzc-q.is-head {
  stroke: none;
  fill: var(--accent);
}

.vzc-c1 { stroke: #3b82f6; }
.vzc-c1.is-head { stroke: none; fill: #3b82f6; }
.vzc-c2 { stroke: #f59e0b; }
.vzc-c2.is-head { stroke: none; fill: #f59e0b; }
.vzc-c3 { stroke: #8b5cf6; }
.vzc-c3.is-head { stroke: none; fill: #8b5cf6; }

.vzc-c1-bar { background: #3b82f6; }
.vzc-c2-bar { background: #f59e0b; }
.vzc-c3-bar { background: #8b5cf6; }

[data-theme="dark"] .vzc-c1 { stroke: #60a5fa; }
[data-theme="dark"] .vzc-c1.is-head { fill: #60a5fa; }
[data-theme="dark"] .vzc-c2 { stroke: #fbbf24; }
[data-theme="dark"] .vzc-c2.is-head { fill: #fbbf24; }
[data-theme="dark"] .vzc-c3 { stroke: #a78bfa; }
[data-theme="dark"] .vzc-c3.is-head { fill: #a78bfa; }

.viz-bar-row.is-top .viz-bar-label {
  color: var(--text);
  font-weight: 600;
}

.vzc-note-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.vzc-note-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text);
  border-top: 1px dashed var(--border);
}

.vzc-note-row b {
  flex: none;
  width: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-text);
}

.vzc-note-row span {
  font-size: 11.5px;
  color: var(--text-soft);
}

/* 评测一致性（judge） ---------- */
.vzj-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 4px;
}

.vzj-tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.vzj-tb th,
.vzj-tb td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: center;
}

.vzj-tb thead th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
}

.vzj-tb tbody th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  white-space: nowrap;
}

.vzj-tb td {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
}

.vzj-tp { background: color-mix(in srgb, #16a34a 16%, transparent); }
.vzj-tn { background: color-mix(in srgb, #16a34a 10%, transparent); }
.vzj-fp { background: color-mix(in srgb, #ef4444 16%, transparent); }
.vzj-fn { background: color-mix(in srgb, #ef4444 16%, transparent); }

.vzj-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--text-soft);
  border-top: 1px dashed var(--border);
}

.vzj-row b {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text);
}

.vzj-row.is-key b {
  font-size: 16px;
  color: var(--accent-text);
}

.vzj-side .viz-hint,
.vzj-matrix .viz-hint {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .vzc-wrap,
  .vzj-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- RAG 入库系列组件 ---------- */
.vzr-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.vzr-stage {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-mid);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}

.vzr-stage b {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.vzr-stage span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
}

.vzr-stage:hover {
  border-color: var(--border-strong);
}

.vzr-stage.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.vzr-panel {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.vzr-panel-head {
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--accent-text);
}

.vzr-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
}

.vzr-row span {
  color: var(--text-soft);
}

.vzr-row p {
  margin: 0;
  color: var(--text-mid);
}

.vzr-gain {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-soft);
}

.vzp-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.vzp-page {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 11px;
}

.vzp-page.is-ocr {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.vzp-page-no {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-soft);
}

.vzp-page-type {
  margin: 2px 0;
  font-weight: 600;
  color: var(--text);
}

.vzp-page-meta {
  color: var(--text-soft);
  line-height: 1.5;
}

.vzp-page-route {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent-text);
}

.vzp-page-warn {
  margin-top: 4px;
  font-size: 10.5px;
  color: #e5484d;
}

.vzh-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vzh-group {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.vzh-group-title {
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.vzh-group .viz-chunk {
  margin-top: 5px;
}

.vzh-child-card.is-parent {
  background: var(--accent-soft);
  border-color: transparent;
}

.vzh-child-card.is-parent .viz-chunk-no {
  color: var(--accent-text);
}

.vzs-stage {
  margin: 8px 0 12px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.vzs-svg {
  display: block;
  width: 100%;
  height: auto;
}

.vzs-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.vzs-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.vzs-th-line {
  stroke: #e5484d;
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
}

.vzs-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.vzs-dot.is-cut {
  fill: #e5484d;
  stroke: #e5484d;
}

.vzs-lab {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-soft);
}

.vza-stage {
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.vza-svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.vza-edge {
  stroke: var(--border-strong);
  stroke-width: 0.7;
  opacity: 0.7;
}

.vza-dot {
  fill: var(--text-faint);
}

.vza-dot.is-res {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1;
}

.vza-dot.is-miss {
  fill: #e5484d;
}

.vza-q {
  stroke: var(--accent-text);
  stroke-width: 1.6;
}

.vza-lab {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-soft);
}

.vzf-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.vzf-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 62px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}

.vzf-row b {
  display: block;
  color: var(--text);
}

.vzf-row span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-soft);
}

.vzf-row code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mid);
}

.vzf-row em {
  font-style: normal;
  font-size: 11px;
  text-align: right;
  color: var(--text-soft);
}

.vzf-row.is-changed {
  border-color: color-mix(in srgb, #e5484d 45%, transparent);
}

.vzf-row.is-changed em {
  color: #e5484d;
}

.vzrr-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vzsm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.vzsm-store {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.vzsm-store.is-new {
  border-color: color-mix(in srgb, #30a46c 45%, transparent);
  background: color-mix(in srgb, #30a46c 8%, var(--surface-2));
}

.vzsm-store.is-missing {
  border-color: color-mix(in srgb, #e5484d 50%, transparent);
  background: color-mix(in srgb, #e5484d 8%, var(--surface-2));
}

.vzsm-store.is-old {
  border-color: color-mix(in srgb, #f59e0b 55%, transparent);
  background: color-mix(in srgb, #f59e0b 9%, var(--surface-2));
}

.vzsm-store.is-gone {
  opacity: 0.55;
}

.vzsm-store-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.vzsm-store-desc {
  margin: 2px 0 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-soft);
}

.vzsm-store-state {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mid);
}

@media (max-width: 720px) {
  .vzr-stages,
  .vzp-grid,
  .vzsm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vzrr-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .vzf-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .vzf-row em {
    text-align: left;
  }
}

/* ---------- 首页：文档站布局（参考 opencode.ai/v2/docs） ---------- */
body.home-docs {
  --font-head: "JetBrains Mono", Consolas, "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", sans-serif;
  background: var(--surface);
}

.docs-shell {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 32px;
}

/* 三栏：左目录 / 正文 / 右目录 */
.docs-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 36px 0 64px;
}

.docs-side {
  display: none;
}

.docs-content {
  min-width: 0;
}

.docs-prose {
  max-width: 760px;
}

/* 左侧目录 */
.docs-side-link {
  display: block;
  padding: 4px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.docs-side-link:hover {
  color: var(--text);
}

.docs-side-link.is-active {
  color: var(--text);
  font-weight: 600;
}

.docs-side-group {
  margin-top: 26px;
}

.docs-side-group > summary,
.docs-side-series > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.docs-side-group > summary::-webkit-details-marker,
.docs-side-series > summary::-webkit-details-marker {
  display: none;
}

.docs-side-group > summary {
  padding: 2px 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

.docs-side-group > summary:hover,
.docs-side-series > summary:hover {
  color: var(--text-mid);
}

.docs-side-group[open] > summary {
  margin-bottom: 6px;
}

.docs-side-group > summary::before,
.docs-side-series > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform 0.15s ease;
}

.docs-side-group[open] > summary::before,
.docs-side-series[open] > summary::before {
  transform: rotate(90deg);
}

.docs-side-group > summary i,
.docs-side-series > summary i {
  margin-left: auto;
  font-style: normal;
  font-family: var(--font-head);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-faint);
}

.docs-side-series {
  margin: 8px 0 2px 9px;
}

.docs-side-series > summary {
  padding: 2px 0;
  font-size: 10.5px;
  color: var(--text-faint);
}

.docs-side-series[open] > summary {
  margin-bottom: 2px;
}

.docs-side-series .docs-side-link {
  padding-left: 13px;
}

.docs-side-stage {
  font-size: 10px;
  color: var(--text-faint);
}

.docs-side-stage > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0 2px 13px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.docs-side-stage > summary::-webkit-details-marker {
  display: none;
}

.docs-side-stage > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 3.5px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform 0.15s ease;
}

.docs-side-stage[open] > summary::before {
  transform: rotate(90deg);
}

.docs-side-stage > summary i {
  margin-left: auto;
  font-style: normal;
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 500;
  color: var(--text-faint);
}

.docs-side-stage-body .docs-side-link {
  padding-left: 22px;
}

/* 窄屏目录抽屉 */
.docs-side-mobile {
  margin: 0 0 30px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.docs-side-mobile summary {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  cursor: pointer;
}

.docs-side-mobile[open] summary {
  margin-bottom: 12px;
}

.docs-side-mobile .docs-side-group {
  margin-top: 18px;
}

/* 正文排版：标题用等宽，正文留白接近文档站 */
.docs-prose h1 {
  margin: 0 0 32px;
  font-family: var(--font-head);
  font-size: clamp(30px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
}

.docs-lede {
  margin: 0 0 10px;
  max-width: 680px;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
}

.docs-prose h2 {
  margin: 48px 0 14px;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.docs-prose h3 {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}

.docs-prose p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-mid);
}

.docs-list {
  margin: 0 0 8px;
  padding-left: 22px;
}

.docs-list li {
  margin: 0 0 7px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-mid);
}

.docs-list li::marker {
  color: var(--text-faint);
}

.docs-list a {
  color: var(--accent-text);
}

.docs-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.docs-item-desc {
  margin-left: 8px;
  font-size: 14px;
  color: var(--text-soft);
}

.docs-item-meta {
  margin-left: 10px;
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-faint);
}

.docs-list-tight li {
  margin-bottom: 5px;
}

/* 主题分组 */
.docs-topic {
  margin-top: 28px;
}

.docs-topic:first-of-type {
  margin-top: 18px;
}

.docs-series-block {
  margin-top: 22px;
}

.docs-series-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.docs-series-title span,
.docs-stage-title span {
  margin-left: 6px;
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
}

.docs-stage-block {
  margin-top: 14px;
}

.docs-stage-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.docs-prose p.docs-topic-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-soft);
}

.docs-prose p.docs-count {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-soft);
}

/* 搜索状态条 */
.docs-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-mid);
}

.docs-filter[hidden] {
  display: none;
}

.docs-filter button {
  padding: 0;
  color: var(--accent-text);
  font-size: 12.5px;
}

.docs-filter button:hover {
  text-decoration: underline;
}

.docs-empty {
  margin: 12px 0;
  font-size: 14px;
  color: var(--text-soft);
}

.docs-empty[hidden] {
  display: none;
}

/* 右侧本页目录 */
.docs-toc {
  display: none;
}

.docs-toc-label {
  margin-bottom: 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
}

.docs-toc nav {
  display: flex;
  flex-direction: column;
}

.docs-toc a {
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}

.docs-toc a:hover,
.docs-toc a.is-active {
  color: var(--text);
}

/* 页脚 */
.docs-foot {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.docs-foot a {
  color: var(--accent-text);
}

.docs-footer {
  margin-top: 0;
  padding: 0;
}

.docs-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0 32px;
  font-size: 12px;
  color: var(--text-faint);
}

.docs-foot-note {
  font-family: var(--font-head);
  font-size: 11px;
}

@media (min-width: 900px) {
  .docs-grid {
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 48px;
  }

  .docs-side {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 36px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 24px 32px 0;
  }

  .docs-grid::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 220px;
    width: 1px;
    background: var(--border);
  }

  .docs-side-mobile {
    display: none;
  }
}

@media (min-width: 1200px) {
  .docs-grid {
    grid-template-columns: 220px minmax(0, 1fr) 190px;
    column-gap: 56px;
  }

  .docs-toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 36px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 64px);
    overflow-y: auto;
  }
}

@media (max-width: 720px) {
  .docs-shell {
    padding: 0 20px;
  }


  .docs-grid {
    padding-top: 24px;
  }

  .docs-prose h1 {
    margin-bottom: 24px;
    font-size: 28px;
  }

  .docs-prose h2 {
    margin-top: 40px;
    font-size: 21px;
  }

  .docs-list {
    padding-left: 18px;
  }

  .docs-item-desc,
  .docs-item-meta {
    display: block;
    margin: 2px 0 0;
  }
}

/* ---------- 13. 响应式 ---------- */
@media (max-width: 720px) {
  .container {
    padding: 0 16px;
  }
  .nav a {
    padding: 6px 10px;
    font-size: 14px;
  }
  .brand span.brand-text {
    display: none;
  }
  .hero {
    padding: 36px 0 20px;
  }
  /* 窄屏：搜索独占一行，标签横滚在下，吸顶栏保持紧凑 */
  .site-header .search-box {
    max-width: none;
  }
  /* 可视化：三列排名改单列，字段占满一行 */
  .viz-cols {
    grid-template-columns: 1fr;
  }
  .viz-field {
    flex: 1 1 100%;
  }
  .viz-field input[type="range"] {
    flex: 1;
    width: auto;
  }
  .post-grid {
    grid-template-columns: 1fr;
  }
  .post-nav {
    grid-template-columns: 1fr;
  }
  .prose {
    font-size: 16px;
  }
  .prose pre {
    border-radius: var(--radius-sm);
    padding: 14px;
  }
}

/* 极窄屏：导航栏空间紧张，隐藏快捷键提示 */
@media (max-width: 560px) {
  .kbd-hint {
    display: none;
  }
  .site-header .container {
    gap: 8px;
  }
  .site-header .search-box {
    flex: 0 1 110px;
    max-width: 110px;
    margin-left: 0;
  }
  .site-header .search-box input {
    padding: 0 8px 0 30px;
    font-size: 12px;
  }
  .site-header .search-box svg {
    left: 9px;
    width: 14px;
  }
  .nav {
    gap: 0;
  }
  .nav a {
    padding: 5px;
    font-size: 13px;
  }
  .icon-btn {
    width: 32px;
  }
  .store-link {
    flex: 1 1 140px;
  }
}

@media (max-width: 380px) {
  .site-header .search-box {
    display: none;
  }
}

/* ---------- 14. 打印 ---------- */
@media print {
  .site-header,
  .site-footer,
  #backTop,
  .toolbar {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
