/* The chat (design/redesign-2026-10/theme.css: composer, chat timeline, screen: game chat; NOTES.md §9).
   Follows T3 Code's chat/ComposerSurface.tsx, ChatComposer.tsx, ComposerPrimaryActions.tsx,
   ComposerAttachmentStrip.tsx, ComposerBanner.tsx, MessagesTimeline.tsx, TimelineUserMessageRow.tsx,
   TimelineAssistantRows.tsx, TimelineWorkGroupRows.tsx, WorkLog.tsx, V2LifecycleRow.tsx and index.css
   (live-tool-shine). The composer's classes are shared: the Overview's master composer and the
   library's note composer use them too. */

/* ---------------------------------------------------------------- composer (T3 ComposerSurface + ChatComposer) */
.composer-dock {
  position: sticky;
  bottom: 0;
  z-index: 15;
  padding: 0 var(--gutter) 16px;
  background: linear-gradient(to bottom, transparent, var(--bg) 22px);
}
.composer-shell {
  position: relative;
  width: 100%;
  max-width: var(--lane);
  margin: 0 auto;
}
.composer {
  position: relative;
  z-index: 2;
  border-radius: var(--r-6);
  background: var(--surface);
  box-shadow: var(--shadow-composer);
  transition: box-shadow var(--t-med) var(--ease);
}
.composer:focus-within {
  box-shadow: var(--shadow-composer), 0 0 0 3px var(--accent-soft);
}
.composer-input {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 40dvh;
  padding: 16px 18px 4px;
  border: 0;
  background: none;
  resize: none;
  field-sizing: content; /* grows with the text up to max-height */
  font-size: 16px; /* 16 px keeps iOS from zooming on focus (T3 --font-size-prompt-touch) */
  line-height: 1.5;
  color: var(--ink);
}
.composer-input:focus {
  outline: none;
}
.composer-input::placeholder {
  color: var(--ink-4);
}
.composer-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px 10px;
}
.composer-foot .hint {
  margin-left: auto;
  margin-right: 6px;
  font-size: var(--fs-12);
  color: var(--ink-4);
  white-space: nowrap;
}
.composer-foot .hint + .send,
.composer-foot .hint + .stop {
  margin-left: 0;
}
.composer-foot .target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-13);
  font-weight: 560;
  color: var(--ink-3);
}
.composer-foot .target:hover {
  background: var(--hover);
  color: var(--ink);
}
/* T3 ComposerPrimaryActions.tsx: round send (up arrow), round red stop (square), queue (list-plus) */
.send,
.stop {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  transition-property: background-color, scale, opacity;
  transition-duration: var(--t-fast);
  transition-timing-function: var(--ease);
}
.send {
  margin-left: auto;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(120, 50, 20, 0.22);
}
.send:hover {
  background: var(--accent-hover);
  scale: 1.05;
}
.send:active,
.stop:active {
  scale: 0.96;
}
.send:disabled {
  opacity: 0.4;
  scale: 1;
}
.send .i {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}
.stop {
  margin-left: auto;
  color: #fff;
  background: oklch(0.58 0.19 var(--hue-red));
  box-shadow: 0 1px 2px oklch(0.5 0.19 var(--hue-red) / 0.3);
}
.stop:hover {
  background: oklch(0.54 0.19 var(--hue-red));
}
.stop + .send {
  margin-left: 6px;
}
.stop svg {
  width: 12px;
  height: 12px;
}
/* T3 ComposerAttachmentStrip.tsx: 64 px thumbs, remove at the top right, name over the bottom */
.attach-strip {
  display: flex;
  gap: 8px;
  padding: 12px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.attach-strip::-webkit-scrollbar {
  display: none;
}
.attach {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: var(--r-3);
  background: var(--stage);
  overflow: hidden;
}
.attach::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--img-outline);
}
.attach > svg {
  width: 100%;
  height: 100%;
}
.attach .name {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2px 4px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach .x {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 20, 18, 0.62);
}
.attach .x::after {
  content: '';
  position: absolute;
  inset: -8px;
}
.attach .x .i {
  width: 12px;
  height: 12px;
  stroke-width: 2.25;
}
.attach .play-sm {
  position: absolute;
  left: 50%;
  top: 42%;
  translate: -50% -50%;
  color: #fff;
}
.attach .play-sm .i {
  width: 16px;
  height: 16px;
}
/* T3 ComposerBanner.tsx placement="attached": a tab tucked under the composer's top edge */
.banner-dock {
  position: relative;
  z-index: 1;
  width: calc(100% - 44px);
  margin: 0 auto -16px;
}
.banner {
  padding: 8px 10px 24px;
  border-radius: 16px 16px 0 0;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.banner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 4px;
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--ink-3);
}
.banner-head .icon-btn {
  margin-left: auto;
}
.banner-head [aria-expanded='false'] .i {
  rotate: 180deg;
}
.queued {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 4px;
  border-radius: var(--r-2);
  font-size: var(--fs-13);
}
.queued:hover {
  background: var(--hover);
}
.queued .grip {
  color: var(--ink-4);
  cursor: grab;
}
.queued .who {
  flex: none;
  font-weight: 600;
  color: var(--ink-2);
}
.queued .text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.queued .acts {
  display: inline-flex;
  gap: 2px;
}

