/* ============================================
   孕產兒健康陪伴關懷表 - 切版 CSS
   主色調：青藍綠系 (參考原圖配色)
   ============================================ */

:root {
  --bg: #dfe7e7;
  --page-width: 560px;
  --primary: #1aa7b2;
  --primary-dark: #0d8c96;
  --primary-light: #9ed6db;
  --border: #1aa7b2;
  --text: #1a1a1a;
  --muted: #666;
  --card-bg: #ffffff;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(13, 140, 150, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

.page {
  width: min(100%, var(--page-width));
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hidden { display: none !important; }
.hidden-by-logic { display: none !important; }

/* ============ 分頁 (Step) ============ */
.step {
  display: none;
  animation: fadeIn .25s ease;
}
.step.active { display: block; }

/* ============ 全顯模式 (debug / 切版檢視) ============ */
body.show-all .step { display: block !important; animation: none; }
body.show-all .progress,
body.show-all .nav-bar { display: none !important; }
body.show-all .step + .step { margin-top: 40px; }
/* 全顯模式的 step 分隔符：橫線 + 文字置中 (取代原本浮在半空的小膠囊) */
.debug-tag {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 3px;
  margin: 32px 0 24px;
}
.debug-tag::before,
.debug-tag::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--primary);
  opacity: .4;
  border-radius: 1px;
}

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

/* ============ 進度條 ============ */
.progress {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 10px 4px 12px;
  margin: -8px -20px 28px; /* 28px 底部間距：預留首張卡 legend (top:-19px) 空間 */
  padding-left: 20px;
  padding-right: 20px;
}
.progress-bar {
  height: 6px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(26,167,178,.2);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  width: 0;
  transition: width .3s ease;
  border-radius: 4px;
}
.progress-text {
  text-align: right;
  font-size: 12px;
  color: var(--primary-dark);
  margin-top: 4px;
  font-weight: 600;
}

/* ============ 導覽列 ============ */
.nav-bar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 28px 0 12px;
}
.nav-btn {
  flex: 1;
  height: 48px;
  border-radius: 26px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.nav-btn:hover {
  box-shadow: 0 4px 12px rgba(26,167,178,.25);
  transform: translateY(-1px);
}
.nav-btn:disabled,
.nav-btn:disabled:hover {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  background: #fff;
  color: var(--primary);
}
.nav-next:disabled,
.nav-submit:disabled,
.nav-finish:disabled,
.nav-next:disabled:hover,
.nav-submit:disabled:hover,
.nav-finish:disabled:hover {
  background: var(--primary);
  color: #fff;
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.nav-next,
.nav-submit,
.nav-finish {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(26,167,178,.3);
}
.nav-next:hover,
.nav-submit:hover,
.nav-finish:hover {
  background: var(--primary-dark);
}
.nav-prev {
  max-width: 120px;
}

/* ============ 頁首橫幅 ============ */
/* 素材已用 Python 把透明邊 trim 掉，直接以自然比例顯示即可。*/
.hero,
.hero-sub {
  position: relative;
  margin: 6px 0 18px;
}
.hero-banner {
  width: 100%;
  display: block;
}
.hero-title {
  position: absolute;
  top: 50%;
  left: 58%;                 /* 文字靠右 (左側是孕婦/女性插畫) */
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  margin: 0;
  white-space: nowrap;
  letter-spacing: 1px;
  text-shadow: 0 2px 3px rgba(0,0,0,.18);
}
.hero-sub .hero-title {
  left: 50%;                 /* 9.png 沒有人物，文字置中 */
  font-size: clamp(20px, 5.4vw, 28px);
}

/* 感謝橫幅：文字置中於整條橫幅 (對應 問卷13 原圖) */
.hero-thanks .hero-title {
  left: 50%;
  top:63%;
}

/* ============ 說明段落 ============ */
.intro {
  padding: 0 4px;
  margin: 0 0 22px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}
.intro p { margin: 8px 0; }

/* ============ 卡片 ============ */
.card {
  background: var(--card-bg);
  border: 2.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 32px 20px 22px;
  margin: 0 0 22px;
  position: relative;
  box-shadow: var(--shadow);
}
.card-title {
  background: var(--card-bg);
  border: 2.5px solid var(--primary);
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  position: absolute;
  top: -19px;
  left: 18px;
  line-height: 1.2;
}
.card-desc {
  margin: 6px 0 16px;
  color: #222;
  font-size: 16px;
  line-height: 1.65;
}

/* ============ 表單欄位 (姓名/Email) ============ */
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
}
.row-label {
  flex: 0 0 110px;
  font-size: 17px;
  font-weight: 500;
  color: #1a1a1a;
}
.row-label .hint {
  color: var(--muted);
  font-size: 14px;
  margin-left: 4px;
}
.text-input,
.select {
  flex: 1;
  height: 44px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 16px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.text-input:focus,
.select:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(26,167,178,.15);
}
.select {
  cursor: pointer;
  /* 寬度沿用上方 .text-input, .select { flex: 1 }：自動填滿 row 剩餘空間 */
}

/* ============ 個資提醒 ============ */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 2px dashed var(--primary);
  border-radius: 14px;
  background: #fff;
}
.notice-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-top: 2px;
}
.notice p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #222;
}

