:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --accent-color: #10b981;
    --danger-color: #ef4444;
}

.full-row {
    width: 100%;
}

.container-dice-roll {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0 auto;
    background-color: var(--card-bg);
    width: 80%;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    font-size: 1.875rem;
    margin-bottom: 2rem !important;
    color: var(--text-main);
}

.controls-dice-roll {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: end;
}

.battle-initiative {
    grid-template-columns: 1fr 1fr auto 1fr auto;
}

.hit-calculate {
    grid-template-columns: 1fr 1fr 1fr auto;
}

@media (max-width: 960px) {
    .controls-dice-roll, .battle-initiative, .hit-calculate {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 548px) {
    .controls-dice-roll, .battle-initiative, .hit-calculate {
        grid-template-columns: 1fr;
    }
    button.btn-clear {
        width: 100% !important;
    }
    button.btn-roll {
        margin-top: 40px !important;
    }
    table {
        font-size: 12px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    margin-bottom: 20px;
}

button.btn-roll {
    margin-bottom: 20px;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

select, input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, ring 0.2s;
}

select:focus, input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-dice-roll {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-roll {
    background-color: var(--primary-color);
    color: white;
}

.btn-roll:hover {
    background-color: var(--primary-hover);
}

.btn-roll:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

button.btn-clear {
    background-color: transparent;
    color: var(--text-muted);
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    width: 25%;
}

.btn-clear:hover {
    background-color: #fee2e2;
    color: var(--danger-color);
    border-color: #fecaca;
}

.results-container-dice-roll {
    margin-top: 2rem;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.dice {
    width: 50px;
    height: 50px;
    background-color: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    user-select: none;
}

/* Animation class */
.rolling {
    animation: shake 0.15s infinite ease-in-out;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.1);
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg) scale(1.1); }
    20% { transform: translate(-1px, -2px) rotate(-1deg) scale(1.1); }
    40% { transform: translate(-3px, 0px) rotate(1deg) scale(1.1); }
    60% { transform: translate(3px, 2px) rotate(0deg) scale(1.1); }
    80% { transform: translate(1px, -1px) rotate(1deg) scale(1.1); }
    100% { transform: translate(-1px, 2px) rotate(-1deg) scale(1.1); }
}

.total-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    padding: 1rem;
    border-top: 1px dashed var(--border-color);
    width: 100%;
    text-align: center;
    display: none;
}

.total-value {
    color: var(--accent-color);
    font-size: 2rem;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
    position: absolute;
    top: 82px;
}

.roll-btn {
    font-size: 18px;
    width: 49px;
    padding: 0;
    background: #0ea5e9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s ease;
    height: 49px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 40px;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

th {
    background: #f3f4f6;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.center {
    text-align: center;
}

.delete-btn {
    background: #f3f4f6;
    border-radius: 10px;
    padding: 6px 10px;
    height: auto;
    font-size: 13px;
    border-color: transparent;
}

.delete-btn:hover {
    background: #f3f4f6;
    border-color: dimgrey;
}

.roll-history {
    display: none;
    font-size: 1.2rem;
    width: 100%;
    text-align: center;
    border-top: 1px dashed var(--border-color);
    padding: 1rem;
    color: var(--text-main);
    list-style-type: none;
}
