html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: url('background.jpg?v=1.2.5') center center / cover no-repeat;
    background-attachment: fixed;
    position: relative;
}

html::before,
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    z-index: 0;
}

#canvas {
    display: block;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.css-fallback {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    perspective: 1200px;
    cursor: pointer;
    z-index: 1;
}

.css-fallback .dice {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    transform-style: preserve-3d;
}

.face {
    position: absolute;
    width: 120px;
    height: 120px;
    background: linear-gradient(145deg, #f8f8f8 0%, #e8e8e8 25%, #d0d0d0 75%, #c0c0c0 100%);
    border: 4px solid #999;
    border-radius: 20px;
    box-sizing: border-box;
    backface-visibility: hidden;
    box-shadow: 
        inset 0 8px 20px rgba(255, 255, 255, 0.8),
        inset 0 -8px 20px rgba(0, 0, 0, 0.2),
        inset 2px 2px 4px rgba(255, 255, 255, 0.6),
        inset -2px -2px 4px rgba(0, 0, 0, 0.15),
        0 15px 40px rgba(0, 0, 0, 0.4);
}

.dot {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #2a2a2a 0%, #1a1a1a 70%, #0a0a0a 100%);
    border-radius: 50%;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.6),
        inset 1px 1px 2px rgba(80, 80, 80, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.4);
}

/* Dot positioning classes */
.dot.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dot.top-left {
    top: 20px;
    left: 20px;
}

.dot.top-right {
    top: 20px;
    right: 20px;
}

.dot.bottom-left {
    bottom: 20px;
    left: 20px;
}

.dot.bottom-right {
    bottom: 20px;
    right: 20px;
}

.dot.middle-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.dot.middle-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.f1 {
    transform: rotateY(0deg) translateZ(60px);
}

.f2 {
    transform: rotateY(90deg) translateZ(60px);
}

.f3 {
    transform: rotateY(180deg) translateZ(60px);
}

.f4 {
    transform: rotateY(-90deg) translateZ(60px);
}

.f5 {
    transform: rotateX(90deg) translateZ(60px);
}

.f6 {
    transform: rotateX(-90deg) translateZ(60px);
}

/* Animation classes - will be added dynamically */
.dice.rolling {
    animation: diceRoll 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes diceRoll {
    0% {
        transform: translate3d(0, -400px, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    
    60% {
        transform: translate3d(0, 150px, 0) rotateX(var(--rotX)) rotateY(var(--rotY)) rotateZ(var(--rotZ));
    }
    
    75% {
        transform: translate3d(0, 120px, 0) rotateX(var(--rotX)) rotateY(var(--rotY)) rotateZ(var(--rotZ));
    }
    
    85% {
        transform: translate3d(0, 140px, 0) rotateX(var(--rotX)) rotateY(var(--rotY)) rotateZ(var(--rotZ));
    }
    
    95% {
        transform: translate3d(0, 135px, 0) rotateX(var(--rotX)) rotateY(var(--rotY)) rotateZ(var(--rotZ));
    }
    
    100% {
        transform: translate3d(0, 140px, 0) rotateX(var(--rotX)) rotateY(var(--rotY)) rotateZ(var(--rotZ));
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.9;
    }
}