/* dokay itself, rebuilt in HTML for the scenes of the page. Each window is
   laid out at a fixed size in the app's own pixels and zoomed to the width
   of its frame, so its text stays text, sharp at any size. The values come
   from web/src/styles.css of the app. What moves is in the block at the end;
   without it every window shows how its scene ends. */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app {
  --app-bg: #ffffff;
  --app-surface: #ffffff;
  --app-surface-2: #f2f4f7;
  --app-surface-3: #e8ebf0;
  --app-tab: #f2f4f7;
  --app-line: #e2e6ec;
  --app-line-strong: #cdd4de;
  --app-text: #171a20;
  --app-strong: #12151b;
  --app-muted: #6b7383;
  --app-accent: #148a73;
  --app-accent-soft: rgba(20, 138, 115, 0.12);
  --app-unread: #2563eb;
  --app-good: #12925f;
  --app-warn: #a8710a;
  --app-node-fill: #ffffff;
  --app-node-alt: #f4f6f9;
  --app-node-stroke: #c6cdd8;
  --app-edge: #7b8496;
  --app-selection: #b3d7ff;
  --app-tint: 6%;
  --app-shadow: 0 14px 34px -18px rgba(12, 18, 30, 0.35);
  --claude: #65a30d;
  --merge: #4f46e5;
  --spark: #d97757;
  --w: 1120px;
  --h: 700px;
  position: absolute;
  top: 0;
  left: 0;
  width: var(--w);
  height: var(--h);
  zoom: tan(atan2(100cqw, var(--w)));
  overflow: hidden;
  background: var(--app-bg);
  color: var(--app-text);
  font: 400 14px/1.5 var(--font);
  letter-spacing: 0;
  text-align: left;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

@media (prefers-color-scheme: dark) {
  .app {
    --app-bg: #0b0d12;
    --app-surface: #11141b;
    --app-surface-2: #171b24;
    --app-surface-3: #1d222d;
    --app-tab: #262b35;
    --app-line: #232936;
    --app-line-strong: #313949;
    --app-text: #e7eaf0;
    --app-strong: #f2f4f8;
    --app-muted: #8a93a6;
    --app-accent: #34b59c;
    --app-accent-soft: rgba(52, 181, 156, 0.16);
    --app-unread: #5b9cff;
    --app-good: #3ecf8e;
    --app-warn: #eab308;
    --app-node-fill: #191e28;
    --app-node-alt: #151a22;
    --app-node-stroke: #39414f;
    --app-edge: #737e93;
    --app-selection: #3f638b;
    --app-tint: 9%;
    --app-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  }
}

.app p {
  text-wrap: wrap;
}

.app .i {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app kbd {
  padding: 1px 4px;
  border-radius: 5px;
  background: var(--app-surface);
  color: var(--app-muted);
  font: 400 11px/16.5px var(--font);
}

.av {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--av, var(--claude));
}

.av svg {
  width: 55%;
  height: 55%;
  fill: #ffffff;
}

.av-merge {
  --av: var(--merge);
}

.av-you {
  border: 1px solid var(--app-line);
  background: var(--app-surface);
  color: var(--app-muted);
}

.av-you .i {
  width: 14px;
  height: 14px;
}

.tag {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  color: var(--tone);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}

.tag-unread {
  --tone: var(--app-unread);
}

.tag-good {
  --tone: var(--app-good);
}

.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--app-line-strong);
  border-radius: 999px;
  background: var(--app-surface-2);
  color: var(--app-text);
  font-size: 12px;
}

.chip .i {
  width: 13px;
  height: 13px;
}

/* A text that changes: each state a line of its own, and the track moves
   on by one line. */
.roll {
  display: inline-block;
  overflow: hidden;
  height: var(--line);
  vertical-align: top;
}

.roll-track {
  display: flex;
  flex-direction: column;
}

.roll-track > * {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--line);
  white-space: nowrap;
}

/* Grows from nothing to its height, pushing what comes after it. */
.grow {
  display: grid;
  grid-template-rows: 1fr;
}

.grow > div {
  min-height: 0;
  overflow: hidden;
}

/* How each scene ends, where it differs from the parts on their own. */
.welcome {
  grid-template-rows: 0fr;
}

.composer-text {
  visibility: hidden;
}

.panel-title .roll-track {
  translate: 0 -20px;
}

.app-pill-label .roll-track {
  translate: 0 -18px;
}

.activity-roll .roll-track {
  translate: 0 -44px;
}

/* ------------------------------------------------------------ title bar */

.app-window {
  display: flex;
  flex-direction: column;
}

.app-top {
  display: flex;
  flex: none;
  align-items: stretch;
  gap: 8px;
  height: 52px;
  padding-right: 16px;
  background: var(--app-surface-3);
}

.app-lights {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  width: 76px;
  padding-left: 20px;
}

.app-lights i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}

.app-lights i:nth-child(2) {
  background: #febc2e;
}

.app-lights i:nth-child(3) {
  background: #28c840;
}

.app-brand {
  display: flex;
  flex: none;
  align-self: center;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--app-tab);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.app-brand svg {
  width: 19px;
  height: 19px;
}

.app-tab {
  display: flex;
  align-self: flex-end;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 8px 0 15px;
  border-radius: 10px 10px 0 0;
  background: var(--app-bg);
  color: var(--app-strong);
  font-size: 13.5px;
  font-weight: 600;
}

.app-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--app-unread);
}

.app-tab .i {
  width: 13px;
  height: 13px;
  margin: 0 3px;
  color: var(--app-muted);
}

.app-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.app-find {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  color: var(--app-muted);
}

.app-pill {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 9px 0 3px;
  border: 1px solid color-mix(in srgb, var(--app-good) 45%, transparent);
  border-radius: 999px;
  font-size: 12px;
}

.app-pill-second {
  display: flex;
  width: 12px;
}

.app-pill-second .av {
  margin-left: -8px;
  box-shadow: 0 0 0 1.5px var(--app-surface-3);
}

.app-pill-label {
  --line: 18px;
  width: 50px;
  margin-left: 7px;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 30px;
  color: var(--app-muted);
}

.app-icon .is-light {
  display: none;
}

@media (prefers-color-scheme: light) {
  .app-icon .is-dark {
    display: none;
  }

  .app-icon .is-light {
    display: block;
  }
}

