/* ONEVA — แชทน้องโอนี่ (2026-11-19) · คลาสขึ้นต้น sqb- ทั้งหมด
   การเคลื่อนไหวลื่นต่อเนื่อง: ซ้อน 3 ชั้นที่รอบเวลาไม่เท่ากัน (ลอยขึ้นลง 3.4 วิ · โยกซ้ายขวา 5.2 วิ · หายใจ 2.6 วิ) → ไม่เห็นจุดวนซ้ำ
   เปลี่ยนท่า = ค่อยๆ จางเข้า + ยืด-หด (squash & stretch) แบบสปริง · ท่าโบกมือมีแกว่งเบาๆ เพิ่ม */
.sqb { --sqbA: #2563eb; --sqbB: #22d3ee; --sqbPn: rgba(9, 22, 66, .97); --sqbTx: #e8eefc; --sqbMu: #9fb0d4; --sqbBot: rgba(255, 255, 255, .08); --sqbLn: rgba(148, 176, 255, .18); --sqbIn: rgba(255, 255, 255, .07);
  position: fixed; z-index: 60; right: max(12px, calc(50vw - 240px + 12px)); bottom: calc(max(calc(var(--sbot, 0px) - 16px), 10px) + 80px); font-family: inherit; }
html[data-mode="light"] .sqb { --sqbPn: rgba(255, 255, 255, .98); --sqbTx: #0f172a; --sqbMu: #64748b; --sqbBot: #eef3ff; --sqbLn: #e2e8f0; --sqbIn: #f1f5f9; }
.sqb button { font: inherit; cursor: pointer; }
.sqb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- น้องโอนี่ (ใช้ซ้ำทุกจุด) ---------- */
.sqb-m { position: relative; display: block; width: var(--sqbS, 74px); height: var(--sqbS, 74px); pointer-events: none; }
.sqb-sh { position: absolute; left: 22%; right: 22%; bottom: 2%; height: 9%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .38), transparent); animation: sqbShd 3.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-bob, .sqb-sw, .sqb-br { position: absolute; inset: 0; display: block; }
.sqb-bob { animation: sqbBob 3.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-sw { transform-origin: 50% 92%; animation: sqbSway 5.2s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-br { transform-origin: 50% 96%; animation: sqbBre 2.6s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-br img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .45s ease; user-select: none; -webkit-user-drag: none; }
.sqb-br img.on { opacity: 1; }
.sqb-m.pop .sqb-br { animation: sqbPop .7s cubic-bezier(.34, 1.56, .64, 1), sqbBre 2.6s 0.7s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-m[data-p="wave"] .sqb-sw { animation: sqbWave 1.6s cubic-bezier(.45, 0, .55, 1) infinite; }
.sqb-m[data-p="phone"] .sqb-bob { animation-duration: 1.7s; }
.sqb-m[data-p="happy"] .sqb-bob { animation: sqbHop 1.9s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes sqbBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes sqbShd { 0%, 100% { transform: scaleX(1); opacity: .9; } 50% { transform: scaleX(.82); opacity: .55; } }
@keyframes sqbSway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2.2deg); } }
@keyframes sqbBre { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(.985, 1.03); } }
@keyframes sqbWave { 0%, 100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }
@keyframes sqbHop { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-9%); } 55% { transform: translateY(0); } 70% { transform: translateY(-3%); } }
@keyframes sqbPop { 0% { transform: scale(1.06, .9); } 40% { transform: scale(.96, 1.06); } 70% { transform: scale(1.02, .98); } 100% { transform: scale(1, 1); } }
@media (prefers-reduced-motion: reduce) { .sqb-sh, .sqb-bob, .sqb-sw, .sqb-br, .sqb-m.pop .sqb-br { animation: none !important; } }

