/* --- Estilos Generales --- */
body, html {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#app-container {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* --- Pantalla de Selección de Nivel --- */
#level-selection-screen h1 {
    text-align: center;
    font-size: 2.8rem;
    color: #4a4a4a;
    margin-bottom: 2rem;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
}

.level-btn {
    padding: 20px;
    font-size: 1.4rem;
    font-weight: bold;
    border: 2px solid #007bff;
    background-color: white;
    color: #007bff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.level-btn:hover, .level-btn:active {
    background-color: #007bff;
    color: white;
    transform: translateY(-2px);
}

/* --- Pantalla de Juego --- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 10px;
    font-size: 1.5rem;
}

.timer {
    font-weight: bold;
    color: #dc3545;
}

#game-board {
    display: grid;
    gap: 5px;
    background-color: #9e9e9e;
    border: 5px solid #9e9e9e;
    border-radius: 8px;
    padding: 5px;
}

.puzzle-tile {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e0e0e0;
    font-weight: bold;
    color: #424242;
    aspect-ratio: 1 / 1;
    font-size: clamp(20px, 8vw, 40px);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.puzzle-tile.movable {
    background-color: #4caf50; /* Verde para piezas que se pueden mover */
    color: white;
    cursor: pointer;
}

.puzzle-tile.empty {
    background-color: transparent;
    cursor: default;
}

.game-stats {
    text-align: center;
    font-size: 1.5rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* --- Modal de Fin de Juego --- */
#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content button {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    margin-top: 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

#modal-action-btn {
    background-color: #28a745;
    color: white;
}

#back-to-menu-btn {
    background-color: #6c757d;
    color: white;
}
