/* =============================================================================
   1. 基礎佈局與全域樣式 (Global Settings)
   ============================================================================= */
html {
    overflow-x: hidden;
}

body {
    font-family: Arial, "Microsoft JhengHei", sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    text-size-adjust: 100%;
    background-color: #97dbfe;    
    min-height: 110vh !important;
}

/* 建立一個鎖定在螢幕上的背景層 */
body::before {
    content: "";
    position: fixed;
    /* 🚀 關鍵修正：改用四邊 0 鎖定，不要只用 width/height 100% */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    /* 🚀 關鍵修正：解決 iOS 工具列伸縮導致圖片跳動 */
    height: 100lvh; /* 使用 lvh (Large Viewport Height) 確保圖片涵蓋最大範圍 */
    
    background: url('images/cgmh20182.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: -1;
    
    /* 防止背景層攔截任何滑動手勢，讓滑動直接傳遞給 body */
    pointer-events: none; 
    
    /* 避免背景圖片在滾動時因為渲染順序產生抖動 */
    will-change: transform; 
}

/* 🚀 統一寬度與置中規則（垂直節奏 20px，與各框架覆寫一致） */
header,
#scanner-section, 
.tabs, 
.selector {
    width: 92%;                      /* 使用百分比確保手機版適配 */
    max-width: 95%;     
    margin-left: auto !important;    /* auto 會自動平分左右空間，達成水平置中 */
    margin-right: auto !important;
    margin-top: 20px;
    margin-bottom: 20px;
    box-sizing: border-box;          /* 確保 Padding 不會撐破寬度 */
}

/* =============================================================================
   2. 頁首與統計顯示 (Header & Stats)
   ============================================================================= */
header {
    padding-top: env(safe-area-inset-top,30px); 
    padding-bottom: 15px; 
    padding-left:15px; 
    padding-right: 15px; 
    background: #2c7be5; 
    border: 1px solid #2c7be5; 
    border-radius: 20px; 
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.7); 
    color: white;
}

header h1 {
    margin-top: 10px; 
    margin-bottom: 5px; 
    font-size: 28px; 
    letter-spacing: 5px;
}

header p {
    margin-top: 0px; 
    margin-bottom: 10px; 
    font-size: 14px;
    letter-spacing: 1px;
}

/* 統計數據主容器 */
.stats-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 右對齊 */
    font-size: 11px;
    color: #FFFF00;        /* 統一設定 Emoji 與文字顏色 */
    margin-top: 5px;
    padding-right: 5px;
    line-height: 1.8;
}

/* 統計數據每一行的佈局 */
.stats-row {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* 針對統計項目中的文字與間距 */
.stats-display span {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-left: 10px;
    gap: 4px;
}

/* 固定數字的寬度 */
.stat-value {
    display: inline-block;
    color: #FFFFFF;
    font-weight: bold;
    width: 35px;       /* 🚀 設定固定寬度，確保四位數內都不會撐開排版 */
    text-align: center; /* 數字在自己的區塊內置中 */
    margin: 0 4px;     /* 數字與前後圖案、文字的間距 */
}

/* 數據數字統一設為白色 */
.stats-display b {
    color: #FFFFFF;
    font-weight: bold;
    display: inline-block;
    min-width: 2.5ch;
    text-align: right;
}

/* 尚未載入時不顯示 0，避免先跳 0 再更新 */
.stats-display b:not([data-stats-loaded="1"]) {
    visibility: hidden;
}

/* 衛教外殼與影片區預設隱藏 (僅限前端視覺，不影響後端 PHP 統計) */
#content,
#video-player-wrapper,
.video-area { 
    display: none; 
}

/* 當一進入網頁，#content 隱藏時，提示文字要「顯示」 */
#content {
    display: none;
}

/* 當 JavaScript 讓 #content 變成 block (顯示) 時，自動隱藏提示文字 */
#content[style*="block"] ~ .video-footer-notice {
    display: none !important;
}

/* =============================================================================
   3. 掃描辨識核心區塊 (Scanner Section)
   ============================================================================= */
/* 與上方框架（header／scanner／tabs／selector）同樣採 20px 垂直節奏；
   上緣不加多餘 margin（沿用 .selector 的 margin-bottom 20px），
   避免與標題文字量到的視覺間距疊加變大 */
#content {
    padding: 0 20px;
    max-width: 800px;
    margin: 0 auto 20px;
}

/* 未選檢查時的說明文字、諮詢頁導言：同樣 20px 框架間距 */
.video-footer-notice,
#consultContent {
    padding: 0 20px;
    max-width: 800px;
    margin: 20px auto;
    box-sizing: border-box;
}

.video-footer-notice h2,
#consultContent h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.video-footer-notice p,
#consultContent p {
    margin-top: 0;
}

/* 外層容器數據 */
#scanner-section {
    margin: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: visible;
}

.scanner-title {
    font-size: 24px;
    margin-top: 5px;
    margin-bottom: 15px;
}

/* 隱私宣告 */
.privacy-container {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    padding: 5px 10px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: inline-block;
}
.privacy-text {
    font-size: 12px;
    color: #0056b3;
    margin: 0;
    line-height: 1.4;
}

/* 提示與導引按鈕 */
.guide-prompt-area {
    text-align: center;
    margin-top: -5px;
}
.guide-instruction {
    font-size: 14px;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 10px;
    font-weight: bold;
}
/* OCR 辨識區「代碼在哪裡？」「檢查室在哪裡？」：還原淺底藍字（暗綠改錯處） */
.btn-where-code {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    color: #2c7be5;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 4px 12px;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

/* OCR「代碼在哪裡？」彈窗 — 共用 AR vsh-sheet 骨架（還原見 Instruction Manual/佈景樣式變更紀錄.md） */
#guide-image-area.vsh-sheet-scrim {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.guide-sheet-card {
    /* AR .vsh-nav-stack 估算總高 ≈ 322px；非圖片區 = 16+24+12+12+26+16 = 106px */
    --guide-popup-target-height: 322px;
    --guide-chrome-height: 106px;
}

.guide-img-frame {
    container-type: inline-size;
    position: relative;
    border-radius: 8px;
    border: 1px solid #ccc;
    line-height: 0;
    overflow: hidden;
}

.guide-sheet-card .guide-sample-img {
    width: 100%;
    height: min(
        calc(100cqw * 1834 / 1967),
        calc(var(--guide-popup-target-height) - var(--guide-chrome-height))
    );
    object-fit: cover;
    object-position: top center;
    display: block;
    border-radius: 8px;
    filter: brightness(0.7) contrast(1.4) saturate(1.1);
}

/* 「代碼在哪裡」我知道了：藍色同衛教諮詢分頁 active（#2c7be5），尺寸維持原 OCR 彈窗 */
.guide-popup-btn.vsh-btn--primary {
    width: auto;
    height: auto;
    font-size: 12px;
    padding: 5px 15px;
    border-radius: 15px;
    align-self: center;
    color: #fff;
    background: #2c7be5;
    background-image: none;
    box-shadow: 0 2px 6px rgba(44, 123, 229, 0.28);
}

/* --- AR 導航設定彈窗（vsh-sheet）--- */
.vsh-sheet-scrim {
    position: absolute;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.vsh-sheet-card {
    width: 100%;
    max-width: 300px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.vsh-sheet-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px 8px;
    flex-shrink: 0;
}

.vsh-sheet-icon {
    font-size: 22px;
    color: #2c7be5;
    flex-shrink: 0;
}

.vsh-sheet-title {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 1px;
    white-space: nowrap;
}

.vsh-sheet-body {
    padding: 0 16px;
    flex: 0 1 auto;
    min-height: 0;
}

.vsh-sheet-body--media {
    padding-bottom: 4px;
}

.vsh-sheet-body--form {
    padding-top: 4px;
    padding-bottom: 8px;
}

.vsh-field {
    margin-bottom: 12px;
}

.vsh-field:last-child {
    margin-bottom: 0;
}

.vsh-field label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #777;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.vsh-select {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border-radius: 20px;
    border: 1px solid #d8d8d8;
    background: #f5f7fa;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.vsh-sheet-footer {
    padding: 10px 16px 14px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.vsh-sheet-footer--stack {
    flex-direction: column;
    gap: 8px;
}

.vsh-btn {
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: transform 0.1s ease;
}

.vsh-btn:active {
    transform: scale(0.98);
}

.vsh-btn--primary {
    width: 100%;
    height: 42px;
    color: #fff;
    background: linear-gradient(135deg, #fd9d52 0%, #fdfc47 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.vsh-btn--secondary {
    width: 100%;
    height: 38px;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
}

.vsh-btn--ghost {
    min-width: 112px;
    height: 36px;
    padding: 0 22px;
    color: #2c7be5;
    background: rgba(44, 123, 229, 0.08);
    border: 1px solid rgba(44, 123, 229, 0.22);
}

/* AR 導航設定彈窗：無黑色透明遮罩，只顯示白卡 */
#nav-setup-scrim.vsh-sheet-scrim,
#nav-feature-scrim.vsh-sheet-scrim {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* AR 導航設定彈窗：標題純文字、全區統一間距 */
.vsh-sheet-card--nav {
    --vsh-nav-gap: 12px;
    /* 與第二層（智能路線導航設定）同寬同高 */
    --vsh-nav-sheet-width: 300px;
    --vsh-nav-sheet-height: 322px;
    width: var(--vsh-nav-sheet-width);
    max-width: var(--vsh-nav-sheet-width);
    height: var(--vsh-nav-sheet-height);
    max-height: var(--vsh-nav-sheet-height);
    box-sizing: border-box;
}

.vsh-nav-stack {
    display: flex;
    flex-direction: column;
    gap: var(--vsh-nav-gap);
    padding: 16px;
    height: 100%;
    box-sizing: border-box;
}

.vsh-nav-stack--feature {
    justify-content: space-between;
    gap: 0;
}

.vsh-nav-title {
    margin: 0;
    padding: 0;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 1px;
    text-align: center;
}

.vsh-sheet-card--nav .classic-4color-gradient {
    width: auto !important;
}

.vsh-nav-label {
    margin: 0;
    font-size: 12px;
    font-weight: bold;
    color: #777;
    letter-spacing: 1px;
}

.vsh-sheet-card--nav .vsh-select,
.vsh-sheet-card--nav .vsh-btn {
    margin: 0;
}

/* 第一層：功能名稱（彈丸型按鈕，保留主色）與註解分開 */
.vsh-feature-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.vsh-feature-pill {
    height: 42px;
    border-radius: 21px;
    line-height: 1;
}

/* 「檢查室在哪裡？」第一層：兩選項分色＋圖標 */
#nav-feature-route-btn.vsh-btn--primary,
#nav-feature-tour-btn.vsh-btn--primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#nav-feature-route-btn.vsh-btn--primary {
    background: linear-gradient(135deg, #1b5e20 0%, #43a047 100%);
    box-shadow: 0 1px 4px rgba(27, 94, 32, 0.25);
}
/* 室內地圖導覽：方案 C 鮮橘→淺橘（與智能路線導航綠區隔） */
#nav-feature-tour-btn.vsh-btn--primary {
    background: linear-gradient(135deg, #ff6d00 0%, #ff9100 50%, #ffab40 100%);
    box-shadow: 0 1px 4px rgba(255, 109, 0, 0.3);
}
#nav-feature-route-btn .vsh-feature-btn-icon,
#nav-feature-tour-btn .vsh-feature-btn-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: block;
}

.vsh-feature-desc {
    margin: 0;
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0;
    line-height: 1.4;
    text-align: center;
}

/* =============================================================================
   4. 相機組件樣式 (Camera Component)
   ============================================================================= */
/* 相機容器 */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
}
#camera {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: none;
    background: #000;
}

