* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background-color: #fff;
    font-family: 'Montserrat', sans-serif;
}

.main-container {
    cursor: pointer;
    width: 100vw;
    /* height: 100vh; */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    top: 0;
    overflow: hidden;
}

/* 確保隱藏類別優先級正確 */
.main-container.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* 文字元素樣式 */
.title,
.content {
    font-family: 'Montserrat', sans-serif;
}


/* 基本的 main-bg 樣式 */

.main-bg,
.modal-container,
.ff-game-bg,
.ga-game-bg {
    position: relative;
    /* 為 absolute 定位的子元素提供參考點 */
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

.modal-container {
    display: flex;
    justify-content: center;
    align-items: center;

}

/* modal-bg 基本樣式 */
.modal-bg {
    position: relative;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

.modal-bg .title {
    font-size: 0.6rem;
    font-weight: 700;

    text-align: center;
    margin-top: 1rem;
}

.modal-bg .content {
    margin: 0 auto;
    text-align: center;
    font-size: 0.24rem;
    margin-top: 0.4rem;
}

.modal-bg .content p {
    line-height: 1.5;
    font-size: 0.22rem;
}

.next_btn {
    cursor: pointer;
    display: block;
    margin: 0 auto;
    width: 3.16rem;
    height: 0.78rem;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-top: 0.2rem;

}

.finish_btn {
    cursor: pointer;
    display: block;
    margin: 0 auto;
    width: 3.16rem;
    height: 0.78rem;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-top: 0.1rem;

}

.ga {
    color: #fff;
}

.ff {
    color: #252628;
}


/* main_start 基本樣式 */
.main_start_btn {
    cursor: pointer;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    /* 水平置中 */
    width: 3.94rem;
    height: 0.78rem;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    /* 加入閃爍動畫 */
    animation: blink 2s infinite ease-in-out;
}

/* 小鳥 Sprite 動畫樣式 */
.game-bird {
    width: 1.2rem;
    height: 1.5rem;
    /* 使用 sprite sheet */
    background-image: url('../img/pingu_ani.png');
    background-size: 3.6rem 1.5rem;
    /* sprite 總尺寸：容器寬度×3幀, 容器高度×1 */
    background-repeat: no-repeat;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    /* 預設狀態：一般狀態 (第一幀) */
    background-position: 0rem 0rem;
}

.top-box {
    width: 1000%;
    height: 1.43rem;
    position: absolute;
    left: 0;
    top: 0;
}

.bottom-box {
    width: 1000%;
    height: 1.43rem;
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 1000;
}

.ff-box {
    width: 1.41rem;
    height: 1.43rem;
    background-image: url('../img/ff_box.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.ga-box {
    width: 1.41rem;
    height: 1.43rem;
    background-image: url('../img/ga_box.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.game-over {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
  
}

.switch_btn {
    position: absolute;

    left: 50% ;
    transform: translateX(-50%);
    width: 7rem;
    height: 0.61rem;
    display: flex;
    justify-content: center;
    z-index: 100;
}

.goback_btn {
    cursor: pointer;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 100;
    transition: transform 0.3s ease;
    margin: 0 0.06rem;
}

.goback_btn:hover {
    transform: scale(1.05);
}

/* 遊戲結束按鈕禁用狀態 */
.goback_btn:disabled,
.goback_btn[disabled] {
    opacity: 1 !important;
    /* filter: grayscale(1) !important; */
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.restart_btn {
    cursor: pointer;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 100;
    transition: transform 0.3s ease;
    margin: 0 0.06rem;
}

.restart_btn:hover {
    transform: scale(1.05);
}

/* 遊戲結束按鈕禁用狀態 */
.restart_btn:disabled,
.restart_btn[disabled] {
    opacity: 1 !important;
    /* filter: grayscale(1) !important; */
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* 動畫效能優化：will-change */
.game-bird,
.obstacle-group,
.modal-bg,
.game-over,
.game-over-overlay {
    will-change: transform, opacity;
}

/* 寬屏模式 (width >= height) */
@media screen and (orientation: landscape) {


    .loading-container {
        width: 19.2rem;
        height: 9.23rem;
        background-image: conic-gradient(from 0.28turn,
                #dbddee,
                #fdfefe 0.06turn,
                #eaebf5 0.14turn,
                #f8f0f8 0.2turn,
                #fff 0.3turn,
                #d4dde9 0.37turn,
                #eee7f1 0.44turn,
                #eaf6f9 0.53turn,
                #fdfefe 0.57turn,
                #f9f2f8 0.61turn,
                #f2eff8 0.69turn,
                #fdfefe 0.78turn,
                #f9f6fd 0.86turn,
                #fdfefe 0.91turn,
                #daddee 0.97turn);
    }

    .main-bg {
        width: 19.2rem;
        height: 9.23rem;
        background-image: url('../img/main_bg_en.jpg');
    }

    .ff-game-bg {
        width: 19.2rem;
        height: 9.23rem;
        background-image: url('../img/ff_game_bg.jpg');
    }

    .ga-game-bg {
        width: 19.2rem;
        height: 9.23rem;
        background-image: url('../img/ga_game_bg.jpg');
    }

    .modal-container {
        width: 19.2rem;
        height: 9.23rem;
    }

    .modal-bg {
        width: 10.89rem;
        height: 5.36rem;

    }

    .ga_bg {
        background-image: url('../img/ga_modal.png');
    }

    .ff_bg {
        background-image: url('../img/ff_modal.png');
    }

    .main_start_btn {
        background-image: url('../img/main_start_en.png');
        bottom: 0.25rem;
    }

    .next_btn {
        background-image: url('../img/next_btn_en.png');
    }

    .finish_btn {
        background-image: url('../img/finish_btn_en.png');
    }

    .modal-bg .content {
        width: 7.2rem;
        height: 1.9rem;

    }

    .ffModal_bg {
        background-image: url('../img/ff_game_bg.jpg');
    }

    .gaModal_bg {
        background-image: url('../img/ga_game_bg.jpg');
    }
 
    .game-over {
        width: 6.57rem;
        height: 3.94rem;
        background-image: url('../img/game_over_en.png');

    }
    .switch_btn {  
     bottom: 0.2rem;   
    }
    .goback_btn {
        width: 2.32rem;
        height: 0.61rem;
        background-image: url('../img/goback_btn_en.png');
    
    }
    .restart_btn {
        width: 2.32rem;
        height: 0.61rem;
        background-image: url('../img/again_btn_en.png');
      
    }
}

/* 直屏模式 (width < height) */
@media screen and (orientation: portrait) {
    .loading-container {
        width: 7.5rem;
        height: 13.34rem;
        background-image: conic-gradient(from 0.28turn,
                #dbddee,
                #fdfefe 0.06turn,
                #eaebf5 0.14turn,
                #f8f0f8 0.2turn,
                #fff 0.3turn,
                #d4dde9 0.37turn,
                #eee7f1 0.44turn,
                #eaf6f9 0.53turn,
                #fdfefe 0.57turn,
                #f9f2f8 0.61turn,
                #f2eff8 0.69turn,
                #fdfefe 0.78turn,
                #f9f6fd 0.86turn,
                #fdfefe 0.91turn,
                #daddee 0.97turn);
    }

    .main-bg {
        width: 7.5rem;
        height: 13.34rem;
        background-image: url('../img/vertical/main_bg_en.jpg');
    }

    .ff-game-bg {
        width: 7.5rem;
        height: 13.34rem;
        background-image: url('../img/vertical/ff_game_bg.jpg');
    }

    .ga-game-bg {
        width: 7.5rem;
        height: 13.34rem;
        background-image: url('../img/vertical/ga_game_bg.jpg');
    }

    .modal-container {
        width: 7.5rem;
        height: 13.34rem;
    }

    .modal-bg {
        width: 7.38rem;
        height: 5.94rem;
        background-image: url('../img/vertical/ga_modal.png');
    }

    .ga_bg {
        background-image: url('../img/vertical/ga_modal.png');
    }

    .ff_bg {
        background-image: url('../img/vertical/ff_modal.png');
    }

    .main_start_btn {
        background-image: url('../img/vertical/main_start_en.png');
        bottom: 0.5rem;
    }

    .next_btn {
        background-image: url('../img/vertical/next_btn_en.png');
    }

    .finish_btn {

        background-image: url('../img/vertical/finish_btn_en.png');
    }

    .modal-bg .content {
        width: 5.2rem;
        height: 2.3rem;

    }

    .ffModal_bg {
        background-image: url('../img/vertical/ff_game_bg.jpg');
    }

    .gaModal_bg {
        background-image: url('../img/vertical/ga_game_bg.jpg');
    }
    .game-over {
        width: 6.78rem;
        height: 4.35rem;
        background-image: url('../img/vertical/game_over_en.png');

    }
    .switch_btn {  
        bottom: 0.6rem;   
       }
    .goback_btn {
        width: 2.61rem;
        height: 0.78rem;
        background-image: url('../img/vertical/goback_btn_en.png');
    
    }
    .restart_btn {
        width: 2.61rem;
        height: 0.78rem;
        background-image: url('../img/vertical/again_btn_en.png');
      
    }
  
}

/* 閃爍動畫定義 */
@keyframes blink {
    0% {
        opacity: 1;
    }

    15% {
        opacity: 0.5;
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}