/* Tools around a conversation: waiting caption, table toolbar, question rail, shortcut sheet. */

/* Beside the waiting star, on its row, without moving anything: the caption is pulled up by exactly its own height. */
/* While the reply is on its way the star and this caption say it once; the other status lines stay for screen readers. */
.message.assistant:has(> .reply-elapsed) .message-state, .message.user[data-status="pending"]:has(+ .message.assistant) .message-state,
.conversation-column:has(.message.assistant:is([data-status="pending"], [data-status="streaming"])) .composer-state {
  position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.reply-elapsed {
  block-size: 24px; margin-block-start: -24px; margin-inline-start: calc(24px + var(--space-2));
  color: var(--color-muted); font-size: var(--text-caption); line-height: 24px; pointer-events: none;
}

/* Over the frame's top inline-end corner like the code copy, so a hidden toolbar reserves nothing. */
.markdown-table { position: relative; }
.table-tools { position: absolute; inset-block-start: var(--space-1); inset-inline-end: var(--space-1); display: flex; gap: var(--space-1); -webkit-user-select: none; user-select: none; }
.table-tools button {
  min-block-size: 28px; padding: 2px var(--space-3); border: 0; border-radius: var(--radius-full); background: var(--material-solid); box-shadow: var(--hairline);
  color: var(--color-ink); font-family: var(--font-sans); font-size: var(--text-caption);
  transition: color var(--motion-fast) ease, transform 80ms ease;
}
.table-tools button:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) {
  .table-tools { opacity: 0; pointer-events: none; transition: opacity var(--motion-fast) ease; }
  .markdown-table:hover > .table-tools, .markdown-table:focus-within > .table-tools { opacity: 1; pointer-events: auto; }
  .table-tools button:hover { color: var(--color-accent); }
}
/* On touch there is no hover to reveal it, so it gets its own row below the table instead of covering the header. */
@media (pointer: coarse) {
  .table-tools { position: sticky; inset-block-start: auto; inset-inline: 0; justify-content: flex-end; padding: var(--space-2); }
  .table-tools button { min-block-size: 44px; }
}

/* The rail only exists on a wide screen with a pointer. Each tick is a 3px line inside a 24px hit area. */
.question-rail {
  position: absolute; inset-block-start: 50%; inset-inline-end: var(--space-3); translate: 0 -50%; z-index: 1;
  display: grid; justify-items: end; max-block-size: calc(100% - 2 * var(--space-16));
}
.question-tick {
  position: relative; display: grid; align-content: center; inline-size: 16px; block-size: 24px; padding: 0; border: 0; background: none;
  transition: transform 80ms ease;
}
.question-tick::before {
  content: ""; block-size: 3px; border-radius: var(--radius-full); background: var(--color-fill-strong);
  transition: background-color var(--motion-fast) ease;
}
.question-tick.is-current { inline-size: 22px; }
.question-tick.is-current::before { background: var(--color-accent); }
.question-tick:active { transform: scale(.96); }
/* Toward the conversation, beside the tick; it never takes a click. */
.question-tip {
  position: absolute; inset-block-start: 50%; inset-inline-end: calc(100% + var(--space-3)); translate: 0 -50%;
  inline-size: max-content; max-inline-size: 280px; padding: var(--space-1) var(--space-3); overflow: hidden; border-radius: var(--radius-full);
  color: var(--color-ink); font-size: var(--text-caption); text-align: match-parent; text-overflow: ellipsis; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--motion-fast) ease;
}
.question-tick:focus-visible > .question-tip { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .question-tick:hover > .question-tip { opacity: 1; } }

/* Wider than the default sheet, but only where the sheet is a centred dialog; phones keep the bottom sheet. */
@media (min-width: 600px) { #shortcuts-dialog { inline-size: min(100% - 48px, 480px); } }
.shortcut-list { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.shortcut-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-block-size: 36px; font-size: var(--text-subhead); }
.shortcut-keys { display: flex; flex: none; gap: var(--space-1); }
.shortcut-keys kbd {
  min-inline-size: 28px; padding: 2px var(--space-2); border-radius: var(--radius-full); background: var(--color-fill);
  color: var(--color-muted); font-family: inherit; font-size: var(--text-caption); text-align: center;
}