/* ---------- ปุ่มเปิด ---------- */
.sqb-fab { position: relative; display: flex; align-items: center; border: 0; background: none; padding: 0; color: #fff; -webkit-tap-highlight-color: transparent; }
.sqb-fl { display: none; }
.sqb-tip { position: absolute; right: calc(100% - 6px); bottom: 62%; white-space: nowrap; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: #fff; color: #0f172a; font-size: 12.5px; font-weight: 600; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); transform-origin: 100% 100%; animation: sqbTip .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes sqbTip { from { opacity: 0; transform: scale(.6) translateY(6px); } }
.sqb.open .sqb-fab { opacity: 0; pointer-events: none; transform: scale(.6); }
.sqb-fab { transition: opacity .25s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- แผงแชท (โครงร่วม) ---------- */
.sqb-pn { position: fixed; z-index: 61; display: flex; flex-direction: column; background: var(--sqbPn); color: var(--sqbTx); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); border: 1px solid var(--sqbLn); }
.sqb-pn[hidden] { display: none; }
.sqb-stage { display: none; }
.sqb-hd { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--sqbLn); }
.sqb-av { flex: none; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #1e3a8a, #2563eb); overflow: hidden; position: relative; }
.sqb-av .sqb-m { --sqbS: 58px; position: absolute; left: -7px; top: 2px; } .sqb-av .sqb-sh { display: none; }
.sqb-tt { flex: 1; min-width: 0; } .sqb-tt b { display: block; font-size: 15px; } .sqb-tt small { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--sqbMu); } .sqb-tt small i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.sqb-x { width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--sqbIn); color: var(--sqbTx); display: grid; place-items: center; }
.sqb-bd { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scroll-behavior: smooth; }
.sqb-ms { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 86%; animation: sqbIn .35s cubic-bezier(.2, .8, .2, 1); }
.sqb-ms.me { align-self: flex-end; align-items: flex-end; }
@keyframes sqbIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.sqb-tx { padding: 10px 13px; border-radius: 18px 18px 18px 6px; background: var(--sqbBot); font-size: 14px; line-height: 1.55; white-space: pre-line; word-break: break-word; }
.sqb-ms.me .sqb-tx { border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, var(--sqbA), #1d4ed8); color: #fff; }
.sqb-bt { display: flex; flex-wrap: wrap; gap: 6px; }
.sqb-bt a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; background: linear-gradient(135deg, var(--sqbA), #1d4ed8); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; box-shadow: 0 6px 14px -8px rgba(37, 99, 235, .9); }
.sqb-bt a svg { width: 15px; height: 15px; }
.sqb-sg { display: flex; flex-wrap: wrap; gap: 6px; }
.sqb-sg button { padding: 7px 12px; border-radius: 999px; border: 1.5px solid rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .08); color: var(--sqbTx); font-size: 12.5px; text-align: left; }
html[data-mode="light"] .sqb-sg button { color: #0e7490; border-color: #a5f3fc; background: #ecfeff; }
.sqb-fb { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--sqbMu); }
.sqb-fb button { width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--sqbLn); background: none; color: var(--sqbMu); display: grid; place-items: center; }
.sqb-fb button svg { width: 15px; height: 15px; } .sqb-fb button.on { background: var(--sqbA); border-color: var(--sqbA); color: #fff; }
.sqb-ty { display: inline-flex; gap: 4px; padding: 13px 15px; border-radius: 18px 18px 18px 6px; background: var(--sqbBot); }
.sqb-ty i { width: 7px; height: 7px; border-radius: 50%; background: var(--sqbMu); animation: sqbDot 1.1s ease-in-out infinite; } .sqb-ty i:nth-child(2) { animation-delay: .15s; } .sqb-ty i:nth-child(3) { animation-delay: .3s; }
@keyframes sqbDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.sqb-in { display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--sbot, 0px)); border-top: 1px solid var(--sqbLn); }
.sqb-in input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sqbLn); background: var(--sqbIn); color: var(--sqbTx); font: inherit; font-size: 16px; outline: none; }   /* 16px: iPhone ไม่ซูมเข้าตอนแตะช่องพิมพ์ (ซูมแล้วกล่องแชทตกขอบ) */
.sqb-in input:focus { border-color: var(--sqbB); }
.sqb-in button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--sqbB), var(--sqbA)); color: #fff; display: grid; place-items: center; }
.sqb-bg { position: fixed; inset: 0; z-index: 59; background: rgba(2, 6, 23, .5); opacity: 0; transition: opacity .3s; pointer-events: none; }
.sqb.open .sqb-bg { opacity: 1; pointer-events: auto; }

