/* ==========================================================================
   ฟอนต์ Prompt เก็บไว้ในเว็บเอง (เดิมโหลดจาก Google Fonts ซึ่งถูกบล็อกในจีนแผ่นดินใหญ่)
   ไฟล์และ unicode-range คัดลอกจาก Google Fonts (Prompt v12, SIL Open Font License)
   เบราว์เซอร์โหลดเฉพาะไฟล์ที่มีตัวอักษรบนหน้าจริง (เช่น หน้าอังกฤษไม่โหลดไฟล์ไทย)
   ========================================================================== */
/* thai 300 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/prompt-300-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* vietnamese 300 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/prompt-300-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext 300 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/prompt-300-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin 300 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/prompt-300-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* thai 400 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/prompt-400-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* vietnamese 400 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/prompt-400-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext 400 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/prompt-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin 400 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/prompt-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* thai 500 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/prompt-500-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* vietnamese 500 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/prompt-500-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext 500 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/prompt-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin 500 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/prompt-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* thai 600 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/prompt-600-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* vietnamese 600 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/prompt-600-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext 600 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/prompt-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin 600 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/prompt-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* thai 700 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/prompt-700-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* vietnamese 700 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/prompt-700-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext 700 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/prompt-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin 700 */
@font-face {
  font-family: 'Prompt';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/prompt-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   SUITCUBE AI — Option 02 Guided Fit / Task First
   Design System & Responsive Stylesheet
   ========================================================================== */

:root {
  /* ── ฟอนต์ ── */
  --font-main: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font-main); /* CI ใช้ Prompt ทั้งหมด (ตามเว็บ suitcube.com) */

  /* ── พื้นผิว (จากสว่างไปเข้ม) ── */
  --bg-card: #FFFFFF;            /* การ์ด ปุ่มรอง ช่องกรอก */
  --paper: #FCFBF7;              /* กระดาษตั๋ว */
  --bg-accent-light: #FBF8F2;
  --surface-subtle: #FAF9F6;     /* คอลัมน์ข้าง แถบล่างการ์ด */
  --bg-page: #F6F5F1;            /* พื้นหลังหน้า */
  --surface-hover: #F6F5F1;      /* ปุ่มรองตอนชี้ */
  --well: #F4F1EA;               /* ช่องที่บุ๋มลง: แถบเลือกเพศ กรอบรูป สายวัด */
  --well-deep: #ECE8DF;          /* พื้นหลังรูปก่อนโหลด */
  --navy: #1C2638;                /* ผ้าสูท: ปุ่มหลัก การ์ดไซส์ */
  --navy-deep: #131A28;

  /* ── ตัวหนังสือ ── */
  --ink-primary: #1A2130;         /* navy เข้ม */
  /* หมึกรองอมน้ำเงินผ้าสูทเล็กน้อย — ผ่าน 4.5:1 บนกระดาษทุกเฉด */
  --ink-secondary: #59606E;
  --ink-muted: #666C78;
  --on-dark: #FFFFFF;            /* ตัวหนังสือ/ไอคอนบนพื้น navy ทอง แดง */

  /* ── ทอง 3 ระดับตามหน้าที่: พื้น/เส้น · เครื่องหมาย (ไอคอน ≥3:1) · ตัวหนังสือ (≥4.5:1) ── */
  --gold-primary: #C3933E;
  --gold-mark: #A5782B;
  --gold-dark: #86621F;
  --gold-light: #F4EEDB;
  --gold-glow: rgba(195, 147, 62, 0.28);
  --thread: #D4B06A;             /* ด้ายทองบนพื้น navy (สว่างกว่าทองหลัก) */
  --thread-soft: #B99C5F;        /* ขีดบนสายวัดของตั๋ว */

  /* ── เส้น ── */
  --border-subtle: #EAE7E1;      /* ขอบการ์ด เส้นแบ่งบาง */
  --border-control: #DCD7CE;     /* ขอบช่องกรอก/ปุ่มเลือกไฟล์ */
  --border-strong: #C8C5BD;      /* ขอบปุ่มช่วยเหลือ */
  --paper-line: #E6E0D2;         /* เส้นบรรทัดบนกระดาษ */
  --stitch: #D9D0BC;             /* รอยเย็บบนพื้นอ่อน */
  --gold-line: #E3D2AC;          /* เส้นประอมทอง */
  --gold-line-strong: #D9C9A6;

  /* ── สถานะ ── */
  --danger: #B5372A;
  --danger-ink: #9E3226;
  --danger-bg: #FDF6F5;
  --danger-line: #F0D4D0;
  --success: #2E7D32;

  /* ── รูปทรง เงา ระยะ ── */
  --radius-card: 18px;
  --radius-inner: 10px;
  --radius-pill: 9999px;
  --shadow-soft: 0 10px 32px rgba(25, 26, 25, 0.04);
  --shadow-card: 0 14px 44px rgba(20, 22, 20, 0.06);
  /* ระยะที่การ์ดขั้นตอนขยับขึ้นไปทับรูป hero (ใช้ร่วมกับตำแหน่งป้ายใน hero) */
  --hero-overlap: 200px;

  /* ── จังหวะการเคลื่อนไหว ── */
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.3, .64, 1);
  --dur-fast: 150ms;
  --dur-base: 320ms;
  --dur-slow: 450ms;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--ink-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh; /* มือถือ: ไม่นับแถบ address bar ที่ยืด/หด */
  display: flex;
  flex-direction: column;
}

button, input, a {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 3px;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  height: 74px;
  box-shadow: inset 0 -1px 0 var(--border-subtle), inset 0 -2px 0 var(--gold-light);
}

.header-inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--ink-primary);
}

.brand-logo {
  display: block;
  height: 30px;
  width: auto;
}

@media (max-width: 860px) {
  .brand-logo {
    height: 24px;
  }
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-secondary);
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover {
  color: var(--ink-primary);
}

.stylist-link {
  color: var(--ink-primary);
  font-weight: 500;
}

.icon-chat {
  color: var(--gold-mark);
}

.nav-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border-subtle);
}

.mobile-nav-wrap {
  display: none;
  align-items: center;
  gap: 14px;
}

.mobile-stylist-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-primary);
}

.mobile-stylist-btn svg {
  color: var(--gold-mark);
}

.mobile-menu-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink-primary);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
main {
  width: 100%;
  flex: 1;
}

