/* ═══════════════════════════════════════════════════════════════
   CLOTITEC PLAY · Gincanas Digitales Municipales
   styles.css — Design tokens (paleta «Verde profundo / Arena», ago-2026)
   Marca: verde #0E8A72 · arena #EDE5D6 · tinta #1A1A1A · verde profundo
   #0E8A72 como acento focal (uno por pantalla, jamás de fondo)
   Tipografía: Baloo 2 (títulos y cifras) + DM Sans (cuerpo)
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Marca */
  --c-primary: #0E8A72;
  --c-primary-strong: #0A6355; /* hover del primario: oscurece, nunca aclara */
  --c-primary-t1: #8CC0AF;
  --c-primary-t2: #B9D8CD;
  --c-primary-t3: #F2ECE1;
  --c-secondary: #EDE5D6;
  --c-secondary-t1: #F2ECE1;
  --c-secondary-t2: #F7F3EC;
  --c-secondary-t3: #FCFAF6;
  --c-ink: #1A1A1A;
  --c-gray-600: #5F5F5F;
  --c-gray-400: #A3A3A3;
  --c-gray-200: #DDDDDD;

  /* Acento focal verde profundo (era naranja hasta la migración de
     ago-2026). Regla de marca: UNO por pantalla, solo decorativo/dato
     destacado (4.29:1 sobre blanco — nunca texto pequeño, nunca fondo).
     Para texto o bordes que deban cumplir contraste se usa
     --c-focal-ink (7.17:1 sobre blanco). */
  --c-focal: #0E8A72;
  --c-focal-ink: #0A6355;

  /* Semánticos */
  --c-bg: #FCFAF6;
  --c-surface: #FFFFFF;
  --c-surface-2: #F7F3EC;
  /* Colores de texto verificados WCAG 2.1 AA (≥4.5:1 sobre --c-bg).
     No aclarar estos valores sin recalcular el contraste: la app se
     entrega a administraciones públicas sujetas al RD 1112/2018. */
  --c-text: #1A1A1A;         /* 16.69:1 */
  --c-text-muted: #5F5F5F;   /*  6.13:1 */
  --c-text-soft: #707070;    /*  4.75:1 */
  --c-border: #E1DBDA;
  --c-border-soft: rgba(26, 26, 26, 0.08);
  --c-accent: #0E8A72;       /*  4.29:1 sobre --c-bg (ring de foco, bordes) */
  --c-accent-ink: #0A6355;   /*  7.19:1 sobre --c-bg · 6.37:1 sobre t3 */
  --c-on-accent: #FFFFFF;    /*  Va sobre --c-primary-strong (#0A6355, 7.17:1),
                                NO sobre --c-primary: con el verde claro se
                                queda en 4.29:1 y los rellenos llevan texto
                                pequeño. Decisión de marca 2026-08-13. */
  --c-danger: #B03B3B;       /*  5.70:1 */
  --c-warn: #C9A227;         /* solo rellenos decorativos, nunca texto */
  --c-warn-ink: #7A5E00;     /*  5.88:1 — variante para texto */
  --c-ok: #0E8A72;
  /* Decorativos de medallas: el texto que va encima es --c-ink */
  --c-bronze: #B08968;

  /* Glass (píldoras de mapa, guía v2 §7-8) */
  --c-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(240, 246, 242, 0.88));
  --c-glass-solid: rgba(255, 255, 255, 0.92);
  --c-glass-border: rgba(26, 26, 26, 0.06);

  /* Tipografía */
  --f-heading: 'Baloo 2', sans-serif;
  --f-body: 'DM Sans', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;

  /* Geometría — escalera de radios de marca: 8 / 12 / 20 / 999 */
  --r-sm: 0.5rem;
  --r-md: 0.75rem;
  --r-lg: 1.25rem;
  --r-xl: 1.25rem;
  --r-2xl: 1.25rem;
  --r-full: 9999px;
  --sp: 1.5rem;
  --maxw: 1200px;

  /* Sombras de marca: casi nulas, teñidas de tinta (nunca negro puro) */
  --sh-sm: 0 1px 2px rgba(26, 26, 26, 0.05);
  --sh-md: 0 2px 8px -2px rgba(26, 26, 26, 0.07);
  --sh-lg: 0 4px 16px -2px rgba(26, 26, 26, 0.08);
  --sh-pill: 0 2px 10px -2px rgba(26, 26, 26, 0.10);

  /* Movimiento: física suave compartida (misma curva que .sheet) */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-theme="dark"] {
  --c-bg: #1A1A1A;
  --c-surface: #242624;
  --c-surface-2: #2C2F2C;
  --c-text: #EDE5D6;         /* 12.18:1 sobre --c-surface */
  --c-text-muted: #A3A3A3;   /*  6.04:1 */
  --c-text-soft: #949494;    /*  5.02:1 */
  --c-danger: #E58585;
  --c-warn-ink: #E0BC5A;
  /* Los tintes de marca se oscurecen: si no, los fondos sutiles de acento
     (chips, fila propia del ranking, zona de check-in) quedan claros y el
     texto claro encima se vuelve ilegible. Contraste sobre #1E2B26:
     texto 11.93:1 · acento 7.19:1 · atenuado 5.83:1 */
  /* OJO: no tocar --c-secondary ni --c-bronze aquí. --c-secondary es el
     texto sobre superficies oscuras (hero, toast, botones oscuros) y debe
     seguir siendo claro; --c-bronze es fondo de medalla con texto negro. */
  --c-primary-t3: #1E2B26;
  --c-primary-t2: #2E4A3E;
  --c-border: #3A3E3A;
  --c-border-soft: rgba(255, 255, 255, 0.08);
  --c-accent: #8CC0AF;       /* 8.51:1 sobre --c-bg oscuro */
  --c-accent-ink: #8CC0AF;
  --c-on-accent: #FFFFFF;    /* el relleno --c-primary no cambia con el tema */
  --c-glass: linear-gradient(135deg, rgba(36, 38, 36, 0.92), rgba(28, 30, 28, 0.88));
  --c-glass-solid: rgba(36, 38, 36, 0.92);
  --c-glass-border: rgba(255, 255, 255, 0.08);
  --sh-md: 0 1px 3px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 4px 16px rgba(0, 0, 0, 0.5);
  --sh-pill: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ── Reset / base ───────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--f-heading); line-height: 1.2; font-weight: 700; }
button { font-family: var(--f-body); cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: var(--f-body); font-size: 1rem; color: var(--c-text); }
img { max-width: 100%; }
a { color: var(--c-accent-ink); }
[hidden] { display: none !important; }

