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

#snow-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 0;
}

.background-layer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(63, 50, 135, 0.3);
    pointer-events: none;
    z-index: 1;
}

.frost-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    animation: frostFadeIn 3s ease-in-out forwards;
    filter: blur(1px) brightness(1.1);
}

@keyframes frostFadeIn {
    0% {
        opacity: 0;
        transform: scale(1.05);
        filter: blur(6px) brightness(0.8);
    }
    60% {
        opacity: 0.8;
        filter: blur(1.5px) brightness(1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(1px) brightness(1.1);
    }
}







html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

#feature-preview-screen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    overflow: hidden;
}

.background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: parallaxZoom 20s ease-in-out infinite,
    brightnessPulse 10s ease-in-out infinite;
    transform-origin: center;
}

#fps-wrapper {
    display: grid;
    place-items: center;
    grid-template-areas:
            "logo logo logo"
            "feature-block1 feature-block2 feature-block3"
            "feature-desc2 feature-desc2 feature-desc2"
            "start-button start-button start-button";
    grid-template-columns: 45dvw 5dvw 45dvw;
    grid-template-rows: auto auto auto auto;
    height: 100vh;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    /*padding: 0 6vw;*/
    /*column-gap: 2vw;*/
    width: 100%;
    max-width: 100vw;
}

#logo-placeholder {
    position: absolute;
    grid-area: logo;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.logo-image {
    height: 20vh;
    display: block;
    opacity: 0;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    animation: logoFadeIn 1s ease-out 0.5s forwards,
    pulseGlow 6s ease-in-out infinite 2s;
    margin-bottom: 4vh;
    margin-top: 1vh;
}

#sound-toggle {
    position: absolute;
    bottom: 3vh;
    right: clamp(2vw, 3vw, 4vw);
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
}

#sound-toggle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#feature-block1 {
    grid-area: feature-block1;
}

#feature-block2 {
    grid-area: feature-block2;
}

#feature-block3 {
    grid-area: feature-block3;
}

#feature-desc1 {
    grid-area: feature-desc1;
    height: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

#feature-desc2 {
    grid-area: feature-desc2;
    display: flex;
    height: 100%;
    justify-content: flex-start;
    align-items: center;

}

#feature-desc3 {
    grid-area: feature-desc3;
    height: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

#section-button {
    grid-area: start-button;
}