/* 按鈕組數據 */
.camera-btn-group {
    margin-top: 15px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 95%;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

/* 相機按鈕文字 */
#btn-text {
    font-size: 16px ;
    color: #2c7be5 ;
    font-weight: bold;
    letter-spacing: 5px;
    padding-left: 5px;
    white-space: nowrap;
}

#btn-text.is-ocr-loading {
    letter-spacing: 1px;
    font-size: 15px;
}

/* 辨識、暫停、返回按鈕的通用樣式 */
.camera-btn-group button:not(#start-cam-btn) {
    flex: 1 1 0;
    max-width: 140px;
    min-width: 0;
    height: 40px;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

#scan-btn { background: #28a745; }
#stop-btn { background: #dc3545; }
#back-btn { background: #2c7be5; }

#scan-status { margin-top: 15px; font-weight: bold; }

/* OCR 暫停／失敗黃色提示（字級可跟隨顯示大小） */
.vsh-fail-notice {
    background: rgba(255, 234, 0, 0.9);
    color: black;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    display: inline-block;
    width: auto;
    max-width: 85%;
    margin: 10px auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    line-height: 1.8;
    border: 1px solid #d9534f;
}

.vsh-fail-notice-emoji {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 0.35em;
}

.vsh-fail-notice b {
    vertical-align: middle;
}

.vsh-fail-notice-check,
.vsh-fail-notice-em {
    color: #d9534f;
}

/* OCR 辨識成功／注意事項（字級可跟隨顯示大小） */
.vsh-ocr-success-title {
    font-size: 20px;
    color: green;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
    line-height: 1.4;
}

.vsh-ocr-result {
    text-align: center;
    padding: 10px 0;
    margin-top: -15px;
}

.vsh-ocr-code {
    color: #666;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 10px;
    font-family: monospace;
    line-height: 1.4;
}

.vsh-ocr-prep,
.vsh-ocr-prep-body {
    line-height: 1.8;
    font-size: 15px;
    color: #333;
    font-weight: bold;
}

.vsh-ocr-prep-heading {
    color: #333;
}

.vsh-ocr-prep-em {
    color: red;
    font-weight: bold;
}

#start-cam-btn.is-retry-cam,
#start-cam-btn.is-retry-cam #btn-text {
    font-size: 14px;
}

/* OCR 引擎載入進度（相機按鈕下方，毛玻璃外框 + 進度條） */
.ocr-engine-loader {
    width: 92%;
    max-width: 340px;
    margin: 10px auto 0;
    padding: 10px 14px 12px;
    border-radius: 16px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.28) 0%,
        rgba(255, 255, 255, 0.10) 45%,
        rgba(120, 120, 128, 0.18) 100%
    );
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.ocr-engine-loader-text {
    font-size: 13px;
    font-weight: bold;
    color: #007AFF;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.ocr-engine-loader-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
}

.ocr-engine-loader-bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #007AFF 0%, #5AC8FA 100%);
    transition: width 0.25s ease;
}
#result { font-size: 11px; color: #999; word-break: break-all; opacity: 0.7; }

/* =============================================================================
   5. 頁尾語系導引 (Footer & Language Guide)
   ============================================================================= */
/* Footer 外層 */
.footer-container {
    margin-top: 20px; /* 與框架間距 1–4 同一 20px 節奏（間距 5） */
    padding: 0px 10px;
    border-top: 1px solid #eee;
    text-align: center;
    background-color: #fcfcfccc;
    /* 字體設定完整還原 */
    font-family: -apple-system, system-ui, BlinkMacSystemFont, sans-serif;
}

/* 內容最大寬度限制 */
.footer-content {
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 標題：Language Guide */
.footer-lang-title {
    color: #333;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* 語系操作細節文字顏色與字級 */
.footer-lang-details {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
}

/* iPhone/Android 每一行的間距 */
.lang-item {
    margin-bottom: 4px;
}

/* 特殊按鈕圖示樣式 (如 AA, ≣) */
.key-cap {
    background: #eee;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: bold;
}

.key-icon {
    background: #eee;
    padding: 1px 3px;
    border-radius: 4px;
}

.key-bold {
    font-weight: bold;
}

/* 最後一行文字 */
.lang-last {
    /* 這裡維持預設，不加 margin-bottom */
}

/* 藍色 AI 提示區塊 */
.footer-ai-tip {
    color: #007AFF;
    font-weight: 600;
    margin: 0;
    font-size: 12px;
    padding: 8px 12px;
    background-color: #f0f7ff;
    border-radius: 12px;
    display: inline-block;
    max-width: 90%;
    /* 處理文字溢出不換行 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =============================================================================
   6. 分頁導覽系統 (Tabs Navigation)
   ============================================================================= */
.tabs {
    margin: 20px auto;                             /* 上下留 20px，auto 負責水平置中 */
    padding: 15px;
    background: transparent; 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px);
    border-radius: 50px;                           /* 足夠大的圓角，創造膠囊感 */
    border: 1px solid #e0e0e0;                     /* 淡淡的邊框，增加精緻度 */
    display: flex;                                 /* 讓內部的按鈕左右並排 */
    
    /* 🚀 整合修正：增加換行許可，防止翻譯後擠壓 */
    flex-wrap: wrap;                               /* 空間不足時自動換行，避免重疊 */
    
    padding: 5px;                                  /* 讓內部的按鈕跟外框留一點點縫隙 */
    overflow: hidden;                              /* 確保內部按鈕的直角不會刺穿外框的圓角 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);     /* 讓它有一點懸浮感 */
}

.tab-btn {
    flex: 1 1 50%;                                 /* 原始數據：預設各佔一半 */
    
    min-width: 0;
    height: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    
    padding: 15px 4px;
    border: none;
    background: none;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 10px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
    background-color: #2c7be5;                     /* 原始數據：改用填滿色 */
    color: white;                                  /* 原始數據：文字變白 */
    
    /* 🚀 修正殘影：調整圓角邏輯，使其完美貼合外框，不產生像素溢出 */
    border-radius: 45px;                           /* 稍微縮小半徑，使其在 padding 內完美貼合 */
    
    transition: none;                              /* 🚀 修正：Active 狀態不使用動畫，解決殘影問題 */
}

.tab-content {
    animation: fadeIn 0.4s ease-in-out;
}

/* =============================================================================
   🌍 語系補償：字級由 JS 依欄寬自動縮放（見 script.js refreshAdaptiveUILayout）
   - 中文：分頁標題預設略大；外語維持原字級，交由 JS 再縮放
   ============================================================================= */

html[lang="zh"] .tab-btn,
html[lang="zh-TW"] .tab-btn,
html[lang="zh-Hant"] .tab-btn,
html:not([lang]) .tab-btn {
    font-size: 22px;
}

html:not([lang="zh"]):not([lang="zh-TW"]):not([lang="zh-Hant"]) .tabs {
    border-radius: 25px;
}

html:not([lang="zh"]):not([lang="zh-TW"]):not([lang="zh-Hant"]) .tab-btn.active {
    border-radius: 20px;
}

/* =============================================================================
   7. 下拉選單與輸入組件 (Selectors & Inputs)
   ============================================================================= */
/* --- 下拉選單外框容器 --- */
.selector { 
    margin: 20px; 
    padding: 15px; 
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid #e0e0e0;
    border-radius: 50px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.4); 
}

/* --- 選單欄位上方標語文字 --- */
.slogan-text {
    display: block;
    font-size: 14px;
    letter-spacing: 2px;
    color: #666;
    margin-bottom: 12px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
}

/* --- 統一欄位佈局容器 --- */
.selector-row {
    display: flex; 
    gap: 10px; 
    justify-content: center; 
    max-width: 500px; 
    margin: 0 auto;
}

/* --- 下拉選單與輸入框樣式 --- */
.selector-row select, 
.selector-row input {
    flex: 1 1 50%;
    width: 50%;
    min-width: 0;
    height: 38px;            
    font-size: 17px; 
    letter-spacing: 5px;        
    padding: 0 10px;         
    border: 2px solid #e0e0e0;
    color: #fff;
    font-weight: bold;
    border-radius: 20px;      
    background-color:  rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    text-align: center;
    -webkit-appearance: none; /* 移除 iOS 預設樣式 */
    appearance: none; /* 移除 Android 預設樣式 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 影片上方檢查名稱 + 點閱次數（flex 避免英文重疊）
   上下留白不靠標題自身撐高，改由外側 20px 節奏（與框架間距 1–3 相同） */
#examTitle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    margin: 0;
    gap: 8px;
    padding: 0 2px;
    box-sizing: border-box;
    line-height: 1.2;
}

/* 選單選定後標題：基準字級隨顯示大小；過寬時由 JS fitExamNameTitle 再內聯縮小 */
#examNameText {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    max-width: 100%;
    white-space: nowrap;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    font-size: calc(18px * var(--vsh-font-scale, 1));
}

@media (max-width: 480px) {
    #examNameText {
        font-size: calc(16px * var(--vsh-font-scale, 1));
    }
}

#examCountText {
    flex: 0 0 auto;
    font-size: 12px;
    color: #333;
    font-weight: bold;
    white-space: nowrap;
    line-height: 1.2;
}

/* 自定義下拉箭頭圖示 */
.selector-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23FFF' d='M1 4l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

select {
    text-align: center;
    text-align-last: center; /* 這是針對某些瀏覽器顯示選中項目的關鍵 */
    padding-left: 0;
    padding-right: 0;
}

/* =============================================================================
   8. 相機入口 UI (Camera Entry UI)
   ============================================================================= */
/* 外層容器：負責整體間距 */
.camera-entry-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 5px;
}

/* 相機底框樣式 */
.camera-icon-bg {
    width: 60px;
    height: auto !important; 
    min-height: 140px;      
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible !important; 
    padding: 25px 10px;     
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    -webkit-backface-visibility: hidden;
    transition: opacity 0.3s ease;
}

/* 啟動按鈕本體 */
#start-cam-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;      
    border: none;
    width: 20%;
    height: auto;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent; /* 🚀 核心修正：移除 iOS 點擊閃爍 */
    outline: none;
}

/* 圖示圓形外圈 */
#btn-icon-wrapper {
    background: #2c7be5 !important;   
    width: 60px;
    height: 60px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px; 
    box-shadow: 0 4px 10px rgba(0, 162, 255, 0.8);
    -webkit-appearance: none;
    transform: translateZ(0); 
}

/* Material Icons 圖示微調 */
#btn-icon-wrapper .material-icons {
    font-size: 32px !important;
    color: white !important;
}

/* =============================================================================
   9. 智能辨識實時介面 (Camera Live Interface)
   ============================================================================= */
/* iPhone 式透視遮罩：黃框外半透明暗角，凸顯對準範圍 */
.ocr-scan-mask {
    position: absolute;
    inset: 0;
    z-index: 400;
    pointer-events: none;
    --ocr-hole-w: 260px;
    --ocr-hole-h: 120px;
}
.ocr-mask-band {
    position: absolute;
    background: rgba(0, 0, 0, 0.52);
}
.ocr-mask-top {
    top: 0;
    left: 0;
    right: 0;
    height: calc(50% - (var(--ocr-hole-h) / 2));
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.62) 0%,
        rgba(0, 0, 0, 0.48) 100%
    );
}
.ocr-mask-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(50% - (var(--ocr-hole-h) / 2));
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.62) 0%,
        rgba(0, 0, 0, 0.48) 100%
    );
}
.ocr-mask-left {
    top: calc(50% - (var(--ocr-hole-h) / 2));
    height: var(--ocr-hole-h);
    left: 0;
    width: calc(50% - (var(--ocr-hole-w) / 2));
    background: rgba(0, 0, 0, 0.5);
}
.ocr-mask-right {
    top: calc(50% - (var(--ocr-hole-h) / 2));
    height: var(--ocr-hole-h);
    right: 0;
    width: calc(50% - (var(--ocr-hole-w) / 2));
    background: rgba(0, 0, 0, 0.5);
}

