/* ==========================================================================
   Clash Verge官网 · 设计系统基础层
   暖夜基底 + 米白纸面双色节奏；令牌集中在 :root，组件只引用令牌。
   目录：1 令牌 / 2 reset / 3 排版 / 4 版心与区块 / 5 按钮 / 6 页头 / 7 页脚
        8 通用卡片与工具类 / 9 滚动淡入 / 10 响应式与防溢出
   ========================================================================== */

/* ------------------------------------------------------------------ 1 令牌 */
:root {
  /* 深色面 */
  --bg: #130F03;
  --bg-panel: #1C1610;

  /* 米白面 */
  --paper: #F7F3EA;
  --paper-hi: #FEFCF6;
  --paper-lo: #F0EADB;
  --border: #DED4C0;

  /* 强调与语义色 */
  --accent: #F2561C;
  --accent-dark: #BF3E0E;
  --success: #5F9E72;
  --warn: #D9A441;
  --error: #DC3E38;

  /* 深色面前景 */
  --text: #F5EFE1;
  --text-muted: #A79B87;

  /* 米白面前景 */
  --ink: #17120A;
  --ink-2: #6B6152;
  --ink-3: #756A58;
  --line-mid: #A79B87;

  /* 米白面文字级强调色（深一档，保证小字号对比度 ≥4.5） */
  --accent-ink: #A8340A;
  --error-ink: #B62A24;
  --warn-ink: #8A5A12;
  --success-ink: #2F6B45;

  /* 半透明层 */
  --veil-ink: rgba(23, 18, 10, .055);
  --veil-ink-2: rgba(23, 18, 10, .10);
  --accent-veil: rgba(242, 86, 28, .12);
  --accent-line: rgba(242, 86, 28, .30);
  --danger-veil: rgba(220, 62, 56, .09);
  --danger-line: rgba(220, 62, 56, .28);
  --warn-veil: rgba(217, 164, 65, .10);
  --warm-line: rgba(245, 239, 225, .12);
  --warm-line-2: rgba(245, 239, 225, .17);
  --shadow-ink: rgba(19, 15, 3, .55);

  /* 字体族 */
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font-body: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* 圆角 */
  --r-card: 28px;
  --r-panel: 24px;
  --r-float: 18px;
  --r-chip: 14px;
  --r-pill: 999px;

  /* 投影 */
  --shadow-card: 0 30px 66px -34px rgba(56, 36, 14, .34), 0 10px 24px -16px rgba(56, 36, 14, .16);
  --shadow-float: 0 28px 54px -22px rgba(19, 15, 3, .52), 0 6px 16px -8px rgba(19, 15, 3, .34);
  --shadow-btn: 0 14px 28px -14px rgba(191, 62, 14, .55);
  --shadow-soft: 0 20px 44px -30px var(--shadow-ink);

  /* 版式尺寸 */
  --shell-w: 1240px;
  --header-w: 1280px;
  --gutter: 40px;
  --header-h: 76px;
  --band-h: 84px;

  /* 组件节奏 */
  --tab-cycle: 6s;
}

/* ------------------------------------------------------------------ 2 reset */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.nav-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img,
svg,
video { display: block; max-width: 100%; }

img { height: auto; }

button { font: inherit; }

ul, ol { margin: 0; padding: 0; }

[hidden] { display: none !important; }

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

::selection {
  background: var(--accent);
  color: var(--text);
}

/* --------------------------------------------------------------- 3 排版 */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

.h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 3.34vw, 48px);
  line-height: 1.08;
  letter-spacing: -.01em;
  color: var(--ink);
}

.h1 > span { display: block; }

.h1 .h1-accent { color: var(--accent); }

.h1 .nowrap { display: inline-block; }

.h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 2.7vw, 38px);
  line-height: 1.18;
  letter-spacing: -.01em;
  color: var(--ink);
}

.h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
}

.nowrap { white-space: nowrap; }

.lead {
  margin: 22px 0 0;
  max-width: 34em;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--ink-2);
}

.lead strong { font-weight: 600; color: var(--ink); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--ink-3);
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-veil);
}

.sec-title {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 2.7vw, 38px);
  line-height: 1.18;
  letter-spacing: -.01em;
  color: var(--ink);
}

.sec-sub {
  margin: 14px 0 0;
  max-width: 44em;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--ink-2);
}

.sec-head { max-width: 48em; margin-bottom: 38px; }

/* 正文排版（教程 / 文章 / 术语长文共用） */
.prose { font-size: 16px; line-height: 1.85; color: var(--ink-2); }
.prose > * + * { margin-top: 18px; }
.prose h2 {
  margin-top: 46px;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
}
.prose h3 { margin-top: 32px; font-size: 19px; color: var(--ink); }
.prose h4 { margin-top: 26px; font-size: 17px; color: var(--ink); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a {
  color: var(--accent-ink);
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 1px;
}
.prose a:hover { border-bottom-color: var(--accent-ink); }
.prose ul, .prose ol { padding-left: 22px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 8px; }
.prose li::marker { color: var(--accent-ink); }
.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.prose pre {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--warm-line);
  border-radius: var(--r-panel);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
}
.prose blockquote {
  margin: 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}
