/* ==========================================================================
   陈小涛的技术学习笔记 · 全站样式 v3
   设计基调：深色终端 / 等宽点缀 / 单色强调 / 细边框网格
   特性：CSS 自定义属性双主题（跟随系统 + 手动切换持久化）、
        prefers-reduced-motion 降级、打印优化
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg:            #ffffff;
  --bg-alt:        #f7f9fc;
  --surface:       #ffffff;
  --surface-2:     #f2f5f9;
  --surface-3:     #e9eff6;
  --border:        #e4e9f0;
  --border-strong: #cfd8e3;
  --fg:            #1b1f26;
  --fg-2:          #454d5a;
  --muted:         #6b7686;
  --accent:        #2f6bb0;
  --accent-2:      #1f9d63;
  --accent-3:      #b07818;
  --warn:          #b07818;
  --danger:        #c0392b;
  --code-bg:       #f5f7fa;
  --code-fg:       #2b3038;
  --shadow-sm:     0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md:     0 8px 24px -8px rgba(16, 24, 40, .14);
  --shadow-lg:     0 20px 48px -16px rgba(16, 24, 40, .22);

  --note-border:   #f0e0bc;
  --note-bg:       #fffaf0;
  --tip-border:    #c9e5d5;
  --tip-bg:        #f3faf6;
  --tip-fg:        #1f7a4d;
  --alert-border:  #f0cccc;
  --alert-bg:      #fff5f5;
  --alert-fg:      #b03a2e;

  --radius:        14px;
  --radius-sm:     9px;
  --wrap:          960px;
  --ease:          cubic-bezier(.22, .61, .36, 1);

  color-scheme: light;
}

/* 深色：跟随系统（用户未手动指定时生效） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0a0d13;
    --bg-alt:        #0d1119;
    --surface:       #11161f;
    --surface-2:     #161c27;
    --surface-3:     #1d2531;
    --border:        #232c3a;
    --border-strong: #334052;
    --fg:            #e4e8f0;
    --fg-2:          #b9c2d0;
    --muted:         #7d8798;
    --accent:        #5aa2ff;
    --accent-2:      #56d68a;
    --accent-3:      #eeb35c;
    --warn:          #eeb35c;
    --danger:        #ff7b72;
    --code-bg:       #0e131b;
    --code-fg:       #cfd8e6;
    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:     0 10px 30px -10px rgba(0, 0, 0, .6);
    --shadow-lg:     0 24px 56px -18px rgba(0, 0, 0, .75);
    --note-border:   #4a3d20;
    --note-bg:       #1a1608;
    --tip-border:    #23503a;
    --tip-bg:        #0d1a14;
    --tip-fg:        #6fd39b;
    --alert-border:  #5a2b28;
    --alert-bg:      #1c1010;
    --alert-fg:      #ff9a90;
    color-scheme: dark;
  }
}

/* 深色：用户手动选择 */
:root[data-theme="dark"] {
  --bg:            #0a0d13;
  --bg-alt:        #0d1119;
  --surface:       #11161f;
  --surface-2:     #161c27;
  --surface-3:     #1d2531;
  --border:        #232c3a;
  --border-strong: #334052;
  --fg:            #e4e8f0;
  --fg-2:          #b9c2d0;
  --muted:         #7d8798;
  --accent:        #5aa2ff;
  --accent-2:      #56d68a;
  --accent-3:      #eeb35c;
  --warn:          #eeb35c;
  --danger:        #ff7b72;
  --code-bg:       #0e131b;
  --code-fg:       #cfd8e6;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md:     0 10px 30px -10px rgba(0, 0, 0, .6);
  --shadow-lg:     0 24px 56px -18px rgba(0, 0, 0, .75);
  --note-border:   #4a3d20;
  --note-bg:       #1a1608;
  --tip-border:    #23503a;
  --tip-bg:        #0d1a14;
  --tip-fg:        #6fd39b;
  --alert-border:  #5a2b28;
  --alert-bg:      #1c1010;
  --alert-fg:      #ff9a90;
  color-scheme: dark;
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-block-start: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s var(--ease), color .3s var(--ease);
  overflow-x: hidden;
}

