:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --ink: #221f1c;
  --muted: #615d56;
  --faint: #777168;
  --line: #d9d5cd;
  --strong-line: #a9a298;
  --hover: #ebe8e2;
  --active: #e7e3db;
  --code: #ece9e4;
  --accent: #176950;
  --accent-bg: #dceae0;
  --warm: #9a481e;
  --face-top: #f9f7f2;
  --face-left: #e4dfd5;
  --face-right: #c8c2b7;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Geist, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1a18;
  --ink: #f2eee7;
  --muted: #c3bcb1;
  --faint: #a39a8c;
  --line: #3e3831;
  --strong-line: #796f62;
  --hover: #292521;
  --active: #342f29;
  --code: #27231f;
  --accent: #8bd8b6;
  --accent-bg: #263b32;
  --warm: #f0aa76;
  --face-top: #433d35;
  --face-left: #322d27;
  --face-right: #24211d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 14px/1.6 var(--sans); }
h1, h2, p, dl, dd, ol { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; background: transparent; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, pre { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.top { display: flex; align-items: center; gap: 22px; height: 64px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; white-space: nowrap; }
.wordmark { text-decoration: none; font-size: 20px; letter-spacing: -.045em; font-weight: 550; }
.edition { color: var(--muted); font-size: 11px; border-left: 1px solid var(--line); padding-left: 12px; }
.home-link { font-size: 12px; color: var(--muted); text-decoration: none; margin-left: 6px; }
.home-link:hover, .jump a:hover, #spec-link:hover { color: var(--accent); }
#versions { display: flex; align-items: center; gap: 12px; }
.versions-label { font: 11px var(--mono); color: var(--muted); }
.version-track { display: flex; }
.version-track button { display: grid; place-items: center; position: relative; gap: 5px; min-width: 60px; padding: 4px 5px; font: 10px var(--mono); color: var(--muted); }
.version-track button::before { content: ""; width: 9px; height: 9px; border: 1px solid var(--strong-line); border-radius: 50%; background: var(--bg); z-index: 1; }
.version-track button:not(:last-child)::after { content: ""; position: absolute; height: 1px; background: var(--strong-line); left: 50%; right: -50%; top: 9px; }
.version-track button[aria-pressed="true"] { color: var(--ink); font-weight: bold; }
.version-track button[aria-pressed="true"]::before { background: var(--ink); border-color: var(--ink); }
.theme { display: flex; gap: 3px; }
.theme button { width: 32px; height: 32px; border-radius: 6px; font-size: 19px; line-height: 1; }
.theme button[aria-pressed="true"], .theme button:hover { background: var(--active); }
.layout { display: grid; grid-template-columns: 262px minmax(0, 1fr) 346px; height: calc(100dvh - 64px); }
.layout.is-intro { grid-template-columns: clamp(345px, 36vw, 555px) minmax(0, 1fr); }
.intro { display: grid; align-items: center; border-right: 1px solid var(--line); overflow-y: auto; padding: 36px clamp(25px, 3.4vw, 56px); }
.intro-inner { max-width: 490px; }
.eyebrow { font-size: 11px; color: var(--muted); }
.intro h1 { font-size: clamp(38px, 4.2vw, 64px); font-weight: 530; letter-spacing: -.065em; line-height: 1.1; margin: 13px 0 19px; }
.lead { font-size: clamp(15px, 1.24vw, 18px); line-height: 1.85; color: var(--muted); }
.roles { display: grid; grid-template-columns: 68px 1fr; gap: 11px 13px; padding: 23px 0 24px; }
.roles dt { font: 13px/1.8 var(--mono); }
.roles dd { font-size: 13px; color: var(--muted); }
.primary { display: inline-flex; justify-content: center; align-items: center; color: var(--bg); background: var(--ink); }
.primary:hover { background: var(--accent); }
.start { gap: 20px; border-radius: 8px; padding: 11px 17px; text-decoration: none; }
.jump { color: var(--muted); font-size: 12px; margin-top: 13px; }
.jump span { margin: 0 7px; }
.sidebar, .detail { min-height: 0; overflow: auto; scrollbar-width: thin; }
.sidebar { border-right: 1px solid var(--line); }
.detail { border-left: 1px solid var(--line); }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.sidebar-head h2 { font-size: 17px; font-weight: 500; }
.sidebar-head span { color: var(--muted); font-size: 11px; }
.chapter-group h3 { font-size: 11px; font-weight: 500; color: var(--muted); padding: 13px 18px 5px; margin: 0; }
.chapter-link { display: block; padding: 9px 17px; text-decoration: none; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; }
.chapter-link:hover { background: var(--hover); }
.chapter-link[aria-current="page"] { border-left-color: var(--accent); background: var(--active); }
.chapter-link b { font-weight: 520; }
.chapter-link small { display: block; font-size: 11px; color: var(--muted); }
.chapter-link[data-unavailable] b { color: var(--faint); }
.steps { list-style: none; padding: 7px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.steps button { display: flex; gap: 9px; align-items: center; padding: 5px 8px; width: 100%; text-align: left; font-size: 12px; border-radius: 4px; }
.steps button:hover, .steps button[aria-current="step"] { background: var(--hover); }
.step-number, .row-number { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--strong-line); border-radius: 50%; font: 10px var(--mono); flex: 0 0 auto; }
[aria-current="step"] .step-number, [aria-current="true"] .row-number { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(340px, 1fr) minmax(170px, 32%); }
.is-intro .workspace { grid-template-rows: minmax(340px, 1fr) auto; }
.stage { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.stage-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 13px; padding: 16px 20px 12px; }
.caption h2 { font-size: 20px; font-weight: 500; line-height: 1.35; margin: 2px 0 4px; }
#step-description { color: var(--muted); font-size: 13px; max-width: 560px; }
.segmented { display: flex; padding: 3px; gap: 2px; border-radius: 7px; background: var(--hover); flex: 0 0 auto; }
.segmented button { padding: 4px 8px; font-size: 11px; color: var(--muted); border: 1px solid transparent; border-radius: 5px; }
.segmented button[aria-pressed="true"] { border-color: var(--line); background: var(--bg); color: var(--ink); }
.network, .sequence { position: relative; min-height: 0; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 16px 16px; }
.network { overflow: hidden; }
.network canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.actor { position: absolute; width: clamp(84px, 26%, 200px); min-height: 126px; display: grid; justify-items: center; align-content: end; padding: 24px 4px 9px; border: 1px solid var(--strong-line); border-radius: 12px; transform: translate(-50%, -50%); background: var(--bg); }
.actor.remote { border-style: dashed; }
.actor.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.actor-region { position: absolute; top: 8px; left: 10px; color: var(--muted); font-size: 10px; }
.actor-name { margin-top: 5px; font-size: 13px; font-weight: 540; }
.actor-role { font: 10px/1.4 var(--mono); color: var(--muted); }
.model { width: 84px; height: 55px; position: relative; }
.model::after { content: ""; position: absolute; z-index: -1; width: 79px; height: 27px; border-radius: 50%; background: var(--line); bottom: -2px; left: 2px; }
.iso-block { position: absolute; inset: 0; }
.iso-block span { position: absolute; inset: 0; background: var(--ink); }
.iso-block span::after { content: ""; position: absolute; inset: 2px; background: var(--face, var(--face-top)); clip-path: inherit; }
.iso-block .face-a { clip-path: polygon(50% 4%, 96% 42%, 50% 80%, 4% 42%); }
.iso-block .face-b { --face: var(--face-left); clip-path: polygon(4% 42%, 50% 80%, 50% 97%, 4% 60%); }
.iso-block .face-c { --face: var(--face-right); clip-path: polygon(50% 80%, 96% 42%, 96% 60%, 50% 97%); }
.server-art .iso-block:nth-child(1) { transform: translateY(4px); }
.server-art .iso-block:nth-child(2) { transform: translateY(-6px); }
.server-art .iso-block:nth-child(3) { transform: translateY(-16px); }
.server-art .iso-block::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); top: 26px; left: 8px; }
.chip-art .iso-block { transform: translateY(2px); }
.chip-art .iso-block:nth-child(2) { transform: translateY(-8px) scale(.67); }
.chip-art .iso-block:nth-child(2)::after { content: "✦"; color: var(--accent); position: absolute; left: 35px; top: 10px; font-size: 16px; }
.host-art .iso-block { transform: translateY(6px); }
.host-art .iso-block:nth-child(2) { transform: translateY(-11px) scale(.75); }
.host-art .iso-block:nth-child(2)::after { content: "≋"; position: absolute; color: var(--accent); left: 32px; top: 3px; font-size: 25px; transform: rotate(-17deg); }
.user-art::before { content: ""; position: absolute; width: 21px; height: 21px; border: 1px solid var(--ink); background: var(--face-top); border-radius: 50%; left: 31px; top: 3px; }
.user-art .iso-block { transform: scale(.58) translateY(24px); }
.packet { position: absolute; z-index: 2; display: grid; place-items: center; max-width: 96%; white-space: nowrap; pointer-events: none; background: var(--bg); border: 1px solid var(--accent); color: var(--accent); padding: 2px 7px; border-radius: 20px; font: 11px var(--mono); transform: translate(-50%, -50%); }
.stage-footer { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 8px; color: var(--muted); font-size: 11px; }
.stage-footer i, .message-name i { display: inline-block; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; margin-right: 5px; }
.sequence { overflow: auto; padding: 12px 15px; scrollbar-width: thin; }
.sequence-grid { min-width: 290px; display: grid; position: relative; grid-template-columns: repeat(var(--lanes), minmax(0,1fr)); }
.lane { grid-row: 1; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; margin: 0 3px 6px; font: 11px/2.4 var(--mono); white-space: nowrap; }
.lifelines { position: absolute; inset: 34px 0 0; display: grid; grid-template-columns: repeat(var(--lanes), 1fr); pointer-events: none; }
.lifelines i { border-left: 1px dashed var(--strong-line); margin-left: 50%; opacity: .6; }
.seq-message { grid-column: 1 / -1; position: relative; height: 43px; color: var(--muted); }
.seq-message[aria-current="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent-bg) 55%, transparent); }
.seq-message:hover { background: var(--hover); }
.seq-message span { position: absolute; top: 4px; left: var(--center); transform: translateX(-50%); font: 11px var(--mono); white-space: nowrap; }
.seq-message i { position: absolute; left: var(--left); right: var(--right); top: 27px; border-top: 1px solid currentColor; }
.seq-message i::after { position: absolute; right: 0; top: -4px; width: 6px; height: 6px; content: ""; border-right: 1px solid; border-top: 1px solid; transform: rotate(45deg); }
.seq-message.reverse i::after { left: 0; right: auto; transform: rotate(-135deg); }
.flow { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.flow-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; justify-content: space-between; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.flow-title { display: flex; align-items: baseline; gap: 9px; }
.flow h2, .inspector h2 { font-size: 15px; font-weight: 530; }
#flow-count { color: var(--muted); font-size: 11px; }
.controls { display: flex; gap: 5px; }
.controls button, #copy { border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; font-size: 11px; white-space: nowrap; }
.controls button:hover:not(:disabled):not(.primary), #copy:hover { background: var(--hover); border-color: var(--strong-line); }
#play { min-width: 68px; border-color: transparent; }
.flow-scroll { overflow: auto; scrollbar-width: thin; }
.is-intro .flow-scroll { display: none; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--bg); font-weight: 530; z-index: 1; }
th:first-child, td:first-child { padding-left: 17px; }
td { color: var(--muted); }
tr[aria-current="true"] td, tbody tr:hover td { background: var(--active); color: var(--ink); }
tbody tr { cursor: pointer; }
.row-number { border-color: var(--line); }
.overview, .inspector { padding: 19px 20px; }
.overview { border-bottom: 1px solid var(--line); }
.overview h2 { font-weight: 520; font-size: clamp(26px, 2.45vw, 39px); letter-spacing: -.04em; line-height: 1.18; margin: 5px 0; overflow-wrap: anywhere; }
#overview-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
#overview-summary, #message-note { font-size: 13px; color: var(--muted); }
#spec-link { display: inline-block; margin-top: 12px; font-size: 12px; }
.version-note { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 15px; font-size: 12px; color: var(--muted); }
.version-note b { display: block; color: var(--ink); font-weight: 530; margin-bottom: 4px; font-family: var(--mono); }
.inspector-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.message-name { display: flex; align-items: center; gap: 3px; }
.message-name code { overflow-wrap: anywhere; }
.message-name span { margin-left: auto; font: 10px var(--mono); color: var(--muted); white-space: nowrap; }
#message-route { margin: 1px 0 8px; font-size: 11px; color: var(--muted); }
pre { margin: 0 0 9px; padding: 12px; background: var(--code); border: 1px solid var(--line); border-radius: 7px; overflow: auto; max-height: 40vh; font-size: 11px; line-height: 1.6; tab-size: 2; }
.json-string { color: var(--accent); }
.json-value { color: var(--warm); }
.no-messages { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; }
@media (max-width: 1130px) {
  .layout { grid-template-columns: 210px minmax(0,1fr) 280px; }
  .stage-top { padding-inline: 13px; }
  .overview, .inspector { padding-inline: 15px; }
}
@media (max-width: 900px) {
  .layout { height: auto; grid-template-columns: 200px minmax(0,1fr); }
  .workspace { grid-template-rows: 440px 220px; }
  .detail { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); }
  .sidebar { grid-row: span 2; max-height: 80vh; position: sticky; top: 0; }
  .layout.is-intro { grid-template-columns: minmax(270px, 38%) minmax(0,1fr); min-height: calc(100dvh - 64px); }
  .is-intro .workspace { grid-template-rows: minmax(430px, 1fr) auto; }
  .top { gap: 10px; padding-inline: 14px; }
  .version-track button { min-width: 49px; }
}
@media (max-width: 650px) {
  .top { height: auto; min-height: 57px; flex-wrap: wrap; padding-block: 7px; column-gap: 7px; row-gap: 4px; }
  .brand { gap: 7px; }
  .wordmark { font-size: 17px; }
  .edition { padding-left: 7px; }
  .home-link { margin-left: 1px; font-size: 10px; }
  #versions { order: 3; justify-content: center; width: 100%; }
  .version-track button { min-width: 51px; }
  .layout, .layout.is-intro { display: flex; flex-direction: column; }
  .intro { padding: 30px 19px 25px; border-right: 0; border-bottom: 1px solid var(--line); }
  .intro h1 { margin-block: 8px 12px; }
  .roles { padding-block: 17px; gap: 7px 9px; }
  .workspace { grid-template-rows: 435px 222px; }
  .is-intro .workspace { grid-template-rows: 455px auto; }
  .sidebar { position: static; max-height: 170px; border-bottom: 1px solid var(--line); border-right: 0; }
  .sidebar-head { padding: 7px 13px; }
  .sidebar-head h2 { font-size: 14px; }
  #chapters { padding: 5px 10px 9px; }
  .chapter-group { display: inline; }
  .chapter-group h3, .chapter-link small, .steps { display: none; }
  .chapter-link { display: inline-block; border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; margin: 2px; font-size: 11px; }
  .chapter-link[aria-current="page"] { border-color: var(--accent); }
  .actor { min-height: 106px; }
  .actor-name { font-size: 11px; }
  .actor-region, .actor-role { font-size: 9px; }
  .actor-region { left: 6px; }
  .model { transform: scale(.81); margin-block: -5px; }
}
@media (min-width: 901px) and (max-height: 640px) {
  .layout, .layout.is-intro { min-height: 575px; }
}
