/* Tab 的所有关联都使用 aria-controls，组件之间不共享激活状态。 */
.tabs { min-width: 0; }
.tab-list, [role="tablist"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tab-list [role="tab"], .settings-list [role="tab"] {
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-panel);
  color: var(--c-text);
  font-weight: var(--fw-medium);
  text-align: left;
}
.tab-list [role="tab"]:hover { background: var(--c-panel-2); color: var(--c-text); }
.tab-list [role="tab"][aria-selected="true"] { border-color: var(--c-accent); background: var(--c-accent); color: var(--c-text); font-weight: var(--fw-bold); }
.tab-panel { min-width: 0; margin-top: 32px; }
.settings-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  min-width: 0;
  border-radius: var(--r-panel);
  background: var(--c-panel);
  color: var(--c-text);
}
.settings-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 48px 32px;
  border-right: 1px solid var(--c-border);
}
.settings-list [role="tab"] {
  position: relative;
  border: 0;
  padding-left: 30px;
  border-radius: var(--r-btn);
  background: var(--c-clear);
  color: var(--c-muted);
}
.settings-list [role="tab"]::before { content: ""; position: absolute; left: 10px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: var(--r-round); background: var(--c-clear); color: var(--c-text); }
.settings-list [role="tab"][aria-selected="true"] { font-weight: var(--fw-bold); color: var(--c-text); }
.settings-list [role="tab"][aria-selected="true"]::before { background: var(--c-accent); color: var(--c-text); }
.settings-list [role="tab"]:hover { background: var(--c-panel-2); color: var(--c-text); }
.settings-content { min-width: 0; padding: 64px 48px 0; }
.settings-content .tab-panel { margin-top: 0; margin-bottom: -24px; padding: 36px; border: 1px solid var(--c-border); border-radius: var(--r-card); background: var(--c-bg); color: var(--c-text); }
.settings-content p { margin-top: 18px; color: var(--c-muted); }
.setting-options { margin: 24px 0 0; padding: 0; list-style: none; }
.setting-options li { display: flex; align-items: center; gap: 10px; padding-block: 14px; border-top: 1px solid var(--c-border); font-size: var(--fs-nav); }
.setting-options li::before { content: ""; width: 8px; height: 8px; flex-shrink: 0; border: 1px solid var(--c-muted); border-radius: var(--r-round); }
.setting-options .selected::before { background: var(--c-accent); color: var(--c-text); border-color: var(--c-accent-dark); }
.settings-section { padding-bottom: 32px; }

/* 目录条须直接置于覆盖全部章节的容器中。 */
.toc {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 10px;
  margin-bottom: 36px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-menu);
  background: var(--c-bg);
  color: var(--c-text);
}
.toc a { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 44px; padding: 10px 16px; border-radius: var(--r-btn); font-size: var(--fs-sm); }
.toc a:hover, .toc a[aria-current="location"] { background: var(--c-panel); color: var(--c-text); }
.toc-static { position: static; }

.faq-item { padding: 0 28px; border: 1px solid var(--c-border); border-radius: var(--r-card); background: var(--c-bg); color: var(--c-text); }
.faq-item + .faq-item { margin-top: 12px; }
.faq-item summary { position: relative; min-height: 72px; padding: 22px 32px 22px 0; list-style: none; cursor: pointer; font-weight: var(--fw-semibold); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; top: 20px; right: 0; font-family: var(--font-mono); font-size: var(--fs-lead); }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding-bottom: 28px; color: var(--c-muted); }
.faq-answer p + p { margin-top: 16px; }

.term-card { padding: 32px; border-radius: var(--r-card); background: var(--c-panel); color: var(--c-text); border: 1px solid var(--c-border); min-width: 0; }
.term-card dt { font-size: var(--fs-h3); font-weight: var(--fw-bold); }
.term-card dd { margin: 16px 0 0; color: var(--c-muted); }
.term-family { display: block; margin-bottom: 12px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--c-muted); }

