/* ══════════════════════════════════════════════════════════
   Falta alguien · Estilos
   ══════════════════════════════════════════════════════════ */

/* ── Reset y base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Lato', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: #585857;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Variables ────────────────────────────────────────── */
:root {
  --crema: #FBF6EE;
  --bgk-gris: #585857;
  --bgk-rojo: #B31218;
  --est: #3B4CA8;
  --cul: #A16100;
  --nor: #DE1E0F;
  --rel: #717530;
}

/* ── Accesibilidad ───────────────────────────────────── */
.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;
}

/* ── Skip link ───────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--bgk-rojo);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* ── Pantallas ────────────────────────────────────────── */
.pantalla {
  display: none;
  min-height: 100dvh;
}
.pantalla.activa {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════
   CLASIFICACIÓN
   ══════════════════════════════════════════════════════════ */

.pantalla-clasificacion {
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Contenedor de la carta con flip ──────────────────── */
.carta-contenedor {
  flex: 1;
  position: relative;
  perspective: 1000px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.carta-flip {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.carta-flip.girada {
  transform: rotateY(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .carta-flip {
    transition: none;
  }
}

/* ── Cara común ───────────────────────────────────────── */
.carta-cara {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px 28px;
  overflow-y: auto;
}

/* ── Anverso ──────────────────────────────────────────── */
.carta-anverso {
  font-family: 'Montserrat', sans-serif;
  color: var(--crema);
}

/* Barra lateral izquierda */
.carta-anverso::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 20px;
  bottom: 20px;
  width: 4px;
  background: var(--crema);
  border-radius: 2px;
  opacity: 0.5;
}

.carta-rotulo {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
  line-height: 1.3;
}

.carta-ambito-progreso {
  font-weight: 500;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 4px;
}

.carta-pregunta {
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
  margin-top: auto;
  margin-bottom: auto;
  padding-top: 16px;
  padding-bottom: 16px;
}

/* Pie de la carta: icono + hint juntos, nunca sobre la pregunta */
.carta-pie {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
}

.carta-pista-hint {
  font-weight: 500;
  font-size: 0.7rem;
  opacity: 0.7;
  font-family: 'Montserrat', sans-serif;
  padding-bottom: 2px;
}

.carta-icono {
  width: 72px;
  height: 72px;
  opacity: 0.22;
  pointer-events: none;
  flex-shrink: 0;
  margin-right: -10px;
  margin-bottom: -6px;
}
.carta-icono svg {
  width: 100%;
  height: 100%;
}

/* ── Reverso ──────────────────────────────────────────── */
.carta-reverso {
  transform: rotateY(180deg);
  background: var(--crema) !important;
  font-family: 'Montserrat', sans-serif;
}

.reverso-rotulo {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
  line-height: 1.3;
}

.reverso-label {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  margin-top: 20px;
}

.reverso-pista {
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.45;
  margin-top: 8px;
}

.reverso-hint {
  font-weight: 500;
  font-size: 0.7rem;
  opacity: 0.6;
  text-align: center;
  margin-top: auto;
  padding-top: 12px;
}

/* ── Barra de progreso ────────────────────────────────── */
.progreso-barra {
  height: 3px;
  background: rgba(255,255,255,0.2);
}
.progreso-barra-relleno {
  height: 100%;
  background: var(--crema);
  transition: width 0.3s ease;
}

/* ── Botones de clasificación ─────────────────────────── */
.clasificacion-acciones {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--crema);
  flex-shrink: 0;
}

.clasificacion-acciones .fila-botones {
  display: flex;
  gap: 8px;
}

.btn-clasificar {
  flex: 1;
  min-height: 48px;
  border-radius: 8px;
  border: 2px solid;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 8px 4px;
  text-align: center;
  line-height: 1.2;
}

.btn-clasificar:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}

.btn-clasificar.seleccionado {
  color: var(--crema) !important;
}

/* Navegación (anterior / siguiente) */
.clasificacion-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 12px;
  background: var(--crema);
  flex-shrink: 0;
}

.btn-nav {
  min-height: 44px;
  min-width: 44px;
  border: none;
  background: transparent;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bgk-gris);
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 16px;
  -webkit-tap-highlight-color: transparent;
}

.btn-nav:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn-nav.btn-siguiente {
  background: var(--bgk-gris);
  color: #fff;
}

.btn-nav.btn-siguiente:disabled {
  background: #ccc;
  color: #999;
}

.progreso-texto {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bgk-gris);
  font-family: 'Montserrat', sans-serif;
}

/* ══════════════════════════════════════════════════════════
   INICIO
   ══════════════════════════════════════════════════════════ */

#pantalla-inicio {
  padding: 0;
}