/* 全站极淡网格底纹 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--fg) 4%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--fg) 4%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  opacity: .55;
}
body > * { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; transition: color .18s var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--fg); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

img, svg { max-width: 100%; }
img { height: auto; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }

/* 跳转到主内容（键盘可达） */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-size: 14px;
}
.skip-link:focus { left: 0; text-decoration: none; }

/* ---------- 3. 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 20px -12px rgba(0,0,0,.3); }
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--fg);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .prompt {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--accent-2);
  font-weight: 700;
}
.brand span { color: var(--accent); }

/* min-width:0 必设：flex 子项默认 min-width:auto，长内容会撑破容器 */
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
.nav a {
  position: relative;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 11px;
  border-radius: 7px;
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.nav a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.nav a::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 2px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }
.nav a.is-active { color: var(--accent); }

.nav-tools { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding-inline: 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: color .18s, border-color .18s, background-color .18s, transform .12s;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--surface-2);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 16px; height: 16px; display: block; }

.kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}
.nav-tools .search-btn { gap: 8px; padding-inline: 10px; }

.scroll-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 70;
  background: transparent;
  pointer-events: none;
}
.scroll-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 60%, var(--accent-3));
  transition: width .1s linear;
}

/* ---------- 4. Hero ---------- */
/* 用 grid 而非 flex：flex-basis:0 配 flex-shrink:0 会把右侧挤到下一行 */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 40px;
  align-items: center;
  padding: 72px 0 44px;
  border-bottom: 1px solid var(--border);
}
.hero-text { min-width: 0; }

.hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.24;
  margin: 0 0 14px;
  letter-spacing: -.025em;
  font-weight: 800;
  color: var(--fg);
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 22px; max-width: 46ch; }

.hero .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  transition: color .18s, border-color .18s, transform .12s;
}
.tag:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transform: translateY(-1px);
}

.hero-art { min-width: 0; }

.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.terminal-bar .lights { display: flex; gap: 5px; }
.terminal-bar .lights i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.terminal-bar .lights i:nth-child(1) { background: #ff5f57; }
.terminal-bar .lights i:nth-child(2) { background: #febc2e; }
.terminal-bar .lights i:nth-child(3) { background: #28c840; }
.terminal-bar .title { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.terminal-body { padding: 14px 16px; line-height: 1.85; }
.terminal-body .row { white-space: pre-wrap; word-break: break-word; }
.terminal-body .c-dim  { color: var(--muted); }
.terminal-body .c-key  { color: var(--accent-2); }
.terminal-body .c-str  { color: var(--accent); }
.terminal-body .c-ok   { color: var(--accent-2); }
.caret {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent-2);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- 5. 区块标题 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 700;
  margin: 52px 0 20px;
  letter-spacing: -.01em;
  scroll-margin-block-start: 84px;
}
.section-title::before {
  content: "";
  width: 3px; height: 19px;
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 2px;
  flex: none;
}
.section-title .idx {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  letter-spacing: .08em;
}
.section-title .count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 6. 卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  color: inherit;
  isolation: isolate;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
/* 卡片跟随鼠标的聚光 */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%);
  transition: opacity .3s var(--ease);
}
.card:hover::before { opacity: 1; }
/* 顶部渐变描边 */
.card::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 3;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .42s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  text-decoration: none;
}
.card:hover::after { transform: scaleX(1); }

.card .thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 180;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  transition: filter .35s var(--ease);
}
/* 深色主题下把浅底插画压暗，避免刺眼 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card .thumb { filter: brightness(.66) contrast(1.06) saturate(.9); }
}
:root[data-theme="dark"] .card .thumb { filter: brightness(.66) contrast(1.06) saturate(.9); }

.card .body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card .cat {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: .05em;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 22%, transparent);
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.card h3 {
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 8px;
  color: var(--fg);
  font-weight: 700;
  transition: color .2s;
}
.card:hover h3 { color: var(--accent); }
.card p {
  font-size: 13.8px;
  color: var(--muted);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .more {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--accent);
}
.card .more .arrow { transition: transform .26s var(--ease); }
.card:hover .more .arrow { transform: translateX(4px); }

/* ---------- 7. 专题横幅 ---------- */
.feature-banner { margin: 40px 0 8px; }
.feature-link {
  position: relative;
  display: flex;
  gap: 30px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 18px;
  padding: 32px 34px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 15%, var(--surface)) 0%, var(--surface) 55%),
    var(--surface);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.feature-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    115deg, color-mix(in srgb, var(--accent) 6%, transparent) 0 2px, transparent 2px 9px);
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}
.feature-link:hover::before { opacity: 1; }
.feature-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  text-decoration: none;
}
/* currentColor 依赖容器 color，否则描边透明 */
.feature-art { flex: 0 0 118px; position: relative; z-index: 1; color: var(--accent); }
.feature-art svg { width: 118px; height: 118px; display: block; }
.feature-text { flex: 1; position: relative; z-index: 1; min-width: 0; }
.feature-text h2 {
  font-size: clamp(19px, 2.6vw, 25px);
  margin: 0 0 10px;
  color: var(--fg);
  font-weight: 800;
  letter-spacing: -.015em;
}
.feature-text p {
  color: var(--fg-2);
  font-size: 15px;
  line-height: 1.8;
  margin: 0 0 18px;
  max-width: 62ch;
}
.feature-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: transform .16s, filter .2s;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.feature-link:hover .feature-cta { transform: translateY(-1px); filter: brightness(1.08); }