.feature-block {
    position: relative;
    width: clamp(180px, 25vw, 300px);
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Загальні стилі */
.stack {
    position: relative;
    width: 120%;
    height: 100%;
}

.stack .feature-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.stack .layer-base {
    z-index: 1;
}

.stack .layer-top,
.stack .layer-top-1,
.stack .layer-top-2,
.stack .layer-top-3 {
    z-index: 2;
}

/* Анімації */
@keyframes freezePulse {
    0% {
        transform: scale(0.4);
        opacity: 0;
        filter: blur(12px);
    }
    60% {
        transform: scale(1.05);
        opacity: 0.95;
        filter: blur(3px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes frostBreath {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.7);
        opacity: 0.95;
    }
}

@keyframes swapFrames {
    0%   { opacity: 1; }
    40%  { opacity: 1; }
    50%  { opacity: 0; }
    100% { opacity: 0; }
}

/* Перша картинка зникає */
.layer-top-1 {
    z-index: 2;
    opacity: 1;
    animation:
            freezePulse 1.2s ease-out forwards,
            frostBreath 1.2s ease-in-out 1.2s infinite;
            /*fadeOutSwap 0.6s ease 2s forwards;*/
}

.layer-top-f2 {
    z-index: 2;
    opacity: 1;
    animation:
            freezePulse 1.2s ease-out forwards,
            frostBreath 1.2s ease-in-out 1.2s infinite;
}

.layer-top-2 {
    z-index: 3;
    opacity: 0;
    animation:
            fadeInSwap 0.6s ease 2s forwards,
            frostBreath 2.5s ease-in-out 2.6s infinite,
            fadeOutSwap 0.6s ease 3.8s forwards;
}

.layer-top-3 {
    z-index: 3;
    opacity: 0;
    animation:
            fadeInSwap 0.6s ease 4s forwards,
            frostBreath 2.5s ease-in-out 4.6s infinite;
}

/* --- Кадрові анімації --- */
@keyframes freezePulse {
    0% {
        transform: scale(0.4);
        opacity: 0;
        filter: blur(12px);
    }
    60% {
        transform: scale(1.05);
        opacity: 0.95;
        filter: blur(3px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes frostBreath {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.95;
    }
}

@keyframes fadeOutSwap {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes fadeInSwap {
    from { opacity: 0; }
    to   { opacity: 1; }
}







.feature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    aspect-ratio: 0.9 / 1;
    margin-top: -5%;
    padding: 0;
    width: 100%;
    height: auto;
    max-width: 86%;
    /*min-width: 200px;*/
    justify-content: center;
    overflow: visible;
    transform-origin: center;

    /*border-radius: 32px;*/
    /*background: rgba(255, 255, 255, 0.07);*/
    /*padding: 1.5rem;*/
    /*justify-content: center;*/
    /*box-shadow:*/
    /*        0 0 20px rgba(0, 255, 255, 0.1),*/
    /*        inset 0 0 20px rgba(255, 255, 255, 0.08),*/
    /*        0 8px 24px rgba(0, 0, 0, 0.5);*/
    /*backdrop-filter: blur(20px) saturate(160%);*/
    /*-webkit-backdrop-filter: blur(20px) saturate(160%);*/
    /*animation: subtleZoom 8s ease-in-out infinite;*/
    /*transition: transform 0.3s ease, box-shadow 0.3s ease;*/
    /*box-sizing: border-box;*/
}

.feature-image {
    display: block;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

/*.stacked-block {*/
/*    position: relative;*/
/*    display: flex;*/
/*    justify-content: center;*/
/*    align-items: center;*/
/*    width: 100%;*/
/*    height: 100%;*/
/*    align-self: baseline;*/
/*}*/
/*FINISH ANIMATION AND STACK IF IT NEEDED FOR BEAUTY ANIMATION*/

.feature-description {
    /*display: flex;*/
    /*flex-direction: column;*/
    justify-content: flex-start;
    align-items: center;
    text-align: center;

    font-size: clamp(14px, 1vw, 24px);
    line-height: 1.3;
    margin: 0;
    padding: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    z-index: 2;
    font-family: var(--main-font);
    font-weight: 800;
    color: white;
}

/* Додана анімація світіння */
.glow-flash {
    font-size: clamp(20px, 2dvw, 30px);
    color: #00D4FF;
    /*text-shadow:*/
    /*        0 2px 2px #000,*/
    /*        0 0 3px #80d8ff,   */
    /*        0 0 5px #40c4ff,   */
    /*        0 0 12px #00b0ff;  */
}

.start-fixed-portrait {
    position: fixed;
    bottom: 2dvh;
    left: 0;
    width: 100%;
    /*height: 20vh;*/
    /*display: flex;*/
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    flex-direction: column;
    text-align: center;
    display: grid;
    place-items: center;
}

.start-fixed-portrait > .loading-bar-wrapper,
.start-fixed-portrait > .start-button {
    grid-area: 1 / 1;
}

.start-gradient-background {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 20vh;
    background: linear-gradient(to top, rgba(18, 16, 48, 0.85), rgba(18, 16, 48, 0.0));
    z-index: 1;
    pointer-events: none;
}

.loading-bar-wrapper {
    position: relative;
    width: clamp(20vw, 25vw, 35vw);
    /*height: clamp(2vh, 2.5vh, 3.5vh);*/
    /*margin-top: clamp(5vh, 7vh, 10vh);*/
    background: radial-gradient(circle at center,
        rgba(60, 90, 120, 0.4),
        rgba(10, 30, 60, 0.6));
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.6);
    border: 2px solid #f8f8f8;

    margin-top: 0;
    min-width: clamp(140px, 30vw, 320px);
    height: clamp(18px, 2.5vh, 28px);
    transition: opacity 0.35s ease;
}

.start-fixed-portrait.ready .loading-bar-wrapper {
    opacity: 0;
}

.start-fixed-portrait.ready .start-button {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00b0ff, #40c4ff, #80d8ff, #00b0ff);
    background-size: 300% 100%;
    animation: shimmer 2s linear infinite;
    transition: width 0.3s ease;
    border-radius: 999px;
    box-shadow:
            0 0 20px rgba(0, 176, 255, 0.6),
            0 0 40px rgba(64, 196, 255, 0.5),
            0 0 60px rgba(128, 216, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.loading-percent {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--main-font, sans-serif);
    font-size: clamp(12px, 2vw, 16px);
    color: white;
    font-weight: bold;
    pointer-events: none;
}

/* START BUTTON */
.start-button {
    width: clamp(70vw, 50vw, 90vw);
    font-size: clamp(1.3rem, 2.8vw, 1.5rem);
    text-transform: uppercase;
    padding: clamp(1.2vh, 2vh, 3vh) clamp(3vw, 3vw, 3vw);
    text-align: center;

    letter-spacing: 0.05em;
    font-weight: 500;
    background-size: 200% auto;
    background: linear-gradient(to right, #00b0ff, white, #00b0ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: white;
    border: none;

    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.6s ease, transform 0.4s ease;
    animation: gradientShift 5s linear infinite, pulseZoom 5s ease-in-out infinite;
}

.start-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

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

@keyframes pulseZoom {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes blurPulse {
    0%, 100% { filter: blur(6px); }
    50% { filter: blur(10px); }
}

@keyframes subtleZoom {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes parallaxZoom {
    0%, 100% { transform: scale(1.05) translate(0, 0); }
    50% { transform: scale(1.12) translate(-1.5%, 1.5%); }
}

@keyframes parallaxShift {
    0% { transform: translate(0%, 0%) scale(1.05); }
    25% { transform: translate(1.5%, -1%) scale(1.08); }
    50% { transform: translate(-1%, 2%) scale(1.1); }
    75% { transform: translate(2%, 1%) scale(1.07); }
    100% { transform: translate(0%, 0%) scale(1.05); }
}

@keyframes brightnessPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.08); }
}

@keyframes overlayPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.28; }
}

@keyframes logoFadeIn {
    0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 2px 8px rgb(20, 35, 81)); }
    50% { filter: drop-shadow(0 4px 14px rgb(30, 46, 103)); }
}

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

/* === ADAPTATION === */
@media (orientation: portrait) {
    #feature-preview-screen {
        height: auto;
        min-height: 100dvh;
        overflow-y: hidden;
    }

    #fps-wrapper {
        display: grid;
        grid-template-areas:
      "logo"
      "feature-block1"
      "feature-block2"
      "feature-block3"
      "feature-desc"
      "start-button";
        grid-template-columns: 1fr;
        grid-template-rows: 12vh;
        /*margin-top: 2vh;*/
        /*row-gap: 1vh;*/
        height: 100%;
        min-height: auto;
        overflow: hidden;
        box-sizing: border-box;
    }

    .feature-block {
        height: 80%;
        margin: 0 auto;
        padding: 0;
    }

    #feature-block1, #feature-block3 {
        /*width: clamp(50vw, 60vw, 70vw);*/
        height: clamp(30vh, 20vh, 70vh);
        margin: 0 auto;
    }

    #feature-block2 {
        margin-top: -4vh;
        width: clamp(15dvw, 80dvw, 8dvw);
        /*margin: 0 auto;*/
        display: flex;
        justify-content: center;
        align-items: center;
        transform: rotate(90deg);

        /*animation: arrowNudgePortrait 5s ease-in-out infinite;*/
        transform-origin: center;
    }

    #feature-block3 {
        margin-top: -4vh;
    }

    #logo-placeholder {
        position: relative;
        display: flex;
        justify-content: center;
    }

    #logo-placeholder {
        position: absolute;
        grid-area: logo;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 1vh;
        z-index: 2;
    }

    .logo-image {
        height: clamp(10vh, 12vh, 14vh);
        width: auto;
        margin-top: 0.5vh;
    }

    #feature-desc {
        grid-area: feature-desc;
        margin-top: 0;
        z-index: 1000;
    }

    .feature-description {
        line-height: 1.2;
        max-width: 90%;
        margin-top: 0;
    }

    .start-fixed-portrait {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        background: linear-gradient(to top, rgba(18, 16, 48, 0.88), rgba(18, 16, 48, 0));
        box-sizing: border-box;
        z-index: 3;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 2vh;
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .loading-bar-wrapper {
        position: absolute;
        bottom: clamp(1vh, 2vh, 3vh);
        left: 50%;
        transform: translateX(-50%);
        width: clamp(40vw, 45vw, 50vw);
        height: clamp(1.6vh, 2vh, 2.5vh);
        background: radial-gradient(circle at center,
        rgba(60, 90, 120, 0.4),
        rgba(10, 30, 60, 0.6));
        border-radius: 999px;
        overflow: hidden;
        box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.6);
        border: 2px solid #f8f8f8;
    }

    .loading-bar {
        width: 0%;
        height: 100%;
        background: linear-gradient(90deg, #00b0ff, #40c4ff, #80d8ff, #00b0ff);
        background-size: 300% 100%;
        animation: shimmer 2s linear infinite;
        transition: width 0.3s ease;
        border-radius: 999px;
        box-shadow:
                0 0 20px rgba(0, 176, 255, 0.6),
                0 0 40px rgba(64, 196, 255, 0.5),
                0 0 60px rgba(128, 216, 255, 0.4);
    }

    .start-button {
        font-size: clamp(0.8rem, 4vw, 1rem);
        padding: clamp(1.5vh, 2.5vh, 3vh) 0;
        text-align: center;
        background: linear-gradient(to right, #00b0ff, white, #00b0ff);
        background-size: 200% auto;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        border: none;
        opacity: 0;
        pointer-events: none;
        transform: scale(0.95) translateX(-50%);
        transition: opacity 0.6s ease, transform 0.4s ease;
        animation: gradientShift 5s linear infinite, pulseZoom 5s ease-in-out infinite;
    }

    .start-button.visible {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1) translateX(-50%);
    }

    #sound-toggle {
        bottom: 1.5vh;
        right: clamp(3vw, 4vw, 5vw);
    }
}