/* เนื้อหาใต้ hero ล็อกความกว้างไว้เท่าเดิม (hero กว้างเต็มจอ) */
.main-inner {
  position: relative; /* อยู่เหนือรูป hero ตอนขยับขึ้นไปทับ */
  z-index: 2;
  max-width: 1280px;
  margin: calc(-1 * var(--hero-overlap)) auto 0;
  padding: 0 32px 60px;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
/* hero ชนขอบจอซ้าย-ขวา ข้อความยังตรงแนวกับเนื้อหาด้านล่าง (container 1280 - padding 32) */
.hero-section {
  --hero-gutter: max(44px, calc((100% - 1280px) / 2 + 44px));
  position: relative;
  overflow: hidden;
  min-height: 460px;
  padding: 72px var(--hero-gutter) 120px;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-img {
  width: 100%;
  object-fit: cover;
  object-position: 76% 20%;
  /* parallax: เผื่อความสูงรูปไว้ให้เลื่อนลงได้ 54px โดยไม่เห็นขอบ (JS ขยับ transform) */
  position: absolute;
  top: -12%;
  left: 0;
  height: 124%;
  will-change: transform;
}

/* ขอบล่างค่อยๆ จางกลืนกับพื้นหลังหน้า + เงาอ่อนด้านซ้ายหลังข้อความให้อ่านง่าย */
.hero-fade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(246, 245, 241, 0) 55%, rgba(246, 245, 241, 0.7) 82%, var(--bg-page) 100%),
    linear-gradient(90deg, rgba(246, 245, 241, 0.55) 0%, rgba(246, 245, 241, 0.2) 38%, rgba(246, 245, 241, 0) 58%);
}

.hero-left {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.hero-title {
  color: var(--ink-primary);
}

.hero-gold {
  display: block;
  font-size: 1.75rem;
  color: var(--gold-mark);
  margin-top: 6px;
  letter-spacing: -0.3px;
}

.hero-subtitle {
  font-size: 0.9375rem;
  color: var(--ink-secondary);
  margin-top: 14px;
  max-width: 320px; /* ตัดขึ้นบรรทัดใหม่ก่อนถึงต้นไม้ในรูป */
  line-height: 1.6;
}

.hero-book-tag {
  position: absolute;
  z-index: 1;
  top: 28px;
  right: var(--hero-gutter);
  color: var(--on-dark);
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  background: var(--navy);
  outline: 1px dashed var(--thread);
  outline-offset: -5px;
  padding: 9px 14px;
  border-radius: 3px;
  backdrop-filter: none;
}

.hero-book-tag small {
  font-size: 0.6875rem;
  font-weight: 500;
}

.hero-motto {
  position: absolute;
  z-index: 1;
  right: var(--hero-gutter);
  bottom: calc(var(--hero-overlap) + 28px); /* อยู่เหนือการ์ดที่ขยับขึ้นมาทับ */
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 18px;
  /* รูปเต็มแล้ว ตำแหน่งนี้ทับสูทสีดำ — ใช้ตัวอักษรสีอ่อนแทนสีเทา */
  border-left: 1px solid rgba(255, 255, 255, 0.55);
  font-size: 0.6875rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.92);
  /* จอแคบข้อความจะไปตกบนผนังสีอ่อน — เงา navy สองชั้นพยุงให้อ่านได้ทั้งบนสูทและบนผนัง */
  text-shadow: 0 1px 2px rgba(19, 26, 40, 0.65), 0 0 14px rgba(19, 26, 40, 0.55);
  font-weight: 500;
}

/* ==========================================================================
   Consent, Retake & Result Notes
   ========================================================================== */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 22px 0 4px;
  padding: 14px 16px;
  background: var(--bg-accent-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background var(--dur-base) ease, border-color var(--dur-base) ease;
}

.consent input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

.inline-link {
  color: var(--gold-dark);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.photo-card.photo-failed {
  border: 1.5px solid var(--danger);
  background: var(--danger-bg);
}

.retake-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--danger);
  color: var(--on-dark);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.result-alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-inner);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger-ink);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.result-notes {
  margin: 0 0 14px;
  padding: 12px 14px;
  list-style: none; /* ข้อความเตือนจาก API มีไอคอนนำหน้าอยู่แล้ว */
  border-radius: var(--radius-inner);
  background: var(--bg-accent-light);
  color: var(--ink-secondary);
  font-size: 0.7812rem;
  line-height: 1.65;
}

.result-notes li + li {
  margin-top: 6px;
}

.workspace-footer.workspace-footer-single {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   Mobile Stepper (Hidden on Desktop)
   ========================================================================== */
.mobile-stepper {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 18px;
}

.mobile-step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: 12px;
}

.mobile-step-dots {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mob-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 500;
  display: grid;
  place-items: center;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base), box-shadow var(--dur-base);
  background: var(--bg-card);
  box-shadow: inset 0 0 0 1.5px var(--stitch);
  color: var(--ink-muted);
  /* stepper มือถือเป็นปุ่มจริง: กดได้ด้วยคีย์บอร์ด + พื้นที่กด 44px */
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.mob-line {
  flex: 1;
  margin: 0 8px;
  height: 0;
  background: none;
  border-top: 2px dashed var(--stitch);
  position: relative;
}

/* ==========================================================================
   Main Workspace Card
   ========================================================================== */
.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 42px;
}

.workspace-body {
  display: grid;
  grid-template-columns: 210px 1fr 400px;
  min-height: 520px;
}

.workspace-body.no-guide {
  grid-template-columns: 210px 1fr;
}

.workspace-body.no-guide .guide-column {
  display: none;
}

/* Left: Desktop Stepper */
.steps-column {
  padding: 38px 24px;
  background: var(--paper);
  border-right: 1px dashed var(--stitch);
}

.step {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-muted);
  position: relative;
  margin-bottom: 38px;
  transition: all 0.15s ease;
}

.step:last-child {
  margin-bottom: 0;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 42px;
  height: 28px;
  /* stepper = หมุดกลัดบนรอยเย็บ: เส้นเชื่อมเป็นเส้นประ จุดเสร็จเป็นหมุดทอง จุดปัจจุบันเป็น navy ล้อมด้ายทอง */
  width: 0;
  background: none;
  border-left: 2px dashed var(--stitch);
}

.step b {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 500;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base), box-shadow var(--dur-base);
  box-shadow: inset 0 0 0 1.5px var(--stitch);
}

.step.active {
  color: var(--ink-primary);
  font-weight: 600;
}

.step:disabled {
  cursor: default;
}

/* Center: Surface Column */
.surface-column {
  padding: 38px 40px;
  min-width: 0;
}

.surface-column h2 {
  color: var(--ink-primary);
  margin-bottom: 4px;
}

.surface-column .sub {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  margin-bottom: 24px;
}

/* Gender Toggle Tabs */
.gender {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--well);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px;
  margin: 18px 0 24px;
  position: relative;
}

.gender button {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-secondary);
  border-radius: 6px;
  position: relative;
  z-index: 1;
  transition: color var(--dur-base) ease, font-weight 0s;
}

.gender button.selected {
  color: var(--on-dark);
  font-weight: 500;
  background: transparent;
  box-shadow: none;
}

/* Form Inputs */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-primary);
  margin-bottom: 6px;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--bg-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrap:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.input-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 0.9375rem;
  outline: none;
  min-width: 0;
  color: var(--ink-primary);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) var(--ease-out), background var(--dur-fast) ease;
}

.input-wrap .unit-tag,
.input-wrap span {
  padding: 0 10px;
  color: var(--ink-secondary);
  font-size: 0.875rem;
}

.inline-help-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  margin-right: 10px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.inline-help-btn:hover {
  border-color: var(--gold-mark);
  color: var(--gold-dark);
}

.hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin: 5px 0 0;
}

/* Actions & Buttons */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.primary {
  color: var(--on-dark);
  border: 1px solid var(--ink-primary);
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 0.9375rem;
  font-weight: 500;
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--navy);
  border-color: var(--navy);
}

.primary:active {
  transform: translateY(1px);
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
  transition: opacity var(--dur-base) ease;
}

.secondary {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 13px 20px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-primary);
}

.secondary:hover {
  background: var(--surface-hover);
}

.form-foot {
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 18px;
}

/* Right: Guide Column */
.guide-column {
  background: var(--surface-subtle);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.guide-accordion-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
}

.guide-acc-text {
  display: flex;
  flex-direction: column;
}

.guide-acc-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.guide-acc-summary {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.guide-acc-arrow {
  transition: transform 0.2s ease;
}

.guide-box {
  position: relative;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  background: var(--well-deep) url('images/preparation-fabric-tape.webp') center / cover no-repeat;
}

.guide-overlay {
  position: relative;
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 14px;
  padding: 22px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.guide-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-primary);
  margin-bottom: 20px;
}

.guide-tips-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.guide-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.tip-icon-wrap {
  color: var(--gold-mark);
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.tip-text strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.tip-text p {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-top: 2px;
}

.guide-learn-more {
  margin-top: 20px;
  display: block;
  font-size: 0.8125rem;
  color: var(--gold-dark);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-align: left;
}

/* Card Footer Utility Links */
.workspace-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
}

.footer-link-item {
  display: flex;
  justify-content: center;
}

.btn-utility-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink-secondary);
  transition: color 0.15s ease;
}

.btn-utility-link:hover {
  color: var(--ink-primary);
}

.btn-utility-link strong {
  font-weight: 500;
  color: var(--ink-primary);
}

/* ==========================================================================
   Photo Upload Step (Step 1)
   ========================================================================== */
.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0 20px;
}

.photo-card {
  border: 1px dashed var(--stitch);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) ease;
  border-color: var(--gold-line);
  background: var(--paper);
}

.photo-preview {
  height: 180px;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--gold-mark);
  background: var(--well);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

/* absolute ให้รูปยึดกรอบช่อง — ถ้าเป็น grid item ธรรมดา height:100% ไม่ทำงาน
   รูปจะโชว์ขนาดจริงจนเห็นแค่หัว และดันการ์ดให้กว้างล้นขอบ */
.photo-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--well-deep);
}

.sample-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20, 20, 20, 0.78);
  backdrop-filter: blur(4px);
  color: var(--on-dark);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ก่อนอัปโหลด: แสดงท่ายืนตัวอย่างแบบจาง ให้ต่างจากรูปที่อัปโหลดจริงชัดเจน */
.photo-preview .photo-example {
  padding: 10px 0;
  background: transparent;
  opacity: 0.55;
  mix-blend-mode: multiply;
}

.check-mark-text {
  color: var(--success);
  margin-left: 4px;
  font-weight: bold;
}

.photo-card strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-primary);
}

.photo-card label {
  display: inline-block;
  margin-top: 8px;
  border: 1px solid var(--border-control);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.75rem;
  cursor: pointer;
  background: var(--bg-card);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.photo-card label:hover {
  background: var(--surface-hover);
}

.photo-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.remove-photo-btn,
.photo-card button {
  margin-top: 6px;
  font-size: 0.6875rem;
  color: var(--danger-ink);
  text-decoration: underline;
}

.privacy {
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-top: 14px;
}

.error {
  color: var(--danger);
  font-size: 0.8125rem;
  margin: 12px 0 0;
}

.error:empty {
  display: none;
}

/* ==========================================================================
   Review Step (Step 2) & Result Step (Step 3)
   ========================================================================= */
.review {
  margin: 20px 0;
}

.review > div {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 0.875rem;
}

.review strong {
  font-weight: 500;
}

.mini-photos-wrap {
  margin: 18px 0;
}

.mini-photos-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: 8px;
}

.mini-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mini-photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mini-photo-item img {
  width: 100%;
  height: 80px;
  object-fit: contain;
  background: var(--well);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.mini-photo-item small {
  font-size: 0.6875rem;
  color: var(--ink-secondary);
}

/* Modal Media Guides */
.modal-photo-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}

.modal-photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modal-photo-item img {
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: var(--well);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.modal-photo-item small {
  font-size: 0.6875rem;
  color: var(--ink-secondary);
}

.text-button {
  color: var(--gold-dark);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin-top: 6px;
}

/* ==========================================================================
   Result Page (Step 4) — full card width, size card + measurements
   ========================================================================== */
#workspace-body.result-mode .surface-column {
  padding: 34px 40px 40px;
}

.result-title {
  text-align: center;
  margin-bottom: 26px;
}

.surface-column .result-title h2 {
  text-wrap: balance;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) 1.25fr;
  gap: 20px;
  align-items: start;
}

.result-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Size card */
.size-card {
  color: var(--on-dark);
  border-radius: var(--radius-card);
  /* การ์ดไซส์ = ป้ายทอติดเสื้อ: navy ขอบด้ายทองเย็บโดยรอบ */
  position: relative;
  background: var(--navy);
  padding: 26px 28px 20px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.size-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .78);
}

.size-main {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(195, 147, 62, 0.45);
  border-bottom-color: rgba(212, 176, 106, .5);
  flex-wrap: wrap; row-gap: 10px;
}

.size-num {
  font-size: 4.75rem;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  letter-spacing: -2px;
}

.size-len {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding-bottom: 6px;
}

.size-len b {
  font-size: 1.625rem;
  font-weight: 600;
}

.size-len small {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.75);
}

.result-badge {
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
  background: var(--gold-primary);
  color: var(--ink-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.size-alt {
  margin-top: 14px;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
}

.size-alt b {
  margin-left: 6px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--on-dark);
}

.size-illus {
  display: block;
  width: 190px;   /* ภาพ 560×718 */
  height: auto;
  margin: 18px auto 6px;
}

/* Soft white cards */
.soft-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap; gap: 6px 12px;
}

.card-head h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink-primary);
}

.card-head h3 .ic {
  width: 28px;
  height: 28px;
  color: var(--gold-mark);
}

.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--gold-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.edit-link .ic {
  width: 15px;
  height: 15px;
}

.unit-pill {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--paper-line);
}

.info-list {
  list-style: none;
}

.info-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  font-size: 0.875rem;
  color: var(--ink-primary);
  min-width: 0;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list .ic {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--ink-secondary);
}

/* Measurements */
.measure-card {
  padding: 22px 26px 24px;
  /* ปุ่มเรียงตามความกว้างของการ์ดเอง (มีคอลัมน์ขั้นตอนด้านซ้าย การ์ดจึงแคบได้แม้จอกว้าง) */
  container-type: inline-size;
}

