:root {
  color-scheme: dark;
  --bg: #1d2024;
  --surface: #222529;
  --surface-2: #292c30;
  --surface-3: #32353a;
  --text: #f0f0f1;
  --muted: #989ba0;
  --line: rgba(255,255,255,.085);
  --accent: #e7cc96;
  --accent-2: #ead3a5;
  --gold-surface: linear-gradient(115deg, #ead3a5, #e5c990);
  --warning: #f2c872;
  --danger: #f28d9a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% -10%, #27203b 0, transparent 40%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { border-right: 1px solid var(--line); background: rgba(13, 14, 21, .86); padding: 28px 18px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 700; letter-spacing: .05em; }
.brand-mark { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: #0f1015; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 900; }
.eyebrow { font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav { display: grid; gap: 8px; }
.nav button { text-align: left; color: var(--muted); border-radius: 9px; padding: 11px 12px; background: transparent; }
.nav button:hover, .nav button.active { color: var(--text); background: var(--surface-2); }
.nav button.active { box-shadow: inset 2px 0 var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 11px; }
.install-gate { border: 1px solid #5c4d7e; padding: 12px; border-radius: 11px; background: #1c1830; color: #dcd2ff; font-size: 12px; line-height: 1.55; }
.main { min-width: 0; padding: 27px clamp(18px, 4vw, 58px) 48px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 28px; }
.topbar h1 { margin: 5px 0 8px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.03em; }
.topbar p { color: var(--muted); margin: 0; font-size: 13px; }
.soul-picker { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.soul-picker select { max-width: 220px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); padding: 9px 11px; border-radius: 8px; }
.grid { display: grid; gap: 17px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 15px; padding: 19px; background: linear-gradient(160deg, rgba(28, 31, 46, .95), rgba(18, 20, 30, .95)); box-shadow: 0 15px 45px rgba(0,0,0,.12); }
.panel h2, .panel h3 { margin: 0 0 11px; letter-spacing: -.02em; }
.panel h2 { font-size: 18px; }.panel h3 { font-size: 14px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.panel-header h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; color: #111219; background: var(--accent); padding: 9px 13px; font-weight: 700; font-size: 12px; }
.button.secondary { color: var(--text); background: var(--surface-3); border: 1px solid var(--line); }
.button.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button.danger { color: #2a1117; background: var(--danger); }
.button + .button { margin-left: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; padding: 4px 7px; border-radius: 100px; color: var(--muted); border: 1px solid var(--line); font-size: 11px; }
.tag.good { color: var(--accent-2); border-color: #2a655e; }.tag.warn { color: var(--warning); border-color: #68562c; }
.soul-list, .role-list { display: grid; gap: 10px; }
.soul-card, .role-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(15, 16, 25, .4); }
.soul-card.selected, .role-card.installed { border-color: #62538e; background: #211c34; }
.avatar { width: 37px; height: 37px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #51467b, #26716d); font-weight: 800; }
.card-main { display: flex; gap: 11px; min-width: 0; }.card-main strong { display: block; font-size: 14px; margin-bottom: 3px; }.card-main p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.report { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }.report p { margin: 0 0 8px; }.report ul { display: grid; gap: 7px; margin: 0; padding-left: 18px; }.report li { color: var(--muted); font-size: 11px; line-height: 1.4; }.report li strong { display: inline; margin: 0 4px; font-size: 11px; color: var(--text); }
.card-actions { flex: 0 0 auto; text-align: right; }.price { color: var(--warning); font-size: 11px; display: block; margin-bottom: 6px; }
.gate { min-height: 300px; display: grid; place-items: center; text-align: center; padding: 35px; }
.gate-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 14px; border: 1px solid #5c4d7e; border-radius: 17px; font-size: 24px; background: #211b35; }
.conversation { display: grid; grid-template-rows: auto 1fr auto; min-height: 510px; }
.presence { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 15px; border-bottom: 1px solid var(--line); }.presence-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; padding: 5px 8px; background: #191c28; border-radius: 100px; }.presence-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.messages { overflow: auto; display: grid; align-content: start; gap: 11px; padding: 18px 1px; max-height: 450px; }
.message { max-width: 83%; padding: 11px 13px; border-radius: 11px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }.message.user { justify-self: end; color: #19151f; background: #ccbfff; }.message.role { justify-self: start; background: #242839; }.message .meta { color: var(--muted); display: block; font-size: 10px; margin-bottom: 4px; }.message.user .meta { color: #5d526d; }
.composer { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }.composer textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 140px; color: var(--text); background: #11131b; border: 1px solid var(--line); border-radius: 9px; padding: 11px; outline: none; }.composer textarea:focus { border-color: var(--accent); }
.memory-actions { display: flex; flex-wrap: wrap; gap: 8px; }.memory-actions .button { margin: 0; }
.hook-list { display: grid; gap: 8px; max-height: 430px; overflow: auto; }.hook { padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line); background: #171a25; }.hook.active { border-color: #665997; }.hook-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }.hook-title { font-size: 12px; font-weight: 700; }.hook p { margin: 6px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); }.hook time { color: var(--muted); font-size: 10px; }
.upload-zone { border: 1px dashed #4e5367; border-radius: 11px; padding: 25px; text-align: center; color: var(--muted); }.upload-zone input { display: block; margin: 13px auto 0; max-width: 100%; font-size: 12px; }
.station-status { display: inline-flex; gap: 6px; align-items: center; color: var(--accent-2); font-size: 11px; }.station-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.timeline { display: grid; gap: 8px; }.timeline-item { display: grid; grid-template-columns: 8px 1fr; gap: 10px; font-size: 12px; }.timeline-item::before { content: ""; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--accent); }.timeline-item p { margin: 0; color: var(--muted); line-height: 1.45; }.timeline-item strong { color: var(--text); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 23px 10px; font-size: 12px; }.notice { padding: 10px 12px; border-radius: 9px; background: #23202e; color: #cdc5e3; font-size: 12px; line-height: 1.45; margin-bottom: 12px; }.notice.error { background: #352027; color: #ffc7ce; }
@media (max-width: 850px) { .app-shell { grid-template-columns: 1fr; }.sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; gap: 14px; }.nav { display: flex; overflow-x: auto; }.nav button { white-space: nowrap; }.sidebar-foot { display: none; }.main { padding: 20px 14px 35px; }.topbar { display: block; }.soul-picker { margin-top: 16px; }.grid.two { grid-template-columns: 1fr; } }

/* Conversation-first client. Management surfaces live in the contextual drawer. */
body { min-height: 100vh; background: #0b0c10; }
#app { min-height: 100vh; }
.main.chat-app { width: 100%; min-height: 100vh; padding: 0; display: flex; flex-direction: column; background: radial-gradient(800px 380px at 75% -12%, rgba(100, 76, 167, .22), transparent 70%), #0b0c10; }
.chat-topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; gap: 24px; padding: 0 clamp(18px, 4vw, 56px); border-bottom: 1px solid rgba(61, 64, 82, .65); background: rgba(12, 13, 18, .9); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 4; }
.chat-topbar .brand { flex: 0 0 auto; font-size: 15px; letter-spacing: .02em; }
.chat-topbar .brand-mark { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
.conversation-identity { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.identity-avatar { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #5d5084; border-radius: 12px; background: linear-gradient(145deg, #51467b, #25766e); font-size: 18px; }
.conversation-identity strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-meta { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: #6e7180; }
.presence-dot.online { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(126, 231, 213, .12); }
.presence-dot.offline { background: var(--warning); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.soul-chip { display: inline-flex; align-items: center; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: 10px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 11px; color: var(--text); background: #1b1e2b; border: 1px solid #3b3f53; border-radius: 10px; font-size: 12px; }
.icon-button:hover { border-color: var(--accent); background: #252138; }
.collection-trigger { color: #eee9ff; }
.chat-app > .notice { margin: 14px auto 0; width: min(1220px, calc(100% - 36px)); }
.chat-layout { width: min(1220px, calc(100% - 36px)); flex: 1; min-height: 0; margin: 22px auto 36px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.conversation { min-height: calc(100vh - 160px); height: calc(100vh - 160px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: 0; overflow: hidden; background: rgba(18, 20, 29, .88); }
.conversation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 26px 17px; border-bottom: 1px solid var(--line); }
.conversation-head h1 { margin: 6px 0 10px; font-size: clamp(20px, 2.4vw, 28px); letter-spacing: -.035em; }
.conversation-head h1 .muted { font-weight: 400; }
.conversation-head .presence { padding: 0; border: 0; }
.conversation-actions { flex: 0 0 auto; }
.messages { min-height: 0; max-height: none; padding: 24px 26px; overflow-y: auto; overscroll-behavior: contain; }
.message { max-width: min(680px, 84%); padding: 13px 15px; border-radius: 15px; font-size: 14px; line-height: 1.65; box-shadow: 0 5px 20px rgba(0, 0, 0, .12); }
.message.user { border-bottom-right-radius: 5px; }
.message.role { border-bottom-left-radius: 5px; background: #232735; }
.conversation-empty { display: grid; place-items: center; align-content: center; height: 100%; min-height: 260px; text-align: center; }
.conversation-empty strong { margin-top: 14px; font-size: 15px; color: var(--text); }
.conversation-empty p { margin: 6px 0; }
.empty-orb { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid #5b4d81; border-radius: 20px; color: #d4c9ff; background: #231d3a; font-size: 24px; box-shadow: 0 0 40px rgba(180, 156, 255, .12); }
.attachment-strip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 9px 24px 0; }
.attachment-chip { color: #d5cdf3; background: #242039; border: 1px solid #50437a; border-radius: 999px; padding: 5px 9px; font-size: 11px; }
.chat-upload-facts { max-height: 180px; overflow-y: auto; margin: 9px 20px 0; padding: 9px 11px; border: 1px solid #34384a; border-radius: 10px; background: rgba(14, 16, 24, .74); }
.chat-upload-facts > .hook { margin-top: 7px; padding: 8px 10px; background: #171a25; }
.chat-upload-facts .hook p { margin-top: 4px; }
.composer { align-items: flex-end; margin: 0 20px; padding: 14px 0 7px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 46px; max-height: 150px; padding: 12px 13px; border-radius: 12px; }
.composer .plus-button { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 1px solid #45495e; border-radius: 11px; color: var(--muted); background: #171923; font-size: 24px; line-height: 1; }
.composer .plus-button:hover { color: var(--text); border-color: var(--accent); background: #252138; }
.send-button { min-height: 42px; padding: 0 16px; border-radius: 11px; color: #17131e; background: var(--accent); font-size: 12px; font-weight: 750; }
.send-button:hover { filter: brightness(1.08); }
.composer-hint { margin: 0; padding: 0 24px 15px; color: #74798d; font-size: 10px; }
.chat-context { min-width: 0; display: grid; align-content: start; gap: 14px; }
.chat-context .panel { padding: 16px; }
.chat-context .panel-header h2 { font-size: 15px; }
.chat-context .hook-list { max-height: 285px; }
.chat-context .memory-actions { display: grid; }
.chat-context .memory-actions .button { width: 100%; }
.chat-context .memory-actions .button + .button { margin-left: 0; }
.chat-gate { width: min(760px, calc(100% - 36px)); min-height: 450px; margin: 70px auto; display: grid; place-items: center; background: rgba(20, 22, 32, .88); }
.chat-gate h1 { margin: 0 0 10px; font-size: clamp(23px, 3vw, 32px); letter-spacing: -.04em; }
.chat-gate p { max-width: 520px; margin: 0 auto 20px; line-height: 1.6; }
.gate-actions { display: flex; justify-content: center; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; background: rgba(3, 4, 8, .64); backdrop-filter: blur(3px); }
.collection-drawer { width: min(610px, 94vw); height: 100%; overflow-y: auto; border-left: 1px solid #41455a; background: #11131b; box-shadow: -20px 0 60px rgba(0, 0, 0, .35); animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 22px 17px; border-bottom: 1px solid var(--line); background: rgba(17, 19, 27, .95); backdrop-filter: blur(16px); }
.drawer-header h2 { margin: 5px 0 2px; font-size: 22px; }
.drawer-header p { margin: 0; }
.drawer-body { padding: 6px 22px 35px; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 11px; margin-bottom: 13px; }
.drawer-section-head h3 { margin: 0 0 3px; font-size: 15px; }
.drawer-section-head p { margin: 0; }
.drawer-section .soul-card, .drawer-section .role-card { background: #171a25; }
.drawer-section .soul-card { padding: 12px; }
.drawer-section .role-card { display: block; padding: 13px; }
.drawer-section .role-card .card-actions { margin-top: 12px; text-align: left; display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-section .role-card .button + .button { margin-left: 0; }
.drawer-section .card-main { align-items: flex-start; }
.drawer-section .card-actions .button { min-height: 31px; padding: 6px 9px; font-size: 11px; }
.drawer-section .report { background: #141620; border-radius: 8px; padding: 10px; }
.trust-section { padding-bottom: 0; }
.drawer-empty { padding: 45px 22px; color: var(--muted); text-align: center; font-size: 13px; }
.workstation-capability { margin: 0 20px 13px; padding: 15px; border: 1px solid #4d4370; border-radius: 12px; background: #1e1a30; }
.capability-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 13px; margin-bottom: 12px; }
.capability-head strong { display: block; margin: 4px 0; font-size: 13px; }
.capability-head p { margin: 0; }
.workstation-capability .timeline { max-height: 170px; overflow-y: auto; margin-bottom: 12px; }
.workstation-form { display: flex; align-items: flex-end; gap: 8px; }
.workstation-form textarea { flex: 1; min-height: 42px; resize: vertical; color: var(--text); background: #11131b; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.workstation-form .button { min-height: 42px; white-space: nowrap; }
.controller-lock { margin-top: 11px; padding: 10px 11px; border: 1px solid #5a4c2f; border-radius: 9px; background: #272117; color: #f2d68d; }
.controller-lock strong { font-size: 12px; }
.controller-lock p { margin: 4px 0 0; }
code { color: #d7cdfc; font-size: 10px; word-break: break-all; }
@media (max-width: 900px) {
  .chat-topbar { gap: 12px; padding: 0 16px; }
  .chat-topbar .brand > span:last-child { display: none; }
  .soul-chip { display: none; }
  .chat-layout { display: block; width: min(760px, calc(100% - 24px)); margin-top: 12px; }
  .conversation { min-height: calc(100vh - 104px); height: calc(100vh - 104px); }
  .chat-context { display: grid; margin-top: 14px; }
  .conversation-head { padding: 19px 17px 14px; }
  .messages { padding: 17px; }
}
@media (max-width: 560px) {
  .chat-topbar { height: 60px; flex-basis: 60px; }
  .chat-topbar .brand { display: none; }
  .conversation-identity { order: 1; }
  .topbar-actions { order: 2; }
  .collection-trigger span { display: none; }
  .collection-trigger { width: 38px; padding: 7px; font-size: 18px; }
  .conversation-head { display: block; }
  .conversation-actions { margin-top: 12px; }
  .conversation-actions .button { width: 100%; }
  .composer { margin: 0 11px; gap: 6px; }
  .composer-hint { padding-left: 14px; padding-right: 14px; }
  .send-button { padding: 0 12px; }
  .workstation-capability { margin-left: 11px; margin-right: 11px; }
  .capability-head { display: block; }
  .capability-head .station-status { margin-top: 8px; }
  .workstation-form { display: grid; }
  .workstation-form .button { width: 100%; }
  .drawer-body { padding-left: 15px; padding-right: 15px; }
  .drawer-header { padding-left: 15px; padding-right: 15px; }
  .drawer-section .card-actions .button { flex: 1 1 auto; }
}

/* Main-site shell integration. The character console is rendered inside the
   same narrow, artwork-backed conversation frame as 潛龍尋道, while its role
   drawer and server gates remain available as contextual surfaces. */
html, body { min-height: 100%; }
body {
  min-width: 280px;
  color: #eee;
  background: linear-gradient(rgba(21,21,21,.63), rgba(21,21,21,.84)), url('/public/golden-dragon-zhuda-v1.webp') center / cover fixed;
}
.main-site-shell {
  width: min(540px, 100%);
  max-width: 540px;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  color: #eee;
  background: #181818;
  box-shadow: 0 0 90px rgba(0,0,0,.48);
}
.main-site-shell > .notice {
  flex: 0 0 auto;
  width: auto;
  margin: 10px 20px 0;
  border: 1px solid #4b4438;
  border-radius: 8px;
  background: #29251f;
  color: #d9c8a8;
}
.chat-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  flex: 0 0 auto;
  height: auto;
  min-height: 64px;
  padding: 10px 16px 8px;
  gap: 2px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: #181818;
  position: relative;
  z-index: 5;
}
.chat-identity { grid-column: 1; grid-row: 1; min-width: 0; }
.main-brand {
  display: block;
  width: fit-content;
  max-width: 100%;
  color: #a7a39c;
  text-decoration: none;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .1em;
}
.chat-role-title { margin: 3px 0 0; color: var(--text); font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-brand span { color: #a7a39c; font-size: 11px; font-weight: 400; }
.conversation-identity {
  min-width: 0;
  gap: 8px;
  flex: 1;
  opacity: .78;
  display: none;
}
.identity-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
.conversation-identity strong { font-size: 11px; }
.identity-meta { font-size: 9px; }
.site-header-actions { gap: 9px; flex: 0 0 auto; }
.site-nav-button, .site-settings-button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #444;
  border-radius: 24px;
  color: #d4d1cc;
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
}
.site-nav-button:hover, .site-settings-button:hover { background: rgba(255,255,255,.07); border-color: #666; }
.site-settings-button { width: 38px; padding: 5px; position: relative; font-size: 19px; line-height: 1; }
.settings-dot { position: absolute; right: 7px; bottom: 7px; width: 9px; height: 9px; border-radius: 50%; background: #8ac293; }
.settings-dot.offline { background: #b28d58; }
.chat-layout {
  width: 100%;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  flex: 1;
}
.conversation {
  min-height: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #181818;
  box-shadow: none;
}
.conversation > * { flex-shrink: 0; }
.conversation > .messages { flex: 1 1 0; }
.conversation-head {
  display: flex;
  align-items: center;
  padding: 12px 24px 8px;
  border: 0;
  background: #181818;
}
.conversation-head h1 { margin: 0; font-size: 18px; line-height: 1.3; }
.conversation-head .eyebrow { display: none; }
.presence { padding: 0; border: 0; }
.presence-item { padding: 4px 8px; background: #242424; }
.conversation-actions .button { min-height: 35px; border-radius: 20px; }
.host-workflow-row {
  margin: 0 42px;
  padding: 13px 0 17px;
  border-bottom: 1px solid #343434;
  color: #a5a29b;
  font-size: 13px;
}
.host-workflow-row span { display: inline-block; margin-right: 10px; color: #8e8a82; font-size: 21px; vertical-align: -2px; }
.messages {
  min-height: 0;
  max-height: none;
  padding: 14px 24px 12px;
  gap: 6px;
  background: #181818;
}
.turn { margin: 0 0 14px; min-width: 0; }
.turn.user { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.message-meta { color: #96928c; font-size: 10px; margin-bottom: 5px; }
.user .message-meta { margin: 0 4px; }
.bubble {
  max-width: 92%;
  padding: 9px 12px;
  border: 1px solid #393939;
  border-radius: 19px 19px 5px 19px;
  background: #303030;
  color: #eee;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-text {
  max-width: 100%;
  color: #e6e4df;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-participants, .message-hook { margin-top: 8px; margin-bottom: 0; }
.reply-pending { display: flex; align-items: center; gap: 9px; padding: 3px 0 8px; color: #b1aaa0; font-size: 12px; }
.reply-service-wait { flex-wrap: wrap; color: #d2bd92; }
.reply-service-wait > span:nth-child(2) { flex: 1; min-width: 180px; }
.reply-wait-mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid currentColor; border-radius: 50%; flex: none; }
.reply-switch-soul { min-height: 44px; padding: 6px 12px; border: 1px solid #cdb78755; border-radius: 10px; background: #cdb78712; color: #d8c49a; font: inherit; cursor: pointer; }
.reply-pulse { display: flex; gap: 4px; }
.reply-pulse i { width: 4px; height: 4px; border-radius: 50%; background: #cdb787; animation: reply-pulse 1.2s infinite; }
.reply-pulse i:nth-child(2) { animation-delay: .2s; }
.reply-pulse i:nth-child(3) { animation-delay: .4s; }
.delivery-error { margin: -17px 0 24px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; color: #e5ab9e; font-size: 11px; }
@keyframes reply-pulse { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reply-pulse i { animation: none; } }
.conversation-empty { min-height: 260px; }
.composer {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 0;
  align-items: stretch;
  margin: 0 16px;
  padding: 8px 10px 6px;
  border: 1px solid #454545;
  border-radius: 25px;
  background: #303030;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.meeting-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #bdb8ae;
  font-size: 13px;
  padding: 0 4px 5px;
}
.meeting-entry button {
  padding: 8px 14px;
  border: 1px solid #58749a;
  border-radius: 22px;
  color: #d5e4ff;
  background: #26344a;
  font-size: 13px;
}
.composer textarea {
  display: block;
  width: 100%;
  resize: none;
  min-height: 32px;
  max-height: 120px;
  padding: 3px 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
}
.composer textarea:focus { border-color: transparent; }
.composer[data-form="chat"] { position: relative; }
.composer[data-form="chat"]:focus-within { border-color: #79736b; }
.composer.drag-over { border-color: #d6b67f; }
.composer-drop-hint { display: none; }
.composer.drag-over .composer-drop-hint {
  display: grid; place-items: center; position: absolute; inset: 0; z-index: 2;
  border-radius: inherit; background: #30302ff5; color: #ebd7b2;
  font-size: 14px; pointer-events: none;
}
.draft-attachments { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; max-width: 100%; }
.draft-attachment {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: 100%;
  padding: 6px; border: 1px solid #514e48; border-radius: 12px; background: #383735;
}
.draft-attachment img { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.draft-file-icon { width: 32px; text-align: center; color: #d2c1a1; font-size: 24px; }
.draft-file-name { min-width: 0; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.draft-file-name small { display: block; margin-top: 3px; font-size: 10px; color: #c0b9ac; }
.draft-attachment.failed { border-color: #bd7e74; }
.draft-attachment.failed small { color: #efb0a4; }
.attachment-remove { min-width: 36px; min-height: 40px; padding: 0 8px; color: #d8d4ce; background: transparent; border-radius: 8px; font-size: 22px; }
.attachment-remove:hover { background: #ffffff0d; }
.attachment-retry { padding: 8px; color: #e5cd9f; background: transparent; font-size: 12px; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 0; padding: 0; }
.composer .plus-button { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: transparent; font-size: 25px; }
.composer .plus-button:hover { background: rgba(255,255,255,.08); }
.soul-caption { min-width: 0; flex: 1; padding: 8px; text-align: right; color: #bdb9b2; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-button { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: #f5f3ee; color: #292929; font-size: 24px; }
.composer-hint { display: none; }
.chat-context { display: none; }
.chat-gate { width: 100%; min-height: 0; margin: 0; border: 0; border-radius: 0; background: #181818; box-shadow: none; }
.chat-gate h1 { font-size: 25px; }
.chat-gate .button { background: #cfb688; color: #27231c; border-radius: 10px; }
.collection-drawer { background: #242424; }
.drawer-header { background: rgba(36,36,36,.96); }
.drawer-empty.compact { padding: 28px 12px; }
.drawer-assets-list { display: grid; gap: 9px; }
.assets-drawer .hook { background: #303030; border-color: #444; }
.memory-drawer .drawer-section > .panel-header { margin-top: 0; }
.memory-drawer .memory-actions { display: grid; }
.memory-drawer .memory-actions .button { width: 100%; }
.memory-drawer .memory-actions .button + .button { margin-left: 0; }

/* Role collection is a small picker, not an administration page. */
.collection-drawer { width: min(380px, 88vw); }
.drawer-header h2 { margin: 0; font-size: 18px; }
.drawer-header-actions { display: flex; align-items: center; gap: 7px; }
.compact-drawer { padding: 0 20px 24px; }
.compact-section { padding: 17px 0; }
.compact-section h3 { margin: 0 0 7px; color: #a9a59e; font-size: 11px; font-weight: 500; }
.minimal-list { display: grid; }
.minimal-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid #383838; }
.minimal-row:last-child { border-bottom: 0; }
.minimal-label { min-width: 0; overflow: hidden; color: #e7e4de; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.minimal-action { flex: 0 0 auto; min-height: 31px; padding: 5px 11px; border: 1px solid #555; border-radius: 17px; color: #ded9cf; background: #303030; font-size: 11px; }
.minimal-action:hover { border-color: #cdb88c; color: #f2dfb4; }
.minimal-action.current { border-color: #8ac293; color: #b8e0bf; }
.asset-status { flex: 0 0 auto; color: #8ac293; font-size: 11px; }
.memory-compact-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #aaa59d; font-size: 12px; }
.memory-compact-head .memory-actions { display: flex; gap: 6px; }
.memory-compact-head .button + .button { margin-left: 0; }
.danger-action { color: #e0aaa2; border-color: #664541; }
.danger-action:hover { border-color: #d18d82; color: #f0c0b8; }
.drawer-empty.compact { padding: 20px 0; }
.chat-gate h1 { margin: 0 0 20px; }
.chat-gate .gate-icon { margin-bottom: 20px; }

@media (max-width: 520px) {
  body { background: #181818; }
  .main-site-shell { width: 100%; min-height: 100dvh; }
  .chat-topbar { height: auto; padding: 10px 14px 8px; }
  .main-brand { font-size: 10px; }
  .main-brand span { font-size: 11px; }
  .conversation-identity { display: none; }
  .site-header-actions { gap: 5px; }
  .site-nav-button { min-height: 38px; padding: 7px 10px; font-size: 11px; }
  .site-nav-button:first-child, .site-nav-button:nth-child(3) { display: none; }
  .site-settings-button { width: 42px; min-height: 38px; font-size: 20px; }
  .conversation-head { padding: 10px 16px 6px; }
  .host-workflow-row { margin: 0 20px; }
  .messages { padding: 12px 16px 10px; }
  .composer { margin: 0 10px; border-radius: 21px; }
  .composer textarea { max-height: 112px; }
}

/* Collection drawer: quiet spacing, one clear action per row. */
.collection-drawer {
  width: min(520px, calc(100vw - 22px));
  background: #1d1d1c;
  border-left-color: rgba(255,255,255,.14);
  box-shadow: -28px 0 72px rgba(0,0,0,.42);
}
.drawer-header {
  align-items: center;
  padding: 30px 32px 25px;
  border-bottom-color: #3a3936;
  background: rgba(29,29,28,.96);
}
.drawer-header h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.drawer-header-actions { gap: 18px; }

.icon-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #eee9df;
  background: transparent;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}
.icon-button:hover { background: rgba(255,255,255,.08); border: 0; }
.compact-drawer { padding: 0 32px 42px; }
.compact-section { padding: 29px 0 31px; border-bottom-color: #393836; }
.compact-section h3 {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0 0 14px;
  color: #b4b0a8;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.compact-section h3::after { content: ""; height: 1px; flex: 1; background: #393836; }
.minimal-list { gap: 4px; }
.minimal-row {
  min-height: 61px;
  padding: 7px 0;
  border-bottom: 0;
}
.row-main { display: flex; align-items: center; min-width: 0; gap: 13px; }
.row-icon {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #e9d8ae;
  background: #2a2926;
  font-size: 17px;
}
.role-icon { font-size: 18px; }
.minimal-label {
  max-width: min(250px, 48vw);
  color: #eeeae3;
  font-size: 14px;
  font-weight: 500;
}
.row-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #777773;
}
.row-status-dot.active, .row-status-dot.verified { background: #7dcf91; box-shadow: 0 0 0 3px rgba(125,207,145,.1); }
.row-status-dot.failed { background: #c9796f; }
.minimal-action {
  min-width: 82px;
  min-height: 38px;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  color: #2e281e;
  background: #dfc487;
  font-size: 12px;
  font-weight: 650;
}
.minimal-action:hover { color: #2e281e; background: #f0d59c; border: 0; }
.minimal-action.current { color: #bfe0c6; background: #2f4334; }
.minimal-action:disabled { color: #918d84; background: #383733; }
.drawer-empty.compact { padding: 24px 0; }

@media (max-width: 520px) {
  .collection-drawer { width: 100%; }
  .drawer-header { padding: 23px 20px 20px; }
  .drawer-header h2 { font-size: 22px; }
  .drawer-header-actions { gap: 10px; }
  .compact-drawer { padding-left: 20px; padding-right: 20px; }
  .compact-section { padding-top: 25px; padding-bottom: 27px; }
  .minimal-label { max-width: calc(100vw - 210px); }
}

/* Contextual panels open below the centered chat header on every device. */
.drawer-backdrop {
  align-items: flex-start;
  justify-content: center;
}
.collection-drawer {
  width: min(540px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 76px);
  margin-top: 68px;
  border: 1px solid rgba(255,255,255,.14);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  animation: drawer-in .2s ease-out;
}
@keyframes drawer-in {
  from { transform: translateY(-18px); opacity: .62; }
  to { transform: translateY(0); opacity: 1; }
}
.site-header-actions { grid-column: 2; grid-row: 1; order: 0; gap: 6px; margin-left: 0; }
.site-toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 11px;
  border: 1px solid #ffffff0b;
  border-radius: 12px;
  color: #c9c5bd;
  background: linear-gradient(145deg, #ffffff06, #ffffff02);
  font-size: 12px;
  font-weight: 600;
}
.site-toolbar-button > span:first-child {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #e2cc99;
  background: #2a2926;
  font-size: 14px;
}
.site-toolbar-button:hover { border-color: #4b4944; background: rgba(255,255,255,.06); color: #f0ece4; }
.asset-trigger > span:first-child { color: #c9d4c6; }
.drawer-count { display: block; margin-top: 5px; color: #85827b; font-size: 11px; }
.asset-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px 0 7px;
}
.asset-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid #3b3a36;
  border-radius: 999px;
  color: #aaa69d;
  background: #252522;
  font-size: 11px;
}
.asset-filter span { color: #d3be8d; font-size: 13px; }
.asset-filter small { color: #77746e; font-size: 10px; }
.asset-filter:hover, .asset-filter.active { border-color: #b99e65; color: #f0e3c4; background: #3a3326; }
.asset-filter.active small { color: #d9c28a; }
.asset-section { padding-top: 18px; }
.asset-icon { color: #c9d4c6; font-size: 16px; }
.asset-row .asset-status { color: #99bd9d; }

@media (max-width: 520px) {
  .collection-drawer { width: calc(100vw - 0px); max-height: calc(100dvh - 68px); margin-top: 68px; border-right: 0; border-left: 0; border-radius: 0 0 18px 18px; }
  .site-toolbar-button { width: 44px; height: 44px; padding: 0; flex: 0 0 44px; }
  .site-toolbar-button > span + span { display: none; }
  .site-toolbar-button > span:first-child { width: 24px; height: 24px; }
  .asset-filters { gap: 6px; padding-top: 19px; }
  .asset-filter { min-height: 32px; padding-left: 9px; padding-right: 9px; }
}

/* Conversation-native role discussion; the chain contains only completed role calls. */
.discussion-toggle { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; min-height: 44px; padding: 0 12px; border: 1px solid #48423a; border-radius: 20px; color: #bdb7ac; background: transparent; font-size: 12px; cursor: pointer; }
.discussion-toggle:hover { border-color: #a18b65; color: #ece0cb; }
.discussion-toggle.active { color: #f2d9ad; border-color: #997744; background: #76562430; }
.discussion-toggle.active > span { color: #dbae65; }
.discussion-group { min-width: 0; }
.discussion-chain { border: 1px solid #514b403b; border-radius: 12px; background: #24221e60; margin: 4px 0 12px; overflow: hidden; }
.discussion-chain > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; cursor: pointer; color: #ded3be; }
.discussion-chain > summary::-webkit-details-marker { display: none; }
.discussion-mark { font-size: 18px; color: #c3a778; }
.discussion-title { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; }
.discussion-title small { color: #9e978a; font-size: 11px; font-weight: 400; }
.discussion-status { margin-left: auto; color: #999488; font-size: 11px; }
.discussion-status.running { color: #d2b781; }
.discussion-chevron { color: #8f8677; transition: transform .18s; }
.discussion-chain[open] .discussion-chevron { transform: rotate(180deg); }
.discussion-speeches { padding: 0 14px 10px 22px; }
.discussion-speeches .turn { position: relative; margin: 0; padding: 8px 0 10px 16px; border-left: 1px solid #6f5c3e80; }
.discussion-speeches .turn::before { content: ""; position: absolute; left: -4px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: #b59968; }
.discussion-speeches .message-meta { color: #c8b89c; margin-bottom: 5px; }
.discussion-speeches .assistant-text { font-size: 13px; line-height: 1.65; }
.discussion-wait { display: flex; gap: 8px; align-items: center; padding: 6px 0 0 16px; color: #ada391; font-size: 11px; }
.discussion-paused { color: #bba789; font-size: 12px; margin: 10px 0 0 20px; }
@media (max-width: 600px) {
  .composer-toolbar { gap: 6px; flex-wrap: nowrap; }
  .composer-toolbar .plus-button, .composer-toolbar .send-button { flex-shrink: 0; }
  .soul-caption { font-size: 10px; padding: 4px 0; }
  .discussion-toggle { padding: 0 9px; font-size: 11px; gap: 5px; }
  .discussion-chain > summary { padding: 8px 10px; gap: 7px; flex-wrap: wrap; }
  .discussion-title { gap: 7px; }
  .discussion-status { font-size: 10px; }
  .discussion-speeches { padding: 0 12px 10px 16px; }
  .discussion-speeches .turn { padding-left: 14px; }
}

/* Approved role collection: a single top-centered sheet. */
.role-collection-backdrop {
  background: rgba(12, 15, 19, .64);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.collection-drawer.role-collection {
  --collection-surface: #222529;
  --collection-gold: #e7cc96;
  --collection-hairline: rgba(255, 255, 255, .085);
  display: flex;
  flex-direction: column;
  width: min(480px, calc(100vw - 24px));
  height: min(760px, calc(100dvh - 88px - env(safe-area-inset-bottom, 0px)));
  max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px));
  margin-top: 68px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 20px;
  background: linear-gradient(135deg, #272a2e, var(--collection-surface) 48%, #202327);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .035);
  color: #f0f0f1;
}
.collection-icon { display: block; width: 24px; height: 24px; flex: 0 0 auto; pointer-events: none; }
.collection-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 16px 18px 14px 26px; }
.collection-header h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: .06em; }
.collection-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: #aaaeb3; background: transparent; border-radius: 10px; }
.collection-close .collection-icon { width: 24px; height: 24px; stroke-width: 1.5; }
.collection-close:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.collection-content { flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.3fr); gap: 16px; min-height: 0; overflow: hidden; padding: 0 20px 18px; }
.collection-content > section { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.collection-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #ffffff35 transparent; border-radius: 12px; }
.collection-scroll:focus-visible { outline: 1px solid var(--collection-gold); outline-offset: 2px; }
.collection-error { flex-shrink: 0; margin: 0 22px 14px; color: #f0aba4; font-size: 13px; line-height: 1.5; }
.role-collection h3 { margin: 0 0 10px; padding-left: 6px; color: #989ba0; font-size: 14px; font-weight: 500; letter-spacing: .06em; }
.collection-souls { padding-top: 0; }
.soul-switch { display: block; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .015); }
.soul-option { display: block; position: relative; width: 100%; min-width: 0; min-height: 48px; padding: 12px 38px 12px 14px; border: 1px solid transparent; border-bottom-color: var(--collection-hairline); border-radius: 8px; background: transparent; color: #f0f0f1; text-align: left; transition: background .15s; }
.soul-option-name { display: block; font-size: 15px; line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; }
.soul-option > .collection-icon { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 18px; height: 18px; stroke-width: 2; }
.soul-option:not(.selected):not(:disabled):hover { background: rgba(255, 255, 255, .05); }
.soul-option.selected { color: #1c1b18; border-color: #efdbaf; background: linear-gradient(115deg, #ead3a5, #e5c990); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.soul-option.selected:disabled, .collection-role-row.selected:disabled { opacity: 1; cursor: default; }
.soul-purchase { display: block; margin-top: 5px; font-size: 11px; color: var(--collection-gold); }
.soul-option.unavailable { color: #929296; background: rgba(255, 255, 255, .025); cursor: not-allowed; }
.soul-unavailable { display: block; margin-top: 4px; font-size: 11px; color: #aaa6a0; }
.collection-role-list { border-top: 1px solid var(--collection-hairline); }
.collection-role-row { position: relative; display: flex; align-items: center; gap: 24px; width: 100%; min-height: 66px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--collection-hairline); color: #f0f0f1; background: transparent; text-align: left; }
.collection-role-row:not(:disabled):hover { background: rgba(255, 255, 255, .035); }
.collection-role-row.selected { color: var(--collection-gold); }
.collection-role-row.selected::before { content: ""; position: absolute; left: -1px; top: 3px; bottom: 3px; width: 3px; border-radius: 3px; background: var(--collection-gold); }
.collection-role-symbol { flex: 0 0 30px; color: var(--collection-gold); }
.collection-role-symbol .collection-icon { width: 30px; height: 30px; }
.collection-role-name { flex: 1; min-width: 0; font-size: 19px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.collection-role-action { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-shrink: 0; color: #b1b3b8; font-size: 16px; font-weight: 400; white-space: nowrap; }
.collection-role-action .collection-icon { width: 18px; height: 18px; }
.collection-role-row.selected .collection-role-action { color: var(--collection-gold); }
.role-collection button:focus-visible { outline: 2px solid #f3d9a8; outline-offset: -4px; }
.soul-option.selected:focus-visible { outline-color: #3c3424; }
@media (max-width: 520px) {
  .collection-drawer.role-collection { border-radius: 18px; }
  .collection-header { padding: 12px 10px 12px 22px; }
  .collection-header h2 { font-size: 21px; }
  .collection-content { padding: 0 12px 14px; gap: 12px; }
  .soul-option { min-height: 46px; padding: 10px 34px 10px 12px; }
  .soul-option-name { font-size: 14px; }
  .collection-role-row { min-height: 61px; gap: 18px; padding-left: 12px; padding-right: 4px; }
  .collection-role-name { font-size: 17px; }
  .collection-role-symbol { flex-basis: 27px; }
  .collection-role-symbol .collection-icon { width: 27px; height: 27px; }
  .collection-role-action { gap: 5px; font-size: 14px; }
  .collection-role-action .collection-icon { width: 17px; height: 17px; }
}
@media (max-width: 360px) {
  .collection-role-row { gap: 12px; padding-left: 10px; }
  .collection-role-name { font-size: 15px; }
  .collection-role-action { gap: 3px; font-size: 12px; }
  .soul-option-name { font-size: 15px; }
  .soul-option { padding-left: 14px; }
}
@media (max-height: 600px) {
  .collection-drawer.role-collection { margin-top: 16px; height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px)); max-height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px)); }
  .collection-header { padding-top: 8px; padding-bottom: 8px; }
  .collection-content { gap: 8px; }
  .collection-role-row { min-height: 56px; padding-top: 10px; padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .role-collection { animation: none; }
  .soul-option { transition: none; }
}

/* Shared charcoal and champagne surfaces across chat and contextual panels. */
body { background: radial-gradient(ellipse at 50% 0, #30353c, #16191d 80%); color: var(--text); }
.main-site-shell { background: var(--bg); color: var(--text); box-shadow: 0 0 80px #0005; }
.chat-topbar { background: linear-gradient(125deg, #272a2e, #222529); border-color: var(--line); }
.main-brand { color: var(--muted); }
.main-brand span, .message-meta, .soul-caption { color: var(--muted); }
.conversation, .conversation-head, .messages, .chat-gate { background: transparent; }
.conversation-head h1 { color: var(--text); font-size: 18px; font-weight: 550; letter-spacing: .02em; }
.site-toolbar-button { color: #c4c6ca; }
.site-toolbar-button > span:first-child, .asset-trigger > span:first-child { background: transparent; color: var(--accent); }
.site-toolbar-button .collection-icon { width: 17px; height: 17px; }
.site-toolbar-button:hover { background: #ffffff08; border-color: #ffffff15; color: var(--text); }
.bubble { border-color: #ffffff0d; background: linear-gradient(130deg, #303338, #292c31); color: var(--text); border-radius: 18px 18px 5px 18px; }
.assistant-text { color: #e3e4e7; }
.composer { background: linear-gradient(130deg, #2b2e33, #25282d); border-color: #ffffff1f; border-radius: 20px; box-shadow: 0 8px 24px #0002, inset 0 1px #ffffff04; }
.composer textarea { color: var(--text); }
.composer textarea::placeholder { color: #888c93; }
.composer[data-form="chat"]:focus-within { border-color: #b59d7066; }
.composer .plus-button { color: #b4b7bd; }
.composer-toolbar { justify-content: flex-start; gap: 8px; }
.composer .send-button { flex: 0 0 42px; width: 42px; min-height: 42px; color: #22211d; background: var(--gold-surface); border: 1px solid #efdbaf; font-size: 25px; }
.composer .send-button:disabled { opacity: .35; }
.discussion-toggle { border-color: #ffffff17; color: #b8bbc1; background: transparent; }
.discussion-toggle:hover { border-color: #e7cc9660; color: var(--accent); }
.discussion-toggle.active { border-color: #e7cc9660; background: #e7cc960d; color: var(--accent); }
.discussion-toggle.active > span, .reply-pulse i { color: var(--accent); }
.reply-pulse i { background: var(--accent); }
.reply-pending, .discussion-wait { color: #b2b5bc; }
.discussion-chain { border-color: var(--line); background: #25282c; }
.discussion-chain > summary, .discussion-mark, .discussion-status.running { color: var(--accent); }
.discussion-title small, .discussion-status, .discussion-chevron { color: var(--muted); }
.discussion-speeches .turn { border-color: #e7cc9633; }
.discussion-speeches .turn::before { background: var(--accent); }
.discussion-speeches .message-meta { color: #ccb993; }
.draft-attachment { background: #303339; border-color: #ffffff1c; }
.draft-file-icon, .attachment-retry { color: var(--accent); }
.composer.drag-over .composer-drop-hint { background: #25282df5; color: var(--accent); }
.drawer-backdrop { background: #0c0f13a3; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.collection-drawer:not(.role-collection) { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px)); margin-top: 68px; border: 1px solid #ffffff21; border-radius: 20px; background: linear-gradient(135deg, #272a2e, #222529 48%, #202327); box-shadow: 0 24px 64px #0006, inset 0 1px #ffffff09; }
.drawer-header { padding: 20px 22px 16px; background: #24272bf5; border-color: var(--line); }
.drawer-header h2 { color: var(--text); font-size: 22px; font-weight: 600; letter-spacing: .05em; }
.drawer-header .icon-button { color: #aaaeb3; }
.compact-drawer { padding: 0 22px 24px; }
.compact-section { border-color: var(--line); }
.compact-section h3 { color: var(--muted); }
.compact-section h3::after { background: var(--line); }
.row-icon, .asset-icon { color: var(--accent); background: transparent; border-radius: 0; }
.minimal-label { color: var(--text); font-size: 14px; }
.asset-row { border-bottom: 1px solid var(--line); min-height: 60px; }
.asset-row .asset-status { color: #b6aa90; }
.asset-filter { min-height: 38px; border-radius: 9px; background: transparent; color: #aeb1b8; border-color: #ffffff12; }
.asset-filter span { color: #c8b58e; }
.asset-filter.active, .asset-filter:hover { border-color: #e7cc9655; color: var(--accent); background: #e7cc960c; }
.asset-filter small, .drawer-count { color: var(--muted); }
.minimal-action { border-radius: 9px; background: #ffffff07; color: var(--accent); border: 1px solid #e7cc9633; }
.minimal-action:hover { background: #e7cc9612; color: #f0d9ac; border: 1px solid #e7cc9655; }
.minimal-action.danger-action { color: #e0aaa2; border-color: #e0aaa233; }
.memory-compact-head { color: var(--muted); }
.memory-drawer .hook { background: #ffffff03; border-color: var(--line); border-radius: 12px; }
.hook-title { color: var(--accent); }
.hook p, .hook time, .drawer-empty { color: var(--muted); }
.timeline-item { border-color: var(--line); background: #ffffff03; }
.main-site-shell > .notice { border-color: #e7cc9630; color: #e1cea9; background: #292a29; }
.main-site-shell > .notice.error { border-color: #e0aaa233; color: #efb0a4; background: #30282a; }
.message-queue { margin: 0 16px 6px; padding: 6px 10px 2px; border: 1px solid var(--line); border-radius: 12px; background: #25282c; }
.message-queue header { display: flex; align-items: center; justify-content: space-between; min-height: 28px; color: #cbbb9a; font-size: 11px; }
.message-queue ol { max-height: 104px; overflow-y: auto; overscroll-behavior: contain; padding: 0; margin: 0; list-style: none; }
.queued-message { display: flex; align-items: center; gap: 5px; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--line); }
.queue-copy { min-width: 0; flex: 1; }
.queue-copy small { color: var(--muted); font-size: 10px; }
.queue-copy p { margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #e0e2e5; }
.queued-message button, .queue-resume { flex: 0 0 auto; min-width: 34px; min-height: 38px; padding: 0 8px; border-radius: 8px; color: var(--accent); background: transparent; font-size: 16px; }
.queue-resume { min-height: 28px; font-size: 12px; }
.queued-message button:hover, .queue-resume:hover { background: #ffffff08; }
@media (max-width: 520px) {
  .collection-drawer:not(.role-collection) { border-radius: 18px; }
  .drawer-header { padding: 16px 16px 12px 20px; }
  .compact-drawer { padding-left: 18px; padding-right: 18px; }
  .message-queue { margin-left: 10px; margin-right: 10px; }
  .composer-toolbar { gap: 5px; }
  .composer .plus-button { width: 44px; height: 44px; }
  .composer .send-button { flex-basis: 40px; width: 40px; min-height: 40px; }
  .discussion-toggle { padding: 0 8px; }
  .queue-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 360px) {
  .composer .soul-caption { display: none; }
  .composer .send-button { margin-left: auto; }
}
@media (max-height: 600px) {
  .collection-drawer:not(.role-collection) { margin-top: 16px; max-height: calc(100dvh - 32px); }
  .message-queue ol { max-height: 90px; }
}

/* CLI evidence belongs to the conversation, with the same charcoal/gold palette. */
.sandbox-result { width: min(100%, 720px); margin: 8px 0; color: var(--text, #e7e3da); }
.sandbox-trace { border: 1px solid #35342f; background: #20211e; border-radius: 12px; font-size: 13px; }
.sandbox-trace summary { display: flex; gap: 8px; align-items: center; min-height: 44px; padding: 8px 12px; cursor: pointer; list-style: none; }
.sandbox-trace summary > span { color: #c2ae86; }
.sandbox-trace summary small { margin-left: auto; color: #96968c; white-space: nowrap; }
.sandbox-trace ol { margin: 0; padding: 0 16px 14px 34px; }
.sandbox-trace li { padding: 5px 0; }
.sandbox-trace code { display: block; color: #aaa99e; overflow-wrap: anywhere; white-space: pre-wrap; margin-top: 4px; }
.sandbox-artifacts { display: grid; gap: 8px; margin-top: 8px; }
.sandbox-artifacts figure { margin: 0; border: 1px solid #35342f; border-radius: 12px; overflow: hidden; background: #1d1e1b; }
.sandbox-artifacts img { display: block; width: 100%; height: auto; max-height: clamp(200px, 40dvh, 320px); aspect-ratio: 8 / 5; object-fit: contain; background: #171815; }
.sandbox-artifacts figcaption { display: flex; align-items: center; gap: 14px; padding: 10px 14px; font-size: 13px; }
.sandbox-artifacts figcaption span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bcbcb0; }
.sandbox-artifacts figcaption button { background: #302e27; border: 1px solid #514939; color: #d6c4a0; border-radius: 7px; padding: 6px 12px; cursor: pointer; flex-shrink: 0; }

.main-brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Tactile controls stay fully inside the sheet's visible header. */
.collection-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.collection-close { flex: 0 0 44px; min-width: 44px; min-height: 44px; border: 1px solid #ffffff25; border-radius: 13px; color: #e2e1df; background: linear-gradient(145deg, #3b3f45, #2b2e33); box-shadow: inset 0 1px #ffffff0b, 0 3px 8px #0002; touch-action: manipulation; }
.collection-close:hover { color: #f5e1b6; border-color: #e7cc9670; background: #404248; }
.collection-close:active { transform: translateY(1px); background: #22262b; }
.collection-close:focus-visible { outline: 2px solid #f3d9a8; outline-offset: 3px; }
.collection-close .collection-icon { width: 22px; height: 22px; stroke-width: 1.8; }
.collection-drawer:focus { outline: none; }


.svg-artwork { margin: 10px 0 6px; max-width: 720px; overflow: hidden; border: 1px solid #b9a16f36; border-radius: 14px; background: #202328; }
.svg-artwork img { display: block; width: 100%; height: auto; max-height: clamp(200px, 40dvh, 320px); object-fit: contain; background: #f4f1e9; }
.svg-artwork figcaption { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.svg-artwork figcaption span { flex: 1; overflow: hidden; text-overflow: ellipsis; color: #c8c2b6; }
.svg-artwork figcaption button { flex-shrink: 0; min-height: 40px; padding: 8px 15px; border: 1px solid #d4bc8d55; border-radius: 10px; color: #e4cea1; background: #37352f; cursor: pointer; }
.svg-artwork figcaption button:hover { background: #454137; }

/* Voice tools remain in the conversation, sharing the collection palette. */
.voice-clone-form,.voice-output{width:min(100%,520px);margin:16px 0;padding:20px;border:1px solid #e7cc9626;border-radius:18px;background:linear-gradient(135deg,#272a2e,#222529);color:var(--text);box-sizing:border-box}
.voice-clone-form{display:grid;gap:16px}
.voice-clone-form>label{display:grid;gap:8px;font-size:13px;font-weight:600}
.voice-clone-form label>span{font-weight:400;font-size:12px;color:var(--muted)}
.voice-clone-form textarea,.voice-clone-form input[type=file]{box-sizing:border-box;max-width:100%;width:100%;padding:11px 12px;border:1px solid #ffffff20;border-radius:10px;background:#1d2024;color:var(--text);font:inherit;font-weight:400;resize:vertical}
.voice-clone-form input[type=file]::file-selector-button{background:#33363a;border:0;border-radius:6px;color:#e7cc96;padding:7px 10px;margin-right:8px}
.voice-clone-form .voice-consent{display:flex;align-items:center;gap:10px;font-size:12px;font-weight:400;line-height:1.6;min-height:40px}
.voice-consent input{width:18px;height:18px;flex-shrink:0;accent-color:#e7cc96}
.voice-form-footer,.voice-output figcaption{display:flex;align-items:center;justify-content:space-between;gap:16px}
.voice-form-footer [role=status]{color:#efb0a2;font-size:12px;line-height:1.6}
.voice-form-footer button,.voice-output button{min-height:44px;padding:0 18px;border:1px solid #e7cc9659;border-radius:11px;background:#303235;color:#e7cc96;font:inherit;white-space:nowrap;cursor:pointer}
.voice-clone-form button:disabled{opacity:.55;cursor:default}
.voice-output audio{display:block;width:100%;height:42px;margin-bottom:12px}
.voice-output figcaption{font-size:12px;overflow-wrap:anywhere}
@media(max-width:600px){.voice-clone-form,.voice-output{padding:16px;border-radius:14px}.voice-clone-form textarea{font-size:16px}}

.asset-entry{border-bottom:1px solid var(--line);min-width:0}
.asset-entry:last-child{border-bottom:0}
.asset-entry>.asset-row{border-bottom:0;gap:16px;padding:14px 0}
.asset-entry .minimal-label{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.5}
.asset-row-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.asset-row-actions .minimal-action{min-width:60px;min-height:44px;padding:8px 12px}
.asset-preview-toggle[aria-expanded=true]{background:#e7cc9614;border-color:#e7cc9670}
.asset-preview-content{margin:0 0 16px;overflow:hidden;border:1px solid #ffffff15;border-radius:12px;background:#191c20}
.asset-preview-content.image{background:repeating-conic-gradient(#303338 0% 25%,#292c30 0% 50%) 50% / 20px 20px}
.asset-preview-content img{display:block;width:100%;max-height:380px;object-fit:contain}
.asset-preview-content audio{display:block;width:100%;height:48px}
.asset-preview-content.audio{padding:10px;background:#292c30}
.asset-preview-content video{display:block;width:100%;max-height:380px}
.asset-preview-content iframe{display:block;width:100%;height:340px;border:0;background:white}
.asset-preview-content pre{max-height:340px;overflow:auto;margin:0;padding:16px;font:12px/1.7 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text)}
.asset-preview-status{margin:0;padding:22px;text-align:center;font-size:12px;color:var(--muted)}
.asset-preview-error{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px;font-size:12px;color:var(--muted)}
@media(max-width:600px){.asset-entry>.asset-row{gap:10px}.asset-row-actions{gap:6px}.asset-row-actions .minimal-action{min-width:54px;padding:8px 10px}.asset-preview-content img,.asset-preview-content video{max-height:300px}}

/* Uploaded references stay with the user's message, above its prompt. */
.message-images { display: grid; width: min(260px, 100%); gap: 6px; margin: 4px 0; }
.message-images img { display: block; width: 100%; height: 160px; min-width: 0; object-fit: contain; border: 1px solid #e7cc9626; border-radius: 12px; background: #202226; color: #c5bda9; font-size: 13px; }
.message-images.multiple { width: min(448px, 100%); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-images.multiple img { height: 140px; }
@media (max-width: 480px) { .message-images.multiple img { height: 132px; } }

.creation-results { display: grid; gap: 10px; margin: 10px 0; max-width: 560px; width: 100%; }
.creation-results figure { margin: 0; min-width: 0; overflow: hidden; border: 1px solid #e7cc9626; background: #222429; border-radius: 14px; }
.creation-results video, .creation-results img { display: block; max-height: clamp(200px, 40dvh, 320px); width: 100%; object-fit: contain; background: #181a1d; }
.creation-results audio { display: block; width: calc(100% - 20px); margin: 10px; }
.creation-results figcaption { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 14px; font-size: 13px; color: var(--muted); }
.creation-results figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creation-job { margin-top: 8px; }

/* Roles keep their two independent, touch-sized actions. */
.collection-role-row { flex-wrap: wrap; gap: 12px; cursor: default; }
.collection-role-buttons { display:flex; align-items:center; gap:10px; }
.collection-role-buttons button { min-height:44px; padding:8px 10px; border-radius:9px; background:#ffffff05; border:1px solid #ffffff12; }
.collection-role-buttons .role-info { color:var(--muted); font-size:14px; }
.collection-role-buttons .collection-role-action { min-width:84px; justify-content:center; color:var(--collection-gold); }
.role-description { flex:1 0 100%; margin:0; padding:0 4px 8px 42px; color:var(--muted); font-size:14px; line-height:1.65; }
@media(max-width:520px) { .collection-role-row { gap:8px; padding-left:4px; } .collection-role-name { font-size:15px; } .collection-role-symbol { flex-basis:24px; } .collection-role-buttons { gap:6px; } .collection-role-buttons button { padding:8px; } .collection-role-buttons .collection-role-action { min-width:70px; } }

.work-card { margin:10px 0; background:#25282c; border:1px solid #d9bc7833; border-radius:14px; overflow:hidden; }
.work-card header { display:flex; align-items:center; gap:10px; padding:6px 10px; border-bottom:1px solid var(--line); }
.work-name { flex:1; min-width:0; overflow-wrap:anywhere; color:var(--muted); font-size:13px; }
.work-actions { display:flex; gap:6px; flex-wrap:wrap; }
.work-card button { min-height:40px; padding:6px 10px; font-size:12px; border:1px solid #ffffff1a; background:#ffffff05; color:var(--gold,#e1c990); border-radius:8px; }
.work-card button[aria-pressed="true"] { background:#e1c9901a; border-color:#e1c99055; }
.work-preview iframe { display:block; width:100%; height:clamp(220px, 44dvh, 360px); border:0; background:white; }
.work-preview img,.work-preview video { display:block; width:100%; max-height:clamp(200px, 40dvh, 320px); object-fit:contain; }
.work-preview audio { width:100%; padding:16px; }
.work-code { padding:14px; } .work-code pre,.work-preview pre { margin:10px 0 0; padding:10px; max-height:450px; overflow:auto; white-space:pre; font-size:13px; }
.work-error,.work-status { padding:12px; color:var(--muted); }
.work-expanded { position:fixed; z-index:100; inset:16px max(12px,calc((100vw - 1160px)/2)) auto; max-height:calc(100dvh - 32px); box-shadow:0 0 0 100vmax #000a; }
.work-expanded .work-preview iframe { height:calc(100dvh - 114px); }
.work-expanded .work-code pre { max-height:calc(100dvh - 200px); }
@media(max-width:520px) { .work-card header { flex-wrap:wrap; gap:6px; padding:6px 8px; } .work-name { flex:1 1 120px; } .work-actions { max-width:100%; margin-left:auto; justify-content:flex-end; } .work-card button { min-height:44px; } }
.computer-panel { width:min(620px,calc(100vw - 24px)); }
.computer-connect-actions { display:flex; justify-content:flex-end; gap:12px; margin:12px 0 24px; }
.computer-pair-form { display:flex; gap:12px; align-items:end; flex-wrap:wrap; }
.computer-pair-form label { display:grid; gap:8px; flex:1; color:var(--muted); font-size:14px; }
.computer-pair-form select { background:var(--panel,#282b30); color:var(--text); padding:12px; border-radius:8px; border:1px solid var(--line); min-width:0; }
.computer-panel pre { white-space:pre-wrap; overflow-wrap:anywhere; padding:14px; background:#0003; border-radius:10px; font-size:12px; }
.computer-panel summary { min-height:44px; padding:10px 0; cursor:pointer; }
.computer-help { font-size:13px; line-height:1.6; color:var(--muted); }
.computer-panel button { min-height:44px; }

/* Poster first; decorative video never gates the real eight loading steps. */
.startup-loading { overflow: hidden; }
.startup-loading #app { opacity: 0; }
.startup-ready #app { animation: startup-chat-in .65s ease both; }
.startup-screen {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
  background: #15191c; color: #e7cc96; opacity: 1; transition: opacity .65s ease, visibility .65s;
}
.startup-stage { position: relative; width: min(100vw, 56.25dvh, 560px); aspect-ratio: 9 / 16; }
.startup-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.startup-art::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 30px 22px #15191c; }
.startup-poster, .startup-video { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.startup-video { opacity: 0; transition: opacity .5s ease; }
.startup-screen.has-video .startup-video { opacity: 1; }
.startup-scene { position: absolute; top: 64%; left: 13%; right: 13%; text-align: center; animation: startup-scene-in .7s ease both; }
.startup-title { margin: 0; color: #eee7da; font-size: clamp(22px, 3.1dvh, 32px); font-weight: 550; line-height: 1.3; letter-spacing: .12em; padding-left: .12em; }
.startup-message { margin: 10px 0 0; color: #c5bfb4; font-size: clamp(13px, 1.8dvh, 18px); font-weight: 400; line-height: 1.5; letter-spacing: .035em; }
.startup-progress { height: 3px; border-radius: 8px; background: #e7cc9619; margin-top: clamp(24px, 4.2dvh, 42px); }
.startup-progress-fill { display: block; width: 0; height: 100%; position: relative; border-radius: inherit; background: linear-gradient(90deg, #cda873, #f2d8a7); box-shadow: 0 0 9px #e7cc9630; transition: width .65s cubic-bezier(.2,.7,.2,1); }
.startup-progress-fill::after { content: ""; position: absolute; right: -2px; top: -1px; width: 5px; height: 5px; border-radius: 50%; background: #fff0c8; box-shadow: 0 0 10px 2px #e7cc9670; }
.startup-caption { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; margin-top: 13px; }
.startup-label { margin: 0; color: #b7b1a7; font-size: clamp(11px, 1.6dvh, 14px); line-height: 1.6; text-align: left; overflow-wrap: anywhere; }
.startup-count { flex: 0 0 auto; color: #d9b780; font-size: clamp(11px, 1.6dvh, 14px); font-variant-numeric: tabular-nums; }
.startup-detail { color: #96928a; font-size: 11px; margin: 10px 0 0; }
.startup-retry { margin-top: 16px; min-height: 44px; padding: 10px 24px; background: #e7cc9612; border: 1px solid #e7cc9640; border-radius: 12px; color: #e7cc96; font-size: 13px; }
.startup-retry[hidden], .startup-detail[hidden] { display: none; }.startup-retry:hover { background: #e7cc9620; }.startup-retry:focus-visible { outline: 2px solid #e7cc96; outline-offset: 4px; }
.startup-screen.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.startup-screen.is-error .startup-label { color: #e6b5a4; }
@keyframes startup-scene-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes startup-chat-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-height: 560px) and (min-aspect-ratio: 4/3) {
  .startup-stage { width: min(100%, 760px); height: 100dvh; aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .startup-art { position: relative; height: 100%; }
  .startup-poster, .startup-video { object-fit: cover; object-position: 50% 35%; }
  .startup-scene { position: relative; top: auto; left: auto; right: auto; margin: 20px 28px 20px 10px; }
  .startup-progress { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .startup-scene, .startup-ready #app { animation: none; }
  .startup-video { display: none; }
  .startup-screen, .startup-progress-fill { transition-duration: .01s; }
}

/* One animated Zhuda control: send, enqueue and stop share the same hit area. */
.composer .send-button.pig-action {
  --pig-frame: 56px; position: relative; flex: 0 0 var(--pig-frame); width: var(--pig-frame); height: var(--pig-frame); min-height: var(--pig-frame);
  display: grid; place-items: center; padding: 0; margin: -6px -3px -2px auto; overflow: visible; border: 0; border-radius: 16px;
  background: transparent; color: #27231d; isolation: isolate; transform-origin: center 80%; transition: transform .18s ease;
}
.composer .pig-action::before { content: ''; position: absolute; z-index: -1; inset: 15% 0 -2%; border-radius: 50%; background: radial-gradient(ellipse, #e7cc9624, transparent 70%); opacity: 0; transition: opacity .25s; }
.composer .pig-action:hover:not(:disabled)::before, .composer .pig-action:focus-visible::before { opacity: 1; }
.composer .pig-action:hover:not(:disabled) { filter: none; transform: translateY(-2px); }
.composer .pig-action:active:not(:disabled) { transform: scale(.95); }
.composer .pig-action:focus-visible { outline: 2px solid #e7cc9699; outline-offset: 2px; }
.composer .send-button.pig-action:disabled { opacity: 1; cursor: default; }
.pig-sprite {
  pointer-events: none; display: block; width: var(--pig-frame); height: var(--pig-frame);
  background-image: url('/public/zhuda-action-sprites-v1.webp'); background-repeat: no-repeat;
  background-size: calc(4 * var(--pig-frame)) calc(4 * var(--pig-frame));
  background-position-x: 0; background-position-y: 0;
  animation: pig-frames 2.8s steps(4) infinite; animation-delay: var(--pig-phase, 0s);
  filter: drop-shadow(0 3px 3px #0004);
}
.pig-action[data-pig-state="ready"] .pig-sprite { background-position-y: calc(-1 * var(--pig-frame)); animation-duration: 1.6s; }
.pig-action[data-pig-state="working"] .pig-sprite { background-position-y: calc(-2 * var(--pig-frame)); animation-duration: .88s; }
.pig-action[data-pig-state="stopping"] .pig-sprite { background-position-y: calc(-3 * var(--pig-frame)); animation-duration: 1.6s; }
.pig-action-badge { position: absolute; pointer-events: none; right: 2px; bottom: 2px; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 8px; background: linear-gradient(135deg, #f0d7a3, #c9aa72); box-shadow: 0 2px 5px #0003, 0 0 0 2px #2b2e32; transition: background .2s, opacity .2s; }
.pig-action-badge svg { width: 15px; height: 15px; }
.pig-action[data-pig-mode="stop"] .pig-action-badge { color: #fff0e5; background: #a76f67; }
.pig-action:disabled .pig-action-badge { opacity: .42; }
.pig-action[data-pig-state="working"]::before { opacity: .65; }
@keyframes pig-frames { to { background-position-x: calc(-4 * var(--pig-frame)); } }
@media (max-width: 520px) { .composer .send-button.pig-action { --pig-frame: 52px; margin-right: -2px; }.pig-action-badge { width: 20px; height: 20px; } }
@media (prefers-reduced-motion: reduce) { .pig-sprite { animation: none; }.composer .pig-action, .composer .pig-action::before { transition: none; }.composer .pig-action:hover:not(:disabled) { transform: none; } }

/* Transparency stays visible in chat and in the asset preview panel. */
.creation-results video.alpha-video,.asset-preview-content.video{background:#25282d}
.video-background-control{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-height:36px;padding:5px 9px;border:1px solid #ffffff20;border-radius:9px;background:#ffffff08;color:inherit;font:inherit;font-size:12px;cursor:pointer}
.video-background-control span{width:13px;height:13px;border:1px solid #ffffff60;border-radius:50%;background:var(--swatch)}
.video-background-control:hover{background:#ffffff16}
.video-background-control:focus-visible{outline:2px solid #d5b575;outline-offset:3px}
.video-preview-tools{display:flex;justify-content:flex-end;padding:8px}

.account-panel{width:min(420px,calc(100vw - 24px));color:#e5dfd3;background:linear-gradient(160deg,#30302b,#242622);}
.account-panel .drawer-body{padding:22px 26px 26px;}
.account-panel .drawer-header{padding:22px 26px 18px;}
.account-panel .drawer-header h2{font-size:22px;overflow-wrap:anywhere;}
.account-trigger svg{width:19px;height:19px;}
.account-form{display:grid;gap:17px;}
.account-form label{display:grid;gap:8px;color:#c8c2b6;font-size:12px;}
.account-form input{width:100%;min-width:0;height:46px;padding:10px 13px;border:1px solid #ffffff21;border-radius:12px;background:#171a176b;color:#f2ede2;font:inherit;font-size:16px;outline:none;}
.account-form input:focus{border-color:#d9bb7b;box-shadow:0 0 0 3px #d9bb7b15;}
.account-form small,.account-hint{color:#ada89d;font-size:12px;line-height:1.7;}
.account-hint{margin:0 0 20px;}
.account-panel .account-primary{width:100%;min-height:46px;margin:3px 0 0;border:0;border-radius:12px;background:linear-gradient(120deg,#e9d3a0,#c6a568);color:#27251f;font-size:14px;font-weight:650;}
.account-primary:disabled{opacity:.6;}
.account-links,.account-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:16px;}
.account-text{min-height:44px;padding:6px 0;background:transparent;color:#cdb88d;border:0;font:inherit;font-size:12px;cursor:pointer;}
.account-text:hover{color:#f0d79e;}
.account-notice{margin:15px 0 0;color:#eab6a8;font-size:12px;line-height:1.6;}
.account-recovery{display:block;overflow-wrap:anywhere;padding:18px;margin-bottom:18px;border:1px solid #d9bb7b3b;border-radius:12px;background:#191c18;color:#eed5a3;font-size:15px;line-height:1.8;user-select:all;}
.account-devices .minimal-row{gap:14px;padding:14px 0;}
.account-devices .minimal-label{display:grid;gap:5px;}
.account-devices small{color:#93b697;font-size:11px;}
.account-form input:focus-visible,.account-panel button:focus-visible{outline:2px solid #d9bb7b;outline-offset:3px;}
@media(max-width:520px){.account-panel .drawer-body{padding:20px}.account-panel .drawer-header{padding:20px}}

/* Inline references keep the native editor and the compact chat layout. */
.mention-input { position:relative; min-width:0; }
.mention-input textarea { position:relative; z-index:1; }
.mention-highlight { position:absolute; inset:0; margin:0; border:0; overflow:hidden; white-space:pre-wrap; overflow-wrap:anywhere; pointer-events:none; color:transparent; }
.mention-token { border-radius:4px; background:#e7cc9620; box-shadow:inset 0 -1px #e7cc9660; }
.mention-token.asset { background:#97c2c51c; box-shadow:inset 0 -1px #97c2c560; }
.bubble .mention-token { color:var(--accent); }
.bubble .mention-token.asset { color:#b3d1d3; }
.mention-menu { position:absolute; z-index:8; left:0; right:0; bottom:calc(100% + 6px); max-height:min(320px,44dvh); overflow:auto; overscroll-behavior:contain; padding:6px; border:1px solid #ffffff26; border-radius:14px; background:linear-gradient(135deg,#2b2e33,#222529); box-shadow:0 12px 36px #0006; }
.mention-menu[hidden] { display:none; }
.mention-group { padding:6px 10px 3px; color:var(--muted); font-size:10px; }
.mention-menu button { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:7px 10px; border:0; border-radius:8px; background:transparent; text-align:left; color:var(--text); }
.mention-menu button[aria-selected=true],.mention-menu button:hover { background:#e7cc9611; }
.mention-symbol { flex:0 0 20px; color:var(--accent); text-align:center; }
.mention-option-copy { display:grid; gap:2px; min-width:0; }
.mention-option-copy > span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:13px; }
.mention-option-copy small { font-size:10px; color:var(--muted); }
.mention-empty { padding:14px 10px; color:var(--muted); font-size:12px; }

.asset-labels { display:block; padding:0 12px 8px; color:var(--muted, #a6a29a); font-size:11px; }

/* Audio controls stay visible through streaming updates, without UA shadow controls. */
.audio-player { min-width:0; margin:12px; padding:6px 8px; border-radius:12px; background:#303237; color:#e9e2d4; }
.audio-player audio[hidden] { display:none!important; }
.image-preview-trigger { display:block; min-width:0; padding:0; border:0; border-radius:14px; background:transparent; cursor:zoom-in; line-height:0; }
.image-preview-trigger:focus-visible { outline:2px solid #e7cc96; outline-offset:3px; }
.draft-attachment .image-preview-trigger { flex:0 0 44px; width:44px; height:44px; border-radius:8px; }
.draft-attachment .image-preview-trigger img { width:44px; height:44px; }
.message-images .image-preview-trigger { width:100%; }
.svg-artwork .image-preview-trigger,.sandbox-artifacts .image-preview-trigger,.creation-results .image-preview-trigger,.work-preview .image-preview-trigger,.asset-preview-content .image-preview-trigger { width:100%; min-height:0; padding:0; border:0; border-radius:0; background:transparent; }
.svg-artwork .image-preview-trigger:focus-visible,.sandbox-artifacts .image-preview-trigger:focus-visible,.creation-results .image-preview-trigger:focus-visible,.work-preview .image-preview-trigger:focus-visible,.asset-preview-content .image-preview-trigger:focus-visible { outline-offset:-3px; }
.image-viewer { position:fixed; inset:12px 0 auto; width:min(1040px,calc(100vw - 24px)); max-width:none; max-height:calc(100dvh - 24px); margin:0 auto; padding:0; overflow:hidden; border:1px solid #e7cc9633; border-radius:18px; color:#ece8df; background:#25282d; box-shadow:0 20px 80px #0008; }
.image-viewer::backdrop { background:#11151ccc; backdrop-filter:blur(5px); }
.image-viewer-header { display:flex; align-items:center; gap:10px; padding:10px 12px; border-bottom:1px solid #ffffff14; }
.image-viewer-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; color:#c9c2b5; }
.image-viewer-header button,.image-viewer-retry { min-height:44px; padding:8px 12px; border:1px solid #e7cc9633; border-radius:10px; background:#ffffff05; color:#e7cc96; font-size:12px; }
.image-viewer-header button:hover,.image-viewer-retry:hover { background:#e7cc9615; }
.image-viewer-header button:focus-visible,.image-viewer-retry:focus-visible { outline:2px solid #e7cc96; outline-offset:2px; }
.image-viewer-header .image-viewer-close { width:44px; flex:0 0 44px; padding:10px; }
.image-viewer-close svg { display:block; width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; }
.image-viewer-content { display:grid; place-items:center; padding:12px; min-height:160px; max-height:calc(100dvh - 104px); overflow:auto; overscroll-behavior:contain; background:#191c20; }
.image-viewer-content img { display:block; width:auto; height:auto; max-width:100%; max-height:calc(100dvh - 128px); object-fit:contain; cursor:zoom-in; }
.image-viewer-content.original-size { display:block; }
.image-viewer-content.original-size img { max-width:none; max-height:none; margin:0 auto; cursor:zoom-out; }
.image-viewer [hidden] { display:none!important; }
.image-viewer-status { margin:24px 0; font-size:13px; color:#c9c2b5; }
@media(max-width:520px) { .image-viewer { border-radius:14px; }.image-viewer-header { gap:6px; padding:8px; }.image-viewer-content { padding:8px; } }
.audio-controls { display:flex; align-items:center; gap:8px; min-width:0; }
.audio-controls button { display:grid; place-items:center; flex:0 0 40px; width:40px; height:40px; min-height:40px; padding:9px; border:0; border-radius:9px; background:transparent; color:#e6ce9e; cursor:pointer; }
.audio-controls button:hover:not(:disabled) { background:#ffffff0b; }
.audio-controls button:disabled { opacity:.45; cursor:wait; }
.audio-controls svg { width:20px; height:20px; fill:currentColor; }
.audio-time { flex-shrink:0; font-size:12px; font-variant-numeric:tabular-nums; white-space:nowrap; color:#cec8bd; }
.audio-seek { --audio-progress:0%; flex:1; width:0; min-width:32px; height:26px; margin:0; padding:0; border:0; background:transparent; appearance:none; -webkit-appearance:none; cursor:pointer; accent-color:#e6ce9e; }
.audio-volume { flex:0 0 56px; width:56px; height:26px; padding:0; margin:0; border:0; background:transparent; appearance:none; -webkit-appearance:none; cursor:pointer; }
.audio-seek::-webkit-slider-runnable-track,.audio-volume::-webkit-slider-runnable-track { height:4px; border-radius:8px; background:linear-gradient(to right,#e6ce9e var(--audio-progress),#ffffff25 var(--audio-progress)); }
.audio-seek::-webkit-slider-thumb,.audio-volume::-webkit-slider-thumb { width:12px; height:12px; margin-top:-4px; border:0; border-radius:50%; background:#e6ce9e; appearance:none; -webkit-appearance:none; }
.audio-seek::-moz-range-track,.audio-volume::-moz-range-track { height:4px; border-radius:8px; background:#ffffff25; }
.audio-seek::-moz-range-progress,.audio-volume::-moz-range-progress { height:4px; background:#e6ce9e; }
.audio-seek::-moz-range-thumb,.audio-volume::-moz-range-thumb { width:12px; height:12px; border:0; border-radius:50%; background:#e6ce9e; }
.audio-seek:disabled { opacity:.45; cursor:wait; }
.audio-controls button:focus-visible,.audio-seek:focus-visible,.audio-volume:focus-visible { outline:2px solid #e6ce9e; outline-offset:2px; }
.audio-status { display:block; margin:0 8px 4px; font-size:11px; color:var(--muted); }
.audio-status[hidden] { display:none; }
.asset-preview-content.audio .audio-player { margin:0; }
@media(max-width:520px) { .audio-player { margin:8px; padding:4px; }.audio-controls { gap:4px; }.audio-controls button { flex-basis:44px; width:44px; height:44px; }.audio-time { font-size:11px; } }
@media(max-width:420px) { .audio-volume { display:none; } }

/* Published games share the existing work-card palette. */
.game-card{margin:8px 0;border:1px solid var(--border,rgba(139,110,74,.23));border-radius:12px;background:rgba(255,250,239,.7);overflow:hidden}
.game-card header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;flex-wrap:wrap}
.game-card strong{font-size:14px}.game-expiry{display:block;font-size:11px;opacity:.65;margin-top:4px}
.game-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.game-actions button,.game-actions a{font:inherit;font-size:12px;line-height:1.2;border:1px solid rgba(139,110,74,.22);border-radius:8px;padding:9px 11px;background:rgba(255,255,255,.55);color:inherit;text-decoration:none;cursor:pointer}.game-actions a{background:#365f56;color:#fff}.game-actions button:disabled{opacity:.45;cursor:default}
.game-preview{border-top:1px solid rgba(139,110,74,.18)}.game-preview iframe{display:block;width:100%;height:min(65vh,600px);border:0;background:#fff}.game-preview[hidden]{display:none}
@media(max-width:520px){.game-card header{padding:10px}.game-actions{width:100%}.game-actions button,.game-actions a{flex:1;text-align:center;min-height:40px}}

/* 子代理：沿用角色面板的炭灰、香檳色；任務面板獨立於主聊天 DOM。 */
.task-status-slot { grid-column:1 / -1; grid-row:2; display:flex; justify-content:flex-end; min-width:0; min-height:0; }
.task-status-slot:empty { display:none; }
.task-status-trigger { display:flex;gap:7px;align-items:center;max-width:100%;min-height:30px;border:0;border-radius:8px;background:transparent;color:#b9aa91;padding:3px 5px;font-size:11px;cursor:pointer; }
.task-status-dot { flex:0 0 5px;width:5px;height:5px;border-radius:50%;background:#8f877a; }
.task-status-trigger[data-active="true"] .task-status-dot { background:var(--accent);box-shadow:0 0 8px #e7cc9633; }
.task-status-text { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.task-status-trigger:hover { color:#ead8b5; }
.site-toolbar-button:focus-visible,.task-status-trigger:focus-visible { outline:2px solid var(--accent);outline-offset:2px; }
.task-card { margin:8px 0 16px 32px;max-width:480px;display:flex;gap:13px;padding:15px 18px;background:linear-gradient(125deg,#2a2b2d,#222326);border:1px solid #ad967a38;border-radius:15px;box-shadow:0 8px 24px #0002; }
.task-orbit { display:grid;place-items:center;align-self:flex-start;flex:0 0 30px;width:30px;height:30px;border:1px solid #bda88345;border-radius:50%;color:#ceb58b; }
.task-orbit.active { animation:task-breathe 2.6s ease-in-out infinite; }
.task-card strong { display:block;color:#ddd7cc;font-size:13px;font-weight:500;line-height:1.6; }
.task-card small,.task-result-label { color:#a99b84;font-size:11px; }
.task-card button { border:0;background:none;padding:7px 0 0;color:#cdb793;font-size:12px;cursor:pointer; }
.task-card button span { margin-left:12px; }
.task-result-label { display:block;margin:15px 0 2px 30px; }
.task-dialog { position:fixed;inset:24px 0 auto;margin:0 auto;width:min(780px,calc(100vw - 32px));height:calc(100dvh - 48px);max-width:unset;max-height:unset;padding:0;border:1px solid #7d715d63;border-radius:22px;background:#232427;color:#d9d4cb;box-shadow:0 24px 100px #0008;overflow:hidden; }
.task-dialog[open] { display:flex;flex-direction:column; }
.task-dialog::backdrop { background:#08090ac7;backdrop-filter:blur(9px); }
.task-panel-header { flex-shrink:0;display:flex;justify-content:space-between;gap:12px;align-items:flex-start;padding:22px 24px 18px;border-bottom:1px solid #a4907025;background:linear-gradient(120deg,#343431,#28292b); }
.task-panel-header>div { display:flex;gap:12px;min-width:0; }
.task-panel-header small { color:#bca987;font-size:10px;letter-spacing:2px; }
.task-panel-header h2 { margin:6px 0 0;font-weight:500;font-size:19px;line-height:1.5;overflow-wrap:anywhere; }
.task-panel-header p { margin:5px 0 0;font-size:12px;color:#a8a39a; }
.task-panel-close,.task-back { flex-shrink:0;display:grid;place-items:center;min-width:44px;min-height:44px;border-radius:12px;border:1px solid #c8b48e4d;background:#d3c3a511;color:#e0ccb0;font-size:27px;cursor:pointer; }
.task-back { min-width:34px;font-size:26px;margin-left:-8px; }
.task-overview,.task-process { overflow:auto;overscroll-behavior:contain;min-height:0;flex:1;scrollbar-gutter:stable; }
.task-overview { padding:12px 20px; }
.task-overview-item { display:flex;gap:14px;width:100%;padding:18px 4px;text-align:left;background:none;color:inherit;border:0;border-bottom:1px solid #bda88322;cursor:pointer; }
.task-overview-item>span:nth-child(2) { flex:1;min-width:0; }
.task-overview-item strong { display:block;font-size:14px;font-weight:500;line-height:1.5; }
.task-overview-item small,.task-overview-item time { display:block;margin-top:5px;color:#aaa397;font-size:11px; }
.task-overview-item:hover { background:#d4bd9410; }
.task-overview-row { display:flex;align-items:center;gap:12px;border-bottom:1px solid #bda88322; }
.task-overview-row .task-overview-item { flex:1;min-width:0;border-bottom:0; }
.task-archive,.task-overview-tools button { min-height:44px;min-width:56px;padding:8px 12px;border:1px solid #bda58044;border-radius:10px;background:#c8b48d0c;color:#cdbb9b;font:inherit;font-size:12px;cursor:pointer; }
.task-archive:hover,.task-overview-tools button:hover { background:#c8b48d20; }
.task-overview-tools { display:flex;justify-content:flex-end;padding:4px 0 8px; }
.task-card .task-card-archive { margin-left:20px;min-height:44px; }
.task-footer [data-task-controls] { display:flex;align-items:center;gap:10px;flex-wrap:wrap; }
.task-process { padding:22px 28px; }
.task-events { list-style:none;padding:0;margin:0; }
.task-event { position:relative;padding:0 0 24px 22px;border-left:1px solid #b8a17b33;overflow-wrap:anywhere; }
.task-event:before { position:absolute;content:'';width:7px;height:7px;background:#bca57d;border-radius:50%;top:4px;left:-4px; }
.task-event>div { display:flex;gap:12px;align-items:center; }
.task-event time { font-size:10px;color:#878780;font-variant-numeric:tabular-nums; }
.task-event strong { font-size:12px;font-weight:500;color:#cfba98; }
.task-event p { white-space:pre-wrap;font-size:13px;line-height:1.75;margin:8px 0 0; }
.task-event.milestone p { font-size:11px;color:#96948d; }
.task-event details { margin-top:10px;border:1px solid #a9967433;border-radius:8px;padding:10px; }
.task-event summary { font-size:12px;cursor:pointer; }
.task-event pre { white-space:pre-wrap;font-size:11px;max-height:360px;overflow:auto; }
.task-file { display:inline-block;color:#cdb691;font-size:12px;padding:8px 0; }
.task-more { padding:12px 20px;border:1px solid #ad987344;border-radius:10px;background:#bba07810;color:#c5b08c;cursor:pointer; }
.task-new-progress { position:absolute;bottom:140px;right:28px;border:1px solid #bea47e66;border-radius:20px;padding:10px 16px;background:#3b352c;color:#e4cc9f;box-shadow:0 5px 24px #0005;cursor:pointer; }
.task-new-progress[hidden] { display:none; }
.task-footer { flex-shrink:0;padding:12px 24px max(10px,env(safe-area-inset-bottom));border-top:1px solid #ad967a33;background:#28292a; }
.task-footer [data-task-controls] { font-size:11px;color:#97948c; }
.task-footer button { border:1px solid #bda58044;border-radius:9px;padding:8px 12px;background:#c8b48d12;color:#cdbb9b;font-size:12px;cursor:pointer; }
.task-footer form { display:flex;gap:10px;margin-top:10px; }
.task-footer textarea { flex:1;min-width:0;border:1px solid #8d806944;border-radius:10px;background:#202124;color:#ddd5c8;padding:11px;font:inherit;font-size:13px;resize:vertical;max-height:130px; }
.task-footer form button { align-self:flex-end;min-height:42px; }
.task-feedback { font-size:11px;color:#c0aa85;min-height:14px;margin:7px 0 0; }
.task-empty { text-align:center;color:#a39b8c;padding:60px 12px; }
@keyframes task-breathe { 50% { box-shadow:0 0 0 5px #bda8830b;color:#e0c492; } }
@media(max-width:600px) { .task-dialog { inset:0;width:100vw;height:100dvh;border:0;border-radius:0; }.task-panel-header { padding:calc(16px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 16px max(16px,env(safe-area-inset-left)); }.task-panel-header h2 { font-size:17px; }.task-process { padding:22px 18px; }.task-footer { padding-left:16px;padding-right:16px; }.task-card { margin-left:0; }.task-new-progress { right:18px; } }
@media(prefers-reduced-motion:reduce) { .task-orbit.active { animation:none; } }
.task-event video,.task-event audio { display:block;max-width:100%;margin:10px 0;border-radius:10px; }
.task-html iframe { display:block;width:100%;min-height:360px;border:0;background:white;margin-top:10px;border-radius:8px; }
button.task-file { margin-right:10px;border:0;background:transparent;font:inherit;font-size:12px;cursor:pointer; }

/* Public task milestones stay compact; recovery bookkeeping stays in the journal. */
.task-event.milestone { padding-bottom:16px; }
.task-event.milestone p { font-size:12px;color:#c2b9a9;margin-top:5px; }
.task-empty-progress { color:#aaa191;font-size:13px;line-height:1.7; }
.task-empty-progress[hidden] { display:none; }

/* Main personalities switch identity; engineering roles stay available for delegation. */
.role-description p { margin: 0; }
.role-description .minimal-action { margin-top: 10px; min-height: 44px; }
.role-section-caption { float: right; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.engineering-roles .collection-role-row { min-height: 54px; }
.engineering-roles .collection-role-symbol { opacity: .7; }
.engineering-roles .collection-role-name { font-size: 14px; }
.engineering-roles .collection-role-buttons { margin-left: auto; }

/* Shared toolbar: full touch targets and stable buttons while background events stream. */
.main-brand { display:inline-flex;align-items:center;gap:8px; }
.main-brand img { border-radius:8px;object-fit:cover; }
.task-toolbar-slot { display:inline-flex; }
.site-toolbar-button { position:relative;isolation:isolate; }
.toolbar-count { position:absolute;right:-4px;top:-5px;display:grid;place-items:center;min-width:17px;height:17px;padding:0 4px;border-radius:10px;background:#d7bd8c;color:#242320;font:600 10px/1 system-ui;box-shadow:0 0 0 2px #232427; }
.toolbar-new-dot { position:absolute;right:6px;top:6px;width:6px;height:6px;border-radius:50%;background:#f0d69f;box-shadow:0 0 10px #e4bd70; }
.toolbar-count[hidden],.toolbar-new-dot[hidden] { display:none; }
.task-trigger[data-active="true"] { color:#ead6b2;border-color:#c2a16b70;animation:toolbar-glow 2.4s ease-in-out infinite; }
.task-trigger[data-active="true"]::after { content:'';position:absolute;inset:-1px;border:1px solid #dab47865;border-radius:inherit;pointer-events:none;animation:toolbar-wave 2.4s ease-out infinite; }
.asset-trigger[data-new="true"] { border-color:#cbb27b80;animation:asset-arrival 2.8s ease-in-out infinite; }
.task-dependency { display:block;max-width:100%;padding:10px 12px;margin-bottom:14px;border:1px solid #c8ae7d44;background:#d1b7870c;color:#d8c4a0;border-radius:9px;text-align:left;font-size:12px;cursor:pointer; }
@keyframes toolbar-glow { 0%,100% { box-shadow:0 0 0 0 #d8b67408; } 50% { box-shadow:0 0 20px 2px #d8b67428; } }
@keyframes toolbar-wave { from { transform:scale(1);opacity:.8; } to { transform:scale(1.18,1.4);opacity:0; } }
@keyframes asset-arrival { 0%,100% { box-shadow:0 0 0 #dfc08300; } 45% { box-shadow:0 0 16px #dfc08333; } }
@media(max-width:520px) {
  .chat-topbar { grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:8px; }
  .chat-identity { min-width:0; }
  .main-brand { gap:5px;font-size:12px;letter-spacing:.01em; }
  .main-brand img { width:22px;height:22px;border-radius:6px; }
  .chat-role-title { font-size:13px;margin-top:3px; }
  .site-header-actions { gap:5px; }
  .site-header-actions .site-toolbar-button { width:auto;flex:0 0 auto;height:44px;min-width:48px;padding:4px 8px;gap:3px;flex-direction:column;font-size:10px;border-radius:11px; }
  .site-header-actions .site-toolbar-button > span + span { display:block;line-height:12px; }
  .site-header-actions .site-toolbar-button > span:first-child { width:18px;height:18px; }
  .site-header-actions .account-trigger { min-width:36px;padding:4px; }
  .site-header-actions .account-trigger > span + span { display:none; }
}
@media(prefers-reduced-motion:reduce) {
  .task-trigger[data-active="true"],.task-trigger[data-active="true"]::after,.asset-trigger[data-new="true"] { animation:none; }
  .task-trigger[data-active="true"] { box-shadow:0 0 12px #d8b67430; }
}
.task-wait-reason { margin:4px 0 0;color:#b4a691;font-size:11px;line-height:1.5; }

.mention-token.task{color:#d4bd91;background:rgba(206,177,119,.10);border-radius:4px}

/* Voice controls remain small visually, with a full touch target. */
.zhuda-speech-play{display:inline-flex;align-items:center;justify-content:center;gap:5px;border:1px solid transparent;background:transparent;color:var(--muted,#8b817a);cursor:pointer;border-radius:12px;min-width:44px;min-height:44px;flex-shrink:0;font:inherit}
.zhuda-speech-play svg{width:17px;height:17px;flex-shrink:0}
.zhuda-speech-play:hover{background:rgba(170,124,80,.10);color:#a36f44}
.zhuda-speech-play[data-playing=true]{color:#a36f44;background:rgba(170,124,80,.09)}
.zhuda-speech-play{font-size:11px;padding:0 8px;min-height:36px;vertical-align:middle;margin-left:8px;max-width:220px}
.zhuda-speech-play span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.message-meta:has(.zhuda-speech-play){display:flex;align-items:center;flex-wrap:wrap}
@media(max-width:600px){.zhuda-speech-play{min-height:44px}}
.conversation-empty[hidden]{display:none}

/* A compact sign-in entrance; protected chat is not mounted for visitors. */
.account-gate{min-height:100dvh;display:flex;flex-direction:column;align-items:center;padding:36px 12px 24px;background:radial-gradient(ellipse at top,#34372e,#20231f 70%);}
.account-gate>.main-brand{gap:10px;font-size:22px;color:#e5d2aa;margin-bottom:28px;}
.account-gate .account-backdrop{position:static;display:block;padding:0;background:none;backdrop-filter:none;width:100%;}
.account-gate .account-panel{position:relative;inset:auto;transform:none;margin:0 auto;max-height:calc(100dvh - 140px);border-radius:22px;box-shadow:0 22px 70px #0004;}
.account-devices .minimal-label small{display:block;font-size:11px;color:#b6b0a4;margin-top:5px;overflow-wrap:anywhere;}

/* Consistent prose across every role, final answer and retained task log. */
.markdown-content { white-space: normal; min-width: 0; overflow-wrap: anywhere; }
.markdown-content > :first-child { margin-top: 0; }
.markdown-content > :last-child { margin-bottom: 0; }
.markdown-content p { margin: .6em 0; }
.markdown-content :is(ul,ol) { margin: .6em 0; padding-left: 1.5em; }
.markdown-content li { margin: .3em 0; }
.markdown-content li > p { margin: .25em 0; }
.markdown-content :is(h1,h2,h3,h4,h5,h6) { font-size: 1.08em; line-height: 1.45; margin: 1em 0 .4em; font-weight: 650; color: inherit; }
.markdown-content strong { font-weight: 650; color: var(--text, #eee); }
.markdown-content a { color: var(--accent, #d7be8b); text-decoration: underline; text-underline-offset: .18em; overflow-wrap: anywhere; }
.markdown-content a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 3px; }
.markdown-content blockquote { margin: .65em 0; border-left: 3px solid #cdb78777; padding: .1em .85em; color: #bbb8b0; }
.markdown-content :not(pre) > code { font: .88em ui-monospace, monospace; background: #ffffff0c; border-radius: 5px; padding: .12em .3em; }
.markdown-content pre { max-width: 100%; overflow-x: auto; padding: 12px; border: 1px solid #ffffff12; border-radius: 10px; background: #14171b; white-space: pre; font: .85em/1.6 ui-monospace, monospace; }
.markdown-content pre code { white-space: inherit; }
.markdown-content hr { border: 0; border-top: 1px solid #ffffff1a; margin: 1em 0; }
.message-table { max-width: 100%; overflow-x: auto; margin: .7em 0; border: 1px solid #ffffff1c; border-radius: 9px; }
.markdown-content table { border-collapse: collapse; width: 100%; font-size: .94em; }
.markdown-content :is(th,td) { padding: .5em .7em; border: 1px solid #ffffff12; text-align: left; min-width: 5em; }
.markdown-content th { background: #cdb78713; font-weight: 650; }
.task-event > .markdown-content { display: block; color: inherit; font-size: 13px; line-height: 1.75; }
.task-event .markdown-content strong { font-size: inherit; }

/* Conversation display controls never change server memory. */
.chat-view-clear { display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;padding:11px;border:1px solid #514536;border-radius:13px;background:#2b2721;color:#d8bd8d;cursor:pointer; }
.chat-view-clear svg {width:22px;height:22px;}
.chat-view-clear:hover {background:#393024;border-color:#9b7b4d;}
.chat-view-clear:focus-visible,.chat-view-bar button:focus-visible {outline:2px solid #ddb574;outline-offset:2px;}
.chat-view-bar {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:3px 14px;border-bottom:1px solid #393127;background:#25211c;color:#c2af92;font-size:12px;line-height:1.5;}
.chat-view-bar>span {min-width:0;}
.chat-view-bar button {flex-shrink:0;min-height:44px;padding:6px 10px;border:0;border-radius:10px;background:transparent;color:#edc98b;font:inherit;cursor:pointer;}
.chat-view-bar button:hover {background:#393024;}
@media(max-width:480px) {.chat-view-bar {padding-inline:10px;gap:4px;font-size:11px;}.chat-view-bar button {padding-inline:6px;}}

/* More reading space on desktop; the mobile composer keeps its existing geometry. */
@media (min-width: 900px) {
  .main-site-shell { width: min(100%, 1040px); max-width: 1040px; }
  .message-content { max-width: 80ch; }
  .work-expanded { inset: 16px auto auto 50%; transform: translateX(-50%); width: min(94vw, 1440px); }
}
.history-load { display: block; margin: 12px auto; min-height: 44px; padding: 8px 18px; border-radius: 12px; border: 1px solid var(--border, #ddd); background: var(--collection-surface, #fff); color: inherit; }
.asset-search-controls { display: flex; gap: 8px; margin: 12px 0; }
.asset-search-controls input { min-width: 0; flex: 1; }
.asset-search-controls input, .asset-search-controls select { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; background: inherit; color: inherit; }
.asset-count,.asset-metadata { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.catalog-asset { display: flex; gap: 10px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.catalog-asset > div { min-width: 0; flex: 1; }
.asset-thumbnail { width: 56px; height: 56px; flex: 0 0 56px; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--surface-2); }
.asset-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.asset-metadata { display: block; padding: 0 8px 6px; }
.work-actions button { min-height: 44px; min-width: 44px; }
.soul-health { display: block; font-size: 11px; font-weight: normal; }
@media (max-width: 600px) { .site-toolbar-button,.work-actions button { min-width: 44px; min-height: 44px; } .asset-search-controls select { max-width: 110px; } }

.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
