/* =========================================================================
   Ford · Memory Pickups — activación en tablet
   Unidades: cqw / cqh = % del "stage" (marco vertical que se adapta a 9:16,
   10:16 y 3:4). Así la composición del arte se mantiene en cualquier tablet.
   ========================================================================= */

@font-face {
  font-family: "Archivo";
  src: url("../assets/fonts/Archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: block;
}
@font-face {
  font-family: "Anton";
  src: url("../assets/fonts/Anton-400.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

:root {
  --bg: #0f0f0f;
  --blue: #066fef;
  --blue-hi: #2fa9f4;
  --blue-dk: #01366c;
  --navy: #002552;
  --ink: #141414;
  --white: #ffffff;
  --muted: #8d8d92;
  --warn: #e8a33d;
  --err: #ff7a66;
  --flip: 380ms;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--white);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
}
img { -webkit-user-drag: none; user-select: none; }
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }

/* ---------- Stage ---------- */
.stage {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(100vw, 75vh);
  width: min(100vw, 75dvh);
  height: 100vh;
  height: 100dvh;
  container-type: size;
  overflow: hidden;
  background: var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility 0s linear .35s;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity .35s ease;
}

.lockup { display: block; height: auto; pointer-events: none; }

/* ---------- Tipografía ---------- */
.headline {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-stretch: 62%;
  line-height: .88;
  letter-spacing: -.005em;
  margin: 0;
  text-transform: uppercase;
}
.headline--blue { color: var(--blue); }
.headline--white { color: var(--white); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.96); filter: brightness(1.1); }
.btn--pill {
  position: relative;
  min-width: min(30cqw, 18cqh);
  height: min(8cqw, 4.6cqh);
  padding: 0 min(5cqw, 3cqh);
  border-radius: 999px;
  font-size: min(3.2cqw, 1.85cqh);
  color: var(--white);
  background: linear-gradient(180deg, #0a7cff 0%, var(--blue) 30%, #0453b4 70%, var(--blue-dk) 100%);
  box-shadow:
    inset 0 min(.35cqw, .2cqh) 0 rgba(255,255,255,.28),
    inset 0 max(-.4cqw, -.22cqh) min(.6cqw, .35cqh) rgba(0,0,0,.35),
    0 min(.8cqw, .45cqh) min(2.2cqw, 1.2cqh) rgba(6,111,239,.35);
}
.btn--sm { height: min(6.4cqw, 3.6cqh); min-width: 0; font-size: min(2.8cqw, 1.6cqh); }
.btn--ghost {
  height: min(6.4cqw, 3.6cqh);
  padding: 0 min(4cqw, 2.3cqh);
  border-radius: 999px;
  font-size: min(2.6cqw, 1.5cqh);
  font-weight: 700;
  color: var(--white);
  box-shadow: inset 0 0 0 min(.3cqw, .17cqh) #4a4a50;
}
.btn--pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(6,111,239,.6);
  animation: ring 2.2s ease-out infinite;
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(6,111,239,.55); }
  70%, 100% { box-shadow: 0 0 0 min(3.5cqw, 2cqh) rgba(6,111,239,0); }
}

/* =========================================================================
   PASO 01 · SCREENSAVER
   ========================================================================= */
.screen--attract { cursor: pointer; }
.hero {
  position: relative;
  width: 100%;
  height: min(50.3cqw, 30cqh);
  flex: none;
  overflow: hidden;
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
  transform-origin: 55% 60%;
  animation: kenburns 16s ease-in-out infinite alternate;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 22%;
  background: linear-gradient(180deg, rgba(15,15,15,0), var(--bg));
}
@keyframes kenburns {
  from { transform: scale(1) translateX(0); }
  to   { transform: scale(1.09) translateX(-1.5%); }
}
.screen--attract .lockup--fuerza {
  width: min(76cqw, 42cqh);
  margin-top: min(9cqw, 5.5cqh);
  animation: rise .9s cubic-bezier(.2,.7,.2,1) both .1s;
}
.screen--attract .btn { margin-top: auto; margin-bottom: auto; }
.screen--attract .lockup--readyset {
  width: min(26.5cqw, 14.5cqh);
  margin-bottom: min(9cqw, 5.5cqh);
}
@keyframes rise { from { opacity: 0; transform: translateY(3cqh); } to { opacity: 1; transform: none; } }

