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

/* sarabun-latin-ext-400-normal */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/fonts/sarabun/sarabun-latin-ext-400-normal.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;
}

/* sarabun-latin-400-normal */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/fonts/sarabun/sarabun-latin-400-normal.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;
}/* sarabun-thai-600-normal */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/sarabun/sarabun-thai-600-normal.woff2) format('woff2');
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}

/* sarabun-latin-ext-600-normal */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/sarabun/sarabun-latin-ext-600-normal.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;
}

/* sarabun-latin-600-normal */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/sarabun/sarabun-latin-600-normal.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;
}/* ibm-plex-sans-thai-thai-600-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-thai-600-normal.woff2) format('woff2');
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}

/* ibm-plex-sans-thai-latin-ext-600-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-latin-ext-600-normal.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;
}

/* ibm-plex-sans-thai-latin-600-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-latin-600-normal.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;
}/* ibm-plex-sans-thai-thai-700-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-thai-700-normal.woff2) format('woff2');
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}

/* ibm-plex-sans-thai-latin-ext-700-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-latin-ext-700-normal.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;
}

/* ibm-plex-sans-thai-latin-700-normal */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/fonts/ibm-plex-sans-thai/ibm-plex-sans-thai-latin-700-normal.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;
}/* ===== โทนสีและขนาดหลัก: เรียบ สุภาพ คอนทราสต์สูง อ่านง่ายสำหรับทุกวัย ===== */
:root {
  --navy: #0f2847;
  --navy-2: #173a66;
  /* KRUCLIP: พื้นเข้มของหัวเว็บ/hero/ท้ายเว็บ ทองเป็นสีปุ่มหลัก (ตัวหนังสือกรมท่าบนทอง 6.8:1) — ดู .claude/skills/kruclip-design */
  --navy-deep: #0a1c33;
  --gold: #e9a11b;
  --gold-strong: #d48f12;
  --gold-light: #f5c868;
  /* ลิงก์และตัวหนังสือที่กดได้บนพื้นสว่าง: กรมท่าอมน้ำเงิน 8.8:1 (ทองบนขาวอ่านไม่ออก 2.2:1 จึงไม่ใช้) */
  --primary: #1b4a87;
  --primary-dark: #0f2847;
  --primary-soft: #eef2f8;
  /* วงโฟกัสคีย์บอร์ด: กรมท่าบนพื้นสว่าง · ในพื้นเข้มเปลี่ยนเป็นทองอ่อนอัตโนมัติ (ดูท้ายไฟล์) */
  --focus: #1b4a87;
  --accent: #e9a11b;
  --accent-soft: #fdf4e1;
  --green: #12804c;
  --green-soft: #e8f5ee;
  --red: #c0392b;
  --red-soft: #fdeceb;
  --line-green: #06c755;
  /* สีเขียว LINE เข้มขึ้นสำหรับปุ่มที่มีตัวหนังสือขาว: คอนทราสต์ 5.1:1 ผ่านเกณฑ์อ่านง่าย (สีเดิม 2.3:1) */
  --line-green-text: #037f35;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b2333;
  --muted: #5a6475;
  --border: #e3e7ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 40, 71, .05), 0 4px 16px rgba(15, 40, 71, .06);
  --shadow-lg: 0 12px 40px rgba(15, 40, 71, .12);
  --font-head: 'IBM Plex Sans Thai', 'Sarabun', system-ui, sans-serif;
  --font-body: 'Sarabun', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.35; margin: 0 0 .5em; color: var(--navy); font-weight: 600; }
