/* ═══════════════════════════════════════════
   MESSAGES, BUBBLES, INPUT, STREAMING
   ═══════════════════════════════════════════ */
.messages {
  flex: 1; overflow-y: auto; padding-bottom: 32px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

.message-row { padding: 20px 0; animation: fadeUp .3s ease; }
.message-inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }

.msg-user .message-inner { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .bubble {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 18px 18px 4px 18px;
  padding: 12px 18px; max-width: 78%;
  font-size: 14.5px; line-height: 1.65;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}

.msg-ai .message-inner { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.ai-avatar {
  width: 30px; height: 30px;
  background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: #000;
}
.ai-content { flex: 1; font-size: 14.5px; line-height: 1.75; color: var(--text); min-width: 0; }
.ai-content > * { max-width: 100%; }
.ai-content p { margin-bottom: 12px; }
.ai-content p:last-child { margin-bottom: 0; }
.ai-content strong { color: var(--text); font-weight: 600; }

.msg-time {
  width: 100%; font-family: var(--mono); font-size: 10px;
  color: #5f5f5f; margin-top: 6px; padding-left: 44px; letter-spacing: .01em;
}
.msg-user .msg-time { text-align: right; padding-left: 0; padding-right: 0; }

.stream-cursor { color: var(--accent); font-weight: 300; font-size: 16px; animation: cursorBlink .6s infinite; margin-left: 2px; }
.stream-el { animation: streamIn .3s ease forwards; }
@keyframes streamIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 4px 0; }
.typing-dot { width: 7px; height: 7px; background: var(--text-muted); border-radius: 50%; animation: tdot 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes tdot { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-7px);opacity:1} }

.input-area { padding: 12px 24px 18px; flex-shrink: 0; }
.input-box {
  max-width: 760px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border2); border-radius: 14px;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 14px; transition: all .25s;
}
.input-box:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(0,212,170,.06), 0 4px 16px rgba(0,0,0,.2); }
.input-box textarea {
  flex: 1; background: none; border: none; outline: none;
  resize: none; color: var(--text); font-family: var(--font);
  font-size: 14.5px; line-height: 1.5; min-height: 24px; max-height: 160px; overflow-y: auto;
}
.input-box textarea::placeholder { color: var(--text-dim); }
.input-box textarea::-webkit-scrollbar { width: 3px; }
.input-box textarea::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

.send-btn {
  width: 34px; height: 34px; background: var(--accent);
  border: none; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all .2s; flex-shrink: 0; opacity: .3;
}
.send-btn.active { opacity: 1; }
.send-btn.active:hover { background: var(--accent2); transform: scale(1.05); }
.send-btn:disabled { cursor: not-allowed; }
.input-hint { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 8px; max-width: 760px; margin-left: auto; margin-right: auto; }

.ai-content ul { margin: 8px 0 8px 18px; color: var(--text-muted); }
.ai-content ol { margin: 8px 0 8px 18px; color: var(--text-muted); }
.ai-content li { margin-bottom: 4px; font-size: 13.5px; line-height: 1.6; }
.ai-content h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 12px 0 6px; }
.ai-content code { font-family: var(--mono); background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent2); }
.ai-content pre { background: #0a0a0a; border: 1px solid var(--border2); border-radius: 8px; padding: 12px 16px; margin: 8px 0; overflow-x: auto; }
.ai-content pre code { background: none; padding: 0; color: var(--accent2); }
.ai-content a { color: var(--accent); text-decoration: none; }
.ai-content a:hover { text-decoration: underline; }
.ai-badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; background: rgba(0,212,170,.08); color: var(--accent); border: 1px solid var(--accent-border); border-radius: 20px; padding: 2px 8px; margin-bottom: 10px; }
