/* =============================================================
   PesoJusto — Calculadora de IMC
   Registro visual: informe clínico. Azul frío, filetes de 1 px,
   mono para unidades y etiquetas, escala de referencia.
   1. Tokens
   ============================================================= */
:root {
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-2: #e6eef3;
  --ink: #0c2430;
  --ink-2: #42606e;
  --ink-3: #7793a1;
  --line: #d3e0e8;
  --line-2: #b6cad6;

  --accent: #0a7ea4;
  --accent-dark: #06617f;
  --accent-soft: #e0f0f7;

  /* Escala de riesgo — semántica, independiente del color de marca */
  --lvl-normal:   #12805f;
  --lvl-under-1:  #b8860b;
  --lvl-under-2:  #d9661f;
  --lvl-under-3:  #c62f36;
  --lvl-over:     #b8860b;
  --lvl-obese-1:  #d9661f;
  --lvl-obese-2:  #c62f36;
  --lvl-obese-3:  #9c1c23;
  --lvl-none:     #7793a1;

  --err-bg: #fbeaea;
  --err-ink: #8c1f24;
  --warn-bg: #fdf4e0;
  --warn-ink: #6b4d00;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(12, 36, 48, .04);
  --shadow-md: 0 1px 3px rgba(12, 36, 48, .06), 0 8px 24px rgba(12, 36, 48, .05);
  --shadow-lg: 0 4px 12px rgba(12, 36, 48, .10), 0 24px 56px rgba(12, 36, 48, .14);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1120px;
}

/* Modo oscuro. Se define dos veces a propósito: por preferencia del sistema
   (salvo que se haya elegido claro a mano) y por elección explícita. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08161d;
    --surface: #0f2029;
    --surface-2: #162d38;
    --ink: #e6f0f5;
    --ink-2: #a3bcc8;
    --ink-3: #74909e;
    --line: #1e3843;
    --line-2: #2c4c59;
    --accent: #2ba5cd;
    --accent-dark: #1d90b6;
    --accent-soft: #0d2c39;
    --lvl-normal: #1fa87d;
    --lvl-under-1: #d9a520;
    --lvl-over: #d9a520;
    --lvl-under-2: #ef8340;
    --lvl-obese-1: #ef8340;
    --lvl-under-3: #e35a60;
    --lvl-obese-2: #e35a60;
    --lvl-obese-3: #c23d43;
    --err-bg: #2a1315;
    --err-ink: #ffb3b6;
    --warn-bg: #2a2410;
    --warn-ink: #f0d590;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.45), 0 24px 56px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg: #08161d;
  --surface: #0f2029;
  --surface-2: #162d38;
  --ink: #e6f0f5;
  --ink-2: #a3bcc8;
  --ink-3: #74909e;
  --line: #1e3843;
  --line-2: #2c4c59;
  --accent: #2ba5cd;
  --accent-dark: #1d90b6;
  --accent-soft: #0d2c39;
  --lvl-normal: #1fa87d;
  --lvl-under-1: #d9a520;
  --lvl-over: #d9a520;
  --lvl-under-2: #ef8340;
  --lvl-obese-1: #ef8340;
  --lvl-under-3: #e35a60;
  --lvl-obese-2: #e35a60;
  --lvl-obese-3: #c23d43;
  --err-bg: #2a1315;
  --err-ink: #ffb3b6;
  --warn-bg: #2a2410;
  --warn-ink: #f0d590;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.45), 0 24px 56px rgba(0,0,0,.5);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Etiqueta técnica: mayúsculas en mono. El recurso que da el aire clínico. */
.lbl {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
}

/* =============================================================
   3. Utilities
   ============================================================= */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: 760px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 56px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; }
.logo-mark { width: 26px; height: 26px; color: var(--accent); }
.logo-text { font-weight: 400; font-size: 1.1rem; letter-spacing: -0.02em; }
.logo-text strong { font-weight: 600; }
.site-nav {
  display: none; gap: 1.5rem; font-family: var(--mono);
  font-size: .76rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-2);
}
.site-nav a { transition: color .2s var(--ease-out); }
.site-nav a:hover { color: var(--accent); }
@media (min-width: 720px) { .site-nav { display: flex; } }

/* =============================================================
   5. Hero + ficha de la herramienta
   ============================================================= */
