@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@700;800;900&display=swap');
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;
    transform-origin: center;
    z-index: -3;
}

.landscape-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center;
}
.portrait-bg {
    display: none;
}

@media (orientation: portrait) {
    .landscape-bg {
        display: none;
    }

    .portrait-bg {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transform-origin: center;
    }
}

#fps-wrapper {
    display: grid;
    place-items: center;
    grid-template-areas:
            "logo logo logo"
            "feature-block1 feature-block2 feature-block3"
            "feature-desc1 feature-desc2 feature-desc3"
            "start-button start-button start-button";
    grid-template-rows: 23dvh 1fr 10dvh 15dvh;
    grid-template-columns: 26dvw 30dvw 26dvw;
    height: 100%;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 0 6dvw;
    column-gap: 2dvw;
    width: 100%;
    max-width: 100dvw;
}

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

.logo-image {
    height: 18dvh;
    display: block;
    opacity: 0;
    margin-bottom: 3dvh;
    animation:
            logoFadeIn 1.2s ease-out 0.5s forwards,
            logoShadowPulse 4s ease-in-out infinite 2s;
    filter:
            drop-shadow(0 0 8px rgba(10, 2, 25, 0.5))
            drop-shadow(0 0 16px rgba(10, 2, 25, 0.3));
    transition: transform 0.3s ease;
    will-change: transform, filter;
}

@keyframes logoShadowPulse {
    0%, 100% {
        filter:
                drop-shadow(0 0 8px rgba(10, 2, 25, 0.5))
                drop-shadow(0 0 16px rgba(10, 2, 25, 0.3));
    }
    50% {
        filter:
                drop-shadow(0 0 12px rgba(10, 2, 25, 0.6))
                drop-shadow(0 0 24px rgba(10, 2, 25, 0.4));
    }
}


#sound-toggle {
    position: fixed;
    bottom: clamp(2vh, 2vh, 2vh);
    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;
}

/* Контейнер для стеку */
.stacked-block {
    position: relative;
    display: inline-block;
    width: fit-content;
    height: auto;
}

.layer-base,
.layer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.layer-base {
    z-index: 2;
}

.layer-overlay {
    z-index: 1;
}

/* Абсолютне позиціонування поверх один одного */
.stacked-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: auto;
    z-index: 1;
}

#section-button {
    position: sticky;
    grid-area: start-button;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 1vh;
    z-index: 10;
}

.feature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 0;
    width: 100%;
    height: auto;
    min-width: unset;
    justify-content: center;
    overflow: visible;
    transform-origin: center;
    max-height: 45vh;
}

.feature-image {
    display: block;
    object-fit: contain;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: auto;
}

#feature-block1,
#feature-block3 {
    height: clamp(30vh, 36vh, 40vh);
    display: flex;
    justify-content: center;
    align-items: center;
}

#feature-block1 .feature-image,
#feature-block3 .feature-image {
    height: 100%;
    width: 100%;
    object-fit: contain;
    display: block;
}

.feature-description {
    position: relative;
    display: inline-block;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    text-transform: uppercase;
    transform: translateY(-2vh);

    font-size: clamp(1rem, 2.7vw, 1.7rem);
    line-height: 1.3;
    padding: clamp(0.5vh, 1vh, 1.5vh) 0;
    margin: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Exo 2', sans-serif;
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
    word-break: break-word;
    white-space: normal;
    flex-wrap: wrap;
    z-index: 11;
}

.feature-description .stroke-text {
    position: relative;
    color: transparent;
    -webkit-text-stroke: 2.5px #110330;
    /*text-shadow:*/
    /*        0 0 3px rgba(10, 2, 25, 0.8),*/
    /*        0 0 6px rgba(10, 2, 25, 0.6),*/
    /*        0 0 8px rgba(10, 2, 25, 0.5);*/
    animation: textShadowPulse 4s ease-in-out infinite;
    z-index: 1;
}

