/* 巨幅配置窗口：装饰内容，不放交互控件。 */
.stage { position: relative; margin-top: 36px; min-width: 0; }
.stage::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: -120px;
  height: 300px;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), .13), rgba(var(--accent-rgb), .04) 55%, var(--clear));
  color: var(--text);
  pointer-events: none;
}
.device {
  position: relative;
  z-index: 1;
  height: var(--dev-h);
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr);
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-window);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(var(--hair-rgb), .04), 0 40px 90px -50px rgba(var(--shade-rgb), .9);
}
.chrome { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--border); }
.lights { display: flex; gap: 7px; }
.lights i { width: 11px; height: 11px; flex-shrink: 0; border-radius: var(--r-circle); opacity: .55; }
.lights i:nth-child(1) { background: var(--error); color: var(--bg); }
.lights i:nth-child(2) { background: var(--warn); color: var(--bg); }
.lights i:nth-child(3) { background: var(--success); color: var(--bg); }
.chrome-title { font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); }
.chrome-meta { justify-self: end; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.pane { display: grid; grid-template-columns: minmax(0, 68fr) minmax(0, 32fr); gap: 18px; padding: 16px; min-height: 0; }
.canvas {
  position: relative;
  min-height: 0;
  min-width: 0;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--r-canvas);
  background: radial-gradient(120% 70% at 50% 0%, rgba(var(--accent-rgb), .10), var(--clear) 62%), var(--canvas);
  color: var(--text);
}
.canvas-glow {
  position: absolute;
  inset: -2px;
  border-radius: var(--r-canvas);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .35), 0 0 14px 1px rgba(var(--accent-rgb), .55), 0 0 44px 4px rgba(var(--accent-rgb), .26), 0 0 96px 12px rgba(var(--accent-rgb), .12), inset 0 0 26px rgba(var(--accent-rgb), .18);
  opacity: .8;
  animation: canvas-breathe 7s ease-in-out 1.2s infinite alternate;
}
.canvas-tag {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid rgba(var(--accent-rgb), .45);
  border-radius: var(--r-tag);
  background: rgba(var(--accent-rgb), .08);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
}
.code { position: relative; z-index: 1; margin-top: 16px; font-family: var(--font-mono); font-size: 13px; line-height: 20px; overflow-x: auto; }
.ln { display: grid; grid-template-columns: 22px max-content; column-gap: 18px; animation: config-rise .42s var(--ease) both; }
.ln:nth-child(1) { animation-delay: .05s; }
.ln:nth-child(2) { animation-delay: .10s; }
.ln:nth-child(3) { animation-delay: .15s; }
.ln:nth-child(4) { animation-delay: .20s; }
.ln:nth-child(5) { animation-delay: .25s; }
.ln:nth-child(6) { animation-delay: .30s; }
.ln:nth-child(7) { animation-delay: .35s; }
.ln:nth-child(8) { animation-delay: .40s; }
.ln:nth-child(9) { animation-delay: .45s; }
.ln:nth-child(10) { animation-delay: .50s; }
.ln:nth-child(11) { animation-delay: .55s; }
.ln:nth-child(12) { animation-delay: .60s; }
.n { color: var(--text-muted); text-align: right; user-select: none; }
.c { white-space: pre; color: var(--text); }
.k { color: var(--text); }
.v { color: var(--accent); }
.p { color: var(--text-muted); }
.caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -3px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), .7);
  animation: config-caret 1s steps(1, end) 1.2s 5 both;
}
.toolbar {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  max-width: calc(100% - 24px);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: rgba(var(--panel-rgb), .9);
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(var(--hair-rgb), .04), 0 14px 34px -10px rgba(var(--shade-rgb), .85);
  white-space: nowrap;
  transform: translateX(-50%);
}
.seg { display: flex; padding: 3px; border-radius: var(--r-pill); background: var(--bg-panel-2); color: var(--text-muted); }
.seg span { padding: 4px 12px; border-radius: var(--r-pill); font-size: var(--size-micro); line-height: 18px; }
.seg .is-on { color: var(--accent); background: rgba(var(--accent-rgb), .14); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .45); }
.tb-sep { width: 1px; height: 18px; flex-shrink: 0; background: var(--border); color: var(--text); margin: 0 4px; }
.tg { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; font-size: var(--size-micro); color: var(--text-muted); }
.sw { position: relative; width: 28px; height: 16px; flex-shrink: 0; border-radius: var(--r-pill); background: var(--bg-panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: var(--r-circle); background: var(--text-muted); color: var(--bg); }
.sw.on { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 10px rgba(var(--accent-rgb), .45); }
.sw.on::after { background: var(--white); color: var(--bg); transform: translateX(12px); }
.side { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel-2); color: var(--text); overflow: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg-panel); color: var(--text-muted); }
.side-tabs span { padding: 3px 12px; border-radius: var(--r-pill); font-size: var(--size-micro); line-height: 18px; }
.side-tabs .is-on { color: var(--text); background: rgba(var(--accent-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35); }
.side-src { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.log { display: grid; gap: 11px; list-style: none; margin: 18px 0 0; padding: 0; }
.log-item { display: grid; grid-template-columns: 36px 1fr; column-gap: 8px; font-family: var(--font-mono); font-size: 11.5px; line-height: 17px; animation: config-rise .42s var(--ease) both; }
.log-item:nth-child(1) { animation-delay: .30s; }
.log-item:nth-child(2) { animation-delay: .42s; }
.log-item:nth-child(3) { animation-delay: .54s; }
.log-item:nth-child(4) { animation-delay: .66s; }
.log-item:nth-child(5) { animation-delay: .76s; }
.lv { font-size: 10.5px; letter-spacing: .04em; color: var(--success); }
.msg { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.cmd { margin-top: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-panel); color: var(--text-muted); font-family: var(--font-mono); font-size: 11.5px; line-height: 17px; overflow-x: auto; white-space: nowrap; flex-shrink: 0; }
.cmd-pr { color: var(--accent); margin-right: 6px; }
.cmd-bin { color: var(--text); }
.statusbar { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.statusbar-in { display: flex; justify-content: center; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); }
.statusbar-in span + span::before { content: "·"; margin: 0 14px; }
.statusbar-in b { font-weight: var(--weight-regular); color: var(--text-muted); }

/* 通用 tabs 与首页画布 + 侧栏。 */
.tabs { min-width: 0; }
[role="tablist"] { display: flex; align-items: stretch; gap: 8px; max-width: 100%; overflow-x: auto; padding: 4px; }
[role="tab"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  flex-shrink: 0;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-weight: var(--weight-regular);
  text-align: center;
}
[role="tab"]:hover { color: var(--text); border-color: var(--border-strong); }
[role="tab"][aria-selected="true"] { background: var(--bg-panel-2); color: var(--accent); border-color: var(--accent); }
[role="tabpanel"] { min-width: 0; margin-top: 24px; }
[role="tabpanel"]:focus-visible { outline-offset: 6px; }
.feature-deck { display: grid; grid-template-columns: minmax(0, 7fr) minmax(220px, 3fr); gap: 20px; align-items: stretch; }
.feature-panels { min-width: 0; }
.feature-panels [role="tabpanel"] { margin-top: 0; height: 100%; }
.feature-canvas { padding: 32px; border: 1px solid var(--border); border-radius: var(--r-window); background: var(--bg-panel); color: var(--text); }
.feature-canvas pre { min-height: 220px; background: var(--bg-panel-2); color: var(--text); }
.feature-description { margin-top: 28px; max-width: 70ch; }
.feature-description p { color: var(--text-muted); line-height: 1.9; }
.feature-tabs[role="tablist"] { flex-direction: column; padding: 0; gap: 12px; overflow: visible; }
.feature-tabs [role="tab"] { display: block; width: 100%; padding: 24px; min-height: 100px; border-radius: var(--r-card); text-align: left; white-space: normal; overflow: hidden; }
.feature-tabs [role="tab"][aria-selected="true"] { border-color: var(--border); border-left: 2px solid var(--accent); color: var(--text); }
.feature-tabs small { display: block; margin-top: 8px; color: var(--text-muted); font-family: var(--font-mono); font-size: var(--size-micro); }
.tab-progress { position: absolute; height: 2px; bottom: 0; left: 0; right: 0; background: var(--accent); color: var(--on-accent); transform: scaleX(0); transform-origin: left; }
.tabs.is-playing [role="tab"][aria-selected="true"] .tab-progress { animation: feature-progress var(--feature-duration) linear forwards; }
.tabs.is-paused [role="tab"][aria-selected="true"] .tab-progress { transform: scaleX(1); }
.tabs-playback { margin-bottom: 16px; }

/* 长页导航的直接父级必须覆盖全部章节。 */
.document-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.document-layout > * { min-width: 0; }
.toc { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc a { display: block; padding: 10px 14px; border-left: 1px solid var(--border); color: var(--text-muted); }
.toc a:hover, .toc a[aria-current] { border-color: var(--accent); color: var(--accent); }
.toc-tabs { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding-block: 8px; }
.toc-tabs a { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg-panel); color: var(--text-muted); }
.toc-tabs a:hover { color: var(--accent); border-color: var(--accent); }

.faq-item { border: 1px solid var(--border); border-radius: var(--r-card); margin-bottom: 12px; background: var(--bg-panel); color: var(--text); }
.faq-item summary { position: relative; cursor: pointer; list-style: none; min-height: 60px; padding: 18px 54px 18px 24px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 24px; top: 17px; color: var(--accent); font-family: var(--font-mono); }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 24px 24px; color: var(--text-muted); }
.faq-answer p:last-child { margin-bottom: 0; }
.term-card { border-top: 2px solid var(--border-strong); }
.term-card dt { font-size: var(--size-h3); font-weight: var(--weight-regular); }
.term-card dd { margin: 14px 0 0; color: var(--text-muted); line-height: 1.9; }
.term-key { display: block; margin-top: 6px; font-family: var(--font-mono); font-size: var(--size-small); color: var(--accent); }
.client-card { display: flex; flex-direction: column; gap: 20px; }
.client-card.is-featured { border-color: rgba(var(--accent-rgb), .65); }
.client-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.client-head h3 { margin: 0; }
.client-details { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: var(--size-small); }
.client-details dt { color: var(--text-muted); }
.client-details dd { min-width: 0; margin: 0; }
.client-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; }
[data-ver]:empty { display: none; }
.post-card { display: flex; flex-direction: column; gap: 18px; }
.post-card h3 { font-size: 23px; line-height: 1.45; margin: 0; }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { color: var(--text-muted); margin: 0; }
.post-card .text-link { margin-top: auto; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-family: var(--font-mono); font-size: var(--size-micro); }
.badge, .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-size: var(--size-micro);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.badge-first, .badge-recommended { border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .1); color: var(--accent); }
.badge-archived { background: var(--bg-panel-2); color: var(--warn); }
.badge-success { background: var(--bg-panel-2); color: var(--success); }
.badge-error { background: var(--bg-panel-2); color: var(--error); }
.callout { margin: 24px 0; padding: 22px 24px; border: 1px solid var(--border); border-left: 2px solid var(--accent); border-radius: var(--r-ctl); background: var(--bg-panel); color: var(--text); }
.callout p { color: var(--text-muted); }
.callout p:last-child { margin-bottom: 0; }
.callout-warning { border-left-color: var(--warn); }
.article-download { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; margin-top: 48px; }
.article-download h2 { font-size: var(--size-h3); margin: 0 0 8px; }
.article-download p { color: var(--text-muted); margin: 0; }

