/* ============================================================
   INSTRUCTIVO - CSS Responsive (Flexbox, sin transform:scale)
   ============================================================ */

/* === RESET / BASE === */
html {
  touch-action: pan-x pan-y;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;        /* Sin scroll en el body */
  overflow-x: hidden;
  max-width: 100vw;
  background-color: #e6e5e4;
  color: #000;
}

/* === LOGO DE LA ELECCION === */
.logo_eleccion_izq {
  max-height: 50px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* === LAYOUT PRINCIPAL: 3 zonas (header | contenido | botÃ³n fijo) === */
#contenedor {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ayuda {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  position: relative;
}

/* --- Zona 1: Header fijo --- */
#contenedor-ayuda header {
  flex-shrink: 0;
  height: 60px;
  display: flex;
  align-items: center;
}

#contenedor-ayuda header .container,
#contenedor-ayuda header .row {
  width: 100%;
}

#contenedor-ayuda header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  margin: 0;
}

#contenedor-ayuda header #superior {
  display: flex;
  align-items: center;
  flex: 1;
  float: none;
  width: auto;
  min-width: 0;
}

#contenedor-ayuda header .texto-tribunal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  float: none;
  width: auto;
}

#contenedor-ayuda header img {
  max-height: 50px;
  width: auto;
  object-fit: contain;
}

/* --- Zona 2: Contenido central (ocupa todo lo disponible) --- */
#ayuda #contenedor-ayuda {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* Sin esto el flex item crece y overflow-y:auto no scrollea en WebView */
}

#bienvenido,
#agradecimiento,
#ayuda .paso {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding-bottom: 80px;    /* Espacio para el botÃ³n fijo */
}

/* #bienvenido necesita mÃ¡s espacio inferior para acomodar Comenzar + botones de descarga */
#bienvenido {
  padding-bottom: 160px;
}
/* ImÃ¡genes escalan automÃ¡ticamente sin romper el layout */
#ayuda .grafico {
  max-height: 42vh;
  max-width: 80%;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* Textos responsive con clamp */
#ayuda .paso h1 {
  margin: 16px auto;
  color: #000;
  font-size: clamp(1rem, 2.5vw, 1.8em);
  text-align: center;
  max-width: 80%;
}

#bienvenido h1,
#agradecimiento h1 {
  font-size: clamp(1.2rem, 3vw, 2.3em);
  margin-bottom: 0;
}

#bienvenido h3,
#agradecimiento h3 {
  font-size: 1.3em;
  margin-top: 16px;
}

#bienvenido .botones {
  display: flex;
  justify-content: center;
}

/* --- Zona 3: Botones SIEMPRE fijos al fondo --- */
#ayuda button {
  height: 50px;
  width: 160px;
  padding: 0;
  margin-top: 0;
  margin-left: 0;
}

#empezar,
#ayuda .paso button.next,
#reset {
  position: fixed !important;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) !important;
  -webkit-transform: translateX(-50%) !important;
  z-index: 100;
  margin: 0 !important;
  height: 50px;
  width: 160px;
  padding: 0;
}

/* ============================================================
   WRAPPER BIENVENIDA: agrupa Comenzar + botones de descarga
   fijos al fondo. #empezar resetea su posiciÃ³n dentro de Ã©l.
   ============================================================ */
.bienvenida-acciones {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: 95vw;
}

/* Dentro del wrapper, #empezar vuelve al flujo normal */
.bienvenida-acciones #empezar {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  -webkit-transform: none !important;
  margin: 0 !important;
}
/* ExcepciÃ³n: paso-3 tiene 2 botones, los acomodamos */
#ayuda #paso-3 button.next {
  margin-left: 0 !important;
}

/* ============================================================
   SELECCION DE UBICACIONES
   Desktop:  Partido = 1 col | Resto = 2 col
   Mobile:   Todo = 1 col
   ============================================================ */

/* El paso #ubicaciones puede scrollear verticalmente (sin scrollbar visible) */
#ayuda #ubicaciones.paso {
  justify-content: flex-start;
  padding-top: 16px;
  overflow-y: auto;
  padding-bottom: 80px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#ayuda #ubicaciones.paso::-webkit-scrollbar { display: none; }

