/* ══════════════════════════════════════════════════════════════════
   ACE digital twin - a 1:1 scripted replica of the shipped app UI.
   Ported from duocode/src/app/globals.css, chat-surface.css,
   board-surface.css, chat-dock.css, task-board.css (dev @ 6925de2c).
   Scoped under .tw so it can sit inside any landing page.
   Light theme (the app default). Values are the app's own tokens.
   ══════════════════════════════════════════════════════════════════ */

.tw {
  /* tokens (globals.css :root, light) */
  --bg: #F6F0E6;
  --surface-solid: #FFF9F1;
  --surface-2-solid: #EFE4D3;
  --surface-3-solid: #E7DCCA;
  --surface: rgba(255, 249, 241, 0.74);
  --surface-2: rgba(239, 228, 211, 0.56);
  --text: #1E1A17;
  --text-muted: #746C63;
  --text-muted-2: #877F75;
  --text-on-tint: #4A443C;
  --line: rgba(124, 99, 72, 0.24);
  --line-strong: rgba(124, 99, 72, 0.38);
  --grid: rgba(38, 32, 26, 0.055);
  --shadow: rgba(42, 31, 20, 0.12);
  --shadow-sm: 0 1px 2px rgba(42, 31, 20, 0.05);
  --shadow-md: 0 1px 2px rgba(42, 31, 20, 0.05), 0 8px 24px rgba(42, 31, 20, 0.08);
  --shadow-lg: 0 12px 40px rgba(42, 31, 20, 0.16);
  --mention-ink: #8F3505;
  --mention-fill: #F4D2B9;
  --accent-claude: #E96B2C;
  --accent-claude-deep: #C65B25;
  --accent-codex: #1F7A72;
  --accent-gemini: #4285F4;
  --semantic-success: #43A047;
  --semantic-success-text: #2E7D32;
  --semantic-warning: #FFB300;
  --semantic-warning-text: #B26A00;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --dur-short: 180ms;
  --dur-medium: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --glass-surface: rgba(255, 249, 241, 0.66);
  --glass-surface-strong: rgba(255, 249, 241, 0.82);
  --font-body: 'Satoshi', system-ui, sans-serif;
  --font-fraunces: 'Fraunces', Georgia, serif;
  --font-jetbrains: 'JetBrains Mono', ui-monospace, monospace;
  --acx-gutter: 24px;
  --app-backdrop:
    linear-gradient(135deg, rgba(233, 107, 44, 0.12) 0%, rgba(246, 240, 230, 0) 34%, rgba(31, 122, 114, 0.10) 70%, rgba(212, 184, 255, 0.12) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(90deg, rgba(30, 26, 23, 0.025) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(0deg, rgba(30, 26, 23, 0.018) 0 1px, transparent 1px 36px);

  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg);
  background-image: var(--app-backdrop);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  cursor: default;
  container-type: size;
}
/* dark theme ([data-theme="dark"] tokens from globals.css) */
.tw[data-theme="dark"] {
  --bg: #0A0A0B;
  --surface-solid: #141416;
  --surface-2-solid: #1C1C1F;
  --surface-3-solid: #0F0F11;
  --surface: rgba(20, 20, 22, 0.68);
  --surface-2: rgba(28, 28, 31, 0.62);
  --text: #E8E8E8;
  --text-muted: #A3A3AA;
  --text-muted-2: #70707A;
  --text-on-tint: #A3A3AA;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --grid: rgba(255, 240, 220, 0.045);
  --shadow: rgba(0, 0, 0, 0.48);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --mention-ink: #FFC9A3;
  --mention-fill: #3A2A20;
  --accent-claude-deep: #CF6229;
  --semantic-success-text: #66BB6A;
  --semantic-warning-text: #FFB300;
  --glass-surface: rgba(20, 20, 22, 0.58);
  --glass-surface-strong: rgba(20, 20, 22, 0.76);
  --app-backdrop:
    linear-gradient(135deg, rgba(233, 107, 44, 0.12) 0%, rgba(10, 10, 11, 0) 34%, rgba(31, 122, 114, 0.10) 70%, rgba(212, 184, 255, 0.12) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 38px);
}
.tw[data-theme="dark"] ::selection { background: rgba(233, 107, 44, 0.35); }
.tw[data-theme="dark"] .tw-node.is-working .tw-node-disc {
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 40%, transparent), 0 0 58px color-mix(in srgb, var(--c) 22%, transparent), 0 18px 42px var(--shadow);
}

.tw *, .tw *::before, .tw *::after { box-sizing: border-box; }
.tw button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
.tw ::selection { background: rgba(233, 107, 44, 0.22); }

/* ── Top bar ─────────────────────────────────────────────────── */
.tw-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  background: var(--glass-surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(150%) blur(22px);
  z-index: 45;
}
.tw-lights { display: flex; gap: 8px; margin-right: 8px; }
.tw-lights i { width: 12px; height: 12px; border-radius: 50%; }
.tw-lights i:nth-child(1) { background: #F2555A; }
.tw-lights i:nth-child(2) { background: #F6BD3B; }
.tw-lights i:nth-child(3) { background: #43C645; }
.tw-brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-fraunces);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.22;
  color: var(--text);
}
.tw-brand-icon {
  width: 26px;
  height: 26px;
  margin-right: 6px;
  background: url('/ace-spade-logo.svg') center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 106, 61, 0.32));
}
.tw-hc {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2-solid);
}
.tw-hc-spade { color: var(--accent-claude); font-size: 14px; line-height: 1; }
.tw-hc-kick {
  font-family: var(--font-jetbrains);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-on-tint);
}
.tw-hc-title { font-family: var(--font-fraunces); font-size: 14px; font-weight: 700; white-space: nowrap; }
.tw-topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.tw-avstack { display: flex; }
.tw-avstack .tw-orb { box-shadow: 0 0 0 2px var(--surface-solid); }
.tw-avstack .tw-orb + .tw-orb { margin-left: -7px; }
.tw-sep { width: 1px; height: 20px; background: var(--line); }
.tw-gear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
}
.tw-gear svg { width: 15px; height: 15px; }

/* The one layout control: a stepped pill (TopBar.tsx LAYOUT_CONTROL_CSS) */
.tw-layout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  transition: border-color 160ms ease, color 160ms ease;
}
.tw[data-layout="split"] .tw-layout { border-color: color-mix(in srgb, var(--accent-claude) 25%, var(--line)); color: var(--accent-claude); }
.tw[data-layout="full"] .tw-layout { border-color: color-mix(in srgb, var(--accent-claude) 45%, var(--line)); color: var(--accent-claude); }
.tw-layout-icon { display: grid; place-items: center; }
.tw-layout-icon svg { width: 15px; height: 15px; display: block; }
.tw-layout-scope {
  font-family: var(--font-jetbrains);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-on-tint);
}
.tw-layout-stop { font-size: 12px; font-weight: 600; line-height: 1; color: var(--text); }

/* ── Body seam ───────────────────────────────────────────────── */
.tw-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  position: relative;
  --fs-msg: 14px;
}
/* the chat is zoomed with the frame (twin.js sets --tw-zoom from the
   container's width, up to 2x), so a big stage reads like a big screen;
   the rail follows at half the rate so it never crowds the chat */
.tw-chat-col { zoom: var(--tw-zoom, 1); }
.tw-rail { zoom: var(--tw-zoom-rail, 1); }
/* at high zoom the composer gives the feed its room back */
.tw[data-zoom="up"] .tw-comp-actions { display: none; }
.tw[data-zoom="up"] .tw-composer { padding: 10px var(--acx-gutter) 12px; }
.tw[data-zoom="up"] .tw-composer-box { padding: 10px 12px; }
.tw[data-zoom="up"] .tw-composer-btns button { width: 36px; height: 36px; border-radius: 9px; }
.tw[data-zoom="up"] .tw-composer-btns button svg { width: 15px; height: 15px; }
.tw[data-zoom="up"] .tw-msg { padding: 10px var(--acx-gutter); }
.tw[data-zoom="up"] .tw-chat-head { padding: 6px var(--acx-gutter); }
.tw[data-zoom="up"] .tw-feed { padding-top: 2px; }
/* with the preview open beside a zoomed chat, the filter pills have no
   room: the head keeps its title and count */
