/* ==========================================================
   Server Game Thai — มือถือ / แท็บเล็ต
   โหลดเป็นไฟล์สุดท้ายของทุกหน้า · จอใหญ่ (≥ 1200px) ไม่โดนอะไรในไฟล์นี้
   ≤ 1199px : แถบซ้าย = ลิ้นชัก (☰) · แชท = หน้าต่างเต็มจอ (ปุ่มลอย) · เมนูล่าง 5 ปุ่ม
   ≤ 767px  : จัดเนื้อหาเป็นคอลัมน์เดียวสำหรับมือถือ
   ปุ่ม / ลิ้นชัก / เมนูล่าง สร้างใน js/shell.js › renderMobile
   ========================================================== */

/* ชิ้นส่วนที่มีเฉพาะบนมือถือ: ซ่อนบนจอใหญ่ */
.m-only,.m-burger,.m-nav,.m-chat-fab,.m-scrim{display:none}
.chat-head .m-x.m-only{display:none} /* ปุ่มปิดแชทเต็มจอ (ต้องชนะ .chat-head .gear ที่ตั้ง display:grid) */

/* ตารางหลังบ้าน (js/admin.js › table): จอกว้างหน้าตาเดิม — ปุ่ม "จัดการ ▾" ซ่อน ปุ่มจริงเรียงตามปกติ */
.at-more{display:none}
.at-actw,.at-acts{display:contents}
/* ลิงก์ยาวซ่อนไว้ กดแสดง (js/admin.js › urlBox) */
.at-url{display:inline}
.at-url-b{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 9px;border-radius:7px;border:1px solid rgba(103,232,249,.4);background:rgba(6,182,212,.08);color:#67E8F9;font-size:11.5px;font-weight:600;cursor:pointer;vertical-align:middle}
.at-url-b i{font-size:12px}
.at-url-b:hover,.at-url-b[aria-expanded="true"]{background:rgba(6,182,212,.18);border-color:#67E8F9}
.at-url-a:not([hidden]){display:block;margin-top:5px;font-size:12px;line-height:1.45;word-break:break-all}

/* เลขหน้าใต้ตารางหลังบ้าน (js/admin.js › pagerHTML · หน้าละ 10 แถว) */
.at-pgw{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 14px;margin-top:12px}
.at-pg-n{font-size:12.5px;color:#94A3B8}
.at-pg{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.at-pg-b{min-width:36px;height:36px;padding:0 10px;display:inline-grid;place-items:center;border-radius:9px;border:1px solid #334155;background:rgba(255,255,255,.03);color:#CBD5E1;font-family:var(--font-display);font-size:14px;font-weight:700;cursor:pointer;transition:border-color .15s,background .15s}
.at-pg-b i{font-size:16px}
.at-pg-b:hover:not(:disabled){border-color:var(--purple-400);color:#fff}
.at-pg-b.on{background:var(--grad-purple);border-color:var(--purple-400);color:#fff;box-shadow:0 0 12px rgba(168,85,247,.45);cursor:default}
.at-pg-b:disabled{opacity:.35;cursor:default}
.at-pg-gap{min-width:18px;text-align:center;color:#64748B}

/* ตารางหลังบ้านบนจอแคบ: แต่ละแถว = การ์ด · ช่องแรกเป็นหัวการ์ด · ช่องอื่นมีชื่อคอลัมน์ด้านซ้าย · ปุ่มเยอะรวมเป็น "จัดการ ▾" */
@media (max-width:1023px){
  .at{display:flex;flex-direction:column;gap:10px;border:0!important;border-radius:0!important;overflow:visible!important}
  .at.m-wide-box{overflow:visible!important}
  .at-h{display:none!important}
  .at-r{display:flex!important;flex-direction:column;align-items:stretch!important;gap:8px!important;min-width:0!important;padding:12px!important;border:1px solid rgba(51,65,85,.75)!important;border-radius:12px;background:rgba(11,14,20,.55)!important}
  .at-c{display:grid;grid-template-columns:84px minmax(0,1fr);gap:10px;align-items:start;text-align:left!important}
  .at-c::before{content:attr(data-l);padding-top:2px;font-size:11.5px;font-weight:600;line-height:1.4;color:#64748B}
  .at-v{min-width:0}
  .at-v > [style*="justify-content:flex-end"]{justify-content:flex-start!important}
  .at-c.at-main{display:block;padding-bottom:10px;border-bottom:1px solid rgba(51,65,85,.55)}
  .at-c.at-main::before,.at-c.at-act::before{content:none}
  .at-c.at-act{display:block;padding-top:4px}
  .at-c.at-act .at-v > div{justify-content:flex-start!important}
  .at-c.at-act button,.at-c.at-act a{min-height:34px}
  .at-empty{border:1px dashed rgba(51,65,85,.75);border-radius:12px}
  .at-pgw{flex-direction:column;justify-content:center;margin-top:14px}
  .at-pg{justify-content:center}
  .at-pg-b{min-width:40px;height:40px}

  /* ในการ์ดมีที่พอ → ข้อความที่เคยตัดด้วย … แสดงเต็ม (ขึ้นบรรทัดใหม่ได้) */
  .at-v :is(span,div)[style*="white-space:nowrap"]{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere}

  .at-actw{position:relative;display:flex;flex-direction:column;gap:6px}
  .at-more{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;height:40px;padding:0 14px;border-radius:10px;border:1px solid #475569;background:rgba(255,255,255,.04);color:#E2E8F0;font-size:13px;font-weight:700;cursor:pointer}
  .at-more i{font-size:15px}
  .at-more .icon-chevron-down{font-size:13px;transition:transform .2s}
  .at-more[aria-expanded="true"]{border-color:var(--purple-400);background:rgba(168,85,247,.14);color:#fff}
  .at-more[aria-expanded="true"] .icon-chevron-down{transform:rotate(180deg)}
  .at-acts{display:none}
  .at-actw.open .at-acts{display:block;position:static;padding:8px;border-radius:12px;background:#0F1324;border:1px solid #334155;box-shadow:0 18px 44px rgba(0,0,0,.65)}
  .at-acts > div{flex-direction:column!important;flex-wrap:nowrap!important;align-items:stretch!important;justify-content:flex-start!important;gap:6px!important}
  .at-acts :is(button,a){width:100%;height:40px!important;justify-content:flex-start!important;padding:0 12px!important;font-size:13px!important}
  .at-acts :is(button,a) i{font-size:15px!important}
}

@media (max-width:1199px){
  html,body,.page{min-width:0}
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  body{-webkit-tap-highlight-color:rgba(166,77,255,.18)}
  body:has(.m-nav){padding-bottom:calc(64px + env(safe-area-inset-bottom))}
  body.m-lock{overflow:hidden}

  /* ---------- แถบบน ---------- */
  .topbar{display:flex;align-items:center;gap:6px;height:60px;padding:0 10px 0 8px}
  .m-burger{display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0;border-radius:12px;border:1px solid var(--border-subtle);background:rgba(5,6,15,.6);color:#fff;cursor:pointer}
  .m-burger i{font-size:22px}
  .m-burger[aria-expanded="true"]{border-color:var(--purple-400);box-shadow:var(--glow-purple)}
  .topbar-logo{flex:none;padding-left:2px}
  .topbar-logo img{height:42px}
  .topbar-right{flex:1;justify-content:flex-end;gap:8px;padding:0}
  .topnav{display:none}

  /* ---------- โครง 3 คอลัมน์ → คอลัมน์เดียว ---------- */
  .layout{display:block;z-index:auto} /* ไม่สร้าง stacking context → ลิ้นชัก / แชทลอยเหนือพื้นมืดได้ */
  .main{padding:18px 18px 24px;gap:22px}

  /* ---------- ลิ้นชักซ้าย (แถบเกม / ผู้สนับสนุน) ---------- */
  .side-left,.mleft{position:fixed;top:0;bottom:0;left:0;z-index:140;width:min(320px,86vw);overflow-y:auto;overscroll-behavior:contain;visibility:hidden;transform:translateX(-104%);transition:transform .3s var(--ease-out),visibility 0s linear .3s;background:linear-gradient(180deg,#0f1130,#080a1c);border-right:1px solid var(--border-default);box-shadow:24px 0 60px rgba(0,0,0,.55)}
  body.m-drawer-open :is(.side-left,.mleft){visibility:visible;transform:none;transition:transform .3s var(--ease-out)}
  .side-left-inner{padding:0 14px calc(24px + env(safe-area-inset-bottom));gap:4px}
  .m-drawer-head{display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;z-index:2;margin:0 -14px 6px;padding:8px 10px 8px 14px;background:rgba(15,17,48,.96);border-bottom:1px solid var(--border-subtle)}
  .m-drawer-head img{display:block;height:40px;width:auto;filter:drop-shadow(0 0 10px rgba(166,77,255,.45))}
  .m-x{display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0;border-radius:12px;border:1px solid var(--border-subtle);background:rgba(5,6,15,.6);color:var(--silver-200);cursor:pointer}
  .m-x i{font-size:20px}
  .m-x:hover{color:#fff;border-color:var(--purple-400)}
  .m-extra{display:flex;flex-direction:column;gap:10px;padding:6px 0 12px;margin-bottom:6px;border-bottom:1px solid var(--border-subtle)}
  .m-lang{display:flex;align-items:center;justify-content:space-between;padding:0 4px;font-size:14px;color:var(--text-muted)}
  .m-lang .lang{height:36px}
  .m-lang .lang button{height:30px;padding:0 14px;font-size:13px}
  .m-auth{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .m-auth .btn,.m-extra .btn{height:44px;padding:0 10px;font-size:14px}
  .side-btn{height:46px;font-size:15px}
  .side-btn img{width:24px;height:24px}
  .ad-list{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .ad-slot{font-size:12px}
  .discord-card button,.side-left .btn{height:44px}
  /* ---------- หน้าสมาชิก (Dashboard / ร้านค้า / หลังบ้าน · js/member.js) ---------- */
  .m-topbar{display:flex;align-items:center;gap:6px;height:60px;padding:0 10px 0 8px}
  .m-topbar .lg{flex:none;padding-left:2px}
  .m-topbar .lg img{height:42px}
  .m-topbar .rt{flex:1;justify-content:flex-end;gap:8px;padding:0}
  .m-topbar nav{display:none}
  .mlayout,.ad-wrap{display:block;z-index:auto}
  /* หน้าต่างป๊อปอัป (css/shop.css .modal-wrap เป็น grid) → ให้ช่องกว้างเท่าจอ ป๊อปอัปจะไม่ล้นขวา */
  .modal-wrap{grid-template-columns:minmax(0,100%);padding:10px}
  .modal{max-width:100%}
  .ad-main{padding:18px 18px 24px}
  .mleft .in{position:static;height:auto;overflow:visible;padding:64px 14px calc(24px + env(safe-area-inset-bottom))}
  .mleft a.nv{min-height:46px}
  .mleft a.nv span{font-size:15px}
  .m-drawer-x{display:none}
  body.m-drawer-open .m-drawer-x{display:grid;position:fixed;top:8px;left:calc(min(320px,86vw) - 54px);z-index:141}
  .mmain{padding:18px 18px 24px;gap:20px}
  .mright{border-left:0;border-top:1px solid var(--border-subtle)}
  .mright .in{padding:18px}
  .mfoot{padding:24px 20px}
  body:has(.m-nav) .toasts{bottom:calc(84px + env(safe-area-inset-bottom))}

  .m-scrim{display:block;position:fixed;inset:0;z-index:135;background:rgba(3,4,12,.62);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;pointer-events:none;transition:opacity .25s}
  body.m-lock .m-scrim{opacity:1;pointer-events:auto}

  /* ---------- แชท: หน้าต่างเต็มจอเลื่อนขึ้นจากล่าง ---------- */
  .side-right{position:fixed;left:0;right:0;bottom:0;z-index:140;height:calc(100dvh - 24px);max-height:calc(100vh - 24px);border-left:0;border-top:1px solid var(--border-default);border-radius:20px 20px 0 0;background:var(--night-900);box-shadow:0 -24px 60px rgba(0,0,0,.6);visibility:hidden;transform:translateY(104%);transition:transform .32s var(--ease-out),visibility 0s linear .32s}
  body.m-chat-open .side-right{visibility:visible;transform:none;transition:transform .32s var(--ease-out)}
  .side-right-inner{padding:10px 10px calc(10px + env(safe-area-inset-bottom));gap:10px}
  .side-right .chat{flex:1 1 auto;height:auto;min-height:0;border-radius:16px}
  .chat-head .m-x.m-only{display:grid;width:40px;height:40px;margin-left:0}
  .chat-head .pop,.chat-grip{display:none}
  .chat-head .pop + .gear{margin-left:auto}
  .chat-head{padding:12px 12px 10px;gap:10px}
  .chat-head .typing{display:none}
  .rooms button{height:36px;font-size:14px}
  .pin{margin:10px 12px 0;padding:8px 10px}
  .chat-body{padding:12px}
  .bubble{font-size:15px}
  .msg .who .nm{font-size:14px}
  .chat-foot{padding:10px 12px 12px}
  .quick{overflow-x:auto;scrollbar-width:none}
  .quick::-webkit-scrollbar{display:none}
  .quick button{height:34px;padding:0 14px;font-size:14px}
  .emoji{width:44px;height:44px}
  .input-pill{height:46px}
  .input-pill input{font-size:16px} /* 16px: iOS ไม่ซูมหน้าเองตอนแตะช่องพิมพ์ */
  .input-pill button{width:36px;height:36px}
  .chat-note{display:none}
  .emo-panel{width:auto;right:10px}
  .cs-panel{top:62px;right:10px;left:10px;width:auto;max-width:none}
  .cs-row{min-height:46px;font-size:14px}
  .cs-sw{width:46px;height:27px}
  .cs-sw::after{width:21px;height:21px}
  .cs-sw[aria-checked="true"]::after{transform:translateX(19px)}
  .cs-seg button{height:34px;min-width:50px;font-size:13.5px}
  .cs-foot button{height:38px}
  .chat.cs-fs-s .bubble{font-size:13px}
  .chat.cs-fs-l .bubble{font-size:17px}
  .side-right .mp-slim{flex:none}

  /* ---------- เมนูล่าง ---------- */
  .m-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:120;height:calc(64px + env(safe-area-inset-bottom));padding:0 4px env(safe-area-inset-bottom);background:rgba(8,10,28,.94);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-top:1px solid var(--border-subtle);box-shadow:0 -8px 24px rgba(0,0,0,.35)}
  body .m-nav a,body .m-nav a:hover{color:var(--silver-400)}
  body .m-nav a.on{color:#fff}
  .m-nav a{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;color:var(--silver-400);font-family:var(--font-head);font-size:12.5px;font-weight:600;line-height:1;white-space:nowrap}
  .m-nav a i{font-size:22px;line-height:1;transition:transform .2s var(--ease-out)}
  .m-nav a:active i{transform:scale(.88)}
  .m-nav a.on{color:#fff}
  .m-nav a.on i{color:#C084FC;filter:drop-shadow(0 0 8px rgba(168,85,247,.7))}
  .m-nav a.on::before{content:"";position:absolute;top:0;left:22%;right:22%;height:3px;border-radius:0 0 3px 3px;background:var(--grad-brand);box-shadow:0 0 10px rgba(168,85,247,.8)}

  /* ปุ่มแชทลอย */
  .m-chat-fab{display:grid;place-items:center;position:fixed;right:14px;bottom:calc(78px + env(safe-area-inset-bottom));z-index:121;width:56px;height:56px;padding:0;border-radius:50%;border:1px solid var(--cyan-400);background:var(--grad-cyan);color:#fff;cursor:pointer;box-shadow:0 10px 26px rgba(0,0,0,.5),0 0 18px rgba(31,182,255,.45);transition:transform .2s var(--ease-out),opacity .2s}
  .m-chat-fab i{font-size:25px}
  .m-chat-fab .pulse{position:absolute;top:6px;right:6px}
  .m-chat-fab:active{transform:scale(.93)}
  body.m-lock .m-chat-fab{opacity:0;pointer-events:none}

  /* ข้อความแจ้งเตือน / แถบคุกกี้ ไม่ทับเมนูล่าง */
  body:has(.m-nav) .toast{bottom:calc(88px + env(safe-area-inset-bottom))}
  body:has(.m-nav) .cc-bar{bottom:calc(76px + env(safe-area-inset-bottom))}
  /* คูปองของขวัญลอย (js/account.js › mountGift): อยู่เหนือเมนูล่าง เล็กลงนิด · ซ่อนตอนเปิดลิ้นชัก / แชท */
  body:has(.m-nav) .gift-fab{left:8px;bottom:calc(76px + env(safe-area-inset-bottom));scale:.76;transform-origin:0 100%}
  body.m-lock .gift-fab{opacity:0;pointer-events:none}

  /* สตาร์บอยวิ่งเล่นเฉพาะจอกว้าง */
  .hb{display:none!important}

  /* ---------- Hero หน้าแรก: หัวข้อ + ค้นหาอยู่บน · วงล้อเกมอยู่ล่าง (ปัดซ้าย/ขวาได้ · js/home.js) ---------- */
  .hero.hx{height:auto;display:flex;flex-direction:column}
  .hero.hx .hero-content{order:1;height:auto;max-width:none;padding:6px 2px 0;gap:14px}
  .hero.hx h1{font-size:44px}
  .hero.hx h1 + p{margin-top:-6px}
  .hero-cta{flex-wrap:wrap}
  .hs{flex:1 1 280px;height:48px}
  .hs input{font-size:16px}
  .hs-list{width:auto;right:-1px}
  .hx-car{position:relative;order:2;inset:auto;height:300px;margin-top:4px;perspective-origin:50% 50%}
  .hx-card{left:50%}
  /* หน้าเกม: ภาพลอยด้านขวาทับหัวข้อเมื่อจอแคบ → ใช้แค่พื้นหลังเบลอ */
  .gx-float{display:none}
  .game-h1,.hero h1.game-h1{white-space:normal;font-size:44px;line-height:1.1}

  /* ---------- อันดับเซิร์ฟเวอร์ ---------- */
  .server-row{grid-template-columns:44px 104px minmax(0,1fr) 170px;gap:14px}
  .server-row .thumb{width:104px;height:104px}
  .server-row .name-line{flex-wrap:wrap;gap:2px 10px}
  .server-row .name{flex:1 1 100%;font-size:20px;line-height:1.3;white-space:normal;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
  .server-row .meta{flex-wrap:wrap;gap:4px 14px}
  .server-row .ghost-num{display:none}
  .sec-head{flex-wrap:wrap;row-gap:10px}
  .sec-title,.top-title{white-space:normal}
  .sec-sub{display:none}
  .server-row .stars,.server-row.first .stars{font-size:24px}
  .server-row .star-line i{font-size:24px}

  /* ---------- ไลฟ์ & วีดีโอ ---------- */
  .lv-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .plat-row{min-width:0}
  .plat-row > div{min-width:0;overflow-x:auto;scrollbar-width:none}
  .plat-row > div::-webkit-scrollbar{display:none}
  .plat-row .chip{flex-shrink:0}

  /* ---------- ตลาดซื้อขาย: ยกเลิกตารางวางเอง (inline grid-column / grid-row) → 2 คอลัมน์ ---------- */
  .market-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:auto}
  .market-grid > *{grid-column:auto!important;grid-row:auto!important}
  .mcard.big{min-height:380px}
  .mcard.small{min-height:150px}

  /* ---------- เว็บบอร์ด ---------- */
  .board-cols{grid-template-columns:minmax(0,1fr)}

  /* ---------- หน้าย่อย (css/pages.css) ---------- */
  .tile-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .srv-cover .in{grid-template-columns:minmax(0,1fr) 240px;gap:24px;padding:26px 24px}
  .srv-cover .pic{width:240px}
  .srv-cover h1{font-size:32px}
  .link-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rank-th,.rank-row{grid-template-columns:44px 64px minmax(0,1fr) 150px}
  .rank-th > :nth-child(4),.rank-row .on-col{display:none}
  .rank-row > img{width:64px;height:64px}
  .op{grid-template-columns:150px minmax(0,1fr)}

  /* ---------- Footer ---------- */
  .footer .cols{grid-template-columns:1fr 1fr;gap:28px 24px;padding:32px 24px 24px}
  .footer .brand{grid-column:1/-1}
  .footer .bottom{flex-direction:column;gap:6px;padding:14px 24px 20px}
}

/* ==========================================================
   มือถือ (≤ 767px)
   ========================================================== */
@media (max-width:767px){
  /* แถบบน: ภาษา / สมัครสมาชิก / ร้านค้า ย้ายไปอยู่ในลิ้นชัก */
  .topbar-right .lang,.topbar-right a[href="signup.html"],.topbar-right .acct-shop{display:none}
  .topbar-logo img{height:38px}
  .topbar-right .btn{height:40px;padding:0 12px;font-size:14px}
  .topbar-right .acct-btn .nm,.topbar-right .acct-btn > .icon-chevron-down{display:none}
  .m-topbar .lang,.m-topbar .shop-pill,.m-topbar .acct-btn .nm,.m-topbar .acct-btn > .icon-chevron-down{display:none}
  /* ปุ่มโปรไฟล์: วงกลมพอดีรูป (ไม่มีชื่อ / ลูกศร) · ตัวเลขงานค้างของทีมงานติดมุมขวาบน */
  :is(.topbar-right,.m-topbar) .acct-btn{position:relative;width:46px;padding:0;gap:0;justify-content:center;border-radius:50%}
  :is(.topbar-right,.m-topbar) .acct-btn .acct-job{position:absolute;top:-5px;right:-7px;border:2px solid #0F172A}
  .m-topbar .lg img{height:38px}
  .mmain,.ad-main{padding:14px 12px 22px;gap:16px}
  .mright .in{padding:14px 12px}

  /* หน้าสมาชิกจัดวางด้วย inline style (js/dashboard.js · shop.js · admin.js) → จับตามรูปแบบ grid แล้วยุบคอลัมน์
     ตารางหลายคอลัมน์เท่ากัน → 2 คอลัมน์ · โครงซ้าย-ขวา (สัดส่วนไม่เท่า / ความกว้างคงที่) → คอลัมน์เดียว */
  :is(.mmain,.mright,.ad-main,#modalBox) :is([style*="grid-template-columns:repeat(4"],[style*="grid-template-columns:repeat(5"],[style*="grid-template-columns:repeat(6"],[style*="grid-template-columns:repeat(7"],[style*="grid-template-columns:repeat(3"]){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  :is(.mmain,.mright,.ad-main,#modalBox) :is([style*="grid-template-columns:minmax(0,1fr) minmax(0,1."],[style*="grid-template-columns:minmax(0,1fr) minmax(0,2fr)"],[style*="grid-template-columns:minmax(0,1fr) minmax(0,1fr)"],[style*="grid-template-columns:minmax(0,1.1fr)"],[style*="grid-template-columns:minmax(0,1.2fr) minmax(0,1fr)"],[style*="grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)"],[style*="grid-template-columns:minmax(0,.9fr)"],[style*="grid-template-columns:1fr 1.6fr"],[style*="grid-template-columns:300px"],[style*="grid-template-columns:240px"],[style*="grid-template-columns:200px minmax"],[style*="grid-template-columns:18% 1fr 22%"],[style*="grid-template-columns:minmax(0,1fr) 230px"],[style*="grid-template-columns:minmax(0,1.6fr) minmax(0,1fr)"],[style*="grid-template-columns:minmax(0,1.3fr) minmax(0,2fr)"]){grid-template-columns:minmax(0,1fr)!important}
  /* 2–3 คอลัมน์ที่เว้นช่องกว้าง (≥ 14px) = กล่องเนื้อหาวางคู่กัน → คอลัมน์เดียว · 3 ช่องเล็ก (ช่องห่าง ≤ 8px เช่นแท็บ / ตัวเลขสั้น) คงไว้ 3 */
  :is(.mmain,.mright,.ad-main,#modalBox) :is([style*="repeat(2,minmax(0,1fr));gap:14px"],[style*="repeat(2,minmax(0,1fr));gap:16px"],[style*="repeat(2,minmax(0,1fr));gap:20px"],[style*="repeat(2,minmax(0,1fr));gap:24px"],[style*="repeat(3,minmax(0,1fr));gap:14px"],[style*="repeat(3,minmax(0,1fr));gap:16px"]){grid-template-columns:minmax(0,1fr)!important}
  :is(.mmain,.mright,.ad-main,#modalBox) :is([style*="grid-template-columns:repeat(3,1fr)"],[style*="repeat(3,minmax(0,1fr));gap:6px"],[style*="repeat(3,minmax(0,1fr));gap:8px"]){grid-template-columns:repeat(3,minmax(0,1fr))!important}
  :is(.mmain,.mright,.ad-main,#modalBox) [style*="grid-column:span"]{grid-column:auto!important}
  /* หัวกล่อง (ไอคอน + หัวข้อ + ปุ่มชิดขวา) → ปุ่มขึ้นบรรทัดใหม่ได้เมื่อไม่พอ */
  :is(.mmain,.ad-main) [style*="display:flex;align-items:flex-start;gap"]:has(> [style*="margin-left:auto"]){flex-wrap:wrap}
  /* ตารางหลายคอลัมน์: เลื่อนแนวนอนในกรอบ (js/member.js ติดคลาส .m-wide ให้แถว / .m-wide-box ให้กรอบ) */
  #modalBox [style*="grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px"]{grid-template-columns:minmax(0,1fr)!important} /* ฟอร์มในป๊อปอัป (คูปอง ฯลฯ) */
  .m-wide-box{overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .m-wide{min-width:640px}
  input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea,select{font-size:16px!important} /* iOS ไม่ซูมหน้าเองตอนแตะช่องพิมพ์ */

  .main{padding:14px 12px 22px;gap:18px}
  .panel{padding:16px 14px;border-radius:14px}

  /* หัวข้อ section: ให้ขึ้นบรรทัดใหม่ได้ */
  .sec-head{flex-wrap:wrap;gap:8px 10px;margin-bottom:14px}
  .sec-icon{width:36px;height:36px;border-radius:10px}
  .sec-icon i{font-size:20px}
  .sec-title,.top-title{font-size:22px;white-space:normal}
  .sec-sub{display:none}
  .sec-btn{order:5;flex:1 1 100%;height:42px;margin-left:0}
  .sec-note{margin:-4px 0 12px}
  .more-flow .cap{width:72px;height:36px}

  /* Hero */
  .hero.hx h1{font-size:30px}
  .game-h1,.hero h1.game-h1{font-size:34px}
  .hero.hx .hero-content{gap:12px}
  .hero.hx p{font-size:16px}
  .hero-cta{flex-direction:column;align-items:stretch;gap:10px}
  .hs{flex:none;width:100%}
  .hero-cta > .btn{width:100%}
  .hx-car{height:236px}
  .hx-card{--w:178px}
  .hx-card[data-pos="-1"]{transform:translate3d(-58%,0,-110px) rotateY(26deg) scale(.66)}
  .hx-card[data-pos="1"]{transform:translate3d(58%,0,-110px) rotateY(-26deg) scale(.66)}
  .hx-card[data-pos="-2"],.hx-card[data-pos="2"]{opacity:0;pointer-events:none}
  .hx-name{font-size:16px;padding:24px 12px 10px}

  /* รีเซ็ตอันดับ: ข้อความบน · นับถอยหลังล่าง */
  .reset-bar{flex-wrap:wrap;gap:8px 10px;margin:-6px 0 14px;padding:10px 12px}
  .reset-bar > div:not(.countdown){flex:1 1 0;min-width:0}
  .reset-bar .t1{display:block}
  .countdown{width:100%;margin-left:0;gap:6px}
  .countdown div{flex:1;width:auto;height:44px}
  .countdown b{font-size:17px}
  .countdown span{font-size:11px}

  /* การ์ดอันดับ: รูปซ้าย ข้อมูลขวา · เลขอันดับติดมุมรูป · สตาร์ใต้ข้อมูล */
  .server-row{grid-template-columns:96px minmax(0,1fr);grid-template-areas:"thumb info" "thumb star";align-items:start;gap:6px 12px;padding:12px}
  .server-row:hover{transform:none}
  .server-row .bar{top:12px;bottom:12px}
  .server-row .rank-col{position:absolute;top:6px;left:6px;z-index:3;gap:2px}
  .server-row .rank-col .rank-badge{width:32px!important;height:32px!important;font-size:15px!important;box-shadow:0 2px 8px rgba(0,0,0,.6)}
  .server-row .rank-col .mv{margin-top:0;padding:2px 5px;border-radius:999px;background:rgba(5,6,15,.82);font-size:12px}
  .server-row .thumb{grid-area:thumb;width:96px;height:96px}
  .server-row .info{grid-area:info;gap:4px}
  .server-row .name-line{flex-wrap:wrap;gap:2px 8px}
  .server-row .name{flex:1 1 100%;font-size:18px;line-height:1.3;white-space:normal;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
  .server-row .game{font-size:12px}
  .server-row .desc{font-size:13px;line-height:1.45}
  .server-row .meta{flex-wrap:wrap;gap:4px 12px;margin-top:2px;font-size:12px}
  .server-row .star-col{grid-area:star;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px}
  .server-row .star-lbl{font-size:12px}
  .server-row .star-line{gap:6px}
  .server-row .star-line i{font-size:18px}
  .server-row .stars,.server-row.first .stars{font-size:20px}
  .server-row .ghost-num{display:none}
  .server-row.ph .name{font-size:17px}

  /* ไลฟ์ & วีดีโอ */
  .lv-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .lv-head{flex-wrap:wrap;gap:6px 10px}
  .lv-note{flex:1 1 100%;margin-left:0}
  .plat-row{margin:0 0 12px}

  /* ตลาด: คอลัมน์เดียว */
  .market-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .mcard.big{min-height:0}
  .mcard.big .pic{height:180px}
  .mcard:hover{transform:none}
  .market-grid .mcard.ph ~ .mcard.ph{display:none} /* ช่องว่างโชว์แค่ใบเดียว ไม่ให้หน้ายาวเกิน */

  /* เว็บบอร์ด: แถบหมวดเลื่อนแนวนอน · ซ่อนคอลัมน์ตอบล่าสุด */
  .cat-row{flex-wrap:nowrap;overflow-x:auto;margin:0 -14px 14px;padding:0 14px 2px;scrollbar-width:none}
  .cat-row::-webkit-scrollbar{display:none}
  .cat-row .chip{flex-shrink:0;height:36px}
  .board-th,.topic{grid-template-columns:40px minmax(0,1fr) 48px}
  .board-th > :nth-child(4),.topic .last,.topic.ph .last{display:none}
  .board-col .topic.ph ~ .topic.ph ~ .topic.ph{display:none} /* แถวว่างโชว์ไม่เกิน 2 แถวต่อคอลัมน์ */
  .board-col + .board-col:not(:has(.topic:not(.ph))){display:none}
  .topic{padding:10px 6px}
  .topic .tt span{font-size:15px}

  /* ---------- หน้าย่อย (css/pages.css) ---------- */
  .tile-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .tile-card:hover{transform:none}
  .lv-bar{gap:4px;padding:6px}
  .lv-like{padding:0 7px}
  .lv-watch{flex:1 1 auto;min-width:0;justify-content:center;padding:0 6px;overflow:hidden}
  .pager{flex-wrap:wrap;justify-content:center;row-gap:8px}
  .pager .info{flex:1 1 100%;margin-left:0;text-align:center}
  .empty-line{padding:32px 16px}

  /* อันดับแบบตาราง */
  .rank-th{display:none}
  .rank-row{grid-template-columns:32px 56px minmax(0,1fr);gap:10px;padding:10px}
  .rank-row:hover{transform:none}
  .rank-row > img{width:56px;height:56px}
  .rank-row .st-col{grid-column:2/-1;justify-content:flex-start}
  .mini-count{flex-wrap:wrap;margin-left:0}

  /* เว็บบอร์ด: ตารางกระทู้ → ซ่อนคอลัมน์เข้าชม / ล่าสุด */
  .wb-th,.wb-row{grid-template-columns:40px minmax(0,1fr) 48px;gap:10px}
  .wb-th > :nth-child(n+4),.wb-row .vw,.wb-row .ls{display:none}
  .wb-th,.wb-row{padding-left:10px;padding-right:10px}
  .wb-row .tt span{font-size:15px}

  /* รายละเอียดเซิร์ฟ: รูปบน ข้อมูลล่าง */
  .srv-cover{border-radius:16px}
  .srv-cover .in{grid-template-columns:minmax(0,1fr);gap:18px;padding:18px 16px}
  .srv-cover .pic{order:-1;width:min(240px,70%);justify-self:center;border-radius:16px}
  .srv-cover h1{font-size:24px}
  .srv-cover p{font-size:15px}
  .srv-pills{flex-wrap:wrap}
  .star-box{align-self:stretch;padding:10px 14px}
  .srv-cover .l > :last-child{flex-wrap:wrap}
  .srv-cover .l > :last-child > .btn{flex:1 1 auto;height:42px}
  .star-box b{font-size:30px}
  .box,.detail-box{padding:16px 14px}
  .detail-box h2{font-size:20px}
  .detail-box > p{font-size:15px}
  .link-grid{grid-template-columns:minmax(0,1fr)}

  /* ประกาศซื้อขาย */
  .post-grid{grid-template-columns:minmax(0,1fr);gap:16px;padding:14px}
  .post-info h1{font-size:22px}
  .post-info .meta{flex-wrap:wrap;gap:4px 8px}
  .post-info .meta > *{white-space:nowrap}
  .seller-box{flex-wrap:wrap}
  .seller-box > :nth-child(2){flex:1;min-width:0}
  .seller-box > .btn,.seller-box > a.btn,.seller-box > button{flex:1 1 100%;height:44px}
  .post-price{font-size:30px}
  .post-price i{font-size:24px}
  .cmt-box{padding:16px 14px}
  .cmt-new{flex-wrap:wrap}

  /* กระทู้ */
  .th-head{padding:16px 14px}
  .th-head h1{font-size:22px}
  .th-meta{gap:8px 14px}
  .th-meta .acts{margin-left:0;flex:1 1 100%}
  .op{grid-template-columns:minmax(0,1fr)}
  .op-side{flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:6px 10px;padding:12px 14px;text-align:left;border-right:0;border-bottom:1px solid var(--border-subtle)}
  .op-av{width:48px;height:48px;font-size:18px}
  .op-stats{width:auto;margin-top:0;grid-template-columns:repeat(2,auto)}
  .op-side .jn{flex:1 1 100%}
  .op-body{padding:14px}
  .op-body p{font-size:15px;line-height:1.75}
  .post-acts{margin-left:0}
  .reply{grid-template-columns:40px minmax(0,1fr);gap:10px;padding:12px}
  .reply .av{width:40px;height:40px;font-size:16px}
  .reply .ac{flex-wrap:wrap;gap:6px 14px}
  .replies-head{flex-wrap:wrap}
  .composer-box{padding:14px}
  .composer-box .f{flex-wrap:wrap}
  .editor textarea{font-size:16px}
  .related{padding:14px}

  /* นโยบาย: แท็บเลื่อนแนวนอน */
  .pol-tabs{flex-wrap:nowrap;overflow-x:auto;margin-left:-14px;margin-right:-14px;padding:0 14px 4px;scrollbar-width:none}
  .pol-tabs::-webkit-scrollbar{display:none}
  .pol-tabs > *{flex-shrink:0}

  /* Footer */
  .footer .cols{grid-template-columns:1fr;gap:24px;padding:28px 18px 20px}
  .footer .brand img{width:170px}
  .footer .links{gap:12px;font-size:15px}
  .footer .bottom{padding:14px 18px 18px}
}
