/* AIDailyTH · หน้าคอร์สเสียเงิน (หน้าขาย + หน้าเรียน) · โหลดต่อจาก site.css · ใช้โทเคนชุด B (dark) */

/* ---------- หน้าขาย ---------- */
.buy-note { margin: var(--s4) 0 0; font-size: 15px; color: var(--faint); max-width: 36em; }

/* กล่องสถานะสมาชิก (course.js เติม: none / login / paid) */
.member-box { margin: var(--s5) 0 0; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4) var(--s5); font-size: 15px; line-height: 1.65; }
.member-box b { font-family: var(--font-head); font-weight: 700; }
.member-box .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: var(--s3); align-items: center; }
.member-box code { font-family: var(--font-mono); background: rgb(var(--ink-rgb) / .07); color: var(--text); padding: 2px 8px; border-radius: 6px; font-size: 14px; overflow-wrap: anywhere; }
.member-box.paid { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(255, 225, 26, .06), transparent 70%), var(--surface); }
.dl { display: flex; gap: 10px; flex-wrap: wrap; margin-top: var(--s3); }
.dl .btn { white-space: normal; text-align: left; }

/* แถบข้อเท็จจริง */
.facts { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin: calc(var(--s7) * -1) 0 0; position: relative; }
.facts li { padding: var(--s5); }
.facts li + li { border-left: 1px solid var(--line); }
.facts b { display: block; font: 700 20px/1.3 var(--font-head); }
.facts span { font-size: 15px; }

/* หน้าเปลี่ยน / หน้าเดิม */
.ba { display: grid; gap: var(--s4); }
.ba-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6); align-items: center; padding: var(--s5); }
.ba-row .label h3 { font-size: 24px; margin-top: var(--s3); }
.ba-row .label p { margin: var(--s2) 0 0; font-size: 15px; }
.ba-row .shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.ba-row .shots figure { margin: 0; position: relative; }
.ba-row .shots img { width: 100%; aspect-ratio: 360 / 432; object-fit: cover; border-radius: var(--r-in); }
.ba-row .shots figcaption { position: absolute; left: var(--s2); top: var(--s2); font-size: 12px; line-height: 1; padding: 6px var(--s2); border-radius: 999px; background: rgb(var(--bg-rgb) / .75); color: var(--text); }
.ba-row.bad .shots img { filter: saturate(.55) brightness(.8); }
.ba-row.good { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(255, 225, 26, .05), transparent 60%), var(--surface); }
.tag-bad, .tag-good { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1; padding: 6px var(--s2); border-radius: 999px; border: 1px solid var(--line-strong); }
.tag-good { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }

/* คลิปตัวอย่าง */
.demo { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--s8); align-items: center; }
.demo video { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line-strong); background: #000; box-shadow: var(--shadow); display: block; }
.demo .sec-head { margin-bottom: var(--s5); }
.cmd { padding: var(--s5); }
.checks { list-style: none; padding: 0; display: grid; gap: var(--s3); margin: var(--s5) 0 0; }
.checks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--s2); }
.checks li::before { content: "✓"; color: var(--accent-text); font-family: var(--font-head); }
.checks.no li::before { content: "✕"; color: var(--faint); }

/* Terminal */
.term { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s7); align-items: center; padding: var(--s7); }
.term h2 { font-size: 30px; }
.term ol { list-style: none; counter-reset: t; display: grid; gap: var(--s4); margin: var(--s5) 0 0; padding: 0; }
.term ol li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--s3); }
.term ol li::before { counter-increment: t; content: counter(t); font: 700 15px/1.75 var(--font-head); color: var(--accent); }
.term ol li p { margin: 0; }
.term ol b { display: block; }
.chat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); }
.chat .lbl { display: block; font: 400 12px/1 var(--font-mono); color: var(--faint); margin: var(--s4) 0 var(--s2); }
.chat .dots + .lbl { margin-top: 0; }
.chat .you { margin: 0; padding: var(--s3) var(--s4); border-radius: var(--r-in); background: var(--surface-2); color: var(--text); font-size: 15px; }
.chat .ai { margin: 0; padding: var(--s3) var(--s4); border-radius: var(--r-in); border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font-size: 15px; }

/* เหมาะกับใคร */
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.fit > div { padding: var(--s6); }
.fit h3 { font-size: 20px; }
.fit .yes { border-color: var(--accent-line); }

/* สิ่งที่ได้ */
.get { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); }
.get > div { padding: var(--s6); }
.get .num { font: 700 15px/1 var(--font-head); color: var(--accent-text); }
.get h3 { font-size: 20px; margin: var(--s4) 0 var(--s2); }
.get p { margin: 0; font-size: 15px; }

