@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Raleway';
  src: url('../fonts/raleway-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #004067;
  --blue: #0374B1;
  --red: #D4213B;
  --cyan: #04B2E8;
  --white: #FBFCFD;
  --ink: #33414F;
  --grey: #D8D9DE;
  --panel: color-mix(in srgb, #0374B1 30%, #004067);
  --soft: color-mix(in srgb, #0374B1 50%, #FBFCFD);
  --line: color-mix(in srgb, #FBFCFD 22%, transparent);

  --f-head: 'Montserrat', system-ui, sans-serif;
  --f-body: 'Raleway', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --tap: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--navy);
  color: var(--white);
  font: 400 1.125rem/1.55 var(--f-body);
}
/* Luz azul y roja de las dos píldoras, como en el video (capa fija: iOS no admite background-attachment: fixed). */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(3, 116, 177, 0.42), transparent 48%),
    radial-gradient(circle at 92% 85%, rgba(212, 33, 59, 0.18), transparent 46%);
}
#app { position: relative; z-index: 0; }

h1, h2, h3 { font-family: var(--f-head); line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 4vw, 2.8rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; margin-top: 1.6rem; }
p { margin: 0.8rem 0 0; max-width: 62ch; }
h1:focus, h2:focus { outline: none; }
.lead { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 500; }
.hint { color: color-mix(in srgb, var(--white) 80%, var(--navy)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { padding: 20px var(--gutter) 0; }
.brand { all: unset; cursor: default; display: inline-block; -webkit-touch-callout: none; user-select: none; }
.brand img { width: clamp(150px, 18vw, 230px); height: auto; display: block; -webkit-user-drag: none; }

main { padding: clamp(24px, 5vh, 56px) var(--gutter) 48px; max-width: 1240px; margin: 0 auto; }
.view { animation: enter 260ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Botones ---------- */
.btn {
  font: 700 1.1rem/1 var(--f-head);
  min-height: var(--tap);
  padding: 0 32px;
  border-radius: 14px;
  border: 2px solid var(--white);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  touch-action: manipulation;
}
.btn.primary { background: var(--white); color: var(--navy); }
.btn.primary:active { transform: translateY(1px); }
.btn.link { border-color: transparent; padding: 0 8px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 28px; }

/* ---------- Inicio ---------- */
.inicio { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; min-height: 70dvh; }
.inicio h1 { max-width: 12ch; }
.inicio h1::after {
  content: ''; display: block; width: 120px; height: 6px; margin-top: 22px;
  background: linear-gradient(90deg, var(--blue) 50%, var(--red) 50%); border-radius: 3px;
}
.inicio .btn { margin-top: 36px; min-width: 240px; }

/* ---------- Píldoras sobre la plataforma de gobernanza ---------- */
.stage { margin: 0; display: grid; justify-items: center; }
.pills { display: flex; justify-content: center; gap: clamp(24px, 6vw, 72px); padding: 24px 0 8px; }
.pill-slot { display: grid; justify-items: center; gap: 34px; transition: opacity 300ms, filter 300ms; }
.pill-slot.off { opacity: 0.3; filter: saturate(0.35); }
.pill {
  --rot: 60deg;
  position: relative;
  display: block;
  width: 190px; height: 78px;
  border-radius: 39px;
  transform: rotate(var(--rot));
  margin: 46px 0;
  animation: float 6s ease-in-out infinite;
}
.pill-azul {
  background: linear-gradient(170deg, #8fd6ff 0%, #2a9cec 30%, #0b6fc4 68%, #074a8a 100%);
  box-shadow: 0 0 70px 6px rgba(4, 178, 232, 0.45), inset -6px -10px 18px rgba(0, 30, 70, 0.45);
}
.pill-roja {
  --rot: -60deg;
  background: linear-gradient(170deg, #ff9aa8 0%, #ec3550 30%, #c0182f 68%, #7f0b1b 100%);
  box-shadow: 0 0 70px 6px rgba(212, 33, 59, 0.45), inset -6px -10px 18px rgba(60, 0, 10, 0.45);
  animation-delay: -3s;
}
/* Unión de las dos mitades, brillo superior y luz de borde inferior. */
.pill::before { content: ''; position: absolute; left: 50%; top: 3px; bottom: 3px; width: 3px; margin-left: -1.5px; background: rgba(0, 0, 0, 0.28); border-radius: 2px; }
.pill::after { content: ''; position: absolute; left: 24px; right: 34px; top: 11px; height: 15px; border-radius: 10px; background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0)); }
.pill i { position: absolute; left: 30px; right: 30px; bottom: 9px; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); }
.pill-slot.off .pill { box-shadow: none; animation: none; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--rot)); }
  50% { transform: translateY(-10px) rotate(var(--rot)); }
}
.pill-label { font: 700 1.05rem var(--f-head); }
.platform {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: min(100%, 460px);
  margin-top: 10px;
  padding: 16px 22px;
  background: linear-gradient(var(--white), #DCEFF8);
  color: var(--navy);
  font: 800 1.05rem/1.2 var(--f-head);
  text-align: center;
  border: 2px solid var(--cyan);
  border-radius: 14px 14px 40px 40px;
  box-shadow: 0 0 40px rgba(4, 178, 232, 0.35);
}
.platform::before {
  content: ''; flex: none; width: 22px; height: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 26'%3E%3Cpath d='M11 1 2 4.5v7.2C2 18 5.9 22.8 11 25c5.1-2.2 9-7 9-13.3V4.5L11 1Z' fill='none' stroke='%2304B2E8' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='m6.8 12.8 3 3 5.5-6' fill='none' stroke='%23004067' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Nombre ---------- */
.nombre { max-width: 760px; }
.nombre form { margin-top: 28px; }
input[type="text"], input:not([type]), input[name="nombre"] {
  width: 100%;
  min-height: 72px;
  padding: 0 22px;
  font: 600 1.4rem var(--f-body);
  color: var(--ink);
  background: var(--white);
  border: 3px solid transparent;
  border-radius: 14px;
}
input[name="nombre"]:focus-visible { border-color: var(--cyan); outline: none; }
.consent { display: grid; grid-template-columns: auto 1fr; gap: 16px; margin-top: 22px; font-size: 0.95rem; line-height: 1.5; cursor: pointer; }
.consent input { width: 30px; height: 30px; margin: 2px 0 0; accent-color: var(--blue); }
.error { margin-top: 16px; padding: 12px 16px; border-left: 5px solid var(--red); background: color-mix(in srgb, var(--red) 18%, var(--navy)); font-weight: 600; }

/* ---------- Preguntas ---------- */
.progress { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 40px; max-width: 520px; }
.progress li { flex: 1; display: flex; align-items: center; }
.progress li:not(:last-child)::after { content: ''; flex: 1; height: 3px; background: var(--line); margin: 0 6px; }
.progress li.done:not(:last-child)::after { background: var(--cyan); }
.progress span {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  font: 700 1rem var(--f-head); border: 2px solid var(--line); color: color-mix(in srgb, var(--white) 70%, transparent);
}
.progress .done span { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.progress .now span { background: var(--white); border-color: var(--white); color: var(--navy); }

.q-layout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.options { display: grid; gap: 14px; }
.option {
  text-align: left;
  min-height: 76px;
  padding: 16px 24px 16px 28px;
  font: 600 1.2rem/1.3 var(--f-body);
  color: var(--white);
  background: var(--panel);
  border: 2px solid color-mix(in srgb, var(--white) 20%, transparent);
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  touch-action: manipulation;
}
.option::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 5px; border-radius: 0 4px 4px 0; background: transparent; }
.option.selected { background: var(--blue); border-color: var(--white); }
.option.selected::before { background: var(--cyan); }
@media (hover: hover) { .option:hover { border-color: var(--cyan); } }
.back { margin-top: 28px; }

/* ---------- Resultado ---------- */
.resultado { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px 56px; grid-template-areas: 'head diagram' 'body diagram' 'qualify qualify'; }
.res-head { grid-area: head; }
.resultado .stage { grid-area: diagram; align-self: start; }
.res-head::before { content: ''; display: block; width: 96px; height: 6px; border-radius: 3px; margin-bottom: 18px; background: var(--blue); }
.resultado.res-roja .res-head::before { background: var(--red); }
.resultado.res-ambas .res-head::before { background: linear-gradient(90deg, var(--blue) 50%, var(--red) 50%); }
.res-path { font: 700 1.05rem var(--f-head); margin-top: 10px; color: color-mix(in srgb, var(--white) 80%, var(--navy)); }
.res-body { grid-area: body; }
.res-kicker { font: 600 1.2rem var(--f-body); color: var(--soft); margin: 0 0 8px; }
.reasons { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.reasons li { padding-left: 26px; position: relative; max-width: 62ch; }
.reasons li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--cyan); }
.gov { margin-top: 24px; padding: 4px 0 4px 20px; border-left: 5px solid var(--cyan); }
.gov h3 { margin-top: 0; }
.first-step { margin-top: 22px; font-size: 1.15rem; }

.qualify { grid-area: qualify; margin-top: 32px; padding: 28px; background: var(--white); color: var(--ink); border-radius: 18px; }
.qualify fieldset { border: 0; padding: 0; margin: 0 0 20px; }
.qualify legend { font: 800 1.25rem var(--f-head); color: var(--navy); margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 56px; padding: 0 22px;
  font: 600 1.05rem var(--f-body); color: var(--navy);
  background: transparent; border: 2px solid var(--grey); border-radius: 999px; cursor: pointer;
  touch-action: manipulation;
}
.chip.selected { background: var(--blue); border-color: var(--blue); color: var(--white); }
.qualify .btn.primary { background: var(--navy); color: var(--white); border-color: var(--navy); margin-top: 4px; }
.qualify :focus-visible { outline-color: var(--blue); }

/* ---------- Gracias ---------- */
.gracias { min-height: 60dvh; display: grid; align-content: center; justify-items: start; }
.gracias .btn { margin-top: 36px; }

/* ---------- Panel comercial ---------- */
dialog#panel {
  width: min(1180px, 96vw); max-height: 92dvh; padding: 0; border: 0; border-radius: 18px;
  background: var(--white); color: var(--ink); color-scheme: light;
}
dialog#panel::backdrop { background: color-mix(in srgb, var(--navy) 80%, transparent); }
.panel-inner { padding: 28px; }
.panel-inner header { display: flex; justify-content: space-between; align-items: center; }
.panel-inner h2 { color: var(--navy); font-size: 1.8rem; }
.panel-inner .btn { color: var(--navy); border-color: var(--navy); min-height: 52px; }
.panel-inner .btn.primary { background: var(--navy); color: var(--white); }
.kam { margin-top: 18px; padding: 16px 20px; background: color-mix(in srgb, var(--blue) 10%, var(--white)); border-left: 5px solid var(--blue); border-radius: 0 12px 12px 0; }
.kam h3 { margin: 0; color: var(--navy); }
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 20px 0 0; }
.metrics div { padding: 12px 14px; border: 2px solid var(--grey); border-radius: 12px; }
.metrics dt { font-size: 0.85rem; }
.metrics dd { margin: 0; font: 800 1.8rem var(--f-head); color: var(--navy); }
.sync-status { font-size: 0.95rem; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--grey); vertical-align: top; }
th { font: 700 0.85rem var(--f-head); color: var(--navy); }
.prio { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap; background: var(--grey); }
.prio-A { background: var(--red); color: var(--white); }
.prio-B { background: var(--blue); color: var(--white); }

