/* Estilos base para desktop */
#sopa-jgh-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  max-width: 1200px; /* Limitar ancho máximo */
  padding: 20px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  min-height: 600px;
}

#sopa-jgh-juego {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px; /* Reducido de 30px */
  width: 100%;
  max-width: 900px; /* Limitar ancho del área de juego */
}

#sopa-jgh-tablero {
  position: relative;
  margin: 0;
  max-width: 100%;
  overflow: visible;
  display: inline-block;
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#sopa-jgh-tablero .celda {
  width: 30px;
  height: 30px;
  border: 1px solid #dee2e6;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  user-select: none;
  transition: all 0.3s ease;
  font-size: 14px;
  cursor: pointer;
  background: white;
  z-index: 1;
  border-radius: 2px;
}

#sopa-jgh-tablero .celda:hover {
  background: #f8f9fa;
  transform: scale(1.05);
}

#sopa-jgh-tablero .celda.encontrada {
  background: #4caf50;
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#sopa-jgh-tablero canvas {
  position: absolute;
  top: 10px;
  left: 10px;
  pointer-events: none;
  z-index: 10; /* Por encima de las celdas */
}

#sopa-jgh-lateral {
  min-width: 220px; /* Ligeramente más ancho */
  max-width: 280px;
  text-align: left;
  flex-shrink: 0;
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#sopa-jgh-lateral h4 {
  margin: 0 0 15px 0;
  color: #495057;
  font-size: 16px;
  text-align: center;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 8px;
}

/* Instrucciones para móvil - ocultas en desktop */
#sopa-jgh-instrucciones-movil {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
  font-size: 13px;
  line-height: 1.4;
  display: none; /* Ocultas en desktop */
}

/* Instrucciones para desktop - debajo de la sopa */
#sopa-jgh-instrucciones-desktop {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1px solid #2196f3;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

#sopa-jgh-instrucciones-movil h5,
#sopa-jgh-instrucciones-desktop h5 {
  margin: 0 0 8px 0;
  color: #1976d2;
  font-size: 15px;
  font-weight: 600;
}

#sopa-jgh-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 6px;
}

#sopa-jgh-lista li {
  font-weight: 600;
  margin: 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  transition: all 0.3s ease;
  font-size: 13px;
  border: 1px solid #dee2e6;
  text-align: center;
}

#sopa-jgh-lista li:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#sopa-jgh-lista li.encontrado {
  text-decoration: line-through;
  color: #4caf50;
  background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
  border-color: #4caf50;
  font-weight: 700;
}

#sopa-jgh-progreso {
  margin-top: 20px;
  font-size: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-radius: 8px;
  text-align: center;
  border: 1px solid #ff9800;
  box-shadow: 0 2px 4px rgba(255, 152, 0, 0.15);
}

#sopa-jgh-progreso strong {
  color: #f57c00;
}

#sopa-jgh-controles {
  margin-top: 25px;
  margin-bottom: 15px;
  text-align: center;
  padding: 0 15px;
}

#sopa-jgh-reiniciar {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff6b35 100%) !important;
  color: white !important;
  border: none !important;
  padding: 15px 25px !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  font-size: 16px !important;
  transition: all 0.4s ease !important;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4) !important;
  min-width: 160px !important;
  position: relative !important;
  overflow: hidden !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

#sopa-jgh-reiniciar::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent) !important;
  transition: left 0.6s ease !important;
}

#sopa-jgh-reiniciar:hover {
  background: linear-gradient(135deg, #e55a2b 0%, #e8851a 50%, #e55a2b 100%) !important;
  transform: translateY(-3px) scale(1.05) !important;
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.6) !important;
}

#sopa-jgh-reiniciar:hover::before {
  left: 100% !important;
}

#sopa-jgh-reiniciar:active {
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.5) !important;
}

#sopa-jgh-reiniciar:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3) !important;
}