.tw[data-zoom="up"]:has(.tw-pv.is-open) .tw-filters { display: none; }
.tw[data-layout="full"] .tw-board-col, .tw[data-layout="full"] .tw-dock { display: none; }
.tw[data-layout="canvas"] .tw-chat-col, .tw[data-layout="canvas"] .tw-rail, .tw[data-layout="canvas"] .tw-pv { display: none; }
.tw[data-layout="split"] .tw-chat-col, .tw[data-layout="split"] .tw-rail, .tw[data-layout="split"] .tw-pv { display: none; }
.tw-view-fade { animation: tw-fade 200ms var(--ease-out); }
@keyframes tw-fade { from { opacity: 0; } }

/* canvas -> full in one click: the chat sweeps in from the right,
   over the board it is replacing */
.tw.tw-expanding .tw-board-col { display: flex !important; position: absolute; inset: 0; z-index: 1; }
.tw.tw-expanding .tw-chat-col, .tw.tw-expanding .tw-rail { position: relative; z-index: 2; }
.tw.tw-expanding .tw-chat-col { animation: tw-chat-sweep 480ms var(--ease-out) both; }
.tw.tw-expanding .tw-rail { animation: tw-chat-sweep 480ms var(--ease-out) both; }
@keyframes tw-chat-sweep {
  from { transform: translateX(72%); opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .tw.tw-expanding .tw-board-col { display: none !important; }
  .tw.tw-expanding .tw-chat-col, .tw.tw-expanding .tw-rail { animation: none; }
}

/* ── Chat surface (chatLayout = full) ────────────────────────── */
.tw-chat-col { flex: 1 1 auto; display: flex; min-width: 0; }
.tw-chat {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  z-index: 20;
}
.tw-chat-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 8px var(--acx-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface-solid);
  overflow: hidden;
}
.tw-chat-head-title { display: flex; align-items: center; gap: 9px; font-weight: 650; white-space: nowrap; flex: 0 0 auto; }
.tw-chat-head-title .tw-serif { font-family: var(--font-fraunces); font-size: 16px; font-weight: 700; }
.tw-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-family: var(--font-jetbrains);
  font-size: 11px;
  color: var(--text-muted);
}
.tw-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tone, var(--semantic-success)); }
.tw-chat-head-sub { font-size: 11px; color: var(--text-muted); }
.tw-chat-head > .tw-chat-head-sub { margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
.tw-mission {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  font-size: 12.5px;
  font-weight: 650;
  min-width: 0;
}
.tw-mission-mark { color: var(--accent-claude-deep); font-size: 13px; line-height: 1; }
.tw-mission-name { white-space: nowrap; flex: 0 0 auto; }
.tw-mission-goal {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tw-mission-chev { margin-left: auto; color: var(--text-muted); font-size: 12px; flex: 0 0 auto; }
.tw-filters {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.tw-fpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px 3px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  font-size: 11.5px;
  color: var(--text);
}
.tw-fpill.is-on { background: var(--surface-2-solid); }
.tw-fpill { flex: 0 0 auto; }
.tw-fpill b { font-weight: 600; white-space: nowrap; }
.tw-fpill .tw-orb + .tw-orb { margin-left: -8px; }
.tw-fpill .tw-orb { box-shadow: 0 0 0 2px var(--surface-solid); }
.tw-fpill-name { font-weight: 600; color: var(--c, var(--text)); }
.tw-fpill-handle { font-family: var(--font-jetbrains); font-size: 10px; color: var(--text-muted); }

/* thread strip */
.tw-reps {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  max-width: min(100%, 620px);
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 3.5%, transparent);
  font-size: 12.5px;
}
.tw-reps-head { display: flex; align-items: center; gap: 8px; width: 100%; }
.tw-reps-count { font-weight: 650; font-variant-numeric: tabular-nums; }
.tw-reps-when { font-size: 11px; color: var(--text-muted); }
.tw-reps-chev { margin-left: auto; color: var(--text-muted-2); }
.tw-reps { cursor: pointer; transition: background-color var(--dur-short) var(--ease-out); }
.tw-reps:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.tw-reps-chev { transition: transform var(--dur-short) var(--ease-out); }
.tw-reps.is-open .tw-reps-chev { transform: rotate(90deg); }
.tw-rep {
  display: flex;
  align-items: baseline;
  gap: 7px;
  width: 100%;
  min-width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  transition: height var(--dur-short) var(--ease-out), opacity var(--dur-short) var(--ease-out);
}
.tw-reps.is-open .tw-rep { height: 20px; opacity: 1; }
.tw-rep .tw-orb { align-self: center; }
.tw-rep-who { font-size: 12.5px; font-weight: 650; flex: 0 0 auto; }
.tw-rep-time { font-size: 11px; color: var(--text-muted); flex: 0 0 auto; }
.tw-rep-text {
  font-size: calc(var(--fs-msg, 15px) * 0.9);
  line-height: 1.45;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tw-faces { display: flex; align-items: center; }
.tw-faces .tw-orb, .tw-faces .tw-face-user { box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 3.5%, var(--surface-solid)); }
.tw-faces > * + * { margin-left: -5px; }
.tw-faces .tw-face-user { width: 20px; height: 20px; font-size: 10px; }

/* feed */
.tw-feed {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 6px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.tw-feed > :first-child { margin-top: auto; }

.tw-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px var(--acx-gutter) 4px;
  font-family: var(--font-jetbrains);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tw-day::before, .tw-day::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--line); }

/* message row: no card, no border, no fill at rest (chat-surface.css) */
.tw-msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 2px;
  padding: 14px var(--acx-gutter);
  border-radius: var(--radius-lg);
  transition: background-color 180ms var(--ease-out);
  animation: tw-msg-in 300ms var(--ease-out);
}
.tw-msg:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.tw-msg.tw-typing-row:hover { background: transparent; }
@keyframes tw-msg-in { from { transform: translateY(9px); } }

.tw-msg-av { width: 32px; flex: 0 0 auto; display: flex; align-items: flex-start; }
.tw-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: linear-gradient(150deg, var(--c, #E96B2C), color-mix(in srgb, var(--c, #E96B2C) 72%, #000 28%));
}
.tw-orb img { width: 54%; height: 54%; object-fit: contain; filter: brightness(0) invert(1); }
.tw-orb.tw-orb-sm { width: 24px; height: 24px; }
.tw-orb.tw-orb-xs { width: 20px; height: 20px; }
.tw-face-user {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-3-solid);
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
  line-height: 1;
}
.tw-msg-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: stretch; }
.tw-msg-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 4px;
  font-size: calc(var(--fs-msg, 15px) - 0.5px);
  font-weight: 650;
  color: var(--text); /* the name is ink, never the accent */
}
.tw-msg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-2-solid);
  color: var(--text);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
}
.tw-msg-time {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tw-msg-text { font-size: var(--fs-msg, 15px); line-height: 1.55; color: var(--text); text-wrap: pretty; }
.tw-msg-text .tw-mention {
  color: var(--mention-ink);
  background: var(--mention-fill);
  border-radius: 4px;
  padding: 0 3px;
}
.tw-caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  background: var(--text-muted);
}

/* typing indicator: bare dots, message-row geometry, no pill */
.tw-typing-dots { display: flex; gap: 4px; padding: 7px 0; }
.tw-typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.tw-typing-dots i:nth-child(1) { animation: tw-typing-bounce 1.2s infinite; }
.tw-typing-dots i:nth-child(2) { animation: tw-typing-bounce 1.2s infinite 0.18s; }
.tw-typing-dots i:nth-child(3) { animation: tw-typing-bounce 1.2s infinite 0.36s; }
@keyframes tw-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
}

