/* HEADFACE STUDY - หน้าเส้นทางเรียนของวิชา (course.html) แบบ "เส้นทางวงกลม"
   โหลดในทุกหน้าที่ใช้ Barba (index / subject / progress / course) เพราะ Barba สลับเฉพาะเนื้อหา ไม่โหลด CSS ของหน้าใหม่
   ทุกคลาสขึ้นต้นด้วย cp- เพื่อไม่ชนกับสไตล์ของหน้าอื่น ใช้ตัวแปรสี .hue-* จาก css/style.css (--bg --bd --edge --strong --bar --chip)
   หลักการ: ข้อความน้อย (วงกลมสื่อด้วยไอคอนและสี) การเคลื่อนไหวมีความหมาย (เด้งเข้าเมื่อเลื่อนมาถึง / วงถัดไปเรียกสายตา / กดแล้วจมลง)
   และปิดทั้งหมดได้ด้วย prefers-reduced-motion */

:root { --cp-spring: cubic-bezier(.34, 1.56, .64, 1); --cp-out: cubic-bezier(.2, .8, .2, 1); }

/* sticky ของแบนเนอร์หน่วยต้องอ้างอิงหน้าจอ: overflow-x:hidden ของ wrapper ทำให้เกิดกล่องเลื่อนที่ไม่เลื่อนจริง จึงใช้ clip แทน */
[data-barba="wrapper"] { overflow-x: clip !important; }

/* แถบหัวร่วมที่ถูกซ้อนด้วยส่วนหัวของหน้าเส้นทางเรียน (main.js สลับ class นี้พร้อมเฟด) */
.hdr.is-covered { opacity: 0; visibility: hidden; pointer-events: none; }

