:root {
  --kyoto-red: #d90429;      /* 稍微沈穩的京都紅 */
  --sakura-pink: #ffeaee;    /* 淡淡的櫻花粉背景 */
  --ink-black: #2b2d42;      /* 墨色文字 */
  --success-green: #52b788;
  --border-gray: #ccc;
  --light-bg: #f8f9fa;
}

/* 基礎設定 */
body { 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
  background-color: #f9f9f9; 
  padding: 20px; 
  color: var(--ink-black);
}

.container { 
  max-width: 500px; 
  margin: auto; 
  background: white; 
  /* 增加這行：確保在各機型都有呼吸空間，預設 20px 或遵循系統安全區 */
  padding: calc(env(safe-area-inset-top, 20px) + 10px) 20px 20px 20px; 
  border-radius: 12px; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.08); 
}

/* 標題與通用輸入 */
.section-title { 
  color: var(--kyoto-red); border-bottom: 2px solid #eee; 
  padding-bottom: 10px; margin-bottom: 20px; 
}

.input-row { margin-bottom: 15px; }
.input-row label { 
  display: block; font-weight: bold; margin-bottom: 8px; 
  font-size: 0.9em; color: #555; 
}

input[type="date"], input[type="number"], input[type="text"], input[type="tel"] {
  width: 100%; padding: 12px; border: 1px solid var(--border-gray); 
  border-radius: 8px; box-sizing: border-box; font-size: 16px; 
}

.styled-select {
  width: 100%;           /* 寬度撐滿 */
  padding: 16px 15px;    /* 內距，讓文字不擠在一起 */
  font-size: 16px;       /* 防止 iOS 自動放大網頁 */
  border: 1px solid #ccc;/* 邊框顏色 */
  border-radius: 12px;   /* ✨ 圓角設定，數值越大越圓 */
  background-color: #fff;/* 背景白 */
  color: #333;           /* 文字深灰色 */
  cursor: pointer;
  margin-bottom: 8px; 
  
  
  /* 移除瀏覽器預設樣式並自訂外觀 */
  -webkit-appearance: none; 
  -moz-appearance: none;
  appearance: none;

  /* 加上一個自訂的小箭頭 (選填) */
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="gray" viewBox="0 0 16 16"><path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.482a1 1 0 0 1-1.506 0z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 15px center; /* 箭頭靠右 15px */
}

/* 當選單被點擊時的藍色邊框 */
.styled-select:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}


/* 按鈕類 */
.btn-next {
  width: 100%; background-color: #4a90e2; color: white; padding: 15px;
  border: none; border-radius: 30px; font-size: 1.1em; font-weight: bold; 
  cursor: pointer; margin-top: 10px; transition: 0.3s;
}
.btn-next:hover { background-color: #357abd; }

.btn-lock {
  width: 100%; background-color: var(--light-bg); color: #495057; padding: 10px;
  border: 1px solid #ced4da; border-radius: 8px; cursor: pointer; 
  margin-top: 10px; font-weight: bold;
}

.btn-submit {
  width: 100%; background-color: var(--kyoto-red); color: white; padding: 18px;
  border: none; border-radius: 35px; font-size: 1.2em; font-weight: bold; cursor: pointer;
}

.hidden { display: none;  }


/* 鎖定後的樣式 */
.guest-box.locked {
  background-color: #fcfcfc;
  border-left: 5px solid var(--success-green);
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}


/* --- [ 自定義下拉與觸發器 ] --- */
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    height: 45px;
    cursor: pointer;
    box-sizing: border-box;
}

.custom-select-trigger:after {
  content: "▼"; font-size: 0.7em; color: #999; margin-left: auto;
}

