html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #2c2f3a; /* Changed from white to dark background */
    font-family: 'Roboto', sans-serif;
}

#unity-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Full viewport height */
    width: 100vw; /* Full viewport width */
    position: fixed; /* Changed from relative to fixed */
    top: 0;
    left: 0;
    background-color: #2c2f3a; /* Dark background to match */
}

#unity-canvas {
    width: 100%; /* Fill container completely */
    height: 100%; /* Fill container completely */
    border-radius: 0; /* Removed border radius for full-screen */
    display: block;
    object-fit: contain; /* Maintain aspect ratio while filling */
}

/* FIXED: Unity Loading Bar Container */
#unity-loading-bar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    width: auto;
    max-width: 90%;
    box-sizing: border-box;
}

/* FIXED: Unity Logo - Larger for desktop */
#unity-logo {
    width: 150px; /* Fixed size for desktop - larger than before */
    height: 150px; /* Fixed height to maintain aspect ratio */
    background: url('unity-logo-dark.png') no-repeat center;
    background-size: contain;
    margin: 0 auto 5vh auto;
    display: block;
}

#unity-progress-bar-empty {
    width: 80%;
    max-width: 500px;
    min-width: 250px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2); /* Semi-transparent for dark background */
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    padding: 5px;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: #ffffff; /* White progress bar for contrast */
    transition: width 0.3s ease;
    border-radius: 10px;
}

#unity-warning {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4d4f;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    display: none;
    z-index: 100;
}

#fullscreen-note-container {
    position: fixed;
    top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

#fullscreen-note {
    background: rgba(44, 47, 58, 0.95);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.portrait-warning {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
}

.warning-content {
    color: #fff;
    padding: 20px;
    font-size: 18px;
    line-height: 1.6;
    font-weight: 500;
}

/* Portrait mode handling */
@media screen and (orientation: portrait) {
    .portrait-warning {
        display: flex;
    }
    #unity-container {
        transform: translate(-50%, -50%) rotate(-90deg);
        transform-origin: center;
        width: 100vh;
        height: 100vw;
        position: fixed; /* Ensure it stays fixed */
        top: 50%;
        left: 50%;
    }
}

/* Mobile landscape full-screen optimization */
@media screen and (orientation: landscape) {
    html, body {
        background-color: #2c2f3a; /* Ensure no white shows */
    }
    
    #unity-container {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
        padding: 0;
    }
    
    #unity-canvas {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* Mobile landscape loading screen optimizations */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #unity-logo {
        width: 15vw;
        max-width: 80px;
        min-width: 60px;
        height: auto;
        margin-bottom: 3vh;
    }
    
    #unity-progress-bar-empty {
        min-width: 200px;
    }
    
    /* Ensure full coverage on small landscape screens */
    #unity-container {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
    }
}

/* Larger screens optimization */
@media (min-width: 480px) {
    #unity-loading-bar {
        max-width: 600px;
    }
}

/* Very small mobile devices */
@media (max-width: 480px) {
    #unity-logo {
        width: 25vw;
        max-width: 80px;
        min-width: 60px;
        height: auto;
    }
    
    #unity-progress-bar-empty {
        min-width: 200px;
        width: 90%;
    }
}

/* Force full-screen on all mobile devices */
@media (max-width: 768px) {
    html, body {
        background-color: #2c2f3a;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    #unity-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        margin: 0;
        padding: 0;
        background-color: #2c2f3a;
    }
    
    #unity-canvas {
        width: 100%;
        height: 100%;
        border-radius: 0;
        object-fit: contain;
    }
    
    /* Keep mobile logo size smaller */
    #unity-logo {
        width: 25vw;
        max-width: 80px;
        min-width: 60px;
        height: auto;
    }
}