:root {
  --protocol-blue: #4a6fa5;
  --protocol-blue-soft: #e8eef6;
  --protocol-ink: #1a1a1a;
  --protocol-line: rgba(26, 26, 26, 0.14);
  --protocol-green: #2f765a;
  --protocol-amber: #a76625;
}

code,
.protocol-workspace,
.protocol-status-card {
  font-variant-ligatures: none;
}

.protocol-intro {
  display: grid;
  gap: 2rem;
  align-items: end;
}

@media (min-width: 960px) {
  .protocol-intro {
    grid-template-columns: minmax(0, 1fr) 19rem;
  }
}

.protocol-status-card {
  border: 1px solid rgba(26, 26, 26, 0.1);
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 18px 45px rgba(28, 39, 53, 0.06);
}

.status-row {
  display: grid;
  grid-template-columns: 0.65rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.55rem 0;
}

.status-row strong,
.status-row span {
  display: block;
}

.status-row strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.status-row div > span {
  margin-top: 0.14rem;
  color: rgba(26, 26, 26, 0.52);
  font-size: 0.72rem;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.25rem;
  border-radius: 999px;
  background: var(--protocol-green);
  box-shadow: 0 0 0 4px rgba(47, 118, 90, 0.1);
}

.status-dot--verified {
  background: var(--protocol-blue);
  box-shadow: 0 0 0 4px rgba(74, 111, 165, 0.11);
}

.status-dot--pending {
  background: #9a8d77;
  box-shadow: 0 0 0 4px rgba(154, 141, 119, 0.12);
}

.status-hash {
  margin-top: 0.75rem;
  border-top: 1px solid rgba(26, 26, 26, 0.07);
  padding-top: 0.8rem;
  color: rgba(26, 26, 26, 0.42);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  line-height: 1.5;
}

.protocol-workspace {
  margin-top: 3rem;
  min-width: 0;
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: #fff;
  box-shadow: 0 24px 70px rgba(28, 39, 53, 0.07);
}

.workspace-toolbar {
  display: flex;
  min-height: 4.5rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(26, 26, 26, 0.09);
  padding: 0.85rem 1rem;
}

.workspace-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.workspace-toolbar label {
  color: rgba(26, 26, 26, 0.48);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-toolbar select {
  border: 1px solid rgba(26, 26, 26, 0.13);
  border-radius: 0.25rem;
  background: #fff;
  padding: 0.48rem 1.9rem 0.48rem 0.65rem;
  color: var(--protocol-ink);
  font-size: 0.78rem;
  opacity: 1;
}

.view-switcher {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid rgba(26, 26, 26, 0.12);
  border-radius: 0.3rem;
  padding: 0.2rem;
}

.view-button {
  border-radius: 0.2rem;
  padding: 0.42rem 0.72rem;
  color: rgba(26, 26, 26, 0.52);
  font-size: 0.72rem;
  font-weight: 600;
}

.view-button.is-active {
  background: var(--protocol-blue-soft);
  color: #294f7e;
}

.view-button:focus-visible {
  outline: 2px solid var(--protocol-blue);
  outline-offset: 2px;
}

.read-only-badge {
  border: 1px solid rgba(167, 102, 37, 0.22);
  border-radius: 999px;
  background: rgba(167, 102, 37, 0.07);
  padding: 0.35rem 0.65rem;
  color: #88511d;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}

.protocol-loading,
.protocol-error {
  padding: 4rem 2rem;
  text-align: center;
  color: rgba(26, 26, 26, 0.5);
  font-size: 0.85rem;
}

.protocol-error {
  color: #8d3028;
}

.diagram-scroll {
  overflow-x: auto;
  padding: 1.5rem;
}

.protocol-diagram {
  position: relative;
  min-width: 760px;
  padding-bottom: 1.5rem;
  --participant-count: 3;
}

.participant-header {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(var(--participant-count), minmax(10rem, 1fr));
  min-height: 4.5rem;
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
  background: #fff;
}

.participant {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.participant strong {
  font-family: "Lora", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 500;
}

.participant span {
  color: rgba(26, 26, 26, 0.42);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.63rem;
}

.timeline {
  position: relative;
  min-height: 10rem;
  padding-top: 1.1rem;
}

.lifeline-layer {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}

.lifeline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(74, 111, 165, 0.27) 0,
    rgba(74, 111, 165, 0.27) 7px,
    transparent 7px,
    transparent 13px
  );
}

.sequence-content {
  position: relative;
  z-index: 2;
}

.message-row {
  position: relative;
  min-height: 5.1rem;
}

.message-line {
  position: absolute;
  top: 2.55rem;
  height: 1px;
  background: var(--protocol-ink);
}

.message-line::before {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--protocol-ink);
  border-radius: 999px;
  background: #fff;
  content: "";
}