.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--r-card); }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-panel); color: var(--text); font-size: 14px; }
.data-table caption { text-align: left; padding: 16px; color: var(--text-muted); }
.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;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th { background: var(--bg-panel-2); color: var(--text); font-weight: var(--weight-medium); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.prose table, .article-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: var(--bg-panel);
  color: var(--text);
}
.prose table code, .article-body table code, .data-table code { overflow-wrap: anywhere; white-space: normal; }

.dl-fab {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  max-width: calc(100% - 32px);
  padding: 9px 16px 9px 14px;
  border: 1px solid rgba(var(--accent-rgb), .45);
  border-radius: var(--r-pill);
  background: rgba(var(--panel-rgb), .92);
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  box-shadow: 0 12px 30px -12px rgba(var(--shade-rgb), .9), 0 0 18px -6px rgba(var(--accent-rgb), .55);
  transition: border-color var(--duration) var(--ease), background-color var(--duration) var(--ease);
}
.dl-fab svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.dl-fab:hover { border-color: var(--accent); background: var(--bg-panel-2); color: var(--text); }

/* 仅预览页使用的令牌色板。 */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.swatch { padding: 12px; border: 1px solid var(--border); border-radius: var(--r-ctl); color: var(--text); background: var(--bg-panel); }
.swatch-chip { display: block; height: 56px; border: 1px solid var(--border-strong); border-radius: var(--r-tag); margin-bottom: 12px; }
.swatch code { font-size: var(--size-micro); }
.swatch-chip[data-color="bg"] { background: var(--bg); color: var(--text); }
.swatch-chip[data-color="bg-panel"] { background: var(--bg-panel); color: var(--text); }
.swatch-chip[data-color="bg-panel-2"] { background: var(--bg-panel-2); color: var(--text); }
.swatch-chip[data-color="bg-panel-3"] { background: var(--bg-panel-3); color: var(--text); }
.swatch-chip[data-color="border"] { background: var(--border); color: var(--text); }
.swatch-chip[data-color="border-strong"] { background: var(--border-strong); color: var(--text); }
.swatch-chip[data-color="accent"] { background: var(--accent); color: var(--on-accent); }
.swatch-chip[data-color="accent-hi"] { background: var(--accent-hi); color: var(--on-accent); }
.swatch-chip[data-color="accent-dark"] { background: var(--accent-dark); color: var(--white); }
.swatch-chip[data-color="text"] { background: var(--text); color: var(--bg); }
.swatch-chip[data-color="text-muted"] { background: var(--text-muted); color: var(--bg); }
.swatch-chip[data-color="text-faint"] { background: var(--text-faint); color: var(--white); }
.swatch-chip[data-color="white"] { background: var(--white); color: var(--bg); }
.swatch-chip[data-color="on-accent"] { background: var(--on-accent); color: var(--text); }
.swatch-chip[data-color="success"] { background: var(--success); color: var(--bg); }
.swatch-chip[data-color="warn"] { background: var(--warn); color: var(--bg); }
.swatch-chip[data-color="error"] { background: var(--error); color: var(--bg); }
.swatch-chip[data-color="canvas"] { background: var(--canvas); color: var(--text); }
.swatch-chip[data-color="clear"] { background: var(--clear); color: var(--text); }