/* 修改國碼觸發器 */
.dial-code-trigger {
    display: flex;
    align-items: center; /* 垂直絕對置中 */
    justify-content: center; /* 水平絕對置中 */
    padding: 0 6px; /* 縮小左右內距，為電話號碼騰出空間 */
    border: 1px solid #ddd;
    border-radius: 8px 0 0 8px;
    background: #f8f9fa;
    width: auto; /* 讓內容決定寬度 */
    min-width: 70px; /* 保底寬度，不讓極短國碼縮得太難看 */
    cursor: pointer;
    /* 這裡不用設定 font-weight，因為妳 JS 裡面的 dial-text 會處理 */
    gap: 5px; /* 這 5px 是國旗與數字之間最完美的距離，且它是 Flex 自動計算的 */
}

/* 國旗小郵票樣式 */
.flag-icon {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.1); 
    border-radius: 2px;
    flex-shrink: 0; /* 絕對不能被擠壓 */
    margin: 0; /* 移除間距，改由父層控制 */
    /* 在 Flex 容器下，不需要 vertical-align */
}

.phone-container { display: flex; align-items: stretch; }
.phone-container input { border-radius: 0 8px 8px 0; border-left: none; }

/* 身份選擇器 */
.identity-selector { background: var(--light-bg); padding: 12px; border-radius: 8px; margin-top: 10px; }
.radio-group { display: flex; gap: 15px; margin-top: 8px; }
.radio-label { font-weight: normal !important; cursor: pointer; display: flex; align-items: center; gap: 5px; }

/* --- [ 全域搜尋彈窗樣式 ] --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6); z-index: 10000;
  display: flex; justify-content: center; align-items: flex-start;
}

.modal-content {
  position: relative; top: 8%; width: 92%; max-width: 400px; 
  background: white; border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-header { 
  padding: 15px; border-bottom: 1px solid #eee; 
  display: flex; gap: 10px; align-items: center;
}

#modalSearchInput { 
  flex: 1; padding: 12px; font-size: 16px; 
  border: 1px solid #ddd; border-radius: 8px; outline: none;
}

.result-list { 
  max-height: 350px; 
  overflow-y: auto; -webkit-overflow-scrolling: touch; 
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
}

.result-item:active { background-color: #f1f3f5; }

.close-btn { 
  background: none; border: none; font-size: 28px; 
  cursor: pointer; color: #bbb; line-height: 1; padding: 0 5px;
}

/* 顯示資訊 (鎖定後) */
.display-info { line-height: 1.8; font-size: 0.95em; }
.display-info p {
  margin: 10px 0;
  border-bottom: 1px dashed #eee;
  padding-bottom: 5px;
  display: flex;
  align-items: center;
}

.display-info strong {
  color: #666;
  font-weight: 600;
  width: 100px; /* 固定寬度讓冒號對齊 */
  display: inline-block;
}

/* 確保國碼文字不變粗 */
.dial-text {
    font-weight: 400 !important;
}

/* 1. 數字徽章：米色系暖調 */
.guest-badge {
    /* 這裡就是徽章的「生命維持系統」 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; 
    height: 26px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0; /* 確保不管字多長都不會變橢圓 */
    
    /* 修改這裡：跟邊條同步成米色 */
    background-color: #FDF5E6; 
    color: #8b7d6b; /* 字用深一點的米褐色，才看得到數字 */
}




/* 5. 卡片外框與左側邊條 */
.guest-box {
    border: 1px solid #eee;
    border-left: 6px solid #FDF5E6; /* 初始米色左邊條 */
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    transition: all 0.4s ease;
}


/* 讓貴賓這兩個字感覺更高級一點 */
.guest-identity {
    font-family: "Microsoft JhengHei", sans-serif;
    color: #2c3e50;
}

.country-code-mono {
    /* 優先使用等寬字型 */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 400; /* 確保不加粗 */
    font-size: 13px;
    letter-spacing: 0.5px; /* 稍微拉開一點字距，更專業 */
    text-transform: uppercase; /* 強制大寫 */
}
.snapshot-flag {
    height: 14px;
    width: auto;
    border: 1px solid #eeeeee; /* 防止淺色國旗融入背景 */
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 1px; /* 稍微圓角，看起來更精緻 */
}

