:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: #4d4d4d;
  --border: #000000;
  --radius-sm: 10px;
  --radius-md: 14px;
  --font-sans: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
}

a {
  color: var(--text);
}

.app {
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.topbar-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-static {
  position: relative;
}

.topbar-bg-solid {
  background: #ffffff;
}

.topbar-bg-transparent {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.topbar-bg-striped {
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.04) 0,
    rgba(0, 0, 0, 0.04) 1px,
    transparent 1px,
    transparent 7px
  );
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand-image-wrap {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-utility {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.language-label {
  font-size: 0.88rem;
  color: #000000;
  white-space: nowrap;
}

.language-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 26px;
  background: #ffffff;
  color: #000000;
  font: inherit;
  padding: 0 8px;
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  background: #ffffff;
}

.header-action.filled {
  background: #000000;
  color: #ffffff;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.nav-link.active {
  font-weight: 700;
}

.menu-button {
  display: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  min-height: 34px;
  padding: 0 12px;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 260px;
  min-height: calc(100vh - 64px);
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 20px;
  background: var(--surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.sidebar-group + .sidebar-group {
  margin-top: 24px;
}

.sidebar-group h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.sidebar-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-group li + li {
  margin-top: 8px;
}

.sidebar-link {
  display: block;
  padding: 6px 8px;
  border: 1px solid transparent;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.sidebar-link.active {
  border-color: var(--border);
  font-weight: 700;
}

.content {
  padding: 28px 36px 40px;
}

.doc {
  max-width: 860px;
}

.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc h5,
.doc h6 {
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.9rem;
}

.doc h1 {
  margin-top: 0;
}

.doc p {
  margin: 0.9rem 0;
}

.doc ul,
.doc ol {
  padding-left: 1.4rem;
}

.doc .task-list {
  list-style: none;
  padding-left: 0;
}

.doc .task-list-item {
  margin: 0.4rem 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.doc .task-list-marker {
  width: 15px;
  height: 15px;
  margin-top: 4px;
  border: 1px solid #000000;
  display: inline-block;
  position: relative;
  border-radius: 4px;
}

.doc .task-list-item.checked .task-list-marker::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border-right: 2px solid #000000;
  border-bottom: 2px solid #000000;
  transform: rotate(45deg);
}

.doc .task-list-item.checked .task-list-content {
  color: #222222;
}

.doc pre {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 14px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.doc code {
  font-family: var(--font-mono);
}

.doc blockquote {
  margin: 1.2rem 0;
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 2px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.doc .admonition {
  margin: 1.4rem 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-sm);
}

.doc .admonition-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.doc .admonition p {
  margin: 0.7rem 0 0;
}

.doc .admonition-warning {
  background: #3b1d27;
  border-color: #3b1d27;
  color: #ffffff;
}

.doc .admonition-warning a {
  color: #ffffff;
}

.doc .admonition-warning code {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0 4px;
}

.pager {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.pager-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--border);
  text-decoration: none;
  padding: 0 12px;
  border-radius: var(--radius-sm);
}

.toc {
  border-left: 1px solid var(--border);
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.toc h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li + li {
  margin-top: 8px;
}

.toc-level-3 {
  padding-left: 12px;
}

.toc-empty {
  margin: 0;
  color: var(--muted);
}

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

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-utility {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .header-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .language-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .language-select {
    width: 55%;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar.open {
    display: block;
  }

  .content {
    padding: 22px 18px 32px;
  }
}