/* work fold */
.tw-work { margin-top: 9px; }
.tw-work-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 4px 11px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--c, var(--accent-claude)) 8%, var(--surface-2-solid));
  color: var(--text-on-tint);
  font-size: calc(var(--fs-msg, 15px) * 0.86);
  text-align: left;
  transition: border-color var(--dur-short) var(--ease-out);
}
.tw-work-head:hover { border-color: color-mix(in srgb, var(--c, var(--accent-claude)) 40%, transparent); }
.tw-work-head-icon { width: 18px; color: var(--c, var(--accent-claude)); font-size: 12px; display: inline-flex; gap: 2px; align-items: center; }
.tw-work-beat { display: inline-flex; gap: 2px; }
.tw-work-beat i {
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.35;
  animation: tw-work-beat 1.1s ease-in-out infinite;
}
.tw-work-beat i:nth-child(2) { animation-delay: 0.13s; }
.tw-work-beat i:nth-child(3) { animation-delay: 0.26s; }
.tw-work-beat i:nth-child(4) { animation-delay: 0.39s; }
@keyframes tw-work-beat {
  0%, 100% { transform: scaleY(0.5); opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 0.95; }
}
.tw-work-head-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-work-head-meta { font-size: 11px; color: var(--text); font-variant-numeric: tabular-nums; }
.tw-work-head-toggle { margin-left: auto; font-size: 11px; color: var(--text); }
.tw-work-body { display: flex; flex-direction: column; gap: 1px; padding: 5px 0 0 4px; }
.tw-work-step {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 9px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: calc(var(--fs-msg, 15px) * 0.84);
}
.tw-work-step-icon { color: var(--text); font-size: 11px; }
.tw-work-step b { font-weight: 600; color: var(--text); }
.tw-work-step-right {
  display: grid;
  grid-template-columns: 44px 36px;
  column-gap: 9px;
  justify-items: end;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tw-work-step-right em { font-style: normal; }
.tw-work-step-right em.is-ok { color: color-mix(in srgb, var(--semantic-success-text) 72%, var(--text)); }
.tw-work-step-right em.is-live { color: var(--text); }

/* reaction chips */
.tw-reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tw-re {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface-2-solid);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  animation: tw-re-in 320ms var(--ease-spring);
}
.tw-re b { font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes tw-re-in { from { opacity: 0; transform: scale(0.5); } }

/* a thumbnail of the marked-up preview, sent into the chat */
.tw-thumb {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: 9px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2-solid);
  animation: tw-re-in 340ms var(--ease-spring);
}
.tw-thumb-shot {
  position: relative;
  width: 74px;
  height: 46px;
  border-radius: 7px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.tw-thumb-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #04102c 0%, #123067 62%, #3f6cc0 100%);
}
.tw-thumb-sun {
  position: absolute;
  left: 50%;
  bottom: 26%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #fff3cf, #f8bd4e 55%, #ec931e);
  box-shadow: 0 0 10px rgba(248, 189, 78, 0.7);
}
.tw-thumb-ridge {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0;
  height: 34%;
  background: #060d20;
  clip-path: polygon(0 52%, 16% 26%, 34% 56%, 52% 16%, 70% 48%, 88% 28%, 100% 52%, 100% 100%, 0 100%);
}
.tw-thumb-mark {
  position: absolute;
  border: 1.4px solid #ff3d8a;
  border-radius: 50%;
}
.tw-thumb-mark.m1 { left: 27%; bottom: 18%; width: 46%; height: 42%; }
.tw-thumb-mark.m2 { left: 12%; top: 12%; width: 56%; height: 24%; }
.tw-thumb-mark.m3 { right: 8%; top: 26%; width: 24%; height: 26%; }
.tw-thumb-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tw-thumb-meta b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.tw-thumb-meta em { font-style: normal; font-size: 11px; color: var(--text-muted); }

/* preview card */
.tw-prev {
  margin-top: 10px;
  max-width: 520px;
  border: 1px solid color-mix(in srgb, var(--semantic-success) 34%, var(--line));
  border-radius: var(--radius-md);
  background: var(--surface-2-solid);
  overflow: hidden;
}
.tw-prev-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--semantic-success) 11%, transparent);
  font-size: 12px;
  font-weight: 600;
}
.tw-prev-head .tw-dot { --tone: var(--semantic-success-text); }
.tw-prev-foot { display: flex; align-items: center; gap: 11px; padding: 9px 11px; }
.tw-prev-where { font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-prev-cta {
  margin-left: auto;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-claude);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  flex: 0 0 auto;
}
.tw-prev-cta:hover { background: var(--accent-claude-deep); }

/* composer */
.tw-composer-wrap { flex: 0 0 auto; border-top: 1px solid var(--line); }
.tw-composer { padding: 12px var(--acx-gutter) 14px; }
.tw-composer-box {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2-solid);
  transition: border-color 150ms ease-in-out;
}
.tw-composer-box.is-focus { border-color: color-mix(in srgb, var(--accent-claude) 55%, transparent); }
.tw-composer-input {
  width: 100%;
  min-height: 22px;
  font-size: var(--fs-msg, 15px);
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.tw-composer-input .tw-ph { color: var(--text); opacity: 0.92; }
.tw-composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.tw-composer-legend { min-width: 0; font-size: calc(var(--fs-msg, 15px) * 0.84); line-height: 1.4; color: var(--text); }
.tw-composer-btns { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.tw-composer-btns button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  color: var(--text-muted);
  transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.tw-composer-btns button:active { transform: scale(0.985); }
.tw-composer-btns button svg { width: 17px; height: 17px; }
.tw-composer-btns .tw-send {
  border: none;
  background: var(--accent-claude);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.tw-send.is-pop { animation: tw-send-pop 180ms var(--ease-out); }
@keyframes tw-send-pop { 50% { transform: scale(0.9); } }
.tw-comp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tw-comp-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: calc(var(--fs-msg, 15px) * 0.8);
  transition: border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.tw-comp-action:hover { border-color: var(--line-strong); color: var(--text); }
.tw-comp-action.is-hot { border-color: var(--accent-claude-deep); color: var(--text); }
.tw-cmd-slash { font-family: var(--font-jetbrains); font-size: 12px; line-height: 1; opacity: 0.75; }

/* ── Preview dock (browser frame beside the chat at full) ────── */
.tw-pv {
  flex: 0 0 auto;
  width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  z-index: 15;
  transition: width var(--dur-medium) var(--ease-out);
}
.tw-pv.is-open { width: 420px; border-left: 1px solid var(--line); }
.tw-pv-inner { width: 420px; height: 100%; display: flex; flex-direction: column; }
.tw-pv-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2-solid);
}
.tw-pv-nav { display: flex; gap: 2px; color: var(--text-muted); }
.tw-pv-nav svg { width: 14px; height: 14px; display: block; }
.tw-pv-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  font-family: var(--font-jetbrains);
  font-size: 10.5px;
  color: var(--text-on-tint);
  white-space: nowrap;
  overflow: hidden;
}
.tw-pv-url .tw-dot { flex: 0 0 auto; --tone: var(--semantic-success); }
.tw-pv-tool {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex: 0 0 auto;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.tw-pv-tool svg { width: 14px; height: 14px; display: block; }
.tw-pv-tool:hover { background: var(--surface-3-solid); color: var(--text); }
.tw-pv-tool.is-on {
  background: color-mix(in srgb, var(--accent-claude) 18%, transparent);
  color: var(--accent-claude);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-claude) 45%, transparent);
}
/* while sketching, the preview says so */
.tw-pv-notes.is-sketching {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-claude) 42%, transparent);
}
.tw-pv-notes.is-sketching::before {
  content: 'Sketching';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent-claude) 88%, #000);
  color: #fff;
  font-family: var(--font-jetbrains);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: tw-re-in 300ms var(--ease-spring);
}

.tw-pv-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.tw-pv-x:hover { background: var(--surface-3-solid); color: var(--text); }
.tw-pv-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }

/* ── The built page shown in the preview: "Alpenglow", a dawn-ultra
   landing page the agents just shipped. Default styles are the FINISHED
   frame; adding .is-play replays the whole sunrise. ─────────────────── */
