/* Vestra Code launch page (`hero: code`) and its components, `codeloop` and `screen`. Loaded only by
   pages that use them, on top of /static/css/styles.css and news.css. Palette: the app's own black
   and hairlines with the mint of the Vestra mark as the signal, so it reads apart from the galaxy
   (cobalt), trace (amber), Veriwell (light) and Vestra One (violet) pages. */

.news-code {
  --bg: #000;
  --surface: #0d0f13;
  --surface-2: #14171c;
  --surface-3: #1b1f26;
  --mint: #9ee9dc;            /* the mark: 15:1 on black */
  --mint-ink: 158, 233, 220;
  --signal: var(--mint);
  background: var(--bg);
}

html:has(> body.news-code) {
  background: #000;
}

/* ------------------------------------------------------------------ hero */

.code-hero {
  position: relative;
}

/* --u is one character of the field: small enough that the mark (26 lines of 1.5em, about 46em
   wide) fits half the screen's height and most of its width. */
.code-stage {
  --u: min(1.25svh, 1.85vw);
  --mark-y: 39%;
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding: var(--nav-h) var(--gutter) 0;
  overflow: clip;
  background:
    radial-gradient(48% 40% at 50% 39%, rgba(var(--mint-ink), 0.07) 0%, rgba(var(--mint-ink), 0) 70%),
    #000;
}

.code-field {
  position: absolute;
  left: 50%;
  top: var(--mark-y);
  z-index: -1;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--u);
  line-height: 1.5;
  white-space: pre;
  color: rgba(242, 244, 247, 0.16);
  transform: translate(calc(-1 * var(--fx)), calc(-1 * var(--fy)));
  -webkit-mask-image: radial-gradient(closest-side at var(--fx) var(--fy), #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side at var(--fx) var(--fy), #000 55%, transparent 100%);
  pointer-events: none;
  user-select: none;
  overflow: visible;
}

.cf-r {
  display: block;
}

.cf-n {
  color: rgba(242, 244, 247, 0.09);
}

/* The selection, in the shape of the mark. */
.cf-s {
  display: inline-block;
  height: 1.5em;
  vertical-align: top;
  background: rgba(var(--mint-ink), 0.2);
  color: var(--mint);
  text-shadow: 0 0 0.9em rgba(var(--mint-ink), 0.45);
}

.code-lockup {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: calc(var(--mark-y) + 19.5 * var(--u) + clamp(1.25rem, 4vh, 3rem));
  display: grid;
  justify-items: center;
  gap: clamp(0.6rem, 1.5vh, 1.1rem);
  text-align: center;
}

.code-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 1rem + 5.6vw, 6.75rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

/* A text cursor after the title (decorative). */
.code-title::after {
  content: "";
  display: inline-block;
  width: 0.075em;
  height: 0.74em;
  margin-left: 0.09em;
  background: var(--mint);
  vertical-align: -0.02em;
}

.code-line {
  max-width: 24em;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 0.95rem + 1.2vw, 2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
  color: var(--ink-2);
}

.code-cue { display: none; }

/* Arrival, once, in CSS: the lines type in, the selection is dragged down through them and the mark
   appears, then the title and the line. Ends exactly at the still in the HTML. */
@media (prefers-reduced-motion: no-preference) {
  .js .code-field {
    animation: cf-dim 1s var(--ease-out) 1.5s both;
  }

  .js .cf-r {
    animation: cf-type 0.5s steps(22, end) backwards;
    animation-delay: calc(var(--r) * 30ms);
  }

  .js .cf-s {
    animation: cf-select 0.45s var(--ease-out) both;
    animation-delay: calc(1.35s + (var(--r) - 5) * 34ms);
  }

  .js .code-title {
    animation: code-rise 0.9s var(--ease-out) 2.05s both;
  }

  .js .code-title::after {
    animation: code-blink 1.1s steps(1, end) 3s infinite;
  }

  .js .code-line {
    animation: code-rise 0.9s var(--ease-out) 2.45s both;
  }

  .js .code-stage .code-cue {
    position: absolute;
    bottom: clamp(1.5rem, 4vh, 2.5rem);
    left: 50%;
    display: block;
    width: 1px;
    height: 44px;
    background: linear-gradient(to bottom, rgba(var(--mint-ink), 0), rgba(var(--mint-ink), 0.6));
    animation: cue 2.4s var(--ease-out) 3.2s infinite both;
    transform-origin: top;
  }
}