/* =========================================================================
   PASO 02 · REGISTRO
   ========================================================================= */
.screen--form {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--kb, 0px));
}
.form {
  width: 100%;
  padding: min(13cqw, 7.5cqh) 8cqw 0;
  display: flex;
  flex-direction: column;
}
.form__title {
  font-size: min(15.5cqw, 8.6cqh);
  margin: 0 0 min(5cqw, 2.8cqh) 0;
}
.field { display: flex; flex-direction: column; }
.field label {
  font-size: min(3.3cqw, 1.9cqh);
  font-weight: 400;
  padding-left: min(4.2cqw, 2.4cqh);
  margin-bottom: min(1.3cqw, .75cqh);
}
.field input {
  width: 100%;
  height: min(8cqw, 4.6cqh);
  border-radius: 999px;
  border: min(.35cqw, .2cqh) solid transparent;
  padding: 0 min(4.2cqw, 2.4cqh);
  font-family: inherit;
  font-size: max(16px, min(3.6cqw, 2.05cqh));
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(180deg, #fdfdfd 0%, #f1f1f1 45%, #d3d3d1 100%);
  box-shadow:
    inset 0 max(-.35cqw, -.2cqh) min(.6cqw, .35cqh) rgba(0,0,0,.16),
    0 min(.4cqw, .23cqh) min(1cqw, .6cqh) rgba(0,0,0,.55);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: #9b9b9b; font-weight: 400; }
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 min(.9cqw, .5cqh) rgba(6,111,239,.35), 0 min(.4cqw, .23cqh) min(1cqw, .6cqh) rgba(0,0,0,.55);
}
.field__error {
  min-height: min(4.2cqw, 2.4cqh);
  margin: min(.8cqw, .45cqh) 0 min(.6cqw, .3cqh) min(4.2cqw, 2.4cqh);
  font-size: min(2.6cqw, 1.5cqh);
  line-height: 1.25;
  color: var(--err);
}
.field__error button {
  color: var(--white);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .15em;
}
.has-error input { border-color: var(--err); }
.shake { animation: shake .4s ease; }
@keyframes shake {
  20% { transform: translateX(-1.2cqw); } 40% { transform: translateX(1.2cqw); }
  60% { transform: translateX(-.7cqw); } 80% { transform: translateX(.7cqw); }
}

.consents {
  display: flex;
  flex-direction: column;
  align-self: center;
  max-width: 100%;
  margin-top: min(1.5cqw, .9cqh);
}
.consent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: min(2.4cqw, 1.4cqh);
  cursor: pointer;
}
.consent .consent__text { flex: 1; min-width: 0; }
.consent .field__error {
  flex-basis: 100%;
  margin: min(.6cqw, .35cqh) 0 min(.6cqw, .35cqh) calc(min(6.6cqw, 3.8cqh) + min(2.4cqw, 1.4cqh));
}
.check {
  position: relative;
  width: min(6.6cqw, 3.8cqh);
  height: min(6.6cqw, 3.8cqh);
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 50% 45%, #1b1b1d 0 47%, transparent 49%),
              radial-gradient(circle at 35% 30%, #5ab8ff 0%, var(--blue) 45%, #022d6b 100%);
  box-shadow: 0 min(.4cqw, .2cqh) min(1cqw, .55cqh) rgba(0,0,0,.6);
  transition: transform .15s ease;
}
.check[aria-checked="true"] {
  background: radial-gradient(circle at 38% 32%, #bfe6ff 0%, #6cc1ff 18%, var(--blue) 55%, #022d6b 100%);
}
.check[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 34%;
  top: 22%;
  width: 26%;
  height: 46%;
  border: solid #fff;
  border-width: 0 min(.75cqw, .42cqh) min(.75cqw, .42cqh) 0;
  transform: rotate(45deg);
}
.has-error .check { box-shadow: 0 0 0 min(.5cqw, .3cqh) var(--err); }
.consent__text { font-size: min(3.3cqw, 1.9cqh); }
.link {
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: .06em;
}

#btn-submit { align-self: center; margin-top: min(4cqw, 2.3cqh); }

.screen--form .lockup--fuerza-sm {
  width: min(38cqw, 21cqh);
  margin: auto 0 min(9cqw, 5cqh);
  padding-top: min(8cqw, 4.5cqh);
  flex: none;
}
.keyboard-open .screen--form .lockup--fuerza-sm { display: none; }

/* =========================================================================
   PASO 03 · JUEGO
   ========================================================================= */
.screen--game {
  padding: min(6cqw, 3.4cqh) 11.8cqw min(5cqw, 2.8cqh);
}
.hud {
  width: 100%;
  display: flex;
  align-items: center;
  gap: min(3.5cqw, 2cqh);
  flex: none;
}
.hud__timer, .hud__pairs {
  display: flex;
  align-items: baseline;
  gap: min(1cqw, .6cqh);
  font-weight: 900;
  font-stretch: 62%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud__num { font-size: min(10cqw, 5.6cqh); min-width: 2ch; text-align: right; transition: color .2s; }
.hud__pairs { font-size: min(6cqw, 3.4cqh); }
.hud__label {
  font-size: min(2.4cqw, 1.35cqh);
  font-weight: 700;
  font-stretch: 100%;
  letter-spacing: .08em;
  color: var(--muted);
  margin-left: min(1cqw, .6cqh);
}
.hud__bar {
  flex: 1;
  height: min(1.6cqw, .9cqh);
  border-radius: 999px;
  background: #26262a;
  overflow: hidden;
}
.hud__bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-hi), var(--blue));
  transform-origin: left center;
  will-change: transform;
}
.hud.is-low .hud__num { color: var(--warn); animation: tick 1s steps(1) infinite; }
.hud.is-low .hud__bar-fill { background: linear-gradient(90deg, #ffc46b, var(--warn)); }
@keyframes tick { 0% { transform: scale(1.12); } 50% { transform: scale(1); } }

.grid {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, 1fr);
  gap: min(4.6cqw, 2.6cqh) min(4.6cqw, 3cqh);
  margin: min(5cqw, 2.8cqh) 0;
}
.card {
  position: relative;
  perspective: 1200px;
  border-radius: min(3cqw, 1.7cqh);
  touch-action: manipulation;
}
.card__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--flip) cubic-bezier(.3,.7,.3,1);
}
.card.is-flipped .card__inner, .card.is-matched .card__inner { transform: rotateY(180deg); }
.card__face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-radius: min(3cqw, 1.7cqh);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}
.card__back {
  background: linear-gradient(180deg, var(--blue-hi) 0%, #198af2 10%, #0b6ae6 32%, #034eab 62%, var(--navy) 100%);
  box-shadow: inset 0 min(.3cqw, .17cqh) 0 rgba(255,255,255,.3), 0 min(.6cqw, .35cqh) min(1.6cqw, .9cqh) rgba(0,0,0,.55);
}
/* Mini-cariño: Ready Set Ford en gris oscuro translúcido sobre el azul */
.card__back::before {
  content: "";
  position: absolute;
  inset: 21% 0;
  background: #0d0f14;
  opacity: .28;
  -webkit-mask: url("../assets/img/lockup-readyset.png") center / contain no-repeat;
  mask: url("../assets/img/lockup-readyset.png") center / contain no-repeat;
  pointer-events: none;
}
.card__back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.16) 48%, transparent 60%);
  transform: translateX(-100%);
  animation: sheen 5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes sheen { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.card__front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #f6f6f6 0%, #ececeb 55%, #d6d6d4 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5% 4% 4%;
  box-shadow: 0 min(.6cqw, .35cqh) min(1.6cqw, .9cqh) rgba(0,0,0,.55);
}
.card__img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;   /* las fotos vienen sobre blanco: así se funden con el degradé de la carta */
}
.card__name {
  flex: none;
  margin-top: 1%;
  color: var(--ink);
  font-weight: 800;
  font-stretch: 72%;
  font-size: min(2.7cqw, 1.5cqh);
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
}
.card__name sup { font-size: .5em; vertical-align: super; line-height: 0; margin-left: .05em; }
.card__front.no-img .card__name { font-size: min(4.4cqw, 2.5cqh); }