/* ============ 選項 (radio / checkbox) ============ */
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 10px 0;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.option:hover {
  background: #f5fbfb;
}
.option input[type="radio"],
.option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background: #fff;
  margin: 0;
}
.option input[type="checkbox"] {
  border-radius: 4px;
}
.option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}
.option input[type="checkbox"]:checked {
  background: var(--primary);
}
.option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.option span {
  font-size: 17px;
  color: #1a1a1a;
  flex: 1;
  font-weight: 500;
}
.option input[type="radio"]:checked ~ span,
.option input[type="checkbox"]:checked ~ span {
  color: #111;
}
.option:has(input:checked) {
  background: #eafafb;
  border-color: var(--primary-dark);
}

/* 內嵌輸入 (週數/其他) */
.inline-input {
  width: 70px;
  height: 32px;
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 16px;
  margin: 0 6px;
  font-family: inherit;
}
.inline-input.wide {
  width: 160px;
}

.multi-hint {
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0 10px;
}

/* ============ Yes/No 橫向 ============ */
.yesno {
  display: flex;
  gap: 12px;
}
.yesno .option {
  flex: 1;
  justify-content: center;
}

/* ============ 隱私權 ============ */
.privacy-box {
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 4px 0 18px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  font-size: 15px;
  line-height: 1.75;
}
.privacy-box h3 {
  font-size: 17px;
  margin: 12px 0 6px;
  color: #111;
  font-weight: 700;
}
.privacy-box h3:first-child { margin-top: 0; }
.privacy-box p { margin: 8px 0; color: #222; }
.privacy-box h4 { font-size: 15px; margin: 14px 0 6px; color: #111; font-weight: 700; }
.privacy-box ul, .privacy-box ol { margin: 8px 0; padding-left: 22px; color: #222; }
.privacy-box li { margin: 4px 0; }

.privacy-details { margin-top: 12px; }
.privacy-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  padding: 8px 0;
  list-style: revert;
}
.privacy-details summary:hover { text-decoration: underline; }
.privacy-details-content { margin-top: 8px; }

/* 隱私權閘門說明文字 — 恒顯，紅字提醒使用者需閱讀至底部
   選擇器加上 .privacy-ack 提升 specificity，覆蓋下方 .privacy-ack p 的預設色 */
.privacy-ack .privacy-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: #d32f2f;           /* 紅色警示 */
  font-weight: 600;
  line-height: 1.5;
}
/* 停用狀態的同意勾選視覺 */
.privacy-agree-label input:disabled + span {
  color: #999;
  cursor: not-allowed;
}
.privacy-agree-label input:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.privacy-ack {
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 16px 18px;
  background: #fff;
}
.privacy-ack p {
  margin: 8px 0 12px;
  font-size: 15px;
  color: #222;
  line-height: 1.7;
}

/* ============ APP 介紹 ============ */
.app-intro {
  margin: 28px 0 20px;
}

/* 頁首：AI Doctor 圓徽章 + 青綠色膠囊橫幅 */
.app-hero {
  position: relative;
  margin: 16px 0 24px;
}
.app-hero-image {
  display: block;
  width: 100%;
  height: auto;
}
/* 在 3.png 上疊一層青綠色 pill + 白字
   pill 左邊界刻意延伸到 AI Doctor 圓圈上，製造「插畫 + pill」交疊的層次感 */
.app-hero-text {
  position: absolute;
  top: 8%;
  left: 15%;               /* 延伸到 AI Doctor 圓圈右緣，覆蓋約 5% */
  right: 3%;
  bottom: 27%;             /* pill 比原本更高（避開 3.png 底部偏移陰影塊） */
  background: var(--primary);
  border: 2px solid var(--primary-dark);
  border-radius: 999px;    /* 兩端圓滑 → 膠囊形 */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 5vw, 28px);
  letter-spacing: .5px;
  text-shadow: 0 2px 3px rgba(0,0,0,.18);
  white-space: nowrap;
  pointer-events: none;
}

/* 核心功能 / 進階功能：圖示 + 文字 (非填滿膠囊，置中顯示) */
.section-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 28px 0 20px;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
}
.section-label img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* 三手機展示排 (4+5+6.png 並排) */
.phone-showcase {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 24px;
}
.phone-showcase img {
  flex: 1;
  min-width: 0;
  max-width: 33%;
  height: auto;
  object-fit: contain;
}

.intro-text {
  margin: 14px 4px;
  font-size: 16px;
  line-height: 1.75;
  color: #222;
  font-weight: 500;
}

/* 引言框（1.png 底 + 文字疊層）- 搭配進階功能副標 */
.quote-panel {
  position: relative;
  margin: 16px 0 20px;
}
.quote-panel-bg {
  display: block;
  width: 100%;
  height: auto;
}
.quote-panel-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  margin: 0;
  text-align: center;
  font-size: clamp(15px, 3.8vw, 19px);
  font-weight: 700;
  color: #222;
  line-height: 1.55;
  pointer-events: none;
}

