/* =========================
   Global
   ========================= */
   html, body {
    margin: 0;
    padding: 0;
    background: #000;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    color: #fff;
}

/* =========================
   外層 wrapper：1080x1920 + Safari 安全區
   ========================= */
#game-wrapper {
    position: fixed;
    inset: 0;
    width: 100vw;

    /* 避免 iOS Safari 底部 UI 壓住畫面 */
    height: 100vh;
    height: 100dvh; /* 🔥 Safari 動態可見高度 */

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

    background: #000;
    overflow: hidden;
}

/* =========================
   Unity 容器（背景在這裡）
   ========================= */
#unity-container {
    position: relative;
    width: 100%;
    height: 100%;

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

    overflow: hidden;

    /*  Loading 圖片背景 */
    background-image: url("LoadingBG.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

#unity-container.unity-desktop,
#unity-container.unity-mobile {
    width: 100%;
    height: 100%;
}

/* =========================
   Canvas：Unity 遊戲畫面
   ========================= */
#unity-canvas {
    position: relative;
    z-index: 1; /* 在背景圖上層 */

    display: block;

    /*  Canvas 必須透明，否則會遮住 LoadingBG */
    background: transparent !important;

    width: auto !important;
    height: 100% !important;

    aspect-ratio: 1080 / 1920;
    max-height: 100vh;
    max-height: 100dvh; /* 🔥 Safari 動態高度 */
    max-width: calc(100dvh * (1080 / 1920));
}

.unity-mobile #unity-canvas {
    position: relative;
    z-index: 1;

    width: auto !important;
    height: 100% !important;

    aspect-ratio: 1080 / 1920;
    max-height: 100vh;
    max-height: 100dvh;
    max-width: calc(100dvh * (1080 / 1920));
}

/* =========================
   Loader
   ========================= */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);

    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    z-index: 2; /* loader 在 Canvas 上面 */
}

#unity-logo {
    display: none !important;
}

#unity-progress-bar-empty {
    width: 141px;
    height: 18px;
    margin: 0 auto;

    border: 2px solid #fff;
    box-sizing: border-box;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: #fff;
}

/* =========================
   Warning Banner（Unity 自己用）
   ========================= */
#unity-warning {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;

    max-width: 800px;
    margin: 0 auto;

    text-align: left;
    z-index: 9999;

    display: none;
}

#unity-warning div {
    margin-bottom: 5px;
}