:root {
    --app-vh: 100vh;
}

@supports (height: 100svh) {
    :root {
        --app-vh: 100svh;
    }
}

@supports (height: 100dvh) {
    :root {
        --app-vh: 100dvh;
    }
}

body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000000;
    height: var(--app-vh);
    width: 100vw;
    /* width: calc(100vh * 0.35); */
    border: none;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-global-loader {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#edge-fill {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.edge-fill__side {
    position: absolute;
    top: 0;
    height: 100%;
    width: 0;
    display: block;
}

#edge-fill-left {
    left: 0;
}

#edge-fill-right {
    right: 0;
}

.main-layout {
    position: absolute;
    height: var(--app-vh);
    width: 100vw;
    /* width: calc(var(--app-vh) * 0.75); */
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: #000;
    overflow: hidden;
    z-index: 1;

    transition: opacity 600ms ease-in-out;
}

#splash {
    overflow: hidden;
    width: 100vw;
}

.splash__scene {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 0;
}

.splash__scene img {
    position: absolute;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.splash__image_0 {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Арт квадратный (1920x1920) и композиционно верхний: смещаем кроп вверх,
       чтобы на широких экранах не срезало нимб. В портрете по высоте кропа нет. */
    object-position: center 45%;
    z-index: 1;
}

#progress-bar-container {
    position: absolute;
    top: 84%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(72%, 520px);
    background-color: transparent;
    z-index: 6;
    transition: opacity 1s ease-in-out;
    border: 0;
}


/* #progress-bar {
    height: 100%;
    width: 0%;
    position: relative;
    display: block;
    background-color: #38cb1c;
    transition: width 0.5s ease-in-out;
}

.progress-track {
    width: 100%;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.8);

    display: flex;
    align-items: center;
} */
/* ВНЕШНЯЯ РАМКА — повторяет в CSS спрайт progressbar.png от дизайнера.
   Спрайт плоский, поэтому воспроизводится точно, зато без швов border-image:
   9-slice растрирует куски по отдельности и на дробных границах оставлял
   по 1 px частичного покрытия — две светлые линии поперёк трека.
   Метрики спрайта: капсула y 17..109 (93 px), белое кольцо 10 px (10/93 = 0.108),
   нутро #03156A, по краям нутра мягкая внутренняя тень ~5 px, снаружи свечение ~9 px. */
.progress-track {
    --pb-height: clamp(41px, 5.2vh, 57px);
    --pb-ring: calc(var(--pb-height) * 0.108);

    position: relative;
    width: 100%;
    height: var(--pb-height);
    box-sizing: border-box;
    background: #03156a;
    border: var(--pb-ring) solid #ffffff;
    border-radius: 999px;
    box-shadow:
        0 0 calc(var(--pb-height) * 0.16) rgba(0, 20, 91, 0.5),
        inset 0 calc(var(--pb-height) * 0.02) calc(var(--pb-height) * 0.07) rgba(0, 0, 40, 0.55);
}

/* САМ ПРОГРЕСС — капсула из спрайта progressbar_fill.png.
   В спрайте заливка попиксельно совпадает с внутренней областью рамки, а inset: 0
   у абсолютного потомка считается от padding-box трека, то есть ровно от неё же.
   Поэтому ширина задаётся простым процентом (splash_screen.js, renderProgress). */
#progress-bar {
    position: absolute;
    inset: 0;
    width: 0;
    max-width: 100%;
    border-radius: 999px;
    background: linear-gradient(180deg,
            #ffec08 0%,
            #ffec08 22%,
            #ffd306 42%,
            #feae02 67%,
            #feae02 100%);
    transition: none;
    pointer-events: none;
}

.progress-star {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    background: url('./data/loading_star.png') no-repeat center / contain;
    pointer-events: none;
}

