/* General Style */
body {
  font-family: "Press Start 2P", cursive;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #1d3557, #457b9d);
  color: #f1faee;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 100px;
}

header {
  background-color: #333;
  color: #0f0;
  padding: 1rem 0;
  text-align: center;
  border-bottom: 4px solid #0f0;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

main {
  flex: 1;
  padding: 6rem 2rem 2rem; /* Ajustamos el padding para header fijo */
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  gap: 2rem;
}

/* Configuración inicial */
#config {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1rem;
}

#config-form {
  flex-direction: row;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

#config-form label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

form input[type="number"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
  background-color: #222;
  color: #0f0;
  border: 2px solid #0f0;
  padding: 0.5rem;
  font-family: "Press Start 2P", cursive;
  width: 100px;
  margin: auto;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

form input[type="number"]:hover {
  background-color: #0f0;
  color: #000;
  transform: scale(1.1);
}

/* Botones */
button {
  background-color: #2db2ff;
  color: #ffffff;
  border: 2px solid #f4a261;
  padding: 0.75rem 1.5rem;
  font-family: "Press Start 2P", cursive;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

button:hover {
  background-color: #0f0;
  color: #000;
  transform: scale(1.1);
}

#start-btn {
  background-color: #f4a261;
  color: #1d3557;
  border: 2px solid #0f0;
  padding: 2rem;
  font-size: 1.2rem;
}

/* Estilo responsivo para la sección de controles */
/* Distribución general */
#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Centra verticalmente los botones */
  gap: 1rem; /* Espaciado entre los botones */
  height: 100%; /* Asegura que ocupa todo el alto disponible */
  position: relative;
}

/* Ajustes específicos para pantallas grandes */
@media (min-width: 992px) {
  #controls {
    align-self: center; /* Centra el contenedor en relación a su fila */
    margin-top: 20rem; /* Asegúrate de que no haya margen superior */
  }

 
}

/* Para pantallas medianas */
@media (max-width: 768px) {
  #controls {
    flex-direction: row; /* Botones en fila */
    justify-content: center; /* Centra horizontalmente */
    gap: 0.5rem; /* Reduce el espacio entre botones */
  }

  #help-popup{
    padding: 1rem;
    width: 90%;
    max-width: 300px;
    max-height: 90%;

  }
}

/* Para pantallas pequeñas */
@media (max-width: 480px) {
  #controls {
    flex-direction: column; /* Botones en columna nuevamente */
    align-items: center; /* Centra en móviles */
  }

  #help-popup{
    padding: 1rem;
    width: 90%;
    max-width: 200px;
    max-height: 90%;

  }
}

#game-controls {
  display: flex;
  gap: 1rem;
  padding-bottom: 100px;
}

/* Game Layout */
#game {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  background-color: #222;
  border: 2px solid #0f0;
  box-shadow: 0 0 20px #0f0;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Tablero del Juego */
#game-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  background-color: #111;
  border: 4px solid #0f0;
  box-shadow: 0 0 20px #0f0, 0 0 40px #0f0 inset;
  padding: 1rem;
  width: fit-content;
  margin: 0 auto;
}

.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  font-size: clamp(0.75rem, 2vw, 1rem);
  border: 1px solid #0f0;
  background-color: #222;
  color: #0f0;
  transition: all 0.3s ease;
}

.cell:hover {
  box-shadow: 0 0 15px #0f0;
  filter: brightness(1.2);
}

#game-board .cell.red {
  background-color: #ff0000;
}

#game-board .cell.blue {
  background-color: #0000ff;
}

/* Panel Lateral */
#side-panel {
  margin-top: 3.38rem;
  width: 100%;
  max-width: 500px;
  background-color: #222;
  color: #0f0;
  border: 2px solid #0f0;
  padding: 5rem;
  font-family: "Press Start 2P", cursive;
  box-shadow: 0 0 20px #0f0;
  overflow-y: auto;
}

#side-panel h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #0f0;
  padding-bottom: 0.5rem;
}

/* Listas */
#history-list,
#solution-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#history-list li,
#solution-list li {
  margin: 0.6rem 0;
}

.col-lg-2 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

/* Mensajes y Popups */
#win-message,
#error-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(250, 250, 250, 0.95);
  color: #457b9d;
  border: 2px solid #e63946;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  font-family: "Press Start 2P";
  text-align: center;
  z-index: 1000;
  box-shadow: 0 0 15px #0f0;
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Fuegos artificiales */
.fireworks-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.firework {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: transparent;
  border-radius: 50%;
  animation: explode 1.5s ease-out forwards;
}

@keyframes explode {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(3) translateY(100px);
    opacity: 0;
  }
}

/* Ventana de Ayuda */
#help-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.9);
  color: #1d3557;
  border: 2px solid #f4a261;
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  z-index: 1100;
  overflow-y: auto;
  box-shadow: 0 0 20px #0f0;
}

#help-popup.hidden {
  display: none;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: #333;
  color: #0f0;
  border-top: 4px solid #0f0;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1000;
}

/* Animaciones */

/* Media Queries */
@media (max-width: 1024px) {
  .cell {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 768px) {
  .game-container {
    grid-template-columns: 1fr;
  }

  .cell {
    width: 40px;
    height: 40px;
  }

  #controls {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .cell {
    width: 35px;
    height: 35px;
    font-size: 0.75rem;
  }

  #controls {
    flex-direction: column;
  }
}
