html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;  /* 舊瀏覽器相容 */
    height: 100dvh; /* 確保 iOS Safari 與 Chrome 抓到完全一致的動態滿版高度 */
    overflow: hidden;
    position: relative;
}

#game-title {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    /* Center horizontally */
    width: 320px;
    /* Fit 75% of screen width */
    height: auto;
    /* Maintain aspect ratio */
    z-index: 5;
    /* Below video but above AR content */
    opacity: 0;
    /* Initially invisible for fade-in */
    transition: opacity 0.5s ease;
    /* Smooth fade animation */
}

#frameHints {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
}

#center-container {
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* background-color: rgb(239 245 235); */
    z-index: 5;
}

.myButton {
    background: transparent;
    border: none;
    cursor: pointer;

    position: absolute;
    width: 100%;
    bottom: 0px;
    padding: 0;
}

#landingPage {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    object-fit: cover !important;
    transform: none !important;
    display: block;
    /* Hidden initially */
}

.startBtn {
    width: 100%;
    /* height: 100%; */
    vertical-align: middle;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-dots div {
    width: 10px;
    height: 10px;
    margin: 0 4px;
    background-color: #3498db;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots div:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

#captureBtn {
    display: none;
    position: fixed; /* 使用固定定位 */
    bottom: calc(10px + env(safe-area-inset-bottom)); /* 自動加上 iOS 底部安全區域防線 */
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 80px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 1000;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

#captureBtn:active {
    transform: translateX(-50%) scale(0.92);
    /* subtle press effect */
    opacity: 0.85;
}

#home_title {
    width: 100%;
    margin: 0 auto;
    position: absolute;
    top: 7%;
}

button {
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
}

/* Ensure no effect on active or focus states */
button:focus,
button:active {
    outline: none;
    box-shadow: none;
    /* Remove any shadow */
    /* background: #007bff; */
    /* Keep consistent background */
    border: none;
    /* Keep consistent border */
}

/* === NEW STYLES FOR CAPTURE PREVIEW === */
.capture-preview-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 15px;
    box-sizing: border-box;
    touch-action: auto;
}

.capture-frame {
    padding: 14px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.75);
    max-width: 92vw;
    max-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.capture-img {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 60vh;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    pointer-events: auto;
}

.capture-message {
    margin-top: 18px;
    text-align: center;
    font-size: 15px;
    color: #eeeeee;
    padding: 0 10px;
}

.capture-close-btn {
    position: absolute;
    top: 35px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    z-index: 10001;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.capture-close-btn:active {
    background: rgba(255, 255, 255, 0.25);
}

#notice-container {
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 99999;
    position: absolute;
    display: none;
}

#notice_page {
    position: absolute;
    display: block;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    TEXT-ALIGN: center;
    font-size: 15px;
    width: 100%;
    color: white;
}

#whiteScreen {
    background-color: black;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    transition: opacity 0.1s ease;
    opacity: 0;
    display: none;
}

#switchCameraBtn {
    position: fixed;
    top: 30px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
    transition: all 0.2s ease;
}

#switchCameraBtn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.8);
}

#webcam-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    object-fit: cover;
    z-index: -1;
    background-color: #000;
}

/* 確保此處維持 fixed 定位，覆蓋之前錯誤的 absolute 設定 */
#captureBtn,
#switchCameraBtn {
    display: none;
    position: fixed; 
    z-index: 100;
}

#photoframe {
    position: absolute;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    object-fit: cover;
    object-position: center;
}

#photoframe-container {
position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh; /* 使用動態視高，與 body 和相機完全同步 */
    z-index: 1;
    pointer-events: none; /* 防止相框容器阻擋了按鈕的點擊事件 */
}