.measure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.measure-item {
  padding: 14px 16px 14px 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.measure-item:nth-child(odd) {
  border-right: 1px solid var(--border-subtle);
}

.measure-item:nth-child(even) {
  padding-left: 30px;
}

.measure-item:nth-last-child(-n + 2) {
  border-bottom: none;
}

.measure-item span {
  display: block;
  font-size: 0.9375rem;
  color: var(--ink-secondary);
  margin-bottom: 2px;
}

.measure-item strong {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.result-note {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-inner);
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gold-dark);
  margin-bottom: 18px;
  background: var(--gold-light);
  border: 1px dashed var(--gold-line);
}

.result-note .ic {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--gold-mark);
}

.result-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.result-actions .primary,
.result-actions .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}

@container (max-width: 500px) {
  .result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .result-actions .text-button {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@container (max-width: 340px) {
  .result-actions {
    grid-template-columns: 1fr;
  }
}

.result-actions .ic {
  width: 20px;
  height: 20px;
}

.result-actions .text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 6px;
}

.result-actions .text-button .ic {
  width: 16px;
  height: 16px;
}

.print-only {
  display: none;
}

.loading {
  text-align: center;
  padding: 60px 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   4 ขั้นตอนสู่ขนาดของคุณ (Journey Section)
   ========================================================================== */

/* ==========================================================================
   Footer & Dialog
   ========================================================================== */
footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  padding: 22px 0;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-secondary);
}

.footer-inner small {
  font-size: 0.6875rem;
  margin-left: 6px;
  letter-spacing: 2px;
  color: var(--gold-dark);
}

.footer-inner button {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  text-decoration: underline;
}

dialog {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  max-width: 500px;
  width: calc(100% - 32px);
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  margin: auto;
}

dialog::backdrop {
  background: rgba(15, 16, 15, 0.5);
  backdrop-filter: blur(4px);
}

dialog h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--ink-primary);
}

dialog p, dialog li {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--ink-secondary);
}

dialog ol {
  padding-left: 20px;
  margin: 12px 0;
}

dialog .primary {
  width: 100%;
  margin-top: 22px;
}

dialog a {
  color: var(--gold-dark);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1080px) {
  .workspace-body {
    grid-template-columns: 190px 1fr 290px;
  }

  .workspace-body.no-guide {
    grid-template-columns: 190px 1fr;
  }

}

@media (max-width: 860px) {
  header {
    height: 64px;
  }
  
  .header-inner {
    padding: 0 18px;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .mobile-nav-wrap {
    display: flex;
  }
  
  .main-inner {
    margin-top: 0; /* จอเล็กไม่มีรูป hero ไม่ต้องทับ */
    padding: 0 16px 40px;
  }

  .hero-section {
    min-height: 0;
    padding: 20px 16px 0;
    margin-bottom: 20px;
  }

  .hero-bg,
  .hero-book-tag,
  .hero-motto {
    display: none; /* Matches mobile mockup layout */
  }

  
  .hero-gold {
    font-size: 1.375rem;
    color: var(--gold-dark);
  }
  
  .hero-subtitle {
    font-size: 0.875rem;
  }
  
  /* Show Mobile Stepper */
  .mobile-stepper {
    display: block;
  }
  
  .workspace-card {
    border-radius: 14px;
    margin-bottom: 24px;
  }
  
  .workspace-body {
    display: flex;
    flex-direction: column;
  }
  
  /* Hide Desktop Stepper */
  .steps-column {
    display: none;
  }
  
  .surface-column {
    padding: 24px 20px;
  }
  
  /* Guide Accordion on Mobile */
  .guide-column {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  
  .guide-accordion-header {
    display: flex;
  }
  
  .guide-column.accordion-open .guide-acc-arrow {
    transform: rotate(180deg);
  }
  
  .guide-box {
    padding: 20px;
  }
  
  /* Workspace Footer */
  .workspace-footer {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 20px;
    text-align: center;
  }
  
  
  /* Sticky Action Button on Mobile (Matching Mockup) */
  .actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 14px 0 8px;
    margin-top: 18px;
    z-index: 20;
    box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.95);
  }
  

  .footer-inner {
    padding: 0 18px;
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

@media print {
  header, footer, .steps-column, .guide-column, .hero-section, .mobile-stepper, .workspace-footer, .picks-section, .actions {
    display: none !important;
  }
  .workspace-card {
    border: none;
    box-shadow: none;
  }
  .surface-column {
    padding: 0;
  }
}

/* ==========================================================================
   Result Page — phone / tablet (≤860px) and print
   ========================================================================== */
@media (max-width: 860px) {
  #workspace-body.result-mode .surface-column {
    padding: 22px 16px 24px;
  }

  .result-title {
    margin-bottom: 18px;
  }

  .result-layout,
  .result-side {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .size-num {
    font-size: 3.75rem;
  }

  .size-illus {
    display: none;
  }

  .soft-card,
  .measure-card {
    padding: 16px 16px 18px;
  }

  .info-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }

  .info-list li {
    padding: 6px 0;
    font-size: 0.8125rem;
    gap: 10px;
  }

  .measure-item {
    padding: 9px 10px 9px 2px;
  }

  .measure-item:nth-child(even) {
    padding-left: 18px;
  }

  .measure-item span {
    font-size: 0.75rem;
  }

  .measure-item strong {
    font-size: 1.125rem;
  }

  .result-note {
    font-size: 0.7812rem;
  }

  .result-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-actions .text-button {
    justify-self: center;
  }
}

@media print {
  .print-only {
    display: block;
  }

  .print-logo {
    height: 28px;
    width: auto;
    margin: 0 auto 14px;
  }

  .result-actions,
  .edit-link,
  .mobile-stepper {
    display: none !important;
  }

  #workspace-body.result-mode .surface-column {
    padding: 0;
  }
}

/* ==========================================================================
   Motion system — ลื่น นุ่ม ไม่รีบ (ภาษาเดียวกันทั้งหน้า)
   easing ชุดเดียว · เข้า 320–450ms / ออก 150ms · stagger 55ms · ปิดหมดเมื่อ reduce-motion
   ========================================================================== */

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--stitch) var(--bg-page);
}

/* ── เนื้อหาในการ์ดลอยขึ้นทีละชิ้นตอนเปลี่ยนขั้น (JS ใส่ .rise + --i, ทิศทางผ่าน --dx) ── */
@keyframes rise {
  from { opacity: 0; transform: translate(var(--dx, 0), 8px); }
  to   { opacity: 1; transform: translate(0, 0); }
}