/* ---------- Celular (QR) ---------- */
@media (max-width: 760px) {
  body { font-size: 1.05rem; }
  .inicio { grid-template-columns: 1fr; min-height: auto; gap: 8px; }
  .inicio .stage { order: -1; justify-self: center; margin-bottom: 20px; }
  .pill { width: 130px; height: 54px; margin: 30px 0; }
  .pill::after { left: 16px; right: 22px; top: 8px; height: 10px; }
  .pill i { left: 20px; right: 20px; bottom: 6px; }
  .pill-slot { gap: 20px; }
  .pill-label { font-size: 0.92rem; }
  .inicio .btn { width: 100%; }
  .q-layout { grid-template-columns: 1fr; gap: 24px; }
  .option { min-height: 68px; font-size: 1.1rem; }
  .progress { margin-bottom: 28px; }
  .progress span { width: 34px; height: 34px; }
  .resultado { grid-template-columns: 1fr; grid-template-areas: 'head' 'diagram' 'body' 'qualify'; }
  .qualify { padding: 22px 18px; margin-inline: calc(var(--gutter) * -0.5); }
  .qualify .btn { width: 100%; }
  .chip { flex: 1 1 100%; text-align: left; }
  .row .btn { width: 100%; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Kiosco (tablet horizontal) ---------- */
[data-modo="kiosco"] body, [data-modo="kiosco"] { user-select: none; }
[data-modo="kiosco"] input { user-select: text; }

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