body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  margin: 0;
  padding: 20px;
  color: #333;
}

#main-flex {
    display: flex;
    align-items: flex-start;
    /* height: 100vh; */
    justify-content: center;
    position: relative;
    flex-direction: column;
}

.game-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

h1 {
  text-align: center;
  color: #2c3e50;
}

.difficulty-selector {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
    background-color: #e9f5ff;
    border-radius: 8px;
    max-width: 300px;
}

.difficulty-selector h2 {
  margin-top: 0;
  color: #2c3e50;
}

#difficulty {
    padding: 8px 12px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    width: 100%;
    margin-top: 10px;
}

#start-game-btn {
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

#start-game-btn:hover {
  background-color: #2980b9;
}

.game-info {
    display: flex;
    justify-content: center;
    margin: 20px auto;
    padding: 15px;
    background-color: #f1f8fe;
    border-radius: 8px;
    max-width: 300px; /* Reducido para solo contener stats */
}

.stats {
    display: flex;
    gap: 25px;
    background-color: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-weight: bold;
}

#time {
  color: #2ecc71;
}

#attempts {
  color: #e74c3c;
}

#sudoku-board {
  margin: 20px auto;
  border-collapse: collapse;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#sudoku-board td {
  border: 1px solid #ddd;
  width: 50px;
  height: 50px;
  text-align: center;
  font-size: 24px;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* Bordes gruesos */
#sudoku-board tr:nth-child(3n) td {
  border-bottom: 3px solid #34495e;
}

#sudoku-board tr:nth-child(1) td {
  border-top: 3px solid #34495e;
}

#sudoku-board td:nth-child(3n) {
  border-right: 3px solid #34495e;
}

#sudoku-board td:nth-child(1) {
  border-left: 3px solid #34495e;
}

/* Estilos de celdas */
td.prefilled {
  background-color: #f0f0f0;
  font-weight: bold;
  color: #333 !important; /* Fuerza color negro para prefilled */
  cursor: default;
}

/* Celda con número incorrecto */
td:not(.prefilled)[data-value]:not([data-value=""]) {
  color: red; /* Números incorrectos en rojo */
}

td.selected {
  background-color: #cce5ff !important;
}

/* Resaltado de fila/columna (más suave) */
.highlighted {
  background-color: #cce0ff;
}

/* Resaltado de bloque 3x3 (intermedio) */
.highlighted-block {
  background-color: #cce0ff;
}

/* Prefilled normal (sin seleccionar) */
.prefilled {
  background-color: #f0f0f0;
  font-weight: bold;
  color: #333;
  cursor: pointer; /* Cambiamos de default a pointer */
}

/* Asegurar legibilidad en prefilled resaltadas */
.prefilled.highlighted {
  background-color: #e6f2ff;
}

.prefilled.highlighted-block {
  background-color: #cce0ff;
}

.same-number {
    background-color: #ffebee;
    animation: pulse 2s infinite;
}

.same-number::after {
  content: "★";
  color: #ff3333;
  position: absolute;
  font-size: 12px;
  top: 2px;
  right: 2px;
}

@keyframes pulse {
  0% { background-color: #ffebee; }
  50% { background-color: #ffcdd2; }
  100% { background-color: #ffebee; }
}

/* Celda seleccionada (prefilled o no) */
.selected {
  background-color: #0066cc !important;
  /*color: white !important; */
  font-weight: bold;
  outline: 3px solid #003366 !important;
  outline-offset: -2px;
  /*box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.5) inset; */
}

.controls {
  margin: 25px auto;
  text-align: center;
  max-width: 600px;
}

#num-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

#num-buttons button {
  width: 50px;
  height: 50px;
  font-size: 20px;
  border: none;
  border-radius: 8px;
  background-color: #3498db;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

#num-buttons button:hover {
  background-color: #2980b9;
  transform: scale(1.05);
}

#num-buttons button.disabled-btn {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.notification.hidden {
    display: none;
}

.notification-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.notification h2 {
    color: #e74c3c;
    margin-top: 0;
}

#close-notification {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
}

td.error {
    background-color: #ffebee;
    animation: pulseError 0.5s;
}

@keyframes pulseError {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Estilo para los botones numéricos con contador */
#num-buttons button {
    position: relative;
    width: 50px;
    height: 50px;
    font-size: 20px;
    /* mantén tus otros estilos existentes */
}

.count-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background-color: #2ecc71;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.disabled-btn .count-badge {
    background-color: #27ae60;
}

#ranking-container {
    max-width: 300px;
    position: absolute;
    right: 1rem;
    top: 0;
}

#ranking-list {
  padding-left: 20px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.difficulty-btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.difficulty-btn:hover {
    background-color: #2980b9;
}

#name-input {
    margin: 15px 0;
    display: flex;
    gap: 10px;
}

#player-name {
    padding: 8px;
    border: 1px solid #3498db;
    border-radius: 4px;
    width: 150px;
}

/* Responsive */
@media (max-width: 768px) {

    .difficulty-buttons {
        flex-direction: column;
    }

    #num-buttons button {
        width: 40px;
        height: 40px;
    }
    .count-badge {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    .game-info {
        flex-direction: column;
        gap: 15px;
    }
    #sudoku-board td {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    #num-buttons button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    #ranking-container {
        position: static;
        width: 100%;
    }
}
