/* ==========================================================================
   米伦 (MyRen) 使用手册 — Apple 风格样式表
   纯静态零依赖，适配桌面、平板与手机屏幕，支持浅色 / 深色模式自动与手动切换
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-strong: rgba(255, 255, 255, 0.9);
  --text: #1d1d1f;
  --text-secondary: #515154;
  --text-muted: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --ok: #1d8a3f;
  --ok-soft: rgba(52, 199, 89, 0.13);
  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, 0.13);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, 0.12);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.14);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --header-h: 56px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* iOS 风格系统色图标块 */
  --tile-blue: #007aff;
  --tile-indigo: #5856d6;
  --tile-pink: #ff2d55;
  --tile-purple: #af52de;
  --tile-orange: #ff9500;
  --tile-teal: #30b0c7;
  --tile-green: #34c759;
  --tile-gray: #8e8e93;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-alt: #111113;
  --bg-elevated: #1c1c1e;
  --bg-glass: rgba(20, 20, 22, 0.78);
  --bg-glass-strong: rgba(28, 28, 30, 0.92);
  --text: #f5f5f7;
  --text-secondary: #c7c7cc;
  --text-muted: #8e8e93;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-soft: rgba(41, 151, 255, 0.16);
  --ok: #30d158;
  --ok-soft: rgba(48, 209, 88, 0.16);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.16);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.7);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 28px);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  word-break: break-all;
}

[data-theme="dark"] code {
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   顶部阅读进度条与毛玻璃导航栏
   ========================================================================== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent), #5ac8fa);
  z-index: 120;
  transition: width 80ms linear;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.015em;
  min-width: 0;
}

.brand-link:hover {
  text-decoration: none;
  opacity: 0.85;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.brand-sub {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.search-trigger kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(0.95);
}

.menu-btn {
  display: none;
}

/* ==========================================================================
   Hero 顶部主视觉区
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 68px 20px 56px;
  background:
    radial-gradient(65% 80% at 15% 0%, rgba(0, 113, 227, 0.08), transparent 65%),
    radial-gradient(55% 75% at 88% 12%, rgba(175, 82, 222, 0.08), transparent 65%),
    linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .hero {
  background:
    radial-gradient(60% 75% at 15% 0%, rgba(41, 151, 255, 0.16), transparent 65%),
    radial-gradient(55% 70% at 88% 10%, rgba(175, 82, 222, 0.14), transparent 65%),
    linear-gradient(180deg, #0c0c0e 0%, #000000 100%);
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.hero h1 {
  margin: 0 auto 16px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.032em;
  color: var(--text);
}

.hero-lead {
  margin: 0 auto 28px;
  max-width: 640px;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
  color: var(--text-secondary);
  font-weight: 400;
}

.hero-address {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 42px;
}

.hero-address strong {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
}

/* 7 大章节快速导航卡片 */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s, border-color 0.22s;
}

.quick-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.quick-card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.quick-card-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* 彩色圆角图标块 */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: #ffffff;
  flex-shrink: 0;
}

.tile svg {
  width: 18px;
  height: 18px;
}

