
.polygon {
    transition: opacity, transform 1s ease;
    position: absolute;
    transform: translate(-50%, -50%);
    opacity: 10%;
    overflow: hidden;
}

.polygon.animate {
    transition: opacity, transform 1s ease;
    visibility: visible;
    transform: translate(-50%, -50%) scale(2);
    opacity: 100%;
}

.triangle {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 50px solid dodgerblue; /* Color of the triangle */
    top: 25%;
    right: 23%;
}

.square {
    width: 50px;
    height: 50px;
    background-color: orange;
    top: 50%;
    left: 27%;
}

.pentagon {
    width: 50px;
    height: 50px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    background-color: white;
    top: 80%;
    right: 19%;
}

.octagon {
    width: 50px;
    height: 50px;
    clip-path: polygon(
            30% 0%, /* Top-left corner */
            70% 0%, /* Top-right corner */
            100% 30%, /* Right-top corner */
            100% 70%, /* Right-bottom corner */
            70% 100%, /* Bottom-right corner */
            30% 100%, /* Bottom-left corner */
            0% 70%, /* Left-bottom corner */
            0% 30% /* Left-top corner */
    );
    background-color: red;
    top: 55%;
    right: 10%;
}

.circle {
    width: 50px;
    height: 50px;
    background-color: green;
    border-radius: 50%;
    top: 20%;
    left: 20%;
}

.cube {
    position: relative;
    width: 100px;
    height: 100px;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(20deg);
    margin: 100px auto;
    transition: transform 5s; /* Smooth transition for manual animation toggling */
}

/* General Face Styles */
.cube .face {
    position: absolute;
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
}

/* Front */
.cube .front { transform: translateZ(60px); background: white/*#cccccc*/; }
/* Back */
.cube .back { transform: rotateY(180deg) translateZ(-60px); background: white/*#6c63ff*/; }
/* Left */
.cube .left { transform: rotateY(-90deg) translateX(-60px); transform-origin: left center; background: white/*#28c76f*/; }
/* Right */
.cube .right { transform: rotateY(90deg) translateX(60px); transform-origin: right center; background: white/*#ffc107*/; }
/* Top */
.cube .top { transform: rotateX(90deg) translateY(-60px); transform-origin: top center; background: white/*#00cfe8*/; }
/* Bottom */
.cube .bottom { transform: rotateX(-90deg) translateY(60px); transform-origin: bottom center; background: white/*#ea5455*/; }

/* Rotation Animation */
.cube.animate {
    animation: rotateCube 10s infinite linear;
}

@keyframes rotateCube {
    0% {
        transform: rotateY(0deg) rotateX(0deg) translateY(0);
    }
    12.5%{
        transform: rotateY(-180deg) rotateX(180deg) translateY(30px);
    }
    25%{
        transform: rotateY(-360deg) rotateX(360deg) translateY(60px);
    }
    50%{
        transform: rotateY(-180deg) rotateX(180deg) translateY(30px);
    }
    62.5%{
        transform: rotateY(0deg) rotateX(0deg) translateY(0px);
    }
    75%{
        transform: rotateY(180deg) rotateX(-180deg) translateZ(-30px);
    }
    99.9% {
        transform: rotateY(360deg) rotateX(-360deg) translateZ(0px);
    }
    100% {
        transform: rotateY(0deg) rotateX(0deg); /* Seamlessly jump back to 0 degrees */
    }
}


.animate_button {
    top: 40%;
    position: absolute;
    align-self: center;
    width: auto;
    border-radius: 5px;
    border: 1px solid var(--border-light-color);
    font-size: 90%;
    color: var(--font-dark-color);
    background-color: var(--background-normal-color);
    cursor: pointer;
    margin: 10px;
}

#select_animation {
    top: 70%;
    left: 15%;
    position: absolute;
    align-self: center;
    width: max(100px,10%);
    border-radius: 5px;
    border: 1px solid var(--border-light-color);
    font-size: 90%;
    color: var(--font-dark-color);
    background-color: var(--background-normal-color);
    cursor: pointer;
    margin: 10px;
}

#select_anim_label {
    top: 68%;
    left: 15%;
    position: absolute;
}

#select_animation:hover {
    transition: background-color 0.3s ease;
    color: var(--font-basic-color);
    background-color: var(--background-dark-color);
}

#select_animation:focus {
    outline: none;
}

.animate_button:hover {
    transition: background-color 0.3s ease;
    color: var(--font-basic-color);
    background-color: var(--background-dark-color);
}