/* yak.sh wears @yaks/ui's default theme and skin: gouache.css (the painted
   yak's colours, by role) and paper.css (its grain), the kit's own files
   (packages/ui). The sheet is light; its terminal windows are dark
   (`color-scheme: dark`), and every colour turns in them. */
:root {
  color-scheme: light;
  /* A wash of the lit colour, laid under what it marks. */
  --wash: color-mix(in srgb, var(--accent) 13%, transparent);
  /* The page's one side margin: the nav, the story, the bands, the parts and
     the title block all keep it. */
  --gutter: clamp(1rem, 4vw, 3rem);
  --diagram-line: var(--border2);
  --diagram-soft: var(--muted);
  --diagram-fill: var(--card);
  --diagram-paper: var(--bg);
  --diagram-glow: var(--accent);
  --diagram-font: var(--mono);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  background-color: var(--bg);
  /* Two washes at the top of the sheet, teal behind the drawing and bone
     behind the words, fading out before the story starts. */
  background-image:
    radial-gradient(52rem 34rem at 78% 4rem,
    color-mix(in srgb, var(--accent) 9%, transparent),
    color-mix(in srgb, var(--accent) 4%, transparent) 45%, transparent 72%),
    radial-gradient(44rem 30rem at 8% 0, rgba(196, 160, 112, .16),
    rgba(196, 160, 112, .06) 50%, transparent 75%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--accent);
}
code {
  font: 500 .88em/1.4 var(--mono);
}
p code,
li code {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05em .35em;
}
h1,
h2 {
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.12;
  margin: 0 0 .5em;
}
h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  max-width: 14ch;
}
h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.Site {
  overflow-x: clip;
}

/* ---------------------------------------------------------------- hero */
.Nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem var(--gutter);
  font: 500 .9rem var(--mono);
}
.Nav a {
  text-decoration: none;
}
.Nav_Mark {
  display: inline-flex;
  align-items: center;
  gap: clamp(.6rem, 1.5vw, 1.2rem);
  color: var(--text);
  font-size: clamp(1.1rem, 2.4vw, 2rem);
}
/* The painted yak fills the top of the page, down to the kicker. */
.Nav_Logo {
  width: clamp(72px, 15vw, 200px);
  height: auto;
}
.Kicker_Dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--wash);
}
.Nav_Links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem 1.2rem;
}
.Hero {
  padding: clamp(1rem, 3vh, 2rem) 0 clamp(2.2rem, 5vw, 4rem);
}
.Kicker {
  display: flex;
  align-items: center;
  gap: .6rem;
  font: 500 .8rem var(--mono);
  color: var(--muted);
  text-transform: lowercase;
}
.Lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 38rem;
}
.Hint {
  font: .8rem var(--mono);
  color: var(--muted);
  margin-top: 2.5rem;
}

.Copy {
  display: flex;
  align-items: stretch;
  max-width: 40rem;
  margin: 1.4rem 0 .5rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.Copy code {
  flex: 1;
  padding: .75rem .9rem;
  overflow-x: auto;
  white-space: nowrap;
}
.Copy_Sign {
  color: var(--accent);
}
.Copy button {
  border: 0;
  padding: 0 1.1rem;
  font: 500 .85rem var(--font);
  color: var(--card);
  background: var(--accent);
  cursor: pointer;
  transition: background .2s;
}
.Copy button:hover {
  background: var(--border2);
}

/* ---------------------------------------------------------------- plot */
/* #11's plot: the hero and the steps scroll on the left while the drawing
   and the prompt stay on the right, the drawing beside the hero from the
   start. */
.Plot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  column-gap: clamp(1.8rem, 4vw, 4rem);
  padding: 0 var(--gutter);
}
.Steps {
  list-style: none;
  margin: 0;
  padding: 0 0 12vh;
}
/* A step takes most of a screen, and its commands share out its scrolling
   (told.ts `allot`): each runs as its share starts, typed as it draws in. */