.feature {
  display: flex;
  align-items: center;
  gap: 16px;                 /* 設計稿：圖文間留明顯間隔 */
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 14px;
  padding: 18px 16px;        /* 放寬內間距，對齊設計稿的呼吸感 */
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.feature-body {
  flex: 1;
  min-width: 0;
}
/* 原圖標題：青綠粗字、無底線、無 badge */
.feature-body h3 {
  color: var(--primary-dark);
  font-size: 24px;        /* 標題：最大 */
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: .3px;
}
.feature-body p {
  margin: 8px 0;
  font-size: 19px;        /* 內容：居中 */
  color: #222;
  line-height: 1.65;
  font-weight: 700;
}
.feature-body ul {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 15px;        /* 項目：最小 */
  color: #222;
  line-height: 1.7;
}
.feature-body li {
  margin: 4px 0;
  list-style: disc;
}
.feature-body li::marker { color: var(--primary); }

/* 右側插畫 — 依設計稿佔卡片寬度約 32%，並設定最大值避免過寬
   align-self: flex-end 讓插畫在 flex row 裡對齊右下角 */
.feature-illust {
  width: 32%;
  max-width: 160px;
  min-width: 120px;          /* 文字很長時也不要縮得太小 */
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  align-self: flex-end;      /* 垂直貼底 → 整體落在卡片右下角 */
}


/* 頁末總結區：文字 + 寶寶+BABY 積木插畫 */
/* 結尾總結：文字在上、插畫置中在下 (對應 問卷13 結尾原圖) */
.outro {
  margin-top: 24px;
}
.outro .intro-text {
  margin: 0 0 12px;
  font-size: 19px;          /* 比一般 intro-text 更大，作為收尾強調 */
  font-weight: 600;
  line-height: 1.75;
  color: #1a1a1a;
  text-align: left;
}
.outro-illust {
  display: block;
  width: 280px;
  max-width: 80%;
  height: auto;
  margin: 0 auto;           /* 水平置中 */
}

/* ============ 送出按鈕 ============ */
.submit-wrap {
  text-align: center;
  margin: 30px 0 12px;
}
.submit-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 60px;
  border-radius: 30px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26,167,178,.35);
  transition: transform .1s, box-shadow .1s;
  font-family: inherit;
}
.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(26,167,178,.45);
}
.submit-btn:active {
  transform: translateY(0);
}

/* ============ 感謝頁 ============ */
.thanks-card,
.thanks .card {
  padding: 22px 20px;
  text-align: left;
  font-size: 16px;
  line-height: 1.75;
  color: #222;
}
.thanks-card p,
.thanks .card p {
  color: #222;
  font-size: 16px;
  margin: 8px 0 14px;
}
.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  padding: 12px 26px;
  border-radius: 26px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  margin-top: 12px;
  box-shadow: 0 3px 10px rgba(26,167,178,.3);
}
.plane-icon {
  width: 22px;
  height: 22px;
  stroke: #fff;
  flex-shrink: 0;
}

/* ============ 自訂 Dialog (取代 alert) ============ */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.dialog-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.dialog {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .28);
  width: min(100%, 380px);
  padding: 28px 24px 22px;
  text-align: center;
  transform: translateY(12px) scale(.96);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.dialog-backdrop.is-open .dialog {
  transform: translateY(0) scale(1);
}
.dialog-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffe8a3, #ffc658);
  color: #7a4500;
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* 變體：成功/完成 */
.dialog-icon.is-success {
  background: linear-gradient(135deg, #b8e4c9, var(--primary-light));
  color: var(--primary-dark);
}
/* 變體：錯誤 */
.dialog-icon.is-error {
  background: linear-gradient(135deg, #ffcdd2, #ef9a9a);
  color: #b71c1c;
}
.dialog-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: #1a1a1a;
  letter-spacing: .3px;
}
.dialog-message {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  word-break: break-word;
  white-space: pre-line;   /* 讓訊息中的 \n 能換行 */
}
.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.dialog-btn {
  min-width: 120px;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 22px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .08s;
  box-shadow: 0 3px 10px rgba(26,167,178,.28);
}
.dialog-btn:hover { background: var(--primary-dark); }
.dialog-btn:active { transform: translateY(1px); }

/* ============ RWD ============ */
@media (max-width: 480px) {
  .page { padding: 16px 14px 40px; }
  .hero-title { font-size: 18px; }
  .hero-sub .hero-title { font-size: 16px; }
  .row { flex-direction: column; align-items: stretch; gap: 4px; }
  .row-label { flex: none; }
  .select { width: 100%; flex: 1; }
  .feature { flex-direction: column; }
  .feature-phone { width: 140px; align-self: center; }
  .yesno { flex-direction: column; }
  .dialog { padding: 22px 18px 18px; }
}
