: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 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* -- Game logo -- */

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

/* -- Content area (gift boxes) -- */

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

.gift-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
}

.gift {
    aspect-ratio: 606 / 605;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.sub {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#subMini    { aspect-ratio: 325 / 320; }
#subReels   { aspect-ratio: 411 / 264; }
#subNumbers { aspect-ratio: 444 / 137; }

/* -- Progress bar (wooden board + candy fill) -- */

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

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

#bar2 {
    width: 0;
    height: 100%;
    background-repeat: no-repeat;
    background-position: left center;
    background-size: var(--bar-w) 100%;
}

#bar2Percent {
    position: relative;
    z-index: 1;
    pointer-events: none;
    font-family: 'LilitaOne-Regular', sans-serif;
    font-weight: 400;
    color: #fff;
}

/* -- Tap to start -- */

.blinking_text {
    font-family: 'LilitaOne-Regular', sans-serif;
    font-weight: 400;
    color: white;
    text-align: center;
    white-space: nowrap;
    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 2vh;
    }

    /* 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: min(44vw, 26vh); order: -1; margin: 1vh 0; }

    /* content — scattered gift boxes */
    #spines { position: relative; }
    .gift-group { display: contents; }

    .gift, .sub {
        position: absolute;
        transform: translate(-50%, -50%);
    }

    /* left / right column, staggered rows.
       widths capped by vh so images shrink (instead of overlapping)
       on short / near-square portrait screens */
    #subNumbers { left: 31%; top: 13%; width: min(42vw, 28vh); }
    #giftExtra  { left: 70%; top: 13%; width: min(54vw, 22vh); }
    #giftMulti  { left: 30%; top: 50%; width: min(54vw, 22vh); }
    #subMini    { left: 72%; top: 50%; width: min(30vw, 16vh); }
    #subReels   { left: 31%; top: 81%; width: min(30vw, 16vh); }
    #giftDouble { left: 70%; top: 81%; width: min(54vw, 22vh); }

    /* progress */
    #progress_bar2 { --bar-w: 84vw; width: var(--bar-w); margin-top: 1vh; }
    #bar2Percent {
        font-size: 7vw;
        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: 2vh 0;
        justify-content: space-between;
    }

    /* 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 — top center */
    #gameLogo { width: min(22vw, 24vh); margin-bottom: 3vh;}

    /* content — three gift columns side by side, centered vertically
       so leftover height is balanced instead of dumped below the row */
    #spines { flex-direction: row; align-items: center; gap: 2vw; margin-bottom: 8vh; }
    .gift-group {
        position: relative;
        gap: 0;
        padding-bottom: 17vh;
    }
    .gift { width: min(28vw, 40vh); }
    .sub {
        position: absolute;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
    }
    #subMini    { height: var(--subMini-h, min(17vw, 19vh)); }
    #subReels   { height: var(--subReels-h, min(15vw, 17vh)); }
    #subNumbers { height: var(--subNumbers-h, min(11vw, 13vh)); }

    /* progress */
    #progress_bar2 { --bar-w: 36vw; width: var(--bar-w); }
    #bar2Percent {
        font-size: 4.8vh;
        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; }
