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

@font-face {
    font-family: 'Inter';
    font-style: normal;
    src: url('../fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
    font-display: auto;
}

@font-face {
    font-family: 'SpaceGrotesk';
    font-style: normal;
    src: url('../fonts/SpaceGrotesk-VariableFont_wght.ttf') format('truetype');
    font-display: auto;
}

:root {
    --primary: #8a5cf6;
    --background-gradient: radial-gradient(135.86% 287.63% at 100%, #150c25 37.5%, #1d0840 100%);
    --text: #fff;
    --dark: #150c25;
    --accent: #3498db;
    --violet-100: #521094;
    --violet-200: #8c40ef;
    --violet-300: #792dd4;
    --yellow: #fbc600;
    --orange: #ff602e;
    --violet-400: #C085FF;
    --grey: #453C5A;

    --header-height: 48px;
}

html {
    font-size: 16px;
    background: var(--dark);

    &.has-background {
        background: var(--dark) url('../assets/sphere600px.png') no-repeat center calc(100% + 420px);

        @media (min-height: 520px) {
            background-position: center calc(100% + 230px);
        }
        @media (min-height: 720px) {
            background-position: center calc(100% + 60px);
        }
    }

    &:not(.has-background) body {
        background: var(--background-gradient);
    }
}

body {
    padding: 1.5rem;
    font-family: Inter, sans-serif;
    background: transparent;
    color: var(--text);
    overflow-x: hidden;
    position: relative;
    height: 100svh;
}

.container {
    max-width: 520px;
    margin: 0 auto;
    height: calc(100svh - var(--header-height) * 2);

    &.terms-container {
        display: flex;
        flex-direction: column;
        height: 100svh;
    }
}

header {
    .ai-pulse-logo {
        width: 100%;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 0 2rem 0;
    }

    .ai-pulse-logo svg {
        width: 245px;
        height: auto;
        display: block;
    }
}

footer {
    padding: 3rem;
    text-align: center;
    flex: 1;
    margin-top: auto;
    color: var(--violet-400);
}

.screen {
    width: 100%;
    height: 100%;
    flex-direction: column;
    display: none;

    .frame-content p {
        opacity: 0;

        @starting-style {
            opacity: 0;
        }

        transition-property: display, opacity;
        transition-duration: .3s;
        transition-timing-function: cubic-bezier(.33, .54, .21, 1.09);
        transition-behavior: allow-discrete;
    }

    &.terms {
        padding-top: 2rem;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    &.screen-1,
    &.screen-2 {
        .center-zone {
            opacity: 0;
            transform: translateY(-24px);

            @starting-style {
                opacity: 0;
                transform: translateY(-24px);
            }

            transition-property: opacity, transform;
            transition-duration: .8s;
            transition-timing-function: cubic-bezier(.33, .54, .21, 1.09);
            transition-behavior: allow-discrete;
        }
    }
}

a {
    color: var(--violet-400);
}

.active {
    display: flex;

    .frame-content p {
        opacity: 1;

        @starting-style {
            opacity: 0;
        }

    }

    &.screen-1,
    &.screen-2 {
        .center-zone {
            opacity: 1;
            transform: translateY(0);

            @starting-style {
                opacity: 0;
                transform: translateY(64px);
            }
        }
    }
}

.screen-1 {
    .primary-cta {
        position: sticky;
        bottom: 10px;
        top: 320px;
    }
}

.screen-3 {
    .center-zone {
        padding: 4rem 0 1.5rem 0;
    }
}

.frame-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    margin-bottom: auto;
}

.main-heading {
    text-align: center;
    background: linear-gradient(to right, var(--violet-100), #bf95f9);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    width: 100%;
    font-family: SpaceGrotesk, sans-serif;
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
}

.description {
    letter-spacing: -.4px;
    text-align: center;
    color: #b5b7bd;
    width: 100%;
    font-family: Inter, sans-serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.5;
    text-wrap: pretty;
}

.center-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 1.5rem 0;
}

.save-image {
    padding: 16px 0 8px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

@keyframes sphere-rotate {
    from {
        transform: rotate(-32deg) scale(0.82);
    }
    to {
        transform: rotate(0deg) scale(1);
    }
}

.sphere-image img {
    width: 100%;
    max-width: 360px;
    animation: sphere-rotate .8s cubic-bezier(.43, .41, .22, .83) backwards;
}

/* -------------- FORM --------------*/

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

fieldset {
    border: 0;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    display: flex;
}

.form-input {
    flex-direction: column;
    gap: 8px;
    width: 100%;
    display: flex;
}

.name-input {
    top: 301px;
}

.form-label {
    text-align: center;
    color: #fff;
    font-family: Inter, sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.input-wrapper {
    position: relative;
    z-index: 0;
    width: auto;
    height: auto;

    &::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        padding: 1px;
        border-radius: 8px;

        opacity: 1;
        background: linear-gradient(
                to left,
                var(--violet-400),
                var(--grey)
        );
        mask: linear-gradient(var(--grey) 0) content-box,
        linear-gradient(var(--grey) 0 0);
        mask-composite: exclude;
    }
}

.text-input {
    color: #fff;
    background: none;
    border: 1px solid #fff3;
    border-radius: 8px;
    width: 100%;
    height: 48px;
    padding: 8px 16px;
    font-family: Inter, sans-serif;
    font-size: 16px;
    line-height: 24px;

}

.text-input::placeholder {
    color: #727683;
}

.text-input:focus {
    border-color: #fff6;
    outline: none;
}

.upload-section {
    border: 1px solid #fff3;
    border-radius: 16px;
    align-items: center;
    gap: 16px;
    padding: 16px;

    position: relative;
    z-index: 0;

    &::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        padding: 1px;
        border-radius: 16px;

        opacity: 1;
        background: linear-gradient(
                to top,
                var(--violet-400),
                var(--grey)
        );
        mask: linear-gradient(var(--grey) 0) content-box,
        linear-gradient(var(--grey) 0 0);
        mask-composite: exclude;
    }
}

.upload-icon,
.preview {
    background: var(--violet-100);
    border-radius: 100%;
    justify-content: center;
    align-items: center;
    width: 56px;
    height: 56px;
    display: flex;
    object-fit: cover;
}

.upload-icon svg {
    width: 36px;
    height: 36px;
}

.upload-text {
    text-align: center;
    flex-direction: column;
    gap: 4px;
    width: 313px;
    display: flex;
}

.upload-title {
    color: #fff;
    font-family: Inter, sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
}

.upload-subtitle {
    color: #727683;
    font-family: Inter, sans-serif;
    font-size: 16px;
    line-height: 24px;
}

.select-button {
    text-transform: uppercase;
    color: #fff;
    cursor: pointer;
    background: var(--violet-200);
    border: none;
    border-radius: 8px;
    width: 100%;
    height: 56px;
    font-family: Inter, sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
    transition: background .3s;
}

.select-button:hover {
    background: #9d5af5;
}

.input-terms {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-weight: 400;
    font-size: 14px;
    color: lightgrey;

    label,
    input {
        cursor: pointer;
        width: fit-content;
    }

    input[type="checkbox"] {
        -webkit-appearance: none;
        appearance: none;
        background-color: transparent;
        margin: 0;
        color: currentColor;
        width: 24px;
        height: 24px;
        border-radius: 4px;
        border: 2px var(--violet-200) solid;
        transform: translateY(-0.075em);
        display: grid;
        place-content: center;
    }

    input[type="checkbox"]::before {
        background-color: var(--text);
        content: "";
        width: 13px;
        height: 13px;
        clip-path: polygon(97% 3%, 44% 97%, 3% 58%, 3% 42%, 38% 72%, 85% 3%);
        transform: scale(0);
        transform-origin: center;
    }

    input[type="checkbox"]:checked {
        background-color: var(--violet-200);

    }

    input[type="checkbox"]:checked::before {
        transition: 0.1s transform ease-in-out;
        transform: scale(1);
    }
}

.upload-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.upload-label {
    text-transform: uppercase;
    color: var(--text);
    display: inline-block;
    background-color: var(--violet-200);
    border: 0;
    border-radius: 8px;
    padding: 5px 8px;
    outline: none;
    white-space: nowrap;
    -webkit-user-select: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 18px;
    font-family: Inter, sans-serif;
    height: 56px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-name {
    margin-top: -4px;
    font-size: 0.8rem;
    color: #ccc;
    font-style: italic;
}

.preview {
    display: none;
}

.prediction-card {
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    background: #110b1e66;
    border: 0;
    border-radius: 16px;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 366px;
    padding: 12px;
    display: flex;
    position: relative;
    z-index: 0;

    &::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        padding: 1px;
        border-radius: 16px;

        opacity: 0.8;
        background: linear-gradient(
                to top,
                var(--violet-400),
                var(--grey)
        );
        mask: linear-gradient(var(--grey) 0) content-box,
        linear-gradient(var(--grey) 0 0);
        mask-composite: exclude;
    }


    .loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding-top: 32px;
        overflow: hidden;

        img {
            width: 36px;
            height: 36px;
            margin-bottom: 24px;
        }
    }

    .result {
        display: none;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        flex: 1;
        width: 100%;
    }
}

.copy-button {
    background: transparent;
    border: 1px solid #c085ff;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #c085ff;
    transition: all 0.2s ease;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-top: auto;
    font-size: 14px;

    &.enlight {
        color: var(--text);
        border-color: currentColor;
    }
}

.copy-button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.2);
    border-color: currentColor;
}

