/* 分段控件与左右分栏舞台 */
.capability { padding: 12px var(--gutter) 120px; }
.seg, [role="tablist"].seg {
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 6px;
  overflow-x: auto;
  background: var(--bg);
  color: var(--text);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-seg);
}
.seg-tab {
  appearance: none;
  flex-shrink: 0;
  border: 0;
  margin: 0;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  background: var(--transparent);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 15px;
}
.seg-tab:hover { background: var(--bg-panel); color: var(--text); }
.seg-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: var(--weight-medium); }
.cap-stage {
  margin-top: 40px;
  padding: 72px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px;
  align-items: center;
  background: var(--bg-panel);
  color: var(--text);
  border-radius: var(--r-panel);
}
.cap-title { margin: 0; font-size: 32px; line-height: 1.25; }
.cap-text { margin: 20px 0 0; font-size: 15.5px; line-height: 1.85; color: var(--text-muted); }
.cap-link { display: inline-block; margin-top: 24px; font-size: 15px; font-weight: var(--weight-medium); color: var(--accent-dark); }
.snippet { background: var(--bg); color: var(--text); border-radius: var(--r-card); box-shadow: var(--shadow-sheet); padding: 24px 28px; font-family: var(--font-mono); font-size: 13.5px; line-height: 2.1; max-width: 100%; overflow-x: auto; }
.snippet pre { padding: 0; margin: 0; background: var(--bg); color: var(--text); border-radius: 0; font-size: inherit; line-height: inherit; }
.snippet .sec { color: var(--accent-dark); font-weight: var(--weight-strong); }
.snippet .cm { color: var(--text-muted); }
.snippet .p-proxy { color: var(--accent-dark); font-weight: var(--weight-strong); }
.snippet .p-direct { color: var(--text-muted); font-weight: var(--weight-strong); }
.snippet .p-reject { color: var(--error-ink); font-weight: var(--weight-strong); }
.settings-group { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sheet); border-radius: var(--r-card); padding: 8px 24px; list-style: none; margin: 0; }
.settings-group li { padding-block: 17px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); }
.settings-group li:last-child { border-bottom: 0; }
.settings-group .chevron { flex-shrink: 0; color: var(--text-muted); }
.protocol-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* 长页目录；直接放在覆盖所有章节的内容容器中。 */
.toc { position: sticky; top: 16px; z-index: 20; margin-bottom: var(--space-7); padding: 12px; background: var(--bg); color: var(--text); border-radius: var(--r-md); box-shadow: var(--shadow-seg); }
.toc.is-flow { position: static; }
.toc ul { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.toc li { flex-shrink: 0; }
.toc a { display: block; min-height: 44px; padding: 10px 16px; border-radius: var(--r-sm); font-size: var(--size-small); }
.toc a:hover, .toc a[aria-current="location"] { background: var(--accent-soft); color: var(--accent-dark); }

/* FAQ 基于浏览器原生 details，无脚本也可操作。 */
.faq-list { display: grid; gap: 12px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); color: var(--text); }
.faq-item summary { position: relative; list-style: none; padding: 22px 56px 22px 24px; cursor: pointer; font-weight: var(--weight-medium); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 24px; top: 20px; color: var(--accent-dark); font-size: 22px; font-family: var(--font-mono); }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 24px 24px; color: var(--text-muted); line-height: 1.85; }
.faq-answer p:last-child { margin-bottom: 0; }

/* 术语与文章 */
.term-card { padding: 28px 32px; border-radius: var(--r-card); background: var(--bg); color: var(--text); box-shadow: var(--shadow-seg); }
.term-card h3 { margin-top: 12px; margin-bottom: 12px; }
.term-card p { color: var(--text-muted); margin-bottom: 0; line-height: 1.85; }
.term-key { display: inline-block; max-width: 100%; font-family: var(--font-mono); font-size: 12px; padding: 4px 10px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-dark); overflow-wrap: anywhere; }
.article-card { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 32px; border-radius: var(--r-card); background: var(--bg); color: var(--text); box-shadow: var(--shadow-seg); }
.article-card h3 { margin: 0; font-size: 24px; line-height: 1.4; }
.article-card h3 a:hover { color: var(--accent-dark); }
.article-card p { margin: 0; color: var(--text-muted); line-height: 1.8; }
.article-card .text-link { margin-top: auto; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: var(--size-caption); color: var(--text-muted); }

