:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f5f7fa;
  --line: #d8d8d8;
  --line-strong: #c6c6c6;
  --text: #333333;
  --muted: #666666;
  --soft: #999999;
  --accent: #3661ec;
  --accent-weak: #ebeffd;
  --success: #138a63;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.12);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 68px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 42px;
  color: var(--accent);
  font-weight: 800;
}

.logo-stroke {
  position: relative;
  width: 58px;
  height: 32px;
  margin-right: 2px;
}

.logo-stroke::before,
.logo-stroke::after {
  position: absolute;
  content: "";
  bottom: 2px;
  width: 34px;
  height: 24px;
  border-top: 5px solid var(--accent);
  border-left: 5px solid var(--accent);
  transform: skewX(-24deg);
}

.logo-stroke::before {
  left: 0;
}

.logo-stroke::after {
  left: 24px;
}

.brand-logo strong {
  color: #2460ef;
  font-size: 28px;
  line-height: 34px;
  letter-spacing: 0;
}

.brand-logo em {
  align-self: center;
  padding: 1px 4px;
  border-radius: 3px;
  background: #7f9cf5;
  color: #fff;
  font-size: 15px;
  font-style: normal;
  line-height: 18px;
}

.doc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #0f172a;
  font-size: 16px;
  justify-self: start;
}

.back-mark {
  color: #111827;
  font-size: 30px;
  line-height: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #111827;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.top-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search svg {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--soft);
  stroke-width: 2;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #f5f7fa;
  color: var(--text);
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

.text-button:hover {
  border-color: var(--line-strong);
  background: #fafbfc;
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 92px;
  background: rgba(15, 23, 42, 0.18);
}

.search-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 130px));
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.search-dialog-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.close-search {
  display: inline-grid;
  place-items: center;
  font-size: 22px;
}

.icon-button {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  margin: 4px auto;
  border-radius: 2px;
  background: currentColor;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 68px);
}

.sidebar,
.toc {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow: auto;
  background: var(--surface);
}

.sidebar {
  border-right: 1px solid var(--line);
}

.toc {
  position: fixed;
  top: 133px;
  right: 87px;
  width: 275px;
  height: auto;
  max-height: calc(100vh - 500px);
  padding: 0 0 0 8px;
  border-left: 3px solid #dedede;
  background: transparent;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 18px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tree {
  padding: 0 0 24px;
}

.tree-item {
  display: flex;
  align-items: center;
  min-height: 46px;
  gap: 5px;
  padding: 0 14px 0 24px;
  border-radius: 0;
  color: #333;
  text-decoration: none;
  line-height: 32px;
  overflow-wrap: anywhere;
}

.tree-caret {
  flex: 0 0 14px;
  color: #999;
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
}

.tree-caret.expanded {
  transform: rotate(90deg);
}

.tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item:hover {
  background: #f5f7fa;
}

.tree-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 400;
}

.tree-item.active .tree-caret {
  color: #fff;
}

.tree-children {
  margin-left: 0;
  padding-left: 16px;
  border-left: 0;
}

.content {
  min-width: 0;
  padding: 60px 55px 64px 72px;
  outline: none;
}

article {
  max-width: none;
  margin: 0;
  padding-right: 347px;
}

.article-meta {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

#pageTitle {
  margin: 0 0 60px;
  font-size: 36px;
  font-weight: 600;
  line-height: 50px;
  letter-spacing: 0;
}

.article-body {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin-bottom: 64px;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 36px 0 18px;
  line-height: 1.35;
  letter-spacing: 0;
}

.article-body h1:first-child,
.article-body h2:first-child,
.article-body h3:first-child {
  margin-top: 0;
}

.article-body h1 {
  font-size: 32px;
}

.article-body h2 {
  font-size: 23px;
  padding-top: 8px;
  border-top: 0;
}

.article-body h3 {
  font-size: 19px;
}

.article-body p,
.article-body li,
.article-body blockquote {
  line-height: 1.85;
}

.article-body p {
  margin: 12px 0;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: var(--accent-weak);
  color: #334155;
}

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 22px 0 28px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.article-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef2f7;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.article-body pre {
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: #182033;
  color: #eef4ff;
}

.article-body pre code {
  padding: 0;
  background: transparent;
}

.article-body a {
  color: var(--accent);
  text-decoration: none;
}

.article-body a:hover {
  text-decoration: underline;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.article-body th,
.article-body td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.toc-title {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.toc a {
  display: block;
  padding: 0 0 8px;
  color: #666;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.toc .depth-2 {
  padding-left: 14px;
}

.toc .depth-3,
.toc .depth-4,
.toc .depth-5,
.toc .depth-6 {
  padding-left: 28px;
}

.search-panel {
  max-height: 500px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.search-empty {
  padding: 34px 18px;
  color: var(--soft);
  text-align: center;
}

.search-result {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result strong {
  display: block;
  margin-bottom: 4px;
}

.search-result span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  article {
    max-width: none;
    margin-right: 0;
    padding-right: 0;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 52px;
    padding: 6px 14px;
  }

  .sidebar-toggle,
  .close-sidebar {
    display: inline-grid;
    place-items: center;
  }

  .search {
    grid-column: auto;
    order: initial;
  }

  .brand-logo strong,
  .brand-logo em {
    display: none;
  }

  .brand {
    gap: 0;
  }

  .brand-logo {
    height: 38px;
  }

  .logo-stroke {
    transform: scale(0.72);
    transform-origin: left center;
  }

  .doc-title {
    font-size: 14px;
  }

  .top-actions {
    gap: 10px;
  }

  .top-link {
    font-size: 13px;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(86vw, 340px);
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .content {
    padding: 24px 22px 54px;
  }

  #pageTitle {
    font-size: 26px;
    line-height: 36px;
    margin-bottom: 20px;
  }

  .article-body {
    padding: 0;
  }
}