.Step {
  position: relative;
  min-height: 70vh;
  padding: clamp(1.8rem, 4vw, 2.8rem) 0 0 58px;
  border-top: 1px solid var(--border);
}
.Step::before {
  content: '';
  position: absolute;
  left: 0;
  top: -5px;
  width: 1px;
  height: 9px;
  background: var(--border2);
}
.Step_No {
  position: absolute;
  left: 0;
  top: clamp(1.6rem, 4vw, 2.6rem);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg);
  font: 500 .8rem var(--mono);
  transition: border-color .3s, color .3s, background .3s, box-shadow .3s;
}
.Step.is-on .Step_No {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 5px var(--wash);
}
.Step h2 {
  font-size: clamp(1.45rem, 2.3vw, 1.85rem);
  margin: .2rem 0 .9rem;
}
.Step p {
  color: var(--muted);
  max-width: 33em;
}
.Step_Lines {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
}
.Step_Lines > li + li {
  margin-top: .7rem;
}
.Step_Note {
  display: block;
  margin-bottom: .2rem;
  font: 400 .8125rem/1.5 var(--mono);
  color: var(--muted);
}
.Step_Lines code {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  color: var(--link);
  white-space: pre-wrap;
  word-break: break-all;
}
.Step_Lines code::before {
  content: '$ ';
  color: var(--accent);
}
.Step_Lines .is-agent code::before {
  content: 'agent → ';
}
/* The command whose write the pen is drawing, where the leader starts. */
.Step_Lines code {
  border-radius: 3px;
  transition: color .3s, background .3s, box-shadow .3s;
}
.Step_Lines .is-led code {
  color: var(--accent);
  background: var(--wash);
  box-shadow: 0 0 0 4px var(--wash);
}

.Plot_Side {
  position: sticky;
  top: 1rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  height: calc(100vh - 2rem);
  max-height: 980px;
  margin-top: 1rem;
}

.Figure {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  /* The figure's ground, opaque, so the halo behind the drawing's words is
     the colour they sit on. */
  --ground: color-mix(in srgb, var(--card) 80%, var(--bg));
  background: var(--ground);
  overflow: hidden;
  --diagram-paper: var(--ground);
}
.Figure_Bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .9rem .5rem;
  border-bottom: 1px solid var(--border);
  font: .75rem var(--mono);
  color: var(--muted);
}
.Figure_Bar b {
  font-weight: 500;
  color: var(--text);
}
.Figure_State::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: .45rem;
  border-radius: 50%;
  vertical-align: .08em;
  background: var(--accent);
}
.Figure_Sheet {
  flex: 1 1 auto;
  min-height: 0;
}
.Figure_Sheet svg {
  width: 100%;
  height: 100%;
}
.Figure_Sheet .Diagram_Title {
  font-family: var(--font);
}
/* The drawing's shapes in washes of the painting's colours: what is done in
   teal, a person or an agent in bone. */
.Diagram .is-done > .Diagram_Fill {
  fill: color-mix(in srgb, var(--accent) 8%, var(--card));
}
.Diagram_Node-round > .Diagram_Fill,
.Diagram_Node-hex > .Diagram_Fill {
  fill: color-mix(in srgb, #e0d4bf 45%, var(--card));
}
.Figure_Query {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem 0;
  border-top: 1px solid var(--border);
  font: .75rem var(--mono);
  color: var(--muted);
}
.Figure_Query input {
  flex: 1;
  min-width: 0;
  padding: .35rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.Figure_Wider {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: .5rem .9rem .7rem;
}
.Figure_Wider button {
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(252, 249, 243, .6);
  color: var(--muted);
  font: .72rem var(--mono);
  cursor: pointer;
}
.Figure_Wider button:hover,
.Figure_Wider button.is-on {
  border-color: var(--accent);
  background: var(--wash);
  color: var(--text);
}
.Figure_Fault {
  margin: 0;
  padding: 0 .9rem .6rem;
  font: .75rem var(--mono);
  color: var(--negative);
}

/* The leader: a line from the step being drawn to the pen drawing it. */
.Leader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity .35s;
}
.Leader.is-on {
  opacity: 1;
}
.Leader_Line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: .75;
}
.Leader_Dot {
  fill: var(--accent);
}

.Prompt {
  color-scheme: dark;
  flex: none;
  display: flex;
  flex-direction: column;
  height: clamp(190px, 30vh, 300px);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: .8rem/1.5 var(--mono);
  box-shadow: 0 10px 28px -14px rgba(39, 43, 53, .55);
  overflow: hidden;
}
.Prompt_Bar {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
  border-bottom: 1px solid rgba(236, 228, 212, .1);
  color: #a19b90;
}
.Prompt_Bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}
.Prompt_Bar span {
  margin-left: .5rem;
}
.Prompt_Screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: .6rem .9rem;
}
.Prompt_Line {
  white-space: pre-wrap;
  word-break: break-word;
}
.Prompt_Line.is-in,
.Prompt_Line.is-agent {
  color: #faf6ee;
  margin-top: .45rem;
}
.Prompt_Line.is-out {
  color: var(--muted);
}
.Prompt_Line.is-fault {
  color: var(--negative);
}
.Prompt_Line.is-note {
  color: var(--dim);
  margin-top: .45rem;
}
.Prompt_Line.is-note + .Prompt_Line {
  margin-top: 0;
}
.Prompt_Sign {
  color: var(--accent);
}
.Caret {
  display: inline-block;
  width: .55em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.Prompt_Form {
  display: flex;
  align-items: center;
  padding: .55rem .9rem;
  border-top: 1px solid rgba(236, 228, 212, .1);
}
.Prompt_Form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: #faf6ee;
  font: inherit;
}