/* 水平儀/輔助線容器 */
#level-container {
    position: absolute;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 200px;
    height: 100px;
    z-index: 999;
    pointer-events: none;
}

/* 掃描框引導視覺效果 */
#scan-guide-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    height: 120px;
    background:
        linear-gradient(to right, #ffea00 6px, transparent 6px) 0 0,
        linear-gradient(to bottom, #ffea00 6px, transparent 6px) 0 0,
        linear-gradient(to left, #ffea00 6px, transparent 6px) 100% 0,
        linear-gradient(to bottom, #ffea00 6px, transparent 6px) 100% 0,
        linear-gradient(to right, #ffea00 6px, transparent 6px) 0 100%,
        linear-gradient(to top, #ffea00 6px, transparent 6px) 0 100%,
        linear-gradient(to left, #ffea00 6px, transparent 6px) 100% 100%,
        linear-gradient(to top, #ffea00 6px, transparent 6px) 100% 100%;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    /* 入場動畫，跑一次就停止 */
    animation: focusEntrance 0.8s ease-out forwards; 
    opacity: 0; 
}

.scan-anim-active {
    animation: focusEntrance 0.8s ease-out forwards,
               scanBreath 5s infinite ease-in-out 0.8s !important;
    opacity: 1;
}

/* 掃描中心十字準星線 */
.cross-line {
    position: absolute;
    background: rgba(255, 234, 0, 0.6);
    top: 50% !important;
    left: 50% !important;
}

.line-h {
    width: 180px;
    height: 3px;
    transform: translate(-50%, -50%);
}

.line-v {
    width: 2px;
    height: 60px;
    transform: translate(-50%, -50%);
}

/* =============================================================================
   10. 相機疊層文字提示 (Camera Overlay Text)
   ============================================================================= */
/* --- 相機畫面內的提示文字 --- */
#instruction-text {
    position: absolute;    
    top: 15px;             
    left: 50%;             
    transform: translateX(-50%); 
    width: 90%;            
    max-width: 400px;      
    padding: 0;        
    color: #FFD700;        
    font-weight: bold;     
    font-size: 16px;       
    letter-spacing: 2px;   
    text-align: center;    
    z-index: 2000;         
    background: none; 
    border-radius: 8px;    
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); 
    pointer-events: none;  
    white-space: normal;   
    line-height: 1.4;      
}

/* 「陰影」略放大突顯（勿過搶） */
#instruction-text .vsh-instr-shadow {
    font-size: 1.2em;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.85), 1px 1px 3px rgba(0, 0, 0, 0.9);
}

/* --- 相機下緣的狀態文字 (正在啟動 / 辨識中) --- */
#status-text {
    position: absolute;    
    bottom: 15px;          
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    z-index: 1010;         
    color: #FFD700;        
    font-size: 16px;
    letter-spacing: 2px;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

/* 暫停辨識：隱藏黃字／黃框／十字；紅字放大置中，與「辨識中」明顯區隔 */
.camera-container.is-ocr-paused #instruction-text {
    display: none !important;
}
.camera-container.is-ocr-paused #level-container {
    display: none !important;
}
.camera-container.is-ocr-paused #ocr-scan-mask {
    display: none !important;
}
.camera-container.is-ocr-paused #status-text {
    top: 50%;
    bottom: auto;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    max-width: 360px;
    font-size: 24px;
    line-height: 1.35;
    letter-spacing: 1px;
    color: #FF4D4D !important;
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.85),
        1px 1px 4px rgba(0, 0, 0, 0.95);
    z-index: 2020;
}

/* =============================================================================
   11. 智能客服與 FAQ 樣式 (Chatbot & FAQ)
   ============================================================================= */
/* FAQ 單個項目外框 */
.faq-item {
    background: white;
    margin: 10px 0;
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

#consult-faq {
    box-sizing: border-box !important;    /* 🚀 強制撐開：確保在手機上內容能流動 */
    width: 100% !important;
    max-width: 800px !important;
    margin: 0 auto !important;
    display:none; 
    text-align:left; 
    padding: 10px 20px;
}

/* 諮詢 FAQ 標題列與題目（字級跟隨顯示大小） */
.faq-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 4px solid #2c7be5;
    padding-bottom: 8px;
    /* 100%：對齊 PR37（原 inline margin-top:-15px） */
    margin-top: -15px;
    margin-bottom: 20px;
    gap: 8px;
}

/* >100%：保留 PR49 防裁切（拿掉負 margin） */
html:not([data-vsh-display-scale="100"]) .faq-section-head {
    margin-top: 0;
}

.faq-section-head-main {
    text-align: left;
    min-width: 0;
}

.faq-section-title {
    font-size: 18px;
    margin: 0;
    color: #333;
    line-height: 1.35;
}

.faq-section-subtitle {
    color: #666;
    font-weight: bold;
    font-size: 12px;
    line-height: 1.4;
}

.faq-section-count {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    margin-left: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.faq-item-card {
    margin-bottom: 12px;
    border: 1px solid #eee;
    border-radius: 60px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    background: #fff;
}

.faq-q-row {
    background: rgba(44, 123, 229, 0.08);
    padding: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    text-align: left;
}

.faq-q-wrap {
    font-weight: bold;
    color: #1a5ab5;
    display: flex;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.faq-q-mark {
    font-size: 20px;
    margin-right: 10px;
    line-height: 1;
    flex-shrink: 0;
}

.faq-q-title {
    line-height: 1.4;
    font-size: 17px;
    letter-spacing: 0.8px;
}

.faq-q-chevron {
    color: #284;
    transition: transform 0.3s;
    font-size: 10px;
    margin-left: 10px;
    flex-shrink: 0;
}

.faq-a-panel {
    padding: 10px;
    background: #F2F7F2;
    border-top: 1px solid #eee;
    text-align: left;
}

.faq-a-wrap {
    display: flex;
    align-items: flex-start;
}

.faq-a-mark {
    font-size: 19px;
    font-weight: bold;
    color: #284;
    margin-right: 12px;
    flex-shrink: 0;
}

.faq-a-body {
    line-height: 1.6;
    min-width: 0;
}

.faq-main-answer {
    color: #333;
    font-weight: bold;
    font-size: 16px;
    white-space: pre-wrap;
}

.faq-full-answer {
    margin-top: 10px;
    color: #555;
    font-size: 15px;
    font-weight: bold;
    border-top: 1px dotted #2c7be5;
    padding-top: 2px;
    white-space: pre-wrap;
}

/* 智能客服懸浮容器
   pointer-events: none 讓隱藏氣泡佔位時，觸控可穿透到下層頁面；
   僅圖示本身再開啟可點擊。
   不進 #vsh-zoom-root；縮放由 --vsh-apo-zoom 控制（上限 125%）。 */
.apo-bot {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    pointer-events: none;
    -webkit-transform: scale(var(--vsh-apo-zoom, 1));
    transform: scale(var(--vsh-apo-zoom, 1));
    -webkit-transform-origin: bottom right;
    transform-origin: bottom right;
    will-change: transform;
}

/* 客服對話氣泡樣式：改為絕對定位，避免隱藏時仍撐開容器熱區 */
.apo-talk-bubble {
    position: absolute;
    right: 70px;
    bottom: 0;
    background: white;
    padding: 8px 15px;
    border-radius: 30px;
    font-size: 13px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid #eee;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: 0.4s;
    pointer-events: none;
}

/* 當處於辨識中或輸入中時，強制氣泡消失（含關閉手機呼吸燈動畫） */
.apo-talk-bubble.force-hide {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(10px) scale(0.8) !important; /* 縮小並往右側藏 */
    pointer-events: none !important; /* 確保點擊穿透 */
    animation: none !important;
    transition: all 0.3s ease;
}

/* 客服圓形圖示容器：唯一可接收點擊／觸控的區域 */
.apo-icon-container {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #00847b;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* 懸停時顯示對話氣泡 */
.apo-bot:hover .apo-talk-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(-5px);
}

.apo-icon-container img {
    width: 85%;
    height: auto;
}

/* =============================================================================
   12. 視覺美化：漸層與動畫 (Visuals & Animations)
   ============================================================================= */
/* --- 漸層標題組 --- */
.smart-gradient-title {
    background: linear-gradient(to right, #4b2c82 0%, #6a5acd 45%, #2d3e91 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    font-size: 22px !important;
    display: inline-block !important;
    font-family: "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
    filter: drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.1));
    margin: 0;
    padding: 2px 0;
}

.classic-4color-gradient {
    background: linear-gradient(to right,#0000FF 25%, #87CEFA 38%, #00FFFF 48%, #FFD700 53%, #FFB347 58%, #FFB6C1 68%, #FF0000 78%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    font-weight: 900 !important;
    display: block !important;
    text-align: center;
    width: 100%;
    letter-spacing: 1px;
}

/* --- 動畫 Keyframes --- */
@keyframes scanBreath {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.7; }
}

@keyframes focusEntrance {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mobilePulseReminder {
    0%, 5% { opacity: 0; visibility: hidden; }
    10%, 25% { opacity: 1; visibility: visible; }
    30%, 100% { opacity: 0; visibility: hidden; }
}

/* =============================================================================
   13. 行動裝置適配與修正 (RWD Fixes)
   ============================================================================= */
/* 針對 Android 字體鎖定修正 */
#formatted-result, .faq-answer {
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
    line-height: 1.5 !important;
    max-height: 999999px;
}

/* --- 橫向模式鎖定 --- */
/* 🚀 移除原本的媒體查詢，改用全域鎖定 */
html, body {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* 針對橫向模式的 FAQ 特殊補強 */
@media screen and (orientation: landscape) {
    /* 確保所有文字容器都遵循 100% */
    * {
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }

    /* 針對你提到的 FAQ 答案區與結果區 */
    #formatted-result p, 
    #formatted-result div, 
    .faq-answer,
    .faq-item * { 
        line-height: 1.6 !important;
        /* 🚀 移除 max-height: 999999px，改用下面這行穩定版面 */
        overflow-wrap: break-word; 
    }
}

/* --- 手機版選單排版微調 --- */
@media screen and (max-width: 480px) {
    .selector-row { gap: 8px; }
    .selector-row select, .selector-row input { height: 36px; font-size: 14px; padding: 0 8px; }
    .selector-row select { background-position: right 8px center; padding-right: 22px; }
    .slogan-text { font-size: 13px; }
}

/* --- 手機版智能客服位置修正（呼吸燈提示，不影響觸控穿透） --- */
/* 直立式再貼底；橫式維持抬高，避免遮到系統列／內容；電腦版仍用預設 20px */
@media screen and (max-width: 768px) {
    .apo-talk-bubble { animation: mobilePulseReminder 30s infinite !important; }
}
@media screen and (max-width: 768px) and (orientation: portrait) {
    .apo-bot { bottom: 8px !important; }
}
@media screen and (max-width: 768px) and (orientation: landscape) {
    .apo-bot { bottom: 45px !important; }
}

/* 針對手機窄螢幕的微調(FAQ分頁)；縮放時改由下方 --vsh-font-scale 規則接管 */
@media (max-width: 480px) {
    html[data-vsh-display-scale="100"] #consult-faq h3,
    html:not([data-vsh-display-scale]) #consult-faq h3 {
        font-size: 1.1rem !important; /* 標題小一點，避免折行太嚴重 */
    }
    html[data-vsh-display-scale="100"] .faq-q-title,
    html:not([data-vsh-display-scale]) .faq-q-title {
        font-size: 15px !important;
    }
    html[data-vsh-display-scale="100"] .faq-main-answer,
    html:not([data-vsh-display-scale]) .faq-main-answer {
        font-size: 15px !important;
    }
}

/* =============================================================================
   14. 影片組件與預覽 (Video Preview)
   ============================================================================= */
/* 子項目翻頁：影片容器左右箭頭 + 下方提示文字
   margin-top 20px = 標題下方間距，與框架間距 1–3／標題上方同一節奏 */
.video-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 480px;
    margin: 20px auto 8px;
    gap: 6px;
}

