/* Dice Styles */
.dice-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.dice {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    color: #1a1a2e;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    user-select: none;
}

.dice:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.dice.kept {
    background: linear-gradient(135deg, var(--accent-color) 0%, #e11d48 100%);
    color: white;
    transform: translateY(-12px) scale(1.05);
    box-shadow: 0 0 25px var(--accent-color), 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
}

.dice.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dice.rolling {
    animation: diceRoll 0.4s ease-in-out;
}

@keyframes diceRoll {
    0% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(15deg) scale(1.1);
    }

    50% {
        transform: rotate(-10deg) scale(0.9);
    }

    75% {
        transform: rotate(5deg) scale(1.05);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

/* Roll Button */
.btn-roll {
    font-size: 16px;
    padding: 16px 32px;
}

/* Score Sheet */
/* Score Sheet */
#score-sheet-container {
    margin-top: 10px;
    overflow-x: auto;
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
    /* Masquer la scrollbar par défaut mais permettre le scroll */
    scrollbar-width: thin;
    padding-bottom: 20px;
    /* Espace pour l'ombre */
}

.score-sheet {
    width: 100%;
    border-collapse: separate;
    /* Nécessaire pour sticky */
    border-spacing: 0;
    font-size: 13px;
    /* Légèrement plus grand pour lisibilité */
}

.score-sheet td,
.score-sheet th {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 8px;
    text-align: center;
    white-space: nowrap;
    /* Empêcher le retour à la ligne */
}

.score-sheet th {
    background: rgba(30, 41, 59, 0.95);
    /* Fond opaque pour sticky */
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Colonne Sticky (Règles) */
.score-sheet th:first-child,
.score-sheet td:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    /* Au-dessus des autres cellules */
    background: rgba(15, 23, 42, 0.95);
    /* Fond sombre pour cacher le scroll */
    backdrop-filter: blur(8px);
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

.score-sheet th:first-child {
    z-index: 30;
    /* Coin haut gauche au-dessus de tout */
}

/* Avatar in score sheet header */
.th-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid;
    overflow: hidden;
    margin: 0 auto;
}

.th-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-name {
    font-weight: 700;
    font-size: 10px;
    text-transform: none;
}

@keyframes colGlow {

    0%,
    100% {
        box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.3);
    }

    50% {
        box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.5);
    }
}

.cat-header {
    width: 40%;
}

.cat-label {
    text-align: left !important;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    padding-left: 8px !important;
}

.cat-label:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.help-icon {
    font-size: 12px;
    opacity: 0.5;
    margin-right: 5px;
    transition: opacity 0.2s;
}

.cat-label:hover .help-icon {
    opacity: 1;
}

.score-cell {
    background: rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    font-weight: 500;
}

.score-cell.editable {
    cursor: pointer;
    position: relative;
}

.score-cell.editable::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.score-cell.editable:hover::after {
    opacity: 1;
}

.score-cell.editable:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.05);
}

.score-cell.filled {
    font-weight: 700;
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

/* Score de 0 = renoncé = croix rouge */
.score-cell.filled.score-zero {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.score-cell.potential {
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

/* My column highlight - blue border */
.score-sheet th.my-col,
.score-sheet td.my-col {
    background: rgba(59, 130, 246, 0.15);
    border-left: 2px solid var(--primary-color);
    border-right: 2px solid var(--primary-color);
}

.score-sheet th.my-col {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

/* Current player column highlight - green glow */
.score-sheet th.current-col:not(.my-col),
.score-sheet td.current-col:not(.my-col) {
    background: rgba(16, 185, 129, 0.1);
}

.score-sheet th.current-col:not(.my-col) {
    background: rgba(16, 185, 129, 0.2);
    animation: colGlow 2s infinite ease-in-out;
}

/* Subtotal and bonus rows */
.subtotal-row td {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

.bonus-row td {
    background: rgba(245, 158, 11, 0.1);
    font-weight: 600;
}

.bonus-row td.bonus-earned {
    color: var(--success-color);
    font-weight: 800;
}

.bonus-row td.bonus-missed {
    color: var(--danger-color);
    font-weight: 700;
}

.bonus-row td.bonus-ontrack {
    color: var(--success-color);
}

.section-separator td {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 0;
}

.total-row td {
    background: rgba(255, 255, 255, 0.1);
    font-size: 14px;
    font-weight: 800;
}

.total-row td:first-child {
    text-align: left !important;
    padding-left: 12px !important;
}

/* Current Player Indicator */
.current-player-indicator {
    text-align: center;
    padding: 18px 20px;
    margin-bottom: 20px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.4s ease;
}

.current-player-indicator.my-turn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(59, 130, 246, 0.2)) !important;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.turn-emoji {
    font-size: 24px;
    margin-right: 8px;
    display: inline-block;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Animations */
@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
    }
}

.pulse-animation {
    animation: pulseGlow 1.5s infinite, fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-animation {
    animation: slideIn 0.4s ease-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.4s ease;
    border-color: var(--accent-color) !important;
}

/* ===== ERROR TOAST ===== */
.error-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
    color: white;
    padding: 14px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .error-toast {
        bottom: 90px;
        padding: 12px 18px;
        max-width: 85%;
    }

    .toast-message {
        font-size: 13px;
    }
}