/* Variante "nombre grande + foto chica" (par de la Maverick) */
.card__front--name { justify-content: center; padding: 6% 6% 7%; }
.card__front--name .card__img {
  flex: 0 0 auto;
  height: 42%;
  width: auto;
  max-width: 52%;
}
.card__front--name .card__name {
  margin-top: 3%;
  font-weight: 900;
  font-stretch: 62%;
  font-size: min(7.4cqw, 4.2cqh);
  line-height: .9;
  letter-spacing: 0;
}
.card__front.no-img::before {
  content: "IMAGEN PENDIENTE";
  position: absolute;
  top: 10%;
  font-size: min(1.8cqw, 1cqh);
  font-weight: 700;
  letter-spacing: .12em;
  color: #9a9a9a;
}
.card:not(.is-flipped):not(.is-matched):active .card__inner { transform: scale(.96); transition-duration: .1s; }
.card.is-matched .card__front {
  box-shadow: 0 0 0 min(.6cqw, .35cqh) var(--blue), 0 0 min(4cqw, 2.3cqh) rgba(6,111,239,.75);
}
.card.is-matched .card__inner { animation: pop .45s ease var(--flip); }
@keyframes pop { 0% { scale: 1; } 40% { scale: 1.06; } 100% { scale: 1; } }
.card.is-wrong { animation: wobble .45s ease; }
@keyframes wobble { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }

.screen--game .lockup--game { width: min(30cqw, 16cqh); flex: none; }
@container (min-aspect-ratio: 7/10) {
  .screen--game .lockup--game { display: none; }
  .screen--game { padding-bottom: min(7cqw, 4cqh); }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(15,15,15,.84);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.count__intro {
  margin: 0 0 min(4cqw, 2.3cqh);
  font-weight: 900;
  font-stretch: 62%;
  font-size: min(8.4cqw, 4.7cqh);
  line-height: .95;
}
.count__intro span { color: var(--blue); }
.count__num {
  margin: 0;
  font-weight: 900;
  font-stretch: 62%;
  font-size: min(42cqw, 23cqh);
  line-height: .9;
  color: var(--blue);
}
.count__num.go { font-size: min(26cqw, 14.5cqh); }
.count__num.pop { animation: countpop .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes countpop { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
.overlay--timeup .headline { font-size: min(15cqw, 8.4cqh); animation: countpop .6s ease both; }

/* =========================================================================
   PASO 04 · PREMIO
   ========================================================================= */
.screen--result { justify-content: center; cursor: pointer; }
.result {
  position: absolute;
  left: 0; right: 0;
  top: 47%;
  transform: translateY(-50%);
  text-align: center;
  padding: 0 8cqw;
}
.result__title { font-size: min(15cqw, 8.4cqh); }
.screen--lose .result__title { font-size: min(14.8cqw, 8.3cqh); line-height: .9; }
.result__sub {
  margin: min(1.6cqw, .9cqh) 0 0;
  font-weight: 800;
  font-stretch: 85%;
  font-size: min(4.6cqw, 2.6cqh);
  letter-spacing: -.005em;
}
.result__meta {
  margin: min(5cqw, 2.8cqh) 0 0;
  font-size: min(2.8cqw, 1.6cqh);
  color: var(--muted);
  font-weight: 500;
}
.screen--result .lockup--readyset {
  position: absolute;
  bottom: min(9cqw, 5.5cqh);
  width: min(26.5cqw, 14.5cqh);
}
.screen.is-active .result__title { animation: countpop .7s cubic-bezier(.2,.8,.2,1) both .1s; }
.screen.is-active .result__sub, .screen.is-active .result__meta { animation: rise .6s ease both .45s; }

.autoreturn {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: min(.8cqw, .45cqh);
  background: #1d1d20;
}
.autoreturn__fill { height: 100%; background: var(--blue); transform-origin: left; transform: scaleX(0); }
.screen.is-active .autoreturn__fill { animation: drain var(--dur, 10s) linear both; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.burst { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.burst i {
  position: absolute;
  top: -4%;
  width: min(1.6cqw, .9cqh);
  height: min(3cqw, 1.7cqh);
  border-radius: 2px;
  background: var(--blue);
  opacity: .9;
  animation: fall var(--t, 3s) linear var(--d, 0s) infinite;
}
.burst i:nth-child(3n) { background: #fff; }
.burst i:nth-child(4n) { background: var(--blue-hi); }
@keyframes fall {
  from { transform: translate3d(0, 0, 0) rotate(0); }
  to   { transform: translate3d(var(--x, 0), 110cqh, 0) rotate(var(--r, 540deg)); }
}

/* =========================================================================
   Modales
   ========================================================================= */
.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6cqw;
  background: rgba(0,0,0,.72);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal__card {
  width: 100%;
  max-height: 82cqh;
  overflow: auto;
  background: #19191b;
  border: 1px solid #2c2c30;
  border-radius: min(3.2cqw, 1.8cqh);
  padding: min(6cqw, 3.4cqh);
  animation: rise .3s ease both;
}
.modal__card--center { text-align: center; }
.modal__title {
  margin: 0 0 min(3cqw, 1.7cqh);
  font-size: min(4.6cqw, 2.6cqh);
  font-weight: 800;
}
.modal__body { font-size: min(3cqw, 1.7cqh); line-height: 1.45; color: #d2d2d6; -webkit-user-select: text; user-select: text; }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: min(2.4cqw, 1.4cqh);
  margin-top: min(4cqw, 2.3cqh);
}
.modal__actions--wrap { flex-wrap: wrap; }
.idle__title { font-size: min(11cqw, 6.2cqh); }
.idle__text { font-size: min(3.4cqw, 1.9cqh); margin: min(2.4cqw, 1.4cqh) 0 min(5cqw, 2.8cqh); color: #d2d2d6; }

.admin__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3cqw;
  padding: min(1.8cqw, 1cqh) 0;
  border-bottom: 1px solid #2a2a2e;
  font-size: min(2.8cqw, 1.6cqh);
}
.admin__row input[type="number"] {
  width: min(16cqw, 9cqh);
  height: min(6cqw, 3.4cqh);
  border-radius: 8px;
  border: 1px solid #3a3a40;
  background: #0f0f10;
  color: #fff;
  font: inherit;
  text-align: center;
}
.admin__row input[type="checkbox"] { width: min(4.5cqw, 2.6cqh); height: min(4.5cqw, 2.6cqh); accent-color: var(--blue); }
.admin__stats, .admin__version { font-size: min(2.4cqw, 1.35cqh); color: var(--muted); margin: min(2.4cqw, 1.4cqh) 0 0; }

.corner-hotspot {
  position: absolute;
  top: 0; left: 0;
  width: min(18cqw, 10cqh);
  height: min(18cqw, 10cqh);
  z-index: 30;
  display: none;
}
.attract-on .corner-hotspot { display: block; }

@media (prefers-reduced-motion: reduce) {
  .hero img, .btn--pulse::after, .card__back::after, .burst i { animation: none !important; }
}