/* ---------- 8. 文章页 ---------- */
.article { padding: 40px 0 72px; }
.breadcrumb {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.article h1 {
  font-size: clamp(25px, 4.2vw, 34px);
  line-height: 1.3;
  margin: 0 0 18px;
  letter-spacing: -.022em;
  font-weight: 800;
  scroll-margin-block-start: 84px;
}
.article h2 {
  font-size: 21px;
  margin: 44px 0 14px;
  padding: 0 0 0 12px;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
  scroll-margin-block-start: 84px;
}
.article h3 { font-size: 17px; margin: 28px 0 10px; scroll-margin-block-start: 84px; }
.article p { margin: 0 0 16px; }

.article ul, .article ol { margin: 0 0 18px; padding-inline-start: 24px; }
.article li { margin: 7px 0; }
.article strong { font-weight: 700; color: var(--fg); }
.article hr { border: 0; border-top: 1px dashed var(--border); margin: 34px 0; }

/* 导语 */
.article .lead {
  font-size: 16.5px;
  line-height: 1.92;
  color: var(--fg-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px;
  margin: 0 0 28px;
}
/* 隐私承诺这类通篇加粗的导语 */
.article .lead strong,
.article .lead b {
  display: block;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.06em;
  line-height: 1.85;
}

/* 引用 */
.article blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 18px;
  border-inline-start: 3px solid var(--border-strong);
  color: var(--muted);
  font-style: italic;
}
.article blockquote p:last-child { margin-bottom: 0; }

.quote-card {
  margin: 26px 0;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  line-height: 1.9;
}
.quote-card .qmark { color: var(--accent); font-size: 22px; font-weight: 800; margin-inline-end: 3px; }
.quote-card .qby { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

/* 提示块 */
.tip, .alert, .note {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14.8px;
  line-height: 1.82;
}
.note { border: 1px solid var(--note-border); background: var(--note-bg); }
.note b, .note strong { color: var(--warn); }
.tip { border: 1px solid var(--tip-border); background: var(--tip-bg); }
.tip b, .tip strong { color: var(--tip-fg); }
.alert { border: 1px solid var(--alert-border); background: var(--alert-bg); }
.alert b, .alert strong { color: var(--alert-fg); }
.tip::before, .alert::before {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  display: block;
  margin-bottom: 5px;
  letter-spacing: .1em;
}
.tip::before { content: "TIP"; color: var(--tip-fg); }
.alert::before { content: "WARN"; color: var(--alert-fg); }

/* 文内目录 */
.toc {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 22px 12px;
  margin: 0 0 28px;
  font-size: 14.5px;
}
.toc .toc-title {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: .05em;
}
.toc ol { margin: 0 0 4px; padding-inline-start: 22px; }
.toc li { margin: 4px 0; }
.toc a { color: var(--fg-2); }
.toc a:hover { color: var(--accent); }

/* 时间线 */
.timeline {
  list-style: none;
  margin: 24px 0;
  padding: 0 0 0 26px;
  border-inline-start: 2px solid var(--border);
}
.timeline li { position: relative; margin: 0 0 20px; }
.timeline li::before {
  content: "";
  position: absolute;
  inset-inline-start: -32px;
  top: 9px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.timeline li b { display: block; color: var(--accent); font-size: 14.5px; margin-bottom: 3px; }

/* 编号步骤 */
.steps { counter-reset: st; list-style: none; margin: 22px 0; padding: 0; }
.steps > li { counter-increment: st; position: relative; padding-inline-start: 46px; margin: 0 0 18px; }
.steps > li::before {
  content: counter(st, decimal-leading-zero);
  position: absolute;
  inset-inline-start: 0; top: 2px;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}
.steps > li b { color: var(--fg); }

/* 数据小卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  padding: 16px 18px;
  text-align: center;
  transition: transform .2s var(--ease), border-color .2s;
}
.stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.stat b {
  display: block;
  font-size: 22px;
  color: var(--accent);
  line-height: 1.35;
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
}
.stat span { font-size: 13px; color: var(--muted); }

/* 两栏对比 */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
.kv { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
.kv h4 { margin: 0 0 10px; font-size: 15px; color: var(--accent); }
.kv ul { margin: 0; padding-inline-start: 20px; font-size: 14.2px; }
.kv li { margin: 5px 0; }
.kv.pro h4 { color: var(--accent-2); }
.kv.con h4 { color: var(--danger); }

/* 问答 */
.qa { margin: 22px 0; }
.qa .q { font-weight: 700; color: var(--fg); margin: 20px 0 7px; }
.qa .q::before { content: "Q "; color: var(--accent); font-family: ui-monospace, Consolas, monospace; }
.qa .a { color: var(--fg-2); margin: 0 0 8px; padding-inline-start: 24px; }
.qa .a::before { content: "A "; color: var(--muted); font-family: ui-monospace, Consolas, monospace; margin-inline-start: -24px; }

/* 打分条 */
.bars { margin: 22px 0; }
.bar-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 14px; }
.bar-row .name { flex: 0 0 92px; color: var(--fg-2); }
.bar-row .track { flex: 1; height: 9px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-row .fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0;
  transition: width 1.1s var(--ease);
}
.bar-row .val { flex: 0 0 48px; text-align: right; color: var(--muted); font-size: 13px; font-family: ui-monospace, Consolas, monospace; }

/* 标签行 */
.tagline { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.tagline span {
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 999px;
  padding: 3px 11px;
}

.divider { border: 0; border-top: 1px dashed var(--border); margin: 34px 0; }

/* 结论面板 */
.panel {
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
  padding: 18px 22px;
  margin: 28px 0;
}
.panel h4 { margin: 0 0 10px; font-size: 15.5px; color: var(--accent); }
.panel p:last-child, .panel ul:last-child, .panel ol:last-child { margin-bottom: 0; }

/* 插图 */
.figure { margin: 26px 0; text-align: center; }
.figure svg {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
}
.figure figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; font-family: ui-monospace, Consolas, monospace; }

/* ---------- 9. 代码 ---------- */
code {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas,
               "Liberation Mono", Menlo, monospace;
  font-size: .92em;
}
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--accent-2);
  padding: 1px 6px;
  border-radius: 5px;
  word-break: break-word;
}

.code-block {
  position: relative;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px 7px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .04em;
}
.code-head .lang { color: var(--accent); }
.code-head .lang::before { content: "$ "; color: var(--accent-2); }
.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 6px;
  font-size: 11.5px;
  font-family: inherit;
  padding: 3px 9px;
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.copy-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.copy-btn.done { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }

pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
  color: var(--code-fg);
  font-size: 13.4px;
  line-height: 1.72;
  tab-size: 2;
}
pre code { font-size: inherit; background: none; border: 0; padding: 0; color: inherit; }