.message-line::after {
  position: absolute;
  top: -4px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-top: 1.5px solid var(--protocol-ink);
  border-right: 1.5px solid var(--protocol-ink);
  content: "";
  transform: rotate(45deg);
  transform-origin: center;
}

.message-line.is-reverse::before {
  right: -3px;
  left: auto;
}

.message-line.is-reverse::after {
  right: auto;
  left: -1px;
  transform: rotate(-135deg);
}

.message-label {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  max-width: 19rem;
  transform: translateX(-50%);
  text-align: center;
}

.message-label strong {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 500;
}

.message-label span {
  display: block;
  margin-top: 0.18rem;
  overflow: hidden;
  color: rgba(26, 26, 26, 0.5);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.protocol-frame {
  position: relative;
  margin: 0.55rem 0.65rem 1.15rem;
  border: 1px solid rgba(74, 111, 165, 0.24);
  background: rgba(255, 255, 255, 0.78);
}

.frame-header {
  display: flex;
  min-height: 2.35rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(74, 111, 165, 0.16);
  background: rgba(232, 238, 246, 0.7);
  padding: 0.5rem 0.75rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.frame-kind {
  border-radius: 0.15rem;
  background: var(--protocol-blue);
  padding: 0.18rem 0.36rem;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.frame-title {
  color: #294f7e;
  font-size: 0.7rem;
  font-weight: 500;
}

.frame-detail {
  margin-left: auto;
  color: rgba(41, 79, 126, 0.7);
  font-size: 0.62rem;
}

.frame-body {
  padding: 0.5rem;
}

.choice-branch + .choice-branch {
  border-top: 1px dashed rgba(26, 26, 26, 0.15);
}

.branch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.6rem 0.8rem 0;
  color: rgba(26, 26, 26, 0.48);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6rem;
}

.branch-meta strong {
  color: var(--protocol-ink);
  font-weight: 500;
}

.terminal-row {
  min-height: 2.7rem;
  padding: 0.7rem;
  text-align: center;
}

.terminal-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(26, 26, 26, 0.13);
  border-radius: 999px;
  background: #fff;
  padding: 0.3rem 0.55rem;
  color: rgba(26, 26, 26, 0.55);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6rem;
}

.terminal-pill--continue {
  border-color: rgba(74, 111, 165, 0.23);
  color: #315987;
}

.source-view {
  min-height: 36rem;
  background: #18202a;
  color: #e8edf3;
}

.source-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  padding: 0.9rem 1rem;
  color: rgba(232, 237, 243, 0.62);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
}

.source-view pre {
  max-height: 48rem;
  overflow: auto;
  padding: 1.35rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.75;
  tab-size: 2;
}

.protocol-explainer {
  display: grid;
  gap: 2rem;
  margin-top: 4rem;
  padding-bottom: 1rem;
}

.protocol-explainer ol {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(26, 26, 26, 0.09);
  background: rgba(26, 26, 26, 0.09);
}

.protocol-explainer li {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  gap: 0.8rem;
  background: #fff;
  padding: 1rem;
}

.protocol-explainer li > span {
  color: rgba(74, 111, 165, 0.65);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.64rem;
}

.protocol-explainer strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
}

.protocol-explainer p {
  margin-top: 0.22rem;
  color: rgba(26, 26, 26, 0.55);
  font-size: 0.74rem;
  line-height: 1.55;
}

.protocol-prose {
  border-top: 1px solid rgba(26, 26, 26, 0.09);
  padding-top: 1.15rem;
}

.protocol-prose p {
  margin: 0;
  max-width: 48rem;
  color: rgba(26, 26, 26, 0.72);
  font-size: 0.9rem;
  line-height: 1.75;
}

.protocol-prose p + p {
  margin-top: 1rem;
}

