/* 3D Dice Styling */

.dice-wrapper {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    min-height: 150px;
}

.dice {
    width: 80px;
    height: 80px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s ease-out;
    cursor: pointer;
}

.dice:hover {
    transform: rotateX(20deg) rotateY(20deg) scale(1.05);
}

.dice.rolling {
    animation: roll 1s linear infinite;
    transition: none; /* Disable transition during rolling */
}

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

.face {
    position: absolute;
    width: 80px;
    height: 80px;
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "a . c"
        "e g f"
        "d . b";
    padding: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Dice face positions */
.front  { transform: translateZ(40px); }
.back   { transform: rotateY(180deg) translateZ(40px); }
.right  { transform: rotateY(90deg) translateZ(40px); }
.left   { transform: rotateY(-90deg) translateZ(40px); }
.top    { transform: rotateX(90deg) translateZ(40px); }
.bottom { transform: rotateX(-90deg) translateZ(40px); }

/* Dice pips (dots) */
.pip {
    width: 12px;
    height: 12px;
    background: #d32f2f;
    border-radius: 50%;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
    align-self: center;
    justify-self: center;
}

/* Dice shadow */
.dice-wrapper::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3), transparent);
    border-radius: 50%;
}

/* Roll button styling */
#roll-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#roll-btn:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

#roll-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Responsive dice */
@media (max-width: 767px) {
    .dice {
        width: 60px;
        height: 60px;
    }

    .face {
        width: 60px;
        height: 60px;
        padding: 8px;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
    }

    .pip {
        width: 9px;
        height: 9px;
    }

    .front  { transform: translateZ(30px); }
    .back   { transform: rotateY(180deg) translateZ(30px); }
    .right  { transform: rotateY(90deg) translateZ(30px); }
    .left   { transform: rotateY(-90deg) translateZ(30px); }
    .top    { transform: rotateX(90deg) translateZ(30px); }
    .bottom { transform: rotateX(-90deg) translateZ(30px); }

    .dice-wrapper {
        gap: 20px;
    }
}
