/* A Code session's live transcript (public/code-trace.js), like Claude Code
   and Codex in VS Code: quiet chrome at the menu's size, readable monospace
   for commands, output and diffs; phone and desktop. */
/* The transcript never widens its message: long lines scroll inside their own box. */
.code-trace-host { width: 100%; max-width: 860px; min-width: 0; }
.msg .msg-body:has(> .code-trace-host) { width: 100%; }
#code-trace-live { box-sizing: border-box; }
.code-trace { --ct-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; min-width: 0; margin: 4px 0 12px; font-size: 14px; color: var(--ink-2); }
.code-trace code, .code-trace pre { font-family: var(--ct-mono); }
.ct-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.ct-step, .ct-plan, .ct-changed, .ct-body { min-width: 0; }

/* One step: a row that opens. */
.ct-step { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; }
.ct-step > summary { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; cursor: pointer; list-style: none; color: var(--ink-2); }
.ct-step > summary::-webkit-details-marker { display: none; }
.ct-step > summary:hover { background: var(--hover); }
.ct-step > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.ct-icon { flex: none; display: grid; place-items: center; width: 18px; height: 18px; color: var(--ink-3); }
.ct-icon svg { width: 16px; height: 16px; }
.ct-verb { flex: none; color: var(--ink-2); }
.ct-step summary code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink); }
.ct-cmd::before { content: "$ "; color: var(--ink-3); }
.ct-state { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.ct-state.is-failed { color: var(--red, #dc2626); }
.ct-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink-2); animation: ct-spin .9s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ct-spin { animation: none; } }
.ct-stat { margin-left: auto; flex: none; display: inline-flex; gap: 6px; font-family: var(--ct-mono); font-size: 12.5px; }
.ct-state + .ct-stat, .ct-stat + .ct-state { margin-left: 8px; }
.ct-plus { color: var(--green, #16a34a); }
.ct-minus { color: var(--red, #dc2626); }
.ct-body { border-top: 1px solid var(--line); }
.ct-body pre { margin: 0; padding: 10px 12px; max-height: 360px; overflow: auto; font-size: 12.5px; line-height: 1.5; white-space: pre; background: var(--panel-2, rgba(127,127,127,.06)); color: var(--ink); }
.ct-body pre.ct-args { border-bottom: 1px solid var(--line); color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.ct-out { white-space: pre-wrap !important; word-break: break-word; }
.ct-out.ct-empty { color: var(--ink-3); }
.ct-note { margin: 0; padding: 8px 12px; font-size: 13px; color: var(--ink-3); }
.ct-note code { font-size: 12.5px; word-break: break-all; }

/* Inline diffs. */
.ct-diff { padding: 6px 0 !important; }
.ct-line { display: block; padding: 0 12px; min-height: 1.5em; }
.ct-add { background: color-mix(in srgb, var(--green, #16a34a) 14%, transparent); color: var(--ink); }
.ct-del { background: color-mix(in srgb, var(--red, #dc2626) 13%, transparent); color: var(--ink); }
.ct-hunk { color: var(--ink-3); }

.ct-results { list-style: none; margin: 0; padding: 6px 12px; max-height: 240px; overflow: auto; }
.ct-results li { padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-results code { font-size: 12.5px; color: var(--ink); }

/* Quiet reasoning summaries. */
.ct-reasoning { margin: 2px 0; padding: 0 2px 0 12px; border-left: 2px solid var(--line-2); color: var(--ink-3); font-size: 14px; font-style: italic; line-height: 1.5; }

/* The plan, updating in place; the changed files at the end. */
.ct-plan, .ct-changed { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--bg); }
.ct-plan header, .ct-changed header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 600; color: var(--ink); font-size: 14px; }
.ct-plan-count { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.ct-plan ol, .ct-changed ul { list-style: none; margin: 0; padding: 0; }
.ct-plan li { display: flex; align-items: flex-start; gap: 10px; padding: 3px 0; color: var(--ink-2); line-height: 1.4; }
.ct-check { flex: none; width: 14px; height: 14px; margin-top: 3px; border: 1.5px solid var(--ink-3); border-radius: 50%; }
.ct-plan li.is-in_progress { color: var(--ink); font-weight: 500; }
.ct-plan li.is-in_progress .ct-check { border-color: var(--ink); background: radial-gradient(var(--ink) 35%, transparent 40%); }
.ct-plan li.is-completed { color: var(--ink-3); text-decoration: line-through; }
.ct-plan li.is-completed .ct-check { border-color: var(--green, #16a34a); background: var(--green, #16a34a); }
.ct-changed li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.ct-changed li code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink); }

/* A phone: rule zero for the chrome; code stays readable. */
@media (max-width: 600px) {
  .code-trace { font-size: 16px; }
  .ct-step > summary { min-height: 44px; padding: 8px 12px; }
  .ct-step summary code, .ct-changed li code { font-size: 14px; }
  .ct-body pre, .ct-results code, .ct-note code { font-size: 13.5px; }
  .ct-state, .ct-stat, .ct-plan-count { font-size: 14px; }
  .ct-plan header, .ct-changed header, .ct-reasoning, .ct-note { font-size: 16px; }
  .ct-body pre { max-height: 300px; }
}