.video-stage.has-sub-nav {
    max-width: 520px;
}

/* Liquid Glass 共用：翻页箭头 + 封面播放钮 */
.sub-item-nav-btn,
.video-cover-play-btn {
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.28) 0%,
        rgba(255, 255, 255, 0.10) 45%,
        rgba(120, 120, 128, 0.22) 100%
    );
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -1px 0 rgba(0, 0, 0, 0.06);
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.sub-item-nav-btn:hover,
.video-cover-play-btn:hover {
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.36) 0%,
        rgba(255, 255, 255, 0.14) 45%,
        rgba(120, 120, 128, 0.28) 100%
    );
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.52),
        inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.sub-item-nav-btn {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    color: rgba(72, 72, 78, 0.88);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.sub-item-nav-btn:active,
.video-cover-play-btn:active {
    transform: scale(0.94);
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.20) 0%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(100, 100, 108, 0.26) 100%
    );
}

.sub-item-nav-hint {
    display: none;
    text-align: center;
    font-size: 13px;
    color: #007AFF;
    font-weight: bold;
    margin: 0 auto 16px;
    max-width: 92%;
    line-height: 1.5;
}

.video-stage .video-container {
    flex: 1 1 auto;
    width: auto;
    max-width: 400px;
    margin: 0;
}

/* 影片預覽圖外殼：直式手機比例（9:16 為預設，載入後依影片/封面實際尺寸覆寫） */
.video-container {
    position: relative;
    width: 92%;
    max-width: 400px;
    margin: 20px auto;
    aspect-ratio: 9 / 16;
    border-radius: 20px;
    overflow: hidden;
    background-color: transparent;
    border: 1px solid #e0e0e0; 
    box-shadow: 0 4px 10px rgba(44, 123, 229, 0.8);
}

/* 裡面的影片：完整顯示直立畫面，不裁切 */
.video-container video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: transparent;
}

/* =============================================================================
   🔍 搜尋浮層專用樣式 (完整隔離版：確保不影響首頁開啟相機按鈕)
   ============================================================================= */

/* 1. 最外層半透明背景遮罩 */
#full-screen-search.vsh-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overscroll-behavior: none;
}

/* 2. 搜尋主方框 (對齊 .selector 質感：20% 透明白 + 磨砂) */
#full-screen-search .vsh-search-modal {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    padding: 15px; 
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    max-height: 85%;
    overflow: hidden;
    display: flex; 
    flex-direction: column;
}

/* 🚀 搜尋頭部容器：確保返回鍵與輸入框並排且不溢出 */
#full-screen-search .vsh-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

/* 3. 搜尋輸入框本體 (白色高對比背景) */
#full-screen-search .vsh-search-input-field {
    flex: 1;
    min-width: 0;
    height: 48px;
    border-radius: 25px;
    border: 2px solid white;
    padding: 0 18px;
    font-size: 17px;
    outline: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-weight: bold;
    letter-spacing: 1px;
}

/* 4. 輸入框 Placeholder */
#full-screen-search .vsh-search-input-field::placeholder {
    color: #666;
    font-weight: bold;
    letter-spacing: 1px;
}

/* 5. 返回按鈕 (精確隔離：防止推擠首頁佈局) */
#full-screen-search .vsh-search-back-btn {
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap; /* 確保「返回」不換行 */
    padding: 5px 0 5px 10px;
    display: inline-block;
    flex-shrink: 0; /* 禁止縮小，確保點擊範圍 */
    letter-spacing: 2px;
}

/* 6. 中間提示標題 (☘️ 您可以嘗試搜尋...)：100% 還原 PR37 間距／字級 */
#full-screen-search .vsh-search-hint-text {
    text-align: center;
    color: white;
    padding: 10px 0;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 翻譯模式提示：對齊 PR37 原 inline（13px／opacity 0.75） */
#full-screen-search .vsh-search-hint-text--locale {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.75;
    margin-bottom: 12px;
    padding: 0;
    text-shadow: none;
}

/* 9. 搜尋引導清單：左右切齊搜尋列（含返回）；列距略加大 */
#full-screen-search .vsh-search-hint-box {
    padding: 0;
    margin-top: -5px;
}

#full-screen-search .vsh-search-hint-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#full-screen-search .vsh-search-hint-list li {
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 14px;
    /* 彈丸形：與搜尋列圓角語彙一致；單行不換行以免放大後變兩行 */
    border-radius: 999px;
    color: white;
    font-size: 15px;
    box-sizing: border-box;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

/* 7. 搜尋結果滾動區 */
#full-screen-search .vsh-search-results-container {
    flex: 1;
    overflow-y: auto;
    text-align: left;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* 全螢幕搜尋專用鎖捲：不共用教學 vsh-tour-scroll-lock，且不對 html 設 touch-action:none（否則建議清單滑不了） */
html.vsh-search-scroll-lock,
html.vsh-search-scroll-lock body,
body.vsh-search-scroll-lock {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

/* 8. 搜尋結果單筆項目 */
#full-screen-search .search-result-item {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#full-screen-search .search-result-title {
    font-weight: bold;
    color: white;
    font-size: 16px;
    letter-spacing: 1px;
}

#full-screen-search .search-result-category {
    color: rgba(255, 255, 255, 0.7);
    font-weight: bold;
    font-size: 12px;
}

#full-screen-search .search-result-arrow {
    color: rgba(255, 255, 255, 0.5);
}

#full-screen-search .vsh-search-group-hint {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 12px 4px;
}

#full-screen-search .search-group-block {
    margin-bottom: 14px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

#full-screen-search .search-group-header,
#full-screen-search .search-subgroup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    cursor: pointer;
    color: #fff;
    font-weight: bold;
}

#full-screen-search .search-group-header {
    background: rgba(255, 255, 255, 0.12);
    font-size: 16px;
}

#full-screen-search .search-group-header.search-drill-section {
    cursor: default;
    margin-top: 10px;
    border-radius: 12px 12px 0 0;
}

#full-screen-search .search-group-header.search-drill-section + .search-subgroup-header {
    border-radius: 0;
}

#full-screen-search .search-subgroup-header.search-drill-row:last-of-type,
#full-screen-search .search-group-header.search-drill-section + .search-subgroup-header:last-of-type {
    border-radius: 0 0 12px 12px;
    margin-bottom: 8px;
}

#full-screen-search .search-subgroup-header {
    padding-left: 28px;
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#full-screen-search .search-group-meta {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    white-space: nowrap;
}

#full-screen-search .search-drill-back {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: bold;
    padding: 8px 4px 14px;
    cursor: pointer;
}

#full-screen-search .search-drill-row {
    margin-bottom: 8px;
    border-radius: 12px;
}

#full-screen-search .search-drill-browse-btn {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 20px;
    background: rgba(44, 123, 229, 0.35);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
}

#full-screen-search .search-partition-block {
    margin-bottom: 14px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

#full-screen-search .search-partition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: bold;
    font-size: 15px;
}

#full-screen-search .search-partition-toggle {
    cursor: pointer;
}

#full-screen-search .search-partition-toggle:active {
    background: rgba(255, 255, 255, 0.18);
}

#full-screen-search .search-partition-block .search-result-item-compact {
    padding-left: 22px;
}

#full-screen-search .search-code-expand-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 12px 15px;
    color: #d9ecff;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    background: rgba(44, 123, 229, 0.18);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#full-screen-search .search-code-expand-hint:active {
    background: rgba(44, 123, 229, 0.28);
}

#full-screen-search .search-partition-browse {
    margin: 0;
    border-radius: 12px 12px 0 0;
    background: rgba(44, 123, 229, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#full-screen-search .search-partition-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

#full-screen-search .search-result-item-compact {
    padding-left: 28px;
    background: rgba(0, 0, 0, 0.08);
}

#consultSearch::placeholder {
    color: #fff;
    font-weight: bold;
}

#consultSearch {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 統計項目預設先隱藏，交由 JS 根據配置決定是否顯示 */
#display-total-views-wrapper, 
#display-total-consults-wrapper, 
#display-total-plays-wrapper, 
#display-total-ocr-wrapper,
#examCountText,
#display-consult-count-wrapper {
    display: none;
}


/* 自訂封面層（方案 B） */
.video-cover-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
}

.video-cover-layer.is-hidden {
    display: none;
}

.video-cover-layer img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: transparent;
}

.video-cover-play-btn {
    position: relative;
    z-index: 3;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.video-cover-play-icon {
    font-size: 26px;
    line-height: 1;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* =============================================================================
   AR 報到導航（nav/ 模組專用，不覆寫 OCR 既有規則）
   ============================================================================= */

.guide-help-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.nav-only {
    display: none !important;
}

body.nav-mode-active .ocr-only {
    display: none !important;
}

body.nav-mode-active #nav-section-title.nav-only {
    display: block !important;
}

body.nav-mode-active #nav-instruction-text.nav-only {
    display: block !important;
}

body.nav-mode-active #nav-stage-wrap.nav-only {
    display: block !important;
}

body.nav-mode-active #nav-sheet.nav-only {
    display: block !important;
}

body.nav-mode-active #nav-btn-group {
    display: flex !important;
    /* 短視窗／縮放後仍固定在可視區底部，避免「結束導航」被推到螢幕外 */
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin-top: 10px;
    margin-bottom: 0;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    /* 不使用白底／漸層底板，避免按鈕區出現白方塊 */
    background: transparent;
    box-shadow: none;
    border: none;
}

body.nav-mode-active #nav-hint-panel {
    display: block !important;
}

/* 矮螢幕：縮小地圖高度，讓標題＋地圖＋三顆按鈕能落在首屏內 */
@media (max-height: 720px) {
    body.nav-mode-active .nav-map-stage {
        height: min(220px, 34vh);
    }
}

@media (max-height: 600px) {
    body.nav-mode-active .nav-map-stage {
        height: min(170px, 28vh);
    }
}

.nav-instruction-text {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    letter-spacing: 1px;
    margin: 0 0 12px;
}

/* 導航地圖／羅盤舞台（不使用相機） */
.nav-stage-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
}

/* 導航中封鎖瀏覽器原生下拉重整（拉說明層時勿觸發整頁 refresh） */
html.nav-mode-active,
html.nav-mode-active body {
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
}
body.nav-mode-active {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    /* 蓋過全域 min-height:110vh，避免文件可被下拉 */
    min-height: 100% !important;
    height: 100% !important;
}
body.nav-mode-active #nav-sheet,
body.nav-mode-active #nav-side-rail,
body.nav-mode-active #nav-hint-panel {
    overscroll-behavior: contain;
}

.nav-map-stage {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #eef2f6;
    overscroll-behavior: none;
    touch-action: manipulation;
}

/* 實景地圖（取代院區地圖主畫面；B1 等無平面圖） */
.nav-photo-stage {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #111;
}
.nav-photo-viewport {
    position: absolute;
    inset: 0;
}
.nav-photo-img {
    width: 100%;
    height: 100%;
    /* cover：實景步填滿地圖區；走道置中裁切（拍攝時盡量置中） */
    object-fit: cover;
    object-position: center center;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    background: #0d0d0d;
}
.nav-photo-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.nav-photo-path {
    fill: none;
    stroke: #ff5252;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 7;
    stroke-opacity: 0.55;
    animation: nav-photo-flow 1.1s linear infinite;
}
.nav-photo-path-active {
    fill: none;
    stroke: #00e676;
    stroke-width: 1.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 7;
    stroke-opacity: 0.95;
    animation: nav-photo-flow 1.1s linear infinite;
}
.nav-photo-label {
    display: none;
}
@keyframes nav-photo-flow {
    to { stroke-dashoffset: -28; }
}
body.nav-mode-active.nav-ui-maps .nav-photo-stage {
    height: 100% !important;
    min-height: 100% !important;
    border-radius: 0;
}

