body {
    padding: 0;
    margin: 0;
    height: 100%;
    overflow: hidden; /* Prevents scrollbars */
}

#unity-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Ensure no overflow issues */
}

#unity-container.unity-desktop {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
}

#unity-container.unity-mobile {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Ensure the canvas is always fully visible in both orientations */
#unity-canvas {
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    position: absolute; /* Ensure positioning doesn't shift */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
}

.unity-mobile #unity-canvas {
    display: block;
    margin: 0 auto;
}

.unity-desktop #unity-canvas {
    display: block;
    margin: 0 auto;
}

/* Loading bar position adjustment */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    bottom: 8%;
    transform: translateX(-50%);
    display: none;
}

/* Ensure the header doesn't disappear */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.8); /* Add background so it remains visible */
    color: white;
    padding: 10px;
    text-align: center;
}

#unity-logo {
    width: 180px;
    height: 180px;
    background: url('unity-logo-dark.png') no-repeat center;
}

#unity-progress-bar-empty {
    width: 141px;
    height: 18px;
    margin-top: 10px;
    margin-left: 20px;
    background: url('progress-bar-empty-dark.png') no-repeat center;
}

#unity-progress-bar-full {
    width: 0%;
    height: 18px;
    margin-top: 10px;
    background: url('progress-bar-full-dark.png') no-repeat center;
}

#unity-footer {
    position: relative;
    bottom: 0;
    width: 100%;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.5); /* Footer remains visible */
}

.unity-mobile #unity-footer {
    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;
}

#unity-warning {
    position: absolute;
    left: 50%;
    top: 5%;
    transform: translate(-50%, 0);
    background: white;
    padding: 10px;
    display: none;
}

/* Handle orientation changes */
@media only screen and (orientation: landscape) {
    #unity-container {
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        overflow: hidden;
    }

    #unity-canvas {
        width: 100%;
        height: 100%;
    }

    header {
        position: fixed;
        width: 100%;
        top: 0;
    }
}

@media only screen and (orientation: portrait) {
    #unity-container {
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        overflow: hidden;
    }

    #unity-canvas {
        width: 100%;
        height: 100%;
    }

    header {
        position: fixed;
        width: 100%;
        top: 0;
    }
}
