:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6370;
  --border: #e2e6ed;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --sidebar-w: 280px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.sidebar-header p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.search-wrap {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

#search {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
}

.search-suggest {
  margin-top: 0.45rem;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.search-suggest.hidden {
  display: none;
}

.search-suggest-empty {
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.search-suggest-more {
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
  color: var(--accent);
  text-align: center;
}

.search-suggest-more:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.search-hit {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.search-hit:last-child {
  border-bottom: none;
}

.search-hit:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.search-hit-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.search-hit-section {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.1rem;
}

.search-hit-snippet {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.45;
}

.search-hit-snippet mark {
  background: #fef08a;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

.nav-search-link a {
  font-weight: 600;
  color: var(--accent);
}

.search-article h1 {
  margin-top: 0;
}

.search-lead {
  color: var(--muted);
  margin-bottom: 1rem;
}

.search-lead em {
  font-style: normal;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.search-form button {
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

.search-form button:hover {
  filter: brightness(1.05);
}

.search-meta {
  min-height: 1.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.search-results .search-hit,
.search-suggest .search-hit {
  display: block;
}

.search-results .search-hit {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.65rem;
}

.search-results .search-hit:last-child {
  margin-bottom: 0;
}

.search-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  overflow-y: auto;
  flex: 1;
}

.nav-list li a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}

.nav-list li a:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.nav-list li a.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--accent);
}

.nav-list li a .nav-id {
  display: inline-block;
  min-width: 1.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-footer {
  padding: 0.6rem 1rem;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
  max-width: 920px;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem 2rem;
}

.article h1 {
  margin-top: 0;
  font-size: 1.65rem;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.article h2 {
  margin-top: 2rem;
  font-size: 1.2rem;
}

.article h3 {
  margin-top: 1.4rem;
  font-size: 1.05rem;
}

.article blockquote {
  margin: 1rem 0;
  padding: 0.65rem 1rem;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-size: 0.92rem;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.article th,
.article td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.article th {
  background: #f0f3f8;
  font-weight: 600;
}

.article code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #f0f3f8;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.article pre {
  background: #1e2430;
  color: #e8ecf4;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.article pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.off-repo {
  color: var(--muted);
  font-size: 0.85em;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.pager a {
  max-width: 45%;
}

.pager .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

@media (max-width: 860px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 15;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  }

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

  .main {
    padding: 3.5rem 1rem 2rem;
  }

  .article {
    padding: 1.25rem 1rem;
  }
}