/* ULs de seleccion â€” flex container */
#ayuda #contenedor-ayuda #ubicaciones .departamentos,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
  display: flex;         /* SIN !important: JS necesita poder poner display:none */
  flex-wrap: wrap;       /* SIN !important: idem */
  justify-content: center;
  align-items: flex-start;
  column-gap: 8px;       /* no superar 8px: rompe 2 col con calc(50%-4px) */
  row-gap: 10px;
  list-style: none;
  width: 100%;
  padding: 0;
  margin: 8px 0;
  box-sizing: border-box;
}

/* === DESKTOP: PRIMERA SELECCION (Partido) - 1 columna centrada === */
#ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 600px !important;
  margin: 0 auto !important;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
}

/* === DESKTOP: RESTO DE SELECCIONES - exactamente 2 columnas === */
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
  flex: 0 0 calc(50% - 4px) !important;
  width: calc(50% - 4px) !important;
  max-width: calc(50% - 4px) !important;
  margin: 0 !important;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* touch: sin delay, sin flash, sin selecciÃ³n de texto */
#ayuda #contenedor-ayuda #ubicaciones .departamentos li,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  outline: none;
}
#ayuda #contenedor-ayuda #ubicaciones .departamentos li:focus,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li:focus {
  outline: none !important;
  box-shadow: none !important;
}
#ayuda #contenedor-ayuda #ubicaciones .departamentos li:active,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li:active {
  opacity: 0.85;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}

/* pointer-events:none en hijos: cualquier tap en cualquier zona
   del <li> dispara el evento en el <li> mismo (donde esta el data-id) */
#ayuda #contenedor-ayuda #ubicaciones .departamentos li *,
#ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li * {
  pointer-events: none;
}

/* === MISCELÃNEOS === */
#ayuda button:hover { cursor: pointer; }
#ayuda #escudo { display: inline-block; }
#ayuda .tribunal { display: inline-block; font-size: 0.9em; color: #888; }
#ayuda .simulador { font-size: 0.9em; display: inline-block; color: #999; }
.simulador-guia { display: flex; align-items: center; font-size: 0.75rem; }
#ayuda .texto-tribunal { display: flex; }
#ayuda h2 { font-size: 1.6em; color: #000; width: 100%; max-width: 50%; margin-top: 3%; line-height: 1.3em; }
#ayuda .bienvenida { margin: 0 auto; width: 100%; max-width: 50%; }

#ayuda #btn_goople_play { border: 0; background: transparent; }
#ayuda #btn_goople_play img { height: 55px; }

#logo-final {
  width: 15%;
  position: absolute;
  right: 5%;
  bottom: 20%;
}

/* Gradiente (uso interno, se mantiene por compatibilidad) */
.gradiente-gris {
  background: #feffff;
  background: linear-gradient(to bottom, #feffff 0%, #ddf1f9 50%, #a0d8ef 100%);
}

/* ============================================================
   MEDIA QUERIES â€” Sin transform:scale, solo ajustes de tamaÃ±o
   ============================================================ */

/* --- Tablet / ventana a ~1024px --- */
@media (max-width: 1024px) {
  .row { display: flex; }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 45px;
  }

  .texto-tribunal { font-size: 0.85em; }

  #ayuda .grafico { max-height: 38vh; }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 45px;
    width: 145px;
  }
  /* ELIMINADO width:auto que pisaba las reglas de flex de ubicaciones */
}

/* --- Tablet pequeÃ±a / ventana achicada (~900px) --- */
@media (max-width: 900px) {
  #ayuda .grafico { max-height: 35vh; }

  #ayuda #contenedor-ayuda #ubicaciones,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones {
    padding-left: 0;
    padding-right: 0;
  }

  #ayuda #contenedor-ayuda #ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
    padding-left: 0;
    padding-right: 0;
    margin-top: 0;
    column-gap: 6px;   /* no superar: sync con calc(50% - 3px) */
    row-gap: 10px;
  }

  #ayuda #contenedor-ayuda #ubicaciones .departamentos .btn-lg,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos .btn-lg,
  #ayuda #contenedor-ayuda #seleccionar_ubicaciones .departamentos .btn-lg {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
  }
}

/* --- Mobile (portrait o landscape) --- */
@media (max-width: 768px) {
  #contenedor-ayuda header {
    height: 50px;
  }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 35px;
  }

  /* Ocultar texto del tribunal en mobile para ganar espacio */
  .texto-tribunal {
    display: none !important;
  }

  #ayuda .grafico { max-height: 32vh; }

  #ayuda .paso h1 {
    font-size: clamp(0.85rem, 2vw, 1.1em);
    margin: 8px auto;
  }

  #bienvenido h1,
  #agradecimiento h1 {
    font-size: clamp(1rem, 2.5vw, 1.5em);
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 40px;
    width: 135px;
    font-size: 15px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 10px;
  }

  /* Mobile portrait: TODAS las listas en 1 sola columna */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box;
  }


  #bienvenido,
  #agradecimiento,
  #ayuda .paso {
    padding-bottom: 65px;
  }
}