/* บทเรียน */
.syllabus { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5); align-items: start; }
.syl { padding: var(--s5) var(--s6); }
.syl h3 { font: 400 13px/1 var(--font-body); letter-spacing: .08em; color: var(--faint); margin: 0 0 var(--s3); }
.syl h3 + ul { margin-top: 0; }
.syl ul + h3 { margin-top: var(--s5); }
.syl ul { list-style: none; margin: 0; padding: 0; }
.syl li { display: flex; gap: var(--s3); align-items: baseline; padding: var(--s3) 0; border-top: 1px solid var(--line); color: var(--text); font-size: 15px; line-height: 1.55; }
.syl li:first-child { border-top: 0; }
.syl .no { flex: 0 0 64px; font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.syl .free { margin-left: auto; flex: none; font-size: 12px; color: var(--accent-text); border: 1px solid var(--accent-line); border-radius: 999px; padding: 0 var(--s2); }

/* กล่องราคา + วิธีสั่งซื้อ */
.offer { display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border-color: var(--accent-line); }
.offer .inc { padding: var(--s7); display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: var(--s6); align-content: start; }
.offer-cover { width: 168px; border-radius: 3px 8px 8px 3px; transform: rotate(-3deg); box-shadow: var(--shadow); }
.offer .inc h2 { font-size: 28px; margin: 0 0 var(--s4); }
.offer .pay { padding: var(--s7); background: linear-gradient(160deg, rgba(255, 225, 26, .09), transparent 55%), var(--surface-2); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.offer .pay .price-row { margin-top: 0; }
.offer .pay .price-now { font-size: 64px; margin-top: var(--s3); }
.offer .pay .btn { margin-top: var(--s6); min-height: 60px; font-size: 19px; width: 100%; }
.offer .pay .buy-note { margin-top: var(--s3); }
.howbuy { margin-top: auto; padding-top: var(--s6); }
.howbuy h3 { font: 400 13px/1 var(--font-body); letter-spacing: .08em; color: var(--faint); margin: 0 0 var(--s3); }
.howbuy ol { list-style: none; display: grid; gap: var(--s3); counter-reset: b; margin: 0; padding: 0; }
.howbuy li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s2); font-size: 15px; line-height: 1.6; }
.howbuy li::before { counter-increment: b; content: counter(b); display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 1px solid var(--line-strong); font: 700 12px/1 var(--font-head); color: var(--text); }

/* FAQ */
.c-faq { max-width: 860px; margin: 0 auto; }
.c-faq details { border-bottom: 1px solid var(--line); }
.c-faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s5) 0; font: 700 20px/1.5 var(--font-head); color: var(--text); }
.c-faq summary::-webkit-details-marker { display: none; }
.c-faq summary::after { content: "+"; flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); font: 400 18px/1 var(--font-body); color: var(--muted); }
.c-faq details[open] summary::after { content: "−"; color: var(--accent-text); border-color: var(--accent-line); }
.c-faq details p { margin: 0; padding: 0 var(--s7) var(--s5) 0; }

/* ปิดท้าย */
.final { text-align: center; padding: var(--s8) var(--s6); position: relative; overflow: hidden; }
.final::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 260px at 50% 0%, rgba(255, 225, 26, .14), transparent 70%); pointer-events: none; }
.final > * { position: relative; }
.final h2 { font-size: clamp(28px, 3.2vw, 40px); }
.final .price-row, .final .cta-row { justify-content: center; }
.final .buy-note { margin-left: auto; margin-right: auto; }
.c-page .site-foot { margin-top: var(--s9); }

/* แถบซื้อติดล่าง (มือถือ) */
.buybar { display: none; }

