/* Búsqueda del Tesoro Ávila — ESTRUCTURA de la app (tamaños, posiciones, animaciones).
   Los colores, la tipografía y el patrón que se ven hoy los pone css/tema.css (propuesta B del manual de
   identidad), que se carga después. Los colores de noche de este archivo son el diseño anterior: quedan
   como base hasta fusionar los dos archivos. Anton solo la usan la propuesta y el video (presentacion/).
   Los logos oficiales (negros) se recolorean con mask-image: nunca poner el PNG negro sobre fondo oscuro. */

/* ---------- Fuentes locales ---------- */
@font-face {
  font-family: "Anton";
  src: url("../fonts/anton-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/archivo-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --noche: #0A0A0A;
  --noche-2: #141414;
  --linea: rgba(255, 255, 255, .12);
  --amarillo: #FFE000;
  --crema: #FFFFC5;
  --blanco: #fff;
  --texto-claro: #EDEDE6;   /* 16.9:1 sobre --noche */
  --gris: #A3A3A3;          /*  8.0:1 sobre --noche */
  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --texto: "Archivo", Arial, sans-serif;
  --curva: cubic-bezier(.16, 1, .3, 1);
  --foco: var(--amarillo);
  --error: #FF9A8B;         /*  9.4:1 sobre --noche */
  --color-marca: var(--amarillo);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--noche); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--noche);
  color: var(--texto-claro);
  font-family: var(--texto);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

p, h1, h2, dl, dd { margin: 0; }
svg { display: block; }
[tabindex="-1"]:focus { outline: none; }

.biblioteca { position: absolute; width: 0; height: 0; overflow: hidden; }

.aviso-noscript {
  margin: 24px 20px;
  padding: 16px;
  border: 1px solid var(--amarillo);
  border-radius: 16px;
  color: var(--blanco);
  font-weight: 700;
}

/* ---------- Pantallas ---------- */
.pantalla {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(14px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, calc(env(safe-area-inset-bottom) + 16px))
    max(20px, env(safe-area-inset-left));
  overflow: hidden;
}

.pantalla > :not(.fondo) {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}

.pantalla--centro { text-align: center; }

.fondo {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- Barra superior con la marca ---------- */
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.marca {
  display: block;
  height: 34px;
  aspect-ratio: 700 / 378;
  background: var(--color-marca);
  -webkit-mask: var(--logo-avila) center / contain no-repeat;
  mask: var(--logo-avila) center / contain no-repeat;
}

.marca-montana {
  display: inline-block;
  flex: none;
  width: 42px;
  aspect-ratio: 700 / 202;
  background: currentColor;
  -webkit-mask: var(--logo-montana) center / contain no-repeat;
  mask: var(--logo-montana) center / contain no-repeat;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--linea);
  border-radius: 999px;
  color: var(--texto-claro);
  font: 700 .72rem/1 var(--texto);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.chip--vivo::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--amarillo);
  box-shadow: 0 0 10px var(--amarillo);
  vertical-align: 1px;
  animation: titilar 1.6s ease-in-out infinite;
}

.progreso {
  display: flex;
  align-items: baseline;
  padding: 8px 16px;
  border: 1px solid rgba(255, 224, 0, .4);
  border-radius: 999px;
  background: rgba(255, 224, 0, .08);
  color: var(--gris);
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1;
}

.progreso strong { color: var(--amarillo); font-weight: 400; font-size: 1.7rem; }

/* ---------- Tipografía ---------- */
.antetitulo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--amarillo);
  font: 700 .76rem/1.3 var(--texto);
  letter-spacing: .22em;
  text-transform: uppercase;
}

.antetitulo:not(.antetitulo--marca)::before {
  content: "";
  flex: none;
  width: 28px;
  height: 2px;
  background: currentColor;
}

.pantalla--centro .antetitulo { justify-content: center; }

.titular {
  color: var(--blanco);
  font-family: var(--display);
  font-size: clamp(3.4rem, 19vw, 6rem);
  font-weight: 400;
  line-height: .93;
  text-transform: uppercase;
}

.titular__linea { display: block; }