/* var(--c-accent), no --c-primary: en oscuro el verde de marca apenas
   contrasta con el fondo tinta (~3.2:1); el acento sí (8.51:1). */
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: var(--r-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Pantallas (SPA por secciones) ──────────────────────────── */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
}
.screen.active { display: flex; }
.screen-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--r-md);
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  text-decoration: none;
  min-height: 48px; /* táctil accesible */
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--c-primary-strong);
  color: var(--c-on-accent);
  box-shadow: 0 4px 14px -2px rgba(14, 138, 114, 0.35);
}
.btn-primary:hover { background: var(--c-primary-strong); }
.btn-dark { background: var(--c-ink); color: var(--c-secondary); }
.btn-dark:hover { background: var(--c-gray-600); }
.btn-outline { background: transparent; border: 1.5px solid var(--c-primary); color: var(--c-accent-ink); }
.btn-outline:hover { background: var(--c-primary-t3); }
.btn-ghost { background: transparent; color: var(--c-text-muted); font-weight: 500; }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-block { width: 100%; }
.btn-lg { padding: 1.125rem 2rem; font-size: 1.125rem; border-radius: var(--r-lg); }
.btn-sm { padding: 0.5rem 0.875rem; font-size: 0.875rem; min-height: 36px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* Botón icono cuadrado (atrás de la ficha del punto, etc.). El class
   .icon-btn no tenía regla propia: sin esto el botón atrás quedaba sin
   estilo (el reset global de <button> le quita fondo y borde). */
.icon-btn {
  align-items: center;
  border-radius: var(--r-full);
  display: inline-flex;
  flex-shrink: 0;
  font-size: 1.25rem;
  height: 2.75rem;
  justify-content: center;
  width: 2.75rem;
}
.icon-btn:hover { background: var(--c-surface-2); }

/* ── Landing ────────────────────────────────────────────────── */
/* Hero editorial (Culture Trip + Cleo AI, design-refs/refs.md tanda 3):
   fotografía a sangre en el tercio superior y hoja clara montada encima
   con radio de marca. El ÚNICO acento focal de esta pantalla es la
   barra de acento bajo el titular. */
.land-hero { position: relative; height: min(44vh, 420px); background: var(--c-ink); }
.land-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Velo funcional de legibilidad (no decorativo): el logo blanco va sobre
   cielo claro imprevisible — mismo criterio que el degradado de .pano-top. */
.land-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5.5rem;
  background: linear-gradient(rgba(26, 26, 26, 0.5), rgba(26, 26, 26, 0));
  z-index: 1;
  pointer-events: none;
}
.landing-logos {
  position: absolute;
  top: calc(0.875rem + var(--safe-t));
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-inline: 1rem;
}
/* Caja explícita con la proporción REAL de este SVG (viewBox 320×58,
   trazado VTracer — no la 747:214 del manual): el fichero no declara
   width/height y como flex item se estiraba a todo el ancho. */
.landing-logos > img { height: 26px; width: 143px; flex: none; filter: drop-shadow(0 1px 4px rgba(26, 26, 26, 0.5)); }
.muni-logo-chip {
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--r-full);
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--c-ink);
  font-weight: 700;
  font-family: var(--f-heading);
  font-size: 0.875rem;
  box-shadow: var(--sh-pill);
}
/* Hoja clara montada sobre la foto */
.land-sheet {
  position: relative;
  z-index: 1;
  background: var(--c-bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  margin-top: -1.25rem;
  padding: 2rem 1.5rem 2.25rem;
  text-align: center;
}
/* Label de marca: DM Sans 700 mayúsculas en verde o gris, nunca el focal */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent-ink);
  margin-bottom: 0.625rem;
}
.land-sheet h1 {
  font-size: clamp(2.125rem, 8vw, 3.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 0.875rem;
}
.land-sheet h1 .hl { color: var(--c-accent-ink); }
.accent-bar { width: 76px; height: 8px; border-radius: 4px; background: var(--c-focal); margin: 0 auto 1rem; }
.landing-sub {
  font-size: 1.0625rem;
  color: var(--c-text-muted);
  max-width: 32rem;
  margin: 0 auto 1.75rem;
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--c-border-soft);
  border-block: 1px solid var(--c-border-soft);
}
.landing-stat { background: var(--c-surface); padding: 1.25rem 0.75rem; text-align: center; }
.landing-stat b {
  display: block;
  font-family: var(--f-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--c-accent-ink);
}
.landing-stat span { font-size: 0.8125rem; color: var(--c-text-muted); }

.landing-section { padding: 2.5rem 1.5rem; max-width: var(--maxw); margin-inline: auto; width: 100%; }
.landing-section h2 { font-size: 1.5rem; margin-bottom: 1.25rem; text-align: center; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--sh-sm);
}
.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--c-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}
.feature-card h3 { font-size: 1.0625rem; margin-bottom: 0.25rem; }
.feature-card p { font-size: 0.875rem; color: var(--c-text-muted); }

.landing-footer {
  background: var(--c-ink);
  color: var(--c-gray-400);
  text-align: center;
  padding: 2rem 1.5rem calc(2rem + var(--safe-b));
  font-size: 0.8125rem;
}
.landing-footer img { height: 24px; opacity: 0.9; margin-bottom: 0.75rem; }
.landing-footer a { color: var(--c-primary-t1); text-decoration: none; }

/* Crédito de la portada del hero. Honestidad de origen: la imagen de la
   demo está generada por IA y hay que decirlo donde se ve, no solo en el
   código. Mismo criterio de contraste que .media-credit. */
.hero-credit {
  background: rgba(15, 23, 20, .8);
  border-radius: var(--r-sm);
  bottom: 1.75rem;
  color: #fff;
  font-size: .68rem;
  left: .5rem;
  margin: 0;
  padding: .2rem .45rem;
  position: absolute;
  z-index: 2;
}

/* ── Tarjeta de catálogo (destino o gincana) ─────────────────── */
/* komoot/Culture Trip: portada arriba, cuerpo debajo y fila de métricas.
   El botón del título se estira sobre toda la tarjeta (::after) para que
   la superficie completa sea pulsable con un único nombre accesible. */
.travel-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--sh-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.travel-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.travel-card:active { transform: translateY(0); }
.tc-media { background: var(--c-secondary-t1); display: block; }
.tc-media .media { border-radius: 0; margin: 0; }
/* max-height además de la proporción: en pantalla ancha un 16:9 de 34rem
   ya es alto, y sin tope la portada se comía la tarjeta entera. */
.tc-media img { aspect-ratio: 16 / 9; max-height: 260px; object-fit: cover; }
/* Sin portada: el emoji hace de portada sobre superficie arena */
.tc-emoji {
  align-items: center;
  aspect-ratio: 16 / 5;
  display: flex;
  font-size: 2.5rem;
  justify-content: center;
}
.tc-body { padding: 1rem 1.125rem 1.125rem; }
.tc-body h3 { font-size: 1.125rem; margin: 0 0 .25rem; }
.tc-body p { color: var(--c-text-muted); font-size: .875rem; margin: 0 0 .625rem; }
.tc-open {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
}
.tc-open::after { content: ''; position: absolute; inset: 0; }
/* El foco se pinta sobre la tarjeta entera, no sobre el texto del título:
   el objetivo pulsable real es la tarjeta (WCAG 2.4.7). */
.tc-open:focus-visible { outline: none; }
.tc-open:focus-visible::after {
  border-radius: var(--r-lg);
  outline: 3px solid var(--c-accent);
  outline-offset: -3px;
}

/* ── Pantalla de destino (hub de municipio) ──────────────────── */
.dest-hero { background: var(--c-ink); position: relative; }
.dest-hero .media { border-radius: 0; margin: 0; }
/* La hoja monta 1.25rem sobre la portada: a ras de fondo el crédito
   quedaría debajo de ella y en móvil desaparecería entero. */
.dest-hero .media-credit { bottom: 1.75rem; }
.dest-hero img { aspect-ratio: 16 / 10; max-height: min(42vh, 380px); object-fit: cover; width: 100%; }
/* Velo funcional: el botón atrás va sobre una foto imprevisible */
.dest-hero::before {
  background: linear-gradient(rgba(26, 26, 26, 0.45), rgba(26, 26, 26, 0));
  content: '';
  height: 5rem;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}