@media (max-width: 899px) {
  .Plot {
    grid-template-columns: minmax(0, 1fr);
  }
  .Plot_Words {
    display: contents;
  }
  .Plot_Side {
    grid-row: 2;
    top: 0;
    z-index: 6;
    gap: .5rem;
    height: auto;
    margin: 0 calc(6px - var(--gutter));
    background: var(--bg);
  }
  /* On a phone the drawing and the terminal stay at the top in well under
     half the screen, so the step and its commands have the rest. */
  .Figure {
    height: clamp(150px, 26svh, 240px);
    flex: none;
  }
  .Figure_Query,
  .Figure_Wider {
    display: none;
  }
  .Prompt {
    height: 5.75rem;
  }
  .Steps {
    grid-row: 3;
  }
  .Step {
    padding-left: 46px;
  }
  .Step_No {
    width: 32px;
    height: 32px;
    font-size: .75rem;
  }
}

/* ---------------------------------------------------------------- editor
   The entity a reader opened, from anywhere on the page. */
.Editor {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(70vh, 40rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 12px 32px -16px rgba(43, 43, 51, .4);
  font: .8125rem/1.45 var(--mono);
}
.Editor_Bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .5rem .6rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.Editor_Bar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Editor_Bar button {
  border: 0;
  padding: 0 .45rem;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.Editor_Hint {
  margin: 0;
  padding: .5rem .9rem 0;
  color: var(--muted);
  font: .75rem/1.45 var(--font);
}
.Editor_Comp {
  padding: .6rem .9rem .2rem;
}
.Editor_Comp h3 {
  margin: 0 0 .35rem;
  font: 500 .8125rem/1.3 var(--mono);
  color: var(--text);
}
.Editor_Comp dl {
  margin: 0;
}
.Editor_Prop {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: .6rem;
  padding: .2rem 0;
}
.Editor_Prop dt {
  padding-top: .3rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.Editor_Prop dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.Editor_Prop code {
  display: block;
  padding-top: .3rem;
  color: var(--muted);
}
.Editor_Field {
  width: 100%;
  padding: .25rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.Editor_Field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--wash);
}
.Editor_Ref,
.Prompt_Id {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.Editor_Ref {
  padding-top: .3rem;
  color: var(--link);
}
.Prompt_Id:hover {
  color: var(--accent);
}
.Editor_Ref:hover {
  color: var(--accent);
}
.Doors_Drawing [data-eid],
.Window,
.Phases [data-phase] {
  cursor: pointer;
}

/* ---------------------------------------------------------------- bands */
.Band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  padding: 5rem var(--gutter);
  border-top: 1px solid var(--border);
}
.Band_Text p {
  color: var(--muted);
  max-width: 34rem;
}

/* The bundle's source (#12) and the doors (#14), lit in the accent where
   the last write went. */
.Stack,
.Doors {
  --faint: rgba(52, 71, 77, .08);
  align-items: start;
}
/* The steps fill the band down to the bottom of its drawing, so they are
   spread over all of the scrolling the drawing stays in view for. */
.Stack_Text,
.Doors_Text {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.Phases,
.Beats {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.Stack_Figure,
.Doors_Figure {
  margin: 0;
  position: sticky;
  top: 1.5rem;
}
.Stack_Figure figcaption,
.Doors_Figure figcaption {
  font-size: .875rem;
  color: var(--muted);
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.No {
  font: 500 .75rem/1 var(--mono);
  color: var(--text);
  margin-right: .5rem;
}
.Phases {
  list-style: none;
  margin: 1.2rem 0 0 2.1rem;
  padding: 0;
}
.Phases [data-phase] {
  position: relative;
  padding: .55rem 0 .75rem;
  border-top: 1px solid var(--faint);
  transition: background .3s;
}
.Phases > :last-child {
  border-bottom: 1px solid var(--faint);
}
.Phases .Dot {
  position: absolute;
  left: -2.1rem;
  top: .95rem;
  width: 9px;
  height: 9px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.Phases b {
  display: block;
  font: 500 .875rem/1.3 var(--mono);
  color: var(--muted);
  transition: color .3s;
}
.Phases [data-phase] > :not(.Dot, b, .Skip) {
  color: var(--muted);
  font-size: .90625rem;
  line-height: 1.5;
  margin-top: .2rem;
}
.Phases [data-phase] > :not(.Dot, b, .Skip) p {
  margin: 0;
}
/* The phases inside the transaction: one box in ink around them, whatever
   has run, and none of the green that a phase turns once it has happened.
   The box reaches out past the dots so they keep one column. */
.Phases .Tx {
  position: relative;
  margin: 1.1rem -.7rem 1.1rem calc(-2.1rem - .7rem);
  padding: .45rem .7rem .3rem calc(2.1rem + .7rem);
  border: 1px solid var(--border2);
  border-radius: 8px;
}
.Phases .Tx > ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.Phases .Tx [data-phase]:first-child {
  border-top: 0;
}
.Tx_Name {
  position: absolute;
  top: -.45rem;
  left: .5rem;
  padding: 0 .4rem;
  background: var(--bg);
  font: 500 .6875rem/1 var(--mono);
  color: var(--text);
}
/* The write the phases follow: the command it came from, its dot green once
   the reader has passed it and it has been made. */
.Phases .Call {
  position: relative;
  padding: .55rem 0 .9rem;
}
.Phases .Call code {
  display: block;
  margin-top: .3rem;
  font: 400 .75rem/1.5 var(--mono);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A phase that has happened: green, with its green dot. */
.Phases [data-phase].on {
  background: linear-gradient(90deg, var(--wash), transparent 70%);
}
.Phases li.on .Dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--wash);
}
.Phases li.on b {
  color: var(--text);
}
.Phases li.skip .Dot {
  border-style: dashed;
}
.Phases .Skip {
  display: none;
}
.Phases li.skip .Skip {
  display: block;
  font: 400 .75rem/1.5 var(--mono);
  color: var(--muted);
}

/* The bundle as its source, annotated (bundle mockup 8): the code on the
   left, what each line is on the right, changed as the reader scrolls
   through apply()'s phases. */
.Source {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(252, 249, 243, .6);
  padding: clamp(.8rem, 2vw, 1.6rem) 0;
  font: 400 .8125rem/1.5 var(--mono);
}
.Source .R {
  display: contents;
  cursor: pointer;
}
.Source .R > div {
  padding: 3px 12px;
  transition: background .4s, max-height .6s, opacity .5s, padding .6s;
}
.Source .c {
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--border);
}
.Source .n {
  position: relative;
  padding-left: 26px !important;
  font: 400 .8125rem/1.5 var(--font);
  color: var(--muted);
}
.Source .n:not(:empty)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 18px;
  height: 1px;
  background: var(--border2);
}
.Source .n code {
  font-size: .75rem;
  color: var(--text);
}
.Source .k,
.Source .pn {
  color: var(--muted);
}
.Source .s {
  color: #7a5634;
}
.Source .num {
  color: var(--negative);
}
.Source .ok {
  color: var(--accent);
  opacity: 0;
  transition: opacity .4s;
}
.Source.p-admit .ok {
  opacity: 1;
}
/* Admit reads each line in turn as the reader scrolls past the phase. */
.Source.now-admit .comp > div {
  --at: 0s;
  animation: scan 1.6s linear both paused;
  animation-delay: calc(var(--at) - var(--p, 1) * 2.65s);
}
.Source.now-admit .d2 > div {
  --at: .35s;
}
.Source.now-admit .d3 > div {
  --at: .7s;
}
.Source.now-admit .d4 > div {
  --at: 1.05s;
}
@keyframes scan {
  0%,
  100% {
    background: transparent;
  }
  30%,
  60% {
    background: rgba(26, 111, 123, .2);
  }
}
.Source.now-normalize .c {
  background: rgba(252, 249, 243, .8);
}
/* A line the phase the reader is at changed, its margin saying what it did,
   lit as they scroll past the phase. */
.Source .is-now > div {
  background: rgba(26, 111, 123, calc(.16 * var(--p, 1)));
}
.Source .is-now .n {
  color: var(--text);
}
.Source .n b {
  font: 500 .75rem/1 var(--mono);
}
.Source.now-mutate .body > .c {
  background: rgba(252, 249, 243, .9);
  box-shadow: inset 3px 0 0 var(--accent);
}
.Source .stamp .c {
  color: var(--accent);
}
.Source .brace {
  transition: color .4s;
}
.Source.p-commit .brace {
  color: var(--accent);
  font-weight: 600;
}
/* The mail service the letter's effect hands it to: each try it made. */
.Outbox {
  margin-top: .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(252, 249, 243, .6);
  font: 400 .75rem/1.5 var(--mono);
}
.Outbox_Bar {
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.Outbox_Bar b {
  font-weight: 500;
  color: var(--text);
  margin-right: .4rem;
}
.Outbox ol {
  list-style: none;
  margin: 0;
  padding: 6px 12px;
}
.Outbox li {
  animation: pop .4s both;
}
.Outbox li::before {
  content: '→ ';
  color: var(--muted);
}
.Outbox li.is-sent::before {
  content: '✓ ';
  color: var(--accent);
}
.Outbox li.is-refused::before {
  content: '✗ ';
  color: var(--negative);
}
/* The letter was sent: a notice in the corner of the window, which goes
   by itself. */
.Toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 10;
  display: grid;
  gap: .15rem;
  max-width: min(22rem, calc(100vw - 2.4rem));
  padding: .7rem 1rem .75rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 12px 30px -14px rgba(43, 43, 51, .4);
  font-size: .875rem;
  animation: toast 6s both;
}
.Toast::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--wash);
}
.Toast b {
  font-weight: 500;
}
.Toast span {
  color: var(--muted);
}
@keyframes toast {
  0% {
    opacity: 0;
    transform: translateY(.6rem);
  }
  6%,
  85% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@keyframes fade {
  0% {
    opacity: 0;
  }
  6%,
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@media (max-width: 760px) {
  .Source {
    grid-template-columns: minmax(0, 1fr);
  }
  .Source .c {
    border-right: 0;
  }
  .Source .n:empty {
    display: none;
  }
  .Source .n {
    padding: 0 12px 8px 26px;
  }
}

/* The doors (#14): the top's drawing again, each interface a small window
   over a part of it the story leaves empty (doors.ts DOCK), sized with the
   drawing so a wire from a window meets what it changed. */
.Beats {
  list-style: none;
  margin: 1.6rem 0 0 2.1rem;
  padding: 0;
}
/* Each beat takes a stretch of scrolling, so the windows open one at a time
   while the drawing stays in view, each as far as the reader has played it
   (`--p`, told.ts). */
.Beats li {
  position: relative;
  flex: 1 0 auto;
  min-height: 30vh;
  padding: .7rem 0 1.4rem;
  border-top: 1px solid var(--faint);
  transition: background .3s;
}
.Beats li > b {
  display: block;
  font: 500 .875rem/1.3 var(--mono);
  color: var(--muted);
  transition: color .3s;
}
.Beats li > :not(.Dot, b, code) {
  color: var(--muted);
  font-size: .90625rem;
  line-height: 1.5;
  margin-top: .2rem;
}
.Beats li > :not(.Dot, b, code) p {
  margin: 0;
}
.Beats li > code {
  display: block;
  margin-top: .45rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--link);
  white-space: pre-wrap;
  word-break: break-all;
}
.Beats .Dot {
  position: absolute;
  left: -2.1rem;
  top: 1.1rem;
  width: 9px;
  height: 9px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.Beats li.on {
  background: linear-gradient(90deg, var(--wash), transparent 70%) 0 0 / 100%
    2.6rem no-repeat;
}
.Beats li.on .Dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--wash);
}
.Beats li.on > b {
  color: var(--text);
}
/* The doors' desk: a column of windows left of the drawing, one slot for
   each beat (doors.ts DESK), every window that has run open in its slot. */
.Doors {
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.5fr);
  --pane: color-mix(in srgb, var(--bg), #fff 60%);
}
.Doors_Desk {
  position: relative;
  aspect-ratio: var(--desk, 980 / 620);
  container-type: inline-size;
}
.Doors_Sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sheet, 57%);
}
.Doors_Drawing,
.Doors_Drawing svg,
.Doors_Wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.Doors_Drawing .Diagram_Title {
  font-family: var(--font);
}
.Doors_Drawing .is-told > .Diagram_Fill {
  fill: color-mix(in srgb, var(--accent) 14%, var(--card));
}
.Doors_Drawing .is-told .Diagram_Stroke {
  stroke: var(--accent);
  stroke-width: 2;
}
.Doors_Wire {
  overflow: visible;
  pointer-events: none;
}
.Doors_Wire path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: .8;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--p, 1));
}
.Windows {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--column, 39%);
  display: grid;
  grid-template-rows: repeat(var(--slots, 3), minmax(0, 1fr));
  row-gap: var(--gap, 2.6%);
  font: 400 clamp(9px, 1.25cqw, 13px)/1.45 var(--mono);
}
/* A window is its slot's height, and what it holds past that is cut off
   under a fade. */