.hero { padding: clamp(1.1rem, 4vw, 2.75rem) 0 1rem; }
.hero h1 {
  font-size: clamp(1.85rem, 6vw, 2.9rem);
  font-weight: 600;
  margin-bottom: .5rem;
}
.hero-sub {
  color: var(--ink-2);
  font-size: clamp(.95rem, 2.4vw, 1.05rem);
  max-width: 64ch;
  margin-bottom: clamp(1rem, 3vw, 1.6rem);
}
.hero-sub strong { color: var(--ink); font-weight: 600; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
/* Cabecera de ficha: la franja que convierte la tarjeta en un informe. */
.tool-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .55rem clamp(.9rem, 3.2vw, 1.75rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tool-head-title { display: inline-flex; align-items: center; gap: .5rem; }
.tool-head-title svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.tool-head-title span {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .11em; color: var(--ink-2);
}
.tool-head-meta { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); letter-spacing: .04em; }
@media (max-width: 480px) {
  .tool-head-title span { font-size: .66rem; letter-spacing: .07em; }
  .tool-head-meta { font-size: .64rem; }
  .head-norma { display: none; }
  .tool-head { gap: .5rem; }
}

.tool-body { padding: clamp(.9rem, 3.2vw, 1.75rem); }

.noscript-note {
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--ink); padding: 1rem; border-radius: var(--radius);
  font-weight: 500; margin-bottom: 1rem;
}

/* En móvil: primero la lectura (el visitante ve la herramienta funcionando),
   justo debajo los campos, y al final el detalle y los botones.
   En escritorio: dos columnas, campos a la izquierda. */
.tool-grid { display: grid; gap: clamp(1.1rem, 3vw, 2rem); }
.tool-readout { order: 1; }
.tool-inputs { order: 2; display: grid; gap: 1rem; }
.tool-extra { order: 3; }

@media (min-width: 900px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-areas: "campos lectura" "campos detalle";
    align-content: start;
    column-gap: clamp(1.5rem, 3.5vw, 2.75rem);
    row-gap: 0;
  }
  .tool-inputs { grid-area: campos; align-content: start; }
  .tool-readout { grid-area: lectura; }
  .tool-extra { grid-area: detalle; }
  /* Filete vertical de separación entre datos y lectura, como en un parte */
  .tool-readout { padding-left: clamp(1.5rem, 3.5vw, 2.75rem); border-left: 1px solid var(--line); }
  .tool-extra { padding-left: clamp(1.5rem, 3.5vw, 2.75rem); border-left: 1px solid var(--line); }
}

/* ---- Campos ---- */
.units {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.unit-btn {
  padding: .38rem .7rem; border-radius: 4px;
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.unit-btn.is-active { background: var(--surface); color: var(--accent-dark); box-shadow: var(--shadow-sm); }

.field { border: 0; padding: 0; min-width: 0; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .45rem; }
.field label, .field legend {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
}
.field legend { margin-bottom: .45rem; padding: 0; }
.field-help { font-size: .77rem; color: var(--ink-3); margin-top: .4rem; line-height: 1.45; }

.value-box {
  display: inline-flex; align-items: baseline; gap: .3rem;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: .26rem .55rem;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.value-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.value-box input {
  width: 4rem; border: 0; background: none; color: var(--ink);
  font: 600 1.18rem/1.25 var(--mono); font-variant-numeric: tabular-nums;
  text-align: right; padding: 0; -moz-appearance: textfield;
}
.value-box input::-webkit-outer-spin-button,
.value-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.value-box input:focus { outline: none; }
.value-box--dual input { width: 2.4rem; }
.unit-label { font-family: var(--mono); font-size: .74rem; font-weight: 500; color: var(--ink-3); }

/* Deslizadores */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; background: none; cursor: pointer; display: block;
}
.slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: var(--line);
}
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; margin-top: -8px;
  border-radius: 50%; background: var(--surface);
  border: 5px solid var(--accent);
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease-out);
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 5px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.slider:active::-webkit-slider-thumb { transform: scale(1.12); }

/* Sexo */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .65rem .5rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 500; font-size: .9rem; color: var(--ink-2);
  transition: all .2s var(--ease-out);
}
.seg span svg { width: 17px; height: 17px; flex: none; }
.seg:hover span { border-color: var(--accent); }
.seg input:checked + span {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent-dark); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.seg input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.tool-error {
  background: var(--err-bg); border-left: 3px solid var(--lvl-under-3); color: var(--err-ink);
  padding: .65rem .85rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .86rem; font-weight: 500;
}

