/* Fashion Studio — รอบ 4 (26 พ.ย. 2026)
   โครงใช้งาน: แบบรอบ 2 (เมนูบน + หน้าสร้างภาพหน้าเดียว 3 ขั้น + สรุปราคาติดจอ) ผู้ใช้บอกว่าใช้ง่ายกว่าแบบแถบซ้าย/wizard
   หน้าตา: แนว uwear.ai — ขาวล้วน ดำ ครีม #F4EFE6, Nunito Sans หนาและชิด, ปุ่มแคปซูล, หัวข้อตัวพิมพ์ใหญ่แบบแคบ (Oswald)
   ตัวไทยใช้ IBM Plex Sans Thai · กฎจาก skill ui-ux-pro-max: contrast ≥4.5:1, ปุ่ม ≥44px บนมือถือ, focus ชัด, reduced-motion */
:root {
  --paper: #ffffff;
  --paper-2: #f4efe6;      /* ครีม (สีปุ่มรอง/พื้นรอง) */
  --paper-3: #f6f6f5;      /* เทาอ่อนมาก ช่องว่างภาพ */
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #2b2b2b;
  --muted: #646464;        /* 5.9:1 บนขาว */
  --line: #ececec;
  --line-strong: #d4d4d4;
  --accent: #b08d57;       /* ทองครีม ใช้เป็นจุดเล็ก ๆ เท่านั้น ไม่ใช้กับตัวหนังสือ */
  --ok: #15803d;
  --warn: #8a5a00;
  --bad: #b91c1c;
  --radius: 12px;
  --radius-lg: 20px;
  --sans: "Nunito Sans", "IBM Plex Sans Thai", -apple-system, system-ui, sans-serif;
  --display: "Oswald", "IBM Plex Sans Thai", "Nunito Sans", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .08);
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.6; font-size: 16px; }
img { max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 800; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.028em; text-wrap: balance; }
h1 { font-size: clamp(32px, 4.6vw, 56px); }
h2 { font-size: clamp(22px, 2.4vw, 30px); }
h3 { font-size: 18px; letter-spacing: -.015em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.num, .digits { font-variant-numeric: tabular-nums lining-nums; }
.display { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: -.01em; line-height: .95; }
.eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.eyebrow.plain::before { display: none; }
.eyebrow.plain { letter-spacing: .04em; font-size: 13px; text-transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; text-decoration: none; }
.skip:focus { top: 12px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.lg { width: 26px; height: 26px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
[hidden] { display: none !important; }

/* ---------- แถบบน ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; height: 68px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 22px; font-weight: 400; letter-spacing: .14em; text-decoration: none; white-space: nowrap; }
.brand b { font-weight: 800; letter-spacing: .14em; }
nav.main { display: flex; gap: 2px; }
nav.main a { text-decoration: none; padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--muted); transition: background .2s var(--ease), color .2s; }
nav.main a:hover { color: var(--ink); background: var(--paper-3); }
nav.main a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.top-right { display: flex; gap: 10px; align-items: center; }
.credit-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--paper-2); border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (max-width: 760px) {
  header.top { padding: 10px 16px 0; height: auto; flex-wrap: wrap; gap: 6px 12px; }
  nav.main { order: 3; width: 100%; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
  nav.main a { flex: none; min-height: 40px; display: inline-flex; align-items: center; }
  .brand { font-size: 18px; }
}

/* ---------- โครง ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 40px 28px 96px; }
.narrow { max-width: 760px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } .wrap { padding: 24px 16px 128px; } }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.page-head h1 { margin: 8px 0 0; font-size: clamp(32px, 4vw, 48px); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.card + .card { margin-top: 20px; }
.card.cream { background: var(--paper-2); border-color: transparent; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---------- ปุ่มแคปซูล ---------- */
button, .btn {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; border-radius: 999px; padding: 11px 24px; min-height: 44px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff; text-decoration: none; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .2s var(--ease), color .2s, border-color .2s, transform .1s;
}
button:hover, .btn:hover { background: #262626; }
button:active, .btn:active { transform: scale(.98); }
button.ghost, .btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--ink); background: #fff; }
button.cream, .btn.cream { background: var(--paper-2); color: var(--ink); border-color: var(--paper-2); }
button.cream:hover, .btn.cream:hover { background: #ebe3d5; }
button.link { background: none; border: 0; color: var(--ink); text-decoration: underline; padding: 4px 0; min-height: 0; font-weight: 600; }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
button.small, .btn.small { padding: 6px 14px; font-size: 13px; min-height: 36px; }
button.big { padding: 15px 28px; font-size: 16px; width: 100%; }
button.danger { background: var(--bad); border-color: var(--bad); }
button.loading { position: relative; color: transparent !important; pointer-events: none; }
button.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- ฟอร์ม ---------- */
label { display: block; font-size: 14px; margin: 16px 0 6px; font-weight: 700; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 16px; min-height: 48px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: #fff; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .08); }
textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.field-error { font-size: 14px; color: var(--bad); margin: 8px 0 0; display: flex; gap: 6px; align-items: center; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }

/* ---------- ป้าย / แท็บ / ชิป ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--paper-3); color: var(--ink-2); }
.pill.warn { color: var(--warn); background: #fdf6e3; }
.pill.ok { color: var(--ok); background: #effaf2; }
.pill.bad { color: var(--bad); background: #fdf0f0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.tabs button { background: #fff; color: var(--ink-2); border-color: var(--line-strong); min-height: 40px; padding: 8px 18px; font-size: 14px; font-weight: 600; }
.tabs button:hover { border-color: var(--ink); background: #fff; }
.tabs button.on, .tabs button[aria-pressed="true"], .tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: #fff; color: var(--ink); border-color: var(--line-strong); padding: 9px 18px; font-size: 14px; font-weight: 600; min-height: 44px; flex-direction: column; align-items: flex-start; gap: 0; border-radius: 16px; text-align: left; white-space: normal; }
.chips button:hover { border-color: var(--ink); background: #fff; }
.chips button.on, .chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips button .d { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.chips button.on .d, .chips button[aria-pressed="true"] .d { color: #c9c9c9; }

/* ---------- หน้าสร้างภาพ ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; align-items: start; }
@media (max-width: 980px) { .studio { grid-template-columns: 1fr; gap: 32px; } }
.step { padding: 0 0 44px; margin: 0 0 44px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.step-no { font-family: var(--display); font-size: 44px; font-weight: 600; line-height: .9; color: var(--ink); flex: none; }
.step-head h2 { margin: 0; }
.step-head p { margin: 4px 0 0; }

.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 32px; text-align: center; cursor: pointer; background: var(--paper-3);
  display: grid; place-items: center; min-height: 260px; position: relative; transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #fff; }
.drop .big-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #fff; margin: 0 auto 12px; box-shadow: var(--shadow); }
.drop img { max-height: 320px; max-width: 100%; border-radius: var(--radius); }
.drop input { display: none; }
.drop .change { position: absolute; top: 14px; right: 14px; }

/* ภาพสินค้าหลายมุม: ช่องใหญ่ (มุมหลัก) + 3 ช่องเล็ก */
.views { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; }
.view-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.view-cap { margin: 0; line-height: 1.35; }
.view-slots { display: grid; grid-template-rows: repeat(3, 1fr); gap: 10px; flex: 1; }
.slot { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; }
.slot .slot-btn { grid-row: 1 / 3; all: unset; box-sizing: border-box; cursor: pointer; width: 64px; height: 80px; border-radius: 10px; border: 1.5px dashed var(--line-strong); background: var(--paper-3); display: grid; place-items: center; overflow: hidden; transition: border-color .2s; }
.slot .slot-btn:hover { border-color: var(--ink); }
.slot .slot-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.slot .slot-btn img { width: 100%; height: 100%; object-fit: cover; }
.slot .link { justify-self: start; min-height: 24px; }
@media (max-width: 560px) { .views { grid-template-columns: 1fr; } .view-slots { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); } .slot { grid-template-columns: 1fr; text-align: center; } .slot .slot-btn { grid-row: auto; width: 100%; height: 96px; } .slot .link { justify-self: center; } }
.preset .custom-card { display: grid; place-items: center; text-align: center; background: var(--paper-2); color: var(--ink-2); font-size: 13px; font-weight: 700; line-height: 1.5; border: 1.5px dashed var(--line-strong); }
.preset .custom-card img { position: absolute; inset: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 20px 14px; }
.preset { position: relative; background: none; color: var(--ink); border: 0; border-radius: 0; padding: 0; text-align: left; display: block; min-height: 0; font-weight: 400; white-space: normal; min-width: 0; }
.preset:hover { background: none; }
.preset .ph { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--paper-3); aspect-ratio: 3/4; box-shadow: 0 0 0 2px transparent; transition: box-shadow .2s; }
.preset img, .preset .noimg { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.preset:hover img { transform: scale(1.04); }
.preset b { display: block; font-size: 14px; font-weight: 800; padding: 10px 2px 0; line-height: 1.3; }
.preset span.d { display: block; font-size: 12px; color: var(--muted); padding: 2px 2px 0; line-height: 1.4; }
.preset.on .ph { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.preset .tick { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: none; place-items: center; }
.preset.on .tick { display: grid; }

.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.model { all: unset; box-sizing: border-box; cursor: pointer; display: block; min-width: 0; border-radius: var(--radius); }
.model img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; border-radius: var(--radius); }
.model .n { font-size: 13px; font-weight: 700; padding: 8px 2px 0; }
.model.on img, .model.on .none { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.model:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.model .none { display: grid; place-items: center; aspect-ratio: 3/4; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--paper-3); border-radius: var(--radius); padding: 10px; text-align: center; }

details.more { border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
details.more > summary { cursor: pointer; list-style: none; padding: 20px 24px; display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 17px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; margin-left: auto; font-size: 26px; font-weight: 400; line-height: 1; transition: transform .2s; }
details.more[open] > summary::after { transform: rotate(45deg); }
details.more .inner { padding: 0 24px 24px; }

/* สรุปด้านขวา / แถบล่างบนมือถือ */
.summary { position: sticky; top: 92px; }
.summary .card { padding: 24px; background: var(--paper-2); border: 0; }
.sum-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.sum-row .th { width: 56px; aspect-ratio: 3/4; border-radius: 8px; background: #fff; object-fit: cover; display: block; }
.sum-row .k { font-size: 12px; color: var(--muted); }
.sum-row .v { font-size: 14px; font-weight: 800; line-height: 1.35; }
.price { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 4px; }
.price .num { font-family: var(--display); font-size: 44px; font-weight: 600; line-height: 1; }
.mobile-bar { display: none; }
@media (max-width: 980px) {
  .summary { position: static; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; gap: 12px; align-items: center; justify-content: space-between;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  .mobile-bar .num { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; }
  .mobile-bar button { flex: none; }
}
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 72px; height: 96px; object-fit: cover; border-radius: 10px; cursor: pointer; display: block; }

/* ---------- งาน ---------- */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 28px 18px; }
.jobcard { text-decoration: none; display: block; }
.jobcard .ph { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--paper-3); aspect-ratio: 3/4; }
.jobcard img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.jobcard:hover img { transform: scale(1.03); }
.jobcard .ph .pill { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .92); }
.jobcard .meta { padding: 10px 2px; font-size: 14px; }
.jobcard .meta b { display: block; font-weight: 800; margin-bottom: 2px; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 72px 20px; border-radius: var(--radius-lg); background: var(--paper-3); }
/* ปุ่มเลือกภาษา TH | EN */
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong, rgba(0,0,0,.2)); border-radius: 999px; padding: 2px; margin-right: 8px; }
.lang-switch button { all: unset; cursor: pointer; font: 700 12px/1 'Nunito Sans', sans-serif; padding: 7px 10px; border-radius: 999px; min-width: 22px; text-align: center; }
.lang-switch button[aria-pressed="true"] { background: var(--ink, #0b0b0b); color: #fff; }
.lang-switch button:focus-visible { outline: 2px solid var(--ink, #0b0b0b); outline-offset: 2px; }
.hero-dark .lang-switch { border-color: rgba(255,255,255,.6); }
.hero-dark .lang-switch button { color: #fff; }
.hero-dark .lang-switch button[aria-pressed="true"] { background: #fff; color: #0b0b0b; }
/* ระดับการใช้งาน มือใหม่ / มืออาชีพ (app.html) */
.level { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--paper-3, #f1f1ef); }
.level button { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.level button b { font-size: 15px; }
.level button span { font-size: 12px; opacity: .7; font-weight: 400; }
.level button[aria-checked="true"] { background: var(--ink, #0b0b0b); color: #fff; }
.level button:focus-visible { outline: 2px solid var(--ink, #0b0b0b); outline-offset: 2px; }
.lv-beginner .pro-only { display: none !important; }
body:not(.lv-beginner) .beginner-only { display: none !important; }
.step.dimmed { opacity: .45; }
.step.dimmed::before { content: 'ใช้ prompt ที่เขียนเองแทนฉากสำเร็จรูป'; display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
@media (max-width: 640px) { .level { width: 100%; } .level button { flex: 1; } }
/* คำถามที่พบบ่อย (หน้าแรก) */
.faq { display: grid; gap: 10px; max-width: 760px; }
.faq details { border: 1px solid rgba(0,0,0,.1); border-radius: 16px; padding: 16px 20px; background: #fff; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 10px 0 0; }
/* สัดส่วนนางแบบ (models.html) */
fieldset.measure { border: 0; padding: 0; margin: 16px 0 4px; min-width: 0; }
fieldset.measure legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 2px; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0 12px; }
.measure-grid label { font-size: 13px; }
.measure-grid input:disabled { opacity: .45; background: var(--paper-3, #f1f1ef); cursor: not-allowed; }
.measure-dlg { border: 0; border-radius: 20px; padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.measure-dlg::backdrop { background: rgba(0,0,0,.4); }
.gen { width: 72%; text-align: center; }
.gen-track { height: 6px; border-radius: 99px; background: rgba(0,0,0,.08); overflow: hidden; margin-bottom: 10px; }
.gen-bar { height: 100%; width: 0; border-radius: 99px; background: var(--ink, #111); transition: width .3s linear; }
@media (prefers-reduced-motion: reduce) { .gen-bar { transition: none; } }
.skel { background: linear-gradient(90deg, var(--paper-3) 0%, #ececea 50%, var(--paper-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.shot { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.shot img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; cursor: zoom-in; }
.shot .err { aspect-ratio: 3/4; display: grid; place-items: center; padding: 16px; color: var(--bad); font-size: 14px; text-align: center; }
.shot .dl { display: flex; gap: 6px; padding: 10px; flex-wrap: wrap; }
.compare { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }
.compare .orig img { width: 100%; border-radius: var(--radius); }
/* ---------- เครดิต / เติมเงิน / ประวัติ ---------- */
.balance { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 28px; background: var(--paper-2); border-radius: var(--radius-lg); }
.balance .big { font-family: var(--display); font-weight: 600; font-size: clamp(56px, 8vw, 96px); line-height: .9; margin-top: 8px; }
.balance .expiry { max-width: 380px; text-align: right; }
@media (max-width: 640px) { .balance .expiry { text-align: left; } }
.warn-text { color: var(--warn); }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pack { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: #fff; transition: border-color .2s, box-shadow .2s, transform .1s; min-height: 160px; }
.pack:hover { border-color: var(--ink); }
.pack:active { transform: scale(.99); }
.pack:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pack[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper-2); }
.pack .tag { position: absolute; top: 14px; right: 14px; }
.pack .price { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1; }
.pack .cr { font-weight: 800; font-size: 15px; }
.pack .eq { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: auto; }
.pay-row { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.pay-sum { width: min(340px, 100%); text-align: center; }
.pay-sum #pay-line { margin-bottom: 10px; }
.qr-pane { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; margin-top: 20px; border: 2px solid var(--ink); }
.qr-pane:focus { outline: none; }
.qr-box { text-align: center; }
.qr-img { width: 240px; height: 240px; padding: 8px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.qr-img svg { width: 100%; height: 100%; display: block; }
@media (max-width: 560px) { .qr-pane { flex-direction: column; align-items: stretch; } .qr-img { width: 100%; height: auto; aspect-ratio: 1; } }
.slip-thumb { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .r { text-align: right; white-space: nowrap; }
table.list .plus { color: var(--ok); font-weight: 700; }
/* หน้าสาธารณะ (ราคา ติดต่อ นโยบาย ใบเสร็จ) */
.doc { max-width: 760px; }
.doc h2 { margin-top: 36px; font-size: 22px; }
.doc li { margin-bottom: 8px; }
.doc .todo { background: #fdf6e3; padding: 2px 6px; border-radius: 6px; color: #6b4600; }
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 14px; }
dl.kv dd { margin: 0; font-weight: 600; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 10px; } }

/* ---------- หน้าแรก (การตลาด) ---------- */
.hero-dark { position: relative; min-height: min(86vh, 760px); display: grid; place-items: center; text-align: center; color: #fff; overflow: hidden; background: #111; }
.hero-dark .bg { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.hero-dark .bg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-dark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .62)); }
.hero-dark .in { position: relative; z-index: 1; max-width: 760px; padding: 96px 20px 72px; }
.hero-dark h1 { color: #fff; font-size: clamp(36px, 5.4vw, 64px); }
.hero-dark .lead { font-size: 18px; color: rgba(255, 255, 255, .88); margin: 0 auto 28px; max-width: 36em; }
.hero-dark .btn.outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.hero-dark .btn.outline:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
.hero-dark .note { font-size: 14px; color: rgba(255, 255, 255, .8); margin-top: 18px; }
.site-top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; color: #fff; }
.site-top .brand { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.stats > div { padding: 28px 24px 8px 0; }
.stats > div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.stats .big { font-family: var(--display); font-weight: 600; font-size: clamp(48px, 7vw, 96px); line-height: .9; letter-spacing: -.02em; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } .stats > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); } }
.section-title { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: clamp(44px, 8vw, 104px); line-height: .9; letter-spacing: -.01em; margin: 0 0 28px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.how .n { font-family: var(--display); font-size: 56px; font-weight: 600; line-height: 1; margin-bottom: 14px; }
@media (max-width: 820px) { .how { grid-template-columns: 1fr; } }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 260px); gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.rail figure { margin: 0; scroll-snap-align: start; position: relative; }
.rail img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--radius); display: block; }
.rail figcaption { position: absolute; left: 12px; top: 12px; right: 12px; font-family: var(--display); font-weight: 600; text-transform: uppercase; color: #fff; font-size: 20px; line-height: 1; text-shadow: 0 1px 12px rgba(0, 0, 0, .45); }
.rail .label { display: block; position: static; font-family: var(--sans); text-transform: none; color: var(--muted); font-size: 13px; text-shadow: none; padding-top: 8px; font-weight: 600; }
.legal ol { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
footer.foot { border-top: 1px solid var(--line); padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- อื่น ๆ ---------- */
.banner { padding: 8px 16px; background: #fdf6e3; font-size: 13px; color: #6b4600; text-align: center; }
#toasts { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 980px) { #toasts { bottom: calc(92px + env(safe-area-inset-bottom)); } }
.toast { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: up .2s var(--ease); max-width: calc(100vw - 32px); display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.toast.bad { background: var(--bad); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); display: grid; place-items: center; z-index: 50; cursor: zoom-out; border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; }
.lightbox img { max-width: 92vw; max-height: 92dvh; border-radius: var(--radius); }

/* =====================================================================
   ธีมจาก Lovable (27 พ.ย. 2026) — ผู้ใช้สั่งออกแบบใน Lovable แล้วให้นำหน้าตามาใช้
   พื้นขาวอุ่น #FDFCFA · ตัวอักษรดำ · ครีม #F4EFE6 · สีหลัก "ดินเผา" #974A2C (ปุ่มหลัก หัวข้อเล็ก)
   การ์ดมนใหญ่ + เงานุ่ม · ฟอนต์ไทย IBM Plex Sans Thai เป็นหลัก · โลโก้ M วงกลมดำ
   ใส่ไว้ท้ายไฟล์ ทับค่าเดิมโดยไม่แตะโครงเดิม
   ===================================================================== */
:root {
  --paper: #fdfcfa;
  --paper-2: #f4efe6;
  --paper-3: #f5f3ef;
  --card: #ffffff;
  --ink: #161616;
  --muted: #6b6862;       /* 5.3:1 บนพื้น */
  --line: #e8e5e0;
  --line-strong: #d9d5ce;
  --clay: #974a2c;        /* 6.6:1 กับตัวอักษรขาว */
  --clay-dark: #7e3c22;
  --accent: var(--clay);
  --radius: 16px;
  --radius-lg: 24px;
  --sans: "IBM Plex Sans Thai", "Nunito Sans", -apple-system, system-ui, sans-serif;
  --shadow-soft: 0 1px 2px rgba(22, 22, 22, .04), 0 8px 24px -8px rgba(22, 22, 22, .10);
  --shadow-lift: 0 2px 4px rgba(22, 22, 22, .05), 0 20px 40px -12px rgba(22, 22, 22, .18);
  background: var(--paper);
}
body { background: var(--paper); }
h1, h2, h3 { letter-spacing: -.01em; line-height: 1.28; }

/* โลโก้ */
.brand { display: inline-flex; align-items: center; gap: 10px; letter-spacing: 0; font-size: 18px; min-height: 44px; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 19px; height: 19px; display: block; }
.brand-word { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; font-size: 19px; }
.brand-word span { font-weight: 400; color: var(--muted); }
.hero-dark .brand-mark { background: #fff; color: var(--ink); }
.hero-dark .brand-word span { color: rgba(255, 255, 255, .75); }

/* แถบบน */
header.top { background: rgba(253, 252, 250, .9); border-bottom-color: var(--line); height: 64px; }
nav.main a { font-weight: 500; font-size: 14px; padding: 10px 16px; }
nav.main a[aria-current="page"] { background: var(--paper-3); }
.credit-pill { background: var(--paper-2); font-weight: 600; }
.credit-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--clay); }
@media (max-width: 760px) { nav.main a[aria-current="page"] { background: var(--ink); color: #fff; } }

/* หัวข้อเล็ก: Oswald สีดินเผา ไม่มีจุด */
.eyebrow { font-family: var(--display); color: var(--clay); letter-spacing: .25em; font-weight: 500; font-size: 13px; }
.eyebrow::before { display: none; }
.eyebrow.plain { font-family: var(--sans); color: var(--muted); letter-spacing: .02em; }

/* ปุ่ม: หลัก = ดินเผา, ghost = ขอบ, ชิปที่เลือก = ดำ */
button, .btn { background: var(--clay); border-color: var(--clay); font-weight: 600; box-shadow: var(--shadow-soft); transition: background .2s var(--ease), box-shadow .2s, transform .15s; }
button:hover, .btn:hover { background: var(--clay-dark); box-shadow: var(--shadow-lift); }
button.ghost, .btn.ghost, .btn.outline { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
button.ghost:hover, .btn.ghost:hover, .btn.outline:hover { background: var(--paper-2); border-color: var(--line-strong); box-shadow: none; }
button.cream, .btn.cream { box-shadow: none; }
button.link { box-shadow: none; }
button.ink, .btn.ink { background: var(--ink); border-color: var(--ink); }
button.ink:hover, .btn.ink:hover { background: #2b2b2b; }
.chips button, .tabs button, .level button, .lang-switch button, .slot .slot-btn, .preset, .model, .faq summary { box-shadow: none; }
.chips button[aria-pressed="true"], .tabs button[aria-pressed="true"] { background: var(--ink) !important; border-color: var(--ink) !important; color: #fff !important; }

/* การ์ดและฟอร์ม */
.card { border-color: var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.card.cream { box-shadow: none; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea { border-color: var(--line-strong); background: #fff; border-radius: 16px; }
input:focus, select:focus, textarea:focus { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(151, 74, 44, .15); }
.check input { accent-color: var(--clay); }
.step { border-radius: var(--radius-lg); }

/* ---------- หน้าแรกแบบ Lovable ---------- */
.lv-top { max-width: 1152px; margin: 0 auto; height: 64px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lv-top .row { gap: 8px; }
.lv-wrap { max-width: 1152px; margin: 0 auto; padding: 0 16px; }
.lv-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 64px 0 64px; }
.lv-hero h1 { font-size: clamp(32px, 4.4vw, 50px); line-height: 1.25; font-weight: 700; margin: 14px 0 0; }
.lv-hero h1 em { font-style: normal; color: var(--clay); }
.lv-hero .lead { font-size: 18px; color: var(--muted); margin: 20px 0 0; }
.lv-hero .cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.lv-hero .cta .btn { min-height: 56px; padding: 14px 30px; font-size: 16px; }
.lv-hero .note { font-size: 14px; color: var(--muted); margin-top: 16px; }
.lv-ba { display: grid; grid-template-columns: 2fr 3fr; gap: 12px; align-items: end; }
.lv-ba .before { background: var(--paper-2); border-radius: 28px; padding: 12px; }
.lv-ba .before .ph { aspect-ratio: 1; border-radius: 20px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.lv-ba .before .ph img { width: 72%; height: auto; object-fit: contain; }
.lv-ba .after img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 28px; box-shadow: var(--shadow-lift); display: block; }
.lv-ba p { text-align: center; font-size: 12px; font-weight: 600; margin: 8px 0 0; }
.lv-band { background: var(--paper-2); padding: 64px 0; }
.lv-band.muted { background: var(--paper-3); }
.lv-section { padding: 64px 0; }
.lv-title { margin-bottom: 32px; max-width: 640px; }
.lv-title h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; margin: 8px 0 0; }
.lv-title p { color: var(--muted); margin: 8px 0 0; }
.lv-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0; }
.lv-steps li { background: #fff; border-radius: 28px; padding: 24px; box-shadow: var(--shadow-soft); }
.lv-steps .top { display: flex; justify-content: space-between; align-items: center; }
.lv-steps .ic { width: 48px; height: 48px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; }
.lv-steps .n { font-family: var(--display); font-size: 40px; color: var(--line-strong); line-height: 1; }
.lv-steps h3 { margin: 20px 0 4px; font-size: 18px; font-weight: 600; }
.lv-steps p { color: var(--muted); margin: 0; }
.lv-rail { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 max(16px, calc((100vw - 1152px) / 2 + 16px)) 16px; scrollbar-width: none; }
.lv-rail::-webkit-scrollbar { display: none; }
.lv-rail figure { margin: 0; width: 224px; flex: none; scroll-snap-align: start; position: relative; }
.lv-rail img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 20px; display: block; transition: transform .3s var(--ease); }
.lv-rail figure:hover img { transform: translateY(-4px); }
.lv-rail figcaption { font-weight: 600; font-size: 14px; margin-top: 8px; }
.lv-rail .label { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(6px); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; color: var(--muted); }
.lv-strip { background: var(--ink); color: #fdfcfa; border-radius: 28px; padding: 32px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lv-strip p { margin: 0; font-size: 18px; font-weight: 600; }
.lv-strip .big { font-family: 'Nunito Sans', sans-serif; font-size: 26px; }
.lv-partner { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.lv-partner .pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lv-partner .pics img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 20px; display: block; }
.lv-partner .pics img:nth-child(2) { transform: translateY(-16px); }
.lv-partner ul { list-style: none; padding: 0; margin: 0 0 24px; }
.lv-partner li { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.lv-partner li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.faq details { border: 0; border-radius: 20px; box-shadow: var(--shadow-soft); padding: 18px 20px; }
.lv-foot { border-top: 1px solid var(--line); padding: 32px 16px; text-align: center; font-size: 14px; color: var(--muted); }
.lv-foot a { margin: 0 4px; }
@media (max-width: 820px) {
  .lv-hero, .lv-partner { grid-template-columns: 1fr; padding-top: 24px; }
  .lv-steps { grid-template-columns: 1fr; }
  .lv-rail figure { width: 176px; }
  .lv-hero .cta .btn { width: 100%; }
}