.protocol-guide-content,
.artifact-guide {
  border-top: 1px solid rgba(26, 26, 26, 0.09);
  padding-top: 1.15rem;
}

.protocol-guide-lede {
  max-width: 52rem;
  color: rgba(26, 26, 26, 0.74);
  font-size: 0.9rem;
  line-height: 1.75;
}

.protocol-guide-lede strong {
  color: var(--protocol-ink);
}

.assurance-steps {
  display: grid;
  gap: 1px;
  margin-top: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(26, 26, 26, 0.09);
  border-radius: 0.45rem;
  background: rgba(26, 26, 26, 0.09);
}

.assurance-steps li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.8rem;
  background: #fff;
  padding: 0.9rem 1rem;
}

.assurance-steps li > span {
  padding-top: 0.08rem;
  color: rgba(74, 111, 165, 0.72);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.64rem;
}

.assurance-steps strong,
.assurance-grid h3,
.artifact-guide-grid h3 {
  display: block;
  color: var(--protocol-ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.assurance-steps p,
.assurance-grid p,
.artifact-guide-grid p,
.artifact-one-note p {
  margin: 0.25rem 0 0;
  color: rgba(26, 26, 26, 0.58);
  font-size: 0.74rem;
  line-height: 1.55;
}

.assurance-grid,
.artifact-guide-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.assurance-grid article,
.artifact-guide-grid article {
  border: 1px solid rgba(26, 26, 26, 0.1);
  border-radius: 0.45rem;
  background: #fff;
  padding: 1rem;
}

.capability-badge {
  display: inline-flex;
  margin-bottom: 0.65rem;
  border-radius: 999px;
  background: rgba(74, 111, 165, 0.11);
  padding: 0.26rem 0.52rem;
  color: #294f7e;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.59rem;
  font-weight: 500;
}

.capability-badge--available {
  background: rgba(47, 118, 90, 0.1);
  color: var(--protocol-green);
}

.capability-badge--planned {
  background: rgba(167, 102, 37, 0.1);
  color: #88511d;
}

.artifact-guide-grid article.artifact-guide-future {
  border-style: dashed;
  background: rgba(250, 248, 244, 0.72);
}

.artifact-guide-grid small {
  display: block;
  margin-top: 0.65rem;
  border-top: 1px solid rgba(26, 26, 26, 0.07);
  padding-top: 0.65rem;
  color: rgba(26, 26, 26, 0.46);
  font-size: 0.66rem;
  line-height: 1.5;
}

.protocol-guide-link {
  margin-top: 1rem;
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.75rem;
  line-height: 1.6;
}

.protocol-guide-link a {
  color: #294f7e;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(74, 111, 165, 0.35);
  text-underline-offset: 0.18rem;
}

.artifact-one-note {
  margin-top: 1rem;
  border-left: 3px solid rgba(74, 111, 165, 0.35);
  background: rgba(232, 238, 246, 0.45);
  padding: 0.85rem 1rem;
}

.artifact-one-note strong {
  color: #294f7e;
  font-size: 0.78rem;
  font-weight: 600;
}

@media (min-width: 700px) {
  .assurance-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .artifact-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .protocol-explainer {
    grid-template-columns: minmax(0, 0.7fr) minmax(30rem, 1.3fr);
    align-items: start;
  }
}

@media (max-width: 640px) {
  .workspace-toolbar {
    align-items: flex-start;
  }

  .view-switcher {
    margin-left: 0;
  }

  .read-only-badge {
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  .diagram-scroll {
    padding: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-button {
    transition: none;
  }
}

/* ---------------------------------------------------------- editor MVP -- */

.editor-view {
  padding: 1.25rem;
  --participant-count: 2;
}

.editor-bar {
  display: grid;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .editor-bar {
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.8fr);
  }
}

.editor-bar-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.editor-status-chip {
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 500;
}

.editor-status-chip[data-state="editing"] {
  background: rgba(154, 141, 119, 0.14);
  color: #6f6552;
}

.editor-status-chip[data-state="wellformed"] {
  background: rgba(47, 118, 90, 0.12);
  color: var(--protocol-green);
}

.editor-status-chip[data-state="invalid"] {
  background: rgba(141, 48, 40, 0.1);
  color: #8d3028;
}

.editor-status-chip[data-state="offline"] {
  background: rgba(167, 102, 37, 0.1);
  color: #88511d;
}

.editor-bar-note {
  margin-bottom: 1rem;
  color: rgba(26, 26, 26, 0.45);
  font-size: 0.68rem;
  line-height: 1.5;
}

.editor-artifacts {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgb(32 45 42 / 12%);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 58%);
}

.editor-artifacts p {
  margin: 0.25rem 0 0;
  color: rgb(32 45 42 / 68%);
  font-size: 0.78rem;
  line-height: 1.45;
}

.editor-artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.editor-artifact-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.editor-artifact-status {
  min-height: 1.1rem;
}

.editor-verify-button {
  border: 1px solid var(--protocol-blue);
  border-radius: 0.3rem;
  background: var(--protocol-blue);
  padding: 0.35rem 0.75rem;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.editor-verify-button:hover {
  background: #3d5d8c;
}

.editor-verify-button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.editor-verify-chip {
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 500;
}

.editor-verify-chip[data-state="idle"] {
  background: rgba(26, 26, 26, 0.06);
  color: rgba(26, 26, 26, 0.55);
}

.editor-verify-chip[data-state="pending"] {
  background: rgba(74, 111, 165, 0.12);
  color: #294f7e;
}

.editor-verify-chip[data-state="verified"] {
  background: rgba(74, 111, 165, 0.14);
  color: #294f7e;
}

.editor-verify-chip[data-state="failed"] {
  background: rgba(141, 48, 40, 0.1);
  color: #8d3028;
}

.editor-verify-chip[data-state="stale"] {
  background: rgba(167, 102, 37, 0.12);
  color: #88511d;
}

.editor-endpoint {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.editor-endpoint span {
  color: rgba(26, 26, 26, 0.48);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-endpoint input {
  width: 100%;
  border: 1px solid rgba(26, 26, 26, 0.14);
  border-radius: 0.25rem;
  padding: 0.4rem 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
}

.editor-service {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid rgba(26, 26, 26, 0.1);
  border-radius: 0.45rem;
  padding: 0.7rem 0.75rem;
  background: rgba(250, 250, 250, 0.72);
}

.editor-service > span:nth-child(2) {
  min-width: 0;
}

.editor-service strong,
.editor-service small {
  display: block;
}

.editor-service strong {
  font-size: 0.72rem;
  font-weight: 600;
}

.editor-service small {
  margin-top: 0.12rem;
  color: rgba(26, 26, 26, 0.52);
  font-size: 0.65rem;
  line-height: 1.45;
}

.editor-service-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.22rem;
  border-radius: 999px;
  background: #9a8d77;
  box-shadow: 0 0 0 4px rgba(154, 141, 119, 0.12);
}

.editor-service-dot[data-state="online"] {
  background: var(--protocol-green);
  box-shadow: 0 0 0 4px rgba(47, 118, 90, 0.1);
}

.editor-service-dot[data-state="offline"] {
  background: var(--protocol-amber);
  box-shadow: 0 0 0 4px rgba(167, 102, 37, 0.1);
}

.editor-service-developer {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  padding-top: 0.55rem;
}

.editor-service-developer summary {
  cursor: pointer;
  color: rgba(26, 26, 26, 0.48);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .editor-view {
    padding: 0.85rem;
  }

  .editor-service {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .editor-service > button {
    grid-column: 2;
    justify-self: start;
  }
}

.editor-section-label {
  color: rgba(26, 26, 26, 0.45);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-participants-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
  padding: 0.75rem 0;
}

.editor-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.editor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(74, 111, 165, 0.26);
  border-radius: 0.35rem;
  background: rgba(232, 238, 246, 0.55);
  padding: 0.28rem 0.4rem 0.28rem 0.55rem;
}

.editor-chip-name {
  width: 6rem;
  border: 0;
  background: transparent;
  font-family: "Lora", Georgia, serif;
  font-size: 0.86rem;
  color: var(--protocol-ink);
}

.editor-chip-name:focus-visible {
  outline: 2px solid var(--protocol-blue);
  outline-offset: 2px;
}

.editor-chip-id {
  color: rgba(41, 79, 126, 0.7);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6rem;
}

.editor-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  color: rgba(26, 26, 26, 0.4);
  font-size: 0.9rem;
  line-height: 1;
}

.editor-chip-remove:hover {
  background: rgba(141, 48, 40, 0.1);
  color: #8d3028;
}

.editor-add {
  border: 1px dashed rgba(74, 111, 165, 0.4);
  border-radius: 0.35rem;
  padding: 0.35rem 0.7rem;
  color: #315987;
  font-size: 0.7rem;
  font-weight: 600;
}

.editor-add:hover {
  background: var(--protocol-blue-soft);
}

.editor-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 900px) {
  .editor-grid {
    grid-template-columns: minmax(0, 1fr) 18rem;
    align-items: start;
  }
}

.editor-canvas {
  position: relative;
  min-height: 16rem;
  overflow-x: auto;
  border: 1px solid rgba(26, 26, 26, 0.1);
  background:
    linear-gradient(#fff, #fff) padding-box;
  padding: 3rem 1rem 1.5rem;
}

.editor-lifelines {
  position: absolute;
  inset: 3rem 1rem 1rem;
  pointer-events: none;
}

.editor-lifeline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-0.5px);
  background: repeating-linear-gradient(
    to bottom,
    rgba(74, 111, 165, 0.3) 0,
    rgba(74, 111, 165, 0.3) 7px,
    transparent 7px,
    transparent 13px
  );
}

.editor-handle {
  position: absolute;
  top: -2.2rem;
  width: 1.5rem;
  height: 1.5rem;
  transform: translateX(-50%);
  border: 1px solid var(--protocol-blue);
  border-radius: 999px;
  background: #fff;
  color: var(--protocol-blue);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.editor-handle::after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  content: "↧";
  font-size: 0.8rem;
}

.editor-handle:active {
  cursor: grabbing;
  background: var(--protocol-blue-soft);
}

.editor-drag-preview {
  position: absolute;
  top: 0.4rem;
  height: 2px;
  background: rgba(74, 111, 165, 0.6);
  pointer-events: none;
}

.editor-rows {
  position: relative;
  z-index: 2;
}

.editor-block {
  position: relative;
  min-height: 1.5rem;
}

.editor-choice-branch > .editor-block {
  padding: 0.35rem 0.45rem 0.55rem;
}

.editor-block:empty {
  min-height: 2.5rem;
}

.has-diagnostic {
  outline: 2px solid rgba(141, 48, 40, 0.72);
  outline-offset: 2px;
}

.editor-message {
  position: relative;
  min-height: 3.4rem;
  cursor: pointer;
}

.editor-message.is-dragging {
  opacity: 0.5;
}

.editor-message.is-region-selected {
  border-radius: 0.25rem;
  background: rgba(74, 111, 165, 0.08);
  box-shadow: inset 3px 0 0 var(--protocol-blue);
}

.editor-region-toggle {
  position: absolute;
  top: 0.35rem;
  right: 0.2rem;
  z-index: 3;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(74, 111, 165, 0.42);
  border-radius: 999px;
  background: #fff;
  color: var(--protocol-blue);
  font-size: 0.72rem;
  line-height: 1;
}

.editor-message.is-region-selected .editor-region-toggle {
  background: var(--protocol-blue);
  color: #fff;
}

.editor-loop-frame.is-dragging,
.editor-choice-frame.is-dragging {
  opacity: 0.55;
}

.editor-block.is-frame-drop-target {
  outline: 2px dashed rgba(74, 111, 165, 0.72);
  outline-offset: -2px;
}

.editor-frame-grip {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  margin-right: 0.15rem;
  color: rgba(26, 26, 26, 0.4);
  cursor: grab;
  touch-action: none;
}

.editor-frame-grip:hover {
  color: var(--protocol-blue);
}

.editor-frame-grip:active {
  cursor: grabbing;
}

.editor-message.is-drop-target {
  box-shadow: inset 0 2px 0 var(--protocol-blue);
}

[data-message-location].is-drop-container {
  outline: 1px dashed rgba(74, 111, 165, 0.65);
  outline-offset: -2px;
}

[data-message-location].is-drop-append::after {
  display: block;
  height: 2px;
  margin: 0.2rem 0.6rem;
  background: var(--protocol-blue);
  content: "";
}

.editor-grip {
  position: absolute;
  top: 0.35rem;
  left: 0.1rem;
  z-index: 3;
  width: 1.1rem;
  height: 1.3rem;
  color: rgba(26, 26, 26, 0.32);
  font-size: 0.8rem;
  line-height: 1.3rem;
  cursor: grab;
  touch-action: none;
}

.editor-grip:hover {
  color: var(--protocol-blue);
}

.editor-grip:active {
  cursor: grabbing;
}

.editor-inline-label {
  width: 20rem;
  max-width: 46vw;
  border: 1px solid var(--protocol-blue);
  border-radius: 0.2rem;
  padding: 0.15rem 0.35rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  text-align: center;
}

.editor-loop-spawn {
  position: absolute;
  top: 3rem;
  left: 0.15rem;
  z-index: 4;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px dashed rgba(74, 111, 165, 0.5);
  border-radius: 0.3rem;
  background: #fff;
  color: var(--protocol-blue);
  font-family: "Lora", Georgia, serif;
  font-size: 0.8rem;
  font-style: italic;
}

.editor-loop-spawn:hover {
  background: var(--protocol-blue-soft);
}

.editor-message.is-selected .editor-message-line {
  background: var(--protocol-blue);
  height: 2px;
}

.editor-message.is-selected .editor-message-label {
  color: #294f7e;
}

.editor-message:focus-visible {
  outline: 2px solid var(--protocol-blue);
  outline-offset: 2px;
}

.editor-message-line {
  position: absolute;
  top: 1.5rem;
  height: 1px;
  background: var(--protocol-ink);
}

.editor-message-line::before {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--protocol-ink);
  border-radius: 999px;
  background: #fff;
  content: "";
}

