:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #e5e2da;
  --soft: #f4f2ec;
  --paper: #ffffff;
  --tint: #f5f3ee;
  --accent: #176b5b;
  --accent-soft: #e9f5f1;
  --warning: #fff6dd;
  --sidebar-width: 260px;
  --toc-width: 220px;
  --topbar-height: 72px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--tint);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--tint); }
button, input { font: inherit; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(260px, 620px) auto;
  align-items: center;
  gap: 24px;
  height: var(--topbar-height);
  padding: 0 28px 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  padding: 2px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: white; }
.search-wrap svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-wrap input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-wrap input::placeholder { color: #98a2b3; }
kbd { padding: 2px 7px; border: 1px solid #d0d5dd; border-radius: 5px; color: #7a8494; background: white; font-size: 11px; white-space: nowrap; }

.lang-button {
  justify-self: end;
  min-width: 58px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.lang-button:hover { border-color: #b8b2a4; background: var(--soft); }
.search-button { display: none; }
.mobile-menu { display: none; }

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: #faf8f4;
}
.nav-label { margin: 0 10px 12px; color: #98a2b3; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.doc-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin: 4px 0;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  color: #475467;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.doc-link:hover { color: var(--ink); background: #efece5; }
.doc-link.active { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.doc-index { color: #98a2b3; font: 600 11px/1.2 ui-monospace, monospace; }
.doc-link.active .doc-index { color: var(--accent); }

.sidebar-note { margin: 34px 10px 0; padding-top: 22px; border-top: 1px solid var(--line); }
.sidebar-note span { color: var(--accent); font-size: 12px; font-weight: 700; }
.sidebar-note p { margin: 8px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

.content-area { min-width: 0; padding: 58px 7vw 40px; }
.document { width: min(100%, 820px); margin: 0 auto; }
.document-status { width: min(100%, 820px); margin: 0 auto; color: var(--muted); }
.document-status:empty { display: none; }

.document h1 { margin: 0 0 14px; font: 700 clamp(30px, 4vw, 44px)/1.2 Georgia, "Songti SC", serif; letter-spacing: -.025em; }
.document h1 + p { color: var(--muted); }
.document h2 { margin: 54px 0 18px; padding-top: 8px; color: var(--ink); font-size: 22px; line-height: 1.45; scroll-margin-top: 96px; }
.document h3 { margin: 32px 0 12px; font-size: 17px; scroll-margin-top: 96px; }
.document p, .document li { font-size: 15px; line-height: 1.95; }
.document p { margin: 12px 0; }
.document ul, .document ol { margin: 12px 0 18px; padding-left: 1.55em; }
.document li { margin: 5px 0; padding-left: .22em; }
.document li::marker { color: var(--accent); font-weight: 650; }
.document strong { font-weight: 700; }
.document a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.document code { padding: 2px 6px; border-radius: 5px; color: #0f5e50; background: var(--accent-soft); font: 13px/1.6 ui-monospace, monospace; }
.document blockquote { margin: 24px 0; padding: 15px 19px; border-left: 3px solid var(--accent); color: #425466; background: var(--accent-soft); }
.document blockquote p { margin: 0; }
.document hr { margin: 44px 0; border: 0; border-top: 1px solid var(--line); }
.table-wrap { margin: 22px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.document table { width: 100%; border-collapse: collapse; font-size: 14px; }
.document th, .document td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.65; }
.document th { background: var(--soft); font-weight: 700; }
.document tr:last-child td { border-bottom: 0; }
.search-hit { border-radius: 3px; color: inherit; background: #ffe89a; }
.search-summary { margin: 0 0 24px; padding: 12px 15px; border-radius: 8px; color: #6b5312; background: var(--warning); font-size: 13px; }

.toc {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  padding: 44px 24px 30px 0;
  overflow-y: auto;
}
.toc-title { margin: 0 0 13px; color: #98a2b3; font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.toc a { display: block; margin: 0 0 4px; padding: 5px 0 5px 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; text-decoration: none; }
.toc a:hover, .toc a.active { border-left-color: var(--accent); color: var(--accent); }

.page-footer { width: min(100%, 820px); margin: 72px auto 0; padding-top: 24px; border-top: 1px solid var(--line); color: #98a2b3; font-size: 12px; line-height: 1.7; }
.page-footer p { margin: 4px 0; }
.overlay { display: none; }
.error-box { padding: 20px; border: 1px solid #f0b8b8; border-radius: 10px; color: #8b2828; background: #fff4f4; }

@media (max-width: 1040px) {
  .site-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .toc { display: none; }
  .topbar { grid-template-columns: var(--sidebar-width) minmax(240px, 1fr) auto; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 64px; }
  .site-shell { display: block; }
  .topbar { display: flex; height: var(--topbar-height); padding: 0 15px; gap: 12px; }
  .mobile-menu { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 34px; height: 34px; padding: 7px; border: 0; border-radius: 8px; background: var(--soft); }
  .mobile-menu span { display: block; width: 100%; height: 1.5px; background: var(--ink); }
  .brand { flex: 1; }
  .brand-mark, .brand small { display: none; }
  .search-wrap { position: absolute; top: calc(var(--topbar-height) + 10px); left: 14px; right: 14px; display: none; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
  .search-wrap.open { display: flex; }
  .search-button { display: block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-size: 12px; }
  .lang-button { min-width: 0; padding: 7px 11px; font-size: 12px; }
  kbd { display: none; }
  .sidebar { position: fixed; z-index: 30; top: 0; left: 0; width: min(86vw, 310px); height: 100vh; padding-top: 28px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 12px 0 28px rgba(16, 24, 40, .12); }
  .sidebar.open { transform: translateX(0); }
  .overlay { position: fixed; z-index: 25; inset: 0; background: rgba(16, 24, 40, .35); }
  .overlay.open { display: block; }
  .content-area { padding: 42px 20px 30px; }
  .document h1 { font-size: 31px; }
  .document h2 { margin-top: 42px; font-size: 20px; }
  .document p, .document li { font-size: 14px; line-height: 1.9; }
}

@media print {
  .topbar, .sidebar, .toc, .page-footer, .document-status { display: none !important; }
  .site-shell, .content-area { display: block; padding: 0; }
  .document { width: 100%; max-width: none; }
  .document h2 { break-after: avoid; margin-top: 28px; }
  .document p, .document li { font-size: 10.5pt; line-height: 1.65; }
  .document a { color: inherit; text-decoration: none; }
}
