/*
 * Arcade Buster — web pública.
 *
 * Mobile-first a propósito: la encuesta se abre casi siempre dentro del Custom
 * Tab de un móvil, así que el caso pequeño es el principal y el escritorio es
 * la excepción.
 *
 * Paleta tomada de los overlays del juego (ProfileScene/ShopScene) para que web
 * y juego no parezcan dos productos distintos.
 */

:root {
  --bg:        #070d16;
  --panel:     #0c1825;
  --panel-alt: #0a1220;
  --line:      #1e3350;
  --line-soft: #16283c;
  --text:      #d0e8ff;
  --text-soft: #8fb0cc;
  --muted:     #55779a;
  --accent:    #88ccff;
  --gold:      #ffd700;
  --danger:    #ff8888;
  --ok:        #44dd88;
  --radius:    4px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Cabecera / pie ─────────────────────────────────────────── */

.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
/* La marca es el logo del juego, no texto: el `alt` lleva el nombre */
.brand { display: block; line-height: 0; }
.brand img {
  display: block; width: auto; height: 30px;
  filter: drop-shadow(0 0 10px rgba(120, 90, 255, .5));
}
@media (min-width: 720px) { .brand img { height: 38px; } }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  color: var(--muted); text-decoration: none; font-size: 12px;
  padding: 4px 8px; border: 1px solid var(--line-soft); border-radius: 3px;
}
.lang-switch a.is-active { color: #fff; background: #14304e; border-color: #3a6a9a; }

.site-main { flex: 1; }

.site-foot {
  border-top: 1px solid var(--line-soft);
  padding: 20px 18px 28px; text-align: center;
}
.site-foot nav { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 10px; }
.site-foot a { color: var(--text-soft); font-size: 12px; }

a { color: var(--accent); }
a:hover { color: #fff; }

/* ── Contenedores ───────────────────────────────────────────── */

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 28px 18px; }
.wrap-narrow { max-width: 620px; }
.center { text-align: center; }

h1 { font-size: 21px; color: #fff; margin: 0 0 12px; line-height: 1.3; }
h2 { font-size: 16px; color: var(--accent); margin: 26px 0 8px; }
h3 { font-size: 14px; color: #fff; margin: 0 0 6px; }
p  { margin: 0 0 14px; }

.lead  { color: var(--text-soft); }
.muted { color: var(--muted); font-size: 13px; }

/* ══ Movimiento ══════════════════════════════════════════════
 *
 * UN solo juego de @keyframes para toda la web. Lo que cambia entre elementos
 * —retardo, duración, recorrido— va por custom property en el atributo `style`,
 * así que añadir una animación nueva no significa añadir CSS nuevo.
 *
 * Y UN solo bloque de `prefers-reduced-motion`, al final de esta sección. Si se
 * escriben animaciones fuera de aquí hay que acordarse de apagarlas allí
 * también, y no se hará.
 */

@keyframes ab-rise  { from { opacity: 0; transform: translateY(var(--rise, 20px)); } }
@keyframes ab-float {
  50% { transform: translate(var(--fx, 10px), var(--fy, -18px)) rotate(var(--fr, 4deg)); }
}
@keyframes ab-pulse { 50% { box-shadow: 0 0 26px -4px var(--accent); } }

/* Desplazamiento en bucle de una capa que tilea. `--tile` es el ancho exacto
   del patrón en negativo: al recorrerlo entero el fotograma final coincide con
   el inicial y no se ve el salto. */
@keyframes ab-scroll { to { background-position-x: var(--tile); } }

/* Ciclo de carrera del sprite. `steps()` corta el interpolado: sin él se verían
   los frames desplazándose en vez de cambiando. */
@keyframes ab-run { to { background-position-x: var(--run-end); } }

/* Rebote de una bola. Con `alternate` la curva se invierte al bajar, así que
   una sola curva de salida da la sensación de gravedad en los dos sentidos. */
@keyframes ab-bounce { to { transform: translateY(calc(-1 * var(--h))); } }


/* Entrada escalonada. El elemento acaba en su estado normal, así que si la
   animación no llega a ejecutarse el contenido se ve igual. */
.reveal {
  animation: ab-rise .62s cubic-bezier(.22, .7, .3, 1) both;
  animation-delay: var(--d, 0s);
}

/* ══ Barra de attract mode ═══════════════════════════════════
 *
 * Cruza el ancho completo, fuera de cualquier `.wrap`.
 *
 * Toda la escala se controla desde estas cuatro variables. `--tile-*` es el
 * ancho del patrón y tiene que cuadrar con `background-size`, o el bucle da un
 * salto visible: la tira de monumentos es 2100x294 (siete veces más ancha que
 * alta), así que su tile mide siempre alto x 7,142.
 */
.band {
  /* Las tres únicas medidas que hay que tocar para reescalar la barra. Todo lo
     demás —tiles, personaje, bolas, altura total— se deriva de ellas. */
  --char-h:   62px;      /* alto del personaje ya recortado */
  --floor-h:  54px;
  --lm-h:    150px;

  /* Derivadas. El tile tiene que cuadrar con `background-size` o el bucle
     pega un salto: floor_earth es 512x256 (2:1) y la tira de monumentos
     2100x294 (7,142:1). */
  --tile-floor: calc(var(--floor-h) * 2);
  --tile-lm:    calc(var(--lm-h) * 7.142857);
  --actor-x:    13%;

  position: relative; overflow: hidden;
  /* Hueco suficiente para que la bola grande quepa en lo alto de su rebote */
  height: calc(var(--floor-h) + var(--lm-h) + var(--char-h) * 1.4);
  /* Cielo de día del mundo 1, el mismo `skyBase` que usa SkyRenderer */
  background: linear-gradient(to bottom, #5ba3d9 0%, #9dc6e2 52%, #f5d08a 100%);
  /* Va entre dos secciones oscuras: el filete a los dos lados le da canto */
  border-block: 1px solid #2a3d55;
}

.band-layer {
  position: absolute; left: 0; right: 0;
  background-repeat: repeat-x;
  animation: ab-scroll var(--dur) linear infinite;
}
.band-landmarks {
  bottom: calc(var(--floor-h) - 4px); height: var(--lm-h);
  background-image: url("/assets/img/band/landmarks.webp");
  background-size: var(--tile-lm) var(--lm-h);
  background-position-y: bottom;
  --tile: calc(-1 * var(--tile-lm));
  --dur: 54s;            /* lo lejano se mueve despacio */
}
.band-floor {
  bottom: 0; height: var(--floor-h);
  background-image: url("/assets/img/band/floor.webp");
  background-size: var(--tile-floor) var(--floor-h);
  --tile: calc(-1 * var(--tile-floor));
  --dur: 2.4s;           /* lo cercano, deprisa: de ahí sale el parallax */
}

/* El personaje corre en el sitio; lo que se mueve es el mundo.
   El sprite está recortado a su contenido, así que apoya justo en el suelo sin
   corregir nada a ojo. Cada frame es cuadrado (180x180). */
.band-runner {
  --run-end: calc(var(--char-h) * -3);
  position: absolute; left: var(--actor-x);
  bottom: calc(var(--floor-h) - 2px);
  width: var(--char-h); height: var(--char-h);
  background: url("/assets/img/band/runner.webp") 0 0 no-repeat;
  background-size: calc(var(--char-h) * 3) var(--char-h);
  animation: ab-run .45s steps(3) infinite;
}

.band-ball {
  position: absolute; left: var(--x); bottom: var(--floor-h);
  width: calc(var(--char-h) * var(--ball));
  aspect-ratio: 199 / 191;
  --h: calc(var(--char-h) * var(--bounce));
  background: url("/assets/img/band/ball-1.webp") center / contain no-repeat;
  animation: ab-bounce var(--dur) cubic-bezier(0, .52, .48, 1) var(--delay) infinite alternate;
}
.band-ball[style*="--n:2"] { background-image: url("/assets/img/band/ball-2.webp"); }
.band-ball[style*="--n:3"] { background-image: url("/assets/img/band/ball-3.webp"); }

/* ══ Landing ═════════════════════════════════════════════════ */

.hero {
  position: relative;
  overflow: hidden;
  padding: 6px 0 20px;
  /* El mismo cielo synthwave del menú del juego, fundido al fondo de la web
     para que no se vea el canto de la imagen. */
  background:
    linear-gradient(to bottom, transparent 45%, var(--bg) 96%),
    radial-gradient(120% 80% at 50% 0%, #1b2a56 0%, transparent 60%),
    url("/assets/img/art/sky.webp") center top / cover no-repeat,
    var(--bg);
}
.hero-inner { position: relative; z-index: 1; padding-top: 26px; }

.hero-title {
  font-size: 20px; color: var(--accent);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 12px;
}
.hero-intro { max-width: 56ch; margin-inline: auto; }

.btn-cta {
  padding: 15px 28px; font-size: 15px; letter-spacing: 1px;
  box-shadow: 0 0 18px -6px var(--accent);
  animation: ab-pulse 3.4s ease-in-out infinite;
}
.badge-soon {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  border: 1px dashed var(--line); color: var(--text-soft); font-size: 13px;
}

/* Burbujas del hero. Decorativas: `aria-hidden` en la plantilla y
   `pointer-events:none` aquí, para que nunca estorben a un dedo. */
.bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--size); height: auto;
  opacity: .5;
  animation: ab-float var(--dur, 14s) ease-in-out var(--delay, 0s) infinite alternate;
}

/* Título de sección de la landing. Es un <h2> y tiene que parecerlo: el
   tamaño de "etiqueta" que tenía antes lo hacía pasar por un pie de foto. */
.section-title {
  font-size: 19px; color: #fff; text-align: center;
  letter-spacing: 1px; margin: 34px 0 20px;
}
.section-title::after {
  content: ""; display: block; width: 46px; height: 2px;
  margin: 10px auto 0; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* ══ Componentes ═════════════════════════════════════════════ */

/* ── Captura de una escena del juego ─────────────────────────
 * El juego es landscape, así que todas las escenas son 16:9 y el marco de
 * móvil va tumbado. `aspect-ratio` reserva el hueco antes de que cargue la
 * imagen y evita que la página pegue un salto. */
.shot { margin: 0; }
.shot-screen {
  display: block; position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  box-shadow: 0 10px 30px -12px #000;
}
.shot-screen img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot figcaption {
  margin-top: 8px; text-align: center;
  font-size: 12px; color: var(--muted); letter-spacing: 1px;
}

.shot:hover .shot-screen { border-color: #35577f; }
.shot-screen { transition: border-color .2s; }

/* Tira lateral de capturas. Con arrastre en móvil y rejilla en pantalla ancha:
   es el mismo marcado, solo cambia el contenedor. */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 78%;
  gap: 14px; overflow-x: auto; padding-bottom: 10px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  /* Se sale del `.wrap` por los lados para que se vea que hay más a la derecha */
  margin-inline: -18px; padding-inline: 18px;
}
.rail > * { scroll-snap-align: center; }

/* ── Tarjeta de característica ───────────────────────────── */
.cards { display: grid; gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--line); transform: translateY(-2px); }
.card-icon { display: block; color: var(--accent); font-size: 20px; margin-bottom: 8px; }
.card h3 { margin-bottom: 6px; }
.card p { margin: 0; color: var(--text-soft); font-size: 13px; }

@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .rail  { grid-auto-columns: 1fr; grid-auto-flow: column; overflow-x: visible;
           margin-inline: 0; padding-inline: 0; }
  .hero-title { font-size: 24px; }
  .section-title { font-size: 23px; }

  /* La barra crece con la pantalla. Solo cambian estas tres: tiles, personaje,
     bolas y altura total se recalculan solos y siguen tileando sin salto. */
  .band {
    --char-h:   92px;
    --floor-h:  84px;
    --lm-h:    210px;
  }
}

/* Un único sitio donde se apaga el movimiento. Nada de esto es información:
   quitarlo deja la misma escena, quieta. */
@media (prefers-reduced-motion: reduce) {
  .reveal, .bubble, .btn-cta, .card, .shot-screen,
  .band-layer, .band-runner, .band-ball {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Legales ────────────────────────────────────────────────── */

.legal section { margin-bottom: 22px; }
.legal p { color: var(--text-soft); font-size: 14px; }

/* ── Formularios ────────────────────────────────────────────── */

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}

input[type="text"], input[type="email"], textarea {
  width: 100%; padding: 11px 12px;
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--line); border-radius: 3px;
  font-family: inherit;
  /* 16px evita el zoom automático de iOS al enfocar un campo */
  font-size: 16px;
  line-height: 1.4;
}
input:focus, textarea:focus { outline: 2px solid #3a6a9a; outline-offset: 1px; }
textarea { resize: vertical; min-height: 76px; }

.btn {
  display: inline-block; padding: 13px 22px; border-radius: 3px;
  background: #1a2535; color: var(--text); border: 1px solid var(--line);
  font-family: inherit; font-size: 14px; font-weight: bold;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: #1a4080; border-color: #3366bb; color: #fff; }
.btn-danger  { background: #7a2222; border-color: #aa3333; color: #fff; }
.btn:hover { filter: brightness(1.2); }
.survey .btn, form .btn { width: 100%; margin-top: 8px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.check span { font-size: 13px; color: var(--text-soft); }

/* Trampa anti-bots: fuera de pantalla pero no display:none, que algunos bots detectan */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Encuesta ───────────────────────────────────────────────── */

.section {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 2px; margin: 30px 0 12px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line-soft);
}

.q { border: 0; margin: 0 0 20px; padding: 0; }
.q legend { padding: 0; font-size: 14px; color: var(--text); margin-bottom: 10px; }
.q[hidden] { display: none; }
.q.has-error legend { color: #ffbbbb; }

.opts { display: flex; flex-direction: column; gap: 7px; }

.opt { display: block; cursor: pointer; }
/* El radio real se oculta pero sigue siendo enfocable: el foco se pinta en el
   <span>, así que el teclado sigue funcionando. */
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt span {
  display: block; padding: 12px 14px;
  background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: 3px; color: var(--text-soft); font-size: 14px;
}
.opt input:checked + span {
  background: #14304e; border-color: #4a8ac0; color: #fff; font-weight: bold;
}
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 560px) {
  .opts { flex-direction: row; }
  .opt { flex: 1; }
  .opt span { text-align: center; }
}

.stars { display: flex; gap: 4px; }
.star { cursor: pointer; }
.star input { position: absolute; opacity: 0; width: 0; height: 0; }
.star span { font-size: 34px; line-height: 1; color: #24405c; padding: 0 3px; display: block; }
.star input:checked ~ span { color: var(--gold); }
.star input:focus-visible ~ span { outline: 2px solid var(--accent); }
/* Al marcar una estrella se doran también las anteriores: se recorre en orden
   inverso con flex-direction para poder usar el selector de hermano siguiente. */
.stars { flex-direction: row-reverse; justify-content: flex-end; }
.star:has(~ .star input:checked) span { color: var(--gold); }

.field-error { color: var(--danger); font-size: 12px; margin: 6px 0 0; }

.alert { padding: 12px 14px; border-radius: 3px; font-size: 13px; margin-bottom: 18px; }
.alert-error { background: #2a1010; border: 1px solid #6a2a2a; color: #ffbbbb; }
.alert-ok    { background: #0f2418; border: 1px solid #2a6a44; color: #aaf0cc; }

.notice {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px; margin-bottom: 22px;
}
.notice h2 { margin-top: 0; font-size: 14px; }
.notice ul { margin: 0 0 10px; padding-left: 20px; color: var(--text-soft); font-size: 13px; }

.avatar-reward {
  width: 128px; height: 128px; border-radius: 6px;
  border: 2px solid var(--gold); margin-bottom: 18px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