@keyframes cf-type {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes cf-select {
  from { background-color: rgba(var(--mint-ink), 0); color: rgba(242, 244, 247, 0.3); text-shadow: none; }
}

@keyframes cf-dim {
  from { color: rgba(242, 244, 247, 0.3); }
}

@keyframes code-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes code-blink {
  50% { opacity: 0; }
}

/* ------------------------------------------------------- page chrome */

.news-code .code-intro .launch-dek { color: var(--ink); }

.news-code .launch-nav,
.news-code .nav.is-scrolled {
  background: rgba(0, 0, 0, 0.9);
}

.news-code .btn-primary,
.news-code .launch-nav-cta {
  background: var(--mint);
  border-color: var(--mint);
  color: #03110e;
}

@media (hover: hover) {
  .news-code .btn-primary:hover,
  .news-code .launch-nav-cta:hover { background: #fff; border-color: #fff; }
}

.news-code .launch-nav-list a.is-active { color: var(--mint); }
.news-code .c-callout { border-color: rgba(var(--mint-ink), 0.3); }

/* ---------------------------------------------------------------- screen */

.c-screen {
  display: grid;
  gap: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
}

.c-screen-shot {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: clamp(10px, 0.5rem + 0.6vw, 16px);
  background: #000;
  box-shadow: 0 30px 80px -40px rgba(var(--mint-ink, 158, 233, 220), 0.25);
}

.c-screen-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.c-screen-cap {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (min-width: 720px) {
  .c-screen[data-n="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .c-screen[data-n="2"] > .c-note { grid-column: 1 / -1; }
}

/* -------------------------------------------------------------- codeloop */

.c-codeloop {
  --cl-mint: var(--mint, #9ee9dc);
  --cl-glow: 96, 150, 255;
  --cl-add: #4ade80;
  --cl-del: #f87171;
  --cl-ultra: #b79cff;
  display: grid;
  gap: 1rem;
}

.cl-window {
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: clamp(14px, 0.6rem + 0.8vw, 20px);
  background: #000;
  box-shadow: 0 40px 120px -60px rgba(var(--mint-ink, 158, 233, 220), 0.35);
}

.cl-titlebar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.cl-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.cl-mark {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--cl-mint);
}

.cl-chat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.cl-chat-title {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cl-project {
  color: var(--muted);
  font-size: 0.8rem;
}

/* The transcript scrolls inside the window. */
.cl-transcript {
  display: block;
  max-height: 34rem;
  padding: 1.25rem clamp(1rem, 0.5rem + 2vw, 2rem) 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  font-size: 0.9rem;
}

.cl-transcript > *,
.cl-approve > *,
.cl-writing > * {
  min-width: 0;
}

/* Without JavaScript the finished run is shown whole; with it, the window has a fixed height. */
.c-codeloop:not(.is-live) .cl-transcript {
  max-height: none;
}

.c-codeloop.is-live .cl-transcript {
  height: clamp(20rem, 46vh, 30rem);
}

.cl-transcript:focus-visible {
  outline: 2px solid var(--cl-mint);
  outline-offset: -2px;
}

.cl-transcript > * + .cl-user,
.cl-transcript > * + .cl-say,
.cl-transcript > * + .cl-approve,
.cl-transcript > * + .cl-writing,
.cl-transcript > * + .cl-divider,
.cl-transcript > * + .cl-thinking {
  margin-top: 0.6rem;
}

.cl-user {
  width: fit-content;
  margin-left: auto;
  max-width: min(32rem, 88%);
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
}

.cl-user p { margin: 0; }

.cl-user.is-steer {
  border-color: rgba(var(--cl-glow), 0.35);
  background: rgba(var(--cl-glow), 0.08);
}

.cl-steer-tag {
  margin-bottom: 0.15rem !important;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Rows: thinking, tools, files. */
.cl-row {
  margin-top: 0.15rem;
  color: var(--ink-2);
  font-size: 0.86rem;
}

.cl-row > summary,
div.cl-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.9rem;
  padding: 0.15rem 0;
}

.cl-row > summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
}

.cl-row > summary::-webkit-details-marker { display: none; }

.cl-row > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 0.15rem;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  opacity: 0.5;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease-out);
}

.cl-row[open] > summary::after { transform: rotate(45deg); }

.cl-row > summary:focus-visible {
  outline: 2px solid var(--cl-mint);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (hover: hover) {
  .cl-row > summary:hover { color: var(--ink); }
}

.cl-ico {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.cl-think { color: var(--muted); }
.cl-think.is-ultra { color: var(--cl-ultra); }
.cl-think.is-ultra .cl-ico { filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.8)); }

.cl-notes {
  margin: 0.2rem 0 0.5rem 1.6rem;
  padding: 0 0 0 0.9rem;
  border-left: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 0.84rem;
  list-style: none;
}

.prose .cl-notes > li + li { margin-top: 0.2rem; }

.cl-out {
  margin: 0.25rem 0 0.5rem 1.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cl-add,
.cl-del {
  font-family: var(--font-mono);
  font-size: 0.8em;
}

.cl-add { color: var(--cl-add); }
.cl-del { color: var(--cl-del); }

.cl-file.is-undone > summary > span:first-of-type { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.4); }
.cl-file.is-undone > summary { opacity: 0.6; }

/* In flight: a pulsing dot after the label. */
.cl-row.is-live > span:first-of-type {
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink) 50%, var(--ink-2) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cl-shimmer 1.6s linear infinite;
}

.cl-think.is-live.is-ultra > span:first-of-type {
  background-image: linear-gradient(90deg, #8b6cff 0%, #e2d6ff 50%, #8b6cff 100%);
}

@keyframes cl-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* Code: a file, or a diff. */
.cl-code {
  margin: 0.3rem 0 0.6rem 1.6rem;
  max-height: 15rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #07080a;
  scrollbar-width: thin;
}

.cl-approve .cl-code { margin: 0; max-height: 17rem; }

.cl-lines {
  margin: 0;
  padding: 0.45rem 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  counter-reset: ln;
  min-width: max-content;
}

.prose .cl-lines > li + li { margin-top: 0; }

.cl-lines > li {
  display: flex;
  gap: 0.6rem;
  padding: 0 0.85rem 0 0;
  counter-increment: ln;
}

.cl-lines > li::before {
  content: counter(ln);
  flex: none;
  width: 2.6em;
  text-align: right;
  color: rgba(255, 255, 255, 0.22);
}

.cl-code.is-diff .cl-lines > li::before { content: none; }
.cl-code.is-diff .cl-lines > li { padding-left: 0.85rem; }

.cl-lines code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: #d6dbe2;
  white-space: pre;
}

.cl-sign { flex: none; width: 0.8em; color: var(--muted); }
.cl-lines > li.is-add { background: rgba(34, 197, 94, 0.1); }
.cl-lines > li.is-add .cl-sign { color: var(--cl-add); }
.cl-lines > li.is-del { background: rgba(239, 68, 68, 0.12); }
.cl-lines > li.is-del .cl-sign { color: var(--cl-del); }
.cl-lines > li.is-hunk code { color: var(--muted); }
.cl-code:not(.is-diff) .cl-lines > li.is-add { background: none; }

.hl-k { color: #ff7b72; }
.hl-s { color: #a5d6ff; }
.hl-c { color: #8b949e; }
.hl-n { color: #79c0ff; }
.hl-h { color: var(--cl-mint); font-weight: 700; }

/* Live writing. */
.cl-writing-meta {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.cl-stream {
  margin: 0.25rem 0 0.4rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #07080a;
  overflow: hidden;
}

.cl-stream-note {
  margin: 0 !important;
  padding: 0.35rem 0.8rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.cl-stream-code {
  height: 9.6rem;
  margin: 0;
  padding: 0.5rem 0.8rem;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: #d6dbe2;
  white-space: pre;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Approval card. */
.cl-approve {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
}

.cl-approve p { margin: 0 !important; }

.cl-approve-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.88rem;
}

.cl-approve-note {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  font-size: 0.8rem;
}

.cl-approve-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.cl-btn {
  min-height: 34px;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.2s var(--ease-out), border-color 0.2s;
}

.cl-btn.is-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

@media (hover: hover) {
  .cl-btn.is-ghost:hover { background: rgba(255, 255, 255, 0.06); }
  .cl-btn.is-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
}

.cl-btn:focus-visible,
.cl-undo:focus-visible,
.cl-send:focus-visible,
.cl-send-now:focus-visible,
.cl-queue-x:focus-visible,
.cl-task:focus-visible,
.cl-run:focus-visible {
  outline: 2px solid var(--cl-mint);
  outline-offset: 2px;
}

.cl-edit-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.cl-edit {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #07080a;
  color: #e6eaf0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  white-space: pre;
  resize: vertical;
}

.cl-edit:focus-visible {
  outline: 2px solid var(--cl-mint);
  outline-offset: 1px;
}

.cl-say {
  margin: 0.4rem 0;
  color: var(--ink);
  font-size: 0.93rem;
  line-height: 1.6;
}

.cl-say p { margin: 0; }
.cl-say p + p { margin-top: 0.6rem; }

.cl-pill {
  display: flex;
  align-items: stretch;
  width: fit-content;
  margin: 0.75rem auto 0.25rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.84rem;
  overflow: hidden;
}

.cl-pill-sum {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
}

.cl-pill-sum b { font-weight: 500; }

.cl-undo {
  padding: 0.45rem 0.95rem;
  border-left: 1px solid var(--line-2);
  color: var(--ink);
  font-weight: 500;
}

.cl-undo:disabled { color: var(--ink-2); cursor: default; }

@media (hover: hover) {
  .cl-undo:not(:disabled):hover { background: rgba(255, 255, 255, 0.06); }
}

.cl-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 0 !important;
  color: var(--muted);
  font-size: 0.8rem;
}

.cl-divider::before,
.cl-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Status line and composer. */
.cl-status {
  min-height: 1.6rem;
  margin: 0 !important;
  padding: 0.2rem clamp(1rem, 0.5rem + 2vw, 2rem);
  color: var(--ink-2);
  font-size: 0.8rem;
}

.cl-window.is-running .cl-status[data-elapsed]::after {
  content: "  " attr(data-elapsed);
  white-space: pre;
  color: var(--muted);
}

.cl-status.is-waiting { color: #fbbf24; }

.cl-composer {
  margin: 0 clamp(0.6rem, 0.3rem + 1vw, 1rem) clamp(0.6rem, 0.3rem + 1vw, 1rem);
  padding: 0.65rem 0.75rem 0.6rem;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--surface);
}

.cl-input-static {
  margin: 0 0 0.6rem !important;
  padding: 0.2rem 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.cl-form { margin-bottom: 0.5rem; }

.cl-input {
  width: 100%;
  min-height: 34px;
  padding: 0.3rem 0.15rem;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.92rem;
}

.cl-input::placeholder { color: var(--muted); }
.cl-input:focus { outline: none; }
.cl-composer:focus-within { border-color: rgba(var(--mint-ink, 158, 233, 220), 0.45); }

.cl-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.cl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2);
  white-space: nowrap;
}

.cl-chip-effort { color: #8ab4ff; }
.cl-chip-effort[data-level="low"] { color: var(--ink-2); }
.cl-chip-effort[data-level="ultra"] { color: var(--cl-ultra); text-shadow: 0 0 10px rgba(167, 139, 250, 0.6); }

.cl-composer-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.cl-mic { display: inline-flex; color: var(--muted); }
.cl-mic .cl-ico { width: 16px; height: 16px; }

.cl-send {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #000;
}

.cl-send svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cl-send.is-stop svg { fill: currentColor; stroke: none; }

/* Steering queue, above the input. */
.cl-queue {
  display: grid;
  gap: 0.4rem;
  margin: -0.2rem -0.25rem 0.6rem;
  padding: 0.5rem;
  border: 1px solid rgba(var(--cl-glow), 0.3);
  border-radius: 12px;
  background: rgba(var(--cl-glow), 0.06);
}

.cl-queue[hidden] { display: none; }

.cl-queue-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .cl-queue-list > li + li { margin-top: 0; }

.cl-queue-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.3rem 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 0.85rem;
}

.cl-queue-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.cl-queue-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
}

.cl-queue-x svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.cl-queue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.cl-send-now {
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Controls above the window. */
.cl-bar {
  display: grid;
  gap: 1rem 2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .cl-bar { grid-template-columns: minmax(0, 1fr) 17rem auto; }
}

.cl-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cl-task {
  min-height: 38px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out), border-color 0.25s;
}

.cl-task[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #000;
}

@media (hover: hover) {
  .cl-task:not([aria-checked="true"]):hover { color: var(--ink); }
}

.cl-run {
  justify-self: start;
  min-height: 38px;
  min-width: 6.5rem;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  background: var(--cl-mint);
  color: #03110e;
  font-size: 0.875rem;
  font-weight: 600;
}

.cl-run.is-stop {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink);
}

/* The effort slider, after the app's. */
.cl-effort {
  --fx-accent: #7fb0ff;
  --fx-fill: linear-gradient(90deg, #1e3a8a, #3b82f6);
  --fx-glow: transparent;
}

.cl-effort[data-level="low"] { --fx-accent: #8c95a2; --fx-fill: linear-gradient(90deg, #39404c, #6b7585); }
.cl-effort[data-level="high"] { --fx-accent: #5b9bff; --fx-fill: linear-gradient(90deg, #1d4ed8, #3b82f6); --fx-glow: rgba(59, 130, 246, 0.35); }
.cl-effort[data-level="xhigh"] { --fx-accent: #4d8dff; --fx-fill: linear-gradient(90deg, #1d4ed8, #2f6bff 55%, #60a5fa); --fx-glow: rgba(47, 107, 255, 0.45); }
.cl-effort[data-level="ultra"] { --fx-accent: #b79cff; --fx-fill: linear-gradient(90deg, #2563eb, #7c3aed 55%, #c084fc); --fx-glow: rgba(167, 139, 250, 0.6); }

.cl-effort-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
}

.cl-effort-label { color: var(--muted); }

.cl-effort-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fx-accent);
  transition: color 0.2s var(--ease-out);
}

.cl-effort[data-level="ultra"] .cl-effort-name { text-shadow: 0 0 14px rgba(167, 139, 250, 0.55); }

.cl-effort-track {
  position: relative;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.cl-effort-track:focus-visible {
  box-shadow: inset 0 0 0 1px var(--line), 0 0 0 3px rgba(var(--mint-ink, 158, 233, 220), 0.55);
}

.cl-effort-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--fx-fill);
  box-shadow: 0 0 18px var(--fx-glow);
  overflow: hidden;
  transition: width 0.18s var(--ease-out), box-shadow 0.2s;
}

.cl-effort-sparkle {
  position: absolute;
  inset: 0;
  display: none;
  background-image:
    radial-gradient(1.4px 1.4px at 18% 35%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 42% 70%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1.6px 1.6px at 63% 28%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1.1px 1.1px at 81% 64%, rgba(255, 255, 255, 0.75), transparent 60%),
    radial-gradient(1.3px 1.3px at 30% 80%, rgba(255, 255, 255, 0.7), transparent 60%);
}

.cl-effort[data-level="ultra"] .cl-effort-sparkle { display: block; }

@media (prefers-reduced-motion: no-preference) {
  .cl-effort-sparkle { animation: cl-twinkle 2.4s ease-in-out infinite alternate; }
}

@keyframes cl-twinkle {
  from { opacity: 0.35; transform: translateX(-2px); }
  to { opacity: 1; transform: translateX(2px); }
}

.cl-effort-dot {
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.cl-effort-dot.is-on { background: rgba(255, 255, 255, 0.55); }

.cl-effort-thumb {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: left 0.18s var(--ease-out);
}

.cl-effort-track.is-dragging .cl-effort-fill,
.cl-effort-track.is-dragging .cl-effort-thumb { transition: none; }

.cl-effort-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.cl-effort-hint {
  margin: 0.25rem 0 0 !important;
  min-height: 1.2em;
  font-size: 0.78rem;
  color: var(--ink-2);
}

@media (max-width: 560px) {
  .cl-titlebar .cl-project { display: none; }
  .cl-transcript { font-size: 0.86rem; }
  .cl-code, .cl-out, .cl-stream, .cl-notes { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cl-row.is-live > span:first-of-type { animation: none; color: var(--ink); background: none; }
  .cl-effort-fill, .cl-effort-thumb, .cl-task, .cl-row > summary::after { transition: none; }
}

/* 1.12: the thinking carousel, the plan checklist and test reactions. */
.cl-sum {
  color: var(--muted);
  font-size: 0.82rem;
}

.cl-sum::before {
  content: "·";
  margin-right: 0.4rem;
  opacity: 0.7;
}

.cl-carousel {
  margin: 0.2rem 0 0.4rem 1.6rem;
  padding: 0.5rem 0.8rem 0.55rem;
  border: 1px solid rgba(var(--mint-ink, 158, 233, 220), 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 0 24px -8px rgba(var(--mint-ink, 158, 233, 220), 0.25);
}

.cl-carousel.is-ultra {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 28px -6px rgba(167, 139, 250, 0.45);
}

.cl-carousel-lines {
  display: grid;
  gap: 0.15rem;
  min-height: 3.6em;
  align-content: end;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
}

.cl-carousel-line {
  margin: 0 !important;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cl-carousel-line:last-child { color: var(--ink-2); }

.cl-carousel-now {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0 !important;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.cl-carousel-now::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cl-mint);
}

.cl-carousel.is-ultra .cl-carousel-now::before { background: var(--cl-ultra); }

@media (prefers-reduced-motion: no-preference) {
  .cl-carousel-line:last-child { animation: cl-roll 0.35s var(--ease-out) both; }
  .cl-plan-list > li.is-ticking .cl-check { animation: cl-tick 0.5s var(--ease-out) both; }
  .cl-row.is-reacting { animation: cl-ripple 1.2s var(--ease-out) both; border-radius: 8px; }
}

@keyframes cl-roll {
  from { opacity: 0; transform: translateY(0.6em); }
}

@keyframes cl-tick {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.18); }
  100% { transform: none; }
}

@keyframes cl-ripple {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.12); }
  100% { box-shadow: 0 0 0 14px rgba(74, 222, 128, 0); background: transparent; }
}

.cl-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.cl-badge.is-pass { background: rgba(34, 197, 94, 0.14); color: var(--cl-add); }
.cl-badge.is-fail { background: rgba(239, 68, 68, 0.14); color: var(--cl-del); }

/* A failed command: a red marker on the row. */
.cl-row.is-fail > summary,
div.cl-row.is-fail {
  box-shadow: inset 2px 0 0 var(--cl-del);
  padding-left: 0.5rem;
  margin-left: -0.5rem;
  color: #fca5a5;
}

.cl-plan {
  margin: 0.5rem 0 0.6rem;
  padding: 0.75rem 0.9rem 0.8rem;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
}

.cl-plan-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem !important;
  font-size: 0.88rem;
}

.cl-plan-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.cl-plan-bar {
  position: relative;
  width: 4rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.cl-plan-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p) * 100%);
  border-radius: inherit;
  background: var(--cl-mint);
  transition: width 0.4s var(--ease-out);
}

.cl-plan.is-done .cl-plan-bar > span { background: var(--cl-add); }

.cl-plan-list {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
}

.prose .cl-plan-list > li + li { margin-top: 0; }

.cl-plan-list > li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-2);
}

.cl-check {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: none;
  border: 1.4px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.cl-plan-list > li.is-now { color: var(--ink); font-weight: 600; }
.cl-plan-list > li.is-now .cl-check { border-color: var(--cl-mint); box-shadow: inset 0 0 0 3px #000, inset 0 0 0 8px var(--cl-mint); }
.cl-plan-list > li.is-done .cl-plan-text { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.35); color: var(--muted); }
.cl-plan-list > li.is-done .cl-check { border-color: var(--cl-add); background: var(--cl-add); }
.cl-plan-list > li.is-done .cl-check::after {
  content: "";
  width: 6px;
  height: 3.5px;
  margin-top: -1px;
  border-left: 1.6px solid #04210f;
  border-bottom: 1.6px solid #04210f;
  transform: rotate(-45deg);
}

@media (max-width: 560px) {
  .cl-carousel { margin-left: 0; }
}