/* 自绘文字商店按钮，不使用徽章图片。 */
.store-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 24px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--grad-accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-cta);
  line-height: 1.2;
  font-weight: var(--weight-medium);
  transition: transform var(--duration-fast) var(--ease);
}
.store-button:hover { transform: translateY(-1px); }
.store-button svg { width: 24px; height: 26px; flex-shrink: 0; }
.store-button-copy { display: grid; gap: 4px; text-align: left; }
.store-button-copy small { font-size: 11px; font-weight: var(--weight-normal); }
.store-button-copy strong { font-size: 16px; font-weight: var(--weight-medium); }
.store-button[aria-disabled="true"] { background: var(--bg-panel-2); color: var(--text-muted); box-shadow: none; transform: none; cursor: not-allowed; }

/* 事实、标签与静态装饰条 */
.fact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.fact-pill, .badge { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 6px 12px; border-radius: var(--r-pill); background: var(--bg-panel); color: var(--text-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.fact-pill code { font-size: 11px; }
.badge { background: var(--accent-soft); color: var(--accent-dark); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-error { background: var(--error-soft); color: var(--error-ink); }
.status-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; padding: 16px 24px; background: var(--bg-panel); color: var(--text-muted); border-radius: var(--r-md); font-family: var(--font-mono); font-size: 12px; }
.status-dot { display: inline-block; width: 6px; height: 6px; flex-shrink: 0; margin-right: 8px; border-radius: var(--r-circle); background: var(--accent); color: var(--accent-dark); }

/* 官方截图不锁比例、不补边、不画外壳。 */
.official-shot { width: 100%; max-width: 280px; margin: 0 auto; padding: 0; flex-shrink: 0; }
.official-shot img { display: block; width: 100%; height: auto; border-radius: var(--r-sm); }
.official-shot img { border-radius: 10px; }
.official-shot > img { outline: 1px solid var(--border); }
.official-shot figcaption { padding-top: 12px; color: var(--text-muted); font-size: var(--size-caption); line-height: 1.7; text-align: center; }
.shot-pair { display: flex; flex-wrap: wrap; justify-content: center; gap: 32px; }
.shot-placeholder { display: grid; place-content: center; aspect-ratio: 750 / 1334; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-panel-2); color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; text-align: center; gap: 12px; }

/* 设备入口只设 iPhone 与 iPad 两张。 */
.device-card { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: start; gap: 20px; padding: 32px; border-radius: var(--r-card); background: var(--bg); color: var(--text); box-shadow: var(--shadow-sheet); }
.device-card > svg { width: 42px; height: 56px; color: var(--accent-dark); }
.device-card h3 { margin: 0 0 12px; }
.device-card p { margin-bottom: 20px; color: var(--text-muted); line-height: 1.8; }
.device-card .text-link { display: inline-flex; align-items: center; min-height: 44px; }

/* 引用与文末商店引导 */
.callout { margin-block: 28px; padding: 24px 28px; border-left: 4px solid var(--accent); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--accent-softer); color: var(--text); line-height: 1.85; }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--accent-dark); }
.store-note { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px; padding: 32px; border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.store-note-copy { flex: 1 1 260px; }
.store-note h2, .store-note h3 { font-size: 24px; margin: 0 0 12px; }
.store-note p { margin: 0; color: var(--text-muted); }

/* 所有表格均允许横向滑动，包含嵌套在正文 div 中的裸表格。 */
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--border); border-radius: var(--r-md); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--size-small); }
.prose table, .article-body table, .manual-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
}
.data-table th, .data-table td,
.prose table th, .prose table td,
.article-body table th, .article-body table td,
.manual-body table th, .manual-body table td {
  min-width: 7em;
  padding: 16px 20px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th, .prose table th, .article-body table th, .manual-body table th { background: var(--bg-panel); color: var(--text); font-weight: var(--weight-medium); }
.data-table td, .prose table td, .article-body table td, .manual-body table td { background: var(--bg); color: var(--text); }
.data-table td code, .prose table td code, .article-body table td code, .manual-body table td code { overflow-wrap: anywhere; }
.data-table caption { text-align: left; padding: 16px 20px; color: var(--text-muted); }

/* 所有页面统一存在；由 footer.js 自动补齐，页面无需重复。 */
.dl-fab {
  position: fixed;
  z-index: 50;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  min-height: 46px;
  padding: 8px 18px 8px 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  color: var(--accent-dark);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-float);
  font-size: 14.5px;
  font-weight: var(--weight-medium);
  transition: transform var(--duration-fast) var(--ease);
}
.dl-fab:hover { transform: translateY(-2px); }
.dl-fab-icon { width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--r-circle); display: grid; place-items: center; background: var(--grad-accent); color: var(--on-accent); }
.dl-fab-icon svg { width: 15px; height: 15px; }

