/* La ventana (/bienvenida/nueva, tarea 13): las puertas en la palabra exacta y la demo «Mándale un mensaje», dentro del
   marco de la llamada. Usa los tokens de estilo.css (oro sobre negro). */

/* =========================================================== las puertas */
/* En escritorio, una columna a la derecha del marco (la cara queda al centro; el rótulo, a la izquierda). */
.puertas { position: absolute; z-index: 3; right: 14px; top: 50%; transform: translateY(-46%); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.puertas[hidden] { display: none; }
.puerta { display: flex; align-items: center; gap: 10px; min-width: 196px; padding: 6px 14px 6px 6px; border-radius: 999px; background: rgba(9, 8, 12, 0.72); box-shadow: 0 0 0 1px rgba(243, 209, 142, 0.16), 0 14px 30px -14px rgba(0, 0, 0, 0.9);
  opacity: 0; transform: translateX(18px) scale(0.94); transition: opacity 0.42s var(--curva), transform 0.52s var(--curva), box-shadow 0.6s ease; }
.puerta.entra { opacity: 1; transform: none; }
.puerta-icono { position: relative; flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(70, 52, 26, 0.95), rgba(16, 12, 10, 0.95)); }
.puerta-icono::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--oro-claro); opacity: 0; transform: scale(1); }
.puerta.entra .puerta-icono::after { animation: puerta-aro 0.9s ease-out both; }
@keyframes puerta-aro { 0% { opacity: 0.95; transform: scale(1); } 100% { opacity: 0; transform: scale(1.75); } }
.puerta-icono svg { width: 20px; height: 20px; fill: none; stroke: var(--oro-claro); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.puerta-texto { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.puerta-texto b { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; color: var(--tinta); white-space: nowrap; }
.puerta-texto small { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--oro-claro); white-space: nowrap; }
/* «todas las puertas»: se encienden juntas, una ola de luz de arriba abajo */
.puertas.todas .puerta { box-shadow: 0 0 0 1px rgba(243, 209, 142, 0.55), 0 0 26px -4px rgba(212, 166, 86, 0.55); }
.puertas.todas .puerta-icono { animation: puerta-luz 1.1s ease both; }
.puertas.todas .puerta:nth-child(2) .puerta-icono { animation-delay: 0.08s; }
.puertas.todas .puerta:nth-child(3) .puerta-icono { animation-delay: 0.16s; }
.puertas.todas .puerta:nth-child(4) .puerta-icono { animation-delay: 0.24s; }
.puertas.todas .puerta:nth-child(5) .puerta-icono { animation-delay: 0.32s; }
@keyframes puerta-luz { 40% { background: radial-gradient(circle at 50% 35%, #fbe3ad, var(--oro) 70%, var(--oro-hondo)); } }
.puertas.todas .puerta-icono svg { animation: puerta-trazo 1.1s ease both; animation-delay: inherit; }
@keyframes puerta-trazo { 40% { stroke: #1a1206; } }
.puertas.sale { opacity: 0; transition: opacity 0.4s ease; }
/* con las puertas a la vista, el rótulo no repite los puntos ni la ventanita propia estorba */
body.con-puertas .rotulo-punto { display: none; }
body.puertas-a-la-vista .tu { opacity: 0; }

/* =========================================================== «Mándale un mensaje» */
.ventana { position: absolute; z-index: 4; right: 16px; top: 50%; width: min(360px, 44%); transform: translateY(-50%); padding: 14px 14px 12px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(24, 20, 18, 0.94), rgba(10, 9, 12, 0.96)); box-shadow: 0 0 0 1px rgba(243, 209, 142, 0.2), 0 30px 80px -24px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: ventana-entra 0.5s var(--curva) both; --canal: var(--oro); }
.ventana[hidden] { display: none; }
.ventana.sale { animation: ventana-sale 0.36s ease both; }
@keyframes ventana-entra { from { opacity: 0; transform: translateY(calc(-50% + 18px)) scale(0.97); } }
@keyframes ventana-sale { to { opacity: 0; transform: translateY(calc(-50% + 12px)) scale(0.98); } }
body.con-ventana .tu, body.con-ventana .subtitulo, body.con-ventana .rotulo { opacity: 0; pointer-events: none; }
.v-cabeza { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 40px; position: relative; margin-bottom: 12px; }
.v-ojo { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 500; line-height: 1.1; color: var(--tinta); }
/* el sello de simulación: a la vista desde el primer cuadro hasta que se cierra */
.v-sello-sim { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; border: 1px dashed rgba(243, 209, 142, 0.55); color: var(--oro-claro); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.v-cerrar { position: absolute; top: -4px; right: -4px; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(242, 236, 224, 0.08); color: var(--suave); }
.v-cerrar:hover { color: var(--tinta); background: rgba(242, 236, 224, 0.14); }
.v-cerrar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.v-envio { display: flex; flex-direction: column; gap: 12px; }
.v-quien { display: flex; align-items: center; gap: 12px; }
.v-avatar { position: relative; flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(100% 100% at 30% 20%, color-mix(in srgb, var(--canal) 70%, #ffffff), color-mix(in srgb, var(--canal) 45%, #120e0b)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.v-avatar > svg { width: 24px; height: 24px; fill: none; stroke: #1a1206; stroke-width: 1.8; stroke-linecap: round; }
.v-canal { position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #1a1511; box-shadow: 0 0 0 2px rgba(24, 19, 15, 0.95); }
.v-canal svg { width: 12px; height: 12px; fill: none; stroke: var(--oro-claro); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.v-quien-texto { min-width: 0; }
.v-nombre { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.15; color: var(--tinta); }
.v-via { margin: 2px 0 0; font-size: 12.5px; font-weight: 700; color: color-mix(in srgb, var(--canal) 80%, var(--tinta)); }
/* la conversación: un fondo apenas distinto y la burbuja que sale, a la derecha */
.v-chat { position: relative; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; min-height: 128px; padding: 12px 10px 10px; border-radius: 16px; overflow: hidden;
  background: radial-gradient(circle at 1px 1px, rgba(243, 236, 226, 0.05) 1px, transparent 1.4px) 0 0 / 14px 14px, rgba(0, 0, 0, 0.26); border: 1px solid rgba(243, 236, 226, 0.06); }
.v-burbuja { position: relative; max-width: 92%; min-width: 64px; padding: 9px 12px 6px 13px; border-radius: 18px 18px 6px 18px; overflow: hidden; transform-origin: 100% 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--canal) 30%, #1d1712), color-mix(in srgb, var(--canal) 20%, #1a1511)); border: 1px solid color-mix(in srgb, var(--canal) 38%, transparent); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  animation: v-burbuja-entra 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s both; }
.v-texto { margin: 0; min-height: 1.45em; font-size: 15px; line-height: 1.45; color: var(--tinta); white-space: pre-wrap; overflow-wrap: anywhere; }
/* el cursor mientras AURA escribe */
.v-envio[data-estado="escribiendo"] .v-texto::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: var(--oro-claro); animation: v-cursor 0.9s steps(1) infinite; }
@keyframes v-cursor { 50% { opacity: 0; } }
.v-hora { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; font-size: 12px; color: rgba(246, 239, 230, 0.6); }
.v-marca { color: var(--oro-claro); font-weight: 700; }
.v-pie { display: flex; align-items: center; gap: 10px; min-height: 30px; margin: 0; font-size: 14px; font-weight: 600; color: var(--suave); }
.v-pie b { color: var(--tinta); font-weight: 800; }
.v-confirma { position: relative; flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(212, 166, 86, 0.18); }
.v-confirma::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(243, 209, 142, 0.6); animation: v-escucha 1.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite; }
.v-confirma svg { width: 16px; height: 16px; fill: none; stroke: var(--oro-claro); stroke-width: 1.8; stroke-linecap: round; }
@keyframes v-escucha { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.75); } }
.v-puntos { display: inline-flex; gap: 4px; }
.v-puntos i { width: 6px; height: 6px; border-radius: 50%; background: var(--canal); animation: v-punto 0.9s ease-in-out infinite; }
.v-puntos i:nth-child(2) { animation-delay: 0.15s; }
.v-puntos i:nth-child(3) { animation-delay: 0.3s; }
@keyframes v-punto { 0%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.v-botones { display: flex; gap: 8px; }
.v-botones[hidden] { display: none; }
.v-si { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border: 0; border-radius: 14px; background: linear-gradient(180deg, var(--oro-claro), var(--oro)); color: #1a1206; font-size: 15px; font-weight: 800;
  box-shadow: 0 12px 28px -10px rgba(212, 166, 86, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5); animation: subir 0.4s var(--curva) both; transition: transform 0.2s var(--curva); }
.v-si:active { transform: scale(0.97); }
.v-si svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.v-no { flex: none; height: 48px; padding: 0 16px; border: 1px solid var(--linea-fuerte); border-radius: 14px; background: none; color: var(--suave); font-size: 14px; font-weight: 600; animation: subir 0.4s var(--curva) 0.06s both; }
.v-no:hover { color: var(--tinta); }
/* enviando: un brillo que recorre la burbuja */
.v-envio[data-estado="enviando"] .v-burbuja::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.16) 50%, transparent 80%); transform: translateX(-100%); animation: v-brillo 1.1s ease-in-out infinite; }
@keyframes v-brillo { to { transform: translateX(100%); } }
/* enviado: la burbuja toma impulso y se va volando; el avión con su estela; salta el ✓ */
.v-envio[data-estado="enviado"] .v-burbuja { animation: v-volar 0.52s cubic-bezier(0.55, 0, 0.75, 0.2) 0.14s forwards; }
.v-avion { position: absolute; right: 22px; bottom: 30px; color: var(--oro-claro); opacity: 0; pointer-events: none; }
.v-avion svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.v-estela { position: absolute; right: 16px; top: 14px; width: 90px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(243, 209, 142, 0.7)); transform-origin: 100% 50%; transform: rotate(-38deg) scaleX(0.2); opacity: 0; }
.v-envio[data-estado="enviado"] .v-avion { animation: v-avion 0.72s cubic-bezier(0.4, 0, 0.6, 1) 0.12s forwards; }
.v-envio[data-estado="enviado"] .v-estela { animation: v-estela 0.72s ease-out 0.12s forwards; }
.v-hecho { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center; pointer-events: none; }
.v-envio[data-estado="enviado"] .v-hecho { display: flex; }
.v-hecho-sello { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #fde7b6, var(--oro-claro) 30%, var(--oro) 70%, var(--oro-hondo)); color: #1a1206;
  box-shadow: 0 0 0 8px rgba(212, 166, 86, 0.16), 0 10px 26px rgba(212, 166, 86, 0.34); transform: scale(0); animation: v-resorte 0.52s cubic-bezier(0.34, 1.7, 0.5, 1) 0.42s forwards; }
.v-hecho-sello svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.v-trazo { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dibujar 0.3s ease-out 0.64s forwards; }
.v-hecho-titulo { margin: 6px 0 0; font-size: 20px; font-weight: 800; color: var(--tinta); opacity: 0; animation: v-titulo 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) 0.52s forwards; }
.v-hecho-detalle { margin: 0; display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; border: 1px dashed rgba(243, 209, 142, 0.6); font-size: 12.5px; font-weight: 700; color: var(--oro-claro);
  opacity: 0; animation: v-titulo 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s forwards; }
.v-envio[data-estado="enviado"] .v-pie { min-height: 0; margin-top: -12px; }
.v-envio[data-estado="cancelado"] { animation: v-descartar 0.6s cubic-bezier(0.4, 0, 1, 1) 0.08s forwards; }
@keyframes v-burbuja-entra { from { opacity: 0; transform: translateY(10px) scale(0.94); } }
@keyframes v-volar { 0% { transform: none; opacity: 1; } 22% { transform: translate(-6px, 5px) scale(0.97); opacity: 1; } 100% { transform: translate(150px, -120px) rotate(-10deg) scale(0.45); opacity: 0; } }
@keyframes v-avion { 0% { opacity: 0; transform: translate(-20px, 16px) scale(0.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(120px, -96px) scale(1); } }
@keyframes v-estela { 0% { opacity: 0; transform: rotate(-38deg) scaleX(0.2); } 35% { opacity: 1; } 100% { opacity: 0; transform: rotate(-38deg) scaleX(1); } }
@keyframes v-resorte { to { transform: scale(1); } }
@keyframes v-titulo { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes v-descartar { to { opacity: 0; transform: translateY(18px); } }

/* =========================================================== celular (marco 4:5): abajo, la cara queda arriba */
@media (max-width: 899px) {
  .puertas { left: 10px; right: 10px; top: auto; bottom: 74px; transform: none; flex-direction: row; justify-content: center; gap: 6px; }
  .puerta { flex: 1; min-width: 0; max-width: 76px; flex-direction: column; gap: 4px; padding: 6px 2px 5px; border-radius: 14px; transform: translateY(12px) scale(0.94); }
  .puerta-icono { width: 34px; height: 34px; }
  .puerta-icono svg { width: 18px; height: 18px; }
  .puerta-texto { align-items: center; }
  .puerta-texto b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .puerta-texto small { display: none; }
  /* compacta: la cara arriba y, abajo, todo lo de la demo sin desplazarse (los botones siempre a la vista) */
  .ventana { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; transform: none; padding: 10px 12px 10px; max-height: calc(100% - 60px); overflow-y: auto; }
  @keyframes ventana-entra { from { opacity: 0; transform: translateY(24px); } }
  @keyframes ventana-sale { to { opacity: 0; transform: translateY(16px); } }
  .v-cabeza { margin-bottom: 8px; gap: 6px 8px; }
  .v-ojo { font-size: 19px; }
  .v-envio { gap: 8px; }
  .v-avatar { width: 36px; height: 36px; }
  .v-avatar > svg { width: 19px; height: 19px; }
  .v-nombre { font-size: 16px; }
  .v-chat { min-height: 92px; padding: 8px; }
  .v-texto { font-size: 14px; line-height: 1.4; }
  .v-pie { min-height: 26px; font-size: 13.5px; }
  .v-si, .v-no { height: 46px; }
  /* las puertas toman el lugar del globo (la pregunta ya se contestó) */
  body.puertas-a-la-vista .globo { opacity: 0; transition: opacity 0.3s; }
}
/* horizontal en el teléfono: el marco 3:2 es bajo; columna de íconos y la ventana a la derecha */
@media (orientation: landscape) and (max-height: 500px) {
  .puertas { left: auto; right: 10px; top: 50%; bottom: auto; transform: translateY(-50%); flex-direction: column; gap: 6px; }
  .puerta { min-width: 0; max-width: none; flex-direction: row; padding: 4px; border-radius: 999px; transform: translateX(12px); }
  .puerta-texto { display: none; }
  .ventana { left: auto; right: 10px; top: 10px; bottom: 10px; width: min(330px, 56%); max-height: none; transform: none; overflow-y: auto; }
  .v-chat { min-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .puerta { transform: none; }
  .v-burbuja, .v-hecho-titulo, .v-hecho-detalle { opacity: 1; animation: none !important; }
  .v-envio[data-estado="enviado"] .v-burbuja { animation: v-fundir 0.24s ease forwards !important; }
  .v-hecho-sello { transform: none; animation: none !important; }
  .v-trazo { stroke-dashoffset: 0; animation: none !important; }
  .v-avion, .v-estela { display: none; }
  @keyframes v-fundir { to { opacity: 0; } }
}