/* ---------- หน้าเรียน ---------- */
.learn { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: var(--s6); padding-top: var(--s6); padding-bottom: var(--s8); align-items: start; }
.learn > * { min-width: 0; }
.learn-nav { position: sticky; top: 80px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); max-height: calc(100vh - 96px); overflow: auto; }
.learn-nav h2 { font-size: 16px; line-height: 1.45; margin: 0 0 var(--s2); }
.learn-nav .part { font-size: 12px; letter-spacing: .06em; color: var(--faint); margin: var(--s3) 0 var(--s1); }
.learn-nav a { display: flex; gap: var(--s2); align-items: flex-start; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.learn-nav a:hover { background: rgb(var(--ink-rgb) / .04); color: var(--text); }
.learn-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.learn-nav a .lk { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.learn aside .dl { margin-top: var(--s3); }
.lesson { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s7) var(--s7); min-height: 60vh; color: var(--ink-2); }
.lesson h1 { font-size: clamp(26px, 3.2vw, 36px); margin: 0 0 var(--s5); line-height: 1.3; }
.lesson h2 { font-size: 23px; margin: var(--s7) 0 var(--s3); }
.lesson h3 { font-size: 19px; margin: var(--s5) 0 var(--s2); }
.lesson p, .lesson li { font-size: 17px; line-height: 1.85; overflow-wrap: anywhere; }
.lesson p { margin: 0 0 var(--s4); }
.lesson ul, .lesson ol { padding-left: 24px; margin: 0 0 var(--s4); }
.lesson li { margin-bottom: var(--s1); }
.lesson a { color: var(--text); }
.lesson .tbl { overflow-x: auto; margin: var(--s3) 0 var(--s5); border: 1px solid var(--line); border-radius: var(--r-in); }
.lesson table { border-collapse: collapse; width: 100%; font-size: 15px; }
.lesson th { background: var(--surface-3); color: var(--text); text-align: left; padding: 9px 12px; font-family: var(--font-head); font-weight: 700; }
.lesson td { border-top: 1px solid var(--line); padding: 9px 12px; vertical-align: top; }
.lesson pre { white-space: pre-wrap; word-break: break-word; background: #070a11; color: #e3e8f4; border: 1px solid var(--line); border-radius: var(--r-in); padding: 14px var(--s4); overflow-x: auto; font-size: 14.5px; line-height: 1.65; margin: 0 0 var(--s4); }
.lesson code { font-family: var(--font-mono); font-size: .9em; }
.lesson :not(pre) > code { background: rgba(255, 255, 255, .07); color: var(--text); padding: 1px 6px; border-radius: 5px; }
.lesson blockquote { margin: var(--s4) 0; padding: var(--s3) var(--s4); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-in) var(--r-in) 0; color: var(--ink-2); }
.lesson blockquote p:last-child { margin-bottom: 0; }
.lesson blockquote.warn { border-color: var(--danger); background: var(--danger-soft); max-width: none; box-shadow: none; }
.lesson hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }
.lesson img { border-radius: var(--r-in); }
/* ภาพประกอบบทเรียน (หน้าจอจริง / เฟรมจากคลิป) · build ใส่ <figure class="shot"> */
.lesson figure.shot { margin: var(--s4) 0 var(--s5); }
.lesson figure.shot img { display: block; max-width: 100%; max-height: 85vh; width: auto; height: auto; border: 1px solid var(--line); background: #070a11; }
.lesson figure.shot figcaption { margin-top: var(--s2); font-size: 14px; line-height: 1.6; color: var(--faint); }
.lesson blockquote figure.shot { margin-bottom: 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); flex-wrap: wrap; }
.lesson-nav .btn { white-space: normal; text-align: left; line-height: 1.4; padding-top: 8px; padding-bottom: 8px; max-width: 100%; }
.locked { text-align: center; padding: var(--s7) var(--s3); }
.locked .ic { font-size: 0; width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-line); position: relative; }
.locked .ic::after { content: ""; position: absolute; inset: 0; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1.5A1.5 1.5 0 0 1 20 11.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 20.5v-9A1.5 1.5 0 0 1 5.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z'/%3E%3C/svg%3E") center / 24px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1.5A1.5 1.5 0 0 1 20 11.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 20.5v-9A1.5 1.5 0 0 1 5.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z'/%3E%3C/svg%3E") center / 24px no-repeat; }
.locked h2 { margin: var(--s4) 0 var(--s2); font-size: 26px; }
.locked p { max-width: 520px; margin: 0 auto var(--s5); }
.locked .buy { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: center; align-items: center; }

/* ---------- จอเล็ก ---------- */
@media (max-width: 960px) {
  .learn { grid-template-columns: 1fr; padding-top: var(--s5); }
  .learn > aside { order: 2; }
  .learn-nav { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .facts { grid-template-columns: 1fr 1fr; margin-top: calc(var(--s6) * -1); }
  .facts li { padding: var(--s4); }
  .facts li:nth-child(3) { border-left: 0; }
  .facts li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .facts b { font-size: 17px; }
  .facts span { font-size: 13px; line-height: 1.6; display: block; }
  .ba-row { grid-template-columns: 1fr; gap: var(--s4); padding: var(--s4); }
  .ba-row .shots { gap: var(--s2); }
  .ba-row .shots figcaption { font-size: 11px; padding: 4px 6px; left: 6px; top: 6px; }
  .demo { grid-template-columns: 1fr; gap: var(--s6); }
  .demo > div { order: -1; }
  .demo video { max-width: 280px; margin: 0 auto; }
  .term { grid-template-columns: 1fr; padding: var(--s5); gap: var(--s6); }
  .term h2 { font-size: 26px; }
  .fit, .get, .syllabus { grid-template-columns: 1fr; gap: var(--s4); }
  .fit > div, .get > div { padding: var(--s5); }
  .syl { padding: var(--s4) var(--s5); }
  .syl .no { flex-basis: 56px; }
  .offer { grid-template-columns: 1fr; }
  .offer .inc, .offer .pay { padding: var(--s5); }
  .offer .inc { grid-template-columns: 1fr; gap: var(--s4); }
  .offer-cover { width: 96px; }
  .offer .inc h2 { font-size: 22px; }
  .offer .pay { border-left: 0; border-top: 1px solid var(--line); }
  .offer .pay .price-now { font-size: 52px; }
  .c-faq summary { font-size: 17px; }
  .c-faq details p { padding-right: 0; }
  .final { padding: var(--s7) var(--s5); }
  .lesson { padding: var(--s5) var(--s4); }
  .lesson p, .lesson li { font-size: 16px; }
  .lesson h2 { font-size: 21px; }
  .lesson table { font-size: 14px; }
  .lesson th, .lesson td { padding: 7px 8px; }
  .lesson pre { font-size: 13.5px; padding: var(--s3); }

  body.has-buybar { padding-bottom: 84px; }
  .buybar {
    display: flex; align-items: center; gap: var(--s3); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
    background: rgb(var(--bg-rgb) / .95); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-strong); transition: transform .25s;
  }
  .buybar.off { transform: translateY(110%); }
  .buybar .p { line-height: 1.25; }
  .buybar .p b { display: block; font: 700 20px/1.2 var(--font-head); }
  .buybar .p s { font-size: 12px; color: var(--faint); }
  .buybar .btn { margin-left: auto; min-height: 48px; }
  body.has-buybar .toast { bottom: 96px; }
}

/* ---------- ความคืบหน้าบทเรียน (เครื่องหมายถูกในสารบัญ · บันทึกใน /api/me/read) ---------- */
.learn-nav a .ck { flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font: 700 10px/1 var(--font-head); color: transparent; }
.learn-nav a.opened .ck { border-color: var(--accent-line); }
.learn-nav a.done .ck { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.learn-nav a.done > span:nth-child(2) { color: var(--faint); }
.learn-nav a.done[aria-current="page"] > span:nth-child(2) { color: var(--text); }
.learn-prog { display: grid; gap: 6px; margin: 0 0 var(--s3); font-size: 13px; color: var(--muted); }
.learn-prog .bar { height: 6px; border-radius: 999px; background: rgb(var(--ink-rgb) / .08); overflow: hidden; }
.learn-prog .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; width: 0; transition: width .3s; }
.learn-prog b { font-family: var(--font-head); font-weight: 700; }
.lesson-done { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s5); font-size: 14px; color: var(--accent-text); }

