/* components.css */
/* ===== App Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between; 
  padding: 0.5em 1em;s
}

/* ====== HUD ====== */
#hud {
  flex: 1;                /* ocupa todo el espacio sobrante */
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 1rem;
  padding: 0.5em 1em;
  gap: 1em;
}

#hud .hud-center span {
  margin: 0 5px;
}

#hud-streak {
  font-weight: bold;
  color: orange;
}

.hud-left {
  flex: 0; /* ocupa solo lo que necesite (logo y título) */
}

.hud-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end; /* 👈 alinea los hijos a la derecha */
  gap: 1em; /* separa uniformemente cada item */
  flex: 1;                   /* 👈 ocupa todo el espacio disponible */
}

.hud-right {
  flex: 1; /* ocupa todo el espacio sobrante */
  display: flex;
  justify-content: flex-end; /* alinea ❤️ 🔥 ⏱️ a la derecha */
  align-items: center;
  gap: 1em; /* espacio entre los elementos */
}

.hud-item {
  min-width: 3em;
  text-align: center;
  font-weight: 600;
}
/* ===== Responsive HUD ===== */
 @media (max-width: 600px) {
  #hud {
    flex-direction: row;
    align-items: center;
    gap: 0.5em;
  }

  .hud-left, .hud-center {
    flex: unset;
    text-align: center;
    width: auto;
  }

  .hud-right {
    flex: 1;                 /* 👈 ocupa el espacio sobrante */
    justify-content: flex-end; /* 👈 empuja su contenido a la derecha */
  }
  
  #hud .hud-center span {
    display: inline;
    margin: 0 0.3em;
  }
} 

@media (min-width: 601px) {
  .hud-center {
    display: flex;
    justify-content: flex-end !important; /* alinea todo a la derecha */
    text-align: right;
    gap: 1em; /* 👈 espacio entre los elementos */
  }
}

/* ====== Timer ====== */
/*.timer-bar {
  position: relative;
  width: 100%;
  height: 1em;
  background: #eee;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1em 0;
}
.timer-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 1s linear;
}
.timer-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8em;
  font-weight: bold;
}*/

/* ====== Toasts ====== */
#toast-container {
  position: fixed;
  top: 100px;
  left: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.3em;       /* espacio entre varios toasts */
}
.toast {
  background: var(--color-info);
  padding: 0.6em 1em;
  border-radius: var(--radius);
  margin-top: 0.5em;
  box-shadow: var(--shadow);
  opacity: 0.95;
  transition: opacity 0.3s;
}

.toast.fade-out { opacity: 0; }
/* Toasts de éxito/fracaso */
.toast.good {
  background-color: #38a169; /* verde éxito */
  color: #fff;
}

.toast.warn {
  background-color: #e53e3e; /* rojo advertencia */
  color: #fff;
}


/* ====== Modal ====== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5em;
  max-width: 500px;
  width: 90%;
}
.modal-actions {
  margin-top: 1em;
  display: flex;
  justify-content: center;
  gap: 1em;
}

/* ====== Menu ====== */
.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.menu h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.menu p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 400px;
  margin-bottom: 2em;
}

.menu-grid .btn {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.9rem 1.2rem;
}

.menu-actions {
  margin-top: 2rem;
}

.menu-actions .btn {
  font-size: 1rem;
  padding: 0.7rem 1.2rem;
}

/* Responsivo */
@media (min-width: 600px) {
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ====== Game Shell ====== */
.game-shell {
  text-align: center;
  padding: 1em;
}
.game-title {
  margin-bottom: 1em;
}
.game-root {
  margin: 1em 0;
}
.game-actions {
  margin-top: 1.5em;
}

/* ====== End Screen ====== */
.end-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1em;
  margin-top: 2em;
}

.end-screen h2 {
  font-size: 2.5rem;               
  font-weight: 900;
  color: #e63946;                  
  text-transform: uppercase;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.25);
  margin-bottom: 0.5em;
  letter-spacing: 1px;
}

.end-screen p {
  font-size: 1.2rem;
  margin-bottom: 1em;
}

.end-screen .game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
}

.end-screen .game-actions .btn {
  min-width: 140px;
}

/* En pantallas pequeñas, botones apilados */
@media (max-width: 480px) {
  .end-screen .game-actions {
    flex-direction: column;
    align-items: center;
  }
}

/* ===== Pregunta principal en juegos ===== */
.question {
  text-align: center;
  font-size: 3.5rem;   /* bien grande */
  font-weight: bold;
  margin: 1em 0;
  color: #222;
}

/* ====== Options (botones de respuesta) ====== */
.options-container {
  display: grid;
  gap: 1em;
  margin: 1.5em auto;
  justify-content: center;
  align-items: center;   /* 👈 centra también verticalmente si hace falta */
  text-align: center;    /* 👈 centra el contenido dentro de cada celda */
}

.options-container.cols-2 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 400px;
  margin-left: auto;   /* 👈 asegura centrado */
  margin-right: auto;
}

.options-container.cols-3 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
/* Layout adaptado a móviles */
@media (max-width: 600px) {
  .options-container.cols-3 {
    grid-template-columns: repeat(2, 1fr); /* 👈 2 columnas en móviles */
    max-width: 400px; /* ajusta el ancho si quieres */
  }
}

