:root{--bg:#000000;--panel:#0a0a0a;--panel2:#111111;--border:#1a1a1a;--text:#f0ebe0;--muted:#8a8a7a;--accent:#3a9a78;--accent2:#1a1a1a;--gold:#d4af37;--user:#141414;--danger:#e5484d;--code:#050505}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--text);font:15px/1.6 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans","Noto Naskh Arabic",sans-serif}
button{font:inherit;cursor:pointer}
#app{display:flex;height:100vh;height:100dvh}
#sidebar{width:270px;flex-shrink:0;background:var(--panel);border-right:1px solid var(--border);display:flex;flex-direction:column;padding:14px}
.brand{display:flex;gap:10px;align-items:center;margin:4px 4px 16px}
.logo{width:38px;height:38px;border-radius:10px;background:var(--accent2);display:grid;place-items:center;font-size:22px}
.title{font-weight:700;font-size:17px}.subtitle{color:var(--muted);font-size:12px}
.btn-new{background:var(--panel2);color:var(--text);border:1px solid var(--border);border-radius:10px;padding:10px;text-align:left}
.btn-new:hover{border-color:var(--accent)}
.hist-label{color:var(--muted);font-size:12px;margin:18px 6px 6px}
#history{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:2px}
.h-item{display:flex;align-items:center;border-radius:8px;padding:8px 10px;color:var(--text);background:none;border:0;text-align:left;width:100%}
.h-item:hover{background:var(--panel2)}.h-item.active{background:#22312c}
.h-item .t{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.h-item .del{opacity:0;color:var(--muted);padding:0 4px;background:none;border:0}
.h-item:hover .del{opacity:1}.h-item .del:hover{color:var(--danger)}
.side-foot{color:var(--muted);font-size:11px;padding:8px 6px 0}
#main{flex:1;display:flex;flex-direction:column;min-width:0}
#topbar{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--border);min-height:50px}
#menuBtn{display:none;background:none;border:0;color:var(--text);font-size:20px}
#chatTitle{font-weight:600;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#messages{flex:1;overflow-y:auto;padding:24px 16px}
.msg{max-width:820px;margin:0 auto 22px;display:flex;gap:12px}
.msg .av{width:30px;height:30px;border-radius:8px;flex-shrink:0;display:grid;place-items:center;font-size:15px;background:var(--accent2)}
.msg.user{justify-content:flex-end}
.msg.user .body{background:var(--user);border:1px solid #2c3d37;border-radius:14px;padding:10px 14px;max-width:85%;white-space:pre-wrap;word-wrap:break-word}
.msg.bot .body{flex:1;min-width:0;word-wrap:break-word}
.body p{margin:0 0 .7em}.body p:last-child{margin-bottom:0}
.body h1,.body h2,.body h3{margin:.9em 0 .4em;line-height:1.3}.body h1{font-size:1.3em}.body h2{font-size:1.15em}.body h3{font-size:1.05em}
.body ul,.body ol{margin:.3em 0 .8em;padding-left:1.4em}
.body blockquote{margin:.5em 0;padding:.3em 1em;border-left:3px solid var(--accent);color:#c9cdd3;background:#141a18}
.body code{background:var(--code);padding:1px 5px;border-radius:5px;font-size:.9em}
.body pre{background:var(--code);border:1px solid var(--border);padding:12px;border-radius:10px;overflow-x:auto}
.body pre code{padding:0;background:none}
.body a{color:var(--accent)}
.body hr{border:0;border-top:1px solid var(--border)}
.body table{border-collapse:collapse;margin:.5em 0}.body td,.body th{border:1px solid var(--border);padding:4px 8px}
.think{margin-bottom:10px;border:1px solid var(--border);border-radius:10px;background:var(--panel)}
.think summary{cursor:pointer;color:var(--muted);font-size:13px;padding:6px 12px;user-select:none}
.think .tc{color:var(--muted);font-size:13px;white-space:pre-wrap;padding:0 12px 10px;max-height:300px;overflow-y:auto}
.err{color:#ffb4b6;background:#2a1517;border:1px solid #4a2023;border-radius:10px;padding:10px 14px}
.cursor::after{content:"▍";animation:blink 1s steps(1) infinite;color:var(--accent)}
@keyframes blink{50%{opacity:0}}
.typing{color:var(--muted)}
#welcome{max-width:720px;margin:8vh auto 0;text-align:center}
.w-logo{font-size:44px;width:72px;height:72px;margin:0 auto 10px;border-radius:18px;background:var(--accent2);display:grid;place-items:center}
#welcome h1{font-size:26px;margin:.3em 0}#welcome p{color:var(--muted)}
#composer{padding:10px 16px 14px}
#form{max-width:820px;margin:0 auto;display:flex;gap:8px;align-items:flex-end;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:8px}
#form:focus-within{border-color:var(--accent2)}
#input{flex:1;resize:none;background:transparent;border:0;outline:0;color:var(--text);font:inherit;padding:8px;max-height:220px}
#send,#stop{border:0;border-radius:10px;padding:9px 16px;color:#fff;background:var(--accent)}
#send:disabled{opacity:.45;cursor:default}
#stop{background:#3a3f47}
@media (max-width:760px){
  #sidebar{position:fixed;z-index:20;top:0;bottom:0;left:0;transform:translateX(-100%);transition:transform .2s}
  #app.open #sidebar{transform:none}
  #app.open #backdrop{position:fixed;inset:0;background:#0008;z-index:10}
  #menuBtn{display:block}
  #messages{padding:16px 10px}
}

body{background:#000 fixed}
.tawhid{font-family:"Amiri","Noto Naskh Arabic",serif;color:var(--gold);line-height:1.5;text-shadow:0 0 24px rgba(201,164,92,.18);margin:0 auto 4px}
.tawhid .t1{font-size:clamp(40px,9vw,72px);font-weight:700}
.tawhid .t2{font-size:clamp(30px,6.5vw,52px);font-weight:400;margin-top:-6px}
.orn{color:var(--gold);opacity:.6;font-size:22px;margin:6px 0}
.w-sub{letter-spacing:.3em;text-transform:uppercase;color:var(--muted);font-size:12px;margin-bottom:10px}
#welcome{margin-top:5vh}
#welcome h1{font-weight:600}
.tb-tawhid{margin-left:auto;font-family:"Amiri","Noto Naskh Arabic",serif;color:var(--gold);font-size:20px;white-space:nowrap}
.logo{color:var(--gold)}
#send{background:var(--accent2)}#send:hover{background:var(--accent)}
.body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",sans-serif}
.body :lang(ar),.body [dir=rtl]{font-family:"Amiri","Noto Naskh Arabic",serif;font-size:1.2em}
@media (max-width:760px){.tb-tawhid{font-size:16px}#chatTitle{max-width:40vw}}
@media (max-width:380px){.tb-tawhid{display:none}}
.body p,.body li,.body blockquote,.msg.user .body{unicode-bidi:plaintext;text-align:start}

.w-tr{color:var(--muted);font-size:13px;letter-spacing:.12em;text-transform:uppercase;margin:4px 0 0}
.tawhid .t1{font-size:clamp(28px,6.5vw,48px)!important;font-weight:700}
.tawhid .t2{font-size:clamp(24px,5.5vw,40px)!important;margin-top:8px!important}
#welcome{margin-top:8vh!important}
#sidebar{background:#000;border-right-color:#1a1a1a}
#topbar{background:#000;border-bottom-color:#1a1a1a}
#form{background:#0a0a0a;border-color:#222}
.msg.user .body{background:#141414;border-color:#222}
.model-tag{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;color:var(--gold);letter-spacing:0;text-transform:none;opacity:.9}
.subtitle .model-tag{display:inline}
