* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body {
  background: #0b141a;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
.phone {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-vh, 100dvh);
  background: #efeae2;
  background-image:
    radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px;
  background-position: 0 0, 11px 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.chat-header {
  background: #075e54;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.chat-header img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.chat-header .title { font-weight: 600; font-size: 16px; line-height: 1.2; }
.chat-header .subtitle { font-size: 12px; opacity: 0.85; line-height: 1.2; margin-top: 2px; }

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px calc(40px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.bubble {
  max-width: 78%;
  padding: 8px 10px 6px 10px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.bubble.bot { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.bubble.user { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 0; }
.bubble .time { display: block; font-size: 10px; color: #667781; text-align: right; margin-top: 2px; }

.typing {
  align-self: flex-start;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  border-top-left-radius: 0;
  display: inline-flex;
  gap: 4px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9aa0a6;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Choice bubble: pergunta + botões dentro do mesmo card (estilo WA) */
.bubble.choice {
  align-self: flex-start;
  background: #fff;
  border-top-left-radius: 0;
  border-radius: 8px;
  max-width: 88%;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  animation: pop 0.18s ease-out;
}
.bubble.choice .text {
  padding: 8px 10px 6px;
  font-size: 14.5px;
  line-height: 1.4;
  color: #303235;
  white-space: pre-wrap;
}
.bubble.choice .text .time {
  display: block;
  font-size: 10px;
  color: #667781;
  text-align: right;
  margin-top: 2px;
}
.bubble.choice .inline-actions {
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
}
.bubble.choice .inline-actions button {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: transparent;
  color: #00a884;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s;
}
.bubble.choice .inline-actions button:last-child { border-bottom: none; }
.bubble.choice .inline-actions button:hover { background: rgba(0,168,132,0.06); }
.bubble.choice .inline-actions button:active { background: rgba(0,168,132,0.12); }
.bubble.choice .inline-actions button.primary { color: #075e54; font-weight: 600; }

.bubble.choice .inline-actions.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.bubble.choice .inline-actions.grid button {
  border-right: 1px solid rgba(0,0,0,0.08);
}
.bubble.choice .inline-actions.grid button:nth-child(2n) { border-right: none; }
.bubble.choice .inline-actions.grid button.full {
  grid-column: 1 / -1;
  border-right: none;
}
