.chat-anim {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 16px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Fade out messages as they reach the top */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 28%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 28%);
}

/* ── Wrapper — handles height expansion and alignment ── */
.chat-bubble-wrap {
  display: grid;
  grid-template-rows: 0fr;
  max-width: 78%;
  animation: expandRow 0.5s cubic-bezier(0.25, 0, 0, 1) forwards;
}

.chat-bubble-wrap--agent { align-self: flex-end; }
.chat-bubble-wrap--user  { align-self: flex-start; }

/* ── Inner — required for the grid 0fr trick ── */
.chat-bubble-inner {
  overflow: hidden;
  min-height: 0;
  padding-bottom: 8px;
}

/* ── Bubble ── */
.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 14px;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: bubbleReveal 0.3s cubic-bezier(0.25, 0, 0, 1) both;
}

.chat-bubble--agent {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.chat-bubble--user {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* ── Header row (avatar + name) ── */
.chat-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Avatars ── */
.chat-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar--agent {
  background: rgba(255, 255, 255, 0.18);
}

.chat-avatar--user {
  background: rgba(255, 255, 255, 0.35);
  color: white;
  font-size: 9px;
  font-weight: 600;
}

/* ── Sender name ── */
.chat-bubble-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* ── Message text ── */
.chat-bubble-text {
  font-size: 13px;
  line-height: 1.5;
  color: white;
  margin: 0;
}

/* ── Animations ── */
@keyframes expandRow {
  from { grid-template-rows: 0fr; }
  to   { grid-template-rows: 1fr; }
}

@keyframes bubbleReveal {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

