:root {
  --text: #1a1f2b;
  --sub: #3f4756;
  --muted: #7a8394;
  --line: #e6e9ef;
  --bg: #f4f6f9;
  --paper: #ffffff;
  --side: #f7f9fc;
  --accent: #2f6fd6;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-size: 15px;
  word-break: keep-all;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  letter-spacing: -0.2px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  min-height: 100vh;
}

.toc {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 1.75rem 1.1rem 2rem;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.toc-kicker {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.toc-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
}

.toc-meta {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.toc nav {
  display: grid;
  gap: 0.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.toc-label {
  margin: 0 0 0.4rem 0.6rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.toc nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--sub);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.toc nav a span {
  color: #aab2bf;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.toc nav a:hover {
  background: var(--side);
}

.toc nav a.active {
  background: #eef4ff;
  color: var(--accent);
}

.toc nav a.active span {
  color: var(--accent);
}

.page {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2.5rem 2rem 45vh;
}

.page section {
  scroll-margin-top: 1.5rem;
}

.kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.35;
  letter-spacing: -0.4px;
}

.meta {
  margin: 0.55rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.lead {
  margin: 0 0 1rem;
  color: var(--sub);
  font-size: 1.02rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chips span {
  padding: 0.15rem 0.55rem;
  border: 1px solid #e3e9f3;
  border-radius: 999px;
  background: var(--paper);
  color: #34445f;
  font-size: 0.78rem;
  font-weight: 600;
}

section {
  margin-top: 2.75rem;
}

.num {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

h2 {
  margin: 0.15rem 0 0.85rem;
  font-size: 1.35rem;
}

h3 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.02rem;
}

p {
  margin: 0 0 0.7rem;
}

.note,
.card p,
.why p {
  color: var(--sub);
}

.arch {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.arch-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 700;
}

.arch-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.tiers {
  display: grid;
  grid-template-columns: 5.5rem repeat(3, minmax(0, 1fr));
}

.corner,
.flow-head {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--side);
}

.flow-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 2px solid var(--flow);
}

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

.tiers > :nth-child(4n + 2) {
  --flow: #2f6fd6;
  --tint: #f7faff;
}

.tiers > :nth-child(4n + 3) {
  --flow: #178a4c;
  --tint: #f6fbf8;
}

.tiers > :nth-child(4n + 4) {
  --flow: #7c5cff;
  --tint: #f9f7ff;
}

.tier {
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--side);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.9rem 0.9rem;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--tint);
}

.tiers > .cell:nth-child(-n + 8) {
  padding-top: 0.9rem;
}

.tiers > :nth-last-child(-n + 4) {
  border-bottom: 0;
}

.node {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid #dfe4eb;
  border-top: 2px solid var(--flow, #dfe4eb);
  border-radius: 8px;
  background: var(--paper);
  text-align: center;
  box-shadow: 0 1px 3px rgba(26, 31, 43, 0.05);
}

.node b {
  display: block;
  font-size: 0.88rem;
}

.node span {
  color: var(--muted);
  font-size: 0.74rem;
}

.node.vip {
  border: 1px dashed #c9d1dc;
  background: transparent;
  box-shadow: none;
}

.node.vip b::before {
  content: "L4";
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--flow);
  color: #fff;
  font-size: 0.66rem;
  vertical-align: 0.1em;
}

.pair {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  width: 100%;
}

.pair[data-link]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(50% - 0.55rem);
  width: 1.1rem;
  border-top: 1px dashed var(--flow);
}

.pair[data-link]::after {
  content: attr(data-link);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--flow);
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 0 1px var(--line);
}

.wire {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 1.7rem;
}

.wire::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 5px;
  left: 50%;
  width: 1px;
  background: var(--flow);
  opacity: 0.45;
}

.wire::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(50% - 4px);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--flow);
  opacity: 0.6;
}

.wire span {
  position: relative;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--flow);
  font-size: 0.66rem;
  font-weight: 800;
}

.wire.both::before {
  top: 5px;
}

.wire.both span::before {
  content: "";
  position: absolute;
  top: -0.85rem;
  left: calc(50% - 4px);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--flow);
  opacity: 0.6;
}

.node.zk {
  border-style: solid;
  border-top-style: solid;
  background: var(--paper);
}

.node.zk b::before {
  content: "ZK";
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--flow);
  color: var(--flow);
  font-size: 0.66rem;
  vertical-align: 0.1em;
}

