/* 通用 tab；每个 data-tabs 独立管理自己的面板。 */
.tabs { min-width: 0; }
[role="tablist"] { display: flex; align-items: center; gap: 8px; max-width: 100%; overflow-x: auto; padding: 4px; scrollbar-width: thin; }
[role="tab"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--clear);
  border-radius: var(--r-pill);
  background: var(--clear);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: var(--weight-medium);
  line-height: 1.5;
}
[role="tab"]:hover { background: var(--bg); color: var(--text); }
[role="tab"][aria-selected="true"] { background: var(--accent); color: var(--text); }
[role="tabpanel"] { min-width: 0; }
.tab-panel { margin-top: 24px; }
.settings-browser {
  display: grid;
  grid-template-columns: minmax(0, 34fr) minmax(0, 66fr);
  gap: 32px;
  padding: 32px;
  border-radius: var(--r-panel);
  background: var(--bg-panel);
  color: var(--text);
}
.settings-browser [role="tablist"] { align-items: stretch; flex-direction: column; justify-content: center; overflow: visible; gap: 14px; }
.settings-browser [role="tab"] { width: 100%; justify-content: flex-start; padding: 16px 22px; text-align: left; }
.settings-browser__detail {
  min-height: 360px;
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--text);
}
.settings-browser__detail h3 { margin-top: 0; }
.settings-browser__detail p { color: var(--text-muted); }
.setting-example {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-small);
  background: var(--bg-panel);
  color: var(--text);
}
.setting-example code { font-size: 13px; }
.tab-progress { position: absolute; bottom: 5px; left: 22px; right: 22px; height: 2px; overflow: hidden; background: var(--accent-line); color: var(--text); }
.tab-progress::after { content: ""; display: block; height: 100%; background: var(--accent-deep); transform: scaleX(0); transform-origin: left; }
.is-autoplay [aria-selected="true"] .tab-progress::after { animation: tab-time var(--tab-duration) linear forwards; }
@keyframes tab-time { to { transform: scaleX(1); } }
.toc {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 40px;
}
.toc a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r-pill); color: var(--text-muted); text-decoration: none; }
.toc a:hover, .toc a[aria-current] { background: var(--accent); color: var(--text); }
.faq-item { border-bottom: 1px solid var(--border); background: var(--bg); color: var(--text); }
.faq-item summary { position: relative; padding: 24px 44px 24px 0; cursor: pointer; list-style: none; font-weight: var(--weight-semibold); font-size: 18px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 8px; top: 22px; color: var(--accent-deep); font-size: 24px; line-height: 1.5; }
.faq-item[open] summary::after { content: "−"; }
.faq-item__answer { padding-bottom: 24px; max-width: 70em; color: var(--text-muted); }
.faq-item__answer p:last-child { margin-bottom: 0; }
.term-card { padding: 28px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.term-card__name { margin: 0 0 6px; font-size: 22px; }
.term-card__alias { display: block; margin-bottom: 18px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.term-card p { margin-bottom: 0; color: var(--text-muted); }
.client-card { padding: 32px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg); color: var(--text); }
.client-card--first { border-color: var(--accent-dark); }
.client-card__head { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.client-card__head > div { min-width: 0; }
.client-card__logo { width: 56px; height: 56px; flex-shrink: 0; }
.client-card__title { margin: 0 0 6px; font-size: 22px; }
.client-card__desc { margin-top: 24px; color: var(--text-muted); }
.client-card__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.client-card__meta { margin-top: 14px; color: var(--text-muted); font-size: 13px; }
[data-version]:empty { display: none; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.badge--first { border-color: var(--accent); background: var(--accent); color: var(--text); }
.badge--recommended { border-color: var(--accent-dark); background: var(--bg); color: var(--accent-deep); }
.badge--archived { border-color: var(--border); background: var(--bg-panel); color: var(--text-muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; flex-shrink: 0; border-radius: var(--r-round); background: var(--success); }
.post-card { display: flex; flex-direction: column; gap: 18px; padding: 30px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg); color: var(--text); }
.post-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.post-card__title { margin: 0; font-size: 22px; line-height: 1.45; }
.post-card__title a { color: var(--text); text-decoration: none; }
.post-card__title a:hover { color: var(--accent-deep); }
.post-card p { margin: 0; color: var(--text-muted); font-size: 15px; }
.post-card__more { margin-top: auto; color: var(--accent-deep); font-size: 14px; font-weight: var(--weight-semibold); }
.callout { margin: 28px 0; padding: 24px 28px; border: 1px solid var(--border); border-left: 4px solid var(--accent-dark); border-radius: var(--r-small); background: var(--bg-panel); color: var(--text); }
.callout p:last-child { margin-bottom: 0; }
.callout--warn { border-left-color: var(--warn); }
.callout--error { border-left-color: var(--error); }
.callout__title { display: block; margin-bottom: 8px; font-weight: var(--weight-semibold); }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-small); -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg); color: var(--text); text-align: left; }
.data-table th, .data-table td, .prose table th, .prose table td, .article-body table th, .article-body table td {
  min-width: 7em;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
}
.data-table th, .prose table th, .article-body table th { background: var(--bg-panel); color: var(--text); font-weight: var(--weight-semibold); }
.data-table tr:last-child td { border-bottom: 0; }
/* 后代选择器也覆盖隔着 div 的后台文章裸表格。 */
.prose table, .article-body table {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}
.prose table code, .article-body table code { overflow-wrap: anywhere; }
.dl-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 9px 18px 9px 15px;
  border: 1px solid var(--accent-dark);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text);
  font-size: 14.5px;
  font-weight: var(--weight-semibold);
  text-decoration: none;
  line-height: 1.5;
}
.dl-fab:hover { background: var(--accent-hover); color: var(--text); }
.dl-fab svg { width: 17px; height: 17px; flex-shrink: 0; }
.article-download { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; margin-top: 56px; padding: 32px; border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.article-download__copy { flex: 1 1 260px; min-width: 0; }
.article-download h2 { margin: 0 0 10px; font-size: 24px; }
.article-download p { margin: 0; color: var(--text-muted); }
.quicksteps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; list-style: none; padding: 0; margin: 40px 0 32px; counter-reset: quick; }
.quicksteps li { min-width: 0; counter-increment: quick; }
.quicksteps li::before { content: counter(quick); display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 22px; border: 1px solid var(--text); border-radius: var(--r-round); font-family: var(--font-mono); }
.quicksteps h3 { margin: 0 0 12px; }
.quicksteps p { margin: 0; }
.preview-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.preview-heading { margin-top: 0; }
.preview-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.preview-dark { padding: 28px; border-radius: var(--r-card); background: var(--bg-stage); color: var(--on-dark); }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.swatch { min-width: 0; border: 1px solid var(--border); border-radius: var(--r-small); background: var(--bg); color: var(--text); overflow: hidden; }
.swatch__paint { display: block; height: 64px; border-bottom: 1px solid var(--border); }
.swatch code { display: block; padding: 12px; color: var(--text-muted); font-size: 11px; }
.sw-bg { background: var(--bg); }
.sw-panel { background: var(--bg-panel); }
.sw-stage { background: var(--bg-stage); }
.sw-border { background: var(--border); }
.sw-accent { background: var(--accent); }
.sw-hover { background: var(--accent-hover); }
.sw-dark { background: var(--accent-dark); }
.sw-deep { background: var(--accent-deep); }
.sw-soft { background: var(--accent-soft); }
.sw-line { background: var(--accent-line); }
.sw-text { background: var(--text); }
.sw-muted { background: var(--text-muted); }
.sw-success { background: var(--success); }
.sw-warn { background: var(--warn); }
.sw-error { background: var(--error); }
.sw-on { background: var(--on-dark); }
.sw-on-muted { background: var(--on-dark-muted); }
.sw-on-faint { background: var(--on-dark-faint); }
.sw-on-line { background: var(--on-dark-line); }
.sw-on-hover { background: var(--on-dark-hover); }
.sw-graphite { background: var(--graphite); }
.sw-lift { background: var(--graphite-lift); }
.sw-back { background: var(--graphite-back); }
.sw-back-line { background: var(--graphite-back-line); }
.sw-cam { background: var(--graphite-cam); }
.sw-screen { background: var(--screen-bg); }
.sw-screen-card { background: var(--screen-card); }
.sw-screen-line { background: var(--screen-line); }
.sw-knob { background: var(--knob); }
.sw-sofa { background: var(--sofa-fill); }
.sw-sofa-line { background: var(--sofa-line); }
.sw-sofa-seam { background: var(--sofa-seam); }
.sw-cat { background: var(--cat-line); }
.sw-cat-fill { background: var(--cat-fill); }
.sw-glow { background: var(--lamp-glow); }
.sw-glow-end { background: var(--lamp-glow-end); }
.sw-keep { background: var(--mask-keep); }
.sw-cut { background: var(--mask-cut); }
.sw-clear { background: var(--mask-clear); }
.sw-transparent { background: var(--clear); }
.sw-veil { background: var(--veil); }
@media (max-width: 900px) {
  .settings-browser { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px; }
  .settings-browser [role="tablist"] { flex-direction: row; overflow-x: auto; justify-content: flex-start; gap: 8px; }
  .settings-browser [role="tab"] { width: auto; white-space: nowrap; }
  .settings-browser__detail { padding: 28px; }
  .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .quicksteps { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .settings-browser { padding: 16px; }
  .settings-browser__detail { min-height: 0; padding: 24px 20px; }
  .client-card, .post-card, .term-card, .article-download { padding: 24px; }
  .toc { flex-wrap: nowrap; overflow-x: auto; }
  .toc a { flex-shrink: 0; }
  .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-fab { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
}