.app-send {
  display: flex;
  height: 34px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.app-send-main,
.app-send-more {
  display: flex;
  align-items: center;
  background: var(--app-accent);
}

.app-send-main {
  gap: 8px;
  padding: 0 9px 0 12px;
  border-radius: 8px 0 0 8px;
}

.app-send-main .i,
.app-send-more .i {
  width: 14px;
  height: 14px;
}

.app-send kbd {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-send-more {
  padding: 0 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0 8px 8px 0;
}

/* ------------------------------------------------------------ the book */

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-rail {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 46px;
  padding-top: 16px;
  background: var(--app-surface);
  color: var(--app-muted);
}

.app-rail-new {
  position: relative;
  display: flex;
}

.app-rail-new b {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--app-unread);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.app-rail-settings {
  position: absolute;
  bottom: 16px;
}

.app-nav {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 230px;
  padding: 0 12px 18px 4px;
  overflow: hidden;
  border-right: 1px solid var(--app-line);
  background: var(--app-surface);
}

.nav-book {
  display: flex;
  flex: none;
  align-items: center;
  height: 46px;
  padding: 0 8px;
  color: var(--app-strong);
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.nav-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin-top: 6px;
  padding: 0 8px;
  color: var(--app-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-head:first-of-type {
  margin-top: 0;
}

.nav-head .i {
  width: 12px;
  height: 12px;
}

.nav-head .nav-head-add {
  width: 15px;
  height: 15px;
  margin-left: auto;
}

.nav-count {
  margin-left: auto;
  color: var(--app-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-question {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 8px;
}

.nav-question .av {
  width: 16px;
  height: 16px;
}

.nav-question-text {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.nav-question-text small,
.nav-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-question-text small {
  color: var(--app-muted);
  font-size: 12.5px;
}

.nav-age {
  color: var(--app-muted);
  font-size: 11px;
}

.nav-question .nav-count {
  margin-left: 0;
}

.nav-group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  color: var(--app-muted);
  font-size: 13.5px;
}

.nav-group.is-unread,
.nav-group.is-unread .nav-count {
  color: var(--app-unread);
}

.nav-group .i {
  width: 13px;
  height: 13px;
}

.nav-row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
}

.nav-row-title {
  flex: 1;
  min-width: 0;
}

.nav-row.is-open {
  background: var(--app-surface-3);
  color: var(--app-strong);
  font-weight: 600;
}

.nav-row .tag {
  font-weight: 500;
}

.nav-row .i {
  color: var(--app-muted);
}

/* "Sent", then the agent's spark while it works on the thread. */
.nav-state {
  --line: 20px;
  flex: none;
}

.nav-state .roll-track {
  align-items: flex-end;
  translate: 0 -20px;
}

.nav-state .spark {
  width: 13px;
  height: 13px;
  fill: var(--spark);
}

.nav-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--app-unread);
}

.nav-new {
  flex: none;
}

.nav-page {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
}

.nav-page.is-active {
  background: var(--app-surface-3);
  color: var(--app-strong);
  font-weight: 600;
}

.nav-status {
  font-size: 12px;
}

.nav-foot {
  margin-top: auto;
  padding: 0 8px;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ------------------------------------------------------------ the page */

.app-reader {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  background: var(--app-bg);
}

.app-crumbs {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  color: var(--app-muted);
  font-size: 13.5px;
}

.app-crumbs .i {
  width: 14px;
  height: 14px;
}

.crumb-sep {
  color: var(--app-line-strong);
}

.crumb-here {
  margin-right: 4px;
  color: var(--app-text);
}

.app-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.app-page {
  width: 452px;
  margin: 0 auto;
  padding-top: 26px;
}

.page-title {
  margin: 0 0 14px;
  color: var(--app-strong);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.page-p {
  position: relative;
  margin: 0;
  font-size: 15.5px;
  line-height: 1.7;
}

.app u {
  text-decoration: underline dotted color-mix(in srgb, var(--app-accent) 70%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/* The words picked: a selection first, then the reference of the
   conversation about them. */
.mark {
  position: relative;
  border-radius: 2px;
  background: linear-gradient(color-mix(in srgb, var(--app-accent) 22%, transparent), color-mix(in srgb, var(--app-accent) 22%, transparent)) 0 0 / 100% 100% no-repeat;
  white-space: nowrap;
}

.ref-n {
  position: absolute;
  right: -26px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--app-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.ref-n-1 {
  top: 30px;
}

.ref-n-2 {
  top: 18px;
}

.pop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--app-line-strong);
  border-radius: 999px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  font-size: 12px;
  line-height: 18px;
  transform-origin: 50% 100%;
  translate: -50% 0;
  visibility: hidden;
}

.pop-act {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
}

.pop-act .i {
  width: 13px;
  height: 13px;
}

/* A point on the words, later on the popover's first button; the I-beam
   is centred on it, the arrow has its tip there. */
.cursor {
  --pop-x: calc(50% - 60px);
  --pop-y: -24px;
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 100%;
  width: 0;
  height: 0;
}

.cursor svg {
  position: absolute;
  width: 26px;
  height: 26px;
  visibility: hidden;
}

.cursor-beam {
  top: -13px;
  left: -13px;
}

.cursor-arrow {
  top: -2px;
  left: -3px;
}

.page-added {
  position: relative;
}

.page-added > div {
  padding-top: 14px;
}

.change-line {
  position: absolute;
  inset: 8px -8px -6px;
  border-top: 2px solid var(--app-accent);
  border-bottom: 2px solid var(--app-accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--app-accent) 60%, transparent);
  opacity: 0;
  pointer-events: none;
}

.figure {
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-surface);
}

.figure-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--app-line);
  font-size: 12.5px;
  white-space: nowrap;
}

.figure-head > .i {
  width: 14px;
  height: 14px;
  color: var(--app-accent);
}

.figure-head b {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.figure-meta {
  flex: 1;
  color: var(--app-muted);
  font-size: 11.5px;
}

.figure-head .chip {
  height: 22px;
  font-size: 11.5px;
}

.figure-stage {
  padding: 18px 16px;
  background: radial-gradient(circle, var(--app-line) 1px, transparent 1.4px) 0 0 / 18px 18px;
}

.seq {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--font);
}

.seq-lines path,
.seq-line {
  fill: none;
  stroke: var(--app-edge);
  stroke-width: 1.4;
}

.seq-dash {
  stroke-dasharray: 4 4;
}

.seq-head {
  fill: var(--app-edge);
}

.seq-actor rect,
.seq-note {
  fill: var(--app-node-fill);
  stroke: var(--app-node-stroke);
  stroke-width: 1;
}

.seq .seq-note {
  fill: var(--app-node-alt);
}

.seq text {
  fill: var(--app-text);
  font-size: 13.5px;
  text-anchor: middle;
}

.seq .seq-actor text {
  font-size: 15px;
}

/* ------------------------------------------------------------ the conversation */

.app-panel {
  --panel-w: 330px;
  position: relative;
  flex: none;
  width: var(--panel-w);
  overflow: hidden;
  border-left: 1px solid var(--app-line);
  background: var(--app-surface);
}

.panel-inner {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: calc(var(--panel-w) - 1px);
}

.panel-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 12px 0 14px;
  font-size: 13px;
  font-weight: 600;
}

.panel-title {
  --line: 20px;
  width: 136px;
}

.panel-head > .i {
  width: 13px;
  height: 13px;
  color: var(--app-muted);
}

.panel-tools {
  display: flex;
  gap: 12px;
  margin-left: auto;
  color: var(--app-muted);
}

.panel-tools .i {
  width: 15px;
  height: 15px;
}

.panel-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  padding: 0 14px;
  overflow: hidden;
}

