:root {
  color-scheme: light;
  --canvas: #f3f5f0;
  --surface: #ffffff;
  --surface-strong: #f9faf7;
  --ink: #182b24;
  --muted: #607068;
  --faint: #7f8c85;
  --line: #d5ded6;
  --line-strong: #bdcbbf;
  --soft: #e7eee6;
  --accent: #176247;
  --accent-hover: #104d37;
  --accent-soft: #deeee2;
  --action-ink: #ffffff;
  --warning: #9a5b16;
  --warning-bg: #fff5e2;
  --shadow: 0 18px 50px rgba(24, 43, 36, .08);
  --topbar-height: 72px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101713;
  --surface: #18221d;
  --surface-strong: #1c2821;
  --ink: #eaf1eb;
  --muted: #a9b5ad;
  --faint: #89978e;
  --line: #334239;
  --line-strong: #46584d;
  --soft: #233029;
  --accent: #a1dcad;
  --accent-hover: #bcebc5;
  --accent-soft: #263e31;
  --action-ink: #13291b;
  --warning: #f1c77e;
  --warning-bg: #392e1d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-height) + 28px); }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.65; }
button, input { font: inherit; }
a { color: var(--accent); }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; border-radius: 8px;
  background: var(--ink); color: var(--canvas); transform: translateY(-150%); transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky; z-index: 40; top: 0; height: var(--topbar-height); display: flex; align-items: center;
  justify-content: space-between; gap: 20px; padding: 0 34px; background: color-mix(in srgb, var(--canvas) 92%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; line-height: .82; }
.brand-mark { width: 25px; height: 28px; }
.brand-mark path { fill: none; stroke: currentColor; stroke-width: 3.8; }
.brand-name { font-weight: 800; font-size: 13px; letter-spacing: -.02em; }
.brand-divider { width: 1px; height: 30px; margin: 0 3px; background: var(--line-strong); }
.brand-product { color: var(--muted); font-weight: 650; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-strong); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-button { display: none; }
.sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }
.app-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 9px; background: var(--accent); color: var(--action-ink); text-decoration: none; font-size: .875rem; font-weight: 700; }
.app-link:hover { background: var(--accent-hover); }

.wiki-shell { display: grid; grid-template-columns: 268px minmax(0, 800px) 210px; justify-content: center; min-height: calc(100vh - var(--topbar-height)); }
.sidebar { position: sticky; top: var(--topbar-height); align-self: start; height: calc(100vh - var(--topbar-height)); padding: 28px 24px 26px 10px; border-right: 1px solid var(--line); overflow: auto; }
.search-wrap { position: relative; display: flex; align-items: center; margin-bottom: 26px; }
.search-wrap svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; pointer-events: none; }
.search-wrap input { width: 100%; height: 42px; padding: 0 42px 0 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); outline: none; }
.search-wrap input::placeholder { color: var(--faint); }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap kbd { position: absolute; right: 10px; min-width: 23px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-color: var(--line-strong); border-radius: 5px; color: var(--faint); background: var(--surface-strong); text-align: center; font: 12px/19px inherit; }
.search-results { position: absolute; z-index: 5; top: 79px; width: 233px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.search-results a { display: block; padding: 10px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--soft); outline: none; }
.search-results strong { display: block; font-size: .875rem; line-height: 1.35; }
.search-results span { display: block; margin-top: 2px; color: var(--muted); font-size: .75rem; }
.search-empty { margin: 8px; color: var(--muted); font-size: .875rem; }
.nav-group { margin-bottom: 26px; }
.nav-label { margin: 0 0 8px 12px; color: var(--faint); font-size: .72rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; justify-content: space-between; min-height: 38px; margin: 2px 0; padding: 7px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 560; line-height: 1.35; }
.nav-link:hover { color: var(--ink); background: var(--soft); }
.nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 720; }
.nav-link[aria-current="page"]::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.sidebar-foot { margin: 32px 10px 0; padding-top: 19px; border-top: 1px solid var(--line); font-size: .8rem; }
.sidebar-foot p { margin: 0 0 3px; color: var(--faint); }
.sidebar-foot a { text-decoration: none; font-weight: 700; }