.client-card { padding: 36px; min-width: 0; border: 1px solid var(--c-border); border-radius: var(--r-panel); background: var(--c-bg); color: var(--c-text); }
.client-card.is-primary { border-color: var(--c-accent-dark); }
.client-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 24px; }
.client-head > div { min-width: 0; }
.client-logo { width: 56px; height: 56px; flex-shrink: 0; }
.client-rev { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--c-muted); }
.client-description { color: var(--c-muted); }
.client-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.client-extra { margin-top: 18px; font-size: var(--fs-sm); }
.client-extra a { text-decoration: underline; text-underline-offset: 4px; }

.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge, .tag {
  display: inline-block;
  max-width: 100%;
  padding: 5px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-panel);
  color: var(--c-text);
  font-size: var(--fs-xs);
  line-height: 1.6;
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
  vertical-align: middle;
}
.badge-primary { border-color: var(--c-accent); background: var(--c-accent); color: var(--c-text); }
.badge-recommended { border-color: var(--c-accent-dark); background: var(--c-bg); color: var(--c-accent-dark); }
.badge-retired { border-color: var(--c-border); background: var(--c-panel-2); color: var(--c-muted); }
.tag { font-weight: var(--fw-normal); }

.article-card { display: flex; flex-direction: column; min-width: 0; padding: 32px; border: 1px solid var(--c-border); border-radius: var(--r-card); background: var(--c-panel); color: var(--c-text); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--c-muted); }
.article-card h3 { font-size: var(--fs-lead); line-height: 1.5; }
.article-card p { margin-top: 16px; color: var(--c-muted); }
.article-link { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 44px; margin-top: 24px; font-weight: var(--fw-semibold); }
.article-card a:hover { text-decoration: underline; text-underline-offset: 4px; }

.callout { margin-inline: 0; padding: 24px 28px; border: 1px solid var(--c-border); border-left: 4px solid var(--c-accent-dark); border-radius: var(--r-menu); background: var(--c-panel); color: var(--c-text); }
.callout strong { display: block; margin-bottom: 8px; }
.callout-warning { border-left-color: var(--c-warn); }
.callout-error { border-left-color: var(--c-error); }
.callout-success { border-left-color: var(--c-success); }
.download-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 32px; border-radius: var(--r-card); background: var(--c-accent); color: var(--c-text); }
.download-note > div { min-width: 0; flex: 1 1 260px; }
.download-note p { margin-top: 10px; }
.dl-fab { position: fixed; right: 24px; bottom: 24px; z-index: 15; display: inline-flex; align-items: center; gap: 10px; min-height: 54px; max-width: calc(100% - 40px); padding: 12px 20px; border: 1px solid var(--c-accent-dark); border-radius: var(--r-pill); background: var(--c-accent); color: var(--c-text); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.dl-fab svg { width: 20px; height: 20px; flex-shrink: 0; }
.dl-fab:hover { background: var(--c-accent-hi); color: var(--c-text); }
.has-dl-fab .site-footer { padding-bottom: 100px; }

.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; border: 1px solid var(--c-border); border-radius: var(--r-menu); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-nav); background: var(--c-bg); color: var(--c-text); }
.data-table th, .data-table td, .prose table th, .prose table td {
  min-width: 7em;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th, .prose table th { background: var(--c-panel); color: var(--c-text); font-weight: var(--fw-semibold); }
.data-table tr:last-child td { border-bottom: 0; }
.prose table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  border-collapse: collapse;
  margin-block: 24px;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--fs-nav);
}
.prose table code { overflow-wrap: anywhere; }

