:root {
  --bg: #121821; --surface: #1a212c; --surface2: #212a37; --ink: #ebe8e1; --ink2: #cdd3da; --muted: #9ba6b3;
  --line: #2e3846; --primary: #dcb06c; --primary-h: #e8c483; --primary-ink: #1a1205; --primary-soft: rgba(220, 176, 108, .12);
  --gold: #dcb06c; --gold-soft: rgba(220, 176, 108, .12);
  --up: #26a69a; --down: #ef5350;
  --ok: #26a69a; --ok-soft: rgba(38, 166, 154, .14); --warn: #f0a24b; --warn-soft: rgba(240, 162, 75, .14); --bad: #ef5350; --bad-soft: rgba(239, 83, 80, .14);
  --link: #e8c483;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
/* แถบเลื่อนโทนมืด (Windows ไม่ขึ้นเป็นแถบขาว) */
:root { color-scheme: dark; }
* { scrollbar-width: thin; scrollbar-color: #3a4556 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a4556; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #4b586b; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Anuphan", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.7; font-size: 17px; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(18, 24, 33, .82); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.logo { font-weight: 700; font-size: 21px; color: var(--ink); letter-spacing: -.2px; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--gold); }
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; height: 34px; width: auto; }
@media (max-width: 480px) { .logo img { height: 30px; } }
.nav-links { display: flex; gap: 22px; flex: 1; }
.nav-links a { color: var(--ink2); font-size: 16px; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.nav-user img { width: 30px; height: 30px; border-radius: 50%; }
@media (max-width: 760px) { .nav-links { display: none; } .nav .wrap { justify-content: space-between; } .nav-user span { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 1px rgba(220, 176, 108, .3), 0 6px 20px rgba(220, 176, 108, .18); }
.btn-primary:hover { background: var(--primary-h); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: #3a4657; background: var(--surface2); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--ink2); white-space: nowrap; }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.blue { background: rgba(77, 144, 254, .14); color: #7fb0ff; }
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.approved { background: var(--ok-soft); color: var(--ok); }
.chip.rejected, .chip.revoked { background: var(--bad-soft); color: var(--bad); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 24px; }

/* sections */
section { padding: 64px 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 5px 12px; border-radius: 999px; }
h1, h2, h3 { letter-spacing: -.3px; line-height: 1.25; margin: 0; }
h2 { font-size: 30px; }
.section-head { margin-bottom: 28px; }
.section-head p { color: var(--muted); margin: 8px 0 0; }

/* forms */
label.f { display: block; font-size: 15px; font-weight: 500; color: var(--ink2); margin: 16px 0 6px; }
input[type=text], input[type=email], input[type=tel], input[type=search], input[type=number], input[type=url], select, textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; font-size: 17px; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 12px 14px; min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--muted); margin: 18px 0; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.msg { margin-top: 12px; font-size: 15px; min-height: 20px; }
.msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px; }
.modal .box { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 32px 28px; text-align: center; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); position: relative; }
.modal h3 { font-size: 23px; margin-bottom: 6px; }
.modal p { color: var(--muted); margin: 0 0 22px; font-size: 16px; }
.modal .x { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 23px; color: var(--muted); cursor: pointer; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }

/* footer */
footer { border-top: 1px solid var(--line); background: #0f141c; padding: 36px 0 48px; color: var(--muted); font-size: 14px; }
footer p { margin: 6px 0; }

/* trading accents */
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }
::selection { background: rgba(220, 176, 108, .35); }

/* แชท FAQ */
.chatw { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.chat-fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-ink); font-size: 24px; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.chatw.on .chat-fab { background: var(--surface2); border: 1px solid var(--line); }
.chat-panel { width: min(360px, calc(100vw - 40px)); height: min(520px, calc(100vh - 120px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head small { display: block; color: var(--muted); font-size: 14px; }
.chat-head .x { background: none; border: 0; color: var(--muted); font-size: 23px; cursor: pointer; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 85%; background: var(--surface2); border: 1px solid var(--line); padding: 10px 13px; border-radius: 14px 14px 14px 4px; font-size: 15px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.bub.me { align-self: flex-end; background: var(--primary-soft); border-color: rgba(220, 176, 108, .3); border-radius: 14px 14px 4px 14px; }
.qs { display: flex; flex-direction: column; gap: 6px; }
.qs button { text-align: left; background: none; border: 1px solid var(--line); color: var(--primary); font: inherit; font-size: 15px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.qs button:hover { background: var(--primary-soft); }
.chat-line { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 520px) { .chatw { right: 14px; bottom: 14px; } }

/* ปุ่มติดตั้งแอป (มือถือ) */
.install-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 760px) { .nav .wrap { gap: 10px; } #installSlot { margin-left: auto; } }
@media (max-width: 480px) { .nav .install-btn { padding: 0 10px; font-size: 0; gap: 0; } .nav .install-btn svg { width: 18px; height: 18px; } }

/* ปุ่มออกจากระบบ (หน้าบ้าน — แบบเดียวกับหลังบ้าน) */
.logout { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: .15s; white-space: nowrap; }
.logout svg { width: 16px; height: 16px; flex: none; }
.logout:hover { border-color: rgba(239,83,80,.5); color: #ef5350; background: rgba(239,83,80,.08); }
@media (max-width: 760px) { .logout span { display: none; } .logout { padding: 0 9px; } }

/* popup ยืนยัน (ใช้ร่วมกันหน้าบ้าน/หลังบ้าน) */
.cfm { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(5,8,12,.72); backdrop-filter: blur(4px); animation: cfmIn .15s ease; }
.cfm.out { opacity: 0; transition: opacity .15s; }
.cfm-box { position: relative; width: 100%; max-width: 400px; background: linear-gradient(180deg, #212a37, #1a212c); border: 1px solid #2a3443; border-radius: 20px; padding: 28px 24px 22px; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: cfmPop .18s cubic-bezier(.2,.9,.3,1.2); }
.cfm-ic { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; }
.cfm-ic svg { width: 28px; height: 28px; }
.cfm-box.ok .cfm-ic { background: rgba(38,166,154,.14); color: #26a69a; box-shadow: 0 0 0 6px rgba(38,166,154,.06); }
.cfm-box.bad .cfm-ic { background: rgba(239,83,80,.14); color: #ef5350; box-shadow: 0 0 0 6px rgba(239,83,80,.06); }
.cfm h3 { margin: 0 0 16px; font-size: 21px; }
.cfm-acc { background: rgba(18, 24, 33,.7); border: 1px dashed #364152; border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.cfm-acc small { display: block; font-size: 14px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.cfm-acc b.long { font-size: 19px; letter-spacing: 0; overflow-wrap: anywhere; display: block; }
.cfm-acc b { font-size: 30px; letter-spacing: .06em; font-variant-numeric: tabular-nums; color: var(--ink); }
.cfm-box.ok .cfm-acc b { color: #26a69a; } .cfm-box.bad .cfm-acc b { color: #ef5350; }
.cfm-who { font-size: 15px; margin-bottom: 10px; } .cfm-who span { display: block; color: var(--muted); font-size: 14px; }
.cfm p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 20px; }
.cfm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfm-btns .btn { height: 44px; justify-content: center; }
.cfm-btns.one { grid-template-columns: 1fr; }
.cfm-btns .btn.ok { background: #26a69a; color: #04110f; border-color: transparent; font-weight: 600; }
.cfm-btns .btn.bad { background: #ef5350; color: #fff; border-color: transparent; font-weight: 600; }
.cfm-btns .btn.ok:hover { background: #2bb8aa; } .cfm-btns .btn.bad:hover { background: #f26663; }
@keyframes cfmIn { from { opacity: 0; } } @keyframes cfmPop { from { transform: scale(.94); opacity: 0; } }
.cfm-btns .btn.ok { background: #26a69a; color: #04110f; border-color: transparent; font-weight: 600; }
.cfm-btns .btn.bad { background: #ef5350; color: #fff; border-color: transparent; font-weight: 600; }
.cfm-btns .btn.ok:hover { background: #2bb8aa; } .cfm-btns .btn.bad:hover { background: #f26663; }
.cfm-box.gold .cfm-ic { background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 6px rgba(220, 176, 108,.06); }
.cfm-box.gold .cfm-acc b { color: var(--primary); }
.cfm-btns .btn.gold { background: var(--primary); color: var(--primary-ink); border-color: transparent; font-weight: 600; }

/* เมนู ☰ มุมบนขวา (มือถือเท่านั้น) */
.menu-btn { display: none; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; flex: none; transition: .15s; }
.menu-btn svg { width: 20px; height: 20px; }
.menu-btn.on, .menu-btn:hover { border-color: rgba(212,168,83,.5); color: var(--gold); }
.menu-pop { position: absolute; top: 58px; right: 20px; width: min(260px, calc(100vw - 32px)); padding: 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: 0 18px 40px rgba(0,0,0,.45); z-index: 30; animation: menuIn .14s ease-out; }
.menu-pop[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } }
.menu-pop button { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.menu-pop button svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: rgba(255,255,255,.05); outline: none; }
.menu-pop button.bad, .menu-pop button.bad svg { color: #ef5350; }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-who { padding: 10px 12px 8px; font-size: 15px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-who small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .nav .wrap { position: relative; }
  .menu-btn { display: inline-flex; }
  .nav #installSlot, .nav #navAdmin, .nav .logout { display: none; }
  .nav-user { margin-left: auto; }
}

/* กล่องเตือนในป๊อปอัปขอปลดล็อก */
.unlock-warn { display: flex; gap: 10px; padding: 12px 14px; margin: 4px 0 14px; border-radius: 12px; font-size: 15px; line-height: 1.55;
  background: rgba(212,168,83,.09); border: 1px solid rgba(212,168,83,.3); color: #f0d9a8; }
.unlock-warn svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--gold); }
.unlock-warn b { color: #fff2d6; }
.unlock-warn a { display: block; margin-top: 4px; color: var(--gold); font-weight: 600; }

/* footer ติดล่างเสมอ (หน้าเนื้อหาสั้นก็ไม่ลอยขึ้นมากลางจอ) */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
body > .wrap { width: 100%; }
body > * { min-width: 0; }
body > footer { margin-top: auto; }

/* มือถือ: popup ไม่ล้นจอ เลื่อนได้ในตัว / Turnstile ไม่ล้นกรอบ */
.modal { overflow-y: auto; overscroll-behavior: contain; }
.modal .box { max-height: calc(100dvh - 40px); overflow-y: auto; }
#tsBox { max-width: 100%; overflow: hidden; }
@media (max-width: 480px) {
  .modal { padding: 12px; }
  .modal .box { padding: 26px 18px 20px; border-radius: 18px; max-height: calc(100dvh - 24px); }
  .modal h3 { font-size: 21px; padding-right: 24px; }
  .modal p { margin-bottom: 16px; font-size: 15px; }
  .cfm { padding: 12px; }
  .cfm-box { padding: 24px 18px 18px; }
}

/* ปุ่ม Google / Turnstile เป็น iframe ธีมสว่าง → ให้ตรงกัน ไม่งั้นเบราว์เซอร์ทาพื้นขาวรอบปุ่ม */
.gbtn, .gbtn iframe, #tsBox, #tsBox iframe, #ibTs, #ibTs iframe { color-scheme: light; }

/* ปุ่ม "เริ่มยังไง?" เลื่อนลงมา — เว้นที่ให้แถบเมนูด้านบน */
section[id] { scroll-margin-top: 72px; }

/* popup บังคับอ่านคำเตือนความเสี่ยง (ฟอร์มขอปลดล็อก) */
#riskModal { z-index: 60; }
#riskModal .box { max-width: 560px; text-align: left; display: flex; flex-direction: column; overflow: hidden; }
#riskModal .sub { margin: 0 0 12px; }
.risk-wrap { position: relative; margin: 0 0 14px; min-height: 0; flex: 1; display: flex; }
.risk-body { flex: 1; max-height: min(52vh, 460px); overflow-y: auto; padding: 4px 14px 8px 2px; font-size: 15px; line-height: 1.7; color: var(--ink2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.risk-body .ver { color: var(--muted); font-size: 13px; margin: 10px 0; }
.risk-body .key { padding: 12px 14px; border-radius: 12px; background: rgba(239,83,80,.08); border: 1px solid rgba(239,83,80,.3); color: #f5c9c8; }
.risk-body .key b { color: #ffd9d8; }
.risk-body h2 { font-size: 16px; color: var(--ink); margin: 18px 0 6px; }
.risk-body p { margin: 0 0 8px; font-size: 15px; color: var(--ink2); }
.risk-body ul { padding-left: 20px; margin: 6px 0; }
.risk-body li { margin: 4px 0; }
.risk-skip { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: #1a1407; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.45); transition: opacity .2s; }
.risk-skip svg { width: 22px; height: 22px; }
.risk-skip.gone { opacity: 0; pointer-events: none; }
#riskOk:disabled { opacity: .55; cursor: not-allowed; }

/* ปุ่มกากบาทปิด popup แจ้งผล */
.cfm-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.cfm-x:hover { background: rgba(255,255,255,.06); color: var(--ink); }

/* โลโก้เล็กใน footer */
.foot-logo { height: 22px; width: auto; vertical-align: middle; margin: -3px 4px 0 0; }