.Window {
  grid-row: var(--slot, auto);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--pane);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(43, 43, 51, .06), 0 6px 18px rgba(43, 43, 51, .1);
}
.Window.is-last {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 22px rgba(43, 43, 51, .16);
}
/* The newest window comes in as the reader scrolls past its beat, and goes
   back out as they scroll back (`--p`, told.ts). */
.Window.is-last,
.Declared {
  opacity: calc(.3 + .7 * var(--p, 1));
  transform: translateY(calc(6px - 6px * var(--p, 1)));
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.97);
  }
}
.Term_Screen,
.Chat_Call,
.Page_Body,
.Tui_Screen {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 1.4em), transparent);
  mask-image: linear-gradient(#000 calc(100% - 1.4em), transparent);
}
.Window .is-fault {
  color: var(--negative);
}

/* The terminal: dark glass, the command after its prompt. */
.Term,
.Tui {
  color-scheme: dark;
  border-color: transparent;
  background: var(--bg);
  color: var(--text);
}
.Term .is-fault,
.Tui .is-fault {
  color: var(--negative);
}
.Term_Bar {
  display: flex;
  align-items: center;
  gap: .4em;
  padding: .45em .7em;
  background: rgba(236, 228, 212, .06);
}
.Term_Bar i {
  flex: none;
  width: .65em;
  height: .65em;
  border-radius: 50%;
  background: rgba(236, 228, 212, .28);
}
.Term_Bar span {
  margin: 0 auto;
  padding-right: 2.6em;
  color: rgba(236, 228, 212, .6);
}
.Term_Screen {
  padding: .55em .8em;
  white-space: pre-wrap;
  word-break: break-word;
}
.Term_In {
  color: #faf6ee;
}
.Term_In span {
  color: var(--accent);
}