/* 无脚本预览所需的状态与色板。 */
.preview-section { padding-top: 88px; padding-bottom: 88px; }
.preview-section h2 { margin-bottom: 32px; }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.preview-type > * + * { margin-top: 24px; }
.preview-type .type-h1 { font-size: var(--fs-h1); font-weight: var(--fw-display); line-height: var(--lh-title); }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr))); gap: 12px; }
.swatch { min-height: 96px; padding: 20px; border: 1px solid var(--c-border); border-radius: var(--r-btn); background: var(--c-bg); color: var(--c-text); font-family: var(--font-mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.sw-bg { background: var(--c-bg); color: var(--c-text); }
.sw-panel { background: var(--c-panel); color: var(--c-text); }
.sw-panel2 { background: var(--c-panel-2); color: var(--c-text); }
.sw-border { background: var(--c-border); color: var(--c-text); }
.sw-accent { background: var(--c-accent); color: var(--c-text); }
.sw-accent-hi { background: var(--c-accent-hi); color: var(--c-text); }
.sw-accent-dark { background: var(--c-accent-dark); color: var(--on-dark); }
.sw-text { background: var(--c-text); color: var(--on-dark); }
.sw-muted { background: var(--c-muted); color: var(--on-dark); }
.sw-success { background: var(--c-success); color: var(--c-text); }
.sw-warn { background: var(--c-warn); color: var(--c-text); }
.sw-error { background: var(--c-error); color: var(--on-dark); }
.sw-ink { background: var(--ink-950); color: var(--on-dark); }
.sw-panel-a { background: var(--ink-panel-a); color: var(--on-dark); }
.sw-panel-b { background: var(--ink-panel-b); color: var(--on-dark); }
.sw-ring { background: var(--ink-ring); color: var(--on-dark); }
.sw-window { background: var(--ink-window); color: var(--on-dark); }
.sw-window-line { background: var(--ink-window-line); color: var(--on-dark); }
.sw-menu { background: var(--ink-menu); color: var(--on-dark); }
.sw-menu-line { background: var(--ink-menu-line); color: var(--on-dark); }
.sw-menu-on { background: var(--ink-menu-on); color: var(--on-dark); }
.sw-slab0 { background: var(--ink-slab-0); color: var(--on-dark); }
.sw-slab1 { background: var(--ink-slab-1); color: var(--on-dark); }
.sw-chip { background: var(--ink-chip-line); color: var(--on-dark); }
.sw-hover { background: var(--ink-hover); color: var(--on-dark); }
.sw-on-dark { background: var(--on-dark); color: var(--c-text); }
.sw-on-dark2 { background: var(--on-dark-2); color: var(--c-text); }
.sw-dark-muted { background: var(--on-dark-muted); color: var(--c-text); }
.sw-dark-faint { background: var(--on-dark-faint); color: var(--on-dark); }
.sw-accent-line { background: var(--line-on-accent); color: var(--c-text); }
.sw-veil { background: var(--veil-color); color: var(--on-dark); }
.sw-clear { background: var(--c-clear); color: var(--c-text); }
.preview-dark { padding: 28px; border-radius: var(--r-card); background: var(--ink-950); color: var(--on-dark); }
.preview-language summary { list-style: none; cursor: pointer; }
.preview-language summary::-webkit-details-marker { display: none; }
.preview-nav-static { display: none; }

@media (max-width: 768px) {
  .settings-board { grid-template-columns: minmax(0, 1fr); }
  .settings-list { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 20px; border-right: 0; border-bottom: 1px solid var(--c-border); }
  .settings-list [role="tab"] { flex: 0 1 auto; padding-right: 14px; }
  .settings-content { padding: 24px 20px 0; }
  .settings-content .tab-panel { padding: 24px; }
}
@media (max-width: 640px) {
  .client-card, .term-card, .article-card { padding: 24px; }
  .faq-item { padding-inline: 20px; }
  .callout { padding: 22px; }
  .download-note { padding: 24px; }
  .dl-fab { right: 20px; bottom: 20px; }
  .swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swatch { padding: 14px; }
  .preview-nav-static { display: block; }
}