/* ========== A · ปุ่มกลมลอย + แผงเลื่อนขึ้น (น้องนั่งบนขอบแผง) ========== */
.sqb-a .sqb-fab { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #3b82f6, #1e3a8a 75%); box-shadow: 0 0 0 3px rgba(34, 211, 238, .35), 0 14px 26px -10px rgba(37, 99, 235, .9); }
.sqb-a .sqb-fab .sqb-m { --sqbS: 86px; position: absolute; left: -11px; bottom: 2px; } .sqb-a .sqb-fab .sqb-sh { display: none; }
.sqb-a .sqb-fab:before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(34, 211, 238, .5); animation: sqbRing 2.8s ease-out infinite; }
@keyframes sqbRing { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.sqb-a .sqb-pn { left: 50%; bottom: 0; width: 100%; max-width: 480px; height: min(78vh, 680px); height: min(78dvh, 680px, calc(100dvh - var(--stop, 0px) - 96px)); transform: translateX(-50%); border-radius: 26px 26px 0 0; border-bottom: 0; border-left: 0; border-right: 0; animation: sqbUp .45s cubic-bezier(.2, .9, .25, 1); }
@keyframes sqbUp { from { transform: translate(-50%, 100%); } }
.sqb-a .sqb-stage { display: block; position: absolute; right: 18px; top: -78px; pointer-events: none; } .sqb-a .sqb-stage .sqb-m { --sqbS: 108px; }
.sqb-a .sqb-hd { padding-right: 130px; } .sqb-a .sqb-av { display: none; } .sqb-a .sqb-x { position: absolute; left: 12px; top: -48px; background: rgba(9, 22, 66, .85); color: #fff; }

/* ========== B · น้องยืนเต็มตัว + บับเบิลทัก + แชทเต็มจอ ========== */
.sqb-b .sqb-fab .sqb-m { --sqbS: 104px; }
.sqb-b .sqb-pn { inset: 0; left: 50%; width: 100%; max-width: 480px; transform: translateX(-50%); border-radius: 0; border: 0; animation: sqbFade .35s ease; }
@keyframes sqbFade { from { opacity: 0; transform: translateX(-50%) scale(.98); } }
.sqb-b .sqb-hd { padding-top: calc(var(--stop, 0px) + 12px); }
.sqb-b .sqb-ms:not(.me) { position: relative; padding-left: 40px; }
.sqb-b .sqb-ms:not(.me) > .sqb-mini { position: absolute; left: -4px; top: -6px; } .sqb-b .sqb-mini .sqb-m { --sqbS: 44px; } .sqb-b .sqb-mini .sqb-sh { display: none; }
.sqb-mini { display: none; } .sqb-b .sqb-mini { display: block; }

/* ========== C · ปุ่มแคปซูล + การ์ดลอยมีเวทีน้องตัวใหญ่ ========== */
.sqb-c .sqb-fab { gap: 2px; padding: 0 16px 0 2px; height: 50px; border-radius: 999px; background: linear-gradient(135deg, #2563eb, #1e3a8a); box-shadow: 0 0 0 1.5px rgba(165, 243, 252, .6), 0 14px 26px -12px rgba(37, 99, 235, 1); }
.sqb-c .sqb-fab .sqb-m { --sqbS: 66px; margin: -18px -2px 0 -6px; } .sqb-c .sqb-fab .sqb-sh { display: none; }
.sqb-c .sqb-fl { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.sqb-c .sqb-pn { left: 50%; bottom: calc(var(--sbot, 0px) + 14px); width: calc(100% - 24px); max-width: 456px; height: min(80vh, 700px); height: min(80dvh, 700px, calc(100dvh - var(--stop, 0px) - 40px)); transform: translateX(-50%); border-radius: 26px; overflow: hidden; animation: sqbCard .45s cubic-bezier(.2, .9, .25, 1); }
@keyframes sqbCard { from { opacity: 0; transform: translate(-50%, 30px) scale(.94); } }
.sqb-c .sqb-stage { display: flex; justify-content: center; align-items: flex-end; height: 150px; flex: none; background: radial-gradient(120% 90% at 50% 100%, rgba(34, 211, 238, .28), transparent 60%), linear-gradient(180deg, #1d4ed8, #0b1f5c); position: relative; transition: height .35s cubic-bezier(.2, .9, .25, 1); }
.sqb-c .sqb-stage .sqb-m { --sqbS: 150px; margin-bottom: -10px; }
.sqb-c.chat .sqb-stage { height: 96px; } .sqb-c.chat .sqb-stage .sqb-m { --sqbS: 104px; }
.sqb-c .sqb-stage .sqb-m { transition: width .35s, height .35s; }
.sqb-c .sqb-hd { border-bottom: 0; padding-top: 10px; } .sqb-c .sqb-av { display: none; }
.sqb-c .sqb-x { position: absolute; right: 12px; top: 12px; background: rgba(255, 255, 255, .16); color: #fff; z-index: 2; }
.sqb-c .sqb-qk { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.sqb-c .sqb-qk button { padding: 11px 12px; border-radius: 14px; border: 1px solid var(--sqbLn); background: var(--sqbIn); color: var(--sqbTx); font-size: 13px; text-align: left; line-height: 1.35; }
.sqb-c .sqb-ms.qk { max-width: 100%; width: 100%; }

/* ปุ่มสลับแบบ (ช่วงออกแบบ) */
.sqb-vsw { position: fixed; top: calc(var(--stop, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; gap: 3px; padding: 4px; border-radius: 999px; background: #111827; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.sqb-vsw a { min-width: 34px; padding: 5px 0; text-align: center; border-radius: 999px; font-size: 12px; font-weight: 700; color: #cbd5e1; text-decoration: none; } .sqb-vsw a.on { background: #fff; color: #111827; }
.sqb.open ~ .sqb-vsw { z-index: 72; }

/* 2026-11-19 มือถือ: กล่องแชทตกขอบ → นับขอบรวมในความกว้าง · คีย์บอร์ดเด้งแล้วแผงยกขึ้นตาม (bot.js ตั้ง --sqbKb) */
.sqb, .sqb *, .sqb *::before, .sqb *::after { box-sizing: border-box; }
.sqb-pn { max-width: 100vw; margin-bottom: var(--sqbKb, 0px); }
.sqb.kb .sqb-in { padding-bottom: 10px; }

/* ========== 2026-11-19 ย่อน้อง + ลากได้ ==========
   ปุ่มย่อ/ขยาย (.sqb-mn) จุดเล็กมุมซ้ายบนของน้อง · ลากอยู่ = ไม่มี transition ให้ตามนิ้วทันที · วางแล้วค่อยๆ เลื่อนเข้าที่ */
.sqb { transition: left .35s cubic-bezier(.2, .9, .25, 1), top .35s cubic-bezier(.2, .9, .25, 1); }
.sqb.drag { transition: none; }
.sqb.drag .sqb-fab { transform: scale(1.08); filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .45)); }
.sqb-fab { touch-action: none; user-select: none; -webkit-user-select: none; }
.sqb-mn { position: absolute; z-index: 2; top: -6px; left: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(9, 22, 66, .92); color: #fff; box-shadow: 0 0 0 1.5px rgba(165, 243, 252, .55), 0 4px 10px rgba(0, 0, 0, .4); opacity: .9; padding: 0; }
.sqb-mn svg { width: 13px; height: 13px; stroke-width: 2.6; }
.sqb.lft .sqb-mn { left: auto; right: -6px; }
.sqb.open .sqb-mn, .sqb.drag .sqb-mn { opacity: 0; pointer-events: none; }
.sqb.lft .sqb-tip { right: auto; left: calc(100% - 6px); border-radius: 14px 14px 14px 4px; transform-origin: 0 100%; }
/* A · ลูกกลมเล็ก */
.sqb-a.m-a.mini .sqb-fab { width: 42px; height: 42px; }
.sqb-a.m-a.mini .sqb-fab .sqb-m { --sqbS: 58px; left: -8px; bottom: 0; }
.sqb-a.m-a.mini .sqb-fab:before { inset: -4px; }
/* B · แอบขอบจอ (โผล่ครึ่งตัว เอียงมองเข้าจอ) */
.sqb-a.m-b.mini .sqb-fab { width: 56px; height: 56px; background: none; box-shadow: none; }
.sqb-a.m-b.mini .sqb-fab:before { display: none; }
.sqb-a.m-b.mini .sqb-fab .sqb-m { --sqbS: 78px; left: -11px; bottom: -4px; transition: transform .35s; }
.sqb-a.m-b.mini.edge-r .sqb-fab .sqb-m { transform: rotate(-14deg); }
.sqb-a.m-b.mini.edge-l .sqb-fab .sqb-m { transform: rotate(14deg) scaleX(-1); }
.sqb-a.m-b.mini .sqb-mn { display: none; }
/* C · แคปซูลจิ๋ว */
.sqb-a.m-c.mini .sqb-fab { width: auto; height: 34px; padding: 0 16px 0 38px; border-radius: 999px; }
.sqb-a.m-c.mini .sqb-fab .sqb-m { --sqbS: 46px; left: -6px; bottom: -1px; }
.sqb-a.m-c.mini .sqb-fab:before { border-radius: 999px; }
.sqb-a.m-c.mini .sqb-fl { display: block; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.sqb-a.m-c.mini .sqb-fl:before { content: "โอนี่"; } .sqb-a.m-c.mini .sqb-fl { font-size: 0; } .sqb-a.m-c.mini .sqb-fl:before { font-size: 12.5px; }
.sqb-msw { position: fixed; top: calc(var(--stop, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; gap: 3px; padding: 4px; border-radius: 999px; background: #111827; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.sqb-msw a { min-width: 34px; padding: 5px 0; text-align: center; border-radius: 999px; font-size: 12px; font-weight: 700; color: #cbd5e1; text-decoration: none; } .sqb-msw a.on { background: #fff; color: #111827; }
/* 2026-11-19 ผู้ใช้: ในคอมให้น้องชิดขวาล่างของจอ (เดิมชิดขอบคอลัมน์มือถือกลางจอ) · แผงแชทเป็นการ์ดลอยมุมขวาล่าง */
@media (min-width: 1024px) {
  .sqb { right: 28px; bottom: 28px; }
  .sqb-a .sqb-pn { left: auto; right: 28px; bottom: 28px; width: 400px; height: min(640px, calc(100vh - 140px)); transform: none; border-radius: 24px; border: 1px solid var(--sqbLn); animation: sqbDesk .4s cubic-bezier(.2, .9, .25, 1); }
  .sqb-a .sqb-in { padding-bottom: 12px; }
  .sqb-bg { background: rgba(2, 6, 23, .25); }
}
@keyframes sqbDesk { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@media (min-width: 1024px) { .sqb-a.m-b.mini .sqb-fab { width: 76px; height: 76px; } .sqb-a.m-b.mini .sqb-fab .sqb-m { --sqbS: 104px; left: -14px; bottom: -4px; } .sqb-a.m-b.mini.edge-r .sqb-fab .sqb-m { transform: rotate(-8deg); } .sqb-a.m-b.mini.edge-l .sqb-fab .sqb-m { transform: rotate(8deg) scaleX(-1); } }   /* คอม: น้องแอบขอบตัวใหญ่ขึ้น โผล่ ~80% */

/* 2026-11-19 มือถือ: ไม่มีปุ่มย่อ (ลากชิดขอบ = แอบเข้ามุม) · ใกล้ขอบตอนลาก = ย่อลงนิดให้รู้ว่าจะเข้ามุม */
@media (max-width:1023px){.sqb-mn{display:none!important}.sqb.near .sqb-fab,[class*=sqb].near .sqb-fab{transform:scale(.82);opacity:.8;transition:transform .15s,opacity .15s}}
