/* ============ 开发者赚钱手册 · 设计系统 ============ */
:root {
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-strong: #4338ca;
  --teal: #0d9488;
  --teal-soft: #e6f7f4;
  --amber: #b45309;
  --amber-soft: #fef6e7;
  --rose: #be123c;
  --rose-soft: #fdeef0;
  --ink: #1c2030;
  --body: #3a4053;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --bg: #ffffff;
  --bg-alt: #fafbfd;
  --sidebar-bg: #fbfbfd;
  --border: #ebecf2;
  --border-strong: #dde0e9;
  --code-bg: #f5f6fa;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 1px 3px rgba(20, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 24, 40, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 24, 40, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 286px;
  --content-max: 820px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--body);
  background: var(--bg);
  font-size: 16.5px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* reading progress */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  z-index: 200; transition: width .1s linear;
}

/* ---------- top bar (mobile) ---------- */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 90;
  align-items: center; gap: 12px;
  height: 58px; padding: 0 16px;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand-mini { font-weight: 700; color: var(--ink); font-size: 15px; }
.hamburger {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 38px; height: 38px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: #fff; cursor: pointer; padding: 0 9px;
}
.hamburger span { height: 2px; background: var(--ink); border-radius: 2px; transition: .25s; }

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

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 26px 18px 60px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e3ea; border-radius: 8px; }

.home-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 8px 16px; padding: 5px 11px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 999px; text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.home-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.brand { display: block; text-decoration: none; margin: 0 8px 22px; }
.brand .logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; color: var(--ink); font-size: 17px; letter-spacing: -.01em;
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.brand .sub { display: block; color: var(--faint); font-size: 12px; font-weight: 500; margin: 5px 0 0 35px; }

