/* Main screen (Chat, Settings) and the newer setup pieces. Marochy: square, 1 px lines, one accent. */

.stage.flush { padding: 0; place-items: stretch; overflow: hidden; }
.meter.thin { height: 3px; margin-top: 8px; }
.meter.thin i { width: 0; transition: width 300ms var(--ease); }

/* ---- chat ---------------------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; overflow-x: hidden; }
.chat > * { min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.chat-head .grow { flex: 1; }
.msgs { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px; display: flex; flex-direction: column; gap: 18px; min-height: 0; min-width: 0; }
.msgs > * { flex-shrink: 0; min-width: 0; max-width: 100%; content-visibility: auto; contain-intrinsic-size: auto 120px; }
.msg { display: flex; flex-direction: column; gap: 8px; max-width: 100%; min-width: 0; }
.msg.user { align-items: flex-end; }
.bubble { max-width: 80%; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); white-space: pre-wrap; font-size: 14px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
/* Fork from one of Maro's messages: quiet until the message is hovered. */
.forkbtn { opacity: 0; padding: 3px 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; transition: opacity .12s ease, color .12s ease, border-color .12s ease; }
.msg.user:hover .forkbtn, .forkbtn:focus-visible { opacity: 1; }
.forkbtn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.forkbtn:disabled { opacity: .45; cursor: default; }
.msg.ai .txt { font: 15px/1.6 var(--sans); min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.msg.ai .txt p { margin: 0 0 10px; }
.msg.ai .txt p:last-child { margin-bottom: 0; }
.msg.ai .txt ul, .msg.ai .txt ol { margin: 0 0 10px; }
.msg.ai .txt code { background: var(--surface3); padding: 1px 5px; font-size: 13px; }
.msg.ai .txt pre { background: var(--surface); border: 1px solid var(--border); padding: 12px; font-size: 13px; }
.msg.ai .txt a { color: var(--fg); text-decoration-color: var(--accent); }
.msgerr { color: color-mix(in srgb, var(--accent) 70%, white); font-size: 13px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); }
.empty { margin: auto; display: grid; justify-items: center; gap: 16px; text-align: center; }
.empty h2 { margin: 0; font-size: 22px; }
.composer { display: flex; align-items: flex-end; gap: 10px; margin: 0 24px; padding: 10px; border: 1px solid var(--border); background: var(--surface); min-width: 0; width: calc(100% - 48px); box-sizing: border-box; }
.composer:focus-within { border-color: var(--faint); }
.composer textarea { flex: 1; min-width: 0; resize: none; field-sizing: content; overflow-y: auto; border: 0; outline: none; background: none; color: var(--fg); font: 15px/1.5 var(--mono); padding: 6px 4px; max-height: 180px; user-select: text; -webkit-user-select: text; }
.composer textarea::placeholder { color: var(--faint); }
.sendbtn { width: 42px; height: 42px; padding: 0; flex: none; }
.sendbtn.stopping { background: var(--surface3); color: var(--fg); }

/* ---- overlay, sheet ---------------------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, black 70%, transparent); display: grid; place-items: center; padding: 24px; animation: in 160ms var(--ease); }
.overlay > img { max-width: 100%; max-height: 100%; border: 1px solid var(--border); }
.sheet { width: min(620px, 100%); max-height: 100%; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--border); }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); font-size: 16px; }
.sheet-body { overflow-y: auto; padding: 18px; display: grid; gap: 12px; align-content: start; }
.sheet-body .m-section { margin: 6px 0 0; font-size: 12px; }
.connect { display: grid; gap: 14px; justify-items: start; padding: 8px 0; }
.connect h2 { margin: 0; font-size: 20px; }
/* ---- richer answers: headings, tables, quotes, pictures ---------------------------------------- */
.msg.ai .txt h3 { margin: 16px 0 8px; font: 600 17px/1.3 var(--sans); }
.msg.ai .txt h4 { margin: 14px 0 6px; font: 600 15px/1.3 var(--sans); color: var(--fg); }
.msg.ai .txt > :first-child { margin-top: 0; }
.msg.ai .txt hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.msg.ai .txt blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 2px solid var(--faint); color: var(--muted); }
.msg.ai .txt li > ul, .msg.ai .txt li > ol { margin: 4px 0 0; }
/* List markers sit outside the item, in the list's left padding, and every transcript entry clips what lies outside
   its box (content-visibility). A fixed 22px cut "12. " (four characters in the mono font) down to "2." (card
   20005209): the room is counted in characters, so it fits whatever the font. md.js marks lists that reach three
   digits or more. */