.editor-message-line::after {
  position: absolute;
  top: -4px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-top: 1.5px solid var(--protocol-ink);
  border-right: 1.5px solid var(--protocol-ink);
  content: "";
  transform: rotate(45deg);
}

.editor-message-line.is-reverse::before {
  right: -3px;
  left: auto;
}

.editor-message-line.is-reverse::after {
  right: auto;
  left: -1px;
  transform: rotate(-135deg);
}

.editor-message-label {
  position: absolute;
  top: 1.9rem;
  transform: translateX(-50%);
  color: rgba(26, 26, 26, 0.72);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  white-space: nowrap;
}

.editor-message-broken {
  padding: 1rem;
  color: #8d3028;
  font-size: 0.7rem;
}

/* mu-recursion frame: a box that encompasses the lifelines with the loop
   variable shown in the top corner. */
.editor-loop-frame {
  position: relative;
  z-index: 3;
  margin: 1.5rem 0 0.5rem;
  border: 1.5px solid rgba(74, 111, 165, 0.5);
  border-radius: 0.35rem;
  background: rgba(232, 238, 246, 0.28);
}

.editor-loop-frame.is-selected {
  border-color: var(--protocol-blue);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
}

.editor-loop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(74, 111, 165, 0.22);
  background: rgba(232, 238, 246, 0.85);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.editor-loop-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.25rem;
  background: var(--protocol-blue);
  color: #fff;
  font-family: "Lora", Georgia, serif;
  font-size: 0.85rem;
  font-style: italic;
}