.dest-back {
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-ink);
  left: .75rem;
  position: absolute;
  top: calc(.75rem + var(--safe-t));
  z-index: 2;
  box-shadow: var(--sh-pill);
}
.dest-back:hover { background: #fff; }
/* Hoja a todo el ancho, como .land-sheet: con max-width quedaban dos
   franjas de portada asomando a los lados en escritorio. */
.dest-sheet {
  background: var(--c-bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  margin-top: -1.25rem;
  padding: 1.75rem 1.5rem .5rem;
  position: relative;
  text-align: center;
  z-index: 1;
}
/* Mayúsculas del patrón Culture Trip: el nombre del municipio como rótulo,
   no como frase. text-transform, no el texto en mayúsculas en el dato: el
   lector de pantalla debe seguir leyendo "Santander", no "S-A-N-T…". */
.dest-sheet h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-transform: uppercase;
}
.dest-sheet h1:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 4px; }
.dest-lead { color: var(--c-text-muted); margin-inline: auto; max-width: 30rem; }
/* Columna de catálogo a ancho de lectura, como el resto de páginas
   internas (.page-body, .rank-page): una tarjeta de 1200 px de ancho no
   se lee, se sufre. */
.dest-list,
#huntList { display: flex; flex-direction: column; gap: .75rem; margin-inline: auto; max-width: 34rem; width: 100%; }

/* ── Tarjetas de gincana disponibles ────────────────────────── */
.hunt-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  border-radius: var(--r-lg);
  padding: 1rem;
  box-shadow: var(--sh-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  text-align: left;
  width: 100%;
}
.hunt-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.hunt-card-emoji {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-primary-t3);
  border-radius: var(--r-lg);
}
.hunt-card-body { flex: 1; min-width: 0; }
.hunt-card-body h3 { font-size: 1.0625rem; }
.hunt-card-body p { font-size: 0.8125rem; color: var(--c-text-muted); }
.hunt-card-meta { display: flex; gap: 0.5rem; margin-top: 0.375rem; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border-radius: var(--r-full);
  padding: 0.125rem 0.625rem;
}
.chip-accent { background: var(--c-primary-t3); color: var(--c-accent-ink); font-weight: 700; }

/* ── Formularios (registro / unirse) ────────────────────────── */
.form-page {
  max-width: 30rem;
  margin-inline: auto;
  width: 100%;
  padding: calc(1.5rem + var(--safe-t)) 1.5rem calc(2rem + var(--safe-b));
}
.form-back { margin-bottom: 1rem; color: var(--c-text-muted); font-size: 0.9375rem; display: inline-flex; align-items: center; gap: 0.375rem; }
.form-page h2 { font-size: 1.75rem; margin-bottom: 0.375rem; }
.form-lead { color: var(--c-text-muted); margin-bottom: 1.5rem; }
.field { margin-bottom: 1.25rem; }
.field label { display: block; font-weight: 700; font-size: 0.9375rem; margin-bottom: 0.375rem; }
.field .hint { font-size: 0.8125rem; color: var(--c-text-soft); margin-top: 0.25rem; }
.input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  transition: border-color 0.2s;
  min-height: 48px;
}
.input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(14, 138, 114, 0.2); }
.input-code {
  font-family: var(--f-mono);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-weight: 500;
}
.input-error { border-color: var(--c-danger) !important; }
.field-error { color: var(--c-danger); font-size: 0.8125rem; margin-top: 0.25rem; }

/* Selector de avatar emoji */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 0.5rem; }
.avatar-opt {
  font-size: 1.625rem;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.avatar-opt:hover { transform: scale(1.08); }
.avatar-opt.selected { border-color: var(--c-primary); background: var(--c-primary-t3); box-shadow: 0 0 0 3px rgba(14, 138, 114, 0.25); }

/* Consentimiento RGPD */
.consent-box {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1rem;
  font-size: 0.8125rem;
  color: var(--c-text-muted);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.consent-box input[type="checkbox"] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--c-primary); flex: none; }

/* Radio de modo equipo */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.mode-card {
  border: 2px solid var(--c-border);
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 1rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.mode-card .mc-emoji { font-size: 1.75rem; display: block; margin-bottom: 0.375rem; }
.mode-card b { font-family: var(--f-heading); font-size: 0.9375rem; }
.mode-card p { font-size: 0.75rem; color: var(--c-text-muted); }
.mode-card.selected { border-color: var(--c-primary); background: var(--c-primary-t3); }

/* ── Pre-permiso ubicación (patrón Strava/Lugg) ─────────────── */
.perm-hero {
  flex: 1;
  background: var(--c-secondary-t1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  min-height: 38dvh;
}
.perm-sheet { padding: 0 1.5rem calc(2rem + var(--safe-b)); max-width: 30rem; margin-inline: auto; width: 100%; text-align: center; }
.perm-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--r-full);
  background: var(--c-primary-t3);
  border: 2px solid var(--c-primary-t2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: -36px auto 1rem;
  position: relative;
  box-shadow: var(--sh-md);
}
.perm-sheet h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.perm-sheet p { color: var(--c-text-muted); font-size: 0.9375rem; margin-bottom: 1.5rem; }

/* ── Tutorial ───────────────────────────────────────────────── */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(26, 26, 26, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}
.tut-card {
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  max-width: 26rem;
  width: 100%;
  padding: 1.5rem;
  margin-bottom: calc(1rem + var(--safe-b));
  box-shadow: var(--sh-lg);
}
.tut-progress { display: flex; gap: 0.375rem; margin-bottom: 1rem; }
.tut-progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--c-border); }
.tut-progress span.done { background: var(--c-primary); }
.tut-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; }
.tut-card h3 { font-size: 1.25rem; margin-bottom: 0.375rem; }
.tut-card p { font-size: 0.9375rem; color: var(--c-text-muted); margin-bottom: 1.25rem; }
.tut-nav { display: flex; gap: 0.75rem; justify-content: space-between; }

/* ── Cabecera de juego (in-game) ────────────────────────────── */
.game-topbar {
  position: absolute;
  top: calc(0.75rem + var(--safe-t));
  left: 0.75rem;
  right: 0.75rem;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}
.game-topbar > * { pointer-events: auto; }

/* Píldoras glass (guía v2 §7-8, paleta nueva) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1rem;
  border-radius: 22px;
  background: var(--c-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--c-glass-border);
  box-shadow: var(--sh-pill);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-text);
  min-height: 42px;
  white-space: nowrap;
}
.pill .pi { font-size: 1.125rem; line-height: 1; }
.pill.active { background: var(--c-primary-strong); color: var(--c-on-accent); border-color: transparent; }
.pill-stack { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; }
.pill-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill-help { background: var(--c-primary-strong); color: var(--c-on-accent); animation: helpPulse 2.5s ease-in-out infinite; }
@keyframes helpPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 138, 114, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(14, 138, 114, 0); }
}
@media (max-width: 480px) {
  .pill .pl { display: none; } /* móvil: solo emoji */
  .pill { padding: 0.5625rem 0.75rem; }
  .pill-progress .pl { display: inline !important; } /* progreso siempre visible */
}

/* Progreso inferior estilo Bump */
.game-bottombar {
  position: absolute;
  bottom: calc(4.25rem + var(--safe-b)); /* por encima del tabbar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.pill-progress { padding-right: 0.625rem; }
.pill-progress .ring {
  width: 30px;
  height: 30px;
  flex: none;
}

/* ── Mapa ───────────────────────────────────────────────────── */
#map, .map-holder { position: absolute; inset: 0; }
.map-screen { position: relative; min-height: 100dvh; overflow: hidden; }

/* Marcador del jugador */
.player-marker {
  width: 22px;
  height: 22px;
  background: var(--c-primary);
  border: 3.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(14, 138, 114, 0.45);
  animation: playerPulse 2.4s ease-out infinite;
}
@keyframes playerPulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 138, 114, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(14, 138, 114, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 138, 114, 0); }
}