.pantalla-inicio-contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.inicio-titulo {
  font-weight: 900;
  font-size: 2rem;
  color: var(--bgk-gris);
  line-height: 1.1;
  margin-bottom: 12px;
}
.inicio-titulo span { color: var(--bgk-rojo); }

.inicio-descripcion {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #555;
  max-width: 32ch;
  margin-bottom: 28px;
}

.inicio-creditos {
  font-size: 0.75rem;
  color: #767676;
  margin-top: auto;
  padding-top: 24px;
}

/* ── Cabecera Bizkaia Gazteak ─────────────────────────── */
.bgk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}

.bgk-logo-texto {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--bgk-gris);
  letter-spacing: -0.3px;
}

/* Cuando llegue el logo, descomentar y ocultar .bgk-logo-texto:
.bgk-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
}
.bgk-logo-texto { display: none; }
*/

/* ── Botones genéricos ────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 14px;
  border-radius: 8px;
  border: none;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 10px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}
.btn-primario {
  background: var(--bgk-rojo);
  color: #fff;
}
.btn-secundario {
  background: transparent;
  border: 2px solid var(--bgk-gris);
  color: var(--bgk-gris);
}

/* ── Footer BFA ──────────────────────────────────────── */
.bfa-footer {
  display: flex;
  justify-content: center;
  padding: 16px 20px 20px;
  flex-shrink: 0;
}
.bfa-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.bfa-footer-oscuro {
  filter: brightness(0) invert(1);
  opacity: 0.7;
}

/* ══════════════════════════════════════════════════════════
   PREPARACIÓN
   ══════════════════════════════════════════════════════════ */

#pantalla-preparacion {
  padding: 0;
}

.pantalla-preparacion-contenido {
  flex: 1;
  padding: 8px 20px 20px;
  overflow-y: auto;
}

.preparacion-titulo {
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--bgk-gris);
  margin-bottom: 20px;
}

.campo {
  margin-bottom: 18px;
}

.campo label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bgk-gris);
  margin-bottom: 6px;
}

.campo input[type="text"],
.campo select {
  width: 100%;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  color: var(--bgk-gris);
  background: #fff;
  -webkit-appearance: none;
}

.campo input[type="text"]:focus,
.campo select:focus {
  border-color: var(--bgk-rojo);
  outline: none;
}

/* Desplegable con filtro */
.municipio-wrapper {
  position: relative;
}
.municipio-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  color: var(--bgk-gris);
  background: #fff;
}
.municipio-input:focus {
  border-color: var(--bgk-rojo);
  outline: none;
}
.municipio-lista {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 2px solid var(--bgk-rojo);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 10;
  display: none;
}
.municipio-lista.visible { display: block; }
.municipio-opcion {
  padding: 10px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--bgk-gris);
}
.municipio-opcion:hover,
.municipio-opcion.activa {
  background: var(--crema);
  color: var(--bgk-rojo);
}

/* Radio buttons estilizados */
.opciones-radio {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radio-opcion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bgk-gris);
  transition: border-color 0.15s, background 0.15s;
}
.radio-opcion:has(input:checked) {
  border-color: var(--bgk-rojo);
  background: var(--bgk-rojo);
  color: #fff;
}
.radio-opcion input[type="radio"] {
  accent-color: var(--bgk-rojo);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.radio-opcion:has(input:checked) input[type="radio"] {
  accent-color: #fff;
}

.aviso-registro {
  font-size: 0.75rem;
  line-height: 1.45;
  color: #767676;
  margin-top: 4px;
}

.aviso-clasificacion {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--bgk-gris);
  background: var(--crema);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 18px;
  text-align: center;
}

.preparacion-footer {
  padding: 0 20px 20px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   BLOQUEO (pasa el móvil)
   ══════════════════════════════════════════════════════════ */

#pantalla-bloqueo {
  background: var(--bgk-gris);
  color: #fff;
}

.pantalla-bloqueo-contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
}

.bloqueo-titulo {
  font-weight: 900;
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.bloqueo-mensaje {
  font-size: 1rem;
  line-height: 1.5;
  max-width: 28ch;
  margin-bottom: 40px;
  opacity: 0.85;
}

#pantalla-bloqueo .btn-primario {
  background: #fff;
  color: var(--bgk-gris);
  font-weight: 900;
  font-size: 1.1rem;
}

/* ══════════════════════════════════════════════════════════
   CÓDIGO (modo dos móviles)
   ══════════════════════════════════════════════════════════ */

.pantalla-codigo-contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.codigo-titulo {
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--bgk-gris);
  margin-bottom: 20px;
}

.codigo-display {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: 0.2em;
  color: var(--bgk-rojo);
  margin-bottom: 20px;
  user-select: all;
  -webkit-user-select: all;
}

.codigo-instruccion {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #666;
  max-width: 30ch;
  margin-bottom: 24px;
}

.codigo-acciones {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 320px;
}