.editor-loop-title {
  color: #294f7e;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
}

.editor-loop-detail {
  color: rgba(41, 79, 126, 0.75);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
}

.editor-loop-body {
  position: relative;
  padding: 0.5rem 0 0.25rem;
}

.editor-loop-continue {
  border-top: 1px dashed rgba(74, 111, 165, 0.35);
  padding: 0.45rem 0.7rem;
  color: #315987;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
}

.editor-choice-frame {
  position: relative;
  z-index: 3;
  margin: 1rem 0.4rem;
  border: 1.5px solid rgba(167, 102, 37, 0.45);
  border-radius: 0.35rem;
  background: rgba(167, 102, 37, 0.035);
}

.editor-choice-frame.is-selected {
  border-color: var(--protocol-amber);
  box-shadow: 0 0 0 3px rgba(167, 102, 37, 0.12);
}

.editor-choice-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(167, 102, 37, 0.2);
  background: rgba(167, 102, 37, 0.08);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.editor-choice-kind {
  border-radius: 0.2rem;
  background: var(--protocol-amber);
  padding: 0.18rem 0.38rem;
  color: #fff;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-choice-title,
.editor-choice-detail {
  color: #7a4a1a;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
}

.editor-choice-detail {
  margin-left: auto;
  opacity: 0.72;
}

.editor-choice-branch + .editor-choice-branch {
  border-top: 1px dashed rgba(26, 26, 26, 0.15);
}

.editor-choice-branch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem 0;
  color: rgba(26, 26, 26, 0.55);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
}

