:root {
  --bg: #0f1115;
  --card: #151925;
  --text: #e6e8ef;
  --muted: #a9afc1;
  --primary: #3aa0ff; /* Ajusta a la paleta Mayorking si quieres */
  --accent: #7bda7b;
  --warning: #ffcc66;
  --danger: #ff6b6b;
  --border: #263042;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Inter, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% 10%, #101423 0%, #0b0e16 60%, #090b12 100%);
  color: var(--text);
}

.app-header { padding: 24px 16px; text-align: center; }
.app-header h1 { margin: 0 0 4px 0; font-size: clamp(22px, 4vw, 34px); }
.app-header .tagline { margin: 0; color: var(--muted); }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

/* Formulario */
.inputs .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
label { font-weight: 600; }

input[type="number"] {
  background: #0e1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
}

input::placeholder { color: #6e7690; }
.hint { color: var(--muted); }

.actions { display: flex; gap: 10px; margin-top: 8px; }

.btn {
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  background: #11162a;
  color: var(--text);
}

.btn.primary {
  background: linear-gradient(180deg, #2d7be0, #2363b5);
  border-color: #1f4f8a;
}

.btn.ghost { background: transparent; }
.btn:active { transform: translateY(1px); }

.form-error { color: #ff9aa0; min-height: 20px; margin-top: 6px; }

/* Resultados */
.results .result-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
}

.avatar-wrap { position: relative; }
.avatar { display: none; }
.avatar.active { display: block; }

.avatar-bg { fill: #0e1220; }
.av-head { fill: #d6d9e4; }
.av-neck { fill: #d6d9e4; }
.av-body-slim { fill: #7aa8ff; }
.av-body { fill: #7bda7b; }
.av-body-wide { fill: #ffd66b; }
.av-body-plus { fill: #ff9aa0; }
.av-leg { fill: #d6d9e4; }

.numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.stat {
  background: #0e1220;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 800; }

.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #12172a;
}

/* Barras */
.bars { margin-top: 12px; display: grid; gap: 18px; }
.bar-block { display: flex; flex-direction: column; gap: 8px; }
.bar-title { color: var(--muted); font-weight: 600; }

.bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b0f1e;
}

.bar.imc {
  /* Segmentos: bajo, normal, sobrepeso, obesidad */
  background: linear-gradient(
    90deg,
    #7aa8ff 0% 20%,
    #7bda7b 20% 48%,
    #ffd66b 48% 64%,
    #ff9aa0 64% 100%
  );
}

.bar-legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.marker {
  position: absolute;
  top: -6px;
  width: 0;
  height: 28px;
  border-left: 3px solid #e6e8ef;
  filter: drop-shadow(0 0 4px rgba(230, 232, 239, .5));
}

.marker::after {
  content: "";
  position: absolute;
  top: 26px;
  left: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #e6e8ef;
  background: #0e1220;
}

.marker-label {
  position: absolute;
  top: -26px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text);
  background: #0e1220;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.bar.weight { background: #0b0f1e; }

.weight-range {
  position: absolute;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(58, 160, 255, .0),
    rgba(123, 218, 123, .35) 20%,
    rgba(123, 218, 123, .5) 80%,
    rgba(58, 160, 255, .0)
  );
  border: 1px solid rgba(123, 218, 123, .45);
}

.range-row { display: flex; justify-content: space-between; color: var(--muted); }
.delta { color: var(--muted); margin: 6px 2px; }

.disclaimer { margin-top: 8px; color: #a6adc3; }
.app-footer { padding: 20px; text-align: center; color: var(--muted); }

/* Responsivo */
@media (max-width: 720px) {
  .results .result-grid { grid-template-columns: 1fr; }
  .numbers { grid-template-columns: 1fr 1fr; }
}
