/* ==========================================================================
   ES::Tools — "Eonian Authority" Design System
   瑞士网格 · 权威藏青 · ES 红 · 衬线标题
   ========================================================================== */

:root {
  --navy: #16233f;
  --navy-2: #1e3a8a;
  --navy-soft: #eef2f9;
  --red: #b91c1c;
  --red-bright: #dc2626;
  --red-soft: #fef2f2;
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --heading: var(--navy);

  /* 语义化扩展 */
  --on-navy: #ffffff;
  --on-red: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --hero-glow: rgba(30, 58, 138, 0.10);
  --shelf-shadow: rgba(22, 35, 63, 0.05);
  --navy-deep: #24365c;
  --red-deep: #8f1515;

  /* 卡片 hover 光效 */
  --glow-red: rgba(185, 28, 28, 0.38);
  --line-red: rgba(185, 28, 28, 0.75);
  --hover-red-shadow: rgba(185, 28, 28, 0.22);
  --hover-navy-shadow: rgba(22, 35, 63, 0.20);

  /* 付费工具图标光环 */
  --ring-color: rgba(185, 28, 28, 0.95);
  --ring-color-soft: rgba(185, 28, 28, 0.45);
  --ring-glow: rgba(185, 28, 28, 0.25);

  /* 状态点 */
  --status-stable: #10b981;
  --status-dev: #f59e0b;

  /* 免费标签（绿色系） */
  --green-ink: #047857;
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;

  /* Badge 边框 */
  --red-border: #fecaca;
  --navy-border: #c7d4ef;

  /* doc-body */
  --doc-text: #334155;
  --code-text: #e2e8f0;

  /* Footer（深色 footer 内的层次） */
  --footer-bg: var(--navy);
  --footer-text: #cbd5e1;
  --footer-muted: #94a3b8;
  --footer-heading: #7e93bd;
  --footer-brand: #ffffff;
  --footer-link: #cbd5e1;
  --footer-link-hover: #ffffff;
  --footer-decl: #e2e8f0;
  --footer-line: rgba(148, 163, 184, 0.18);
  --footer-accent: #3b527e;

  /* QR */
  --qr-frame-bg: #ffffff;
  --qr-shadow: rgba(0, 0, 0, 0.25);
  --qr-hover-shadow: rgba(185, 28, 28, 0.35);

  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lift: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 40px rgba(22, 35, 63, 0.14);
  --radius: 10px;
  --max: 1200px;
}

/* ---------- 暗色主题 ---------- */
:root[data-theme="dark"] {
  --navy: #0f172a;
  --navy-2: #60a5fa;
  --navy-soft: #1e293b;
  --red: #ef4444;
  --red-bright: #f87171;
  --red-soft: #2a1010;
  --bg: #0a0f1c;
  --surface: #131c30;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #1e293b;
  --line-strong: #334155;
  --heading: #f1f5f9;

  --on-navy: #ffffff;
  --on-red: #ffffff;
  --nav-bg: rgba(19, 28, 48, 0.92);
  --glass-bg: rgba(19, 28, 48, 0.75);
  --hero-glow: rgba(96, 165, 250, 0.12);
  --shelf-shadow: rgba(0, 0, 0, 0.30);
  --navy-deep: #0a0f1c;
  --red-deep: #7f1d1d;

  --glow-red: rgba(239, 68, 68, 0.42);
  --line-red: rgba(239, 68, 68, 0.80);
  --hover-red-shadow: rgba(239, 68, 68, 0.30);
  --hover-navy-shadow: rgba(0, 0, 0, 0.50);

  /* 付费工具图标光环（暗色用白色更醒目） */
  --ring-color: rgba(255, 255, 255, 0.95);
  --ring-color-soft: rgba(255, 255, 255, 0.55);
  --ring-glow: rgba(255, 255, 255, 0.18);

  --status-stable: #10b981;
  --status-dev: #f59e0b;

  --green-ink: #34d399;
  --green-bg: #052e1f;
  --green-border: #064e3b;

  --red-border: #7f1d1d;
  --navy-border: #1e3a8a;

  --doc-text: #cbd5e1;
  --code-text: #e2e8f0;

  --footer-bg: #060912;
  --footer-text: #cbd5e1;
  --footer-muted: #94a3b8;
  --footer-heading: #94a3b8;
  --footer-brand: #ffffff;
  --footer-link: #cbd5e1;
  --footer-link-hover: #ffffff;
  --footer-decl: #e2e8f0;
  --footer-line: rgba(148, 163, 184, 0.18);
  --footer-accent: #1e293b;

  --qr-frame-bg: #ffffff;
  --qr-shadow: rgba(0, 0, 0, 0.5);
  --qr-hover-shadow: rgba(239, 68, 68, 0.35);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 4px 8px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--red); }

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