/* Marcador de punto de juego (emoji sobre pin suave) */
.point-marker {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--c-glass-solid);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
  opacity: 0.94;
}
.point-marker:hover { transform: scale(1.1); opacity: 1; }
.point-marker.done { filter: grayscale(0.2); }
.point-marker.done::after {
  content: '✓';
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  background: var(--c-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.point-marker.locked { filter: grayscale(1); opacity: 0.55; }
/* El siguiente punto es EL acento focal de la pantalla de mapa
   (regla de marca: un focal por pantalla). Borde sobre teselas
   claras u oscuras: el verde profundo #0E8A72 mantiene ≥3:1 en ambas
   (4.29:1 sobre blanco · 4.90:1 sobre negro — UI, 1.4.11). */
.point-marker.next { border-color: var(--c-focal); animation: nextPointGlow 2s ease-in-out infinite; }
@keyframes nextPointGlow {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14), 0 0 0 0 rgba(14, 138, 114, 0.55); }
  50% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14), 0 0 0 12px rgba(14, 138, 114, 0); }
}
.point-marker .pm-num {
  position: absolute;
  bottom: -6px;
  left: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--c-ink);
  color: var(--c-secondary);
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--f-mono);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ── v2 · Modo explorador (GPS puro, estilo Pokémon GO) ─────── */

/* Aparición de un punto descubierto */
.point-marker.spawn { animation: spawnPop 0.9s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes spawnPop {
  0% { transform: scale(0); opacity: 0; }
  55% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(1); }
}