/* ---------- 10. 表格 ---------- */
table.tbl, .article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.4px;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table.tbl th, table.tbl td, .article table th, .article table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
table.tbl th, .article table th {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}
table.tbl tr:last-child td, .article table tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover, .article table tbody tr:hover { background: var(--surface-2); }

/* ---------- 11. 页脚 & 联系方式 ---------- */
footer.site {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 44px 24px 40px;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--bg-alt);
}
footer.site .foot-inner { max-width: var(--wrap); margin-inline: auto; }

.contact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  padding: 26px 28px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
}
.contact-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 8px;
}
.contact-title .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
  flex: none;
}
.contact p { margin: 0 0 14px; color: var(--muted); line-height: 1.75; }

.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mail-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  word-break: break-all;
  transition: background-color .2s, transform .16s, box-shadow .2s;
}
.mail-link:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--accent) 90%, transparent);
}
.mail-link svg { width: 16px; height: 16px; flex: none; }

.copy-mail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-family: ui-monospace, Consolas, monospace;
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.copy-mail:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.copy-mail.done { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 42%, transparent); }

footer.site .foot-beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 18px;
}
footer.site .foot-beian a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color .18s, border-color .18s;
}
footer.site .foot-beian a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
footer.site .foot-copy {
  text-align: center;
  margin-top: 12px;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  padding-inline-end: 58px;   /* 给右下角返回顶部按钮留空间 */
}
footer.site .foot-copy .sep { opacity: .45; margin-inline: 8px; }