/* Your agent's chat: the tool it called as a card, its arguments and what
   came back, and the box you'd reply in. */
.Chat {
  font-family: var(--font);
}
.Chat_Head {
  display: flex;
  align-items: center;
  gap: .5em;
  padding: .5em .8em;
  border-bottom: 1px solid var(--border);
}
.Chat_Face {
  flex: none;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    color-mix(in srgb, var(--accent) 45%, #fff), var(--accent));
}
.Chat_Head b {
  font-weight: 500;
}
.Chat_Head span:last-child {
  color: var(--muted);
}
.Chat_Call {
  margin: .6em .8em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--mono);
}
.Chat_Tool {
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .35em .6em;
  border-bottom: 1px solid var(--border);
}
.Chat_Tool svg {
  flex: none;
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.Chat_Tool code {
  font: 500 1em var(--mono);
  color: var(--text);
}
.Chat_Call dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 .8em;
  margin: 0;
  padding: .35em .6em;
}
.Chat_Call dt {
  color: var(--muted);
}
.Chat_Call dd {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.Chat_Result {
  padding: .35em .6em .45em;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.Chat_Say {
  flex: none;
  margin: 0 .8em .6em;
  padding: .35em .8em;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  opacity: .75;
}

/* The web canvas in a browser: the address bar, the entity the call changed
   as the canvas draws it, and the call in the status line. */
.Page {
  font-family: var(--font);
}
.Page_Bar {
  display: flex;
  align-items: center;
  gap: .7em;
  padding: .4em .7em;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg), var(--border2) 5%);
}
.Page_Nav {
  color: var(--muted);
}
.Page_Address {
  flex: 1;
  padding: .1em .8em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--pane);
  font-family: var(--mono);
  color: var(--muted);
}
.Page_Body {
  padding: .8em 1em;
}
.Page_Title {
  display: flex;
  align-items: baseline;
  gap: .55em;
}
.Page_Title b {
  font-weight: 500;
  font-size: 1.12em;
}
.Page_Id {
  flex: none;
  font-family: var(--mono);
  color: var(--muted);
}
.Page_Box {
  position: relative;
  flex: none;
  align-self: center;
  width: 1.05em;
  height: 1.05em;
  border: 1.5px solid var(--border2);
  border-radius: 3px;
}
.Page_Box.is-on {
  border-color: var(--accent);
  background: var(--accent);
}
.Page_Box.is-on::after {
  content: '';
  position: absolute;
  left: 30%;
  top: 6%;
  width: 28%;
  height: 58%;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.Page_State {
  margin-top: .4em;
  color: var(--muted);
}
.Page_Choices {
  display: grid;
  gap: .35em;
  margin: .6em 0 0;
  padding: 0;
  list-style: none;
}
.Page_Choices li {
  padding: .3em .7em;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}
.Page_Choices li.is-on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}
.Page_Comment {
  margin-top: .6em;
  padding: .45em .7em;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, #fff);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.Page_Comment span {
  color: var(--muted);
  font-family: var(--mono);
}
.Page_Comment p {
  margin: .15em 0 0;
}
.Page_Status {
  flex: none;
  padding: .25em .8em;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  color: var(--muted);
}