/* Overlay de encuentro/captura */
.encounter-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(26, 26, 26, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: var(--c-secondary);
  animation: encIn 0.3s ease-out;
}
@keyframes encIn { from { opacity: 0; } to { opacity: 1; } }
.encounter-stage { position: relative; width: 200px; height: 200px; margin-bottom: 1rem; }
.encounter-rings {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(140, 192, 175, 0.6);
  animation: encRing 1.8s ease-out infinite;
}
.encounter-rings::after {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 2px solid rgba(140, 192, 175, 0.3);
  animation: encRing 1.8s ease-out infinite 0.5s;
}
@keyframes encRing {
  0% { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}
.encounter-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  animation: encBounce 1.6s ease-in-out infinite;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.45));
}
@keyframes encBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-14px) scale(1.05); }
}
.encounter-title { font-size: 1.5rem; color: #fff; margin-bottom: 0.25rem; font-family: var(--f-heading); }
.encounter-sub { color: rgba(237, 229, 214, 0.75); font-size: 0.9375rem; margin-bottom: 2rem; }
.encounter-actions { display: flex; gap: 0.75rem; width: 100%; max-width: 22rem; }

/* Radar de puntos ocultos */
.radar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.25rem;
  border-bottom: 1px solid var(--c-border-soft);
}
.radar-row b { flex: 1; letter-spacing: 0.2em; color: var(--c-text-soft); }
.radar-emoji {
  font-size: 1.625rem;
  filter: blur(5px) grayscale(0.7);
  opacity: 0.8;
}
.radar-band {
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--r-full);
  padding: 0.25rem 0.75rem;
}
.radar-band.b1 { background: var(--c-surface-2); color: var(--c-text-soft); }
.radar-band.b2 { background: rgba(169, 213, 203, 0.18); color: #0a6355; }
.radar-band.b3 { background: var(--c-primary-t3); color: var(--c-accent-ink); }
.radar-band.b4 { background: rgba(201, 162, 39, 0.18); color: var(--c-warn-ink); animation: blink 1.2s step-end infinite; }

#pillSim { background: rgba(201, 162, 39, 0.16); border-color: rgba(201, 162, 39, 0.4); }

/* ── Media de contenido (renderMedia: foto / histórica / recreación IA) ── */
.media { border-radius: var(--r-xl); margin: 0; overflow: hidden; position: relative; }
.media img { display: block; width: 100%; }

/* Cartela de recreación IA: fondo sólido, no degradado, para garantizar
   el contraste 4.5:1 (WCAG 1.4.3) sobre cualquier imagen. */
.media-cartela {
  background: rgba(15, 23, 20, .88);
  bottom: 0; color: #fff; font-size: .78rem; left: 0;
  letter-spacing: .01em; padding: .45rem .7rem; position: absolute; right: 0;
}
/* max-width: sin él la caja se dimensiona por shrink-to-fit y un crédito
   largo (p. ej. la declaración de imagen generada por IA) se sale de la
   figura y se corta. Con tope, envuelve a dos líneas y no se pierde
   texto: un crédito recortado deja de cumplir su función. */
.media-credit {
  bottom: 0; background: rgba(15, 23, 20, .7); color: #fff; font-size: .7rem;
  max-width: calc(100% - .5rem);
  padding: .25rem .5rem; position: absolute; right: 0;
}
/* Si falta el fichero, el hueco no debe romper la maquetación. */
.media-missing { background: var(--c-surface-2); min-height: 140px; }
.media-missing img { display: none; }

/* ── Ficha del punto (pantalla screen-punto) ───────────────────
   AllTrails (pestañas de capas) + Google Arts & Culture (píldora
   de audio anclada). */
#screen-punto { padding-bottom: 5rem; }
.punto-top { align-items: center; display: flex; gap: .75rem; padding: .75rem 1rem; }
.punto-top h1 { font-size: 1.25rem; margin: 0; }
.punto-hero { margin: 0 0 1.25rem; }

/* Comparador antes/después (mountCompare, Task 10). El raíl (input range)
   va FUERA de la imagen: un tirador arrastrable sobre la foto no es
   operable por teclado, un <input type=range> lo es de serie (WCAG 2.1.1). */
.cmp { display: grid; gap: .5rem; margin: 0 1rem 1.25rem; }
.cmp-stack { border-radius: var(--r-xl); overflow: hidden; position: relative; }
.cmp-stack .media { border-radius: 0; }
.cmp-clip { height: 100%; left: 0; overflow: hidden; position: absolute; top: 0; width: 50%; }
.cmp-clip .cmp-img img { max-width: none; width: var(--cmp-w, 100vw); }
.cmp-rail { align-items: center; display: flex; gap: .75rem; font-size: .8rem; }
.cmp-rail input { flex: 1; }
.cmp-rail input:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; }
.punto-relato { padding: 0 1rem 1rem; }
.punto-capas { display: grid; gap: .5rem; padding: 0 1rem; }
.layer { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.layer summary { cursor: pointer; font-weight: 600; padding: .85rem 1rem; }
.layer summary:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.layer-body { padding: 0 1rem 1rem; }
.layer-src { color: var(--c-text-muted); font-size: .8rem; margin-top: .5rem; }
/* color: var(--c-on-accent), no #fff (brief original) — blanco sobre
   --c-accent da ~2.7:1 en claro y ~1.9:1 en oscuro (falla WCAG 4.5:1).
   --c-on-accent es el mismo patrón ya verificado que usa .btn-primary
   (6.53:1 claro / 9.1:1 oscuro sobre este verde). */
.result-unlock { background: var(--c-primary-strong); border: 0; border-radius: var(--r-lg); color: var(--c-on-accent); font-weight: 600; margin-top: 1rem; padding: .85rem 1.25rem; width: 100%; }
.punto-pano { padding: 1rem 1rem 0; }

/* ── Visor 360 (pantalla screen-pano, Fase 4) ──────────────────
   Google Arts & Culture (design-refs/refs.md): coach-mark del gesto
   sobre el panorama, X arriba a la derecha y crédito abajo. Fondo
   oscuro fijo en ambos temas: el panorama es el protagonista. */
#screen-pano { background: #0F1714; color: #fff; position: relative; }
.pano-top {
  align-items: center;
  background: linear-gradient(rgba(15, 23, 20, .8), rgba(15, 23, 20, 0));
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  left: 0;
  padding: calc(.5rem + var(--safe-t)) 1rem .75rem;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 6;
}
.pano-top h1 { font-size: 1.1rem; margin: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.pano-top .icon-btn { background: rgba(15, 23, 20, .65); color: #fff; }
.pano-top .icon-btn:hover { background: rgba(15, 23, 20, .85); }
/* pannellum.css se carga perezosamente DESPUÉS de esta hoja y añade al
   mismo div la clase .pnlm-container con position:relative — ganaba el
   cascade, el visor colapsaba a alto 0 y el panorama se veía negro.
   El selector id+clase gana a .pnlm-container sea cual sea el orden. */
.pano-viewer,
#panoViewer.pnlm-container { position: absolute; inset: 0; width: 100%; height: 100%; }
.pano-loading { align-items: center; display: flex; height: 100%; justify-content: center; }
/* Crédito del panorama: mismo criterio de contraste que .media-credit
   pero con fondo al 88 % (texto pequeño sobre imagen imprevisible). */
.pano-credit {
  background: rgba(15, 23, 20, .88);
  border-radius: var(--r-sm);
  bottom: calc(.5rem + var(--safe-b));
  color: #fff;
  font-size: .7rem;
  left: .5rem;
  margin: 0;
  padding: .25rem .5rem;
  position: absolute;
  z-index: 6;
}
/* Coach-mark: no bloquea el gesto que enseña (pointer-events: none).
   La animación de la mano queda anulada por el prefers-reduced-motion
   global (línea ~126). */
.pano-coach {
  align-items: center;
  background: rgba(15, 23, 20, .88);
  border-radius: var(--r-xl);
  color: #fff;
  display: flex;
  gap: .75rem;
  left: 50%;
  max-width: min(85vw, 22rem);
  padding: .9rem 1.1rem;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
}
.pano-coach-hand { animation: panoDrag 1.6s ease-in-out infinite; font-size: 1.6rem; }
@keyframes panoDrag { 0%, 100% { transform: translateX(-7px); } 50% { transform: translateX(7px); } }
/* Fallback sin WebGL / sin librería: panorámica plana desplazable.
   El contenedor recibe foco (tabindex=0) para poder hacer scroll con
   teclado; la imagen anula el max-width global para no encogerse. */
.pano-fallback {
  align-content: center;
  display: grid;
  gap: .75rem;
  height: 100%;
  padding: calc(4rem + var(--safe-t)) 1rem calc(2.5rem + var(--safe-b));
}
.pano-fallback-notice {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--r-md);
  font-size: .9rem;
  padding: .75rem 1rem;
}
.pano-fallback-scroll { border-radius: var(--r-lg); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pano-fallback-scroll:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.pano-fallback-scroll img { display: block; height: min(55vh, 420px); max-width: none; width: auto; }

/* ── Bottom sheet de punto ──────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(26, 26, 26, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--c-surface);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: 0.75rem 1.5rem calc(1.5rem + var(--safe-b));
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 82dvh;
  overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}
.sheet.open { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--c-gray-200); border-radius: 2px; margin: 0 auto 1rem; }
.sheet h3 { font-size: 1.375rem; display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.25rem; }
.sheet .sheet-sub { color: var(--c-text-muted); font-size: 0.9375rem; margin-bottom: 1rem; }
.sheet-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* ── Navegación al punto (brújula / frío-caliente) ──────────── */
.nav-panel {
  text-align: center;
  padding: 1rem 1.5rem calc(1.5rem + var(--safe-b));
}
.compass-wrap { position: relative; width: 180px; height: 180px; margin: 0.5rem auto 1rem; }
.compass-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px dashed var(--c-primary-t2);
  animation: spinSlow 24s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.compass-arrow {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  transition: transform 0.4s ease-out;
  box-shadow: var(--sh-md);
}
.nav-distance { font-family: var(--f-heading); font-size: 2.5rem; font-weight: 800; }
.nav-distance small { font-size: 1.125rem; color: var(--c-text-muted); font-weight: 600; }
.heat-meter { display: flex; gap: 4px; justify-content: center; margin: 0.75rem 0 0.25rem; }
.heat-meter span { width: 26px; height: 8px; border-radius: 4px; background: var(--c-border); transition: background 0.3s; }
.heat-meter span.on-1 { background: #A9D5CB; }
.heat-meter span.on-2 { background: var(--c-primary-t1); }
.heat-meter span.on-3 { background: var(--c-primary); }
.heat-meter span.on-4 { background: var(--c-warn); }
.heat-meter span.on-5 { background: var(--c-danger); }
.heat-label { font-size: 0.875rem; font-weight: 700; color: var(--c-text-muted); margin-bottom: 0.75rem; }

/* ── Check-in / llegada ─────────────────────────────────────── */
.checkin-zone {
  border: 2px dashed var(--c-primary);
  background: var(--c-primary-t3);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
}
.checkin-zone.far { border-color: var(--c-border); background: var(--c-surface-2); }

/* Escáner QR */
.qr-video-wrap {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  aspect-ratio: 1;
  background: #000;
  max-width: 22rem;
  margin: 0 auto 1rem;
}
.qr-video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.qr-reticle {
  position: absolute;
  inset: 14%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}
.qr-reticle::after {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  top: 0;
  height: 2px;
  background: var(--c-primary);
  animation: scanline 2.2s ease-in-out infinite;
}
@keyframes scanline { 0%, 100% { top: 4%; } 50% { top: 92%; } }

/* ── Pantalla de prueba (quiz estilo Bloom) ─────────────────── */
.challenge-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.875rem + var(--safe-t)) 1.25rem 0.5rem;
}
.seg-progress { display: flex; gap: 0.3125rem; flex: 1; margin-inline: 0.75rem; }
.seg-progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--c-border); }
.seg-progress span.done { background: var(--c-primary); }
.timer-pill {
  font-family: var(--f-mono);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 0.3125rem 0.875rem;
  font-size: 0.9375rem;
}
.timer-pill.low { background: rgba(194, 94, 94, 0.12); border-color: var(--c-danger); color: var(--c-danger); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

.challenge-body { flex: 1; padding: 1rem 1.5rem; max-width: 36rem; margin-inline: auto; width: 100%; display: flex; flex-direction: column; }
.challenge-kind { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-accent-ink); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.375rem; }
.challenge-q { font-size: clamp(1.375rem, 4.5vw, 1.75rem); font-weight: 800; margin-bottom: 1.5rem; }
.challenge-img { border-radius: var(--r-xl); margin-bottom: 1.25rem; max-height: 220px; object-fit: cover; width: 100%; }

.answers { display: flex; flex-direction: column; gap: 0.75rem; }
.answer {
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  position: relative;
  min-height: 54px;
}
.answer:hover { border-color: var(--c-primary-t1); }
.answer:active { transform: scale(0.99); }
.answer.correct { border-color: var(--c-ok); background: var(--c-primary-t3); font-weight: 700; }
.answer.correct::after { content: '✓'; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--c-accent-ink); font-weight: 800; }
.answer.wrong { border-color: var(--c-danger); background: rgba(194, 94, 94, 0.08); }
.answer.wrong::after { content: '✕'; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--c-danger); font-weight: 800; }
.answer:disabled { cursor: default; opacity: 1; }
.answer.dim { opacity: 0.5; }