.nav-group { margin: 18px 0 4px; }
.nav-group-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); padding: 0 10px; margin-bottom: 6px;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--body); text-decoration: none; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav a .num {
  font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums;
  min-width: 18px; font-weight: 600;
}
.nav a:hover { background: #f0f1f6; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav a.active .num { color: var(--accent); }

/* ---------- main ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto; padding: 52px 40px 30px;
  flex: 1 0 auto;
}

.eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 11px; border-radius: 100px; margin-bottom: 16px;
}

h1 { font-size: 33px; line-height: 1.25; color: var(--ink); margin: 0 0 14px; letter-spacing: -.02em; font-weight: 800; }
h2 {
  font-size: 23px; color: var(--ink); margin: 46px 0 14px; letter-spacing: -.01em; font-weight: 750;
  padding-top: 8px; scroll-margin-top: 80px;
}
h3 { font-size: 18.5px; color: var(--ink); margin: 30px 0 10px; font-weight: 700; scroll-margin-top: 80px; }
h2 + h3 { margin-top: 16px; }

p { margin: 0 0 16px; }
.lead { font-size: 18.5px; color: var(--muted); line-height: 1.7; margin-bottom: 26px; }

a { color: var(--accent-strong); text-decoration: none; border-bottom: 1px solid rgba(79,70,229,.25); transition: border-color .15s; }
a:hover { border-color: var(--accent); }

strong { color: var(--ink); font-weight: 700; }
em { color: var(--body); }

ul, ol { margin: 0 0 18px; padding-left: 22px; }
li { margin: 7px 0; }
li::marker { color: var(--accent); }
ol li::marker { color: var(--muted); font-weight: 600; }

hr { border: none; border-top: 1px solid var(--border); margin: 38px 0; }

blockquote {
  margin: 22px 0; padding: 14px 20px;
  border-left: 3px solid var(--accent); background: var(--bg-alt);
  border-radius: 0 8px 8px 0; color: var(--muted); font-style: italic;
}
blockquote p:last-child { margin: 0; }
blockquote cite { display: block; font-style: normal; font-size: 13.5px; color: var(--faint); margin-top: 6px; }

code {
  font-family: var(--mono); font-size: .88em;
  background: var(--code-bg); color: #b4317a;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
}
pre {
  background: #1a1d29; color: #e6e8f0; padding: 18px 20px; border-radius: var(--radius);
  overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; margin: 18px 0;
}
pre code { background: none; border: none; color: inherit; padding: 0; font-size: inherit; }

/* ---------- callouts ---------- */
.callout {
  display: flex; gap: 13px; padding: 15px 18px; border-radius: var(--radius);
  margin: 22px 0; font-size: 15px; line-height: 1.7; border: 1px solid;
}
.callout .ico { flex: 0 0 22px; font-size: 18px; line-height: 1.5; }
.callout p:last-child { margin: 0; }
.callout strong { display: block; margin-bottom: 2px; }
.callout.tip { background: var(--teal-soft); border-color: #bfe9e1; color: #0b5d52; }
.callout.tip strong { color: var(--teal); }
.callout.warn { background: var(--amber-soft); border-color: #f3dca8; color: #875207; }
.callout.warn strong { color: var(--amber); }
.callout.note { background: var(--accent-soft); border-color: #d7d9fb; color: #3730a3; }
.callout.note strong { color: var(--accent-strong); }
.callout.danger { background: var(--rose-soft); border-color: #f6cdd5; color: #9f1239; }
.callout.danger strong { color: var(--rose); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-alt); color: var(--ink); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }

/* ---------- case cards ---------- */
.cases { display: grid; gap: 16px; margin: 24px 0; }
.case {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  background: #fff; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
}
.case:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.case-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.case-name { font-weight: 750; color: var(--ink); font-size: 17px; }
.case-name span { font-weight: 500; color: var(--muted); font-size: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; padding: 4px 11px; border-radius: 100px;
  background: var(--teal-soft); color: var(--teal); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.case p { margin: 6px 0 0; font-size: 14.5px; color: var(--body); }
.case .src { font-size: 12.5px; color: var(--faint); margin-top: 9px; }
.case .src a { color: var(--faint); border-bottom-color: transparent; }
.case .src a:hover { color: var(--accent); }

/* ---------- stat row ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 24px 0; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--bg-alt); }
.stat .big { font-size: 27px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; line-height: 1.1; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* ---------- steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 22px 0; }
.steps > li {
  position: relative; padding: 0 0 18px 44px; margin: 0;
  border-left: 2px solid var(--border); margin-left: 14px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -15px; top: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps > li strong { display: block; color: var(--ink); margin-bottom: 2px; }

/* ---------- pills / tags ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pill { font-size: 13.5px; padding: 5px 13px; border-radius: 100px; background: var(--bg-alt); border: 1px solid var(--border-strong); color: var(--body); }

/* ---------- hero (home) ---------- */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 40px; line-height: 1.18; }
.hero .lead { font-size: 19.5px; max-width: 680px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 22px;
  border-radius: 10px; font-weight: 650; font-size: 15.5px; text-decoration: none;
  border: 1px solid transparent; transition: transform .15s, box-shadow .15s, background .15s;
}
.btn.primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--accent-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 30px 0; }
.feature {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  background: #fff; box-shadow: var(--shadow-sm);
}
.feature .fico {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 16.5px; }
.feature p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* roadmap cards on home */
.roadmap { display: grid; gap: 12px; margin: 24px 0; }
.rm-card {
  display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
  text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.rm-card:hover { transform: translateX(3px); box-shadow: var(--shadow-md); border-color: #d7d9fb; }
.rm-num {
  flex: 0 0 42px; width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--teal)); color: #fff;
  font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.rm-body h3 { margin: 0 0 3px; font-size: 16.5px; color: var(--ink); }
.rm-body p { margin: 0; font-size: 14px; color: var(--muted); }
.rm-stage { font-size: 11.5px; font-weight: 700; color: var(--accent); letter-spacing: .03em; }

/* ---------- prev/next ---------- */
.pager { display: flex; gap: 14px; margin: 50px 0 10px; }
.pager a {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 18px;
  text-decoration: none; transition: border-color .15s, box-shadow .15s; background: #fff;
}
.pager a:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.pager .dir { font-size: 12.5px; color: var(--faint); font-weight: 600; }
.pager .ttl { color: var(--ink); font-weight: 650; font-size: 15px; margin-top: 3px; }
.pager .next { text-align: right; }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--border); padding: 26px 40px; margin-top: 30px;
  color: var(--faint); font-size: 13px; line-height: 1.7;
  max-width: var(--content-max); margin-left: auto; margin-right: auto; width: 100%;
}
.foot a { color: var(--muted); }

/* TOC inline on long pages */
.toc {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  background: var(--bg-alt); margin: 22px 0 30px;
}
.toc .toc-t { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.toc ul { margin: 0; padding-left: 18px; }
.toc li { margin: 4px 0; font-size: 14.5px; }

/* backdrop for mobile drawer */
.backdrop { display: none; position: fixed; inset: 0; background: rgba(20,24,40,.4); z-index: 80; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 100;
    transform: translateX(-100%); transition: transform .28s ease;
    box-shadow: var(--shadow-lg); width: 290px;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; }
  .content { padding: 30px 22px 24px; }
  .hero h1 { font-size: 30px; }
  h1 { font-size: 27px; }
  .foot { padding: 24px 22px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .content { padding: 24px 16px 20px; }
  .pager { flex-direction: column; }
  .hero .lead { font-size: 17px; }
  .case-head { align-items: flex-start; }
}
