:root {
  --bg: #14122b; --bg2: #1d1a3d; --card: #262252; --me: #c9a24b; --me-text: #1b1630;
  --text: #f3effc; --muted: #b6aed6; --line: #3a3470; --accent: #e5c56f;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 60% at 50% 0%, #2a2560 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; height: 100dvh;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; border-bottom: 1px solid var(--line);
  background: rgba(20, 18, 43, .85); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.moon { font-size: 28px; }
h1 { font: 600 18px/1.2 Georgia, "Times New Roman", serif; margin: 0; color: var(--accent); }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
#chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 88%; padding: 12px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; animation: in .2s ease-out; }
.bot { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; }
.me { align-self: flex-end; background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; }
.err { align-self: flex-start; background: #4a2236; color: #ffd9e4; }
.status { align-self: flex-start; color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; padding: 4px 6px; }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--accent); animation: b 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  border-top: 1px solid var(--line); background: var(--bg2);
}
textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; outline: none;
}
textarea:focus { border-color: var(--accent); }
#enviar { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--me-text); display: grid; place-items: center; }
#enviar:disabled { opacity: .45; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes b { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
