/* css/chat.css: the /chat app. orbio.so credits voice: paper, ink, neon; DM Sans text, Geist Mono numbers and labels.
   The playground workbench is the model for messages (user = green tinted request, assistant = plain response). */

.chat-app {
  --cx-paper: #f8f8f6; --cx-paper-2: #f0f0ec; --cx-paper-3: #e6e6e0; --cx-white: #fefefd;
  --cx-ink: #141413; --cx-ink-2: #3f3f3b; --cx-ink-3: #77776f;
  --cx-line: #1414131f; --cx-line-2: #14141338;
  --cx-neon: #c9ff3f; --cx-neon-2: #b8f22e; --cx-lime: #9de500; --cx-green: #436021; --cx-green-2: #6a823c;
  --cx-bad: #b0483c; --cx-bad-tint: #f8ebe8;
  --cx-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --cx-sans: 'DM Sans', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cx-ease: cubic-bezier(.23, 1, .32, 1);
  --cx-rail-w: 264px; --cx-drawer-w: 300px;
  position: fixed; left: 0; right: 0;
  top: calc(var(--cx-top, 0px) + var(--cx-vtop, 0px));
  height: var(--cx-h, 100dvh);
  display: grid; grid-template-columns: var(--cx-rail-w) minmax(0, 1fr) var(--cx-drawer-w);
  background: var(--cx-paper); color: var(--cx-ink); font-family: var(--cx-sans);
  z-index: 20; overflow: hidden; letter-spacing: -0.005em;
}
html.cx-mode, html.cx-mode body { overflow: hidden; overscroll-behavior: none; }
html.cx-mode body { background: #f8f8f6; }
html.cx-mode .site-footer { display: none; }
.chat-app *, .cx-menu * { box-sizing: border-box; }
.chat-app button, .cx-menu button { font: inherit; color: inherit; }
.chat-app [hidden] { display: none !important; }
.cx-flex { flex: 1 1 auto; }
.cx-num { font-family: var(--cx-mono); font-variant-numeric: tabular-nums; }
.cx-label { font-family: var(--cx-mono); font-size: 11px; letter-spacing: .08em; text-transform: lowercase; color: var(--cx-ink-3); }
.cx-label-gap { margin-top: 18px; margin-bottom: 8px; }
.cx-eyebrow { font-family: var(--cx-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: lowercase; color: var(--cx-green-2); }
.cx-muted { color: var(--cx-ink-3); font-size: 13px; margin: 8px 0; }

/* ----------------------------------------------------------------- buttons */
.cx-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; flex: none; }
.cx-icon:hover { background: var(--cx-paper-2); }
.cx-icon svg, .cx-tool svg, .cx-send svg, .cx-btn svg, .cx-link svg, .cx-new svg { width: 18px; height: 18px; flex: none; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--cx-line-2); background: var(--cx-white); font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; color: var(--cx-ink); transition: background .15s, transform .15s var(--cx-ease); }
.cx-btn:hover { background: var(--cx-paper-2); }
.cx-btn:active { transform: scale(.98); }
.cx-btn:disabled { opacity: .55; cursor: default; }
.cx-btn-go { background: var(--cx-neon); border-color: #14141326; color: var(--cx-ink); }
.cx-btn-go:hover { background: var(--cx-neon-2); }
.cx-btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.cx-btn-block { width: 100%; }
.cx-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 2px; background: none; border: 0; color: var(--cx-ink-2); font-size: 13px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--cx-line-2); text-underline-offset: 3px; }
.cx-link svg { width: 15px; height: 15px; }
.cx-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cx-line-2); background: var(--cx-white); font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.cx-chip:hover { background: var(--cx-paper-2); }
.cx-chip.is-on { background: var(--cx-ink); color: var(--cx-paper); border-color: var(--cx-ink); }

