:root {
  --bg: #ffffff;
  --surface: #f6f7fb;
  --surface2: #eceef6;
  --border: #dde1ec;
  --text: #1c2030;
  --text2: #5a6178;
  --accent: #4c6ef5;
  --accent-soft: rgba(76, 110, 245, 0.10);
  --code-bg: #f1f3f9;
  --green: #2f9e44;
  --amber: #e8590c;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141c; --surface: #1a1d28; --surface2: #222636; --border: #2d3244; --text: #e6e8f0; --text2: #9aa1b8;
    --accent: #7c96ff; --accent-soft: rgba(124, 150, 255, 0.14); --code-bg: #1d2130; --green: #51cf66; --amber: #ff922b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12141c; --surface: #1a1d28; --surface2: #222636; --border: #2d3244; --text: #e6e8f0; --text2: #9aa1b8;
  --accent: #7c96ff; --accent-soft: rgba(124, 150, 255, 0.14); --code-bg: #1d2130; --green: #51cf66; --amber: #ff922b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: "Cascadia Mono", Consolas, "SF Mono", monospace; font-size: 12.5px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav-toggle, .theme { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; width: 34px; height: 32px; cursor: pointer; font-size: 15px; }
.theme { display: inline-block; }
.top-link { white-space: nowrap; font-size: 13px; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-results { display: none; position: absolute; left: 0; right: 0; top: 40px; max-height: 70vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,0.18); }
.search-results.open { display: block; }
.search-results a { display: block; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active { background: var(--accent-soft); text-decoration: none; }
.search-results .kind { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 6px; }
.search-results .sub { display: block; font-size: 12px; color: var(--text2); }
.search-results .none { padding: 10px 12px; color: var(--text2); }

.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 220px; max-width: 1400px; margin: 0 auto; }
.side { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 16px 10px 40px 16px; border-right: 1px solid var(--border); }
.side h4 { margin: 18px 6px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2); }
.side h4:first-child { margin-top: 0; }
.side a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--text); font-size: 13px; }
.side a:hover { background: var(--surface); text-decoration: none; }
.side a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side a .num { display: inline-block; min-width: 26px; color: var(--text2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.side a.active .num { color: var(--accent); }
.side a.sub { padding-left: 16px; }
.side a.all { font-style: italic; color: var(--text2); }
.side .side-app { display: none; }
.side details { margin: 0 0 2px; }
.side summary { cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 13px; list-style: none; display: flex; align-items: center; gap: 6px; }
.side summary::-webkit-details-marker { display: none; }
.side summary::before { content: "›"; display: inline-block; width: 10px; color: var(--text2); transition: transform 0.15s; }
.side details[open] > summary::before { transform: rotate(90deg); }
.side summary:hover { background: var(--surface); }
.side details a { padding-left: 24px; }
.side .count { margin-left: auto; font-size: 11px; color: var(--text2); }

.content { padding: 28px 40px 80px; min-width: 0; }
.content:focus { outline: none; }
.content h1 { font-size: 28px; line-height: 1.25; margin: 0 0 6px; }
.content h2 { font-size: 20px; margin: 34px 0 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.content h3 { font-size: 16px; margin: 24px 0 8px; }
.content p { margin: 8px 0; }
.lead { font-size: 15.5px; color: var(--text2); margin: 4px 0 14px; max-width: 820px; }
.loading { color: var(--text2); }
.crumbs { font-size: 12.5px; color: var(--text2); margin-bottom: 10px; }
.crumbs a { color: var(--text2); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--border); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text2); }
.badge.accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.warn { color: var(--amber); border-color: var(--amber); }
.title-row { display: flex; align-items: center; gap: 12px; }
.swatch { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; flex: none; }

table { border-collapse: collapse; width: 100%; margin: 10px 0 16px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--surface); font-weight: 600; font-size: 12px; color: var(--text2); white-space: nowrap; }
td code { white-space: pre-wrap; overflow-wrap: anywhere; }
td .muted, .muted { color: var(--text2); font-size: 12px; }
.req { color: var(--amber); font-size: 11px; margin-left: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 14px 0; }
.card { display: block; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg); color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.card .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card .d { font-size: 12.5px; color: var(--text2); margin-top: 4px; }
.card .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.action { border: 1px solid var(--border); border-radius: 10px; padding: 4px 16px 10px; margin: 14px 0; }
.action h3 { margin-top: 12px; }
.steps-list { counter-reset: s; list-style: none; padding: 0; }
.steps-list li { counter-increment: s; position: relative; padding: 8px 0 8px 38px; border-bottom: 1px solid var(--border); }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 12.5px; }
.steps-list .st { font-weight: 600; }
.shot { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; margin: 10px 0; }
.zoomable { cursor: zoom-in; }
.shot-fig { margin: 14px 0 18px; }
.shot-fig .shot { margin: 0; }
.shot-fig figcaption { font-size: 12.5px; color: var(--text2); margin-top: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 20, 0.86); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 90px); border-radius: 8px; background: #fff; }
.lightbox-caption { color: #e6e8f0; font-size: 13px; margin-top: 10px; text-align: center; max-width: 900px; }
.lightbox-close { position: absolute; top: 12px; right: 14px; background: none; border: 1px solid rgba(255,255,255,0.4); color: #fff; border-radius: 6px; width: 34px; height: 32px; cursor: pointer; font-size: 15px; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout.warning, .callout.important { border-left-color: var(--amber); background: rgba(232, 89, 12, 0.08); }
.callout ul { margin: 6px 0 0; padding-left: 20px; }
.begin { border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 10px; margin: 18px 0 8px; background: var(--surface); }
.begin h2 { border-top: none; margin-top: 10px; }
.begin .steps-list li { border-bottom-color: var(--border); }
.begin .st { font-weight: 600; font-size: 14.5px; }
.pager { margin-top: 30px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
details.advanced { margin: 30px 0 10px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; }
details.advanced > summary { cursor: pointer; color: var(--text2); font-size: 13px; }
.toc-inline { display: none; margin: 10px 0 16px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.toc-inline summary { cursor: pointer; color: var(--text2); }
.toc-inline a { display: block; padding: 3px 0; }
.back-to-top { position: fixed; right: 18px; bottom: 18px; z-index: 12; display: none; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.back-to-top.show { display: inline-block; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.md code { overflow-wrap: anywhere; }

.toc { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 28px 16px; font-size: 12.5px; }
.toc h5 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2); }
.toc a { display: block; color: var(--text2); padding: 3px 0 3px 10px; border-left: 2px solid var(--border); }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }

.md h3, .md h4 { margin: 18px 0 6px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 3px 0; }

@media (max-width: 1150px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-block; }
  .top-link { display: none; }
  .brand span { display: none; }
  .side { display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; height: auto; z-index: 15; background: var(--bg); border-right: none; }
  .side.open { display: block; }
  .side .side-app { display: block; margin: 0 0 8px; font-weight: 600; color: var(--accent); }
  .search-results { position: fixed; left: 8px; right: 8px; top: 52px; max-height: calc(100vh - 64px); }
  th { white-space: normal; }
  .content { padding: 20px 16px 60px; }
  .content h1 { font-size: 23px; }
}