:is(.txt, .ask-plan, .btw-a) :is(ul, ol) { padding-left: 3ch; list-style-position: outside; }
:is(.txt, .ask-plan, .btw-a) ol { padding-left: 4.5ch; }
:is(.txt, .ask-plan, .btw-a) ol[data-digits="3"] { padding-left: 5.5ch; }
:is(.txt, .ask-plan, .btw-a) ol[data-digits="4"] { padding-left: 6.5ch; }
:is(.txt, .ask-plan, .btw-a) ol[data-digits="5"] { padding-left: 7.5ch; }
:is(.txt, .ask-plan, .btw-a) ol[data-digits="6"] { padding-left: 8.5ch; }
.tablewrap { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--border); }
.msg.ai .txt table, .rich-block table { border-collapse: collapse; width: 100%; font-size: 14px; }
.msg.ai .txt th, .msg.ai .txt td, .rich-block th, .rich-block td { padding: 7px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.msg.ai .txt th, .rich-block th { background: var(--surface2); font-weight: 600; border-top: 0; white-space: nowrap; }
.msg.ai .txt tbody tr:hover { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.mdimg { display: block; max-width: min(100%, 420px); max-height: 420px; margin: 6px 0; border: 1px solid var(--border); cursor: zoom-in; }
.mdimg.broken { display: none; }

/* ---- attachments and chat settings ------------------------------------------------------------- */
.chat.dropping .composer { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* ---- provider colours (sender tint) and the Claude-Code-style transcript ------------------------ */
:root { --c-claude: #d97757; --c-agy: #6ea8fe; --c-codex: #f2f2f2; --c-deepseek: #4d6bfe; --c-opencode: #a0a0a0; }
.sender { padding: 10px 14px; border-left: 3px solid var(--sc, var(--muted)); background: color-mix(in srgb, var(--sc, var(--muted)) 8%, transparent); }
.sender.from-claude { --sc: var(--c-claude); }
.sender.from-agy { --sc: var(--c-agy); }
.sender.from-codex { --sc: var(--c-codex); }
.sender.from-deepseek { --sc: var(--c-deepseek); }
.sender.from-opencode, .sender.from-metro { --sc: var(--c-opencode); }
.sender > small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11.5px; }
.sender .txt { font: 14px/1.55 var(--sans); }
.sender .txt p { margin: 0 0 10px; }
.sender .txt p:last-child { margin-bottom: 0; }
.sender .txt ul, .sender .txt ol { margin: 0 0 10px; }
.sender .txt code { background: var(--surface3); padding: 1px 5px; font-size: 13px; }
.sender .txt pre { background: var(--surface); border: 1px solid var(--border); padding: 12px; font-size: 13px; }
.sender .txt a { color: var(--fg); text-decoration-color: var(--accent); }
.sender .txt h3, .sender .txt h4 { margin: 14px 0 6px; font: 600 15px/1.3 var(--sans); }
.sender .txt blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 2px solid var(--faint); color: var(--muted); }
.sender .txt table { border-collapse: collapse; width: 100%; font-size: 14px; }
.sender .txt th, .sender .txt td { padding: 7px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.sender .txt th { background: var(--surface2); font-weight: 600; border-top: 0; white-space: nowrap; }

/* A message Maro sent while the agent works: queued (read after this turn) or steering (read at the next step). */
.qtag { padding: 2px 8px; border: 1px solid var(--border); color: var(--gold); font-size: 11px; white-space: nowrap; }
.qtag:has(.qtag-now) { display: inline-flex; align-items: center; gap: 8px; }
.qtag-now { padding: 1px 8px; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border)); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); font: inherit; font-size: 11px; cursor: pointer; }
.qtag-now:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.qtag.steering { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }

/* A background job (Bash run_in_background): one line when it starts and one when it settles. */
.bgjob { display: flex; align-items: baseline; gap: 8px; font: 13px var(--mono); color: var(--muted); }
.bgjob .bgdot { width: 12px; flex: none; text-align: center; }
.bgjob.started .bgdot { color: var(--accent); }
.bgjob.finished .bgdot { color: var(--teal); }
.bgjob.failed .bgdot { color: var(--red); }