.prose figure { margin: 0; }
.prose figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-3);
}

/* --------------------------------------------------- 4 版心 / 区块 / 表面 */
.wrap {
  width: 100%;
  max-width: var(--shell-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-wide {
  width: 100%;
  max-width: min(100%, calc(var(--header-w) + var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 区块节奏：只声明纵向，避免覆盖版心的左右留白 */
.sec {
  padding-top: 96px;
  padding-bottom: 96px;
}
.sec-sm { padding-top: 64px; padding-bottom: 64px; }
.sec-lg { padding-top: 124px; padding-bottom: 124px; }

.surf-dark { background: var(--bg); color: var(--text); }
.surf-panel { background: var(--bg-panel); color: var(--text); }
.surf-paper { background: var(--paper); color: var(--ink); }

.surf-dark .sec-title,
.surf-panel .sec-title { color: var(--text); }
.surf-dark .sec-sub,
.surf-panel .sec-sub { color: var(--text-muted); }
.surf-dark .eyebrow,
.surf-panel .eyebrow { color: var(--text-muted); }
.surf-dark .lead,
.surf-panel .lead { color: var(--text-muted); }
.surf-dark .lead strong,
.surf-panel .lead strong { color: var(--text); }

.hairline-top { border-top: 1px solid var(--warm-line); }
.hairline-bottom { border-bottom: 1px solid var(--border); }

.clip-x { overflow-x: clip; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.grid-2 > *,
.grid-3 > * { min-width: 0; }

.stack-sm > * + * { margin-top: 10px; }
.stack > * + * { margin-top: 18px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- 5 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .01em;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--ink-3);
  background: var(--paper-hi);
}

.btn-sm {
  min-height: 40px;
  padding: 9px 18px;
  font-size: 13.5px;
}

.btn-block { width: 100%; }

.btn-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.is-disabled,
.btn[disabled] {
  opacity: .5;
  pointer-events: none;
  box-shadow: none;
}

.surf-dark .btn-ghost,
.surf-panel .btn-ghost {
  color: var(--text);
  border-color: var(--warm-line-2);
}
.surf-dark .btn-ghost:hover,
.surf-panel .btn-ghost:hover {
  background: var(--warm-line);
  border-color: var(--text-muted);
}

/* --------------------------------------------------------------- 6 页头 */
#site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.header-bar { position: relative; z-index: 65; }

.header-inner {
  width: 100%;
  max-width: min(100%, calc(var(--header-w) + var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: none;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
}

.brand-sub {
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-3);
}

.nav-desktop { margin-left: auto; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  font-size: 14px;
  color: var(--ink-2);
  transition: background-color .18s ease, color .18s ease;
}
.nav-link:hover { color: var(--ink); background: var(--veil-ink); }
.nav-link.is-active { background: var(--ink); color: var(--paper); }

.header-div {
  width: 1px;
  height: 22px;
  flex: none;
  background: var(--border);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.lang-switch { position: relative; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.lang-btn:hover { border-color: var(--ink-3); color: var(--ink); }

.lang-short { display: none; }

.chev {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 176px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--paper-hi);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-float);
  box-shadow: var(--shadow-card);
}

.lang-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.lang-menu a:hover { background: var(--veil-ink); color: var(--ink); }
.lang-menu a.is-current { color: var(--ink); font-weight: 600; }
.lang-menu a.is-current::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.burger {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.burger-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.burger-box span {
  display: block;
  height: 1.6px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}

.burger[aria-expanded="true"] .burger-box span:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
.burger[aria-expanded="true"] .burger-box span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] .burger-box span:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }

.nav-veil { display: none; }
.nav-drawer { display: none; }

/* --------------------------------------------------------------- 7 页脚 */
#site-footer {
  background: var(--bg);
  color: var(--text);
  border-top: 1px solid var(--warm-line);
  padding-top: 64px;
  padding-bottom: 28px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr 1fr;
  gap: 36px;
}

.footer-inner > * { min-width: 0; }

.footer-brand .brand-name { color: var(--text); }
.footer-brand .brand-sub { color: var(--text-muted); }

.footer-note {
  margin: 16px 0 0;
  max-width: 32em;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-muted);
}

.footer-title {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .16em;
  color: var(--text-muted);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-list a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color .18s ease;
}
.footer-list a:hover { color: var(--text); }

.footer-kw {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-kw a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 12px;
  border: 1px solid var(--warm-line);
  border-radius: var(--r-pill);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: color .18s ease, border-color .18s ease;
}
.footer-kw a:hover { color: var(--text); border-color: var(--warm-line-2); }

.footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  margin: 44px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--warm-line);
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-copy a { color: var(--text-muted); }
.footer-copy a:hover { color: var(--text); }

/* --------------------------------------------- 8 通用卡片 / 工具类 / 装饰 */
.card {
  padding: 26px;
  border: 1px solid var(--warm-line);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text);
}

.card-paper {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--paper-hi);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: inherit;
}

