* {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --panel: #fbfbfb;
  --ink: #171717;
  --muted: #6f6f6f;
  --soft: #f4f4f5;
  --line: #e8e8ea;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #16a34a;
  --wechat: #07c160;
  --radius: 18px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Roboto Mono", Consolas, monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

.wiki-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: #fafafa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.brand span:not(.brand-mark) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-group {
  margin-top: 24px;
}

.nav-title {
  margin: 0 0 10px;
  padding: 0 8px;
  color: #9a9a9a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  color: #404040;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.nav-item.locked {
  color: #71717a;
}

.nav-item.locked small {
  color: #a16207;
}

.nav-item small {
  color: #a1a1aa;
  font-family: var(--mono);
  font-size: 11px;
}

.sidebar-foot {
  margin-top: 30px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.sidebar-foot b {
  display: block;
  font-size: 13px;
}

.sidebar-foot p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #9a9a9a;
  background: #fafafa;
  font-size: 14px;
}

.search kbd {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #8a8a8a;
  background: #fff;
  font-family: var(--mono);
  font-size: 11px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.pill.private .dot {
  background: var(--wechat);
}

.content {
  max-width: 1180px;
  padding: 56px 64px 76px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 52px;
  align-items: end;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  max-width: 760px;
  margin: 22px 0 0;
  font-size: clamp(40px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -.04em;
}

.lead {
  max-width: 690px;
  margin: 22px 0 0;
  color: #4b5563;
  font-size: 18px;
  line-height: 1.85;
}

.hero-card,
.chapter,
.preview-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.hero-card {
  padding: 24px;
  background:
    radial-gradient(circle at 90% 8%, rgba(37, 99, 235, .12), transparent 44%),
    #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, .06);
}

.hero-card small,
.preview-card small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-card strong {
  display: block;
  margin-top: 14px;
  font-size: 24px;
  line-height: 1.35;
}

.hero-card p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.stat {
  padding: 14px;
  border-radius: 14px;
  background: var(--soft);
}

.stat b {
  display: block;
  font-size: 22px;
}

.stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: 58px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.02em;
}

.section-head p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.updated {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.chapter-grid.handbook-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chapter-grid.handbook-two-col .chapter {
  min-height: 310px;
}

.chapter {
  min-height: 220px;
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.chapter:hover {
  transform: translateY(-3px);
  border-color: #c7d2fe;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .08);
}

.chapter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.num {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}

.tag {
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #52525b;
  background: var(--soft);
  font-size: 12px;
  line-height: 24px;
}

.chapter h3 {
  margin: 30px 0 0;
  font-size: 24px;
  letter-spacing: -.025em;
}

.chapter p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.links {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #3f3f46;
  font-size: 13px;
}

.links a::before {
  content: "→";
  margin-right: 8px;
  color: var(--blue);
}

.links a em {
  flex: 0 0 auto;
  font-style: normal;
  color: #a16207;
  font-size: 12px;
}

.auth-content {
  max-width: 1120px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 52px;
  align-items: center;
  min-height: calc(100vh - 220px);
}

.private-eyebrow {
  color: #047857;
  background: #ecfdf5;
}

.login-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 90% 0%, rgba(7, 193, 96, .12), transparent 42%),
    #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .08);
}

.lock-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #fff;
  background: var(--wechat);
  font-size: 26px;
  font-weight: 800;
}

.login-card h2 {
  margin: 24px 0 0;
  font-size: 26px;
  letter-spacing: -.03em;
}

.login-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.login-card small {
  display: block;
  margin-top: 16px;
  color: #8a8a8a;
  font-size: 12px;
  line-height: 1.7;
}

.wechat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 24px;
  padding: 0 20px;
  border-radius: 12px;
  color: #fff;
  background: var(--wechat);
  font-size: 15px;
  font-weight: 800;
}

.permission-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 34px;
}

.permission-notes article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.permission-notes b {
  display: block;
  font-size: 15px;
}

.permission-notes p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.locked-article {
  max-width: 760px;
  padding-top: 80px;
}

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

.secondary-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.article-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 26px;
}

.preview-card {
  padding: 24px;
  background: var(--panel);
}

.preview-card h3 {
  margin: 18px 0 0;
  font-size: 22px;
  letter-spacing: -.02em;
}

.preview-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.action-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  color: #1e3a8a;
  background: var(--blue-soft);
  font-size: 14px;
  line-height: 1.65;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 240px;
  gap: 56px;
  align-items: start;
}

.article {
  min-width: 0;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.article-body {
  margin-top: 42px;
  color: #262626;
  font-size: 17px;
  line-height: 2;
}

.article-body h2 {
  margin: 46px 0 12px;
  font-size: 28px;
  line-height: 1.35;
  letter-spacing: -.02em;
}

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

.article-body ul {
  margin: 18px 0;
  padding-left: 1.2em;
}

.article-body li {
  margin: 8px 0;
}

.article-body blockquote {
  margin: 28px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--blue);
  border-radius: 0 14px 14px 0;
  color: #1e3a8a;
  background: var(--blue-soft);
  font-weight: 700;
}

.toc {
  position: sticky;
  top: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.toc strong {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
}

.toc a {
  display: block;
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.next-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 50px;
}

.next-links a {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.next-links small {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.next-links b {
  display: block;
  margin-top: 8px;
  font-size: 16px;
}

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

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar .nav-group:nth-of-type(n + 2),
  .sidebar-foot,
  .top-actions,
  .toc {
    display: none;
  }

  .topbar {
    position: static;
    display: block;
    min-height: auto;
    padding: 16px 20px;
  }

  .search {
    max-width: none;
  }

  .content {
    padding: 34px 20px 52px;
  }

  .hero,
  .auth-panel,
  .article-layout,
  .article-preview,
  .next-links {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 38px;
  }

  .lead {
    font-size: 16px;
  }

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

  .chapter-grid.handbook-two-col {
    grid-template-columns: 1fr;
  }

  .permission-notes {
    grid-template-columns: 1fr;
  }

  .article-body {
    font-size: 16px;
    line-height: 1.9;
  }
}