::selection { background: var(--navy); color: var(--on-navy); }

/* ---------- 顶部导航 ---------- */

.topline {
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy) 55%, var(--red) 55%, var(--red) 100%);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--heading);
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand:hover { color: var(--heading); }
.brand .brand-logo {
  width: 38px; height: 38px;
  display: block;
}
.brand small {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  line-height: 1.1;
}
.brand .brand-name { line-height: 1.2; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links > a,
.nav-dropdown > button {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 200ms, background 200ms;
}
.nav-links > a:hover,
.nav-dropdown:hover > button,
.nav-dropdown > button[aria-expanded="true"] {
  color: var(--red);
  background: var(--red-soft);
}
.nav-links > a.active { color: var(--red); }

.nav-dropdown { position: relative; }
.nav-dropdown .caret { width: 14px; height: 14px; transition: transform 200ms; }
.nav-dropdown:hover .caret,
.nav-dropdown > button[aria-expanded="true"] .caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.nav-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  transition: background 160ms;
}
.dropdown-item:hover { background: var(--navy-soft); color: var(--heading); }
.dropdown-item .mono-badge {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  font-size: 0.72rem;
}
.dropdown-item .di-name { font-weight: 600; font-size: 0.92rem; line-height: 1.3; }
.dropdown-item .di-tag {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
  display: block;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 420px at 50% -160px, var(--hero-glow), transparent 70%),
    var(--surface);
  border-bottom: 1px solid var(--line);
}

#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  text-align: center;
  padding: 96px 24px 72px;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before,
.hero-eyebrow::after {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--line-strong);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.4vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--heading);
  margin: 20px 0 14px;
  line-height: 1.2;
}

.hero .slogan {
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

.hero .hero-sub {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero .hero-sub svg { width: 16px; height: 16px; }

.hero-stats {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 44px auto 0;
  max-width: 720px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.hero-stats .stat {
  flex: 1;
  padding: 22px 12px;
  text-align: center;
}
.hero-stats .stat + .stat { border-left: 1px solid var(--line); }
.hero-stats .num {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.1;
}
.hero-stats .num em { font-style: normal; color: var(--red); }
.hero-stats .lbl {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- 展示台（书架） ---------- */

.section { padding: 84px 0 20px; }

.section-head { text-align: center; margin-bottom: 54px; }
.section-head .kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red);
}
.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  color: var(--heading);
  margin: 12px 0 8px;
}
.section-head p { color: var(--muted); margin: 0; }

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px;
  position: relative;
  padding-bottom: 26px;
}
/* 展示台基座线 */
.shelf::after {
  content: "";
  position: absolute;
  left: -8px; right: -8px; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 12%, var(--line-strong) 88%, transparent);
}
.shelf::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 22px;
  background: linear-gradient(180deg, var(--shelf-shadow), transparent);
  pointer-events: none;
}

.tool-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 20px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 18px -10px var(--hover-red-shadow),
    0 14px 32px -18px var(--hover-navy-shadow);
  border-color: var(--line-strong);
}
.tool-card::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: -14px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--glow-red) 0%, transparent 70%);
  filter: blur(4px);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
.tool-card::after {
  content: "";
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-red), transparent);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
.tool-card:hover::before { opacity: 1; }
.tool-card:hover::after { opacity: 1; }

.tool-card .tc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.mono-badge {
  width: 52px; height: 52px;
  flex: 0 0 52px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--on-navy);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  overflow: visible;
}
.mono-badge img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.mono-badge.badge-red { background: linear-gradient(145deg, var(--red) 0%, var(--red-deep) 100%); }

/* 付费工具：白色光环旋转特效 */
.mono-badge.badge-red { position: relative; }
.mono-badge.badge-red::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--ring-color);
  border-right-color: var(--ring-color-soft);
  box-shadow: 0 0 10px var(--ring-glow);
  animation: badge-spin 2.6s linear infinite;
  pointer-events: none;
}
@keyframes badge-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mono-badge.badge-red::after {
    animation: none;
    border-top-color: var(--ring-color);
    border-right-color: var(--ring-color-soft);
  }
}

.tc-name {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 6px;
  line-height: 1.35;
}
.tc-tagline {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 14px;
  flex: 1;
}

.tc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag-chip {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy-2);
  letter-spacing: 0.02em;
}

