: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 { 
  display: none; /* 先讓整個世界消失 */
  max-width: 500px; 
  margin: auto; 
  background: white; 
  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); 
}

/* 2. 確保 Sophia 貼在按鈕上 - 完整回歸版 */
#sophia-welcome {
    width: 66%;         /* 或者妳原本精算的百分比 */
    max-width: 200px;
    display: inline-block;
    margin-bottom: -14px; /* 妳最關鍵的「踩腳」位移 */
    position: relative;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s;
}

  .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;
  }



/* 觸發後顯示並跑動畫 */
.is-visible {
  display: block !important;
  animation: fadeInUp 0.8s ease-out forwards;
}

/* 標題與通用輸入 */
.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;
  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;
}

.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;
}

/* 核心隱藏邏輯：加強權重防止與 Flex 衝突 */
.hidden { display: none !important; }

/* 鎖定後的樣式 */
.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;
    min-width: 70px;
    cursor: pointer;
    gap: 5px;
}

.flag-icon {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.1); 
    border-radius: 2px;
    flex-shrink: 0;
}

.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;
}

/* 1. 修正彈窗內容容器 */
.modal-content {
  /* 移除 position: relative 和 top: 8%，改用 margin 來推 */
  margin-top: 60px; 
  width: 92%; 
  max-width: 400px; 
  background: white; 
  border-radius: 16px; 
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  /* 確保它不會長得太誇張 */
  display: flex;
  flex-direction: column;
}

.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;
}

/* 2. 確保清單有基礎高度 */
.result-list { 
  height: 350px; /* 從 max-height 改成固定 height 測試看看 */
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch; 
  background: #ffffff;
}

.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;
}

/* 鎖定後資訊顯示樣式 */
.locked-info-grid {
    padding: 10px 0;
}

.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;
}

.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;
}

/* 動畫與特殊優化 */
.fade-in-up {
  animation: fadeInUp 1.0s ease-out forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.field-error {
    border: 1px solid #ff4d4f !important;
    background-color: #fff1f0 !important;
}

.shake {
    animation: shake 0.2s ease-in-out 0s 2;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* A16 與小螢幕優化 */
#step-0 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding: 40px 20px;
    text-align: center;
}

.lang-switcher {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 14px;
  color: #888;
}

.lang-item.active {
  color: #3498db;
  border-bottom: 2px solid #3498db;
  font-weight: bold;
}

/* 讓這一段排在 .btn-next 的下面 */

.btn-start {
  width: 50%;          /* 恢復適中，蓋掉 btn-next 的 100% */
  padding: 15px;       /* 恢復妳的 15px 厚度 */
  font-size: 18px;     /* 恢復妳的 18px 字體 */
  border-radius: 12px; /* 恢復妳精算的 12px 長方形，不准變 30px 圓石 */
  
  display: block;
  margin: 10px auto 0;
}