/* Pista */
.hint-row { margin-top: 1rem; text-align: center; }
.hint-box {
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: var(--r-lg);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  margin-top: 0.75rem;
  text-align: left;
}

/* Relato / historia */
.story-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  box-shadow: var(--sh-sm);
  margin-bottom: 1.25rem;
}
.story-card .story-era { font-size: 0.8125rem; font-weight: 700; color: var(--c-accent-ink); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.5rem; }
.story-card p { font-size: 1.0625rem; line-height: 1.75; color: var(--c-text); }
.story-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--c-ink);
  color: var(--c-secondary);
  border-radius: var(--r-full);
  padding: 0.625rem 1.25rem;
  font-weight: 700;
  font-size: 0.9375rem;
  margin-top: 1rem;
}
.story-audio-btn.playing .eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq { display: none; }
.eq i { width: 3px; background: var(--c-primary-t1); border-radius: 1px; animation: eqBar 0.8s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: 0.2s; }
.eq i:nth-child(3) { animation-delay: 0.4s; }
@keyframes eqBar { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* Píldora de audio de la ficha del punto (mismo look que .story-audio-btn;
   clase propia porque toggleStoryAudio la corrige a partir de e.currentTarget
   y necesita su propio sa-label sin el marcador .eq). Fondo/texto fijos
   (--c-ink/--c-secondary) para mantener contraste en ambos temas. */
.btn-audio {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--c-ink);
  color: var(--c-secondary);
  border-radius: var(--r-full);
  padding: 0.625rem 1.25rem;
  font-weight: 700;
  font-size: 0.9375rem;
  margin-top: 1rem;
}
.btn-audio.playing { background: var(--c-accent-ink); }

/* Foto */
.photo-drop {
  border: 2px dashed var(--c-border);
  border-radius: var(--r-xl);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--c-text-muted);
  background: var(--c-surface);
  cursor: pointer;
}
.photo-drop img { border-radius: var(--r-lg); max-height: 240px; }

/* ── Resultado de prueba ────────────────────────────────────── */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.result-card {
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  padding: 2rem 1.5rem;
  max-width: 24rem;
  width: 100%;
  text-align: center;
  box-shadow: var(--sh-lg);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-emoji { font-size: 3.5rem; margin-bottom: 0.5rem; }
.result-card h3 { font-size: 1.5rem; margin-bottom: 0.25rem; }
/* El dato destacado es el focal de la tarjeta de resultado. En claro
   usa --c-focal-ink #0A6355 (7.17:1 sobre superficie); en oscuro no hay
   focal de texto verificado, así que cae al acento verde claro. */
.result-points {
  font-family: var(--f-heading);
  font-size: 2.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--c-focal-ink);
  margin: 0.5rem 0;
}
html[data-theme="dark"] .result-points { color: var(--c-accent); }
.result-detail { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; color: var(--c-text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* Confeti simple */
.confetti { position: fixed; top: -12px; z-index: 61; font-size: 1.25rem; animation: confFall linear forwards; pointer-events: none; }
@keyframes confFall { to { transform: translateY(105dvh) rotate(540deg); opacity: 0.4; } }

/* ── Ranking (podio Stadium Live/HQ) ────────────────────────── */
.rank-page { padding: calc(1rem + var(--safe-t)) 1.25rem calc(6rem + var(--safe-b)); max-width: 34rem; margin-inline: auto; width: 100%; }
.rank-toggle { display: flex; background: var(--c-surface-2); border-radius: var(--r-full); padding: 4px; margin-bottom: 1.5rem; }
.rank-toggle button { flex: 1; padding: 0.5rem; border-radius: var(--r-full); font-weight: 700; font-size: 0.875rem; color: var(--c-text-muted); }
.rank-toggle button.active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-sm); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 0.625rem; align-items: end; margin-bottom: 1.5rem; }
.podium-card {
  border-radius: var(--r-xl);
  padding: 1rem 0.5rem;
  text-align: center;
  position: relative;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}
.podium-card .pos {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  /* Texto oscuro sobre las medallas: en blanco no llegaba a 4.5:1 */
  color: #1A1A1A;
  font-weight: 800;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--c-surface);
}
.podium-card.p1 { background: var(--c-primary-t3); border-color: var(--c-primary-t1); padding-top: 1.5rem; }
.podium-card.p1 .pos { background: var(--c-warn); }        /* 7.19:1 */
.podium-card.p2 .pos { background: var(--c-gray-400); }    /* 6.90:1 */
.podium-card.p3 .pos { background: var(--c-bronze); }      /* 5.49:1 */
.podium-avatar { font-size: 2.25rem; }
.podium-card.p1 .podium-avatar { font-size: 2.75rem; }
.podium-card b { display: block; font-family: var(--f-heading); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 0.25rem; }
.podium-card .pts { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-accent-ink); font-weight: 500; }
.rank-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--r-lg);
  padding: 0.625rem 0.875rem;
}
.rank-row .rr-pos { font-family: var(--f-mono); width: 1.75rem; text-align: center; color: var(--c-text-muted); font-weight: 500; }
.rank-row .rr-avatar { font-size: 1.5rem; }
.rank-row .rr-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rr-pts { font-family: var(--f-mono); font-weight: 500; color: var(--c-accent-ink); }
/* --c-text-muted, no soft: en la fila propia el fondo es el tinte de
   acento y el gris suave se quedaba en 4.35:1 */
.rank-row .rr-time { font-size: 0.75rem; color: var(--c-text-muted); font-family: var(--f-mono); }
/* Tu fila es el acento focal de la pantalla de ranking. Borde en
   --c-focal-ink, no --c-focal: sobre el tinte t3 el verde profundo se
   queda en 3.65:1 y el verde oscuro llega a 6.10:1 (UI, 1.4.11). */
.rank-row.me { border: 2px solid var(--c-focal-ink); background: var(--c-primary-t3); position: sticky; bottom: calc(4.5rem + var(--safe-b)); box-shadow: var(--sh-lg); }

/* ── Pasaporte / insignias ──────────────────────────────────── */
/* Contador de relatos: enlaza al álbum (defecto 6, pass.stories sin
   bloque propio). Objetivo táctil 44×44 (WCAG 2.5.8) y foco visible. */
.pass-link {
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  display: flex;
  font-size: 1rem;
  gap: 0.75rem;
  justify-content: space-between;
  min-height: 44px;
  padding: 0.9rem 1rem;
  text-align: left;
  width: 100%;
}
.pass-link:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.pass-link span:first-child { font-weight: 700; }
#passStoriesCount { color: var(--c-text-muted); font-family: var(--f-mono); }

