:root { 
    --primary: #8b0000; 
    --bg: #f4f4f9; 
    --card: #ffffff; 
    --text: #333; 
}

body { 
    font-family: 'Segoe UI', sans-serif; 
    background-color: var(--bg); 
    margin: 0; 
    padding: 10px; 
    color: var(--text); 
}

.app-container { 
    max-width: 500px; 
    margin: auto; 
}

.char-header { 
    background: var(--primary); 
    color: white; 
    padding: 15px; 
    border-radius: 15px; 
    text-align: center; 
    margin-bottom: 15px; 
}

.exp-bar-container { 
    background: rgba(255,255,255,0.3); 
    height: 8px; 
    border-radius: 4px; 
    margin: 10px 0; 
    overflow: hidden; 
}

.exp-fill { 
    background: #ffcc00; 
    height: 100%; 
}

.quick-menu { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    margin-bottom: 15px; 
}

.menu-row { 
    display: flex; 
    gap: 8px; 
}

.menu-row button { 
    flex: 1; 
    padding: 12px; 
    border: none; 
    border-radius: 8px; 
    background: var(--card); 
    font-weight: bold; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    cursor: pointer;
}

.combat-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 10px; 
    margin-bottom: 15px; 
}

.stat-box { 
    background: var(--card); 
    padding: 10px; 
    border-radius: 10px; 
    text-align: center; 
    border: 1px solid #ddd; 
}

.hp-control { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 20px; 
    background: var(--card); 
    padding: 15px; 
    border-radius: 15px; 
    border: 1px solid #ddd; 
}

.hp-display { 
    font-size: 1.5rem; 
    font-weight: bold; 
}

.btn-plus { 
    background: #4caf50; 
    color: white; 
    border: none; 
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    font-size: 1.5rem; 
    cursor: pointer;
}

.btn-minus { 
    background: #f44336; 
    color: white; 
    border: none; 
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    font-size: 1.5rem; 
    cursor: pointer;
}

.abilities-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 8px; 
}

.ability-card { 
    background: white; 
    padding: 8px; 
    border-radius: 10px; 
    text-align: center; 
    border: 1px solid #ddd; 
}

.ability-card .label { 
    display: block; 
    font-size: 0.7rem; 
    color: #666; 
}

.ability-card .mod { 
    display: block; 
    font-size: 1.2rem; 
    font-weight: bold; 
    color: var(--primary); 
}

.ability-card .score { 
    font-size: 0.8rem; 
    color: #999; 
}

.grid-2 { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
}

/* Stili Admin */
.admin-form-style input, .admin-form-style select { 
    width: 100%; 
    padding: 12px; 
    margin: 5px 0 15px 0; 
    border: 1px solid #ccc; 
    border-radius: 5px; 
    box-sizing: border-box; 
}

.btn-save { 
    width: 100%; 
    padding: 15px; 
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 10px; 
    font-weight: bold; 
    margin-top: 10px; 
    cursor: pointer;
}

/* Griglia Selezione Personaggi */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 10px;
}

.char-card-link { 
    text-decoration: none; 
    color: inherit; 
}

.char-select-card {
    background: #333;
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid #444;
    transition: transform 0.2s;
}

.char-select-card:active { 
    transform: scale(0.95); 
}

.avatar-circle {
    width: 60px; 
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.char-select-card h2 { 
    font-size: 1.1rem; 
    margin: 0; 
}

.char-select-card p { 
    font-size: 0.8rem; 
    color: #aaa; 
    margin: 5px 0 0; 
}
/* Stili per la finestra Modale */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.7); 
    align-items: center; 
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    width: 85%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-btn {
    position: absolute;
    right: 15px; top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

#modal-title {
    color: var(--primary);
    margin-top: 0;
    border-bottom: 2px solid var(--bg);
    padding-bottom: 10px;
}

#modal-text {
    margin-top: 15px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}