:root {
  --bg: #12121f;
  --bg-elev: #1a1a2e;
  --surface: #222238;
  --surface-hover: #2a2a44;
  --border: #34344f;
  --text: #f2f2f7;
  --text-muted: #a3a3b8;
  --accent: #e94560;
  --accent-hover: #ff5c77;
  --accent-soft: rgba(233, 69, 96, 0.14);
  --error: #ff8a8a;
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Montserrat", var(--font-body);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: radial-gradient(1200px 600px at 50% -200px, #2a1a35 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Barra superior ─────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: rgba(18, 18, 31, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: 15px;
}

.progress { flex: 1; display: flex; align-items: center; gap: 12px; }
.progress[hidden] { display: none; }
.progress-track { flex: 1; height: 6px; border-radius: 99px; background: var(--surface); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.35s ease; }
.progress-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding-block: 32px 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}

.video-link {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.video-link:hover { border-color: var(--accent); background: var(--surface); }
.video-link:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.video-play {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}
.video-link small { display: block; color: var(--text-muted); font-size: 13px; }

.loading { color: var(--text-muted); text-align: center; margin-top: 30vh; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 800; }
h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 700; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.subtitle { font-family: var(--font-head); font-weight: 600; color: var(--text-muted); font-size: 18px; margin: 0 0 16px; }
.lead p { color: var(--text-muted); margin: 0 0 12px; }

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Preguntas ──────────────────────────────────────────────── */
.block-head { margin-bottom: 28px; }

.question {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.question.has-error { border-color: var(--error); }

.q-label { display: block; font-weight: 600; font-size: 17px; margin-bottom: 4px; }
.q-num { color: var(--accent); margin-right: 6px; }
.q-required { color: var(--accent); margin-left: 2px; }
.q-help { color: var(--text-muted); font-size: 14px; margin: 0 0 12px; white-space: pre-line; }
.q-body { margin-top: 12px; }
.q-error { color: var(--error); font-size: 14px; margin: 10px 0 0; min-height: 0; }
.q-error:empty { display: none; }

input[type="text"], input[type="email"], input[type="tel"], textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6f6f88; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.counter { text-align: right; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Escala 1-5 */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale-labels { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.scale-labels span:last-child { text-align: right; }

/* Opciones */
.options { display: grid; gap: 8px; }
.multi-hint { font-size: 13px; color: var(--text-muted); margin: 0 0 10px; }

.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.choice-box:hover { background: var(--surface-hover); }
.choice-mark {
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.choice input[type="checkbox"] + .choice-box .choice-mark { border-radius: 6px; }
.choice input:checked + .choice-box { border-color: var(--accent); background: var(--accent-soft); }
.choice input:checked + .choice-box .choice-mark { border-color: var(--accent); background: var(--accent); }
.choice input:checked + .choice-box .choice-mark::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #fff; }
.choice input:focus-visible + .choice-box { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.choice input:disabled + .choice-box { opacity: 0.45; cursor: not-allowed; }

.scale .choice-box { justify-content: center; padding: 14px 0; font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.scale .choice-mark { display: none; }

.other-input { margin-top: 8px; }
.other-input[hidden] { display: none; }

/* ── Botones ────────────────────────────────────────────────── */
.actions { display: flex; gap: 12px; justify-content: space-between; margin-top: 28px; }
.actions .spacer { flex: 1; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 14px 26px;
  font: 600 16px var(--font-body);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0; font: 600 14px var(--font-body); cursor: pointer; }
.btn:focus-visible, .btn-link:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ── Resumen ────────────────────────────────────────────────── */
.review-block { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.review-head h3 { font-size: 17px; margin: 0; }
.review-item { padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.review-item:first-of-type { border-top: 0; }
.review-q { color: var(--text-muted); }
.review-a { margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; background: rgba(255, 138, 138, 0.1); border: 1px solid var(--error); color: var(--error); }

/* ── Pantallas finales ──────────────────────────────────────── */
.center { text-align: center; padding-top: 10vh; }
.center .lead p { max-width: 520px; margin-left: auto; margin-right: auto; }
.check {
  width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-size: 34px; font-weight: 700;
}

@media (max-width: 480px) {
  .question { padding: 16px; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .actions .spacer { display: none; }
  .scale-labels { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
