/* === DICE MODAL === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(20, 8, 4, 0.97);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 2rem 3rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 0 60px rgba(201, 168, 76, 0.2);
    margin: auto;
}

.modal-content h2, .modal-content h3 {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold);
    margin-bottom: 1rem;
}

.dice-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.dice {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #3d2914 0%, #2c1810 50%, #1a0f08 100%);
    border: 3px solid var(--gold);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'MedievalSharp', cursive;
    font-size: 2.8rem;
    color: var(--gold);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.3), inset 0 0 20px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

.dice.rolling {
    animation: diceRoll 0.1s infinite;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(10deg) scale(1.05); }
    50% { transform: rotate(-5deg) scale(0.95); }
    75% { transform: rotate(8deg) scale(1.02); }
    100% { transform: rotate(0deg) scale(1); }
}

.dice.result {
    animation: diceResult 0.5s ease;
}

@keyframes diceResult {
    0% { transform: scale(1.3) rotate(15deg); }
    50% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.dice-action-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    color: rgba(244, 228, 193, 0.8);
    font-style: italic;
    margin: 0.6rem 0 1rem 0;
    line-height: 1.5;
}

.dice-pre-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin: 0.5rem 0 0.75rem 0;
}

.dice-stat-badge {
    font-family: 'MedievalSharp', cursive;
    font-size: 0.82rem;
    color: rgba(201, 168, 76, 0.75);
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.25);
    padding: 3px 11px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.dice-mod-badge {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 2px 14px;
    border-radius: 6px;
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.22);
    color: #e8c96b;
    min-width: 3rem;
    text-align: center;
}

.dice-mod-badge.pos  { color: #7ec87e; border-color: rgba(126,200,126,0.35); background: rgba(126,200,126,0.08); }
.dice-mod-badge.neg  { color: #d96060; border-color: rgba(217,96,96,0.35);  background: rgba(217,96,96,0.08); }
.dice-mod-badge.zero { color: rgba(200,185,155,0.5); }

.dice-formula {
    font-family: 'Crimson Text', serif;
    font-size: 0.92rem;
    color: rgba(244, 228, 193, 0.4);
    margin: 0 0 0.25rem 0;
}

.dice-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.dice-detail {
    color: var(--parchment-dark);
    font-size: 0.95rem;
    margin: 0.5rem 0;
}

.dice-result {
    font-family: 'MedievalSharp', cursive;
    font-size: 1.3rem;
    margin: 0.8rem 0;
    min-height: 1.5em;
}

.dice-result.success {
    color: #27ae60;
}

.dice-result.failure {
    color: var(--blood-light);
}

.dice-result.critical-success {
    color: var(--gold);
    text-shadow: 0 0 15px rgba(201, 168, 76, 0.6);
    font-size: 1.5rem;
}

.dice-result.critical-failure {
    color: var(--blood);
    text-shadow: 0 0 15px rgba(139, 26, 26, 0.6);
    font-size: 1.5rem;
}

/* === END MODAL === */
#end-modal .modal-content {
    max-width: 500px;
}

#end-modal h2 {
    font-size: 2rem;
}

#end-modal p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--parchment-dark);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 168, 76, 0.6);
}

/* === DAMAGE FLASH === */
.damage-flash {
    animation: damageFlash 0.5s ease;
}

@keyframes damageFlash {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(192, 57, 43, 0.6); }
}

.heal-flash {
    animation: healFlash 0.5s ease;
}

@keyframes healFlash {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(39, 174, 96, 0.6); }
}

