:root{
  --bg:#000; --fg:#f4f4f5; --dim:#8a8a92; --line:#1c1c1f;
  --bubble:#1a1a1d; --field:#111113; --field-line:#26262a;
  --accent:#fff; --radius:26px;
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-t:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--fg);
  font:16px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased; display:flex; flex-direction:column;
  padding-top:var(--safe-t);
}
.bar{display:flex;align-items:center;gap:8px;padding:10px 14px;height:52px;flex:0 0 auto}
.title{font:inherit;font-weight:600;letter-spacing:-.01em;background:none;border:0;color:var(--fg);cursor:pointer;padding:4px 2px}
.title:active{opacity:.7}
.spacer{flex:1}
.icon-btn{width:36px;height:36px;border:0;border-radius:50%;background:transparent;color:var(--dim);display:grid;place-items:center;cursor:pointer}
.icon-btn:hover{background:#141417;color:var(--fg)}

.stream{flex:1 1 auto;overflow-y:auto;padding:8px 16px 12px;scroll-behavior:smooth}
.stream:empty{display:none}

.hero{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:0 24px 12vh}
.hero[hidden]{display:none}
.orb{filter:drop-shadow(0 18px 48px rgba(0,0,0,.65))}
.wordmark{margin:14px 0 0;font-size:clamp(24px,6.6vw,32px);font-weight:600;letter-spacing:-.025em;white-space:nowrap}
.lede{margin:2px 0 0;color:var(--dim);font-size:15px}
.sub{margin:10px 0 0;color:#55555c;font-size:12.5px;letter-spacing:.02em}

.msg{max-width:720px;margin:0 auto;padding:14px 0;display:flex;gap:12px}
.msg .body{white-space:pre-wrap;word-break:break-word;line-height:1.7}
.msg.user{justify-content:flex-end}
.msg.user .body{background:var(--bubble);padding:10px 14px;border-radius:18px;max-width:78%}
.msg.bot .body{padding-top:2px}
.msg.bot .dot{flex:0 0 26px;width:26px;height:26px;margin-top:2px}
.msg.bot .dot img{display:block;width:26px;height:26px}
.msg.err .body{color:#fca5a5}
.msg .body code{background:#17171a;padding:1px 5px;border-radius:5px;font-size:.92em}
.msg .body pre{background:#101012;border:1px solid var(--line);padding:12px;border-radius:12px;overflow:auto;white-space:pre}
.msg .body pre code{background:none;padding:0}
.msg .body a{color:#d4d4d8;text-decoration:underline}

.composer{flex:0 0 auto;padding:6px 14px calc(12px + var(--safe-b));max-width:860px;width:100%;margin:0 auto}
.field{display:flex;align-items:flex-end;gap:8px;background:var(--field);border:1px solid var(--field-line);border-radius:var(--radius);padding:8px 8px 8px 18px}
.field:focus-within{border-color:#3a3a40}
textarea{
  flex:1;resize:none;border:0;outline:0;background:transparent;color:var(--fg);
  font:inherit;line-height:1.5;max-height:180px;padding:8px 0;
}
textarea::placeholder{color:#6b6b73}
.send{flex:0 0 36px;width:36px;height:36px;border:0;border-radius:50%;background:var(--accent);color:#000;display:grid;place-items:center;cursor:pointer}
.send:disabled{opacity:.35;cursor:default}
.send.stop{background:#2a2a2e;color:#fff}
.hint{text-align:center;color:#5a5a61;font-size:12px;padding:8px 0 0}
@media (max-width:520px){.hint{display:none}.orb{width:84px;height:84px}.orb img{display:block;width:96px;height:96px}}

.pill{font-size:11.5px;color:#6b6b73;border:1px solid #232329;border-radius:999px;padding:3px 9px;letter-spacing:.02em;white-space:nowrap}
.pill.on{color:#9ae6b4;border-color:#1f3a2b}
.pill.off{color:#8a8a92}
.sysline{max-width:720px;margin:0 auto;color:#6b6b73;font-size:12.5px;padding:2px 0 10px 38px}
.tool{color:#7c7c88;font-size:12.5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;padding:3px 0;white-space:pre-wrap;word-break:break-all;border-left:1px solid #26262a;padding-left:10px;margin:4px 0}
.err{color:#fca5a5}
.sheet{position:fixed;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(8px);display:flex;align-items:flex-end;justify-content:center;z-index:40}
.sheet-inner{width:100%;max-width:520px;background:#0e0e11;border:1px solid #1e1e23;border-radius:22px 22px 0 0;padding:14px 14px calc(20px + var(--safe-b));display:flex;flex-direction:column;gap:6px;max-height:70vh;overflow:auto}
.sheet-head{color:#6b6b73;font-size:12px;padding:4px 8px 8px}
.sheet-item{text-align:left;background:#141418;border:1px solid #1e1e23;color:var(--fg);border-radius:14px;padding:12px 14px;font:inherit;cursor:pointer}
.sheet-item.active{border-color:#3a3a44}
.sheet-item:active{opacity:.8}

.tools{margin:2px 0 6px;display:flex;flex-direction:column;gap:2px}
.tools .tool:last-child{margin-bottom:2px}
.tool.ok{color:#4b5563;border-left-color:#1b1b20}

.msg .col{flex:1 1 auto;min-width:0}
.msg .body .h3,.msg .body .h4,.msg .body .h5{font-weight:600;margin:10px 0 4px;letter-spacing:-.01em}
.msg .body .h3{font-size:1.06em}
.msg .body .li{padding-left:2px;margin:2px 0}
.msg .body table{border-collapse:collapse;margin:8px 0;font-size:.94em;width:auto;max-width:100%;display:block;overflow-x:auto}
.msg .body th,.msg .body td{border:1px solid #23232a;padding:5px 10px;text-align:left;white-space:nowrap}
.msg .body th{background:#131316;font-weight:600}

.tool.git{color:#7f8ea3;border-left-color:#243040}

.clip{flex:0 0 32px;width:32px;height:32px;border:0;background:transparent;color:#71717a;display:grid;place-items:center;cursor:pointer;border-radius:50%;margin-bottom:2px}
.clip:active{color:#fff;background:#1c1c20}
.chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 6px 8px}
.chip{display:flex;align-items:center;gap:6px;background:#15151a;border:1px solid #24242b;border-radius:999px;padding:5px 8px 5px 12px;font-size:12.5px;color:#c8c8d0;max-width:100%}
.chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip-x{background:none;border:0;color:#6b6b73;font-size:15px;line-height:1;cursor:pointer;padding:0 2px}
.chip-x:active{color:#fff}
.tool.branch{color:#8b9bb4}