.passport-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.75rem; }
.stamp {
  aspect-ratio: 1;
  border-radius: var(--r-xl);
  border: 2px dashed var(--c-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-align: center;
  padding: 0.5rem;
  color: var(--c-text-soft);
  background: var(--c-surface);
}
.stamp b { font-size: 0.6875rem; font-weight: 700; line-height: 1.2; }
.stamp .se { font-size: 1.75rem; filter: grayscale(1); opacity: 0.4; }
.stamp.earned { border: 2px solid var(--c-primary); background: var(--c-primary-t3); color: var(--c-text); transform: rotate(-2deg); }
.stamp.earned .se { filter: none; opacity: 1; }
.stamp.earned:nth-child(even) { transform: rotate(2deg); }

/* ── Galería de fotos del equipo (pasaporte) ────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }
.photo-cell {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 0;
}
.photo-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-cell figcaption {
  color: var(--c-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
}
/* Reto superado con descripción alternativa en vez de imagen */
.photo-cell.photo-text p {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  color: var(--c-text-soft);
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
  padding: 0.6rem;
}

/* ── Vale de recompensa (pantalla final) ────────────────────────
   Patrón de cupón de adidas y Grab (design-refs/refs.md, familia 12):
   cabecera oscura con el código destacado, troquel con muescas, tira de
   datos en columnas y botón de copiar. Un vale tiene que parecer un
   vale: la tarjeta plana anterior parecía un aviso del sistema. */
.reward-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;          /* recorta las muescas del troquel */
  text-align: left;
}
.rw-ticket { background: var(--c-ink); color: #fff; padding: 1.25rem; }
.rw-eyebrow, .rw-code-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 .375rem;
}
.rw-eyebrow { color: var(--c-primary-t1); }
.rw-code-label { color: rgba(255, 255, 255, .6); margin-top: 1.125rem; }
.rw-ticket h3 { color: #fff; font-size: 1.25rem; line-height: 1.25; margin: 0; }
/* Monoespaciada y espaciada: este código se dicta en voz alta en un
   mostrador y se teclea desde una foto del diploma. */
.reward-code {
  font-family: var(--f-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: .12em;
  margin: 0;
  word-break: break-all;
}
/* Troquel: las dos muescas son círculos del color de la página que el
   overflow del contenedor recorta por la mitad. */
.rw-strip {
  background: var(--c-surface);
  border-top: 2px dashed var(--c-border);
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  padding: 1.125rem 1.25rem;
  position: relative;
}
.rw-strip::before, .rw-strip::after {
  background: var(--c-bg);
  border-radius: 50%;
  content: '';
  height: 20px;
  position: absolute;
  top: -11px;
  width: 20px;
}
.rw-strip::before { left: -10px; }
.rw-strip::after { right: -10px; }
.rw-k { color: var(--c-text-soft); font-size: .6875rem; font-weight: 700; letter-spacing: .1em; margin: 0 0 .125rem; text-transform: uppercase; }
.rw-v { font-weight: 700; margin: 0; }
.rw-foot { padding: 0 1.25rem 1.25rem; }
.reward-detail { color: var(--c-text-muted); font-size: .9375rem; margin-bottom: .875rem; }
.reward-meta { color: var(--c-text-muted); font-size: .8125rem; margin-top: .75rem; text-align: center; }

/* ── Panel · importación de mapas ───────────────────────────── */
.imp-box {
  background: var(--c-secondary-t2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: 1.25rem;
  padding: 1.25rem;
}
.imp-box h3 { font-size: 1.0625rem; margin-bottom: .25rem; }
.imp-resumen { border-radius: var(--r-md); font-size: .875rem; margin-top: .875rem; padding: .75rem 1rem; }
.imp-resumen.ok { background: var(--c-primary-t3); color: var(--c-text); }
.imp-resumen.error { background: #fdecea; border-left: 4px solid #b3261e; color: #8c1d18; }

/* ── Diploma final ──────────────────────────────────────────── */
.diploma-wrap { text-align: center; padding: 1rem 1.5rem calc(2rem + var(--safe-b)); max-width: 30rem; margin-inline: auto; }
#diplomaCanvas { width: 100%; border-radius: var(--r-lg); box-shadow: var(--sh-lg); border: 1px solid var(--c-border); }

/* ── Tabs inferiores in-game ────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  background: var(--c-glass-solid);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--c-glass-border);
  padding-bottom: var(--safe-b);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.5rem 0 0.4375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--c-text-muted);
}
.tabbar button .ti { font-size: 1.375rem; line-height: 1.2; }
.tabbar button.active { color: var(--c-accent-ink); }
.tabbar button.active .ti { transform: translateY(-1px); }
.tab-badge { position: relative; }
.tab-badge[data-n]:not([data-n="0"])::after {
  content: attr(data-n);
  position: absolute;
  top: -4px;
  right: -10px;
  background: var(--c-danger);
  color: #fff;
  font-size: 0.625rem;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ── Mini-player de audio persistente ───────────────────────── */
/* Flota sobre la tabbar (no pegado al borde): misma distancia que
   .toast, que ya está calibrada para no tapar la tabbar en ningún
   punto de la app. */
.mini-player {
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  bottom: calc(5.5rem + var(--safe-b));
  box-shadow: 0 6px 24px rgb(0 0 0 / .16);
  display: flex;
  gap: .6rem;
  left: .75rem;
  padding: .6rem .75rem;
  position: fixed;
  right: .75rem;
  z-index: 40;
}
.mini-emoji { font-size: 1.25rem; flex: none; }
.mini-title { flex: 1; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-btn { background: none; border: 0; font-size: 1.1rem; min-height: 44px; min-width: 44px; flex: none; }
.mini-btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }

/* Página interna con cabecera */
.page-head { padding: calc(1.25rem + var(--safe-t)) 1.5rem 0.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 34rem; margin-inline: auto; width: 100%; }
.page-head h2 { font-size: 1.5rem; }
.page-body { padding: 0 1.5rem calc(6rem + var(--safe-b)); max-width: 34rem; margin-inline: auto; width: 100%; }

/* ── Álbum de sellos (sustituye a la lista de relatos) ───────── */
.album-top { padding: calc(1.25rem + var(--safe-t)) 1.5rem 0.75rem; max-width: 34rem; margin-inline: auto; width: 100%; }
.album-top h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
.album-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 0 1.5rem calc(6rem + var(--safe-b)); max-width: 34rem; margin-inline: auto; width: 100%; }
/* .album-stamp, no .stamp: el pasaporte ya usa .stamp para las insignias,
   con estilos propios (sin width:100%, radio r-xl); reutilizar el nombre
   habría desajustado la rejilla de insignias del pasaporte. */
/* Sello conseguido: pieza física de álbum (Slowly, refs.md familias 7 y
   13) — ventana con la foto del lugar, marco claro, ligera rotación
   alternada y lacre ✓. La foto es lo que separa un álbum de una lista. */
.album-stamp {
  align-items: stretch; background: var(--c-surface);
  border: 2px solid var(--c-primary-t1); border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: .35rem; justify-content: flex-start;
  padding: .5rem .5rem .7rem; text-align: center; width: 100%;
  position: relative;
  box-shadow: var(--sh-sm);
}
.stamp-art {
  align-items: center;
  aspect-ratio: 1;
  background: var(--c-secondary-t1);
  border-radius: 3px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.stamp-art img { display: block; height: 100%; object-fit: cover; width: 100%; }
.album-stamp:not(.locked) { transform: rotate(-1.4deg); }
.album-stamp:not(.locked):nth-child(even) { transform: rotate(1.4deg); }
.album-stamp:not(.locked)::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -6px;
  width: 24px;
  height: 24px;
  background: var(--c-primary);
  color: #fff; /* 4.29:1 sobre el verde */
  font-size: 0.8125rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--c-surface);
  transform: rotate(8deg);
}
.stamp-emoji { font-size: 2rem; }
.stamp-name { font-size: .85rem; font-weight: 600; }
.stamp-era { color: var(--c-text-muted); font-size: .75rem; }
/* Bloqueado: silueta de contorno discontinuo, no opacidad de texto — la
   opacidad baja rompe el contraste (WCAG 1.4.3). El color viene de
   --c-text-muted, verificado en ambos temas (≥6:1). Solo el emoji se
   atenúa (decorativo). */
.album-stamp.locked { background: transparent; border: 2px dashed var(--c-border); box-shadow: none; color: var(--c-text-muted); }
.album-stamp.locked .stamp-art { background: var(--c-surface-2); }
/* Silueta sólida, no emoji atenuado: brightness(0) aplana el color y deja
   la forma, que es justo lo que se quiere insinuar (patrón Swarm). */
.album-stamp.locked .stamp-emoji { filter: grayscale(1) brightness(0); opacity: .26; }
html[data-theme="dark"] .album-stamp.locked .stamp-emoji { filter: grayscale(1) brightness(0) invert(1); opacity: .3; }

/* ── Lista de puntos (alternativa accesible al mapa) ─────────── */
.plist { list-style: none; margin: 0; padding: 0; }
.plist-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--c-border-soft);
}
.plist-row:last-child { border-bottom: none; }
.plist-emoji { font-size: 1.375rem; width: 1.75rem; text-align: center; flex: none; }
.plist-body { flex: 1; min-width: 0; }
.plist-body b { display: block; font-family: var(--f-heading); font-size: 0.9375rem; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--c-ink);
  color: var(--c-secondary);
  border-radius: var(--r-full);
  padding: 0.75rem 1.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: min(92vw, 26rem);
  text-align: center;
  box-shadow: var(--sh-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Modal genérico ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(26, 26, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  padding: 1.5rem;
  max-width: 26rem;
  width: 100%;
  max-height: 86dvh;
  overflow-y: auto;
  box-shadow: var(--sh-lg);
}
.modal h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }

