/* Run view — self-contained (no cross-origin subresources: the page is served under
   COEP: require-corp). CHARLIE-FIXES T1/T2/T3 (2026-09-26): one morphing /run surface →
   the familiar chat. Tokens follow the T1/T2 frames (Apple-neutral ink, quiet greys);
   every quiet text token clears 4.5:1 on its background in BOTH themes (T1 §6). */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #fbfbfd;
  --field: #f4f4f6;
  --ink: #1d1d1f;
  --body: #515154;         /* 7.9:1 on --bg */
  --muted: #5f5f64;        /* 6.4:1 — secondary copy */
  --quiet: #6e6e73;        /* 5.0:1 — the quietest text allowed (frames' #86868b/#aeaeb2 fail 4.5:1) */
  --line: #e5e5ea;
  --hairline: #ececef;
  --accent: #0066cc;       /* 5.6:1 */
  --on-accent: #ffffff;
  --tint: #eef4fd;
  --fill: #1d1d1f;         /* round send / stop */
  --on-fill: #ffffff;
  --fill-off: #d9d9de;
  --danger: #b3261e;
  --ok: #1a7f37;           /* the ● dot + "ready" (5.0:1) */
  --radius: 12px;
  --col: 760px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316; --surface: #17191d; --field: #202227; --ink: #f2f2f4; --body: #c9c9ce; --muted: #b4b4ba;
    --quiet: #9d9da4; --line: #33353b; --hairline: #26282d; --accent: #6aa8ff; --on-accent: #0b1220; --tint: #1b2638;
    --fill: #f2f2f4; --on-fill: #121316; --fill-off: #3a3c42; --danger: #ff8a80; --ok: #4cc26a;
  }
}
:root[data-theme="dark"] {
  --bg: #121316; --surface: #17191d; --field: #202227; --ink: #f2f2f4; --body: #c9c9ce; --muted: #b4b4ba;
  --quiet: #9d9da4; --line: #33353b; --hairline: #26282d; --accent: #6aa8ff; --on-accent: #0b1220; --tint: #1b2638;
  --fill: #f2f2f4; --on-fill: #121316; --fill-off: #3a3c42; --danger: #ff8a80; --ok: #4cc26a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.run-app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- T1 chrome: 56px, brand · centred status pill · New chat ---- */
.run-top {
  position: sticky; top: 0; z-index: 5; height: 56px; flex: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--hairline);
}
.run-brand { justify-self: start; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; text-decoration: none; }
.run-newchat {
  justify-self: end; white-space: nowrap; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 10px; background: none;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.run-newchat:hover { background: var(--field); color: var(--ink); }
.run-top__end { justify-self: end; display: flex; align-items: center; gap: 4px; min-width: 0; }
.run-library { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 10px; border-radius: 10px; color: var(--accent); font-size: 14px; text-decoration: none; white-space: nowrap; }
.run-library:hover { background: var(--field); }
.run-library:focus-visible, .run-brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.run-brand:hover { text-decoration: underline; text-underline-offset: 3px; }
.run-pill-wrap { position: relative; justify-self: center; }
.run-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.run-pill:disabled { cursor: default; opacity: 1; }
.run-pill:not(:disabled):hover { background: var(--field); }
.run-pill__dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  border: 2px solid var(--quiet); background: transparent;          /* ○ — nothing claimed running */
  transition: background-color 240ms ease, border-color 240ms ease, transform 240ms ease;
}
.run-pill__dot.is-ready { border-color: var(--ok); background: var(--ok); } /* ● — the real first token */
.run-pill__ready { color: var(--ok); font-weight: 600; }
.run-pill__chev { color: var(--quiet); font-size: 11px; margin-left: -2px; }
.program-list {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 10;
  width: max-content; min-width: 260px; max-width: calc(100vw - 32px);
  list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.program-list button {
  width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.program-list button:hover { background: var(--field); }
.program-list button[aria-current="true"] { background: var(--tint); }
.program-list .tag { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }

.run-main { flex: 1; display: flex; flex-direction: column; width: 100%; }

/* ---- phone doctrine panes keep their own column + heading ---- */
.run-head, .run-pane { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
.run-head { padding-top: 20px; }
.run-head h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.run-tagline { margin: 2px 0 6px; color: var(--muted); }
/* W2-1 phone screens (frames mr_entry / mr_check / mr_cantrun / mr_handoff): one calm
   voice, one button that continues the sentence above it, nothing else competing. */
.run-phone { margin-top: 28px; }
.run-phone__head { margin: 0 0 12px; font-size: 30px; line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
.run-phone__body { margin: 0 0 26px; font-size: 17px; line-height: 1.5; color: var(--muted); }
.run-phone__head--center, .run-phone__body--center { text-align: center; }
.run-phone__cta.primary { display: block; width: 100%; min-height: 52px; border-radius: 16px; font-size: 17px; }
.run-phone__quiet { display: block; margin: 14px auto 0; font-size: 15px; color: var(--accent); text-align: center; }
.run-phone__micro { margin: 12px 0 0; text-align: center; font-size: 13px; line-height: 1.45; color: var(--muted); }
.run-phone__addr { margin: 14px 0 0; padding: 16px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: center; font-weight: 700; overflow-wrap: anywhere; }
.run-phone__addr a { color: var(--accent); }
.run-spinner { width: 44px; height: 44px; margin: 72px auto 28px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: run-spin 900ms linear infinite; }
@keyframes run-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .run-spinner { animation: none; } }
.run-expander { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.run-expander summary { cursor: pointer; font-size: 15px; font-weight: 600; }
.run-expander__body { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--muted); }

/* R1 live readout — probe results as quiet lines; each fades in when its probe answers. */
.run-readout { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; font-size: 15px; line-height: 1.45; color: var(--muted); }
.run-readout--final { margin: 0 0 18px; }
.run-readout__line { animation: run-readout-in 220ms ease-out both; }
.run-readout__line--pass, .run-readout__line--reported { color: var(--ink); }
.run-readout__line--fail { color: var(--danger); }
@keyframes run-readout-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .run-readout__line { animation: none; } }


/* ---- T2: THE ONE /run SURFACE (frames t2_run_*; T3b beat on top) ---- */
.run-stage { width: 100%; max-width: 640px; margin: 0 auto; padding: 72px 24px 80px; text-align: center; }
.run-stage__head { margin: 0 0 12px; font-size: 32px; line-height: 1.15; letter-spacing: -0.022em; font-weight: 700; outline: none; text-wrap: balance; }
.run-stage__sub { margin: 0 0 32px; font-size: 17px; line-height: 1.5; color: var(--body); }
.run-bar { height: 10px; margin: 0 0 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.run-bar__fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 320ms ease; }
.run-bytes { margin: 0 0 24px; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.run-body { max-width: 520px; margin: 0 auto 28px; font-size: 16px; line-height: 1.6; color: var(--body); }
/* WX-6a: GR-BODY sits in its grey panel on the getting-ready beats (frame wx-i6-loading). */
.run-body--panel { margin-top: 20px; padding: 18px 20px; border-radius: 14px; background: var(--field); font-size: 15.5px; line-height: 1.55; text-align: left; }
/* WX-6a: the K3 loading line, above the bar. */
.run-progress { margin: 0 0 14px; font-size: 17px; line-height: 1.5; color: var(--body); font-variant-numeric: tabular-nums; }
/* WX-6b: the initializing quiet line — lead text + the A-S5 link. */
.run-trust { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--quiet); }
.run-trust__link { color: var(--accent); text-decoration: none; }
.run-trust__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.run-starting { margin: 4px 0 28px; }
.run-starting__head { margin: 0 0 6px; font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 700; }
.run-starting__sub { margin: 0; font-size: 16px; line-height: 1.5; color: var(--body); }
.run-switch { margin: 0 0 22px; }
.run-switch__others { margin: 0 0 6px; font-size: 14px; color: var(--quiet); }
.run-switch__list { list-style: none; margin: 0; padding: 0; }
.run-switch__row {
  min-height: 32px; padding: 4px 6px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--accent); cursor: pointer; border-radius: 8px; text-underline-offset: 3px;
}
.run-switch__row:hover { text-decoration: underline; }
.run-micro { margin: 0 0 6px; font-size: 14px; line-height: 1.5; color: var(--quiet); }
.run-micro--stall { margin: 0 0 18px; }
.run-cancel-row { margin: 14px 0 0; }
.run-cancel { font-size: 14px; }
.run-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 20px; margin: 8px 0 20px; }
.run-stage[data-kind] .run-stage__head { font-size: 30px; }
/* failures: no bar, no counter — the head, the honest body, one action + one quiet link */
.run-app[data-surface$="failed"] .run-stage__head, .run-app[data-surface="offline"] .run-stage__head,
.run-app[data-surface="not-found"] .run-stage__head, .run-app[data-surface="cancelled"] .run-stage__head { margin-bottom: 14px; }

