:root {
  --bg: #f5f7f8;
  --ink: #151d27;
  --muted: #667383;
  --line: #d7e0e8;
  --surface: #ffffff;
  --surface-2: #edf2f5;
  --green: #176b5b;
  --amber: #d79324;
  --blue: #2e5d86;
  --red: #aa413b;
  --shadow: 0 18px 48px rgba(30, 42, 55, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button {
  font: inherit;
}

.arch-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
  padding: 22px 0 24px;
}

.back-link {
  display: inline-flex;
  color: var(--green);
  text-decoration: none;
  margin-bottom: 14px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 58px);
  letter-spacing: 0;
  line-height: 1.02;
}

.hero p,
.map-heading p,
.pipeline-section p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.6;
}

.runtime-card,
.map-section,
.module-nav,
.module-panel,
.pipeline-section,
.lineage-section,
.io-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.runtime-card {
  padding: 18px;
}

.runtime-card span,
.module-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.runtime-card strong {
  display: block;
  font-size: 18px;
}

.map-section {
  padding: 18px;
}

.map-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.architecture-map {
  position: relative;
  min-height: 430px;
  background:
    linear-gradient(90deg, rgba(23, 107, 91, 0.06), transparent 35%),
    linear-gradient(180deg, rgba(46, 93, 134, 0.06), transparent 42%),
    #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.map-node {
  position: absolute;
  z-index: 2;
  width: 170px;
  min-height: 78px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 13px;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(30, 42, 55, 0.08);
}

.map-node span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.map-node.active,
.map-node:hover {
  border-color: var(--green);
  outline: 3px solid rgba(23, 107, 91, 0.12);
}

.node-data { left: 34px; top: 44px; }
.node-builder { left: 274px; top: 44px; }
.node-memory { left: 514px; top: 44px; }
.node-api { left: 274px; top: 244px; }
.node-agent { left: 514px; top: 244px; }
.node-trust { left: 754px; top: 244px; }
.node-ui { right: 34px; top: 244px; }

.edge {
  position: absolute;
  z-index: 1;
  background: var(--line);
}

.edge::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.edge-data-builder { left: 204px; top: 82px; width: 70px; height: 3px; }
.edge-builder-memory { left: 444px; top: 82px; width: 70px; height: 3px; }
.edge-memory-agent { left: 594px; top: 122px; width: 3px; height: 122px; }
.edge-ui-api { right: 204px; top: 282px; width: 310px; height: 3px; }
.edge-api-agent { left: 444px; top: 282px; width: 70px; height: 3px; }
.edge-agent-trust { left: 684px; top: 282px; width: 70px; height: 3px; }
.edge-trust-ui { right: 204px; top: 318px; width: 70px; height: 3px; }

.content-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.module-nav,
.module-panel {
  padding: 18px;
}

.module-nav h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

.module-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 42px;
  margin-top: 8px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.module-button.active,
.module-button:hover {
  border-color: var(--green);
  background: #f2faf7;
}

.module-panel h2 {
  font-size: 30px;
  margin-bottom: 12px;
}

.module-panel p {
  color: var(--muted);
  line-height: 1.75;
  font-size: 15px;
}

.module-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.fact-pill {
  border: 1px solid rgba(23, 107, 91, 0.28);
  background: #f2faf7;
  color: #164d43;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
  counter-reset: detail-step;
}

.detail-card {
  position: relative;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 8px;
  padding: 14px 14px 14px 54px;
  counter-increment: detail-step;
}

.detail-card::before {
  content: counter(detail-step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #164d43;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.detail-card + .detail-card::after {
  content: "";
  position: absolute;
  left: 27px;
  top: -11px;
  width: 2px;
  height: 10px;
  background: var(--line);
}

.detail-card h3,
.example-box h3 {
  font-size: 14px;
  margin-bottom: 10px;
}

.detail-card ul {
  margin: 0;
  padding-left: 18px;
}

.detail-card li {
  color: #415061;
  line-height: 1.65;
  font-size: 13px;
  margin: 6px 0;
}

.example-box {
  margin-top: 16px;
}

.deep-box,
.talk-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.deep-box h3,
.talk-box h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.talk-box {
  background: #fff9ed;
  border-color: rgba(215, 147, 36, 0.35);
}

.pipeline-section,
.io-section,
.lineage-section {
  margin-top: 16px;
}

.pipeline-section {
  padding: 18px;
}

.lineage-section {
  padding: 18px;
}

.lineage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.lineage-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.lineage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.lineage-card {
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 8px;
  padding: 14px;
  min-height: 172px;
}

.lineage-card span {
  display: inline-block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 12px;
}

.lineage-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.lineage-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(8, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 18px;
  overflow-x: auto;
}

.step {
  min-height: 88px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  font-size: 24px;
  font-weight: 900;
}

.step span {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.step.guard {
  border-color: rgba(170, 65, 59, 0.45);
  background: #fff6f5;
}

.io-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.io-card {
  padding: 18px;
}

.io-card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #203040;
  background: #f3f6f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .hero,
  .content-grid,
  .io-section,
  .detail-grid,
  .lineage-grid {
    grid-template-columns: 1fr;
  }

  .map-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .architecture-map {
    display: grid;
    gap: 10px;
    min-height: auto;
    padding: 12px;
  }

  .map-node {
    position: static;
    width: 100%;
  }

  .edge {
    display: none;
  }

  .lineage-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
