.messages-container {
  flex: 1; padding: 24px 40px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  justify-content: flex-end; min-height: 0;
}
.messages-container::before { content: ''; flex: 1; }

.message-row {
  display: flex; align-items: flex-end; gap: 12px; max-width: 65%;
  /* Пружинная анимация появления */
  animation: springUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes springUp {
  0% { opacity: 0; transform: translateY(30px) scale(0.9); }
  70% { opacity: 1; transform: translateY(-5px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.message-row.incoming { align-self: flex-start; }
.message-row.outgoing { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; font-weight: 700; color: #fff; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bubble {
  padding: 12px 18px; border-radius: 20px; background: var(--msg-in);
  font-size: 15px; line-height: 1.5; position: relative;
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  color: #e1e9f1; word-break: break-word;
}
.outgoing .bubble { background: var(--msg-out); border: none; border-bottom-right-radius: 6px; color: #fff; box-shadow: 0 4px 20px rgba(0, 114, 255, 0.3); }
.incoming .bubble { border-bottom-left-radius: 6px; }

.bubble .time { font-size: 11px; color: rgba(255,255,255,0.5); float: right; margin: 8px 0 -2px 12px; font-weight: 500; }
.outgoing .bubble .time { color: rgba(255,255,255,0.8); }