/* NiyaiPlus · ชุดปรับหน้ามือถือ (v1.5.0)
   ใช้เฉพาะจอแคบ (≤860px) — จอคอมไม่เปลี่ยน · โครงเมนูล่าง/ปุ่มลัดสร้างใน mobile.js */
.mob{display:none}
#bnav{display:none}

@media (max-width:860px){
  :root{--bn:calc(62px + env(safe-area-inset-bottom,0px))}
  .dsk{display:none!important}
  .mob{display:inline}
  html{scroll-padding-bottom:calc(var(--bn) + 16px);-webkit-text-size-adjust:100%}
  body{padding-bottom:calc(var(--bn) + 10px);overscroll-behavior-y:contain;-webkit-tap-highlight-color:transparent}
  button,summary,label,select{touch-action:manipulation}
  input,select,textarea{font-size:16px!important} /* กัน iPhone ซูมหน้าเองตอนแตะช่องพิมพ์ */
  main{padding:6px 12px 24px}

  /* ── แถบบน: บรรทัดเดียว ── */
  #shell-main>header{flex-wrap:nowrap;gap:8px;min-height:52px;padding:6px 56px 6px 10px;padding-top:calc(6px + env(safe-area-inset-top,0px))}
  #ann.on+header{padding-top:6px}
  #shell-main>header .crumb{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:1rem}
  #shell-main>header .crumb>span{display:none}
  #shell-main>header .hdr-tools{flex:none;flex-wrap:nowrap;gap:4px;margin:0}
  /* ปุ่มหน้ากาก/ติดตั้ง เหลือแต่ไอคอน */
  .hdr-tools .hdr-pill{font-size:0;gap:0;min-width:44px;min-height:44px;padding:0;justify-content:center;border-radius:12px}
  .hdr-tools .hdr-pill svg{width:21px;height:21px}
  .hdr-tools .hdr-pill.np-inst{font-size:.84rem;font-weight:700;gap:4px;padding:0 12px;min-width:0;white-space:nowrap;color:#fff;background:var(--acc);border-color:var(--acc)}
  .hdr-tools .hdr-pill.np-inst.np-short{font-size:0}
  .hdr-tools .hdr-pill.np-inst.np-short::before{content:'📲';font-size:20px}
  #sdopen{min-height:44px;min-width:44px}
  /* v1.6.9: ยังไม่ล็อกอิน — แถบบนเคยกว้าง 410px ล้นจอ 360–390px (ปุ่มสมัครโดนตัด กระดิ่งหาย ทั้งหน้าเลื่อนซ้ายขวาได้)
     → ซ่อนปุ่มติดตั้ง (มีแบนเนอร์ติดตั้งอยู่แล้ว) และปุ่มสมัคร (มีในแบนเนอร์ใต้หัวเว็บ) เหลือแค่ "เข้าสู่ระบบ" */
  html.np-guest .hdr-tools .hdr-pill.np-inst,html.np-guest .hdr-tools .au-hb .au-ink{display:none!important}
  .hdr-tools .au-hb button{min-height:44px;white-space:nowrap}
  #shell-main>header{max-width:100vw;box-sizing:border-box}
  #ntbtn{top:calc(8px + env(safe-area-inset-top,0px))!important;right:8px!important}
  #ann.on~#ntbtn{top:auto!important}

  /* ── เมนูล่าง (แตะด้วยนิ้วโป้งได้สะดวก) ── */
  #bnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:45;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));background:var(--card);border-top:1px solid var(--line);box-shadow:0 -6px 22px rgba(0,0,0,.10)}
  #bnav button{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:50px;padding:2px 0;border:0;border-radius:12px;background:transparent;color:var(--mut);font-size:.72rem;font-weight:600;line-height:1.2}
  #bnav button .ic{display:flex;align-items:center;justify-content:center;width:46px;height:28px;border-radius:14px;transition:background .15s}
  #bnav button svg{width:21px;height:21px}
  #bnav button.on{color:var(--acc)}
  #bnav button.on .ic{background:rgba(var(--acc-rgb,168,87,29),.16)}
  #bnav button:active .ic{background:rgba(var(--acc-rgb,168,87,29),.24)}
  body.np-kb #bnav{display:none}           /* คีย์บอร์ดเปิดอยู่ → ซ่อนเมนูล่าง */
  body.np-kb{padding-bottom:12px}
  body.np-kb{--bn:0px}

  /* ── ปุ่มแชทแอดมิน: เหลือวงกลมเล็ก ไม่บังเนื้อหา ── */
  /* v1.6.20: ปุ่มแชทเขียนคำว่า "แชทกับแอดมิน" ให้เห็นชัด (เดิมเหลือแค่ไอคอน 💬 ลูกค้าไม่รู้ว่าคืออะไร) */
  .npc-float{right:12px!important;bottom:calc(var(--bn) + 12px)!important;min-height:46px;padding:0 16px!important;border-radius:23px!important;font-size:.92rem!important;font-weight:700;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:4px;transition:bottom .2s}
  .npc-float .npc-bdg{position:absolute;top:-5px;right:-5px;margin:0;font-size:.72rem;line-height:1.4;min-width:1.4em;padding:0 5px;border:2px solid var(--bg)}
  body.np-act .npc-float{bottom:calc(var(--bn) + 92px)!important} /* มีแถบปุ่มหลักลอยอยู่ → ยกขึ้นเหนือแถบ */
  body.np-kb .npc-float{display:none}
  .toast{bottom:calc(var(--bn) + 16px)}

  /* ── หน้าแรก: กระชับ + ปุ่มวางลิงก์มาก่อน ── */
  .np-top{display:flex;flex-direction:column}
  .np-top>*{order:5}
  .np-top>.np-hero{order:0;margin:4px 0 12px!important}
  .np-top>.np-urlcard{order:1;margin-top:0!important}
  .np-top>.np-dz{order:2}
  .np-top>.np-nokey{order:3}
  .np-top>#sitesdet{order:6}
  .np-top>.np-txtdet{order:2} /* v1.6.20: อยู่ต่อจากการ์ดไฟล์ ให้เห็นทางเลือกครบ 3 ทางติดกัน */
  .np-top>.np-steps{display:none}
  .np-top>input#file{display:none}
  .np-logo{display:none!important}
  .np-hero h2{font-size:1.5rem!important;line-height:1.3!important}
  .np-hero .mut{font-size:.9rem!important;margin-top:4px!important}
  .np-urlcard{padding:14px!important}
  #urlpaste{min-height:58px;font-size:1.08rem!important;margin-bottom:10px!important;border-radius:14px}
  .np-urllbl{font-size:.88rem;color:var(--mut);margin:2px 0 6px!important}
  .np-urlrow{flex-wrap:wrap;gap:8px!important}
  .np-urlrow #urlin{flex:1 1 100%!important;min-width:0!important;min-height:48px}
  .np-urlrow #urln{width:84px!important;min-height:48px;text-align:center}
  .np-urlbtns{gap:8px!important}
  .np-urlbtns button{flex:1 1 100%;min-height:50px;font-size:1rem}
  #urlmsg{font-size:.82rem!important;line-height:1.5}
  .np-dz{min-height:0!important;padding:18px 14px!important;gap:8px!important;border-radius:18px!important;margin-top:12px!important}
  .np-dz svg{width:28px;height:28px}
  .np-dz-t{font-size:1.1rem!important}
  .np-dz .row{gap:6px!important}
  .np-dz .row>span:first-child{padding:11px 22px!important;font-size:1rem!important;border-radius:12px!important}
  #sitesdet>summary{display:block;min-height:48px;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--card);line-height:1.45}
  #sitesdet[open]>summary{border-color:var(--acc)}
  .np-txtdet textarea{min-height:160px}
  #app h2#shelf,#app h2#ashelf{font-size:1.3rem!important;margin-top:26px!important}
  .card{padding:16px;border-radius:16px;margin:12px 0}

  /* ── หลังวางนิยาย: ปุ่ม "แปล" ลอยติดล่าง กดได้ทันที ── */
  .np-go #gostaged{position:sticky;bottom:calc(var(--bn) + 10px);z-index:6;max-width:none!important;min-height:58px!important;font-size:1.15rem!important;box-shadow:0 10px 28px rgba(0,0,0,.28)}

  /* ── หน้าเรื่อง ── */
  .np-projhd{flex-wrap:nowrap!important;gap:8px!important}
  .np-projhd #back{flex:none;min-width:44px;padding:0 8px;font-size:0}
  .np-projhd #back::before{content:'‹';font-size:1.7rem;line-height:1}
  .np-projhd h2{flex:1 1 auto;min-width:0;font-size:1.15rem!important;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .np-projhd #renameproj{flex:none;padding:0 12px}
  .chbar{bottom:calc(var(--bn) + 8px)!important;padding:10px 12px;border-radius:14px}
  .chbar{gap:8px}
  .chbar button.p.big{flex:1 1 100%;padding:10px 18px;font-size:1.05rem;min-height:50px}
  #selcnt{font-size:.85rem}
  body.np-act #start{display:none} /* ปุ่มซ้ำกับแถบลอยด้านล่าง */
  .chtools{gap:8px}
  .chr{padding:8px 4px 8px 10px;gap:10px}
  .chr .no{min-width:2.4rem;height:2.4rem}
  .chr .x{min-width:44px}

  /* ── หน้าต่างตั้งค่า / แพ็กเกจ: เต็มจอ ── */
  #advmodal{padding:0!important;align-items:stretch!important}
  .advbox{width:100%!important;max-height:none!important;height:100%;border-radius:0!important;border:0!important}
  .advhd{padding:8px 14px!important;padding-top:calc(8px + env(safe-area-inset-top,0px))!important;position:sticky;top:0;background:var(--card);z-index:2}
  .advhd h2{font-size:1.15rem}
  .advbody{padding:14px 14px calc(28px + env(safe-area-inset-bottom,0px))!important}
  #gate{padding:0!important;align-items:flex-end!important}
  .npc-ov{padding:0!important}

  /* ── เมนูข้าง (☰) ── */
  #side{width:min(300px,88vw)}
  #side .sd-nav{padding-bottom:10px}
}

/* จอเตี้ย (มือถือแนวนอน): ไม่ให้เมนูล่างกินที่ */
@media (max-width:860px) and (max-height:430px){
  #bnav button{min-height:42px;flex-direction:row;gap:6px;font-size:.8rem}
  #bnav button .ic{width:auto;height:auto;background:none!important}
  :root{--bn:calc(50px + env(safe-area-inset-bottom,0px))}
}

@media (prefers-reduced-motion:reduce){
  #bnav button .ic,.npc-float{transition:none}
}

/* v1.6.14: มือถือ · มีแถบชวนติดตั้งแอปอยู่แล้ว → ซ่อนปุ่ม "ติดตั้งแอป" ซ้ำบนหัวเว็บ ให้หัวเว็บโล่งขึ้น */
@media (max-width:860px){
  body:has(.np-ib.on) .hdr-tools .hdr-pill.np-inst{display:none!important}
}

/* v1.6.20: เครื่องเล่นเสียงเปิดอยู่ → ซ่อนปุ่มแชทลอยชั่วคราว ไม่ให้บังปุ่มของเครื่องเล่น (แชทยังเข้าได้จากเมนู "แพ็กเกจ") */
@media (max-width:860px){
  body:has(#apbar:not(.hide)) .npc-float{display:none!important}
}

/* v1.6.21 บริการพิเศษ: แปลง PDF เป็นข้อความ (public/extra.js) */
#xpage{padding:0 16px 120px}
.xp-wrap{max-width:640px;margin:0 auto}
.xp-top{text-align:center;margin:14px 0 18px}
.xp-top h2{font-family:'Noto Serif Thai',serif;font-size:1.9rem;margin:0}
.xp-top .mut{margin-top:4px}
.xp-card-h{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.xp-card-h b{font-size:1.25rem}
.xp-card-h .mut{font-size:.95rem}
.xp-ic{flex:none;width:52px;height:52px;border-radius:14px;background:var(--acc);color:#fff;display:inline-flex;align-items:center;justify-content:center}
.xp-step{display:flex;gap:10px;align-items:flex-start;margin:6px 0}
.xp-step b{flex:none;width:28px;height:28px;border-radius:50%;background:var(--acc);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:.9rem}
.xp-step span{padding-top:2px}
.xp-big{width:100%;font-size:1.08rem;padding:15px 12px;font-weight:700;margin-top:12px;min-height:52px}
.xp-wide{width:100%;margin-top:8px;min-height:46px}
.xp-s{font-size:.92rem;margin-top:8px}
.xp-own{margin-top:12px;padding:10px 12px;border-radius:12px;border:1px solid var(--line);font-size:.92rem}
.xp-h{font-weight:700;font-size:1.12rem;margin:6px 0;word-break:break-word}
.xp-done{color:var(--ok,#2e7d32)}
.xp-bar{height:12px;margin:8px 0}
.xp-bar i{background:var(--acc)}
.xp-l{font-weight:600;margin:14px 0 4px}
.xp-opt{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:12px;border:1px solid var(--line);border-radius:12px;margin:6px 0;font-weight:600;cursor:pointer}
.xp-opt:has(input[type=radio]:checked){border:2px solid var(--acc)}
.xp-opt input[type=radio]{width:22px;height:22px;margin:0;flex:none;accent-color:var(--acc)}
.xp-rng{gap:8px}
.xp-rng input[type=number]{width:74px;min-height:44px;margin:0;padding-left:10px;padding-right:6px}
.xp-pv{max-height:180px;overflow:auto;font-size:.95rem;line-height:1.7;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--bg)}
.xp-c2{margin-top:16px}
.xp-lock{border:1.5px dashed var(--line);background:transparent;color:inherit}
.cv-row{display:flex;gap:6px}.cv-o{flex:1;min-height:46px;padding:6px 4px;font-weight:600}.cv-o.on{border:2px solid var(--acc);color:var(--acc);font-weight:700}.cv-pick{gap:12px;background:var(--card);color:inherit}
.xp-ok{margin-top:12px;padding:10px 12px;border-radius:12px;background:rgba(46,125,50,.12);font-size:.95rem}
/* v1.6.22 หน้าต่างหมดโควตาฟรี (public/extra.js) */
.xq-ov{position:fixed;inset:0;z-index:95;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;padding:16px}
.xq{max-width:420px;width:100%;margin:0;text-align:center;padding:24px 20px;max-height:calc(100vh - 32px);overflow:auto}
.xq-ic{font-size:2.4rem;line-height:1}
.xq h2{font-size:1.3rem;margin:10px 0 8px}
.xq p{margin:0 0 10px}
.xq .xq-b{font-weight:600;margin-bottom:6px}
.xq-n{font-size:.85rem;margin-top:12px}
