:root {
  --bg: #ffffff;
  --bg-2: #f6f7f8;
  --card: #ffffff;
  --gold: #c9a227;
  --gold-lit: #8a6a00;
  --gold-dim: rgba(180, 140, 20, 0.28);
  --ink: #111111;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --line: #e6e6e8;
  --danger: #b42318;
  --sidebar: 272px;
  --radius: 16px;
  --font: "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "Noto Sans Mono CJK SC", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
}

a { color: var(--gold-lit); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #5c4700; }
code, .btn-name {
  font-family: var(--mono);
  font-size: 0.92em;
  color: #6b5200;
  background: #fff8e6;
  padding: 0.05em 0.3em;
  border-radius: 4px;
}
.btn-name {
  font-family: var(--font);
  font-weight: 700;
  white-space: nowrap;
}

/* Shell */
.shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f6f7f8;
  border-right: 1px solid var(--line);
  padding: 20px 16px 20px;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  padding: 4px 4px 16px;
}
.brand img {
  width: 40px; height: 40px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(180, 140, 20, 0.35);
  background: #fff;
}
.brand-name {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.2;
}
.brand-name small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.14em;
}

.nav { flex: 1; overflow: auto; min-height: 0; }
.search {
  position: relative;
  z-index: 20;
  margin: 0 0 18px;
  flex: 0 0 auto;
}
.search input {
  width: 100%;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 12px 0 34px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.search input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}
.search .icon {
  position: absolute;
  left: 12px; top: 10px;
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  max-height: 320px;
  overflow: auto;
  z-index: 30;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}
.search-results a:hover, .search-results a.active { background: #fff8e6; }
.search-results .t { color: var(--ink); font-weight: 700; }
.search-results .s { color: var(--muted); font-size: 12px; }
.search-results .empty { padding: 12px; color: var(--muted); font-size: 13px; }

.nav-group {
  margin: 14px 0 6px;
  padding: 0 8px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav a {
  display: block;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.nav a:hover { background: #eceef0; color: var(--ink); }
.nav a.current {
  background: #fff3cc;
  color: #5c4700;
  box-shadow: inset 2px 0 0 var(--gold);
  font-weight: 700;
}

.ext {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.ext a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; }
.ext a:hover { color: var(--gold-lit); }

/* Main */
main {
  flex: 1;
  min-width: 0;
  padding: 28px 40px 80px;
  background: var(--bg);
}
article { max-width: 820px; margin: 0 auto; }
.kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--gold-lit);
  margin: 0 0 8px;
}
h1 {
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin: 0 0 8px;
  color: var(--ink);
}
.lead { font-size: 18px; color: #333; margin: 0 0 24px; }
h2 {
  font-size: 22px;
  margin: 36px 0 12px;
  padding-top: 8px;
  color: var(--ink);
  border-top: 1px solid var(--line);
}
h3 { font-size: 17px; margin: 22px 0 8px; color: var(--ink); }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 1.3em; }
li { margin: 0 0 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* Figures */
.shot { margin: 20px 0 28px; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  background: #fff;
}
.shot.mobile img { max-width: 390px; margin: 0 auto; }
.shot figcaption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* Callouts / tables */
.note {
  border-left: 3px solid var(--gold);
  background: #fff8e6;
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0 20px;
  font-size: 14px;
}
.note.warn {
  border-left-color: var(--danger);
  background: #fdecea;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 8px 0 20px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
th { background: #f6f7f8; color: var(--ink); font-weight: 700; }
td { background: #fff; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
  position: relative;
  padding: 8px 0 8px 44px;
  border-bottom: 1px solid var(--line);
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #111;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 28px;
  text-align: center;
}

/* Prev / next */
.pager {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 1;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--card);
}
.pager a:hover { border-color: var(--gold); color: var(--gold-lit); }
.pager .dir { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 2px; }
.pager .next { text-align: right; }

footer.page-foot {
  margin-top: 36px;
  font-size: 12px;
  color: var(--muted);
}

/* Mobile chrome */
.menu-btn, .backdrop { display: none; }
.menu-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 45;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; left: auto; right: 10px; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-110%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,0.12);
    background: #f6f7f8;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.28);
    z-index: 25;
  }
  body.nav-open .backdrop { display: block; }
  main { padding: 64px 18px 64px; }
  h1 { font-size: 28px; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
  table { font-size: 13px; display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}
