:root {
    --bg: #f5f5dc;          /* Fondo de la pantalla: Beige claro */
    --grid-bg: #e2e8f0;     /* Fondo de la cuadrícula: Gris claro suave (Tailwind slate-200) */
    --cell-size-hand: 18px; /* Tamaño fijo del cuadrito en la mano */
}

body {
    background: var(--bg);
    color: #1e293b;         /* Cambiado a gris oscuro para que contraste con el fondo beige */
    font-family: 'Segoe UI', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

#score {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 10px;
    color: #0284c7;         /* Un azul un poco más oscuro para que resalte en el fondo claro */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cuadrícula principal */
#grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    background: var(--grid-bg);
    padding: 6px;
    border-radius: 8px;
    width: 85vmin;
    height: 85vmin;
    max-width: 420px;
    max-height: 420px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08); /* Sombra mucho más suave adecuada para fondos claros */
}

/* Celdas vacías del tablero */
.cell {
    background: #f8fafc;     /* Blanco grisáceo para las celdas vacías del tablero */
    border-radius: 2px;
    transition: background 0.1s;
}

/* Color de las celdas ocupadas en el tablero */
.cell.filled {
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
}

/* Contenedor de piezas inferiores */
#hand {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 450px;
    height: 120px;
    margin-top: 15px;
}

.piece-container {
    display: grid;
    gap: 2px;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-width: 60px;
    justify-content: center;
}

.piece-container.selected {
    border-color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
    transform: scale(1.1);
}

/* Cuadritos de las piezas de la mano */
.hand-cell {
    width: var(--cell-size-hand);
    height: var(--cell-size-hand);
    border-radius: 2px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}

.controls {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}

.btn-rotate { background: #0284c7; color: white; } /* Texto blanco para el botón azul */
.btn-refresh { background: #64748b; color: white; }
button:active { transform: scale(0.9); }
/* Centrar el nuevo botón de ayuda debajo de los otros */
.help-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 20px;
}

.btn-help {
    background: #e2e8f0; /* Gris claro que combina con la cuadrícula */
    color: #1e293b;
    border: 2px solid #cbd5e1;
}

.btn-help:hover {
    background: #cbd5e1;
}

/* Estilos para la ventana de diálogo (Modal) */
dialog {
    border: none;
    border-radius: 15px;
    padding: 25px;
    background: #f5f5dc; /* Fondo beige a juego */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    text-align: center;
    color: #1e293b;
    font-family: inherit;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5); /* Oscurece el fondo del juego al abrirse */
    backdrop-filter: blur(3px);     /* Efecto difuminado moderno */
}

dialog h3 {
    margin-top: 0;
    color: #0284c7; /* Azul a juego con el score */
}

dialog p {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 20px;
}