/* Elementos */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px;
    background-color: #2e2115;
    color: #eeeeee;
    text-align: center;
    transition: background-color 0.3s ease;
}
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    width: 100%;
    max-width: 700px;
}
section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
button, select, input {
    padding: 8px 12px;
    margin-top: 10px;
    border: 1px solid #8c6849;
    border-radius: 4px;
    background-color: #4b2f1f;
    color: #fff5e6;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}
select {
    font-size: 12px;
}
h1 {
    margin-bottom: 10px;
    color: #fbe5c4;
    font-size: 24px;
    transition: color 0.3s ease;
}
p {
    color: #eee1c5;
    font-size: 16px;
    transition: color 0.3s ease;
}
footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
label {
    transition: color 0.3s ease;
}

/* Pseudoelementos/Pseudoclases */
button:hover, select:hover, input:hover {
    background-color: #6f4f35;
}

.celda:hover {
    background-color: #a47858;
    transform: scale(1.05);
}
.reiniciar:disabled, .comenzar:disabled {
    background-color: #999999;
    color: #cccccc;
    opacity: 0.7;
    cursor: not-allowed;
}

/* Clases */
.formulario-jugador {
    display: flex;
    flex-direction: column;
}
.controles {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0;
    font-size: 14px;
}
.controles .comenzar {
    font-size: 14px;
}
.control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}
.control label {
    white-space: nowrap;
}
.control-botones {
    display: flex;
    gap: 5px;
}
.juego {
    width: 100%;
    min-width: max-content;
    padding: 15px;
    margin: 20px auto;
    border: 2px solid #5d3e1c;
    border-radius: 15px;
    background-color: #4a3320;
    text-align: center;
    box-shadow: 0 0 15px #5d3e1cb3;
}
.informacion {
    padding: 10px 16px;
    margin-bottom: 10px;
    border: 1px solid #a3784c;
    border-radius: 12px;
    background-color: #6b4a2d;
    color: #f3e1c3;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 0 8px #ffd29633;
    transition: color 0.3s ease;
}
.informacion .tiempo {
    color: #ffb347;
}
.mensaje {
    min-height: 24px;
    margin-top: 10px;
    margin-bottom: 10px;
    color: #ff5555;
    font-size: 18px;
    font-weight: bold;
}
.tablero {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    margin: 20px auto;
}
/* Calculo el ancho de las celdas con la cantidad de celdas y el espacio entre ellas */
.nivel-bajo {
    width: calc(8 * 35px + 7 * 2px);
}
.nivel-medio {
    width: calc(12 * 35px + 11 * 2px);
}
.nivel-alto {
    width: calc(16 * 35px + 15 * 2px);
}
.celda {
    width: 35px;
    height: 35px;
    border: 1px solid #999999;
    background-color: #b5a8a8;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}
.celda.revelada {
    background-color: #e7cba9;
    color: #222222;
    cursor: default;
    box-shadow: inset 0 0 4px #a3784c;
}
.celda.mina {
    background-color: #ff6f3c;
    color: white;
    font-size: 22px;
}
.revelada {
    background-color: #eeeeee;
    cursor: default;
}
.mina {
    background-color: #ff0000;
    color: #ffffff;
}
.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00000099;
    z-index: 9999;
}
.modal-contenido {
    max-width: 90%;
    padding: 20px 30px;
    border-radius: 10px;
    background: #4a3320;
    text-align: center;
    box-shadow: 0 0 10px #000000;
    word-wrap: break-word;
}
.modal-ranking {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00000099;
    text-align: center;
    z-index: 9999;
    overflow: auto;
}
.modal-ranking-contenido {
    max-height: 700px;
    padding: 20px 30px;
    border-radius: 10px;
    background: #4a3320;
    text-align: center;
    box-shadow: 0 0 10px #000000;
    word-wrap: break-word;
    overflow: auto;
}
.tabla-ranking {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}
.tabla-ranking th {
    background-color: #e6dbcf;
    color: #4a3320;
}
.tabla-ranking th, .tabla-ranking td {
    padding: 8px;
    border: 1px solid #8c6849;
    text-align: center;
}
.minas-restantes {
    transition: color 0.3s ease;
}
.contacto {
    padding: 10px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* -- Clases compuestas -- */
body.tema-claro {
    background-color: #f4f1eb;
    color: #3e2f1c;
}
body.tema-claro h1 {
    color: #3e2f1c;
}
body.tema-claro p {
    color: #3e2f1c;
}
body.tema-claro button,
body.tema-claro input,
body.tema-claro textarea {
    border: 1px solid #c9b4a3;
    background-color: #e6dbcf;
    color: #3e2f1c;
}
body.tema-claro button:hover,
body.tema-claro input:hover,
body.tema-claro textarea:hover {
    background-color: #d4c7be;
}
body.tema-claro .informacion {
    border: 1px solid #c9b4a3;
    background-color: #ded1c5;
    color: #3e2f1c;
}
body.tema-claro .tiempo {
    color: #c88527
}
body.tema-claro .modal-contenido {
    background-color: #e6dbcf;
    color: #3e2f1c;
}
body.tema-claro .modal-ranking-contenido {
    background-color: #e6dbcf;
    color: #3e2f1c;
}
body.tema-claro .tabla-ranking th {
    background-color: #4a3320;
    color: #e6dbcf;
}
.celda.revelada[data-numero='1'] { 
    color: #00aaff; 
}
.celda.revelada[data-numero='2'] { 
    color: #00cc66; 
}
.celda.revelada[data-numero='3'] { 
    color: #ff4444; 
}
.celda.revelada[data-numero='4'] { 
    color: #ff8800; 
}
.celda.revelada[data-numero='5'] { 
    color: #aa66cc; 
}
.celda.revelada[data-numero='6'] { 
    color: #00dddd; 
}
.celda.revelada[data-numero='7'] { 
    color: #555555; 
}
.celda.revelada[data-numero='8'] { 
    color: #888800; 
}
.celda.bandera {
    background-color: #ffeeba;
    font-size: 20px;
    text-align: center;
}
.minas-restantes.negativo {
    color: red;
}
.modal.oculto {
    display: none;
}
.modal-ranking.oculto {
    display: none;
}
footer a.github-link {
    padding: 10px;
    border-radius: 5px;
    background-color: #6b4a2d;
    color: #eee1c5;
}
footer a.github-link:hover {
    background-color: #5a3d25;
}
.github-link i {
    margin-right: 5px;
}
footer .autor {
    color: #eee1c5;
}

/* Media Queries */
@media (max-width: 600px) {
    .informacion {
        display: flex;
        flex-direction: column;
    }
    .nivel-bajo {
        width: calc(8 * 40px + 7 * 2px);
    }
    .nivel-bajo .celda {
        width: 40px;
        height: 40px;
        font-size: 26px;
    }
    .nivel-medio {
        width: calc(12 * 30px + 11 * 2px);
    }
    .nivel-medio .celda {
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
    .nivel-alto {
        width: calc(16 * 20px + 15 * 2px);
    }
    .nivel-alto .celda {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    .modal-contenido {
        width: 90%;
        padding: 15px;
    }
    footer {
        gap: 20px;
        padding: 10px;
    }
}

@media (max-width: 400px) {
    .juego {
        padding-left: 0px;
        padding-right: 0px;
        margin-left: 0px;
        margin-right: 0px;
        border: 0;
    }
}