:root {
  color-scheme: light dark;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-raised: #fbfcfe;
  --ink: #1b1f29;
  --muted: #636b7a;
  --subtle: #7f8795;
  --line: #d8dee8;
  --line-strong: #bfc8d6;
  --accent: #1f6feb;
  --accent-strong: #1458c8;
  --green: #2f9e6d;
  --amber: #a66f00;
  --code-bg: #f0f3f8;
  --shadow: 0 14px 40px rgba(31, 43, 66, 0.08);
  --sidebar-width: 282px;
  --toc-width: 232px;
  --content-width: 780px;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #111418;
  --surface: #171b21;
  --surface-raised: #1e232b;
  --ink: #eceff4;
  --muted: #b1b8c4;
  --subtle: #8e98a7;
  --line: #2e3540;
  --line-strong: #46505d;
  --accent: #73a7ff;
  --accent-strong: #a7c6ff;
  --green: #59c58f;
  --amber: #e2ac4f;
  --code-bg: #242a33;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]),
  body:not([data-theme="light"]) {
    --bg: #111418;
    --surface: #171b21;
    --surface-raised: #1e232b;
    --ink: #eceff4;
    --muted: #b1b8c4;
    --subtle: #8e98a7;
    --line: #2e3540;
    --line-strong: #46505d;
    --accent: #73a7ff;
    --accent-strong: #a7c6ff;
    --green: #59c58f;
    --amber: #e2ac4f;
    --code-bg: #242a33;
    --shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 24px;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 40;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.mobile-header {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-inner {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.sidebar-search {
  position: relative;
}

.sidebar-search input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  outline: none;
}

.sidebar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.nav-caption {
  margin: 0 0 8px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 620;
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1;
}

.badge-ready {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  color: var(--green);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 0.84rem;
}

.sidebar-footer a {
  color: var(--muted);
}

.content-shell {
  min-width: 0;
  padding: 36px 34px 64px;
}

.article {
  width: min(var(--content-width), 100%);
  margin: 0 auto;
}

.content-tools {
  display: flex;
  justify-content: flex-end;
  min-height: 38px;
  margin-bottom: 10px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.article-header {
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 42px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.55rem;
  line-height: 1.22;
  letter-spacing: 0;
}

h3 {
  margin: 26px 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.notice {
  display: grid;
  gap: 8px;
  margin: 24px 0 30px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--amber) 42%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--amber) 9%, var(--surface));
}

.notice strong {
  color: var(--ink);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0 12px;
}

.guide-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 43, 66, 0.03);
  color: var(--ink);
  text-decoration: none;
}

.guide-card:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.guide-card h2,
.guide-card h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.12rem;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--subtle);
  font-size: 0.82rem;
  font-weight: 680;
}

.path-row,
.step-list,
.plain-list {
  margin: 14px 0 0;
  padding-left: 1.35rem;
}

.path-row li,
.step-list li,
.plain-list li {
  margin: 8px 0;
}

.callout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}

.callout {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.callout h3 {
  margin-top: 0;
}

.callout p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

code,
kbd {
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  padding: 0.12em 0.35em;
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: transparent;
}

.article-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.article-footer a {
  font-weight: 700;
}

.toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 92px 18px 24px 0;
}

.toc-panel {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.toc-title {
  margin: 0 0 8px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
}

.mobile-backdrop {
  display: none;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  body {
    font-size: 15px;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
  }

  .mobile-header .brand {
    font-size: 0.96rem;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 35;
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
    visibility: hidden;
    pointer-events: none;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 34;
    display: none;
    background: rgba(10, 15, 24, 0.42);
  }

  body.menu-open .mobile-backdrop {
    display: block;
  }

  .content-shell {
    padding: 26px 18px 48px;
  }

  .content-tools {
    display: none;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .guide-grid,
  .callout-grid {
    grid-template-columns: 1fr;
  }

  .article-footer {
    flex-direction: column;
  }
}
