@font-face {
    font-family: "SubFont";
    src: url("./SubFont.otf") format("opentype");
}
html {
    height: 100%;
    width: 100%;
}
body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}
#unity-container {
    position: absolute;
}
#unity-container.unity-desktop {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
#unity-container.unity-mobile {
    position: fixed;
    width: 100%;
    height: 100%;
}
#unity-canvas {
    background: #000;
}
.unity-mobile #unity-canvas {
    width: 100%;
    height: 100%;
}

#unity-canvas {
    display: block;
    width: auto; /* chiều ngang tự tính theo aspect */
    height: 100svh; /* fill full chiều cao màn hình */
    margin: 0 auto; /* căn giữa ngang */
    background: #000;
}

/* Fallback cho iOS cũ (chưa có 100svh) */
@supports not (height: 100svh) {
    :root {
        --vh: 100vh;
    }
    #unity-canvas {
        height: var(--vh);
    }
}

#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
}
#unity-logo {
    /* position: absolute; */
    width: 300px;
    height: 183px;
    background: url("logo.png") no-repeat center;
    background-size: contain;
    /* top: 50%; */
    /* left: 50%; */
    /* transform: translate(-50%, -50%); */
}
#unity-progress-bar-empty {
    position: relative; /* làm mốc cho overlay */
    width: 300px;
    height: 30px;
    padding-left: 4px;
    padding-right: 4px;
    /* background: url("process_bar.png") no-repeat center; */
    background-image: url("process_bar.png");
    background-size: 100% 100%;
    /* background-size: contain; */
    overflow: hidden; /* (tuỳ) tránh tràn */
}

#unity-progress-bar-full {
    position: relative;
    /* display: block; */
    z-index: 1; /* lớp dưới chữ */
    width: 0;
    height: 20px;
    top: 4px;
    background-image: url("process_bar1.png");
    background-size: auto;
    background-repeat: repeat-x;
}

#text-loading {
    position: absolute;
    inset: 0; /* phủ toàn bộ parent */
    display: flex;
    align-items: center;
    justify-content: center; /* canh giữa hoàn hảo */
    z-index: 2; /* cao hơn phần fill */
    pointer-events: none; /* (tuỳ) cho phép click xuyên qua */
    color: white;
    font-family: "SubFont";
    top: 4px;
}

#text-loading {
    -webkit-text-stroke: 1px #000;
    font-weight: 700; /* (tuỳ) tăng độ dày chữ cho dễ nhìn */
}

#unity-footer {
    position: relative;
}
.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 {
    cursor: pointer;
    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%);
    background: white;
    padding: 10px;
    display: none;
}

/* === Landscape-only Loading UI override (added by ChatGPT) === */
/* The loading overlay will always render in landscape layout even if the device is in portrait. */
#unity-loading-bar {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-image: url("./bg_loading.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    gap: 12px;
}

/* When device is in portrait, rotate the loading overlay to landscape. */
@media (orientation: portrait) {
    #unity-loading-bar {
        position: absolute; /* break out to the viewport to avoid parent sizing issues */
        inset: 0;
        width: 100vh; /* use the device-height as the rotated width */
        height: 100vw; /* and device-width as the rotated height */
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center center;
    }
    /* Center the logo/progress nicely after rotation */
    #unity-logo,
    #unity-progress-bar-empty,
    #unity-progress-bar-full {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Make sure warning banner appears above rotated overlay */
#unity-warning {
    z-index: 1000;
}

/* Keep overlay above the canvas/footer while loading */
#unity-loading-bar {
    z-index: 999;
}

.start-wrap {
    /* position: absolute; */
    display: none;
    pointer-events: auto;
    /* top: 70%;
  left: 50%;
  transform: translate(-50%,-50%); */
    /* cho click */
}

.btn-start {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 176px;
    height: 64px;
    font-size: 24px;
    color: #fff;
    user-select: none;
    cursor: pointer;
    background: url("./btn_red.png") no-repeat center;
    background-size: contain;
    font-family: "SubFont";
}

.btn-start:hover {
    filter: brightness(1.05);
}

.btn-start:active {
    transform: translateY(4px);
    filter: brightness(0.95);
}

.btn-start:focus-visible {
    outline: 3px solid #ffffff88;
    outline-offset: 4px;
}

.is-ready #unity-progress-bar-empty {
    display: none;
}

.is-ready .start-wrap {
    display: block;
}

/* === End Landscape override === */
