/* Amor Tóxico v0.2 — sistema de diseño "Serene Recovery" (Stitch/DESIGN.md) */

:root {
  /* superficies */
  --bg: #faf9f7;
  --surface-low: #f4f3f1;
  --surface: #efeeec;
  --surface-high: #e9e8e6;
  --card: #ffffff;
  /* tinta */
  --ink: #1a1c1b;
  --muted: #464554;
  --faint: #777585;
  --line: #c7c4d6;
  /* primario (índigo / violeta suave) */
  --primary: #4441c4;
  --primary-cont: #5d5cde;
  --on-primary-cont: #f1eeff;
  --primary-fixed: #e2dfff;
  --primary-dim: #c2c1ff;
  /* secundario (verde salvia) */
  --sage: #4a654e;
  --sage-cont: #c9e8cb;
  --sage-deep: #334d38;
  /* terciario (rosa suave / terracota — reservado al corazón y toques emocionales) */
  --rose: #ffb4a2;
  --rose-soft: #ffdad2;
  --terra: #9c5c4c;
  --terra-deep: #6f3729;
  /* error (nunca para emociones) */
  --error: #ba1a1a;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Manrope", -apple-system, "Segoe UI", sans-serif;

  --r-lg: 1rem;
  --r-xl: 1.5rem;
  --sombra: 0 4px 20px rgba(26, 28, 27, 0.04);
}

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