.rise {
  animation: rise var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* ── Hero: โหลดหน้าแล้วข้อความลอยขึ้น ป้ายจางเข้า ── */
.hero-left > * {
  animation: rise 700ms var(--ease-out) both;
}
.hero-left > :nth-child(1) { animation-delay: 80ms; }
.hero-left > :nth-child(2) { animation-delay: 200ms; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-book-tag,
.hero-motto {
  animation: fade-in 900ms var(--ease-out) 350ms both;
}

/* ── Stepper: จุด active pop ขึ้น · เส้นเชื่อม/สีไล่ตาม ── */
@keyframes pop {
  0%   { transform: scale(.78); }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.step.active b,
.mob-dot.active {
  animation: pop 420ms var(--ease-spring);
}

.step b .ic {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* ── ปุ่ม: ยกเบาๆ ตอน hover กดแล้วยุบนิดเดียว ── */
.primary,
.secondary {
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.primary:not(:disabled):hover {
  transform: translateY(-1px);
  background: var(--navy-deep);
}

.secondary:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--border-control);
  box-shadow: 0 6px 16px rgba(21, 22, 21, .06);
}

.primary:not(:disabled):active,
.secondary:not(:disabled):active {
  transform: translateY(0) scale(.985);
  box-shadow: none;
}

.text-button,
.edit-link,
.inline-link {
  transition: color var(--dur-fast) ease, text-underline-offset var(--dur-fast) var(--ease-out);
}

.text-button:hover,
.edit-link:hover,
.inline-link:hover {
  text-underline-offset: 6px;
}

/* ── เลือกเพศ: แถบดำเลื่อนไปมาแทนการสลับสี ── */

.gender::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  transition: transform var(--dur-base) var(--ease-out);
  background: var(--navy);
}

.gender[data-gender="female"]::before {
  transform: translateX(100%);
}

/* ── ช่องรอบอก/สะโพก (สูทผู้หญิง) กางออก-พับเก็บแบบลื่น ── */
.female-fields {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--dur-base) var(--ease-out), opacity 240ms ease;
}

.female-fields.open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.female-fields-inner {
  min-height: 0;
  overflow: hidden;
}

/* ── ช่องกรอก: โฟกัสนุ่ม ── */

/* ── การ์ดรูป: hover ยก · รูปที่เพิ่งอัปโหลด fade เข้า · ✓ pop ── */

.photo-card:hover {
  border-color: var(--gold-line-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(21, 22, 21, .06);
}

.photo-card.photo-failed:hover {
  border-color: var(--danger);
}

@keyframes photo-in {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}

.photo-card.just-added .photo-preview img {
  animation: photo-in var(--dur-slow) var(--ease-out) both;
}

.photo-card.just-added .check-mark-text {
  display: inline-block;
  animation: pop 420ms var(--ease-spring) 120ms both;
}

.photo-card label:active {
  transform: scale(.97);
}

/* ── ช่องยินยอม: กล่องสว่างขึ้นเมื่อติ๊ก ── */

.consent:has(input:checked) {
  background: var(--gold-light);
  border-color: var(--gold-line);
}

/* ── หน้ากำลังโหลด ── */
.loading-hint {
  margin-top: 6px;
  font-size: 0.7812rem;
  color: var(--ink-muted);
}

/* ── หน้าผล: ตัวเลขไซส์ pop ตามหลังการ์ด ── */
.size-num {
  animation: pop 520ms var(--ease-spring) 260ms both;
}

.measure-item,
.soft-card,
.size-card {
  transition: box-shadow var(--dur-base) var(--ease-out);
}

.result-badge {
  animation: fade-in 500ms ease 420ms both;
}

/* ── Dialog: เข้า scale+fade · ออกย้อนกลับ (JS ใส่ .is-closing แล้วรอ animationend) ── */
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dialog-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(10px) scale(.98); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes backdrop-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

dialog[open] {
  animation: dialog-in 280ms var(--ease-out);
}

dialog[open]::backdrop {
  animation: backdrop-in 280ms ease;
}

dialog.is-closing {
  animation: dialog-out 180ms var(--ease-in) forwards;
}

dialog.is-closing::backdrop {
  animation: backdrop-out 180ms ease forwards;
}

/* ── Journey cards ด้านล่าง: hover ยกชัดขึ้นนิด ── */

/* ── มือถือ: accordion "เตรียมข้อมูล" กางแบบลื่นแทนโผล่ทันที ── */
@media (max-width: 860px) {
  .guide-column .guide-box {
    display: grid;
    grid-template-rows: 1fr;
    height: auto;
    transition: grid-template-rows var(--dur-base) var(--ease-out), padding var(--dur-base) var(--ease-out);
  }

  .guide-column:not(.accordion-open) .guide-box {
    display: grid;
    grid-template-rows: 0fr;
    padding-top: 0;
    padding-bottom: 0;
  }

  .guide-column .guide-overlay {
    min-height: 0;
    overflow: hidden;
    transition: padding var(--dur-base) var(--ease-out), opacity 200ms ease;
  }

  /* padding ของกล่องในไม่ถูก overflow ตัด → พับ padding ตามไปด้วย ไม่งั้นเหลือแถบว่าง 44px */
  .guide-column:not(.accordion-open) .guide-overlay {
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
  }

  .guide-acc-arrow {
    transition: transform var(--dur-base) var(--ease-out);
  }

  /* บนมือถือไม่มีรูป hero — ตัดแอนิเมชันป้ายที่ซ่อนอยู่ */
  .hero-book-tag,
  .hero-motto {
    animation: none;
  }
}

/* ── ผู้ใช้ตั้ง "ลดการเคลื่อนไหว": ปิดทุกอย่าง (JS เช็ค matchMedia เดียวกัน) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .hero-bg-img {
    transform: none !important;
  }
}

/* ==========================================================================
   Direction B — "ตั๋วช่างตัด" (tailor's ticket)
   ภาษาของชิ้นส่วนมาจากโต๊ะช่าง: ป้ายทอ · ตั๋ววัดตัว · รอยเย็บ · หมุด · สายวัด · กระดาษแพตเทิร์น
   จานสี: ครีม (กระดาษ) · navy (ผ้าสูท) · ทอง (ด้าย/ชอล์ก)   —   ฟอนต์: Prompt ทั้งหมดตาม CI
   ========================================================================== */

/* grain กระดาษบางๆ ทั้งหน้า (SVG noise, ไม่โหลดรูป) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

/* ── Typography ── */
.hero-title,
.surface-column h2,
.surface-column .result-title h2,
.card-head h3,
.guide-title,
.picks-head h2,
dialog h2 {
  font-family: var(--font-display);
  letter-spacing: -0.5px;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1px;
}

.hero-gold {
  font-family: var(--font-main);
  font-weight: 500;
}

.surface-column h2 {
  font-size: 1.5625rem;
  font-weight: 600;
}

.surface-column .result-title h2 {
  font-size: 1.9375rem;
  letter-spacing: -0.8px;
}

.card-head h3 {
  font-size: 1.125rem;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-main);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 2.2px;
  color: var(--gold-dark);
}

.eyebrow-thread {
  color: var(--thread);
}

/* ── Header / footer: เส้นด้ายทองบางๆ ── */

.footer-inner > span:first-child {
  letter-spacing: .3px;
}

/* ── Hero: ป้ายมุมขวา = ป้ายทอ (navy + ขอบด้ายทอง) ── */

.hero-book-tag small {
  color: var(--thread);
  letter-spacing: 1.6px;
}

/* ── ปุ่มหลัก = navy ── */

.primary:not(:disabled):hover {
  box-shadow: 0 8px 20px rgba(28, 38, 56, .22);
}

/* ── การ์ดหลัก: แถบ navy บน + คอลัมน์ขั้นตอนเป็นกระดาษแพตเทิร์น ── */
.workspace-card {
  border-top: 3px solid var(--navy);
}

.step b {
  background: var(--bg-card);
  color: var(--ink-muted);
}

.step.active b {
  background: var(--navy);
  color: var(--on-dark);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--gold-primary), 0 4px 14px var(--gold-glow);
}