/* ---- T1: the chat ---- */
.run-chat { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 24px; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 0 28px; text-align: center; }
.chat-handoff { margin: 0 0 18px; font-size: 13px; color: var(--quiet); font-variant-numeric: tabular-nums; }
.chat-first { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--ok); }
.chat-greeting { margin: 0 0 8px; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; outline: none; text-wrap: balance; }
.chat-greeting-sub { margin: 0 0 28px; font-size: 16px; color: var(--muted); text-wrap: balance; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
.chips:empty { display: none; }
.chips .chip {
  min-height: 72px; padding: 14px 16px; text-align: left; vertical-align: top;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; line-height: 1.35; cursor: pointer; display: flex; align-items: flex-start;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.chips .chip:hover { border-color: var(--quiet); background: var(--bg); }
.chips .chip:active { transform: scale(.985); }

.messages { display: flex; flex-direction: column; gap: 26px; padding: 28px 0 8px; }
.messages:empty { display: none; padding: 0; }
.msg { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 85%; text-align: left; }
.msg.assistant { align-self: stretch; }
/* caret-only streaming: a steady block that blinks gently; never animates through a stall */
.msg.is-streaming .body::after {
  content: ""; display: inline-block; width: 9px; height: 1.15em; margin-left: 2px; vertical-align: -0.2em;
  background: var(--ink); border-radius: 1px; animation: run-caret 1s steps(1) infinite;
}
@keyframes run-caret { 50% { opacity: 0; } }
.msg__note { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); white-space: normal; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.msg__note-text { border-left: 2px solid var(--ink); padding-left: 10px; }
/* WX-7: the visible Stop beside the slow-first clock line, and its micro. */
.msg__stop {
  min-height: 30px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
  color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.msg__stop:hover { background: var(--field); }
.msg__micro { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--quiet); white-space: normal; }
.msg__actions { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; white-space: normal; }
.msg__action { font-size: 13px; text-decoration: none; color: var(--quiet); padding: 4px 2px; min-height: 28px; }
.msg__action:hover { color: var(--ink); text-decoration: underline; }
.msg__dot { color: var(--quiet); font-size: 13px; }

.chat-dock { position: sticky; bottom: 0; z-index: 3; padding: 12px 0 0; background: linear-gradient(to bottom, transparent, var(--bg) 14px); }
.composer {
  display: flex; align-items: flex-end; gap: 12px; padding: 10px 10px 10px 22px;
  background: var(--field); border: 1px solid transparent; border-radius: 28px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.composer:focus-within { border-color: var(--line); box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.composer textarea {
  flex: 1; min-height: 36px; max-height: 200px; padding: 7px 0; border: 0; outline: none; resize: none;
  background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 22px;
}
.composer textarea::placeholder { color: var(--quiet); opacity: 1; }
.composer__btn {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); color: var(--on-fill); cursor: pointer; transition: background-color 160ms ease, transform 120ms ease;
}
.composer__btn:active { transform: scale(.94); }
.composer__send:disabled { background: var(--fill-off); color: var(--on-fill); cursor: default; opacity: 1; }
.chat-disclaimer { margin: 0; padding: 10px 8px 20px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--quiet); }
.run-chat[data-chat="empty"] .chat-dock { position: static; }
.run-chat[data-chat="empty"] .chat-empty { flex: none; padding-top: max(56px, 13vh); }

/* the morph: the surface repaints in place with a soft settle, never a page change */
.is-morphing { animation: run-settle 260ms ease-out; }
@keyframes run-settle { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .run-top { padding: 0 12px; height: 52px; }
  .run-app[data-surface="chat"] .run-brand { visibility: hidden; }
  .run-brand { font-size: 15px; }
  .run-pill { min-height: 36px; padding: 6px 14px; font-size: 13px; }
  .run-stage { padding: 48px 18px 64px; }
  .run-stage__head { font-size: 26px; }
  .run-stage__sub { font-size: 16px; margin-bottom: 26px; }
  .run-chat { padding: 0 16px; }
  .chat-greeting { font-size: 24px; }
  .chat-greeting-sub { font-size: 14px; margin-bottom: 22px; }
  .chips { grid-template-columns: 1fr; gap: 10px; }
  .chips .chip { min-height: 48px; align-items: center; border-radius: 14px; font-size: 14px; }
  .chat-disclaimer { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .is-morphing { animation: none; }
  .msg.is-streaming .body::after { animation: none; }
  .run-bar__fill, .run-pill__dot, .run-pill, .chips .chip, .composer, .composer__btn { transition: none; }
}

.quiet-link {
  display: inline; padding: 0; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.quiet-link:hover { color: var(--accent); }
.run-actions .quiet-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.run-actions .quiet-link:hover { text-decoration: underline; }
.run-quiet { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
button.primary {
  min-height: 48px; padding: 12px 28px; border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer;
}
a.primary { display: inline-flex; align-items: center; min-height: 48px; padding: 12px 28px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
button:disabled { cursor: not-allowed; }
button.primary:disabled { opacity: .55; }

/* Post-answer KEEP card — WX-8 (frame wx-i8-keep): head, sub, one primary, a quiet door
   under it. No download control. The parked card opens inline under the door. */
.keep-card {
  margin-top: 22px; padding: 20px 0 4px; border-top: 1px solid var(--hairline);
}
.keep-card__heading { margin: 0 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.keep-card__sub { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.keep-card__save {
  min-height: 44px; padding: 11px 24px; border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.keep-card__quiet { margin: 14px 0 0; }
.keep-card__door {
  display: inline; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 15px;
  text-decoration: none; cursor: pointer; text-underline-offset: 3px;
}
.keep-card__door:hover { text-decoration: underline; }
.keep-card__parked { margin: 12px 0 0; padding: 16px 18px; max-width: 34em; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.keep-card__parked-head { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.keep-card__parked-body { margin: 0 0 12px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.keep-card__saved { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.keep-card__saved-line { margin: 0; color: var(--ok); font-weight: 700; }

/* PIVOT FUNNEL — the usefulness question (only when the funnel is enabled). */
.run-useful { margin-top: 18px; padding: 16px 0 4px; border-top: 1px solid var(--hairline); }
.run-useful__q, .run-useful__why { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.run-useful__choices { display: flex; flex-wrap: wrap; gap: 8px; }
.run-useful__btn {
  min-height: 40px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer;
}
.run-useful__btn:hover { border-color: var(--accent); }
.run-useful__reasons { margin-top: 14px; }
.run-useful__thanks { margin: 0; color: var(--muted); font-size: 15px; }

[hidden] { display: none !important; }
:is(button, a, textarea, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.composer textarea:focus-visible { outline: none; }
/* the composer's focus indicator: a 2px accent ring on the field itself (≥3:1, calm on arrival) */
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 2px 12px rgba(0,0,0,.06); }
.msg__actions .msg__action { color: var(--quiet); font-size: 13px; text-decoration: none; }
.msg__actions .msg__action:hover { color: var(--ink); text-decoration: underline; }

/* S-A11Y-6 (Wave 4): visually-hidden utility — supports L-A11Y-1's
   <label class="visually-hidden" for="prompt">Type your question</label>. */
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}
/* WN4 — the check's receipt: a calm, always-open card under the MR-C body. */
.run-receipt { margin: 0 0 22px; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.run-receipt__title { margin: 0 0 10px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.run-receipt__rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.run-receipt__self { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--muted); }
/* Phone quiet links sit centred under the one CTA (beats the generic .quiet-link inline style). */
.quiet-link.run-phone__quiet { display: block; margin: 14px auto 0; min-height: 44px; font-size: 15px; color: var(--accent); text-align: center; }

/* §D26 T1-ERROR-CHROME — a failure (and the cancelled beat) is head + honest body + ONE
   primary full-width button + the quiet link centred BELOW it; no chat input renders. */
.run-app[data-surface$="failed"] .run-actions, .run-app[data-surface="offline"] .run-actions,
.run-app[data-surface="not-found"] .run-actions, .run-app[data-surface="cancelled"] .run-actions,
.run-app[data-surface="capability"] .run-actions, .run-app[data-surface="memory"] .run-actions { flex-direction: column; align-items: stretch; }
.run-app[data-surface$="failed"] .run-actions .primary, .run-app[data-surface="offline"] .run-actions .primary,
.run-app[data-surface="not-found"] .run-actions .primary, .run-app[data-surface="cancelled"] .run-actions .primary,
.run-app[data-surface="capability"] .run-actions .primary, .run-app[data-surface="memory"] .run-actions .primary { width: 100%; justify-content: center; }
.run-app[data-surface$="failed"] .run-actions .quiet-link, .run-app[data-surface="offline"] .run-actions .quiet-link,
.run-app[data-surface="not-found"] .run-actions .quiet-link, .run-app[data-surface="cancelled"] .run-actions .quiet-link,
.run-app[data-surface="capability"] .run-actions .quiet-link, .run-app[data-surface="memory"] .run-actions .quiet-link { align-self: center; }

/* HIDDEN PHONE RUN TEST MODE (phone-test.js) — renders ONLY behind the secret-gated flag. */
.phone-test { margin: 0; padding: 10px max(16px, env(safe-area-inset-left, 0px)) 10px max(16px, env(safe-area-inset-right, 0px)); background: #fff4d6; color: #3d2a00; border-bottom: 2px solid #8a5600; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.phone-test__banner { margin: 0 0 6px; font-weight: 700; }
.phone-test__crash { margin: 0 0 6px; color: #8b1a12; font-weight: 700; }
.phone-test__details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.phone-test__readout { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; font: inherit; }
.phone-test__copy { margin-top: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #8a5600; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-weight: 700; }

/* Home-screen app (standalone-nav.js): safe areas, Back, 44px targets. Inert in a tab. */
.run-top { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
html[data-hb-standalone] .chat-dock { padding-bottom: env(safe-area-inset-bottom, 0px); }
html[data-hb-standalone] .run-library, html[data-hb-standalone] .run-newchat { min-height: 44px; }
html[data-hb-standalone] .run-brand { display: inline-flex; align-items: center; min-height: 44px; }
.hb-standalone-back {
  position: absolute; left: max(4px, env(safe-area-inset-left, 0px)); top: 6px; z-index: 6;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 12px;
  background: none; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hb-standalone-back[hidden] { display: none; }
.hb-standalone-back:active { background: var(--field); }
.hb-standalone-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html[data-hb-standalone] .run-pill { min-height: 44px; }
/* With Back present the brand column sizes to its content so "Hugging Bay" never truncates. */
html[data-hb-can-back] .run-top { grid-template-columns: auto minmax(0, 1fr) auto; }
html[data-hb-can-back] .run-pill-wrap { justify-self: center; }

/* ---- UX lane 3 (2026-09-28; lock pass 2026-09-29): the FIRST-RUN layer ---------------
   Pre-flight card (what / size / the real check / time) on the loading beats, the locked
   step eyebrow (F1/F3), the first-try card (sample + paste box) that can be queued during the
   load, and the A4 first-answer payoff. Tokens only; both themes; 390 px. */
.run-step { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; color: var(--muted); }
.run-micro--consent { margin: 4px 0 14px; }
.run-preflight {
  margin: 0 0 28px; padding: 18px 20px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.run-preflight__title { margin: 0; font-size: 19px; line-height: 1.3; font-weight: 700; letter-spacing: -0.012em; }
.run-preflight__what { margin: 2px 0 12px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.run-preflight__facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.run-preflight__row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.run-preflight__row:last-child { border-bottom: 0; padding-bottom: 2px; }
.run-preflight__row dt { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.run-preflight__row dd { margin: 0; font-size: 14px; line-height: 1.5; color: var(--body); }

.run-leave { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.run-task-slot:empty { display: none; }
#stageTaskSlot { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--hairline); }
.run-task { text-align: left; width: 100%; }
.run-task__lead { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.run-task__head { margin: 0 0 4px; font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -0.014em; }
.run-task__sub { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.run-task__field {
  display: block; width: 100%; min-height: 120px; max-height: 320px; padding: 12px 14px; resize: vertical;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink);
  font: inherit; font-size: 15px; line-height: 1.55;
}
.run-task__field:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.run-task__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 12px 0 0; }
.run-task__run.primary { min-height: 44px; padding: 10px 22px; }
.run-task__queued { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--tint); font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.run-task__queued .quiet-link { margin-left: 6px; }
.run-task__caveat { margin: 12px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--quiet); }
/* In the (empty) chat the card sits between the greeting and the starters. */
#chatTaskSlot { width: 100%; margin: 0 0 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.chips-lead { align-self: flex-start; margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); }

.run-a4 { margin: 0 0 18px; }
.run-a4__head { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.run-a4__sub { margin: 4px 0 0; font-size: 17px; line-height: 1.45; color: var(--muted); }
.run-result { margin: 18px 0 0; }
.run-a4__line { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--body); }
.run-a4__keep.primary { margin-top: 12px; min-height: 48px; padding: 10px 24px; }
/* Phone verdict F: the handoff is a link LINE (not a pill), then the quiet escape + micro. */
.run-phone__handoff { margin: 22px 0 6px; font-size: 17px; line-height: 1.5; color: var(--ink); }
.run-phone__handoff-link { font-weight: 600; color: var(--accent); text-underline-offset: 3px; }
.run-phone__back { margin: 6px 0 0; }
.run-phone__back .quiet-link { display: inline-flex; align-items: center; min-height: 48px; }
.run-result__useful:empty { display: none; }
.run-result__useful { margin-top: 12px; }

/* the loading beat reads top-down (card → status → steps → the first try) */
.run-app[data-surface="loading"] .run-stage, .run-app[data-surface="stalled"] .run-stage,
.run-app[data-surface="starting"] .run-stage, .run-app[data-surface="still-starting"] .run-stage { padding-top: 40px; }

@media (max-width: 640px) {
  .run-preflight { padding: 16px 16px 12px; margin-bottom: 22px; }
  .run-preflight__row { grid-template-columns: 1fr; gap: 2px; }
  .run-app[data-surface="loading"] .run-stage, .run-app[data-surface="stalled"] .run-stage,
  .run-app[data-surface="starting"] .run-stage, .run-app[data-surface="still-starting"] .run-stage { padding-top: 24px; }
  #chatTaskSlot { padding: 16px 14px; }
  .run-task__run.primary { width: 100%; justify-content: center; }
  .run-phone__head { font-size: 26px; }
  .run-a4__head { font-size: 24px; }
  .run-a4__keep.primary { width: 100%; justify-content: center; }
}

/* 2026-09-29: the LOCKED run-step line under the unsupported body, before the file link. */
.run-runstep { margin-top: -16px; font-size: 15px; }

/* ---------- PETER SHIP LIST (2026-09-30) — ledger, continuity, W-A3 beat, T8 card, P1/P3 ---------- */
/* (3) Flow 3 continuity line: a quiet tinted note above the handshake. */
.run-continuity { margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius); background: var(--tint); color: var(--ink); font-size: 15px; line-height: 1.5; text-align: left; }
/* (1) Flow 2 byte ledger: two quiet tabular rows UNDER the bar (the bar is the hero). */
.run-ledger { margin: 2px 0 14px; padding: 10px 0 0; border-top: 1px solid var(--hairline); text-align: left; }
.run-ledger__row { display: flex; justify-content: space-between; gap: 16px; margin: 2px 0; font-size: 14px; line-height: 1.5; }
.run-ledger__row dt { color: var(--quiet); }
.run-ledger__row dd { margin: 0; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* (6) P3 — the NL4 step list (live states). */
.run-steps { margin: 4px 0 16px; text-align: left; }
.run-steps__head { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.run-steps__list { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.run-steps__item { position: relative; margin: 0 0 4px; padding-left: 28px; font-size: 14.5px; line-height: 1.5; color: var(--quiet); counter-increment: step; }
.run-steps__item::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; line-height: 18px; text-align: center; color: var(--quiet); }
.run-steps__item--now { color: var(--ink); font-weight: 600; }
.run-steps__item--now::before { border-color: var(--accent); color: var(--accent); }
.run-steps__item--done { color: var(--body); }
.run-steps__item--done::before { content: "\2713"; border-color: var(--ok); color: var(--ok); }
/* (4) W-A3 retry beat: counter + drop tick. */
.run-bar { position: relative; }
.run-bar__tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); }
.run-beat__counter { margin: 4px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.run-beat__sub { margin: 0 0 12px; font-size: 14px; color: var(--quiet); }
.run-beat__caption { margin: -4px 0 14px; font-size: 13.5px; color: var(--quiet); text-align: left; }
.run-beat__mark { color: var(--ink); }
.run-beat__quiet { margin: 10px 0 6px; }
/* (7) T8 recovery card: the pale-green evidence box + the quiet outcome line. */
.run-evidence { margin: 14px 0 16px; padding: 12px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--ok) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--ok) 28%, var(--bg)); color: var(--ink); font-size: 15px; line-height: 1.5; text-align: left; }
.run-outcome { margin: 10px 0 6px; font-size: 13.5px; }
/* (6) P1 on the handshake. */
.run-p1__why { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: var(--body); }
.run-p1__fit { margin: 0 0 12px; }
.run-p1__badge { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--ok); }
.run-p1__choose { margin: 8px 0 0; font-size: 14px; }
.run-p1__hundred { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius); background: var(--tint); text-align: left; }
.run-p1__hundred-head { margin: 0 0 2px; font-size: 14px; font-weight: 600; color: var(--ink); }
.run-p1__hundred-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--body); }
.run-explainer { margin: 8px 0 10px; }
@media (max-width: 640px) {
  .run-ledger__row { font-size: 13.5px; }
  .run-beat__counter { font-size: 24px; }
}
/* Design QA c27: the phone bar's controls meet the 44px touch floor in a normal tab too
   (was 36px outside the home-screen app). Craft only. */
@media (pointer: coarse) {
  .run-library, .run-newchat, .run-pill { min-height: 44px; }
  .run-brand { display: inline-flex; align-items: center; min-height: 44px; }
}
/* OFFLINE RUN (2026-09-29) — the dare (its own quiet beat after the first answer; the design's
   card: surface panel, hairline, no modal, no fanfare) and the kept-chats disclosure. */
.run-dare { margin: 22px 0 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.run-dare__text { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink); }
.run-dare__dismiss { margin-top: 10px; }
.run-dare[data-state="proof"] { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.run-dare__head { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.run-dare__witnessed { margin: 8px 0 0; font-size: 16px; line-height: 1.5; color: var(--ink); }
.run-dare__quiet { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.chat-history { margin: -12px 0 0; padding: 0 8px 18px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--quiet); }
.chat-history__toggle { font-size: 12px; }
.chat-restored { margin: 0 0 10px; font-size: 13px; color: var(--quiet); }
@media (max-width: 480px) { .run-dare { padding: 14px 16px; } }

/* PETER WOW PACK (2026-09-30) */
/* #53 ?from=phone banner — light strip, dismissible (track6 C3 B2). */
.run-from-phone { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--tint); color: var(--ink); text-align: left; }
.run-from-phone[hidden] { display: none; }
.run-from-phone__text { margin: 0; flex: 1; font-size: 15px; line-height: 1.5; }
.run-from-phone__x { flex: none; min-width: 44px; min-height: 44px; margin: -10px -8px -10px 0; border: 0; background: transparent; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
/* #55 designed-path reframe — the shaded box (track6 C1 A). */
.run-phone__reframe { margin: 12px 0; padding: 12px 14px; border-radius: var(--radius); background: var(--tint); color: var(--ink); font-size: 15px; line-height: 1.5; text-align: left; }
.run-phone__reframe[hidden] { display: none; }
/* #46 F3 payoff line under the loading body. */
.run-payoff { margin-top: 10px; }
/* round 4: the killed last try's diagnostics, shown first, with the smaller-model next step */
.phone-test__lasttry { font-weight: 400; color: inherit; max-height: 40vh; overflow: auto; white-space: pre-wrap; }
.phone-test__smaller { display: block; margin: 6px 0; font-weight: 700; }
/* Round 6 (phone test &phone_lite=1): the minimal-render page — no animation/transition,
   transforms, filters, backdrop blur, sticky/fixed layers, smooth scroll or web fonts. */
html.phone-lite, html.phone-lite * { scroll-behavior: auto !important; }
html.phone-lite *, html.phone-lite *::before, html.phone-lite *::after {
  animation: none !important; transition: none !important; transform: none !important;
  filter: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  will-change: auto !important; box-shadow: none !important; background-image: none !important;
  font-family: -apple-system, system-ui, sans-serif !important;
}
html.phone-lite body * { position: static !important; }
html.phone-lite .phone-test__readout { max-height: 30vh; overflow: auto; }

/* ===================================================================   Hugging Bay brand redesign (Charlie, 2026-09-29): the runner joins the new
   identity. Tokens only re-point the palette; wording is untouched. Fonts are
   served from the main site (/fonts/brand-2026/), same origin as /run.
   ========================================================================== */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 500 900; font-display: swap; src: url("/fonts/brand-2026/Outfit-latin.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/brand-2026/DMSans-latin.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/fonts/brand-2026/JetBrainsMono-latin.woff2") format("woff2"); }
:root {
  --bg: #ffffff; --surface: #f6f6f8; --field: #f6f6f8; --ink: #0b0b0f; --body: #3a3a44; --muted: #4a4a55; --quiet: #6b6b76;
  --line: #e0e0e6; --hairline: #e6e6ea; --accent: #0b0b0f; --on-accent: #ffffff; --tint: #f6f6f8;
  --fill: #0b0b0f; --on-fill: #ffffff; --ok: #127a36;
  --brand-green: #3fe06a;
  --font-display: "Outfit", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e12; --surface: #16161c; --field: #16161c; --ink: #f4f4f6; --body: #c8c8d0; --muted: #b8b8c2; --quiet: #9a9aa6;
    --line: #2a2a33; --hairline: #22222a; --accent: #f4f4f6; --on-accent: #0b0b0f; --tint: #16161c; --fill: #f4f4f6; --on-fill: #0b0b0f; --ok: #4cc26a;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e12; --surface: #16161c; --field: #16161c; --ink: #f4f4f6; --body: #c8c8d0; --muted: #b8b8c2; --quiet: #9a9aa6;
  --line: #2a2a33; --hairline: #22222a; --accent: #f4f4f6; --on-accent: #0b0b0f; --tint: #16161c; --fill: #f4f4f6; --on-fill: #0b0b0f; --ok: #4cc26a;
}
body { font-family: var(--font-body); }
button, input, textarea, select { font-family: inherit; }

/* Header: the brand logo (the link text stays for screen readers). */
.run-top { height: 64px; border-bottom: 1px solid var(--hairline); }
.run-brand {
  display: inline-block; width: 142px; height: 40px; overflow: hidden;
  color: transparent; font-size: 0; line-height: 0;
  background: url("/brand/logo.png") left center / contain no-repeat;
}
.run-brand:hover { text-decoration: none; opacity: 0.8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .run-brand { filter: invert(1); } }
:root[data-theme="dark"] .run-brand { filter: invert(1); }
.run-library { color: var(--ink); font-weight: 600; }
.run-pill { border-color: var(--line); font-family: var(--font-display); font-weight: 700; }

/* Stage type: the big Outfit headline, like the rest of the site. */
.run-stage__head, .run-phone__head, .run-head h1 {
  font-family: var(--font-display); font-weight: 900; letter-spacing: -0.035em; line-height: 1;
  font-size: clamp(34px, 5vw, 52px);
}
.run-stage[data-kind] .run-stage__head { font-size: clamp(30px, 4.4vw, 44px); }
.run-stage__sub { font-size: clamp(17px, 1.6vw, 19px); }
.run-step { font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--quiet); }

/* Buttons: ink pills in Outfit. */
button.primary, a.primary {
  border: 2px solid var(--fill); border-radius: 999px; background: var(--fill); color: var(--on-fill);
  font-family: var(--font-display); font-weight: 700; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button.primary:hover:not(:disabled), a.primary:hover { transform: translateY(-2px); box-shadow: 0 4px 0 color-mix(in srgb, var(--fill) 30%, transparent); }
.run-phone__cta.primary { border-radius: 999px; }
.quiet-link, .run-phone__quiet { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.run-spinner { border-top-color: var(--ink); }
.run-pill__dot.is-ready { border-color: var(--brand-green); background: var(--brand-green); }
@media (prefers-reduced-motion: reduce) {
  button.primary, a.primary { transition: none; }
  button.primary:hover:not(:disabled), a.primary:hover { transform: none; }
}
@media (max-width: 520px) {
  .run-top { padding: 0 12px; gap: 6px; }
  .run-brand { width: 96px; height: 28px; }
  .run-pill { padding: 6px 12px; font-size: 13px; }
}
=======
.msg__fit { margin: 4px 0 0; font-size: 13px; color: var(--muted, #666); }
/* The "jump to the latest" arrow (shown only while the reader has scrolled up). */
.chat-jump { display: block; margin: 0 auto 8px; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--ink); }
.chat-jump[hidden] { display: none; }

/* Founder Phase 1: retain the minimal flow bar, align its frame and targets. */
:root { --wrap-narrow: 720px; --wrap-wide: 1120px; --wrap-full: 1400px; --col: var(--wrap-narrow); }
.run-app :is(a, button, summary, input, select) { min-height: 44px; }
.run-app :is(a, button, summary) { min-width: 44px; }
.run-app a { display: inline-flex; align-items: center; }
.run-app :is(p, span, label, small, pre):not(.run-brand) { font-size: max(14px, 1em); }
.run-app .run-brand { height: 44px; }
.run-app #stageQuietLink { min-height: 44px; }

/* Founder Phase 2: a quiet rail, one live loading card, Charlie's tokens. */
.phase2-run-rail { list-style:none; padding:0; display:flex; gap:12px; max-width:720px; margin:24px auto; font-size:14px; }
.phase2-run-rail li { flex:1; padding:12px 8px; border-bottom:2px solid var(--line, #888); }
.phase2-run-rail [aria-current="step"] { font-weight:700; border-color:var(--green, #22864b); }
.phase2-run-rail [data-complete] { color:var(--muted); }
.run-stage { border:1px solid var(--line, #888); border-radius:16px; padding:24px; max-width:720px; }
@media(max-width:640px) { .phase2-run-rail { margin:16px; } .run-stage { padding:20px; } }
