:root {
  --accent: #4f46e5;
  --accent-weak: #eef0fe;
  --ink: #1f2330;
  --muted: #6b7180;
  --line: #e7e8ee;
  --bg: #ffffff;
  --sidebar: #fafbfc;
  --code-bg: #f5f6f8;
  --radius: 10px;
  --maxw: 1180px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }
.logo { width: 30px; height: 30px; color: var(--accent); }
.search {
  margin-left: auto; width: min(320px, 40vw);
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 14px; outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* Shell */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 0; max-width: var(--maxw); margin: 0 auto; }

.sidebar {
  position: sticky; top: 57px; align-self: start;
  height: calc(100vh - 57px); overflow-y: auto;
  padding: 24px 16px; border-right: 1px solid var(--line); background: var(--sidebar);
}
.navhead { margin: 18px 8px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.navhead:first-child { margin-top: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--ink); font-size: 14px; }
.sidebar a:hover { background: var(--accent-weak); text-decoration: none; }

/* Content */
.content { padding: 36px 48px 80px; min-width: 0; }
.content section { scroll-margin-top: 72px; padding-bottom: 8px; }
h1 { font-size: 32px; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 22px; margin: 40px 0 12px; padding-top: 8px; }
.lead { font-size: 18px; color: #3a3f4c; }
p, li { color: #2b3040; }
ol, ul { padding-left: 22px; }
li { margin: 5px 0; }
.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps li { position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--line); }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 9px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}

kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; font-size: 13px; font-family: inherit; }
code { background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; }
pre code { background: none; padding: 0; font-size: 13px; line-height: 1.7; }

table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }

.tip, .note { border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; font-size: 15px; }
.tip { background: var(--accent-weak); border: 1px solid #d9ddfb; }
.note { background: #fff8e6; border: 1px solid #f3e3b0; }

dl dt { font-weight: 700; margin-top: 14px; }
dl dd { margin: 4px 0 0; color: var(--muted); }

.foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .content { padding: 28px 22px 60px; }
  .search { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaf0; --muted: #9aa0ad; --line: #2a2d36; --bg: #15171c;
    --sidebar: #181b21; --code-bg: #1e2128; --accent-weak: #20233a;
  }
  body { background: var(--bg); }
  .topbar { background: rgba(21,23,28,.86); }
  .search, kbd { background: #1e2128; color: var(--ink); }
  .lead, p, li { color: #cdd1da; }
  .note { background: #2a2410; border-color: #4a401c; }
}