.feature-description .fill-text {
    background: linear-gradient(to top, #fae873, #ffa500, #ff4500);
    /*background: linear-gradient(to top, #fb6b97, #ffffff);*/
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: absolute;
    z-index: 2;
}

.fill-text span {
    display: inline-block;
    background: linear-gradient(to top, #fae873, #ffa500, #ff4500);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.start-fixed-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.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: absolute;
    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;
}

@media (orientation: landscape) {
    .loading-bar-wrapper {
        margin-bottom: clamp(1dvh, 2dvh, 3dvh);
    }
    .start-fixed-portrait {
        margin-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(1dvh, 2dvh, 3dvh));
    }
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(
            90deg,
            #FFCC00,
            #FF9900,
            #FF5500,
            #FF3300,
            #FF9900,
            #FFCC00
    );
    background-size: 300% 100%;
    animation: shimmer 2s linear infinite;
    transition: width 0.3s ease;
    border-radius: 999px;
    box-shadow:
            0 0 15px rgba(255, 153, 0, 0.8),
            0 0 30px rgba(255, 85, 0, 0.6),
            0 0 45px rgba(255, 51, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


@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(40vw, 50vw, 60vw);
    font-size: 1.4rem;
    text-transform: uppercase;
    padding: clamp(1.2vh, 2vh, 3vh) clamp(3vw, 5vw, 6vw);
    margin-top: clamp(3vh, 4vh, 5vh);
    text-align: center;
    font-family: 'Exo 2', sans-serif;
    font-weight: 500;

    letter-spacing: 0.05em;
    background-size: 200% auto;
    background: linear-gradient(to right, rgb(255, 193, 13), #ffe53c, #ffc10d);
    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 logoFadeIn {
    0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* === ADAPTATION === */
@media (orientation: portrait) {
    #feature-preview-screen {
        height: auto;
        min-height: 100svh;
        overflow-y: hidden;
        padding-bottom: env(safe-area-inset-bottom, 2dvh);
        padding-top: env(safe-area-inset-top, 2dvh);
    }

    #fps-wrapper {
        display: grid;
        grid-template-areas:
      "logo"
      "feature-block1"
      "feature-desc1"
      "feature-block2"
      "feature-desc2"
      "feature-block3"
      "feature-desc3"
      "start-button";
        grid-template-columns: 1fr;
        grid-template-rows:
    minmax(4dvh, auto)       /* logo */
    minmax(14dvh, auto)      /* feature 1 */
    minmax(3dvh, auto)     /* desc 1 */
    minmax(14dvh, auto)      /* feature 2 */
    minmax(3.5dvh, auto)     /* desc 2 */
    minmax(14dvh, auto)      /* feature 3 */
    minmax(3dvh, auto)     /* desc 3 */
    minmax(7dvh, auto);      /* button */

        width: 100dvw;
        height: 100%;
        box-sizing: border-box;
        padding: 0 5dvw;
        gap: 1dvh;
        align-content: start;
    }

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

    #feature-block1, #feature-block3 {
        width: clamp(50dvw, 60dvw, 70dvw);
        height: clamp(16dvh, 20dvh, 22dvh);
        margin: 0 auto;
    }

    #feature-block2 {
        width: clamp(60dvw, 80dvw, 90dvw);
        height: clamp(18dvh, 22dvh, 24dvh);
        margin: 0 auto;
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    #logo-placeholder {
        position: relative;
        grid-area: logo;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        height: 100%;
        box-sizing: border-box;
        margin-top: 0.7vh;
    }

    .logo-image {
        height: clamp(9vh, 11vh, 14vh);
        width: auto;
        object-fit: contain;
        margin-bottom: 1.5vh;
    }

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

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

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

    .feature-description {
        max-width: 85%;
        margin-top: 0;
        font-size: clamp(0.8rem, 2dvw, 1.1rem);
        line-height: 1.1;
        padding: 0.3dvh 0;
        text-align: center;
        transform: translateY(-0.4dvh);
    }

    .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: 2;
        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);
    }

    .start-button {
        font-size: clamp(0.9rem, 1.5vw, 1.1rem);
        /*font-size: 1.1rem;*/
        padding: clamp(1.5vh, 2.5vh, 3vh) 0;
        text-align: center;
        text-transform: uppercase;
        background: linear-gradient(to right, #ffc10d, white, #ffc10d);
        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);
        z-index: 999;
    }
}

@media (orientation: portrait) and (max-height: 560px) {
    .feature-description {
        font-size: 0.7rem;
    }

    .start-button {
        font-size: clamp(0.7rem, 1vh, 0.9rem);
    }

    #fps-wrapper {
        row-gap: 0;
    }
}

