/* --- FONT (HTML loading text only) --- */
@font-face {
    font-family: 'JotiOne';
    src: url('./JotiOne-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- PAGE BACKGROUND --- */
html, body {
    width: 100%;
    height: 100%;
}

body {
    padding: 0;
    margin: 0;
    overflow: hidden;

    /* Match the gradient tones */
    background: linear-gradient(
        180deg,
        #1FBEF3 0%,
        #58B9AE 55%,
        #90B369 100%
    );
}

/* --- CONTAINER: center the canvas, respect safe areas (notches) --- */
#unity-container {
    position: absolute;
    inset: 0;

    /* safe area padding */
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);

    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- CANVAS SIZING (FIT INSIDE SCREEN) --- */
/* Goal: always keep 9:16 portrait and NEVER exceed viewport */
#unity-canvas {
    /* Fit inside viewport: width is limited by both vw and vh */
    width: min(100vw, calc(100vh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));

    /* optional: prevents blurry scaling in some browsers */
    image-rendering: auto;

    /* Your existing loading splash on the canvas */
    background: url('loading.jpeg') no-repeat center;
    background-size: cover;
}

/* Keep Unity's mobile class support (JS sets unity-mobile on container) */
#unity-container.unity-mobile {
    width: 100%;
    height: 100%;
}

/* --- LOADING UI --- */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 80%;
    transform: translate(-50%, -50%);

    /* NEW: true centering */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

/* Optional: on short screens, bring loading up slightly */
@media (max-height: 700px) {
    #unity-loading-bar {
        top: 75%;
    }
}

#unity-progress-bar-empty {
    width: 370px;
    height: 25px;
    margin-top: 10px;
    margin: 10px auto 0 auto; /* centers the bar */
    background: url('empty_load.png') no-repeat center;
    border-radius: 30px;
}

#unity-progress-bar-full {
    width: 0%;
    height: 25px;
    margin-top: 10px;
    border-radius: 30px;
    background: url('full_load.png') no-repeat center;
}

/* Loading text */
p {
    font-family: 'JotiOne', sans-serif;
    text-align: center;
    color: #111;
    font-size: 65px;
    margin-top: 30px;
    margin-bottom: 0;
    text-transform: uppercase;
}

/* Make loading text scale down on small phones */
@media (max-width: 420px) {
    p {
        font-size: 44px;
    }
    #unity-progress-bar-empty,
    #unity-progress-bar-full {
        width: 300px;
    }
}

/* --- FOOTER (hidden as you had) --- */
#unity-footer {
    position: relative;
    display: none;
}

#unity-webgl-logo {
    float: left;
    width: 204px;
    height: 38px;
    background: url('webgl-logo.png') no-repeat center;
}

#unity-build-title {
    float: right;
    margin-right: 10px;
    line-height: 38px;
    font-family: arial;
    font-size: 18px;
}

#unity-fullscreen-button {
    float: right;
    width: 38px;
    height: 38px;
    background: url('fullscreen-button.png') no-repeat center;
}