/*
 * 實景比例：直向手機用 _port（3:4）、橫向／桌機平板用 _land（16:9）。
 * 地圖區仍滿版；圖以 cover 填滿，專用裁切避免橫向被「直向圖」左右裁掉關鍵景物。
 */
body.nav-mode-active.nav-photo-map-active .nav-photo-stage.is-photo-land .nav-photo-img,
body.nav-mode-active.nav-photo-map-active .nav-photo-stage.is-photo-port .nav-photo-img {
    object-fit: cover;
    object-position: center center;
}
/* 橫向手機矮視窗：改 contain，完整呈現 16:9 專用圖（上下可留黑邊） */
@media (orientation: landscape) and (max-height: 480px) {
    body.nav-mode-active.nav-photo-map-active .nav-photo-stage.is-photo-land .nav-photo-img {
        object-fit: contain;
        background: #0d0d0d;
    }
}
/* 桌機／平板寬螢幕：流動線略細 */
@media (orientation: landscape), (min-width: 900px) {
    body.nav-mode-active.nav-photo-map-active .nav-photo-path {
        stroke-width: 1.35;
    }
    body.nav-mode-active.nav-photo-map-active .nav-photo-path-active {
        stroke-width: 1.05;
    }
}
@media (min-width: 900px) {
    body.nav-mode-active.nav-photo-map-active:not(.nav-ui-maps) .nav-photo-stage.is-photo-land {
        aspect-ratio: 16 / 9;
        height: auto;
        max-height: min(62vh, 560px);
    }
}
/* 直向窄螢幕：流動線維持適中；非滿版地圖時框成 3:4 */
@media (orientation: portrait) and (max-width: 899px) {
    body.nav-mode-active.nav-photo-map-active .nav-photo-path {
        stroke-width: 1.6;
    }
    body.nav-mode-active.nav-photo-map-active .nav-photo-path-active {
        stroke-width: 1.25;
    }
    body.nav-mode-active.nav-photo-map-active:not(.nav-ui-maps) .nav-photo-stage.is-photo-port {
        aspect-ratio: 3 / 4;
        height: auto;
        max-height: min(58vh, 520px);
    }
}

.nav-map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: manipulation;
}

/* 導航中：僅地圖區塊可拖曳 */
.nav-map-stage.is-drag-enabled .nav-map-viewport {
    touch-action: none;
    cursor: grab;
}

.nav-map-stage.is-drag-enabled .nav-map-viewport.is-dragging {
    cursor: grabbing;
}

.nav-map-layer {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.nav-map-layer.is-panning {
    will-change: transform;
}

.nav-map-img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    /* 放大時盡量保持平滑，避免過度像素化 */
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

.nav-map-svg {
    position: absolute;
    left: 0;
    top: 0;
    overflow: visible;
    pointer-events: none;
}

.nav-map-route-path {
    stroke: #ff5252;
    /* 基準對應 4800 寬；高清／中高清由 JS 依比例覆寫 stroke / dash */
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 14 10;
    --nav-dash-cycle: 24;
    /* 不用 drop-shadow：大圖幅 SVG filter 在手機上極耗 GPU，易造成分頁被殺 */
}

.nav-map-route-path.is-flowing {
    animation: nav-route-flow 1.1s linear infinite;
}

/* 目前「下一步」對應路段：亮綠流動線疊在完整紅線之上（明顯比紅線細；紅／綠皆可流動） */
.nav-map-route-active {
    stroke: #00e676;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 14 10;
    --nav-dash-cycle: 24;
}

.nav-map-route-active.is-flowing {
    animation: nav-route-flow 1.1s linear infinite;
}

/* 步驟點：綠實心 + 同色流動外框（到此點再按「下一步」） */
.nav-map-step-core {
    fill: #00e676;
    stroke: #fff;
    stroke-width: 2;
}

/* 起點：橙色實心 + 同色流動外框 */
.nav-map-step-marker.is-start .nav-map-step-core {
    fill: #ffb74d;
}

/* 終點：青色實心 + 同色流動外框 */
.nav-map-step-marker.is-end .nav-map-step-core {
    fill: #00e5ff;
}

.nav-map-step-ring {
    fill: none;
    /* 預設＝步驟點亮綠；起／迄由下方覆寫為與實心同色 */
    stroke: #00e676;
    stroke-linecap: round;
    stroke-dasharray: 6 5;
    --nav-dash-cycle: 11;
}

.nav-map-step-marker.is-start .nav-map-step-ring {
    stroke: #ffb74d;
}

.nav-map-step-marker.is-end .nav-map-step-ring {
    stroke: #00e5ff;
}

.nav-map-step-ring.is-flowing {
    animation: nav-route-flow 0.9s linear infinite;
}

/* 終點／檢查室名稱：SVG 字級隨底圖與地圖 +/-，不套用 --vsh-font-scale */
.nav-map-step-label {
    fill: #00acc1;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-linejoin: round;
    paint-order: stroke fill;
    font-weight: 700;
    font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
    text-anchor: middle;
    dominant-baseline: hanging;
    pointer-events: none;
    user-select: none;
}

@keyframes nav-route-flow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: calc(-1 * var(--nav-dash-cycle, 24)); }
}

.nav-map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* 各圓鈕＋tip 同容器：tip 相對該鈕垂直置中，隨堆疊位移 */
.nav-map-control-item {
    position: relative;
    display: none;
    line-height: 0;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}

/* 地圖隨向／語音：同一套圓鈕（44×44、正圓、毛玻璃白底） */
.nav-map-heading-btn,
.nav-map-voice-btn {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 44px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    cursor: pointer;
    line-height: 0;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-map-voice-btn .nav-map-voice-icon {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-map-voice-btn.is-on {
    background: #1a73e8;
    border-color: rgba(255, 255, 255, 0.95);
    color: #fff;
}

.nav-map-voice-btn.is-disabled,
.nav-map-voice-btn:disabled,
.nav-map-heading-btn.is-disabled,
.nav-map-heading-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nav-map-voice-btn.is-hint-pulse {
    animation: nav-heading-hint-pulse 1.1s ease-in-out 0s 3;
}

.nav-map-heading-btn .nav-map-heading-icon {
    display: block;
}

.nav-map-heading-btn.is-follow {
    background: #1a73e8;
    border-color: rgba(255, 255, 255, 0.95);
    color: #fff;
}

.nav-map-heading-btn.is-hint-pulse {
    animation: nav-heading-hint-pulse 1.1s ease-in-out 0s 3;
}

@keyframes nav-heading-hint-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 6px rgba(26, 115, 232, 0.3);
    }
}

.nav-map-voice-tip,
.nav-map-heading-tip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    width: min(196px, 52vw);
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    z-index: 2;
}

.nav-map-voice-tip::after,
.nav-map-heading-tip::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(17, 24, 39, 0.88);
}

.nav-map-zoom {
    display: flex;
    flex-direction: column;
    width: 40px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-map-zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #1f2937;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.nav-map-zoom-btn + .nav-map-zoom-btn {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-map-zoom-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.nav-compass-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 110px;
    margin: -55px 0 0 -36px;
    pointer-events: none;
    z-index: 2;
    transition: transform 0.12s ease-out;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.nav-compass-arrow-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 雙箭頭：前（箭尖）小 → 主箭頭，略縮小 */
.nav-arrow-part {
    display: block;
    flex-shrink: 0;
    line-height: 0;
}

.nav-arrow-front {
    margin-bottom: -18px;
    opacity: 0.92;
}

.nav-arrow-main {
    z-index: 2;
}

.nav-overlay-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 14px 16px;
    min-height: 48px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 17px;
    font-weight: bold;
    text-align: center;
    line-height: 1.45;
    letter-spacing: 0.5px;
    white-space: pre-line;
    display: none;
    z-index: 3;
}

