/* transcript.css — a chat on one of your computers: the feed, messages and
 * their markdown, action chips, the question / plan / shell cards, the working
 * line, the composer and the permission card. Copied from the desktop
 * (krystal-desktop src/css/transcript.css, working.css, composer.css,
 * questions.css, motion.css), so a reply looks the same here as there; only the
 * widths and paddings are fitted to a phone. */

/* ------------------------------- the page ---------------------------------- */

/* The desktop's thin scrollbars, in its colours. */
#computer * { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
#computer *::-webkit-scrollbar { width: 8px; height: 8px; }
#computer *::-webkit-scrollbar-track { background: transparent; }
#computer *::-webkit-scrollbar-thumb { background: var(--border-2); border: 2px solid var(--bg); border-radius: 999px; min-height: 32px; }

.cv-chat { display: flex; flex-direction: column; overflow: hidden; }
.feed {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 0 36px;   /* the bottom slack scrolls under the composer */
  display: flex; flex-direction: column; align-items: center;
}
.feed.thread-in { animation: thread-in .26s ease; }
@keyframes thread-in { from { opacity: 0; transform: translateY(5px); } }

.msg { width: 100%; max-width: calc(var(--read-w) + 32px); padding: 0 16px; margin-bottom: 24px; animation: msg-in .26s ease backwards; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble {
  max-width: 86%;
  background: #17221c;
  border-radius: 18px 18px 6px 18px;
  padding: 10px 16px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 20px -14px rgba(0,0,0,0.9);
}
.msg.user .role { display: none; }
.msg .role {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.10em; color: var(--fg-dim); margin-bottom: 7px;
  display: flex; align-items: center; gap: 8px;
}
.msg.assistant .role {
  color: var(--fg); font-size: 13px; text-transform: none; letter-spacing: 0;
  margin-bottom: 9px;
}
.msg.assistant .role::before {
  content: 'K'; flex: none; width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 800; color: #0a0f0b;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
}
.msg.assistant.shell .role { color: #56c7d6; }
.msg.assistant.shell .role::before { content: '$'; background: #56c7d6; }

.msg-cut {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 3px 9px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--warn); background: var(--warn-bg);
  border: 1px solid var(--warn-bd); border-radius: 999px;
}
.msg-cut::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }

.msg .file-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px;
  color: var(--accent-3); background: rgba(108,199,142,0.08);
  border: 1px solid rgba(108,199,142,0.30); border-radius: 999px;
  padding: 3px 10px; max-width: 260px;
}
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------- the reply and its markdown ----------------------- */

.msg.assistant .bubble {
  padding: 0 0 0 29px;   /* text starts under the name, past the mark */
  font-size: 15px;
  line-height: 1.68;
  overflow-wrap: anywhere;
}
.msg.assistant .bubble :first-child { margin-top: 0; }
.msg.assistant .bubble :last-child { margin-bottom: 0; }
.msg.assistant .bubble h1, .msg.assistant .bubble h2,
.msg.assistant .bubble h3, .msg.assistant .bubble h4 {
  margin: 20px 0 8px; font-weight: 600; line-height: 1.3; color: var(--fg);
  text-transform: none; letter-spacing: 0;
}
.msg.assistant .bubble h1 { font-size: 20px; }
.msg.assistant .bubble h2 { font-size: 17px; }
.msg.assistant .bubble h3 { font-size: 15px; color: var(--accent-3); }
.msg.assistant .bubble h4 { font-size: 14px; color: var(--fg-muted); }
.msg.assistant .bubble p { margin: 10px 0; }
.msg.assistant .bubble ul, .msg.assistant .bubble ol { margin: 10px 0; padding-left: 22px; }
.msg.assistant .bubble li { margin: 4px 0; }
.msg.assistant .bubble a { color: var(--accent-2); text-decoration: none; border-bottom: 1px dashed rgba(108,199,142,0.4); }
.msg.assistant .bubble a:hover { border-bottom-style: solid; }
.msg.assistant .bubble strong { color: var(--fg); font-weight: 600; }
.msg.assistant .bubble blockquote { margin: 12px 0; padding: 4px 16px; border-left: 3px solid var(--border-2); color: var(--fg-muted); }
.msg.assistant .bubble hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.msg.assistant .bubble code {
  font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,0.06);
  border-radius: 4px; padding: 1px 6px; color: var(--fg);
}
.msg.assistant .bubble pre {
  position: relative;
  margin: 14px 0; background: var(--code-bg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.045);
  border-radius: 10px; overflow-x: auto;
}
.msg.assistant .bubble pre code { display: block; padding: 14px 44px 14px 16px; background: transparent; border: none; font-size: 12.5px; line-height: 1.55; }
.msg.assistant .bubble pre code.hljs { background: transparent; padding: 14px 44px 14px 16px; }   /* room for Copy, which a touch screen can't hover to reveal */
.msg.assistant .bubble table { display: block; overflow-x: auto; border-collapse: collapse; margin: 14px 0; max-width: 100%; }
.msg.assistant .bubble th, .msg.assistant .bubble td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.msg.assistant .bubble th { background: var(--bg-elev); font-weight: 600; }
.msg.assistant .bubble .seg-text { margin: 0; }
.msg.assistant .bubble .seg-text + .seg-text { margin-top: 10px; }
.msg.assistant .bubble .seg-text :first-child { margin-top: 0; }
.msg.assistant .bubble .seg-text :last-child { margin-bottom: 0; }

