*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{display:flex;flex-direction:column;background:#0b0d10;color:#e6e8eb;font:15px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #1d2127;padding-top:max(12px,env(safe-area-inset-top))}
.brand{font-weight:600;font-size:16px}
.logo{color:#9ab4ff}.logo.big{font-size:40px}
button{font:inherit;cursor:pointer}
#newChat{background:#181c22;color:#e6e8eb;border:1px solid #2a2f37;border-radius:8px;padding:6px 12px}
#newChat:hover{background:#20252c}
main{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:14px;max-width:820px;width:100%;margin:0 auto}
.empty{margin:auto;text-align:center;color:#8a929c}
.msg{max-width:88%;padding:10px 14px;border-radius:14px;white-space:normal;word-wrap:break-word;overflow-wrap:anywhere}
.msg.user{align-self:flex-end;background:#2b4a8b;color:#fff;border-bottom-right-radius:4px;white-space:pre-wrap}
.msg.assistant{align-self:flex-start;background:#151920;border:1px solid #1f242b;border-bottom-left-radius:4px}
.msg.error{align-self:center;background:#3a1518;border:1px solid #6b2a30;color:#ffb4b9;font-size:14px}
.msg p{margin:0 0 .6em}.msg p:last-child{margin-bottom:0}
.msg pre{background:#0a0c0f;border:1px solid #232830;border-radius:8px;padding:20px 10px 10px;overflow-x:auto;margin:.5em 0;position:relative}
.msg pre code{font:13px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:pre}
.msg code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.92em;background:#0a0c0f;padding:1px 5px;border-radius:4px}
.msg pre code{background:none;padding:0}
.msg .lang{position:absolute;top:4px;right:8px;font-size:11px;color:#6b737d}
.msg ul,.msg ol{margin:.3em 0 .6em;padding-left:1.4em}
.msg h1,.msg h2,.msg h3{font-size:1.05em;margin:.6em 0 .3em}
.msg a{color:#9ab4ff}
.cursor::after{content:"▍";animation:blink 1s steps(1) infinite;color:#9ab4ff}
@keyframes blink{50%{opacity:0}}
form{display:flex;gap:8px;padding:12px 16px;border-top:1px solid #1d2127;max-width:820px;width:100%;margin:0 auto;padding-bottom:max(12px,env(safe-area-inset-bottom))}
textarea{flex:1;resize:none;background:#151920;color:#e6e8eb;border:1px solid #2a2f37;border-radius:12px;padding:10px 12px;font:inherit;font-size:16px;max-height:200px;outline:none}
textarea:focus{border-color:#4a6fc1}
#send{width:44px;border:0;border-radius:12px;background:#4a6fc1;color:#fff;font-size:18px}
#send:disabled{opacity:.45;cursor:default}