#sopa-jgh-victoria {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  color: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  margin-top: 20px;
  font-weight: bold;
  display: none;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#sopa-jgh-victoria h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

#sopa-jgh-victoria p {
  margin: 0 0 15px 0;
  font-size: 14px;
  opacity: 0.95;
}

#sopa-jgh-victoria button {
  background: white !important;
  color: #4caf50 !important;
  border: none !important;
  padding: 12px 24px !important;
  border-radius: 6px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  font-size: 14px !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#sopa-jgh-victoria button:hover {
  background: #f8f9fa !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Media Queries para Tablets */
@media screen and (max-width: 768px) {
  #sopa-jgh-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 15px;
    margin: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  }
  
  #sopa-jgh-juego {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
  }
  
  #sopa-jgh-tablero {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  /* Mostrar instrucciones de móvil, ocultar las de desktop */
  #sopa-jgh-instrucciones-movil {
    display: block;
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin-bottom: 20px;
  }
  
  #sopa-jgh-instrucciones-desktop {
    display: none;
  }
  
  #sopa-jgh-tablero .celda {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }
  
  #sopa-jgh-tablero canvas {
    top: 8px;
    left: 8px;
  }
  
  #sopa-jgh-lateral {
    min-width: auto;
    max-width: 100%;
    width: 100%;
    text-align: center;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  #sopa-jgh-lista {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
  }
  
  #sopa-jgh-lista li {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* Media Queries para Móviles */
@media screen and (max-width: 480px) {
  #sopa-jgh-container {
    margin: 10px auto;
    padding: 0 10px;
    gap: 15px;
  }
  
  #sopa-jgh-juego {
    flex-direction: column;
    gap: 15px;
  }
  
  /* Mostrar instrucciones de móvil, ocultar las de desktop */
  #sopa-jgh-instrucciones-movil {
    display: block;
    width: 100%;
    font-size: 12px;
    padding: 10px;
    margin-bottom: 15px;
  }
  
  #sopa-jgh-instrucciones-desktop {
    display: none;
  }
  
  #sopa-jgh-tablero {
    margin: 0 auto;
  }
  
  #sopa-jgh-tablero .celda {
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 600;
    border-width: 1px;
  }
  
  #sopa-jgh-lateral {
    width: 100%;
    max-width: none;
  }
  
  #sopa-jgh-lateral h4 {
    font-size: 16px;
    margin-bottom: 12px;
    text-align: center;
  }
  
  #sopa-jgh-lista {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 6px;
    margin-bottom: 15px;
  }
  
  #sopa-jgh-lista li {
    font-size: 12px;
    padding: 8px 6px;
    text-align: center;
    border-radius: 6px;
  }
  
  #sopa-jgh-progreso {
    font-size: 13px;
    padding: 10px;
    margin-top: 10px;
  }
}

/* Media Queries para móviles muy pequeños */
@media screen and (max-width: 360px) {
  #sopa-jgh-tablero .celda {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  #sopa-jgh-lista {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #sopa-jgh-lista li {
    font-size: 11px;
    padding: 6px 4px;
  }
}

/* Mejoras para interacción táctil */
@media (hover: none) and (pointer: coarse) {
  #sopa-jgh-tablero .celda {
    /* Mantener tamaño mínimo para touch */
    min-width: 18px;
    min-height: 18px;
  }
  
  #sopa-jgh-lista li {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Orientación landscape en móviles */
@media screen and (max-width: 768px) and (orientation: landscape) {
  #sopa-jgh-container {
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
  }
  
  #sopa-jgh-tablero {
    flex-shrink: 0;
  }
  
  #sopa-jgh-tablero .celda {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  
  #sopa-jgh-lateral {
    width: auto;
    min-width: 180px;
    max-width: 250px;
  }
  
  #sopa-jgh-lista {
    grid-template-columns: 1fr;
    max-height: 300px;
    overflow-y: auto;
  }
}