/* 返回顶部 */
.to-top {
  position: fixed;
  inset-block-end: 26px;
  inset-inline-end: 26px;
  z-index: 65;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.9);
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s, color .2s, border-color .2s;
  box-shadow: var(--shadow-md);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); }
.to-top svg { width: 17px; height: 17px; }
.to-top .ring { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); pointer-events: none; }

/* ---------- 12. 命令面板 ---------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: 12vh 20px 20px;
  background: color-mix(in srgb, var(--bg) 55%, rgba(0, 0, 0, .45));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cmdk.open { display: block; }
.cmdk-panel {
  max-width: 620px;
  margin-inline: auto;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cmdk-in .22s var(--ease);
}
@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.cmdk-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
  padding: 17px 20px;
  outline: none;
}
.cmdk-input::placeholder { color: var(--muted); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--fg-2);
}
.cmdk-item .k {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 26%, transparent);
  padding: 1px 8px;
  border-radius: 999px;
  flex: none;
}
.cmdk-item .t { font-size: 14.6px; color: var(--fg); font-weight: 600; }
.cmdk-item .d {
  font-size: 12.6px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmdk-item mark { background: color-mix(in srgb, var(--accent-3) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--surface-2); }
.cmdk-item.sel { box-shadow: inset 2px 0 0 var(--accent); }
.cmdk-empty { padding: 26px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 13. 统计条 ---------- */
.statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 34px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.statbar > div { background: var(--surface); padding: 18px 16px; text-align: center; }
.statbar b {
  display: block;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}
.statbar span { font-size: 12.5px; color: var(--muted); }

/* ---------- 14. 渐入动画 ---------- */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

/* ---------- 15. 响应式 ---------- */
@media (max-width: 860px) {
  /* Hero 单列堆叠 */
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .topbar .wrap { height: auto; min-height: 58px; padding-block: 8px; flex-wrap: wrap; row-gap: 6px; }
  .brand { font-size: 14.5px; flex: 1 1 auto; }
  .nav-tools { flex: none; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex: none; padding: 5px 10px; font-size: 13.6px; }
  .nav a::after { left: 10px; right: 10px; }
}

@media (max-width: 760px) {
  /* 隐藏终端时必须同时把 grid 收成单列，否则留一条空白列 */
  .hero { padding: 48px 0 32px; gap: 26px; grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .feature-link { flex-direction: column; text-align: center; padding: 26px 20px; gap: 18px; }
  .feature-art { flex: none; }
  .feature-text p { font-size: 14.4px; }
  .kv-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .bar-row .name { flex: 0 0 74px; font-size: 13px; }
  .article .lead { font-size: 16px; }
  .to-top { inset-block-end: 16px; inset-inline-end: 16px; }
}

@media (max-width: 520px) {
  .brand .prompt { display: none; }
  .nav a { padding: 5px 8px; font-size: 13.2px; }
  .wrap { padding-inline: 18px; }
  .hero h1 { font-size: 27px; }
  .contact { padding: 20px 18px; }
  .mail-row { flex-direction: column; align-items: stretch; }
  .mail-link, .copy-mail { justify-content: center; }
}

/* ---------- 16. 动效降级 & 打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .card:hover { transform: none; }
  body::before { display: none; }
}

@media print {
  body::before, .topbar, .to-top, .cmdk, .scroll-progress, .feature-banner { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .article h2, .article h3 { break-after: avoid; }
  .article pre, .code-block, .figure, table { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
  footer.site { border-top: 1px solid #ccc; }
}