.option {
  display: block;  
  width: auto;
  min-width: 180px;            
  max-width: 300px;
  margin: 0 auto;
  background-color: var(--color-primary, #4caf50);
  color: #000;
  border: none;
  border-radius: 16px;
  padding: 1em 1.5em;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
  text-align: center;
}

.option:hover {
  background-color: #7cd87c;
  border: 1px solid #4caf50;
}

.option:active {
  transform: scale(0.95);
}

/* ===== Responsive ===== */
/*@media (max-width: 600px) {
  .options-container {
    grid-template-columns: 1fr !important; // siempre una sola columna
    max-width: 100% !important;
  }

  .option {
    width: 100%;   // botón ocupa todo el ancho disponible 
    font-size: 1rem;
    padding: 0.8em;
  }
}*/

/* Switch para dificultad */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #4caf50; /* verde = fácil */
  transition: 0.4s;
  border-radius: 30px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 24px; width: 24px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #e63946; /* rojo = difícil */
}
input:checked + .slider:before {
  transform: translateX(30px);
}

/* ====== Brand link ====== */
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5em;
  text-decoration: none;
  color: inherit;
}

/* ====== Settings ====== */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1em;
}
.settings-item {
  display: flex;
  flex-direction: row;   /* ahora todo en una fila */
  align-items: center;   /* centra verticalmente */
  flex-wrap: wrap;       /* permite que salten de línea si no caben */
  gap: 0.8em;            /* espacio entre elementos */
}
.settings-item label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-right: 0.5em;
  white-space: nowrap; /* evita que se corte en varias líneas */
}
.settings-item input,
.settings-item select,
.settings-item span {
  flex: 0 0 auto; /* no se estiran, ocupan lo justo */
}
  
/* ====== Settings Actions (botones guardar/reset/cancel) ====== */
.settings-actions {
  display: flex;
  justify-content: center; /* centra todos los botones */
  gap: 1em;                /* espacio uniforme entre ellos */
  margin-top: 1em;
}

/* Stepper (para errores) */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.btn-step {
  background: var(--color-primary);
  border: none;
  color: white;
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
}
.btn-step:hover {
  opacity: 0.8;
}
#fails-value {
  min-width: 2rem;
  text-align: center;
  font-weight: bold;
}

/* Ajustes para slider de preguntas */
#qcount-value {
  font-weight: bold;
  min-width: 2rem;
  text-align: right;
}

/* ===== HUD extra ===== */
#hud {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#hud-progress {
  font-size: 1rem;
  font-weight: bold;
  color: #2c7a7b; /* verde suave */
}

#hud-timer-knob {
  width: 80px;
  height: 60px;
  margin: 0 auto;
}

#hud-timer-value {
  display: block;
  text-align: center;
  font-size: 0.9rem;
  font-weight: bold;
  margin-top: 4px;
  color: #444;
}

/* Ajustar responsividad */
/*@media (max-width: 600px) {
  #hud {
    flex-direction: column;
    align-items: flex-start;
  }

  #hud-timer-knob {
    width: 70px;
    height: 50px;
  }

  #hud-timer-value {
    font-size: 0.8rem;
  }
}*/

/* ====== Game Over Screen ====== */
.game-over-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1em;
  margin-top: 3em;
}

.game-over-screen h2 {
  font-size: 2.2rem;
  font-weight: 900;
  color: #e63946; /* rojo para énfasis */
  text-transform: uppercase;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.25);
  margin-bottom: 0.5em;
  letter-spacing: 1px;
}

.game-over-screen p {
  font-size: 1.2rem;
  margin-bottom: 0.5em;
}

.game-over-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  margin-top: 1.5em;
}

.game-over-buttons .btn {
  min-width: 140px;
  font-size: 1rem;
  padding: 0.7rem 1.2rem;
}

/* En pantallas pequeñas, botones apilados */
@media (max-width: 480px) {
  .game-over-buttons {
    flex-direction: column;
    align-items: center;
  }
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1em;
}

.settings-row > * {
  flex: 0 0 auto; /* evita que los hijos se estiren */
}

/* Dificultad en settings */
.difficulty-item {
  display: flex;
  align-items: center;
  gap: 0.8em;
}

.difficulty-item label[for="difficulty"] {
  flex: 1;
  font-weight: 600;
}

#difficulty-emoji {
  font-size: 1.5rem;
}

/* ====== Rango con noUiSlider ====== */
#range-slider {
  margin: 1em 0;
  width: 100%;        /* ocupa todo el ancho del contenedor */
  max-width: 900px;   /* límite para que no se vea demasiado grande en pantallas grandes */
}

.noUi-target {
  background: #ddd;   /* color base de la pista */
  border-radius: 10px;
  height: 10px;        /* grosor de la pista */
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.noUi-connect {
  background: var(--color-primary, #4caf50); /* color de la parte seleccionada */
}

.noUi-handle {
  width: 15px;
  height: 15px;
  border-radius: 80%;
  background: white;
  border: 2px solid var(--color-primary, #4caf50);
  cursor: grab;
}

.noUi-handle:active {
  cursor: grabbing;
}

.noUi-horizontal .noUi-handle {
  top: -6px;   /* centra el handle verticalmente en la pista */
}

.settings-item p {
  margin-top: 0.5em;
  font-weight: 600;
  text-align: center;
}
@media (max-width: 600px) {
  #range-slider {
    max-width: 100%;   /* en móviles usa todo el ancho */
  }
}