/* ---------------------------------------------------------------- chat timeline (T3 MessagesTimeline) */
.chat-scroll {
  flex: 1;
  padding: 8px var(--gutter) 24px;
}
.lane {
  width: 100%;
  max-width: var(--lane);
  margin: 0 auto;
}
.tl-row {
  padding-bottom: 16px;
}
.tl-row.is-tight {
  padding-bottom: 8px;
}
/* day and status dividers (T3 ContextCompactionTimelineRow) */
.tl-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 18px;
  font-size: var(--fs-12);
  color: var(--ink-3);
}
.tl-divider::before,
.tl-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line-2);
}
.tl-divider > span {
  max-width: 82%;
  text-align: center;
  line-height: 1.5;
  text-wrap: balance;
}
.tl-divider > span > .i {
  display: inline-block;
  margin: 0 4px -2px 0;
}
.tl-divider b {
  color: var(--ink-2);
  font-weight: 600;
}
/* people's messages (T3 TimelineUserMessageRow): right-aligned bubble, sender above, meta on hover */
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.msg-from {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 80%;
  padding-right: 4px;
  font-size: var(--fs-12);
  color: var(--ink-3);
}
.msg-from b {
  font-weight: 650;
  color: var(--ink-2);
}
.msg-from .via {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bubble {
  position: relative;
  min-width: 0;
  max-width: 80%;
  padding: 11px 14px;
  border-radius: var(--r-5);
  background: var(--bubble);
  font-size: var(--fs-15);
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.bubble.is-collapsed {
  max-height: 176px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.bubble .pics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-width: 220px;
  margin-bottom: 8px;
}
.bubble .pics .media {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-2);
}
.bubble .pics .media.is-wide {
  grid-column: 1 / -1;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  font-size: var(--fs-12);
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}
.msg-user:hover .msg-meta,
.msg-bot:hover .msg-meta,
.msg-meta:focus-within {
  opacity: 1;
}
@media (pointer: coarse) {
  .msg-meta {
    opacity: 1;
  }
}
.msg-meta .icon-btn {
  width: 26px;
  height: 26px;
}
.msg-meta .icon-btn .i {
  width: 14px;
  height: 14px;
}
/* the agent's words (T3 TimelineAssistantRows): no bubble, serif, full lane */
.msg-bot {
  padding: 2px 4px 0;
}
.msg-bot .prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  line-height: 1.4;
}
.table-scroll {
  overflow-x: auto;
  margin: 0.9em 0;
  border-radius: var(--r-3);
  box-shadow: inset 0 0 0 1px var(--line);
}
.prose th,
.prose td {
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
.prose th {
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
}
.prose tr + tr td {
  box-shadow: inset 0 1px 0 var(--line);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.media-grid figure {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.media-grid figcaption {
  font-size: var(--fs-12);
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* T3 ContextChip.tsx: an inline reference to a thing (an asset version, a card) */
.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 34px;
  margin-top: 12px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  color: var(--ink-2);
}
.ref-chip .trunc {
  flex: 1;
}
.ref-chip .go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.ref-chip .go:hover {
  background: var(--accent-soft);
}
/* the streaming caret */
.caret {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.16em;
  border-radius: 2px;
  background: var(--ink);
  animation: caret 1s steps(2, start) infinite;
}
@keyframes caret {
  to {
    visibility: hidden;
  }
}
/* turn fold (T3 TurnFoldTimelineRow): "Worked for 3m 12s" with a hairline under it */
.turn-fold {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  margin-bottom: 10px;
  padding: 0 2px 4px;
  box-shadow: inset 0 -1px 0 var(--line);
  font-size: var(--fs-14);
  color: var(--ink-3);
}
.turn-fold button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 6px;
  margin-left: -6px;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
  transition: color var(--t-fast) var(--ease);
}
.turn-fold button:hover {
  color: var(--ink);
}
.turn-fold .chev {
  transition: rotate var(--t-med) var(--ease);
}
.turn-fold [aria-expanded='true'] .chev {
  rotate: 90deg;
}
.turn-fold .when {
  margin-left: auto;
  font-size: var(--fs-12);
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
/* work log rows (T3 WorkLog.tsx / TimelineWorkEntryRow.tsx): 24 px icon column, one truncated line */
.work,
.work-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.work {
  margin: -4px 0 12px;
}
.work-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 1px 2px;
  border-radius: 7px;
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--ink-3);
  text-align: left;
  width: 100%;
}
.work-row > .ico {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--ink-4);
}
.work-row > .ico .i {
  width: 16px;
  height: 16px;
}
.work-row .what {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.work-row .what em {
  font-style: normal;
  color: var(--ink-2);
}
.work-row .when {
  font-size: var(--fs-12);
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}
.work-row:hover .when {
  opacity: 1;
}
.work-row.is-failed > .ico {
  color: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red));
}
button.work-row:hover {
  color: var(--ink);
}
.work-group {
  max-height: min(18rem, 50dvh);
  overflow-y: auto;
  margin-left: 30px;
  padding: 2px 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}
