:root {
    color-scheme: only light;
}

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

body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: #0b1327;
    width: 100%;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

#app {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0%);
    width: 100%;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

/* ===== First Preloader (ArtOfSpin logo) ===== */

#preloader {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1327;
}

.preloader_inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo {
    width: min(60vw, 640px);
    aspect-ratio: 640 / 280;
    margin-bottom: 5vmin;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0;
    transition: opacity 0.7s;
}

.progress_bar {
    background-color: #09394b;
    border-radius: 18px;
    width: min(66vw, 500px);
    height: 36px;
}

.bar {
    width: 0;
    height: 32px;
    margin: 1px;
    border-radius: 16px;
    min-width: 32px;
    background-image: url("./assets/images/preloader_bg.webp");
    background-color: #b3fbff;
    border: 1px solid #09394b;
}

/* ===== Sound Buttons ===== */

.soundBtn {
    position: fixed;
    z-index: 100;
    top: 3vmin;
    right: 3vmin;
    width: 7vmin;
    height: 7vmin;
    min-width: 40px;
    min-height: 40px;
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Splash Screen ===== */

#preloader2 {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    visibility: hidden;
    overflow: hidden;
}

/* -- Gamification banner -- */

#gamification {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    aspect-ratio: 1424 / 225;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

#spinny {
    flex-shrink: 0;
    aspect-ratio: 1;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.gamification-text {
    font-family: AlexandriaExtraBold;
    font-weight: 800;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* -- Game logo -- */

#gameLogo {
    flex-shrink: 0;
    aspect-ratio: 544 / 231;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* -- Content area (two splash blocks) -- */

#spines {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.splash-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.splash-image {
    flex: 1;
    min-height: 0;
    width: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
}

.numbers-img {
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#numbers4096 {
    aspect-ratio: 560 / 119;
}

#numbers100 {
    aspect-ratio: 348 / 100;
}

.label-text {
    flex-shrink: 0;
    box-sizing: border-box;
    max-width: 100%;
    font-family: AlexandriaExtraBold;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    color: #FFEB72;
    line-height: 1.3;
}

.up-to-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.free-games-img {
    flex-shrink: 0;
    aspect-ratio: 619 / 99;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* -- Progress bar -- */

#progress_bar2 {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 682 / 79;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}

#progress_bar2.is-tap-ready {
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
    box-sizing: border-box;
    padding: 0.6vh 4vw;
}

#bar2Holder {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#bar2 {
    width: 0;
    height: 100%;
    background-repeat: no-repeat;
    background-position: left center;
}

#bar2Percent {
    position: relative;
    z-index: 1;
    pointer-events: none;
    font-family: AlexandriaExtraBold;
    font-weight: 800;
    color: #fff;
}

/* -- Tap to start -- */

.blinking_text {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font-family: AlexandriaExtraBold;
    font-weight: 800;
    color: white;
    text-align: center;
    line-height: 1.25;
    animation: smoothBlink 2s infinite alternate;
}

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

/* Portrait (aspect-ratio < 4/5) */
@media (max-aspect-ratio: 4/5) {
    #preloader2 {
        padding: 0 0 1vh;
    }

    /* gamification — full width, edge-to-edge */
    #gamification {
        width: 100%;
    }
    #spinny {
        width: 12vw;
        margin-left: 2vw;
    }
    .gamification-text { margin-left: 2vw; }
    #portalRewards {
        font-size: 3.5vw;
        margin-bottom: -2vw;
        margin-top: 2vw;
    }
    #available {
        font-size: 6vw;
    }

    /* logo above gamification */
    #gameLogo { width: 55vw; }

    /* content */
    #spines { flex-direction: column; }
    .splash-block { width: 100%; flex: 1; }

    /* numbers */
    #numbers4096 { width: 45vw; }
    #numbers100  { width: 22vw; }

    /* text */
    .label-text {
        font-size: 6vw;
        text-shadow:
            -0.6vw -0.6vw 0 #4D1601, 0.6vw -0.6vw 0 #4D1601,
            -0.6vw  0.6vw 0 #4D1601, 0.6vw  0.6vw 0 #4D1601;
    }

    .up-to-row { gap: 4vw; }
    .free-games-img { width: 55vw; }

    /* progress */
    #progress_bar2 { --bar-w: 80vw; width: var(--bar-w); margin-top: 1vh; }
    #progress_bar2.is-tap-ready { --bar-w: 92vw; width: var(--bar-w); }
    #bar2 { background-size: var(--bar-w) 100%; }
    #bar2Percent {
        font-size: 4vw;
        text-shadow:
            -0.2vw -0.2vw 0 #4D1601, 0.2vw -0.2vw 0 #4D1601,
            -0.2vw  0.2vw 0 #4D1601, 0.2vw  0.2vw 0 #4D1601;
    }
    .blinking_text {
        font-size: 5vw;
        text-shadow:
            -0.2vw -0.2vw 0 black, 0.2vw -0.2vw 0 black,
            -0.2vw  0.2vw 0 black, 0.2vw  0.2vw 0 black;
    }
}

/* Landscape (aspect-ratio >= 4/5) */
@media (min-aspect-ratio: 4/5) {
    #preloader2 {
        padding: 0 0 1vh;
        justify-content: center;
    }

    #spines { flex: 0 1 auto; }

    /* gamification — absolute top-left */
    #gamification {
        position: absolute;
        top: 0;
        left: 0;
        width: 30vw;
        z-index: 2;
    }
    #spinny {
        width: 5vh;
        margin-left: 1vw;
    }
    .gamification-text { margin-left: 1vw; }
    #portalRewards {
        font-size: 1.6vw;
        margin-bottom: -0.8vw;
        margin-top: 1vw;
    }
    #available {
        font-size: 2.6vw;
    }

    /* logo */
    #gameLogo { width: min(40vw, 45vh); }

    /* content — side by side */
    #spines { flex-direction: row; gap: 2vw; }
    .splash-block { flex: 1; max-width: 48%; }
    .splash-image { flex: 0 0 auto; height: 40vh; }

    /* numbers */
    #numbers4096 { width: min(22vh, 20vw); }
    #numbers100  { width: min(12vh, 11vw); }

    /* text */
    .label-text {
        font-size: min(3.5vh, 3vw);
        text-shadow:
            -0.4vh -0.4vh 0 #4D1601, 0.4vh -0.4vh 0 #4D1601,
            -0.4vh  0.4vh 0 #4D1601, 0.4vh  0.4vh 0 #4D1601;
    }

    .up-to-row { gap: 2vh; }
    .free-games-img { width: min(32vh, 28vw); }

    /* progress */
    #progress_bar2 { --bar-w: 40vw; width: var(--bar-w); margin-top: 2vh; }
    #progress_bar2.is-tap-ready { --bar-w: min(70vw, 90vh); width: var(--bar-w); }
    #bar2 { background-size: var(--bar-w) 100%; }
    #bar2Percent {
        font-size: 2.2vh;
        text-shadow:
            -0.2vh -0.2vh 0 #4D1601, 0.2vh -0.2vh 0 #4D1601,
            -0.2vh  0.2vh 0 #4D1601, 0.2vh  0.2vh 0 #4D1601;
    }
    .blinking_text {
        font-size: 3vh;
        text-shadow:
            -0.15vh -0.15vh 0 black, 0.15vh -0.15vh 0 black,
            -0.15vh  0.15vh 0 black, 0.15vh  0.15vh 0 black;
    }
}

/* ===== Debug UI ===== */
#lil_gui { top: 0; left: 0; }
