:root {
  --bg: #ffffff;
  --host-bubble-bg: #f7f8ff;
  --host-bubble-text: #303235;
  --accent: #0042da;          /* cor dos botões / respostas */
  --accent-text: #ffffff;
  --avatar-size: 40px;
  --max-width: 400px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--host-bubble-text);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* Container central — full screen no celular, coluna estreita no desktop */
.chat {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ---- Linha de mensagem do bot (avatar + bolha) ---- */
.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
  animation: fadeUp 0.35s ease;
}

.row.host {
  justify-content: flex-start;
}

.row.guest {
  justify-content: flex-end;
}

.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  min-width: var(--avatar-size);
  border-radius: 50%;
  object-fit: cover;
  background: var(--host-bubble-bg);
}

/* placeholder pra alinhar bolhas seguidas sem repetir avatar */
.avatar.spacer {
  visibility: hidden;
}

.bubble {
  max-width: 80%;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.45;
  border-radius: 6px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.row.host .bubble {
  background: var(--host-bubble-bg);
  color: var(--host-bubble-text);
  border-bottom-left-radius: 2px;
}

.row.guest .bubble {
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 2px;
}

.bubble strong {
  font-weight: 700;
}

/* ---- Imagens ---- */
.row .bubble.image {
  padding: 0;
  background: transparent;
  overflow: hidden;
  border-radius: 8px;
}

.row .bubble.image img {
  display: block;
  width: 100%;
  max-width: 280px;
  border-radius: 8px;
}

/* ---- Indicador de digitando ---- */
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 16px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9a9ca3;
  animation: blink 1.3s infinite ease-in-out both;
}

.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ---- Área de botões / input ---- */
.input-area {
  padding: 8px 16px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.choice-btn {
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease;
  max-width: 100%;
  animation: fadeUp 0.3s ease;
}

.choice-btn:hover {
  opacity: 0.9;
}

.choice-btn:active {
  transform: scale(0.97);
}

/* ---- Animações ---- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scrollbar discreta */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}