.locked-grid-item {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap; /* 確保 2x2 在正常情況下不換行 */
    text-overflow: ellipsis; /* 如果內容真的太長，用省略號 */
}
/* 錯誤狀態的框線 */
.field-error {
    border: 1px solid #ff4d4f !important;
    background-color: #fff1f0 !important;
}

/* 選填：輕微搖晃動畫，讓提示更明顯 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.shake {
    animation: shake 0.2s ease-in-out 0s 2;
}




/* 1. 圖片滑入動畫：讓妳圖床的照片由下往上浮現 */
.fade-in-up {
  animation: fadeInUp 1.0s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 2. 動態生成的打勾列樣式：對應妳 JS 注入的內容 */
.success-guest-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  font-size: 1.1rem;
}

/* 3. 確保圖床照片寬度乖乖聽話 */
#success-ui img {
  width: 100%;
  max-width: 450px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  margin: 20px auto;
  display: block;
}

/* 建議增加這個媒體查詢，針對 375px 以下的小螢幕 */
@media (max-width: 375px) {
    .display-info strong {
        width: 80px; /* 縮小標籤寬度 */
        font-size: 0.85em;
    }
    .radio-group {
        gap: 8px; /* 縮小日本居民/海外遊客的間距 */
    }
    .radio-label {
        font-size: 0.85em; /* 字體稍微縮小一點點 */
    }
}





/* 針對 A16 狹長螢幕的優化佈局 */
  #step-0 {
    display: flex; /* 必須是 flex，妳下面的垂直置中參數才有用 */
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding: 40px 20px;
    text-align: center;
}


/* 2. 確保 Sophia 貼在按鈕上 */
#sophia-welcome {
    width: 66%; 
    max-width: 200px;
    display: inline-block; /* 讓 text-align: center 生效 */
    margin-bottom: -14px;  /* 關鍵！讓她踩在按鈕上 */
    position: relative;    /* 確保她在層級上方 */
    z-index: 5;
    /* 移除掉之前那個版本多加的 shadow 和 border-radius */
    border-radius: 0; 
    box-shadow: none;
    pointer-events: none; /* 讓點擊穿透 Sophia，直接點到後面的按鈕或標籤 */
    user-select: none;    /* 防止房客長按按鈕時不小心選取到圖片 */
}

/* 3. 正攻法隱藏：利用「ID選擇器 + Class選擇器」組合 */
/* 權重說明：
   #step-0 (權重 100)
   #step-0.hidden (權重 100 + 10 = 110)
   因為 110 > 100，所以 display: none 會優雅地蓋過 display: flex，不需要 !important
*/
#step-0.hidden, 
#step-1.hidden, 
#step-2.hidden {
    display: none;
}

  .welcome-text {
    font-size: 20px; /* 字體放大 */
    font-weight: 400;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.4;
  }

  .agreement-label {
    font-size: 15px; /* checkbox 字縮小 */
    color: #666;
    margin-bottom: 30px;
  }

  .btn-start {
    width: 50%; /* 按鈕寬度適中 */
    padding: 15px;
    font-size: 18px;
    border-radius: 12px;
  }



  /* 新的語系導覽列樣式 */
.lang-switcher {
  width: 100%;
  display: flex;
  justify-content: center; /* 讓語系在正中間排排站 */
  align-items: center;
  gap: 12px;               /* 語系之間的間距，方便手指點選 */
  padding: 12px 0;         /* 上下留一點呼吸空間 */
  font-size: 14px;         /* A16 螢幕上清晰可讀的字體大小 */
  color: #888;
  background-color: #fff;  /* 確保背景乾淨 */
}

.lang-item {
  cursor: pointer;
  padding: 5px 2px;
}

/* 點選中的語系可以加個顏色或底線 */
.lang-item.active {
  color: #3498db;
  border-bottom: 2px solid #3498db;
  font-weight: bold;
}

/* 這樣就能確保「偷」過來的圖長得漂亮 */
#success-girl-display {
    width: 100%;
    max-width: 450px;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