.editor-choice-branch-meta strong {
  color: var(--protocol-ink);
  font-weight: 500;
}

.editor-choice-action {
  margin-left: auto;
  color: #7a4a1a;
}

.editor-choice-arrow {
  position: relative;
  min-height: 3.4rem;
}

.editor-choice-inspector-branch {
  margin-top: 0.9rem;
  border-top: 1px solid rgba(26, 26, 26, 0.1);
  padding-top: 0.8rem;
}

.editor-choice-inspector-title {
  margin-bottom: 0.55rem;
  color: #7a4a1a;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
}

.editor-inspector-note {
  margin-top: 0.75rem;
  color: rgba(26, 26, 26, 0.45);
  font-size: 0.66rem;
  line-height: 1.5;
}

.editor-hint {
  position: relative;
  z-index: 2;
  padding: 2.5rem 1rem;
  text-align: center;
  color: rgba(26, 26, 26, 0.42);
  font-size: 0.78rem;
}

.editor-inspector {
  border: 1px solid rgba(26, 26, 26, 0.1);
  background: #fbfbfb;
  padding: 1rem;
}

.editor-inspector-empty {
  color: rgba(26, 26, 26, 0.42);
  font-size: 0.76rem;
}

.editor-inspector-title {
  margin-bottom: 0.6rem;
  font-family: "Lora", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 500;
}