/* 地圖上方提示：兩行各一個獨立方塊 */
.nav-overlay-stack {
    display: none;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: min(92vw, 420px);
    z-index: 3;
    pointer-events: none;
}
.nav-overlay-chip {
    display: none;
    box-sizing: border-box;
    width: max-content;
    max-width: 100%;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 17px;
    font-weight: bold;
    text-align: center;
    line-height: 1.45;
    letter-spacing: 0.5px;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* 沿途示意圖：單一容器輪播；左右鈕樣式沿用 .sub-item-nav-btn（同衛教影片） */
.nav-hint-img-stage,
.nav-hint-img-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 4px;
}
.nav-hint-img-stage[hidden],
.nav-hint-img-stack[hidden] {
    display: none !important;
}
.nav-hint-img-stage.has-sub-nav {
    max-width: 100%;
}
.nav-hint-img-stage .nav-hint-img-frame,
.nav-hint-img-stack .nav-hint-img-frame {
    flex: 1 1 auto;
    margin: 0;
}
.nav-hint-img-stage .sub-item-nav-btn,
.nav-hint-img-stack .sub-item-nav-btn {
    flex: 0 0 auto;
    /* B 淡藍玻璃：白底提示窗上可辨識；不動衛教影片共用鈕 */
    background: linear-gradient(
        145deg,
        rgba(0, 122, 255, 0.22) 0%,
        rgba(0, 122, 255, 0.10) 45%,
        rgba(90, 160, 230, 0.20) 100%
    );
    border: 1px solid rgba(0, 122, 255, 0.38);
    box-shadow:
        0 4px 16px rgba(0, 122, 255, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 0 rgba(0, 90, 200, 0.08);
    color: rgba(0, 90, 200, 0.92);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.nav-hint-img-stage .sub-item-nav-btn:hover,
.nav-hint-img-stack .sub-item-nav-btn:hover {
    background: linear-gradient(
        145deg,
        rgba(0, 122, 255, 0.30) 0%,
        rgba(0, 122, 255, 0.14) 45%,
        rgba(90, 160, 230, 0.26) 100%
    );
}
.nav-hint-img-stage .sub-item-nav-btn:active,
.nav-hint-img-stack .sub-item-nav-btn:active {
    background: linear-gradient(
        145deg,
        rgba(0, 122, 255, 0.18) 0%,
        rgba(0, 122, 255, 0.08) 45%,
        rgba(70, 140, 210, 0.24) 100%
    );
}

.nav-btn-group .nav-action-btn {
    flex: 1 1 0;
    max-width: 140px;
    min-width: 0;
    height: 40px;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* 對齊 OCR 相機開啟後三顆按鈕：辨識(橘) / 暫停(紅) / 返回(藍) */
.nav-btn-cant-find {
    background: linear-gradient(135deg, #1b5e20 0%, #43a047 100%);
    color: #ffffff;
}

.nav-btn-found {
    background: #dc3545;
}

.nav-btn-found:disabled {
    opacity: 0.45;
    cursor: default;
    background: #dc3545;
}

.nav-btn-restart {
    background: linear-gradient(135deg, #1b5e20 0%, #43a047 100%);
    color: #ffffff;
    max-width: 160px !important;
}

/* 開啟地圖準備導航：方案 A 暗綠漸層（不改全域 .vsh-btn--primary） */
#nav-setup-start-btn.vsh-btn--primary {
    background: linear-gradient(135deg, #1b5e20 0%, #43a047 100%);
}

.nav-btn-end {
    background: #2c7be5;
}

.nav-hint-panel {
    background: rgba(255, 234, 0, 0.9);
    color: #000;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    width: auto;
    max-width: 92%;
    margin: 15px auto 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    line-height: 1.7;
    border: 1px solid #e6c200;
}

.nav-hint-step {
    font-weight: bold;
    color: #2c7be5;
    margin: 0 0 8px;
}

.nav-hint-brief {
    margin: 0 0 8px;
    font-weight: bold;
    white-space: pre-line;
}

.nav-hint-direction {
    margin: 0 0 10px;
    font-size: 13px;
    color: #d9534f;
}

.nav-hint-img-frame {
    /* 固定示意圖顯示區：比例與圖庫 800×532 一致，版面不因原圖尺寸跳動 */
    --nav-hint-img-ratio: 800 / 532;
    --nav-hint-img-max-h: min(220px, 42vw);
    /* 高度上限對應寬度上限，避免只限高、寬仍 100% 時比例被撐開而露出左右黑邊 */
    --nav-hint-img-max-w: calc(var(--nav-hint-img-max-h) * 800 / 532);
    position: relative;
    width: min(100%, var(--nav-hint-img-max-w));
    max-width: 100%;
    aspect-ratio: var(--nav-hint-img-ratio);
    max-height: var(--nav-hint-img-max-h);
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid #ccc;
    overflow: hidden;
    line-height: 0;
    background: #f1f3f4;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.nav-hint-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    /* 鋪滿固定框並置中裁切，避免左右黑邊 */
    object-fit: cover;
    object-position: center;
    cursor: pointer;
    background: #f1f3f4;
}

/* 矮螢幕：略縮固定圖框，避免擠壓地圖／按鈕 */
@media (max-height: 720px) {
    .nav-hint-img-frame {
        --nav-hint-img-max-h: min(180px, 38vw);
    }
}

@media (max-height: 600px) {
    .nav-hint-img-frame {
        --nav-hint-img-max-h: min(150px, 34vw);
    }
}

.nav-hint-img-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 6px;
    pointer-events: none;
    line-height: 0;
}

.nav-hint-img-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.nav-hint-img-dot.is-active {
    background: #2c7be5;
    box-shadow: 0 0 0 1px rgba(44, 123, 229, 0.8);
}

/* ----- classic：sheet 只是容器，把手／起迄列／步驟列表／側欄包裝隱藏 ----- */
.nav-sheet-handle,
.nav-sheet-pull-hint,
.nav-step-list {
    display: none;
}
.nav-od-bar {
    display: none !important;
}
.nav-side-rail {
    display: contents;
}
/* 導航中側欄預設不占盒模型，讓子層（起迄／說明）各自顯示；橫向 maps 再改 flex */
body.nav-mode-active #nav-side-rail.nav-only {
    display: contents !important;
}
body.nav-mode-active.nav-ui-maps #nav-side-rail.nav-only {
    display: contents !important;
}
body.nav-mode-active #nav-sheet.nav-only {
    display: block !important;
}
body.nav-mode-active:not(.nav-ui-maps) .nav-sheet-drag {
    display: contents;
}

/* =============================================================================
   Maps 式全螢幕導航（body.nav-ui-maps）
   退回舊版：?navUi=classic 或 localStorage vshNavUiMode=classic
   ============================================================================= */
/*
 * #scanner-section 有 backdrop-filter，會變成 fixed 子元素的 containing block，
 * 導致全螢幕地圖卡在辨識區小框內。導航中關閉 blur／filter。
 */
body.nav-mode-active.nav-ui-maps #scanner-section {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    overflow: visible !important;
}
body.nav-mode-active.nav-ui-maps {
    overflow: hidden;
}
/* 全螢幕導航時隱藏阿波，避免擋到底部「結束導航」等按鈕 */
body.nav-mode-active.nav-ui-maps .apo-bot {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps #nav-section-title,
body.nav-mode-active.nav-ui-maps #nav-instruction-text,
body.nav-mode-active.nav-ui-maps .privacy-container,
body.nav-mode-active.nav-ui-maps .guide-prompt-area {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps #nav-stage-wrap.nav-only {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0;
    z-index: 90;
    overflow: hidden;
    background: #e8eef4;
}
body.nav-mode-active.nav-ui-maps .nav-map-stage {
    height: 100% !important;
    min-height: 100% !important;
    border-radius: 0;
}
body.nav-mode-active.nav-ui-maps .nav-overlay-text {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps .nav-overlay-stack {
    bottom: auto;
    top: calc(12px + env(safe-area-inset-top, 0px) + 72px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 92;
    /* 放大字級時限制寬高，避免蓋住地圖與綠箭 */
    max-width: min(94vw, 520px);
    max-height: min(28vh, 160px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
body.nav-mode-active.nav-ui-maps .nav-overlay-chip {
    font-size: 15px;
    font-weight: 700;
    padding: 7px 14px;
}
body.nav-mode-active.nav-ui-maps .nav-overlay-chip--progress {
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    text-align: left;
}
body.nav-mode-active.nav-ui-maps .nav-progress-track {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}
body.nav-mode-active.nav-ui-maps .nav-progress-sep {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 700;
    padding: 0 1px;
}
body.nav-mode-active.nav-ui-maps .nav-progress-stop {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
}
body.nav-mode-active.nav-ui-maps .nav-progress-stop.is-current {
    color: #00e676;
    font-weight: 800;
}
body.nav-mode-active.nav-ui-maps .nav-map-controls {
    position: fixed;
    top: auto;
    left: auto;
    right: 14px;
    bottom: calc(168px + env(safe-area-inset-bottom, 0px));
    z-index: 97;
}
body.nav-mode-active.nav-ui-maps[data-nav-sheet="half"] .nav-map-controls {
    bottom: calc(var(--nav-sheet-h, 42vh) + 24px);
}
/* 就緒時顯示鈕容器（tip 跟著該容器，不必再寫死 top 偏移） */
body.nav-mode-active.nav-ui-maps.nav-heading-follow-ready .nav-map-control-item--heading,
body.nav-mode-active.nav-ui-maps.nav-heading-follow-ready .nav-map-control-item--voice,
body.nav-mode-active.nav-ui-maps.nav-voice-ready .nav-map-control-item--voice {
    display: block;
}

/* 快速回退：整顆語音容器隱藏（地圖隨向 tip 仍貼自己的鈕） */
body.nav-voice-ui-off .nav-map-control-item--voice {
    display: none !important;
}

body.nav-mode-active.nav-ui-maps #nav-od-bar {
    display: block !important;
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 96;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    padding: 8px 38px 8px 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.nav-od-close {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #f1f3f4;
    color: #444;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.nav-od-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    min-height: 0;
}
.nav-od-row + .nav-od-row {
    border-top: 1px solid #e8eaed;
}
.nav-od-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.nav-od-dot--from { background: #1a73e8; }
.nav-od-dot--to { background: #ea4335; }
.nav-od-text {
    display: flex;
    align-items: baseline;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}
.nav-od-label {
    font-size: 14px;
    font-weight: 700;
    color: #5f6368;
    flex: 0 0 auto;
    white-space: nowrap;
}
.nav-od-value {
    font-size: 15px;
    font-weight: 700;
    color: #202124;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.nav-mode-active.nav-ui-maps #nav-sheet.nav-only {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    margin: 0;
    max-width: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
    padding: 0 14px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    /* collapsed（最下方）：只留把手＋按鈕 */
    height: calc(86px + env(safe-area-inset-bottom, 0px));
    transition: height 0.22s ease;
    overflow: hidden;
}
/* 中段：高度由 JS 依文字＋圖片量測；CSS 先給合理上限 */
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="half"] {
    height: auto;
    max-height: min(72vh, 640px);
}
body.nav-mode-active.nav-ui-maps .nav-sheet-drag {
    display: block;
    flex: 0 0 auto;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    padding-bottom: 2px;
}
body.nav-mode-active.nav-ui-maps .nav-sheet-drag:active {
    cursor: grabbing;
}
body.nav-mode-active.nav-ui-maps .nav-sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 4px;
    min-height: 28px;
    flex: 0 0 auto;
}
.nav-sheet-handle-bar {
    width: 44px;
    height: 5px;
    border-radius: 4px;
    background: #dadce0;
}
body.nav-mode-active.nav-ui-maps .nav-sheet-pull-hint {
    display: block;
    margin: 0 0 4px;
    font-size: 12px;
    color: #5f6368;
    text-align: center;
}
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="half"] .nav-sheet-pull-hint,
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="collapsed"] .nav-sheet-pull-hint {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel {
    background: transparent;
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0 2px 6px;
    max-width: none;
    width: 100%;
    text-align: left;
    overflow: auto;
    /* 佔滿把手與按鈕之間，讓圖片下方步驟列表可捲動 */
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    /* 蓋過 body.nav-mode-active #nav-hint-panel 的 display:block !important */
    display: flex !important;
    flex-direction: column;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-step {
    /* 圖片上方短指令 */
    text-align: left;
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
    color: #1a73e8;
    flex: 0 0 auto;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-brief {
    /* 圖片下方：較詳細導航敘述 */
    text-align: left;
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
    color: #202124;
    display: block;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
    flex: 0 0 auto;
}
body.nav-mode-active.nav-ui-maps #nav-btn-group .nav-action-btn {
    font-weight: 700;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-direction {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-img-stage,
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-img-stack {
    /* 不收縮；多圖同容器輪播，高度只占一框 */
    flex: 0 0 auto;
}
body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-img-frame {
    flex: 0 0 auto;
    flex-shrink: 0;
}
/* collapsed：說明文字／圖片／步驟全藏，只留把手＋按鈕 */
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="collapsed"] #nav-hint-panel {
    display: none !important;
}
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="collapsed"] .nav-sheet-handle {
    padding: 8px 0 2px;
    min-height: 18px;
}
body.nav-mode-active.nav-ui-maps #nav-sheet[data-sheet="collapsed"] #nav-btn-group {
    margin: 0 auto;
    padding: 2px 0 0;
}
body.nav-mode-active.nav-ui-maps #nav-btn-group {
    position: relative;
    bottom: auto;
    margin: 4px auto 0;
    padding: 8px 0 0;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    justify-content: space-evenly;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
}
body.nav-mode-active.nav-ui-maps .nav-btn-group .nav-action-btn {
    flex: 1 1 0;
    max-width: min(160px, 32%);
}
body.nav-mode-active.nav-ui-maps .nav-compass-arrow {
    top: var(--nav-compass-top, 50%);
    left: var(--nav-compass-left, 50%);
    z-index: 94;
    transition: top 0.22s ease, left 0.22s ease, transform 0.12s ease-out;
}

/* Maps：步驟列表（中段在圖片下方，面板內上滑可看） */
body.nav-mode-active.nav-ui-maps .nav-step-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 4px;
    flex: 0 0 auto;
}
.nav-step-list-empty {
    margin: 8px 0;
    font-size: 13px;
    color: #80868b;
}
.nav-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
.nav-step-item.is-current {
    border-color: #1a73e8;
    background: #e8f0fe;
}
.nav-step-item-num {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e8eaed;
    color: #3c4043;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-step-item.is-current .nav-step-item-num {
    background: #1a73e8;
    color: #fff;
}
.nav-step-item-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-step-item-title {
    font-size: 14px;
    line-height: 1.35;
    color: #202124;
    /* 完整步驟文案，不截斷 */
    display: block;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
}
.nav-step-item-meta {
    font-size: 11px;
    color: #1a73e8;
    font-weight: 600;
}
.nav-step-item-img {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f3f4;
}
.nav-step-item-img--empty {
    display: inline-block;
    background: #f1f3f4;
}

/* =============================================================================
   Maps 橫向：起迄＋說明層改左側欄（比照 Google Maps 橫向）
   ============================================================================= */
@media (orientation: landscape) and (min-width: 640px) {
    body.nav-mode-active.nav-ui-maps {
        --nav-rail-w: min(42vw, 400px);
        --nav-rail-gap: 12px;
        --nav-rail-card-gap: 10px;
    }
    /* 下層收合：左側欄變窄（仍夠放三顆控制鈕），地圖左右視野加寬 */
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="collapsed"] {
        --nav-rail-w: min(36vw, 340px);
    }

    body.nav-mode-active.nav-ui-maps #nav-side-rail.nav-only {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        left: var(--nav-rail-gap);
        top: calc(10px + env(safe-area-inset-top, 0px));
        bottom: auto;
        width: calc(var(--nav-rail-w) - var(--nav-rail-gap));
        max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        z-index: 96;
        gap: var(--nav-rail-card-gap);
        box-sizing: border-box;
        pointer-events: none;
        align-items: stretch;
    }
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="half"] #nav-side-rail.nav-only {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        max-height: none;
        height: auto;
    }
    /* 收合：起迄留左上、控制鈕貼左下；中間留給地圖 */
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="collapsed"] #nav-side-rail.nav-only {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        max-height: none;
        height: auto;
        justify-content: space-between;
        gap: 0;
    }

    body.nav-mode-active.nav-ui-maps #nav-od-bar {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: none;
        margin: 0;
        border-radius: 14px;
        box-shadow: 0 2px 14px rgba(0, 0, 0, 0.14);
        pointer-events: auto;
        flex: 0 0 auto;
        box-sizing: border-box;
    }

    body.nav-mode-active.nav-ui-maps #nav-sheet.nav-only {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: none;
        height: auto !important;
        max-height: none;
        margin: 0;
        border-radius: 14px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
        padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
        pointer-events: auto;
        flex: 0 1 auto;
        min-height: 0;
        box-sizing: border-box;
    }
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="half"] #nav-sheet.nav-only {
        flex: 1 1 auto;
        height: auto !important;
        max-height: none;
        overflow: hidden;
    }
    /* 收合：只留控制按鈕（＋極小把手供再展開）；說明隱藏規則見上方通用 collapsed */
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="collapsed"] #nav-sheet.nav-only {
        flex: 0 0 auto;
        padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
    }

    /* 橫向把手比照直向：頂部橫條，可向下收合 */
    body.nav-mode-active.nav-ui-maps .nav-sheet-handle {
        justify-content: center;
        padding: 10px 0 4px;
        min-height: 24px;
    }
    body.nav-mode-active.nav-ui-maps .nav-sheet-handle-bar {
        width: 44px;
        height: 5px;
        border-radius: 4px;
    }
    body.nav-mode-active.nav-ui-maps .nav-sheet-pull-hint {
        text-align: center;
    }

    body.nav-mode-active.nav-ui-maps .nav-map-controls {
        right: 14px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="half"] .nav-map-controls {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    /* 綠箭位置由 --nav-compass-*（JS updateChromeLayout）控制 */
    /* 提示方塊永遠落在右側地圖帶內，不與左上起迄列重疊 */
    body.nav-mode-active.nav-ui-maps .nav-overlay-stack {
        left: calc(var(--nav-rail-w) + (100% - var(--nav-rail-w)) / 2);
        right: auto;
        top: calc(12px + env(safe-area-inset-top, 0px));
        max-width: min(calc(100% - var(--nav-rail-w) - 28px), 42vw, 420px);
    }
    body.nav-mode-active.nav-ui-maps[data-nav-sheet="collapsed"] .nav-overlay-stack {
        left: calc(var(--nav-rail-w) + (100% - var(--nav-rail-w)) / 2);
        max-width: min(calc(100% - var(--nav-rail-w) - 28px), 40vw, 420px);
    }
}

