*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html,
body,
div {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent; 
    -webkit-touch-callout: none;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    padding-top: constant(safe-area-inset-top);
    padding-right: constant(safe-area-inset-right);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-left: constant(safe-area-inset-left);
    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);
    background: #000;
    overflow: hidden;
}

.game {
    position: fixed;
    z-index: 1;
    background-repeat: no-repeat;
    background-position-x: center;
    background-position-y: center;
    background-size: contain;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    margin: auto;
    box-shadow: 0 0 10px #000;
    -moz-box-shadow: 0 0 10px #000;
    -webkit-box-shadow: 0 0 10px #000;
    -webkit-overflow-scrolling: touch;
}


/* 全螢幕模式背景 */
:fullscreen,
:-webkit-full-screen,
:-moz-full-screen,
:-ms-fullscreen {
  background-color: #000;
}

/* 轉向提示圖片 */
.landscape {
    position: fixed;
    display: none;
    z-index: 9999;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background-color: #000;
    background-size: 30%;
    background-repeat: no-repeat;
    background-position: center;
}

/* 上滑提示 */
.fullscreen {
    position: fixed;
    width: 100%;
    bottom: 0;
    z-index: 9998;
    background-color: #000;
    background-size: 30%;
    background-repeat: no-repeat;
    background-position: center top;
    right: constant(safe-area-inset-right);
    right: env(safe-area-inset-right, -50px);
}

.disableTouch {
    touch-action: none;
    user-select: none;
    pointer-events: none;
}

.vertical-background {
    position: absolute;
    margin: auto;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    object-fit: cover;
    pointer-events: none;
    touch-action: none;
    user-select: none;
}

.mobile .vertical-background {
    display: none;
}

.iframeWrap {
    display: none;
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
}

.iframeWrap.show {
    display: block;
}

.iframeWrap .iframeContent {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1;
    touch-action: manipulation;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.closeBtn, .helpCloseBtn {
    position: absolute;
    z-index: 9999;
    width: 55px;
    height: 55px;
    top: 10px;
    right: 30px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Loading 動畫 */
.iframeLoading {
    display: none;
    position: absolute;
    z-index: 1;
    top: 45%;
    left: 45%;
    width: 45px;
    height: 45px;
    padding: 0px;
    border-radius: 100%;
    border: 5px solid;
    border-top-color: rgb(254, 209, 141);
    border-bottom-color: #000;
    border-left-color: #000;
    border-right-color: #000;
    opacity: 0; /* 初始設定為透明 */
    animation: loading-animation 1s linear infinite;
    animation-delay: 0.5s; /* 動畫延遲 0.5 秒開始 */
}

@keyframes loading-animation {
    0% {
      transform: rotate(0deg);
      opacity: 1;
    }
    100% {
      transform: rotate(360deg);
      opacity: 1;
    }
}

/* 直式螢幕 (portrait) */
@media (orientation: portrait) {
    .closeBtn {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 10px;
    }

    .helpCloseBtn {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 30px;
    }
}