/* -------------------------------------------------------------- rail, drawer */
.cx-rail, .cx-drawer { display: flex; flex-direction: column; min-height: 0; background: var(--cx-paper-2); padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.cx-rail { border-right: 1px solid var(--cx-line); }
.cx-drawer { border-left: 1px solid var(--cx-line); }
.cx-grab { display: none; }
.cx-rail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 40px; }
.cx-close { display: none; }
.cx-new { flex: 1; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--cx-line-2); background: var(--cx-white); font-weight: 550; font-size: 14px; cursor: pointer; }
.cx-new:hover { background: var(--cx-paper); }
.cx-list { display: flex; flex-direction: column; gap: 2px; margin: 8px -4px 0; min-height: 60px; flex: 1 1 auto; overflow-y: auto; }
.cx-empty-list { color: var(--cx-ink-3); font-size: 13px; padding: 6px 4px; margin: 0; }
.cx-item { display: flex; align-items: center; border-radius: 10px; }
.cx-item:hover, .cx-item.is-on { background: var(--cx-paper-3); }
.cx-item-open { flex: 1; min-width: 0; min-height: 40px; text-align: left; background: none; border: 0; padding: 6px 8px; cursor: pointer; font-size: 13.5px; }
.cx-item-open span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-item-del { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; opacity: 0; cursor: pointer; color: var(--cx-ink-3); }
.cx-item-del svg { width: 15px; height: 15px; }
.cx-item:hover .cx-item-del, .cx-item.is-on .cx-item-del, .cx-item-del:focus-visible { opacity: 1; }
@media (hover: none) { .cx-item-del { opacity: .7; } }
.cx-mini { margin-top: 10px; }
.cx-rail-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--cx-line); }
.cx-links { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.cx-links a { font-size: 12.5px; color: var(--cx-ink-2); text-decoration: none; min-height: 28px; display: inline-flex; align-items: center; }
.cx-links a:hover { color: var(--cx-ink); text-decoration: underline; }
.cx-legal { font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-ink-3); margin: 8px 0 0; }

.cx-bal { padding: 16px; border-radius: 16px; border: 1px solid var(--cx-line-2); background: var(--cx-white); box-shadow: inset 0 1px #ffffffd9, 0 18px 50px -35px #53613750; }
.cx-bal-v { display: block; font-family: var(--cx-mono); font-size: 30px; font-weight: 500; letter-spacing: -.03em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.cx-bal-row { display: flex; gap: 14px; flex-wrap: wrap; }
.cx-tot { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--cx-ink-2); }
.cx-tot b { font-family: var(--cx-mono); font-size: 18px; font-weight: 500; color: var(--cx-ink); }
.cx-hold { list-style: none; margin: 8px 0 4px; padding: 0; }
.cx-hold li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--cx-line); font-family: var(--cx-mono); font-size: 12.5px; }

/* top up */
.cx-topup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.cx-amt-chips { display: flex; gap: 6px; }
.cx-amt-chips .cx-chip { flex: 1 1 0; justify-content: center; padding: 6px 6px; min-width: 0; font-size: 13px; overflow: hidden; }
.cx-amt-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--cx-line-2); border-radius: 12px; background: var(--cx-white); padding: 0 12px; }
.cx-amt-row:focus-within { border-color: #a87944; }
.cx-amt { flex: 1; min-width: 0; border: 0; background: none; font-family: var(--cx-mono); font-size: 16px; min-height: 44px; outline: none; color: var(--cx-ink); }
.cx-amt-row span { font-family: var(--cx-mono); font-size: 12px; color: var(--cx-ink-3); }
.cx-quote { font-size: 12.5px; color: var(--cx-ink-2); margin: 0; min-height: 1.4em; }

/* ------------------------------------------------------------------- main */
.cx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--cx-paper); }
.cx-top { display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 56px; border-bottom: 1px solid var(--cx-line); background: color-mix(in srgb, var(--cx-paper) 88%, transparent); }
#cx-open-rail, #cx-open-drawer { display: none; }
.cx-avatar { width: 40px; height: 40px; flex: none; border-radius: 12px; overflow: hidden; position: relative; display: grid; place-items: center; }
.cx-avatar img { width: 34px; height: 34px; object-fit: contain; }
.cx-avatar canvas { width: 100% !important; height: 100% !important; display: block; }
.cx-model-chip, .cx-tool { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--cx-line); background: transparent; font-family: var(--cx-mono); font-size: 12px; cursor: pointer; color: var(--cx-ink-2); }
.cx-model-chip svg, .cx-tool svg { width: 14px; height: 14px; }
.cx-model-chip:hover, .cx-tool:hover { background: var(--cx-paper-2); }
.cx-tool-ic { width: 36px; padding: 0; justify-content: center; }
.cx-tool-ic svg { width: 16px; height: 16px; }
.cx-wallet { display: none; }

