:root {
  --bg: #090711;
  --panel: rgba(20, 16, 38, 0.92);
  --line: rgba(168, 140, 255, 0.18);
  --line-strong: rgba(168, 140, 255, 0.36);
  --text: #f4f1fb;
  --muted: #9b96b8;
  --bot: #16132a;
  --user: linear-gradient(135deg, #6a3dff 0%, #c44dff 100%);
  --accent: #cbb6ff;
  --accent-soft: rgba(196, 77, 255, 0.16);
  --brand: linear-gradient(145deg, #7b5cff, #e85cad);
  --on-brand: #12081c;
  --field: #100e1e;
  --surface: #100d1c;
  --live: #c4b8ff;
  --strong: #e4d6ff;
  --whatsapp: #25d366;
  --cash: #3ee08a;
  --cash-soft: rgba(62, 224, 138, 0.14);
  --shadow: 0 24px 64px rgba(8, 4, 20, 0.55);
  --app-height: 100dvh;
  --app-offset: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: Outfit, system-ui, sans-serif;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

button, a, input {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.orb-a {
  width: 360px;
  height: 360px;
  background: #6a3dff;
  top: -100px;
  right: -60px;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: #e85cad;
  bottom: -100px;
  left: -60px;
}

.app {
  width: min(460px, 100%);
  min-height: min(820px, calc(100dvh - 48px));
  height: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 20px;
  border-bottom: 1px dashed var(--line-strong);
  flex-shrink: 0;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  z-index: 2;
}

.topbar::before { left: -10px; }
.topbar::after { right: -10px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--on-brand);
  background: var(--brand);
}

.avatar svg { width: 22px; height: 22px; }

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--live);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--whatsapp);
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
}

.chat {
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding: 22px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  animation: rise 0.35s ease;
}

.row.bot { justify-content: flex-start; }
.row.user { justify-content: flex-end; }

.bubble {
  max-width: min(86%, 340px);
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bot .bubble {
  background: var(--bot);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  white-space: normal;
}

.user .bubble {
  background: var(--user);
  color: white;
  border-bottom-right-radius: 6px;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.choice {
  border: 0;
  cursor: pointer;
  color: var(--on-brand);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 20px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(232, 92, 173, 0.5);
  animation: cta-pulse 2.2s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.choice.ghost { animation: none; box-shadow: none; }

.choice.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  font-weight: 600;
}

.typing {
  display: flex;
  gap: 5px;
  padding: 13px 17px;
  width: fit-content;
  background: var(--bot);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1s infinite;
}

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

.composer {
  position: relative;
  padding: 16px 16px 18px;
  border-top: 1px dashed var(--line-strong);
  flex-shrink: 0;
}

.composer::before,
.composer::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  z-index: 2;
}

.composer::before { left: -10px; }
.composer::after { right: -10px; }

form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

#field {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 15px;
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}

#field:focus { border-color: var(--accent); }

button[type="submit"] {
  width: 48px;
  min-width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: 0;
  border-radius: 16px;
  background: var(--user);
  color: white;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: filter 0.15s ease;
}

button[type="submit"] svg { width: 20px; height: 20px; }

.hint {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
}

.wa {
  display: block;
  margin-top: 12px;
  text-align: center;
  text-decoration: none;
  color: #062813;
  font-weight: 700;
  background: var(--whatsapp);
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.35);
  padding: 14px 14px;
  min-height: 48px;
  border-radius: 14px;
  transition: filter 0.15s ease, transform 0.15s ease;
  overflow-wrap: anywhere;
}

.headline {
  font-family: "Instrument Serif", serif;
  font-size: clamp(19px, 5.4vw, 23px);
  line-height: 1.2;
  margin-bottom: 11px;
  color: var(--accent);
}

.bubble strong { color: var(--strong); font-weight: 700; }

.steps {
  margin: 0;
  padding-left: 19px;
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
}

.steps li::marker { color: var(--accent); }

.example {
  display: grid;
  gap: 8px;
  margin: 5px 0 11px;
}

.example-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.example-row span {
  min-width: 0;
}

.example-row strong {
  color: var(--text);
  font-size: 15px;
  flex-shrink: 0;
}

.example-row.highlight {
  background: var(--cash-soft);
  border-color: rgba(62, 224, 138, 0.4);
}

.example-row.highlight strong {
  color: var(--cash);
  font-size: 17px;
}

.example-note {
  color: var(--muted);
  font-size: 13px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 92, 173, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(232, 92, 173, 0); }
}

@media (hover: hover) and (pointer: fine) {
  .choice:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(196, 77, 255, 0.28);
  }

  .choice.ghost:hover {
    border-color: var(--accent);
    box-shadow: none;
  }

  button[type="submit"]:hover { filter: brightness(1.1); }

  .wa:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
  }
}

.choice:active,
.wa:active,
button[type="submit"]:active {
  transform: scale(0.98);
}

@media (max-width: 520px) {
  body {
    display: block;
    padding: 0;
    height: auto;
    min-height: var(--app-height, 100dvh);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .bg {
    display: none;
  }

  .app {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: var(--app-height, 100dvh);
    max-height: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    background: var(--surface);
    position: relative;
    top: auto;
    left: auto;
    right: auto;
  }

  .topbar {
    padding: max(12px, var(--safe-top)) max(16px, var(--safe-right)) 14px max(16px, var(--safe-left));
    background: var(--surface);
  }

  .topbar::before,
  .topbar::after,
  .composer::before,
  .composer::after {
    display: none;
  }

  .chat {
    padding: 16px max(14px, var(--safe-right)) 12px max(14px, var(--safe-left));
    gap: 12px;
  }

  .bubble {
    max-width: 88%;
    font-size: 15px;
    padding: 12px 14px;
  }

  .choices {
    display: grid;
    width: 100%;
    gap: 8px;
  }

  .choice {
    width: 100%;
    border-radius: 14px;
    padding: 12px 14px;
    text-align: center;
  }

  .composer {
    padding: 12px max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left));
  }

  .example-row {
    flex-wrap: wrap;
    gap: 6px 12px;
  }
}

@media (max-width: 360px) {
  .brand small { display: none; }
  .avatar { width: 36px; height: 36px; border-radius: 11px; }
  .bubble { font-size: 14px; }
  .headline { font-size: 18px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 8px 14px; }
  .avatar { width: 32px; height: 32px; }
  .chat { padding: 10px 14px; gap: 10px; }
  .headline { font-size: 18px; margin-bottom: 8px; }
  .composer { padding: 8px 12px max(8px, var(--safe-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .row { animation: none; }
  .typing span { animation: none; opacity: 0.7; }
  .choice,
  .wa,
  button[type="submit"] {
    transition: none;
    animation: none;
  }
}