h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 700; }
h2 { font-size: clamp(24px, 2.6vw, 30px); }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
img { max-width: 100%; }
svg { flex-shrink: 0; vertical-align: middle; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.narrow-wide { max-width: 1040px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.green { color: var(--green); }
.mt { margin-top: 56px; }
.mt-sm { margin-top: 12px; }
.skip { position: absolute; left: -9999px; }
/* ซ่อนจากสายตาแต่โปรแกรมอ่านหน้าจอยังอ่าน (เช่น หัวข้อที่ช่วยให้ลำดับหัวข้อถูกต้อง) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: #fff; padding: 8px 16px; border-radius: 8px; }

/* ===== ปุ่ม ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 10px 22px;
  font: 600 17px/1.2 var(--font-head);
  border-radius: 10px; border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* ปุ่มหลักสีทองของแบรนด์ ตัวหนังสือกรมท่า (ไม่ใช้ขาวบนทอง: คอนทราสต์ไม่พอ) */
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold-strong); color: var(--navy); }
.btn-outline { border-color: #c9d3e3; color: var(--navy); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--navy); background: transparent; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-ghost-light { color: #fff; border-color: rgba(255, 255, 255, .45); background: transparent; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .1); }
.btn-line { background: var(--line-green-text); color: #fff; }
.btn-line:hover { background: #02692b; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a1301f; }
.btn-sm { min-height: 42px; padding: 6px 16px; font-size: 16px; }

/* กล่องยืนยันก่อนทำรายการสำคัญ (ลบ ยืนยันชำระ ปรับยอดเงิน บันทึกตั้งค่า ฯลฯ) แทนกล่อง confirm ของเบราว์เซอร์
   แบบสั้น = จัดกลาง · แบบมีรายการเปลี่ยนแปลง (has-rows) = กว้างขึ้น ชิดซ้าย มีตารางค่าเดิมเทียบค่าใหม่ */
.confirm-box { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 16px; background: #fff; color: var(--text); box-shadow: var(--shadow-lg); overflow: auto; overscroll-behavior: contain; }
.confirm-box[open] { animation: confirm-in .16s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.confirm-box::backdrop { background: rgba(15, 40, 71, .5); }
.confirm-box form { display: grid; padding: 28px 24px 22px; }
.confirm-head { display: grid; justify-items: center; gap: 12px; text-align: center; }
.confirm-icon { display: grid; width: 52px; height: 52px; border-radius: 50%; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tone-delete .confirm-icon, .tone-danger .confirm-icon { background: var(--red-soft); color: var(--red); }
.tone-money .confirm-icon { background: var(--green-soft); color: var(--green); }
.confirm-title { margin: 0; font-size: 21px; line-height: 1.4; overflow-wrap: anywhere; }
.confirm-text { margin: 4px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.confirm-box.has-rows { width: min(560px, calc(100vw - 32px)); }
.has-rows .confirm-head { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: start; gap: 14px; text-align: left; }
.has-rows .confirm-icon { width: 44px; height: 44px; }
.has-rows .confirm-title { font-size: 20px; }
/* รายการที่จะเปลี่ยน */
.confirm-changes { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; max-height: min(46dvh, 380px); overflow: auto; overscroll-behavior: contain; }
.confirm-group { position: sticky; top: 0; z-index: 1; margin: 0; padding: 7px 14px; border-top: 1px solid var(--border); background: var(--bg); color: var(--navy); font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.confirm-group:first-child { border-top: 0; }
.confirm-list { margin: 0; }
.confirm-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 2px 16px; align-items: baseline; padding: 11px 14px; border-top: 1px solid var(--border); }
.confirm-list .confirm-row:first-child { border-top: 0; }
.confirm-row dt { color: var(--muted); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.confirm-value { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; margin: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.confirm-old { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(90, 100, 117, .55); }
.confirm-new { color: var(--text); font-weight: 600; }
.confirm-value .is-empty { color: var(--muted); font-style: italic; font-weight: 400; text-decoration: none; }
.confirm-arrow { display: inline-flex; color: var(--primary); }
/* ข้อความยาว: วางค่าเดิมกับค่าใหม่ซ้อนกันแบบเทียบบรรทัด */
.confirm-row.is-long { grid-template-columns: 1fr; gap: 6px; }
.is-long .confirm-value { display: grid; gap: 4px; }
.is-long .confirm-arrow { display: none; }
.is-long .confirm-old:not(.is-empty), .is-long .confirm-new:not(.is-empty) { display: block; padding: 6px 10px; border-left: 3px solid; border-radius: 4px 8px 8px 4px; text-decoration: none; }
.is-long .confirm-old:not(.is-empty) { border-color: #e3a49c; background: var(--red-soft); color: #7d2a20; }
.is-long .confirm-new:not(.is-empty) { border-color: #7fc4a1; background: var(--green-soft); color: #0b5132; font-weight: 500; }
.is-long .confirm-clamp { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.is-long .confirm-old .confirm-clamp { -webkit-line-clamp: 2; }
.is-long .confirm-new .confirm-clamp { -webkit-line-clamp: 4; }
.confirm-row.is-big { align-items: center; }
.is-big .confirm-new { color: var(--navy); font-family: var(--font-head); font-size: 24px; line-height: 1.3; }
.confirm-row.is-bad .confirm-new { color: var(--red); }
.confirm-row.is-removed .confirm-old { text-decoration: line-through; }
.confirm-tag { padding: 1px 8px; border-radius: 99px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 600; }
/* ข้อควรรู้ใต้รายการ */
.confirm-notes { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; text-align: left; }
.confirm-notes li { position: relative; padding-left: 18px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.confirm-notes li::before { content: ''; position: absolute; left: 4px; top: .7em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }
.confirm-notes li.is-bad { padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-weight: 600; }
.confirm-notes li.is-bad::before { display: none; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 22px; }
.confirm-actions .btn { min-height: 48px; }
.has-rows .confirm-actions { display: flex; justify-content: flex-end; }
.has-rows .confirm-actions .btn { min-width: 132px; }
.is-blocked .confirm-actions { grid-template-columns: 1fr; }
@media (max-width: 560px) {
  .confirm-box form { padding: 22px 18px 18px; }
  .confirm-row { grid-template-columns: 1fr; }
  .has-rows .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .has-rows .confirm-actions .btn { min-width: 0; }
  .is-blocked.has-rows .confirm-actions { grid-template-columns: 1fr; }
}
/* ปุ่มที่ยืนยันแล้วและกำลังส่ง */
.btn.is-busy::before { content: ''; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pay-spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .confirm-box[open] { animation: none; } .btn.is-busy::before { animation: none; } }
.btn-lg { min-height: 56px; padding: 12px 28px; font-size: 18px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }

/* ===== ส่วนหัว ===== */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 21px var(--font-head); color: var(--navy); text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--navy); color: var(--accent); }
.logo-light { color: #fff; }
.logo-light .logo-mark { background: rgba(255, 255, 255, .1); }
/* โลโก้ที่อัปโหลดจากหลังร้าน: ท้ายเว็บและเมนูหลังร้านพื้นเข้ม จึงรองพื้นขาวกันโลโก้สีเข้มกลืนหาย */
.logo, .ad-brand { min-width: 0; }
/* โลโก้ KRUCLIP เป็นแบบซ้อนบน-ล่าง (สัญลักษณ์ + ชื่อ) ต้องสูงพอให้อ่านชื่อร้านออก */
.logo-img { display: block; flex-shrink: 0; width: auto; height: 50px; max-width: 170px; object-fit: contain; }
.logo-light .logo-img, .ad-brand .logo-img { box-sizing: content-box; padding: 3px 5px; border-radius: 8px; background: #fff; }
/* โลโก้ที่ออกแบบมาสำหรับพื้นเข้มอยู่แล้ว (เช่น KRUCLIP สีทอง/เงิน) วางบนพื้นเข้มได้เลย ไม่ต้องรองพื้นขาว */
.logo-light .logo-img.logo-on-dark, .ad-brand .logo-img.logo-on-dark { padding: 0; background: none; }
/* ชื่อยาวขึ้นบรรทัดใหม่ได้ 2 บรรทัด ไม่ดันเมนูจนล้นจอ */
.logo-name { display: -webkit-box; min-width: 0; overflow: hidden; white-space: normal; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav > a:not(.btn) { padding: 8px 14px; color: var(--text); text-decoration: none; font-weight: 500; border-radius: 8px; }
.main-nav > a:not(.btn):hover, .main-nav > a.active:not(.btn) { color: var(--primary); }
.main-nav > a.active:not(.btn) { box-shadow: inset 0 -2px 0 var(--primary); border-radius: 0; }
.nav-sep { width: 1px; height: 28px; background: var(--border); margin: 0 8px; }
.menu-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.menu-toggle span { display: block; width: 24px; height: 2.5px; background: var(--navy); border-radius: 2px; margin: 5px 0; transition: .2s; }

.flash { margin: 20px 0 0; padding: 14px 18px; border-radius: 10px; font-weight: 500; }
.flash-success { background: var(--green-soft); color: #0b6139; border: 1px solid #bfe3cf; }
.flash-error { background: var(--red-soft); color: #9b2c22; border: 1px solid #f3c6c1; margin-bottom: 16px; }

/* ===== Hero ===== */
/* ส่วนหัวพื้นกรมท่าเข้ม (สีเดียวกับขอบภาพ public/img/hero-*.webp) ภาพ 3D อยู่ครึ่งขวา ไล่จางเข้าหาข้อความ
   ตัวหนังสือขาว/ทองบนพื้น #091e3f คอนทราสต์เกิน 7:1 · จอ ≤1024px ภาพย้ายลงมาใต้ข้อความ */
.hero { --hero-bg: #091e3f; position: relative; overflow: hidden; isolation: isolate; background: var(--hero-bg); color: #c9d4e6; padding: 76px 0 104px; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(45% 60% at 78% 55%, rgba(242, 184, 75, .09), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 640px); min-height: 500px; align-content: center; }
.hero-text { position: relative; }
/* กรอบภาพสัดส่วนเดียวกับไฟล์ (3:2) วางกลางแนวตั้ง ขอบทั้ง 3 ด้านที่ไม่ชนขอบจอไล่จางเข้าพื้น จึงไม่เห็นรอยต่อ */
.hero-art { position: absolute; z-index: -1; top: 50%; right: 0; width: min(64%, 1080px); height: auto; aspect-ratio: 3 / 2; translate: 0 -48%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26%), linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent 0, #000 26%), linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent); mask-composite: intersect; }
.eyebrow { display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; font-size: 15px; margin-bottom: 18px; }
.hero .eyebrow { background: rgba(242, 184, 75, .12); color: #f5c868; border: 1px solid rgba(242, 184, 75, .38); }
.hero h1 { font-size: clamp(34px, 4.6vw, 54px); color: #fff; letter-spacing: -.3px; text-wrap: balance; }
.hl { color: var(--primary); }
.hero .hl { color: #f5c868; }
.lead { font-size: 20px; color: var(--muted); max-width: 580px; }
.hero .lead { color: #c9d4e6; }
.hero .course-search { border-color: transparent; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }
.hero .course-search:focus-within { border-color: #f5c868; box-shadow: 0 0 0 4px rgba(245, 200, 104, .3), 0 12px 32px rgba(0, 0, 0, .28); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 36px; }
.hero .btn-outline { background: rgba(255, 255, 255, .04); color: #fff; border-color: rgba(255, 255, 255, .42); }
.hero .btn-outline:hover { background: rgba(255, 255, 255, .1); border-color: #fff; color: #fff; }
.hero-stats { display: flex; gap: 40px; margin: 0; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); max-width: 560px; }
.hero-stats dt { color: #a9b7cd; font-size: 15px; }
.hero-stats dd { margin: 0; font: 700 28px var(--font-head); color: #fff; }
.hero-stats small { font-size: 16px; color: #a9b7cd; font-weight: 500; }

/* ===== ปกคอร์ส ===== */
.cover {
  position: relative; aspect-ratio: 16 / 9; padding: 22px 24px; display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; overflow: hidden; background-color: var(--c1);
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(135deg, var(--c1), var(--c2));
  background-size: 18px 18px, 100% 100%;
}
.cover-icon { width: 52px; height: 52px; border-radius: 12px; background: #fff; color: var(--c2); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.cover-big .cover-icon { width: 60px; height: 60px; }
.cover-title { font: 700 25px/1.3 var(--font-head); }
.cover-big .cover-title { font-size: 32px; }
.cover-gold { --c1: #c98a12; --c2: #8a5606; }
.cover-rose { --c1: #b43a5c; --c2: #7a1d3a; }
.cover-purple { --c1: #5a48b5; --c2: #362682; }
.cover-blue { --c1: #2560c4; --c2: #163a7c; }
.cover-teal { --c1: #13877c; --c2: #0a5952; }
.cover-green { --c1: #2c8a52; --c2: #185c35; }
.badge { position: absolute; top: 22px; right: 22px; background: rgba(255, 255, 255, .95); color: var(--navy); font: 600 14px var(--font-head); padding: 4px 12px; border-radius: 6px; }

/* ===== แถบจุดเด่น =====
   การ์ดขาวใบเดียววางคร่อมรอยต่อระหว่างส่วนหัว (พื้นขาว) กับส่วนคอร์ส (พื้นเทา) แต่ละจุดคั่นด้วยเส้นบาง
   จัดตามจำนวนจุดที่แสดง (1–3) ผ่าน data-count จอแคบเรียงลงมาทีละแถว */
.guarantee-strip { position: relative; z-index: 1; margin-top: -40px; }
.guarantee-grid { display: flex; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.guarantee-grid[data-count="1"] { max-width: 640px; margin: 0 auto; }
.guarantee { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 22px 28px; }
.guarantee + .guarantee { border-left: 1px solid var(--border); }
.guarantee div { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.5; }
.guarantee b { color: var(--navy); font: 600 18px/1.4 var(--font-head); }
.guarantee span:not(.g-icon) { color: var(--muted); font-size: 15px; line-height: 1.55; }
.g-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.guarantee-strip + .section { padding-top: 64px; }
@media (max-width: 860px) {
  .guarantee-strip { margin-top: -28px; }
  .guarantee-grid { flex-direction: column; }
  .guarantee { justify-content: flex-start; padding: 16px 20px; }
  .guarantee + .guarantee { border-left: 0; border-top: 1px solid var(--border); }
  .g-icon { width: 46px; height: 46px; }
  .guarantee b { font-size: 17px; }
  .guarantee-strip + .section { padding-top: 48px; }
}

/* ===== Section ===== */
.section { padding: 80px 0; }
.section-tight { padding: 36px 0 80px; }
.section-alt { background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 44px; }
.section-head p { color: var(--muted); font-size: 19px; margin: 0; }
.kicker { display: block; color: var(--primary); font: 600 15px var(--font-head); letter-spacing: .3px; margin-bottom: 8px; }
.section-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.section-row p { margin: 0; }

/* ===== การ์ดคอร์ส ===== */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.pad { padding: 30px; }
.grid-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; }
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-link { display: block; text-decoration: none; }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-cat.light { color: #a9c4f5; display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.card-body h3 { font-size: 22px; margin-bottom: 6px; }
.card-body h3 a { color: var(--navy); text-decoration: none; }
.card-body h3 a:hover { color: var(--primary); }
.card-proof { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 15px; margin-bottom: 14px; }
.card-proof > span { display: inline-flex; align-items: center; gap: 5px; }
.card-proof b { color: var(--navy); }
.card-points { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 16px; line-height: 1.5; color: #2c3546; }
.card-points li { display: flex; gap: 8px; align-items: flex-start; }
.card-points svg { color: var(--green); margin-top: 4px; }
.card-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.card-facts span { display: inline-flex; align-items: center; gap: 5px; }
.rating { display: inline-flex; align-items: center; gap: 5px; }
.rating > svg, .stars { color: var(--accent); }
.stars { display: inline-flex; gap: 1px; }
.card-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.card-price { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.card-price s { color: var(--muted); font-size: 16px; }
.off-pill { background: var(--red-soft); color: var(--red); font: 700 14px var(--font-head); padding: 3px 9px; border-radius: 6px; }
.save-line { color: var(--green); font-size: 15px; font-weight: 600; margin-top: -6px; }
.card-more { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--primary); font-weight: 600; text-decoration: none; font-size: 16px; padding: 4px; }
.card-more:hover { text-decoration: underline; }
/* ปกบนการ์ด: คำโปรยตัวใหญ่แทนชื่อคอร์ส */
.cover-card { justify-content: space-between; }
.cover-card .cover-icon { width: 48px; height: 48px; }
.cover-hook { display: grid; gap: 4px; }
.cover-hook span { font-size: 13px; font-weight: 600; letter-spacing: .3px; color: rgba(255, 255, 255, .8); }
.cover-hook b { font: 600 19px/1.55 var(--font-head); padding-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 8px rgba(0, 0, 0, .15); }
.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.price-now { font: 700 26px var(--font-head); color: var(--navy); }
.price-lg .price-now { font-size: 36px; }

/* ===== Features / Steps / Reviews ===== */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature { padding: 28px 24px; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); }
.f-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 16px; }
.feature p { color: var(--muted); margin: 0; font-size: 17px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps li { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.steps p { color: var(--muted); margin: 0; }
.step-no { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; font: 700 20px var(--font-head); margin-bottom: 14px; }
/* ขั้นตอนที่มีภาพ: ภาพเต็มหัวการ์ด เลขขั้นเป็นวงทองซ้อนมุมภาพ */
.steps li:has(.step-art) { padding: 14px 14px 26px; background: #fff; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.steps li:has(.step-art):hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.steps li:has(.step-art) h3, .steps li:has(.step-art) p { padding: 0 12px; }
.step-art { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; background: #0c2350; margin-bottom: 20px; }
.steps li:has(.step-art) .step-no { position: absolute; top: 26px; left: 26px; margin: 0; width: 40px; height: 40px; font-size: 18px; background: #f5c868; color: var(--navy); box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
/* ทำไมต้องเรียนกับเรา: ภาพซ้าย จุดเด่น 2×2 ขวา */
.why-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: center; }
.why-art { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 20px; background: #0c2350; box-shadow: var(--shadow-lg); }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.contact-art { display: block; width: 112px; height: 112px; border-radius: 22px; object-fit: cover; background: #0c2350; box-shadow: var(--shadow); }
.review { padding: 28px; margin: 0; display: flex; flex-direction: column; }
.review blockquote { margin: 14px 0 20px; font-size: 17px; flex: 1; color: #2c3546; }
.review figcaption { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.review figcaption span:last-child { display: flex; flex-direction: column; line-height: 1.4; }
.review small { color: var(--muted); font-size: 14px; }
.avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font: 600 19px var(--font-head); flex-shrink: 0; }
.avatar-lg { width: 68px; height: 68px; font-size: 26px; }

/* ===== FAQ / Accordion ===== */
.faq details, .curriculum details { background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.faq summary, .curriculum summary { cursor: pointer; padding: 18px 22px; font: 600 18px var(--font-head); color: var(--navy); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker, .curriculum summary::-webkit-details-marker { display: none; }
/* ลูกศรชี้ลง (วาดด้วยเส้นขอบ ไม่ใช้ตัวอักษร +/− ที่แต่ละฟอนต์หน้าตาไม่เท่ากัน) หมุนขึ้นเมื่อเปิด */
.faq summary::after, .curriculum summary::after { content: ''; width: 9px; height: 9px; margin: 0 4px 4px 0; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(45deg); transition: transform .2s ease, margin .2s ease; flex-shrink: 0; }
.faq details[open] summary::after, .curriculum details[open] summary::after { transform: rotate(-135deg); margin: 4px 4px 0 0; }
.faq summary:hover, .curriculum summary:hover { color: var(--primary-dark); }
.faq details p { padding: 0 22px 20px; margin: 0; color: var(--muted); }
.curriculum summary { font-size: 17px; }
.curriculum summary .muted { margin-left: auto; font-family: var(--font-body); font-weight: 400; }
.curriculum ul { list-style: none; margin: 0; padding: 0 22px 14px; }
.curriculum li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 17px; }
.curriculum li svg { color: var(--muted); }

/* ===== ติดต่อ =====
   การ์ดขาวบนพื้นหน้าเว็บ ต่อจากคำถามที่พบบ่อย ไม่ซ้อนเป็นแถบน้ำเงินสองชั้นกับส่วนท้าย */
.contact-band { padding: 0 0 80px; }
.contact-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px 40px; padding: 36px 40px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.contact-card h2 { margin-bottom: 6px; text-wrap: balance; }
.contact-copy p { margin: 0; color: var(--muted); max-width: 34em; }
.contact-copy .contact-hours { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--green); font-size: 16px; font-weight: 500; }
.contact-btns { display: flex; flex-direction: column; gap: 10px; }
.contact-btns .btn { justify-content: flex-start; }
@media (max-width: 860px) {
  .contact-card { grid-template-columns: 1fr; padding: 28px; }
  .contact-btns { flex-direction: row; flex-wrap: wrap; }
  .contact-art { width: 84px; height: 84px; border-radius: 18px; }
}
@media (max-width: 600px) {
  .contact-band { padding-bottom: 56px; }
  .contact-card { padding: 24px 20px; }
  .contact-btns .btn { flex: 1 1 100%; justify-content: center; }
}
.float-line { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 99px; background: var(--line-green-text); color: #fff; font: 600 16px var(--font-head); text-decoration: none; box-shadow: 0 8px 24px rgba(3, 127, 53, .35); }
.float-line:hover { background: #02692b; }

/* ===== Page head ===== */
.page-head { background: var(--navy); color: #fff; padding: 44px 0; }
.page-head h1 { color: #fff; margin-bottom: 4px; }
.page-head p { color: #c3cfe0; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.chip { padding: 8px 18px; border-radius: 99px; background: #fff; color: var(--text); text-decoration: none; font-weight: 500; border: 1px solid var(--border); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ===== หน้ารายละเอียดคอร์ส ===== */
.course-hero { background: var(--navy); color: #fff; padding: 32px 0 56px; }
.course-hero h1 { color: #fff; }
.course-hero .lead { color: #c3cfe0; }
.course-hero-text { max-width: 700px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 15px; margin-bottom: 22px; color: #94a6c2; }
.crumb-sep { display: inline-flex; opacity: .7; }
.crumbs > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.crumbs a { color: #c3cfe0; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs-dark, .crumbs-dark a { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 16px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta-light { color: #dfe6f1; }
.course-layout { display: grid; grid-template-columns: 1fr 370px; gap: 36px; align-items: start; padding-bottom: 80px; }
.course-main { padding-top: 36px; }
.box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; margin-bottom: 22px; }
.box h2 { font-size: 24px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist.two-col { grid-template-columns: 1fr 1fr; gap: 14px 28px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { color: var(--green); margin-top: 4px; }
.instructor-row { display: flex; gap: 18px; align-items: center; }
.instructor-row p { margin: 0; }
.buy-box { margin-top: -170px; }
/* กล่องราคาอยู่ก่อนเนื้อหาใน HTML ให้ลำดับการอ่านและปุ่ม Tab บนมือถือตรงกับที่เห็น ส่วนจอกว้างวางเป็นคอลัมน์ขวา
   และยืดเต็มความสูงแถว เพื่อให้การ์ดราคาเลื่อนตามผู้อ่านได้จริง (ถ้าสูงแค่การ์ด position: sticky จะไม่มีที่ให้เลื่อน) */
.course-layout > .buy-box { grid-column: 2; grid-row: 1; align-self: stretch; }
.course-layout > .course-main { grid-column: 1; grid-row: 1; }
/* แถบสั่งซื้อติดล่างจอ: ใช้เฉพาะจอแคบ แสดงเมื่อปุ่มสั่งซื้อหลักเลื่อนพ้นจอไปแล้ว (app.js) */
.buy-bar { display: none; }
.sticky { position: sticky; top: 92px; overflow: hidden; box-shadow: var(--shadow-lg); }
.buy-body { padding: 24px; }
.off-line { color: var(--green); font-weight: 600; margin: 0 0 16px; }
.owned-note { display: flex; gap: 8px; align-items: center; color: var(--green); font-weight: 600; }
.includes { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; font-size: 16px; }
.includes li { display: flex; gap: 10px; align-items: center; }
.includes svg { color: var(--muted); }
.trust-list { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.trust-list svg { color: var(--green); }

/* ===== ฟอร์ม ===== */
/* ช่องล่อบอท: คนมองไม่เห็นและกด Tab ไปไม่ถึง โปรแกรมที่กรอกทุกช่องจะกรอกช่องนี้ด้วย */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-wrap { padding: 56px 20px 80px; display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 480px; padding: 40px; }
.auth-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); margin-bottom: 16px; }
.auth-card h1 { font-size: 30px; margin-bottom: 4px; }
/* เข้าสู่ระบบ/สมัคร: แผงภาพซ้าย + ฟอร์มขวาเป็นการ์ดเดียวกัน (จอแคบเหลือแต่ฟอร์ม) */
.auth-wrap-split { align-items: stretch; }
.auth-aside { position: relative; overflow: hidden; isolation: isolate; width: 420px; flex: 0 0 420px; border-radius: var(--radius) 0 0 var(--radius); background: #0b2150; color: #c9d4e6; box-shadow: var(--shadow); }
.auth-art { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.auth-aside::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, rgba(9, 30, 63, .92) 0, rgba(9, 30, 63, .55) 45%, transparent 70%); }
.auth-aside-copy { padding: 40px 36px; }
.auth-aside-tag { display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid rgba(242, 184, 75, .4); color: #f5c868; font: 600 14px var(--font-head); margin-bottom: 16px; }
.auth-aside-title { font: 700 27px/1.4 var(--font-head); color: #fff; margin: 0 0 18px; }
.auth-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 16px; }
.auth-aside li { display: flex; align-items: center; gap: 8px; }
.auth-aside li svg { color: #f5c868; }
.auth-wrap-split .auth-card { border-radius: 0 var(--radius) var(--radius) 0; }
@media (max-width: 880px) {
  .auth-aside { display: none; }
  .auth-wrap-split .auth-card { border-radius: var(--radius); }
}
/* หน้าไม่พบ */
.not-found-art { display: block; width: 200px; height: 200px; margin: 0 auto 24px; border-radius: 28px; background: #0c2350; box-shadow: var(--shadow-lg); }
.not-found .course-search { margin: 26px auto 18px; text-align: left; }
.not-found-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.form { display: grid; gap: 18px; }
.form h2 { font-size: 21px; margin-bottom: 0; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]) {
  width: 100%; min-height: 52px; padding: 12px 16px; font: 400 18px var(--font-body);
  border: 1.5px solid #cfd7e3; border-radius: 10px; background: #fff; color: var(--text);
}
.form input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px rgba(27, 74, 135, .14); }
.form input:disabled { background: var(--bg); color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); font-size: 15px; }
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 80px !important; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: var(--bg); border: 0; padding: 8px 12px; border-radius: 8px; font: 500 15px var(--font-body); color: var(--primary); cursor: pointer; }
.pw-meter { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; }
.pw-meter i { flex: 1; height: 6px; border-radius: 3px; background: var(--border); position: relative; overflow: hidden; }
.pw-meter i::after { content: ''; position: absolute; inset: 0; width: 0; background: var(--red); transition: width .2s; }
.pw-meter::after { content: attr(data-label); min-width: 72px; color: var(--muted); }
.pw-meter[data-score="0"] { display: none; }
.pw-meter[data-score="1"] i::after { width: 25%; }
.pw-meter[data-score="2"] i::after { width: 50%; background: var(--accent); }
.pw-meter[data-score="3"] i::after { width: 75%; background: #4caf50; }
.pw-meter[data-score="4"] i::after { width: 100%; background: var(--green); }
.pw-meter:not([data-score]) { display: none; }
.check-row, .pay-opt { display: flex !important; gap: 12px !important; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 400 !important; }
.check-row span, .pay-opt span { display: flex; flex-direction: column; line-height: 1.5; }
.check-row span { display: block; }
.check-row b, .check-row small { display: block; }
.check-row small, .pay-opt small { font-size: 15px; }
.check-row input, .pay-opt input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.pay-opt:has(input:checked), .check-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.switch { margin: 24px 0 0; }
.btn-google { margin-top: 20px; background: #fff; color: #1f1f1f; border-color: #c9d3e3; gap: 12px; }
.btn-google:hover { background: #f5f8fd; border-color: #9fb3d1; }
.google-note { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 15px; margin: 22px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.secure-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.secure-note svg { color: var(--green); }

/* ===== Checkout / Order ===== */
.page-title { font-size: clamp(26px, 3vw, 32px); margin-bottom: 4px; }
.stepper { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: s; }
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 15px; font-weight: 500; }
.stepper li::before { content: ''; position: absolute; top: 17px; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: var(--green); }
.stepper li > span { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border); font-weight: 700; }
.stepper em { font-style: normal; }
.stepper li.current { color: var(--navy); font-weight: 600; }
.stepper li.current > span { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper li.done { color: var(--green); }
.stepper li.done > span { background: var(--green); border-color: var(--green); color: #fff; }
.checkout-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; margin-top: 20px; }
.summary h2 { font-size: 21px; }
.order-line { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; margin: 12px 0 20px; }
.order-line .cover { border-radius: 10px; padding: 10px; justify-content: center; align-items: center; }
.order-line .cover-title, .order-line .badge { display: none; }
.order-line .cover-icon { width: 42px; height: 42px; }
.order-line p { margin: 4px 0 0; }
.totals { margin: 0; }
.totals div { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; }
.totals .grand dt { color: var(--navy); font-weight: 700; font-size: 19px; }
.totals .grand dd { font: 700 28px var(--font-head); color: var(--navy); }

.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.pay-grid h2 { font-size: 21px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
#slip-form h2 { justify-content: flex-start; }
.step-tag { font: 600 13px var(--font-head); background: var(--primary-soft); color: var(--primary-dark); padding: 3px 10px; border-radius: 6px; }
.qr-box { display: inline-block; border: 1.5px solid var(--navy); border-radius: 14px; overflow: hidden; padding-bottom: 14px; margin: 8px 0 18px; background: #fff; }
.qr-head { background: var(--navy); color: #fff; font: 600 14px var(--font-head); padding: 10px 20px; letter-spacing: .5px; }
.qr-box img { display: block; margin: 12px auto 4px; width: 250px; height: 250px; }
.qr-amount { font: 700 34px var(--font-head); color: var(--navy); }
.howto { text-align: left; padding-left: 24px; margin: 0 0 14px; }
.howto li { margin-bottom: 4px; }
/* ชำระเงินอัตโนมัติ (RUBUN): QR ที่ยืนยันเอง ซองอั่งเปา และตัวเปลี่ยนวิธีชำระ */
.pay-auto, .voucher-card { max-width: 560px; margin: 0 auto 18px; }
.pay-auto .howto { max-width: 420px; margin-inline: auto; }
.pay-wait { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 12px; padding: 8px 16px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.pay-wait svg { animation: pay-spin 2s linear infinite; }
@keyframes pay-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-wait svg { animation: none; } }
.method-switch { max-width: 560px; margin: 0 auto; }
.pay-grid + .method-switch { margin-top: 18px; }
.method-switch summary { cursor: pointer; min-height: 44px; font-weight: 600; color: var(--primary-dark); }
.method-switch form { margin-top: 14px; }
.banks { display: grid; gap: 12px; margin-top: 16px; text-align: left; }
.bank { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.bank-no { display: flex; align-items: center; gap: 10px; }
.bank-no span { font: 600 20px var(--font-head); color: var(--navy); }
.warn-note { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: var(--accent-soft); color: #7a5300; border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 16px 0 0; }
.warn-note svg { margin-top: 3px; }
.warn-note.left { margin: 0 0 20px; }
.warn-note.no-margin { margin: 0; }
.warn-note a { color: inherit; }
.upload { position: relative; display: block !important; border: 2px dashed #b9c5d8; border-radius: 12px; background: var(--bg); cursor: pointer; text-align: center; overflow: hidden; }
.upload:hover { border-color: var(--primary); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-ui { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 16px; color: var(--primary); }
.upload-ui b { color: var(--navy); }
.upload.has-file .upload-ui { display: none; }
.slip-preview { display: block; max-height: 320px; margin: 0 auto; }
.form-msg { color: var(--red); margin: 0; min-height: 1em; font-weight: 500; }
.status-card { padding: 48px 30px; }
.status-card p { color: var(--muted); }
.status-icon { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; }
.status-icon.ok { background: var(--green-soft); color: var(--green); }
.offline-status { min-height: 1.6em; margin-top: 14px; }
.status-icon.wait { background: var(--accent-soft); color: #a86f00; }
.row-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.learn .row-btns { justify-content: flex-start; }

.pill { display: inline-block; padding: 4px 14px; border-radius: 99px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.st-pending { background: var(--accent-soft); color: #7a5300; }
.st-review { background: var(--primary-soft); color: var(--primary-dark); }
.st-paid { background: var(--green-soft); color: #0b6139; }
.st-rejected { background: var(--red-soft); color: #9b2c22; }
.st-cancelled { background: #eceff3; color: var(--muted); }

/* ===== บัญชีของฉัน ===== */
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.empty { padding: 40px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; padding: 14px 16px; background: var(--bg); color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.table td { padding: 14px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.devices { display: grid; gap: 12px; }
.device { display: flex; gap: 16px; align-items: center; padding: 18px 22px; flex-wrap: wrap; }
.device-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.device-info { display: flex; flex-direction: column; flex: 1; min-width: 220px; }
.device-info b .pill { margin-left: 6px; font-size: 13px; }

/* ===== ห้องเรียน ===== */
.learn { padding: 32px 0 80px; }
.learn-grid { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }
.player { aspect-ratio: 16 / 9; background: #0b1d36; border-radius: var(--radius); display: grid; place-items: center; color: #fff; text-align: center; padding: 20px; margin-bottom: 22px; }
.player-inner svg { color: #fff; opacity: .85; }
.player-inner p { font: 600 21px var(--font-head); margin: 12px 0 4px; }
.player-inner small { color: #94a6c2; }
.lesson-title { font-size: 27px; margin-bottom: 0; }
.lesson-list { padding: 22px; position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow: auto; }
.lesson-list h2 { font-size: 19px; }
.ll-module { margin-bottom: 14px; }
.ll-module > b { display: block; font-size: 15px; color: var(--navy); margin-bottom: 4px; }
.ll-module ul { list-style: none; padding: 0; margin: 0; }
.ll-module a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 16px; }
.ll-module a:hover { background: var(--bg); }
.ll-module a.current { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

/* ===== หลังร้าน ===== */
.stats { margin-bottom: 24px; }
.stats .stat { padding: 20px 22px; }
.stat span { color: var(--muted); display: block; font-size: 15px; }
.stat b { font: 700 30px var(--font-head); color: var(--navy); }
.stat-alert b { color: var(--primary); }
form.inline { display: inline-flex; gap: 6px; margin: 2px 0; }
.reject-form input { width: 120px; min-height: 42px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font: 16px var(--font-body); }

/* ===== หลังร้าน: แท็บ / ภาพรวม / กราฟ ===== */
.btn-gold { background: var(--accent); color: var(--navy); }
.btn-gold:hover { background: #f4b23a; }
.admin-head { padding-bottom: 0; }
.admin-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-tabs { display: flex; gap: 4px; margin-top: 26px; overflow-x: auto; }
.admin-tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; color: #c3cfe0; text-decoration: none; font-weight: 600; border-radius: 10px 10px 0 0; white-space: nowrap; }
.admin-tab:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.admin-tab.active { background: var(--bg); color: var(--navy); }
.admin .card + .card, .admin .grid-2, .admin .card.table-wrap { margin-top: 22px; }
.toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 7px 16px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.seg a.active { background: var(--navy); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi > span:first-child { color: var(--muted); font-size: 15px; }
.kpi b { font: 700 26px var(--font-head); color: var(--navy); }
.delta { font-size: 14px; font-weight: 600; }
.delta small { font-weight: 400; color: var(--muted); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); font-weight: 400; }
.insights { margin-top: 22px; }
.insights h2, .admin h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.insights ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ins { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.ins-tag { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font: 600 13px var(--font-head); padding: 3px 10px; border-radius: 6px; margin-top: 2px; }
.ins-action .ins-tag { background: var(--primary-soft); color: var(--primary-dark); }
.ins-good .ins-tag { background: var(--green-soft); color: #0b6139; }
.ins-warn .ins-tag { background: var(--accent-soft); color: #7a5300; }
.ins-info .ins-tag { background: #eceff3; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-2 > .card, .mt-grid > .card, .kpis > .card, .course-admin-list > .card { margin-top: 0 !important; }
.mt-grid { margin-top: 22px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 12px var(--font-body); }
.chart .area { fill: var(--primary); opacity: .08; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar { fill: var(--primary); }
.chart .hit { fill: transparent; }
.chart .guide { stroke: var(--navy); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .dot { fill: var(--primary); stroke: #fff; stroke-width: 2; opacity: 0; }
.chart .col:hover .guide, .chart .col:hover .dot { opacity: 1; }
.chart .col:hover .hit { fill: rgba(27, 74, 135, .04); }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.chart-tip[hidden] { display: none; }
.chart-tip b { font: 700 16px var(--font-head); }
.chart-tip span { color: #c3cfe0; }
.chart-table { margin-top: 8px; font-size: 15px; }
.chart-table summary { cursor: pointer; color: var(--primary); }
.chart-table .table { margin-top: 8px; }
.rank, .funnel { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.rank-top { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; margin-bottom: 4px; }
.rank-top b { white-space: nowrap; }
.rank-top small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.rank svg, .funnel svg { display: block; width: 100%; height: 8px; }
.funnel svg { height: 12px; }
.rank-bg { fill: var(--bg); }
.rank-fg { fill: var(--primary); }
.pad-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 22px 6px; }
.pad-head h2 { margin: 0; }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.privacy-note { display: flex; gap: 6px; align-items: center; margin-top: 18px; }
.new-tag { font-size: 14px; font-weight: 600; color: var(--primary-dark); background: var(--primary-soft); padding: 2px 10px; border-radius: 6px; }

/* หลังร้าน: คอร์ส */
.course-admin-list { display: grid; gap: 14px; }
.ca-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 20px; align-items: center; padding: 14px; }
.ca-cover .cover { border-radius: 10px; padding: 12px; }
.ca-cover .cover-title { font-size: 15px; }
.ca-cover .cover-icon { width: 34px; height: 34px; }
.ca-cover .cover-icon svg { width: 20px; height: 20px; }
.ca-cover .badge { display: none; }
.ca-info h3 { margin: 6px 0 2px; }
.ca-info p { margin: 0; }
.ca-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.course-edit { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.course-edit-side { display: grid; gap: 16px; position: sticky; top: 92px; }
.course-edit-side .card { margin-top: 0 !important; }
.cover-preview { margin-bottom: 14px; border-radius: 10px; overflow: hidden; }
.trailer-video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #000; }
.cover-photo { padding: 0; background: var(--bg); }
.cover-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form textarea, .form select {
  width: 100%; padding: 12px 16px; font: 400 17px/1.6 var(--font-body);
  border: 1.5px solid #cfd7e3; border-radius: 10px; background: #fff; color: var(--text); resize: vertical;
}
.form select { min-height: 52px; }
.form textarea:focus, .form select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px rgba(27, 74, 135, .14); }
.row-btns.left { justify-content: flex-start; margin-bottom: 0; }
.danger-zone h2 { color: var(--red); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.search-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 220px; min-height: 50px; padding: 10px 16px; font: 17px var(--font-body); border: 1.5px solid #cfd7e3; border-radius: 10px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .course-edit { grid-template-columns: 1fr; }
  .course-edit-side { position: static; }
}
@media (max-width: 880px) {
  .grid-2 { grid-template-columns: 1fr; }
  .ca-row { grid-template-columns: 120px 1fr; }
  .ca-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .table td.num { text-align: right; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }
  .ins { flex-direction: column; gap: 6px; }
}

/* ===== เนื้อหาบทเรียน (ห้องเรียน + หลังร้าน) ===== */
.player-media { position: relative; padding: 0; overflow: hidden; background: #000; }
/* ลายน้ำผู้ซื้อ: จางพอไม่รบกวนการเรียน แต่ยังติดมาในภาพหน้าจอ */
.buyer-mark { position: absolute; top: 10px; right: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .28); color: rgba(255, 255, 255, .72); font-size: 12px; pointer-events: none; }
.buyer-note { margin: 28px 0 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.player-media iframe, .player-media video { width: 100%; height: 100%; border: 0; display: block; }
.lesson-main > .card, .lesson-block { margin-top: 22px; }
.lesson-text { font-size: 18px; line-height: 1.85; }
.lesson-text h3 { font-size: 22px; margin: 22px 0 8px; }
.lesson-text h3:first-child { margin-top: 0; }
.lesson-text ul { padding-left: 24px; margin: 0 0 1em; }
.lesson-text li { margin-bottom: 4px; }
.lesson-text a { word-break: break-all; }
.lesson-block h2, .lesson-admin h2, .lesson-editor h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4 / 3; background: var(--bg); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery a:hover img { transform: scale(1.03); }
.file-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.file-list li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.file-list li > div { flex: 1; min-width: 160px; display: flex; flex-direction: column; line-height: 1.4; word-break: break-word; }
.file-list small { font-size: 14px; }
.file-ext { display: grid; place-items: center; min-width: 52px; height: 52px; padding: 0 6px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font: 700 13px var(--font-head); }
.lesson-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.lesson-tags em { font-style: normal; font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-dark); white-space: nowrap; }
.lesson-tags em.empty { background: #eceff3; color: var(--muted); }
.curriculum li .lesson-tags { margin-left: auto; }
.lesson-admin { grid-column: 1; }
.la-module { margin-top: 16px; }
.la-module > b { color: var(--navy); }
.la-module ul { list-style: none; padding: 0; margin: 6px 0 0; }
.la-module li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.la-title { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.lesson-nav > span:last-child { display: flex; gap: 8px; }
.lesson-editor { display: grid; gap: 22px; max-width: 900px; }
.lesson-editor > .card { margin-top: 0 !important; }
.lesson-editor .player { margin-bottom: 10px; }
.video-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 14px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-label { font-weight: 600; margin: 0 0 6px; }
.format-help { font-size: 15px; color: var(--muted); }
.format-help summary { cursor: pointer; color: var(--primary); }
.format-help code { background: var(--bg); padding: 1px 6px; border-radius: 4px; color: var(--navy); }
.uploader { margin-top: 12px; }
.uploader .upload-ui { padding: 22px 14px; }
.upload input:disabled { cursor: wait; }
.upload-queue { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.upload-queue li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; background: var(--bg); border-radius: 8px; padding: 8px 12px; }
.upload-queue b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uq-status { color: var(--muted); white-space: nowrap; }
.uq-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.uq-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-queue li.done .uq-bar i { background: var(--green); }
.upload-queue li.done .uq-status { color: var(--green); font-weight: 600; }
.upload-queue li.err .uq-bar i { background: var(--red); }
.upload-queue li.err .uq-status { color: var(--red); font-weight: 600; white-space: normal; }
.admin-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 4px; }
.admin-thumbs figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.admin-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.admin-thumbs form { position: absolute; top: 4px; right: 4px; }
.thumb-del { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .92); color: var(--red); cursor: pointer; box-shadow: var(--shadow); }
@media (max-width: 880px) {
  .video-choices { grid-template-columns: 1fr; }
}

/* ===== แอปบนมือถือ ===== */
[hidden] { display: none !important; }
.app-back { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -6px; border: 0; background: none; color: var(--navy); cursor: pointer; border-radius: 10px; }
.app-back svg { transform: rotate(180deg); }
.app-back:hover { background: var(--bg); }
.header-inner { justify-content: flex-start; }
.header-inner .menu-toggle, .header-inner .main-nav { margin-left: auto; }
.standalone body { padding-bottom: env(safe-area-inset-bottom); }
.standalone .site-header { padding-top: env(safe-area-inset-top); }
.install-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 45; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.install-icon img { display: block; border-radius: 10px; }
.install-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.install-text b { color: var(--navy); font-size: 16px; }
.install-text small { color: var(--muted); font-size: 13px; }
.install-close { display: inline-grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; line-height: 1; color: var(--muted); cursor: pointer; padding: 0; }
.install-close:hover { background: var(--bg); color: var(--navy); }
.has-install-bar .float-line { bottom: calc(112px + env(safe-area-inset-bottom)); }
.has-install-bar .site-footer { padding-bottom: 180px; }
.app-promo { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 28px; text-decoration: none; color: inherit; border-color: #c9d8f5; background: linear-gradient(90deg, var(--primary-soft), #fff); }
.app-promo img { border-radius: 12px; flex-shrink: 0; }
.app-promo > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.4; }
.app-promo b { color: var(--navy); }
.app-promo small { color: var(--muted); font-size: 15px; }
.app-hero { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 22px; }
.app-hero img { border-radius: 22px; box-shadow: var(--shadow-lg); flex-shrink: 0; }
.app-hero h2 { font-size: 22px; }
.app-ready { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; color: var(--green); background: var(--green-soft); border-color: #bfe3cf; }
.app-ready p { margin: 0; }
[data-install-native] { margin-bottom: 22px; }
.install-guides { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 20px; }
.install-guides .card { margin: 0; }
.install-guides h2 { font-size: 21px; }
.install-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.install-steps li { display: flex; gap: 14px; align-items: flex-start; }
.install-steps .step-no { width: 36px; height: 36px; font-size: 17px; margin: 0; flex-shrink: 0; }
.install-steps p { margin: 4px 0 6px; }
.key-visual { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); color: var(--primary); font-weight: 600; }
.key-text { font-size: 16px; }
@media (max-width: 700px) {
  .install-guides { grid-template-columns: 1fr; }
  .app-hero { flex-direction: column; align-items: center; text-align: center; }
  .app-hero .checklist { text-align: left; }
  .app-promo .btn { display: none; }
}

/* ===== นโยบาย ===== */
.policy h2 { font-size: 22px; margin-top: 28px; }
.policy h2:first-child { margin-top: 0; }
.policy p, .policy li { color: #33405a; }
.policy ul { padding-left: 22px; margin: 0 0 1em; }

/* ===== ส่วนท้าย =====
   คอลัมน์ร้าน (โลโก้ คำโปรย ข้อมูลบริษัท) กว้างกว่า ตามด้วยลิงก์ 3 กลุ่ม หัวข้อเล็กสีขาว ลิงก์ขนาดเดียวกันทุกกลุ่ม
   แถวล่าง: ลิขสิทธิ์ซ้าย ช่องทางชำระเงินขวา แล้วข้อความชี้แจงตัวเล็ก · เว้นท้ายไว้ให้ปุ่ม LINE ลอยไม่บังเนื้อหา */
.site-footer { background: #0a1c33; color: #b8c4d6; padding: 64px 0 96px; font-size: 15px; line-height: 1.6; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 40px 48px; }
.footer-brand p { margin: 16px 0 20px; max-width: 24em; color: #d3dbe6; font-size: 16px; text-wrap: pretty; }
.footer-company { display: grid; gap: 2px; font-style: normal; font-size: 14px; line-height: 1.6; color: #8c9bb2; max-width: 30em; }
.footer-company b { color: #d3dbe6; font-weight: 600; }
.footer-grid .footer-title { margin: 4px 0 16px; color: #fff; font-size: 15px; font-weight: 600; }
.footer-links { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; }
.footer-links li { display: flex; align-items: center; gap: 10px; }
.footer-links a { display: inline-flex; align-items: center; gap: 10px; color: #b8c4d6; text-decoration: none; }
.footer-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.footer-links svg { color: #7f91ab; }
.footer-contact a, .footer-contact li { overflow-wrap: anywhere; }
.footer-bottom { margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 14px; color: #8c9bb2; }
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-note { margin-top: 14px !important; max-width: 62em; font-size: 13px; line-height: 1.6; color: #7f91ab; }
.pay-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pay-badges small { margin-right: 4px; font-size: 13px; color: #8c9bb2; }
.pay-badges span { padding: 1px 9px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px; color: #d3dbe6; font-size: 13px; font-weight: 500; }
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; column-gap: 48px; }
  .footer-brand .logo, .footer-brand p { grid-column: 1; }
  .footer-brand .footer-company { grid-column: 2; grid-row: 1 / span 2; padding-top: 6px; }
  .footer-brand p { margin-bottom: 0; }
}
@media (max-width: 600px) {
  .site-footer { padding-top: 48px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
  .footer-brand { display: block; }
  .footer-brand p { margin-bottom: 18px; }
  .footer-contact { grid-column: 1 / -1; }
  .footer-legal { flex-direction: column; align-items: flex-start; }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .hero { padding-bottom: 64px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 8px; }
  .hero-art { position: static; z-index: auto; translate: none; display: block; width: calc(100% + 40px); max-width: none; height: auto; aspect-ratio: 6 / 5; max-height: 460px; margin: 0 -20px; object-fit: cover; object-position: 100% 50%; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 85%, transparent); mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 85%, transparent); }
  .why-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .why-art { max-width: 560px; margin: 0 auto; aspect-ratio: 16 / 10; }
  .course-layout, .learn-grid { grid-template-columns: 1fr; }
  .buy-box { margin-top: 0; }
  .course-layout > .buy-box, .course-layout > .course-main { grid-column: auto; grid-row: auto; }
  .buy-bar:not([hidden]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(15, 40, 71, .1); }
  .buy-bar-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; min-width: 0; }
  .buy-bar-price .price-now { font-size: 22px; }
  .buy-bar-price s { font-size: 14px; }
  .buy-bar .btn { flex: 0 0 auto; min-width: 140px; min-height: 48px; }
  .has-buy-bar .float-line { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .has-buy-bar .site-footer { padding-bottom: 96px; }
  .course-main { padding-top: 0; }
  .course-layout { padding-top: 24px; }
  .sticky, .lesson-list { position: static; max-height: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .menu-toggle { display: block; }
  .main-nav { display: none; position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 8px 16px 20px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .menu-open .main-nav { display: flex; }
  .main-nav > a:not(.btn) { padding: 14px 8px; font-size: 19px; border-bottom: 1px solid var(--border); }
  .main-nav > a.active:not(.btn) { box-shadow: none; }
  .nav-sep { display: none; }
  .main-nav .btn { margin-top: 10px; }
  .menu-open .menu-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
  .grid-3, .steps, .checkout-grid, .pay-grid { grid-template-columns: 1fr; }
  .checkout-grid .summary { order: -1; }
  .checklist.two-col { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: block; padding: 12px 16px; border-top: 1px solid var(--border); }
  .table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 14px; text-align: left; }
  .table td:first-child { display: block; text-align: left; padding-bottom: 8px; }
  .table td:first-child::before { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .container { padding: 0 16px; }
  .section { padding: 56px 0; }
  .hero { padding: 36px 0 48px; }
  .hero h1 { font-size: 32px; }
  .hero-cta .btn { flex: 1 1 100%; }
  .hero-stats { gap: 20px; justify-content: space-between; }
  .hero-stats dd { font-size: 22px; }
  .grid-4, .grid-courses, .features { grid-template-columns: 1fr; }
  .hero-art { width: calc(100% + 32px); margin: 0 -16px; }
  .pad, .box { padding: 22px; }
  .auth-card { padding: 28px 22px; }
  .logo { font-size: 19px; }
  .logo-img { height: 42px; }
  .order-line { grid-template-columns: 90px 1fr; }
  .stepper li { font-size: 13px; }
  .float-line span { display: none; }
  .float-line { padding: 14px; }
  .contact-btns .btn { flex: 1 1 100%; }
}

/* ===== ปุ่มกลับหลังร้าน: เห็นเฉพาะผู้ดูแล ลอยอยู่ทุกหน้าของหน้าร้าน ===== */
.back-to-admin { position: fixed; left: 20px; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 99px; background: var(--navy); color: #fff; font: 600 16px var(--font-head); text-decoration: none; box-shadow: var(--shadow-lg); }
.back-to-admin:hover { background: var(--navy-2); }
.back-to-admin:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.has-install-bar .back-to-admin { bottom: calc(112px + env(safe-area-inset-bottom)); }
@media (max-width: 600px) {
  .back-to-admin { left: 16px; bottom: 16px; padding: 12px 16px; font-size: 15px; }
}

/* ===== ค้นหาคอร์สและแพลตฟอร์ม ===== */
.course-search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid #cfd7e3; border-radius: 12px; padding: 6px 6px 6px 16px; margin-bottom: 22px; max-width: 760px; }
.course-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(27, 74, 135, .14); }
.course-search > svg { color: var(--muted); }
.course-search input[type=search] { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; font: 17px var(--font-body); background: transparent; color: var(--text); }
.course-search .btn { min-height: 44px; padding: 8px 20px; }
.hero-text .course-search { margin: 24px 0 0; }
.hero-text .course-search + .hero-cta { margin-top: 18px; }
.filter-row { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.filter-row .chips { margin-bottom: 0; flex: 1; }
.filter-label { flex: 0 0 76px; font-weight: 600; color: var(--muted); font-size: 15px; }
.chips-center { justify-content: center; }
.result-line { margin: 22px 0 18px; font-weight: 600; color: var(--navy); }
.result-line a { font-weight: 400; margin-left: 8px; }
.filter-row + .grid-courses { margin-top: 26px; }
.pf-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px; background: #fff; }
.pf-letter { background: var(--navy); color: #fff; font: 700 13px/1 var(--font-head); box-shadow: 0 0 0 1px rgba(255, 255, 255, .55); }
.chip-pf { display: inline-flex; align-items: center; gap: 7px; padding: 6px 16px 6px 8px; }
.platform-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.platform-tags .pf-icon { width: 20px; height: 20px; border-radius: 5px; }
.platform-tags a { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; line-height: 1.5; padding: 2px 10px 2px 3px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); text-decoration: none; }
.platform-tags a:hover { background: #dfe9fb; }
.platform-tags-light { margin: 4px 0 14px; }
.platform-tags-light a { background: rgba(255, 255, 255, .14); color: #fff; }
.platform-tags-light a:hover { background: rgba(255, 255, 255, .24); }

/* ===== แถบชวนใช้ AI หน้าแรก =====
   พื้นน้ำเงินเข้มเรียบ ไม่มีแสงฟุ้ง · ซ้าย: ข้อความ ราคาเริ่มต้นแต่ละประเภท (คั่นเส้นบาง) และปุ่ม
   ขวา: ตัวอย่างหน้าสร้างงานจริง (/ai) พื้นขาว ฟอร์มซ้าย ผลงานขวา ผลงานอยู่ในกรอบ 4:5 แบบเดียวกับการ์ด "ผลงานของฉัน" */
.ai-band { background: var(--navy); color: #fff; padding: 72px 0; }
.ai-band-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 600px); align-items: center; gap: 64px; }
.ai-band-tag { display: inline-block; margin-bottom: 14px; padding: 1px 10px; border: 1px solid rgba(247, 199, 102, .55); border-radius: 6px; color: #f7c766; font: 600 14px/1.6 var(--font-head); }
.ai-band h2 { color: #fff; margin-bottom: 14px; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.3; text-wrap: balance; }
.ai-band-copy > p { color: #c3cfe0; margin: 0; max-width: 32em; }
.ai-band-kinds { margin: 28px 0 0; border-top: 1px solid rgba(255, 255, 255, .14); }
.ai-band-kinds > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 20px; padding: 13px 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.ai-band-kinds dt { display: flex; align-items: center; gap: 10px; color: #fff; font: 600 17px/1.45 var(--font-head); }
.ai-band-kinds dt svg { color: #8fb2ff; }
.ai-band-kinds dd { margin: 0; grid-column: 1; padding-left: 30px; color: #a9b8cc; font-size: 15px; line-height: 1.5; }
.ai-band-kinds .ai-band-price { grid-column: 2; grid-row: 1 / span 2; padding: 0; text-align: right; color: #c3cfe0; white-space: nowrap; }
.ai-band-price b { color: #f7c766; font: 700 20px/1.2 var(--font-head); margin-left: 2px; }
.ai-band-price small { display: block; font-size: 13px; color: #a9b8cc; }
.ai-band-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
.ai-band-cta small { color: #a9b8cc; font-size: 15px; line-height: 1.5; max-width: 17em; text-wrap: balance; }

/* ตัวอย่างหน้าสร้างงาน */
.ai-demo { background: #fff; color: var(--text); border-radius: 16px; padding: 16px 20px 20px; box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.ai-demo-tabs { display: inline-flex; gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 10px; background: #eef1f5; }
.ai-demo-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 14px/1.4 var(--font-head); cursor: pointer; }
.ai-demo-tabs button:hover { color: var(--navy); }
.ai-demo-tabs button[aria-pressed="true"] { background: var(--navy); color: #fff; }
/* แต่ละตัวอย่างซ้อนอยู่ช่องเดียวกัน ความสูงเท่าตัวที่สูงสุด สลับแล้วกล่องไม่กระโดด · ตัวที่ซ่อนอยู่กดหรือโฟกัสไม่ได้ */
.ai-demo-panels { display: grid; }
.ai-demo-panel { grid-area: 1 / 1; display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 20px; visibility: hidden; opacity: 0; transition: opacity .25s ease, visibility 0s linear .25s; }
.ai-demo-panel.is-on { visibility: visible; opacity: 1; transition: opacity .25s ease; }
.ai-demo-form { display: flex; flex-direction: column; min-width: 0; }
.ai-demo-label { margin-bottom: 6px; color: var(--navy); font: 600 14px/1.4 var(--font-head); }
.ai-demo-prompt { min-height: 98px; margin: 0 0 14px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; line-height: 1.6; transition: border-color .15s, box-shadow .15s; }
.ai-demo[data-step="typing"] .ai-demo-prompt { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ai-demo-caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 1px; vertical-align: -.18em; background: var(--primary); animation: aiCaret 1s steps(1) infinite; }
@keyframes aiCaret { 50% { opacity: 0; } }
.ai-demo:not([data-step="typing"]) .ai-demo-caret { display: none; }
.ai-demo-opts { list-style: none; display: grid; gap: 6px; margin: 0 0 16px; padding: 0; }
.ai-demo-opts li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; line-height: 1.5; }
.ai-demo-opts li.is-picked { border-color: var(--primary); background: var(--primary-soft); }
.ai-demo-radio { flex-shrink: 0; width: 16px; height: 16px; border: 1.5px solid #b7c0ce; border-radius: 50%; background: #fff; }
.is-picked .ai-demo-radio { border: 5px solid var(--primary); }
.ai-demo-opts .opt-icons { margin-left: auto; }
.ai-demo-opts .pf-icon { width: 20px; height: 20px; }
.ai-demo-go { margin-top: auto; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; background: var(--primary); color: #fff; font: 600 15px/1.3 var(--font-head); transition: background .15s; }
.ai-demo-go b { margin-left: 6px; font-weight: 600; color: #dbe6fb; }
.ai-demo-go-busy { display: none; }
.ai-demo[data-step="making"] .ai-demo-go { background: var(--primary-dark); }
.ai-demo[data-step="making"] .ai-demo-go-idle { display: none; }
.ai-demo[data-step="making"] .ai-demo-go-busy { display: inline; }
/* ผลงาน: พิมพ์อยู่ = กรอบว่าง · กำลังสร้าง = แถบความคืบหน้า · เสร็จ = ผลงานค่อย ๆ ขึ้น */
.ai-demo-result { margin: 0; min-width: 0; }
/* แถว/คอลัมน์ minmax(0, 1fr): ช่องเท่ากรอบพอดี ผลงานข้างในย่อให้พอดีกรอบ ไม่ดันกรอบให้สูงขึ้น */
.ai-demo-frame { position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; aspect-ratio: 4 / 5; border-radius: 10px; background: #eceff3; overflow: hidden; }
.ai-demo-frame > * { grid-area: 1 / 1; }
.ai-demo-video { background: #1c1410; }
.ai-demo-audio { background: var(--primary-soft); }
.ai-demo-badge { z-index: 2; place-self: start start; margin: 8px; padding: 1px 8px; border-radius: 6px; background: rgba(15, 40, 71, .8); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.6; }
.ai-demo-audio .ai-demo-badge { background: #fff; color: var(--primary); }
.ai-demo-media { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: 100%; height: 100%; min-height: 0; transition: opacity .45s ease; }
.ai-demo-media > * { grid-area: 1 / 1; }
.ai-demo-image .ai-demo-media svg { width: 100%; height: auto; }
.ai-demo-video .ai-demo-media svg { width: auto; height: 100%; }
.ai-demo-play { display: grid; place-items: center; width: 40px; height: 40px; padding-left: 2px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--navy); }
.ai-demo-scrub { align-self: end; width: 64%; height: 3px; margin-bottom: 16px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.ai-demo-scrub i { display: block; width: 0; height: 100%; background: #fff; }
.ai-demo[data-step="done"] .is-on .ai-demo-scrub i { animation: aiProgress 5s linear forwards; }
@keyframes aiProgress { to { width: 100%; } }
.ai-demo-voice { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; padding: 0 18px; }
.ai-demo-voice-name { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font: 600 14px/1.4 var(--font-head); text-align: center; }
.ai-demo-voice-name svg { color: var(--primary); }
.ai-demo-wave { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 56px; }
.ai-demo-wave i { flex: 0 0 4px; height: 40%; border-radius: 99px; background: var(--primary); opacity: .75; transform-origin: center; }
.ai-demo-voice:has(.is-playing) .ai-demo-wave i { animation: aiWave .9s ease-in-out infinite alternate; }
@keyframes aiWave { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
.ai-demo-wave i:nth-child(1) { height: 30%; } .ai-demo-wave i:nth-child(2) { height: 55%; animation-delay: .1s; } .ai-demo-wave i:nth-child(3) { height: 80%; animation-delay: .2s; } .ai-demo-wave i:nth-child(4) { height: 45%; animation-delay: .3s; }
.ai-demo-wave i:nth-child(5) { height: 95%; animation-delay: .15s; } .ai-demo-wave i:nth-child(6) { height: 60%; animation-delay: .05s; } .ai-demo-wave i:nth-child(7) { height: 35%; animation-delay: .25s; } .ai-demo-wave i:nth-child(8) { height: 75%; animation-delay: .35s; }
.ai-demo-wave i:nth-child(9) { height: 100%; animation-delay: .1s; } .ai-demo-wave i:nth-child(10) { height: 50%; animation-delay: .2s; } .ai-demo-wave i:nth-child(11) { height: 70%; animation-delay: .3s; } .ai-demo-wave i:nth-child(12) { height: 40%; animation-delay: 0s; }
.ai-demo-wave i:nth-child(13) { height: 85%; animation-delay: .15s; } .ai-demo-wave i:nth-child(14) { height: 55%; animation-delay: .25s; } .ai-demo-wave i:nth-child(15) { height: 30%; animation-delay: .05s; } .ai-demo-wave i:nth-child(16) { height: 65%; animation-delay: .35s; }
.ai-demo-wave i:nth-child(17) { height: 90%; animation-delay: .2s; } .ai-demo-wave i:nth-child(18) { height: 45%; animation-delay: .1s; } .ai-demo-wave i:nth-child(19) { height: 60%; animation-delay: .3s; } .ai-demo-wave i:nth-child(20) { height: 35%; animation-delay: 0s; }
.ai-demo-empty { color: var(--muted); font-size: 14px; opacity: 0; }
.ai-demo-wait { display: none; place-self: stretch; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(100deg, #eceff3 30%, #f7f8fa 50%, #eceff3 70%); background-size: 200% 100%; color: var(--muted); font-size: 14px; animation: aiShimmer 1.2s linear infinite; }
@keyframes aiShimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.ai-demo-bar { width: 60%; height: 4px; border-radius: 99px; background: #d9dfe8; overflow: hidden; }
.ai-demo-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); }
.ai-demo[data-step="making"] .ai-demo-bar i { animation: aiProgress 1.5s ease-in-out forwards; }
.ai-demo[data-step="typing"] .ai-demo-media, .ai-demo[data-step="making"] .ai-demo-media { opacity: 0; transition: none; }
.ai-demo[data-step="typing"] .ai-demo-frame, .ai-demo[data-step="making"] .ai-demo-frame { background: #eceff3; }
.ai-demo[data-step="typing"] .ai-demo-empty { opacity: 1; }
.ai-demo[data-step="making"] .ai-demo-wait { display: flex; }
.ai-demo-result figcaption { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.4; transition: opacity .3s; }
.ai-demo-result figcaption span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.ai-demo[data-step="typing"] figcaption, .ai-demo[data-step="making"] figcaption { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .ai-demo-caret, .ai-demo-wave i, .ai-demo-scrub i, .ai-demo-bar i, .ai-demo-wait { animation: none !important; }
  .ai-demo-panel, .ai-demo-panel.is-on, .ai-demo-media, .ai-demo-result figcaption { transition: none; }
}
@media (max-width: 1080px) {
  .ai-band-inner { grid-template-columns: 1fr; gap: 40px; }
  .ai-band-copy > p { max-width: 36em; }
  .ai-demo { width: 100%; max-width: 600px; }
}
@media (max-width: 600px) {
  .ai-band { padding: 56px 0; }
  .ai-demo { padding: 12px 12px 16px; border-radius: 14px; }
  .ai-demo-tabs { display: flex; }
  .ai-demo-tabs button { flex: 1; }
  .ai-demo-panel { grid-template-columns: 1fr; gap: 16px; }
  .ai-demo-prompt { min-height: 76px; }
  .ai-demo-frame { aspect-ratio: auto; height: 260px; }
  .ai-demo-image .ai-demo-media svg { width: auto; height: 100%; }
}

/* ===== ยอดเงิน ===== */
.logo { white-space: nowrap; }
.main-nav { flex-shrink: 0; }
.main-nav > a:not(.btn) { padding: 8px 10px; font-size: 17px; white-space: nowrap; }
.main-nav .btn { white-space: nowrap; }
.main-nav > a.points-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; margin-right: 6px; border-radius: 99px; background: var(--accent-soft); color: #7a5300; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; box-shadow: none; }
.main-nav > a.points-pill:hover, .main-nav > a.points-pill.active { background: #fbe9c4; color: #7a5300; border-radius: 99px; box-shadow: none; }
.points-promo { margin-bottom: 28px; }
.points-promo-icon { color: var(--accent); display: inline-flex; }
.balance { display: flex; align-items: baseline; gap: 8px; color: #fff; text-decoration: none; }
.balance b { font: 700 38px var(--font-head); color: #f7c766; }
.balance small { color: #c3cfe0; font-size: 15px; }
.balance-link:hover small:last-child { text-decoration: underline; }
/* ===== ยอดเงินและเติมเงิน =====
   แนวคิด: กระเป๋าเงินของร้าน — ยอดเงินเป็นทอง (สีเงินของแบรนด์) ปุ่มลงมือทำเป็นน้ำเงิน โบนัส/ได้เพิ่มเป็นเขียว
   ตัวเลขเงินทุกจุดใช้ tabular-nums ให้หลักตรงกันเมื่อค่าเปลี่ยนตามที่เลือก */
.tp [hidden], .wallet-head [hidden] { display: none !important; }
.wallet-head { padding: 40px 0 44px; }
.wallet-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 24px 40px; align-items: center; }
.wallet-hero-text h1 { margin-bottom: 6px; }
.wallet-card { display: grid; gap: 4px; padding: 22px 22px 20px; border-radius: 16px; background: linear-gradient(145deg, #1b4274 0%, #143563 55%, #0f2847 100%); border: 1px solid rgba(247, 199, 102, .3); box-shadow: 0 12px 32px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .07); }
.wallet-card > small { color: #c3cfe0; font-size: 15px; }
.wallet-card-amount { font: 700 46px/1.15 var(--font-head); color: #f7c766; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.wallet-card-uses { margin: 8px 0 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.wallet-card-uses > small { color: #a9b8cc; font-size: 14px; }
.wallet-card .tp-uses-list { color: #e6edf6; }
.wallet-card .tp-uses-list svg { color: #f7c766; }
.page-head .wallet-card-empty { margin: 8px 0 14px; color: #c3cfe0; font-size: 15px; }
.tp-uses-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; }
.tp-uses-list li { display: inline-flex; align-items: center; gap: 6px; }
.tp-uses-list b { font-variant-numeric: tabular-nums; }

.tp-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 22px; }
.tp-section-head h2 { margin: 0 0 2px; }
.tp-section-head p { margin: 0; }
.package-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 20px; }
.package { position: relative; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.package:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c4d2ea; }
.package-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.package h3 { margin: 0; color: var(--muted); font-size: 17px; }
.package-points { font: 700 32px var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
.package-points small { font-size: 16px; font-weight: 600; color: var(--muted); }
.package-price { font-size: 18px; font-weight: 600; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.package-price small { margin-left: 4px; font-size: 15px; }
.package .btn { margin-top: auto; }
.package-best { border: 2px solid var(--accent); }
.package-custom { border: 1.5px dashed #b4c2d8; background: #fbfcfe; box-shadow: none; }
.package-custom h3 { color: var(--navy); }
.package-custom-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: #a86f00; margin-bottom: 4px; }
.package-custom-range { font: 700 22px var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
.package-custom .muted { margin-bottom: 14px; }
.tp-flag { position: absolute; top: -11px; right: 16px; padding: 2px 12px; border-radius: 99px; background: var(--accent); color: var(--navy); font-size: 13px; font-weight: 700; line-height: 1.6; box-shadow: 0 2px 8px rgba(233, 161, 27, .35); white-space: nowrap; }
.tp-flag-soft { background: var(--navy); color: #fff; box-shadow: none; }
.tp-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 99px; background: var(--green-soft); color: #0e6b3f; font-size: 14px; font-weight: 700; line-height: 1.5; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-chip-none { background: var(--bg); color: #4a5466; font-weight: 500; }
.tp-trust { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; color: var(--muted); font-size: 15px; }
.tp-trust li { display: inline-flex; align-items: flex-start; gap: 8px; }
.tp-trust svg { color: var(--green); flex-shrink: 0; margin-top: 3px; }
.tp-empty { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.tp-empty p { margin: 0; }

/* รายการที่ยังไม่ได้จ่าย */
.tp-pending { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; margin-bottom: 30px; border-radius: 12px; background: var(--accent-soft); border: 1px solid #f1d9a6; color: #5c4100; }
.tp-pending-compact { margin: 18px 0 0; }
.tp-pending-icon { display: inline-flex; margin-top: 2px; color: #a86f00; }
.tp-pending-body { flex: 1; min-width: 0; }
.tp-pending ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.tp-pending a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; border-radius: 10px; background: #fff; border: 1px solid #f1d9a6; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.tp-pending a:hover { border-color: var(--accent); }
.tp-pending .pill { padding: 2px 10px; font-size: 14px; }
.tp-pending-go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; }

/* หน้าเติมเงิน */
.tp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tp-head p { margin: 0; }
.tp-head-balance { display: grid; text-align: right; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.tp-head-balance small { color: var(--muted); font-size: 14px; }
.tp-head-balance b { font: 700 24px var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
.tp-form { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; margin-top: 24px; }
.tp-main { display: grid; gap: 18px; min-width: 0; }
.tp-step { margin: 0; padding: 22px 24px 24px; min-width: 0; }
.tp-step-title { float: left; width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 0; font: 600 20px var(--font-head); color: var(--navy); }
.tp-step-title + * { clear: both; }
.tp-num { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: 16px; font-weight: 700; }
.tp-amounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.tp-form .tp-amount { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 400; transition: border-color .15s, box-shadow .15s, background .15s; }
.tp-form .tp-amount > input[type=radio] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tp-amount:hover { border-color: #9fb3d1; }
.tp-form .tp-amount:has(> input[type=radio]:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.tp-amount:has(> input[type=radio]:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tp-amount .tp-flag { top: -10px; right: auto; left: 14px; }
.tp-amount-name { font-size: 15px; font-weight: 600; color: var(--muted); }
.tp-amount-pay { font: 700 28px/1.2 var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
.tp-amount-get { margin-bottom: 6px; font-size: 15px; color: var(--text); }
.tp-amount-get b { font-variant-numeric: tabular-nums; }
.tp-amount .tp-chip { align-self: flex-start; }
.tp-tick { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.tp-amount:has(> input[type=radio]:checked) .tp-tick { opacity: 1; transform: none; }
/* ใส่ยอดเอง: แถวเต็มความกว้างใต้แพ็กเกจ ชื่อซ้าย ช่องพิมพ์ขวา ยอดที่ได้แสดงใต้ช่องทันที */
.tp-form .tp-amount-custom { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 16px; padding-right: 48px; cursor: text; }
.tp-form .tp-amount-custom > label { display: block; cursor: pointer; }
.tp-custom-meta { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; }
.tp-custom-get { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-variant-numeric: tabular-nums; }
.tp-custom-get b { color: var(--navy); }
.tp-custom-field { display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 1.5px solid #cfd7e3; border-radius: 10px; background: #fff; }
.tp-custom-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(27, 74, 135, .14); }
.tp-custom-field > span { font: 700 22px var(--font-head); color: var(--muted); }
#tp-custom { width: 100%; min-width: 0; min-height: 46px; padding: 6px 0; border: 0; border-radius: 0; box-shadow: none; outline: none; background: transparent; font: 700 22px var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
#tp-custom::placeholder { color: #a6b1c2; font-weight: 600; }
.tp-amount-custom:has(#tp-custom[aria-invalid=true]) .tp-custom-field { border-color: var(--red); }
.tp-custom-hint { color: var(--muted); font-size: 14px; }
.tp-error { margin: 10px 0 0; color: var(--red); font-size: 15px; font-weight: 600; }
.tp-ladder { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--bg); }
.tp-ladder-title { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--navy); }
.tp-ladder-title svg { color: var(--accent); }
.tp-ladder ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tp-ladder li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--border); font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, color .15s; }
.tp-ladder li.is-on { background: var(--green-soft); border-color: #bfe3cf; color: #0b6139; }
.tp-ladder li.is-on b { color: #0e6b3f; }
.tp-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: #5c4100; font-size: 15px; }
.tp-nudge > svg { color: #a86f00; flex-shrink: 0; }
.tp-nudge > span { flex: 1; min-width: 180px; }
.tp-nudge .btn { min-height: 38px; padding: 4px 14px; font-size: 15px; }
.tp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.tp-fields label > span small { font-weight: 400; }
.tp-methods { display: grid; gap: 10px; }
.tp-summary { position: sticky; top: 92px; display: grid; gap: 14px; padding: 24px; }
.tp-summary h2 { margin: 0; font-size: 20px; }
.tp-lines { display: grid; margin: 0; }
.tp-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; }
.tp-lines dt { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.tp-lines dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-line-bonus dd { color: var(--green); }
.tp-lines .tp-line-total { margin-top: 4px; padding-top: 14px; border-top: 1px dashed #cfd7e3; }
.tp-line-total dt { color: var(--navy); font-weight: 700; }
.tp-line-total dd { font: 700 32px/1.1 var(--font-head); color: var(--navy); }
.tp-after { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 15px; }
.tp-after > span:last-child { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tp-after b { color: var(--navy); }
.tp-uses > small { color: var(--muted); font-size: 14px; }
.tp-uses .tp-uses-list svg { color: var(--primary); }
.tp-pay { gap: 8px; }
.tp-fine { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tp-fine svg { flex-shrink: 0; margin-top: 3px; color: var(--green); }
@media (max-width: 900px) {
  .wallet-hero, .tp-form { grid-template-columns: minmax(0, 1fr); }
  .tp-summary { position: static; }
}
@media (max-width: 600px) {
  .wallet-head { padding: 28px 0 32px; }
  .wallet-card-amount { font-size: 38px; }
  .tp-step { padding: 18px 16px 20px; }
  .tp-amounts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tp-form .tp-amount { padding: 14px 12px 12px; }
  .tp-amount-pay { font-size: 24px; }
  .tp-form .tp-amount-custom { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .tp-custom-meta { grid-column: 1; }
  .tp-fields { grid-template-columns: minmax(0, 1fr); }
  .tp-head-balance { text-align: left; }
  .tp-summary { padding: 20px 16px; }
  .tp-pending { padding: 14px; }
  .tp-pending-go { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .package, .tp-amount, .tp-tick, .tp-ladder li { transition: none; }
  a.package:hover { transform: none; }
}

/* ===== หน้าสร้างภาพ/วิดีโอ AI =====
   ส่วนหัวบาง แท็บประเภทงานอยู่ขอบล่าง แท็บที่เลือกเป็นสีพื้นเดียวกับพื้นที่ทำงาน ต่อกันเป็นชิ้นเดียว
   ซ้าย: แผงสร้างงาน (ช่องพิมพ์กับตัวอย่างคำสั่งในกรอบเดียว ขนาดเป็นรูปทรงจริง รุ่นและราคา ปุ่มสร้างติดขอบล่าง)
   ขวา: ผลงานแบบแกลเลอรี หรือขั้นตอนใช้งานสำหรับคนที่ยังไม่เข้าสู่ระบบ */
.studio-head { padding: 40px 0 0; }
.studio-head h1 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 36px); }
.studio-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px; padding-bottom: 28px; }
.studio-head-row p { max-width: 40em; }
.wallet { display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 18px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; background: rgba(255, 255, 255, .06); }
.wallet-amount { display: grid; line-height: 1.25; }
.wallet-amount small { color: #a9b8cc; font-size: 14px; }
.wallet-amount b { color: #f7c766; font: 700 28px/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.wallet .btn { gap: 6px; }
.studio-tabs { display: flex; gap: 4px; padding: 0; border: 0; border-radius: 0; background: none; }
.studio-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 12px 12px 0 0; color: #c3cfe0; font: 600 16px/1.4 var(--font-head); text-decoration: none; }
.studio-tabs a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.studio-tabs a.active { background: var(--bg); color: var(--navy); }
.studio-tabs a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.studio-section { padding-top: 28px; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 28px; align-items: start; }
.studio-form { gap: 24px; padding: 24px; border-radius: 16px; box-shadow: var(--shadow); }
.studio-back { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; text-decoration: none; }
.studio-back svg { transform: scaleX(-1); }
.studio-back:hover { text-decoration: underline; }
/* ช่องพิมพ์คำสั่ง: ช่องพิมพ์กับตัวอย่างคำสั่งอยู่ในกรอบเดียว โฟกัสแล้วทั้งกรอบเป็นสีน้ำเงิน */
.composer-field { display: grid; gap: 8px; }
.composer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.form .composer-head label { display: block; color: var(--navy); }
.composer-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.composer-count.is-near { color: #9a5b00; font-weight: 600; }
.composer { border: 1.5px solid #cfd7e3; border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(27, 74, 135, .14); }
.form .composer textarea { display: block; min-height: 132px; padding: 12px 14px 8px; border: 0; border-radius: 12px 12px 0 0; background: transparent; }
.form .composer textarea:focus { box-shadow: none; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px 12px; border-top: 1px dashed var(--border); }
.presets-label { margin-right: 2px; font-size: 13px; color: var(--muted); }
.presets .chip { padding: 3px 12px; border-color: transparent; background: var(--bg); font: 500 14px/1.6 var(--font-body); cursor: pointer; }
.presets .chip:hover { border-color: transparent; background: var(--primary-soft); color: var(--primary-dark); }
.composer-tip { display: flex; gap: 8px; margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.composer-tip svg { flex-shrink: 0; margin-top: 3px; color: #8a96a8; }
/* ปุ่มช่วยเขียนคำสั่ง: ปุ่มไล่สีทอง-น้ำเงินอ่อน เด่นพอให้เห็นแต่ไม่แย่งปุ่มสร้างงาน */
.assist-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.assist-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px; border: 1.5px solid #e8c66f; border-radius: 99px; background: linear-gradient(135deg, #fff8e6, #eef3fd); color: var(--navy); font: 600 15px var(--font-head); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.assist-btn svg { color: #b7860b; }
.assist-btn:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(183, 134, 11, .22); transform: translateY(-1px); }
.assist-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.assist-btn:disabled { cursor: progress; opacity: .85; }
.assist-btn.is-busy svg { animation: assist-spin 1.2s linear infinite; }
@keyframes assist-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .assist-btn.is-busy svg { animation: none; } .assist-btn:hover:not(:disabled) { transform: none; } }
.assist-hint { font-size: 13px; color: var(--muted); }
.assist-status { flex-basis: 100%; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--green-soft); color: #0b6139; font-size: 14px; }
.assist-status.is-error { background: var(--red-soft); color: #9b2c22; }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; }
.no-margin { margin: 0; }
/* ตัวเลือกในฟอร์ม */
.opts { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.opts legend { margin-bottom: 8px; padding: 0; color: var(--navy); font-weight: 600; }
.form label.opt { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 400; transition: border-color .15s, background .15s; }
.form label.opt:hover { border-color: #b9c6db; }
.opt input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
.opt > span:not(.opt-icons) { display: flex; flex-direction: column; line-height: 1.4; flex: 1; min-width: 0; }
.opt small { font-size: 14px; }
.opt-icons { display: flex; gap: 2px; flex-shrink: 0; }
.opt-cost { flex-shrink: 0; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: #7a5300; font-style: normal; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.form label.opt:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.form label.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.form label.opt:has(input:checked) .opt-cost { background: #fff; }
.form label.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
/* เลือกเสียงพากย์: รายการเดียวคั่นเส้นบาง แถวละบรรทัด เสียงที่เลือกขยายคำอธิบายเต็มและมีแถบน้ำเงินด้านซ้าย */
.voice-picker legend { width: 100%; }
.voice-price { float: right; margin-top: 2px; color: #7a5300; font: 600 14px var(--font-body); }
.voice-tools { display: grid; gap: 8px; }
.voice-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-groups .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font: 500 14px/1.6 var(--font-body); cursor: pointer; }
.voice-groups .chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-groups .chip[aria-pressed="true"] { border-color: var(--navy); background: var(--navy); color: #fff; }
.voice-groups .chip[aria-pressed="true"] span { color: rgba(255, 255, 255, .75); }
.voice-groups .chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.form .voice-search { width: 100%; min-height: 42px; padding: 8px 12px; border: 1.5px solid #cfd7e3; border-radius: 10px; font: 400 15px var(--font-body); }
.voice-list { position: relative; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; }
.voice-picker.is-long .voice-list { max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.form label.voice-row { gap: 10px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.form label.voice-row:last-of-type { border-bottom: 0; }
.form label.voice-row:hover { border-color: var(--border); background: var(--bg); }
.form label.voice-row:has(input:checked) { border-color: var(--border); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.form label.voice-row:has(input:focus-visible) { outline-offset: -3px; }
.voice-row input { width: 18px; height: 18px; }
.voice-text b { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; color: var(--navy); font-size: 15px; line-height: 1.45; }
.voice-tag { color: var(--muted); font-size: 13px; font-weight: 500; }
.voice-text small { font-size: 13px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-row:has(input:checked) .voice-text small { white-space: normal; }
.voice-row .voice-play { padding: 4px 10px; font-size: 13px; }
.voice-picker.is-flat-price .opt-cost { display: none; }
.voice-empty { margin: 0; padding: 16px; color: var(--muted); font-size: 14px; text-align: center; }
/* ขนาด: การ์ดสามใบเรียงแถวเดียว มีกรอบสัดส่วนจริงให้เห็นรูปทรงก่อนอ่าน ปุ่มวิทยุซ่อนไว้แต่ยังกดและใช้คีย์บอร์ดได้ */
.opts-ratio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form label.opt-ratio { position: relative; flex-direction: column; justify-content: flex-start; gap: 8px; padding: 14px 6px 10px; text-align: center; }
.form .opt-ratio > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.form .opt-ratio > .ratio-shape { flex: none; }
.form .opt-ratio > .opt-text { flex: 1; display: grid; align-content: start; gap: 2px; line-height: 1.35; }
.opt-ratio .opt-text b { font-size: 15px; color: var(--navy); }
.opt-ratio .opt-text small { font-size: 12.5px; line-height: 1.4; }
.opt-ratio .opt-icons { justify-content: center; }
.opt-ratio .pf-icon { width: 20px; height: 20px; }
.ratio-shape { display: block; height: 30px; border: 2px solid #9aa7ba; border-radius: 4px; background: #fff; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-1x1 { aspect-ratio: 1; }
.ratio-9x16 { aspect-ratio: 9 / 16; }
.form label.opt-ratio:has(input:checked) .ratio-shape { border-color: var(--primary); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 30px rgba(27, 74, 135, .16); }
/* ผลงานของฉัน */
.studio-results { min-width: 0; }
.studio-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; min-height: 44px; margin-bottom: 18px; }
.studio-results-head h2 { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 24px; }
.studio-count { color: var(--muted); font: 500 15px var(--font-body); }
/* จำนวนผลงานบนแท็บ และจุดบอกว่ามีงานกำลังสร้างอยู่ในแท็บนั้น */
.tab-count { min-width: 22px; padding: 0 7px; border-radius: 99px; background: rgba(255, 255, 255, .14); color: #e6edf7; font: 600 13px/1.6 var(--font-body); text-align: center; font-variant-numeric: tabular-nums; }
.studio-tabs a.active .tab-count { background: var(--primary-soft); color: var(--primary-dark); }
.tab-live { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #f7c766; }
.studio-tabs a.active .tab-live { background: var(--accent); }
.tab-live::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; color: #f7c766; opacity: 0; animation: tabLive 1.6s ease-out infinite; }
@keyframes tabLive { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tab-live::after { animation: none; } }
/* เสียงพากย์: ไม่มีภาพให้ดู จึงเรียงเป็นแถว ตัวเล่นเสียงซ้าย บทพูดและปุ่มขวา อ่านบทได้ยาวกว่า */
.job-grid.job-grid-audio { grid-template-columns: 1fr; gap: 12px; }
.job-grid-audio .job { flex-direction: row; }
.job-grid-audio .job-media { flex: 0 0 280px; aspect-ratio: auto; min-height: 196px; }
.job-grid-audio .job-body { min-width: 0; padding: 16px 18px 0; }
.job-grid-audio .job-prompt { min-height: 0; font-size: 16px; -webkit-line-clamp: 3; line-clamp: 3; }
.job-grid-audio .job-actions { margin-left: -18px; margin-right: -18px; padding-left: 14px; padding-right: 14px; }
@media (max-width: 600px) {
  .job-grid-audio .job { flex-direction: column; }
  .job-grid-audio .job-media { flex-basis: auto; min-height: 196px; }
  .job-grid-audio .job-body { padding: 12px 14px 0; }
  .job-grid-audio .job-actions { margin-left: -14px; margin-right: -14px; padding: 6px 8px; }
}
/* ยังไม่มีงาน: กรอบสามขนาดเส้นประ บอกว่างานจะขึ้นตรงนี้ */
.studio-empty { display: grid; justify-items: center; gap: 4px; padding: 52px 24px; border: 1.5px dashed #cfd7e3; border-radius: 16px; text-align: center; }
.studio-empty p { margin: 18px 0 0; color: var(--navy); font: 600 19px/1.4 var(--font-head); }
.studio-empty small { color: var(--muted); font-size: 15px; }
.studio-empty .btn { margin-top: 16px; }
.studio-empty-shapes { display: flex; align-items: flex-end; gap: 10px; }
.studio-empty-shapes .ratio-shape { height: 46px; border-style: dashed; border-color: #b7c2d3; background: transparent; }
.studio-empty-audio { display: grid; place-items: center; width: 64px; height: 64px; border: 2px dashed #b7c2d3; border-radius: 50%; color: #8a96a8; }
/* ยังไม่เข้าสู่ระบบ: ขั้นตอนใช้งานจริงของหน้านี้ เรียงเป็นลำดับ */
.studio-guide { padding: 8px 28px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.studio-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.studio-steps li { counter-increment: step; display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.studio-steps li::before { content: counter(step); grid-row: 1 / span 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font: 700 16px var(--font-head); }
.studio-steps b, .studio-steps span { grid-column: 2; }
.studio-steps b { color: var(--navy); font: 600 18px/1.4 var(--font-head); }
.studio-steps span { color: var(--muted); font-size: 16px; line-height: 1.6; }
.studio-guide-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* การ์ดผลงาน: ทุกใบกว้างและสูงเท่ากัน กรอบสื่อ 4:5 เหมือนกันทุกประเภท */
/* 200px: แถบผลงานบนจอคอม (กว้างราว 690px) ได้ 3 คอลัมน์ เห็นงานทีละหลายชิ้นแบบแกลเลอรี */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.job { overflow: hidden; display: flex; flex-direction: column; container-type: inline-size; border-radius: 14px; box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.job:hover { border-color: #c9d3e3; box-shadow: var(--shadow-lg); }
.job-media { position: relative; aspect-ratio: 4 / 5; background: #eef1f5; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* งานที่กำลังสร้าง: แถบบางวิ่งที่ขอบล่างของกรอบ บอกว่าระบบยังทำงานอยู่ */
.job-media-state { background: linear-gradient(180deg, #f4f6fa, #e8edf4); }
.job[data-job] .job-media::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--primary), transparent) no-repeat; background-size: 45% 100%; animation: jobScan 1.6s ease-in-out infinite; }
@keyframes jobScan { from { background-position: -80% 0; } to { background-position: 180% 0; } }
@media (prefers-reduced-motion: reduce) { .job[data-job] .job-media::after { animation: none; background-size: 100% 100%; opacity: .5; } .job { transition: none; } }
.job-open { position: absolute; inset: 0; display: block; }
.job-open:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.job-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.2); filter: blur(22px) saturate(1.15); opacity: .6; }
.job-fit { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
/* วิดีโอ: เฟรมแรกของคลิปเป็นภาพตัวอย่าง ปุ่มเล่นกลางกรอบ ชี้แล้วเล่นตัวอย่างแบบไม่มีเสียง กดแล้วเปิดเครื่องเล่นเต็มจอ */
.job-media-video { background: var(--navy); }
.job-thumb { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; }
.job-play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; display: grid; place-items: center; padding-left: 3px; background: rgba(255, 255, 255, .94); color: var(--navy); box-shadow: 0 6px 24px rgba(0, 0, 0, .28); transition: transform .15s ease, opacity .2s ease; }
.job-video:hover .job-play, .job-video:focus-visible .job-play { transform: scale(1.08); }
.job-video.is-previewing .job-play { opacity: 0; }
/* เสียงพากย์: ปุ่มเล่นใหญ่กลางกรอบ ชื่อเสียงใต้ปุ่ม แถบเวลาชิดล่าง */
.job-media-audio { background: var(--primary-soft); }
.job-audio { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 44px 14px 14px; }
.job-voice { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; }
.job-voice-icon { width: 68px; height: 68px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--primary); box-shadow: 0 2px 10px rgba(27, 74, 135, .14); cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.job-voice-icon:disabled { cursor: default; }
.job-voice-icon:not(:disabled):hover { transform: scale(1.06); }
.job-voice-icon:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.job-audio.is-playing .job-voice-icon { background: var(--primary); color: #fff; }
.job-voice b { color: var(--navy); font-size: 15px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.job-audio audio { width: 100%; height: 40px; }
.job-audio-bar { display: grid; gap: 4px; }
.job-audio-bar span { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.job-audio-bar input { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 6px 0 0; border-radius: 99px; background: linear-gradient(to right, var(--primary) var(--p, 0%), #cad6ee var(--p, 0%)); cursor: pointer; }
.job-audio-bar input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 40, 71, .3); }
.job-audio-bar input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 40, 71, .3); }
.job-audio-bar input:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .job-play, .job-voice-icon { transition: none; }
  .job-video:hover .job-play, .job-voice-icon:not(:disabled):hover { transform: none; }
}

/* เครื่องดูภาพและวิดีโอเต็มจอ: เปิดทันทีในหน้าเดิม ไม่ต้องรอเปิดแท็บใหม่ */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #fff; overflow: hidden; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(8, 18, 34, .94); }
body:has(.viewer[open]) { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.viewer-title { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .86); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 16px; border: 1px solid rgba(255, 255, 255, .24); border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font: 600 16px var(--font-body); text-decoration: none; cursor: pointer; }
.viewer-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.viewer-btn:focus-visible, .viewer-nav:focus-visible { outline: 3px solid #8fb2ff; outline-offset: 2px; }
.viewer-close { padding: 0; }
.viewer-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 72px 20px; }
.viewer-stage > * { grid-area: 1 / 1; }
.viewer-stage video, .viewer-stage img { display: block; max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; opacity: 0; transition: opacity .2s ease; }
.viewer-stage.is-ready video, .viewer-stage.is-ready img { opacity: 1; }
.viewer-stage.is-ready .spinner { display: none; }
.viewer-stage .spinner { border-color: rgba(255, 255, 255, .25); border-top-color: #fff; }
.viewer-nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.viewer-nav:hover { background: rgba(255, 255, 255, .24); }
.viewer-prev { left: 14px; }
.viewer-next { right: 14px; }
.viewer-prev svg { transform: scaleX(-1); }
.viewer-error { margin: 0; color: rgba(255, 255, 255, .86); text-align: center; }
@media (max-width: 600px) {
  .viewer-stage { padding: 0 8px 12px; }
  .viewer-nav { top: auto; bottom: 18px; margin: 0; width: 44px; height: 44px; background: rgba(8, 18, 34, .6); }
  .viewer-dl span { display: none; }
  .viewer-dl { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { .viewer-stage video, .viewer-stage img { transition: none; } }
/* ป้ายสัดส่วนจริงของงาน (9:16, 16:9, MP3) */
.job-badge { position: absolute; top: 10px; left: 10px; z-index: 1; padding: 1px 8px; border-radius: 7px; background: rgba(15, 40, 71, .8); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.6; pointer-events: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.job-media-audio .job-badge { background: #fff; color: var(--primary); }
/* ปุ่มฟังตัวอย่างเสียงในรายการโทนเสียง */
.voice-play { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 5px 10px; border: 1.5px solid var(--border); border-radius: 999px; background: #fff; color: var(--primary); font: 600 14px var(--font-body, inherit); cursor: pointer; }
.voice-play:hover { border-color: var(--primary); }
.voice-play.is-playing { background: var(--primary); border-color: var(--primary); color: #fff; }
.job-state { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; text-align: center; padding: 16px; }
.job-state.bad { color: var(--red); background: var(--red-soft); align-self: stretch; justify-content: center; width: 100%; }
/* ไฟล์โหลดไม่สำเร็จ: ไม่โชว์ไอคอนรูปแตกกับคำสั่งเป็นลิงก์สีน้ำเงิน แต่ขึ้นกล่องบอกเหตุพร้อมปุ่มลองใหม่ */
.job-media img { color: transparent; }
.job-media.is-broken > :not(.job-broken):not(.job-badge) { visibility: hidden; }
.job-broken { position: absolute; inset: 0; z-index: 1; justify-content: center; background: #eceff3; }
.job-broken .btn { font-size: 15px; }
.job-state small { font-size: 14px; font-weight: 400; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 5; line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #cfd7e3; border-top-color: var(--primary); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
/* ส่วนข้อความ: คำสั่ง 2 บรรทัดเสมอ (สั้นกว่าก็จองที่ไว้) รุ่นกับราคาบรรทัดเดียว ปุ่มชิดล่าง */
.job-body { flex: 1; padding: 12px 14px 0; display: flex; flex-direction: column; gap: 4px; }
.job-prompt { margin: 0; min-height: 3em; color: var(--text); font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.job-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 10px; font-size: 14px; color: var(--muted); }
.job-tier { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.job-tier svg { flex-shrink: 0; }
.job-tier span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-cost { flex-shrink: 0; color: var(--text); font-weight: 600; }
.job-actions { margin: auto -14px 0; min-height: 54px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; border-top: 1px solid var(--border); }
.job-actions .btn-sm { min-height: 38px; font-size: 15px; }
.job-actions .job-icon-btn { color: var(--muted); }
.job-actions .job-icon-btn:hover { background: var(--bg); color: var(--navy); }
.job-wait { padding-left: 4px; }
.job-wait { font-size: 14px; color: var(--muted); }
/* เวลาที่สร้างกับอายุไฟล์: บรรทัดเดียวสีจาง ใกล้หมดอายุเป็นสีส้มให้รีบดาวน์โหลด */
.job-when { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-expiring { color: #9a5b00; font-weight: 600; }
/* ปุ่มดาวน์โหลดกินที่ที่เหลือ ปุ่มใช้ซ้ำกับลบเป็นไอคอนเล็ก การ์ดแคบ (3 คอลัมน์หรือมือถือ) เหลือแค่ไอคอนดาวน์โหลด */
.job-dl { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
.job-tools { display: flex; gap: 2px; flex-shrink: 0; }
.job-icon-btn { min-width: 40px; padding-left: 9px; padding-right: 9px; }
@container (max-width: 250px) {
  .job-dl-text { display: none; }
}
/* งานที่กำลังสร้าง: นาฬิกานับเวลา + เวลาปกติของงานประเภทนั้น */
.job-timer { font: 600 22px var(--font-head); color: var(--navy); font-variant-numeric: tabular-nums; }
.job-timer:empty { display: none; }
.job-eta { font-size: 13px; font-weight: 400; color: var(--muted); }
/* งานที่ไม่สำเร็จ: แถวสรุปเดียวเหนือแกลเลอรี กดเปิดดูรายการ */
.job-failed { margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.job-failed summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); font-size: 15px; cursor: pointer; list-style: none; }
.job-failed summary::-webkit-details-marker { display: none; }
.job-failed summary > svg { flex-shrink: 0; color: var(--red); }
.job-failed summary > span:nth-child(2) { flex: 1; }
.job-failed summary b { color: var(--red); }
.job-failed-more { color: var(--primary); font-weight: 600; white-space: nowrap; }
.job-failed summary:hover .job-failed-more { text-decoration: underline; }
.job-failed[open] .job-failed-more { visibility: hidden; }
.job-failed ul { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; gap: 6px; }
.job-failed li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.job-failed-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.job-failed-text b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-failed-text small { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.5; }
.job-failed .job-icon-btn span { margin-left: 4px; font-size: 15px; }
.job-more { display: grid; justify-items: center; gap: 8px; margin-top: 24px; }
.job-more p { margin: 0; }
/* ปุ่มสร้าง: ติดขอบล่างจอตลอดเวลาที่ฟอร์มอยู่บนจอ ไม่ต้องเลื่อนหา พร้อมราคาของรุ่นที่เลือก */
.studio-submit { position: sticky; bottom: 0; z-index: 3; display: grid; gap: 10px; margin: 0 -24px -24px; padding: 14px 24px calc(16px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid var(--border); border-radius: 0 0 16px 16px; }
.studio-assure { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.studio-assure span { display: inline-flex; align-items: center; gap: 5px; }
.studio-assure svg { color: var(--green); }
.studio-assure a { color: var(--muted); }
.studio-assure a:hover { color: var(--primary); }
@media (max-width: 600px) {
  .studio-form { padding: 18px; gap: 20px; }
  .studio-submit { margin: 0 -18px -18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .studio-head { padding-top: 28px; }
  .studio-head-row { padding-bottom: 20px; }
  .wallet { width: 100%; justify-content: space-between; }
  .studio-tabs a { flex: 1; justify-content: center; padding: 11px 8px; }
  .studio-guide { padding: 4px 20px 22px; }
  .studio-guide-cta .btn { flex: 1 1 100%; }
  /* การ์ดขนาดแคบบนมือถือ: เหลือรูปทรง ชื่อขนาด และโลโก้แพลตฟอร์ม (คำอธิบายยาวตัดคำไม่สวย) */
  .opt-ratio .opt-text small { display: none; }
  .opt-ratio .opt-text b { font-size: 14px; }
}
.btn-price { margin-left: 4px; padding: 2px 10px; border-radius: 99px; background: rgba(255, 255, 255, .2); font-size: 16px; font-variant-numeric: tabular-nums; }
.reuse-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: 15px; line-height: 1.5; }
.reuse-note svg { flex-shrink: 0; }
/* หน้าสร้างงาน: ไม่ให้ปุ่มลอยบังปุ่มสร้างและการ์ดผลงาน ปุ่ม LINE ย่อเป็นวงกลม บนมือถือซ่อน (ติดต่อได้จากเมนูและท้ายหน้า)
   ปุ่ม "กลับหลังร้าน" ซ่อน เพราะทับปุ่มสร้างที่ติดขอบล่าง (ผู้ดูแลกลับได้จากเมนู "หลังร้าน") */
.page-ai .float-line { padding: 14px; }
.page-ai .float-line span { display: none; }
.page-ai .back-to-admin { display: none; }
.page-ai main { padding-bottom: 48px; }
@media (max-width: 760px) {
  .page-ai .float-line { display: none; }
}

/* ===== หลังร้าน: แพลตฟอร์ม ยอดเงิน และ AI ===== */
.check-grid { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 16px 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; min-width: 0; }
.check-grid legend { font-weight: 600; padding: 0 6px; }
.form .check-grid label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check-grid input { width: 19px; height: 19px; accent-color: var(--primary); }
.form-table td[data-label="ไอคอน"] { vertical-align: middle; }
.add-model { margin-bottom: 22px; }
.add-model-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.add-model-row select, .add-model-row input { flex: 1 1 240px; min-width: 0; min-height: 46px; padding: 8px 12px; font: 16px var(--font-body); border: 1.5px solid #cfd7e3; border-radius: 10px; background: #fff; }
.add-model-row select[name=kind] { flex: 0 0 110px; }
.tier-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 16px 18px; display: grid; gap: 10px; min-width: 0; }
.tier-card.is-off { background: var(--bg); }
.tier-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tier-sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 18px; }
.tier-price { font-weight: 600; color: #7a5300; background: var(--accent-soft); padding: 2px 12px; border-radius: 99px; font-size: 15px; }
.tier-card p { margin: 0; }
.tier-warn { color: var(--red); }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.tier-grid [hidden] { display: none; }
.form .tier-grid label { font-weight: 600; font-size: 15px; gap: 4px; align-content: start; min-width: 0; }
.form .tier-grid input:not([type=checkbox]):not([type=radio]) { min-height: 42px; padding: 7px 10px; font-size: 16px; width: 100%; min-width: 0; }
.tier-grid select { width: 100%; min-height: 42px; padding: 7px 10px; font: 16px var(--font-body); border: 1.5px solid #cfd7e3; border-radius: 8px; background: #fff; }
.form-table input { width: 100%; min-width: 96px; min-height: 42px; padding: 7px 10px; font: 16px var(--font-body); border: 1.5px solid #cfd7e3; border-radius: 8px; background: #fff; }
.form-table input:focus { border-color: var(--primary); outline: none; }
.form-table td { vertical-align: top; }
.form h3 { margin: 6px 0 -6px; }
.pad-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 22px 20px; }
.status-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.status-line + .kpis { margin-bottom: 22px; }
.adjust-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.adjust-form input { min-height: 38px; padding: 4px 8px; font: 15px var(--font-body); border: 1.5px solid #cfd7e3; border-radius: 8px; width: 104px; }
.prompt-cell { max-width: 340px; overflow-wrap: anywhere; }

/* เมนูมีรายการเพิ่มขึ้น จึงเปลี่ยนเป็นปุ่มสามขีดเร็วขึ้นกว่าเดิม */
@media (max-width: 1180px) {
  .menu-toggle { display: block; }
  .main-nav { display: none; position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 8px 16px 20px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .menu-open .main-nav { display: flex; }
  .main-nav > a:not(.btn) { padding: 14px 8px; font-size: 19px; border-bottom: 1px solid var(--border); }
  .main-nav > a.active:not(.btn) { box-shadow: none; }
  .nav-sep { display: none; }
  .main-nav .btn { margin-top: 10px; }
  .main-nav > a.points-pill { justify-content: center; margin: 12px 0 0; padding: 10px; border-bottom: 0; font-size: 17px; border-radius: 10px; }
  .menu-open .menu-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
}
@media (max-width: 960px) {
  .studio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .form-table input { min-width: 0; }
  .form-table td[data-label] { flex-direction: column; text-align: left; }
}
@media (max-width: 600px) {
  .filter-row { flex-direction: column; gap: 6px; }
  .filter-label { flex: none; }
  .filter-row .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .filter-row .chip { white-space: nowrap; flex-shrink: 0; }
  .course-search { padding-left: 12px; }
  .course-search > svg { display: none; }
  .course-search input[type=search] { font-size: 16px; }
  .course-search .btn { padding: 8px 14px; }
  .job-grid, .studio-results-wide .job-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .job-body { padding: 10px 10px 0; }
  .job-actions { margin-left: -10px; margin-right: -10px; padding: 6px; }
  .job-prompt { font-size: 14px; }
  .job-actions .btn { padding: 6px 8px; }

  .job-audio { padding: 40px 10px 10px; }
  .job-voice-icon { width: 56px; height: 56px; }
  .job-play { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .balance b { font-size: 30px; }
}

/* ===== หน้าอ่านหนังสือ ===== */
.type-choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.is-reading .site-header { position: static; }
.reader { --paper: #fffdf8; --ink: #24292f; --reader-size: 20px; background: var(--bg); }
.reader[data-size="0"] { --reader-size: 16px; }
.reader[data-size="1"] { --reader-size: 18px; }
.reader[data-size="3"] { --reader-size: 23px; }
.reader[data-size="4"] { --reader-size: 27px; }

.reader-bar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--border); }
.standalone .reader-bar { padding-top: env(safe-area-inset-top); }
.reader-bar-inner { max-width: 1240px; margin: 0 auto; padding: 6px 20px; display: flex; align-items: center; gap: 12px; }
.reader-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--navy); font: 600 16px var(--font-head); text-decoration: none; cursor: pointer; }
.reader-tool:hover:not(:disabled) { background: var(--primary-soft); }
.reader-tool:disabled { opacity: .4; cursor: default; }
.reader-book { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 15px; }
.reader-size { display: flex; gap: 6px; flex-shrink: 0; }
.reader-progress { display: block; width: 100%; height: 3px; border: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.reader-progress::-webkit-progress-bar { background: transparent; }
.reader-progress::-webkit-progress-value { background: var(--accent); }
.reader-progress::-moz-progress-bar { background: var(--accent); }

.reader-grid { max-width: 1240px; margin: 0 auto; padding: 28px 20px 72px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
.reader-page { grid-column: 2; grid-row: 1; justify-self: center; width: 100%; max-width: 780px; padding: 40px 56px 44px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); }
.reader-page .crumbs { margin-bottom: 26px; font-size: 14px; }
.reader-kicker { margin: 0 0 4px; color: var(--muted); font-size: 15px; }
.reader-title { font-size: clamp(26px, 4vw, 34px); line-height: 1.4; margin-bottom: 24px; }
.reader-text { color: var(--ink); font-size: var(--reader-size); line-height: 1.95; overflow-wrap: break-word; }
.reader-text p { margin: 0 0 1.15em; }
.reader-text h3 { font-size: 1.25em; line-height: 1.5; margin: 1.7em 0 .6em; }
.reader-text > :first-child { margin-top: 0; }
.reader-text ul { margin: 0 0 1.15em; padding-left: 1.35em; }
.reader-text li { margin-bottom: .45em; }
.reader-text strong { font-weight: 600; color: var(--navy); }
.reader-text a { overflow-wrap: anywhere; }
.reader-page .lesson-block { margin-top: 32px; }

.reader-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.reader-nav a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-height: 64px; background: #fff; border: 1.5px solid var(--border); border-radius: 12px; color: var(--navy); text-decoration: none; }
.reader-nav a:hover { border-color: var(--primary); }
.reader-nav small { color: var(--muted); font-size: 14px; }
.reader-nav b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font: 600 16px/1.45 var(--font-head); }
.reader-nav .reader-next { grid-column: 2; text-align: right; border-color: var(--primary); background: var(--primary-soft); }
.reader-nav .reader-next:only-child { grid-column: 1 / -1; }

.reader-toc { grid-column: 1; grid-row: 1; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding: 16px 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.reader-toc-head { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 0 8px; margin-bottom: 6px; }
.reader-toc-head h2 { margin: 0; font-size: 18px; }
.reader-toc-close { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-right: -8px; border: 0; background: none; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.reader-toc-part { margin-bottom: 10px; }
.reader-toc-part > b { display: block; padding: 6px 8px; color: var(--muted); font-size: 14px; }
.reader-toc ul { list-style: none; margin: 0; padding: 0; }
.reader-toc a { display: flex; gap: 8px; min-height: 44px; padding: 9px 8px; border-radius: 8px; color: var(--text); font-size: 16px; line-height: 1.5; text-decoration: none; }
.reader-toc a:hover { background: var(--bg); }
.reader-toc a span { flex-shrink: 0; width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.reader-toc a[aria-current] { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.reader-toc a[aria-current] span { color: inherit; }
.reader-scrim { display: none; }
.reader-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40; margin: 0; padding: 8px 16px; border-radius: 99px; background: var(--navy); color: #fff; font-size: 15px; white-space: nowrap; transform: translateX(-50%); }

@media (min-width: 1025px) {
  .reader-bar [data-toc-open], .reader-toc-close { display: none; }
}
/* จอเล็ก: ตัวหนังสือเต็มจอ สารบัญเปิดเป็นแผงด้านข้าง (ถ้าปิด JavaScript สารบัญจะอยู่ท้ายบท) */
@media (max-width: 1024px) {
  .reader-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 0 48px; }
  .reader-page { grid-column: 1; max-width: 720px; border: 0; border-radius: 0; padding: 28px 24px 36px; }
  .reader-toc { grid-column: 1; grid-row: 2; position: static; max-height: none; margin: 16px; }
  .reader-js .reader-toc { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(86vw, 360px); margin: 0; padding-top: calc(12px + env(safe-area-inset-top)); border: 0; border-radius: 0; overscroll-behavior: contain; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; }
  .reader-js.toc-open .reader-toc { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .2s ease, visibility 0s; }
  .toc-open .reader-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 40, 71, .45); touch-action: none; }
}
@media (max-width: 600px) {
  .type-choice { grid-template-columns: minmax(0, 1fr); }
  .reader { --reader-size: 19px; }
  .reader[data-size="0"] { --reader-size: 15px; }
  .reader[data-size="1"] { --reader-size: 17px; }
  .reader[data-size="3"] { --reader-size: 22px; }
  .reader[data-size="4"] { --reader-size: 26px; }
  .reader-bar-inner { padding: 6px 12px; gap: 8px; }
  .reader-page { padding: 20px 16px 28px; }
  .reader-page .crumbs { margin-bottom: 16px; }
  .reader-title { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-js .reader-toc, .reader-js.toc-open .reader-toc { transition: none; }
}

/* ---------- แบบคลิปสำเร็จรูป ---------- */
.tpl-section { margin-bottom: 40px; }
.tpl-section > h2 { margin: 0 0 4px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 18px; }
.tpl-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; box-shadow: none; color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.tpl-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); color: var(--text); }
@media (prefers-reduced-motion: reduce) { .tpl-card { transition: none; } }
.tpl-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.tpl-card h3 { margin: 6px 0 0; font-size: 18px; line-height: 1.35; padding-right: 64px; }
.tpl-card p { margin: 0; flex: 1; color: var(--muted); font-size: 15px; line-height: 1.55; }
.tpl-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tpl-badge { position: absolute; top: 18px; right: 18px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: #7a5300; }
.tpl-badge-new { background: var(--green-soft); color: var(--green); }
.tpl-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.tpl-meta b { color: #7a5300; font-size: 15px; }
.tpl-meta span { display: inline-flex; align-items: center; gap: 5px; }
.tpl-free { border-style: dashed; background: transparent; box-shadow: none; }
.tpl-free .tpl-icon { background: #eef0f4; color: var(--navy); }
.studio-results-wide .job-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.tpl-wrap { max-width: 760px; }
.tpl-form { display: grid; gap: 16px; }
.tpl-step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 19px; }
.tpl-num { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 15px; }
.tpl-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tpl-step .opts + .opts { margin-top: 16px; }
.back-link { display: inline-block; margin-bottom: 6px; font-size: 15px; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.shot { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1.5px solid var(--border); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot-remove { display: grid; place-items: center; position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(15, 23, 42, .72); color: #fff; font-size: 19px; line-height: 1; cursor: pointer; }
.form .shot-add, .shot-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 8px; border-style: dashed; color: var(--primary); font-weight: 500; font-size: 14px; text-align: center; text-decoration: none; cursor: pointer; }
.shot-add:hover { border-color: var(--primary); background: var(--primary-soft); }
.shot-add.busy { opacity: .55; pointer-events: none; }
.shot-status { min-height: 1.5em; margin-top: 8px; color: var(--muted); }
.shot-status.shot-bad { color: var(--red); }

.tpl-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tpl-summary b { display: block; font-size: 26px; color: var(--navy); }
.page-head .back-link { color: rgba(255, 255, 255, .85); }
.page-head .back-link:hover { color: #fff; }
.login-history-title { margin-top: 28px; font-size: 19px; }

@media (prefers-reduced-motion: reduce) { .faq summary::after, .curriculum summary::after { transition: none; } }

/* ปุ่มเปิด/ปิดรายละเอียด: ลูกศรเส้นชุดเดียวกับทั้งเว็บ แทนสามเหลี่ยม ▶ ของเบราว์เซอร์ที่แต่ละเครื่องหน้าตาไม่เหมือนกัน
   ปิดอยู่ชี้ขวา เปิดแล้วชี้ลง */
.method-switch > summary, .chart-table > summary, .format-help > summary, .how-price > summary, .add-custom > summary, .act-pages > summary { display: flex; align-items: center; gap: 8px; list-style: none; }
.method-switch > summary::-webkit-details-marker, .chart-table > summary::-webkit-details-marker, .format-help > summary::-webkit-details-marker, .how-price > summary::-webkit-details-marker, .add-custom > summary::-webkit-details-marker, .act-pages > summary::-webkit-details-marker { display: none; }
.method-switch > summary::before, .chart-table > summary::before, .format-help > summary::before, .how-price > summary::before, .add-custom > summary::before, .act-pages > summary::before { content: ''; flex-shrink: 0; width: 7px; height: 7px; margin: 0 3px 0 1px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s ease; opacity: .75; }
.method-switch[open] > summary::before, .chart-table[open] > summary::before, .format-help[open] > summary::before, .how-price[open] > summary::before, .add-custom[open] > summary::before, .act-pages[open] > summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .method-switch > summary::before, .chart-table > summary::before, .format-help > summary::before, .how-price > summary::before, .add-custom > summary::before, .act-pages > summary::before { transition: none; } }

/* จอสัมผัส/มือถือ: เป้าแตะของป้ายแพลตฟอร์มและตัวอย่างคำสั่งสูงอย่างน้อย 32–36px นิ้วกดไม่พลาด */
@media (pointer: coarse), (max-width: 760px) {
  .platform-tags a { min-height: 34px; }
  .presets .chip { min-height: 36px; }
}

/* ===== หน้ารายละเอียดคอร์ส: คอร์สนี้สอนอะไร / เรียนจบทำอะไรได้ / ต้องเตรียมอะไร / กล่องชวนลองสร้างด้วย AI ===== */
.course-about p { margin: 0 0 14px; font-size: 18px; line-height: 1.75; color: #2c3546; }
.course-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; padding: 18px 0 0; border-top: 1px solid var(--border); }
.course-facts li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--bg); color: var(--navy); font-size: 15px; font-weight: 600; }
.course-facts svg { color: var(--primary); flex-shrink: 0; }
.outcomes { list-style: none; counter-reset: oc; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.outcomes li { counter-increment: oc; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--primary-soft); color: var(--navy); font-weight: 500; line-height: 1.55; }
.outcomes li::before { content: counter(oc); flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font: 700 15px var(--font-head); }
.course-fit { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.course-fit.single { grid-template-columns: 1fr; }
.checklist-plain svg { color: var(--primary); }
.studio-cta { position: relative; display: flex; gap: 22px; align-items: flex-start; overflow: hidden; border: 0; color: #fff; background: radial-gradient(520px 260px at 100% 0%, rgba(233, 161, 27, .28), transparent 70%), linear-gradient(135deg, var(--navy), var(--navy-2)); }
.studio-cta-icon { flex-shrink: 0; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: rgba(233, 161, 27, .16); color: #f5c158; }
.studio-cta-kicker { display: inline-block; margin-bottom: 6px; padding: 3px 12px; border-radius: 99px; background: rgba(255, 255, 255, .12); color: #f5c158; font-size: 14px; font-weight: 600; }
.studio-cta h2 { color: #fff; margin: 0 0 8px; }
.studio-cta p { margin: 0 0 14px; color: rgba(255, 255, 255, .88); line-height: 1.65; }
.studio-cta .small.muted { margin: 14px 0 0; color: rgba(255, 255, 255, .72); }
.studio-cta-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.studio-cta-list li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, .92); }
.studio-cta-list svg { flex-shrink: 0; color: #f5c158; }
.studio-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.studio-cta .btn-outline { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.studio-cta .btn-outline:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .08); }
.studio-hint { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid #f1d9a8; background: var(--accent-soft); }
.studio-hint-icon { flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: #a86f00; }
.studio-hint p { flex: 1; margin: 0; display: grid; gap: 2px; color: var(--navy); }
.studio-hint p span { color: var(--muted); font-size: 15px; }
@media (max-width: 760px) {
  .outcomes, .course-fit { grid-template-columns: 1fr; }
  .studio-cta { flex-direction: column; gap: 14px; padding: 24px 20px; }
  .studio-cta-actions .btn { flex: 1 1 100%; }
  .studio-hint { flex-wrap: wrap; }
  .studio-hint .btn { width: 100%; }
}

/* หน้าสร้างด้วย AI: ลิงก์ไปคอร์สสอนใช้งาน */
.studio-learn { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 14px; border-radius: 99px; background: rgba(233, 161, 27, .14); color: #f5c158; font-size: 15px; font-weight: 600; text-decoration: none; }
.studio-learn:hover { background: rgba(233, 161, 27, .24); color: #ffd98a; }
.studio-learn svg { flex-shrink: 0; }

/* ===== ชำระด้วยยอดเงินในบัญชี ===== */
.pay-opt-balance b { display: inline-flex; align-items: center; gap: 6px; }
.pay-opt-balance b svg { color: #a86f00; }
/* ยอดเงินไม่พอ: บอกด้วยพื้นเทาและวงกลมที่กดไม่ได้ ไม่ใช้ opacity (เคยทำให้ข้อความ "ขาดอีก ฿… · เติมเงิน" จางเหลือ 4.0:1) */
.pay-opt-balance.is-off { cursor: default; background: var(--bg); }
.pay-opt-off { flex-shrink: 0; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; border: 2px solid #c9d3e3; background: #eef1f6; }
.pay-opt-balance.is-off a { font-weight: 600; }
.pay-balance-card { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; border: 1px solid #f1d9a8; background: linear-gradient(135deg, var(--accent-soft), #fff 70%); }
.pbc-icon { flex-shrink: 0; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #fff; color: #a86f00; box-shadow: var(--shadow); }
.pbc-text { flex: 1; margin: 0; display: grid; gap: 2px; color: var(--navy); }
.pbc-text span { color: var(--muted); font-size: 15px; }
@media (max-width: 760px) {
  .pay-balance-card { flex-wrap: wrap; }
  .pay-balance-card .btn { width: 100%; }
}

/* ---------- เสียงของฉัน (โคลนเสียงตัวเอง) ---------- */
.voice-own-link { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; padding: 10px 14px; border: 1.5px dashed #b9c6db; border-radius: 12px; color: var(--primary); font-weight: 600; text-decoration: none; }
.voice-own-link:hover { border-color: var(--primary); background: var(--primary-soft); }
.voice-own-link span { flex: 1; }
.voice-page { display: grid; gap: 20px; max-width: 760px; }
.voice-page .card { padding: 22px; }
.voice-page h2 { margin: 0 0 12px; font-size: 20px; }
.voice-mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.voice-mine-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.voice-mine-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.voice-mine-text { flex: 1; min-width: 0; display: grid; }
.voice-mine-text b { overflow-wrap: anywhere; }
.voice-steps { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 6px; }
.voice-script { margin: 0 0 16px; padding: 18px 20px; border-left: 4px solid var(--primary); border-radius: 10px; background: var(--primary-soft); font-size: 19px; line-height: 1.8; color: var(--text); }
.voice-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.voice-rec p { flex-basis: 100%; margin: 0; }
.voice-rec audio { width: 100%; }
.voice-rec-time { font: 700 20px/1 var(--font-body); font-variant-numeric: tabular-nums; color: #c0392b; }
.voice-rec-time::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: currentColor; animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .voice-rec-time::before { animation: none; } }
.voice-create .check-row { margin: 6px 0 14px; }
@media (max-width: 560px) {
  .voice-page .card { padding: 16px; }
  .voice-mine-list li { flex-wrap: wrap; }
  .voice-script { font-size: 17px; padding: 14px 16px; }
}

/* รุ่นภาพที่เขียนตัวหนังสือไทยในภาพได้ */
.tier-thai { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #e7f6ec; color: #13703a; font: 600 12.5px/1.6 var(--font-body); vertical-align: 2px; white-space: nowrap; }

/* Cloudflare Turnstile (กล่องยืนยันว่าไม่ใช่บอท) จองความสูงไว้ก่อน หน้าจะได้ไม่กระโดดตอนกล่องโหลดเสร็จ */
.turnstile-box { min-height: 65px; }

/* ผู้ซื้อในหน้าสั่งซื้อ/เติมเงิน: ข้อมูลจากบัญชี แสดงบรรทัดเดียว เบอร์โทรกดเพิ่มเองได้ (ไม่บังคับ) */
.buyer-line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; margin: 0 0 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.buyer-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.buyer-who { display: grid; min-width: 0; line-height: 1.45; }
.buyer-who small { color: var(--muted); font-size: 13px; }
.buyer-who b { color: var(--navy); overflow-wrap: anywhere; }
.buyer-who .muted { font-size: 14px; overflow-wrap: anywhere; }
.buyer-phone { grid-column: 2; }
.buyer-phone summary { display: inline-block; list-style: none; color: var(--primary); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.buyer-phone summary::-webkit-details-marker { display: none; }
.buyer-phone[open] summary { margin-bottom: 6px; }
.buyer-phone label { margin: 0; }
.tp-step .buyer-line { margin: 14px 0 0; }

/* ===== หน้าสร้างงาน AI: โต๊ะทำงาน (ซ้าย) คู่กับเวที (ขวา) ผลงานเต็มความกว้างด้านล่าง =====
   เวที = ตัวอย่างงานในกรอบของแพลตฟอร์มตามขนาดที่เลือก + สรุปราคาและยอดเงินหลังสร้าง งานที่เพิ่งสั่งขึ้นบนเวทีก่อน */
.studio-form { counter-reset: studio-step; }
.studio-form .composer-head label, .studio-form > .opts > legend { font: 600 18px/1.45 var(--font-head); color: var(--navy); }
.studio-form .composer-head label::before, .studio-form > .opts > legend::before { counter-increment: studio-step; content: counter(studio-step); display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 10px; border-radius: 50%; background: var(--navy); color: #fff; font: 600 14px/1 var(--font-head); vertical-align: 2px; }
.studio-form > .opts > legend { margin-bottom: 12px; }
.studio-short { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; padding: 8px 8px 8px 14px; border: 1px solid #f1d9a8; border-radius: 12px; background: var(--accent-soft); color: #7a5300; font-size: 15px; line-height: 1.5; }
.studio-short[hidden] { display: none; }
.studio-short svg { flex-shrink: 0; }
.studio-short span { flex: 1; min-width: 0; }
.studio-grid + .studio-results { margin-top: 44px; }

.stage { position: sticky; top: 92px; display: grid; align-content: start; max-height: calc(100vh - 180px); overflow: hidden auto; overscroll-behavior: contain; border-radius: 20px; color: #e6edf6; background: radial-gradient(460px 280px at 50% -40px, rgba(247, 199, 102, .26), transparent 70%), linear-gradient(172deg, #1a4071 0%, #0f2847 58%, #0a1d38 100%); box-shadow: 0 18px 44px rgba(15, 40, 71, .2); scrollbar-width: thin; }
.stage [hidden] { display: none !important; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 18px 20px 0; }
.stage-title { color: #fff; font: 600 17px/1.4 var(--font-head); }
.stage-tabs { display: inline-flex; padding: 3px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
.stage-tabs button { min-height: 32px; padding: 2px 14px; border: 0; border-radius: 99px; background: transparent; color: #c3cfe0; font: 600 14px/1.4 var(--font-body); cursor: pointer; }
.stage-tabs button[aria-pressed="true"] { background: #fff; color: var(--navy); }
.stage-tabs button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.stage-result, .stage-preview { display: grid; }
.stage-floor { position: relative; display: grid; place-items: center; min-height: 380px; padding: 18px 20px 30px; }
.stage-floor::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: 12px; height: 16px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .4), transparent); pointer-events: none; }

/* กรอบงาน: ขนาดตามสัดส่วนที่เลือก ล้อมด้วยโครงหน้าจอของแพลตฟอร์มนั้น (แท่งสีเทา = ส่วนของแอป ไม่ใช่ของงาน) */
.stage-device { position: relative; z-index: 1; display: grid; width: var(--w, 190px); max-width: 100%; border-radius: 16px; overflow: hidden; background: #fff; color: var(--navy); box-shadow: 0 0 0 1px rgba(255, 255, 255, .55), 0 18px 40px rgba(0, 0, 0, .38), 0 0 70px rgba(247, 199, 102, .2); }
.stage-device[data-ratio="9:16"] { --w: 186px; --ar: 9 / 16; }
.stage-device[data-ratio="1:1"] { --w: 252px; --ar: 1; }
.stage-device[data-ratio="16:9"] { --w: 372px; --ar: 16 / 9; }
.stage-device[data-ratio="audio"] { --w: 372px; }
.stage-device.is-pop { animation: stage-pop .22s ease-out; }
@keyframes stage-pop { from { opacity: .35; transform: scale(.965); } }
.stage-frame { position: relative; display: grid; aspect-ratio: var(--ar, auto); min-width: 0; overflow: hidden; background: linear-gradient(160deg, #ffffff 0%, #e9effa 100%); }
.stage-post-head, .stage-post-foot { display: none; align-items: center; gap: 8px; padding: 9px 12px; }
.stage-post-head i { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: #d5deec; }
.stage-post-head span { flex: 1; display: grid; gap: 5px; }
.stage-post-head b { width: 46%; height: 7px; border-radius: 4px; background: #d5deec; }
.stage-post-head b + b { width: 28%; background: #e6ecf5; }
.stage-post-foot i { width: 18px; height: 18px; border-radius: 6px; background: #d5deec; }
.stage-post-foot i:last-child { margin-left: auto; }
.stage-device[data-ratio="1:1"] > .stage-post-head, .stage-device[data-ratio="1:1"] > .stage-post-foot { display: flex; }
.stage-device[data-ratio="16:9"] > .stage-post-head { display: flex; order: 2; }
.stage-side, .stage-lines, .stage-player { position: absolute; display: none; pointer-events: none; }
.stage-device[data-ratio="9:16"] .stage-side { display: grid; gap: 9px; right: 9px; bottom: 52px; }
.stage-side i { width: 22px; height: 22px; border-radius: 50%; background: rgba(15, 40, 71, .15); }
.stage-device[data-ratio="9:16"] .stage-lines { display: grid; gap: 6px; left: 12px; right: 46px; bottom: 16px; }
.stage-lines b { height: 7px; border-radius: 4px; background: rgba(15, 40, 71, .15); }
.stage-lines b + b { width: 60%; }
.stage-device[data-ratio="16:9"] .stage-player { display: flex; align-items: center; gap: 8px; left: 12px; right: 12px; bottom: 10px; }
.stage-player i { width: 0; height: 0; border-left: 9px solid rgba(15, 40, 71, .42); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.stage-player b { flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) 34%, rgba(15, 40, 71, .15) 34%); }
.stage-art { display: grid; align-content: center; justify-items: center; gap: 10px; min-width: 0; padding: 16px; text-align: center; }
.stage-device[data-ratio="9:16"] .stage-art { padding: 16px 36px 58px 14px; }
.stage-device[data-ratio="16:9"] .stage-art { padding-bottom: 30px; }
.stage-art-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.stage-echo { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; margin: 0; max-width: 100%; color: var(--navy); font: 500 14.5px/1.55 var(--font-body); overflow-wrap: anywhere; }
.stage-echo.is-empty { color: var(--muted); font-weight: 400; }
.stage-device[data-ratio="1:1"] .stage-echo { -webkit-line-clamp: 5; line-clamp: 5; }
.stage-device[data-ratio="16:9"] .stage-echo { -webkit-line-clamp: 3; line-clamp: 3; }

/* เสียง: คลื่นเสียง + บทพูดที่พิมพ์ + ความยาวโดยประมาณ */
.stage-device[data-ratio="audio"] .stage-frame { gap: 14px; align-content: start; padding: 22px 20px 18px; }
.stage-wave { display: block; width: 100%; height: 60px; fill: var(--primary); }
.stage-wave rect:nth-child(4n + 2) { fill: var(--accent); }
.stage-device[data-ratio="audio"] .stage-echo { font-size: 15px; }
.stage-length, .stage-voice { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 14.5px; }
.stage-length b, .stage-voice b { color: var(--navy); }
.stage-device[data-ratio="audio"] audio { width: 100%; }
.stage-where { margin: -4px 0 0; padding: 0 20px 16px; color: #c3cfe0; font-size: 14.5px; line-height: 1.5; text-align: center; }

/* งานล่าสุดบนเวที */
.stage-device[data-result]:not([data-ratio="audio"]) .stage-frame { background: #0b1b33; }
.stage-media { display: block; width: 100%; height: 100%; object-fit: contain; }
.stage-open { display: block; min-height: 0; }
.stage-open:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.stage-device[data-result] .job-state { align-self: center; }
.stage-device[data-result]:not([data-ratio="audio"]) .job-state { color: #e6edf6; }
.stage-device[data-result]:not([data-ratio="audio"]) .job-state small { color: #a9b8cc; }
.stage-device[data-result]:not([data-ratio="audio"]) .spinner { border-color: rgba(255, 255, 255, .22); border-top-color: #f7c766; }
.stage-result-info { display: grid; gap: 6px; padding: 0 20px 18px; }
.stage-result-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin: 0; color: #fff; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.stage-result-meta { display: flex; align-items: center; gap: 6px; margin: 0; color: #a9b8cc; font-size: 14px; }
.stage-result-meta svg { flex-shrink: 0; }
.stage-result-wait { margin: 2px 0 0; color: #c3cfe0; font-size: 14.5px; line-height: 1.55; }
.stage-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.stage .stage-ghost { color: #e6edf6; }
.stage .stage-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* สรุปราคา */
.stage-bill { display: grid; margin: 0; padding: 6px 20px 14px; border-top: 1px dashed rgba(255, 255, 255, .2); background: rgba(8, 22, 43, .38); }
.stage-bill > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0; }
.stage-bill > div + div { border-top: 1px solid rgba(255, 255, 255, .08); }
.stage-bill dt { flex-shrink: 0; color: #a9b8cc; font-size: 15px; }
.stage-bill dd { margin: 0; color: #fff; font-weight: 600; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stage-bill-after dd { color: #f7c766; font: 700 21px/1.3 var(--font-head); }
.stage-bill-after.is-short dd { color: #ffb9ad; font-size: 16px; }
.stage-bill-note dt { font-size: 14px; }

/* ผู้ที่ยังไม่เข้าสู่ระบบ: ขั้นตอนเรียงแนวนอนเมื่อผลงานอยู่เต็มความกว้าง */
.studio-results-wide .studio-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; }
.studio-results-wide .studio-steps li { border-bottom: 0; }
@media (max-width: 880px) {
  .studio-results-wide .studio-steps { grid-template-columns: minmax(0, 1fr); }
  .studio-results-wide .studio-steps li { border-bottom: 1px solid var(--border); }
}
/* จอเตี้ย: ย่อกรอบตัวอย่างให้เวทีทั้งแผงยังอยู่ในจอ */
@media (max-height: 780px) {
  .stage-floor { min-height: 318px; }
  .stage-device[data-ratio="9:16"] { --w: 150px; }
  .stage-device[data-ratio="1:1"] { --w: 200px; }
  .stage-device[data-ratio="16:9"] { --w: 330px; }
  .stage-device[data-ratio="9:16"] .stage-echo { -webkit-line-clamp: 4; line-clamp: 4; font-size: 13.5px; }
}
@media (max-height: 700px) {
  .stage-floor { min-height: 300px; }
  .stage-device[data-ratio="9:16"] { --w: 140px; }
  .stage-device[data-ratio="1:1"] { --w: 168px; }
  .stage-device[data-ratio="16:9"] { --w: 300px; }
  .stage-where { display: none; }
}
/* จอแคบ (ฟอร์มเต็มความกว้าง): ตัวอย่างไม่จำเป็น เหลือเฉพาะงานล่าสุดไว้บนสุดให้เห็นทันทีหลังกดสร้าง */
@media (max-width: 960px) {
  .stage { position: static; display: none; max-height: none; }
  .stage.has-result { display: grid; order: -1; }
  .stage.has-result .stage-preview, .stage.has-result .stage-bill, .stage.has-result .stage-tabs { display: none !important; }
  .stage.has-result .stage-result { display: grid !important; }
  .stage-floor { min-height: 0; padding: 16px 16px 28px; }
  .studio-grid + .studio-results { margin-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { .stage-device.is-pop { animation: none; } }
.stage-device[data-result]:not([data-ratio="audio"]) .job-timer { color: #f7c766; }
.stage.is-result .stage-bill { display: none; }

/* ===== คอร์สของฉัน (หน้าบัญชีลูกค้า) =====
   ลำดับบนหน้า: สิ่งที่ต้องทำต่อ (จ่ายเงินที่ค้าง เรียนต่อ) แล้วจึงคอร์สทั้งหมด คำสั่งซื้อ และความปลอดภัย */
.acc-head { padding: 36px 0 28px; }
.acc-top { display: flex; align-items: center; gap: 16px; }
.acc-avatar { flex-shrink: 0; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(145deg, #f7c766, #e9a11b); color: var(--navy); font: 700 26px/1 var(--font-head); box-shadow: 0 0 0 4px rgba(247, 199, 102, .18); }
.acc-id { flex: 1; min-width: 0; }
.acc-id h1 { margin: 0 0 2px; font-size: clamp(24px, 3vw, 32px); overflow-wrap: anywhere; }
.acc-id p { overflow-wrap: anywhere; }
.acc-stats { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 24px 0 0; padding: 0; }
.acc-stats li { display: grid; gap: 2px; align-content: center; padding: 14px 18px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; background: rgba(255, 255, 255, .06); }
.acc-stats li > span { color: #a9b8cc; font-size: 14.5px; }
.acc-stats b { color: #fff; font: 700 28px/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.acc-stats b small { color: #c3cfe0; font: 400 15px var(--font-body); }
.acc-stats .acc-stat-wallet { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
.acc-stat-wallet > span, .acc-stat-wallet > b { grid-column: 1; }
.acc-stat-wallet > b { color: #f7c766; }
.acc-stat-wallet .btn { grid-column: 2; grid-row: 1 / span 2; align-self: center; gap: 6px; }
.acc-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.acc-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 99px; color: #e6edf6; font-weight: 600; font-size: 15.5px; text-decoration: none; white-space: nowrap; }
.acc-nav a:hover { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .08); color: #fff; }
.acc-nav a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.acc-nav i { padding: 0 8px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-style: normal; font-size: 13.5px; font-weight: 600; }

.acc { display: grid; gap: 28px; min-width: 0; }
.acc > * { min-width: 0; }
.acc-block { scroll-margin-top: 96px; }
.acc-block + .acc-block { margin-top: 16px; }
.acc-block-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.acc-block-head h2 { margin: 0; font-size: 24px; }
.acc-block-head p { margin: 4px 0 0; max-width: 46em; }
.acc-block-link { font-weight: 600; }

/* สิ่งที่ต้องทำก่อน: คำสั่งซื้อที่รอชำระหรือรอตรวจ */
.acc-alerts { display: grid; gap: 10px; }
.acc-alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 18px; border: 1px solid #f1d9a8; border-radius: 14px; background: var(--accent-soft); }
.acc-alert.is-bad { border-color: #f3c6c1; background: var(--red-soft); }
.acc-alert.is-info { border-color: #c9d8f5; background: var(--primary-soft); }
.acc-alert-icon { flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; color: #a86f00; }
.acc-alert.is-bad .acc-alert-icon { color: var(--red); }
.acc-alert.is-info .acc-alert-icon { color: var(--primary); }
.acc-alert-text { flex: 1; min-width: 0; display: grid; line-height: 1.45; }
.acc-alert-text b { color: var(--navy); }
.acc-alert-text small { overflow: hidden; color: var(--muted); font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.acc-alert-more { margin: 0; }

/* เรียนต่อจากที่ค้างไว้ */
.acc-continue { display: grid; grid-template-columns: 240px minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 14px 22px 14px 14px; border-color: #c9d8f5; background: linear-gradient(100deg, var(--primary-soft), #fff 62%); color: inherit; text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.acc-continue:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.acc-continue:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.acc-continue-cover .cover { border-radius: 10px; }
.acc-cover-plain { align-items: center; justify-content: center; padding: 0; }
.acc-continue-body { display: grid; gap: 4px; min-width: 0; }
.acc-continue-body > small { color: var(--primary-dark); font-size: 14.5px; font-weight: 600; }
.acc-continue-body > b { color: var(--navy); font: 600 21px/1.35 var(--font-head); overflow-wrap: anywhere; }
.acc-continue-lesson { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); }
.acc-continue-lesson svg { flex-shrink: 0; color: var(--primary); }
.acc-continue-lesson span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-continue .acc-meter { max-width: 460px; margin-top: 6px; }
.acc-continue .btn { white-space: nowrap; }

/* แถบความคืบหน้า: บทที่เปิดดูแล้วจากทั้งหมด */
.acc-meter { display: grid; gap: 6px; }
.acc-meter progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 99px; background: #e3e7ee; -webkit-appearance: none; appearance: none; }
.acc-meter progress::-webkit-progress-bar { border-radius: 99px; background: #e3e7ee; }
.acc-meter progress::-webkit-progress-value { border-radius: 99px; background: var(--primary); }
.acc-meter progress::-moz-progress-bar { border-radius: 99px; background: var(--primary); }
.acc-meter.is-done progress::-webkit-progress-value { background: var(--green); }
.acc-meter.is-done progress::-moz-progress-bar { background: var(--green); }
.acc-meter span { color: var(--muted); font-size: 14.5px; line-height: 1.4; }

/* คอร์สที่ซื้อ: ปก ชื่อ ความคืบหน้า และปุ่มเข้าเรียน (ไม่มีข้อมูลการขายแล้ว เพราะซื้อไปแล้ว) */
.acc-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.acc-course { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s; }
.acc-course:hover { box-shadow: var(--shadow-lg); }
.acc-course-cover { display: block; }
.acc-course-body { flex: 1; display: grid; grid-template-rows: auto auto 1fr auto; gap: 10px; padding: 16px 18px 18px; }
.acc-course-kind { color: var(--muted); font-size: 14px; }
.acc-course h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin: 0; font-size: 18px; line-height: 1.4; }
.acc-course h3 a { color: var(--navy); text-decoration: none; }
.acc-course h3 a:hover { color: var(--primary); }
.acc-course .acc-meter { align-self: end; }
.app-promo.acc-app { margin: 20px 0 0; }

.acc-empty { display: grid; justify-items: center; gap: 6px; padding: 44px 24px; border-style: dashed; box-shadow: none; text-align: center; }
.acc-empty-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 6px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.acc-empty p { margin: 0; color: var(--navy); font: 600 19px/1.45 var(--font-head); }
.acc-empty small { color: var(--muted); font-size: 15px; }
.acc-empty .btn { margin-top: 14px; }
.acc-empty-sm { padding: 28px 24px; }

.acc-orders .nowrap { white-space: nowrap; }
.acc-orders td:nth-child(2) { min-width: 220px; }
.acc-order-act { text-align: right; white-space: nowrap; }

/* ส่วนที่พับไว้: คำสั่งซื้อเก่า และประวัติการเข้าสู่ระบบ */
.acc-fold { margin-top: 14px; }
.acc-fold summary::-webkit-details-marker { display: none; }
.acc-fold > summary { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 16px 8px 10px; border: 1px solid var(--border); border-radius: 99px; background: #fff; color: var(--navy); font-weight: 600; list-style: none; cursor: pointer; }
.acc-fold > summary:hover { border-color: #b9c6db; }
.acc-fold > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.acc-fold > summary svg { color: var(--muted); transition: transform .15s; }
.acc-fold[open] > summary svg { transform: rotate(180deg); }
.acc-fold > summary i { color: var(--muted); font-size: 14.5px; font-style: normal; font-weight: 400; }
.acc-fold > summary i.is-bad { color: var(--red); font-weight: 600; }
.acc-fold[open] > summary { margin-bottom: 12px; }
.acc-logins { margin-top: 18px; }

@media (max-width: 720px) {
  .acc-head { padding: 26px 0 22px; }
  .acc-top { flex-wrap: wrap; }
  .acc-avatar { width: 48px; height: 48px; font-size: 21px; }
  .acc-stats { grid-template-columns: 1fr 1fr; }
  .acc-stats b { font-size: 24px; }
  .acc-stats .acc-stat-wallet { grid-column: 1 / -1; }
  .acc-continue { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .acc-continue .btn { width: 100%; }
  .acc-alert { flex-wrap: wrap; }
  .acc-alert .btn { flex: 1 1 100%; }
  .acc-alert-text small { white-space: normal; }
  .acc-order-act { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .acc-fold > summary svg, .acc-continue, .acc-course { transition: none; } }
/* แถบใต้สรุป: ลิงก์ไปแต่ละส่วนของหน้า และปุ่มออกจากระบบชิดขวา (จอแคบปุ่มลงมาต่อท้ายลิงก์) */
.acc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 20px; }
.acc-bar .acc-nav { margin-top: 0; }
.acc-logout { min-height: 40px; padding: 6px 16px; border: 0; border-radius: 99px; background: transparent; color: #c3cfe0; font: 600 15.5px/1.4 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.acc-logout:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.acc-logout:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ช่องค้นหาคอร์ส: คอร์สที่ตรงระหว่างพิมพ์ (กล่องอยู่ใต้ body เพราะส่วนหัวหน้าแรกตัดของที่ล้นออก ตำแหน่งตั้งจาก public/app.js) */
.search-suggest { position: absolute; z-index: 45; display: grid; gap: 2px; padding: 6px; background: #fff; border: 1px solid #d6deea; border-radius: 14px; box-shadow: 0 18px 44px rgba(9, 30, 63, .24); max-height: min(70vh, 470px); overflow-y: auto; text-align: left; color: var(--text); }
.search-suggest[hidden] { display: none; }
.search-suggest-head { margin: 0; padding: 8px 12px 2px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.search-suggest-head b { color: var(--navy); }
.search-suggest-item { display: grid; gap: 1px; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.search-suggest-item b { font-weight: 600; font-size: 16px; line-height: 1.4; }
.search-suggest-item small { color: var(--muted); font-size: 13.5px; }
.search-suggest-all { padding: 10px 12px; border-radius: 10px; color: var(--primary); font-weight: 600; font-size: 15px; text-decoration: none; }
.search-suggest-item:hover, .search-suggest-all:hover, .search-suggest .is-active { background: var(--primary-soft); }
.search-suggest .is-active { box-shadow: inset 3px 0 0 var(--primary); }
.search-suggest-terms { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 8px; }
.search-suggest-terms a { padding: 5px 14px; border-radius: 99px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 15px; text-decoration: none; }
.search-suggest-terms a:hover, .search-suggest-terms a.is-active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.result-fixed { font-weight: 400; color: var(--muted); }
.empty-hints { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 4px; }
.empty-hints span { width: 100%; color: var(--muted); font-size: 15px; }
.empty-hints .chip { padding: 6px 16px; font-size: 15.5px; }
.recommend-head { margin: 34px 0 16px; font-size: 22px; }

/* โซเชียลของร้าน (ตั้งที่ หลังร้าน > ตั้งค่าเว็บ > ติดต่อและบริษัท) */
.social-links { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; }
.social-links a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 1px solid var(--border); transition: transform .15s, box-shadow .15s; }
.social-links a:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(9, 30, 63, .16); }
.footer-social { margin-top: 16px; gap: 6px; }
.footer-social a { width: 34px; height: 34px; border-radius: 10px; border-color: transparent; }
.footer-social svg { width: 18px; height: 18px; }
.contact-social { justify-content: flex-start; margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .social-links a { transition: none; } }

/* ===== KRUCLIP: พรีเมียมน้ำเงินเข้ม-ทอง =====
   หัวเว็บพื้นเข้มให้โลโก้ทอง/เงินเด่นและต่อเนื่องกับ hero · ปุ่มหลักทอง · พื้นที่อ่าน (บทเรียน ฟอร์ม ชำระเงิน) ยังสว่าง
   คอนทราสต์ที่ใช้: ลิงก์หัวเว็บ #dbe4f0 บน #0a1c33 = 13.3:1 · ทองอ่อนบนพื้นเข้ม 10.9:1 · กรมท่าบนปุ่มทอง 6.8:1 */
.site-header, .hero, .page-head, .course-hero, .site-footer, .ai-band { --focus: var(--gold-light); }
.site-header { background: var(--navy-deep); border-bottom-color: rgba(255, 255, 255, .08); }
.site-header .logo { color: #fff; }
.main-nav > a:not(.btn) { color: #dbe4f0; }
.main-nav > a:not(.btn):hover, .main-nav > a.active:not(.btn) { color: var(--gold-light); }
.main-nav > a.active:not(.btn) { box-shadow: inset 0 -2px 0 var(--gold); }
.nav-sep { background: rgba(255, 255, 255, .14); }
.menu-toggle span { background: #fff; }
.site-header .app-back { color: #fff; }
.site-header .app-back:hover { background: rgba(255, 255, 255, .08); }
.site-header .btn-ghost { color: #fff; }
.site-header .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.site-header .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.site-header .btn-outline:hover, .site-header .btn-outline.active { border-color: var(--gold-light); color: var(--gold-light); }
/* ยอดเงินในหัวเว็บพื้นเข้ม: ทองอ่อนบนพื้นเข้มอมทอง 8.1:1 (พื้นครีมเดิมกับตัวหนังสือสีอ่อนของเมนู = 1.2:1 อ่านไม่ออก) */
.main-nav > a.points-pill { background: rgba(245, 200, 104, .14); color: var(--gold-light); border: 1px solid rgba(245, 200, 104, .4); }
.main-nav > a.points-pill:hover, .main-nav > a.points-pill.active { background: rgba(245, 200, 104, .22); color: var(--gold-light); box-shadow: none; }
@media (max-width: 1180px) {
  .main-nav { background: var(--navy-deep); border-bottom-color: rgba(255, 255, 255, .08); box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
  .main-nav > a:not(.btn) { border-bottom-color: rgba(255, 255, 255, .08); }
}
/* ปุ่มหลักที่กดไม่ได้ (เช่น "ยังสร้างภาพไม่ได้ในขณะนี้"): พื้นเทา ตัวหนังสือเข้ม 6.4:1 แทนการทำให้จาง ข้อความยังอ่านออก
   (ปุ่มที่กำลังส่งข้อมูล .is-busy ยังเป็นสีทองพร้อมวงหมุนตามเดิม) */
.btn-primary:disabled:not(.is-busy) { opacity: 1; background: #e9edf3; color: #4a5568; cursor: not-allowed; }