/* 直向：側欄不占盒模型，子元素各自 fixed（與既有直向版面一致） */
@media (orientation: portrait), (max-width: 639px) {
    body.nav-mode-active.nav-ui-maps #nav-side-rail.nav-only {
        display: contents !important;
    }
}

/* =============================================================================
   顯示大小（液態玻璃 AA 圓鈕 + 單一滑桿：字級與版面一起放大）
   級距：100 / 110 / 125 / 150 / 175
   - 版面：CSS zoom（--vsh-page-zoom）
   - 字級：閱讀文字再乘 --vsh-font-scale（實機 Safari 上只靠 zoom 字看起來幾乎沒變大）

   【永久標注｜PR #49】顯示大小縮放已定案，後續任何 UI／版面／字級改動都必須同時考慮：
   1) 100%（data-vsh-display-scale="100"）維持基準視覺；
   2) >100% 時 html:not([data-vsh-display-scale="100"]) 的 --vsh-font-scale 規則仍正確放大；
   3) 新增文字節點若需跟隨放大，應接上既有 scale 選擇器（參考 PR #49 範圍：影片標題／FAQ／搜尋鑽取等）；
   4) 勿用負 margin／固定高度等在放大後易裁切的寫法，或僅限 100% 並另備 >100% 規則。
   ============================================================================= */
html {
    --vsh-page-zoom: 1;
    --vsh-font-scale: 1;
    --vsh-a11y-panel-shift-y: 0px;
    /* 阿波按鈕／氣泡獨立縮放（由 JS 寫入，上限 1.25） */
    --vsh-apo-max-zoom: 1.25;
    --vsh-apo-zoom: 1;
}

