.transcript {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 8px;
  min-height: 0;
  scroll-behavior: smooth;
}
.turn {
  width: min(var(--content-width), calc(100% - 56px));
  margin: 0 auto 26px;
}
/*
 * Assembly reveal. The turn keeps its layout the whole time — the flying
 * glyphs are aimed at these exact character positions — so only colour and
 * the bubble surface animate:
 *   pending    → nothing visible
 *   surfacing  → the empty bubble fades in, ready to catch the glyphs
 *   (classes off) → the text itself fades in as the glyphs fade out
 */
.turn__body {
  transition: color 260ms ease, background-color 300ms ease, border-color 300ms ease;
}
.turn--pending .turn__body {
  color: transparent;
  background-color: transparent;
  border-color: transparent;
}
.turn--pending.turn--surfacing .turn__body {
  background-color: var(--bg-raised);
  border-color: var(--border-soft);
}
.turn--user {
  display: flex;
  justify-content: flex-end;
}
.turn--user .turn__body {
  max-width: 82%;
  padding: 11px 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.turn--assistant .turn__body {
  color: var(--text);
  word-break: break-word;
}
.turn__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-faint);
  font-size: 12px;
}
.turn__body p { margin: 0 0 12px; }
.turn__body p:last-child { margin-bottom: 0; }
.turn__body ul, .turn__body ol { margin: 0 0 12px; padding-left: 22px; }
.turn__body li { margin: 4px 0; }
.turn__body h1, .turn__body h2, .turn__body h3 {
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.turn__body code {
  padding: 2px 5px;
  background: var(--bg-deep);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.turn__body pre {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.turn__body pre code {
  padding: 0;
  background: none;
  font-size: 13px;
  line-height: 1.55;
}
.turn__body a { color: var(--accent); }
@keyframes blink { to { visibility: hidden; } }
.turn--status .turn__body {
  color: var(--text-faint);
  font-size: 13px;
  font-style: italic;
}
.turn--error .turn__body {
  padding: 12px 16px;
  background: rgba(236, 106, 94, 0.08);
  border: 1px solid rgba(236, 106, 94, 0.35);
  border-radius: var(--radius-md);
  color: #f0b1a9;
  font-size: 14px;
}
/* Tool approval --------------------------------------------------------- */

/* The model is parked here until the user answers, so it has to be obvious. */
.approval {
  margin: 8px 0;
  padding: 12px 14px;
  border: 1px solid var(--star);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.approval__question {
  color: var(--text);
  font-size: 13px;
}
.approval__detail {
  margin: 8px 0 0;
  padding: 8px 10px;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.approval__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.approval__btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}
.approval__btn:hover { background: var(--bg-hover-solid); color: var(--text); }
.approval__btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}
.approval__btn--danger:hover { border-color: hsl(5 60% 45%); color: hsl(5 70% 74%); }
.approval.is-allowed,
.approval.is-denied {
  padding: 8px 12px;
  border-color: var(--border-soft);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}
.approval.is-denied { color: hsl(5 60% 70%); }
/* Marks where older turns were summarised away. */
.compact-marker {
  margin: 14px auto;
  padding: 4px 12px;
  width: fit-content;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
/* Working indicator ----------------------------------------------------- */

/* Cycling code punctuation while the model thinks — motion without a logo. */
.thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
}
.thinking__glyphs {
  display: inline-flex;
  gap: 2px;
  min-width: 46px;
  color: var(--accent);
}
.thinking__glyph {
  display: inline-block;
  width: 10px;
  text-align: center;
  animation: glyph-pulse 1.1s ease-in-out infinite;
}
.thinking__glyph:nth-child(2) { animation-delay: 0.12s; }
.thinking__glyph:nth-child(3) { animation-delay: 0.24s; }
.thinking__glyph:nth-child(4) { animation-delay: 0.36s; }
@keyframes glyph-pulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50%      { opacity: 1;    transform: translateY(-2px); }
}
.thinking__label { letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) {
  .thinking__glyph { animation: none; opacity: 0.8; }
}

/* In-chat browser ------------------------------------------------------- */

/*
 * Progress rows normally live inside an assistant turn and inherit that
 * column's width. When one is created before the turn exists, or restored
 * after a repaint cleared it, it lands as a direct child of the transcript
 * instead, which has no width of its own. These rules give those rows the
 * same column so they never end up flush against the window edge.
 */
.transcript > .browser,
.transcript > .thinking,
.transcript > .approval,
.transcript > .image-grid,
.transcript > .compact-marker {
  width: min(var(--content-width), calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}

.browser {
  display: flex;
  flex-direction: column;
  margin: 10px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-deep);
}

.browser__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-raised);
}

.browser__url {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.browser__url:focus { border-color: var(--accent); color: var(--text); }

.browser__btn {
  flex: none;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.browser__btn:hover { background: var(--bg-hover-solid); color: var(--text); }

/* Tall enough to actually browse in, capped so it never eats the transcript. */
.browser__screen {
  display: block;
  width: 100%;
  background: #fff;
  cursor: pointer;
  outline: none;
  user-select: none;
}

.browser__status {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-size: 11px;
}

/*
 * Deliberately no dimming while a frame is in flight: at scroll cadence it
 * strobed. The status text carries the loading state instead.
 */
.browser.is-busy .browser__status { opacity: 0.5; }

/* Image results --------------------------------------------------------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin: 8px 0 14px;
}

.image-grid__item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}

.image-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 160ms ease;
}

.image-grid__item:hover img { transform: scale(1.04); }
