: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; */
    max-width: 850px;
    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
}

/* 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;
    z-index: 20;
}

.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
}

/* Logiche Blackjack */
.blackjack-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* padding: 20px; */
    color: white;
}

.blackjack-container h4 {
    margin-bottom: 5px;
}

.blackjack-hand {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Stile per la card del Blackjack */
.blackjack-card {
    width: 108px;
    height: 183px;
    background-color: white;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;

    position: relative;
    /* Necessario per posizionare gli elementi al suo interno */
    overflow: hidden;
    /* Per evitare che gli elementi escano dai bordi */
}

/* Stili per il dorso della carta */
.blackjack-card.back {
    background-image: url("Immagini/card-back.png");
    background-color: transparent;
    color: transparent;
    background-size: cover;
    background-position: center;
}

/* Stili per la faccia della carta */
.card-face {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Stili per l'immagine centrale */
.card-image-center {
    width: 80%;
    height: 80%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* Stili per il numero negli angoli */
.card-corner-rank {
    position: absolute;
    font-size: 1.5em;
    font-weight: bold;
    color: black;
    z-index: 10;
}

.card-corner-rank.top-left {
    top: 5px;
    left: 8px;
}

.card-corner-rank.bottom-right {
    bottom: 5px;
    right: 8px;
    transform: rotate(180deg);
    /* Ruota il testo per l'angolo in basso a destra */
}

.blackjack-status {
    height: 35px;
    color: var(--clr-chiaro);
    border: 1px solid var(--clr-chiaro);
    padding: 5px 10px;
    border-radius: 8px;

    font-size: 1.2em;
    text-align: center;
    min-height: 25px;
}

.blackjack-scores {
    font-size: 1.2em;
    min-height: 25px;
    padding: 0 10px;
    margin-bottom: 10px;
}

.score-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 350px;
    padding: 0 30px;
    /* margin-bottom: 20px; */
}

.blackjack-controls {
    display: flex;
    gap: 15px;
    /* margin-top: 20px; */
    margin-bottom: 10px;
}

.blackjack-controls .button {
    width: 150px;
    height: 35px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    padding: 10px 20px;
}

/* Effetti di bagliore per il saldo */
.win-glow {
    animation: glow-win 1s ease-in-out forwards;
}

.lose-glow {
    animation: glow-lose 1s ease-in-out forwards;
}

/* Animazione del bagliore verde per la vittoria */
@keyframes glow-win {
    0% {
        text-shadow: 0 0 5px rgba(0, 255, 0, 0);
        color: white;
    }

    50% {
        text-shadow: 0 0 15px #0f0, 0 0 20px #0f0;
        color: #00ff00;
    }

    100% {
        text-shadow: 0 0 5px rgba(0, 255, 0, 0);
        color: white;
    }
}

/* Animazione del bagliore rosso per la sconfitta */
@keyframes glow-lose {
    0% {
        text-shadow: 0 0 5px rgba(255, 0, 0, 0);
        color: white;
    }

    50% {
        text-shadow: 0 0 15px #f00, 0 0 20px #f00;
        color: #ff0000;
    }

    100% {
        text-shadow: 0 0 5px rgba(255, 0, 0, 0);
        color: white;
    }
}

/* Animazione del bagliore bianco per il pareggio */
.push-glow {
    animation: glow-push 1s ease-in-out forwards;
}

@keyframes glow-push {
    0% {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0);
        color: white;
    }

    50% {
        text-shadow: 0 0 15px #fff, 0 0 20px #fff;
        color: #ffffff;
    }

    100% {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0);
        color: white;
    }
}

/* 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 10px;
    margin-bottom: 10px;
}

/* Nasconde il regolamento */
.regolamento-container.hidden {
    max-height: 0;
    padding: 0 10px;
    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 p {
    margin: 0;
}

/*---------------------------------------------------
Smartphone - esegue se lo schermo è inferiore o uguale a 690px
---------------------------------------------------*/
@media screen and (max-width: 690px) {
    .blackjack-card {
        width: 80px;
        height: 135px;
    }

    .card-corner-rank {
        font-size: 1em;
        /* Riduci la dimensione del numero negli angoli */
    }

    .blackjack-container {
        font-size: 0.9em;
        /* Riduci la dimensione generale del testo del gioco */
    }

    .blackjack-controls .button {
        width: 110px;
        font-size: 0.8em;
        padding: 8px 16px;
    }

    .blackjack-hand {
        gap: 5px;
        /* Riduci lo spazio tra le carte */
    }
}

/*---------------------------------------------------
Smartphone - esegue se lo schermo è inferiore o uguale a 480px
---------------------------------------------------*/
@media (max-width: 480px) {

    /* header */
    .app__header {
        padding: 0 10px 0 10px;
    }

    .blackjack-card {
        width: 65px;
        height: 110px;
    }

}