:root {
    --bg: #0f2e40;
    --accent: #235e6e;
    --sheet-border: 2px solid #000;

    --clr-chiaro: #84c1c6;
    --clr-medio: #235e6e;
    --clr-scuro: #0f2e40;
    --clr-scurissimo: rgb(10, 28, 39);
}

/* base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

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
}

.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
}

/* Gioco del 15 */
.puzzle15-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
}

.puzzle15-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 320px;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.puzzle15-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 5px;
    width: 320px;
    height: 320px;
    background-color: #333;
    border: 5px solid #222;
    border-radius: 10px;
}

.puzzle15-tile {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #007bff;
    font-size: 2em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

/* Stili per le tessere pari e dispari del Gioco del 15 */
.odd-tile {
    background-color: #f92222;
    color: goldenrod;
}

.even-tile {
    background-color: #dddddd;
    color: #555;
}

.puzzle15-tile:not(.empty):hover {
    transform: scale(1.05);
    /* background-color: #0056b3; */
}

.puzzle15-tile.empty {
    background-color: transparent;
    cursor: default;
}

.puzzle15-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.puzzle15-message {
    margin-top: 20px;
    font-size: 1.5em;
    font-weight: bold;
    color: #eee;
    text-align: center;
    min-height: 2em;
}

.puzzle15-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-align: center;
    background-color: #f0f0f0;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    min-width: 280px;
}

.puzzle15-panel h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.8em;
}

.puzzle15-panel p {
    font-size: 1.1em;
    color: #555;
}

/* 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
}

/* piccole regole per schermi stretti */
@media (max-width:420px) {
    .app__header {
        padding: 0 10px 0 10px;
    }
}