@media (orientation: landscape) {

    #fps-wrapper {
        display: grid;
        grid-template-areas:
            "logo logo logo"
            "feature-block1 feature-block2 feature-block3"
            "feature-desc feature-desc feature-desc"
            "start-button start-button start-button";
        grid-template-columns: 45dvw 5dvw 45dvw;
        grid-template-rows: auto auto auto auto;
        height: 100vh;
        justify-content: center;
        align-items: center;
        padding: 0 3vw;
    }

    .feature-description {
        font-size: clamp(0.8rem, 2vw, 1.3rem);
        line-height: 1.1;
        padding: 0.3vh 0;
        margin: 0;
        max-width: 100%;
        word-break: break-word;
    }

    #feature-desc {
        margin-top: -19%;
        grid-area: feature-desc;
        justify-content: unset;
        align-items: center;
    }

    /*.start-button {*/
    /*    font-size: clamp(1rem, 2.5vw, 1.5rem);*/
    /*    padding: clamp(1vh, 1.5vh, 2vh);*/
    /*}*/

    .start-button {
        font-size: clamp(0.5rem, calc(1vw + 1vh), 1.3rem);
        padding: clamp(1dvh, 1.5dvh, 2dvh);
        /*margin-bottom: env(safe-area-inset-bottom);*/
    }

    .loading-bar-wrapper {
        width: clamp(20vw, 22vw, 25vw);
        height: clamp(3vh, 3.1vh, 3.3vh);
    }

    .stacked-block {
        margin: 0;
        align-self: flex-end;
    }

    #sound-toggle {
        bottom: 3vh;
        right: clamp(2vw, 3vw, 4vw);
    }

    #feature-block2 {
        /*animation: arrowNudge 5s ease-in-out infinite;*/
    }
}
@media (max-height: 350px) and (orientation: landscape) {
    .feature-block.scaled,
    .feature-description.scaled {
        transform: scale(0.80);
        transform-origin: top center;
    }
    #feature-desc {
        margin-top: -30%;
    }
    #feature-block2 {
        margin-top: -100%;
    }
}
@media (orientation: portrait) and (min-height: 1000px) {
    .feature-description {
        font-size: clamp(0.8rem, 3vw, 1.4rem);
        padding: clamp(1.5vh, 2.5vh, 3vh);
    }
    .glow-flash {
        font-size: clamp(30px, 2dvw, 40px);
    }
}

/* Пульсація фічей */
@keyframes pulseOnly1 {
    0%, 8% {
        transform: scale(1);
    }
    16% {
        transform: scale(1.05);
    }
    24%, 100% {
        transform: scale(1);
    }
}
@keyframes pulseOnly3 {
    0%, 8% {
        transform: scale(1);
    }
    16% {
        transform: scale(1.05);
    }
    24%, 100% {
        transform: scale(1);
    }
}

@keyframes arrowNudge {
    0%, 39.99% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(20%);
    }
    60.01%, 100% {
        transform: translateX(0);
    }
}
@keyframes arrowNudgePortrait {
    0%, 39.99% {
        transform: rotate(90deg) translateX(0);
    }
    50% {
        transform: rotate(90deg) translateX(10%);
    }
    60.01%, 100% {
        transform: rotate(90deg) translateX(0);
    }
}