.copy-button:active {
    transform: scale(0.95);
}

.user-avatar {
    background: #fff;
    border-radius: 100%;
    width: 110px;
    height: 110px;
    position: absolute;
    top: -55px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.prediction-name {
    letter-spacing: .32px;
    text-align: center;
    background: linear-gradient(109.412deg, #fcfaff 9.2041%, #c085ff 90.796%);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    width: 100%;
    font-family: Space Grotesk, sans-serif;
    font-size: 32px;
    font-weight: 500;
    line-height: 1.2;
    margin-top: 55px;
    padding-top: 16px;
}

.prediction-text {
    padding: 0 20px;
    text-align: center;
    color: var(--text);
    width: 100%;
    font-family: Inter, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    text-wrap: balance;
}

.renew-btn {
    display: none;
}

/* ------------------- GLOW EFFECT FOR BUTTON ------------------- */

.primary-cta {
    isolation: isolate;
    margin-top: auto;
    padding: 1.3rem;
    width: 100%;
}

.primary-button {
    cursor: pointer;
    z-index: 2;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 64px;
    font-size: 18px;
    box-shadow: 0 0 14px 2px #ffffff80;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px 4px #fff9;
}


@property --shimmer {
    syntax: '<angle>';
    inherits: false;
    initial-value: 33deg;
}

@keyframes shimmer {
    0% {
        --shimmer: 0deg;
    }

    100% {
        --shimmer: 360deg;
    }
}

@keyframes shine {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 0.5;
    }

    55% {
        opacity: 0.5;
    }

    100% {
        opacity: 0;
    }
}

@keyframes text {
    0% {
        background-position: 100% center;
    }

    100% {
        background-position: -100% center;
    }
}

.glowWrapper {
    --glow-hue: 40deg;
    --spring-easing: linear(
            0,
            0.002,
            0.01 0.9%,
            0.038 1.8%,
            0.156,
            0.312 5.8%,
            0.789 11.1%,
            1.015 14.2%,
            1.096,
            1.157,
            1.199,
            1.224 20.3%,
            1.231,
            1.231,
            1.226,
            1.214 24.6%,
            1.176 26.9%,
            1.057 32.6%,
            1.007 35.5%,
            0.984,
            0.968,
            0.956,
            0.949 42%,
            0.946 44.1%,
            0.95 46.5%,
            0.998 57.2%,
            1.007,
            1.011 63.3%,
            1.012 68.3%,
            0.998 84%,
            1
    );
    --spring-duration: 5s;

    position: relative;
    display: inline-block;
    z-index: 0;
    width: 100%;


    &::before {
        content: '';
        position: absolute;
        inset: -18px;
        background: linear-gradient(
                30deg,
                var(--violet-300),
                var(--orange),
                var(--yellow)
        );
        z-index: -1;
        filter: blur(32px);
        opacity: 0.8;
        border-radius: 8px;
        /*pointer-events: none;*/
        transition: all 0.3s;
        transition-timing-function: ease-in-out;
    }

    &:hover::before {
        inset: -6px;
        opacity: 0.6;
        background: linear-gradient(120deg, #792dd4, #ff602e, #fbc600);
        filter: blur(16px);
        border-radius: 8px;
    }

    button {
        display: flex;
        justify-content: center;
        z-index: 1;
        border: 0;
        overflow: hidden;
        background: radial-gradient(
                circle at 50% 120%,
                rgb(121 45 212 / 40%) 0%,
                rgb(17 11 30 / 100%) 80%
        ),
        var(--dark);
        position: relative;
        border-radius: 8px;
        transition: all 1s var(--spring-duration) var(--spring-easing);
        transition-timing-function: ease-in-out;

        .text {
            color: white;
            text-transform: uppercase;
            position: relative;
            z-index: 1;
        }

        .shimmer {
            position: absolute;
            inset: -40px;
            border-radius: inherit;
            mask-image: conic-gradient(
                    from var(--shimmer, 0deg),
                    transparent 0%,
                    black 45%,
                    black 55%,
                    transparent 100%
            );
            mask-size: cover;
            animation: shimmer 2s linear infinite both;

            &::before,
            &::after {
                transition: all 0.5s ease;
                opacity: 0;
                content: '';
                border-radius: inherit;
                position: absolute;
                mix-blend-mode: color;
                inset: 40px;
                /*pointer-events: none;*/
            }

            &::before {
                box-shadow: 0 0 2px 2px hsl(var(--glow-hue) 20% 95%),
                0 0 2px 2px hsl(var(--glow-hue) 20% 80%),
                0 0 20px 2px hsl(var(--glow-hue) 50% 70%),
                0 0 20px 2px hsl(var(--glow-hue) 100% 70%);
                z-index: -1;
            }

            &::after {
                box-shadow: inset 0 0 0 1px hsl(var(--glow-hue) 70% 95%),
                inset 0 0 2px 1px hsl(var(--glow-hue) 100% 80%),
                inset 0 0 4px 2px hsl(var(--glow-hue) 100% 70%);
                z-index: 2;
            }
        }

        &:hover:not(:active),
        &:active {
            background: radial-gradient(
                    circle at 50% 110%,
                    rgb(121 45 212 / 100%) 0%,
                    rgb(17 11 30 / 100%) 80%
            ),
            var(--dark);
            transition-duration: calc(var(--spring-duration) * 0.2);
            scale: 1.01;
        }

        &:hover .shimmer::before,
        &:hover .shimmer::after {
            opacity: 1;
            animation: shine 2s ease-in 1 forwards;
        }
    }
}

/*  ---------------- Thinking text ------------------*/

.thinking {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
}

.word {
    position: relative;
    color: var(--text);
}

.dots {
    display: inline-flex;
    align-items: baseline;
    gap: 0.1rem;
}

.dots span {
    display: inline-block;
    animation: cascade 3s ease-in-out infinite both;
    transform: translateY(0);
    will-change: transform;
}

.dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes cascade {
    0% {
        transform: translateY(0);
    }
    10% {
        transform: translateY(-0.35em);
    }
    25% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .word::after,
    .word.fallback,
    .dots span {
        animation: none;
    }
}


