@font-face { font-family: "Speedee"; src: url("../assets/fonts/Speedee_Rg.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Speedee"; src: url("../assets/fonts/Speedee_Lt.ttf") format("truetype"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Speedee"; src: url("../assets/fonts/Speedee_Bd.ttf") format("truetype"); font-weight: 700 900; font-style: normal; font-display: swap; }

:root {
  --red: #db0007;
  --yellow: #fdbb20;
  --cream: #fff3dd;
  --ink: #17161b;
  --white: #ffffff;
  --gray: #f2f0ec;
  --content-enter-delay: 1.1s;
  --content-enter-duration: .8s;
  --content-enter-stagger: .07s;
  --content-enter-offset: 200px;
  --content-enter-ease: cubic-bezier(.2, 1.35, .35, 1);
  --artboard-morph-delay: 0s;
  --artboard-morph-duration: 1.8s;
  --rays-enter-offset: 180px;
  --logo-enter-delay: .22s;
  font-family: "Speedee", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
}

button, input {
  font-family: inherit;
}

.app-shell {
  --hero-height: 37.6389vw;
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100dvh;
  min-height: 620px;
  overflow: hidden;
  background: var(--white);
  isolation: isolate;
  container-type: inline-size;
}

@media (min-width: 520px) {
  .app-shell {
    height: min(100dvh, 900px);
    margin: 16px 0;
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
  }
}

/* Escritorio: la maqueta se evalúa a pantalla completa, sin el marco móvil.
   Solo aquí se carga papitas-bg-desktop.svg; mobile conserva su SVG actual. */
@media (min-width: 760px) {
  body { display: block; }
  .app-shell {
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

}

/* ===== scenes ===== */
.scene {
  --hero-height: 37.6389cqw;
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity .28s ease;
}
.scene.is-active {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}
.scene[data-bg="red"] { background: var(--white); color: var(--white); }
.scene[data-bg="yellow"] { background: var(--white); color: var(--ink); }
.scene[data-bg="dark"] { background: var(--white); color: var(--white); }
.scene[data-bg="cream"] { background: var(--cream); color: var(--ink); }
.scene--loader {
  background: var(--red) !important;
  color: var(--white);
  /* El loader publicado aparece de inmediato: no hereda el fade de escenas. */
  transition: none;
  overflow: hidden;
  display: block;
}
.initial-loader-frame { display:block; width:100%; height:100%; border:0; background:var(--red); }

/* ===== hero compartido =====
   La proporción 1440 × 542 es la del asset rays-desktop.svg. Así el hero
   conserva exactamente su altura al adaptarse al ancho de la maqueta. */
.hero {
  position: relative;
  width: 100%;
  height: var(--hero-height);
  z-index: 0;
  background: var(--white);
  overflow: hidden;
}
.bg-rays {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scene.is-active.is-rays-entering svg.bg-rays > .ray-piece {
  transform-box: fill-box;
  transform-origin: center;
  animation: ray-drop .72s var(--content-enter-ease) both;
  animation-delay: var(--ray-delay, 0s);
}
@keyframes ray-drop {
  from { opacity: 0; transform: translateY(calc(var(--rays-enter-offset) * -1)) rotate(-4deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}
.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(210px, 48cqw);
  z-index: 1;
}
.scene.is-active.is-rays-entering .logo {
  animation: logo-drop .72s var(--content-enter-ease) var(--logo-enter-delay) both;
}
@keyframes logo-drop {
  from { opacity: 0; transform: translate(-50%, calc(-50% - var(--rays-enter-offset))) rotate(-4deg); }
  to { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
}

.scene-inner {
  position: relative;
  z-index: 3;
  min-height: calc(100% - var(--hero-height));
  width: 100%;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Entrada del contenido: cada elemento asciende de forma escalonada al
   activarse su escena. Al salir, la clase is-active se retira y la secuencia
   queda lista para reproducirse de nuevo en la próxima entrada. */
.scene.is-active .scene-inner > * {
  animation: content-rise var(--content-enter-duration) var(--content-enter-ease) both;
}
.scene.is-active .scene-inner > :nth-child(1) { animation-delay: var(--content-enter-delay); }
.scene.is-active .scene-inner > :nth-child(2) { animation-delay: calc(var(--content-enter-delay) + var(--content-enter-stagger)); }
.scene.is-active .scene-inner > :nth-child(3) { animation-delay: calc(var(--content-enter-delay) + var(--content-enter-stagger) * 2); }
.scene.is-active .scene-inner > :nth-child(4) { animation-delay: calc(var(--content-enter-delay) + var(--content-enter-stagger) * 3); }
.scene.is-active .scene-inner > :nth-child(5) { animation-delay: calc(var(--content-enter-delay) + var(--content-enter-stagger) * 4); }
.scene.is-active .scene-inner > :nth-child(n + 6) { animation-delay: calc(var(--content-enter-delay) + var(--content-enter-stagger) * 5); }
@keyframes content-rise {
  from { opacity: 0; transform: translateY(var(--content-enter-offset)); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .scene.is-active .scene-inner > * { animation: none; }
  .scene.is-active.is-rays-entering svg.bg-rays > .ray-piece { animation: none; }
  .scene.is-active.is-rays-entering .logo { animation: none; }
}

/* Artboard del demo footer-bottom-up-1px: se sitúa después del hero y ocupa
   toda el área de contenido, detrás de sus controles y texto. */
.footer-artboard {
  --artboard-fill: var(--yellow);
  position: absolute;
  top: var(--hero-height);
  right: 0;
  left: 0;
  height: var(--artboard-height, calc(100% - var(--hero-height)));
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.footer-artboard--red { --artboard-fill: var(--red); }
.footer-artboard--dark { --artboard-fill: var(--ink); }
.footer-artboard .yellow-morph-svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: var(--artboard-curve-height, 100%);
}
.footer-artboard::after {
  content: "";
  position: absolute;
  top: var(--artboard-curve-height, 100%);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  background: var(--artboard-fill);
  opacity: 0;
}
.footer-artboard.is-filled::after { opacity: 1; }
.desktop-morph-svg { display: none; }

/* El demo desktop usa un path final independiente. Estas reglas se declaran
   después de la base para no afectar mobile ni ser sobrescritas por ella. */
@media (min-width: 760px) {
  .footer-artboard {
    background-image: none;
  }
  .footer-artboard .yellow-morph-svg {
    display: none;
  }
  .footer-artboard::after {
    display: block;
    /* Continúa exactamente donde termina el SVG 1440 × 1107; sin hueco. */
    top: min(100%, 76.875vw);
    background: var(--artboard-fill);
    opacity: 1;
  }
  .desktop-morph-svg {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1440 / 1107;
    pointer-events: none;
  }
}

.back-btn {
  position: absolute;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.08);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

/* ===== welcome ===== */
.scene--welcome .scene-inner { justify-content: flex-start; gap: 10px; }
.headline {
  font-family: "Speedee", Arial, sans-serif;
  font-size: clamp(24px, 7vw, 30px);
  letter-spacing: -.01em;
  margin: 6px 0 0;
  color: var(--ink);
}
.subhead {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  max-width: 320px;
  margin: 6px 0 4px;
}
.scene--welcome .fries-anchor {
  width: min(360px, 78vw);
  margin: auto auto 0;
  display: block;
}

/* Ajuste quirúrgico de bienvenida en desktop. No altera el hero ni ninguna
   regla móvil: solo reposiciona el bloque de contenido y el artboard. */
@media (min-width: 760px) {
  .footer-artboard {
    top: calc(var(--hero-height) - 100px);
    height: calc(var(--artboard-height, calc(100% - var(--hero-height))) + 100px);
    /* Al subir el artboard, debe quedar por delante del fondo del hero. */
    z-index: 2;
  }
  .scene-inner {
    padding-bottom: calc(max(28px, env(safe-area-inset-bottom)) + 100px);
  }
  #welcome .footer-artboard,
  #terms .footer-artboard {
    /* Compensa el nuevo espacio inferior de sus contenidos. */
    height: calc(var(--artboard-height, calc(100% - var(--hero-height))) + 200px);
  }
  #welcome .scene-inner { transform: translateY(32px); }
}

.btn {
  min-height: 54px;
  padding: 0 28px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  font-weight: 900;
  text-transform: none;
  cursor: pointer;
  font-size: 16px;
}
.btn--primary { background: var(--red); color: var(--white); box-shadow: 4px 5px 0 var(--ink); }
.scene--welcome .btn--primary,
.scene--result .btn--primary { background: var(--red); }
.scene--register .btn--primary,
.scene--question .btn--primary,
.scene--terms .btn--primary { background: var(--red); color: var(--white); }
.btn--fill { width: 100%; margin-top: 22px; }
.btn:active { transform: translate(3px,4px); box-shadow: 1px 1px 0 var(--ink); }

.link-btn {
  border: none;
  background: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 2px;
}

/* ===== step chip ===== */
.step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 16px;
  background: var(--white);
  color: var(--ink);
  font-weight: 900;
  font-size: 16px;
  border-radius: 4px 14px 4px 14px;
  margin-top: 10px;
}

.q-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.3;
  max-width: 320px;
  margin: 14px 0 20px;
}

/* ===== card ===== */
.card {
  width: 100%;
  max-width: 340px;
  background: var(--white);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

/* ===== register ===== */
.scene--register .scene-inner { justify-content: flex-start; }
.form { display: grid; gap: 14px; text-align: left; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
.field input {
  border: none;
  border-bottom: 2px solid #ddd;
  padding: 8px 2px;
  font-size: 15px;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--red); }
.field input::placeholder { color: #b7b3ac; }
.field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 3px 0 rgba(219,0,7,.15); }
.phone-row { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #ddd; }
.phone-row input { border: none; flex: 1; padding: 8px 2px; }
.phone-row:has(input[aria-invalid="true"]) { border-color: var(--red); box-shadow: 0 3px 0 rgba(219,0,7,.15); }
.phone-flag {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.phone-flag:focus-visible { outline: 3px solid #2e7eff; outline-offset: 3px; }
.consent {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  color: #555;
  margin-top: 2px;
}
.consent input { width: 18px; height: 18px; accent-color: var(--red); margin: 0; }
.consent input[aria-invalid="true"] { outline: 2px solid var(--red); outline-offset: 2px; }
.consent-terms-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 900; text-decoration: underline; cursor: pointer; }
.field-error { min-height: 14px; margin-top: 2px; color: var(--red); font-size: 11px; font-weight: 800; line-height: 1.2; }
.field-error--consent { margin-top: -8px; }
.form .btn { margin-top: 6px; }

/* ===== questions ===== */
.scene--question .scene-inner { justify-content: flex-start; }
.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: none;
  border-radius: 14px;
  background: var(--gray);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: background .15s, transform .15s;
}
.option-letter {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
}
.option.is-selected { background: #ffe6b0; transform: translateY(-1px); }
.option.is-selected .option-letter { background: var(--red); color: var(--white); }

/* ===== terms ===== */
.scene-inner--scroll { text-align: left; align-items: stretch; }
.terms-title {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
  margin: 0 0 14px;
}
.scene--terms p { font-size: 12px; line-height: 1.5; margin: 0 0 10px; }
.terms-lead { font-weight: 800; }
.terms-pill {
  display: inline-block;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 4px;
  margin: 16px 0 10px;
}
.terms-list { margin: 0 0 10px; padding-left: 18px; }
.terms-list li { font-size: 12px; line-height: 1.5; margin-bottom: 6px; }

/* Solo escritorio: limita la columna de lectura, sin limitar hero/artboard. */
@media (min-width: 760px) {
  #terms .scene-inner--scroll {
    width: min(100%, 780px);
    margin-right: auto;
    margin-left: auto;
    padding-top: max(28px, env(safe-area-inset-top));
  }
}

/* ===== reveal ===== */
.scene--reveal .scene-inner { justify-content: center; }
.scene--reveal .loader-content {
  display: grid;
  width: 100%;
  flex: 1;
  place-items: center;
  text-align: center;
}
.loader-lockup {
  display: grid;
  justify-items: center;
  gap: 16px;
  transform: translateY(-58px);
}
.loader-logo {
  width: min(280px, 76vw);
  animation: loader-logo .7s cubic-bezier(.2,.8,.2,1) both;
}
.loader-box {
  width: 98px;
  height: auto;
  animation: loader-box .72s .09s cubic-bezier(.2,.8,.2,1) both;
}
.loader-lockup p { margin: 0; font-size: 16px; font-weight: 800; }
.loader-line {
  width: 132px;
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.23);
}
.loader-line::after {
  content: "";
  display: block;
  width: 60%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  animation: loader-progress .9s ease-in-out infinite alternate;
}
.loader-lockup--paused .loader-logo,
.loader-lockup--paused .loader-box,
.loader-lockup--paused .loader-line::after { animation: none; }
@keyframes loader-logo { from { opacity: 0; transform: scale(.8) rotate(-5deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes loader-box { 0% { opacity: 0; transform: translateY(-110px) rotate(8deg); } 75% { opacity: 1; transform: translateY(8px) rotate(-3deg); } 100% { opacity: 1; transform: translateY(0) rotate(0); } }
@keyframes loader-progress { from { transform: translateX(-110%); } to { transform: translateX(70%); } }
.kicker {
  display: inline-block;
  font-family: "Speedee", Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: .04em;
  padding: 6px 14px;
  border-radius: 4px;
  transform: rotate(-2deg);
}
.kicker--yellow { background: var(--yellow); color: var(--ink); }
.kicker--white { background: var(--white); color: var(--ink); }
.reveal-title { font-size: 26px; font-weight: 900; margin: 0; }
.reveal-box { width: 120px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ===== result ===== */
.scene--result .scene-inner { justify-content: center; gap: 16px; }
/* Badge exportado tal cual desde Figma (incluye el ribbon "ERES TEAM") —
   reemplaza el shield + texto + emoji reconstruidos a mano. */
.badge { width: min(260px, 66vw); margin: 6px auto 4px; filter: drop-shadow(0 8px 10px rgba(0,0,0,.25)); }
.result-copy { font-size: 15px; font-weight: 700; line-height: 1.4; max-width: 300px; }
.scene--result .btn { width: min(100%, 280px); }
.result-share { display: grid; gap: 9px; width: min(100%, 280px); }
.share-btn,
.download-result-link {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 0 18px;
  border: 2px solid var(--white);
  border-radius: 14px;
  background: transparent;
  color: var(--white);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.share-btn:active { transform: translateY(1px); }

/* ===== country switcher ===== */
.country-fab {
  position: absolute;
  z-index: 20;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15);
  background: var(--white);
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.2);
}

.sheet-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
}
.sheet-overlay[hidden] { display: none; }
.sheet {
  width: 100%;
  background: var(--white);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 10px 22px max(22px, env(safe-area-inset-bottom));
  text-align: center;
}
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: #ddd; margin: 6px auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet-copy { font-size: 12px; color: #777; margin: 0 0 16px; }
.sheet-options { display: grid; gap: 10px; margin-bottom: 16px; }
.sheet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid #eee;
  background: var(--white);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}
.sheet-option.is-active { border-color: var(--red); background: #fff2f2; }
.sheet-flag { font-size: 22px; }
.sheet-close {
  border: none;
  background: var(--gray);
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  font-weight: 800;
  cursor: pointer;
}