.panel-list > .grow > div > * {
  margin-top: 16px;
}

.welcome > div {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0 14px 18px;
  text-align: center;
}

.welcome-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.welcome-logo svg {
  width: 30px;
  height: 30px;
}

.welcome-ask {
  color: var(--app-strong);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.welcome-hint {
  color: var(--app-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.msg {
  display: flex;
  gap: 8px;
}

.msg > .av {
  width: 26px;
  height: 26px;
}

.msg-main {
  flex: 1;
  min-width: 0;
}

.msg.is-agent .msg-main {
  padding: 8px 12px;
  border-left: 3px solid var(--av);
  border-radius: 4px 8px 8px 4px;
  background: color-mix(in srgb, var(--av) var(--app-tint), transparent);
}

.is-claude {
  --av: var(--claude);
}

.is-merge {
  --av: var(--merge);
}

.msg-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 20px;
}

.msg-meta b {
  color: var(--app-strong);
  font-size: 13.5px;
  font-weight: 650;
}

.msg.is-agent .msg-meta b {
  color: var(--av);
}

.msg-text {
  font-size: 14px;
  line-height: 1.5;
}

.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 8px 0 2px;
  border: 1px solid var(--app-line-strong);
  border-radius: 999px;
  background: var(--app-surface-3);
  color: var(--app-text);
  font-size: 12px;
  line-height: 16px;
  vertical-align: 1px;
  white-space: nowrap;
}

.ref-chip b {
  min-width: 16px;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--app-accent);
  color: var(--app-bg);
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.ref-chip.is-pending {
  border-style: dashed;
  padding-right: 3px;
}

.ref-chip .i {
  width: 11px;
  height: 11px;
  margin-left: 2px;
  color: var(--app-muted);
}

.new-line,
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
}

.new-line {
  color: var(--app-unread);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.new-line::before,
.new-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--app-unread);
  opacity: 0.45;
}

.new-line + .msg {
  margin-top: 16px;
}

.notice {
  padding: 0 4px;
  color: var(--app-muted);
  font-size: 12px;
}

.notice i {
  flex: 1;
  border-top: 1px dashed var(--app-line);
}

.mention {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--merge) 14%, transparent);
  color: var(--merge);
  font-weight: 600;
}

.mention .av,
.activity-merge .av {
  width: 16px;
  height: 16px;
}

.activity-line {
  padding-top: 8px;
  border-top: 1px dashed var(--app-line);
  color: var(--app-muted);
  font-size: 12px;
}

.activity-roll {
  --line: 22px;
  display: block;
}

.activity-roll .spark {
  width: 13px;
  height: 13px;
  fill: var(--spark);
}

.activity-claude {
  color: var(--claude);
}

.activity-merge {
  color: var(--merge);
}

.activity-stop {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 1px 9px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  color: var(--danger, #f0616d);
}

.activity-stop .i {
  width: 12px;
  height: 12px;
}

.panel-foot {
  flex: none;
  padding: 12px 14px 14px;
}

.composer {
  padding: 12px;
  border: 1px solid var(--app-accent);
  border-radius: 12px;
  background: var(--app-surface);
}

.composer-field {
  display: grid;
  min-height: 63px;
  font-size: 14px;
  line-height: 21px;
}

.composer-field > * {
  grid-area: 1 / 1;
}

.composer-empty {
  color: var(--app-muted);
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--app-muted);
  font-size: 12px;
}

.composer-bar .i {
  width: 15px;
  height: 15px;
}

.composer-agent {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  color: var(--app-text);
  font-weight: 500;
  white-space: nowrap;
}

.composer-agent .av {
  width: 16px;
  height: 16px;
}

.composer-agent small {
  color: var(--app-muted);
  font-size: 12px;
  font-weight: 400;
}

.composer-agent .i {
  width: 12px;
  height: 12px;
}

.composer-send {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--app-surface-3);
  color: var(--app-muted);
}

.typed .caret {
  display: inline-block;
  width: 1.5px;
  height: 1.15em;
  margin: 0 -0.75px;
  background: var(--app-accent);
  vertical-align: -0.2em;
  animation: caret-blink 1s steps(1) infinite;
}

.typed .rest {
  visibility: hidden;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* ------------------------------------------------------------ cards and tiles

   Smaller parts of dokay on their own, each a window of its own size: the
   thread, the agents of a session, a question as a form, the search, a
   sequence and a class diagram, the page list, a plan and a glossary term. */

.card-thread .shot {
  aspect-ratio: 320 / 440;
}

.app-thread {
  --w: 320px;
  --h: 440px;
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  background: var(--app-surface);
}

.app-thread > .grow > div > * {
  margin-top: 16px;
}

.card-agents .shot {
  aspect-ratio: 400 / 214;
}

.app-agents {
  --w: 400px;
  --h: 214px;
}

.agents-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--app-surface-3);
}

.agents-menu > div {
  padding: 0 10px 12px;
}

.menu {
  margin-top: -6px;
  padding: 8px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
}

.menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 8px;
  border-bottom: 1px solid var(--app-line);
  font-size: 13px;
}

.menu-head b {
  flex: 1;
  font-weight: 700;
}

.menu-head span {
  color: var(--app-muted);
  font-size: 11px;
}

.state {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--app-good);
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 8px 8px;
}

.menu-row.is-delegate {
  align-items: flex-start;
  padding-left: 22px;
}

.menu-row.is-delegate .state {
  margin-top: 8px;
}

.menu-row .av {
  width: 22px;
  height: 22px;
}

.menu-name {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 22px;
}

.menu-name small {
  color: var(--app-muted);
  font-size: 12px;
  line-height: 16px;
}

.menu-ring {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--app-muted);
  font-size: 10px;
  white-space: nowrap;
}

.menu-ring i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: conic-gradient(var(--app-good) 49%, var(--app-line) 0);
}

