/* wizard.css — Wizard step by step (handoff ฉบับ 4 ข้อ F, จอ 06 NEW PLACE) · lib/wizard.js
   มือถือ: เต็มจอ ไม่มี tab bar (focus-mode), footer ติดล่าง · desktop: กลางจอ max-width 560 โครงเดียวกัน */

.wizard {
  display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto;
  min-height: calc(100dvh - env(safe-area-inset-top) - var(--s-2));
}
body.wizard-mode main#view { padding-left: 0; padding-right: 0; padding-bottom: 0; max-width: none; }

/* 1. header: ชื่องานตัวใหญ่ + × (ออกโดยบันทึกร่าง ไม่ถามซ้ำ) */
.wz-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) 12px 0 var(--edge); }
.wz-title { font-family: var(--font-hud); font-size: 18px; font-weight: var(--fw-bold); letter-spacing: .16em; text-transform: uppercase; }
.wz-close { color: var(--muted); }

/* 2. STEP n / N · NAME + DRAFT SAVED + แถบแบ่ง N ช่อง */
.wz-progress { display: flex; flex-direction: column; gap: var(--s-2); padding: 10px var(--edge) 0; }
.wz-progress-row { display: flex; justify-content: space-between; gap: var(--s-3); }
.wz-saved:empty::before { content: "\00a0"; }
.wz-bar > span { transition: background-color 200ms ease; }

/* 3. ขั้น: คำถามไทย 1 บรรทัด (24/600) + คำอธิบาย + field 1–3 ตัว */
.wz-body { flex: 1 1 auto; padding: 22px var(--edge) var(--s-4); overflow-x: hidden; }
.wz-step { display: flex; flex-direction: column; gap: 18px; }
.wz-ask { display: flex; flex-direction: column; gap: 4px; }
.wz-q { font-family: var(--font-ui); font-size: 1.5rem; font-weight: var(--fw-semibold); line-height: 1.4; letter-spacing: 0; outline: none; }
.wz-hint { font-size: var(--fs-sm); color: var(--muted); }
.wz-fields { display: flex; flex-direction: column; gap: 18px; }
.wz-field .input, .wz-field .select, .wz-field .textarea { min-height: 48px; }

/* 5. REVIEW: แถวสรุปต่อขั้น + EDIT */
.wz-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: 10px 12px; background: var(--panel); border-left: 2px solid var(--scan); }
.wz-fields > .wz-row + .wz-row, .wz-fields .wz-row + .wz-row { margin-top: -10px; }
.wz-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wz-row-v { font-size: 15px; overflow-wrap: anywhere; white-space: pre-line; }
.wz-edit { min-height: var(--touch); flex: 0 0 auto; }

/* 4. footer ติดล่าง: BACK (1 ส่วน) + NEXT → (2 ส่วน, chamfer อำพัน) */
.wz-foot {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: 12px var(--edge) calc(18px + env(safe-area-inset-bottom));
  background: rgba(10, 14, 16, .96); border-top: 1px solid var(--line);
}
.wz-foot-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.wz-foot .btn { min-height: 52px; }
.wz-back { color: var(--text); }
.wz-back[disabled] { color: var(--muted); border-color: var(--line); }
.wz-next { font-size: 15px; letter-spacing: .14em; }
.wz-next .ico { width: 14px; height: 14px; }
.wz-next[aria-busy="true"] { opacity: .8; }
.wz-reason { font-size: var(--fs-sm); color: var(--amber); border-left: 2px solid var(--amber); padding-left: var(--s-3); }

/* เปลี่ยนขั้น (ข้อ G): NEXT มาจากขวา, BACK มาจากซ้าย — 220ms ease-out · reduced: fade 160ms */
@keyframes wz-fwd { from { opacity: 0; transform: translateX(24px); } }
@keyframes wz-back { from { opacity: 0; transform: translateX(-24px); } }
@keyframes wz-fade { from { opacity: 0; } }
.wz-step.wz-fwd { animation: wz-fwd 220ms var(--ease-out) both; }
.wz-step.wz-back { animation: wz-back 220ms var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  .wz-step.wz-fwd, .wz-step.wz-back { animation: wz-fade 160ms ease both !important; animation-duration: 160ms !important; }
}

@media (min-width: 900px) {
  body.wizard-mode main#view { padding-top: var(--s-6); }
  .wizard { min-height: auto; border: 1px solid var(--line); background: var(--bg); }
  .wz-foot { position: static; padding-bottom: 18px; }
}
