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

img {
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-transform: translateZ(0);
    -webkit-perspective: 1000;
}

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

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

.background-layer {
    position:fixed;
    inset:0;
    overflow:hidden
}
.background-image{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
    z-index:0;
    pointer-events:none;
}

.particles-1, .particles-2, .particles-3 {
    position:absolute; bottom:calc(env(safe-area-inset-bottom,0px) + 2dvh);
    height:auto; object-fit:contain; pointer-events:none;
    will-change:transform,opacity;
}
.particles-1 {
    left:50%; transform:translateX(-50%);
    width:100dvw; max-height:30dvh;
    z-index:1;
    animation: floatY1 28s linear infinite, twinkleA 3200ms infinite;
    filter: brightness(1.06) contrast(1.04);
}
.particles-2 {
    right: 0;
    width: 50dvw;
    max-height: 26dvh;
    z-index: 2;
    animation: floatY2 34s linear infinite, twinkleB 4400ms infinite;
    filter: brightness(1.04) contrast(1.03);
}
.particles-3 {
    left: 0;
    width: 50dvw;
    max-height: 26dvh;
    z-index:2;
    animation: floatY3 40s linear infinite, twinkleC 6000ms infinite;
    filter: brightness(1.0) contrast(1.02);
}

@keyframes floatY1 { 0%{transform:translate(-50%, 0.4%)} 50%{transform:translate(-50%, -0.4%)} 100%{transform:translate(-50%, 0.4%)} }
@keyframes floatY2 { 0%{transform:translateY( 0.3%)}     50%{transform:translateY(-0.3%)}      100%{transform:translateY( 0.3%)} }
@keyframes floatY3 { 0%{transform:translateY( 0.25%)}    50%{transform:translateY(-0.25%)}     100%{transform:translateY( 0.25%)} }

@keyframes twinkleA{
    0%{opacity:.28} 10%{opacity:.55} 17%{opacity:.18} 33%{opacity:1}
    46%{opacity:.32} 59%{opacity:.85} 71%{opacity:.24} 83%{opacity:.95}
    100%{opacity:.28}
}
@keyframes twinkleB{
    0%{opacity:.22} 9%{opacity:.9} 21%{opacity:.3} 37%{opacity:.75}
    52%{opacity:.26} 68%{opacity:1} 82%{opacity:.34} 100%{opacity:.22}
}
@keyframes twinkleC{
    0%{opacity:.2} 15%{opacity:.6} 28%{opacity:.27} 44%{opacity:.95}
    60%{opacity:.25} 77%{opacity:.8} 92%{opacity:.3} 100%{opacity:.2}
}

@media (orientation: landscape) and (max-height: 420px){
    .particles-1 {
        max-height: 22dvh
    }
    .particles-2, .particles-3 {
        max-height: 20dvh
    }
    .particles-1, .particles-2, .particles-3 {
        bottom: calc(env(safe-area-inset-bottom,0px) + 1.2dvh);
    }
}

@media (prefers-reduced-motion: reduce){
    .particles-1, .particles-2, .particles-3{ animation:none; opacity:.95 }
}

.particles-4, .particles-5, .particles-6 {
    position:absolute;
    top:calc(env(safe-area-inset-top,0px) + 2dvh);
    height:auto;
    object-fit:contain;
    pointer-events:none;
    will-change:transform,opacity;
}
.particles-4 {
    left:50%; transform:translateX(-50%);
    width:100dvw;
    max-height: 30dvh;
    z-index: 1;
    animation: floatY1Top 28s linear infinite, twinkleA 3200ms infinite;
    filter: brightness(1.06) contrast(1.04);
}
.particles-5 {
    left:0;
    width:50dvw;
    max-height:26dvh;
    z-index:2;
    animation: floatY2Top 34s linear infinite, twinkleB 4400ms infinite;
    filter: brightness(1.04) contrast(1.03);
}
.particles-6 {
    right: 0;
    width: 50dvw;
    max-height: 26dvh;
    z-index:2;
    animation: floatY3Top 40s linear infinite, twinkleC 6000ms infinite;
    filter: brightness(1.0) contrast(1.02);
}

@keyframes floatY1Top {
    0%{transform:translate(-50%, -0.4%)}
    50%{transform:translate(-50%,  0.4%)}
    100%{transform:translate(-50%, -0.4%)}
}
@keyframes floatY2Top {
    0%{transform:translateY(-0.3%)}
    50%{transform:translateY( 0.3%)}
    100%{transform:translateY(-0.3%)}
}
@keyframes floatY3Top {
    0%{transform:translateY(-0.25%)}
    50%{transform:translateY( 0.25%)}
    100%{transform:translateY(-0.25%)}
}

@media (orientation: landscape) and (max-height: 420px){
    .particles-4{ max-height:22vh }
    .particles-5, .particles-6{ max-height:20vh }
    .particles-4, .particles-5, .particles-6{
        top:calc(env(safe-area-inset-top,0px) + 1.2vh);
    }
}

#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: 100dvh;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    /*padding: 0 6vw;*/
    /*column-gap: 2vw;*/
    width: 100%;
    max-width: 100dvw;
}

#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: 14dvh;
    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: 4dvh;
    margin-top: 1dvh;
}
/* region SOUND BUTTON */
#sound-toggle {
    position: fixed;
    inline-size: clamp(40px, min(7dvh, 7dvw), 64px);
    block-size: clamp(40px, min(7dvh, 7dvw), 64px);
    cursor: pointer;
    transition: transform .2s ease, opacity .2s ease;
    z-index: 9999;
}

