* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #d1d7db;
  color: #111b21;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cg fill='%23000' fill-opacity='.035'%3E%3Ccircle cx='6' cy='6' r='2'/%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3Cpath d='M30 4h6v2h-6zM4 30h2v6H4z'/%3E%3C/g%3E%3C/svg%3E");
  box-shadow: 0 0 24px rgba(0, 0, 0, .12);
}

/* ---------- Topo ---------- */
.topo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: #008069;
  color: #fff;
  flex-shrink: 0;
}
.topo-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fff; }
.topo-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.topo-info strong { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status { font-size: 13px; opacity: .85; }

/* ---------- Conversa ---------- */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 28px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 3px;
  scroll-behavior: smooth;
}

.linha { display: flex; align-items: flex-start; gap: 6px; animation: surgir .2s ease-out; }
.linha.primeira { margin-top: 10px; }
.linha.user { justify-content: flex-end; }

.av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; visibility: hidden; background: #fff; }
.primeira .av { visibility: visible; }

.bolha {
  max-width: min(80%, 420px);
  padding: 6px 8px 8px 9px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.bot .bolha { background: #fff; }
.user .bolha { background: #d9fdd3; }
.primeira.bot .bolha { border-top-left-radius: 0; }
.primeira.user .bolha { border-top-right-radius: 0; }

.hora {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 8px 0 -5px 10px;
  font-size: 11px;
  color: #667781;
}
.ticks { color: #53bdeb; display: inline-flex; }

/* Digitando */
.dots { display: inline-flex; gap: 4px; padding: 6px 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: pulo 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

/* ---------- Opções ---------- */
.opcoes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 14px 0 4px 34px;
  animation: surgir .25s ease-out;
}
.opcoes button {
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 18px;
  background: #fff;
  color: #008069;
  border: 1px solid #00a884;
  border-radius: 22px;
  cursor: pointer;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  transition: background .15s, color .15s, transform .1s;
}
.opcoes button:hover { background: #00a884; color: #fff; }
.opcoes button:active { transform: scale(.97); }
.opcoes button:focus-visible { outline: 2px solid #008069; outline-offset: 2px; }

.cta {
  align-self: center;
  margin-top: 16px;
  padding: 14px 22px;
  background: #00a884;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  animation: surgir .25s ease-out;
}

@keyframes surgir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulo { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