.tc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 0.8rem;
}
.tc-version {
  font-family: var(--mono);
  color: var(--faint);
  font-size: 0.76rem;
}
.tc-price { font-weight: 600; }
.tc-price.oss { color: var(--navy-2); }
.tc-price.free { color: var(--green-ink); }
.tc-price.paid { color: var(--red); }

.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.status-dot::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--status-stable);
}
.status-dot.dev::before { background: var(--status-dev); }
.status-dot.planned::before { background: var(--faint); }

/* ---------- 开源与社区 ---------- */

.dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 860px) { .dual-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 30px 24px;
  box-shadow: var(--shadow-card);
}
.panel h3 {
  font-family: var(--serif);
  color: var(--heading);
  font-size: 1.25rem;
  margin: 0 0 4px;
}
.panel .panel-sub { font-size: 0.85rem; color: var(--muted); margin: 0 0 18px; }

.oss-list { list-style: none; margin: 0; padding: 0; }
.oss-list li { border-top: 1px solid var(--line); }
.oss-list li:first-child { border-top: none; }
.oss-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 4px;
  color: var(--ink);
  transition: color 160ms;
}
.oss-list a:hover { color: var(--red); }
.oss-list .oss-name { font-family: var(--mono); font-size: 0.88rem; font-weight: 600; }
.oss-list .oss-note { font-size: 0.8rem; color: var(--muted); text-align: right; }

.contrib-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.contrib-list li { padding: 3px 0; }
.contrib-list li::marker { color: var(--red); }

/* ---------- 页脚 ---------- */

.footer {
  margin-top: 96px;
  background: var(--footer-bg);
  color: var(--footer-text);
}
.footer .topline { background: linear-gradient(90deg, var(--red) 0%, var(--red) 45%, var(--footer-accent) 45%, var(--footer-accent) 100%); }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding: 64px 0 44px;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr; } }

.footer h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--footer-heading);
  margin: 0 0 16px;
}
.footer .f-brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--footer-brand);
  margin-bottom: 10px;
}
.footer .f-motto { font-size: 0.88rem; color: var(--footer-muted); max-width: 340px; }

.qr-row {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.qr-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--footer-muted);
  transition: color 160ms;
}
.qr-item:hover { color: var(--footer-link-hover); }
.qr-frame {
  width: 88px;
  height: 88px;
  padding: 6px;
  border-radius: 10px;
  background: var(--qr-frame-bg);
  box-shadow: 0 4px 14px var(--qr-shadow);
  display: grid;
  place-items: center;
  transition: transform 200ms, box-shadow 200ms;
}
.qr-item:hover .qr-frame {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--qr-hover-shadow);
}
.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}
.qr-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.footer ul { list-style: none; margin: 0; padding: 0; }
.footer ul li { margin: 8px 0; }
.footer a { color: var(--footer-link); font-size: 0.9rem; transition: color 160ms; }
.footer a:hover { color: var(--footer-link-hover); }

.footer-bottom {
  border-top: 1px solid var(--footer-line);
  padding: 20px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--footer-heading);
}
.footer-bottom .decl { font-family: var(--serif); letter-spacing: 0.04em; }
.footer-bottom .decl strong { color: var(--footer-decl); font-weight: 600; }

/* ---------- 工具详情页 ---------- */

.detail-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 56px 0 40px;
}
.breadcrumb {
  font-size: 0.82rem;
  color: var(--faint);
  margin-bottom: 22px;
  font-family: var(--mono);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--red); }

.detail-top { display: flex; gap: 24px; align-items: flex-start; position: relative; padding-top: 6px; }
.detail-top .mono-badge { width: 76px; height: 76px; flex-basis: 76px; font-size: 1.3rem; border-radius: 16px; }
.detail-top .mono-badge img { border-radius: 16px; }
.detail-title { flex: 1; min-width: 0; }
.detail-title h1 {
  font-family: var(--serif);
  color: var(--heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 8px;
}
.detail-title .dt-tagline { color: var(--muted); margin: 0 0 16px; font-size: 1.02rem; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg);
}
.badge.mono { font-family: var(--mono); }
.badge.b-red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.badge.b-navy { background: var(--navy-soft); border-color: var(--navy-border); color: var(--navy-2); }
.badge.b-green { background: var(--green-bg); border-color: var(--green-border); color: var(--green-ink); }

.doc-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 44px 48px;
  margin: 40px 0 0;
  flex: 1;
  min-width: 0;
}
@media (max-width: 720px) { .doc-body { padding: 28px 22px; } }

