:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #8b949e;
  --card: #161b22;
  --border: #30363d;
  --accent: #f97316;
  --active-bg: rgba(249, 115, 22, 0.14);
  --backdrop: rgba(0, 0, 0, 0.55);
  --scroll-thumb: #30363d;
  --scroll-thumb-hover: #484f58;
  --tok-kw: #ff7b72;
  --tok-type: #79c0ff;
  --tok-str: #a5d6ff;
  --tok-num: #79c0ff;
  --tok-cmt: #8b949e;
  --tok-punc: #c9d1d9;
  --topbar-h: 54px;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #59636e;
  --card: #f6f8fa;
  --border: #d0d7de;
  --accent: #c2410c;
  --active-bg: rgba(194, 65, 12, 0.1);
  --backdrop: rgba(0, 0, 0, 0.35);
  --scroll-thumb: #c8d1da;
  --scroll-thumb-hover: #9aa4b0;
  --tok-kw: #cf222e;
  --tok-type: #0550ae;
  --tok-str: #0a3069;
  --tok-num: #0550ae;
  --tok-cmt: #6e7781;
  --tok-punc: #24292f;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ffffff;
    --fg: #1f2328;
    --muted: #59636e;
    --card: #f6f8fa;
    --border: #d0d7de;
    --accent: #c2410c;
    --active-bg: rgba(194, 65, 12, 0.1);
    --backdrop: rgba(0, 0, 0, 0.35);
    --scroll-thumb: #c8d1da;
    --scroll-thumb-hover: #9aa4b0;
    --tok-kw: #cf222e;
    --tok-type: #0550ae;
    --tok-str: #0a3069;
    --tok-num: #0550ae;
    --tok-cmt: #6e7781;
    --tok-punc: #24292f;
  }
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: content-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--fg); line-height: 1.5; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: var(--topbar-h); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); background: var(--card); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.55rem; }
.topbar-right { flex: 1 1 auto; justify-content: flex-end; min-width: 12rem; }
.brand { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--fg); text-decoration: none; font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-logo { width: 24px; height: 24px; border-radius: 4px; object-fit: contain; }
#search-input { width: min(24rem, 100%); flex: 0 1 24rem; min-width: 8rem; padding: 0.4rem 0.75rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.nav-toggle { display: none; }
.theme-toggle .icon-sun { display: inline; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: inline; }
}
.search-results { max-width: 960px; margin: 0.75rem auto; padding: 0.75rem 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.layout { display: grid; grid-template-columns: clamp(230px, 22vw, 290px) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; border-right: 1px solid var(--border); background: var(--card); padding: 1rem 0.85rem 2rem; font-size: 0.9rem; }
.sidebar-backdrop { display: none; }
.sidebar-heading { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0.25rem 0 0.5rem 0.4rem; }
.sidebar details { margin-bottom: 0.45rem; }
.sidebar summary { cursor: pointer; font-weight: 600; padding: 0.25rem 0.4rem; border-radius: 5px; color: var(--fg); list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before { content: "▸ "; color: var(--muted); font-size: 0.8em; }
.sidebar details[open] > summary::before { content: "▾ "; }
.sidebar ul { list-style: none; margin: 0.15rem 0 0.4rem 0; padding: 0 0 0 0.65rem; }
.sidebar li a { display: block; padding: 0.25rem 0.5rem; border-radius: 5px; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar li a:hover { color: var(--fg); background: var(--bg); text-decoration: none; }
.sidebar li a.active { color: var(--accent); background: var(--active-bg); font-weight: 600; }
.container { max-width: 960px; width: 100%; margin: 1.25rem auto; padding: 0 clamp(0.85rem, 3vw, 1.75rem) 3rem; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin: 1rem 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.subtitle, .crumb { color: var(--muted); }
h1 { font-size: clamp(1.35rem, 3vw, 2rem); word-break: break-word; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.5rem 0.65rem; border-top: 1px solid var(--border); vertical-align: top; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.badge { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); margin-left: 0.35rem; }
.kind { font-size: 0.8rem; color: var(--muted); font-family: ui-monospace, monospace; }
.decl-sig, .member-sig { margin: 0.5rem 0 0.85rem; padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); overflow-x: auto; font-size: 0.88rem; }
.member-item { padding: 0.9rem 0; border-top: 1px solid var(--border); }
.member-item:first-of-type { border-top: none; padding-top: 0.25rem; }
.member-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.member-sig { flex: 1 1 auto; margin: 0; padding: 0.45rem 0.7rem; }
.member-summary { margin: 0.55rem 0 0.4rem; }
.doc-meta { margin: 0.35rem 0; font-size: 0.92rem; }
.doc-block { margin: 0.55rem 0; }
.doc-label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-bottom: 0.25rem; }
.doc-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25rem 0.85rem; margin: 0; font-size: 0.92rem; }
.doc-dl dt { font-weight: 600; }
.doc-dl dd { margin: 0; color: var(--fg); }
.exc-tag { color: #f87171; }
[data-theme="light"] .exc-tag { color: #b91c1c; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .exc-tag { color: #b91c1c; } }
.doc-remarks { margin: 0.6rem 0; padding: 0.55rem 0.8rem; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 6px 6px 0; font-size: 0.92rem; }
.doc-example pre { margin: 0.25rem 0 0; padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); overflow-x: auto; font-size: 0.86rem; }
.tok-kw { color: var(--tok-kw); font-weight: 500; }
.tok-type { color: var(--tok-type); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-cmt { color: var(--tok-cmt); font-style: italic; }
.tok-punc { color: var(--tok-punc); }
.doc-footer { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.doc-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.doc-footer a:hover { color: var(--accent); }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; width: min(300px, 85vw); z-index: 35; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 30; background: var(--backdrop); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}
@media (max-width: 520px) {
  .topbar-right { width: 100%; }
  #search-input { flex: 1 1 auto; }
  .card { padding: 0.85rem 0.95rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
}