.step.complete b {
  background: var(--gold-primary);
  color: var(--navy);
  box-shadow: none;
}

.mob-dot.active {
  background: var(--navy);
  color: var(--on-dark);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--gold-primary);
}

.mob-dot.complete {
  background: var(--gold-primary);
  color: var(--navy); /* ขาวบนทองได้แค่ 2.8:1 — navy ได้ 5.5:1 */
  box-shadow: none;
}

/* ── รอยเย็บแทนเส้นแบ่งทึบ ── */
.review > div,
.info-list li {
  border-bottom: 1px dashed var(--stitch);
}

/* ── หน้ารอ AI: สายวัดคลี่ออก ── */
.tape {
  position: relative;
  width: 220px;
  height: 34px;
  margin: 0 auto 26px;
  border-radius: 4px;
  background: var(--well);
  border: 1px solid var(--paper-line);
  overflow: hidden;
  transform-origin: left center;
}

.tape-ticks {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, var(--gold-primary) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, var(--navy) 0 1.5px, transparent 1.5px 50px);
  background-size: 50px 11px, 50px 20px;
  background-position: 0 100%, 0 100%;
  background-repeat: repeat-x;
  animation: tape-roll 1.1s linear infinite;
}

.tape-tab {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: var(--navy);
  animation: tape-tab 2.4s var(--ease-out) infinite;
}

@keyframes tape-roll {
  to { background-position: -50px 100%, -50px 100%; }
}

@keyframes tape-tab {
  0%   { left: 0; }
  55%  { left: calc(100% - 14px); }
  100% { left: calc(100% - 14px); opacity: 1; }
}

/* ── หน้าผล ── */

.size-card .eyebrow {
  display: block;
  margin-bottom: 10px;
}

.size-num {
  font-family: var(--font-display);
  font-weight: 700;
}

/* การ์ดสัดส่วน = ตั๋ววัดตัวบนกระดาษ: ขอบบนเป็นสายวัด, หัวตั๋วเส้นประฉีก, ตัวเลขฟอนต์หัวข้อ */
.ticket {
  background: var(--paper);
  border-color: var(--paper-line);
  position: relative;
  overflow: hidden;
}

.ticket::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background-image:
    repeating-linear-gradient(90deg, var(--thread-soft) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(90deg, var(--navy) 0 1.5px, transparent 1.5px 40px);
  background-size: 40px 5px, 40px 9px;
  background-position: 0 100%, 0 100%;
  background-repeat: repeat-x;
  opacity: .75;
}

.ticket-strip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--stitch);
}

.ticket-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.ticket .measure-item {
  border-bottom-color: var(--paper-line);
}

.ticket .measure-item:nth-child(odd) {
  border-right-color: var(--paper-line);
}

.ticket .measure-item strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.875rem;
  letter-spacing: -0.5px;
}

.soft-card:not(.ticket) {
  background: var(--paper);
}

/* ── สูทแนะนำ: การ์ดสินค้าจาก suitcube.com ── */
.picks-section {
  margin: 48px 0 24px;
}

.picks-head {
  margin-bottom: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.picks-head h2 {
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--ink-primary);
  margin-top: 4px;
}

.picks-head p {
  font-size: 0.8438rem;
  color: var(--ink-secondary);
  margin-top: 3px;
}

@media (max-width: 860px) {

  .hero-title {
    font-size: 2rem;
  }

  .surface-column .result-title h2 {
    font-size: 1.5rem;
  }

  .ticket .measure-item strong {
    font-size: 1.25rem;
  }

  .ticket-strip {
    flex-direction: column;
    gap: 2px;
  }
}

@media print {
  body::before {
    display: none;
  }
}

/* โหมดพรีวิว (GitHub Pages) — บอกชัดว่าเป็นผลตัวอย่าง */
.preview-note {
  margin: 0 0 14px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--gold-dark);
}
.preview-banner {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-inner);
  border: 1px dashed var(--gold-primary);
  background: var(--gold-light);
  color: var(--gold-dark);
  font-size: 0.8438rem;
  line-height: 1.6;
}
.preview-banner b { color: var(--ink-primary); }
@media print { .preview-banner { border-style: solid; } }

/* ── สูทแนะนำ: การ์ด ── */

.picks-all {
  font-size: 0.8438rem;
  font-weight: 500;
  color: var(--gold-dark);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 2px;
}

.picks-all:hover { color: var(--navy); }

.picks-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.pick-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 14px;
  background: var(--paper);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  text-decoration: none;
  color: var(--ink-primary);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.pick-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-soft);
}

.pick-photo {
  display: block;
  aspect-ratio: 5 / 6;
  overflow: hidden;
  border-radius: 6px;
  background: var(--well-deep);
  margin-bottom: 12px;
}

.pick-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.pick-card:hover .pick-photo img { transform: scale(1.04); }

.pick-line {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--gold-dark);
}

.pick-card strong {
  margin-top: 3px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.pick-code {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.pick-cta {
  margin-top: auto;
  padding-top: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--navy);
}

@media (max-width: 860px) {
  .picks-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pick-card strong { font-size: 0.875rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pick-card, .pick-photo img { transition: none; }
  .pick-card:hover, .pick-card:hover .pick-photo img { transform: none; }
}

/* ── พื้นผิวที่เบราว์เซอร์วาดเอง ให้ใช้สีของตั๋วช่างตัด ── */
::selection {
  background: var(--gold-light);
  color: var(--navy);
}

input, textarea {
  caret-color: var(--gold-dark);
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--gold-mark);
}

/* มือถือ: หัวข้อทองเหลือ 22px (ไม่นับเป็นตัวใหญ่) และวางบนพื้นกระดาษ → ใช้ทองหมึกให้ผ่าน 4.5:1 */

/* ==========================================================================
   Touch adaptation — นิ้วกดได้ทุกปุ่ม (พื้นที่กด ≥ 44px)
   ใช้กับจอสัมผัสทุกขนาด + จอแคบ · ลิงก์ข้อความขยายพื้นที่กดด้วย ::after ที่มองไม่เห็น
   หน้าตาและระยะห่างเดิมจึงไม่ขยับ
   ========================================================================== */
@media (pointer: coarse), (max-width: 860px) {
  /* แถบบน */
  .mobile-nav-wrap { gap: 4px; }
  .mobile-stylist-btn { min-height: 44px; padding: 0 8px; }
  .mobile-menu-btn { width: 44px; height: 44px; margin-right: -8px; }
  .brand { min-height: 44px; align-items: center; }

  /* ฟอร์ม: 16px กัน iOS ซูมหน้าเองตอนแตะช่องกรอก */
  .input-wrap input { font-size: 1rem; }
  .gender button { min-height: 44px; }
  .consent input[type="checkbox"] { width: 22px; height: 22px; }

  /* ภาพถ่าย: ปุ่มเลือก/เปลี่ยน/นำออก เป็นปุ่มเต็มนิ้ว */
  .photo-card label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.8125rem;
  }
  .remove-photo-btn,
  .photo-card button {
    min-height: 44px;
    margin-top: 0;
    padding: 0 12px;
    font-size: 0.75rem;
  }

  /* ลิงก์ข้อความ + ปุ่ม ? : ขยายพื้นที่กดโดยไม่เปลี่ยนหน้าตา */
  .inline-help-btn,
  .guide-learn-more,
  .btn-utility-link,
  .text-button,
  .edit-link,
  .inline-link,
  .picks-all,
  .footer-inner button {
    position: relative;
  }
  .inline-help-btn::after,
  .guide-learn-more::after,
  .btn-utility-link::after,
  .text-button::after,
  .edit-link::after,
  .inline-link::after,
  .picks-all::after,
  .footer-inner button::after {
    content: '';
    position: absolute;
    inset: -13px -8px;
  }
  .inline-help-btn::after { inset: -14px; }
  /* "เริ่มใหม่" อยู่ชิดใต้ปุ่มปรึกษาเรา — ขยายลงล่างแทน ไม่ให้พื้นที่กดเกยกัน */
  .result-actions .text-button::after { inset: -9px -8px -17px; }
}