/* El "¡" de Anton baja de la línea base: se sube para que no choque con la línea siguiente. */
.abre { display: inline-block; transform: translateY(-.11em); }
.titular em { font-style: normal; color: var(--amarillo); }
.titular--negro { color: #000; }

.lema {
  font-family: var(--display);
  font-size: clamp(2.4rem, 13vw, 4.2rem);
  line-height: .95;
  text-transform: uppercase;
}

.lema__contorno { color: transparent; -webkit-text-stroke: 1.5px var(--crema); }
.lema__lleno { color: var(--amarillo); text-shadow: 0 0 30px rgba(255, 224, 0, .5); }

.titulo {
  color: var(--blanco);
  font-family: var(--display);
  font-size: clamp(2.6rem, 13vw, 3.6rem);
  font-weight: 400;
  line-height: 1.24; /* con menos, la tilde de una mayúscula toca la línea de arriba (ROMPECABEZAS / ÁVILA) */
  text-transform: uppercase;
}

.titulo--xl { font-size: clamp(2.8rem, 14vw, 4rem); }

.entradilla { color: var(--gris); font-size: 1.05rem; }

/* ---------- Bienvenida ---------- */
.topo { position: absolute; width: 150%; height: auto; color: var(--amarillo); opacity: .09; }
.topo--a { top: -18%; right: -62%; }
.topo--b { top: 8%; left: -70%; }
.topo--c { top: -10%; left: -40%; opacity: .06; }
.topo--d { top: -20%; right: -55%; color: #000; opacity: .1; }

/* La montaña ocupa todo el espacio libre bajo el lema, a todo el ancho;
   las cifras y el botón se montan sobre su base. */
.pantalla > .horizonte {
  flex: 1 1 auto;
  align-self: stretch;
  width: auto;
  max-width: none;
  min-height: 300px;
  margin: 0 -20px -150px;
}

.escena { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Tablet, computadora o celular horizontal: la escena se ajusta al ALTO disponible y no al ancho.
   Escalada por el ancho crecía hasta tapar el título; las cordilleras siguen hacia los lados. */
@media (min-width: 500px) {
  .escena { inset: 0 auto 0 50%; width: auto; height: 100%; aspect-ratio: 400 / 320; transform: translateX(-50%); }
}
.pantalla--inicio .cifras,
.pantalla--inicio .acciones--abajo { z-index: 1; }
.pantalla--inicio .acciones--abajo { margin-top: 0; }

.cifras {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 18px;
  background: rgba(10, 10, 10, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.cifras div {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  padding: 12px 14px;
  border-left: 1px solid var(--linea);
}

.cifras div:first-child { border-left: 0; }
.cifras dt { color: var(--gris); font: 700 .68rem var(--texto); letter-spacing: .18em; text-transform: uppercase; }
.cifras dd { color: var(--amarillo); font-family: var(--display); font-size: 2.2rem; line-height: 1; }

.resplandor {
  position: absolute;
  width: 80vmax;
  height: 80vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 0, .2), rgba(255, 224, 0, 0) 62%);
}

.resplandor--arriba { top: -45vmax; right: -40vmax; }

/* ---------- Botones ---------- */
.acciones { display: grid; gap: 12px; }
.acciones--abajo { margin-top: auto; padding-top: 8px; }

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 26px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .15s var(--curva), box-shadow .2s ease, background-color .2s ease;
}

.boton:active { transform: scale(.97); }
.boton:focus-visible { outline: 3px solid var(--foco); outline-offset: 4px; }
.boton__icono { width: 22px; height: 22px; flex: none; }

.boton--primario {
  background: var(--amarillo);
  color: #000;
  box-shadow: 0 12px 34px rgba(255, 224, 0, .32), inset 0 -4px 0 rgba(0, 0, 0, .18);
}

.boton--fantasma {
  background: rgba(255, 255, 255, .03);
  border-color: rgba(255, 255, 255, .32);
  color: var(--blanco);
}

.boton--negro {
  background: #000;
  color: var(--amarillo);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .28);
}

.boton--texto {
  min-height: 48px;
  background: none;
  color: var(--gris);
  font: 600 1rem/1.2 var(--texto);
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.boton--compacto { width: auto; padding: 8px 4px; }

/* ---------- Registro ---------- */
.formulario { display: grid; gap: 18px; margin-top: 4px; }

.campo { display: grid; gap: 8px; }
.campo__etiqueta { color: var(--gris); font: 700 .74rem var(--texto); letter-spacing: .18em; text-transform: uppercase; }

.campo input {
  width: 100%;       /* sin esto el ancho sale del tamaño de la letra y un campo de letra grande se sale */
  min-width: 0;
  min-height: 58px;
  padding: 0 18px;
  border: 1.5px solid #343434;
  border-radius: 16px;
  background: var(--noche-2);
  color: var(--blanco);
  caret-color: var(--amarillo);
  font: 500 1.15rem var(--texto);  /* ≥ 16 px: evita el zoom automático de iPhone */
  transition: border-color .2s ease, box-shadow .2s ease;
}

.campo input:focus { outline: none; border-color: var(--amarillo); box-shadow: 0 0 0 4px rgba(255, 224, 0, .2); }

/* Aviso de error debajo del campo (lo pone js/app.js al validar) */
.campo__error { color: var(--error); font: 600 .9rem/1.3 var(--texto); }
.campo input[aria-invalid="true"] { border-color: var(--error); }

.casilla {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 14px;
  align-items: start;
  min-height: 48px;
  padding: 6px 0;
  color: var(--texto-claro);
  line-height: 1.4;
  cursor: pointer;
}

.casilla input { position: absolute; top: 6px; left: 0; width: 30px; height: 30px; margin: 0; opacity: 0; }

.casilla__caja {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #5A5A5A;
  border-radius: 9px;
  background: var(--noche-2);
  transition: background-color .15s ease, border-color .15s ease;
}

.casilla__caja::after {
  content: "";
  width: 12px;
  height: 7px;
  border-bottom: 3px solid #000;
  border-left: 3px solid #000;
  opacity: 0;
  transform: translate(1px, -1px) rotate(-45deg);
}

.casilla input:checked + .casilla__caja { background: var(--amarillo); border-color: var(--amarillo); }
.casilla input:checked + .casilla__caja::after { opacity: 1; }
.casilla input:focus-visible + .casilla__caja { outline: 3px solid var(--amarillo); outline-offset: 3px; }

/* ---------- Mapa ---------- */
.mapa {
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 28px;
  background: #050505;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
}

.mapa svg { width: 100%; height: auto; }

.estacion__base { fill: #0E0E0E; stroke: #4A4A4A; stroke-width: 2.5; }
.estacion__num { fill: #8C8C8C; font-family: var(--display); font-size: 19px; }
.estacion__check { display: none; fill: none; stroke: #000; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.estacion__pulso { fill: none; stroke: var(--amarillo); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }

.estacion--actual { filter: drop-shadow(0 0 10px rgba(255, 224, 0, .75)); }
.estacion--actual .estacion__base { fill: var(--amarillo); stroke: #000; }
.estacion--actual .estacion__num { fill: #000; }
.estacion--actual .estacion__pulso { animation: pulso 1.8s ease-out infinite; }

.estacion--completada .estacion__base { fill: var(--amarillo); stroke: var(--amarillo); }
.estacion--completada .estacion__num { display: none; }
.estacion--completada .estacion__check { display: inline; }

/* Sendero recorrido: línea continua que avanza hasta la última estación ganada (js/app.js cambia
   stroke-dashoffset; el path tiene pathLength="100", así que 100 = nada y 0 = hasta la cima). */
.sendero-recorrido { stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.4s var(--curva); }

/* Aviso discreto (por ejemplo, si el celular no deja guardar el avance) */
.aviso {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--linea);
  border-radius: 14px;
  color: var(--texto-claro);
  font: 500 .92rem/1.4 var(--texto);
}

/* Boleto: tarjeta amarilla con muescas laterales (pista y premio) */
.boleto {
  padding: 20px 24px 22px;
  border-radius: 20px;
  background: var(--amarillo);
  color: #000;
  -webkit-mask:
    radial-gradient(circle 13px at 0 50%, #0000 96%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 13px at 100% 50%, #0000 96%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 13px at 0 50%, #0000 96%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 13px at 100% 50%, #0000 96%, #000) right / 51% 100% no-repeat;
}

.boleto__etiqueta {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px dashed rgba(0, 0, 0, .35);
  font: 800 .74rem var(--texto);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.pista { font: 700 1.25rem/1.35 var(--texto); }

/* ---------- Escáner ---------- */
.visor {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 58vh;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 28px;
  background: radial-gradient(120% 80% at 50% 40%, #1E1E1E, #050505);
}

/* La cámara llena el visor; el marco y el texto van encima. */
.visor__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Con la cámara apagada (QR ya leído) la línea de escaneo se detiene. */
.visor--quieto .visor__laser { animation: none; opacity: 0; }

/* Código del cartel escrito a mano: letras grandes y separadas, siempre en mayúsculas. */
.campo input.campo__codigo { font-size: 1.7rem; font-weight: 700; letter-spacing: .3em; text-align: center; text-transform: uppercase; }

.visor__marco { position: absolute; top: 45%; left: 50%; width: 66%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.visor__esquina { position: absolute; width: 24%; height: 24%; border: 0 solid var(--amarillo); filter: drop-shadow(0 0 8px rgba(255, 224, 0, .6)); }
.visor__esquina--ai { top: 0; left: 0; border-top-width: 6px; border-left-width: 6px; border-top-left-radius: 20px; }
.visor__esquina--ad { top: 0; right: 0; border-top-width: 6px; border-right-width: 6px; border-top-right-radius: 20px; }
.visor__esquina--bi { bottom: 0; left: 0; border-bottom-width: 6px; border-left-width: 6px; border-bottom-left-radius: 20px; }
.visor__esquina--bd { bottom: 0; right: 0; border-bottom-width: 6px; border-right-width: 6px; border-bottom-right-radius: 20px; }

.visor__laser {
  position: absolute;
  top: 8%;
  left: 6%;
  right: 6%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--amarillo) 20%, var(--amarillo) 80%, transparent);
  box-shadow: 0 0 18px 3px rgba(255, 224, 0, .55);
  animation: laser 2.4s ease-in-out infinite alternate;
}

.visor__texto {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  padding: 0 20px;
  color: var(--blanco);
  font-weight: 700;
  text-align: center;
}

/* ---------- Hallazgo ---------- */
.rayos {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 190vmax;
  height: 190vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 224, 0, .16) 0deg 7deg, rgba(255, 224, 0, 0) 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0, #0000 34%);
  mask: radial-gradient(circle, #000 0, #0000 34%);
  transform: translate(-50%, -50%);
  animation: girar 60s linear infinite;
}

.rayos--cima { top: 26%; }

.cofre {
  width: min(62vw, 250px);
  height: auto;
  margin: 8px auto 4px;
  filter: drop-shadow(0 0 34px rgba(255, 224, 0, .45));
  animation: flotar 3.2s ease-in-out infinite;
}

.destello { transform-box: fill-box; transform-origin: center; animation: destellar 2.2s ease-in-out infinite; }
.destello--2 { animation-delay: 1.1s; }

.nombre-tesoro {
  color: var(--amarillo);
  font-family: var(--display);
  font-size: clamp(2rem, 10vw, 2.8rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 26px rgba(255, 224, 0, .45);
}

/* ---------- Juego ---------- */
/* El reto ocupa el espacio libre de la pantalla; su aspecto lo define cada juego (más abajo). */
.escenario { flex: 1; min-height: 0; }

/* ---------- Reto superado (pantalla amarilla) ---------- */
.pantalla--amarilla {
  --foco: #000;
  --color-marca: #000;
  background: var(--amarillo);
  color: #000;
}

.insignia { width: min(48vw, 200px); height: auto; margin: 10px auto 6px; filter: drop-shadow(0 16px 0 rgba(0, 0, 0, .12)); }
.insignia__check { stroke-dasharray: 100; stroke-dashoffset: 0; }

.contador-tesoro { font-family: var(--display); font-size: 1.7rem; letter-spacing: .04em; text-transform: uppercase; }
.contador-tesoro strong { font-weight: 400; }

.segmentos { display: flex; gap: 6px; max-width: 280px !important; }
.segmentos span { flex: 1; height: 10px; border-radius: 999px; background: rgba(0, 0, 0, .18); }
.segmentos span.lleno { background: #000; }

/* ---------- Final ---------- */
.cima {
  width: min(78%, 300px);
  height: auto;
  margin: 0 auto;
  -webkit-mask: linear-gradient(#000 70%, #0000);
  mask: linear-gradient(#000 70%, #0000);
}

.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dato {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--linea);
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  text-align: left;
}

.dato__valor { color: var(--blanco); font-family: var(--display); font-size: 1.7rem; line-height: 1; }
.dato__etiqueta { color: var(--gris); font: 700 .68rem var(--texto); letter-spacing: .16em; text-transform: uppercase; }

.boleto--premio { padding: 22px 26px 24px; text-align: center; }

.premio__codigo {
  margin: 4px 0 10px;
  padding-left: .14em;
  font-family: var(--display);
  font-size: clamp(3rem, 16vw, 4.4rem);
  letter-spacing: .14em;
  line-height: 1;
}

.premio__mensaje { font-weight: 600; }

/* ---------- Movimiento ---------- */
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes titilar { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes pulso { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes laser { to { top: calc(92% - 3px); } }
@keyframes girar { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes destellar { 0%, 100% { transform: scale(.6); opacity: .3; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes marchar { to { stroke-dashoffset: -90; } }
@keyframes trazar { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes latido {
  0%, 100% { box-shadow: 0 12px 34px rgba(255, 224, 0, .32), inset 0 -4px 0 rgba(0, 0, 0, .18); }
  50% { box-shadow: 0 12px 54px rgba(255, 224, 0, .6), inset 0 -4px 0 rgba(0, 0, 0, .18); }
}

.pantalla--activa { animation: aparecer .45s ease both; }
.pantalla--activa > :not(.fondo) { animation: subir .75s var(--curva) both; }
.pantalla--activa > :nth-child(3) { animation-delay: .06s; }
.pantalla--activa > :nth-child(4) { animation-delay: .12s; }
.pantalla--activa > :nth-child(5) { animation-delay: .18s; }
.pantalla--activa > :nth-child(6) { animation-delay: .24s; }
.pantalla--activa > :nth-child(7) { animation-delay: .30s; }
.pantalla--activa > :nth-child(8) { animation-delay: .36s; }
.pantalla--activa > :nth-child(9) { animation-delay: .42s; }

.pantalla--activa .titular__linea { animation: subir .9s var(--curva) both; }
.pantalla--activa .titular__linea + .titular__linea { animation-delay: .1s; }
.pantalla--activa .insignia__check { animation: trazar .6s .25s ease-out both; }

.estrellas circle { animation: titilar 3.4s ease-in-out infinite; }
.estrellas circle:nth-child(3n) { animation-delay: 1.1s; }
.estrellas circle:nth-child(3n + 1) { animation-delay: 2.2s; }
.sendero { animation: marchar 6s linear infinite; }
.boton--latido { animation: latido 2.8s ease-in-out infinite; }

/* ---------- Letras del título de bienvenida ---------- */
/* app.js separa en letras el texto de [data-letras]: entran una por una desde abajo
   y después el título queda vivo con una ola lenta que lo recorre. */
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.palabra { display: inline-block; white-space: nowrap; }
.letra { display: inline-block; }
.pantalla--activa .letra {
  animation: letra-entra .7s var(--curva) both, letra-ola 5s ease-in-out infinite;
  animation-delay: calc(var(--i) * 45ms + 150ms), calc(var(--i) * 110ms + 2.2s);
}
@keyframes letra-entra { from { opacity: 0; transform: translateY(.55em) rotate(5deg); } to { opacity: 1; transform: none; } }
@keyframes letra-ola { 0%, 24%, 100% { translate: 0 0; } 12% { translate: 0 -.07em; } }

/* ---------- Efectos (Fase 6) ---------- */
/* Botón redondo de ícono (sonido). */
.barra__lado { display: flex; align-items: center; gap: 10px; }
.boton-icono {
  display: grid; flex: none; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: 2px solid currentColor; border-radius: 50%;
  background: transparent; color: var(--tinta, #000); cursor: pointer;
}
.boton-icono svg { width: 24px; height: 24px; }
.boton-icono[aria-pressed="false"] { opacity: .55; }

/* Tesoro encontrado: el cofre se sacude, la tapa se abre y saltan tres chispas. */
.cofre { overflow: visible; }   /* la tapa abierta sobresale un poco del dibujo */
.cofre__tapa { transform-box: view-box; transform-origin: 30px 88px; }
.cofre__chispa { transform-box: fill-box; transform-origin: center; opacity: 0; }
.pantalla--activa .cofre__tapa { animation: cofre-abrir 1.1s .45s var(--curva) both; }
.pantalla--activa .cofre__chispa { animation: chispa-salta 1.1s 1s var(--curva) both; }
.pantalla--activa .cofre__chispa--2 { animation-delay: 1.12s; }
.pantalla--activa .cofre__chispa--3 { animation-delay: 1.24s; }
@keyframes cofre-abrir {
  0% { transform: rotate(0); }
  18% { transform: rotate(3deg); }
  32% { transform: rotate(-2deg); }
  46% { transform: rotate(2deg); }
  100% { transform: rotate(-24deg); }
}
@keyframes chispa-salta {
  0% { opacity: 0; transform: translateY(18px) scale(.2) rotate(-40deg); }
  55% { opacity: 1; transform: translateY(-34px) scale(1.25) rotate(10deg); }
  100% { opacity: 1; transform: translateY(-26px) scale(1) rotate(0); }
}

/* Reto superado: la insignia entra con un rebote. */
.pantalla--activa .insignia { animation: rebote .7s var(--curva) both; }
@keyframes rebote { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }

/* Pista nueva: la tarjeta se voltea al volver al mapa después de ganar un reto (js/app.js pone la clase). */
/* Lleva ".pantalla--activa >" para ganarle a la animación de entrada de la pantalla (subir). */
.pantalla--activa > .boleto--nueva { animation: voltear .9s var(--curva) both; }
@keyframes voltear {
  0% { transform: perspective(900px) rotateX(-88deg); opacity: 0; }
  60% { transform: perspective(900px) rotateX(12deg); opacity: 1; }
  100% { transform: perspective(900px) rotateX(0); }
}

/* La cima: la bandera ondea. */
.cima__bandera { transform-box: fill-box; transform-origin: left center; animation: ondear 1.4s ease-in-out infinite; }
@keyframes ondear { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(-9deg) scaleX(.9); } }

/* Confeti (js/fx.js): papelitos que caen; cada uno trae su posición, color y tiempos en variables. */
/* ".pantalla >" le gana a la regla que pone "position: relative" a todo lo que hay en una pantalla. */
.pantalla > .confeti { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; animation: none; }
.confeti i {
  position: absolute;
  top: -24px;
  left: var(--x);
  width: var(--lado);
  height: calc(var(--lado) * 1.6);
  background: var(--color);
  border: 1px solid rgba(0, 0, 0, .25);
  animation: confeti-cae var(--dura) var(--espera) cubic-bezier(.3, .2, .6, 1) both;
}
.confeti i.confeti__redondo { height: var(--lado); border-radius: 50%; }
.confeti--continuo i { animation-iteration-count: infinite; animation-fill-mode: backwards; }
@keyframes confeti-cae {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--deriva), 105vh, 0) rotate(var(--giro)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .estacion--actual .estacion__pulso { opacity: .5; transform: scale(1.35); }
  .cofre__tapa { transform: rotate(-24deg); }
  .cofre__chispa { opacity: 1; transform: translateY(-26px); }
}

/* ====================================================================================================
   Retos (js/juegos/). Colores del tema: --tinta, --tinta-2, --tarjeta, --amarillo, --azul (css/tema.css).
   Todo lo que se toca mide al menos 48 px de alto.
   ==================================================================================================== */
.juego { display: grid; gap: 14px; justify-items: center; }
.juego__ayuda { justify-self: start; margin: 0; color: var(--tinta-2, #555); font: 500 .98rem/1.4 var(--texto); }
.juego__estado { min-height: 1.5em; margin: 0; color: var(--tinta, #000); font: 700 1rem var(--texto); text-align: center; }

/* ---------- Sopa de letras ---------- */
.sopa__cuadro {
  display: grid;
  grid-template-columns: repeat(var(--lado), 1fr);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--tarjeta, #EEEBE8);
  touch-action: none;            /* arrastrar el dedo marca letras, no desplaza la página */
  -webkit-user-select: none;
  user-select: none;
}
.sopa__celda {
  aspect-ratio: 1;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tinta, #000);
  font: 800 1.25rem var(--display);
  cursor: pointer;
}
.sopa__celda--hallada { background: var(--amarillo); color: #000; }
.sopa__celda--marcada, .sopa__celda--hallada.sopa__celda--marcada { background: var(--azul, #0075FF); color: #fff; }
.sopa__palabras { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sopa__palabras li { padding: 6px 12px; border-radius: 999px; background: var(--tarjeta, #EEEBE8); color: #000; font: 700 .9rem var(--texto); }
.sopa__palabras li.hallada { background: #000; color: var(--amarillo); text-decoration: line-through; }

/* ---------- Rompecabezas deslizante ---------- */
.deslizante__arriba { display: flex; align-items: center; gap: 14px; width: 100%; }
.deslizante__muestra { flex: none; width: 64px; height: 64px; border: 2px solid #000; border-radius: 12px; background-size: cover; }
.deslizante__tablero {
  display: grid;
  grid-template-columns: repeat(var(--lado), 1fr);
  gap: 4px;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  padding: 4px;
  border-radius: 20px;
  background: #000;
}
.deslizante__pieza { position: relative; padding: 0; border: 0; border-radius: 14px; background-color: #fff; cursor: default; }
.deslizante__pieza--movible { outline: 4px solid var(--azul, #0075FF); outline-offset: -4px; cursor: pointer; }
.deslizante__numero {
  position: absolute; top: 6px; left: 6px;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: #000; color: #fff; font: 700 .8rem/22px var(--texto); text-align: center;
}
.deslizante__hueco { border-radius: 14px; background: rgba(255, 255, 255, .14); }
.deslizante__tablero--armado { gap: 0; }
.deslizante__tablero--armado .deslizante__pieza { border-radius: 0; }
.deslizante__tablero--armado .deslizante__numero { display: none; }

/* ---------- Ahorcado ---------- */
/* Los intentos son una montaña de 6 piezas: cada letra fallada derrumba una (js pone --caida). */
.ahorcado__vidas { width: min(64%, 230px); margin: 0; }
.montana { width: 100%; height: auto; overflow: visible; }
.montana__pieza { transform-box: fill-box; transform-origin: center; }
/* Una pieza caída queda invisible; la animación la muestra desprendiéndose y rodando hasta el suelo. */
.montana__pieza--caida { opacity: 0; animation: derrumbe .95s cubic-bezier(.45, 0, .85, .55) both; }
@keyframes derrumbe {
  0% { opacity: 1; transform: none; }
  12% { opacity: 1; transform: translate(calc(var(--cae) * -.06), -3px) rotate(calc(var(--gira) * -.06)); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--cae), 70px) rotate(var(--gira)) scale(.7); }
}
.ahorcado__palabra { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0; }
.ahorcado__letra { width: 28px; height: 42px; border-bottom: 4px solid #000; color: #000; font: 800 1.6rem/38px var(--display); text-align: center; }
.ahorcado__teclado { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: 100%; max-width: 420px; }
.ahorcado__tecla {
  min-height: 48px; padding: 0; border: 0; border-radius: 12px;
  background: var(--tarjeta, #EEEBE8); color: #000; font: 800 1.05rem var(--display); cursor: pointer;
}
.ahorcado__tecla--acierto { background: var(--amarillo); }
.ahorcado__tecla--fallo { background: transparent; color: var(--tinta-2, #555); text-decoration: line-through; }

/* ---------- Rompecabezas de piezas sueltas ---------- */
.puzzle__cuadro {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--lado), 1fr);
  width: min(100%, 300px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid #000;
  border-radius: 18px;
  background: #fff;
}
.puzzle__guia { position: absolute; inset: 0; background-size: cover; opacity: .14; pointer-events: none; }
.puzzle__lugar { position: relative; min-height: 48px; padding: 0; border: 1px dashed rgba(0, 0, 0, .35); background-color: transparent; cursor: pointer; }
.puzzle__lugar--lleno { border: 0; cursor: default; }
.puzzle__lugar--no { background-color: rgba(168, 7, 26, .2); }
.puzzle__bandeja {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 420px;
  min-height: 68px;
  padding: 10px;
  border-radius: 18px;
  background: var(--tarjeta, #EEEBE8);
  touch-action: none;            /* arrastrar una pieza no desplaza la página */
}
.puzzle__pieza { aspect-ratio: 1; min-height: 48px; padding: 0; border: 2px solid #000; border-radius: 10px; background-color: #fff; cursor: grab; touch-action: none; }
.puzzle__pieza--elegida { outline: 4px solid var(--azul, #0075FF); outline-offset: 2px; }
.puzzle__pieza--arrastrada { position: relative; z-index: 5; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); cursor: grabbing; }

/* ---------- Reto de foto (tienda aliada) ---------- */
.juego--foto { justify-items: stretch; }
.foto__pasos { display: grid; gap: 4px; margin: 0; padding-left: 1.3em; color: var(--tinta, #000); font: 500 1rem/1.4 var(--texto); }
.foto__tarjeta {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 12px 14px;
  border: 2px dashed rgba(0, 0, 0, .4);
  border-radius: 18px;
  background: var(--tarjeta, #EEEBE8);
  color: #000;
  cursor: pointer;
}
.foto__tarjeta:focus-within { outline: 3px solid var(--azul, #0075FF); outline-offset: 2px; }
.foto__tarjeta--lista { border-style: solid; border-color: #000; background: var(--amarillo); }
.foto__tarjeta--subiendo { opacity: .7; }
.foto__vista {
  display: grid; flex: none; place-items: center;
  width: 60px; height: 60px; border-radius: 12px;
  background: #000 center / cover; color: var(--amarillo); font: 800 1.4rem var(--display);
}
.foto__tarjeta--lista .foto__vista, .foto__tarjeta--subiendo .foto__vista { color: transparent; }
.foto__texto { display: grid; gap: 2px; font: 500 .92rem/1.35 var(--texto); }
.foto__aviso { font-weight: 700; }
/* El selector de archivo cubre toda la tarjeta, invisible: tocar la tarjeta abre la galería o la cámara. */
.foto__entrada { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.foto__privacidad { margin: 0; color: var(--tinta-2, #555); font: 500 .85rem/1.4 var(--texto); }

/* ---------- Hoja «Instalar en iPhone» (un <dialog> que sube desde abajo; la abre js/instalar.js) ---------- */
.hoja {
  width: 100%;
  max-width: 480px;
  max-height: 100dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
}
.hoja::backdrop { background: rgba(0, 0, 0, .55); }
.hoja__caja {
  display: grid;
  gap: 18px;
  max-height: 100dvh;
  overflow-y: auto;
  padding: 26px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  border-radius: 28px 28px 0 0;
}
.hoja[open] .hoja__caja { animation: hoja-sube .32s var(--curva, ease-out) both; }
@keyframes hoja-sube { from { transform: translateY(40px); opacity: 0; } }
.hoja__titulo { margin: 0; font-size: 1.7rem; line-height: 1.08; }
.hoja__pasos { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: paso; }
.hoja__pasos li { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 14px; font-size: 1.02rem; line-height: 1.35; }
.hoja__icono { width: 48px; height: 48px; padding: 11px; border-radius: 14px; box-sizing: border-box; }
.hoja__icono--app { padding: 0; }
.hoja__nota { margin: 0; font-size: .92rem; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) {
  .hoja[open] .hoja__caja { animation: none; }
}