.tw-pv-page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(130% 62% at 50% 112%, rgba(255, 176, 64, 0.42), rgba(255, 140, 40, 0.10) 46%, transparent 64%),
    linear-gradient(180deg, #04102c 0%, #081b45 34%, #123067 58%, #27509f 80%, #3f6cc0 100%);
  color: #f5efe2;
  font-family: var(--font-body);
  text-align: center;
}
.tw-pv-page::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background-image: radial-gradient(rgba(245, 239, 226, 0.10) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  opacity: 0.35;
  mix-blend-mode: overlay;
}
.tw-ag-stars {
  position: absolute;
  top: 8%;
  left: 10%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    18px 6px 0 rgba(245, 239, 226, 0.9), 84px 30px 0 rgba(245, 239, 226, 0.5),
    150px 2px 0 rgba(245, 239, 226, 0.8), 220px 44px 0 rgba(245, 239, 226, 0.45),
    268px 14px 0 1px rgba(245, 239, 226, 0.9), 320px 58px 0 rgba(245, 239, 226, 0.55),
    356px 24px 0 rgba(245, 239, 226, 0.75), 60px 74px 0 rgba(245, 239, 226, 0.4),
    196px 88px 0 rgba(245, 239, 226, 0.5), 300px 96px 0 rgba(245, 239, 226, 0.35);
}
.tw-ag-stars.s2 {
  top: 12%;
  left: 4%;
  box-shadow:
    40px 40px 0 rgba(245, 239, 226, 0.55), 120px 18px 0 rgba(245, 239, 226, 0.4),
    252px 64px 0 rgba(245, 239, 226, 0.6), 340px 8px 0 rgba(245, 239, 226, 0.45),
    160px 60px 0 1px rgba(245, 239, 226, 0.7);
}
.tw-ag-cloud {
  position: absolute;
  width: 130px;
  height: 30px;
  background-image: radial-gradient(rgba(245, 239, 226, 0.5) 1.1px, transparent 1.2px);
  background-size: 5px 5px;
  -webkit-mask-image: radial-gradient(68% 100% at 50% 50%, #000 34%, transparent 76%);
  mask-image: radial-gradient(68% 100% at 50% 50%, #000 34%, transparent 76%);
  opacity: 0.55;
}
.tw-ag-cloud.c1 { left: 5%; top: 16%; }
.tw-ag-cloud.c2 { right: 3%; top: 27%; width: 96px; transform: scaleX(-1); }
.tw-ag-sunwrap { position: absolute; left: 0; right: 0; bottom: 25%; height: 0; z-index: 1; }
.tw-ag-sun {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 96px;
  height: 96px;
  margin-left: -48px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fff3cf, #f8bd4e 50%, #ec931e 100%);
  box-shadow: 0 0 34px rgba(248, 189, 78, 0.6), 0 0 110px rgba(248, 189, 78, 0.3);
}
.tw-ag-sun::before {
  content: '';
  position: absolute;
  inset: -26px;
  border: 1px solid rgba(255, 236, 190, 0.38);
  border-radius: 50%;
}
.tw-ag-sun::after {
  content: '';
  position: absolute;
  inset: -130px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 230, 170, 0.09) 0deg 2deg, transparent 2deg 30deg);
  -webkit-mask-image: radial-gradient(circle, transparent 34%, #000 36%, transparent 74%);
  mask-image: radial-gradient(circle, transparent 34%, #000 36%, transparent 74%);
}
.tw-ag-ridge { position: absolute; left: -3%; right: -3%; bottom: 0; }
.tw-ag-ridge.r3 {
  height: 44%;
  z-index: 2;
  background: rgba(64, 96, 162, 0.55);
  clip-path: polygon(0 62%, 10% 50%, 22% 64%, 36% 38%, 50% 58%, 66% 34%, 82% 56%, 100% 44%, 100% 100%, 0 100%);
}
.tw-ag-ridge.r2 {
  height: 38%;
  z-index: 3;
  background: rgba(20, 40, 82, 0.92);
  clip-path: polygon(0 52%, 14% 34%, 30% 56%, 47% 22%, 63% 50%, 79% 30%, 100% 54%, 100% 100%, 0 100%);
}
.tw-ag-ridge.r1 {
  height: 30%;
  z-index: 4;
  background: #060d20;
  clip-path: polygon(0 48%, 12% 30%, 27% 54%, 43% 16%, 58% 46%, 74% 26%, 88% 50%, 100% 36%, 100% 100%, 0 100%);
}
.tw-ag-copy { position: absolute; left: 0; right: 0; top: 10%; z-index: 5; padding: 0 24px; }
.tw-ag-kick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-jetbrains);
  font-size: 8px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: #ffe9b0;
}
.tw-ag-kick i { width: 22px; height: 1px; background: rgba(255, 233, 176, 0.45); }
.tw-ag-h {
  margin: 13px 0 8px;
  font-family: var(--tw-serif-site, Georgia, serif);
  font-size: 31px;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 26px rgba(4, 16, 44, 0.55);
}
.tw-ag-h .w { display: inline-block; }
.tw-ag-h em { font-style: italic; color: #f8bd4e; padding-right: 2px; }
.tw-ag-sub {
  margin: 0 0 15px;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: rgba(245, 239, 226, 0.75);
}
.tw-ag-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, #ffd98a, #f6b543 55%, #eda224);
  color: #241605;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 8px 26px rgba(246, 181, 67, 0.38);
  overflow: hidden;
}
.tw-ag-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.45) 50%, transparent 58%);
  background-size: 240% 100%;
  background-position: 120% 0;
}
.tw-ag-stats {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}
.tw-ag-stats span {
  padding: 0 12px;
  font-family: var(--font-jetbrains);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 239, 226, 0.62);
}
.tw-ag-stats span + span { border-left: 1px solid rgba(245, 239, 226, 0.22); }
.tw-ag-marq {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 6px 0;
  background: #050b1c;
  border-top: 1px solid rgba(255, 233, 176, 0.2);
  overflow: hidden;
  white-space: nowrap;
}
.tw-ag-marq span {
  display: inline-block;
  font-family: var(--font-jetbrains);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: rgba(245, 239, 226, 0.6);
  padding-right: 44px;
}

/* the "polish it up" upgrade: richer glow, brighter sun, shimmer wash */
.tw-ag-glowband {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 40%;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(70% 80% at 50% 100%, rgba(255, 128, 88, 0.42), rgba(246, 152, 67, 0.14) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 1100ms var(--ease-out);
}
.tw-ag-wash {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 236, 190, 0.16) 50%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
  opacity: 0;
}
.tw-pv-page .tw-ag-sun { transition: transform 900ms var(--ease-spring); }
.tw-pv-page.is-polished .tw-ag-glowband { opacity: 1; }
.tw-pv-page.is-polished .tw-ag-sun {
  transform: scale(1.12);
  box-shadow: 0 0 54px rgba(248, 189, 78, 0.85), 0 0 170px rgba(248, 189, 78, 0.5);
}
.tw-pv-page.is-polished .tw-ag-h em { text-shadow: 0 0 26px rgba(248, 189, 78, 0.65); }
.tw-pv-page.is-polished .tw-ag-stats span { color: rgba(255, 236, 190, 0.85); }
.tw-pv-page.is-polished .tw-ag-marq { border-top-color: rgba(255, 233, 176, 0.45); }
.tw-ag-h em { transition: text-shadow 900ms ease; }
.tw-ag-stats span { transition: color 900ms ease; }
.tw-ag-marq { transition: border-top-color 900ms ease; }

@media (prefers-reduced-motion: no-preference) {
  .tw-pv-page.is-polished .tw-ag-wash { animation: tw-ag-washplay 1100ms var(--ease-out) 150ms both; }
  @keyframes tw-ag-washplay {
    from { opacity: 1; background-position: 130% 0; }
    to { opacity: 0; background-position: -130% 0; }
  }
  .tw-pv-page.is-polished .tw-ag-sun { animation: tw-ag-breathe-hot 3.6s ease-in-out infinite; }
  @keyframes tw-ag-breathe-hot {
    0%, 100% { box-shadow: 0 0 54px rgba(248, 189, 78, 0.85), 0 0 170px rgba(248, 189, 78, 0.5); }
    50% { box-shadow: 0 0 70px rgba(248, 189, 78, 1), 0 0 210px rgba(248, 189, 78, 0.62); }
  }
}