/* 仅设计预览使用，颜色依然来自统一令牌。 */
.preview-section { padding-top: 80px; padding-bottom: 80px; }
.preview-section > h2 { margin-top: 0; margin-bottom: 32px; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.swatch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.swatch { padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); color: var(--text); }
.swatch-color { height: 72px; border-radius: var(--r-sm); margin-bottom: 12px; border: 1px solid var(--border); }
.swatch code { font-size: 12px; }
.swatch-bg { background: var(--bg); color: var(--text); }
.swatch-panel { background: var(--bg-panel); color: var(--text); }
.swatch-panel2 { background: var(--bg-panel-2); color: var(--text); }
.swatch-border { background: var(--border); color: var(--text); }
.swatch-accent { background: var(--accent); color: var(--on-accent); }
.swatch-dark { background: var(--accent-dark); color: var(--on-accent); }
.swatch-text { background: var(--text); color: var(--bg); }
.swatch-muted { background: var(--text-muted); color: var(--bg); }
.swatch-success { background: var(--success); color: var(--text); }
.swatch-warn { background: var(--warn); color: var(--text); }
.swatch-error { background: var(--error); color: var(--text); }
.swatch-gradient { background: var(--grad-accent); color: var(--on-accent); }
.swatch-accent-soft { background: var(--accent-soft); color: var(--accent-dark); }
.swatch-accent-softer { background: var(--accent-softer); color: var(--accent-dark); }
.swatch-success-soft { background: var(--success-soft); color: var(--success-ink); }
.swatch-warn-soft { background: var(--warn-soft); color: var(--warn-ink); }
.swatch-error-soft { background: var(--error-soft); color: var(--error-ink); }
.swatch-success-ink { background: var(--success-ink); color: var(--bg); }
.swatch-warn-ink { background: var(--warn-ink); color: var(--bg); }
.swatch-error-ink { background: var(--error-ink); color: var(--bg); }
.preview-type-display { font-family: var(--font-display); font-size: 40px; font-weight: var(--weight-normal); line-height: 1.2; }
.preview-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; }
.preview-caption { margin-top: 24px; font-size: var(--size-small); color: var(--text-muted); }
@media (max-width: 1120px) {
  .cap-stage { grid-template-columns: minmax(0, 1fr); padding: 40px; gap: 32px; }
}
@media (max-width: 768px) {
  .preview-grid { grid-template-columns: minmax(0, 1fr); }
  .swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cap-title { font-size: 28px; }
  .preview-type-display { font-size: 28px; }
}
@media (max-width: 640px) {
  .capability { padding-bottom: 64px; }
  .cap-stage { padding: 28px 20px; margin-top: 28px; border-radius: var(--r-card); }
  .seg { border-radius: var(--r-md); justify-content: flex-start; }
  .seg-tab { padding-inline: 16px; }
  .snippet { padding: 20px; font-size: 12px; }
  .fact-row { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .fact-pill { font-size: 11px; padding: 5px 9px; }
  .shot-pair { flex-direction: column; align-items: center; }
  .device-card { padding: 24px; gap: 14px; grid-template-columns: 36px minmax(0, 1fr); }
  .device-card > svg { width: 30px; height: 44px; }
  .term-card, .article-card { padding: 24px; }
  .article-card h3 { font-size: 22px; }
  .callout { padding: 20px; }
  .store-note { padding: 24px; }
  .dl-fab { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); font-size: 13px; }
  .preview-section { padding-top: 56px; padding-bottom: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .store-button { transition: none; }
  .store-button:hover { transform: none; }
}