body {
  font-family: var(--sans);
  background: #edeae4;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* marco tipo teléfono */
.marco {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 0;
}
.phone {
  width: min(430px, 100vw);
  height: min(880px, 100dvh);
  background: var(--bg);
  border-radius: 34px;
  box-shadow: 0 24px 70px rgba(26, 28, 27, 0.16);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (max-width: 460px) {
  .marco { padding: 0; }
  .phone { border-radius: 0; height: 100dvh; }
}

#vista {
  flex: 1;
  overflow-y: auto;
  padding: 26px 24px 120px;
  scroll-behavior: smooth;
}
#vista.sin-dock { padding-bottom: 40px; }

/* ---------- tipografía ---------- */
h1.titular {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 36px;
  color: var(--ink);
}
h2.titular { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 32px; }
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.sub { font-size: 15px; line-height: 24px; color: var(--muted); }
.serif-cita {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 30px;
  color: var(--ink);
}
.metodo-lema {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: 21px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.metodo-lema .activa { background: var(--rose-soft); padding: 2px 6px; border-radius: 6px; }

.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.centrado { text-align: center; }

/* ---------- tarjetas ---------- */
.card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--sombra);
  margin-top: 16px;
}
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin-bottom: 6px; }
.card p { font-size: 14.5px; line-height: 23px; color: var(--muted); }
.card.tinta { background: var(--primary-fixed); box-shadow: none; }
.card.salvia { background: var(--sage-cont); box-shadow: none; }
.card.rosa { background: var(--rose-soft); box-shadow: none; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  border-radius: 999px;
  padding: 16px 28px;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primario { background: var(--primary); color: #fff; }
.btn-primario:hover { filter: brightness(1.08); }
.btn-salvia { background: transparent; color: var(--sage-deep); border: 1.6px solid var(--sage); }
.btn-fantasma { background: transparent; color: var(--primary); }
.btn-suave { background: var(--primary-fixed); color: var(--primary); }
.btn-block { display: flex; width: 100%; }
.btn-grande { padding: 18px 30px; font-size: 17px; }

/* ---------- opciones (respuesta múltiple) ---------- */
.opciones { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.opciones button {
  text-align: left;
  background: var(--card);
  border: 1.4px solid transparent;
  border-radius: var(--r-lg);
  box-shadow: var(--sombra);
  padding: 15px 18px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 22px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.opciones button:hover { border-color: var(--line); }
.opciones button.activa {
  border-color: var(--primary);
  background: var(--primary-fixed);
  color: var(--primary);
  font-weight: 600;
}
.opciones button .punto-op {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--line); margin-right: 10px; vertical-align: 2px;
}
.opciones button.activa .punto-op { background: var(--primary); }

.opciones button.serio {
  background: transparent;
  border: 1.6px solid var(--terra-deep);
  color: var(--terra-deep);
  font-weight: 600;
  box-shadow: none;
}
.opciones button.serio .punto-op { background: var(--terra-deep); }

/* semáforo de señales (spec IA §6) — tonos suaves, nunca alarmantes */
.senal-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: 1px;
  letter-spacing: 0.02em;
}
.senal-verde { background: var(--sage-cont); color: var(--sage-deep); }
.senal-amarilla { background: #f3e5c3; color: #6f5620; }
.senal-roja { background: #f7d9d4; color: #8c2f26; }

/* botones de emergencia (pantalla de seguridad, portados de v0.1) */
.btn-emergencia {
  display: block;
  width: 100%;
  border: 0;
  cursor: pointer;
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-top: 12px;
  background: var(--error);
  color: #fff;
  text-decoration: none;
  text-align: left;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16.5px;
  line-height: 22px;
}
.btn-emergencia small { display: block; font-weight: 500; font-size: 13px; opacity: 0.85; margin-top: 2px; }
.btn-emergencia.linea { background: var(--primary); }
.btn-emergencia.contacto { background: var(--terra-deep); }

/* chips compactos */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips button {
  border: 1.4px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.chips button.activa { border-color: var(--primary); background: var(--primary-fixed); color: var(--primary); font-weight: 600; }

/* ---------- inputs fantasma ---------- */
input[type="text"], textarea {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--surface-high);
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  padding: 12px 2px;
  outline: none;
  transition: border-color 0.15s ease;
}
input[type="text"]:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 130px; resize: vertical; line-height: 25px; }
::placeholder { color: var(--faint); }

/* ---------- barra superior ---------- */
.top-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.top-bar h2 { font-family: var(--serif); font-weight: 500; font-size: 21px; }
.volver {
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--surface-low); color: var(--muted);
  font-size: 17px; cursor: pointer; flex-shrink: 0;
}

/* ---------- progreso (líneas de camino, no barras de carga) ---------- */
.linea-camino {
  height: 5px; border-radius: 999px; background: var(--surface-high);
  overflow: hidden; margin-top: 10px;
}
.linea-camino > div { height: 100%; border-radius: 999px; background: var(--sage); transition: width 0.8s ease; }

.progreso-puntos { display: flex; gap: 6px; margin-bottom: 18px; }
.progreso-puntos span { height: 4px; flex: 1; border-radius: 999px; background: var(--surface-high); }
.progreso-puntos span.activa { background: var(--sage); }

/* ---------- corazón palpitante ---------- */
@keyframes latido {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.corazon-boton {
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  margin: 0 auto;
  animation: latido 4s ease-in-out infinite;
  filter: drop-shadow(0 14px 30px rgba(156, 92, 76, 0.28));
}
.corazon-boton svg { display: block; }
.corazon-texto {
  position: absolute; left: 0; right: 0; top: 0; bottom: 14%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-style: italic; font-weight: 500;
  color: #fff; font-size: 17px; line-height: 22px; text-align: center;
  text-shadow: 0 1px 6px rgba(160, 70, 90, 0.35);
  pointer-events: none;
}
.corazon-wrap { position: relative; display: inline-block; }

/* ---------- pantalla de bienvenida ---------- */
.bienvenida {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 8px;
  padding: 20px 8px;
}
.pregunta-rotativa {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 40px;
  color: var(--ink);
  min-height: 80px;
  transition: opacity 0.6s ease;
}
.pregunta-rotativa.saliendo { opacity: 0; }
.logo-marca {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 15px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--terra);
}

/* ---------- respiración de caja ---------- */
.respira-wrap {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.respira-circulo {
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #daf0dc, var(--sage-cont));
  border: 2px solid rgba(74, 101, 78, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--sage-deep);
  transition: transform 4s cubic-bezier(0.4, 0, 0.4, 1);
  transform: scale(0.72);
}
.respira-circulo.inhala { transform: scale(1.06); }
.respira-circulo.sosten-arriba { transform: scale(1.06); transition-duration: 0.3s; transition-delay: 0s; }
.respira-circulo.exhala { transform: scale(0.72); }
.respira-circulo.sosten-abajo { transform: scale(0.72); transition-duration: 0.3s; }
.respira-fase { margin-top: 26px; font-size: 15px; color: var(--muted); min-height: 24px; }

/* ---------- navegación (dock) ---------- */
.dock {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(250, 249, 247, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--surface-high);
  display: flex; align-items: flex-end; justify-content: space-around;
  padding: 10px 8px calc(14px + env(safe-area-inset-bottom));
}
.dock a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; color: var(--faint);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  width: 68px;
}
.dock a.activa { color: var(--primary); }
.dock .corazon-dock {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), #f398a4);
  display: flex; align-items: center; justify-content: center;
  margin-top: -30px;
  box-shadow: 0 10px 26px rgba(243, 152, 164, 0.45);
  animation: latido 4s ease-in-out infinite;
}

/* ---------- journal ---------- */
.entrada {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  box-shadow: var(--sombra);
  margin-top: 14px;
}
.entrada .fecha { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.entrada h4 { font-family: var(--serif); font-weight: 500; font-size: 17px; margin: 6px 0 2px; }
.entrada .tipo-sello {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; margin-left: 8px; vertical-align: 1px;
}
.sello-sesion { background: var(--primary-fixed); color: var(--primary); }
.sello-libre { background: var(--sage-cont); color: var(--sage-deep); }
.sello-carta { background: var(--rose-soft); color: var(--terra-deep); }
.entrada .resumen-linea { font-size: 14px; color: var(--muted); line-height: 22px; margin-top: 4px; }
.entrada .detalle { margin-top: 12px; border-top: 1px solid var(--surface-high); padding-top: 12px; display: none; }
.entrada.abierta .detalle { display: block; }
.detalle .campo { margin-bottom: 10px; }
.detalle .campo b { font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); display: block; }
.detalle .campo span { font-size: 14.5px; line-height: 22px; color: var(--ink); }

/* ---------- mapa ---------- */
.secuencia { display: flex; flex-direction: column; gap: 0; margin-top: 14px; }
.secuencia .paso {
  background: var(--card); border-radius: var(--r-lg);
  padding: 12px 16px; font-size: 14.5px; box-shadow: var(--sombra);
}
.secuencia .flecha { text-align: center; color: var(--sage); font-size: 15px; padding: 3px 0; }

.camino-etapa { display: flex; gap: 14px; margin-top: 18px; }
.camino-etapa .columna { display: flex; flex-direction: column; align-items: center; }
.camino-etapa .nodo {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface-high); border: 2.5px solid var(--line);
  flex-shrink: 0;
}
.camino-etapa.lograda .nodo { background: var(--sage-cont); border-color: var(--sage); }
.camino-etapa .tallo { width: 2.5px; flex: 1; background: var(--line); margin: 4px 0; min-height: 28px; border-radius: 2px; }
.camino-etapa.lograda .tallo { background: var(--sage); }
.camino-etapa:last-child .tallo { display: none; }
.camino-etapa .cuerpo b { font-size: 13px; letter-spacing: 0.12em; color: var(--ink); }
.camino-etapa.pendiente .cuerpo b { color: var(--faint); }
.camino-etapa .cuerpo p { font-family: var(--serif); font-style: italic; font-size: 15.5px; color: var(--muted); margin-top: 2px; }

