:root {
  --fondo: #181327;
  --fondo2: #241b3f;
  --cab: #221b3a;
  --lu: #2f2752;
  --lu-texto: #f3eefc;
  --yo: #f4b44c;
  --yo2: #ee8d3f;
  --yo-texto: #25170a;
  --suave: #b9aedb;
  --linea: #3a3060;
  --error: #ff8f8f;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, var(--fondo2), var(--fondo));
  color: var(--lu-texto);
  -webkit-font-smoothing: antialiased;
}
.app {
  display: flex; flex-direction: column;
  height: var(--alto, 100dvh); max-width: 560px; margin: 0 auto;
  position: fixed; top: var(--arriba, 0); left: 0; right: 0;
  background: linear-gradient(180deg, #1d1633, #171126);
}
@media (min-width: 600px) {
  .app { top: 18px; bottom: 18px; height: auto; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px #0008; }
}

.cab { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--cab); border-bottom: 1px solid var(--linea); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 20px; color: #2a1b06;
  background: conic-gradient(from 210deg, #f9d276, #f08a3c, #c3569b, #f9d276);
}
.quien { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.quien strong { font-size: 16px; }
.quien span { font-size: 12.5px; color: var(--suave); }
.demo { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: #ffffff1f; color: var(--suave); padding: 1px 6px; border-radius: 6px; vertical-align: middle; }

.barra { flex: none; padding: 9px 16px 10px; background: #1f1836; border-bottom: 1px solid var(--linea); }
.barra-txt { font-size: 13px; color: var(--suave); margin-bottom: 6px; }
.barra-txt b { color: var(--yo); font-variant-numeric: tabular-nums; }
.barra-pista { height: 7px; border-radius: 99px; background: #ffffff14; overflow: hidden; }
.barra-relleno { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--yo), var(--yo2)); transition: width .8s ease; }

.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 6px; scroll-behavior: smooth; overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; max-width: 82%; animation: entra .22s ease-out; }
.msg.lu { align-self: flex-start; }
.msg.yo { align-self: flex-end; align-items: flex-end; }
.burbuja { padding: 9px 13px; border-radius: 16px; font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.lu .burbuja { background: var(--lu); color: var(--lu-texto); border-bottom-left-radius: 5px; }
.yo .burbuja { background: linear-gradient(135deg, var(--yo), var(--yo2)); color: var(--yo-texto); border-bottom-right-radius: 5px; }
.verso .burbuja { font-style: italic; border: 1px solid #f4b44c66; background: #2a2150; }
.msg time { font-size: 11px; color: #8d82b3; margin: 2px 6px 0; }
.escribiendo .burbuja { display: flex; gap: 5px; padding: 13px 14px; }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--suave); opacity: .5; animation: salta 1s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; }
.escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes salta { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.aviso { margin: 0 12px 6px; padding: 9px 12px; border-radius: 10px; background: #3a1f2e; border: 1px solid #7a3b52; color: #ffd3d3; font-size: 14px; }

.pie { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--cab); border-top: 1px solid var(--linea); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.chips:empty { display: none; }
.chip { font: inherit; font-size: 14.5px; padding: 7px 13px; border-radius: 99px; border: 1px solid #f4b44c88; background: transparent; color: var(--yo); cursor: pointer; }
.chip:hover, .chip:focus-visible { background: #f4b44c22; outline: none; }
.entrada { display: flex; align-items: flex-end; gap: 8px; }
.prefijo { align-self: center; color: var(--suave); font-size: 15px; padding-left: 4px; }
textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px; font: inherit; font-size: 16px; line-height: 1.35;
  padding: 10px 14px; border-radius: 20px; border: 1px solid var(--linea); background: #17112b; color: var(--lu-texto);
}
textarea:focus { outline: 2px solid #f4b44c88; outline-offset: 0; }
textarea:disabled { opacity: .5; }
#enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; color: var(--yo-texto); background: linear-gradient(135deg, var(--yo), var(--yo2)); display: grid; place-items: center; flex: none; }
#enviar:disabled { opacity: .4; cursor: default; }
.contador { font-size: 12px; color: var(--suave); text-align: right; margin-top: 4px; }
.contador.mal { color: var(--error); }
.priv { margin: 7px 2px 0; font-size: 12px; color: #8d82b3; text-align: center; }

.verif { position: absolute; inset: 0; background: #181327ee; display: grid; place-items: center; z-index: 5; }
.verif-caja { text-align: center; padding: 24px; }
[hidden] { display: none !important; }
@media (max-height: 560px) { .priv { display: none; } .barra { padding: 6px 16px 7px; } .cab { padding: 8px 16px; } }
@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; } .escribiendo i { animation: none; } .barra-relleno { transition: none; } .chat { scroll-behavior: auto; }
}

/* Cierre: audio cantado + tarjeta de pago */
.especial .burbuja.audio { padding: 8px; }
.especial audio { width: min(270px, 68vw); display: block; }
.especial .burbuja.pago { background: linear-gradient(160deg, #2a2150, #1d1838); border: 1px solid #f4b44c88; text-align: center; padding: 16px 16px 14px; white-space: normal; }
.pago-tit { font-size: 14px; opacity: .85; letter-spacing: .02em; }
.pago-precio { font-size: 32px; font-weight: 800; color: #f4b44c; margin: 2px 0 4px; }
.pago-det { font-size: 13px; opacity: .8; margin-bottom: 12px; }
.pago-btn { display: block; width: 100%; border: 0; cursor: pointer; font-family: inherit; background: linear-gradient(135deg, #f4b44c, #f08a4b); color: #1b1530; font-weight: 800; text-decoration: none; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
div.pago-btn { background: #ffffff14; color: inherit; font-weight: 600; }
.pago-btn:disabled { opacity: .7; cursor: wait; }