.menu-row .chip {
  color: var(--app-muted);
}

.card-questions .shot {
  aspect-ratio: 340 / 500;
}

.app-questions {
  --w: 340px;
  --h: 500px;
  padding: 16px 14px;
  background: var(--app-surface);
}

.qb {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-bg);
}

.qb-card {
  padding: 12px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-surface);
}

.qb-tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--app-surface-3);
  color: var(--app-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 20px;
}

.qb-context {
  margin: 8px 0 10px;
  color: var(--app-muted);
  font-size: 13px;
  line-height: 1.5;
}

.qb-question {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.qb-option {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 7px 4px;
  border-radius: 7px;
}

.qb-option b {
  display: block;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
}

.qb-option em {
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--app-good) 16%, transparent);
  color: var(--app-good);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.qb-option small {
  display: block;
  color: var(--app-muted);
  font-size: 12px;
  line-height: 18px;
}

.qb-mark {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border: 1px solid var(--app-line-strong);
  border-radius: 50%;
  background: var(--app-surface);
}

.qb-pick {
  background: var(--app-accent-soft);
}

.qb-pick .qb-mark {
  border-color: var(--app-accent);
  background: var(--app-accent);
  box-shadow: inset 0 0 0 3px var(--app-surface);
}

.qb-pick .cursor {
  top: 18px;
  left: 12px;
}

.qb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--app-muted);
  font-size: 12px;
}

.qb-count {
  --line: 18px;
}

.qb-count .roll-track {
  translate: 0 -18px;
}

.qb-send {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px 0 12px;
  border-radius: 8px;
  background: var(--app-accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.qb-send kbd {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.85);
}

.card-search .shot {
  aspect-ratio: 420 / 330;
}

.app-search {
  --w: 420px;
  --h: 330px;
  display: flex;
  flex-direction: column;
  background: var(--app-surface);
}

.search-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--app-line);
  color: var(--app-muted);
}

.search-head .typed {
  color: var(--app-text);
  font-size: 15px;
}

.search-scopes {
  display: flex;
  flex: none;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--app-line);
  color: var(--app-muted);
  font-size: 12.5px;
}

.search-scopes span {
  padding: 2px 8px;
  border-radius: 999px;
}

.search-scopes .is-on {
  background: var(--app-surface-2);
  color: var(--app-strong);
}

.search-list {
  flex: 1;
  min-height: 0;
  padding: 4px 8px 8px;
}

.search-group {
  padding: 12px 8px 4px;
  color: var(--app-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
}

.search-row.is-cursor {
  background: var(--app-surface-2);
}

.search-row .i {
  width: 17px;
  height: 17px;
  color: var(--app-muted);
}

.search-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.search-text small {
  overflow: hidden;
  color: var(--app-muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-text b {
  color: var(--app-text);
  font-weight: 500;
}

.app mark {
  border-radius: 4px;
  background: color-mix(in srgb, var(--app-warn) 30%, transparent);
  color: inherit;
}

.search-foot {
  display: flex;
  flex: none;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--app-line);
  color: var(--app-muted);
  font-size: 11.5px;
}

.search-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.search-foot kbd {
  padding: 0 4px;
  border: 1px solid var(--app-line-strong);
  background: none;
  line-height: 15px;
}

/* The diagrams fill their tile with the figure around them. */
.tile-seq .shot {
  aspect-ratio: 800 / 470;
}

.tile-seq .app {
  --w: 800px;
  --h: 470px;
}

.tile-class .shot {
  aspect-ratio: 420 / 316;
}

.tile-class .app {
  --w: 420px;
  --h: 316px;
}

.app-figure .figure {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.app-figure .figure-stage {
  flex: 1;
  min-height: 0;
}

.app-figure svg {
  width: 100%;
  height: 100%;
}

.cls {
  display: block;
  overflow: visible;
  font-family: var(--font);
}

.cls-box rect,
.cls-box path {
  fill: var(--app-node-fill);
  stroke: var(--app-node-stroke);
  stroke-width: 1;
}

.cls-box path {
  fill: none;
}

.cls text {
  fill: var(--app-text);
  font-size: 10.5px;
}

.cls .cls-name {
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
}

.cls-edge,
.cls-tip,
.cls-diamond {
  fill: none;
  stroke: var(--app-edge);
  stroke-width: 1.2;
}

.cls-diamond {
  fill: var(--app-node-fill);
}

.cls .cls-mult,
.cls .cls-label {
  fill: var(--app-muted);
  font-size: 10px;
  text-anchor: middle;
}

.cls .cls-label {
  fill: var(--app-text);
  paint-order: stroke;
  stroke: var(--app-surface);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.cls-change .cls-frame {
  stroke: var(--app-accent);
  stroke-width: 2;
}

.cls-ref circle {
  fill: var(--app-accent);
}

.cls-ref text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
}

.app-pages {
  --w: 380px;
  --h: auto;
  bottom: 0;
}

.app-pages .app-nav {
  width: 100%;
  height: 100%;
  padding: 6px 14px 18px 8px;
  border-right: 0;
}

.app-pages .grow {
  flex: none;
}

.pages-added {
  position: relative;
}

.pages-added .nav-page {
  color: var(--app-strong);
}

.pages-added .nav-dot {
  margin-left: auto;
}

.pages-added .change-line {
  inset: 0 -4px;
}

.tile-plan .shot {
  aspect-ratio: 420 / 316;
}

.app-plan {
  --w: 420px;
  --h: 316px;
  padding: 22px 24px;
}

.plan-title {
  margin-bottom: 12px;
  color: var(--app-strong);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.plan-props {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  row-gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--app-line);
}

.prop-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--app-muted);
  font-size: 13.5px;
}

.prop-name .i {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.plan-status {
  --line: 26px;
}

.plan-status .roll-track {
  translate: 0 -26px;
}

.prop-pill {
  justify-self: start;
  height: 24px;
  padding: 0 11px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--app-unread) 16%, transparent);
  color: color-mix(in srgb, var(--app-unread) 70%, var(--app-text));
  font-size: 12.5px;
  font-weight: 600;
}

.roll-track > .prop-pill {
  height: 24px;
  margin: 1px 0;
}

.prop-pill.is-draft {
  background: var(--app-surface-3);
  color: var(--app-muted);
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--app-muted);
  font-size: 12px;
}

.progress i {
  display: block;
  width: 150px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--app-surface-3);
}

.progress b {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: 999px;
  background: var(--app-accent);
}

.plan-count {
  --line: 18px;
}

.plan-count .roll-track {
  translate: 0 -36px;
}

