:root{--bg:#0f1117;--panel:#161922;--panel-2:#1e2230;--border:#2a2f3e;--text:#e6e8ef;--muted:#8b91a5;--accent:#7c5cff;--accent-2:#22d3ee;--user:#2b3145;--radius:14px}*{box-sizing:border-box}html,body{overscroll-behavior:none;background:var(--bg);height:100%;color:var(--text);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:15px;line-height:1.6;overflow:hidden}button{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none}button:disabled{cursor:not-allowed;opacity:.5}.muted{color:var(--muted);padding:0 .5rem;font-size:.9rem}.logo{object-fit:cover;border-radius:50%;flex-shrink:0;width:40px;height:40px;display:block}.logo.small{width:32px;height:32px}.logo.large{width:88px;height:88px}.icon-btn{width:28px;height:28px;color:var(--muted);border-radius:6px;place-items:center;font-size:1.1rem;display:grid}.icon-btn:hover{background:var(--panel-2);color:var(--text)}.login{flex-direction:column;justify-content:center;align-items:center;gap:1rem;height:100%;padding:1rem;display:flex}.login-card{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);flex-direction:column;align-items:center;gap:.75rem;width:100%;max-width:340px;padding:2rem;display:flex}.login-card h1{margin:0;font-size:1.5rem}.login-card p{color:var(--muted);margin:0 0 .5rem}.login-card input{border:1px solid var(--border);background:var(--bg);width:100%;color:var(--text);font:inherit;border-radius:10px;outline:none;padding:.7rem .9rem}.login-card input:focus{border-color:var(--accent)}.login-card button{background:var(--accent);color:#fff;border-radius:10px;width:100%;padding:.7rem;font-weight:600}.error{color:#f87171;font-size:.9rem}.app{height:100dvh;display:flex;overflow:hidden}.sidebar{background:var(--panel);border-right:1px solid var(--border);flex-direction:column;flex-shrink:0;width:270px;display:flex}.sidebar-header{flex-direction:column;gap:.75rem;padding:1rem;display:flex}.brand{align-items:center;gap:.6rem;font-size:1.05rem;font-weight:700;display:flex}.new-chat{border:1px solid var(--border);text-align:left;border-radius:10px;padding:.6rem}.new-chat:hover:not(:disabled){background:var(--panel-2)}.chat-list{flex:1;padding:0 .5rem;overflow-y:auto}.chat-item{border-radius:8px;align-items:center;display:flex}.chat-item:hover,.chat-item.active{background:var(--panel-2)}.chat-item .icon-btn{visibility:hidden;margin-right:.25rem}.chat-item:hover .icon-btn,.chat-item.active .icon-btn{visibility:visible}.chat-title{text-align:left;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;padding:.5rem .6rem;font-size:.92rem;overflow:hidden}.sidebar-footer{border-top:1px solid var(--border);flex-direction:column;gap:.25rem;padding:.75rem;display:flex}.footer-btn{text-align:left;border-radius:8px;padding:.5rem .6rem;font-size:.92rem}.footer-btn:hover{background:var(--panel-2)}.main{flex-direction:column;flex:1;min-width:0;display:flex}.topbar{border-bottom:1px solid var(--border);align-items:center;gap:.5rem;padding:.75rem 1rem;display:flex}.topbar .menu{display:none}.topbar-new{margin-left:auto;display:none}.topbar-title{white-space:nowrap;text-overflow:ellipsis;font-weight:600;overflow:hidden}.messages{flex:1;overflow-y:auto}.empty{text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:.5rem;min-height:100%;padding:2rem 1rem;display:flex}.empty h1{margin:.75rem 0 0;font-size:1.8rem}.empty p{color:var(--muted);margin:0}.suggestions{grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem;width:100%;max-width:560px;margin-top:1.5rem;display:grid}.suggestions button{border:1px solid var(--border);background:var(--panel);text-align:left;border-radius:12px;padding:.8rem 1rem;font-size:.92rem}.suggestions button:hover{background:var(--panel-2)}.thread{flex-direction:column;gap:1.25rem;max-width:780px;margin:0 auto;padding:1.5rem 1rem;display:flex}.message{gap:.75rem;display:flex}.message.user{justify-content:flex-end}.message.user .bubble{background:var(--user);white-space:pre-wrap;word-wrap:break-word;border-radius:18px;max-width:80%;padding:.6rem 1rem}.message.assistant .bubble{flex:1;min-width:0;padding-top:.15rem}.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}.bubble pre{border:1px solid var(--border);background:#0a0c11;border-radius:10px;padding:.9rem;overflow-x:auto}.bubble code{font-family:ui-monospace,Cascadia Code,Consolas,monospace;font-size:.88em}.bubble :not(pre)>code{background:var(--panel-2);border-radius:5px;padding:.1rem .35rem}.bubble a{color:var(--accent-2)}.bubble table{border-collapse:collapse;display:block;overflow-x:auto}.bubble th,.bubble td{border:1px solid var(--border);padding:.4rem .7rem}.bubble blockquote{border-left:3px solid var(--border);color:var(--muted);margin:0;padding-left:1rem}.typing{gap:4px;padding:.5rem 0;display:inline-flex}.typing i{background:var(--muted);border-radius:50%;width:7px;height:7px;animation:1.2s ease-in-out infinite blink}.typing i:nth-child(2){animation-delay:.2s}.typing i:nth-child(3){animation-delay:.4s}@keyframes blink{0%,80%,to{opacity:.25}40%{opacity:1}}.composer{border:1px solid var(--border);background:var(--panel);border-radius:22px;align-items:flex-end;gap:.5rem;width:calc(100% - 2rem);max-width:780px;margin:.75rem auto 0;padding:.6rem .6rem .6rem 1rem;display:flex}.composer:focus-within{border-color:var(--accent)}.composer textarea{resize:none;color:var(--text);font:inherit;background:0 0;border:none;outline:none;flex:1;max-height:200px;padding:.35rem 0}.send{background:var(--accent);color:#fff;border-radius:50%;flex-shrink:0;place-items:center;width:36px;height:36px;font-size:1.1rem;font-weight:700;display:grid}.send.stop{background:var(--text);color:var(--bg);font-size:.8rem}.disclaimer{text-align:center;color:var(--muted);margin:.4rem 0 .75rem;font-size:.75rem}.copyright{color:var(--muted);text-align:center;margin:0;font-size:.75rem}.disclaimer .copyright:before{content:" · "}@media (max-width:768px){.disclaimer .copyright{display:block}.disclaimer .copyright:before{content:none}}.modal-backdrop{z-index:30;background:#0009;place-items:center;padding:1rem;display:grid;position:fixed;inset:0}.modal{border-radius:var(--radius);border:1px solid var(--border);background:var(--panel);width:100%;max-width:520px;max-height:80vh;padding:1.25rem;overflow-y:auto}.modal-header{justify-content:space-between;align-items:center;margin-bottom:.75rem;display:flex}.modal-header h2{margin:0;font-size:1.15rem}.memory-list{flex-direction:column;gap:.4rem;margin:0;padding:0;list-style:none;display:flex}.memory-list li{background:var(--panel-2);border-radius:10px;justify-content:space-between;align-items:flex-start;gap:.5rem;padding:.6rem .75rem;font-size:.92rem;display:flex}.backdrop{display:none}@media (max-width:768px){html,body,.composer textarea,.login-card input{font-size:16px}.topbar{padding:calc(.4rem + env(safe-area-inset-top)) .5rem .4rem}.topbar .icon-btn{border-radius:10px;width:42px;height:42px}.topbar-title{text-align:center;flex:1;font-size:1rem}.topbar-new{display:grid}.sidebar{z-index:20;width:min(85vw,320px);padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);transition:transform .22s;position:fixed;inset:0 auto 0 0;transform:translate(-100%);box-shadow:8px 0 24px #0006}.sidebar.open{transform:translate(0)}.sidebar-header{padding:1rem .85rem .75rem}.new-chat,.footer-btn,.chat-title{padding:.75rem .85rem;font-size:1rem}.chat-item .icon-btn{visibility:visible;width:36px;height:36px}.backdrop{z-index:10;background:#0000008c;display:block;position:fixed;inset:0}.topbar .menu{display:grid}.thread{padding:1rem .85rem}.message.user .bubble{max-width:88%}.empty h1{font-size:1.6rem}.suggestions{grid-template-columns:1fr}.suggestions button{padding:.9rem 1rem;font-size:1rem}.composer{width:calc(100% - 1.25rem);margin-top:.5rem}.send{width:40px;height:40px}.disclaimer{margin-bottom:calc(.5rem + env(safe-area-inset-bottom))}}