@keyframes config-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes config-caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes canvas-breathe { from { opacity: .72; } to { opacity: 1; } }
@keyframes feature-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 1100px) {
  .pane { grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); }
}
@media (max-width: 900px) {
  .document-layout { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; max-height: none; }
  .toc ul { display: flex; flex-wrap: wrap; }
}
@media (max-width: 768px) {
  .feature-deck { grid-template-columns: 1fr; }
  .feature-tabs[role="tablist"] { grid-row: 1; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .feature-tabs [role="tab"] { width: auto; min-width: 180px; min-height: 88px; padding: 18px; }
  .feature-canvas { padding: 22px; }
}
@media (max-width: 760px) {
  .stage { margin-top: 28px; }
  .stage::before { top: -60px; height: 200px; }
  .device { height: auto; border-radius: var(--r-mobile); }
  .chrome { grid-template-columns: auto 1fr; gap: 14px; }
  .chrome-title { justify-self: end; font-size: 10px; }
  .chrome-meta { display: none; }
  .pane { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .canvas { padding: 14px 14px 16px; }
  .ln:nth-child(n+7) { display: none; }
  .code { font-size: 12px; }
  .ln { grid-template-columns: 16px max-content; column-gap: 12px; }
  .toolbar { position: relative; left: auto; bottom: auto; margin-top: 16px; max-width: 100%; flex-wrap: wrap; justify-content: center; border-radius: var(--r-soft); transform: none; }
  .tb-sep { display: none; }
  .side { padding: 12px; }
  .log { margin-top: 14px; }
  .cmd { margin-top: 16px; }
  .dl-fab { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); min-height: 40px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .canvas-glow, .caret, .ln, .log-item { opacity: 1; }
}