/* --- Mobile landscape (pantalla corta y ancha, cubre iPhones en modo horizontal) --- */
@media (max-height: 500px) {
  #contenedor-ayuda header {
    height: 42px;
  }

  #contenedor-ayuda header img,
  .logo_eleccion_izq {
    max-height: 30px;
  }

  #ayuda .grafico { max-height: 28vh; }

  #ayuda .paso h1 {
    font-size: 0.9em;
    margin: 5px auto;
  }

  #bienvenido h1,
  #agradecimiento h1 {
    font-size: 1.1em;
  }

  #bienvenido,
  #agradecimiento,
  #ayuda .paso {
    padding-bottom: 58px;
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 36px;
    width: 130px;
    font-size: 14px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 25px;
  }

  /* Landscape mobile: 1 sola columna en ubicaciones */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin: 0;
  }
}

/* --- Pantalla muy pequeÃ±a (altura < 280px) --- */
@media (max-height: 280px) {
  #contenedor-ayuda header {
    height: 34px;
  }

  .logo_eleccion_izq {
    max-height: 24px;
  }

  #ayuda .grafico { max-height: 22vh; }

  #ayuda .paso h1,
  #bienvenido h1,
  #agradecimiento h1 {
    font-size: 0.85em;
    margin: 4px auto;
  }

  #ayuda button,
  #empezar,
  #ayuda .paso button.next,
  #reset {
    height: 32px;
    width: 120px;
    font-size: 13px;
  }

  #empezar,
  #ayuda .paso button.next,
  #reset {
    bottom: 6px;
  }

  .texto-tribunal { display: none !important; }
}

/* ============================================================
   DISPOSITIVOS TOUCH (mobile / tablet) â€” cualquier orientacion
   hover:none + pointer:coarse = teclado tactil, no mouse
   Desktop siempre tiene hover:hover y pointer:fine â†’ no aplica
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* 1 sola columna en TODAS las listas de ubicaciones en dispositivos touch */
  #ayuda #contenedor-ayuda #ubicaciones .elegir_eleccion li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_distrito li,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_mesa li {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box;
  }

  /* 1 columna: column-gap irrelevante, ampliar row-gap */
  #ayuda #contenedor-ayuda #ubicaciones .departamentos,
  #ayuda #contenedor-ayuda #ubicaciones .elegir_departamentos {
    column-gap: 0;
    row-gap: 12px;
  }
}

/* ============================================================
   BOTONES DE DESCARGA (bienvenida) â€” scoped al wrapper
   ============================================================ */

.seccion-descargas-final {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: max-content;
  max-width: 95vw;
}

.boton-personalizado {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 56px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.boton-personalizado:hover {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-decoration: none !important;
}

.boton-win-azul {
  background-color: #337ab7;
  color: white;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  padding: 0 18px;
  border: none;
  width: 170px;
  height: 56px;
}

.boton-con-imagen {
  height: 56px;
  width: 170px;
  padding: 0;
}

.boton-con-imagen img {
  height: 100%;
  width: 100%;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}

/* Responsive de los botones de descarga â€” solo aplica a .bienvenida-acciones */
@media (max-width: 768px) {
  .bienvenida-acciones {
    bottom: 10px;
    gap: 8px;
  }

  .seccion-descargas-final {
    gap: 8px;
  }

  .boton-personalizado,
  .boton-win-azul,
  .boton-con-imagen {
    height: 48px;
  }

  .boton-win-azul {
    font-size: 13px;
    width: 150px;
    padding: 0 12px;
  }

  .boton-con-imagen {
    width: 150px;
  }
}

@media (max-height: 500px) {
  .bienvenida-acciones {
    bottom: 6px;
    gap: 5px;
  }

  .seccion-descargas-final {
    flex-direction: row;
    gap: 6px;
  }

  .boton-personalizado,
  .boton-win-azul,
  .boton-con-imagen {
    height: 36px;
  }

  .boton-win-azul {
    font-size: 11px;
    width: 130px;
    padding: 0 8px;
  }

  .boton-con-imagen {
    width: 120px;
  }
}