:root {
  --bakelite: #1a1714;
  --board: #221e1a;
  --trace: #8a5a28;
  --json: #6eb8d6;
  --voice: #3dcc8a;
  --lamp: #f0b429;
  --paper: #f3ead9;
  --ink: #1c1712;
  --mute: #6d6256;
  --office: #3d8fb5;
  --plivo: #d46a32;
  --gate: #2a9d6e;
  --gemini: #8b6cc9;
  --lead: #e0b13a;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
}

body {
  color: var(--paper);
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(240, 180, 41, 0.08), transparent 50%),
    var(--bakelite);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--lamp);
  color: var(--ink);
  padding: 8px 12px;
  z-index: 5;
}
.skip:focus { top: 10px; }

.top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px 32px;
  align-items: end;
  padding: 22px 28px 8px;
}

.mark {
  margin: 0 0 4px;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lamp);
}

h1, h2, .node strong {
  font-family: "Sora", sans-serif;
  letter-spacing: -0.04em;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 800;
}

.promise {
  margin: 0;
  color: #cbbba6;
  font-size: 15px;
  max-width: 42rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 28px 10px;
}

.scene {
  appearance: none;
  border: 1px solid #3d342c;
  background: #2a241f;
  color: var(--paper);
  font: 650 13px/1 "Sora", sans-serif;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.scene.is-on {
  background: var(--lamp);
  color: var(--ink);
  border-color: var(--lamp);
}

.scene:focus-visible,
.play:focus-visible,
.ghost:focus-visible,
.node:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
  gap: 16px;
  padding: 0 20px 8px;
  align-items: stretch;
}

.board-wrap {
  background: var(--board);
  border: 1px solid #3a322b;
  border-radius: 18px;
  padding: 10px 12px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 4px 8px 8px;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  color: #b7a894;
}

.leg::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 99px;
}
.leg.json::before { background: var(--json); }
.leg.voice::before {
  background: repeating-linear-gradient(90deg, var(--voice) 0 6px, transparent 6px 9px);
}
.hint { margin-left: auto; }