.content { min-width: 0; padding: 62px 70px 100px; outline: none; }
.article-head { margin-bottom: 40px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { color: var(--ink); line-height: 1.18; letter-spacing: -.025em; }
h1 { max-width: 720px; margin: 0; font-size: clamp(2.35rem, 5vw, 4.15rem); font-weight: 710; letter-spacing: -.055em; }
.article-lede { max-width: 650px; margin: 20px 0 0; color: var(--muted); font-size: 1.12rem; line-height: 1.65; }
.article-meta { display: flex; gap: 9px; align-items: center; margin-top: 19px; color: var(--faint); font-size: .8rem; }
.article-meta span + span::before { content: "·"; margin-right: 9px; }
.article-body { max-width: 720px; }
.article-body h2 { margin: 52px 0 15px; font-size: 1.65rem; font-weight: 720; scroll-margin-top: calc(var(--topbar-height) + 24px); }
.article-body h3 { margin: 32px 0 10px; font-size: 1.13rem; font-weight: 740; scroll-margin-top: calc(var(--topbar-height) + 24px); }
.article-body p { margin: 0 0 20px; color: var(--muted); }
.article-body strong { color: var(--ink); }
.article-body ul, .article-body ol { margin: 0 0 24px; padding-left: 1.35em; color: var(--muted); }
.article-body li { margin: 8px 0; padding-left: .25em; }
.article-body li::marker { color: var(--accent); font-weight: 700; }
.article-body a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-body code { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: .88em; }
.callout { display: grid; grid-template-columns: 32px 1fr; gap: 12px; margin: 28px 0; padding: 18px 20px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 9px; background: var(--surface); }
.callout.warning { border-left-color: var(--warning); background: var(--warning-bg); }
.callout-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 850; }
.warning .callout-icon { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.callout p { margin: 0; font-size: .93rem; }
.callout p + p { margin-top: 8px; }
.step-list { list-style: none; padding: 0 !important; counter-reset: steps; }
.step-list li { position: relative; min-height: 46px; padding: 0 0 23px 54px; counter-increment: steps; }
.step-list li::before { content: counter(steps); position: absolute; top: -2px; left: 0; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: .82rem; font-weight: 800; }
.step-list li:not(:last-child)::after { content: ""; position: absolute; top: 34px; bottom: 0; left: 17px; width: 1px; background: var(--line); }
.step-list li::marker { content: ""; }
.article-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.article-footer a { flex: 1; padding: 15px 16px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); text-decoration: none; font-size: .88rem; }
.article-footer a:last-child { text-align: right; }
.article-footer a:hover { border-color: var(--line-strong); background: var(--surface); }
.article-footer small { display: block; margin-bottom: 2px; color: var(--faint); font-size: .69rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.home-head { margin-bottom: 37px; }
.home-head h1 { max-width: 660px; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.home-card { position: relative; min-height: 164px; padding: 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.home-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.home-card-number { display: inline-grid; place-items: center; width: 31px; height: 31px; margin-bottom: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 850; }
.home-card h2 { margin: 0 28px 7px 0; font-size: 1.05rem; letter-spacing: -.015em; }
.home-card p { margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.5; }
.home-card-arrow { position: absolute; right: 20px; top: 20px; color: var(--faint); }
.home-section-title { display: flex; align-items: center; gap: 14px; margin: 48px 0 18px; font-size: .75rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.home-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.popular-list { display: grid; gap: 2px; }
.popular-list a { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 13px; align-items: center; padding: 14px 10px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.popular-list a:hover { background: var(--surface); }
.popular-list span:first-child { color: var(--accent); font-size: .78rem; font-weight: 850; }
.popular-list strong { font-size: .94rem; }
.popular-list small { color: var(--faint); font-size: .76rem; }
.popular-list i { color: var(--faint); font-style: normal; }

.outline { position: sticky; top: var(--topbar-height); align-self: start; height: calc(100vh - var(--topbar-height)); padding: 61px 12px 30px 24px; border-left: 1px solid var(--line); overflow: auto; }
.outline-label { margin: 0 0 12px; color: var(--faint); font-size: .71rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.outline nav a { display: block; margin: 3px 0; padding: 5px 0; color: var(--muted); text-decoration: none; font-size: .8rem; line-height: 1.35; }
.outline nav a:hover { color: var(--accent); }
.outline nav a[data-level="3"] { padding-left: 11px; }
.outline-card { margin-top: 35px; padding-top: 20px; border-top: 1px solid var(--line); }
.outline-card-mark { display: inline-grid; place-items: center; width: 31px; height: 31px; border-radius: 7px; background: var(--accent); color: var(--action-ink); font-size: .65rem; font-weight: 850; letter-spacing: -.02em; }
.outline-card p { margin: 10px 0 0; color: var(--faint); font-size: .75rem; line-height: 1.5; }
.outline-card strong { color: var(--muted); }
.noscript { max-width: 680px; margin: 80px auto; padding: 30px; }

@media (max-width: 1100px) {
  .wiki-shell { grid-template-columns: 250px minmax(0, 780px); }
  .outline { display: none; }
  .sidebar { padding-left: 20px; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 64px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .menu-button { display: inline-grid; flex: 0 0 auto; }
  .brand { margin-right: auto; }
  .brand-divider, .brand-product { display: none; }
  .app-link { width: 40px; overflow: hidden; white-space: nowrap; padding: 8px 11px; color: transparent; gap: 0; font-size: 0; }
  .app-link span { color: var(--action-ink); font-size: 1.1rem; }
  .wiki-shell { display: block; }
  .sidebar { position: fixed; z-index: 50; inset: var(--topbar-height) auto 0 0; width: min(88vw, 330px); height: auto; padding: 24px 20px; border-right: 1px solid var(--line); background: var(--canvas); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .search-results { width: calc(100% - 40px); top: 75px; }
  .mobile-overlay { position: fixed; z-index: 45; inset: var(--topbar-height) 0 0; background: rgba(5, 12, 8, .45); }
  .content { padding: 42px 22px 76px; }
  h1 { font-size: clamp(2.25rem, 12vw, 3.2rem); }
  .article-lede { font-size: 1rem; }
  .home-grid { grid-template-columns: 1fr; }
  .home-card { min-height: 148px; }
  .article-footer { flex-direction: column; }
  .article-footer a:last-child { text-align: left; }
}

@media (max-width: 430px) {
  .brand-mark { width: 22px; }
  .brand-name { font-size: 12px; }
  .content { padding-inline: 18px; }
  .article-head { margin-bottom: 32px; padding-bottom: 28px; }
  .article-body h2 { margin-top: 42px; }
  .popular-list a { grid-template-columns: 26px 1fr auto; gap: 8px; }
  .popular-list small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