.work-detail {
  margin: 2px 0 6px 30px;
  padding: 10px 12px;
  border-radius: var(--r-3);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  overflow-x: auto;
  white-space: pre;
}
/* the live line (T3 live-tool-shine): a sheen runs across the current tool's words */
.shine {
  color: transparent;
  background-image: linear-gradient(to right, transparent, var(--ink), transparent), linear-gradient(var(--ink-3), var(--ink-3));
  background-size: 4.5rem 100%, 100% 100%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 2.2s steps(30) infinite;
}
@keyframes shine {
  from {
    background-position: -4.5rem 0, 0 0;
  }
  to {
    background-position: calc(100% + 4.5rem) 0, 0 0;
  }
}
/* the working row (T3 WorkingTimelineRow): "Working for 1m 24s" */
.working {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 30px;
  padding: 2px 2px 8px;
  box-shadow: inset 0 -1px 0 var(--line);
  font-size: var(--fs-14);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
/* a worker running for the ORCH (T3 V2LifecycleRow subagent row) */
.worker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 0 0 12px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.worker .who {
  position: relative;
}
.worker .who .dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 2px var(--surface);
}
.worker .body {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.worker .body b {
  font-size: var(--fs-14);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.worker .body span {
  font-size: var(--fs-13);
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- screen: game chat */
.chat-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.chat-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 16px 0 22px;
}
.chat-bar .seg button .dot {
  width: 7px;
  height: 7px;
}
.chat-bar .end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-13);
  font-weight: 560;
  color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--line);
}
.acct-chip:hover {
  color: var(--ink);
  background: var(--hover);
}
.ctx {
  display: none;
}
@media (min-width: 1360px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr) 312px;
  }
  .ctx {
    position: sticky;
    top: 113px;
    align-self: start;
    display: grid;
    gap: 12px;
    max-height: calc(100dvh - 113px);
    overflow-y: auto;
    padding: 20px 20px 24px 0;
    scrollbar-width: thin;
  }
}
.ctx-box {
  padding: 14px 14px 12px;
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.ctx-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: var(--fs-13);
  font-weight: 650;
  color: var(--ink-2);
}
.ctx-box h3 a {
  margin-left: auto;
  font-size: var(--fs-12);
  font-weight: 560;
  color: var(--ink-3);
}
.ctx-box h3 a:hover {
  color: var(--ink);
}
.ctx-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  font-size: var(--fs-13);
}
.ctx-line + .ctx-line {
  box-shadow: inset 0 1px 0 var(--line);
}
.ctx-line .body {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.ctx-line .body b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctx-line .body span {
  color: var(--ink-3);
  font-size: var(--fs-12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctx-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 12px;
}
.col-counts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.col-counts > a {
  display: grid;
  gap: 4px;
  padding: 8px 6px 7px;
  border-radius: var(--r-2);
  background: var(--surface-2);
  text-align: center;
}
.col-counts b {
  font-size: var(--fs-17);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.col-counts span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.col-counts .dot {
  width: 6px;
  height: 6px;
}

/* ---------------------------------------------------------------- the build's own pieces */
/* the chat page fills the game's body; the timeline scrolls with the page */
.chat-layout {
  min-width: 0;
}
.chat-col {
  min-height: calc(100dvh - 113px);
}
.chat-layout.is-master .chat-col {
  min-height: 100dvh;
}
.chat-layout.is-master .ctx {
  top: 0;
  max-height: 100dvh;
}
.chat-scroll {
  min-width: 0;
}
.chat-col.is-drop .composer {
  box-shadow: var(--shadow-composer), 0 0 0 3px var(--accent-soft), inset 0 0 0 2px var(--accent);
}
.chat-earlier {
  display: flex;
  margin: 0 auto 14px;
}
.chat-empty {
  padding: 24px 0 8px;
}
.tl-rows > *,
.tl-local > * {
  min-width: 0;
}

/* the chat bar: the session switch and the account chip; on the master its name */
.chat-bar .seg button {
  min-height: 30px;
}
.chat-bar.is-master {
  padding-top: 22px;
}
.chat-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 450;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.chat-title .i {
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.acct-chip .status {
  height: 20px;
  margin-right: -4px;
  padding: 0 7px 0 6px;
}
.acct-chip .status::before {
  width: 6px;
  height: 6px;
}
span.acct-chip:hover {
  color: var(--ink-3);
  background: none;
}

/* status lines: a failure reads red, the day line is plain */
.tl-divider.is-error {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}
.tl-divider.is-error::before,
.tl-divider.is-error::after {
  background: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red) / 0.35);
}
.tl-divider > span > .i {
  vertical-align: -2px;
}
/* a factory message: a quiet line that opens */
.tl-row.notice .tl-divider > span {
  min-width: 0;
}
.notice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  padding: 2px 6px;
  border-radius: var(--r-2);
  color: var(--ink-3);
  text-align: left;
  line-height: 1.45;
}
.notice-btn:hover {
  color: var(--ink);
  background: var(--hover);
}
.notice-btn b {
  color: var(--ink-2);
  font-weight: 600;
}
.notice-body {
  margin: -8px 0 18px;
  padding: 12px 16px;
  border-radius: var(--r-4);
  background: var(--surface-2);
  font-size: 15px;
}

/* people's messages */
.bubble-text > * + * {
  margin-top: 0.55em;
}
.bubble-text ul,
.bubble-text ol {
  padding-left: 1.3em;
}
.bubble-text a,
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}
.bubble-text code {
  font-family: var(--font-mono);
  font-size: 0.86em;
}
.bubble .pics .media,
.media-grid .media {
  width: 100%;
  padding: 0;
  border: 0;
  cursor: zoom-in;
}
.bubble .pics .media > img,
.media-grid .media > img {
  object-fit: cover;
}
.media.is-file {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  cursor: pointer;
}
.media.is-file::after {
  box-shadow: inset 0 0 0 1px var(--line);
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 0 8px;
  font-size: var(--fs-13);
  color: var(--ink-2);
}
.media-grid .thumb-blank,
.pics .thumb-blank {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font: 600 11px/1 var(--font-sans);
  color: #cfccc3;
}
.msg-more {
  margin-top: -2px;
  padding-right: 4px;
  font-size: var(--fs-13);
}
.msg-meta.is-on {
  opacity: 1;
}
.msg-user.is-local .bubble {
  opacity: 0.72;
}
.msg-user.is-local[data-state='failed'] .bubble {
  opacity: 1;
  box-shadow: inset 0 0 0 1px oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red) / 0.45);
}
.msg-fail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}

