/* Concepto: un estudio de voz luminoso. Formas orgánicas que flotan detrás,
   superficies blandas al frente y un único acento mandarina para lo que se pulsa. */
/* Diseño unificado con Master (Rowly): mismos colores y fuentes */
:root {
  --bg: #efebe4;
  --surface: #ffffff;
  --surface-2: #e9e4db;
  --ink: #161412;
  --muted: #6f685e;
  --line: #ddd6ca;
  --accent: #1c1a17;
  --accent-ink: #ffffff;
  --accent-soft: #e6e0d6;
  --mint: #d9efe3;
  --lilac: #e4dcf5;
  --butter: #f6ecc4;
  --rec: #c23a47;
  --ok: #1f9d63;
  --warn: #a8701a;

  --display: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --body: "Jost", "Century Gothic", system-ui, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 0 rgba(22, 20, 18, .04), 0 12px 28px -18px rgba(22, 20, 18, .28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; line-height: 1.05; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
[hidden] { display: none !important; }

.marca {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
}
.marca i {
  width: 30px; height: 30px; border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%;
  background: var(--accent); display: grid; place-items: center;
}
.marca i::after { content: ""; width: 8px; height: 14px; border-radius: 8px; background: var(--accent-ink); }

.etiqueta {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; text-decoration: none;
  padding: 14px 24px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.boton:hover { transform: translateY(-1px); }
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.boton.primario { background: var(--accent); color: var(--accent-ink); }
.boton.fantasma { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.boton.chico { padding: 9px 16px; font-size: 14px; }
.boton svg { width: 20px; height: 20px; flex: none; }

/* ---------- Portada ---------- */
.portada {
  position: relative; min-height: 100%; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 28px;
}
.portada header, .portada footer { position: relative; z-index: 2; max-width: 1080px; width: 100%; margin: 0 auto; }
.portada footer { display: flex; justify-content: center; }

.formas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.forma { position: absolute; animation: latir 18s ease-in-out infinite alternate; }
.forma.f1 { width: 46vmax; height: 40vmax; left: -12vmax; top: -10vmax; background: var(--mint);
  border-radius: 62% 38% 46% 54% / 58% 44% 56% 42%; }
.forma.f2 { width: 38vmax; height: 34vmax; right: -10vmax; top: 8vh; background: var(--lilac);
  border-radius: 40% 60% 63% 37% / 45% 55% 45% 55%; animation-duration: 22s; animation-delay: -6s; }
.forma.f3 { width: 30vmax; height: 26vmax; left: 18vw; bottom: -14vmax; background: var(--butter);
  border-radius: 55% 45% 38% 62% / 52% 38% 62% 48%; animation-duration: 26s; animation-delay: -12s; }
@keyframes latir {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { border-radius: 45% 55% 60% 40% / 40% 60% 40% 60%; }
  100% { transform: translate(2vmax, 3vmax) rotate(14deg); }
}

.centro {
  position: relative; z-index: 2; align-self: center; justify-self: center;
  width: min(640px, 100%); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 22px; padding-block: 40px;
}
.centro h1 { font-size: clamp(40px, 7.4vw, 76px); font-weight: 800; letter-spacing: -.035em; }
.centro h1 em { font-style: normal; color: var(--accent); }
.centro .bajada { font-size: 18px; color: var(--muted); max-width: 46ch; }

.arranque {
  position: relative; margin-top: 10px; border: 0; cursor: pointer;
  width: 212px; height: 212px; border-radius: 52% 48% 50% 50% / 48% 54% 46% 52%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; align-content: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em;
  box-shadow: 0 24px 50px -20px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: respirar 6s ease-in-out infinite;
  transition: transform .2s ease;
}
.arranque:hover { transform: scale(1.04); }
.arranque svg { width: 38px; height: 38px; }
.arranque small { font-family: var(--body); font-weight: 500; font-size: 13px; opacity: .85; }
.arranque::before {
  content: ""; position: absolute; inset: -14px; border-radius: inherit;
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  animation: girar 30s linear infinite;
}
@keyframes respirar { 50% { border-radius: 46% 54% 44% 56% / 55% 45% 55% 45%; } }
@keyframes girar { to { transform: rotate(360deg); } }

.reanudar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.pasos {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; list-style: none; padding: 0; margin: 0;
}
.pasos li {
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(6px);
  padding: 10px 18px 10px 10px; border-radius: 999px; font-size: 14px; font-weight: 500;
}
.pasos b {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 12px; font-weight: 500;
}
.dato { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* ---------- Entrevista ---------- */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.barra {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 14px;
}
.barra-in { max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.barra .marca { font-size: 17px; }
.barra .marca i { width: 26px; height: 26px; }
.progreso { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.progreso-txt { display: flex; justify-content: space-between; gap: 12px; }
.tramos { display: flex; gap: 4px; }
.tramo { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tramo span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .5s ease; }

.hilo {
  overflow-y: auto; scroll-behavior: smooth;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 40px;
}
.hilo-in { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.app { position: relative; overflow: hidden; }
.app > .barra, .app > .hilo, .app > .dock { position: relative; z-index: 1; }
.formas.suaves { opacity: .38; }

/* Movimiento: las burbujas nuevas entran con un pequeño rebote,
   la pregunta en curso flota y cambia de forma despacio. */
:root { --rebote: cubic-bezier(.34, 1.56, .64, 1); }
.msg { display: flex; gap: 12px; align-items: flex-end; max-width: 92%; }
.msg.yo { align-self: flex-end; flex-direction: row-reverse; }
.msg.actual, .msg.escribiendo, .msg.quieta { animation: entrar .6s var(--rebote) both; transform-origin: left bottom; }
.msg.yo.nueva { animation: entrar-yo .6s var(--rebote) both; transform-origin: right bottom; }
@keyframes entrar { from { transform: translateY(18px) scale(.94); opacity: 0; } }
@keyframes entrar-yo { from { transform: translateX(22px) scale(.94); opacity: 0; } }
.msg.actual .burbuja { animation: flotar 6s ease-in-out .6s infinite; }
@keyframes flotar {
  0%, 100% { transform: translateY(0) rotate(0deg); border-radius: 22px 22px 22px 8px; }
  50% { transform: translateY(-5px) rotate(-.35deg); border-radius: 28px 18px 26px 8px; }
}
.msg.actual .avatar { animation: latir-avatar 3s ease-in-out infinite; }
@keyframes latir-avatar { 50% { border-radius: 44% 56% 48% 52% / 58% 42% 58% 42%; transform: scale(1.06); } }
.pal { display: inline-block; animation: palabra .5s var(--rebote) both; animation-delay: calc(var(--i) * 40ms + .15s); }
@keyframes palabra { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }
.dock-in.cambio { animation: panel .5s var(--rebote); }
@keyframes panel { from { transform: translateY(14px) scale(.98); opacity: .2; } }
.chip { transition: background .15s ease, transform .25s var(--rebote); }
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: scale(.95); }

.cargando { display: inline-flex; gap: 6px; padding: 4px 2px; }
.cargando i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: saltar 1s ease-in-out infinite; }
.cargando i:nth-child(2) { animation-delay: .15s; }
.cargando i:nth-child(3) { animation-delay: .3s; }
@keyframes saltar { 50% { transform: translateY(-6px); opacity: .5; } }
.gota {
  flex: none; width: 52px; height: 52px; background: var(--accent);
  border-radius: 54% 46% 50% 50% / 50% 54% 46% 50%;
  animation: gota 1.6s ease-in-out infinite;
}
@keyframes gota {
  0%, 100% { transform: rotate(0deg) scale(1); border-radius: 54% 46% 50% 50% / 50% 54% 46% 50%; }
  50% { transform: rotate(180deg) scale(.88); border-radius: 40% 60% 62% 38% / 60% 40% 60% 40%; }
}
.estado-modelo.listo { color: var(--ok); }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%;
  background: var(--accent); display: grid; place-items: center;
}
.avatar::after { content: ""; width: 8px; height: 15px; border-radius: 8px; background: var(--accent-ink); }
.burbuja {
  min-width: 0; background: var(--surface); padding: 16px 20px; border-radius: var(--r-md) var(--r-md) var(--r-md) 8px;
  box-shadow: var(--shadow); display: grid; gap: 8px;
}
.msg.yo .burbuja {
  background: var(--ink); color: var(--bg); border-radius: var(--r-md) var(--r-md) 8px var(--r-md); box-shadow: none;
}
.burbuja .pregunta { font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.burbuja .ayuda { color: var(--muted); font-size: 14.5px; }
.burbuja .seccion { display: inline-flex; align-self: start; justify-self: start; gap: 8px; align-items: center;
  background: var(--accent-soft); color: var(--ink); padding: 4px 10px; border-radius: 99px; }
.msg.yo .respuesta { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.yo .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; opacity: .7; }
.msg.yo .meta button { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; color: inherit; }
.chips-resp { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-resp span { background: color-mix(in srgb, var(--bg) 18%, transparent); border-radius: 99px; padding: 3px 10px; font-size: 13px; }

/* Composer */
.dock {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.dock-in {
  max-width: 820px; margin: 0 auto; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; cursor: pointer; padding: 10px 16px; border-radius: 99px; font-weight: 500; font-size: 15px;
  background: var(--surface-2); color: var(--ink); transition: background .15s ease;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"]::before { content: "✓ "; }

.fila { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fila .empuje { flex: 1; min-width: 0; }

.mic {
  flex: none; width: 76px; height: 76px; border: 0; cursor: pointer;
  border-radius: 54% 46% 50% 50% / 50% 54% 46% 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  transition: transform .15s ease, border-radius .4s ease;
}
.mic:hover { transform: scale(1.05); }
.mic svg { width: 30px; height: 30px; }
.mic.grabando { background: var(--rec); animation: respirar 1.6s ease-in-out infinite; }
/* Al parar la grabación, en el mismo sitio aparece el botón de enviar. */
.mic.enviar { background: var(--ok); color: var(--surface); animation: entrar .45s var(--rebote) both; }
.mic.enviar:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.mic.guardando { animation: respirar 1s ease-in-out infinite; }
.transcribiendo .gota { width: 76px; height: 76px; }
.mic-txt .enlace { font-size: inherit; }
@media (max-width: 560px) { .transcribiendo .gota { width: 64px; height: 64px; } }
.mic-txt strong { display: block; font-family: var(--display); font-size: 18px; }
.mic-txt span { color: var(--muted); font-size: 14px; }

.onda { width: 100%; height: 56px; display: block; }
.en-vivo { font-size: 16px; min-height: 1.5em; color: var(--ink); }
.en-vivo .interino { color: var(--muted); }
.reloj { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--rec); font-size: 14px; }

textarea.editor, input.editor {
  width: 100%; border: 0; resize: vertical; min-height: 96px; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); font: 16px/1.5 var(--body);
}
input.editor { min-height: 0; }
textarea.editor:focus, input.editor:focus { outline: 2px solid var(--accent); }
.nota { font-size: 13.5px; color: var(--muted); }
.nota.alerta { color: var(--warn); }
.enlace { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }
audio { width: 100%; max-width: 320px; height: 40px; }

.final { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 8px; }
.final h2 { font-size: 28px; }

@media (max-width: 560px) {
  .burbuja .pregunta { font-size: 18.5px; }
  .msg { max-width: 100%; }
  .avatar { display: none; }
  .mic { width: 64px; height: 64px; }
  .arranque { width: 184px; height: 184px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