/* ── Preview annotations: circle a region, pin a note, send to chat ── */
.tw-pv-notes {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 1;
  transition: opacity 400ms var(--ease-out);
}
.tw-pv-notes.is-clear { opacity: 0; }
.tw-pv-notes svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* the ink itself: emitted point by point as the pen travels.
   Rose, not gold: a marker has to read against the sun it circles. */
.tw-ink {
  fill: none;
  stroke: #ff3d8a;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 8px rgba(20, 10, 2, 0.55));
}
.tw-note {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  transform: translateY(-50%);
  max-width: 150px;
  padding: 6px 11px;
  border: 1px solid rgba(255, 61, 138, 0.7);
  border-radius: 9px;
  background: rgba(24, 8, 16, 0.94);
  color: #ffe7f0;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}
.tw-pv-send {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-spring);
}
.tw-pv-send.is-on { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.tw-pv-send .tw-dot { --tone: var(--accent-claude); }
.tw-note-caret {
  width: 1.5px;
  height: 11px;
  background: #ff3d8a;
  flex: 0 0 auto;
}
.tw-note.is-set .tw-note-caret { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .tw-note { animation: tw-re-in 240ms var(--ease-spring) both; }
  .tw-note-caret { animation: tw-caret-blink 1s steps(1) infinite; }
  @keyframes tw-caret-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
  .tw-pv-send.is-on { animation: tw-re-in 340ms var(--ease-spring); }
}
.tw-cursor.is-quick { transition-duration: 180ms; }
/* while inking, the pen must sit exactly where the ink is: no easing */
.tw-cursor.is-draw { transition: none; }
.tw-cursor.is-pen.is-down svg { transform: scale(0.94); transform-origin: 25% 10%; }

/* ── Scene 3: "/task Turn it into a moon". The same poster, re-lit:
   gold becomes silver, the warm ground goes to deep night. ────── */
.tw-pv-page.is-moon .tw-ag-s2 {
  background:
    radial-gradient(120% 90% at 68% 30%, rgba(150, 178, 226, 0.34), rgba(48, 68, 116, 0.14) 44%, transparent 66%),
    linear-gradient(180deg, #05070f 0%, #0a1020 46%, #131c33 78%, #1d2949 100%);
  color: #e8eefb;
}
.tw-pv-page.is-moon .tw-ag2-sun {
  background: radial-gradient(circle at 38% 32%, #ffffff, #d9e2f2 48%, #9fb0cd 100%);
  box-shadow: 0 0 54px rgba(198, 214, 240, 0.5), 0 0 170px rgba(150, 178, 226, 0.32);
}
/* a crater shadow turns the disc into a moon */
.tw-pv-page.is-moon .tw-ag2-sun::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 66% 34%, rgba(120, 140, 172, 0.5) 0 9%, transparent 10%),
    radial-gradient(circle at 40% 62%, rgba(120, 140, 172, 0.42) 0 12%, transparent 13%),
    radial-gradient(circle at 62% 70%, rgba(120, 140, 172, 0.34) 0 6%, transparent 7%);
}
.tw-pv-page.is-moon .tw-ag2-sun::after { opacity: 0.35; }
.tw-pv-page.is-moon .tw-ag2-ridge { background: #03060d; }
.tw-pv-page.is-moon .tw-ag2-l1 { color: #eef3fd; }
.tw-pv-page.is-moon .tw-ag2-l2 { color: rgba(12, 18, 32, 0.5); -webkit-text-stroke-color: rgba(232, 238, 251, 0.95); }
.tw-pv-page.is-moon .tw-ag2-l3 { color: #cfe0ff; text-shadow: 0 0 34px rgba(160, 190, 240, 0.55); }
.tw-pv-page.is-moon .tw-ag2-kick { color: #b9cbe8; }
.tw-pv-page.is-moon .tw-ag2-stats b { color: #eef3fd; }
.tw-pv-page.is-moon .tw-ag2-stats span { color: rgba(185, 203, 232, 0.8); }
.tw-pv-page.is-moon .tw-ag2-cta {
  background: linear-gradient(180deg, #f2f6ff, #cdd9ef 55%, #a9b9d6);
  color: #10182a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 30px rgba(150, 178, 226, 0.35);
}
.tw-pv-page.is-moon .tw-ag2-marq { background: #cdd9ef; }
.tw-pv-page.is-moon .tw-ag2-marq span { color: #10182a; }
/* everything re-lights together, like a theme swap in the real build */
.tw-ag-s2, .tw-ag2-sun, .tw-ag2-ridge, .tw-ag2-l1, .tw-ag2-l2, .tw-ag2-l3,
.tw-ag2-kick, .tw-ag2-cta, .tw-ag2-marq, .tw-ag2-marq span, .tw-ag2-stats b, .tw-ag2-stats span {
  transition: background 900ms var(--ease-out), color 700ms var(--ease-out),
    box-shadow 900ms var(--ease-out), text-shadow 700ms var(--ease-out),
    -webkit-text-stroke-color 700ms var(--ease-out);
}

/* ── Scene 2, the "polish it up" overhaul: a daybreak poster cut.
   Night cobalt flips to burnt gold, centered copy flips to a stacked
   display composition, and it wipes in as a circle from the sun. ── */
.tw-ag-s1 { position: absolute; inset: 0; }
.tw-ag-s2 {
  position: absolute;
  inset: 0;
  overflow: hidden;
  text-align: left;
  background:
    radial-gradient(120% 90% at 68% 30%, rgba(255, 158, 64, 0.5), rgba(224, 92, 32, 0.16) 44%, transparent 66%),
    linear-gradient(180deg, #1c0d04 0%, #2c1305 46%, #47200a 78%, #6b3410 100%);
  color: #ffedd2;
  clip-path: circle(0% at 66% 32%);
  visibility: hidden;
}
.tw-pv-page.is-v2 .tw-ag-s2 { clip-path: circle(145% at 66% 32%); visibility: visible; }
.tw-pv-page.is-v2 .tw-ag-s1 { opacity: 0; transform: scale(1.05); filter: blur(9px); }
.tw-ag-s1 { transition: opacity 650ms ease, transform 750ms var(--ease-out), filter 650ms ease; }
.tw-ag2-sun {
  position: absolute;
  top: 12%;
  right: 8%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #fff7dc, #ffcf6a 46%, #f59d2a 100%);
  box-shadow: 0 0 60px rgba(255, 199, 106, 0.75), 0 0 180px rgba(255, 166, 66, 0.45);
}
.tw-ag2-sun::after {
  content: '';
  position: absolute;
  inset: -110px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 226, 160, 0.16) 0deg 3deg, transparent 3deg 26deg);
  -webkit-mask-image: radial-gradient(circle, transparent 30%, #000 32%, transparent 76%);
  mask-image: radial-gradient(circle, transparent 30%, #000 32%, transparent 76%);
}
.tw-ag2-ridge {
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: 0;
  height: 24%;
  background: #140803;
  clip-path: polygon(0 55%, 14% 30%, 30% 58%, 47% 18%, 64% 50%, 80% 28%, 100% 52%, 100% 100%, 0 100%);
}
.tw-ag2-copy { position: absolute; left: 26px; right: 26px; top: 9%; z-index: 3; }
.tw-ag2-kick {
  font-family: var(--font-jetbrains);
  font-size: 8px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #ffd9a0;
}
.tw-ag2-l1, .tw-ag2-l2, .tw-ag2-l3 {
  font-family: var(--tw-serif-site, Georgia, serif);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.tw-ag2-l1 { font-size: 46px; margin-top: 12px; color: #fff3dc; }
.tw-ag2-l2 {
  font-size: 46px;
  color: rgba(30, 14, 4, 0.48);
  -webkit-text-stroke: 1.7px rgba(255, 240, 216, 0.98);
  filter: drop-shadow(0 3px 16px rgba(24, 11, 3, 0.75));
}
.tw-ag2-l3 { font-size: 58px; font-style: italic; color: #ffbe55; text-shadow: 0 0 34px rgba(255, 178, 74, 0.55); padding-bottom: 6px; }
.tw-ag2-stats { display: flex; gap: 26px; margin-top: 16px; }
.tw-ag2-stats b {
  display: block;
  font-family: var(--tw-serif-site, Georgia, serif);
  font-size: 22px;
  font-weight: 700;
  color: #fff3dc;
}
.tw-ag2-stats span {
  font-family: var(--font-jetbrains);
  font-size: 7.5px;
  letter-spacing: 0.22em;
  color: rgba(255, 217, 160, 0.8);
}
.tw-ag2-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, #ffe2a1, #ffbe55 55%, #f59d2a);
  color: #2a1204;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 10px 30px rgba(245, 157, 42, 0.45);
}
.tw-ag2-marq {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 6px 0;
  background: #ffbe55;
  overflow: hidden;
  white-space: nowrap;
}
.tw-ag2-marq span {
  display: inline-block;
  font-family: var(--font-jetbrains);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: #2a1204;
  padding-right: 44px;
}

@media (prefers-reduced-motion: no-preference) {
  .tw-ag-s2 { transition: clip-path 1050ms var(--ease-out) 150ms, visibility 0s 150ms; }
  .tw-pv-page.is-v2 .tw-ag2-sun { animation: tw-ag2-sunin 1200ms var(--ease-spring) 250ms both, tw-ag-breathe 4s ease-in-out 1.5s infinite; }
  .tw-pv-page.is-v2 .tw-ag2-sun::after { animation: tw-ag-rays 70s linear infinite; }
  .tw-pv-page.is-v2 .tw-ag2-kick { animation: tw-ag-rise 500ms var(--ease-out) 500ms both; }
  .tw-pv-page.is-v2 .tw-ag2-l1 { animation: tw-ag-word 650ms var(--ease-spring) 620ms both; }
  .tw-pv-page.is-v2 .tw-ag2-l2 { animation: tw-ag-word 650ms var(--ease-spring) 740ms both; }
  .tw-pv-page.is-v2 .tw-ag2-l3 { animation: tw-ag-word 700ms var(--ease-spring) 860ms both; }
  .tw-pv-page.is-v2 .tw-ag2-stats { animation: tw-ag-rise 600ms var(--ease-out) 1050ms both; }
  .tw-pv-page.is-v2 .tw-ag2-cta { animation: tw-ag-pop 650ms var(--ease-spring) 1220ms both; }
  .tw-pv-page.is-v2 .tw-ag2-ridge { animation: tw-ag-ridgein 800ms var(--ease-out) 300ms both; }
  .tw-pv-page.is-v2 .tw-ag2-marq span { animation: tw-ag-marquee 9s linear infinite; }
  @keyframes tw-ag2-sunin { from { transform: scale(0.55); opacity: 0; } }
}

@media (prefers-reduced-motion: no-preference) {
  .tw-pv-page .tw-ag-stars { animation: tw-ag-twinkle 3.2s ease-in-out infinite; }
  .tw-pv-page .tw-ag-stars.s2 { animation-delay: 1.4s; animation-duration: 2.4s; }
  .tw-pv-page .tw-ag-cloud.c1 { animation: tw-ag-drift 11s ease-in-out infinite alternate; }
  .tw-pv-page .tw-ag-cloud.c2 { animation: tw-ag-drift 14s ease-in-out infinite alternate-reverse; }
  .tw-pv-page .tw-ag-sun { animation: tw-ag-breathe 4.2s ease-in-out infinite; }
  .tw-pv-page .tw-ag-sun::after { animation: tw-ag-rays 90s linear infinite; }
  .tw-pv-page .tw-ag-ridge.r3 { animation: tw-ag-sway 21s ease-in-out infinite alternate; }
  .tw-pv-page .tw-ag-ridge.r2 { animation: tw-ag-sway 16s ease-in-out infinite alternate-reverse; }
  .tw-pv-page .tw-ag-marq span { animation: tw-ag-marquee 12s linear infinite; }
  .tw-pv-page .tw-ag-cta::after { animation: tw-ag-sheen 3.8s ease-in-out infinite; }

  /* the replay: dawn breaks each time .is-play lands */
  .tw-pv-page.is-play .tw-ag-ridge.r3 { animation: tw-ag-ridgein 900ms var(--ease-out) 80ms both, tw-ag-sway 21s ease-in-out 1.2s infinite alternate; }
  .tw-pv-page.is-play .tw-ag-ridge.r2 { animation: tw-ag-ridgein 900ms var(--ease-out) 160ms both, tw-ag-sway 16s ease-in-out 1.3s infinite alternate-reverse; }
  .tw-pv-page.is-play .tw-ag-ridge.r1 { animation: tw-ag-ridgein 900ms var(--ease-out) 240ms both; }
  .tw-pv-page.is-play .tw-ag-sun { animation: tw-ag-sunrise 2s var(--ease-spring) both, tw-ag-breathe 4.2s ease-in-out 2s infinite; }
  .tw-pv-page.is-play .tw-ag-kick { animation: tw-ag-rise 600ms var(--ease-out) 420ms both; }
  .tw-pv-page.is-play .tw-ag-h .w { animation: tw-ag-word 750ms var(--ease-spring) both; animation-delay: var(--wd, 600ms); }
  .tw-pv-page.is-play .tw-ag-sub { animation: tw-ag-rise 600ms var(--ease-out) 1150ms both; }
  .tw-pv-page.is-play .tw-ag-cta { animation: tw-ag-pop 700ms var(--ease-spring) 1350ms both; }
  .tw-pv-page.is-play .tw-ag-stats { animation: tw-ag-rise 650ms var(--ease-out) 1550ms both; }
}
@keyframes tw-ag-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes tw-ag-drift { to { transform: translateX(22px); } }
@keyframes tw-ag-breathe {
  0%, 100% { box-shadow: 0 0 34px rgba(248, 189, 78, 0.6), 0 0 110px rgba(248, 189, 78, 0.3); }
  50% { box-shadow: 0 0 48px rgba(248, 189, 78, 0.78), 0 0 140px rgba(248, 189, 78, 0.42); }
}
@keyframes tw-ag-rays { to { transform: rotate(360deg); } }
@keyframes tw-ag-sway { to { transform: translateX(9px); } }
@keyframes tw-ag-sheen { 0%, 55% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes tw-ag-marquee { to { transform: translateX(-50%); } }
@keyframes tw-ag-sunrise { from { transform: translateY(88px); } }
@keyframes tw-ag-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tw-ag-word {
  from { opacity: 0; transform: translateY(18px); filter: blur(7px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes tw-ag-pop { from { opacity: 0; transform: scale(0.72); } to { opacity: 1; transform: none; } }
@keyframes tw-ag-ridgein { from { transform: translateY(34%); } }

/* ── The 340px rail beside the chat at full ──────────────────── */
.tw-rail {
  flex: 0 0 340px;
  width: 340px;
  border-left: 1px solid var(--line);
  background: var(--surface-2-solid);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding-bottom: 10px;
}
.tw-rail-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 13px 14px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.tw-rail-head-sub { font-size: 11px; font-weight: 400; color: var(--text-on-tint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-rail-div { height: 1px; margin: 14px 0 0; background: var(--line); }

.tw-can {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  overflow: hidden;
  text-align: left;
  transition: border-color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
.tw-can:hover {
  border-color: color-mix(in srgb, var(--accent-claude) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-claude) 13%, transparent);
  transform: translateY(-1px);
}
.tw-can-board {
  position: relative;
  height: 186px;
  border-bottom: 1px solid var(--line);
  background-color: var(--surface-2-solid);
  background-image:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent-claude) 12%, transparent), transparent 62%),
    radial-gradient(var(--grid) 1.2px, transparent 1.2px);
  background-size: auto, 14px 14px;
}
.tw-can-board::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, color-mix(in srgb, var(--surface-solid) 70%, transparent));
  pointer-events: none;
}
.tw-can { cursor: pointer; }
.tw-can:focus-visible { outline: 2px solid var(--accent-claude); outline-offset: 2px; }
.tw-can-expand {
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.tw-can:hover .tw-can-expand {
  background: color-mix(in srgb, var(--accent-claude) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent-claude) 55%, transparent);
  color: var(--accent-claude);
}
.tw-can-board svg { display: block; width: 100%; height: 100%; }
.tw-can-node { fill: var(--surface-2-solid); stroke: var(--tc, var(--line-strong)); stroke-width: 1.5; }
.tw-can-wire { stroke: var(--line-strong); stroke-width: 1.5; opacity: 0.55; fill: none; }
.tw-can-ring { fill: none; stroke: var(--tc, var(--accent-claude)); stroke-width: 2; opacity: 0.85; }
.tw-can-ring.is-live { animation: tw-ring-pulse 1.6s ease-in-out infinite; }
@keyframes tw-ring-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.tw-can-live {
  position: absolute;
  right: 9px;
  top: 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  font-family: var(--font-jetbrains);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.tw-can-foot { display: flex; align-items: center; gap: 9px; padding: 9px 11px; font-size: 12px; color: var(--text); }
.tw-can-foot b { font-weight: 600; }
.tw-can-foot em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.tw-can-expand {
  margin-left: auto;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  color: var(--text-muted);
  transition: border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.tw-can:hover .tw-can-expand { border-color: var(--accent-claude); color: var(--accent-claude); }

/* task cards */
.tw-tb-list { padding: 0 12px; margin: 0; list-style: none; }
.tw-tb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}
.tw-tb-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tw-tb-title { font-size: calc(var(--fs-msg, 15px) * 0.9); font-weight: 600; line-height: 1.38; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-tb-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--tone, var(--text-muted));
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--tone, var(--text-muted)) 12%, transparent);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}
.tw-tb-status .tw-dot { width: 6px; height: 6px; --tone: inherit; background: var(--tone, var(--text-muted)); }
.tw-tb-update { margin: 0; font-size: calc(var(--fs-msg, 15px) * 0.84); line-height: 1.45; color: var(--text); }
.tw-tb-update b { font-weight: 600; }
.tw-tb-foot { display: flex; margin: 0; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tw-tb-go { margin-left: auto; }

/* the task board's own life: cards arrive, change state, finish */
.tw-tb-item { list-style: none; }
.tw-tb-item.is-new { animation: tw-tb-in 460ms var(--ease-spring) both; }
@keyframes tw-tb-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.tw-tb-card.is-done { opacity: 0.72; }
.tw-tb-card.is-done .tw-tb-title { text-decoration: line-through; color: var(--text-muted); }
.tw-tb-status.is-beat { animation: tw-tb-beat 460ms var(--ease-spring); }
@keyframes tw-tb-beat {
  30% { transform: scale(1.12); }
  to { transform: none; }
}
.tw-tb-blank {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
  padding: 14px 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  list-style: none;
}
.tw-tb-blank-t { font-size: 13px; font-weight: 600; color: var(--text); }
.tw-tb-blank-b { font-size: 12px; line-height: 1.45; color: var(--text-muted); }

/* roster cards */
.tw-task {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  text-align: left;
}
.tw-task-top { display: flex; align-items: center; gap: 9px; font-size: calc(var(--fs-msg, 15px) * 0.9); font-weight: 600; color: var(--text); }
.tw-task-status {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--tone, var(--text-muted)) 15%, transparent);
}
.tw-task-sub { font-size: calc(var(--fs-msg, 15px) * 0.84); line-height: 1.45; color: var(--text-muted); }
.tw-task-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--c, var(--accent-claude)) 8%, var(--surface-2-solid));
  font-size: 11.5px;
}
.tw-task-note span { color: var(--text-on-tint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Canvas layout ───────────────────────────────────────────── */
.tw-board-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.tw-board {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 1px), var(--app-backdrop);
  background-size: 22px 22px, auto, auto, auto, auto;
}
.tw-leftrail {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 64px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 0 10px;
  background: var(--surface-solid);
  border-right: 1px solid var(--line);
}
.tw-leftrail-kick {
  margin: 9px 0 4px;
  font-family: var(--font-jetbrains);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tw-leftrail-sep { width: 34px; height: 1px; background: var(--line); margin: 6px 0; }
.tw-railbtn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: var(--text-muted);
}
.tw-railbtn:hover { background: var(--surface-2-solid); }
.tw-railbtn svg { width: 17px; height: 17px; }
.tw-crumb {
  position: absolute;
  top: 14px;
  left: 80px;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-jetbrains);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tw-crumb-home { padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius-full); background: var(--surface); }
.tw-crumb-here {
  padding: 5px 10px;
  border: 1px dashed color-mix(in srgb, var(--accent-claude) 55%, transparent);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent-claude) 8%, var(--surface));
  color: var(--text);
}
.tw-wire-label {
  position: absolute;
  z-index: 3;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  font-family: var(--font-jetbrains);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transform: translate(-50%, -50%);
}
.tw-doc {
  position: absolute;
  z-index: 4;
  width: 128px;
  padding: 9px 10px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
}
.tw-doc.is-anim { transition: left 1000ms var(--ease-out), top 1000ms var(--ease-out), transform 300ms ease, box-shadow 300ms ease; }
.tw-doc.is-drag { transform: rotate(-3deg) scale(1.04); box-shadow: var(--shadow-lg); z-index: 21; }
.tw-wire.is-off, .tw-wire-label.is-off { opacity: 0; }
.tw-wire, .tw-wire-label { transition: opacity 500ms var(--ease-out); }
.tw-doc-title { font-size: 10.5px; font-weight: 700; line-height: 1.3; }
.tw-doc-kind { font-family: var(--font-jetbrains); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
.tw-doc-lines { margin-top: 7px; display: grid; gap: 4px; }
.tw-doc-lines i { display: block; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--text) 14%, transparent); }
.tw-doc-lines i:nth-child(2) { width: 78%; }
.tw-doc-lines i:nth-child(3) { width: 60%; }

.tw-node { position: absolute; width: 116px; text-align: center; }
.tw-node-disc {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.14) 30%, transparent 52%),
    linear-gradient(145deg, color-mix(in srgb, var(--c) 24%, var(--glass-surface-strong)), color-mix(in srgb, var(--c) 14%, transparent));
  border: 1.5px solid color-mix(in srgb, var(--c) 34%, rgba(255, 255, 255, 0.58));
  box-shadow: 0 18px 42px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.58), inset 0 -14px 28px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(14px);
  transition: box-shadow 220ms ease, border-color 220ms ease;
}
.tw-node.is-working .tw-node-disc { box-shadow: 0 0 24px color-mix(in srgb, var(--c) 40%, transparent), 0 0 58px color-mix(in srgb, var(--c) 14%, transparent), 0 18px 42px var(--shadow); }
.tw-node-mark { width: 62px; height: 62px; object-fit: contain; opacity: 0.88; }
.tw-node-mark-ink { display: block; opacity: 1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.tw-node-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px dashed var(--c);
  opacity: 0;
}
.tw-node.is-working .tw-node-ring { opacity: 0.7; animation: tw-ring-spin 4s linear infinite; }
@keyframes tw-ring-spin { to { transform: rotate(360deg); } }
.tw-node.is-working @keyframes tw-core-pulse { 0%, 100% { transform: scale(0.85); opacity: 0.7; } 50% { transform: scale(1.1); opacity: 1; } }
.tw-node-lead {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translate(-50%, -100%);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-jetbrains);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  box-shadow: var(--shadow-sm);
}
.tw-node-name { margin-top: 9px; font-size: 13px; font-weight: 800; color: var(--c); }
.tw-node-model { font-size: 12px; font-weight: 600; color: var(--text-muted); font-family: var(--font-jetbrains); line-height: 1.32; }
/* the "thinking" bubble sits at the disc's shoulder, so it never covers
   the agent's name */