@media (orientation: landscape) {
    #sound-toggle {
        bottom: calc(env(safe-area-inset-bottom) + 12px);
        right:  calc(env(safe-area-inset-right)  + 20px);
    }
}

@media (orientation: portrait) {
    #sound-toggle {
        bottom: calc(env(safe-area-inset-bottom) + 10px);
        right:  calc(env(safe-area-inset-right)  + 16px);
    }
}

#sound-toggle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* endregion */
.feature-block {
    position: relative;
    overflow: visible;
}
#feature-block1 > img,
#feature-block3 > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
#feature-block1 .layer-base,
#feature-block3 .layer-base {
    z-index: 0;
}
#feature-block1 > img:nth-of-type(2),
#feature-block3 > img:nth-of-type(2) {
    z-index: 1;
}

#feature-block1 .symbols,
#feature-block3 .symbols {
    filter: brightness(1.3);
    z-index: 1;
    transform-origin: 50% 50%;
    will-change: transform, filter, opacity;
    animation: featurePulse 3.6s ease-in-out infinite;
}
@keyframes featurePulse {
    0%,100%{
        transform: scale(1);
    }
    50%{
        transform: scale(1.03);
    }
}

@media (prefers-reduced-motion: reduce){
    #feature-block1 .symbols,
    #feature-block3 .symbols {
        animation: none; }
}

#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 {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    aspect-ratio: 0.9 / 1;
    margin-top: -20%;
    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 {
    filter: brightness(1.25);
    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;
}

.feature-description {
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    font-size: clamp(14px, 1dvw, 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: white;
    text-shadow:
            0 2px 2px #000,
            0 0 3px #ffc107,
            0 0 5px #ffb300,
            0 0 12px #ff8f00;
}

.start-fixed-portrait {
    position: fixed;
    bottom: 2dvh;
    /*bottom: calc(env(safe-area-inset-bottom) + 8px);*/
    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;

    /* якщо потрібен невеликий відступ угору від краю:
    padding-bottom: max(2vh, env(safe-area-inset-bottom));
    */
}

.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: 20dvh;
    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-button {
    white-space: nowrap;
    z-index: 1;
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 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, #3e358f, #8e5af4, #c72adf, #ff8019, #8e5af4, #3e358f);
    background-size: 300% 100%;
    animation: shimmer 2s linear infinite;
    transition: width 0.3s ease;
    border-radius: 999px;
    box-shadow: 0 0 20px rgba(42, 64, 239, 0.6), 0 0 40px rgba(83, 12, 182, 0.5), 0 0 60px rgba(58, 44, 117, 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 {
    font-size: clamp(1.3rem, 2.8vw, 1.5rem);
    text-transform: uppercase;
    padding: clamp(1.2dvh, 2dvh, 3dvh) clamp(3dvw, 3dvw, 3dvw);
    text-align: center;
    letter-spacing: 0.05em;
    background-size: 200% auto;
    font-weight: 500;
    background: linear-gradient(to right, #f143ff, rgb(255 147 40 / 78%), #ff45d8);
    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;
    }
}

@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: 12dvh;
        /*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 {
        height: clamp(30dvh, 20dvh, 70dvh);
        margin: -10px auto;
    }

    #feature-block2 {
        width: clamp(6dvw, 8dvw, 10dvw);
        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 {
        height: clamp(30dvh, 20dvh, 70dvh);
        margin-top: 3%;
    }

    #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: 1dvh;
        z-index: 2;
    }

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

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

    .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-size: 300% 100%;
        animation: shimmer 2s linear infinite;
        transition: width 0.3s ease;
        border-radius: 999px;
    }

    .start-button {
        font-size: clamp(0.9rem, 4dvw, 1.1rem);
        padding: clamp(1dvh, 1.5dvh, 2dvh) 0;
        text-align: center;
        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;
        margin-bottom: env(safe-area-inset-bottom);
    }

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

@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: 100dvh;
        justify-content: center;
        align-items: center;
        padding: 0 3dvw;
    }

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

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

    .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(20dvw, 22dvw, 25dvw);
        height: clamp(3dvh, 3.1dvh, 3.3dvh);
        /*margin-bottom: env(safe-area-inset-bottom);*/
    }

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

    #feature-block2{
        top: -5dvh;
    }
}

@media (max-height: 350px) and (orientation: landscape) {
    .feature-block.scaled,
    .feature-description.scaled {
        transform: scale(0.90);
        transform-origin: top center;
    }
    .feature-block {
        margin-top: -12%;
    }
    .feature-image {
        transform: scale(0.9);
    }
}
@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.03);
    }
    24%, 100% {
        transform: scale(1);
    }
}
@keyframes pulseOnly3 {
    0%, 8% {
        transform: scale(1);
    }
    16% {
        transform: scale(1.03);
    }
    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(20%);
    }
    60.01%, 100% {
        transform: rotate(90deg) translateX(0);
    }
}

#feature-block1 {
    animation: pulseOnly1 5s ease-in-out infinite;
}
#feature-block3 {
    animation: pulseOnly3 5s ease-in-out infinite;
    animation-delay: 3s;
    animation-fill-mode: backwards;
}
.feature-block.glow-2 {
    animation: arrowNudge 5s ease-in-out infinite;
    transform-origin: center;
}
