:root {
  --azul: #0b63d6;
  --azul-osc: #073a73;
  --acento: #12b3a6;
  --verde: #1f9d6b;
  --ambar: #e0951b;
  --rojo: #e0443f;
  --tinta: #16212e;
  --gris: #5b6b78;
  --linea: #e6ecf2;
  --fondo: #eef3f9;
  --blanco: #ffffff;
  --sombra: 0 1px 2px rgba(13, 45, 75, 0.05), 0 12px 32px -12px rgba(13, 45, 75, 0.18);
  --sombra-sm: 0 1px 2px rgba(13, 45, 75, 0.06), 0 4px 14px -8px rgba(13, 45, 75, 0.18);
  --radio: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 480px at 50% -8%, #dcebff 0%, rgba(220,235,255,0) 60%),
    linear-gradient(170deg, #eef4fb 0%, var(--fondo) 55%);
  background-attachment: fixed;
  color: var(--tinta);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

/* ---- Topbar ---- */
.topbar { margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
/* Acotado a .brand: la clase .logo también existe en el encabezado del
   sitio y este cuadro pintaba encima (colisión detectada por el Dr. 10-ago). */
.brand .logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--azul) 0%, var(--azul-osc) 100%);
  color: #fff;
  border-radius: 13px;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 6px 18px -6px rgba(11, 99, 214, 0.55);
}
.lang-toggle { margin-left: auto; display: flex; gap: 2px; background: #eef3f8; border-radius: 999px; padding: 3px; }
.lang-toggle button { border: none; background: transparent; color: var(--gris); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.lang-toggle button.on { background: var(--azul); color: #fff; }
.brand-text h1 { margin: 0; font-size: 20px; color: var(--azul-osc); }
.brand-text p { margin: 2px 0 0; font-size: 13px; color: var(--gris); }
.ver { display: inline-block; margin-left: 4px; padding: 1px 7px; font-size: 11px; font-weight: 700; color: var(--azul-osc); background: #e7f1fb; border-radius: 999px; }
/* Línea fina y elegante de marca (fundación) — sobria, espaciada, exclusiva. */
.brand-sub { margin: 3px 0 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris); }
/* La fundación siempre completa en su propia línea, sin partirse (seriedad de marca). */
.brand-found { margin-top: 1px; white-space: nowrap; }

/* ---- Card ---- */
.card {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 26px 24px;
  box-shadow: var(--sombra);
  animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card h2 { margin: 0 0 8px; font-size: 22px; color: var(--azul-osc); letter-spacing: -0.01em; font-weight: 800; }
.hint { margin: 0 0 18px; color: var(--gris); font-size: 15px; }
.hint em { color: var(--tinta); font-style: normal; font-weight: 600; }

/* ---- Caja de síntoma ---- */
.box-row { display: flex; gap: 10px; }
.symptom-box {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--linea);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.symptom-box:focus { border-color: var(--azul); }

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn-primary {
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--azul) 0%, #0a57bd 100%);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(11, 99, 214, 0.6);
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: linear-gradient(180deg, #0a5cc4 0%, var(--azul-osc) 100%); box-shadow: 0 10px 22px -8px rgba(11, 99, 214, 0.7); }
.btn-primary:active { transform: translateY(1px) scale(0.99); }

.btn-secondary {
  margin-top: 22px;
  padding: 12px 18px;
  background: #eef3f8;
  color: var(--azul-osc);
}
.btn-secondary:hover { background: #e2ebf4; }

/* ---- Chips de ejemplo ---- */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}
.chip {
  border: 1px solid var(--linea);
  background: #f7fafd;
  color: var(--gris);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--azul); color: var(--azul); }

.error { color: var(--rojo); font-size: 14px; margin: 12px 0 0; }

/* ---- Categorías (modo intuitivo) ---- */
.cat-title {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gris);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.cat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  background: #f7fafd;
  border: 2px solid var(--linea);
  border-radius: 12px;
  color: var(--tinta);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover {
  border-color: var(--azul);
  background: #eef5fc;
}
@media (min-width: 520px) {
  .categories { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Contexto del paciente en el resultado ---- */
.result-context {
  margin: -8px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--azul-osc);
}
.allergy-alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #9a2a2a;
  background: #fdecec;
  border: 1px solid #f3c6c6;
  border-radius: 10px;
}
#allergy-quick { margin-top: 14px; }
#allergy-quick .option-btn { font-weight: 500; }

/* ---- Posibilidades (%) — opciones claras para el médico ---- */
.prob-row { margin: 12px 0; }
.prob-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.prob-name { font-size: 15px; font-weight: 600; color: var(--tinta); }
.prob-band {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.prob-band.band-strong { background: #e3f1ff; color: var(--azul-osc); }
.prob-band.band-mid { background: #eef3f8; color: var(--gris); }
.prob-band.band-low { background: #f4f7fa; color: #8a98a4; }
.prob-line { display: flex; align-items: center; gap: 10px; }
.prob-track {
  flex: 1;
  height: 12px;
  background: #eef3f8;
  border-radius: 7px;
  overflow: hidden;
}
.prob-bar { height: 100%; border-radius: 7px; transition: width 0.4s ease; }
.prob-bar.band-strong { background: linear-gradient(90deg, var(--azul) 0%, var(--azul-osc) 100%); }
.prob-bar.band-mid { background: var(--azul); opacity: 0.78; }
.prob-bar.band-low { background: #aebfcc; }
.prob-pct { flex: 0 0 42px; text-align: right; font-weight: 700; font-size: 15px; color: var(--azul-osc); }
.prob-why { margin: 12px 0 0; font-size: 13px; color: var(--tinta); }
.prob-meta {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--azul-osc);
  background: #f3f8fd;
  border-left: 3px solid var(--azul);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
}
.prob-caveat { margin: 8px 0 0; font-size: 12px; color: var(--gris); font-style: italic; }
.exam-panel { margin-top: 12px; border: 1px solid var(--linea); border-radius: 10px; background: #f7fafd; padding: 0 12px; }
.exam-panel summary { cursor: pointer; padding: 11px 0; font-weight: 700; font-size: 13px; color: var(--azul-osc); list-style: none; }

.exam-panel[open] summary { border-bottom: 1px solid var(--linea); }
.exam-note { margin: 10px 0 4px; font-size: 12px; color: var(--gris); }
.exam-panel .options { margin: 8px 0 12px; gap: 8px; }
.exam-panel .option-btn { font-size: 14px; padding: 12px 14px 12px 44px; }
.exam-panel .option-check::before { left: 13px; width: 18px; height: 18px; }
.exam-panel .option-check.selected::after { left: 19px; }

/* ---- Resumen para el especialista ---- */
.result-summary {
  margin-top: 18px;
  border: 1px solid var(--linea);
  border-radius: 12px;
  background: #f7fafd;
  padding: 0 14px;
}
.result-summary summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 700;
  color: var(--azul-osc);
  list-style: none;
}
.result-summary[open] summary { border-bottom: 1px solid var(--linea); }
.result-summary ul {
  margin: 10px 0 14px;
  padding-left: 18px;
  font-size: 14px;
  color: var(--tinta);
}
.result-summary li { margin-bottom: 6px; }

/* ---- Datos del paciente (edad / sexo) ---- */
.step {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--azul);
}
.field-label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gris);
}
.text-field {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--linea);
  border-radius: 12px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}
.text-field:focus { border-color: var(--azul); }
.box-row .text-field { flex: 1; width: auto; min-width: 0; }
.btn-block { display: block; width: 100%; margin-top: 20px; }

/* ---- Selección múltiple ---- */
.option-btn.option-check {
  position: relative;
  padding: 16px 18px 16px 48px;
}
.option-check::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--linea);
  border-radius: 6px;
  background: #fff;
  transition: all 0.15s;
}
.option-check.selected {
  border-color: var(--azul);
  background: #eef5fc;
}
.option-check.selected::before {
  background: var(--azul);
  border-color: var(--azul);
}
.option-check.selected::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 50%;
  transform: translateY(-60%) rotate(45deg);
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
}
.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-copy {
  display: block;
  width: 100%;
  margin: 6px 0 14px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-copy:hover { background: var(--azul-osc); }
.summary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.summary-actions .btn-copy { flex: 1 1 auto; margin: 0; min-width: 140px; }
.btn-share { background: var(--verde); }
.btn-share:hover { background: #178055; }
.btn-print { background: #51637a; }
.btn-print:hover { background: #3d4d61; }

/* ---- Hoja imprimible (oculta en pantalla, visible al imprimir) ---- */
#print-sheet { display: none; }
@media print {
  body { background: #fff; }
  .app { display: none !important; }
  #print-sheet { display: block !important; padding: 0; color: #000; }
  .ps-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #0a6ebd; padding-bottom: 10px; margin-bottom: 14px; }
  .ps-logo { width: 38px; height: 38px; display: grid; place-items: center; background: #0a6ebd; color: #fff; border-radius: 9px; font-size: 20px; font-weight: 700; }
  .ps-head h1 { margin: 0; font-size: 18px; color: #084c81; }
  .ps-head p { margin: 2px 0 0; font-size: 12px; color: #444; }
  .ps-date { margin-left: auto; font-size: 12px; color: #444; }
  .ps-table { width: 100%; border-collapse: collapse; }
  .ps-table th, .ps-table td { text-align: left; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid #ddd; font-size: 13px; }
  .ps-table th { width: 34%; color: #084c81; font-weight: 700; }
  .ps-note { margin-top: 14px; font-size: 11px; color: #555; font-style: italic; }
}

/* ---- Preguntas ---- */
.progress {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--azul);
  text-transform: uppercase;
}
.options { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.option-btn {
  text-align: left;
  padding: 16px 18px;
  font-size: 16px;
  background: #f7fafd;
  border: 2px solid var(--linea);
  border-radius: 12px;
  color: var(--tinta);
  cursor: pointer;
  transition: all 0.15s;
}
.option-btn:hover {
  border-color: var(--azul);
  background: #eef5fc;
  transform: translateX(2px);
}
/* Estado seleccionado para botones de opción simples (sí/no, sexo, etc.).
   Antes solo .option-check tenía estilo seleccionado: los botones simples se
   tocaban y no quedaban marcados. */
.option-btn.selected {
  border-color: var(--azul);
  background: #e7f1fb;
  color: var(--azul-osc);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--azul);
}
.option-btn.selected:hover { background: #dceafa; }
/* Feedback táctil inmediato en móvil. */
.option-btn, .btn-primary, .btn-secondary, .btn-copy, .cat-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.option-btn:active { transform: scale(0.99); background: #dceafa; }

/* Sí (verde) / No (rojo) — marco fino, fondo blanco; al elegir, relleno suave. */
.option-btn.yn-yes { border: 1.5px solid var(--verde); background: #fff; color: #0f6b46; box-shadow: none; }
.option-btn.yn-yes:hover { border-color: var(--verde); background: #f2fbf6; }
.option-btn.yn-yes.selected { background: #e7f7ee; border-color: var(--verde); color: #0f6b46; box-shadow: inset 0 0 0 1px var(--verde); }
.option-btn.yn-no { border: 1.5px solid var(--rojo); background: #fff; color: #a11f1b; box-shadow: none; }
.option-btn.yn-no:hover { border-color: var(--rojo); background: #fdf3f3; }
.option-btn.yn-no.selected { background: #fdeaea; border-color: var(--rojo); color: #a11f1b; box-shadow: inset 0 0 0 1px var(--rojo); }

/* ---- Resultado ---- */
.result-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.urgency-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}
.urgency-pill.emergencia { background: var(--rojo); }
.urgency-pill.prioritaria { background: var(--ambar); }
.urgency-pill.rutina { background: var(--verde); }

.result-block {
  padding: 14px 0;
  border-top: 1px solid var(--linea);
}
.result-block:first-of-type { border-top: none; }
.result-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gris);
  margin-bottom: 4px;
}
.result-block p { margin: 0; font-size: 16px; }
.result-block.specialist p {
  font-size: 20px;
  font-weight: 700;
  color: var(--azul-osc);
}

/* ---- Fundamento científico ---- */
.foundation {
  margin-top: 18px;
  border: 1px solid var(--linea);
  border-radius: 12px;
  background: #fff;
  padding: 0 16px;
}
.foundation summary {
  cursor: pointer;
  padding: 13px 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--azul-osc);
  list-style: none;
}

.foundation[open] summary { border-bottom: 1px solid var(--linea); }
.foundation p {
  margin: 12px 0 14px;
  font-size: 13px;
  color: var(--gris);
  line-height: 1.55;
}
.foundation strong { color: var(--tinta); }

/* ---- Disclaimer ---- */
.disclaimer {
  margin-top: 22px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--gris);
  background: #fff8ec;
  border: 1px solid #f3e2bf;
  border-radius: 12px;
}
.disclaimer strong { color: var(--ambar); }
.metrics-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--gris); text-decoration: underline; opacity: 0.7; }
.metrics-link:hover { color: var(--azul); }

/* ---- Tablero de métricas (Etapa 2) ---- */
.metrics-total { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: var(--azul-osc); }
.m-block { padding: 12px 0; border-top: 1px solid var(--linea); }
.m-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.m-name { flex: 0 0 44%; font-size: 13px; color: var(--tinta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-track { flex: 1; height: 10px; background: #eef3f8; border-radius: 6px; overflow: hidden; }
.m-bar { display: block; height: 100%; background: var(--azul); border-radius: 6px; }
.m-bar.u-eme { background: var(--rojo); }
.m-bar.u-pri { background: var(--ambar); }
.m-bar.u-rut { background: var(--verde); }
.m-val { flex: 0 0 36px; text-align: right; font-weight: 700; font-size: 13px; color: var(--azul-osc); }
.m-n { font-size: 11px; font-weight: 600; color: var(--gris); opacity: 0.8; }

/* ================= Calculadora cardiovascular — alto impacto ================= */
/* Semáforo IMC (verde/amarillo/rojo) con impacto visual. */
.imc-badge {
  margin: 12px 0 4px;
  padding: 14px 16px;
  border-radius: 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 800;
  border: 2px solid;
}
.imc-badge .imc-num { font-size: 30px; line-height: 1; }
.imc-badge .imc-cat { font-size: 15px; font-weight: 700; text-transform: capitalize; }
.sem-verde { background: #e7f7ee; border-color: #1f9d6b; color: #0f6b46; }
.sem-amarillo { background: #fff6e2; border-color: #e0951b; color: #8a5a08; }
.sem-rojo { background: #fdeaea; border-color: #e0443f; color: #a11f1b; }

/* Héroe del riesgo — el número dominante. */
.risk-hero {
  margin: 4px 0 6px;
  padding: 22px 18px;
  border-radius: 18px;
  text-align: center;
  border: 2px solid;
  position: relative;
  overflow: hidden;
}
.risk-hero .risk-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.risk-hero .risk-num { font-size: 60px; font-weight: 900; line-height: 1; margin: 6px 0 2px; letter-spacing: -0.02em; }
.risk-hero .risk-label { font-size: 17px; font-weight: 800; }
.risk-hero .risk-sub { font-size: 13px; font-weight: 600; opacity: 0.9; margin-top: 6px; }
.risk-hero.sem-rojo .risk-num { color: #d02f2a; }
.risk-hero.sem-amarillo .risk-num { color: #c47f10; }
.risk-hero.sem-verde .risk-num { color: #1f9d6b; }
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 68, 63, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(224, 68, 63, 0); }
}
.risk-hero.sem-rojo { animation: pulseRed 1.8s ease-out 2; }

/* Veredicto destacado (HeartTrends manda). */
.verdict {
  margin: 0 0 12px;
  padding: 18px;
  border-radius: 16px;
  border: 2px solid;
}
.verdict h3 { margin: 0 0 6px; font-size: 19px; font-weight: 900; }
.verdict p { margin: 0; font-size: 15px; line-height: 1.5; }
.verdict.sem-rojo, .verdict.sem-amarillo { color: #16212e; }

/* Tarjetas de recomendación por segmento. */
.rec-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin: 10px 0;
  border: 1px solid var(--linea);
  border-left: 4px solid var(--acento);
  border-radius: 12px;
  background: #f7fbfd;
}
.rec-card .rec-ico { flex: 0 0 auto; width: 26px; height: 26px; color: var(--azul-osc); }
.rec-card .rec-ico svg { width: 100%; height: 100%; display: block; }
.rec-card.rec-priority { border-left-color: var(--rojo); background: #fdf2f2; }
.rec-card .rec-titulo { margin: 0 0 3px; font-size: 16px; font-weight: 800; color: var(--azul-osc); }
.rec-card .rec-consejo { margin: 0 0 6px; font-size: 14px; color: var(--tinta); }
.rec-card .rec-ref { margin: 0; font-size: 11px; color: var(--gris); font-style: italic; }
.rec-card .rec-cta { width: 100%; margin: 4px 0 10px; font-size: 15px; }

/* Botones de compartir grandes (WhatsApp, PDF). */
.share-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.share-btn {
  flex: 1 1 46%;
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
}
.share-btn:active { transform: scale(0.98); }
.share-btn:hover { filter: brightness(0.94); }
.share-wa { background: #25d366; color: #073a17; }
.share-doc { background: var(--azul); }
.share-pdf { background: #51637a; }
.share-hint { margin: 4px 0 0; font-size: 12px; color: var(--gris); }

/* ── La barra de avance ──────────────────────────────────────────────────
   Los pasos numerados dicen dónde está uno; la barra dice cuánto falta,
   que es lo que sostiene a la persona hasta el final del cuestionario. */
.prog-riel {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(10, 27, 51, .1); margin-bottom: 6px;
}
.prog-lleno {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #FC6000, #FF8A3D);
  transition: width .45s cubic-bezier(.4, .05, .2, 1);
}
.prog-cuenta {
  margin: 0 0 10px; font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: #6B7A90;
}

/* ── Las tres líneas y el corazón de marca ───────────────────────────────
   El mismo lenguaje del resto del sitio, pero con estilos propios: traer
   la hoja completa del sitio rompía los botones de la calculadora. */
.bs-menu {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 10px; flex: none;
  border: 1px solid rgba(10, 27, 51, .16); border-radius: 12px;
  background: #fff; text-decoration: none;
}
.bs-menu span { display: block; height: 2px; width: 100%; border-radius: 2px; background: #0A1B33; }
.bs-menu:hover { border-color: #FC6000; }
.bs-menu:focus-visible { outline: 2px solid #FC6000; outline-offset: 2px; }
.bs-corazon { width: 26px; height: 26px; flex: none; animation: bsLatido 1s ease-in-out infinite; }
@keyframes bsLatido {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.16); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  56% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .bs-corazon { animation: none; } }

/* ── El avance siempre a la vista ────────────────────────────────────────
   La barra se queda pegada bajo la cabecera mientras se recorre el
   cuestionario: saber cuánto falta es lo que sostiene a la persona hasta
   el final. Predecible y sin sorpresas, que es lo que el cerebro premia. */
.progreso {
  /* El encabezado del sitio mide 4.5rem, y 4rem bajo 30rem de ancho
     (mismo quiebre que base.css): con top de 56px la tira quedaba
     parcialmente debajo y "Paso X de 5" se cortaba (fix 12-ago). */
  position: sticky; top: 4.5rem; z-index: 40;
  padding: 16px 0 6px; margin-top: 0;
  background: linear-gradient(180deg, var(--fondo, #F7F5F1) 82%, transparent);
  backdrop-filter: blur(6px);
}
@media (max-width: 30rem) { .progreso { top: 4rem; } }

/* ── El resultado: el número manda ───────────────────────────────────────
   Cuenta hasta su valor con CSS puro, el marco de luz gira alrededor y el
   color obedece al semáforo: verde bajo, ámbar intermedio, rojo alto. El
   bloque ocupa la pantalla: al abrirlo no compite con nada. */
@property --rn-n { syntax: "<integer>"; initial-value: 0; inherits: false; }
@property --rn-giro { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

.risk-hero {
  position: relative; isolation: isolate;
  min-height: 54vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 32px 22px; border-radius: 22px; text-align: center;
}
/* El marco de luz recorre el borde, en el color del semáforo */
.risk-hero::before {
  content: ""; position: absolute; inset: 0; padding: 3px;
  border-radius: inherit; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 170deg, var(--sem-suave) 250deg,
      var(--sem-fuerte) 300deg, var(--sem-suave) 335deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  filter: drop-shadow(0 0 8px var(--sem-suave));
  animation: rnGira 2.8s linear infinite;
}
@keyframes rnGira { to { --rn-giro: 360deg; } }

.risk-hero.sem-verde {
  --sem-fuerte: #07894A; --sem-suave: rgba(16,200,110,.85);
  background: linear-gradient(160deg, #86EFB8 0%, #C6F7DD 55%, #EEFCF4 100%);
}
.risk-hero.sem-amarillo {
  --sem-fuerte: #C96A00; --sem-suave: rgba(255,168,0,.85);
  background: linear-gradient(160deg, #FFC845 0%, #FFE08A 55%, #FFF1C4 100%);
}
.risk-hero.sem-rojo {
  --sem-fuerte: #C62828; --sem-suave: rgba(255,82,70,.85);
  background: linear-gradient(160deg, #FFB3AB 0%, #FFD3CE 55%, #FFF0EE 100%);
}
/* El número, con un punto más de cuerpo para que el color se lea */
.risk-num { text-shadow: 0 2px 0 rgba(255,255,255,.6); }
.risk-label { opacity: .95; }

.risk-kicker { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #6B7A90; }
.risk-num {
  margin: 6px 0 0; display: flex; align-items: baseline; justify-content: center; gap: 2px;
  font-family: Jost, system-ui, sans-serif; font-weight: 700; line-height: 1;
  font-size: clamp(5.5rem, 26vw, 9rem); color: var(--sem-fuerte);
  font-variant-numeric: tabular-nums;
}
.rn { display: inline-grid; }
.rn > .rn-v, .rn::after { grid-area: 1 / 1; }
.rn { counter-reset: rn var(--rn-n); }
.rn::after { content: counter(rn); opacity: 0; }
.rn-u { font-size: .42em; font-weight: 600; }
/* Cuenta al aparecer: primero el contador, y al final el número real */
.risk-hero .rn { animation: rnSube 1.5s ease-out forwards; }
.risk-hero .rn > .rn-v { animation: rnEntrega 1.5s steps(1, end) forwards; }
.risk-hero .rn::after { animation: rnCede 1.5s steps(1, end) forwards; }
@keyframes rnSube { from { --rn-n: 0; } to { --rn-n: var(--rn-to, 0); } }
@keyframes rnEntrega { from, 99% { opacity: 0; } to { opacity: 1; } }
@keyframes rnCede { from, 99% { opacity: 1; } to { opacity: 0; } }

.risk-label { margin: 4px 0 0; font-size: 15px; font-weight: 800;
  letter-spacing: .12em; color: var(--sem-fuerte); }
.risk-sub { margin: 10px 0 0; font-size: 15.5px; line-height: 1.5; color: #3B4A60; max-width: 30ch; }

@media (prefers-reduced-motion: reduce) {
  .risk-hero::before { animation: none; }
  .risk-hero .rn, .risk-hero .rn > .rn-v, .risk-hero .rn::after { animation: none; }
  .risk-hero .rn > .rn-v { opacity: 1; }
  .risk-hero .rn::after { opacity: 0; }
}

/* ── La nota del cálculo, con peso ───────────────────────────────────────
   Es una advertencia sobre la certeza del dato: si se lee como letra
   pequeña, nadie la atiende. Borde de color, cifras en negrita y aire. */
.nota-estimada {
  margin-top: 18px; padding: 16px 18px;
  border-radius: 14px; border: 1px solid rgba(229,138,0,.38);
  border-left: 5px solid #C96A00;
  background: linear-gradient(180deg, #FFE7A8, #FFF7E0);
  font-size: 15px; line-height: 1.6; color: #4A3A20;
}
.nota-estimada strong { color: #7A4A00; font-weight: 700; }
.nota-estimada b { font-weight: 700; }

/* ── El plan: seis cartas que entran una tras otra ───────────────────────
   Cada una con el color de su frente —el corazón siempre rojo—, su marco
   de luz y el enlace a la perla que desarrolla el tema. Entran escalonadas
   para que el plan se lea como una secuencia y no como un muro. */
.rec-card { position: relative; isolation: isolate; --rec-color: #FC6000; }
.rec-card::before {
  content: ""; position: absolute; inset: 0; padding: 2px;
  border-radius: inherit; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 190deg,
      color-mix(in oklab, var(--rec-color) 45%, transparent) 265deg,
      var(--rec-color) 305deg,
      color-mix(in oklab, var(--rec-color) 45%, transparent) 335deg,
      transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  filter: drop-shadow(0 0 5px color-mix(in oklab, var(--rec-color) 45%, transparent));
  animation: rnGira 3.2s linear infinite;
}
.rec-ico { color: var(--rec-color); }
.rec-ico svg { width: 26px; height: 26px; }
.rec-titulo { color: #0A1B33; }

.rec-anima { animation: recEntra .5s cubic-bezier(.2,.7,.3,1) backwards; animation-delay: calc(var(--rec-i, 0) * 90ms); }
@keyframes recEntra { from { opacity: 0; transform: translateY(14px); } }

.rec-perla {
  display: inline-block; margin-top: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
  color: var(--rec-color); text-decoration: none;
  border-bottom: 1.5px solid color-mix(in oklab, var(--rec-color) 40%, transparent);
}
.rec-perla:hover { border-bottom-color: var(--rec-color); }

@media (prefers-reduced-motion: reduce) {
  .rec-card::before { animation: none; }
  .rec-anima { animation: none; }
}

/* ── Los botones de compartir, con su marco de luz ───────────────────────
   Es el momento en que la persona decide pasar el dato a alguien más: el
   botón tiene que pedirlo. El de WhatsApp mantiene su verde. */
.share-btn { position: relative; isolation: isolate; overflow: visible; }
.share-btn::after {
  content: ""; position: absolute; inset: 0; padding: 2px;
  border-radius: inherit; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 185deg,
      rgba(255,255,255,.35) 260deg, rgba(255,255,255,.95) 305deg,
      rgba(255,255,255,.35) 335deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: rnGira 2.8s linear infinite;
}
/* En los claros el haz va en naranja de marca, que sobre blanco sí se ve */
.share-doc::after, .share-pdf::after {
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 185deg,
      rgba(252,96,0,.35) 260deg, #FC6000 305deg,
      rgba(252,96,0,.35) 335deg, transparent 360deg);
  filter: drop-shadow(0 0 5px rgba(252,96,0,.4));
}
@media (prefers-reduced-motion: reduce) { .share-btn::after { animation: none; } }

/* ── Los botones secundarios, con vida ───────────────────────────────────
   'Resumen para el especialista' y 'Empezar de nuevo' quedaban planos,
   como si no fueran parte del mismo sistema. Marco de luz sobrio y el
   texto con peso: siguen siendo secundarios, pero no invisibles. */
.btn-secondary, .result-summary {
  position: relative; isolation: isolate; font-weight: 700 !important;
}
.btn-secondary::after, .result-summary::after {
  content: ""; position: absolute; inset: 0; padding: 2px;
  border-radius: inherit; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 200deg,
      rgba(252,96,0,.25) 268deg, rgba(252,96,0,.85) 306deg,
      rgba(252,96,0,.25) 336deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: rnGira 3.4s linear infinite;
}
/* El haz también en los botones grandes del cierre de la página */
.calc-cierre__btn, .niv-teaser__btn { position: relative; isolation: isolate; }
.calc-cierre__btn::after, .niv-teaser__btn::after {
  content: ""; position: absolute; inset: 0; padding: 2.5px;
  border-radius: inherit; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--rn-giro),
      transparent 0deg 185deg,
      rgba(255,255,255,.35) 262deg, #fff 305deg,
      rgba(255,255,255,.35) 336deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  filter: drop-shadow(0 0 7px rgba(255,255,255,.8));
  animation: rnGira 2.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .btn-secondary::after, .result-summary::after,
  .calc-cierre__btn::after, .niv-teaser__btn::after { animation: none; }
}

/* ── El plan, con color y aire ───────────────────────────────────────────
   Los iconos tomaban el azul del tema y perdían identidad; ahora cada uno
   lleva el color de su factor, en un círculo que lo hace legible. Y el
   texto respira: pegado no se lee, por más bien escrito que esté. */
.rec-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 18px 20px !important; margin-bottom: 14px !important;
  border-radius: 16px;
}
.rec-card .rec-ico {
  width: 46px !important; height: 46px !important; flex: 0 0 46px;
  display: grid; place-items: center; border-radius: 14px;
  color: #fff !important;
  background: var(--rec-color);
  box-shadow: 0 6px 16px -6px var(--rec-color);
}
.rec-card .rec-ico svg { width: 25px !important; height: 25px !important; }
.rec-card .rec-titulo {
  margin: 2px 0 6px !important; font-size: 17px !important;
  color: var(--rec-color) !important; letter-spacing: -.01em;
}
.rec-card .rec-consejo { margin: 0 0 10px !important; font-size: 14.5px !important; line-height: 1.55; }
.rec-card .rec-ref { margin-top: 4px !important; line-height: 1.45; }
.rec-card .rec-cta { margin: 10px 0 6px !important; }
.rec-card.rec-priority { background: linear-gradient(160deg, #FFE3E0 0%, #FFF4F3 60%) !important; }

/* El botón verde: telefonito blanco y su marco de luz, bien contrastado */
.share-wa, .rec-cta.share-wa {
  color: #fff !important; font-weight: 800 !important;
}
.share-wa svg, .rec-cta.share-wa svg { fill: #fff !important; color: #fff !important; }
.share-wa::after { filter: drop-shadow(0 0 6px rgba(255,255,255,.85)); }

/* ── Corrección de encabezado en móvil (15-ago-2026) ──────────────────────
   .brand-text es un elemento flexible con min-width:auto, por lo que se
   negaba a encogerse por debajo de su contenido y empujaba el documento a
   578px en una ventana de 390px. El defecto venía de la versión anterior.
   Se corrige aquí, en el CSS propio de la calculadora: jamás importar el
   base.css del sitio, que pisa estas reglas y rompe los botones.          */
.brand { flex-wrap: wrap; }
.brand-text { min-width: 0; flex: 1 1 auto; }
.brand-text h1,
.brand-sub { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .brand-text h1 { font-size: 18px; line-height: 1.2; }
  .brand-sub { letter-spacing: 0.04em; }
}

/* .brand-found traía white-space:nowrap, que impedía envolver
   "Dr. Christian Rivera — Curridabat, Costa Rica" y era la causa final
   del desborde horizontal por debajo de 768px. Se permite envolver solo
   en pantallas angostas; en escritorio conserva su línea única.          */
@media (max-width: 767px) {
  .brand-found { white-space: normal; }
}