.tw-node-typing {
  position: absolute;
  top: 4px;
  right: -2px;
  display: flex;
  gap: 3px;
  padding: 6px 9px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 13px 13px 13px 4px;
  box-shadow: var(--shadow-lg);
  z-index: 7;
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-out);
}
.tw-node.is-working .tw-node-typing { opacity: 1; }
.tw-node-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.tw-node-typing i:nth-child(1) { animation: tw-typing-bounce 1.2s infinite; }
.tw-node-typing i:nth-child(2) { animation: tw-typing-bounce 1.2s infinite 0.18s; }
.tw-node-typing i:nth-child(3) { animation: tw-typing-bounce 1.2s infinite 0.36s; }
.tw-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tw-wire { stroke: var(--line-strong); stroke-width: 1.5; fill: none; opacity: 0.7; }
.tw-wire.is-live { stroke: var(--accent-claude); stroke-dasharray: 6 5; animation: tw-wire-flow 1.2s linear infinite; }
@keyframes tw-wire-flow { to { stroke-dashoffset: -22; } }

.tw-controls {
  position: absolute;
  left: 80px;
  bottom: 20px;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: var(--glass-surface-strong);
  border: 1px solid color-mix(in srgb, var(--accent-claude) 11%, var(--line));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: saturate(150%) blur(22px);
  z-index: 19;
}
.tw-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-muted);
}
.tw-controls button:hover { background: var(--surface-2); color: var(--text); }
.tw-controls svg { width: 15px; height: 15px; }
.tw-minimap {
  position: absolute;
  right: 16px;
  bottom: 20px;
  width: 210px;
  height: 128px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-claude) 11%, var(--line));
  background: var(--glass-surface-strong);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18), 0 8px 22px rgba(233, 107, 44, 0.025), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: saturate(150%) blur(22px);
  overflow: hidden;
  z-index: 19;
}
.tw-minimap::before {
  content: 'Map';
  position: absolute;
  top: 12px;
  left: 13px;
  font-family: var(--font-jetbrains);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}