.editor-field {
  display: block;
  margin-bottom: 0.65rem;
}

.editor-field > span {
  display: block;
  margin-bottom: 0.2rem;
  color: rgba(26, 26, 26, 0.5);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-field input,
.editor-field select {
  width: 100%;
  border: 1px solid rgba(26, 26, 26, 0.15);
  border-radius: 0.25rem;
  padding: 0.42rem 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}

.editor-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.editor-mini {
  border: 1px solid rgba(26, 26, 26, 0.15);
  border-radius: 0.25rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.editor-mini:hover {
  background: rgba(26, 26, 26, 0.05);
}

.editor-mini--danger {
  margin-left: auto;
  border-color: rgba(141, 48, 40, 0.25);
  color: #8d3028;
}

.editor-mini--danger:hover {
  background: rgba(141, 48, 40, 0.08);
}

.editor-mini--primary {
  border-color: var(--protocol-blue);
  background: var(--protocol-blue);
  color: #fff;
}

.editor-mini--primary:hover {
  background: #3d5d8c;
}

.editor-mini:disabled {
  cursor: progress;
  opacity: 0.55;
}

.editor-lower {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 900px) {
  .editor-lower {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.editor-issues {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.4rem;
}

.editor-issue {
  border-left: 2px solid rgba(26, 26, 26, 0.2);
  padding: 0.35rem 0.6rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  line-height: 1.4;
}

.editor-issue--layer0 {
  border-color: var(--protocol-amber);
  background: rgba(167, 102, 37, 0.06);
  color: #7a4a1a;
}

.editor-issue--tier0 {
  border-color: #8d3028;
  background: rgba(141, 48, 40, 0.06);
  color: #8d3028;
}

.editor-issue--verify {
  border-color: var(--protocol-blue);
  background: rgba(74, 111, 165, 0.07);
  color: #294f7e;
}

.editor-issue--flash {
  border-color: var(--protocol-blue);
  background: var(--protocol-blue-soft);
  color: #294f7e;
}

.editor-source-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.editor-source-actions {
  display: flex;
  gap: 0.4rem;
}

.editor-source-panel textarea {
  display: block;
  width: 100%;
  min-height: 18rem;
  margin-top: 0.5rem;
  max-height: 20rem;
  resize: vertical;
  border: 1px solid rgba(26, 26, 26, 0.14);
  background: #18202a;
  padding: 1rem;
  color: #e8edf3;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  line-height: 1.7;
  tab-size: 2;
}

.editor-source-panel textarea:focus-visible {
  outline: 2px solid var(--protocol-blue);
  outline-offset: 2px;
}
