/* general stuff */

:root {
    --zoom-factor: 1;
    --cubie-size: calc(var(--zoom-factor) * min(120px, 18vw));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: black;
    color: white;
    cursor: move;
}

a {
    color: inherit;
}

a:hover {
    color: yellow;
}

/* help */

#help {
    padding: 20px;
    font-family: "Courier New", Courier, monospace;
    font-size: 22px;
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 1;
    cursor: initial;
}

#helpToggler {
    display: none;
}

#helpContent {
    background-color: rgba(0, 0, 0, 0.9);
    box-shadow: 0px 0px 20px black;
    display: none;
}

#helpToggler:checked ~ label i {
    opacity: 1 !important;
}

#helpToggler:checked ~ #helpContent {
    display: block;
}

#help i {
    opacity: 0.6;
    cursor: pointer;
    text-shadow: 0px 0px 20px #fff8;
}

#help i.animated {
    opacity: 1 !important;
    animation: grow-and-shrink 3s ease-in-out infinite;
}

@keyframes grow-and-shrink {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

#help i:hover {
    opacity: 1;
}

#helpContent p {
    margin-top: 10px;
}

#helpContent strong {
    color: skyblue;
}

/* stage */

#stage {
    height: 100vh;
    perspective: calc(10 * var(--cubie-size));
    transform-style: preserve-3d;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

/* cube */

#cube {
    transform-style: inherit;
    transform: rotateX(-45deg) rotateY(45deg);
    transition: transform 200ms ease-in-out;
}

/* cube solved animation */

#cube.solved {
    animation: solveAnimation 50s linear infinite;
}

@keyframes solveAnimation {
    0% {
        transform: rotateX(-45deg) rotateY(45deg) rotateZ(0deg);
    }
    100% {
        transform: rotateX(315deg) rotateY(405deg) rotateZ(360deg);
    }
}

/* transparent mode */

#cube.transparent .face {
    background: transparent;
}

#cube.transparent .face {
    opacity: 0.85;
    box-shadow: none;
}

#cube.transparent .face::before {
    box-shadow: none;
}

/* rotation layer */

#cubeContainer {
    transform-style: inherit;
}

#rotationLayer {
    transition: transform ease-in-out;
    transition-duration: 250ms;
    transform-style: inherit;
}

/* cubie */

.cubie {
    width: 0%;
    height: 0%;
    transform-style: inherit;
    position: absolute;
    transition-duration: 0s;
    pointer-events: auto;
}

.cubie .face {
    position: absolute;
    width: var(--cubie-size);
    height: var(--cubie-size);
    background: #404040;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: box-shadow 100ms linear;
    box-shadow: 0 0 calc(0.1 * var(--cubie-size))
        rgba(255, 255, 255, 0.2) inset;
}

.cubie .face::before {
    content: "";
    width: 92%;
    height: 92%;
    border-radius: calc(0.1 * var(--cubie-size));
    background: var(--color);
    box-shadow: 0 0 calc(0.05 * var(--cubie-size)) rgba(0, 0, 0, 0.3)
        inset;
}

.cubie:hover .face {
    box-shadow: 0 0 calc(0.2 * var(--cubie-size))
        rgba(255, 255, 255, 1) inset !important;
}

/* 6 faces */

.cubie .face.front {
    transform: translateX(-50%) translateY(-50%)
        translateZ(calc(0.5 * var(--cubie-size)));
}

.cubie .face.back {
    transform: translateX(-50%) translateY(-50%)
        translateZ(calc(-0.5 * var(--cubie-size)));
}

.cubie .face.left {
    transform: translateX(calc(-50% + (-0.5) * var(--cubie-size)))
        translateY(-50%) rotateY(-90deg);
}

.cubie .face.right {
    transform: translateX(calc(-50% + (0.5) * var(--cubie-size)))
        translateY(-50%) rotateY(90deg);
}

.cubie .face.top {
    transform: translateX(-50%)
        translateY(calc(-50% + (-0.5) * var(--cubie-size)))
        rotateX(90deg);
}

.cubie .face.down {
    transform: translateX(-50%)
        translateY(calc(-50% + 0.5 * var(--cubie-size)))
        rotateX(90deg);
}

/* notification area */

#notification {
    display: none;
    z-index: 10;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}

#notificationContent {
    text-shadow: 0px 0px 15px rgba(255, 255, 255, 0.4);
    display: flex;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-size: min(80px, 10vw);
    font-weight: bold;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

/* mobile devices */

.for-mobile {
    display: none;
}

@media (pointer: none), (pointer: coarse) {
    .for-mobile {
        display: block;
    }
    .for-desktop {
        display: none;
    }
}
