/* Xuanshu static v1.2: existing article, navigation and controls stay intact. */
:root[data-xs-static-v12][data-xs-docs] {
  color-scheme: light;
  --paper: #f2ece0;
  --surface: #fcf9f3;
  --soft: #ece5d8;
  --ink: #25211b;
  --muted: #62594c;
  --gold: #80601c;
  --gold-soft: #e8ddc5;
  --line: #d7cbb5;
  --inverse: #fcf9f3;
  --xs-reading: rgb(252 249 243 / 91%);
  --xs-navigation: rgb(242 236 224 / 91%);
  --xs-scene-wash: rgb(242 236 224 / 14%);
  --xs-dragon: url('./dragon-light.webp');
}
:root[data-xs-static-v12][data-xs-docs][data-theme='dark'] {
  color-scheme: dark;
  --paper: #0b0c0d;
  --surface: #131417;
  --soft: #1b1c1f;
  --ink: #ede6d7;
  --muted: #b8b0a0;
  --gold: #c8a45c;
  --gold-soft: #30291c;
  --line: #3b362c;
  --inverse: #131417;
  --xs-reading: rgb(19 20 23 / 90%);
  --xs-navigation: rgb(11 12 13 / 86%);
  --xs-scene-wash: rgb(11 12 13 / 12%);
  --xs-dragon: url('./dragon-dark.webp');
}
html[data-xs-docs] body {
  isolation: isolate;
  background: var(--paper);
}
html[data-xs-docs] body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(var(--xs-scene-wash), var(--xs-scene-wash)), var(--xs-dragon) center top / cover no-repeat;
}
html[data-xs-docs] .docs-content {
  background: var(--xs-reading);
  box-shadow: 0 0 0 20px var(--xs-reading);
}
html[data-xs-docs] .docs-sidebar,
html[data-xs-docs] .docs-toc {
  background: var(--xs-navigation);
  box-shadow: 0 0 0 12px var(--xs-navigation);
}
/* The retained historical HTML has its own topbar and token vocabulary. */
:root.xs-docs[data-xs-static-v12][data-xs-docs] {
  --bg: var(--paper);
  --text: var(--ink);
  --text-strong: var(--ink);
  --text-soft: var(--muted);
  --surface-soft: var(--soft);
  --hover: var(--soft);
  --border: var(--line);
  --link: var(--gold);
  --active-bg: var(--gold-soft);
  --active-text: var(--gold);
  --code-bg: var(--soft);
  --code-text: var(--ink);
  --xs-gold: var(--gold);
  --xs-accent: var(--gold);
  --xs-clouds-image: var(--xs-dragon);
  --xs-clouds-image-mobile: var(--xs-dragon);
}
html.xs-docs[data-xs-docs] .main { background: var(--xs-reading); }
html.xs-docs[data-xs-docs] .sidebar { background-color: var(--xs-navigation); }
.xs-account-slot {
  --foreground: var(--ink);
  --muted-foreground: var(--muted);
  --ring: var(--gold);
  --border: var(--line);
  --card: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 64px;
  max-width: 168px;
  gap: 2px;
  line-height: 1.35;
}
.xs-account-slot [data-xs-avatar] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  color: var(--ink);
  background: var(--soft);
}
.xs-account-slot [data-xs-avatar] img { width: 100%; height: 100%; object-fit: cover; }
.xs-account-slot [data-xs-balance] {
  display: inline-flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  max-width: 100%;
  color: var(--gold);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  overflow-wrap: anywhere;
}
.xs-account-slot [data-xs-balance]:focus-visible,
.xs-account-slot a:focus-visible,
.xs-account-slot button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.xs-account-login { font-size: 12px; color: var(--gold); padding: 6px 4px; }
.xs-account-slot [data-xs-stale],
.xs-account-slot [data-xs-balance-status] { font-size: 10px; color: var(--muted); }
@media (max-width: 680px) {
  :root[data-xs-static-v12][data-xs-docs] { --xs-dragon: url('./dragon-light-portrait.webp'); }
  :root[data-xs-static-v12][data-xs-docs][data-theme='dark'] { --xs-dragon: url('./dragon-dark-portrait.webp'); }
  html[data-xs-docs] .docs-content { box-shadow: 0 0 0 12px var(--xs-reading); }
  .xs-account-slot { min-width: 52px; max-width: 112px; }
  .xs-account-slot [data-xs-balance] { font-size: 10px; }
  .xs-account-slot [data-xs-balance-label] { display: none; }
}
@media (max-width: 600px) {
  html.xs-docs[data-xs-docs] { --xs-header-height: 116px; }
  html.xs-docs[data-xs-docs] .xs-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 4px 10px;
  }
  html.xs-docs[data-xs-docs] .xs-brand { grid-column: 1; grid-row: 1; }
  html.xs-docs[data-xs-docs] .xs-topbar > .xs-account-slot { grid-column: 2; grid-row: 1; }
  html.xs-docs[data-xs-docs] .xs-mobile-menu { grid-column: 3; grid-row: 1; }
  html.xs-docs[data-xs-docs] .theme-toggle { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
}
@media (max-width: 380px) {
  html[data-xs-static-v12] .header-inner { padding-inline: 14px; gap: 8px; }
  html[data-xs-static-v12] .header-actions { gap: 7px; }
  html[data-xs-static-v12] .brand { gap: 6px; }
  html[data-xs-static-v12] .header-inner .brand-word { font-size: 26px; }
  html[data-xs-static-v12] .header-inner .brand-mark,
  html[data-xs-static-v12] .header-inner .brand-mark svg { width: 22px; }
  html[data-xs-static-v12] .theme-picker > svg { display: none; }
  html[data-xs-static-v12] .theme-picker select { max-width: 72px; }
}
@media (forced-colors: active) {
  html[data-xs-docs] body::before { display: none; }
  html[data-xs-docs] .docs-content,
  html[data-xs-docs] .docs-sidebar,
  html[data-xs-docs] .docs-toc { background: Canvas; color: CanvasText; box-shadow: none; }
}