.tile-lg {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.tile-lg svg {
  width: 22px;
  height: 22px;
}

.tile-blue { background: linear-gradient(180deg, #3298ff 0%, #0071e3 100%); }
.tile-indigo { background: linear-gradient(180deg, #7472f2 0%, #5856d6 100%); }
.tile-pink { background: linear-gradient(180deg, #ff4f73 0%, #ff2d55 100%); }
.tile-purple { background: linear-gradient(180deg, #c66ff0 0%, #af52de 100%); }
.tile-orange { background: linear-gradient(180deg, #ffaa2b 0%, #ff9500 100%); }
.tile-teal { background: linear-gradient(180deg, #4cc6db 0%, #249eb5 100%); }
.tile-green { background: linear-gradient(180deg, #4cd964 0%, #28b446 100%); }
.tile-gray { background: linear-gradient(180deg, #98989d 0%, #76767a 100%); }

/* ==========================================================================
   主布局：左侧粘性目录 + 右侧阅读区
   ========================================================================== */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 20px 96px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 44px);
  overflow-y: auto;
  padding-right: 8px;
}

.sidebar-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px 12px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.16s, color 0.16s;
}

.toc-link:hover {
  text-decoration: none;
  background: var(--bg-alt);
  color: var(--text);
}

.toc-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.toc-num {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
  width: 18px;
}

.toc-sub {
  list-style: none;
  margin: 2px 0 6px 32px;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--border);
  display: grid;
  gap: 2px;
}

.toc-sub a {
  display: block;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-muted);
}

.toc-sub a:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--bg-alt);
}

.toc-sub a.is-active {
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   正文排版与章节样式
   ========================================================================== */
.content {
  min-width: 0;
  max-width: 840px;
}

.chapter {
  padding-bottom: 64px;
  margin-bottom: 64px;
  border-bottom: 1px solid var(--border);
}

.chapter:last-of-type {
  border-bottom: none;
  margin-bottom: 24px;
  padding-bottom: 0;
}

.chapter-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.chapter-kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 0 0 4px;
}

.chapter h2 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.chapter-lead {
  margin: 10px 0 0;
  font-size: 16.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.section-block {
  margin-top: 32px;
}

.section-block h3 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-block p {
  margin: 0 0 14px;
  color: var(--text-secondary);
}

.section-block p:last-child {
  margin-bottom: 0;
}

/* Bento 网格卡片 */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

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

.card {
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.card-elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.card-title {
  margin: 0 0 8px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.card p:last-child {
  margin-bottom: 0;
}

.card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 14.5px;
  color: var(--text-secondary);
  display: grid;
  gap: 6px;
}

/* 步骤列表 */
.steps {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.step-title {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--text);
  margin: 0 0 4px;
}

.step-desc {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 提示框 (Apple Callout) */
.callout {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  margin-top: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-secondary);
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.callout-info {
  background: var(--accent-soft);
  border-color: rgba(0, 113, 227, 0.2);
}

.callout-info .callout-icon {
  color: var(--accent);
}

.callout-ok {
  background: var(--ok-soft);
  border-color: rgba(52, 199, 89, 0.25);
}

.callout-ok .callout-icon {
  color: var(--ok);
}

.callout-warn {
  background: var(--warn-soft);
  border-color: rgba(255, 149, 0, 0.26);
}

.callout-warn .callout-icon {
  color: var(--warn);
}

.callout strong {
  color: var(--text);
}

/* 视觉示意图：双机架构 / 信号路径 */
.diagram-box {
  margin-top: 18px;
  padding: 24px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.diagram-caption {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* 双机示意图 */
.topo-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topo-node {
  min-width: 175px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.topo-node-primary {
  border-color: rgba(0, 113, 227, 0.35);
}

.topo-role {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 6px;
}

.topo-node-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.topo-node-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.topo-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.topo-arrow-down {
  display: none;
  font-size: 16px;
  line-height: 1;
}

/* 信号路径示意图 */
.signal-path {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.signal-node {
  flex: 1 1 110px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  text-align: center;
}

.signal-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.signal-val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.signal-sep {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
}

.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* iOS 设置风格分组列表 */
.ios-group {
  margin-top: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ios-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.ios-row:last-child {
  border-bottom: none;
}

.ios-row-body {
  min-width: 0;
  flex: 1;
}

.ios-row-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 3px;
}

.ios-row-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
}

/* 折叠详情 (Disclosure) */
.disclosure {
  margin-top: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.disclosure summary {
  list-style: none;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-right: 4px;
}

.disclosure[open] summary::after {
  transform: rotate(-135deg);
}

.disclosure-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: 14.5px;
  color: var(--text-secondary);
}

/* 十大音色单元列表 */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.unit-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.unit-item-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.unit-item-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* 表格样式（三级重置对比） */
.table-wrap {
  margin-top: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background: var(--bg-elevated);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

td {
  color: var(--text-secondary);
}

/* ==========================================================================
   页脚与返回顶部
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.footer-brand {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}

.back-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   移动端抽屉目录 & 搜索弹窗
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(310px, 84vw);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  z-index: 160;
  padding: 16px 16px 28px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 搜索弹窗 */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 24px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.search-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.search-dialog {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-10px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-modal.is-open .search-dialog {
  transform: translateY(0) scale(1);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-input-row svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}

.search-results {
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: 8px;
}

.search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  transition: background-color 0.14s;
}

.search-item:hover,
.search-item:focus-visible {
  background: var(--bg-alt);
  outline: none;
}

.search-item-cat {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.search-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.search-item-snippet {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* 搜索跳转高亮反馈 */
.is-flash {
  animation: flashRing 1.6s ease;
}

@keyframes flashRing {
  0% { box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.35); border-radius: 14px; }
  25% { box-shadow: 0 0 0 8px rgba(0, 113, 227, 0.16); border-radius: 14px; }
  100% { box-shadow: 0 0 0 0 rgba(0, 113, 227, 0); border-radius: 14px; }
}

/* ==========================================================================
   响应式适配：平板 & 手机
   ========================================================================== */
@media (max-width: 1080px) {
  .topbar-inner {
    padding: 0 28px;
  }

  .hero {
    padding: 56px 28px 48px;
  }

  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 36px 28px 80px;
  }

  .sidebar {
    display: none;
  }

  .content {
    max-width: 100%;
  }

  .menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 767px) {
  .topbar-inner {
    padding: 0 20px;
  }

  .brand-sub,
  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .search-trigger {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .hero {
    padding: 40px 22px 36px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-lead {
    font-size: 15.5px;
    margin-bottom: 22px;
  }

  .hero-address {
    font-size: 13px;
    padding: 8px 14px;
    margin-bottom: 28px;
    max-width: 100%;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .quick-card {
    padding: 14px 13px;
  }

  .quick-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .layout {
    padding: 32px 22px 72px;
  }

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

  .chapter {
    padding-bottom: 44px;
    margin-bottom: 44px;
  }

  .chapter-head {
    gap: 12px;
  }

  .card {
    padding: 18px;
  }

  .step {
    padding: 14px 16px;
    gap: 12px;
  }

  .callout {
    padding: 14px 16px;
  }

  .diagram-box {
    padding: 18px 16px;
  }

  .topo-flow {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topo-node {
    min-width: 0;
    width: 100%;
  }

  .topo-arrow {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 2px 0;
  }

  .topo-arrow-line {
    display: none;
  }

  .topo-arrow-down {
    display: inline;
  }

  .signal-path {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .signal-node {
    flex: none;
    width: 100%;
    padding: 10px 14px;
  }

  .signal-sep {
    transform: rotate(90deg);
    text-align: center;
    line-height: 1;
  }

  /* 移动端表格转为卡片式堆叠，避免挤压或横向裁切 */
  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    padding: 14px 16px;
  }

  td {
    border: none;
    padding: 4px 0;
  }

  td:nth-child(1) {
    font-size: 15.5px;
    color: var(--text);
    padding-bottom: 6px;
  }

  td:nth-child(2)::before {
    content: "清除范围：";
    font-weight: 600;
    color: var(--text);
  }

  td:nth-child(3)::before {
    content: "保留内容：";
    font-weight: 600;
    color: var(--ok);
  }

  .footer {
    padding: 32px 22px;
  }

  .back-top {
    right: 18px;
    bottom: 20px;
  }
}

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

@media print {
  .topbar,
  .sidebar,
  .back-top,
  .progress-bar,
  .search-modal,
  .mobile-drawer,
  .drawer-backdrop {
    display: none !important;
  }
  .layout {
    display: block;
    padding: 0;
  }
  .content {
    max-width: 100%;
  }
}