.plan-p {
  margin: 14px 0 6px;
  font-size: 15px;
}

.tasks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.75;
}

.task-box {
  display: grid;
  flex: none;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 1px solid var(--app-line-strong);
  border-radius: 4px;
}

.task-box .i {
  width: 11px;
  height: 11px;
  color: #ffffff;
  stroke-width: 2.6;
}

.task.is-done .task-box {
  border-color: var(--app-accent);
  background: var(--app-accent);
}

.task.is-done > span {
  color: var(--app-muted);
}

.task > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-gloss .shot {
  aspect-ratio: 1180 / 220;
}

.app-gloss {
  --w: 1180px;
  --h: 220px;
  padding: 22px 28px;
}

.app-gloss .page-p {
  font-size: 16px;
}

.gloss-hit {
  position: relative;
}

.gloss-card {
  position: absolute;
  z-index: 2;
  top: calc(100% + 6px);
  left: -16px;
  display: grid;
  width: 350px;
  padding: 12px 14px;
  border: 1px solid var(--app-line-strong);
  border-radius: 12px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  font-size: 13.5px;
  line-height: 1.5;
  transform-origin: 30px 0;
}

.gloss-card b {
  color: var(--app-strong);
  font-size: 14px;
  font-weight: 700;
}

.gloss-card small {
  margin-bottom: 6px;
  color: var(--app-muted);
  font-size: 12.5px;
}