/* 字級：顯示大小 > 100% 時放大主要閱讀文字（與舊 AA 文字大小同一批節點） */
html:not([data-vsh-display-scale="100"]) header h1 {
    font-size: calc(28px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) header > p {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .stats-display {
    font-size: calc(11px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .privacy-text {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .guide-instruction {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #ocr-section-title,
html:not([data-vsh-display-scale="100"]) #nav-section-title {
    font-size: calc(24px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .footer-lang-title {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .footer-lang-details {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .footer-ai-tip {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-q-title {
    font-size: calc(17px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-main-answer {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-full-answer {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
/* 需蓋過 #consult-faq h3（手機 1.1rem !important） */
html:not([data-vsh-display-scale="100"]) #consult-faq .faq-section-title,
html:not([data-vsh-display-scale="100"]) #consult-faq h3 {
    font-size: calc(18px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-section-subtitle,
html:not([data-vsh-display-scale="100"]) .faq-section-count {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-q-mark {
    font-size: calc(20px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-a-mark {
    font-size: calc(19px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .faq-q-chevron {
    font-size: calc(10px * var(--vsh-font-scale)) !important;
}
/* #examNameText 由 fitExamNameTitle（含 getUiFontScale）負責，避免 CSS 覆寫自適應字級 */
html:not([data-vsh-display-scale="100"]) #examCountText {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #consultSearch,
html:not([data-vsh-display-scale="100"]) #examSelect,
html:not([data-vsh-display-scale="100"]) #consultExamSelect,
html:not([data-vsh-display-scale="100"]) #langSelect {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-input-field {
    font-size: calc(17px * var(--vsh-font-scale)) !important;
    height: calc(48px * min(var(--vsh-font-scale), 1.35));
    min-height: 48px;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-back-btn {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-hint-text {
    font-size: calc(17px * var(--vsh-font-scale)) !important;
    padding: 12px 0 8px !important;
    margin: 0 !important;
    line-height: 1.45 !important;
}
/* >100%：提示區取消負 margin，避免放大後頂部裁切（100% 仍用上方 PR37 緊湊間距） */
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-hint-box {
    margin-top: 0 !important;
    padding: 4px 0 0 !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-results-container {
    padding-top: 4px;
    overflow-x: hidden;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-hint-list li {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-result-title {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-result-category {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .vsh-search-group-hint {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-group-header {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-subgroup-header {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-group-meta {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-drill-back {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-drill-browse-btn {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-partition-header {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #full-screen-search .search-code-expand-hint {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-hint-step {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-hint-brief {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-hint-direction {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
/* Maps 說明層：基準字級與 100% 視覺一致（step 15／brief 14），再乘 --vsh-font-scale */
html:not([data-vsh-display-scale="100"]) body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-step {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-brief {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) body.nav-mode-active.nav-ui-maps #nav-hint-panel .nav-hint-direction {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
/* Maps 步驟列表／起迄列／上滑提示：跟隨顯示縮放 */
html:not([data-vsh-display-scale="100"]) .nav-step-list-empty {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-step-item-num {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-step-item-title {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-step-item-meta {
    font-size: calc(11px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-od-label {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-od-value {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) body.nav-mode-active.nav-ui-maps .nav-sheet-pull-hint {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-overlay-text,
html:not([data-vsh-display-scale="100"]) .nav-overlay-chip {
    font-size: calc(17px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-btn-group .nav-action-btn {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .nav-instruction-text {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .tab-btn {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
/* 首頁：選單欄下方分頁標題＋說明（衛教影片／衛教諮詢） */
html:not([data-vsh-display-scale="100"]) .video-footer-notice h2,
html:not([data-vsh-display-scale="100"]) #consultContent h2 {
    font-size: calc(22px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .video-footer-notice p,
html:not([data-vsh-display-scale="100"]) #consultContent > p {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .btn-where-code {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .slogan-text {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .selector-row select,
html:not([data-vsh-display-scale="100"]) .selector-row input {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}

/* OCR 相機畫面字、按鈕字、暫停／成功／注意事項、代碼／報到彈窗字（不動圖片） */
html:not([data-vsh-display-scale="100"]) #instruction-text {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #status-text {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .camera-container.is-ocr-paused #status-text {
    font-size: calc(24px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #btn-text {
    font-size: calc(16px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #btn-text.is-ocr-loading {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .camera-btn-group button:not(#start-cam-btn),
html:not([data-vsh-display-scale="100"]) #start-cam-btn.is-retry-cam {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .ocr-engine-loader-text {
    font-size: calc(13px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-fail-notice {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-fail-notice-emoji {
    font-size: calc(18px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-ocr-success-title {
    font-size: calc(20px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-ocr-code {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-ocr-prep,
html:not([data-vsh-display-scale="100"]) .vsh-ocr-prep-body,
html:not([data-vsh-display-scale="100"]) .vsh-ocr-prep-heading {
    font-size: calc(15px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) #result {
    font-size: calc(11px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-nav-title,
html:not([data-vsh-display-scale="100"]) .vsh-sheet-title {
    font-size: calc(17px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-nav-label {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
/* 第一層「檢查室在哪裡？」功能註解，需跟隨顯示縮放 */
html:not([data-vsh-display-scale="100"]) .vsh-feature-desc {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-sheet-card--nav .vsh-btn:not(.guide-popup-btn),
html:not([data-vsh-display-scale="100"]) .vsh-sheet-card--nav .vsh-select {
    font-size: calc(14px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .guide-popup-btn.vsh-btn--primary {
    font-size: calc(12px * var(--vsh-font-scale)) !important;
}
html:not([data-vsh-display-scale="100"]) .vsh-sheet-icon {
    font-size: calc(22px * var(--vsh-font-scale)) !important;
}

@media (max-width: 480px) {
    html:not([data-vsh-display-scale="100"]) #consult-faq .faq-section-title,
    html:not([data-vsh-display-scale="100"]) #consult-faq h3 {
        font-size: calc(1.1rem * var(--vsh-font-scale)) !important;
    }
    html:not([data-vsh-display-scale="100"]) .faq-q-title,
    html:not([data-vsh-display-scale="100"]) .faq-main-answer {
        font-size: calc(15px * var(--vsh-font-scale)) !important;
    }
}

/* 整頁縮放根層：優先 CSS zoom；無 zoom 時由 JS 改 transform fallback */
#vsh-zoom-root {
    transform-origin: top center;
}

html.vsh-zoom-transform-fallback #vsh-zoom-root {
    /* JS 會寫入 transform / width；這裡只固定原點 */
    transform-origin: top center;
}

/* AA／使用說明圓鈕：對稱錨在辨識框左上／右上，隨框一起縮放 */
#scanner-section #vsh-a11y-fab,
#scanner-section #vsh-help-fab {
    position: absolute;
    top: 10px;
    z-index: 50;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.72) 0%,
        rgba(255, 255, 255, 0.28) 55%,
        rgba(255, 255, 255, 0.16) 100%
    );
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 28px rgba(20, 40, 80, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1c1c1e;
    padding: 0;
    transition: background 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
        "Microsoft JhengHei", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

#scanner-section #vsh-a11y-fab {
    right: 10px;
}

#scanner-section #vsh-help-fab {
    left: 10px;
}

#scanner-section #vsh-a11y-fab:active,
#scanner-section #vsh-help-fab:active {
    filter: brightness(0.96);
}

#scanner-section #vsh-a11y-fab[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.94);
}

.vsh-help-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

.vsh-aa-mark {
    display: inline-flex;
    align-items: baseline;
    font-weight: 700;
    letter-spacing: -0.05em;
    line-height: 1;
}

.vsh-aa-s {
    font-size: 11px;
    opacity: 0.7;
}

.vsh-aa-l {
    font-size: 15px;
    margin-left: 1px;
}

#scanner-section #vsh-a11y-panel {
    position: absolute;
    top: 54px;
    right: 10px;
    left: auto;
    z-index: 51;
    /* 相對辨識框寬度限制，避免整頁放大後視覺上「超出」 */
    width: min(252px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    /* Safari 實機 backdrop-filter 較弱，背景需夠實才不透字 */
    background:
        linear-gradient(
            165deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(248, 248, 250, 0.94) 100%
        );
    -webkit-backdrop-filter: saturate(160%) blur(36px);
    backdrop-filter: saturate(160%) blur(36px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 18px 40px rgba(20, 40, 80, 0.28);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
        "Microsoft JhengHei", sans-serif;
    -webkit-tap-highlight-color: transparent;
    /* 抵銷外層整頁 zoom，讓小視窗維持可讀大小、不跟整頁一起撐爆 */
    zoom: calc(1 / var(--vsh-page-zoom, 1));
    transform-origin: top right;
    animation: vshA11yPanelIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    isolation: isolate;
}

#scanner-section #vsh-a11y-panel[hidden] {
    display: none !important;
}

@supports not (zoom: 1) {
    #scanner-section #vsh-a11y-panel {
        zoom: unset;
        /* 用獨立 transform 屬性，避免蓋掉 translate 位移 */
        scale: calc(1 / var(--vsh-page-zoom, 1));
    }
}

/* 橫向／矮螢幕：面板貼近頂端，並限制最大高度以免超出 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #scanner-section #vsh-a11y-fab {
        top: 6px;
        right: 8px;
    }

    #scanner-section #vsh-help-fab {
        top: 6px;
        left: 8px;
    }

    #scanner-section #vsh-a11y-panel {
        top: 48px;
        right: 8px;
        width: min(240px, calc(100% - 16px));
        max-height: min(200px, calc((100dvh - 16px) / var(--vsh-page-zoom, 1)));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        gap: 8px;
    }
}

@keyframes vshA11yPanelIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.vsh-a11y-card {
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.vsh-a11y-row-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.vsh-a11y-row-title strong {
    font-size: 13px;
    font-weight: 600;
    color: #1c1c1e;
}

.vsh-a11y-row-title span {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.vsh-page-slider-wrap {
    padding: 4px 2px 2px;
}

.vsh-page-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 6px;
    padding: 0 2px;
}

.vsh-page-sm {
    font-size: 12px;
    font-weight: 600;
    color: #8e8e93;
}

.vsh-page-lg {
    font-size: 18px;
    font-weight: 700;
    color: #1c1c1e;
    line-height: 1;
}

.vsh-page-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(118, 118, 128, 0.28);
    outline: none;
}

.vsh-page-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

.vsh-page-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    #scanner-section #vsh-a11y-panel,
    #scanner-section #vsh-a11y-fab,
    #scanner-section #vsh-help-fab {
        animation: none;
        transition: none;
    }
}

/* --- 首次使用：大泡泡＋多目標高亮導覽 ---
   #tour-root 必須在 #vsh-zoom-root 外（與阿波相同），
   否則顯示大小 >100% 時 CSS zoom 會讓 spotlight／訊息框座標錯位。
   教學開啟時鎖住底層捲動，避免高亮／白框追捲動而閃爍。 */
html.vsh-tour-scroll-lock,
html.vsh-tour-scroll-lock body {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none;
}

html.vsh-tour-scroll-lock #vsh-zoom-root.vsh-tour-scroll-lock-root {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none;
}

body.vsh-tour-active {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

body.vsh-tour-active .apo-bot {
    z-index: 11990 !important;
}

body.vsh-tour-active .apo-bot.vsh-tour-target,
body.vsh-tour-active .apo-bot:has(.vsh-tour-target) {
    z-index: 12002 !important;
}

.vsh-tour-root {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    pointer-events: auto;
    cursor: pointer;
}

.vsh-tour-root.is-open {
    display: block;
    /* 教學層可點按前進，但不要把 touch 傳成底層捲動 */
    touch-action: manipulation;
    overscroll-behavior: none;
}

.vsh-tour-dim-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.vsh-tour-rings {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.vsh-tour-ring {
    position: fixed;
    box-sizing: border-box;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
    pointer-events: none;
    z-index: 12001;
}

@keyframes vsh-tour-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.vsh-tour-fade {
    animation: vsh-tour-fade-in 0.16s ease-out;
}

.vsh-tour-ring--circle {
    border-radius: 999px;
}

.vsh-tour-ring--pill {
    border-radius: 999px;
}

.vsh-tour-target {
    z-index: 12002 !important;
    pointer-events: none !important;
}

.vsh-tour-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 12003;
}

/* 白邊訊息框；說明文字統一橘→藍漸層＋白描邊；箭頭對準高亮 */
.vsh-tour-bubble {
    --tour-caret-x: 50%;
    --tour-caret-y: 50%;
    position: fixed;
    z-index: 12003;
    max-width: min(90vw, 360px);
    padding: 18px 22px;
    border-radius: 28px;
    background: #fffdf8;
    border: 2px solid #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
    pointer-events: none;
}

.vsh-tour-bubble::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fffdf8;
    border: 2px solid #ffffff;
    box-sizing: border-box;
    transform: rotate(45deg);
    pointer-events: none;
}

.vsh-tour-bubble[data-place="below"]::after {
    top: -8px;
    left: var(--tour-caret-x);
    margin-left: -7px;
    border-right: none;
    border-bottom: none;
}

.vsh-tour-bubble[data-place="above"]::after {
    bottom: -8px;
    left: var(--tour-caret-x);
    margin-left: -7px;
    border-left: none;
    border-top: none;
}

.vsh-tour-bubble[data-place="left"]::after {
    right: -8px;
    top: var(--tour-caret-y);
    margin-top: -7px;
    border-left: none;
    border-bottom: none;
}

.vsh-tour-bubble[data-place="right"]::after {
    left: -8px;
    top: var(--tour-caret-y);
    margin-top: -7px;
    border-right: none;
    border-top: none;
}

.vsh-tour-bubble-text,
.vsh-tour-welcome-line,
.vsh-tour-welcome-brand {
    background: linear-gradient(135deg, #fd9d52 0%, #f0c43a 45%, #2c7be5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter:
        drop-shadow(1.5px 0 0 #fff)
        drop-shadow(-1.5px 0 0 #fff)
        drop-shadow(0 1.5px 0 #fff)
        drop-shadow(0 -1.5px 0 #fff)
        drop-shadow(1px 1px 0 #fff)
        drop-shadow(-1px -1px 0 #fff)
        drop-shadow(1px -1px 0 #fff)
        drop-shadow(-1px 1px 0 #fff);
}

.vsh-tour-bubble-text {
    margin: 0;
    font-size: calc(28px * var(--vsh-font-scale, 1));
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: normal;
}

.vsh-tour-welcome {
    position: fixed;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    z-index: 12004;
    width: min(86vw, 340px);
    padding: 36px 28px 32px;
    border-radius: 40px;
    background: #fffdf8;
    border: 3px solid #ffffff;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

.vsh-tour-welcome[hidden] {
    display: none !important;
}

.vsh-tour-welcome-line {
    margin: 8px 0 0;
    font-size: calc(30px * var(--vsh-font-scale, 1));
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 1px;
}

.vsh-tour-welcome-brand {
    margin: 0;
    font-size: calc(38px * var(--vsh-font-scale, 1));
    font-weight: 900;
    line-height: 1.3;
    letter-spacing: 1px;
}

.vsh-tour-corner {
    position: fixed;
    left: 16px;
    right: auto;
    bottom: 64px;
    z-index: 12005;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    pointer-events: none;
    text-align: left;
}

.vsh-tour-corner-hint {
    font-size: calc(22px * var(--vsh-font-scale, 1));
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    letter-spacing: 0.3px;
}

.vsh-tour-corner-skip {
    margin: 0;
    padding: 2px 0;
    border: none;
    background: transparent;
    font-size: calc(22px * var(--vsh-font-scale, 1));
    font-weight: 700;
    color: #fd9d52;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    pointer-events: auto;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
}

.vsh-tour-corner-skip:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

html:not([data-vsh-display-scale="100"]) .vsh-tour-welcome-line {
    font-size: calc(30px * var(--vsh-font-scale)) !important;
}

html:not([data-vsh-display-scale="100"]) .vsh-tour-welcome-brand {
    font-size: calc(38px * var(--vsh-font-scale)) !important;
}

html:not([data-vsh-display-scale="100"]) .vsh-tour-bubble-text {
    font-size: calc(28px * var(--vsh-font-scale)) !important;
}

html:not([data-vsh-display-scale="100"]) .vsh-tour-corner-hint,
html:not([data-vsh-display-scale="100"]) .vsh-tour-corner-skip {
    font-size: calc(22px * var(--vsh-font-scale)) !important;
}

/* 窄螢幕（手機直式）：縮窄白框，讓側向箭頭能貼在高亮旁 */
@media (max-width: 480px) {
    .vsh-tour-bubble {
        max-width: min(58vw, 220px);
        padding: 14px 16px;
        border-radius: 24px;
    }

    .vsh-tour-bubble-text,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-bubble-text {
        font-size: calc(22px * var(--vsh-font-scale, 1)) !important;
        line-height: 1.35;
    }
}

/* 手機橫式／矮視窗：縮小訊息框與角落提示，避免白框被推離高亮 */
@media (max-height: 500px), (orientation: landscape) and (max-width: 960px) {
    .vsh-tour-bubble {
        max-width: min(56vw, 240px);
        padding: 12px 14px;
        border-radius: 22px;
    }

    .vsh-tour-bubble-text,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-bubble-text {
        font-size: calc(18px * var(--vsh-font-scale, 1)) !important;
        line-height: 1.35;
    }

    .vsh-tour-welcome {
        width: min(70vw, 280px);
        padding: 22px 18px 18px;
        border-radius: 28px;
        top: 42%;
    }

    .vsh-tour-welcome-brand,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-welcome-brand {
        font-size: calc(28px * var(--vsh-font-scale, 1)) !important;
    }

    .vsh-tour-welcome-line,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-welcome-line {
        font-size: calc(22px * var(--vsh-font-scale, 1)) !important;
    }

    .vsh-tour-corner {
        bottom: 12px;
        left: 12px;
        gap: 8px;
    }

    .vsh-tour-corner-hint,
    .vsh-tour-corner-skip,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-corner-hint,
    html:not([data-vsh-display-scale="100"]) .vsh-tour-corner-skip {
        font-size: calc(16px * var(--vsh-font-scale, 1)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vsh-tour-ring,
    .vsh-tour-bubble,
    .vsh-tour-welcome {
        transition: none;
    }
}
