:root {
    --mouse-x: 0px;
    --mouse-y: 0px;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    position: fixed;
    inset: 0;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(circle at 50% 45%,
            rgba(110, 78, 255, 0.15),
            transparent 38%),
        radial-gradient(circle at 15% 15%,
            rgba(87, 157, 255, 0.08),
            transparent 30%),
        radial-gradient(circle at 85% 85%,
            rgba(202, 91, 255, 0.08),
            transparent 32%),
        #05050c;

    touch-action: none;
    cursor: crosshair;
}

.page {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
}

.grid {
    position: absolute;
    inset: 0;
    z-index: -5;

    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px,
            transparent 1px),
        linear-gradient(90deg,
            rgba(255, 255, 255, 0.022) 1px,
            transparent 1px);

    background-size: 65px 65px;

    mask-image:
        radial-gradient(circle at center,
            black,
            transparent 75%);

    -webkit-mask-image:
        radial-gradient(circle at center,
            black,
            transparent 75%);
}

.noise {
    position: absolute;
    inset: 0;
    z-index: 20;

    opacity: 0.035;
    pointer-events: none;

    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='.8'/%3E%3C/svg%3E");
}

.stars {
    position: absolute;
    inset: 0;
    z-index: -3;
    overflow: hidden;
    pointer-events: none;
}

.star {
    position: absolute;

    width: 2px;
    height: 2px;

    border-radius: 50%;
    background: #ffffff;

    box-shadow:
        0 0 8px rgba(255, 255, 255, 0.7);

    animation:
        twinkle 3s ease-in-out infinite;
}

.scene {
    position: absolute;
    inset: 0;

    display: grid;
    place-items: center;

    perspective: 1200px;
}

.object-wrapper {
    position: relative;

    display: grid;
    place-items: center;

    width: min(650px, 100vw);
    height: min(650px, 100vh);

    transform:
        translate3d(var(--mouse-x),
            var(--mouse-y),
            0);

    transition:
        transform 0.12s ease-out;

    will-change: transform;
}

.glow {
    position: absolute;

    width: min(520px, 80vw);
    height: min(520px, 80vw);

    border-radius: 50%;

    background:
        radial-gradient(circle,
            rgba(148, 93, 255, 0.3),
            rgba(84, 160, 255, 0.08) 45%,
            transparent 70%);

    filter: blur(30px);

    animation:
        glow 5s ease-in-out infinite;
}

.rings {
    position: absolute;

    width: min(520px, 82vw);
    height: min(520px, 82vw);

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;

    transform:
        rotateX(69deg) rotateZ(-12deg);

    animation:
        rings 8s ease-in-out infinite;
}

.rings::before,
.rings::after {
    content: "";
    position: absolute;

    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 50%;
}

.rings::before {
    inset: 9%;
}

.rings::after {
    inset: 22%;
}

.planet-holder {
    position: relative;
    z-index: 3;

    animation:
        levitate 5s ease-in-out infinite;
}

.planet {
    position: relative;

    width: clamp(190px, 26vw, 290px);
    aspect-ratio: 1;

    border-radius:
        48% 52% 44% 56% / 55% 42% 58% 45%;

    background:
        radial-gradient(circle at 35% 25%,
            rgba(255, 255, 255, 0.9),
            transparent 7%),
        radial-gradient(circle at 34% 29%,
            rgba(255, 255, 255, 0.25),
            transparent 23%),
        radial-gradient(circle at 65% 74%,
            rgba(37, 64, 150, 0.9),
            transparent 34%),
        linear-gradient(145deg,
            #e0e1ff 0%,
            #9e86ed 25%,
            #5754b5 53%,
            #29285c 77%,
            #101021 100%);

    box-shadow:
        inset -32px -40px 75px rgba(3, 2, 18, 0.78),
        inset 22px 18px 38px rgba(255, 255, 255, 0.17),
        0 0 45px rgba(140, 102, 255, 0.3),
        0 55px 110px rgba(0, 0, 0, 0.7);

    animation:
        morph 9s ease-in-out infinite;

    transform:
        rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg));

    transition:
        transform 0.12s ease-out;

    will-change:
        transform,
        border-radius;
}

.planet::before {
    content: "";
    position: absolute;
    top: 13%;
    right: 11%;

    width: 54%;
    height: 22%;

    border-radius: 50%;
    border-top: 2px solid rgba(255, 255, 255, 0.22);

    transform: rotate(28deg);
}

.planet::after {
    content: "";
    position: absolute;
    inset: 0;

    border-radius: inherit;

    background:
        radial-gradient(circle at 29% 68%,
            rgba(255, 255, 255, 0.12),
            transparent 4%),
        radial-gradient(circle at 74% 41%,
            rgba(15, 15, 54, 0.38),
            transparent 11%),
        radial-gradient(circle at 43% 44%,
            rgba(255, 255, 255, 0.09),
            transparent 6%);
}

.shadow {
    position: absolute;
    z-index: 1;

    bottom: 15%;

    width: clamp(150px, 24vw, 245px);
    height: 40px;

    border-radius: 50%;

    background:
        rgba(102, 77, 220, 0.3);

    filter: blur(20px);

    animation:
        shadow 5s ease-in-out infinite;
}

.particle {
    position: absolute;
    z-index: 4;

    border-radius: 50%;
    background: #ffffff;

    box-shadow:
        0 0 15px currentColor,
        0 0 35px currentColor;

    animation:
        particle 6s ease-in-out infinite;
}

.particle-1 {
    top: 22%;
    left: 17%;

    width: 7px;
    height: 7px;

    color: #b87dff;
    animation-delay: -1s;
}

.particle-2 {
    top: 31%;
    right: 13%;

    width: 5px;
    height: 5px;

    color: #6edcff;
    animation-delay: -3s;
}

.particle-3 {
    right: 18%;
    bottom: 25%;

    width: 8px;
    height: 8px;

    color: #eb91ff;
    animation-delay: -4s;
}

.particle-4 {
    left: 11%;
    bottom: 31%;

    width: 4px;
    height: 4px;

    color: #ffffff;
    animation-delay: -2s;
}

@keyframes levitate {

    0%,
    100% {
        transform:
            translateY(-20px) rotate(-2deg);
    }

    50% {
        transform:
            translateY(25px) rotate(2deg);
    }
}

@keyframes morph {

    0%,
    100% {
        border-radius:
            48% 52% 44% 56% / 55% 42% 58% 45%;
    }

    50% {
        border-radius:
            55% 45% 54% 46% / 45% 57% 43% 55%;
    }
}

@keyframes shadow {

    0%,
    100% {
        opacity: 0.22;
        transform: scale(0.8);
    }

    50% {
        opacity: 0.55;
        transform: scale(1.1);
    }
}

@keyframes rings {

    0%,
    100% {
        transform:
            rotateX(69deg) rotateZ(-12deg) scale(0.97);
    }

    50% {
        transform:
            rotateX(69deg) rotateZ(-5deg) scale(1.04);
    }
}

@keyframes particle {

    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(14px, -26px, 0);
    }
}

@keyframes glow {

    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.94);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.08);
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.15;
        transform: scale(0.7);
    }

    50% {
        opacity: 0.95;
        transform: scale(1.3);
    }
}

@media (max-width: 600px) {
    .object-wrapper {
        width: 100vw;
        height: 100vh;
    }

    .rings {
        width: 390px;
        height: 390px;
    }

    .glow {
        width: 360px;
        height: 360px;
    }

    .shadow {
        bottom: calc(50% - 170px);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}