/* motion-graphic · hero = หนังสือ 3D (ภาพ render จาก Three.js · พื้นโปร่งใส) */
.c-hero .mg-stage { height: auto; max-width: 540px; aspect-ratio: 858 / 774; }
.c-hero .mg-stage .mg-mock { position: relative; width: 100%; height: auto; filter: drop-shadow(0 30px 50px rgba(0, 0, 0, .35)); }
.c-hero .mg-stage::before { content: ""; position: absolute; inset: 8% 10% 14%; background: radial-gradient(closest-side, rgba(230, 176, 74, .22), transparent); pointer-events: none; }
.mg-variety { margin: var(--s6) auto 0; max-width: 820px; }
.mg-variety img { width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--line); }
.mg-variety figcaption { margin-top: var(--s2); font-size: 14px; color: var(--faint); text-align: center; }
@media (max-width: 760px) { .c-hero .mg-stage { height: auto; max-width: 358px; } }
/* ชำระเงิน Stripe (course.js · PAY_MODE) */
.chat-alt { display: inline-block; margin-top: var(--s3); font-size: 14px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.chat-alt:hover { color: var(--text); }
.pay-msg { margin: var(--s2) 0 0; font-size: 14px; color: var(--muted); max-width: 36em; }
.pay-msg.ok { color: var(--ok); }
.pay-msg.wait { color: var(--accent-text); }
.pay-msg.err { color: var(--danger); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* ---------- สถานะหลังจ่าย (หน้าเรียน ?paid=1) · การ์ดใหญ่ มีไอคอน + ปุ่มไปต่อ ---------- */
.pay-status { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--s4); align-items: start; margin-top: var(--s5); padding: var(--s5) var(--s6);
  border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); }