.stage {
  position: relative;
  aspect-ratio: 1120 / 560;
  width: 100%;
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wire {
  fill: none;
  stroke: #4a3d32;
  stroke-width: 3;
  stroke-linecap: round;
}

.wire.json { stroke-dasharray: 7 6; }
.wire.voice { stroke-width: 4; }
.wire.is-on.json { stroke: var(--json); filter: url(#glow); }
.wire.is-on.voice,
.wire.is-on.ring { stroke: var(--voice); filter: url(#glow); }
.wire.is-on.ring { stroke-dasharray: none; }

.wire-label {
  fill: #7d6d5c;
  font-family: "Red Hat Mono", monospace;
  font-size: 12px;
}
.wire-label.voice { fill: #4a8f6d; }
.wire.is-on + .wire-label,
.wire-label.is-on { fill: var(--paper); }

#bead {
  fill: var(--lamp);
  filter: url(#glow);
  pointer-events: none;
}

.node {
  position: absolute;
  width: 15%;
  height: 16.4%;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid #4a4036;
  background: #2c2621;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.node .kind {
  font-family: "Red Hat Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a8b78;
}

.node strong {
  font-size: clamp(12px, 1.35vw, 16px);
  font-weight: 700;
}

.node em {
  font-style: normal;
  font-size: 11px;
  color: #b7a894;
}

.node.office { border-color: #2f6f8d; }
.node.plivo { border-color: var(--plivo); }
.node.gateway { border-color: var(--gate); }
.node.gemini { border-color: var(--gemini); }
.node.lead { border-color: var(--lead); }
.node.wallet { border-color: var(--lamp); }

.node.is-on {
  background: #3a3229;
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.35);
  transform: translateY(-1px);
}

.node.is-dim { opacity: 0.38; }

.node.lead.is-ring {
  animation: ring 0.7s ease-in-out infinite;
}

@keyframes ring {
  50% { box-shadow: 0 0 0 6px rgba(224, 177, 58, 0.28); }
}

.slip {
  background: var(--paper);
  color: var(--ink);
  border-radius: 18px;
  padding: 20px 20px 16px;
  min-height: 100%;
}

.slip-kicker {
  margin: 0 0 6px;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--plivo);
}

.slip h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.15;
}

.slip p { margin: 0 0 12px; }

.stamp {
  display: inline-block;
  border: 2px solid var(--danger);
  color: var(--danger);
  font-family: "Sora", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  transform: rotate(-2deg);
}

.stamp[hidden] { display: none; }

.facts {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed #d4c4aa;
}

.facts div { margin: 0 0 8px; }
.facts dt {
  font-family: "Red Hat Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.facts dd { margin: 2px 0 0; font-weight: 700; }

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 28px 28px;
}

.play {
  appearance: none;
  border: 0;
  background: var(--lamp);
  color: var(--ink);
  font: 800 15px/1 "Sora", sans-serif;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  min-width: 96px;
}

.ghost {
  appearance: none;
  border: 1px solid #4a4036;
  background: transparent;
  color: var(--paper);
  font: 650 13px/1 "Sora", sans-serif;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.meter {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: #2f2924;
  border-radius: 99px;
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--lamp);
  border-radius: 99px;
  transition: transform 0.25s ease;
}

.count {
  margin: 0;
  font-family: "Red Hat Mono", monospace;
  font-size: 12px;
  color: #b7a894;
}

@media (max-width: 900px) {
  .top, .workspace { grid-template-columns: 1fr; }
  .top, .toolbar, .transport { padding-left: 16px; padding-right: 16px; }
  .workspace { padding-left: 12px; padding-right: 12px; }
  .hint { display: none; }
}

.top-right { display: grid; gap: 10px; }

.pages {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pages a,
.ghost.linkish {
  text-decoration: none;
  border: 1px solid #4a4036;
  color: var(--paper);
  font: 650 12px/1 "Sora", sans-serif;
  padding: 8px 12px;
  border-radius: 999px;
}

.pages a.is-on {
  background: var(--lamp);
  color: var(--ink);
  border-color: var(--lamp);
}

.ghost.linkish {
  display: inline-flex;
  align-items: center;
}

/* ── Detail document ── */
body.doc {
  background: #efe6d4;
  color: var(--ink);
}

body.doc .top {
  background: var(--bakelite);
  color: var(--paper);
  margin-bottom: 0;
  padding-bottom: 20px;
}

body.doc .promise { color: #cbbba6; }

.doc-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 120px);
  min-width: 0;
}

.doc-nav {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 24px 18px 48px;
  background: #e6dcc8;
  min-height: calc(100vh - 120px);
}

.doc-nav a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 8px;
  border-radius: 8px;
}

.doc-nav a:hover,
.doc-nav a:focus-visible { background: rgba(28, 23, 18, 0.08); }

.doc-main {
  padding: 28px 32px 80px;
  max-width: none;
  min-width: 0;
}

.doc-nav {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.diagram {
  background: #fff;
  border: 1px solid #d4c4aa;
  border-radius: 14px;
  padding: 20px 16px 12px;
  margin: 16px 0 28px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.swipe-hint {
  position: sticky;
  left: 0;
  margin: 0 0 10px;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.diagram-fail {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: #fff8e8;
  border: 1px solid #d4c4aa;
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
}

.story { display: none; }

.diagram svg {
  max-width: none !important;
  width: max-content !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

pre.mermaid:not([data-processed]) {
  color: transparent;
  min-height: 72px;
  overflow: hidden;
}

.diagram .nodeLabel,
.diagram .label,
.diagram foreignObject,
.diagram foreignObject div,
.diagram foreignObject span {
  overflow: hidden !important;
}

.diagram foreignObject div {
  white-space: break-spaces !important;
  line-height: 1.3 !important;
}

.poster {
  background: #fff;
  border: 1px solid #d4c4aa;
  border-radius: 14px;
  padding: 16px 16px 20px;
  margin: 16px 0 28px;
  overflow-x: auto;
  max-width: 100%;
}

.poster-inner { min-width: 880px; }

.plane-band {
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  margin: 14px 0 10px;
}

.plane-band.ctrl { background: #e8f4fb; color: #245a73; }
.plane-band.media { background: #dcf5ea; color: #1a5c40; }
.plane-band.sql { background: #f6efe3; color: #5a4e40; }

.poster-row {
  display: grid;
  gap: 10px;
  margin: 0 0 6px;
}

.poster-row.ops { grid-template-columns: repeat(3, 1fr); }
.poster-row.apis { grid-template-columns: repeat(4, 1fr); }
.poster-row.split { grid-template-columns: 1fr 1.15fr 1fr; }
.poster-row.pair { grid-template-columns: 1fr 1fr; }

.pbox {
  border: 2px solid #d4c4aa;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff8e8;
}

.pbox .k {
  font-family: "Red Hat Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.pbox h3 { margin: 3px 0 5px; font-size: 0.98rem; }
.pbox p { margin: 0; font-size: 13.5px; max-width: none; color: #4a4036; }

.pbox.o { border-color: var(--office); background: #f3f9fc; }
.pbox.p { border-color: var(--plivo); background: #fdf4ee; }
.pbox.g { border-color: var(--gate); background: #f0faf5; }
.pbox.m { border-color: var(--gemini); background: #f6f2fb; }
.pbox.w { border-color: var(--lamp); background: #fff8e8; }
.pbox.d { border-color: #8a7a68; background: #f6efe3; }
.pbox.l { border-color: var(--lead); background: #fff6dd; }

.vpipe {
  text-align: center;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mute);
  padding: 4px 0 8px;
}

.vpipe i {
  display: block;
  width: 3px;
  height: 16px;
  margin: 0 auto 4px;
  background: var(--office);
  border-radius: 99px;
}

.vpipe.voice i {
  background: repeating-linear-gradient(180deg, var(--gate) 0 5px, #b7ead4 5px 8px);
}

.legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.legend-pills span {
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d4c4aa;
}

.pair-diagrams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.pair-diagrams > * { min-width: 0; }

.pair-diagrams .diagram { margin: 0 0 12px; }

.callout {
  background: #fff;
  border: 1px solid #d4c4aa;
  padding: 12px 14px;
  border-radius: 12px;
  margin: 0 0 16px;
  font-size: 15px;
}

.callout.voice { background: #f0faf5; }
.callout.money { background: #fff8e8; }
.callout.stop { background: #fdf2f0; }

.caption {
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 8px;
}

.pipe-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  margin: 8px 0 18px;
}

.pipe-box {
  flex: 1 1 140px;
  background: #fff;
  border: 2px solid #d4c4aa;
  border-radius: 12px;
  padding: 12px;
  min-width: 120px;
}

.pipe-box.o { border-color: var(--office); }
.pipe-box.p { border-color: var(--plivo); }
.pipe-box.g { border-color: var(--gate); }
.pipe-box.m { border-color: var(--gemini); }
.pipe-box.w { border-color: var(--lamp); }

.pipe-box .k {
  font-family: "Red Hat Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.pipe-box h3 { margin: 4px 0 6px; font-size: 1rem; }
.pipe-box p { margin: 0; font-size: 13.5px; }

.pipe-arr {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 52px;
  font-family: "Red Hat Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--mute);
}

.pipe-arr i {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--office);
  margin-bottom: 4px;
  position: relative;
}

.pipe-arr i::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border: 6px solid transparent;
  border-left-color: var(--office);
}

.pipe-arr.voice i,
.pipe-arr.voice i::after { background: var(--gate); }
.pipe-arr.voice i::after { border-left-color: var(--gate); background: transparent; }
.pipe-arr.voice i { background: repeating-linear-gradient(90deg, var(--gate) 0 6px, #b7ead4 6px 9px); }

.doc-main h2 {
  font-size: 1.55rem;
  margin: 36px 0 10px;
}

.doc-main h3 { font-size: 1.1rem; margin: 18px 0 8px; }

.doc-main p { margin: 0 0 12px; max-width: 70ch; }

.doc-main section {
  border-top: 1px solid #d4c4aa;
  padding-top: 8px;
  scroll-margin-top: 12px;
}

.doc-main section:first-of-type { border-top: 0; }

.rooms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}

.rooms article {
  background: #fff;
  border: 2px solid #d4c4aa;
  border-radius: 12px;
  padding: 12px;
}

.rooms .k { font-family: "Red Hat Mono", monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.rooms h3 { margin: 4px 0 6px; }
.rooms p { font-size: 14px; margin: 0; }

.rooms article.o { border-color: var(--office); }
.rooms article.p { border-color: var(--plivo); }
.rooms article.g { border-color: var(--gate); }
.rooms article.m { border-color: var(--gemini); }

.lanes {
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid #d4c4aa;
  border-radius: 12px;
  background: #fff;
}

.lanes table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13.5px;
}

.lanes th {
  background: var(--bakelite);
  color: #fff;
  font-weight: 600;
  padding: 10px 8px;
  text-align: center;
}

.lanes th:nth-child(2) { background: var(--office); }
.lanes th:nth-child(3) { background: var(--plivo); }
.lanes th:nth-child(4) { background: var(--gate); }
.lanes th:nth-child(5) { background: var(--gemini); }

.lanes td {
  border-bottom: 1px dashed #e4d8c4;
  padding: 10px 8px;
  vertical-align: top;
  text-align: center;
}

.lanes td:first-child {
  text-align: left;
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  color: var(--mute);
  white-space: nowrap;
}

.chip {
  display: inline-block;
  background: #f6efe3;
  border: 1px solid #d4c4aa;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: left;
  line-height: 1.35;
}

.steps {
  list-style: none;
  margin: 12px 0 20px;
  padding: 0;
  position: relative;
}

.steps::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #d4c4aa;
}

.steps li {
  position: relative;
  padding: 0 0 16px 48px;
}

.steps .n {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bakelite);
  color: var(--paper);
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
}

.steps h3 { margin: 0 0 4px; }
.steps p { margin: 0; font-size: 15px; color: #4a4036; }

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0 20px;
}

.data th, .data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e4d8c4;
  vertical-align: top;
}

.data th {
  background: var(--bakelite);
  color: #fff;
  font-size: 13px;
}

code {
  font-family: "Red Hat Mono", monospace;
  font-size: 0.86em;
  background: #e8ddd0;
  padding: 1px 5px;
  border-radius: 4px;
}

.rules { padding: 0; margin: 0 0 20px; }
.rules li {
  list-style: none;
  background: #fff;
  border: 1px solid #d4c4aa;
  padding: 12px 14px;
  border-radius: 12px;
  margin: 0 0 8px;
}

@media (max-width: 900px) {
  .doc-shell { grid-template-columns: 1fr; }
  .doc-main { padding: 20px 16px 64px; }
  .rooms { grid-template-columns: 1fr 1fr; }
  .pages { justify-content: flex-start; }
  .pair-diagrams { grid-template-columns: 1fr; }
  .pipe-row { flex-direction: column; }
  .pipe-arr { flex-direction: row; min-width: 0; height: 36px; }
  .pipe-arr i { width: 4px; height: 22px; margin: 0 6px 0 0; }
  .pipe-arr i::after {
    right: auto;
    top: auto;
    bottom: -2px;
    left: -4px;
    border: 6px solid transparent;
    border-top-color: var(--office);
    border-left-color: transparent;
  }
}

@media (max-width: 720px) {
  .top {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px 8px;
  }

  h1 { font-size: 1.35rem; }
  .promise {
    font-size: 14px;
    max-width: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .pages { justify-content: flex-start; }

  .board-page .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
    gap: 8px;
    padding: 8px 16px 12px;
  }
  .board-page .scene {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    text-align: center;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px 108px;
  }

  .slip {
    order: -2;
    min-height: 0;
    padding: 14px 16px 12px;
    border-radius: 14px;
  }
  .slip h2 { font-size: 1.15rem; }
  .slip p { margin-bottom: 8px; }
  .board-page .facts { display: none; }

  .story {
    order: -1;
    display: block;
    list-style: none;
    margin: 0;
    padding: 4px 0 0;
    position: relative;
  }
  .story::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 10px;
    bottom: 18px;
    width: 2px;
    background: #3a322b;
  }
  .story li {
    position: relative;
    padding: 0 0 14px 48px;
    cursor: pointer;
  }
  .story .n {
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2c2621;
    border: 2px solid #4a4036;
    color: var(--paper);
    font-family: "Sora", sans-serif;
    font-weight: 700;
    font-size: 13px;
    display: grid;
    place-items: center;
  }
  .story strong {
    display: block;
    font-family: "Sora", sans-serif;
    font-size: 1rem;
    letter-spacing: -0.03em;
    margin: 6px 0 4px;
  }
  .story p {
    margin: 0;
    font-size: 14px;
    color: #cbbba6;
    line-height: 1.4;
  }
  .story li.is-done .n {
    background: #3a3229;
    border-color: var(--lamp);
    color: var(--lamp);
  }
  .story li.is-on .n {
    background: var(--lamp);
    border-color: var(--lamp);
    color: var(--ink);
  }
  .story li.is-on strong { color: var(--lamp); }

  .board-wrap { padding: 8px 10px 12px; }
  .legend { display: none; }

  .stage {
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .wires { display: none; }

  .node {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: 8px 10px;
  }
  .node .kind { display: block; }
  .node em { display: none; }
  .node strong { font-size: 0.92rem; }

  #n-you { order: 1; }
  #n-office { order: 2; }
  #n-wallet { order: 3; }
  #n-plivo { order: 4; }
  #n-lead { order: 5; }
  #n-gateway { order: 6; }
  #n-gemini { order: 7; }

  .transport {
    position: sticky;
    bottom: 0;
    z-index: 6;
    gap: 8px;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
    background: var(--bakelite);
    border-top: 1px solid #3a322b;
  }
  .play {
    flex: 1 1 100%;
    min-height: 48px;
  }
  .ghost { min-height: 40px; }
  .transport .linkish { display: none; }

  body.doc .top { padding: 16px; }
  body.doc .doc-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #e6dcc8;
  }
  body.doc .doc-nav::-webkit-scrollbar { display: none; }
  body.doc .doc-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    background: #fff;
    border: 1px solid #d4c4aa;
    padding: 8px 12px;
    font-size: 13px;
  }

  .doc-main {
    padding: 16px 14px 80px;
  }
  .doc-main h2 { font-size: 1.3rem; margin-top: 24px; }
  .doc-main p { max-width: none; }
  .doc-main section { scroll-margin-top: 56px; }

  .poster-inner { min-width: 0; }
  .poster-row.ops,
  .poster-row.apis,
  .poster-row.split,
  .poster-row.pair { grid-template-columns: 1fr; }

  .diagram {
    padding: 12px 10px 10px;
  }

  .legend-pills { gap: 6px; }
  .rooms { grid-template-columns: 1fr; }

  .lanes table,
  .data { min-width: 0; }
  .lanes { overflow-x: auto; }
  .data th, .data td { padding: 8px 10px; font-size: 14px; }

  code { overflow-wrap: anywhere; }
}
