/* 3D Dice styling */
.dice-container {
    perspective: 600px;
}

.dice {
    width: 68px;
    height: 68px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.3s ease;
    cursor: pointer;
    user-select: none;
}

@media (min-width: 640px) {
    .dice {
        width: 76px;
        height: 76px;
    }
}

.dice.rolling {
    animation: roll3d 0.4s infinite linear;
}

@keyframes roll3d {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(180deg); }
}

.dice-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: linear-gradient(145deg, #2c2a38, #16151f);
    border: 2px solid #45435a;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.15), 0 10px 20px rgba(0,0,0,0.6);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    box-sizing: border-box;
    backface-visibility: hidden;
}

/* Pip styling */
.pip {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #a1a1aa);
    border-radius: 50%;
    align-self: center;
    justify-self: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Locked status */
.dice.locked .dice-face {
    background: linear-gradient(145deg, #064e3b, #022c22);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6), inset 0 0 10px rgba(16, 185, 129, 0.4);
}

.dice.locked .pip {
    background: radial-gradient(circle at 30% 30%, #a7f3d0, #10b981);
}

/* Destroyed status (Rolled a 6) */
.dice.destroyed {
    cursor: not-allowed;
    animation: shake 0.4s ease-in-out;
}

.dice.destroyed .dice-face {
    background: linear-gradient(145deg, #450a0a, #180303);
    border-color: #ef4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), inset 0 0 12px rgba(239, 68, 68, 0.5);
}

.dice.destroyed .pip {
    background: radial-gradient(circle at 30% 30%, #fca5a5, #dc2626);
    box-shadow: 0 0 5px #ef4444;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-6px, 4px) rotate(-8deg); }
    40% { transform: translate(6px, -4px) rotate(8deg); }
    60% { transform: translate(-4px, -2px) rotate(-4deg); }
    80% { transform: translate(4px, 2px) rotate(4deg); }
}

.special-flash {
    animation: specialFlash 0.65s ease-in-out;
}

@keyframes specialFlash {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(245,158,11,0); }
    50% { transform: scale(1.025); box-shadow: 0 0 30px rgba(245,158,11,0.55); }
}

/* Screen Shake effect */
.screen-shake {
    animation: globalShake 0.35s ease-in-out;
}

@keyframes globalShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-8px, 5px); }
    50% { transform: translate(8px, -5px); }
    75% { transform: translate(-5px, -3px); }
}