/* The letter: who it is from and to under a stamp, what it says, and each
   time the effect handed it to the outbox, as postmarks along its foot. */
.Letter {
  position: relative;
  padding: .8em 1em .7em;
  border-radius: 2px;
  font-family: var(--font);
}
.Letter_Stamp {
  position: absolute;
  top: .7em;
  right: .8em;
  width: 2.2em;
  height: 2.6em;
  border: 2px dotted var(--pane);
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, #fff);
  background: color-mix(in srgb, var(--accent) 19%, transparent);
}
.Letter_Head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .05em .7em;
  margin: 0 3.4em .5em 0;
  padding-bottom: .5em;
  border-bottom: 1px solid var(--border);
}
.Letter_Head dt {
  color: var(--muted);
}
.Letter_Head dd {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Letter_Body {
  margin: 0 0 .6em;
}
.Letter_Body {
  overflow-wrap: anywhere;
}
.Letter_Body :is(p, ol, ul) {
  margin: 0 0 .3em;
}
.Letter_Body :is(ol, ul) {
  padding-left: 1.5em;
}
.Letter_Tries {
  margin: auto 0 0;
  padding: .4em 0 0;
  border-top: 1px dashed var(--border);
  list-style: none;
  font-family: var(--mono);
  color: var(--muted);
}

/* A new session's terminal UI: inverse bars above and below, and the
   context it was given in a ruled box. */
.Tui_Bar,
.Tui_Foot {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: .15em .7em;
}
.Tui_Bar {
  background: var(--accent);
  color: var(--bg);
}
.Tui_Bar b {
  font-weight: 500;
}
.Tui_Screen {
  margin: .45em;
  padding: .3em .6em;
  border: 1px solid rgba(236, 228, 212, .28);
  white-space: pre-wrap;
  word-break: break-word;
}
.Tui_Screen .is-head {
  color: var(--accent);
}
.Tui_Foot {
  background: rgba(236, 228, 212, .1);
  color: rgba(236, 228, 212, .7);
}

/* The rules band: under the drawing, the rule or effect the open turn ran,
   as the vocabulary that declares it writes it. */
.Declares {
  display: grid;
  gap: .6rem;
  margin-top: .8rem;
}
.Declared {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(252, 249, 243, .6);
}
.Declared_Bar {
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  font: 400 .75rem/1.5 var(--mono);
  color: var(--muted);
}
.Declared_Bar b {
  font-weight: 500;
  color: var(--text);
}
.Declared pre {
  margin: 0;
  padding: 8px 12px;
  font: 400 .75rem/1.55 var(--mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.Declared p {
  margin: 0;
  padding: 0 12px 8px;
  font-size: .8125rem;
  color: var(--muted);
}
/* ---------------------------------------------------------------- parts
   Below the bands: a numbered heading on the left, what the part holds on
   the right, a rule across the top; then the title block. */
.Part {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(1.5rem, 4.5vw, 4.5rem);
  margin: 0 var(--gutter);
  padding: 5rem 0;
  border-top: 1px solid var(--border);
}
.Part::before,
.Part::after {
  content: '';
  position: absolute;
  top: -5px;
  width: 1px;
  height: 9px;
  background: var(--border2);
}
.Part::before {
  left: 0;
}
.Part::after {
  right: 0;
}
.Part_Head {
  align-self: start;
  position: sticky;
  top: 2rem;
}
.Part_Head p,
.Part_Body p {
  color: var(--muted);
  max-width: 36rem;
}
.Bubble {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 1.1rem;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg);
  font: 500 .875rem/1 var(--mono);
}
.Bubble::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  width: 44px;
  height: 1px;
  background: var(--border);
}
.Part_Body > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.6rem 2.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.Part_Body > ul li {
  padding-top: .8rem;
  border-top: 1px solid var(--border2);
  color: var(--muted);
  font-size: .95rem;
}
.Part_Body > ul strong {
  display: block;
  margin-bottom: .3rem;
  color: var(--text);
  font-weight: 500;
}
.Part_Lines .Copy {
  margin: .5rem 0;
  max-width: none;
}
.Part_List {
  margin: 0 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: n;
  border-left: 1px solid var(--border);
}
.Part_List li {
  position: relative;
  padding: 0 0 2rem 36px;
  counter-increment: n;
}
.Part_List li:last-child {
  padding-bottom: .3rem;
}
.Part_List li::before {
  content: counter(n);
  position: absolute;
  left: -15px;
  top: -1px;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg);
  font: 500 .75rem/1 var(--mono);
}
.Part_List h3,
.Part_Body > h3 {
  margin: .1rem 0 .7rem;
  font: 500 1.06rem/1.3 var(--font);
}
.Part_Body > h3 {
  margin-top: 2.5rem;
}
.Part_Body table {
  width: 100%;
  margin-bottom: 1.6rem;
  border-collapse: collapse;
}
.Part_Body th {
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border2);
  text-align: left;
  font: 500 .75rem/1 var(--mono);
}
.Part_Body tr {
  border-bottom: 1px solid var(--border);
}
.Part_Body td {
  padding: .5rem 0;
  vertical-align: top;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.45;
}
.Part_Body td:first-child {
  width: 1%;
  padding-right: .9rem;
  white-space: nowrap;
  font: 500 .8125rem/1.45 var(--mono);
}
.Part_Body td:first-child a {
  text-decoration: none;
}
.File {
  margin: .8rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.File_Bar {
  padding: .45rem .9rem;
  border-bottom: 1px solid var(--border);
  font: .75rem var(--mono);
  color: var(--muted);
}
.File pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font: .8125rem/1.7 var(--mono);
}
.Block {
  display: grid;
  grid-template-columns: 30vw minmax(0, 1fr);
  gap: 1px;
  margin: 3rem var(--gutter) 2.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--border);
  overflow: hidden;
}
.Block_Sign,
.Block_Facts > * {
  min-width: 0;
  margin: 0;
  padding: .9rem 1rem;
  background: var(--bg);
}
.Block_Sign {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.Block_Logo {
  width: 100%;
  height: auto;
}
.Block_Facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  grid-auto-rows: 1fr;
  gap: 1px;
}
.Block_Sign strong {
  display: block;
  font: 500 1.125rem/1.2 var(--mono);
}
.Block_Sign span {
  color: var(--muted);
  font-size: .875rem;
}
.Block dt {
  margin-bottom: .5rem;
  font: .6875rem/1 var(--mono);
  color: var(--muted);
}
.Block dd {
  margin: 0;
  font: 500 .875rem/1.35 var(--mono);
  overflow-wrap: anywhere;
}
.Block dd p {
  margin: 0;
}
.Block dd a {
  text-decoration: none;
}