/* จอสัมผัสไม่มี hover: ไม่ให้การ์ดสินค้าค้างท่ายกหลังแตะ ใช้จังหวะกดแทน */
@media (hover: none) {
  .pick-card:hover { transform: none; box-shadow: none; border-color: var(--border-subtle); }
  .pick-card:hover .pick-photo img { transform: none; }
  .pick-card:active { border-color: var(--gold-primary); }
}

/* ==========================================================================
   Hardening — error ระดับช่องกรอก · screen reader · คีย์บอร์ด
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ลิงก์ข้าม: ซ่อนไว้จนกว่าจะ Tab มาถึง */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-inner);
  background: var(--navy);
  color: var(--on-dark);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 12px; }

#surface:focus { outline: none; }

.noscript-note {
  margin: 24px 0;
  padding: 14px 16px;
  border-radius: var(--radius-inner);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger-ink);
  font-size: 0.875rem;
}

/* error ใต้ช่องกรอก: บอกทั้งด้วยสี ขอบ และข้อความ (ไม่พึ่งสีอย่างเดียว) */
.field-error {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--danger);
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  opacity: 0;
  transition: grid-template-rows var(--dur-base) var(--ease-out), margin-top var(--dur-base) var(--ease-out), opacity 200ms ease;
}
.field-error::before {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-dark);
  font-size: 0.6875rem;
  font-weight: 600;
  vertical-align: 1px;
  content: none;
}
.input-wrap.invalid,
.input-wrap.invalid:focus-within {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(181, 55, 42, 0.12);
}

.mob-dot:disabled { cursor: default; }
.mob-dot::after {
  content: '';
  position: absolute;
  inset: -8px;
}

/* ข้อความยาวจาก API (คำเตือน/ข้อผิดพลาด) ตัดบรรทัดได้ ไม่ดันการ์ดล้น */
.error,
.result-notes li,
.result-alert,
.field-error {
  overflow-wrap: anywhere;
}

/* ==========================================================================
   สลับภาษา (ไทย / EN / 中文)
   ========================================================================== */
.lang-switch {
  position: relative;
  margin-left: auto;
  margin-right: 20px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--ink-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.lang-btn:hover,
.lang-btn[aria-expanded="true"] { border-color: var(--gold-primary); background: var(--paper); }
.lang-globe { color: var(--gold-mark); flex-shrink: 0; } /* ทองเดียวกับไอคอนปรึกษาเรา */
.lang-chevron {
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease-out);
}
.lang-btn[aria-expanded="true"] .lang-chevron { transform: rotate(180deg); }

/* เมนู: กระดาษตั๋วใบเล็ก ห้อยใต้ปุ่ม */
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  min-width: 172px;
  padding: 6px;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(28, 38, 56, 0.14), 0 2px 6px rgba(28, 38, 56, 0.06);
  transform-origin: top right;
  animation: lang-in 160ms var(--ease-out);
}
.lang-menu[hidden] { display: none; }
@keyframes lang-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.lang-menu li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-primary);
  cursor: pointer;
  outline: none;
  transition: background var(--dur-fast) ease;
}
.lang-menu li + li { margin-top: 2px; }
.lang-menu li:hover,
.lang-menu li:focus-visible { background: var(--gold-light); }
.lang-menu li:focus-visible { box-shadow: inset 0 0 0 2px var(--gold-dark); }
.lang-menu li[aria-selected="true"] { font-weight: 600; }
.lang-check { color: var(--gold-dark); opacity: 0; flex-shrink: 0; }
.lang-menu li[aria-selected="true"] .lang-check { opacity: 1; }
.lang-menu li[lang="zh-Hans"] { font-family: 'Prompt', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif; }

@media (pointer: coarse), (max-width: 860px) {
  .lang-switch { margin-right: 4px; }
  .lang-btn { height: 44px; padding: 0 10px; font-size: 0.875rem; }
  .lang-menu li { min-height: 46px; font-size: 0.9375rem; }
}

/* จอแคบ: ซ่อนคำว่า "ปรึกษาเรา" เหลือไอคอน (ปุ่มยังมี aria-label) ให้พอที่สำหรับตัวเลือกภาษา */
@media (max-width: 480px) {
  .mobile-stylist-btn span { display: none; }
  .mobile-stylist-btn { width: 44px; justify-content: center; padding: 0; }
}
@media (max-width: 350px) {
  .brand-logo { height: 20px; width: auto; }
  .header-inner { padding: 0 12px;
    gap: 6px;
  }
}

@media print { .lang-switch { display: none; } }

/* ── ภาษาจีน: Prompt ไม่มีตัวอักษรจีน → ตัวจีนใช้ฟอนต์จีนของเครื่อง (ไม่ต้องดาวน์โหลด ใช้ได้ในจีนแผ่นดินใหญ่) · ตัวเลข/ละตินยังเป็น Prompt ── */
:root[lang="zh-Hans"] {
  --font-main: 'Prompt', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', 'Source Han Sans SC', sans-serif;
}
:root[lang="zh-Hans"] body { font-weight: 400; }  /* ตัวจีนน้ำหนัก 300 บางเกินอ่าน */

/* อังกฤษ/จีน: ป้ายยาวกว่าไทย — ให้ตัดบรรทัดได้ ไม่ดันกล่องล้น */
.step span,
.gender button,
.photo-card label,
.measure-item span,
.review > div > span,
.review > div > strong {
  overflow-wrap: anywhere;
}

/* หน่วย (เช่น 英寸) ห้ามตัดบรรทัดกลางคำ */
.unit-tag { white-space: nowrap; flex-shrink: 0; }