.zk-roles {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.zones {
  display: grid;
  grid-template-columns: 6.4rem minmax(12rem, 1fr) 6.2rem minmax(13rem, 1.15fr) 6.2rem minmax(13rem, 1.15fr);
  min-width: 56rem;
}

.zones > .z1 {
  --flow: #2f6fd6;
  --tint: #f7faff;
}

.zones > .z2 {
  --flow: #b7791f;
  --tint: #fffbf3;
}

.zones > .z3 {
  --flow: #178a4c;
  --tint: #f6fbf8;
}

.zone-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 2px solid var(--flow);
  background: var(--side);
  font-size: 0.82rem;
  font-weight: 700;
}

.zone-head::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--flow);
}

.zone-gap {
  border-bottom: 1px solid var(--line);
  background: var(--side);
}

.zones .corner {
  border-bottom: 1px solid var(--line);
}

.zones .tier {
  justify-content: center;
  padding: 0 0.45rem;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

.zcell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.9rem;
  border-bottom: 1px solid var(--line);
  border-left: 1px dashed #d3dae4;
  border-right: 1px dashed #d3dae4;
  background: var(--tint);
}

.zones > :nth-last-child(-n + 6) {
  border-bottom: 0;
}

.node.mine {
  border-color: #cbdcf6;
  background: #f5f9ff;
}

.hop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.hop::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.3rem;
  right: 0.55rem;
  border-top: 1.5px solid #b8c3d1;
}

.hop::after {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  right: 0.3rem;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid #b8c3d1;
}

.hop span {
  position: relative;
  z-index: 1;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--sub);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.arch-foot {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--side);
  color: var(--sub);
  font-size: 0.86rem;
  line-height: 1.7;
}

.arch-foot a {
  font-weight: 600;
}

.cell-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.cell.empty {
  background: repeating-linear-gradient(
    -45deg,
    var(--tint) 0 8px,
    #eff1f6 8px 9px
  );
}

.live {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #f5f9ff;
}

.live-label {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.live-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.84rem;
}

.live-flow b {
  padding: 0.2rem 0.6rem;
  border: 1px solid #d5e3fa;
  border-radius: 6px;
  background: var(--paper);
  font-weight: 700;
}

.live-flow i {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 700;
}

.live-flow i::before,
.live-flow i::after {
  content: "";
  width: 0.9rem;
  height: 1px;
  background: #9db8e6;
}

.live-flow i::after {
  width: 0.6rem;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #9db8e6;
  background: none;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.seq {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.seq + .seq {
  margin-top: 0.7rem;
}

.seq-head,
.seq-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(6.5rem, 1fr));
  min-width: 46rem;
}

.seq.rich .seq-head,
.seq.rich .seq-body,
.seq.rich .lifelines {
  grid-template-columns: repeat(6, minmax(7rem, 1fr));
  min-width: 42rem;
}