/* the agent's words: Markdown in serif */
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  font-weight: 650;
  line-height: 1.35;
  margin-top: 1.1em;
}
.prose h3 {
  font-size: var(--fs-17);
}
.prose blockquote {
  margin: 0.9em 0;
  padding: 2px 0 2px 14px;
  box-shadow: inset 2px 0 0 var(--line-2);
  color: var(--ink-2);
}
.prose hr {
  height: 1px;
  margin: 1.2em 0;
  border: 0;
  background: var(--line);
}
.prose del {
  color: var(--ink-3);
}
/* tables scroll inside themselves; code blocks carry Copy (anywhere Markdown renders) */
.table-scroll {
  overflow-x: auto;
  margin: 0.9em 0;
  border-radius: var(--r-3);
  box-shadow: inset 0 0 0 1px var(--line);
}
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  line-height: 1.4;
}
.table-scroll th,
.table-scroll td {
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
.table-scroll th {
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
}
.table-scroll tr + tr td,
.table-scroll tbody tr:first-child td {
  box-shadow: inset 0 1px 0 var(--line);
}
.code-block {
  margin: 0.9em 0;
  border-radius: var(--r-3);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 4px 0 12px;
  box-shadow: inset 0 -1px 0 var(--line);
  font: 500 var(--fs-12) / 1 var(--font-sans);
  color: var(--ink-3);
}
.code-head .icon-btn {
  margin-left: auto;
}
.code-block pre {
  margin: 0;
  padding: 10px 12px 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.prose .code-block code,
.code-block code {
  padding: 0;
  background: none;
  box-shadow: none;
  font-size: inherit;
}

/* work rows */
button.work-row {
  cursor: pointer;
}
button.work-row .chev {
  width: 15px;
  height: 15px;
  color: var(--ink-4);
  transition: rotate var(--t-med) var(--ease);
}
button.work-row[aria-expanded='true'] .chev {
  rotate: 180deg;
}
.work-row .what em.mono {
  font-size: 0.88em;
}
.work-row:focus-visible {
  border-radius: 7px;
}
.turn-fold .chev {
  width: 15px;
  height: 15px;
}
.working [data-working] {
  font-variant-numeric: tabular-nums;
}
.worker .status {
  flex: none;
}

/* references */
.ref-chip + .ref-chip {
  margin-left: 6px;
}
.ref-chip:hover {
  box-shadow: var(--shadow-2);
}

/* the composer: attachments, the jump to the newest message, the banner tab */
.attach > img,
.attach > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attach-file {
  position: absolute;
  inset: 0 0 18px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  background: var(--surface-2);
}
.attach[data-state='queued'],
.attach[data-state='uploading'] {
  opacity: 0.75;
}
.attach[data-state='failed'] {
  box-shadow: 0 0 0 2px oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red));
}
.attach .bar {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 20px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}
.attach .bar i {
  display: block;
  height: 100%;
  background: #fff;
  transition: width var(--t-med) var(--ease);
}
.composer-foot .icon-btn[aria-pressed='true'] {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
  background: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red) / var(--tone-fill-a));
}
.send .i {
  width: 17px;
  height: 17px;
}
.chat-jump {
  position: absolute;
  left: 50%;
  top: -46px;
  z-index: 3;
  translate: -50% 0;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
}
.banner-head.is-notice {
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: 4px;
  color: var(--ink-2);
  font-weight: 500;
  line-height: 1.45;
}
.banner-head.is-notice > .i {
  margin-top: 2px;
}
.banner-head.is-bad {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}
.banner-head .banner-t {
  flex: 1;
  min-width: 0;
  text-wrap: pretty;
}
.banner-head .btn {
  flex: none;
}
.banner-head + .banner-head {
  margin-top: 4px;
  box-shadow: inset 0 1px 0 var(--line);
  padding-top: 4px;
}
.banner-head [aria-expanded='true'] .i {
  rotate: 0deg;
}
.banner-head [aria-expanded='false'] .i {
  rotate: 180deg;
}
.queue-list {
  display: grid;
  max-height: min(14rem, 30dvh);
  overflow: hidden auto;
  scrollbar-width: thin;
}
.queued .acts .icon-btn.is-sm::after {
  inset: -4px 0;
}

