/* estilos.css */

/* 1. Importar Montserrat */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap');

/* 2. Reset y estilos globales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Montserrat', sans-serif;
}

/* 3. Fondo degradado animado en tonos profundos de rojo */
body {
  /* Color de respaldo */
  background-color: #3c0000;
  /* Degradado principal */
  background-image: linear-gradient(
    -45deg,
    #3c0000,
    #5a0000,
    #780000,
    #9d0910
  );
  background-size: 400% 400%;
  animation: gradientAnimation 15s ease infinite;
}
@keyframes gradientAnimation {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 4. Contenedor y título */
.container {
  position: relative;
  z-index: 1;
  padding: 2rem 1rem;
}
h1 {
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
}

/* 5. Cronómetro */
#cronometro {
  color: #ffffff;
  font-size: clamp(1rem, 2vw, 1.5rem);
  text-align: right;
  margin-bottom: 1rem;
}

/* 6. Grid responsivo (Bootstrap flex-based) */
#grid {
  display: flex;
  flex-wrap: wrap;
}
#grid .col {
  padding: 5px;
}
.row-cols-3 > .col { flex: 0 0 calc(33.3333% - 10px); }
.row-cols-sm-4 > .col { flex: 0 0 calc(25% - 10px); }
.row-cols-md-5 > .col { flex: 0 0 calc(20% - 10px); }
.row-cols-lg-6 > .col { flex: 0 0 calc(16.6667% - 10px); }

/* 7. Tarjetas */
#grid .card {
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255,255,255,0.8);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}
#grid .card:not(.disabled):hover {
  transform: scale(1.05);
}
#grid .card.disabled {
  pointer-events: none;
  opacity: 0.6;
}
#grid .card.correct {
  background-color: #b6e2a1;
}
#grid .card.wrong {
  background-color: #e57373;
}

/* 8. Texto de las tarjetas: centrado h/v, blanco y negrita */
#grid .card-body {
  width: 100%;
  display: flex;
  justify-content: center; /* Centrado horizontal */
  align-items: center;     /* Centrado vertical */
  text-align: center;
  color: #000000;
  font-weight: 700;
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  line-height: 1.1;
}

/* 9. Overlay de cuenta regresiva */
#countdownOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
}
#countdownOverlay.show {
  display: flex;
}
#countdownNumber {
  font-size: clamp(4rem, 20vw, 10rem);
  color: #ffffff;
  font-weight: 700;
}

/* 10. Botón de reinicio */
#resetBtn {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 50px;
  border: 2px solid #000;
  padding: 0.5rem 1rem;
  background-color: #ffffff;
  color: #000;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
#resetBtn:hover {
  background-color: rgba(255,255,255,0.8);
}
#resetBtn:active {
  transform: scale(0.95);
}

/* 11. Tarjetas rectangulares y más columnas en móviles */
@media (max-width: 576px) {
  /* Transformar grid a CSS Grid */
  #grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 0 4px;
  }
  #grid .col {
    flex: none;
    width: auto;
    padding: 0;
  }
  /* Tarjetas más anchas (rectangulares) */
  #grid .card {
    aspect-ratio: 4 / 3;
    transition: transform 0.15s ease;
  }
  /* Texto y padding más compactos */
  #grid .card-body {
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    padding: 0.2rem;
  }
}

/* 12. (Opcional) Cache-busting */
/* Renombra este archivo o fuerza hard refresh (Ctrl+F5) si sigues viendo estilos viejos. */