.tw-minimap::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -18px;
  width: 82px;
  height: 68px;
  background: radial-gradient(closest-side, rgba(233, 107, 44, 0.18), transparent);
}
.tw-minimap i { position: absolute; width: 10px; height: 10px; border-radius: 50%; }

/* ── Docked chat (56px rail / 408px split) ───────────────────── */
.tw-dock {
  flex: 0 0 auto;
  width: 56px;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-left: 1px solid var(--line);
  z-index: 20;
  overflow: hidden;
  transition: width var(--dur-medium) var(--ease-out), flex-basis var(--dur-medium) var(--ease-out);
}
.tw[data-layout="split"] .tw-dock { width: 408px; }
.tw-dock-rail { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 6px 5px; }
.tw[data-layout="split"] .tw-dock-rail { display: none; }
.tw-dock-mark { position: relative; width: 44px; height: 44px; display: grid; place-items: center; color: var(--text-muted); flex: 0 0 auto; }
.tw-dock-mark svg { width: 20px; height: 20px; }
.tw-dock-badge {
  position: absolute;
  top: -1px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--accent-claude) 40%, transparent);
  background: color-mix(in srgb, var(--accent-claude) 20%, var(--surface-solid));
  color: var(--text);
  font-family: var(--font-jetbrains);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-spring);
}
.tw-dock-badge.is-on { opacity: 1; transform: none; }
.tw-dock-chat { display: none; flex-direction: column; flex: 1; min-height: 0; min-width: 408px; }
.tw[data-layout="split"] .tw-dock-chat { display: flex; }
.tw-dock-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.tw-dock-head .tw-serif { font-family: var(--font-fraunces); font-size: 16px; font-weight: 700; }
.tw-dock-head .tw-pill { margin-left: auto; }
.tw-dock-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 0 4px;
  --acx-gutter: 14px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.tw-dock-feed > :first-child { margin-top: auto; }