.pay-status .ps-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; position: relative; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.pay-status .ps-ic::after { content: ""; width: 26px; height: 26px; background: var(--accent);
  -webkit-mask: var(--ps-mask) center / contain no-repeat; mask: var(--ps-mask) center / contain no-repeat; }
.pay-status b { display: block; font: 700 22px/1.35 var(--font-head); color: var(--text); }
.pay-status p { margin: var(--s1) 0 0; font-size: 15.5px; line-height: 1.65; }
.pay-status .ps-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.pay-status.ok { --ps-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.2 16.6 4.6 12l-1.4 1.4 6 6L21 7.6l-1.4-1.4z'/%3E%3C/svg%3E");
  border-color: rgba(95, 211, 154, .5); background: radial-gradient(500px 200px at 0% 0%, rgba(95, 211, 154, .12), transparent 70%), var(--surface); }
.pay-status.ok .ps-ic { background: rgba(95, 211, 154, .12); border-color: rgba(95, 211, 154, .5); }
.pay-status.ok .ps-ic::after { background: var(--ok); }
.pay-status.wait { --ps-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 3v6l5 3 1-1.7-4-2.3V7z'/%3E%3C/svg%3E"); border-color: var(--accent-line); }
.pay-status.spin .ps-ic { background: transparent; border: 3px solid rgba(255, 225, 26, .18); border-top-color: var(--accent); animation: ps-spin 1s linear infinite; }
.pay-status.spin .ps-ic::after { display: none; }
@keyframes ps-spin { to { transform: rotate(360deg); } }
.pay-status.err { --ps-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 21h22L12 2zm-1 7h2v6h-2V9zm0 8h2v2h-2v-2z'/%3E%3C/svg%3E"); border-color: rgba(255, 122, 110, .5); }
.pay-status.err .ps-ic { background: var(--danger-soft); border-color: rgba(255, 122, 110, .5); }
.pay-status.err .ps-ic::after { background: var(--danger); }
@media (max-width: 760px) {
  .pay-status { grid-template-columns: 1fr; padding: var(--s5); gap: var(--s3); }
  .pay-status b { font-size: 19px; }
  .pay-status .ps-row .btn { flex: 1 1 100%; }
}

/* ฉากคั่นตอนพาไป Stripe (ลอยทับทั้งจอ) */
.pay-go { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: var(--s5); background: rgba(6, 9, 16, .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pg-card { max-width: 420px; text-align: center; padding: var(--s7) var(--s6); border-radius: 20px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.pg-spin { display: block; width: 44px; height: 44px; margin: 0 auto var(--s4); border-radius: 50%; border: 3px solid rgba(255, 225, 26, .18); border-top-color: var(--accent); animation: ps-spin 1s linear infinite; }
.pg-card b { display: block; font: 700 21px/1.4 var(--font-head); color: var(--text); }
.pg-card p { margin: var(--s2) 0 0; font-size: 15px; }
.pg-safe { display: inline-block; margin-top: var(--s4); font-size: 13px; color: var(--faint); }

/* การ์ดลอยหลังยกเลิกจ่าย (หน้าขาย ?canceled=1) */
.pay-float { position: fixed; z-index: 120; right: 24px; top: 88px; width: min(380px, calc(100vw - 32px)); padding: var(--s5); border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--accent-line); box-shadow: 0 30px 60px -20px rgb(var(--shadow-rgb) / .18); animation: pf-in .3s ease-out; }
.pay-float b { display: block; font: 700 18px/1.4 var(--font-head); color: var(--text); padding-right: 28px; }
.pay-float p { margin: var(--s1) 0 0; font-size: 14.5px; line-height: 1.6; }
.pay-float .pf-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); }
.pf-x { position: absolute; right: 10px; top: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.pf-x:hover { background: rgb(var(--ink-rgb) / .06); color: var(--text); }
@keyframes pf-in { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 760px) { .pay-float { left: 16px; right: 16px; top: auto; bottom: 96px; width: auto; } }

/* ---------- แผงเริ่มตรงนี้ + คำสั่งติดตั้งบรรทัดเดียว (หน้าเรียน) ---------- */
.start { margin-top: var(--s5); border-radius: 20px; border: 1px solid var(--accent-line); overflow: hidden;
  background: radial-gradient(600px 260px at 100% 0%, rgba(47, 107, 255, .14), transparent 70%), var(--surface); box-shadow: var(--shadow); }
.start summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px var(--s4); align-items: center; padding: var(--s5) var(--s6); }
.start summary::-webkit-details-marker { display: none; }
.start summary::after { content: ""; grid-column: 3; grid-row: 1 / span 2; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.start details[open] summary::after { transform: rotate(-135deg); }
.start summary b { grid-column: 2; font: 700 22px/1.35 var(--font-head); color: var(--text); }
.start .st-t { grid-column: 2; font-size: 14.5px; color: var(--muted); }
.start .st-k { grid-column: 1; grid-row: 1 / span 2; align-self: center; font: 700 13px/1 var(--font-head); color: #0a0e17; background: var(--accent); border: 2px solid #0a0e17; box-shadow: 0 0 0 2px #f3f5fa; border-radius: 8px; padding: 7px 10px; transform: rotate(-3deg); white-space: nowrap; }
.st-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s6); padding: 0 var(--s6) var(--s6); }
.st-side { padding: var(--s5); border-radius: var(--r); border: 1px dashed var(--line-strong); align-self: start; }
.st-side h3 { font-size: 17px; }
.st-side ol { margin: var(--s3) 0 0; padding-left: 20px; display: grid; gap: var(--s3); font-size: 15px; line-height: 1.65; }
.st-side code { font-family: var(--font-body); color: var(--text); background: rgb(var(--ink-rgb) / .07); padding: 1px 6px; border-radius: 5px; }
.st-side a { color: var(--accent-text); }

.install-box { background: #0b101c; border: 1px solid var(--line-strong); border-radius: var(--r); padding: var(--s5); }
.lesson .install-box { margin: 0 0 var(--s5); }
.ib-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.install-box h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.ib-tabs { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgb(var(--ink-rgb) / .03); }
.ib-tabs button { font: 700 13.5px/1 var(--font-head); padding: 8px 16px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.ib-tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.ib-steps { margin: var(--s4) 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.ib-cmdwrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: stretch; margin-top: var(--s4); }
.install-box pre.ib-cmd { margin: 0; white-space: pre-wrap; word-break: break-all; background: #05070d; color: var(--accent); border: 1px solid rgba(255, 225, 26, .3);
  border-radius: var(--r-in); padding: 14px 16px; font: 14px/1.6 var(--font-mono); display: flex; align-items: center; }
.ib-copy { min-height: 52px; padding: 0 22px; }
.ib-copy.ok { background: var(--ok); border-color: var(--ok); }
.install-box .ib-msg { margin: var(--s2) 0 0; min-height: 1.6em; font-size: 14px; color: var(--ok); }
.install-box .ib-warn { margin: var(--s2) 0 0; font-size: 13.5px; color: var(--accent-text); }
.install-box .ib-note { margin: var(--s2) 0 0; font-size: 13.5px; color: var(--faint); line-height: 1.6; }
.ib-foot { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); font-size: 13.5px; }
.ib-foot a { color: var(--text); }
.install-box .ib-rot { background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; color: var(--faint); text-decoration: underline; cursor: pointer; }
@media (max-width: 860px) {
  .st-body { grid-template-columns: 1fr; padding: 0 var(--s4) var(--s4); gap: var(--s4); }
  .start summary { padding: var(--s4); grid-template-columns: minmax(0, 1fr) auto; }
  .start .st-k { grid-column: 1; grid-row: auto; justify-self: start; margin-bottom: var(--s2); }
  .start summary b, .start .st-t { grid-column: 1; }
  .start summary::after { grid-column: 2; grid-row: 1 / span 3; }
  .start summary b { font-size: 19px; }
  .ib-cmdwrap { grid-template-columns: 1fr; }
  .ib-copy { width: 100%; }
  .install-box { padding: var(--s4); }
}

/* ---------- หน้าเรียน: ขัดเงา ---------- */
.lesson-col { min-width: 0; }
.toc-jump { display: none; }
.lesson-loading { color: var(--faint); }
.learn-nav h2 { font-size: 17px; }
.learn-nav a .lk { border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; line-height: 1.6; }
.learn-nav a .lk:empty { display: none; }
.learn-prog .bar { height: 8px; }
.learn-prog .bar i { background: linear-gradient(90deg, var(--accent), #ffd04a); }
.locked { padding: var(--s8) var(--s4); }
.locked .ic { width: 64px; height: 64px; }
.locked .lk-title { margin: var(--s5) auto 0; font-size: 14px; color: var(--faint); }
.locked h2 { margin-top: var(--s2); }
.locked .lk-price { margin: 0 auto var(--s5); }
.locked .lk-price b { font: 700 17px/1.5 var(--font-head); color: var(--accent-text); }
.locked .chat-alt { display: block; margin: var(--s3) auto 0; }
.lk-alt { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); font-size: 14.5px; }
.lk-alt a { color: var(--muted); }
.lk-alt a:hover { color: var(--text); }
@media (max-width: 960px) {
  .toc-jump { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 var(--s3); font-size: 14px; color: var(--muted); }
  .toc-jump::before { content: ""; width: 14px; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
}
@media (prefers-reduced-motion: reduce) { .pay-status.spin .ps-ic, .pg-spin { animation-duration: 3s !important; animation-name: ps-spin !important; } }
/* บรรทัดยอมรับนโยบายคืนเงิน (ใต้ปุ่มซื้อทุกจุด) */
.agree { margin: var(--s2) 0 0; font-size: 14px; color: var(--faint); }
.agree a { color: var(--text); margin: 0 4px; }
.locked .agree { margin: var(--s3) auto 0; }
.lesson .agree, .lesson .lk-alt a { font-size: 14px; }
.lesson .agree { line-height: 1.6; max-width: 520px; }
@media (max-width: 960px) { .lesson { min-height: 100vh; } }

/* ---------- คลิปสอน (บทเรียน + หน้า "คลิปสอนทั้งหมด") ---------- */
.lesson figure.lesson-clip { scroll-margin-top: 88px; margin: var(--s4) 0 var(--s6); border: 1px solid var(--accent-line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; box-shadow: var(--shadow); }
.lesson-clip figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s2); padding: var(--s3) var(--s4); }
.lesson-clip figcaption b { color: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.4; }
.lesson-clip .lc-dur { margin-left: auto; font-size: 13px; color: var(--faint); }
.lc-step { display: inline-flex; align-items: center; font: 700 12px/1 var(--font-head); color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.lesson-clip video, .clip-card video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #070a11; border-radius: 0; }
.lesson .clips-lead { color: var(--muted); }
.clip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin: var(--s5) 0 var(--s6); }
.clip-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-in); background: var(--surface-2); overflow: hidden; }
.clip-card .cc-lock { position: relative; }
.clip-card .cc-lock img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0; filter: brightness(.62) saturate(.8); }
.clip-card .cc-badge { position: absolute; right: 10px; top: 10px; font-size: 12px; line-height: 1; padding: 6px 10px; border-radius: 999px; background: rgb(var(--bg-rgb) / .82); color: var(--text); border: 1px solid var(--line-strong); }
.clip-card .cc-badge::before { content: ""; display: inline-block; width: 8px; height: 9px; margin-right: 6px; border: 1.5px solid currentColor; border-radius: 2px; vertical-align: -1px; }
.clip-card .cc-meta { display: grid; gap: 8px; justify-items: start; padding: var(--s3) var(--s4) var(--s4); }
.clip-card .cc-meta b { color: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.45; }
.clip-card .cc-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px var(--s3); width: 100%; font-size: 13px; color: var(--faint); }
.clip-card .cc-row a { font-size: 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.clips-buy { padding: var(--s4); border: 1px solid var(--accent-line); border-radius: var(--r-in); background: var(--accent-soft); }
.clips-buy p { margin: 0 0 var(--s3); }
.clips-buy .buy { display: flex; flex-wrap: wrap; gap: var(--s2); }
.learn-nav a.clips-link { margin: var(--s2) 0 0; color: var(--text); border: 1px solid var(--accent-line); background: var(--accent-soft); }
.learn-nav a.clips-link .pi { flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM10 8l6 4-6 4z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM10 8l6 4-6 4z'/%3E%3C/svg%3E") center / contain no-repeat; }
.jump-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
@media (max-width: 960px) {
  .toc-jump.clips-jump[hidden] { display: none; }
  .toc-jump.clips-jump::before { width: 0; height: 0; background: none; box-shadow: none; border-left: 9px solid var(--accent); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
}
@media (max-width: 760px) {
  .clip-grid { grid-template-columns: 1fr; }
  .lesson figure.lesson-clip { margin-left: calc(var(--s4) * -1); margin-right: calc(var(--s4) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  .lesson-clip figcaption { padding: var(--s3); }
  .lesson-clip .lc-dur { margin-left: 0; flex-basis: 100%; }
}

/* คอร์สปิดรับสมัครชั่วคราว (หน้าขาย series-autopilot) */
.btn.is-closed { opacity: .6; cursor: default; pointer-events: none; white-space: normal; text-align: center; line-height: 1.35; height: auto; }
.price-now.closed-txt { font-size: clamp(26px, 7.5vw, 40px) !important; line-height: 1.25; white-space: normal; }

/* คลิปขายแบบหยุดถาม (หน้าขาย #watch · course.js player()) */
.ipl-wrap { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s8); align-items: center; }
.ipl { position: relative; aspect-ratio: 9 / 16; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-strong); background: #000; box-shadow: var(--shadow); }
.ipl video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ipl-start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 16px; border: 0; cursor: pointer; color: #fff; font: inherit; text-shadow: 0 1px 8px rgb(var(--shadow-rgb) / .18); background: radial-gradient(circle at 50% 50%, rgb(var(--shadow-rgb) / .18), rgba(0,0,0,.15) 65%); }
.ipl-start b { font-family: var(--font-head); font-size: 20px; }
.ipl-start small { color: rgba(255,255,255,.78); font-size: 14px; }
.ipl-tri { width: 74px; height: 74px; border-radius: 50%; background: var(--accent); margin-bottom: 10px; position: relative; box-shadow: 0 8px 28px rgba(0,0,0,.45); transition: transform .18s; }
.ipl-tri::after { content: ""; position: absolute; left: 29px; top: 22px; border-style: solid; border-width: 15px 0 15px 24px; border-color: transparent transparent transparent var(--accent-ink); }
.ipl-start:hover .ipl-tri, .ipl-start:focus-visible .ipl-tri { transform: scale(1.06); }
.ipl-ask { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px 22px; color: #fff; background: rgba(6, 9, 16, .8); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: ipl-in .25s ease-out; }
.ipl-ask[hidden] { display: none; }
.ipl-ask h3 { font-family: var(--font-head); font-size: clamp(22px, 6vw, 26px); line-height: 1.3; margin: 0; }
.ipl-ask p { margin: 0 0 6px; color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.55; }
.ipl-ask .btn { width: 100%; justify-content: center; text-align: center; }
.ipl-k { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 3px 10px; }
.ipl-go { margin-top: 2px; padding: 10px; border: 0; background: none; color: rgba(255,255,255,.86); font: inherit; font-size: 15px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ipl-go:hover { color: #fff; }
.ipl .pay-msg { margin: 0; font-size: 14px; }
@keyframes ipl-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ipl-ask { animation: none; } .ipl-tri { transition: none; } }
@media (max-width: 960px) {
  .ipl-wrap { grid-template-columns: 1fr; gap: var(--s6); }
  .ipl-side { order: -1; }
  .ipl { width: 100%; max-width: 360px; margin: 0 auto; }
}
/* แนวนอน 16:9 (เบื้องหลังการทำงาน) · มือถือ: กล่องคำถามลงไปอยู่ใต้วิดีโอ เพราะจอแนวนอนเตี้ยเกินใส่ปุ่ม */
.ipl-wrap.wide { grid-template-columns: 1fr; gap: var(--s5); max-width: 1040px; }
.ipl-wrap.wide .ipl-side .sec-head { margin-bottom: 0; }
.ipl.wide { aspect-ratio: 16 / 9; }
.ipl.wide .ipl-ask { align-items: center; text-align: center; padding: 32px 48px; }
.ipl.wide .ipl-k { align-self: center; }
.ipl.wide .ipl-ask p { max-width: 560px; font-size: 17px; }
.ipl.wide .ipl-ask h3 { font-size: clamp(22px, 3vw, 32px); }
.ipl-btns { display: flex; gap: 12px; width: 100%; max-width: 560px; }
.ipl-btns .btn { flex: 1; }
@media (max-width: 960px) { .ipl-wrap.wide .ipl-side { order: 0; } .ipl.wide { max-width: none; } }
@media (max-width: 760px) {
  .ipl.wide { aspect-ratio: auto; overflow: visible; border: 0; box-shadow: none; background: none; }
  .ipl.wide video { aspect-ratio: 16 / 9; height: auto; border-radius: var(--r); border: 1px solid var(--line-strong); }
  .ipl.wide .ipl-start { bottom: auto; aspect-ratio: 16 / 9; border-radius: var(--r); }
  .ipl.wide .ipl-ask { position: static; margin-top: 12px; border-radius: var(--r); padding: 22px 18px; background: var(--surface-2, #172033); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ipl.wide .ipl-ask h3 { font-size: 22px; }
  .ipl-btns { flex-direction: column; }
  .ipl.wide .ipl-tri { width: 58px; height: 58px; }
  .ipl.wide .ipl-tri::after { left: 22px; top: 16px; border-width: 13px 0 13px 20px; }
}

/* หน้าขาย · การ์ดคลิปสอนจับมือทำ (#clips) */
.sales-clips { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.sales-clips .cc-free { position: relative; display: block; }
.sales-clips .cc-free img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.clip-card .cc-badge.free { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.clip-card .cc-badge.free::before { border: 0; width: 0; height: 0; margin-right: 6px; border-style: solid; border-width: 4.5px 0 4.5px 7px; border-color: transparent transparent transparent currentColor; border-radius: 0; }
@media (max-width: 960px) { .sales-clips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .sales-clips { grid-template-columns: 1fr; } }
.mgs-hero .eyebrow.pill { display: inline-flex; margin-bottom: 14px; }