/* ---------- listas suaves (puntos florales, no checklist) ---------- */
.lista-suave { list-style: none; margin-top: 10px; }
.lista-suave li {
  position: relative; padding: 7px 0 7px 22px;
  font-size: 14.5px; line-height: 22px; color: var(--ink);
}
.lista-suave li::before {
  content: ""; position: absolute; left: 2px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sage-cont); border: 1.6px solid var(--sage);
}

/* ---------- slider intensidad ---------- */
input[type="range"] {
  width: 100%; accent-color: var(--primary); margin-top: 14px;
}
.rango-etiquetas { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--faint); margin-top: 4px; }

/* ---------- avatar ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

/* ---------- pantallas de flujo (sin dock) ---------- */
.flujo-cerrar {
  position: absolute; top: 18px; right: 18px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--surface-low); color: var(--muted);
  font-size: 15px; cursor: pointer;
}

/* ---------- sonido ---------- */
.sonido-fila {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--r-lg);
  padding: 15px 18px; margin-top: 10px; box-shadow: var(--sombra);
  font-size: 15px;
}
.sonido-fila button {
  border: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--sage-cont); color: var(--sage-deep);
  font-size: 15px; cursor: pointer;
}
.sonido-fila button.sonando { background: var(--sage); color: #fff; }
.sonido-fila .pronto { font-size: 12px; color: var(--faint); }

/* ---------- ayuda overlay ---------- */
.hoja {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(26, 28, 27, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end;
}
.hoja .panel {
  background: var(--bg); width: 100%;
  border-radius: 28px 28px 0 0;
  padding: 26px 24px calc(28px + env(safe-area-inset-bottom));
  max-height: 82%; overflow-y: auto;
}

/* ---------- misc ---------- */
.aviso {
  font-size: 12.5px; color: var(--faint); line-height: 19px;
  text-align: center; margin-top: 18px;
}
.tag-numero {
  font-family: var(--serif); font-size: 34px; font-weight: 500; color: var(--primary);
}
.grande-num { font-family: var(--serif); font-size: 48px; font-weight: 500; color: var(--ink); }
.divisor { height: 1px; background: var(--surface-high); margin: 18px 0; border: 0; }

/* Carrusel de preguntas de inicio */
.preg-puntos { display: flex; gap: 6px; margin-top: 10px; }
.preg-puntos .pp {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink); opacity: .16; transition: opacity .4s ease;
}
.preg-puntos .pp.on { opacity: .45; }

/* Nota de voz en el journal */
.voz-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voz-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: background .2s, border-color .2s, color .2s;
}
.voz-btn.grabando { background: var(--primary); border-color: var(--primary); color: #fff; }
.voz-estado { font-size: 12.5px; color: var(--muted); }
.voz-vivo {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 15px; line-height: 1.55; color: var(--ink); min-height: 52px;
}
.voz-vivo .voz-pendiente { color: var(--muted); font-style: italic; }

/* Ilustraciones de los ejercicios de regulación.
   SVG de línea que hereda currentColor, así que siguen la paleta sin
   duplicar colores en cada archivo. */
.ilustracion {
  display: flex; justify-content: center;
  margin: 18px 0 6px; color: var(--muted);
}
.ilustracion img { width: 100%; max-width: 300px; height: auto; display: block; }

/* Carrusel: puntos tocables y flecha de siguiente */
.preg-puntos .pp {
  border: 0; padding: 0; cursor: pointer;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink); opacity: .18;
  transition: opacity .3s ease, transform .3s ease;
}
.preg-puntos .pp:hover { opacity: .34; }
.preg-puntos .pp.on { opacity: .5; transform: scale(1.25); }
.preg-puntos .pp-sig {
  border: 0; background: none; cursor: pointer; padding: 0 0 0 4px;
  color: var(--faint); font-size: 17px; line-height: 1; margin-left: 2px;
}
.preg-puntos .pp-sig:hover { color: var(--muted); }
.preg-puntos { align-items: center; }

/* Tabla «dónde se usa IA» en Ajustes */
.ia-fila { padding: 10px 0; border-top: 1px solid var(--line); }
.ia-fila:first-child { border-top: 0; }
.ia-tarea { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.ia-donde { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.ia-manda { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.ia-modelo {
  display: inline-block; margin-top: 6px; padding: 3px 8px;
  background: var(--surface); border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--muted);
}
.ia-sep {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); font-weight: 700;
}