/* ── Ajustes ────────────────────────────────────────────────── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--c-border-soft);
}
.settings-row .sr-label { font-weight: 700; display: flex; align-items: center; gap: 0.625rem; }
.settings-row .sr-sub { font-size: 0.8125rem; color: var(--c-text-muted); font-weight: 400; display: block; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; cursor: pointer; margin: 0; }
.switch .knob {
  position: absolute;
  inset: 0;
  background: var(--c-gray-200);
  border-radius: var(--r-full);
  transition: background 0.2s;
}
.switch .knob::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--sh-sm);
}
.switch input:checked + .knob { background: var(--c-primary); }
.switch input:checked + .knob::after { transform: translateX(20px); }

.lang-pills { display: flex; gap: 0.5rem; }
.lang-pill { border: 1.5px solid var(--c-border); border-radius: var(--r-full); padding: 0.375rem 0.875rem; font-weight: 700; font-size: 0.875rem; }
.lang-pill.active { background: var(--c-primary-strong); border-color: var(--c-primary-strong); color: var(--c-on-accent); }

/* ── Loader ─────────────────────────────────────────────────── */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--c-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  color: var(--c-secondary);
}
.loader-overlay img { height: 40px; }
.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(237, 229, 214, 0.2);
  border-top-color: var(--c-secondary); /* el verde de marca se pierde sobre tinta */
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilidades ─────────────────────────────────────────────── */
.tc { text-align: center; }
.muted { color: var(--c-text-muted); }
.small { font-size: 0.8125rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.row { display: flex; gap: 0.75rem; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.grow { flex: 1; }
.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;
}

/* Modo alto contraste (accesibilidad) */
html[data-contrast="high"] {
  --c-border: #1A1A1A;
  --c-border-soft: #5F5F5F;
  --c-text-muted: #333333;
  --c-text-soft: #333333;
  --c-accent-ink: #124A32; /* 10.24:1 sobre blanco */
}
html[data-contrast="high"] .btn-primary { outline: 2px solid var(--c-ink); }
html[data-contrast="high"] .chip,
html[data-contrast="high"] .input { border: 1.5px solid var(--c-ink); }

/* Respeta la preferencia del sistema de reducir transparencias */
@media (prefers-reduced-transparency: reduce) {
  .pill, .tabbar, .point-marker, .marker-label {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--c-surface);
  }
}

/* Texto grande (accesibilidad) */
html[data-fontsize="large"] { font-size: 19px; }

/* Panel · Biblioteca de medios (Task 7) */
.med-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.med-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); margin: 0; overflow: hidden; }
.med-card.invalid { border-color: #b3261e; }
.med-card img { aspect-ratio: 4 / 3; display: block; object-fit: cover; width: 100%; }
.med-card figcaption { display: grid; gap: .35rem; padding: .75rem; }
.med-kind { color: var(--c-text-muted); font-size: .8rem; }
.med-err { color: #b3261e; font-size: .8rem; margin: 0; }

.med-form { display: grid; gap: 1rem; margin-bottom: 2rem; max-width: 32rem; }
.med-form .hint { color: var(--c-text-muted); font-size: .8rem; margin: .25rem 0 0; }
.med-errors { background: #fdecea; border-left: 4px solid #b3261e; border-radius: var(--r-sm); color: #8c1d18; padding: .75rem 1rem; }
.med-errors ul { margin: 0; padding-left: 1.1rem; }
.med-errors.ok { background: #e8f3e2; border-left-color: var(--c-accent); color: #2f4a1f; }

/* ── Capa de elevación (marca vigente, jul-2026) ─────────────── */
/* Titulares sin viudas y cifras tabulares: Baloo 2 es proporcional
   y sin esto los contadores en vivo (puntos, crono) bailan de ancho. */
h1, h2, h3 { text-wrap: balance; }
.landing-stat b,
.nav-distance,
.pill .pl,
.timer-pill,
.result-points { font-variant-numeric: tabular-nums; }

/* Microinteracciones con la física compartida (--ease). Solo se
   animan transform/opacity: nada que dispare reflow. */
.pill { transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), box-shadow 0.25s var(--ease); }
button.pill:hover { transform: translateY(-1px); }
button.pill:active { transform: translateY(0) scale(0.97); }
.answer { transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.2s var(--ease); }
.answer:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.hunt-card:active { transform: translateY(0) scale(0.99); }

/* Entrada escalonada de contenido (patrón staggered reveal). La regla
   global de prefers-reduced-motion (arriba) ya la anula; la media query
   evita además registrar animaciones que no se van a ver. */
@media (prefers-reduced-motion: no-preference) {
  .land-sheet > *,
  .answers .answer,
  .album-grid .album-stamp,
  .podium-card { animation: riseIn 0.55s var(--ease) both; }
  .land-sheet > :nth-child(2) { animation-delay: 0.06s; }
  .land-sheet > :nth-child(3) { animation-delay: 0.12s; }
  .land-sheet > :nth-child(4) { animation-delay: 0.18s; }
  .land-sheet > :nth-child(5) { animation-delay: 0.24s; }
  .answers .answer:nth-child(2) { animation-delay: 0.06s; }
  .answers .answer:nth-child(3) { animation-delay: 0.12s; }
  .answers .answer:nth-child(4) { animation-delay: 0.18s; }
  .album-grid .album-stamp:nth-child(2) { animation-delay: 0.05s; }
  .album-grid .album-stamp:nth-child(3) { animation-delay: 0.1s; }
  .album-grid .album-stamp:nth-child(4) { animation-delay: 0.15s; }
  .album-grid .album-stamp:nth-child(n+5) { animation-delay: 0.2s; }
  .podium-card.p2 { animation-delay: 0.05s; }
  .podium-card.p3 { animation-delay: 0.1s; }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }
