:root{
  --bg:#050508;
  --panel:#0f0f12;
  --panel2:#0b0b0c;
  --fg:#e9e9ff;
  --muted:#b7b7c9;
  --stroke: rgba(255,255,255,.10);
  --stroke2: rgba(255,255,255,.16);
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --radius: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 70% 20%, rgba(147,76,255,.14), transparent 60%),
    radial-gradient(900px 520px at 30% 40%, rgba(55,181,255,.12), transparent 55%),
    radial-gradient(800px 520px at 50% 70%, rgba(255,79,179,.10), transparent 55%),
    var(--bg);
  color:var(--fg);
}

.app{
  height:100%;
  display:flex;
  flex-direction:column;
  padding:14px;
  gap:12px;
}

.top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border:1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(12,12,15,.55);
  box-shadow: var(--shadow);
}


.model-wrapper{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:4px;
}

.model-note{
  font-size:11px;
  color:var(--muted);
  opacity:.75;
  line-height:1.2;
  max-width:260px;
  text-align:right;
}
.brand-title{font-weight:900; letter-spacing:2px; font-size:13px; opacity:.92}
.brand-sub{font-size:12px; color:var(--muted)}
.top-actions{display:flex; gap:8px; align-items:center}

.icon-btn{
  appearance:none;
  border:1px solid var(--stroke);
  background: rgba(10,10,12,.75);
  color:var(--fg);
  border-radius:999px;
  padding:10px 12px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.icon-btn:hover{background: rgba(20,20,24,.85); border-color: var(--stroke2); transform: translateY(-1px)}

.messages{
  flex:1;
  overflow:auto;
  padding:12px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: rgba(10,10,12,.55);
  box-shadow: var(--shadow);
}

.bubble{
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 8px 0;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,.09);
}

.bubble.user{
  background:#1a1f2b;
  margin-right:auto;
  border-color:#2a2f44;
}

.bubble.assistant{
  background:#141414;
  margin-left:auto;
  border-color:#2a2a2a;
}

.bubble-img{
  display:block;
  width: 280px;
  max-width:100%;
  max-height: 280px;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  margin-top: 8px;
  border:1px solid rgba(255,255,255,.14);
}

.image-preview{
  padding:10px 12px;
  border:1px dashed rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  color: var(--muted);
}

.composer{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

.input{
  flex:1;
  background: rgba(11,11,12,.8);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--fg);
  padding: 10px 12px;
  resize:none;
  outline:none;
  font-family:inherit;
  box-shadow: var(--shadow);
}

.send{
  appearance:none;
  border: 1px solid var(--stroke);
  background: rgba(10,10,12,.85);
  color: var(--fg);
  border-radius: 999px;
  padding: 10px 14px;
  cursor:pointer;
  font-weight:700;
  box-shadow: var(--shadow);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.send:hover{background: rgba(20,20,24,.92); border-color: var(--stroke2); transform: translateY(-1px)}

.hidden{display:none !important}

@media (max-width: 520px){
  .app{padding:10px}
  .bubble{max-width: 92%}
}


.image-preview{
  display:flex;
  align-items:center;
  gap:10px;
  position:relative;
}

.preview-thumb{
  width:64px;
  height:64px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.18);
}

.preview-meta{
  font-size:12px;
  color: var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 70%;
}

.preview-remove{
  margin-inline-start:auto;
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.06);
  color: var(--fg);
  cursor:pointer;
}

.preview-remove:hover{
  background: rgba(255,255,255,.10);
}


/* Links */
.bubble .link{color:#1d9bf0;text-decoration:underline;opacity:1}
.bubble .link:hover{opacity:1}

/* Code blocks + copy */
.codeblock{margin:.55rem 0;border:1px solid var(--stroke);border-radius:12px;overflow:hidden;background:rgba(255,255,255,.03)}
.codebar{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.45rem .6rem;border-bottom:1px solid var(--stroke);background:rgba(0,0,0,.18)}
.codelang{font-size:.78rem;opacity:.85}
.copy-btn{border:1px solid var(--stroke2);background:transparent;color:var(--fg);border-radius:10px;padding:.25rem .55rem;cursor:pointer}
.copy-btn:hover{border-color:rgba(255,255,255,.35)}
.codeblock pre{margin:0;padding:.65rem .75rem;overflow:auto}
.codeblock code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:.9rem;line-height:1.45;white-space:pre}
.inline-code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background:rgba(255,255,255,.08);border:1px solid var(--stroke);border-radius:8px;padding:.05rem .35rem}

/* Pending assistant */
.bubble.assistant.pending{opacity:.85;filter:saturate(.85)}
.bubble.assistant.pending .bubble-text{letter-spacing:.08em}

/* Modal */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.55);padding:18px;z-index:999}
.modal.hidden{display:none}
.modal-card{width:min(380px, 92vw);background:var(--panel);border:1px solid var(--stroke);border-radius:18px;box-shadow:var(--shadow);padding:16px}
.modal-title{font-weight:700;font-size:1.05rem;margin-bottom:6px}
.modal-text{opacity:.9;margin-bottom:12px;line-height:1.5}
.modal-actions{display:flex;gap:10px;justify-content:flex-start}
.btn{border:1px solid var(--stroke2);background:transparent;color:var(--fg);border-radius:12px;padding:.5rem .9rem;cursor:pointer}
.btn:hover{border-color:rgba(255,255,255,.35)}
.btn.danger{border-color:rgba(255,90,90,.55)}
.btn.danger:hover{border-color:rgba(255,90,90,.85)}
.btn.ghost{opacity:.9}
body.modal-open{overflow:hidden}

/* Preview thumb cleanup (no filename) */
.image-preview .preview-meta{display:none}


/* Model button (small) */
.model-btn{padding:8px 10px;font-size:12px;min-width:44px}