.card-body {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-muted);
}

.card-paper .card-body { color: var(--ink-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
  min-height: 32px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--paper-hi);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--ink-2);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.surf-dark .chip,
.surf-panel .chip {
  border-color: var(--warm-line);
  background: transparent;
  color: var(--text-muted);
}

.chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}

.dot-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.dot-row .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}

/* 装饰性微倾斜：只作用在小件上，窄屏一律回正 */
.tilt { transform: rotate(-.45deg); }

/* 表格 */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--ink-2);
}

.data-table caption {
  caption-side: top;
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-3);
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--ink);
  white-space: nowrap;
}

.data-table code { font-family: var(--font-mono); font-size: .9em; overflow-wrap: anywhere; }

/* 文章页裸表格防御：不带 .table-wrap 的表格也不许撑破页面 */
.prose > .data-table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
}

/* 深色面表格 */
.surf-dark .data-table,
.surf-panel .data-table { color: var(--text-muted); }

.surf-dark .data-table th,
.surf-panel .data-table th { color: var(--text); }

.surf-dark .data-table th,
.surf-dark .data-table td,
.surf-panel .data-table th,
.surf-panel .data-table td { border-bottom-color: var(--warm-line); }

/* 命令行 / 代码展示块（深色面通用） */
.code-block {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--warm-line);
  border-radius: var(--r-panel);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.code-block .k { color: var(--text-muted); }
.code-block .v { color: var(--accent); }
.code-block .c { color: var(--text-muted); opacity: .75; }

/* ------------------------------------------------------- 9 滚动淡入 */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .62s ease, transform .62s ease;
  will-change: opacity, transform;
}

.reveal.shown {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ------------------------------------------------- 10 响应式与防溢出 */
@media (max-width: 1180px) {
  :root { --gutter: 32px; }
  .nav-link { padding: 9px 12px; font-size: 13.5px; }
}

@media (max-width: 1000px) {
  .sec { padding-top: 76px; padding-bottom: 76px; }
  .sec-lg { padding-top: 92px; padding-bottom: 92px; }
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
}

@media (max-width: 960px) {
  :root { --gutter: 22px; --header-h: 68px; }

  #site-header { padding-block: 0; }

  .header-inner { flex-wrap: wrap; row-gap: 10px; padding-block: 12px; }

  .brand { margin-right: auto; }

  .brand-sub { display: none; }

  .nav-desktop { display: none; }

  /* 导航收进抽屉后，工具区自己补 margin-left:auto，否则会悬在页中间 */
  .header-tools { margin-left: auto; }

  .header-div { display: none; }

  .burger { display: inline-flex; }

  .nav-veil {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(19, 15, 3, .58);
  }

  .nav-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--header-h) + 26px) var(--gutter) 36px;
    background: var(--bg-panel);
    color: var(--text);
  }

  .drawer-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .drawer-list a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 14px 4px;
    font-size: 17px;
    color: var(--text);
    border-bottom: 1px solid var(--warm-line);
  }

  .drawer-list a.is-active { color: var(--accent); }

  .drawer-lang { margin-top: 26px; }

  .drawer-lang-title {
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .16em;
    color: var(--text-muted);
  }

  .drawer-lang-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .drawer-lang-list a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 4px;
    font-size: 15px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--warm-line);
  }

  .drawer-lang-list a.is-current { color: var(--accent); }

  .grid-2,
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  /* 窄屏下术语不再强制不换行，避免长词把版心撑破（横向溢出） */
  .nowrap { white-space: normal; overflow-wrap: break-word; }
}

@media (max-width: 640px) {
  :root { --gutter: 22px; }
  body { font-size: 15.5px; }
  .h1 { font-size: clamp(24px, 7vw, 30px); line-height: 1.14; }
  .lead { font-size: 15px; max-width: none; }
  .sec { padding-top: 60px; padding-bottom: 60px; }
  .sec-lg { padding-top: 72px; padding-bottom: 72px; }
  .sec-head { margin-bottom: 28px; }
  .card, .card-paper { padding: 20px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .footer-copy { margin-top: 32px; }
  .lang-full { display: none; }
  .lang-short { display: inline; }
  /* 装饰性微倾斜在窄屏一律回正 */
  .tilt { transform: none; }
}

@media (max-width: 360px) {
  :root { --gutter: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .nav-link, .chip, .footer-list a { transition: none; }
}