.input-codigo {
  width: 100%;
  max-width: 280px;
  padding: 16px;
  border: 2px solid #ccc;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  text-align: center;
  letter-spacing: 0.2em;
  color: var(--bgk-gris);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.input-codigo:focus {
  border-color: var(--bgk-rojo);
  outline: none;
}
.input-codigo::placeholder {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  color: #bbb;
}

.codigo-error {
  font-size: 0.8rem;
  color: var(--bgk-rojo);
  min-height: 1.2em;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════════════════════
   RESULTADOS
   ══════════════════════════════════════════════════════════ */

#pantalla-resultado {
  padding: 20px;
  gap: 0;
}

.res-titulo {
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--bgk-gris);
  margin-bottom: 8px;
}

.res-info-partida {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #767676;
  margin-bottom: 20px;
}

.res-seccion {
  margin-bottom: 28px;
}

.res-seccion-titulo {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--bgk-gris);
  margin-bottom: 10px;
}

.res-disc-resumen {
  font-size: 1rem;
  color: var(--bgk-gris);
  margin-bottom: 6px;
}

.res-lectura {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #555;
  margin-bottom: 12px;
}

/* Carta de discrepancia / duda */
.res-disc-carta {
  border-left: 4px solid #ccc;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--crema);
  border-radius: 0 8px 8px 0;
}
.res-disc-rotulo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.res-disc-pregunta {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--bgk-gris);
  margin-bottom: 6px;
}
.res-disc-resp {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: #666;
}

/* Perfil por ámbito */
.res-ambito {
  margin-bottom: 16px;
}
.res-ambito-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.res-ambito-nombre {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
}
.res-ambito-pts {
  font-size: 0.8rem;
  color: #767676;
  font-weight: 700;
}
.res-barra-fondo {
  height: 8px;
  background: #e8e4de;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.res-barra-relleno {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.res-ambito-nivel {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bgk-gris);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.res-ambito-lectura {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #555;
}

/* Total */
.res-total {
  text-align: center;
  margin-bottom: 4px;
}
.res-total-num {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  color: var(--bgk-gris);
}
.res-total-de {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
  color: #767676;
}
.res-total-etiqueta {
  text-align: center;
  font-weight: 900;
  font-size: 1rem;
  color: var(--bgk-gris);
  margin-bottom: 8px;
}

/* Patrones */
.res-patron {
  background: var(--crema);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.res-patron-titulo {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--bgk-gris);
  margin-bottom: 6px;
}

/* Profundizar */
.prof-bloque {
  margin-bottom: 16px;
  border-left: 3px solid #ddd;
  padding-left: 12px;
}
.prof-bloque-a13 {
  margin-top: 20px;
  border-left-style: dashed;
}
.prof-madre {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.prof-derivada {
  margin-bottom: 10px;
}
.prof-der-rotulo {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--bgk-gris);
  margin-bottom: 2px;
}
.prof-der-pregunta {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #555;
}

/* Aviso final */
.res-aviso {
  font-size: 0.75rem;
  line-height: 1.45;
  font-style: italic;
  color: #767676;
  margin-bottom: 20px;
}

/* Notas en discrepancias/dudas */
.res-nota {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 0.8rem;
  color: var(--bgk-gris);
  resize: vertical;
  min-height: 40px;
  margin-top: 6px;
}
.res-nota:focus {
  border-color: var(--bgk-rojo);
  outline: none;
}
.res-duda-campos {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.res-nota-inline {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 0.8rem;
  color: var(--bgk-gris);
}
.res-nota-inline:focus {
  border-color: var(--bgk-rojo);
  outline: none;
}

.res-btn-pdf {
  max-width: 300px;
  margin-bottom: 8px;
}

.res-btn-compartir {
  max-width: 300px;
  margin-bottom: 8px;
}

.res-btn-volver {
  max-width: 300px;
  margin-bottom: 40px;
}

/* ══════════════════════════════════════════════════════════
   TIPOGRAFÍA LOCAL (se sustituirán por woff2 en despliegue)
   ══════════════════════════════════════════════════════════ */

/* Pantallas pequeñas */
@media (max-height: 600px) {
  .carta-pregunta {
    font-size: 1.15rem;
  }
  .carta-anverso, .carta-reverso {
    padding: 14px 16px 10px 24px;
  }
  .carta-icono {
    width: 56px;
    height: 56px;
  }
  .clasificacion-acciones {
    padding: 8px 12px;
    gap: 6px;
  }
  .btn-clasificar {
    min-height: 44px;
    font-size: 0.75rem;
  }
}

/* Pantalla muy corta */
@media (max-height: 500px) {
  .carta-pregunta {
    font-size: 1rem;
  }
  .carta-rotulo {
    font-size: 0.65rem;
  }
  .carta-icono {
    width: 44px;
    height: 44px;
  }
}