.cx-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-padding-bottom: 24px; }
.cx-thread { max-width: 780px; margin: 0 auto; padding: 24px 24px 32px; display: flex; flex-direction: column; gap: 14px; }

/* hello + gate */
.cx-hello { padding: 8vh 0 12px; }
.cx-hello h1, .cx-gate h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -.035em; font-weight: 650; margin: 8px 0 10px; }
.cx-hello p { color: var(--cx-ink-3); font-size: 16px; line-height: 1.6; max-width: 520px; margin: 0; }
.cx-gate { margin: 4vh auto 0; width: 100%; max-width: 460px; text-align: center; padding: 26px 24px 24px; border-radius: 22px; border: 1px solid var(--cx-line-2); background: linear-gradient(125deg, #f7faef99, #fff6 55%, #e9f5cc70), var(--cx-white); box-shadow: inset 0 1px #ffffffd9, 0 18px 50px -35px #53613750; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cx-gate h1 { font-size: clamp(24px, 3.4vw, 32px); margin: 4px 0 4px; }
.cx-gate-sub { color: var(--cx-ink-2); font-size: 15px; line-height: 1.55; margin: 0 0 14px; }
.cx-gate-mascot { width: 168px; height: 168px; display: grid; place-items: center; margin-bottom: 4px; position: relative; }
.cx-gate-mascot img { width: 150px; height: 150px; object-fit: contain; animation: cx-float 4.5s ease-in-out infinite; }
.cx-gate-mascot canvas { width: 100% !important; height: 100% !important; }
@keyframes cx-float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .cx-gate-mascot img { animation: none; } }
.cx-deeplinks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.cx-warnline { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 12.5px; color: var(--cx-ink-2); background: #cff18a40; border: 1px solid #9bbd5940; border-radius: 10px; padding: 10px 12px; margin: 14px 0 4px; line-height: 1.45; }
.cx-warnline svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--cx-green); }
.cx-err { color: var(--cx-bad); font-size: 13px; margin: 6px 0 0; min-height: 0; }
.cx-err:empty { display: none; }

