:root {
  --acento: #B21441;
  --acento-oscuro: #6B073A;
  --texto: #141414;
  --texto-2: #3F3940;
  --texto-3: #5E5560;
  --superficie: #F7F3F4;
  --borde: #E3D8DC;
  --divisor: #EFE7EA;
  --tinte: #FBEAF0;
  --tinte-texto: #5A2236;
  --error: #C0262D;
  --display: "Space Grotesk", system-ui, sans-serif;
  --cuerpo: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #F1ECEE; color: var(--texto); font-family: var(--cuerpo); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--acento); }
a:hover { color: var(--acento-oscuro); }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.app {
  max-width: 480px; min-height: 100dvh; margin: 0 auto; background: #fff;
  display: flex; flex-direction: column; position: relative;
}
.cargando { margin: auto; color: var(--texto-3); }

/* ---------- Ingreso ---------- */
.ingreso {
  flex: 1; display: flex; flex-direction: column; gap: 24px;
  padding: calc(36px + env(safe-area-inset-top)) 28px calc(28px + env(safe-area-inset-bottom));
  border-top: 6px solid var(--acento);
}
.ingreso-marca { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ingreso-marca img { height: 48px; width: auto; }
.chip { font-size: 12px; color: var(--texto-3); border: 1px solid var(--borde); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.ingreso h1 { margin: 16px 0 0; font-family: var(--display); font-weight: 700; font-size: clamp(34px, 10vw, 40px); line-height: 1.05; letter-spacing: -0.02em; }
.ingreso-intro { margin: 0; font-size: 16px; line-height: 1.5; color: var(--texto-2); }
.marcas-mini { display: flex; flex-wrap: wrap; gap: 8px; }
.marcas-mini span { font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; background: var(--superficie); border: 1px solid var(--borde); }
.espacio { flex: 1; }
.formulario { display: flex; flex-direction: column; gap: 10px; }
.formulario label { font-size: 14px; font-weight: 600; }
.formulario input {
  height: 54px; border-radius: 14px; border: 1.5px solid var(--borde); background: var(--superficie);
  color: var(--texto); font: 16px var(--cuerpo); padding: 0 16px;
}
.formulario input[aria-invalid="true"] { border-color: var(--error); }
.formulario input::placeholder { color: #776C73; }
.nota { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--texto-3); text-align: center; }
.error { margin: 0; font-size: 13px; line-height: 1.45; color: var(--error); }

.boton {
  min-height: 52px; border-radius: 14px; border: none; cursor: pointer; padding: 0 20px;
  font: 700 16px var(--cuerpo); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.boton-primario { background: var(--acento); color: #fff; }
.boton-primario:hover { background: var(--acento-oscuro); color: #fff; }
.boton-primario[disabled] { opacity: .6; cursor: progress; }
.boton-secundario { background: transparent; color: var(--texto); border: 1px solid #CDBFC5; font-weight: 600; }
.boton-secundario:hover { background: var(--superficie); color: var(--texto); }

/* ---------- App ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 2; background: #fff;
  border-top: 6px solid var(--acento); border-bottom: 1px solid var(--divisor);
  padding: calc(18px + env(safe-area-inset-top)) 24px 16px; display: flex; flex-direction: column; gap: 14px;
}
.cabecera-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cabecera-fila img { height: 30px; width: auto; }
.cabecera-correo { font-size: 12px; color: var(--texto-3); background: none; border: none; padding: 6px 0; cursor: pointer; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--cuerpo); }
.cabecera h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -0.01em; }
.progreso-txt { display: flex; justify-content: space-between; font-size: 13px; color: var(--texto-2); }
.progreso-txt strong { color: var(--acento); }
.barra { height: 8px; border-radius: 999px; background: var(--divisor); overflow: hidden; margin-top: 8px; }
.barra span { display: block; height: 100%; border-radius: 999px; background: var(--acento); transition: width .4s ease; }

.contenido { flex: 1; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.contenido > p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--texto-2); }

.aviso { border-radius: 16px; background: var(--tinte); border: 1px solid var(--acento); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.aviso-fila { display: flex; gap: 12px; align-items: center; }
.aviso strong { font-size: 15px; display: block; }
.aviso span { font-size: 13px; color: var(--tinte-texto); line-height: 1.45; }
.aviso-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aviso-acciones .boton { min-height: 44px; font-size: 14px; }

.sellos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sello {
  background: var(--superficie); border: 1px solid var(--divisor); border-radius: 18px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.sello.obtenido { border-color: #EAB9C9; }
.sello-num { align-self: flex-start; font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--texto-3); }
.timbre {
  width: 108px; height: 108px; border-radius: 50%; background: #fff; border: 3px dashed #CDBFC5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.timbre img { width: auto; height: auto; max-width: 72px; max-height: 44px; display: block; filter: grayscale(1); opacity: .4; }
.timbre small { font-size: 9px; font-weight: 700; letter-spacing: .16em; color: #6F6570; }
.obtenido .timbre { border-style: solid; border-color: var(--acento); transform: rotate(var(--giro, -6deg)); }
.obtenido .timbre img { filter: none; opacity: 1; }
.obtenido .timbre small { color: var(--acento); }
.sello-estado { min-height: 40px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--acento); }
.sello .boton { width: 100%; min-height: 44px; font-size: 13px; padding: 0 8px; gap: 6px; white-space: nowrap; }

.programa { display: flex; flex-direction: column; }
.programa-item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--divisor); }
.programa-item.destacado { margin-top: 12px; padding: 16px; border: 1px solid var(--acento); border-radius: 16px; background: var(--tinte); }
.programa-hora { width: 64px; flex-shrink: 0; font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--acento); }
.programa-item strong { display: block; font-size: 15px; }
.programa-item span { display: block; font-size: 13px; color: var(--texto-3); line-height: 1.45; margin-top: 4px; }
.destacado span { color: var(--tinte-texto); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { font-size: 13px; color: var(--texto-2); border-radius: 10px; background: var(--superficie); }

.estado-sorteo { border-radius: 16px; background: var(--superficie); border: 1px solid var(--borde); padding: 16px; }
.estado-sorteo.listo { border-color: var(--acento); }
.estado-sorteo strong { display: block; font-size: 16px; }
.estado-sorteo span { display: block; font-size: 13px; color: var(--texto-2); line-height: 1.45; margin-top: 4px; }
.contenido h2 { margin: 4px 0 0; font-family: var(--display); font-size: 18px; }
.pasos { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; counter-reset: paso; }
.pasos li { display: flex; gap: 14px; align-items: flex-start; font-size: 14px; line-height: 1.5; counter-increment: paso; }
.pasos li::before {
  content: counter(paso); width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  background: var(--acento); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.pasos li span { padding-top: 5px; }

.navegacion {
  position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--divisor); background: #fff; padding-bottom: env(safe-area-inset-bottom);
}
.navegacion button {
  height: 64px; padding: 0 2px; border: none; background: transparent; color: var(--texto-3); cursor: pointer;
  font: 600 12px var(--cuerpo); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.navegacion button[aria-current="page"] { color: var(--acento); }

.vacio { margin: 24px 0; text-align: center; color: var(--texto-3); font-size: 14px; line-height: 1.5; }
.materiales { display: flex; flex-direction: column; gap: 10px; }
.material {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; text-decoration: none;
  background: var(--superficie); border: 1px solid var(--divisor); color: var(--texto);
}
.material:hover { border-color: var(--acento); color: var(--texto); }
.material > svg { flex-shrink: 0; color: var(--acento); }
.material-tipo {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px; background: #fff; border: 1px solid var(--borde);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--acento);
}
.material-texto { flex: 1; min-width: 0; }
.material-texto strong { display: block; font-size: 15px; line-height: 1.3; }
.material-texto span { display: block; font-size: 12px; color: var(--texto-3); margin-top: 3px; }

.selfie { border-radius: 16px; border: 1.5px dashed #E2B5C4; background: #FFF9FB; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.selfie-fila { display: flex; gap: 14px; align-items: center; }
.selfie-fila strong { display: block; font-size: 15px; }
.selfie-fila span { display: block; font-size: 13px; color: var(--texto-2); line-height: 1.45; margin-top: 2px; }
.selfie-icono { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; background: var(--tinte); color: var(--acento); display: flex; align-items: center; justify-content: center; }
.selfie-mini { width: 52px; height: 65px; flex-shrink: 0; border-radius: 8px; object-fit: cover; border: 1px solid var(--borde); }
.selfie-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.selfie .boton { min-height: 46px; font-size: 14px; }
.selfie-aviso { margin: 0; font-size: 13px; color: var(--tinte-texto); line-height: 1.45; }
.selfie-previa { width: 180px; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--borde), 0 10px 24px rgba(60, 10, 30, .18); }
.selfie-previa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.enlace { background: none; border: none; color: var(--texto-3); font: 600 14px var(--cuerpo); padding: 8px; cursor: pointer; text-decoration: underline; }

.cta { border-radius: 16px; background: var(--superficie); border: 1px solid var(--borde); padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.cta strong { display: block; font-size: 15px; }
.cta span { display: block; font-size: 13px; color: var(--texto-2); line-height: 1.45; margin-top: 3px; }
.cta .boton { min-height: 46px; font-size: 14px; }
.cta-lista { background: #fff; }
.grupo { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grupo legend, .grupo > label { font-size: 15px; font-weight: 700; padding: 0; margin-bottom: 2px; }
.grupo label:not(.contacto-opcion) { font-size: 14px; font-weight: 600; }
.grupo input[type=text], .grupo input[type=tel], .grupo textarea {
  border-radius: 12px; border: 1.5px solid var(--borde); background: var(--superficie); color: var(--texto);
  font: 16px var(--cuerpo); padding: 12px 14px; width: 100%;
}
.grupo textarea { resize: vertical; min-height: 104px; line-height: 1.45; }
.grupo .ayuda { margin: 0; font-size: 12px; color: var(--texto-3); line-height: 1.45; }
.opcional { font-weight: 400; color: var(--texto-3); }
.marcas-opciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.marca-opcion {
  position: relative; min-height: 86px; border-radius: 14px; border: 1.5px solid var(--borde); background: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; font: 600 13px var(--cuerpo); color: var(--texto);
}
.marca-opcion img { max-width: 84px; max-height: 34px; width: auto; height: auto; }
.marca-opcion[aria-pressed="true"] { border-color: var(--acento); background: var(--tinte); box-shadow: 0 0 0 1px var(--acento); }
.marca-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--acento); color: #fff; display: flex; align-items: center; justify-content: center; }
.marca-check svg { width: 13px; height: 13px; }
.contacto-opciones { display: flex; flex-direction: column; gap: 8px; }
.contacto-opcion { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1.5px solid var(--borde); background: #fff; cursor: pointer; }
.contacto-opcion input { width: 20px; height: 20px; accent-color: var(--acento); flex-shrink: 0; margin: 0; }
.contacto-opcion strong { display: block; font-size: 15px; }
.contacto-opcion small { display: block; font-size: 12px; color: var(--texto-3); margin-top: 2px; }
.contacto-opcion:has(input:checked) { border-color: var(--acento); background: var(--tinte); }
.resumen-sol { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.resumen-sol dt { font-size: 12px; font-weight: 600; color: var(--texto-3); }
.resumen-sol dd { margin: 2px 0 0; font-size: 15px; line-height: 1.45; white-space: pre-line; }
.contenido > .boton, .contenido > .enlace { width: 100%; }

.navegacion-2 { grid-template-columns: repeat(2, 1fr); }
.credencial { border-radius: 20px; overflow: hidden; border: 1px solid var(--borde); background: #fff; box-shadow: 0 10px 28px rgba(60, 10, 30, .14); }
.credencial-tapa {
  background: #6E0A33; color: #D6B15E; padding: 18px 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  box-shadow: inset 0 0 0 6px #6E0A33, inset 0 0 0 7.5px #D6B15E;
}
.credencial-titulo { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 17px; letter-spacing: .14em; }
.credencial-marca { width: 132px; height: 62px; background: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.credencial-marca img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.credencial-tapa strong { font-family: Cinzel, Georgia, serif; font-size: 19px; color: #F3E2B8; letter-spacing: .04em; }
.credencial-evento { font-size: 12px; letter-spacing: .08em; opacity: .9; }
.credencial-qr { padding: 18px 18px 6px; display: flex; justify-content: center; }
.credencial-qr img { width: min(100%, 300px); aspect-ratio: 1; image-rendering: pixelated; }
.credencial-ayuda { margin: 0; padding: 6px 20px 18px; text-align: center; font-size: 14px; line-height: 1.45; color: var(--texto-2); }
.contador { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 14px; border-radius: 14px; background: var(--superficie); }
.contador b { font-family: var(--display); font-size: 30px; color: var(--acento); }
.contador span { font-size: 14px; color: var(--texto-2); }
.qr-completo {
  position: fixed; inset: 0; z-index: 20; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; cursor: pointer;
}
.qr-completo-logo { max-width: 180px; max-height: 64px; width: auto; height: auto; }
.qr-completo-codigo { width: min(88vw, 62vh); aspect-ratio: 1; image-rendering: pixelated; }
.qr-completo p { margin: 0; font-family: var(--display); font-weight: 700; font-size: 20px; }
.qr-completo .boton { min-width: 160px; }

/* ---------- Capas ---------- */
.capa {
  position: fixed; inset: 0; z-index: 10; background: rgba(20, 16, 18, .6);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.capa[hidden] { display: none; }
.dialogo, .escaner {
  width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 28px 24px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.dialogo .timbre { width: 136px; height: 136px; border-style: solid; border-color: var(--acento); transform: rotate(-8deg); animation: estampar .45s cubic-bezier(.2, 1.4, .4, 1); }
.dialogo .timbre img { filter: none; opacity: 1; max-width: 94px; max-height: 58px; }
.dialogo h2, .escaner h2 { margin: 0; font-family: var(--display); font-size: 22px; }
.dialogo p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--texto-2); }
.dialogo .boton, .escaner .boton { width: 100%; }
.escaner-ayuda { margin: 0; font-size: 14px; color: var(--texto-2); }
.lector { width: 100%; border-radius: 16px; overflow: hidden; background: #000; min-height: 240px; }
@keyframes estampar { from { transform: scale(1.6) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(-8deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .dialogo .timbre { animation: none; }
  .barra span { transition: none; }
}