.seq.link3 .seq-head,
.seq.link3 .seq-body,
.seq.link3 .lifelines {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.seq.flow4 .seq-head,
.seq.flow4 .seq-body,
.seq.flow4 .lifelines,
.seq.flow5 .seq-head,
.seq.flow5 .seq-body,
.seq.flow5 .lifelines {
  min-width: 0;
}

.seq.flow4 .seq-head,
.seq.flow4 .seq-body,
.seq.flow4 .lifelines {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.seq.flow5 .seq-head,
.seq.flow5 .seq-body,
.seq.flow5 .lifelines {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.seq.rich .msg {
  height: 2.7rem;
}

.seq.rich .msg span {
  max-width: 9.5rem;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

.handoff {
  display: grid;
  grid-template-columns: 1fr 4.2rem 1fr 4.2rem 1fr;
  align-items: center;
  margin-top: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.seq-head {
  padding: 0.9rem 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.seq-head div {
  margin: 0 0.25rem;
  padding: 0.5rem 0.3rem;
  border: 1px solid #dfe4eb;
  border-top: 2px solid var(--accent);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.seq-body {
  position: relative;
  padding: 0.3rem 0.5rem 1rem;
  row-gap: 0.15rem;
}

.lifelines {
  position: absolute;
  inset: 0 0.5rem;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  pointer-events: none;
}

.lifelines i {
  border-left: 1px dashed #d6dce5;
  margin-left: 50%;
}

.phase {
  position: relative;
  grid-column: 1 / -1;
  margin: 0.7rem 0 0.2rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--side);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.msg {
  --from: calc(100% / var(--n) / 2);
  position: relative;
  height: 2.3rem;
}

.msg::before {
  content: "";
  position: absolute;
  bottom: 0.55rem;
  left: var(--from);
  right: var(--from);
  border-top: 1.5px solid var(--accent);
}

.msg::after {
  content: "";
  position: absolute;
  bottom: calc(0.55rem - 4px);
  right: var(--from);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid var(--accent);
}

.msg.rev::after {
  right: auto;
  left: var(--from);
  border-left: 0;
  border-right: 7px solid var(--accent);
}

.msg.rev::before {
  border-top-style: dashed;
}

.msg.ws::before {
  border-top-color: #0e7490;
}

.msg.ws::after {
  border-left-color: #0e7490;
}

.msg span {
  position: absolute;
  bottom: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 0.35rem;
  background: var(--paper);
  color: var(--sub);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.seq-notes {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.seq-notes .why {
  margin-top: 0;
}

.timeline {
  position: relative;
  margin-top: 1.2rem;
  padding: 1.3rem 1.4rem 1.3rem 3rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.timeline::before {
  content: "";
  position: absolute;
  top: 1.9rem;
  bottom: 1.9rem;
  left: 1.6rem;
  width: 1px;
  background: var(--line);
}

.tl-item {
  position: relative;
  margin-bottom: 1.4rem;
}

.tl-item:last-child {
  margin-bottom: 0;
}

.tl-dot {
  position: absolute;
  top: 0.35rem;
  left: -1.72rem;
  z-index: 1;
  width: 10px;
  height: 10px;
  border: 1.5px solid #9aa4b2;
  border-radius: 50%;
  background: var(--paper);
}

.tl-dot.blue {
  border-color: var(--accent);
  background: #eef4ff;
}

.tl-dot.green {
  border-color: #178a4c;
  background: #e7f7ee;
}

.tl-dot.violet {
  border-color: #7c5cff;
  background: #f3f0ff;
}

.tl-dot.red {
  border-color: #d64545;
  background: #fdeeee;
}

.tl-item.mine .tl-dot {
  background: var(--accent);
}

.tl-phase {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tl-phase.blue {
  color: var(--accent);
}

.tl-phase.green {
  color: #178a4c;
}

.tl-phase.violet {
  color: #7c5cff;
}

.tl-phase.red {
  color: #d64545;
}

.tl-title {
  margin-bottom: 0.2rem;
  font-size: 0.98rem;
  font-weight: 700;
}

.tl-desc {
  color: var(--sub);
  font-size: 0.9rem;
  line-height: 1.75;
}

.tl-item.fail {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px dashed #f0c7c7;
}

.tl-item.fail .tl-dot {
  top: 1.55rem;
}

.cards.three {
  grid-template-columns: repeat(3, 1fr);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.stat {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.stat b {
  display: block;
  color: var(--accent);
  font-size: 1.1rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.8rem;
}

.steps {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.75rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.steps li + li::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -0.5rem;
  width: 0.5rem;
  border-top: 1px solid #c5ceda;
}

.steps b {
  display: block;
  font-size: 0.9rem;
}

.steps span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.ch-board {
  display: grid;
  grid-template-columns: 1fr auto 0.8fr auto 1.3fr;
  gap: 0.7rem;
  align-items: center;
  margin: 0.3rem 0 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.ch-streams,
.ch-loops {
  display: grid;
  gap: 0.4rem;
}

.ch-join {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.ch-board.linked {
  column-gap: 0;
}

.ch-board.linked .ch-streams,
.ch-board.linked .ch-loops,
.ch-board.linked > .node {
  position: relative;
  margin: 0 0.35rem;
}

.ch-board.linked .ch-streams::after,
.ch-board.linked .ch-loops::before {
  content: "";
  position: absolute;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 0.7rem;
  border-top: 1.5px solid #2f6fd6;
  border-bottom: 1.5px solid #2f6fd6;
}

.ch-board.linked .ch-streams::after {
  right: -0.7rem;
  border-right: 1.5px solid #2f6fd6;
  border-radius: 0 8px 8px 0;
}

.ch-board.linked .ch-loops::before {
  left: -0.7rem;
  border-left: 1.5px solid #2f6fd6;
  border-radius: 8px 0 0 8px;
}

.ch-board.linked .ch-join {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  padding: 0 0.95rem;
}

.ch-board.linked .ch-join::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0.55rem;
  border-top: 1.5px solid #2f6fd6;
}

.ch-board.linked .ch-join::after {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  right: 0.05rem;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid #2f6fd6;
}

.ch-board.linked .ch-join span {
  position: relative;
  z-index: 1;
  padding: 0.12rem 0.45rem;
  border: 1px solid #d5e3fa;
  border-radius: 999px;
  background: #fff;
  line-height: 1.35;
}

.tx-compare.linked {
  position: relative;
  margin-top: 0.2rem;
  column-gap: 2.6rem;
}

.tx-compare.linked::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 58%;
  left: calc(50% - 0.95rem);
  width: 1.25rem;
  border-top: 1.5px solid #2f6fd6;
}

.tx-compare.linked::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: calc(58% - 4px);
  left: calc(50% + 0.2rem);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid #2f6fd6;
}

.tx-compare.linked .tx-outer {
  position: relative;
}

.tx-compare.linked .tx-step {
  position: relative;
}

.tx-compare.linked .tx-step + .tx-step::before {
  content: "";
  position: absolute;
  top: -0.45rem;
  left: 1.15rem;
  height: 0.45rem;
  border-left: 1.5px solid #9db8e6;
}

.ch-loops div {
  padding: 0.55rem 0.7rem;
  border: 1px solid #d5e3fa;
  border-radius: 8px;
  background: #f7faff;
}

.ch-loops em,
.ch-loops span {
  display: block;
}

.ch-loops em {
  color: var(--accent);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.ch-loops span {
  color: var(--sub);
  font-size: 0.8rem;
}

.tx-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  align-items: stretch;
}

.tx-col {
  display: flex;
  flex-direction: column;
}

.tx-outer {
  flex: 1;
}

.tx-compare:has(> .tx-col:only-child) {
  grid-template-columns: minmax(0, 28rem);
}

.tx-label {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.tx-label.bad {
  color: #d64545;
}

.tx-label.ok {
  color: #178a4c;
}

.tx-outer {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px dashed #f0c7c7;
  border-radius: 12px;
  background: #fffafa;
}

.tx-outer > b {
  font-size: 0.92rem;
}

.tx-outer > p {
  margin: 0.2rem 0 0;
  color: #d64545;
  font-size: 0.8rem;
  font-weight: 700;
}

.tx-outer.split {
  border-style: solid;
  border-color: #cfe8d8;
  background: #f6fbf8;
}

.tx-label.plain {
  color: var(--muted);
}

.tx-outer.base {
  border-style: solid;
  border-color: var(--line);
  background: var(--side);
}

.tx-outer.base > p {
  color: var(--sub);
}

.tx-step.child {
  margin-left: 1rem;
}

.tx-step.opt {
  border-style: dashed;
  background: transparent;
}

.tx-step.opt em {
  color: var(--muted);
}

.tx-step {
  padding: 0.55rem 0.7rem;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
}

.tx-step b,
.tx-step em {
  display: block;
}

.tx-step b {
  font-size: 0.92rem;
  line-height: 1.35;
}

.tx-step em {
  margin-bottom: 0.12rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.tx-step.ok em {
  color: #178a4c;
}

.tx-step span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.tx-step.ok {
  border-top: 2px solid #178a4c;
}

.tx-step.fail {
  border-top: 2px solid #d64545;
  background: #fffafa;
}

.tx-step.fail em {
  color: #d64545;
}

.tx-call {
  justify-self: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.kpi article {
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.kpi em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.kpi b {
  display: block;
  margin: 0.25rem 0 0.35rem;
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kpi b small {
  margin-left: 0.15rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.kpi span {
  display: block;
  color: var(--sub);
  font-size: 0.8rem;
  line-height: 1.45;
}

.kpi article:nth-child(2) b {
  color: var(--accent);
}

.spec {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.7rem;
}

.spec div {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--side);
}

.spec em {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 800;
}

.spec p {
  margin: 0 0 0.55rem;
  color: var(--sub);
  font-size: 0.9rem;
  line-height: 1.65;
}

.spec p:last-child {
  margin-bottom: 0;
}

.tx-compare code {
  background: #eef4ff;
}

:not(pre) > code {
  padding: 0.08em 0.4em;
  border: 1px solid #e1e6ed;
  border-radius: 5px;
  background: #f0f2f5;
  color: #2b3240;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  font-weight: 500;
  white-space: nowrap;
}

.ps-row.result code {
  color: var(--accent);
}

.results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.result-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
}

.result-card em {
  color: var(--accent);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.result-card b {
  display: block;
  margin: 0.2rem 0 0.4rem;
  font-size: 1.02rem;
  line-height: 1.4;
}

.result-card p {
  margin: 0;
  color: var(--sub);
  font-size: 0.88rem;
}

.result-card .did,
.result-card .got {
  margin-top: 0.55rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
}

.result-card .did {
  border: 1px solid var(--line);
  background: var(--paper);
}

.result-card .got {
  border: 1px solid #d5e3fa;
  background: #f5f9ff;
}

.result-card .did span,
.result-card .got span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.result-card .did span {
  color: var(--muted);
}

.result-card .got span {
  color: var(--accent);
}

.result-card .did p,
.result-card .got p {
  font-size: 0.86rem;
}

.case + .case {
  margin-top: 1.4rem;
}

.case .ps {
  margin-top: 0.7rem;
}

.case .seq + .note {
  margin-top: 0.7rem;
}

.case .note + .tx-label {
  margin-top: 1rem;
}

.fix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.fix > div {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.fix > div p:last-child {
  margin: 0.55rem 0 0;
  color: var(--sub);
  font-size: 0.86rem;
}

.fix-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.fix-map.one .node {
  border-color: #b7dfc6;
  background: #f6fbf8;
}

.meter {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: #fdeeee;
}

.meter span {
  display: block;
  height: 100%;
  background: #d64545;
}

.meter.ok {
  background: #e7f7ee;
}

.meter.ok span {
  background: #178a4c;
}

.roll {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roll li {
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.roll .down {
  background: #fffafa;
  color: #d64545;
}

.roll .stay {
  background: #f6fbf8;
  color: #178a4c;
}

.case h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
}

.case h3 span {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.ps {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.seq-notes + .ps {
  margin-top: 0.9rem;
}

.ps-row {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}

.ps-row:last-child {
  border-bottom: 0;
}

.ps-row b {
  color: var(--muted);
  font-size: 0.82rem;
}

.ps-row p {
  margin: 0;
  color: var(--sub);
}

.ps-row.result {
  background: #f5f9ff;
}

.ps-row.result b,
.ps-row.result p {
  color: var(--accent);
  font-weight: 600;
}

.card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.card b {
  display: block;
  margin-bottom: 0.25rem;
}

.why {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.7rem;
  margin-top: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
}

.why b {
  color: var(--accent);
  font-size: 0.82rem;
}

.purpose {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem 1.05rem;
  border: 1px solid #e6e1da;
  border-radius: 12px;
  background: #f4f2ef;
}

.purpose .tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  color: #3d3833;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.purpose .tag::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #d94b4b;
}

.purpose p {
  margin: 0;
  color: #4e4944;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.15px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-size: 0.92rem;
}

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

th {
  background: var(--side);
  font-size: 0.8rem;
  color: var(--muted);
}

ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  color: var(--sub);
}

.fd {
  --wire: #b8c3d1;
  margin-top: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.fd-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--side);
  font-size: 0.85rem;
  font-weight: 700;
}

.fd-badge {
  flex: 0 0 auto;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: #fdeeee;
  color: #c43d3d;
  font-size: 0.74rem;
  font-weight: 800;
}

.fd-badge.solved {
  background: #e7f7ee;
  color: #178a4c;
}

.fd-badge.plain {
  background: #eef2f7;
  color: var(--sub);
}

.fd-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.4rem 1.2rem 1.2rem;
}

.fd-step {
  width: 100%;
  max-width: 26rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  text-align: center;
}

.fd-step small {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.fd-step b {
  display: block;
  font-size: 0.95rem;
  line-height: 1.45;
}

.fd-step span {
  display: block;
  margin-top: 0.2rem;
  color: var(--sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

.fd-step.blue {
  border-color: #cbdcf6;
  background: #f5f9ff;
}

.fd-step.blue b {
  color: #2458ad;
}

.fd-step.green {
  border-color: #cfe8d8;
  background: #f6fbf8;
}

.fd-step.green b {
  color: #146c3d;
}

.fd-step.violet {
  border-color: #ddd5ff;
  background: #f9f7ff;
}

.fd-step.violet b {
  color: #5b3fd6;
}

.fd-step.amber {
  border-color: #f1dfb6;
  background: #fffbf3;
}

.fd-step.amber b {
  color: #9a6412;
}

.fd-step.warn span {
  color: #c43d3d;
  font-weight: 600;
}

.fd-link {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fd-link::before {
  content: "";
  width: 1.5px;
  height: 0.7rem;
  background: var(--wire);
}

.fd-link span {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
}

.fd-link span::after {
  content: "";
  width: 1.5px;
  height: 0.45rem;
  margin-top: 0.2rem;
  background: var(--wire);
}

.fd-link::after {
  content: "";
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--wire);
}

.fd-link.split::after {
  display: none;
}

.fd-branch {
  --gap: 0.8rem;
  --drop: 0.7rem;
  --edge: calc((100% - (var(--cols, 2) - 1) * var(--gap)) / var(--cols, 2) / 2);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: 40rem;
  padding-top: var(--drop);
}

.fd-branch::before,
.fd-branch.merge::after {
  content: "";
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  border-top: 1.5px solid var(--wire);
}

.fd-branch::before {
  top: 0;
}

.fd-branch.merge {
  padding-bottom: var(--drop);
}

.fd-branch.merge::after {
  bottom: 0;
}

.fd-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fd-col::before,
.fd-branch.merge .fd-col::after {
  content: "";
  position: absolute;
  left: calc(50% - 0.75px);
  width: 1.5px;
  height: var(--drop);
  background: var(--wire);
}

.fd-col::before {
  top: calc(var(--drop) * -1);
}

.fd-branch.merge .fd-col::after {
  bottom: calc(var(--drop) * -1);
}

.fd-col .fd-step {
  flex: 1;
  max-width: none;
}

.fd-tag {
  position: relative;
  margin-bottom: 0.55rem;
  padding: 0.12rem 0.55rem;
  border: 1px solid;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
}

.fd-tag::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(50% - 0.75px);
  width: 1.5px;
  height: 0.55rem;
  background: var(--wire);
}

.fd-tag.blue {
  border-color: #cbdcf6;
  background: #f5f9ff;
  color: #2458ad;
}

.fd-tag.green {
  border-color: #cfe8d8;
  background: #f6fbf8;
  color: #146c3d;
}

.fd-tag.violet {
  border-color: #ddd5ff;
  background: #f9f7ff;
  color: #5b3fd6;
}

.fd-tag.amber {
  border-color: #f1dfb6;
  background: #fffbf3;
  color: #9a6412;
}

.fd-note {
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--side);
  color: var(--sub);
  font-size: 0.88rem;
  line-height: 1.75;
}

.fd-note strong {
  color: var(--text);
}

.fd-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.fd-compare .fd {
  margin-top: 0;
}

.fd + .stats,
.fd-compare + .stats,
.fd + .arch,
.fd-compare + .arch,
.arch + .stats,
.fd + .fd-compare,
.fd-compare + .fd {
  margin-top: 0.9rem;
}

@media (max-width: 960px) {
  .fd-compare,
  .fd-branch {
    grid-template-columns: 1fr;
  }

  .fd-branch::before,
  .fd-branch.merge::after,
  .fd-col::before,
  .fd-branch.merge .fd-col::after {
    display: none;
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: sticky;
    z-index: 2;
    height: auto;
    padding: 0.75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toc .back {
    margin-bottom: 0.5rem;
  }

  .toc-kicker,
  .toc-title,
  .toc-meta,
  .toc-label {
    display: none;
  }

  .toc nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding-top: 0;
    border-top: 0;
  }

  .toc nav a {
    flex: 0 0 auto;
    padding: 0.35rem 0.6rem;
  }

  .page section {
    scroll-margin-top: 6.5rem;
  }
}

@media (max-width: 720px) {

  .ch-board,
  .kpi,
  .spec,
  .fix,
  .tx-compare,
  .results,
  .cards,
  .cards.three,
  .why,
  .ps-row {
    grid-template-columns: 1fr;
  }

  .stats,
  .steps {
    grid-template-columns: 1fr 1fr;
  }


  .steps li + li::after {
    content: none;
  }

  .tiers {
    grid-template-columns: 4rem repeat(3, minmax(9rem, 1fr));
    overflow-x: auto;
  }
}