.code-copy {
  position: absolute; top: 7px; right: 7px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  color: var(--fg-dim); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
  opacity: .7;
  transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}
pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--fg); border-color: var(--border-2); }
.code-copy.copied { color: var(--accent-3); border-color: rgba(108,199,142,0.4); opacity: 1; }

/* The caret, and new ink fading in as it is written. */
.caret { display: inline-block; width: 7px; height: 15px; background: var(--accent-2);
  vertical-align: text-bottom; margin-left: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
.seg-text.streaming .tw { animation: tw-in .32s ease-out backwards; }
@keyframes tw-in { from { opacity: 0; } }

/* The answer is in: one soft sweep of light across it, then it rests. */
.msg.assistant .bubble.landed { position: relative; isolation: isolate; }
.msg.assistant .bubble.landed::after {
  content: ''; position: absolute; z-index: 1; pointer-events: none;
  inset: -18px -24px; mix-blend-mode: screen;
  background: linear-gradient(100deg, transparent 38%, rgba(143,224,170,0.018) 42%,
    rgba(143,224,170,0.052) 46%, rgba(143,224,170,0.07) 50%,
    rgba(143,224,170,0.052) 54%, rgba(143,224,170,0.018) 58%, transparent 62%)
    no-repeat 100% 0 / 250% 100%;
  -webkit-mask-image:
    linear-gradient(90deg, transparent, #000 min(72px, 50%), #000 max(calc(100% - 72px), 50%), transparent),
    linear-gradient(transparent, #000 min(44px, 50%), #000 max(calc(100% - 44px), 50%), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent, #000 min(72px, 50%), #000 max(calc(100% - 72px), 50%), transparent),
    linear-gradient(transparent, #000 min(44px, 50%), #000 max(calc(100% - 44px), 50%), transparent);
  mask-composite: intersect;
  animation: reply-landed 1.2s var(--ease-out) both;
}
@keyframes reply-landed { from { background-position: 100% 0; } to { background-position: 0 0; } }
.msg.user .bubble.landed-in { animation: bubble-landed .7s ease; }
@keyframes bubble-landed { from { box-shadow: -4px 0 16px -5px rgba(108,199,142,0.7); } }

/* ------------------------------- action chips ------------------------------ */

.action-chip {
  width: fit-content; max-width: 100%;
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted);
  background: rgba(255,255,255,0.04); border: 1px solid transparent;
  border-radius: 999px; margin: 9px 0; overflow: hidden;
}
.action-chip .chip-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 12px; cursor: pointer; text-align: left;
  font: inherit; color: inherit; background: none; border: 0;
}
.action-chip.expandable { transition: border-color .15s, translate .2s var(--ease-out); }
.action-chip.expandable.open { width: 100%; border-radius: 13px; }
.action-chip.expandable:hover { border-color: rgba(108,199,142,0.35); background: rgba(255,255,255,0.06); }
.action-chip .chip-ico { font-size: 12px; line-height: 1; flex: 0 0 auto; }
.action-chip .chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.action-chip .chip-caret {
  flex: 0 0 auto; margin-left: auto; padding-left: 6px;
  font-size: 9px; color: var(--fg-dim);
  transition: color .15s, transform .2s ease;
}
.action-chip.expandable:hover .chip-caret { color: var(--accent-3); }
.action-chip.open .chip-caret { transform: rotate(90deg); }

/* status: spinner (working) → check (done) → warm dot (done, with an error) */
.action-chip .chip-status { flex: 0 0 auto; }
.action-chip .chip-tick { display: none; }
.action-chip.working .chip-status {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(108,199,142,0.30); border-top-color: var(--accent-2);
  animation: hint-spin .7s linear infinite;
}
.action-chip.done .chip-status { display: inline-flex; width: 12px; height: 12px; }
.action-chip.done .chip-tick {
  display: block; width: 12px; height: 12px; fill: none;
  stroke: var(--accent-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 11;
}
.action-chip.done.error .chip-tick { display: none; }
.action-chip.done.error .chip-status { width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--warn); }
.action-chip.just-done .chip-tick { animation: tick-draw .36s var(--ease-out) both; }
@keyframes tick-draw { from { stroke-dashoffset: 11; } to { stroke-dashoffset: 0; } }
@keyframes hint-spin { to { transform: rotate(360deg); } }

.action-chip.working {
  color: var(--accent-3); border-color: rgba(108,199,142,0.45);
  background: rgba(108,199,142,0.07);
  animation: chip-pulse 1.6s ease-in-out infinite;
}
.action-chip.working .chip-label { animation: chip-fade 1.6s ease-in-out infinite; }
@keyframes chip-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(108,199,142,0); }
  50%     { box-shadow: 0 0 16px 0 rgba(108,199,142,0.22); }
}
@keyframes chip-fade { 0%,100% { opacity: 1; } 50% { opacity: 0.62; } }
.action-chip.error { color: var(--warn); border-color: var(--warn-bd); background: transparent; }
.action-chip.error > .chip-row { cursor: default; white-space: normal; font-family: var(--sans); font-size: 12.5px; }
.action-chip .chip-time {
  flex: none; padding-left: 8px;
  font-family: var(--mono); font-size: 10.5px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.action-chip .chip-time:empty { display: none; }

.action-chip .chip-details {
  border-top: 1px solid var(--border); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height .2s ease, opacity .16s ease;
}
.action-chip.open .chip-details { opacity: 1; }
.action-chip .chip-details[hidden] { display: none; }
.action-chip .chip-detail-line {
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted);
  word-break: break-all; line-height: 1.5;
}
.action-chip .chip-pre {
  margin: 0; max-height: 280px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  color: var(--fg-muted); white-space: pre-wrap; word-break: break-word;
}
.action-chip .chip-pre.out { color: var(--fg-dim); }
.action-chip .chip-pre.err { color: var(--warn); border-color: var(--warn-bd); }
.action-chip .chip-out-head {
  font-family: var(--sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-dim); font-weight: 600;
}
.action-chip .chip-pending { font-size: 11.5px; color: var(--fg-dim); font-style: italic; }
.action-chip .chip-link { color: var(--accent-3); text-decoration: none; word-break: break-all; border: 0; }
.action-chip .chip-links, .msg.assistant .bubble .action-chip .chip-links {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 5px;
  font-family: var(--sans); font-size: 12px; line-height: 1.45;
}
.action-chip .chip-links li, .msg.assistant .bubble .action-chip .chip-links li { margin: 0; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.action-chip .chip-links .chip-link { word-break: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.action-chip .chip-link-host { flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--fg-dim); }
.chip-diff {
  max-height: 320px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
}
.diff-line { padding: 0 11px; white-space: pre-wrap; word-break: break-word; }
.diff-line.del { color: #e0857a; background: rgba(224,122,90,0.08); }
.diff-line.add { color: var(--accent-3); background: rgba(108,199,142,0.08); }
.action-chip .chip-img {
  display: flex; align-items: center; justify-content: center;
  padding: 8px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; min-height: 40px; font-size: 11.5px; color: var(--fg-dim);
}
.action-chip .chip-img img { max-width: 100%; max-height: 340px; border-radius: 5px; display: block; opacity: 0; transition: opacity .2s ease; }
.action-chip .chip-img.loaded img { opacity: 1; }

/* -------------------------------- shell cards ------------------------------ */

.shell-card {
  width: fit-content; max-width: 100%;
  border: 1px solid var(--border-2); border-left: 3px solid #56c7d6;
  border-radius: var(--radius-sm); background: var(--code-bg); overflow: hidden;
}
.shell-card.err { border-left-color: #e07a5a; }
.shell-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12.5px; color: var(--fg);
}
.shell-head .shell-ico { color: #56c7d6; font-weight: 700; flex: 0 0 auto; }
.shell-card.err .shell-head .shell-ico { color: #e07a5a; }
.shell-cmd { white-space: pre-wrap; word-break: break-all; }
.shell-out {
  position: relative; margin: 0; max-height: 360px; overflow: auto;
  padding: 10px 12px; background: transparent;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  color: var(--fg-muted); white-space: pre-wrap; word-break: break-word;
}
.shell-out.err { color: #e0a99e; }
.shell-code { padding: 6px 12px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 10.5px; color: #e07a5a; }

/* ------------------------------ the working line ---------------------------- */

.work-line {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 0; padding-left: 29px;
  font-size: 12.5px; color: var(--accent-3);
  transition: opacity .3s ease;
}
.work-line.out { opacity: 0; }
.wl-dot {
  flex: none; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%;
  background: var(--accent-2); opacity: .75;
}
.wl-dot.beat { animation: wl-beat .7s ease-out; }
@keyframes wl-beat {
  0%   { opacity: 1; transform: scale(1.35); }
  100% { opacity: .75; transform: scale(1); }
}
.wl-meta { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
.wl-meta:empty { display: none; }
.work-line[data-tone="think"] .wl-label {
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg,
    rgba(143,224,170,0.6) 0%, rgba(143,224,170,0.6) 38%, var(--fg) 50%,
    rgba(143,224,170,0.6) 62%, rgba(143,224,170,0.6) 100%);
  background-size: 250% 100%;
  animation: think-shimmer 2s linear infinite;
}
@keyframes think-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.work-line[data-tone="wait"] { color: var(--warn); }
.work-line[data-tone="wait"] .wl-dot { background: var(--warn); opacity: 1; animation: none; }

/* --------------------------- question and plan cards ------------------------ */

.qa-card {
  margin: 8px 0; border: 1px solid var(--accent-2); border-radius: 12px;
  background: rgba(108,199,142,0.06); overflow: hidden;
}
.qa-intro {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--accent-3);
  border-bottom: 1px solid var(--border); background: rgba(108,199,142,0.08);
}
.qa-q { padding: 12px 14px; }
.qa-q + .qa-q { border-top: 1px solid var(--border); }
.qa-head { font-family: var(--sans); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-dim); margin-bottom: 4px; }
.qa-text { font-size: 14px; color: var(--fg); margin-bottom: 6px; line-height: 1.45; }
.qa-hint { font-size: 11px; color: var(--fg-dim); margin-bottom: 10px; font-family: var(--sans); letter-spacing: 0.02em; }
.qa-q.multi .qa-hint { color: var(--accent-3); }
.qa-opts { display: flex; flex-direction: column; gap: 8px; }
.qa-opt {
  display: flex; flex-direction: row; align-items: flex-start; gap: 10px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px;
  background: var(--bg-card); color: var(--fg); cursor: pointer; font: inherit;
  transition: border-color .15s, background .15s;
}
.qa-opt:hover:not(:disabled) { border-color: var(--accent-2); }
.qa-opt.sel { border-color: var(--accent-2); background: rgba(108,199,142,0.14); }
.qa-opt:disabled { opacity: 0.55; cursor: default; }
.qa-opt-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qa-opt-label { font-weight: 600; font-size: 13.5px; }
.qa-opt-desc { font-size: 12px; color: var(--fg-muted); line-height: 1.4; }
.qa-mark {
  position: relative; flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px;
  border: 2px solid var(--border-2); background: transparent;
  transition: border-color .15s, background .15s;
}
.qa-q.single .qa-mark { border-radius: 50%; }
.qa-q.multi .qa-mark { border-radius: 5px; }
.qa-opt.sel .qa-mark { border-color: var(--accent-2); background: var(--accent-2); }
.qa-q.single .qa-opt.sel .qa-mark::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #0a0f0b; }
.qa-q.multi .qa-opt.sel .qa-mark::after {
  content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #0a0f0b; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.qa-custom {
  width: 100%; margin-top: 8px; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px;
  background: var(--bg); color: var(--fg); font: inherit; font-size: 14px;
  transition: border-color .15s;
}
.qa-custom::placeholder { color: var(--fg-dim); }
.qa-custom:focus { outline: none; border-color: var(--accent-2); }
.qa-custom:disabled { opacity: 0.55; cursor: default; }
.qa-foot { display: flex; justify-content: flex-end; padding: 0 14px 12px; }
.qa-send {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: #0a0f0b; background: var(--accent-2); border: none;
  border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
}
.qa-send:hover:not(:disabled) { background: var(--accent-3); }
.qa-send:disabled { opacity: 0.55; cursor: default; }
.qa-card.answered { border-color: var(--border); background: var(--bg-card); opacity: 0.85; }

.plan-card { margin: 8px 0; border: 1px solid var(--border-2); border-radius: 12px; background: var(--bg-card); overflow: hidden; }
.plan-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--fg-muted);
  border-bottom: 1px solid var(--border); background: var(--bg-elev);
}
.plan-body { padding: 4px 16px 14px; font-size: 14px; line-height: 1.55; }
.plan-body > :first-child { margin-top: 8px; }

/* --------------------------------- empty chat ------------------------------- */

.empty-state { margin: auto; padding: 0 24px; text-align: center; max-width: 460px; color: var(--fg-muted); }
.empty-mark {
  width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff; font-family: var(--mono); font-weight: 700; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  animation: empty-glow 5s ease-in-out infinite;
}
@keyframes empty-glow {
  0%, 100% { box-shadow: 0 0 6px 0 rgba(108,199,142,0.12); }
  50%      { box-shadow: 0 0 22px 2px rgba(108,199,142,0.38); }
}
.empty-state h2 { color: var(--fg); margin: 0 0 8px; font-size: 18px; text-transform: none; letter-spacing: 0; }
.empty-state p { font-size: 14px; line-height: 1.6; margin: 0; }
.empty-state.enter { animation: empty-enter .35s ease; }
@keyframes empty-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------- composer --------------------------------- */

.composer {
  flex: 0 0 auto; position: relative; z-index: 3;
  margin-top: -30px; padding: 30px 12px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.composer-dock {
  max-width: var(--read-w); margin: 0 auto;
  padding: 8px 8px 8px; border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 16px 36px -12px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.055);
  transition: box-shadow .28s ease;
}
.composer-dock:focus-within {
  box-shadow: 0 16px 36px -12px rgba(0,0,0,0.75), 0 0 0 1px rgba(108,199,142,0.42),
    0 0 30px -6px rgba(108,199,142,0.2);
}
.composer-row { position: relative; display: flex; align-items: flex-end; gap: 10px; padding: 0 0 0 4px; }
.composer-row::before {
  content: "▸"; align-self: flex-end; color: var(--accent-2);
  font-family: var(--mono); font-weight: 700; font-size: 15px; line-height: 1;
  padding: 0 2px 11px 2px; text-shadow: 0 0 8px rgba(108,199,142,0.5);
}
.composer-row textarea {
  flex: 1 1 auto; min-width: 0; resize: none; max-height: 200px;
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.5;   /* 16px: no zoom on iOS */
  padding: 7px 2px;
}
.composer-row textarea::placeholder { color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.send-btn {
  position: relative; flex: 0 0 auto; align-self: flex-end;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent-2); border: none; color: #0a0f0b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s ease, transform .12s ease, box-shadow .2s ease;
}
.send-btn:hover:not(:disabled) { background: var(--accent-3); box-shadow: 0 4px 14px rgba(108,199,142,0.38); }
.send-btn:active:not(:disabled) { transform: scale(.9); box-shadow: none; }
.send-btn:disabled { background: var(--border-2); color: var(--fg-dim); cursor: not-allowed; }
.send-btn.is-stop { background: #d8584e; color: #fff; }
.send-btn.is-stop:hover:not(:disabled) { background: #e06a60; box-shadow: 0 4px 14px rgba(216,88,78,0.42); }
.send-btn .ic {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transition: opacity .2s ease, transform .26s cubic-bezier(.3,.9,.3,1.35);
}
.send-btn .ic-send { opacity: 1; transform: none; }
.send-btn .ic-stop { opacity: 0; transform: scale(.4) rotate(-90deg); }
.send-btn.is-stop .ic-send { opacity: 0; transform: scale(.4) rotate(90deg); }
.send-btn.is-stop .ic-stop { opacity: 1; transform: none; }
.send-btn.launch .ic-send { animation: send-launch .36s forwards; }
.send-btn.launch.is-stop .ic-stop { transition-delay: .14s; }
.send-btn.land .ic-send { animation: send-land .34s var(--ease-out) backwards; }
@keyframes send-launch {
  0%   { transform: none; opacity: 1; animation-timing-function: ease-out; }
  28%  { transform: translate(-2px, 2px); animation-timing-function: cubic-bezier(.5,0,.8,.2); }
  100% { transform: translate(18px, -18px); opacity: 0; }
}
@keyframes send-land { from { transform: translate(-10px, 10px); opacity: 0; } }

/* ------------------------------ the permission card ------------------------- */

.composer-perm { max-width: var(--read-w); margin: 0 auto 8px; }
.composer-perm[hidden] { display: none; }
.composer-perm.in .perm-card { animation: suggest-in .22s ease; }
@keyframes suggest-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.perm-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--warn-bd); background: var(--bg-card);
  max-height: 46dvh; overflow-y: auto;
}
.perm-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--fg); }
.perm-ico { flex: none; font-size: 13px; color: var(--warn); }
.perm-title { min-width: 0; }
.perm-more { margin-left: auto; flex: none; font-size: 10.5px; font-weight: 500; color: var(--warn); }
.perm-more[hidden] { display: none; }
.perm-why { font-size: 12px; color: var(--fg-muted); line-height: 1.45; }
.perm-path { font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted); word-break: break-all; line-height: 1.5; }
.perm-what, .perm-card .chip-diff {
  margin: 0; max-height: 168px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px;
}
.perm-what { padding: 8px 11px; line-height: 1.5; color: var(--fg); white-space: pre-wrap; word-break: break-word; }
.perm-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-btn {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-2); background: transparent; color: var(--fg-muted);
  transition: color .15s, border-color .15s, background .15s;
}
.perm-btn:hover:not(:disabled) { color: var(--fg); border-color: var(--fg-dim); }
.perm-btn.allow { color: #0a0f0b; background: var(--accent-2); border-color: var(--accent-2); }
.perm-btn.allow:hover:not(:disabled) { color: #0a0f0b; background: var(--accent-3); border-color: var(--accent-3); }
.perm-btn.deny { margin-left: auto; }
.perm-btn.deny:hover:not(:disabled) { color: #ff8a8a; border-color: rgba(255,138,138,0.45); }
.perm-btn:disabled { opacity: .55; cursor: default; }

/* ------------------------------- wider screens ------------------------------ */

@media (min-width: 720px) {
  .msg { padding: 0 28px; max-width: calc(var(--read-w) + 56px); }
  .composer { padding-left: 28px; padding-right: 28px; }
  .msg.user .bubble { max-width: 82%; font-size: 14.5px; }
  .composer-row textarea { font-size: 14.5px; }
}

/* ------------------------------- reduced motion ----------------------------- */

@media (prefers-reduced-motion: reduce) {
  .work-line { transition: none; }
  .wl-dot.beat, .work-line[data-tone="think"] .wl-label { animation: none; }
  .work-line[data-tone="think"] .wl-label { color: var(--accent-3); background: none; }
  .msg, .feed.thread-in, .empty-state.enter, .empty-mark, .composer-perm.in .perm-card,
  .msg.user .bubble.landed-in, .send-btn.launch .ic-send, .send-btn.land .ic-send,
  .seg-text.streaming .tw, .action-chip.just-done .chip-tick { animation: none; }
  .msg.assistant .bubble.landed::after { display: none; }
  .send-btn .ic { transition: opacity .15s ease; }
  .send-btn .ic-send, .send-btn .ic-stop, .send-btn.is-stop .ic-send, .send-btn.is-stop .ic-stop { transform: none; }
  .action-chip .chip-details, .action-chip .chip-caret, .action-chip.expandable { transition: none; }
}