/* the setup checklist of a new game, above its chat */
.setup {
  margin: 0 0 22px;
  padding: 4px 0;
}
.setup-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 48px;
  padding: 6px 10px 6px 16px;
}
.setup-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-2);
  color: var(--ink-3);
  background: var(--surface-2);
}
.setup-id {
  display: grid;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.setup-t {
  font-weight: 650;
}
.setup-sum {
  font-size: var(--fs-13);
  color: var(--ink-3);
}
.setup-meter {
  flex: 0 1 140px;
  min-width: 80px;
}
.setup-acts {
  display: inline-flex;
  gap: 2px;
}
.setup-steps {
  margin: 0 16px 8px;
}
.setup-step {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 4px 12px;
  min-height: 38px;
  padding: 6px 0;
  font-size: var(--fs-14);
}
.setup-step .dot {
  margin-left: 3px;
}
.setup-label {
  font-weight: 560;
}
.setup-step[data-state='pending'] .setup-label,
.setup-step[data-state='skipped'] .setup-label {
  color: var(--ink-3);
}
.setup-detail {
  font-size: var(--fs-13);
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-step[data-state='failed'] .setup-detail {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
  white-space: normal;
}
.setup-fix {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 4px 4px 10px;
  border-radius: var(--r-2);
  background: var(--surface-2);
}
.setup-fix code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-2);
}