@media (orientation: portrait) and (min-height: 1000px) {
    .feature-description {
        font-size: 1.3rem;
    }
    .start-button {
        font-size: clamp(1rem, 1.6vh, 1.3rem);
    }
}

@media (orientation: portrait) and (min-width: 768px) and (min-height: 1000px) {
    .start-button {
        font-size: 1.2rem;
    }
}

@media (min-width: 1200px) {
    .start-button {
        font-size: 1.4rem;
    }
}

@media (orientation: landscape) and (max-height: 700px) {

    #fps-wrapper {
        display: grid;
        grid-template-areas:
      "logo logo logo"
      "feature-block1 feature-block2 feature-block3"
      "feature-desc1 feature-desc2 feature-desc3"
      "start-button start-button start-button";

        grid-template-columns: 22dvw 32dvw 22dvw;
        width: 100dvw;
        height: 100dvh;
        justify-content: center;
        align-items: center;
        padding: 0 3dvw;
        column-gap: 1.5dvw;
        row-gap: 0.6dvh;
        box-sizing: border-box;
    }

    /*.feature-block {*/
    /*    margin-top: 20px;*/
    /*}*/

    .feature-block.small {
        width: clamp(22vw, 26vw, 28vw);
        height: clamp(28vh, 36vh, 42vh);
    }

    .feature-block.large {
        width: clamp(30vw, 32vw, 34vw);
        height: clamp(30vh, 40vh, 45vh);
    }

    .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-desc1, #feature-desc2, #feature-desc3 {
        justify-content: unset;
        align-items: center;
    }

    .start-button {
        font-size: clamp(0.8rem, 1.3vw, 1.1rem);
        padding: clamp(1vh, 1.5vh, 2vh);
        margin-top: 0;
    }

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

@media (min-device-width: 768px) and (min-device-height: 768px) {
    #sound-toggle {
        width: 45px;
        height: 45px;
    }
}

@media (orientation: landscape) and (max-height: 260px) {
    #fps-wrapper {
        grid-template-columns: 30vw 35vw 30vw;
        grid-template-rows: 15vh auto auto auto;
        row-gap: 0.6vh;
        column-gap: 1vw;
        padding: 0 2vw;
    }

    .feature-block.small,
    #feature-block1,
    #feature-block3 {
        width: clamp(25vw, 30vw, 35vw);
    }

    #feature-block2 {
        width: clamp(30vw, 35vw, 40vw);
        aspect-ratio: unset;
    }

    .feature-description {
        font-size: clamp(0.7rem, 1.5vw, 1rem);
        line-height: 1.1;
        padding: 0.3vh 0;
        word-break: break-word;
        white-space: normal;
        text-align: center;
    }

    .start-button {
        padding: clamp(0.6vh, 1vh, 1.4vh) clamp(3vw, 4vw, 5vw);
        z-index: 3;
        transform: scale(1);
    }

    #section-button {
        padding-bottom: 3vh;
    }

    .logo-image {
        height: clamp(12vh, 15vh, 18vh);
    }

    #sound-toggle {
        bottom: 2vh;
        right: 2vw;
        z-index: 999;
    }
}

@media (orientation: landscape) and (max-height: 480px) {
    .loading-bar-wrapper {
        position: absolute;
        bottom: 3vh;
        left: 50%;
        transform: translateX(-50%);
        width: 150px;
        height: 13px;
        margin: 0;
        padding: 0;
    }

    .loading-percent {
        font-size: 0.8rem;
    }
}

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

@keyframes shimmerFlash {
    0% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.9; filter: brightness(2); }
    100% { opacity: 1; filter: brightness(1); }
}

@keyframes firePulse {
    0%, 100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(20px);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
        filter: blur(50px);
    }
}

.breath {
    animation: breath 2s ease-in-out;
}

.shimmer {
    animation: shimmerFlash 2s ease-in-out;
}

@keyframes firePulse {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(20px);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
        filter: blur(45px);
    }
}

.layer-overlay.glow-shadow {
    filter:
            drop-shadow(0 0 3px rgba(255, 200, 0, 0.6))
            drop-shadow(0 0 6px rgba(255, 150, 0, 0.5))
            drop-shadow(0 0 10px rgba(255, 100, 0, 0.4))
            drop-shadow(0 0 16px rgba(255, 50, 0, 0.3));
    transition: filter 0.2s ease;
}