/* Layout: one centered column (max 680px) — header, stepper, a single form card per step */
:root {
  --bg: #f2f5f8;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #12212e;
  --muted: #5a6a79;
  --line: #d8e0e7;
  --brand: #0b3c5d;
  --brand-2: #3d6680;
  --brand-ink: #ffffff;
  --brand-tint: #e8f0f6;
  --info-bg: #eef4fe;
  --info-line: #c9dafb;
  --info-ink: #1f4fa3;
  --notice-bg: #fff8e1;
  --notice-line: #f3dc8b;
  --ok: #1d7a4b;
  --ok-bg: #e8f6ee;
  --warn: #9a5200;
  --warn-bg: #fff3e0;
  --err: #c0362c;
  --err-bg: #fdecea;
  --focus: #2f7fd1;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 18px;
  --field-radius: 999px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c141c; --surface: #131f2a; --surface-2: #182633; --ink: #e5ecf2; --muted: #93a3b2;
    --line: #283a4a; --brand: #7fb3dc; --brand-2: #2e5878; --brand-ink: #08202f; --brand-tint: #1a3044;
    --info-bg: #142640; --info-line: #2a4673; --info-ink: #a9c6f5; --notice-bg: #2a2412; --notice-line: #5a4b1d;
    --ok: #6fd3a0; --ok-bg: #12301f; --warn: #f0b36b; --warn-bg: #33240f; --err: #ff8a80; --err-bg: #3a1714;
    --focus: #7fb3dc; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c141c; --surface: #131f2a; --surface-2: #182633; --ink: #e5ecf2; --muted: #93a3b2;
  --line: #283a4a; --brand: #7fb3dc; --brand-2: #2e5878; --brand-ink: #08202f; --brand-tint: #1a3044;
  --info-bg: #142640; --info-line: #2a4673; --info-ink: #a9c6f5; --notice-bg: #2a2412; --notice-line: #5a4b1d;
  --ok: #6fd3a0; --ok-bg: #12301f; --warn: #f0b36b; --warn-bg: #33240f; --err: #ff8a80; --err-bg: #3a1714;
  --focus: #7fb3dc; color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* 示範模式橫幅 */
.demo-bar {
  max-width: 680px; margin: 12px auto 0; padding: 8px 14px; border-radius: 12px;
  background: var(--warn-bg); color: var(--warn); font-size: 13px;
}

/* 頁首 */
.site-head { text-align: center; padding-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; }
.site-head h1 { margin: 6px 0 0; font-size: clamp(20px, 5vw, 24px); line-height: 1.35; text-wrap: balance; }
.site-head .sub { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.notice-pill {
  margin-top: 6px; padding: 5px 14px; border-radius: 999px; font-size: 12.5px;
  background: var(--notice-bg); border: 1px solid var(--notice-line); color: var(--ink);
}

/* 旅客切換列 */
.who-row { display: flex; flex-wrap: wrap; gap: 8px; }
.who {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center;
}
.who.is-current { border-color: var(--brand); color: var(--ink); font-weight: 700; }
.who.is-done { color: var(--ok); }

/* 步驟條 */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; min-width: 0; }
.step::before {
  content: ""; position: absolute; top: 16px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0;
}
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--brand); }
.dot {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.step.is-done .dot { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.step.is-current .dot { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.step-label { font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.step.is-current .step-label { color: var(--ink); font-weight: 700; }
@media (max-width: 480px) { .step-label { display: none; } .step.is-current .step-label { display: block; position: absolute; top: 38px; } .stepper { padding-bottom: 20px; } }

.progress { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }

/* 卡片 */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 1px 2px rgb(10 30 50 / .06), 0 8px 24px rgb(10 30 50 / .06); overflow: hidden; }
.card-head { background: linear-gradient(110deg, #0b3c5d, #3d6680); color: #fff; padding: 22px 28px; }
.card-head h2 { margin: 0; font-size: 18px; }
.card-head p { margin: 2px 0 0; font-size: 13px; opacity: .85; }
.card-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 480px) { .card-head, .card-body { padding-left: 18px; padding-right: 18px; } }

/* 欄位 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .legend { font-size: 14px; font-weight: 600; }
.req { color: var(--err); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--field-radius);
  padding: 10px 16px; min-height: 44px;
}
.textarea { border-radius: 16px; min-height: 96px; resize: vertical; }
.select { appearance: auto; }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.err-msg { font-size: 12.5px; color: var(--err); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--err); }
.num { font-family: var(--font-num); letter-spacing: .02em; }

.box { border: 1px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.info { border: 1px solid var(--info-line); background: var(--info-bg); color: var(--info-ink); border-radius: 16px; padding: 14px 18px; font-size: 14px; }
.info strong { display: block; margin-bottom: 2px; }
.info ul { margin: 4px 0 0; padding-left: 20px; }
.warn-box { border-radius: 14px; padding: 12px 16px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }
.err-box { border-radius: 14px; padding: 12px 16px; background: var(--err-bg); color: var(--err); font-size: 13.5px; }
.ok-box { border-radius: 14px; padding: 14px 18px; background: var(--ok-bg); color: var(--ok); }

.radio-line { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.radio-line input { width: 18px; height: 18px; accent-color: var(--brand); }

/* 選項卡（護照狀態） */
.choice-list { display: flex; flex-direction: column; gap: 12px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px 18px; cursor: pointer; background: var(--surface);
}
.choice input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.choice b { display: block; font-size: 15px; }
.choice span { font-size: 13px; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }

/* 勾選格（餐食） */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .chips { grid-template-columns: 1fr; } }
.chip { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; cursor: pointer; background: var(--surface); }
.chip input { width: 17px; height: 17px; accent-color: var(--brand); }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }

/* 按鈕 */
.actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 20px;
  min-height: 42px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.link { border: none; background: none; padding: 0; min-height: auto; color: var(--brand); font-weight: 600; font-size: 13px; }

/* 首頁入口 */
.entry-list { display: flex; flex-direction: column; gap: 12px; }
.entry {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px; padding: 16px 20px;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.entry:hover:not(:disabled) { border-color: var(--brand); }
.entry b { display: block; font-size: 16px; }
.entry span { color: var(--muted); font-size: 13.5px; }
.entry:disabled { cursor: not-allowed; opacity: .55; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr 1fr; } }
.fact { background: var(--surface-2); border-radius: 14px; padding: 10px 14px; }
.fact small { display: block; color: var(--muted); font-size: 12px; }
.fact b { font-variant-numeric: tabular-nums; font-size: 15px; }

/* 條款 */
.terms { border: 1px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.terms h3 { margin: 0; font-size: 16px; }
.terms .text { white-space: pre-line; font-size: 14px; color: var(--ink); max-height: 260px; overflow: auto; }
.agree { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.agree input { width: 18px; height: 18px; accent-color: var(--brand); }

/* 確認頁 */
.review-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.review-card > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; background: var(--surface-2); flex-wrap: wrap; }
.review-card > header b { font-size: 16px; }
.review-sec { padding: 12px 18px; border-top: 1px solid var(--line); }
.review-sec h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; font-size: 14px; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; } }
.kv div { min-width: 0; overflow-wrap: anywhere; }
.kv span { color: var(--muted); }

.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

.sample { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: var(--surface-2); }
.sample img { display: block; width: 100%; border-radius: 10px; }
.sample p { margin: 8px 4px 0; font-size: 12.5px; color: var(--muted); }

.upload-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.thumb { width: 120px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