/* the context panel's own bits */
a.ctx-line {
  margin: 0 -6px;
  padding: 0 6px;
  border-radius: var(--r-2);
  transition: background-color var(--t-fast) var(--ease);
}
a.ctx-line:hover {
  background: var(--hover);
}
a.ctx-line + a.ctx-line,
a.ctx-line + .ctx-line,
.ctx-line + a.ctx-line {
  box-shadow: none;
}
.ctx-line.is-flat {
  min-height: 0;
  padding-bottom: 8px;
}
.ctx-media {
  display: block;
  aspect-ratio: 16 / 8;
}
.ctx-acct + .ctx-acct {
  margin-top: 10px;
}
.ctx-acct .meter {
  margin-top: 2px;
}
.col-counts > a:hover {
  background: var(--surface-3);
}

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 1023px) {
  .chat-col {
    min-height: calc(100dvh - var(--bar-h) - 46px);
  }
  .chat-layout.is-master .chat-col {
    min-height: calc(100dvh - var(--bar-h));
  }
}
@media (max-width: 720px) {
  .bubble,
  .msg-from {
    max-width: 88%;
  }
  .composer-dock {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .composer-foot .hint {
    display: none;
  }
  .prose {
    font-size: 16px;
  }
  .chat-bar {
    padding: 12px 0 16px;
  }
  .chat-bar .end {
    margin-left: 0;
  }
  .chat-title {
    font-size: var(--fs-20);
  }
  .setup-step {
    grid-template-columns: 14px minmax(0, 1fr);
  }
  .setup-detail {
    grid-column: 2;
  }
  .setup-meter {
    flex-basis: 100%;
    order: 3;
  }
}
@media (prefers-reduced-motion: reduce) {
  .caret {
    animation: none;
  }
}
.media.is-file .file-chip {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  max-width: calc(100% - 12px);
  padding: 0;
  font-size: var(--fs-12);
  text-align: center;
}
.media.is-file .file-chip .trunc {
  max-width: 100%;
}