.tw-dock-feed .tw-msg { padding: 10px 14px; gap: 10px; border-radius: var(--radius-md); }
.tw-dock-feed .tw-msg-av, .tw-dock-feed .tw-orb:not(.tw-orb-sm):not(.tw-orb-xs), .tw-dock-feed .tw-face-user { width: 28px; height: 28px; }
.tw-dock-feed .tw-msg-name { font-size: 13px; }
.tw-dock-feed .tw-msg-text { font-size: 13.5px; }
.tw-dock-feed .tw-work-head { padding: 3px 9px; font-size: 11.5px; min-height: 28px; }
.tw-dock-feed .tw-prev, .tw-dock-feed .tw-work-body { display: none; }
.tw-dock-composer { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.tw-dock-composer .tw-composer-box { padding: 9px 11px; border-radius: 14px; }
.tw-dock-composer .tw-composer-input { font-size: 13.5px; }

/* ── Status bar ──────────────────────────────────────────────── */
.tw-statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.tw-statusbar .tw-dot { --tone: var(--semantic-success); }
.tw-statusbar .tw-sep { height: 12px; }
.tw-statusbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tw-statusbar .is-accent { color: var(--accent-claude); }

/* ── Ghost cursor: always on stage ───────────────────────────── */
.tw-cursor {
  position: absolute;
  z-index: 80;
  width: 30px;
  height: 30px;
  pointer-events: none;
  opacity: 0;
  transition: transform 900ms cubic-bezier(0.3, 0.7, 0.2, 1), opacity 300ms ease;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.45));
}
.tw-cursor.is-on { opacity: 1; }
.tw-cursor.is-down { transition-duration: 120ms; }
.tw-cursor.is-down svg { transform: scale(0.88); transform-origin: 24% 12%; }
.tw-cursor svg { transition: transform 140ms ease; }
.tw-click-ring {
  position: absolute;
  z-index: 79;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 2px solid var(--accent-claude);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
.tw-click-ring.is-play { animation: tw-click 500ms var(--ease-out); }
@keyframes tw-click {
  0% { opacity: 0.8; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* ── Narrow container fallbacks ──────────────────────────────── */
@container (max-width: 980px) {
  .tw-rail { display: none !important; }
  .tw-hc { display: none; }
  /* the preview overlays the chat here, so it has to sit above it */
  .tw-pv { position: absolute; top: 0; right: 0; bottom: 0; z-index: 30; border-left: 1px solid var(--line); }
  .tw-pv.is-open { width: min(420px, 88%); box-shadow: var(--shadow-lg); }
  .tw-pv-inner { width: 100%; min-width: 280px; }
}
@container (max-width: 720px) {
  .tw-filters { display: none; }
  .tw-layout-scope, .tw-layout-icon { display: none; }
  .tw-statusbar-right span:nth-child(n+3) { display: none; }
  .tw-minimap { display: none; }
  .tw-comp-actions .tw-comp-action:nth-child(n+3) { display: none; }
  .tw[data-layout="split"] .tw-dock { width: 300px; }
  .tw-dock-chat { min-width: 300px; }
}
/* phone-width boards: smaller discs, and a status bar that never wraps */
@container (max-width: 560px) {
  .tw-node { width: 100px; }
  .tw-node-disc { width: 72px; height: 72px; }
  .tw-node-mark { width: 50px; height: 50px; }
  .tw-node-name { margin-top: 7px; font-size: 12px; }
  .tw-node-model { font-size: 11px; }
  .tw-node-typing { top: 0; }
  .tw-leftrail { width: 56px; }
  .tw-crumb { left: 68px; }
  .tw-controls { left: 68px; }
  .tw-statusbar { white-space: nowrap; overflow: hidden; }
  .tw-statusbar > span, .tw-statusbar-right > span { flex: 0 0 auto; }
  .tw-statusbar-right span:nth-child(n+2) { display: none; }
}

/* ── Reduced motion: settle everything ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tw-msg, .tw-view-fade, .tw-dock, .tw-send.is-pop { animation: none !important; transition: none !important; }
  .tw-typing-dots i, .tw-node-typing i, .tw-work-beat i, .tw-can-ring.is-live,
  .tw-cursor { display: none; }
}
