:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #202a35;
  --muted: #667384;
  --line: #dfe5ec;
  --line-soft: #edf1f5;
  --brand: #123c5c;
  --brand-2: #0e7c76;
  --accent: #d8781f;
  --code-bg: #1f2937;
  --code-ink: #e5eaf0;
  --sidebar-w: 286px;
  --topbar-h: 64px;
  --shadow: 0 10px 28px rgba(25, 42, 60, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  background: #f0f4f8;
  border-color: #c8d2dd;
}

.icon-btn:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}

.brand-mark .icon {
  width: 21px;
  height: 21px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--brand);
  letter-spacing: 0;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

.topbar-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

#menuBtn {
  display: none;
}

.layout {
  padding-top: var(--topbar-h);
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-w);
  padding: 16px 12px 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-head {
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fafbfc;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.search:focus-within {
  border-color: var(--brand-2);
  background: #fff;
}

.search .icon {
  width: 17px;
  height: 17px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.search input::placeholder {
  color: #9aa6b3;
}

.toc {
  padding-top: 8px;
}

.toc-module + .toc-module {
  margin-top: 14px;
}

.toc-module-title {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  margin: 14px 8px 8px;
  padding: 8px 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  border-radius: 7px 7px 0 0;
  transition: background 0.16s ease;
}

.toc-module-title:hover {
  background: #f0f4f8;
}

.toc-module-title:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: -2px;
}

.toc-module-title .chev {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.toc-module.collapsed .toc-module-title {
  margin-bottom: 2px;
  border-bottom: 0;
  border-radius: 7px;
}

.toc-module.collapsed .toc-module-title .chev {
  transform: rotate(-90deg);
}

.toc-module.collapsed .toc-group {
  display: none;
}

.toc-group {
  margin: 0 0 4px;
}

.toc-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 7px;
  transition: background 0.16s ease, color 0.16s ease;
}

.toc-group-label:hover {
  background: #f0f4f8;
}

.toc-group-label .index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #eef3f7;
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
}

.toc-sub {
  margin: 2px 0 8px;
  padding: 0;
  list-style: none;
}

.toc-sub a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px 5px 37px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.toc-sub a::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c3ccd6;
  transition: background 0.16s ease;
}

.toc-sub a:hover {
  background: #f0f4f8;
  color: var(--ink);
}

.toc a.active,
.toc .toc-group-label.active {
  background: #e9f3f6;
  color: var(--brand-2);
}

.toc-sub a.active::before {
  background: var(--brand-2);
}

.overlay {
  display: none;
}

.content {
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--topbar-h));
  padding: 34px 42px 60px;
}

.module {
  max-width: 1000px;
  margin: 0 auto;
}

.module-intro {
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf2f1;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 700;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-2);
}

.module-intro h1 {
  margin: 16px 0 8px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--brand);
}

.module-intro .lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.module-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
}

.stat strong {
  color: var(--ink);
  font-weight: 700;
}

.section {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.section-num {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.section-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--ink);
}

.section-desc {
  max-width: 820px;
  margin: 0 0 16px;
  color: var(--muted);
}

.flow-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.git-flow {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.flow-node rect {
  rx: 12px;
  ry: 12px;
  stroke-width: 1.6;
}

.flow-node .node-title {
  font-size: 17px;
  font-weight: 700;
}

.flow-node .node-en {
  font-size: 11px;
  opacity: 0.72;
}

.flow-node .node-desc {
  font-size: 11.5px;
}

.node--work rect {
  fill: #e7f3fc;
  stroke: #3b8ac4;
}

.node--work .node-title {
  fill: #185b87;
}

.node--stage rect {
  fill: #e6f7f0;
  stroke: #3aa57f;
}

.node--stage .node-title {
  fill: #1e7458;
}

.node--local rect {
  fill: #fff3df;
  stroke: #d99a35;
}

.node--local .node-title {
  fill: #8c5a12;
}

.node--remote rect {
  fill: #f0ecfb;
  stroke: #8069c5;
}

.node--remote .node-title {
  fill: #5c449b;
}

.flow-link {
  fill: none;
  stroke: #8a97a5;
  stroke-width: 1.8;
}

.flow-link.link-commit {
  stroke: #3aa57f;
}

.flow-link.link-push {
  stroke: #8069c5;
}

.flow-link.link-pull {
  stroke: #d8781f;
}

.flow-link-text {
  font-size: 12px;
  font-weight: 600;
  fill: #465568;
}

.flow-link-text.text-add {
  fill: #3b8ac4;
}

.flow-link-text.text-commit {
  fill: #1e7458;
}

.flow-link-text.text-push {
  fill: #5c449b;
}

.flow-link-text.text-pull {
  fill: #b96514;
}

.flow-note {
  font-size: 11.5px;
  fill: #6c7887;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.swatch.work {
  background: #3b8ac4;
}

.swatch.stage {
  background: #3aa57f;
}

.swatch.local {
  background: #d99a35;
}

.swatch.remote {
  background: #8069c5;
}

.cmd-list {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.cmd {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-2);
  border-radius: 9px;
  background: #fff;
  padding: 18px 20px 20px;
  scroll-margin-top: calc(var(--topbar-h) + 18px);
}

.cmd-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cmd-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
}

.cmd-head code {
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef3f7;
  color: var(--brand);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 15px;
}

.cmd-tag {
  align-self: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f4f0e8;
  color: #98601c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cmd-desc {
  margin: 0 0 14px;
  color: var(--muted);
}

.params {
  width: 100%;
  margin: 0 0 14px;
  border-collapse: collapse;
  font-size: 13px;
}

.params th,
.params td {
  padding: 9px 11px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.params thead th {
  background: #eef3f7;
  color: var(--brand);
  font-weight: 700;
}

.params tbody tr:nth-child(even) {
  background: #fafbfc;
}

.params code {
  color: #9a3d12;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  white-space: nowrap;
}

.examples {
  display: grid;
  gap: 8px;
}

.example-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.code-list {
  display: grid;
  gap: 10px;
}

.code-block {
  overflow: hidden;
  border: 1px solid #2c3949;
  border-radius: 8px;
  background: var(--code-bg);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px 7px 13px;
  border-bottom: 1px solid #2c3949;
  color: #93a4b8;
  font-size: 11.5px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid #405066;
  border-radius: 6px;
  background: #2a3748;
  color: #d7e0ea;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.copy-btn:hover {
  background: #344459;
  border-color: #587087;
}

.copy-btn.copied {
  border-color: var(--brand-2);
  color: #b9f0e7;
}

.copy-btn .icon {
  width: 15px;
  height: 15px;
}

pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: 0;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

.content-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 48px;
  color: var(--muted);
  font-size: 12px;
}

.content-footer .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c3ccd6;
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  box-shadow: var(--shadow);
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 900px) {
  #menuBtn {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 0 9999px rgba(16, 28, 42, 0.42);
  }

  .overlay {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 35;
    background: rgba(16, 28, 42, 0.42);
  }

  body.sidebar-open .overlay {
    display: block;
  }

  .content {
    margin-left: 0;
    padding: 24px 18px 48px;
  }

  .module-intro h1 {
    font-size: 27px;
  }
}

@media (max-width: 560px) {
  .topbar-date {
    display: none;
  }

  .brand-text p {
    max-width: 160px;
  }

  .module-intro h1 {
    font-size: 24px;
  }

  .section-title {
    font-size: 18px;
  }

  .cmd {
    padding: 15px 14px 17px;
  }
}
