body {
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    margin: 0;
    padding: 1.25em 0.5em;
    /* Modifica: padding top/bottom 1.25em, left/right 0.5em */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100%;
    /* Aggiunto per evitare che il body si restringa troppo */
    box-sizing: border-box;
    /* Include padding e border nel calcolo della larghezza */
    padding: 1.25em 0.5em;
    /* Ensure left and right padding are equal */
}

.container {
    background: #fff;
    border-radius: 0.625em;
    /* Converte 10px in em */
    box-shadow: 0 0.125em 0.375em rgba(0, 0, 0, 0.1);
    /* Converte 2px e 6px in em */
    padding: 1.25em;
    /* Converte 20px in em */
    margin: 0.625em;
    /* Converte 10px in em */
    width: 90%;
    /* Modified: set container width to 90% */
    max-width: 90%;
    /* Modified: set container maximum width to 90% */
    text-align: center;
    box-sizing: border-box;
    /* Include padding e border nel calcolo della larghezza */


    padding: 0.9375em;
    /* Converte 15px in em */
    margin: 0.3125em;
    /* Converte 5px in em */
}

/* Control container styles */
#control-container {
    display: flex;
    justify-content: center;
    gap: 1.25em;
    /* Converte 20px in em */
    margin-bottom: 1.25em;
    /* Converte 20px in em */
}

#control-container button {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 0.9375em 1.5625em;
    /* Converte 15px e 25px in em */
    border-radius: 0.3125em;
    /* Converte 5px in em */
    cursor: pointer;
    font-size: 1em;
}

#control-container button:hover {
    background: #218838;
}

/* Boss container styles */
#boss-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625em;
    /* Converte 10px in em */
}


#boss-life {
    font-size: 3em;
}

#boss-life input {
    padding: 0.3125em;
    /* Converte 5px in em */
    border: 0.0625em solid #ccc;
    /* Converte 1px in em */
    border-radius: 0.3125em;
    /* Converte 5px in em */
    width: 6.25em;
    /* Converte 100px in em */
    margin-left: 0.625em;
    /* Converte 10px in em */
}

#reset-boss {
    background: #007BFF;
    color: #fff;
    border: none;
    padding: 0.625em 1.25em;
    /* Converte 10px e 20px in em */
    border-radius: 0.3125em;
    /* Converte 5px in em */
    cursor: pointer;
    font-size: 1em;
}

#reset-boss:hover {
    background: #0056b3;
}

/* Damage container styles */
#damage-container {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
}

#total {
    font-weight: bold;
}

#damage-timer {
    background: #333;
    color: #fff;
    padding: 0.3125em 0.625em;
    /* Converte 5px e 10px in em */
    border-radius: 0.3125em;
    /* Converte 5px in em */
}

/* Dice container styles */
#dice-container {
    display: flex;
    justify-content: center;
    gap: 0.5em;
    /* Ridotto il gap */
    flex-wrap: nowrap;
    /* Forza la disposizione orizzontale */
    overflow-x: auto;
    /* Aggiunge scroll orizzontale se necessario */
    padding: 0.5em;
    /* Aggiunto padding per spaziatura interna */
}

.dice {
    width: 30%;
    height: 0;
    padding-bottom: 30%;
    /* Ridotto la larghezza dei dadi */
    /* Ridotto l'altezza dei dadi */
    cursor: pointer;
    border: 0.125em solid #333;
    border-radius: 0.625em;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    user-select: none;
    transition: background-color 0.3s;
    position: relative;
    flex-shrink: 0;
    /* Impedisce ai dadi di ridursi */
    margin: 0;
    /* Rimozione del margin bottom */
}

.dice-value {
    padding-top: 100%;
    font-size: 2.5em;
    /* Ridotto la dimensione del font */
}

/* Stile per l'indicatore del cooldown posizionato in basso a destra dentro il dado */
.cooldown-indicator {
    position: absolute;
    bottom: 0.125em;
    /* Converte 2px in em */
    right: 0.125em;
    /* Converte 2px in em */
    font-size: 1.10em;
    /* dimensione ridotta */
    color: red;
    /* Non usare display:none mai */
}

/* Boss icon style */
#boss-icon {
    font-size: 6.5em;
    /* Converte 80px in em */
}

/* Applica lo stile fisso al nuovo contenitore log-sidebar */
#log-sidebar {
    position: relative;
    /* top: 20px;
    right: 20px; */
    width: 18.75em;
    /* Converte 300px in em */
    height: auto;
    /* altezza automatica basata sul contenuto */
    max-height: calc(100% - 2.5em);
    /* limita l'altezza massima alla finestra */
    overflow-y: auto;
    background: #fff;
    border-radius: 0.625em;
    /* Converte 10px in em */
    box-shadow: 0 0.125em 0.375em rgba(0, 0, 0, 0.1);
    /* Converte 2px e 6px in em */
    padding: 1.25em;
    /* Converte 20px in em */
    text-align: left;
    box-sizing: border-box;
    /* Include padding e border nel calcolo della larghezza */
}



#default-boss,
#default-timer {
    width: 3.75em;
    /* Converte 60px in em */
}

/* Aggiunge uno spazio tra i valori di default */
#defaults-container div {
    margin-bottom: 0.625em;
    /* Converte 10px in em */
}

/* Bottom menu styles */
#bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #333;
    color: #fff;
    display: flex;
    justify-content: space-around;
    padding: 0; /* rimosso padding per evitare variazioni */
    box-sizing: border-box;
    z-index: 1000;
}

#bottom-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 1.2em;
    display: inline-block;
    width: 120px; /* dimensione fissa */
    height: 40px; /* dimensione fissa */
    line-height: 40px; /* per centrare verticalmente il testo */
    text-align: center;
    box-sizing: border-box;
    /* Rimuovi padding extra */
    padding: 0;
}

/* Evidenzia il link attivo nel menu senza alterare le dimensioni */
#bottom-menu a.active {
    background: #555;
    /* Mantenendo padding:0 per non modificare le dimensioni */
    border-radius: 0.3125em;
}

/* Nuovo stile per il container grid del Box */
#box-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 90%;
    max-width: 600px;
    margin: 1em auto;
}

/* Stile per ogni dado custom */
.dice-card {
    background: #eee;
    border: 2px solid #ccc;
    border-radius: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: move;
    /* Proprietà per mantenere l'aspect ratio 1:1 */
    aspect-ratio: 1 / 1;
}

/* Stile specifico per il tasto "+" */
.add-dice {
    background: #28a745;
    color: #fff;
    border: 2px solid blue;  /* DEBUG: bordo blu per vedere l'elemento */
    /* Forza il posizionamento fisso nella cella 1x1 */
    grid-column: 1;
    grid-row: 1;
}

/* Stile per la trash bin */
#trash-bin {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}
#trash-bin img {
    width: 40px;
    height: 40px;
    cursor: pointer;
}

/* Stili per il modal di configurazione */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 1em 2em;
    border-radius: 0.5em;
    text-align: center;
    max-width: 90%;
}

.modal-content form label {
    display: block;
    margin-bottom: 0.5em;
}

.modal-content form input {
    width: 80%;
    margin: 0.5em 0;
}

/* New style for dice modal button */
.dice-modal-button {
    position: absolute;
    bottom: 0.1em;
    left: 0.1em;
    font-size: 0.7em;
    padding: 0.2em 0.4em;
    z-index: 2;
}

/* Modified dice modal style */
#dice-modal {
    display: none;  /* Ensure modal is hidden on page load */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    /* Removed duplicate display property */
    align-items: center;
    justify-content: center;
    z-index: 3000;
}