/* ---------- 文档目录 ---------- */
.doc-wrapper {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}
.doc-toc {
  width: 220px;
  flex: 0 0 220px;
  position: sticky;
  top: 84px;
  align-self: flex-start;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  font-size: 0.88rem;
  padding: 6px 0 6px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.doc-toc .toc-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 0; }
.doc-toc a {
  display: block;
  padding: 5px 0 5px 10px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  transition: color 160ms, border-color 160ms, background 160ms;
  text-decoration: none;
  line-height: 1.5;
  border-radius: 0 4px 4px 0;
}
.doc-toc a:hover {
  color: var(--red);
  border-left-color: var(--red);
  background: var(--red-soft);
}
.doc-toc a.active {
  color: var(--red);
  border-left-color: var(--red);
  background: var(--red-soft);
  font-weight: 600;
}
.doc-toc a.lvl-1 { font-weight: 600; color: var(--heading); }
.doc-toc a.lvl-2 { padding-left: 18px; }
.doc-toc a.lvl-3 { padding-left: 28px; font-size: 0.82rem; }

@media (max-width: 900px) {
  .doc-wrapper { flex-direction: column; }
  .doc-toc {
    width: 100%;
    flex: 0 0 auto;
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
    margin-bottom: 8px;
  }
}

.doc-body h1, .doc-body h2, .doc-body h3 {
  font-family: var(--serif);
  color: var(--heading);
  line-height: 1.4;
}
.doc-body h2 { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-top: 36px; }
.doc-body h1 { font-size: 1.6rem; } .doc-body h2 { font-size: 1.35rem; } .doc-body h3 { font-size: 1.12rem; }
.doc-body p { color: var(--doc-text); }
.doc-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--navy-soft);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--navy-2);
}
.doc-body pre {
  background: var(--navy);
  border-radius: 10px;
  padding: 18px 22px;
  overflow-x: auto;
}
.doc-body pre code { background: none; color: var(--code-text); padding: 0; font-size: 0.86rem; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 0.9rem; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.doc-body th { background: var(--navy-soft); color: var(--heading); font-weight: 600; }
.doc-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.doc-body blockquote {
  margin: 18px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  color: var(--muted);
  border-radius: 0 8px 8px 0;
}

.detail-actions { position: absolute; top: 0; right: 0; display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 180ms, color 180ms, border-color 180ms, transform 180ms;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--red); color: var(--on-red); }
.btn-primary:hover { background: var(--red-bright); color: var(--on-red); }
.btn-ghost { background: var(--surface); color: var(--heading); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--heading); color: var(--heading); }

/* ---------- 404 / 关于 ---------- */

.simple-page { padding: 72px 0 20px; }
.simple-page h1 { font-family: var(--serif); color: var(--heading); font-size: 2.2rem; }

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .nav-links > a, .nav-dropdown > button { padding: 8px 10px; font-size: 0.88rem; }
  .dropdown-menu { min-width: 280px; }
  .hero-inner { padding: 64px 20px 52px; }
  .section { padding: 60px 0 12px; }
  .detail-top { flex-direction: column; }
  .detail-actions { position: static; justify-content: flex-start; margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 活动公告条 ---------- */

.promo-banner {
  display: block;
  background: var(--red-soft);
  border-bottom: 1px solid var(--red-border);
  color: var(--red);
  text-decoration: none;
  transition: background 180ms, color 180ms;
}
.promo-banner:hover { background: var(--red-border); color: var(--red); }
.promo-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 500;
  flex-wrap: wrap;
}
.promo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex: 0 0 8px;
  box-shadow: 0 0 0 4px var(--red-soft);
  animation: promo-pulse 2s ease-in-out infinite;
}
@keyframes promo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--red-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .promo-dot { animation: none; }
}
.promo-text { letter-spacing: 0.02em; }
.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  transition: background 180ms;
}
.promo-cta svg { width: 14px; height: 14px; }
.promo-banner:hover .promo-cta { background: var(--red-bright); }

@media (max-width: 720px) {
  .promo-inner { padding: 8px 16px; font-size: 0.82rem; gap: 10px; }
  .promo-cta { padding: 2px 8px; font-size: 0.78rem; }
}

/* ---------- 主题切换按钮 ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 8px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: color 200ms, background 200ms, border-color 200ms, transform 200ms;
}
.theme-toggle:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
  transform: rotate(-12deg);
}
.theme-toggle:active { transform: rotate(0deg) scale(0.94); }
.theme-toggle svg { width: 18px; height: 18px; }

/* 默认（亮色）显示月亮图标，提示"切到暗色" */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* 暗色主题下显示太阳图标，提示"切到亮色" */
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
