:root {
  --bg: #fafafa;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #ffffff;
  --brand: #3b3bff;
  --brand-2: #7c3aed;
  --accent: #10b981;

  --c-hot: #ef4444;
  --c-new: #f59e0b;
  --c-sim: #3b82f6;
  --c-prof: #8b5cf6;
  --c-soc: #ec4899;
  --c-srch: #0ea5e9;
  --c-ml: #10b981;
  --c-op: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-size: 15px;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
code { font-family: "SF Mono", Menlo, Consolas, monospace; background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

/* -------- Hero -------- */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  color: #fff;
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.3) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.2) 0%, transparent 40%);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.eyebrow {
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: #c7d2fe; margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 56px); margin: 0 0 16px;
  font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #c7d2fe);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 18px; color: #e0e7ff; max-width: 760px; margin: 0 0 24px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 13px;
  backdrop-filter: blur(8px);
}

/* -------- TOC -------- */
.toc {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.toc .wrap { display: flex; gap: 24px; padding: 14px 24px; flex-wrap: wrap; }
.toc a {
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px;
}
.toc a:hover { color: var(--brand); }

/* -------- Sections -------- */
section {
  padding: 64px 0 32px;
  border-bottom: 1px solid var(--line);
}
section:last-of-type { border-bottom: none; }
section h2 {
  font-size: 28px; margin: 0 0 8px; display: flex; align-items: baseline; gap: 12px;
  letter-spacing: -0.01em;
}
section h2 small { font-size: 16px; color: var(--muted); font-weight: 400; }
.step {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
section h3 { font-size: 18px; margin: 24px 0 12px; }
.section-lede { max-width: 900px; color: #374151; margin: 0 0 24px; }

/* -------- Diagram card -------- */
.diagram-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin: 20px 0 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow-x: auto;
}
.mermaid { font-size: 14px; }

/* -------- Callouts -------- */
.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 20px; }
.callout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex; gap: 14px; align-items: flex-start;
}
.cnum {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
}

/* -------- Candidate grid -------- */
.cand-group { margin-top: 28px; }
.cand-group h3 { display: flex; align-items: center; gap: 10px; }
.tag {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  color: #fff;
}
.tag-hot { background: var(--c-hot); }
.tag-new { background: var(--c-new); }
.tag-sim { background: var(--c-sim); }
.tag-prof { background: var(--c-prof); }
.tag-soc { background: var(--c-soc); }
.tag-srch { background: var(--c-srch); }
.tag-ml { background: var(--c-ml); }
.tag-op { background: var(--c-op); }

.cand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.cand {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.cand:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--brand);
}
.cand b {
  display: block; font-family: "SF Mono", Menlo, monospace;
  color: var(--brand); font-size: 14px; margin-bottom: 6px;
}
.cand p { margin: 0; font-size: 13px; color: #374151; line-height: 1.5; }

.pipe-note {
  margin-top: 28px;
  background: #fef3c7; border: 1px solid #fcd34d;
  border-radius: 10px; padding: 14px 18px;
  font-size: 14px; color: #78350f;
}

/* -------- Two column panels -------- */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin: 16px 0;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.panel.full { margin-top: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.panel h3 small { font-weight: 400; color: var(--muted); font-size: 13px; }
ul.tight { margin: 0; padding-left: 18px; }
ul.tight li { margin-bottom: 6px; font-size: 14px; }
ul.tight li b { font-family: "SF Mono", Menlo, monospace; color: var(--brand); font-weight: 600; }

/* -------- Code sample -------- */
.code-sample {
  background: #0f172a; border-radius: 12px; overflow: hidden;
  margin: 20px 0; border: 1px solid #1e293b;
}
.code-head {
  padding: 10px 16px; background: #1e293b; color: #94a3b8;
  font-size: 13px; font-family: "SF Mono", Menlo, monospace;
  border-bottom: 1px solid #334155;
}
.code-sample pre { margin: 0; padding: 16px 20px; overflow-x: auto; }
.code-sample code {
  background: transparent; color: #e2e8f0; padding: 0;
  font-family: "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.6;
}
.c-comment { color: #64748b; font-style: italic; }
.c-kw { color: #c084fc; }

/* -------- Stack -------- */
.stack-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin-top: 20px;
}
.stack-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px;
}
.stack-card h3 { margin: 0 0 10px; font-size: 16px; }
.stack-card ul { margin: 0; padding-left: 18px; }
.stack-card li { font-size: 14px; color: #374151; margin-bottom: 4px; }

/* -------- Footer -------- */
footer {
  background: #0f172a; color: #cbd5e1; padding: 32px 0;
}
footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
footer code { background: rgba(255,255,255,0.08); color: #e2e8f0; }
footer .muted { color: #64748b; }