.gloss-link {
  margin-top: 6px;
  color: var(--app-accent);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gloss-hit .cursor {
  top: 70%;
  left: 60%;
}

@media (max-width: 599px) {
  .tile-seq .shot {
    aspect-ratio: 460 / 400;
  }

  .tile-seq .app {
    --w: 460px;
    --h: 400px;
  }

  .tile-pages .shot {
    aspect-ratio: 380 / 470;
  }

  .tile-gloss .shot {
    aspect-ratio: 420 / 300;
  }

  .app-gloss {
    --w: 420px;
    --h: 300px;
    padding: 20px;
  }

  .gloss-card {
    width: 320px;
  }
}

/* ------------------------------------------------------------ phones

   A narrow window: the page alone, and the conversation floating over its
   lower part, as dokay shows it in its floating view. It leaves out the
   second agent. */

@media (max-width: 640px) {
  .app-window {
    --w: 400px;
    --h: 600px;
  }

  .app-window .app-brand,
  .app-window .app-find,
  .app-window .app-icon,
  .app-window .app-send,
  .app-window .app-rail,
  .app-window .app-nav,
  .app-window .app-crumbs,
  .app-window .welcome-logo,
  .app-window .msg-joined,
  .app-window .msg-merge,
  .app-window .app-pill-second {
    display: none;
  }

  .app-window .app-top {
    height: 44px;
    padding-right: 12px;
  }

  .app-window .app-lights {
    width: 66px;
    padding-left: 16px;
    gap: 7px;
  }

  .app-window .app-tab {
    height: 36px;
  }

  .app-window .app-pill-label {
    width: 40px;
  }

  .app-window .app-pill-label .roll-track {
    translate: 0 0;
  }

  .app-window .app-body {
    position: relative;
  }

  .app-window .app-page {
    width: 352px;
    padding-top: 24px;
    translate: 0 -20px;
  }

  .app-window .pop {
    left: 0;
    translate: none;
    transform-origin: 25% 100%;
  }

  .app-window .cursor {
    --pop-x: 75px;
  }

  .app-window .page-title {
    margin-bottom: 10px;
    font-size: 29px;
  }

  .app-window .page-p {
    font-size: 15px;
    line-height: 1.65;
  }

  .app-window .ref-n {
    right: -21px;
  }

  .app-window .ref-n-1 {
    top: 53px;
  }

  .app-window .app-panel {
    --panel-h: 330px;
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: var(--panel-h);
    border: 1px solid var(--app-line-strong);
    border-radius: 12px;
    box-shadow: var(--app-shadow), 0 -6px 24px -12px rgba(0, 0, 0, 0.35);
  }

  .app-window .panel-inner {
    top: auto;
    left: 0;
    width: auto;
    height: calc(var(--panel-h) - 2px);
  }

  .app-window .panel-head {
    height: 40px;
  }

  .app-window .panel-list {
    padding: 0 12px;
  }

  .app-window .panel-foot {
    padding: 10px 12px 12px;
  }

  .app-window .composer {
    padding: 10px 12px;
  }

  .app-window .composer-field {
    min-height: 42px;
  }

  .app-window .welcome > div {
    gap: 6px;
    padding-bottom: 12px;
  }

  .app-window .welcome-ask {
    font-size: 16px;
  }

  .app-window .activity {
    grid-template-rows: 0fr;
  }
}

/* ------------------------------------------------------------ the scene

   "You point. Your agent answers." on the scroll timeline of the stage,
   `--stage` in style.css, in steps: the book, the words selected, the
   popover, the conversation opening beside the page, the question typed
   and sent, the answer with the agent's change to the page, a second agent.
   Every part grows, moves or turns up; none fades over another. */

@property --mark {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

/* How much of the question scenes.js has typed, 0 to 1. */
@property --typed {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

.mark {
  --mark: color-mix(in srgb, var(--app-accent) 22%, transparent);
  background-image: linear-gradient(var(--mark), var(--mark));
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .stage :is(.mark, .cursor, .cursor-beam, .cursor-arrow, .pop, .pop-act, .ref-n, .app-panel, .app-page, .grow, .welcome > div, .roll-track, .app-pill-label, .app-pill-second, .app-pill-second .av, .change-line, .page-added p, .composer-text, .composer-empty, .composer-send, .typed) {
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --stage;
      animation-range: contain 0% contain 100%;
    }

    .stage .mark {
      animation-name: mark-sweep;
    }

    .stage .cursor {
      animation-name: cursor-path;
    }

    .stage .cursor-beam {
      animation-name: cursor-beam;
    }

    .stage .cursor-arrow {
      animation-name: cursor-arrow;
    }

    .stage .pop {
      animation-name: pop-up;
    }

    .stage .pop-act:first-child {
      animation-name: pop-press;
    }

    .stage .ref-n-1 {
      animation-name: ref-1;
    }

    .stage .ref-n-2 {
      animation-name: ref-2;
    }

    .stage .app-panel {
      animation-name: panel-open;
    }

    .stage .welcome {
      animation-name: welcome-go;
    }

    .stage .welcome > div {
      animation-name: welcome-out;
    }

    .stage .composer-text {
      animation-name: composer-sent;
    }

    .stage .composer-empty {
      animation-name: composer-empty;
    }

    .stage .composer-send {
      animation-name: composer-send;
    }

    .stage .typed {
      animation-name: typing;
    }

    .stage .msg-you {
      animation-name: grow-you;
    }

    .stage .panel-title .roll-track {
      animation-name: roll-title;
    }

    .stage .nav-new {
      animation-name: grow-nav;
    }

    .stage .activity {
      animation-name: grow-activity;
    }

    .stage .activity-roll .roll-track {
      animation-name: roll-activity;
    }

    .stage .nav-state .roll-track {
      animation-name: roll-nav-state;
    }

    .stage .msg-answer {
      animation-name: grow-answer;
    }

    .stage .change-line {
      animation-name: change-line;
    }

    .stage .page-added {
      animation-name: grow-added;
    }

    .stage .page-added p {
      animation-name: block-flash;
    }

    .stage .app-pill-second {
      animation-name: pill-second;
    }

    .stage .app-pill-second .av {
      animation-name: pill-avatar;
    }

    .stage .app-pill-label {
      animation-name: pill-label;
    }

    .stage .app-pill-label .roll-track {
      animation-name: roll-pill;
    }

    .stage .msg-joined {
      animation-name: grow-joined;
    }

    .stage .msg-merge {
      animation-name: grow-merge;
    }
  }

  @media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
    .stage .app-panel {
      animation-name: card-open;
    }

    .stage .app-page {
      animation-name: page-up;
    }

    .stage .activity {
      animation-name: grow-activity-compact;
    }

    .stage :is(.app-pill-label, .app-pill-label .roll-track) {
      animation-name: none;
    }
  }
}

@keyframes card-open {
  0%,
  25% {
    visibility: hidden;
    height: 0;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  25.01% {
    visibility: visible;
    height: 0;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  33%,
  100% {
    visibility: visible;
    height: var(--panel-h);
  }
}

@keyframes page-up {
  0%,
  25% {
    translate: 0 0;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  33%,
  100% {
    translate: 0 -20px;
  }
}

@keyframes mark-sweep {
  0%,
  8% {
    --mark: var(--app-selection);
    background-size: 0% 100%;
  }

  17%,
  25% {
    --mark: var(--app-selection);
    background-size: 100% 100%;
  }

  27%,
  100% {
    --mark: color-mix(in srgb, var(--app-accent) 22%, transparent);
    background-size: 100% 100%;
  }
}

@keyframes cursor-path {
  0%,
  8% {
    top: 50%;
    left: 0%;
  }

  17%,
  18.5% {
    top: 50%;
    left: 100%;
    animation-timing-function: cubic-bezier(0.45, 0, 0.25, 1);
  }

  22.5% {
    top: var(--pop-y);
    left: var(--pop-x);
    scale: 1;
  }

  23.5% {
    scale: 0.82;
  }

  24.5%,
  100% {
    top: var(--pop-y);
    left: var(--pop-x);
    scale: 1;
  }
}

@keyframes cursor-beam {
  0%,
  6% {
    visibility: hidden;
  }

  6.01%,
  18% {
    visibility: visible;
  }

  18.01%,
  100% {
    visibility: hidden;
  }
}

@keyframes cursor-arrow {
  0%,
  18% {
    visibility: hidden;
  }

  18.01%,
  24.9% {
    visibility: visible;
  }

  25%,
  100% {
    visibility: hidden;
  }
}

@keyframes pop-up {
  0%,
  18% {
    visibility: hidden;
    scale: 0.7;
  }

  18.01% {
    visibility: visible;
    scale: 0.7;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1.2);
  }

  20%,
  24.9% {
    visibility: visible;
    scale: 1;
  }

  25%,
  100% {
    visibility: hidden;
  }
}

@keyframes pop-press {
  0%,
  23% {
    background: transparent;
  }

  23.5%,
  100% {
    background: var(--app-surface-3);
  }
}

@keyframes ref-1 {
  0%,
  26% {
    scale: 0;
  }

  28%,
  100% {
    scale: 1;
  }
}

@keyframes ref-2 {
  0%,
  70% {
    scale: 0;
  }

  72%,
  100% {
    scale: 1;
  }
}

@keyframes panel-open {
  0%,
  25% {
    visibility: hidden;
    width: 0;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  25.01% {
    visibility: visible;
    width: 0;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  33%,
  100% {
    visibility: visible;
    width: var(--panel-w);
  }
}

@keyframes welcome-go {
  0%,
  50% {
    grid-template-rows: 1fr;
  }

  53%,
  100% {
    grid-template-rows: 0fr;
  }
}

@keyframes welcome-out {
  0%,
  50% {
    opacity: 1;
  }

  51.5%,
  100% {
    opacity: 0;
  }
}

@keyframes composer-sent {
  0%,
  50% {
    visibility: visible;
  }

  50.01%,
  100% {
    visibility: hidden;
  }
}

@keyframes composer-empty {
  0%,
  50% {
    visibility: hidden;
  }

  50.01%,
  100% {
    visibility: visible;
  }
}

@keyframes composer-send {
  0%,
  36% {
    background: var(--app-surface-3);
    color: var(--app-muted);
  }

  37%,
  49% {
    background: var(--app-accent);
    color: #ffffff;
    scale: 1;
  }

  49.6% {
    background: var(--app-accent);
    color: #ffffff;
    scale: 0.82;
  }

  50% {
    background: var(--app-accent);
    color: #ffffff;
    scale: 1;
  }

  50.01%,
  100% {
    background: var(--app-surface-3);
    color: var(--app-muted);
  }
}

@keyframes typing {
  0%,
  36% {
    --typed: 0;
  }

  49%,
  100% {
    --typed: 1;
  }
}

@keyframes grow-you {
  0%,
  50% {
    grid-template-rows: 0fr;
  }

  53%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes roll-title {
  0%,
  53% {
    translate: 0 0;
  }

  55%,
  100% {
    translate: 0 -20px;
  }
}

@keyframes grow-nav {
  0%,
  52% {
    grid-template-rows: 0fr;
  }

  56%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes grow-activity {
  0%,
  53% {
    grid-template-rows: 0fr;
  }

  55%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes grow-activity-compact {
  0%,
  53% {
    grid-template-rows: 0fr;
  }

  55%,
  63% {
    grid-template-rows: 1fr;
  }

  65%,
  100% {
    grid-template-rows: 0fr;
  }
}

@keyframes roll-activity {
  0%,
  59% {
    translate: 0 0;
  }

  61%,
  86% {
    translate: 0 -22px;
  }

  88%,
  100% {
    translate: 0 -44px;
  }
}

@keyframes roll-nav-state {
  0%,
  59% {
    translate: 0 0;
  }

  61%,
  100% {
    translate: 0 -20px;
  }
}

@keyframes grow-answer {
  0%,
  63% {
    grid-template-rows: 0fr;
  }

  67%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes change-line {
  0%,
  66% {
    opacity: 0;
    scale: 0 1;
  }

  66.01% {
    opacity: 1;
    scale: 0 1;
  }

  68%,
  72% {
    opacity: 1;
    scale: 1 1;
  }

  75%,
  100% {
    opacity: 0;
    scale: 1 1;
  }
}

@keyframes grow-added {
  0%,
  68% {
    grid-template-rows: 0fr;
  }

  71%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes block-flash {
  0%,
  70% {
    background: transparent;
  }

  71.5% {
    background: var(--app-accent-soft);
  }

  77%,
  100% {
    background: transparent;
  }
}

@keyframes pill-second {
  0%,
  77% {
    width: 0;
  }

  79%,
  100% {
    width: 12px;
  }
}

@keyframes pill-avatar {
  0%,
  77% {
    scale: 0;
  }

  79%,
  100% {
    scale: 1;
  }
}

@keyframes pill-label {
  0%,
  78% {
    width: 40px;
  }

  80%,
  100% {
    width: 50px;
  }
}

@keyframes roll-pill {
  0%,
  78% {
    translate: 0 0;
  }

  80%,
  100% {
    translate: 0 -18px;
  }
}

@keyframes grow-joined {
  0%,
  79% {
    grid-template-rows: 0fr;
  }

  82%,
  100% {
    grid-template-rows: 1fr;
  }
}

@keyframes grow-merge {
  0%,
  84% {
    grid-template-rows: 0fr;
  }

  88%,
  100% {
    grid-template-rows: 1fr;
  }
}

/* ------------------------------------------------------------ cards and tiles in motion

   Each card and each tile builds itself while it comes into view, on its
   own view timeline: the conversation grows message by message, the menu of
   agents unfolds, the question is answered, the search types, the diagrams
   draw, the page list fills, the plan ticks its tasks, the glossary card
   opens. Ranges are shares of `cover`, so 50% is the middle of the screen. */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .card {
      view-timeline: --card block;
    }

    .tile {
      view-timeline: --tile block;
    }

    .card :is(.thread-answer, .thread-joined, .thread-merge, .thread-working, .agents-menu, .menu-delegate, .app-pill-second, .app-pill-second .av, .qb-pick, .qb-pick .qb-mark, .qb-count .roll-track, .qb-pick .cursor, .qb-pick .cursor-arrow, .typed, .search-hits) {
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --card;
    }

    .tile :is(.seq-lines, .seq-actor, .seq-msg, .cls-box, .cls-rel, .cls-ref, .cls-frame, .pages-row, .pages-added, .change-line, .task-box, .task-box .i, .task > span, .progress b, .plan-count .roll-track, .plan-status .roll-track, .gloss-card, .gloss-hit .cursor, .gloss-hit .cursor-arrow) {
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --tile;
    }

    /* The conversation */
    .card .thread-answer {
      animation-name: grow-open;
      animation-range: cover 12% cover 22%;
    }

    .card .thread-joined {
      animation-name: grow-open;
      animation-range: cover 24% cover 29%;
    }

    .card .thread-merge {
      animation-name: grow-open;
      animation-range: cover 30% cover 38%;
    }

    .card .thread-working {
      animation-name: grow-open;
      animation-range: cover 39% cover 44%;
    }

    /* The agents */
    .card .agents-menu {
      animation-name: grow-open;
      animation-range: cover 14% cover 24%;
    }

    .card .menu-delegate {
      animation-name: grow-open;
      animation-range: cover 28% cover 36%;
    }

    .card .app-pill-second {
      animation-name: pill-second;
      animation-range: cover 28% cover 36%;
    }

    .card .app-pill-second .av {
      animation-name: pill-avatar;
      animation-range: cover 28% cover 36%;
    }

    /* The question */
    .card .qb-pick .cursor {
      animation-name: cursor-to-pick;
      animation-range: cover 14% cover 32%;
    }

    .card .qb-pick .cursor-arrow {
      animation-name: shown-after;
      animation-range: cover 14% cover 15%;
    }

    .card .qb-pick {
      animation-name: picked;
      animation-range: cover 31% cover 32%;
    }

    .card .qb-pick .qb-mark {
      animation-name: picked-mark;
      animation-range: cover 31% cover 32%;
    }

    .card .qb-count .roll-track {
      animation-name: roll-one;
      animation-range: cover 32% cover 35%;
    }

    /* The search */
    .card .typed {
      animation-name: typing-word;
      animation-range: cover 12% cover 24%;
    }

    .card .search-hits {
      animation-name: grow-open;
      animation-range: cover 25% cover 33%;
    }

    /* The sequence diagram: who takes part, the lifelines, each message in
       its turn, and who takes part again at the foot. */
    .tile .seq-actor {
      animation-name: pop;
      transform-box: fill-box;
      transform-origin: center;
    }

    .tile .seq-actor-1 {
      animation-range: cover 8% cover 13%;
    }

    .tile .seq-actor-2 {
      animation-range: cover 10% cover 15%;
    }

    .tile .seq-actor-3 {
      animation-range: cover 12% cover 17%;
    }

    .tile .seq-actor-4 {
      animation-range: cover 14% cover 19%;
    }

    .tile .seq-lines {
      animation-name: wipe-down;
      animation-range: cover 16% cover 24%;
    }

    .tile .seq-msg {
      animation-name: wipe-right;
    }

    .tile .seq-msg.is-back {
      animation-name: wipe-left;
    }

    .tile .seq-msg-1 {
      animation-range: cover 22% cover 27%;
    }

    .tile .seq-msg-2 {
      animation-range: cover 26% cover 30%;
    }

    .tile .seq-msg-3 {
      animation-range: cover 30% cover 35%;
    }

    .tile .seq-msg-4 {
      animation-range: cover 34% cover 38%;
    }

    .tile .seq-msg-5 {
      animation-range: cover 38% cover 43%;
    }

    .tile .seq-msg-6 {
      animation-range: cover 42% cover 47%;
    }

    .tile .seq-actor-5 {
      animation-range: cover 45% cover 49%;
    }

    .tile .seq-actor-6 {
      animation-range: cover 46% cover 50%;
    }

    .tile .seq-actor-7 {
      animation-range: cover 47% cover 51%;
    }

    .tile .seq-actor-8 {
      animation-range: cover 48% cover 52%;
    }

    /* The class diagram, and the comment on one of its classes */
    .tile .cls-box {
      animation-name: pop;
      transform-box: fill-box;
      transform-origin: center;
    }

    .tile .cls-box-1 {
      animation-range: cover 8% cover 14%;
    }

    .tile .cls-box-2 {
      animation-range: cover 11% cover 17%;
    }

    .tile .cls-box-3 {
      animation-range: cover 14% cover 20%;
    }

    .tile .cls-box-4 {
      animation-range: cover 19% cover 25%;
    }

    .tile .cls-rel {
      animation-name: wipe-down;
    }

    .tile .cls-rel-1 {
      animation-range: cover 26% cover 33%;
    }

    .tile .cls-rel-2 {
      animation-range: cover 29% cover 36%;
    }

    .tile .cls-rel-3 {
      animation-range: cover 32% cover 39%;
    }

    .tile .cls-frame {
      animation-name: node-picked;
      animation-range: cover 42% cover 43%;
    }

    .tile .cls-ref {
      animation-name: pop;
      animation-range: cover 42% cover 46%;
      transform-box: fill-box;
      transform-origin: center;
    }

    /* The page list, and the page the agent adds */
    .tile .pages-row,
    .tile .pages-added {
      animation-name: grow-open;
    }

    .tile .pages-row-1 {
      animation-range: cover 6% cover 9%;
    }

    .tile .pages-row-2 {
      animation-range: cover 8% cover 11%;
    }

    .tile .pages-row-3 {
      animation-range: cover 10% cover 13%;
    }

    .tile .pages-row-4 {
      animation-range: cover 12% cover 15%;
    }

    .tile .pages-row-5 {
      animation-range: cover 14% cover 17%;
    }

    .tile .pages-row-6 {
      animation-range: cover 16% cover 19%;
    }

    .tile .pages-row-7 {
      animation-range: cover 18% cover 21%;
    }

    .tile .pages-row-8 {
      animation-range: cover 20% cover 23%;
    }

    .tile .pages-row-9 {
      animation-range: cover 22% cover 25%;
    }

    .tile .pages-row-10 {
      animation-range: cover 24% cover 27%;
    }

    .tile .pages-row-11 {
      animation-range: cover 26% cover 29%;
    }

    .tile .pages-added {
      animation-range: cover 36% cover 40%;
    }

    .tile .pages-added .change-line {
      animation-name: change-line;
      animation-range: cover 33% cover 44%;
    }

    /* The plan: the first task, then the second, with the progress */
    .tile .task-1 .task-box,
    .tile .task-2 .task-box {
      animation-name: task-box;
    }

    .tile .task-1 .task-box .i,
    .tile .task-2 .task-box .i {
      animation-name: pop;
    }

    .tile .task-1 > span,
    .tile .task-2 > span {
      animation-name: task-done;
    }

    .tile .task-1 :is(.task-box, .task-box .i),
    .tile .task-1 > span {
      animation-range: cover 18% cover 21%;
    }

    .tile .task-2 :is(.task-box, .task-box .i),
    .tile .task-2 > span {
      animation-range: cover 34% cover 37%;
    }

    .tile .plan-status .roll-track {
      animation-name: roll-status;
      animation-range: cover 18% cover 21%;
    }

    .tile .progress b {
      animation-name: progress-two;
      animation-range: cover 18% cover 37%;
    }

    .tile .plan-count .roll-track {
      animation-name: roll-count;
      animation-range: cover 18% cover 37%;
    }

    /* The glossary term */
    .tile .gloss-hit .cursor {
      animation-name: cursor-to-term;
      animation-range: cover 10% cover 23%;
    }

    .tile .gloss-hit .cursor-arrow {
      animation-name: shown-after;
      animation-range: cover 10% cover 11%;
    }

    .tile .gloss-card {
      animation-name: card-unfold;
      animation-range: cover 24% cover 31%;
    }
  }
}

@keyframes grow-open {
  from {
    grid-template-rows: 0fr;
  }

  to {
    grid-template-rows: 1fr;
  }
}

@keyframes pop {
  from {
    scale: 0;
  }

  70% {
    scale: 1.06;
  }

  to {
    scale: 1;
  }
}

@keyframes wipe-right {
  from {
    clip-path: inset(-20px 100% -20px -20px);
  }

  to {
    clip-path: inset(-20px -20px -20px -20px);
  }
}

@keyframes wipe-left {
  from {
    clip-path: inset(-20px -20px -20px 100%);
  }

  to {
    clip-path: inset(-20px -20px -20px -20px);
  }
}

@keyframes wipe-down {
  from {
    clip-path: inset(-20px -20px 100% -20px);
  }

  to {
    clip-path: inset(-20px -20px -20px -20px);
  }
}

@keyframes shown-after {
  from {
    visibility: hidden;
  }

  1%,
  to {
    visibility: visible;
  }
}

@keyframes cursor-to-pick {
  from {
    translate: 90px 70px;
    animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
  }

  85% {
    translate: 0 0;
    scale: 1;
  }

  92% {
    scale: 0.8;
  }

  to {
    translate: 0 0;
    scale: 1;
  }
}

@keyframes picked {
  from {
    background: transparent;
  }
}

@keyframes picked-mark {
  from {
    border-color: var(--app-line-strong);
    background: var(--app-surface);
  }
}

@keyframes roll-one {
  from {
    translate: 0 0;
  }
}

@keyframes typing-word {
  from {
    --typed: 0;
  }

  to {
    --typed: 1;
  }
}

@keyframes node-picked {
  from {
    stroke: var(--app-node-stroke);
    stroke-width: 1;
  }
}

@keyframes task-box {
  from {
    border-color: var(--app-line-strong);
    background: transparent;
  }
}

@keyframes task-done {
  from {
    color: var(--app-text);
  }
}

@keyframes roll-status {
  from {
    translate: 0 0;
  }
}

@keyframes progress-two {
  from {
    width: 0%;
  }

  16%,
  84% {
    width: 25%;
  }

  to {
    width: 50%;
  }
}

@keyframes roll-count {
  from {
    translate: 0 0;
  }

  16%,
  84% {
    translate: 0 -18px;
  }

  to {
    translate: 0 -36px;
  }
}

@keyframes cursor-to-term {
  from {
    translate: 110px 60px;
    animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
  }

  to {
    translate: 0 0;
  }
}

@keyframes card-unfold {
  from {
    clip-path: inset(-20px -40px 100% -40px);
    translate: 0 -6px;
  }

  to {
    clip-path: inset(-20px -40px -50px -40px);
    translate: 0 0;
  }
}