/* ---- Media luna ---- */
.gauge-wrap { position: relative; margin: 0 auto; max-width: 380px; }
.gauge { width: 100%; height: auto; overflow: visible; }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 18; stroke-linecap: round; }
.gauge-fill {
  fill: none; stroke-width: 18; stroke-linecap: round;
  transition: stroke-dasharray .55s var(--ease-out);
}
.gauge-tick { stroke: var(--line-2); stroke-width: 1.5; }
.gauge-dot {
  fill: var(--surface); stroke: var(--ink); stroke-width: 4;
  transition: cx .55s var(--ease-out), cy .55s var(--ease-out), stroke .35s var(--ease-out);
}
.gauge-end { fill: var(--ink-3); font: 500 13px var(--mono); }

.gauge-center {
  position: absolute; left: 50%; bottom: 13%;
  transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
.score {
  display: block; font-family: var(--mono);
  font-size: clamp(2.7rem, 11vw, 3.9rem); font-weight: 600;
  line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.score-max {
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase;
}

/* Estado: chip clínico con barra de severidad a la izquierda */
.badge {
  display: block; text-align: center; margin: .7rem auto .7rem;
  padding: .48rem 1.05rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: clamp(.92rem, 3vw, 1.05rem);
  letter-spacing: -0.01em;
  width: fit-content; max-width: 100%;
  color: #fff; background: var(--lvl-none);
  transition: background .35s var(--ease-out);
}
.badge[data-level="normal"]  { background: var(--lvl-normal); }
.badge[data-level="under-1"] { background: var(--lvl-under-1); }
.badge[data-level="under-2"] { background: var(--lvl-under-2); }
.badge[data-level="under-3"] { background: var(--lvl-under-3); }
.badge[data-level="over"]    { background: var(--lvl-over); }
.badge[data-level="obese-1"] { background: var(--lvl-obese-1); }
.badge[data-level="obese-2"] { background: var(--lvl-obese-2); }
.badge[data-level="obese-3"] { background: var(--lvl-obese-3); }

.imc-line {
  display: flex; align-items: baseline; justify-content: center; gap: .45rem;
  padding-bottom: .7rem;
}
.imc-label {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em; color: var(--ink-3);
}
.imc-value {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.imc-unit { font-family: var(--mono); font-size: .76rem; font-weight: 500; color: var(--ink-3); }

/* ---- Barra de intervalo de referencia (recurso de informe de laboratorio) ---- */
.refbar { padding-top: .75rem; border-top: 1px solid var(--line); }
.refbar-caption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-bottom: 1.3rem;
}
.refbar-caption .lbl { white-space: nowrap; }
.refbar-caption b {
  font-family: var(--mono); font-size: .74rem; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.refbar-track {
  position: relative; display: flex; height: 12px;
  border-radius: 2px; overflow: visible;
}
.refbar-seg { display: block; height: 100%; }
.refbar-seg:first-child { border-radius: 2px 0 0 2px; }
.refbar-seg:last-child { border-radius: 0 2px 2px 0; }
.refbar-seg[data-level="under-1"] { background: var(--lvl-under-1); }
.refbar-seg[data-level="normal"]  { background: var(--lvl-normal); }
.refbar-seg[data-level="over"]    { background: var(--lvl-over); }
.refbar-seg[data-level="obese-1"] { background: var(--lvl-obese-1); }
.refbar-seg[data-level="obese-2"] { background: var(--lvl-obese-2); }
/* El corchete que marca TU intervalo saludable (cambia con la edad) */
.refbar-range {
  position: absolute; top: -7px; height: 26px;
  border: 2px solid var(--ink); border-radius: 3px;
  background: color-mix(in srgb, var(--surface) 25%, transparent);
  transition: left .45s var(--ease-out), width .45s var(--ease-out);
  pointer-events: none;
}
.refbar-marker {
  position: absolute; top: -13px; width: 2px; height: 32px;
  background: var(--ink); transform: translateX(-1px);
  transition: left .45s var(--ease-out);
}
.refbar-marker::after {
  content: ""; position: absolute; top: -7px; left: 50%;
  width: 0; height: 0; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid var(--ink);
}
.refbar-scale { position: relative; height: 1.2rem; margin-top: .5rem; }
.refbar-scale span {
  position: absolute; top: 0; transform: translateX(-50%);
  font-family: var(--mono); font-size: .66rem; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.minor-note {
  margin-top: .85rem; padding: .7rem .9rem;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .845rem; line-height: 1.5; color: var(--ink-2);
}

/* Filas de detalle: tabla de resultados, no tarjetas */
.details { display: grid; margin-top: .9rem; border-top: 1px solid var(--line); }
.detail {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line); min-width: 0;
}
.detail dt {
  font-family: var(--mono); font-size: .69rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
}
.detail dd {
  font-family: var(--mono); font-size: .92rem; font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: right;
  overflow-wrap: anywhere;
}

/* Botones */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .89rem;
  transition: transform .18s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); flex: 1 1 auto; }
.btn--primary:hover { background: var(--accent-dark); box-shadow: var(--shadow-md); }
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn--link { color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; padding: .7rem .5rem; font-size: .84rem; font-weight: 500; }
.btn--link:hover { color: var(--ink); }

.privacy-badge {
  display: flex; gap: .65rem; align-items: flex-start;
  margin-top: 1.4rem; padding-top: 1.15rem; border-top: 1px solid var(--line);
  font-size: .855rem; color: var(--ink-2); line-height: 1.55;
}
.privacy-badge svg { width: 19px; height: 19px; flex: none; color: var(--accent); margin-top: 2px; }
.privacy-badge strong { color: var(--ink); font-weight: 600; }
.medical-note {
  margin-top: .65rem; font-size: .775rem; color: var(--ink-3); line-height: 1.5;
  padding-left: calc(19px + .65rem);
}

/* =============================================================
   6. Huecos de publicidad (placeholders)
   ============================================================= */
.ad-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  color: var(--ink-3); text-align: center; padding: 1rem;
}
.ad-tag { font-family: var(--mono); font-size: .68rem; font-weight: 600; letter-spacing: .22em; color: var(--ink-3); }
.ad-size { font-family: var(--mono); font-size: .65rem; color: var(--ink-3); opacity: .7; }
.ad-slot--leaderboard { min-height: 106px; margin: clamp(1.5rem, 4vw, 2.5rem) 0 0; }
.ad-slot--incontent { min-height: 260px; margin: clamp(1.5rem, 4vw, 2.5rem) 0; }
.ad-slot--interstitial { min-height: 230px; width: 100%; margin: .85rem 0 1rem; }
.ad-slot--corner { min-height: 84px; width: 100%; padding: .55rem; }

