:root {
    --bg: #0f2e40;
    --accent: #235e6e;
    --clr-chiaro: #84c1c6;
    --clr-medio: #235e6e;
    --clr-scuro: #0f2e40;
    --clr-scurissimo: rgb(10, 28, 39);

    --c1: #58b7b0;
    --c2: #e08e45;
    --c3: #d9534f;
    --c4: #f0c987;
    --c5: #7b9acc;
    --c6: #7cc47f;
}

/* base */
* {
    box-sizing: border-box
}

html,
body {
    /* height: 100% */
    touch-action: none;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
    background: var(--bg);
    color: #eeeeee;
    -webkit-font-smoothing: antialiased;
    padding: 8px;
    display: flex;
    justify-content: center;
}

.app {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* header */
.app__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
}

.app__title {
    font-size: 1.3rem;
    margin: 0
}

.back-button {
    color: var(--clr-chiaro);
    text-decoration: none;
}

.status {
    color: var(--clr-chiaro);
    font-size: 0.95rem
}

/* body {
    background: var(--clr-scurissimo);
    color: var(--clr-chiaro);
    font-family: system-ui, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
} */

/* main {
    background: var(--clr-scuro);
    padding: 1rem 2rem;
    border-radius: 1rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: min(90vw, 420px);
} */

/* header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
} */


/* FLOOD*/
#board {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    aspect-ratio: 1 / 1;
    gap: 0;
    /* <- importantissimo */
    background: #000;
    margin: 10px auto;
    width: 100%;
    border: 2px solid var(--accent);
}


/* .cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.1s;
} */

.cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.1s, border 0.1s;
    border: none;
    /* rimuove qualsiasi bordo di default */
    box-sizing: border-box;
    /* già impostato ma utile ricordarlo */
}

/* .cell:hover {
    transform: scale(1.05);
} */


#controls {
    /* margin-top: 1rem; */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#palette {
    margin-top: 0.7rem;
    margin-bottom: 0.7rem;
    display: flex;
    justify-content: center;
    gap: .5rem;
}

.color-btn {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--clr-scurissimo);
    transition: transform 0.1s;
}

.color-btn:hover {
    transform: scale(1.1);
}

/* #restart {
    background: var(--accent);
    color: white;
    border: none;
    padding: .5rem 1rem;
    border-radius: .5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background .2s;
} */

#restart:hover {
    background: var(--clr-chiaro);
    color: var(--clr-scurissimo);
}

/* Stili bottoni */
.controls {
    display: flex;
    gap: 50px;
    align-items: center;
    padding: 6px;
    justify-content: center;
}

.submit-button {
    width: 110px;
    height: 35px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer
}

.restart-button {
    width: 110px;
    height: 35px;
    background: transparent;
    color: var(--clr-chiaro);
    border: 1px solid var(--clr-chiaro);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer
}

/* finestra modale per Ricomincia e Fine partita */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal__content {
    background: var(--accent);
    color: #eeeeee;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal__content h2 {
    margin-top: 0;
}

.modal__content button {
    margin: 0.5rem;
}

#modal-buttons button {
    margin: 0.5rem;
    min-width: 50px;
    background: #0f2e40;
    color: var(--clr-chiaro);
    border: 1px solid var(--clr-chiaro);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer
}

/* Stili per il contenitore del regolamento */
.regolamento-container {
    max-height: 100%;
    /* Altezza massima visibile */
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    padding: 0 30px;
    /* margin-bottom: 10px; */
}

/* Nasconde il regolamento */
.regolamento-container.hidden {
    max-height: 0;
    padding: 0 30px;
    margin: 0;
}

.regolamento-toggle {
    text-align: center;
    font-size: 0.9em;
    color: var(--clr-chiaro);
    cursor: pointer;
    /* margin-bottom: 10px; */
    user-select: none;
    /* Impedisce la selezione del testo */
}

.regolamento {
    text-align: justify;
}

.regolamento p,
li {
    font-size: 14px;
    margin: 0;
}






/* piccole regole per schermi stretti */
@media (max-width:420px) {

    /* header */
    .app__header {
        padding: 0 10px 0 10px;
    }

    .app {
        gap: 5px
    }

    /* #board {
        margin: 0 10px 0 10px;
    } */

    .regolamento-container {
        padding: 0 10px;
    }

    /* Nasconde il regolamento */
    .regolamento-container.hidden {
        padding: 0 10px;
    }
}