.cp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ───────── ส่วนหัวของหน้า (ซ้อนทับตำแหน่งแถบหัวร่วม ใช้พื้นที่สีเขียวถาวรเดียวกัน) ───────── */
.cp { margin-top: -64px; }
.cp-head { position: relative; z-index: 30; display: flex; align-items: flex-start; gap: 6px; width: 100%; max-width: 36rem; margin: 0 auto; padding: 12px 20px 0 12px; color: #fff; }
.cp-bubbles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.cp-bubbles i { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13); animation: cpFloat 7s ease-in-out infinite; }
.cp-bubbles i:nth-child(1) { width: 44px; height: 44px; left: 52%; top: 6px; }
.cp-bubbles i:nth-child(2) { width: 22px; height: 22px; left: 38%; top: 58px; animation-delay: -2.4s; animation-duration: 6s; }
.cp-bubbles i:nth-child(3) { width: 30px; height: 30px; right: 22%; top: 64px; animation-delay: -4.2s; animation-duration: 8s; }
.cp-back { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(2, 44, 34, .35); color: #fff; text-decoration: none; transition: transform .15s, background-color .15s; }
.cp-back:hover { background: rgba(2, 44, 34, .5); transform: translateX(-2px); }
.cp-back:active { transform: scale(.92); }
.cp-head :focus-visible { outline-color: #fff; }
.cp-ht { flex: 1; min-width: 0; padding: 4px 0 0 4px; animation: cpHeadIn .55s var(--cp-out) both; }
.cp-eyebrow { margin: 0; font-size: 12px; line-height: 18px; font-weight: 700; letter-spacing: .04em; color: #D1FAE5; }
.cp-eyebrow:empty { display: none; }
.cp-title { margin: 0; font-size: 26px; line-height: 34px; font-weight: 800; color: #fff; }
.cp-meta { margin: 0; font-size: 13px; line-height: 20px; font-weight: 500; color: #ECFDF5; }
.cp-emoji { flex: none; font-size: 46px; line-height: 1; padding-top: 6px; filter: drop-shadow(0 6px 8px rgba(2, 44, 34, .25)); animation: cpBob 3.4s ease-in-out infinite; }
.cp-emoji:empty { display: none; }
@keyframes cpHeadIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cpBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(5deg); } }
@keyframes cpFloat { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.08); } }

.cp-in { width: 100%; max-width: 36rem; margin: 0 auto; padding: 0 20px; }

/* ───────── สถานะผิดพลาด ───────── */
.cp-state { margin-top: 24px; padding: 28px 20px; text-align: center; background: #fff; border: 2px dashed #CBD5E1; border-radius: 20px; color: #475569; }
.cp-state h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 700; color: #0F172A; }
.cp-state p { margin: 4px 0 14px; }
.cp-state-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cp-state-act .btn { margin-top: 0; }

/* ───────── โครงเปล่าระหว่างรอข้อมูล ───────── */
.cp-sk i { display: block; border-radius: 12px; background: linear-gradient(100deg, #E2E8F0 30%, #F1F5F9 50%, #E2E8F0 70%); background-size: 300% 100%; animation: cpShimmer 1.4s linear infinite; }
.cp-sk .cp-sk-c { width: 68px; height: 68px; border-radius: 50%; flex: none; }
.cp-sk .cp-sk-t { flex: 1; display: grid; gap: 8px; }
.cp-sk .cp-sk-l { height: 14px; width: 70%; }
.cp-sk .cp-sk-l.s { width: 45%; height: 11px; }
.cp-sk .cp-sk-b { height: 54px; border-radius: 18px; margin-top: 14px; }
.cp-sk-path { display: grid; justify-items: center; gap: 18px; margin-top: 26px; }
.cp-sk .cp-sk-ban { width: 100%; height: 62px; border-radius: 18px; }
.cp-sk .cp-sk-n { width: 84px; height: 84px; border-radius: 50%; transform: translateX(var(--dx, 0px)); animation-delay: calc(var(--dx, 0px) * 4ms); }
@keyframes cpShimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ───────── สรุปความคืบหน้า + ปุ่มเรียนต่อ ───────── */
.cp-sum { margin-top: 14px; padding: 14px 16px 16px; background: #fff; border: 2px solid var(--bd); border-radius: 24px; box-shadow: 0 5px 0 var(--edge), 0 14px 28px rgba(15, 23, 42, .06); animation: cpRise .55s .05s var(--cp-out) both; }
.cp-sum-row { display: flex; align-items: center; gap: 14px; }
.cp-pring { position: relative; flex: none; width: 68px; height: 68px; }
.cp-pring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.cp-pring circle { fill: none; stroke-width: 4.4; }
.cp-pring .t { stroke: #E2E8F0; }
.cp-pring .v { stroke: var(--bar); stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.3s .25s var(--cp-out); }
.cp-in:not(.cp-anim) .cp-pring .v, .cp-sum.is-in .cp-pring .v { stroke-dashoffset: var(--off, 100); }
.cp-pring .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; color: var(--strong); }
.cp-sum-t { min-width: 0; }
.cp-sum-h { margin: 0; font-size: 16px; line-height: 24px; font-weight: 800; color: #0F172A; }
.cp-sum-cap { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ปุ่มหลัก: สีไล่เฉด + เงา 3 มิติ + แสงวิ่งผ่านเป็นระยะให้สายตาไปหา กดแล้วจมลง */
.cp-cta { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; min-height: 54px; border-radius: 18px; font-size: 16px; font-weight: 800; letter-spacing: .01em; text-decoration: none; color: #fff;
  background: linear-gradient(180deg, var(--bar), var(--strong)); box-shadow: 0 5px 0 rgba(2, 44, 34, .38), 0 10px 22px rgba(4, 120, 87, .22); }
.cp-cta::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 36%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent); transform: skewX(-20deg); animation: cpShineBtn 4s 1.4s ease-in-out infinite; pointer-events: none; }
.cp-cta svg { animation: cpNudge 1.5s ease-in-out infinite; }
.cp-cta:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(2, 44, 34, .38); }
@keyframes cpShineBtn { 0% { left: -60%; } 38%, 100% { left: 130%; } }
@keyframes cpNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes cpRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* เกี่ยวกับวิชา: แถวเล็ก ๆ ไม่แย่งพื้นที่จากเส้นทาง กดแล้วขยายเป็นการ์ด */
.cp-about { margin-top: 8px; border: 2px solid transparent; border-radius: 18px; }
.cp-about summary { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 0 14px; font-size: 13px; font-weight: 700; color: #475569; cursor: pointer; list-style: none; }
.cp-about summary::-webkit-details-marker { display: none; }
.cp-chev { display: inline-flex; transition: transform .25s var(--cp-out); }
.cp-about[open] { background: #fff; border-color: #E2E8F0; box-shadow: 0 3px 0 #CBD5E1; animation: cpRise .3s var(--cp-out); }
.cp-about[open] .cp-chev { transform: rotate(180deg); }
.cp-about dl { display: grid; gap: 10px; margin: 0; padding: 0 14px 14px; }
.cp-about dt { font-size: 12px; line-height: 18px; font-weight: 700; color: #475569; }
.cp-about dd { margin: 0; font-size: 14px; line-height: 22px; color: #475569; font-weight: 500; }
.cp-about-list { display: grid; gap: 4px; margin: 0; padding-left: 18px; list-style: disc; }

/* ───────── เส้นทาง: หน่วย → บท (แยกสี) → วงกลม ───────── */
.cp-path { margin-top: 14px; display: grid; gap: 30px; }
.cp-unit { position: relative; }
.cp-empty { padding: 18px; text-align: center; color: #475569; }

/* แบนเนอร์หน่วย: ติดขอบบนขณะเลื่อน (ต่อเนื่องกับพื้นที่สีเขียวด้านบน) มีแถบความคืบหน้าของหน่วยที่ขอบล่าง */
.cp-banner { position: sticky; top: 10px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px 15px; border-radius: 20px; color: #fff; overflow: hidden;
  background: linear-gradient(120deg, var(--strong) 0, var(--strong) 62%, var(--bar) 100%); box-shadow: 0 5px 0 rgba(2, 44, 34, .28), 0 12px 24px rgba(4, 120, 87, .2); }
.cp-banner::before, .cp-banner::after { content: ""; position: absolute; left: 16px; bottom: 6px; height: 4px; border-radius: 4px; }
.cp-banner::before { right: 16px; background: rgba(255, 255, 255, .25); }
.cp-banner::after { width: calc((100% - 32px) * var(--u, 0) / 100); background: #fff; }
.cp-banner-k { margin: 0; font-size: 12px; line-height: 18px; font-weight: 700; letter-spacing: .02em; color: #fff; opacity: .95; }
.cp-banner h2 { margin: 0; font-size: 17px; line-height: 24px; font-weight: 800; color: #fff; }
.cp-banner-i { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: rgba(255, 255, 255, .2); }
.cp-banner.is-done .cp-banner-i { background: #FBBF24; color: #78350F; }
.cp-banner-mock { --strong: #9A3412; --bar: #C2410C; box-shadow: 0 5px 0 rgba(67, 20, 7, .3), 0 12px 24px rgba(194, 65, 12, .2); padding-bottom: 11px; }
.cp-banner-mock::before, .cp-banner-mock::after { display: none; }

/* บทเรียน: เส้นคั่น + ป้ายสีประจำบท (เลขบทในวงกลม ชื่อบท และจำนวนกิจกรรมที่เสร็จ) */
.cp-lesson { margin-top: 24px; }
.cp-lh { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.cp-lline { flex: 1; height: 4px; border-radius: 4px; background: var(--bd); opacity: .7; }
.cp-lchip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 82%; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--chip); color: var(--strong); border: 2px solid var(--bd); box-shadow: 0 3px 0 var(--edge); font-size: 13px; line-height: 20px; }
.cp-lnum { flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--strong); color: #fff; font-size: 13px; font-style: normal; font-weight: 800; }
.cp-lt { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-lc { flex: none; font-size: 12px; font-style: normal; font-weight: 800; opacity: .8; font-variant-numeric: tabular-nums; }
.cp-lesson.is-done .cp-lchip { background: #FEF3C7; border-color: #FCD34D; color: #78350F; box-shadow: 0 3px 0 #FDE68A; }
.cp-lesson.is-done .cp-lnum { background: #F59E0B; }
.cp-lesson.is-done .cp-lline { background: #FCD34D; }

/* ───────── วงกลม ───────── */
.cp-seq { position: relative; }
.cp-trail { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.cp-trail path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cp-trail-all { stroke: var(--bd); stroke-width: 5; stroke-dasharray: .1 13; opacity: .75; }
.cp-trail-done { stroke: var(--bar); stroke-width: 6.5; stroke-dasharray: .1 13; }
.cp-nodes { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }

.cp-n { --w: 96px; --face: var(--chip); --depth: var(--bd); --ico: var(--strong); position: relative; display: flex; flex-direction: column; align-items: center; transform: translateX(var(--dx, 0px)); }
.cp-n.is-now { --face: var(--bar); --depth: var(--strong); --ico: #fff; margin-top: 30px; }
.cp-n.is-done { --face: #FBBF24; --depth: #B45309; --ico: #78350F; }
.cp-n.is-optional { --w: 78px; }
.cp-n.is-optional:not(.is-done) { --face: var(--bg); --depth: var(--edge); }

.cp-node { position: relative; display: block; width: var(--w); height: var(--w); padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.cp-node:focus-visible { outline: 3px solid var(--strong); outline-offset: 4px; }
.cp-svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: visible; }

.cp-disc { fill: var(--face); }
.cp-n.is-todo .cp-disc { stroke: var(--bd); stroke-width: 3; }
.cp-depth { fill: var(--depth); }
.cp-ico { color: var(--ico); }
.cp-gloss { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; opacity: .45; }
.cp-n.is-todo .cp-gloss { opacity: .85; }
.cp-fg { transition: transform .12s ease; }
@media (hover: hover) { .cp-node:hover .cp-fg { transform: translateY(-2px); } }
.cp-node:active .cp-fg, .cp-node:hover:active .cp-fg { transform: translateY(5px); }

/* วงแหวนความคืบหน้า: วิ่งเข้าเมื่อเลื่อนมาถึง (ไม่มีแอนิเมชัน = แสดงค่าจริงทันที) */
.cp-track { fill: none; stroke: var(--edge); stroke-width: 7; opacity: .8; }
.cp-arc { fill: none; stroke: var(--bar); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; opacity: 0; transition: stroke-dashoffset 1.1s .3s var(--cp-out), opacity .2s .3s; }
.cp-in:not(.cp-anim) .cp-arc, .cp-n.is-in .cp-arc { stroke-dashoffset: var(--off, 100); opacity: 1; }

/* วงที่ "ถัดไป": คลื่นแผ่ออกเป็นระยะ ไอคอนสะบัดเรียกสายตา */
.cp-n.is-now .cp-node::before, .cp-n.is-now .cp-node::after { content: ""; position: absolute; left: 15%; top: 12%; width: 70%; height: 70%; border-radius: 50%; border: 4px solid var(--bar); opacity: 0; pointer-events: none; animation: cpHalo 2.3s ease-out infinite; }
.cp-n.is-now .cp-node::after { animation-delay: 1.15s; }
.cp-n.is-now .cp-ico { transform-box: fill-box; transform-origin: 50% 60%; animation: cpWiggle 3.4s 1s ease-in-out infinite; }
@keyframes cpHalo { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.75); opacity: 0; } }
@keyframes cpWiggle { 0%, 66%, 100% { transform: rotate(0) scale(1); } 72% { transform: rotate(-11deg) scale(1.08); } 80% { transform: rotate(10deg) scale(1.08); } 88% { transform: rotate(-5deg) scale(1.04); } }

/* วงที่เสร็จแล้ว: ประกายระยิบระยับ */
.cp-spark { fill: #FDE68A; transform-box: fill-box; transform-origin: center; animation: cpTwinkle 2.6s ease-in-out infinite; }
.cp-spark.s2 { animation-delay: 1.2s; }
@keyframes cpTwinkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: .25; } 50% { transform: scale(1) rotate(35deg); opacity: 1; } }

/* ป้าย "เริ่ม" เด้งเหนือวงกลมที่ถัดไป */
.cp-start { position: absolute; top: -38px; left: 50%; z-index: 2; padding: 4px 14px; border-radius: 12px; background: #fff; color: var(--strong); border: 2px solid var(--bd); font-size: 13px; line-height: 20px; font-weight: 800; letter-spacing: .03em; box-shadow: 0 3px 0 var(--edge); transform: translateX(-50%); animation: cpBounce 1.3s ease-in-out infinite; pointer-events: none; }
.cp-start::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 11px; height: 11px; background: #fff; border-right: 2px solid var(--bd); border-bottom: 2px solid var(--bd); transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0; }
@keyframes cpBounce { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-7px); } }

/* ปลายทาง: Mock Exam (วงกลมใหญ่สีส้ม) */
.cp-final .cp-nodes { margin-top: 28px; }
.cp-trophy { --w: 132px; --strong: #9A3412; --bar: #C2410C; --bd: #FDBA74; --edge: #FED7AA; --chip: #FFEDD5; --bg: #FFF7ED; }
.cp-trophy.is-now { --face: #EA580C; --depth: #9A3412; margin-top: 8px; }
.cp-trophy.is-todo { --face: #FDBA74; --depth: #C2410C; --ico: #9A3412; }
.cp-trophy.is-todo .cp-disc { stroke: none; }
.cp-trophy .cp-ico { transform-box: fill-box; transform-origin: 50% 60%; animation: cpTrophy 3.6s ease-in-out infinite; }
@keyframes cpTrophy { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-2.5px) rotate(3deg); } }

/* ───────── การ์ดที่เด้งขึ้นใต้วงกลมเมื่อแตะ ───────── */
.cp-pop-wrap { list-style: none; width: min(100%, 21rem); margin: 8px 0 6px; transform: none; }
.cp-pop { position: relative; padding: 14px 16px 16px; border-radius: 22px; background: var(--strong); color: #fff; box-shadow: 0 6px 0 rgba(0, 0, 0, .22), 0 14px 26px rgba(15, 23, 42, .14); }
.cp-pop::before { content: ""; position: absolute; top: -8px; left: calc(50% + var(--dx, 0px)); width: 18px; height: 18px; background: var(--strong); border-radius: 4px; transform: translateX(-50%) rotate(45deg); }
.cp-pop-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .2); color: #fff; font-size: 12px; line-height: 20px; font-weight: 700; }
.cp-pop h3 { margin: 8px 0 0; font-size: 18px; line-height: 26px; font-weight: 800; color: #fff; }
.cp-pop p { margin: 2px 0 0; font-size: 14px; line-height: 21px; color: #fff; opacity: .95; }
.cp-go { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; margin-top: 14px; border-radius: 16px; background: #fff; color: var(--strong); font-size: 16px; font-weight: 800; letter-spacing: .02em; text-decoration: none; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); transition: transform .1s, box-shadow .1s; }
.cp-go:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.cp-go svg { animation: cpNudge 1.5s ease-in-out infinite; }
.cp-go.is-off { background: rgba(255, 255, 255, .25); color: #fff; box-shadow: none; cursor: not-allowed; }
.cp-go.is-off svg { display: none; }
.cp-pop-mock { --strong: #9A3412; }

/* ปุ่มลอย: พาไปวงที่ต้องทำต่อเมื่ออยู่นอกจอ */
.cp-jump { position: fixed; left: 50%; bottom: 96px; z-index: 60; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 18px; border: 0; border-radius: 999px; background: var(--strong); color: #fff; font: 800 14px/1 inherit; box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 10px 20px rgba(15, 23, 42, .2); cursor: pointer; animation: cpJumpIn .4s var(--cp-spring) both; -webkit-tap-highlight-color: transparent; }
.cp-jump[hidden] { display: none; }
/* ขณะการ์ดรายละเอียดเปิดอยู่ ปุ่มลอยต้องไม่ทับการ์ด */
body.cp-pop-open .cp-jump { display: none; }
/* กันเหนือเมนูล่าง: ถ้าเบราว์เซอร์เลื่อนเองด้วย scrollIntoView ก็ไม่จบใต้เมนู */
.cp-pop-wrap { scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); scroll-margin-top: 90px; }
.cp-jump i { display: inline-flex; }
.cp-jump[data-dir="up"] i { transform: rotate(180deg); }
.cp-jump svg { animation: cpArrow 1.1s ease-in-out infinite; }
.cp-jump:active { margin-bottom: -3px; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
@keyframes cpJumpIn { from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(.8); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes cpArrow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ───────── เด้งเข้าเมื่อเลื่อนมาถึง (เปิดเมื่อมี .cp-anim เท่านั้น: ไม่มี JS/ลดแอนิเมชัน = เห็นทุกอย่างทันที) ───────── */
.cp-anim .cp-sum, .cp-anim .cp-banner, .cp-anim .cp-lh, .cp-anim .cp-n { opacity: 0; animation: none; }
.cp-anim .cp-n { transform: translateX(var(--dx, 0px)) scale(.35); }
.cp-anim .cp-sum.is-in { animation: cpRise .55s var(--cp-out) both; animation-delay: var(--d, 0ms); }
.cp-anim .cp-banner.is-in { animation: cpSlide .55s var(--cp-out) both; animation-delay: var(--d, 0ms); }
.cp-anim .cp-lh.is-in { animation: cpRise .5s var(--cp-out) both; animation-delay: var(--d, 0ms); }
.cp-anim .cp-lh.is-in .cp-lline { animation: cpLine .7s .1s var(--cp-out) both; }
.cp-anim .cp-lh.is-in .cp-lchip { animation: cpChip .55s .05s var(--cp-spring) both; }
.cp-anim .cp-n.is-in { animation: cpPop .6s var(--cp-spring) both; animation-delay: var(--d, 0ms); }
.cp-anim .cp-n.is-done.is-in .cp-ico { transform-box: fill-box; transform-origin: center; animation: cpCheck .55s calc(var(--d, 0ms) + .35s) var(--cp-spring) both; }
@keyframes cpPop { from { opacity: 0; transform: translateX(var(--dx, 0px)) scale(.35); } 60% { opacity: 1; } to { opacity: 1; transform: translateX(var(--dx, 0px)) scale(1); } }
@keyframes cpSlide { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes cpLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cpChip { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes cpCheck { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }

@media (min-width: 640px) {
  .cp-head { padding-left: 20px; }
  .cp-title { font-size: 30px; line-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-ht, .cp-sum, .cp-emoji, .cp-bubbles i, .cp-start, .cp-spark, .cp-sk i, .cp-cta::after, .cp-cta svg, .cp-go svg, .cp-jump, .cp-jump svg, .cp-about[open],
  .cp-n.is-now .cp-node::before, .cp-n.is-now .cp-node::after, .cp-n.is-now .cp-ico, .cp-trophy .cp-ico { animation: none; }
  .cp-start { transform: translateX(-50%); }
  .cp-arc, .cp-pring .v, .cp-fg, .cp-chev { transition: none; }
}

/* EXP ที่วงกลมนี้ให้ (Backend คำนวณ: ทำซ้ำได้ครึ่งเดียว) */
.cp-pop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cp-pop-exp { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: #FBBF24; color: #78350F; font-size: 12px; line-height: 20px; font-weight: 800; }