/* Pop-up */
.interstitial {
  border: 0; padding: 0; background: none; max-width: 380px; width: calc(100% - 2rem);
  border-radius: var(--radius-lg); color: var(--ink);
}
.interstitial::backdrop { background: rgba(6, 22, 30, .6); backdrop-filter: blur(3px); }
.interstitial-inner {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 1.3rem 1.2rem 1.2rem;
}
.interstitial-close {
  position: absolute; top: .55rem; right: .55rem;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--surface-2); transition: background .2s var(--ease-out);
}
.interstitial-close:hover { background: var(--line); color: var(--ink); }
.interstitial-close svg { width: 16px; height: 16px; }
.interstitial-title { font-weight: 600; font-size: .97rem; padding-right: 2.2rem; }
.interstitial-preview { margin: .85rem 0 0; }
.interstitial-preview[hidden] { display: none; }
.interstitial-preview img {
  width: 100%; max-height: 200px; object-fit: contain; object-position: top;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.interstitial-preview figcaption { font-size: .74rem; color: var(--ink-3); margin-top: .4rem; line-height: 1.45; }
.interstitial-continue { width: 100%; }

/* Aviso de esquina */
.corner-ad {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 70;
  width: min(300px, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem;
  animation: cornerIn .45s var(--ease-out) both;
}
.corner-ad[hidden] { display: none; }
@keyframes cornerIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.corner-close {
  position: absolute; top: -9px; right: -9px;
  width: 25px; height: 25px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-sm);
}
.corner-close svg { width: 13px; height: 13px; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: .65rem 1.15rem; border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .8rem; font-weight: 500; z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* =============================================================
   7. Secciones
   ============================================================= */
.section { padding: clamp(2.5rem, 7vw, 4.25rem) 0; }
.section h2 { font-size: clamp(1.45rem, 4.2vw, 2rem); margin-bottom: .5rem; }
.section-sub { color: var(--ink-2); max-width: 64ch; margin-bottom: clamp(1.5rem, 4vw, 2.25rem); }

/* Pasos */
.steps { list-style: none; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 780px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 3px solid var(--accent);
  padding: 1.35rem 1.25rem 1.2rem;
}
.step-num {
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .12em; color: var(--accent); display: block; margin-bottom: .6rem;
}
.step-icon { width: 24px; height: 24px; color: var(--ink-3); margin-bottom: .6rem; }
.step h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.step p { font-size: .91rem; color: var(--ink-2); }

/* Texto */
.section--prose { background: var(--surface); border-block: 1px solid var(--line); }
.section--prose p { margin-bottom: 1rem; color: var(--ink-2); }
.section--prose strong { color: var(--ink); font-weight: 600; }
.section--prose h3 { font-size: clamp(1.1rem, 3.2vw, 1.35rem); margin: 2.25rem 0 .7rem; scroll-margin-top: 5rem; }
.section--prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.formula {
  background: var(--surface-2); border-left: 3px solid var(--accent);
  padding: .85rem 1.05rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--mono); font-size: .95rem; color: var(--ink) !important;
}
.formula strong { font-weight: 600; }
.prose-list { padding-left: 1.15rem; margin-bottom: 1rem; color: var(--ink-2); }
.prose-list li { margin-bottom: .5rem; }

.table-scroll { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); }
.imc-table { width: 100%; border-collapse: collapse; font-size: .89rem; min-width: 520px; }
.imc-table caption {
  caption-side: top; text-align: left; padding: .8rem 1rem;
  font-family: var(--mono); font-size: .69rem; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
}
.imc-table th, .imc-table td { padding: .65rem 1rem; text-align: left; border-top: 1px solid var(--line); }
.imc-table thead th {
  background: var(--surface-2); border-top: 0;
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
}
.imc-table tbody td:first-child { font-family: var(--mono); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.imc-table tbody td:nth-child(2) { font-weight: 600; }
.imc-table tbody td:last-child { color: var(--ink-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .55rem; vertical-align: 1px; background: var(--lvl-none); }
.dot[data-level="normal"]  { background: var(--lvl-normal); }
.dot[data-level="under-1"] { background: var(--lvl-under-1); }
.dot[data-level="under-2"] { background: var(--lvl-under-2); }
.dot[data-level="under-3"] { background: var(--lvl-under-3); }
.dot[data-level="over"]    { background: var(--lvl-over); }
.dot[data-level="obese-1"] { background: var(--lvl-obese-1); }
.dot[data-level="obese-2"] { background: var(--lvl-obese-2); }
.dot[data-level="obese-3"] { background: var(--lvl-obese-3); }

/* Tarjetas */
.cards { display: grid; gap: 1rem; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem 1.2rem;
  transition: border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { width: 24px; height: 24px; color: var(--accent); margin-bottom: .7rem; }
.card h3 { font-size: 1.02rem; margin-bottom: .3rem; }
.card p { font-size: .9rem; color: var(--ink-2); }

/* FAQ */
.faq {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: .5rem; overflow: hidden;
}
.faq summary {
  cursor: pointer; list-style: none; padding: .95rem 3rem .95rem 1.1rem;
  font-weight: 600; font-size: .95rem; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 1.2rem; top: 50%;
  width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform .25s var(--ease-out);
}
.faq[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq[open] summary { color: var(--accent-dark); }
.faq summary:hover { color: var(--accent); }
.faq-body { padding: 0 1.1rem 1.1rem; font-size: .92rem; color: var(--ink-2); }
.faq-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Otras herramientas */
.tool-links { display: grid; gap: .5rem; }
@media (min-width: 640px) { .tool-links { grid-template-columns: repeat(2, 1fr); } }
.tool-link {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; font-weight: 500; font-size: .93rem;
}
.tool-link em {
  font-style: normal; font-family: var(--mono); font-size: .66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
  background: var(--surface-2); padding: .2rem .5rem; border-radius: 3px; flex: none;
}
.tool-link.is-soon { color: var(--ink-3); }

/* =============================================================
   8. Pie
   ============================================================= */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: clamp(2rem, 5vw, 3rem) 0 1.5rem; }
.footer-inner { display: grid; gap: 1.5rem; }
@media (min-width: 720px) { .footer-inner { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.footer-brand p { font-size: .87rem; color: var(--ink-2); margin-top: .4rem; max-width: 46ch; }
.footer-nav {
  display: grid; gap: .5rem; font-family: var(--mono); font-size: .76rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
}
.footer-nav a:hover { color: var(--accent); }
.footer-legal {
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .75rem 2rem; justify-content: space-between;
  font-size: .77rem; color: var(--ink-3);
}
.footer-legal p:first-child { max-width: 68ch; }

/* Páginas legales */
.legal { padding: clamp(2rem, 6vw, 3.5rem) 0; }
.legal h1 { font-size: clamp(1.65rem, 5vw, 2.3rem); margin-bottom: 1rem; }
.legal h2 { font-size: clamp(1.1rem, 3.2vw, 1.35rem); margin: 2rem 0 .6rem; }
.legal p, .legal li { color: var(--ink-2); margin-bottom: .8rem; }
.legal ul { padding-left: 1.15rem; }
.legal .todo {
  background: var(--warn-bg); border-left: 3px solid var(--lvl-under-1); color: var(--warn-ink);
  padding: .8rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .87rem; font-weight: 500;
}
.legal-back { display: inline-block; margin-top: 2rem; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* =============================================================
   9. Movimiento reducido — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .corner-ad { animation: none; }
  .gauge-fill, .gauge-dot, .refbar-marker, .refbar-range { transition: none; }
}

/* =============================================================
   10. Componentes de las demás calculadoras
   ============================================================= */

/* Etiqueta de grupo cuando no hay <fieldset> */
.field-legend {
  display: block; margin-bottom: .5rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
}

/* Selectores tipo chip (actividad, objetivo, unidades de medida) */
.chips { display: grid; gap: .4rem; }
.chips--row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 540px) { .chips--row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
  width: 100%; text-align: left;
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 500; font-size: .88rem; color: var(--ink-2);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), color .2s var(--ease-out);
}
.chips--row .chip { align-items: center; text-align: center; font-size: .82rem; padding: .5rem .4rem; }
.chip em {
  font-style: normal; font-family: var(--mono);
  font-size: .66rem; letter-spacing: .03em; color: var(--ink-3);
}
.chip:hover { border-color: var(--accent); }
.chip.is-active {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent-dark); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.chip.is-active em { color: var(--accent-dark); opacity: .8; }

/* Lectura principal: un número grande en lugar de la media luna */
.big-label {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em; color: var(--ink-3);
  text-align: center;
}
.big-number {
  display: flex; align-items: baseline; justify-content: center; gap: .4rem;
  margin: .2rem 0 .1rem;
  font-family: var(--mono); font-weight: 600;
  font-size: clamp(2.8rem, 11vw, 4rem); line-height: 1.05;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
.big-unit { font-size: .3em; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.big-sub {
  text-align: center; font-size: .87rem; color: var(--ink-2);
  padding-bottom: .9rem;
}
.big-sub strong { font-family: var(--mono); font-weight: 600; color: var(--ink); }

/* Barra de macronutrientes */
.macros { padding-top: .75rem; border-top: 1px solid var(--line); }
.macro-bar {
  display: flex; height: 14px; border-radius: 2px; overflow: hidden;
  background: var(--surface-2);
}
.macro-seg { display: block; height: 100%; transition: width .45s var(--ease-out); }
.macro-seg[data-macro="prote"], .macro-dot[data-macro="prote"] { background: #0a7ea4; }
.macro-seg[data-macro="grasa"], .macro-dot[data-macro="grasa"] { background: #b8860b; }
.macro-seg[data-macro="carbo"], .macro-dot[data-macro="carbo"] { background: #12805f; }
.macro-legend {
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;
  list-style: none; padding: 0; margin-top: .65rem;
  font-size: .8rem; color: var(--ink-2);
}
.macro-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.macro-legend b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.macro-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* Tabla comparativa de fórmulas (peso ideal, metabolismo basal) */
.compare { display: grid; gap: 0; margin-top: .9rem; border-top: 1px solid var(--line); }
.compare-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.compare-row span { font-size: .87rem; color: var(--ink-2); }
.compare-row span em { font-style: normal; color: var(--ink-3); font-size: .78rem; }
.compare-row b { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.compare-row.is-main span { color: var(--ink); font-weight: 600; }
.compare-row.is-main b { color: var(--accent-dark); }

/* Enlaces a otras herramientas: ahora son reales, no "próximamente" */
.tool-link { transition: border-color .2s var(--ease-out), color .2s var(--ease-out); }
a.tool-link:hover { border-color: var(--accent); color: var(--accent-dark); }
a.tool-link:hover em { color: var(--accent-dark); }
.opt {
  font-family: var(--mono); font-size: .62rem; font-weight: 500;
  text-transform: none; letter-spacing: .02em; color: var(--ink-3);
  background: var(--surface-2); padding: .1rem .35rem; border-radius: 3px;
  margin-left: .35rem;
}
.compare-row[hidden] { display: none; }