#progress-text-status {
    width: 100%;
    position: absolute;
    text-align: center;
    color: white;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: clamp(20px, 4.2vh, 32px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-shadow:
        0 3px 0 rgba(0, 0, 0, 0.24),
        0 0 8px rgba(0, 0, 0, 0.35);
}

#progress-loading-message {
    margin-bottom: 12px;
    min-height: 26px;
    color: #ffffff;
    font-size: clamp(16px, 2.7vh, 24px);
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    letter-spacing: 0;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.22),
        0 0 7px rgba(0, 0, 0, 0.5);
}


#site-link {
    /* www.joybits.games wordmark hidden on splash */
    display: none;
    justify-content: center;
    width: 100%;
    margin-top: 28px;
}

#site-link img {
    display: block;
    max-width: 230px;
    width: 60%;
    height: auto;
}

.step_1,
.step_2 {
    width: 0;
    height: 30px;

    background-color: #4caf50;
}

.step_2 {
    background-color: #b4cb1a;
}





#progress-text_1,
#progress-text_2 {
    display: none;
    top: 45%;
    left: 50%;
    /* transform: translate(-50%, -45%); */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}



#version {
    position: absolute;
    top: 0;
    right: 10px;
    z-index: 7;
    user-select: none;
    color: rgba(255, 255, 255, 0.438);
    font-size: 14px;
    /* padding-top: env(safe-area-inset-top, 0);
    padding-top: var(--tg-safe-area-inset-top, 0);

    transition: all 0.3s ease; */
}


#tl_logo {
    display: block;
    /* max-width: 230px; */
    width: clamp(170px, 31%, 248px);
    height: auto;
    position: absolute;
    left: max(20px, 7%);
    top: var(--tg-safe-area-inset-top, 28px);
    z-index: 7;
    padding-top: env(safe-area-inset-top, 0);
    /* padding-top: var(--tg-safe-area-inset-top, 0); */
    transition: all 0.3s ease;
}

#canvas {
    position: relative;
    display: block;
    width: 100%;
    height: 100%
}






#splash.hidden {
    opacity: 0;
}

.release .step_1,
.release .step_2 {
    background-color: transparent;
}

.release #progress-text_1,
.release #progress-text_2 {
    display: none !important;
}

.release #progress-bar-container {
    background-color: transparent !important;
    border: transparent !important;
}









.stats-js {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: unset;
    top: unset;
    z-index: 9999;
}

/* #### Стиль для кнопок переключения билдов --- */
/* --- Стили для кнопок переключения билдов --- */
#build-switcher {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}



.build-btn {
    color: white;
    border: 2px solid white;
    padding: 10px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    cursor: pointer;
    margin-bottom: 5px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    transform: translateX(-30px);
    transition: transform 0.3s ease, background-color 0.3s, border-color 0.3s;
}



/* Стиль для активной кнопки */
.build-btn.active {
    transform: translateX(-20px);
    border-color: #e207ff;
    /* Яркая рамка для выделения */
    box-shadow: 0 0 10px #e207ff;
}


.build-btn:hover,
.build-btn.active:hover {
    transform: translateX(0);
}

/* ###################################### */
/* ===== FULLSCREEN LOADING OVERLAY ===== */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition: opacity 0.4s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== GLASS PANEL ===== */

.loading-glass {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;

    padding: 28px 32px;
    border-radius: 20px;

    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12),
        0 10px 40px rgba(0, 0, 0, 0.6);
}

/* ===== ICON ===== */

.loading-icon {
    position: relative;
    width: min(40vw, 140px);
    aspect-ratio: 1 / 1;
    animation: float 1.6s ease-in-out infinite;
}

.loading-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    
}

.loading-arrow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    
    animation: spin 2.2s linear infinite;
}

/* ===== TEXT ===== */

.loading-text {
    color: #ffffff;
    font-size: clamp(14px, 4vw, 18px);
    text-align: center;
    line-height: 1.3;
    opacity: 0.9;
}

/* ===== ANIMATIONS ===== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

@keyframes float {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}
