/* 座標以設計稿 1081x1921 為單位, --u 為設計稿 1px 對應的螢幕像素 (由 index.js 設定) */
@font-face {
    font-family: "TicketFont";
    /* 由 NotoSansCJKtc-VF.otf 取 Regular 字重並子集化 (Big5 常用字 + ASCII) */
    src: url("../font/NotoSansTC-Ticket.woff2") format("woff2");
    font-weight: 400;
    font-display: block;
}

html, body {
    background: #8fc3cc;
    touch-action: manipulation;
    overflow: hidden;
}

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.ui-container {
    --u: 0.3px;
    display: none;
    position: absolute;
    overflow: hidden;
}

.ui-container img {
    -webkit-user-drag: none;
    pointer-events: none;
}

/* 各頁背景: 由 index.js 切換 body 的 data-bg */
body {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body[data-bg="idle"] {
    background-image: url("../image/0待機畫面/待機素材_待機_背景.png");
}

body[data-bg="quiz"] {
    background-image: url("../image/1答題過程/答題過程_背景.png");
}

body[data-bg="info"] {
    background-image: url("../image/2登機資訊/登機資訊_背景.png");
}

body[data-bg="result"] {
    background-image: url("../image/3結果畫面/結果畫面_結果畫面_背景.png");
}

.abs {
    position: absolute;
}

.btn,
.ui-container img.btn,
.ui-container img.option {
    pointer-events: auto;
    cursor: pointer;
}

.bounce {
    animation: bounce 0.3s ease;
}

@keyframes bounce {
    0% { transform: scale(1); }
    40% { transform: scale(0.9); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 選取框: 疊在選項上方 */
.ui-container img.frame {
    display: none;
}

.ui-container img.frame.on {
    display: block;
}

/* 下一步: 未完成選擇前隱藏 */
.ui-container img.btn.hidden {
    display: none;
}

/* 標題淡入: 頁面由 display: none 切換為顯示時動畫會重新播放 */
.ui-container img.title {
    animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 登機資訊: 姓名輸入 */
#info-name {
    box-sizing: border-box;
    padding: 0 calc(var(--u) * 20);
    margin: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #000;
    text-align: center;
    font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    font-weight: 700;
    font-size: calc(var(--u) * 62);
    -webkit-user-select: text;
    user-select: text;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

#info-name::placeholder {
    color: #bbb;
    font-weight: 400;
    font-size: calc(var(--u) * 44);
}

/* 結果畫面: 登機證圖片可長按儲存 / 分享 */
.ui-container img#result-ticket {
    pointer-events: auto;
    -webkit-touch-callout: default;
    -webkit-user-select: auto;
    user-select: auto;
}

body:not(.kiosk) .kiosk-only,
body.kiosk .web-only {
    display: none;
}

/* 提示訊息 */
#toast {
    position: fixed;
    left: 50%;
    bottom: 24%;
    max-width: 80%;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9000;
}

#toast.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 手機橫放提示 */
#landscape-hint {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #033070;
    color: #fff;
    z-index: 9500;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.mobile.landscape #landscape-hint {
    display: flex;
}

.landscape-hint-icon {
    width: 40px;
    height: 64px;
    border: 4px solid #fff;
    border-radius: 8px;
    margin-bottom: 16px;
}

.landscape-hint-text {
    font-size: 18px;
}

#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#loading-overlay.active {
    display: flex;
}

#loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 開場預載進度 */
#preload-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

#preload-overlay.active {
    display: flex;
    flex-direction: column-reverse;
}

#preload-bar-wrap {
    width: 60%;
    max-width: 400px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

#preload-bar {
    width: 0%;
    height: 100%;
    background: #fff;
    transition: width 0.2s ease-out;
}

#preload-text {
    color: #fff;
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-size: 14px;
    letter-spacing: 1px;
}