/* ── Clarify: เหตุผลที่ปุ่มส่งยังกดไม่ได้ · ช่องทางติดต่อ · ปุ่มลบข้อมูล ── */
.submit-hint {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: right;
  overflow-wrap: anywhere;
  /* ปุ่มส่ง: เหตุผลที่ยังกดไม่ได้ จางเข้า-ออก */
  transition: opacity 200ms ease;
}

.contact-list {
  list-style: none;
  margin: 14px 0 0;
  border-top: 1px dashed var(--stitch);
}
.contact-list li { border-bottom: 1px dashed var(--stitch); }
.contact-list a {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-primary);
}
.contact-list a:hover { color: var(--gold-dark); }

dialog .secondary.danger {
  width: 100%;
  margin-top: 16px;
  color: var(--danger-ink);
  border-color: var(--danger-line);
}
dialog .secondary.danger:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ── Harden: ป้ายภาษาอังกฤษ/จีนยาวกว่าไทย + จอแคบ 320px ── */
/* ลูกของ grid/flex ต้องยอมหดได้ ไม่งั้นการ์ดไซส์ดันกว้างเกินจอ (เนื้อหาถูกตัดขอบขวา) */
.result-layout > *,
.result-side > * { min-width: 0; }
.info-list li span { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 400px) {
  /* ข้อมูลของคุณ: คอลัมน์เดียว ป้ายยาวอย่าง "Trouser waist 30 in" ไม่ถูกบีบ */
  .info-list { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .lang-btn { padding: 0 8px; gap: 5px; }
  .lang-switch { margin-right: 0; }
}

/* ── หน้าผล: ปุ่มหลัก = เลือกซื้อสินค้า (เต็มแถว) · บันทึกผล/ปรึกษาเรา เป็นปุ่มรอง ── */
.result-actions .shop-btn {
  grid-column: 1 / -1;
  text-decoration: none;
  min-height: 52px;
  font-size: 1rem;
}
.result-actions .shop-btn span { opacity: .75; }

/* ==========================================================================
   Motion รอบ 2 — จุดที่เคย "โผล่ทันที" ให้มีจังหวะ · ทุกข้อปิดเองเมื่อ prefers-reduced-motion
   ========================================================================== */

/* ── 1) หน้าผล: รอยเย็บเดินรอบป้ายผ้า (SVG แทน outline เพื่อให้ "เดินเส้น" ได้) ── */
.stitch {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  overflow: visible;
  pointer-events: none;
}
.stitch rect {
  x: .5px;
  y: .5px;
  width: calc(100% - 1px);
  height: calc(100% - 1px);
}
.stitch-line { stroke: var(--thread); stroke-width: 1; }
.stitch-pen { stroke-dashoffset: 0; }
.size-card > :not(.stitch) { position: relative; } /* เนื้อหาอยู่เหนือเส้น */

@keyframes stitch-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.result-layout.reveal .stitch-pen {
  animation: stitch-draw 1400ms cubic-bezier(.3, .1, .2, 1) 260ms both;
}

/* ตัวเลขสัดส่วนในตั๋วไล่ขึ้นทีละช่อง หลังตั๋วลอยขึ้นมาแล้ว */
@keyframes settle {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.result-layout.reveal .measure-item {
  animation: settle 420ms var(--ease-out) both;
  animation-delay: calc(520ms + var(--m, 0) * 60ms);
}
.result-layout.reveal .size-alt,
.result-layout.reveal .size-illus {
  animation: settle 500ms var(--ease-out) 1100ms both;
}

/* ── 3) error ใต้ช่องกรอก: กางออก/พับเก็บ ── */
.field-error.show {
  grid-template-rows: 1fr;
  margin-top: 6px;
  opacity: 1;
}
.field-error > span {
  min-height: 0;
  overflow: hidden;
}
.field-error > span:not(:empty)::before {
  content: '!';
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-dark);
  font-size: 0.6875rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* ── 5) การ์ดสูทแนะนำ: ลอยขึ้นทีละใบเมื่อเลื่อนมาถึง ── */
.picks-grid.pre > li { opacity: 0; }
.picks-grid.in > li {
  animation: settle 520ms var(--ease-out) both;
  animation-delay: calc(var(--n, 0) * 80ms);
}

/* ── 6) หน้าโหลด: สายวัดม้วนเก็บเข้าตลับ (ตลับอยู่ซ้าย) ── */
.loading.done .tape-ticks,
.loading.done .tape-tab { animation-play-state: paused; }

/* ── 7) นำรูปออก: รูปตัวอย่างจางกลับเข้ามา ── */
.photo-card.just-removed .photo-example,
.photo-card.just-removed .sample-badge {
  animation: fade-in 320ms var(--ease-out) both;
}

/* ── 8) เส้นเชื่อมขั้นตอน: ด้ายทองเดินตามขั้นที่ผ่าน ── */
.step.complete:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 42px;
  height: 28px;
  width: 0;
  z-index: 1;
  border-left: 2px dashed var(--gold-primary);
}
@keyframes thread-down { from { clip-path: inset(0 -2px 100% -2px); } to { clip-path: inset(0 -2px 0 -2px); } }
.step.just-done:not(:last-child)::before {
  animation: thread-down 420ms var(--ease-out) 120ms both;
}

.mob-line::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  border-top: 2px dashed var(--gold-primary);
  clip-path: inset(-2px 100% -2px 0);
  transition: clip-path 420ms var(--ease-out);
}
.mob-line.done::after { clip-path: inset(-2px 0 -2px 0); }


/* ── ข้อมูลติดต่อ: กลุ่มช่องกรอกต่อท้ายสัดส่วน คั่นด้วยรอยเย็บ ── */

/* หน้าผล: สัดส่วนเบลอไว้จนกว่าจะเข้าสู่ระบบสมาชิก */
.measure-wrap {
  position: relative;
  margin-bottom: 18px;
}

.measure-wrap .measure-grid {
  margin-bottom: 0;
}

.measure-wrap.locked {
  display: grid;
}

.measure-wrap.locked > .measure-grid,
.measure-wrap.locked > .measure-lock {
  grid-area: 1 / 1;
}

.measure-wrap.locked .measure-item strong {
  filter: blur(10px);
  opacity: 0.5;
  user-select: none;
}

.measure-lock {
  position: relative;
  align-self: center;
  justify-self: center;
  margin: 12px 0;
  width: min(100% - 16px, 380px);
  padding: 22px 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(25, 25, 25, 0.12);
}

.measure-lock > .ic {
  width: 28px;
  height: 28px;
  color: var(--gold-mark);
}

.measure-lock h4 {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-primary);
  text-wrap: balance;
}

.measure-lock p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.measure-lock .primary {
  width: 100%;
  margin-top: 6px;
  justify-content: center;
  text-decoration: none;
}

.measure-lock .text-button {
  min-height: 44px;
  margin-top: 0;
  font-size: 0.875rem;
}

.measure-lock .lock-msg {
  font-size: 0.875rem;
  color: var(--danger-ink);
}

.measure-lock .lock-msg:empty {
  display: none;
}

@media print {
  .measure-lock { display: none; }
}