/* ---------------------------------------------------------------- setup
   A part with one field: the address, sent through apply() and out of the
   tab, then what happens next, and the write drawn as the band draws it. */
.Setup_Form label {
  display: block;
  margin-bottom: .5rem;
  font: 500 .8rem var(--mono);
  color: var(--muted);
}
.Setup_Field {
  display: flex;
  max-width: 34rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.Setup_Field:focus-within {
  border-color: var(--accent);
}
.Setup_Field input {
  flex: 1;
  min-width: 0;
  padding: .75rem .9rem;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: 1rem var(--font);
}
.Setup_Field button {
  border: 0;
  padding: 0 1.2rem;
  font: 500 .9rem var(--font);
  color: var(--card);
  background: var(--accent);
  cursor: pointer;
}
.Setup_Told {
  max-width: 34rem;
  margin: 1.4rem 0;
  padding: .9rem 1rem;
  border-left: 2px solid var(--border2);
  background: var(--card);
}
.Setup_Told.is-sent {
  border-color: var(--accent);
}
.Setup_Told b {
  display: block;
  font-weight: 500;
}
.Setup_Told p {
  margin: .4rem 0 0;
}
.Setup_Write {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 2rem;
  align-items: start;
  margin-top: 2rem;
}
.Setup .Phases {
  margin: 0 0 0 1.2rem;
  font-size: .9rem;
}
.Setup .Phases [data-phase] > :not(.Dot, b, .Skip) {
  display: none;
}
@media (max-width: 880px) {
  .Part,
  .Setup_Write {
    grid-template-columns: minmax(0, 1fr);
  }
  .Part_Head {
    position: static;
  }
  .Block {
    grid-template-columns: minmax(0, 1fr);
  }
  .Block_Logo {
    width: min(60vw, 18rem);
  }
}

@media (max-width: 760px) {
  .Band {
    grid-template-columns: 1fr;
  }
  .Stack_Figure,
  .Doors_Figure {
    position: static;
  }
  /* The windows under the drawing, each as tall as what it holds. */
  .Doors_Desk {
    display: flex;
    flex-direction: column;
    gap: .8rem;
    aspect-ratio: auto;
  }
  .Doors_Sheet {
    position: relative;
    width: 100%;
    aspect-ratio: var(--drawing, 560 / 620);
    max-height: 50svh;
  }
  .Doors_Wire {
    display: none;
  }
  .Windows {
    position: static;
    width: auto;
    grid-template-rows: none;
    gap: .7rem;
    font-size: 12px;
  }
  .Window {
    grid-row: auto;
    max-height: 11rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .Toast {
    animation-name: fade;
  }
  .Outbox li,
  .Caret {
    animation: none;
  }
}