/* Side questions (/btw): a popover beside the composer, never part of the transcript. */
.btw-pop { position: fixed; right: 24px; bottom: 104px; z-index: 25; width: min(440px, calc(100vw - 48px)); max-height: 60vh; overflow-y: auto; display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--accent); background: var(--surface); box-shadow: 0 18px 44px rgb(0 0 0 / .55); animation: btw-in 160ms var(--ease); }
@keyframes btw-in { from { opacity: 0; transform: translateY(6px); } }
.btw-pop header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btw-pop header b { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.btw-close { width: 24px; height: 24px; border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; }
.btw-close:hover { color: var(--fg); background: var(--surface2); }
.btw-q { margin: 0; padding-left: 10px; border-left: 2px solid var(--border); color: var(--muted); font: 13px/1.5 var(--mono); }
.btw-a { font: 14px/1.55 var(--sans); }
.btw-a p { margin: 0 0 10px; }
.btw-a p:last-child { margin: 0; }
.btw-a code { background: var(--surface3); padding: 1px 5px; font-size: 13px; }
.btw-wait { margin: 0; color: var(--faint); font-size: 13px; }
.btw-wait::before { content: "✻ "; color: var(--accent); }
.btw-err { margin: 0; color: color-mix(in srgb, var(--red) 75%, white); font-size: 13px; }
.btw-meta { padding-top: 8px; border-top: 1px solid var(--border); color: var(--faint); font: 11px var(--mono); }

/* Images Maro attached, as thumbnails inside his bubble; click to view full size. */
.bubble .bimgs, .sender .bimgs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin-top: 8px; }
.bubble .bimgs.solo, .sender .bimgs.solo { margin-top: 0; }
.msg.user .bimgs { justify-content: flex-end; }
.bimgs img { max-width: 180px; max-height: 180px; object-fit: cover; border: 1px solid var(--border); cursor: zoom-in; }
.bimgs .img-chip { display: inline-flex; align-items: center; justify-content: center; height: 22px; padding: 0 8px; font: 11px var(--mono); color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: 2px; }
.bimgs .img-chip.loading { opacity: 0.7; }
.md-image { cursor: zoom-in; display: block; max-width: 100%; max-height: 420px; object-fit: contain; border: 1px solid var(--border); }
.chat-image { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.markdown-image { max-width: min(100%, 420px); margin: 6px 0; }
.rich-image-frame { display: block; }
.chat-image > img { -webkit-touch-callout: none; user-select: none; }
.chat-image > img:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.image-actions { position: absolute; top: 6px; right: 6px; display: flex; border: 1px solid var(--border); background: var(--surface); opacity: 0; pointer-events: none; }
.image-actions .m-btn { height: 28px; min-width: 0; padding: 0 6px; font: 11px var(--mono); border: 0; }
.image-actions .m-btn + .m-btn { border-left: 1px solid var(--border); }
.chat-image:focus-within > .image-actions { opacity: 1; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) {
  .chat-image:hover > .image-actions { opacity: 1; pointer-events: auto; }
}

/* Tool calls: one terminal-style line each (no collapsing group). */
.tool { font: 13px var(--mono); min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.tool + .tool { margin-top: -12px; }
.tline { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; cursor: pointer; min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.tline:hover .tname { color: var(--fg); }
.tdot { width: 12px; flex: none; text-align: center; }
.tdot.run { color: var(--accent); animation: pulse 1.2s var(--ease) infinite; }
.tdot.ok { color: var(--teal); }
.tdot.err { color: var(--red); }
.tname { color: var(--muted); min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.tresult { color: var(--faint); font-size: 12px; padding-left: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tbody { margin: 4px 0 8px 20px; padding: 8px 10px; border-left: 2px solid var(--border); display: grid; gap: 6px; }
.tbody b { color: var(--faint); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
.tbody pre { margin: 0; padding: 8px; background: var(--bg); border: 1px solid var(--border); overflow: auto; max-height: 260px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; min-width: 0; max-width: 100%; }

/* The live "it's working" line in the transcript: spark, verb, elapsed and tokens in light purple. */
.statusline { display: flex; align-items: center; gap: 8px; padding: 2px 0; font: 13px var(--mono); color: color-mix(in srgb, var(--accent) 55%, var(--fg)); width: 100%; min-width: 0; box-sizing: border-box; }
.statusline .spark { width: 16px; flex: none; color: var(--accent); font-weight: 700; }
.statusline .sl-verb { color: color-mix(in srgb, var(--accent) 55%, var(--fg)); min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.statusline .sl-tool { color: var(--faint); min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.statusline .sl-meta { color: var(--faint); font-size: 12px; }

/* Live working indicator just above the composer: one line per working/waiting agent, hidden when everyone is idle. */
.work-indicator { flex: none; display: grid; gap: 2px; margin: 0 max(24px, calc((100% - 960px) / 2)) 6px; padding: 5px 10px; border: 1px solid var(--border); background: var(--surface); min-width: 0; width: min(960px, calc(100% - 48px)); box-sizing: border-box; }
.work-indicator[hidden], .work-indicator:empty { display: none; }
.work-line { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 3px 4px; border: 0; background: none; color: var(--muted); font: 12.5px/1.4 var(--mono); text-align: left; cursor: pointer; }
.work-line:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); color: var(--fg); }
.work-spin { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 28%, transparent); border-top-color: var(--accent); animation: spin 780ms linear infinite; }
.work-wait-dot { width: 7px; height: 7px; margin: 0 2.5px; flex: none; border-radius: 50%; background: var(--accent); }
.work-name { color: var(--fg); font-weight: 600; flex: none; white-space: nowrap; }
.work-sep { color: var(--faint); flex: none; }
.work-step { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.work-elapsed { color: var(--faint); flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-wait { color: var(--accent); font-weight: 600; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .work-spin { animation: none !important; border-color: var(--accent); }
}

/* A usage limit stopped this agent: one quiet line under the transcript, with a way out. */
.autocontinue { display: flex; align-items: center; gap: 7px; padding: 3px 0 1px; font: 12.5px var(--mono); color: var(--faint); }
.autocontinue .ac-clock { color: var(--gold); flex: none; }
.autocontinue .ac-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.autocontinue .ac-cancel { flex: none; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.autocontinue .ac-cancel:hover { color: var(--fg); }

.composer { position: relative; z-index: 5; gap: 8px; }
.sendbtn.stopping { background: var(--surface3); color: var(--fg); box-shadow: inset 0 0 0 1px var(--faint); }
.sendbtn.stopping:hover { background: color-mix(in srgb, var(--accent) 22%, var(--surface3)); }
.chat:not([data-working]) .tdot.run { animation: none; }

/* Context meter in chat header */
.context-meter-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.context-meter-wrap { position: relative; }
.context-meter-trigger { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.context-meter-trigger:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.context-meter-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: min(300px, calc(100vw - 32px)); max-height: min(320px, 60vh); overflow-y: auto; padding: 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface2); box-shadow: var(--shadow); color: var(--fg); text-align: left; }
.context-meter-popover-title { display: block; padding: 4px 8px 8px; color: var(--accent); font: 11px var(--mono); }
.context-meter-detail { padding: 5px 8px; color: var(--muted); font: 11px var(--mono); }
.context-meter-estimate { display: block; padding: 8px; color: var(--faint); font: 10px var(--mono); line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.context-meter-bar { width: 56px; height: 4px; background: var(--surface3); border: 1px solid var(--border); overflow: hidden; display: flex; }
.context-meter-fill { height: 100%; display: block; background: var(--muted); transition: width 200ms ease; }
.context-meter-fill.level-normal { background: var(--accent); }
.context-meter-fill.level-amber { background: var(--gold); }
.context-meter-fill.level-red { background: var(--red); }
.context-meter-text { font-family: var(--mono); color: var(--muted); }
.context-meter-text.level-amber { color: var(--gold); font-weight: 600; }
.context-meter-text.level-red { color: var(--red); font-weight: 600; }
.compact-chip { height: 22px; padding: 0 8px; font-size: 11px; background: color-mix(in srgb, var(--red) 20%, var(--surface2)); border: 1px solid var(--red); color: var(--fg); font-weight: 600; cursor: pointer; }
.compact-chip:hover { background: var(--red); color: #fff; }

.ch-cleared { color: var(--faint); font: 12px var(--mono); text-align: center; margin: 12px 0; }

.sender .txt { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.ch-note { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* Fences wrap with indentation intact. Reserve a column for the floating Copy control. */
.msg.ai .txt pre.code-block, .sender .txt pre.code-block, .btw-a pre.code-block, .ask-plan pre.code-block {
  position: relative; max-width: 100%; margin: 12px 0; padding: 44px 78px 14px 14px; overflow-x: hidden;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  border: 1px solid var(--border); background: var(--bg); font: 12.5px/1.65 var(--mono);
}
.msg.ai .txt pre > code, .sender .txt pre > code, .btw-a pre > code, .ask-plan pre > code {
  display: block; padding: 0; background: none; color: var(--fg); font: inherit; white-space: inherit;
}
.code-lang { position: absolute; left: 14px; top: 11px; color: var(--faint); font: 11px var(--mono); }
.code-copy { position: absolute; right: 10px; top: 8px; width: 60px; height: 26px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 11px var(--mono); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 120ms; white-space: nowrap; }
.code-hover > .code-copy, .code-copy:focus-visible, .code-touch > .code-copy { opacity: 1; pointer-events: auto; }
.code-touch > .code-copy { top: 8px !important; }
.code-copy:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
@media (hover: none) {
  .code-copy { top: 8px !important; opacity: 1; pointer-events: auto; }
}
.code-copy:hover { background: var(--surface2); color: var(--fg); }
.hl-comment { color: var(--faint); }
.hl-keyword, .hl-tag, .hl-diff-hunk { color: var(--accent); }
.hl-string, .hl-diff-add { color: var(--teal); }
.hl-number, .hl-attr { color: var(--gold); }
.hl-diff-del { color: var(--red); }
.md-table { display: block; max-width: 100%; overflow-x: auto; }
.txt h1, .txt h2 { margin: 18px 0 10px; font: 600 18px/1.4 var(--mono); }

/* Full-size image viewer and the `show` tool's results */
.image-viewer { padding: 0; overflow: hidden; z-index: 90; grid-template: minmax(0, 1fr) / minmax(0, 1fr); background: color-mix(in srgb, black 94%, transparent); touch-action: none; }
.image-viewer > img { grid-area: 1 / 1; max-width: none; max-height: none; border: 0; user-select: none; }
.image-viewer.zoomed > img { cursor: grab; }
.image-viewer.zoomed > img:active { cursor: grabbing; }
.image-viewer-toolbar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 8px; border: 1px solid var(--border); background: var(--surface); }
.image-viewer-label { min-width: 0; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 12px var(--mono); }
.image-viewer-toolbar button { flex-shrink: 0; white-space: nowrap; }
.image-viewer-toolbar button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
html.phone .overlay.image-viewer { padding: 0; background: transparent; }
html.phone .image-viewer-backdrop { position: absolute; inset: 0; background: var(--bg); pointer-events: none; }
html.phone .image-viewer > img { position: relative; z-index: 1; border-radius: 0; }
html.phone .image-viewer-toolbar { z-index: 2; bottom: 0; left: 0; transform: none; width: 100%; max-width: none; box-sizing: border-box; gap: 4px; padding: 8px 8px max(12px, env(safe-area-inset-bottom)); border-radius: 0; color: var(--fg); transition: opacity 160ms; }
html.phone .image-viewer-toolbar button { min-width: 44px; min-height: 44px; padding: 0 8px; border-radius: 0; background: var(--surface); color: var(--fg); border-color: var(--border); }
html.phone .image-viewer-toolbar button:hover { background: var(--bg); }
html.phone .image-viewer-label { flex: 1; max-width: none; }
html.phone .image-viewer.toolbar-hidden .image-viewer-toolbar { opacity: 0; pointer-events: none; }
.rich-caption { color: var(--muted); font-size: 12px; }
.rich-block { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.rich-title { font: 600 12px var(--mono); color: var(--fg); }
.rich-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-width: 860px; }
.rich-gallery figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rich-gallery:has(figure:only-child) { grid-template-columns: minmax(0, 520px); }
.rich-image { display: block; width: 100%; max-height: 360px; object-fit: contain; border: 1px solid var(--border); cursor: zoom-in; }
.rich-table-wrap { overflow-x: auto; max-width: 100%; }

/* The top of a long chat that is only partly drawn (card 90001285). */
.msgs-more { align-self: center; margin: 6px 0 10px; padding: 4px 12px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: 11px var(--mono); cursor: pointer; }
.msgs-more:hover { color: var(--fg); background: var(--surface2); }