/* messages */
.cx-msg { max-width: 100%; }
.cx-user { align-self: flex-end; max-width: min(86%, 620px); }
.cx-bubble { padding: 12px 16px; border-radius: 18px 18px 6px 18px; background: linear-gradient(140deg, #d9f6a54d, #ffffff14 80%), var(--cx-white); border: 1px solid #72844530; font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-ai { align-self: stretch; font-size: 16px; line-height: 1.7; color: var(--cx-ink); overflow-wrap: anywhere; }
.cx-md > :first-child { margin-top: 0; }
.cx-md > :last-child { margin-bottom: 0; }
.cx-md p, .cx-read p { margin: 0 0 10px; }
.cx-md ul, .cx-md ol { margin: 0 0 10px; padding-left: 22px; }
.cx-md li { margin: 3px 0; }
.cx-md h3, .cx-md h4 { font-size: 16px; font-weight: 650; margin: 14px 0 6px; letter-spacing: -.01em; }
.cx-md h5, .cx-md h6 { font-size: 14px; font-weight: 650; margin: 12px 0 4px; }
.cx-md a { color: var(--cx-green); text-decoration: underline; text-decoration-color: var(--cx-lime); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cx-md code, .cx-cmd code, .cx-hint code { font-family: var(--cx-mono); font-size: .86em; background: var(--cx-paper-2); border: 1px solid var(--cx-line); border-radius: 6px; padding: 1px 5px; }
.cx-md blockquote { margin: 0 0 10px; padding: 4px 0 4px 14px; border-left: 3px solid var(--cx-lime); color: var(--cx-ink-2); }
.cx-md hr { border: 0; border-top: 1px solid var(--cx-line); margin: 14px 0; }
.md-code { border: 1px solid var(--cx-line-2); border-radius: 12px; overflow: hidden; margin: 0 0 12px; background: #141413; color: #ecece6; }
.md-code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; font-family: var(--cx-mono); font-size: 11px; color: #a8a89e; border-bottom: 1px solid #ffffff1a; }
.md-copy { background: none; border: 0; color: #d8d8d0; font-family: var(--cx-mono); font-size: 11px; min-height: 32px; padding: 0 8px; cursor: pointer; }
.md-code pre { margin: 0; padding: 12px; overflow-x: auto; font-family: var(--cx-mono); font-size: 13px; line-height: 1.55; }
.md-code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.md-table { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--cx-line); border-radius: 12px; background: var(--cx-white); -webkit-overflow-scrolling: touch; }
.md-table table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md-table th { font-family: var(--cx-mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: lowercase; color: var(--cx-ink-3); text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--cx-line); white-space: nowrap; }
.md-table td { padding: 8px 12px; border-bottom: 1px solid var(--cx-line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.md-table tr:last-child td { border-bottom: 0; }
.cx-think { font-size: 13px; color: var(--cx-ink-3); margin-bottom: 6px; }
.cx-think summary { cursor: pointer; font-family: var(--cx-mono); font-size: 11px; letter-spacing: .06em; text-transform: lowercase; color: var(--cx-green-2); min-height: 28px; display: flex; align-items: center; }
.cx-think-body { white-space: pre-wrap; max-height: 180px; overflow-y: auto; padding: 6px 0 6px 12px; border-left: 2px solid var(--cx-line); }
.cx-typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.cx-typing i { width: 7px; height: 7px; border-radius: 50%; background: #6d9529; opacity: .35; animation: cx-dot 1.1s infinite ease-in-out; }
.cx-typing i:nth-child(2) { animation-delay: .15s; }
.cx-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cx-dot { 40% { opacity: 1; transform: translateY(-2px); } }

/* step chips, notes, cost */
.cx-step { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 999px; border: 1px solid var(--cx-line); background: var(--cx-paper-2); font-family: var(--cx-mono); font-size: 12px; color: var(--cx-ink-2); }
.cx-step-ic { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--cx-white); }
.cx-step-ic svg { width: 13px; height: 13px; }
.cx-step.is-run .cx-step-ic svg { animation: cx-spin 1s linear infinite; }
.cx-step.is-ok .cx-step-ic { background: var(--cx-neon); }
.cx-step.is-bad .cx-step-ic { background: var(--cx-bad-tint); color: var(--cx-bad); }
@keyframes cx-spin { to { transform: rotate(360deg); } }
.cx-note-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--cx-ink-2); padding: 10px 12px; border-radius: 12px; background: var(--cx-paper-2); border: 1px solid var(--cx-line); line-height: 1.5; }
.cx-note-line svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.cx-note-line.bad { background: var(--cx-bad-tint); border-color: #b0483c30; color: #7c2f26; }
.cx-cost { align-self: flex-start; font-family: var(--cx-mono); font-size: 11px; color: var(--cx-ink-3); letter-spacing: .02em; }
.cx-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.cx-total span { font-size: 13px; color: var(--cx-ink-3); }
.cx-total b { font-family: var(--cx-mono); font-size: 24px; font-weight: 500; letter-spacing: -.03em; }
.cx-read .cx-btn { margin-top: 4px; }
.cx-note { font-size: 12.5px; color: var(--cx-ink-3); }
.cx-json { font-family: var(--cx-mono); font-size: 12px; background: var(--cx-paper-2); padding: 12px; border-radius: 10px; overflow-x: auto; max-height: 280px; }
.cx-cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.cx-cmd { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; min-height: 44px; border-radius: 12px; border: 1px solid var(--cx-line); background: var(--cx-white); cursor: pointer; font-size: 13px; color: var(--cx-ink-2); }
.cx-cmd:hover { border-color: var(--cx-line-2); }

/* action card */
.cx-card { min-width: 0; border: 1px solid var(--cx-line-2); border-radius: 20px; background: var(--cx-white); box-shadow: inset 0 1px #ffffffd9, 0 18px 50px -35px #53613750; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-width: 560px; width: 100%; }
.cx-card[data-state="confirmed"] { border-color: #9bbd59; }
.cx-card[data-state="failed"] { border-color: #b0483c55; }
.cx-card[data-state="cancelled"] { opacity: .8; }
.cx-head h3 { margin: 4px 0 2px; font-size: 19px; letter-spacing: -.02em; font-weight: 650; }
.cx-sum { margin: 0; color: var(--cx-ink-2); font-size: 14px; line-height: 1.5; }
.cx-rows { margin: 0; display: grid; border-top: 1px solid var(--cx-line); }
.cx-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--cx-line); font-size: 13.5px; }
.cx-row dt { color: var(--cx-ink-3); flex: none; }
.cx-row dd { margin: 0; font-family: var(--cx-mono); font-size: 13px; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cx-warn { list-style: none; margin: 0; padding: 10px 12px; border-radius: 10px; background: #cff18a40; border: 1px solid #9bbd5940; display: grid; gap: 6px; }
.cx-warn li { display: flex; gap: 8px; font-size: 12.5px; color: var(--cx-ink-2); line-height: 1.45; }
.cx-warn svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--cx-green); }
.cx-txs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cx-tx { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cx-tx-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--cx-line-2); font-family: var(--cx-mono); font-size: 11px; flex: none; }
.cx-tx-l { flex: 1; min-width: 0; }
.cx-tx-s { font-family: var(--cx-mono); font-size: 11px; color: var(--cx-ink-3); text-align: right; }
.cx-tx-s a { color: var(--cx-green); }
.cx-tx[data-s="signing"] .cx-tx-n, .cx-tx[data-s="pending"] .cx-tx-n { background: var(--cx-neon); border-color: transparent; animation: cx-pulse 1.2s infinite; }
.cx-tx[data-s="confirmed"] .cx-tx-n, .cx-tx[data-s="skipped"] .cx-tx-n { background: var(--cx-ink); color: var(--cx-paper); border-color: transparent; }
.cx-tx[data-s="failed"] .cx-tx-n { background: var(--cx-bad-tint); color: var(--cx-bad); }
@keyframes cx-pulse { 50% { opacity: .55; } }
.cx-status { margin: 0; font-size: 13px; color: var(--cx-ink-2); }
.cx-status:empty { display: none; }
.cx-card[data-state="failed"] .cx-status { color: var(--cx-bad); }
.cx-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cx-actions .cx-btn-go { flex: 0 1 auto; }
.cx-topcard { align-self: stretch; }
.cx-topup.is-compact { max-width: 420px; }

/* composer */
.cx-composer { flex: none; padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--cx-paper) 75%, color-mix(in srgb, var(--cx-paper) 0%, transparent)); position: relative; }
.cx-composer > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.cx-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.cx-chips::-webkit-scrollbar { display: none; }
.cx-box { border: 1px solid var(--cx-line-2); border-radius: 18px; background: color-mix(in srgb, var(--cx-paper-2) 60%, var(--cx-white)); padding: 10px 10px 8px 14px; transition: border-color .15s, box-shadow .2s; }
.cx-box:focus-within { border-color: #a87944; box-shadow: 0 0 0 3px #c9ff3f40; }
.chat-app.is-busy .cx-box { box-shadow: 0 0 0 2px #c9ff3f80; }
.cx-box textarea { width: 100%; border: 0; outline: none; background: transparent; resize: none; font-family: var(--cx-sans); font-size: 16px; line-height: 1.5; color: var(--cx-ink); max-height: 200px; min-height: 26px; padding: 4px 0; display: block; }
.cx-box textarea::placeholder { color: var(--cx-ink-3); }
.cx-tools { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.cx-mode { font-family: var(--cx-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--cx-green-2); }
.cx-send { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid #14141326; background: var(--cx-neon); cursor: pointer; flex: none; }
.cx-send:hover { background: var(--cx-neon-2); }
.cx-send.is-stop { background: var(--cx-ink); color: var(--cx-paper); }
.cx-fine { font-size: 11px; color: var(--cx-ink-3); text-align: center; margin: 6px auto 0; font-family: var(--cx-mono); letter-spacing: .01em; }
.cx-hints { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); background: var(--cx-white); border: 1px solid var(--cx-line-2); border-radius: 14px; box-shadow: 0 18px 50px -25px #14141350; padding: 6px; display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; z-index: 5; }
.cx-hint { display: flex; gap: 10px; align-items: center; text-align: left; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--cx-ink-2); }
.cx-hint:hover, .cx-hint:focus-visible { background: var(--cx-paper-2); }

/* model menu (lives on body) */
.cx-menu { position: fixed; z-index: 120; background: #fefefd; border: 1px solid #14141338; border-radius: 16px; box-shadow: 0 24px 60px -30px #14141366; padding: 10px; font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif; color: #141413; }
.cx-menu .cx-label { padding: 4px 8px 6px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; letter-spacing: .08em; color: #77776f; }
.cx-menu-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; text-align: left; min-height: 48px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; }
.cx-menu-item:hover { background: #f0f0ec; }
.cx-menu-item.is-on { border-color: #14141338; background: #f7faef; box-shadow: inset 3px 0 0 #9de500; }
.cx-menu-t { display: flex; flex-direction: column; min-width: 0; }
.cx-menu-t b { font-size: 14px; font-weight: 600; }
.cx-menu-t small { font-size: 12px; color: #77776f; }
.cx-menu .cx-num { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; color: #3f3f3b; white-space: nowrap; }
.cx-menu-fine { font-size: 11px; color: #77776f; margin: 6px 8px; }
.cx-menu-voice { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px; font-size: 13px; border-top: 1px solid #1414131f; cursor: pointer; }
.cx-menu-voice input { width: 18px; height: 18px; accent-color: #436021; }

.cx-scrim { position: fixed; inset: 0; background: #14141340; opacity: 0; transition: opacity .25s; z-index: 40; }
.cx-scrim.open { opacity: 1; }

/* ------------------------------------------------------------ breakpoints */
@media (max-width: 1179px) {
  .chat-app { grid-template-columns: var(--cx-rail-w) minmax(0, 1fr); }
  #cx-open-drawer { display: inline-grid; }
  .cx-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 50; transform: translateX(105%); transition: transform .3s var(--cx-ease); box-shadow: -24px 0 60px -40px #14141366; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .cx-drawer.open { transform: none; }
  .cx-drawer .cx-close { display: inline-grid; }
  .cx-drawer .cx-rail-top { justify-content: space-between; }
}
@media (max-width: 1023px) { .chat-app { --cx-rail-w: 224px; } }
@media (max-width: 760px) {
  html.cx-mode .site-header, html.cx-mode .banner, html.cx-mode .pillars, html.cx-mode .sheet, html.cx-mode .sheet-back { display: none !important; }
  .chat-app { grid-template-columns: minmax(0, 1fr); top: var(--cx-vtop, 0px); height: var(--cx-h, 100dvh); }
  #cx-open-rail { display: inline-grid; }
  .cx-wallet { display: inline-flex; min-height: 40px; padding: 0 12px; font-size: 13px; max-width: 150px; }
  .cx-wallet .wl { white-space: nowrap; }
  .cx-top { padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px; gap: 6px; min-height: 54px; }
  .cx-sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 82vh; z-index: 50; border: 0; border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .32s var(--cx-ease); box-shadow: 0 -24px 60px -30px #14141366; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .cx-sheet.open { transform: none; }
  .cx-drawer { width: auto; top: auto; }
  .cx-grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--cx-line-2); margin: 2px auto 10px; flex: none; }
  .cx-close { display: inline-grid; }
  .cx-thread { padding: 16px 16px 24px; gap: 12px; }
  .cx-composer { padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cx-hints { left: 12px; right: 12px; }
  .cx-ai { font-size: 15px; }
  .cx-bubble { font-size: 15px; }
  .cx-hello { padding: 4vh 0 8px; }
  .cx-gate { margin-top: 2vh; padding: 20px 16px; }
  .cx-gate-mascot { width: 132px; height: 132px; }
  .cx-gate-mascot img { width: 120px; height: 120px; }
  .cx-card { padding: 16px; border-radius: 18px; }
  .cx-actions .cx-btn { flex: 1 1 auto; }
  .cx-fine { display: none; }
  #cx-model { display: none; }
}
@media (max-width: 420px) {
  .cx-wallet { min-width: 40px; max-width: 120px; padding: 0 10px; }
  .cx-wallet .addr { font-size: 12px; }
  .cx-hint { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cx-hint code { white-space: nowrap; }
}
@media (max-width: 480px) {
  .cx-wallet .addr, .cx-wallet .wl { display: none; }
  .cx-wallet { padding: 0; width: 40px; justify-content: center; }
  .cx-top { gap: 4px; }
}
@media (max-width: 360px) {
  .cx-model-chip { padding: 4px 8px; font-size: 11px; }
  .cx-avatar { width: 36px; height: 36px; }
  .cx-top .cx-icon { width: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-sheet, .cx-drawer, .cx-scrim { transition: none; }
  .cx-typing i, .cx-step.is-run .cx-step-ic svg, .cx-tx-n { animation: none !important; }
}

/* phones: every control at least 40px tall (orbio.chat QA) */
@media (max-width: 767px) {
  .cx-model-chip, .cx-tool, #cx-sound { min-height: 40px; }
}
