:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #607080;
  --paper: #f7f4ed;
  --panel: #fffdf7;
  --line: #d9d0bd;
  --accent: #b8472a;
  --accent-2: #1f6f68;
  --accent-3: #315c9a;
  --code: #243447;
  --soft: #efe7d7;
  --warn: #8b4c10;
  --bad: #9d2c2f;
  --good: #267257;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 32, 42, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 42, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.7;
}

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

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  font-size: 14px;
  color: var(--muted);
}

.brand {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.hero {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.88);
  padding: 34px;
  box-shadow: 0 18px 50px rgba(30, 25, 18, 0.08);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  max-width: 920px;
  letter-spacing: 0;
}

h2 {
  font-size: 26px;
  margin-top: 40px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

h3 {
  font-size: 19px;
  margin-top: 26px;
  margin-bottom: 8px;
}

.subtitle {
  max-width: 860px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.nav-card,
.card,
.note,
.evidence,
.metric {
  border: 1px solid var(--line);
  background: var(--panel);
}

.nav-card {
  min-height: 116px;
  padding: 18px;
}

.nav-card strong {
  display: block;
  color: var(--accent);
  margin-bottom: 7px;
}

.nav-card span {
  color: var(--muted);
  font-size: 14px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card,
.metric {
  padding: 18px;
}

.metric .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.metric .label {
  color: var(--muted);
  font-size: 14px;
}

.note {
  padding: 16px 18px;
  border-left: 5px solid var(--accent-2);
  margin: 18px 0;
}

.warning {
  border-left-color: var(--warn);
}

.danger {
  border-left-color: var(--bad);
}

.good {
  border-left-color: var(--good);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 26px;
  background: var(--panel);
  border: 1px solid var(--line);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--accent);
  background: var(--soft);
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

code,
.path {
  font-family: Consolas, "Cascadia Mono", monospace;
  color: var(--code);
  background: rgba(31, 111, 104, 0.09);
  padding: 2px 5px;
  border-radius: 3px;
}

pre {
  overflow-x: auto;
  padding: 16px;
  background: #16202b;
  color: #f7f4ed;
  border: 1px solid #0f1720;
}

.flow {
  display: grid;
  gap: 10px;
  margin: 16px 0 24px;
}

.flow-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: stretch;
}

.flow-key {
  background: var(--accent-2);
  color: white;
  padding: 12px;
  font-weight: 800;
}

.flow-val {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
}

.evidence {
  margin-top: 28px;
  padding: 18px;
}

.evidence ul,
.tight {
  margin: 8px 0 0;
  padding-left: 20px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.footer {
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.diagram-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(184, 71, 42, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(31, 111, 104, 0.08), transparent 34%),
    var(--panel);
  padding: 20px;
  margin: 18px 0 28px;
  overflow-x: auto;
}

.logic-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(142px, 1fr));
  gap: 14px;
  min-width: 820px;
  align-items: stretch;
}

.logic-node {
  position: relative;
  border: 2px solid var(--line);
  background: rgba(255, 253, 247, 0.92);
  padding: 14px;
  min-height: 112px;
}

.logic-node::after {
  content: "→";
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

.logic-node:last-child::after,
.logic-node.break::after {
  display: none;
}

.logic-node strong {
  display: block;
  color: var(--accent);
  margin-bottom: 6px;
}

.logic-node span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.logic-node.alt {
  border-color: rgba(31, 111, 104, 0.62);
}

.logic-node.stop {
  border-color: rgba(157, 44, 47, 0.56);
}

.framework-map {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 16px;
  min-width: 900px;
}

.framework-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.framework-title {
  font-weight: 800;
  color: var(--accent-2);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

.framework-box {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
  padding: 14px;
}

.framework-box strong {
  display: block;
  color: var(--accent);
  margin-bottom: 4px;
}

.framework-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.formula {
  display: inline-block;
  margin: 6px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-family: Consolas, "Cascadia Mono", monospace;
  color: var(--code);
}

.step-list {
  counter-reset: step;
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.step-item {
  counter-increment: step;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 16px 14px 54px;
  position: relative;
}

.step-item::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--accent-2);
  color: white;
  font-weight: 800;
}

.step-item strong {
  color: var(--accent);
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 24px, 1180px);
    padding-top: 20px;
  }

  .hero {
    padding: 22px;
  }

  .flow-row {
    grid-template-columns: 1fr;
  }

  .diagram-panel {
    padding: 14px;
  }
}
