/* ==========================================================================
   HAMU SHOP — core stylesheet
   ปรับ token ทั้งหมดได้ที่ :root ด้านล่าง
   ========================================================================== */

:root {
  /* พื้นหลัง */
  --bg: #060708;
  --bg-2: #0a0b0d;
  --panel: #0e1013;
  --panel-2: #121519;
  --input: #121519;
  --line: #1b1f25;
  --line-2: #262b33;

  /* ตัวอักษร */
  --text: #e6e8ea;
  --text-2: #a2a9b3;
  --muted: #757c86;

  /* สีแบรนด์ */
  --g1: #2ee88a;
  --g2: #10b981;
  --g3: #0b8f5f;
  --glow: rgba(46, 232, 138, .22);

  /* สีสถานะ */
  --red: #f0556d;
  --orange: #f59e0b;
  --purple: #a855f7;
  --blue: #3b82f6;
  --amber: #fbbf24;

  /* ขนาด */
  --sidebar-w: 214px;
  --topbar-h: 68px;
  --rail-w: 320px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Noto Sans Thai', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #22272f; border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #303740; }

/* ไอคอน ------------------------------------------------------------------ */
.ico {
  width: 18px; height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }
.ico-fill { fill: currentColor; stroke: none; }

/* โครงหน้า ---------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; max-width: 100%; }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  flex: 0 0 auto;
}
.brand-toggle {
  background: none; border: 0; padding: 4px;
  color: var(--g1); display: grid; place-items: center;
}
.brand-mark { line-height: 1; }
.brand-mark b {
  display: block;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--g1);
  text-shadow: 0 0 18px var(--glow);
}
.brand-mark span {
  display: block;
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--text-2);
  font-weight: 600;
  margin-top: -1px;
}

.side-scroll { flex: 1 1 auto; padding: 0 10px; }

.side-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 700;
  color: var(--muted);
  padding: 16px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #15181d; color: var(--text); }
.nav-item.active {
  background: rgba(16, 185, 129, .10);
  border-color: rgba(16, 185, 129, .28);
  color: var(--g1);
}

/* ช่องทางติดต่อท้ายเมนูซ้าย */
.side-social { margin: 14px 10px 18px; display: flex; flex-direction: column; gap: 8px; }
.side-social a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-2);
  transition: border-color .15s, color .15s;
}
.side-social a:hover { border-color: var(--line-2); color: var(--text); }
.side-social img { width: 18px; height: 18px; object-fit: contain; flex: 0 0 auto; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ปุ่มเปิดเมนูบนจอเล็ก — ซ่อนไว้บนเดสก์ท็อป (เปิดใน @media ท้ายไฟล์) */
.nav-burger {
  display: none;
  width: 40px; height: 40px;
  margin-left: -8px;
  background: none; border: 0; padding: 0;
  color: var(--text-2);
  place-items: center;
  flex: 0 0 auto;
}
.nav-burger:hover { color: var(--text); }

.search {
  flex: 0 1 640px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
}
.search:focus-within { border-color: rgba(16, 185, 129, .45); }
.search input {
  flex: 1 1 auto;
  background: none; border: 0; outline: none;
  color: var(--text);
  font-size: 13.5px;
}
.search input::placeholder { color: var(--muted); }
.kbd {
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 2px 7px;
  letter-spacing: .5px;
  white-space: nowrap;
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.top-btn {
  position: relative;
  background: none; border: 0; padding: 4px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-2);
  font-size: 13px;
}
.top-btn:hover { color: var(--text); }
.top-btn .dot {
  position: absolute;
  top: -4px; left: 12px;
  min-width: 16px; height: 16px;
  border-radius: 20px;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
  padding: 0 4px;
  border: 2px solid var(--bg-2);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  min-width: 190px;
  max-width: 290px;   /* ชื่อยาวมากก็ไม่ให้ยืดจนแถบบนเบี้ยว — ตัดชื่อด้วย … แทน */
}
.user-chip img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
/* ชื่อกับยอดเงินอยู่บรรทัดเดียวกัน — ชื่อยาวเกินให้ตัดด้วย … ยอดเงินต้องไม่โดนดันตก */
.user-chip > span { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.user-chip .u-name {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .u-bal { font-size: 12.5px; color: var(--g1); font-weight: 700; flex: 0 0 auto; }
.user-chip .ico { margin-left: auto; color: var(--muted); }

/* เมนูผู้ใช้ (dropdown) --------------------------------------------------- */
.user-menu { position: relative; }
.user-menu.open .user-chip { border-color: rgba(16, 185, 129, .45); }
.user-chip > .ico:last-child { transition: transform .18s; }
.user-menu.open .user-chip > .ico:last-child { transform: rotate(180deg); color: var(--g1); }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 250px;
  padding: 8px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: 0 20px 44px -14px rgba(0, 0, 0, .8);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.user-menu.open .user-dropdown { opacity: 1; visibility: visible; transform: none; }

.ud-head {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px 13px;
  border-bottom: 1px solid var(--line);
}
.ud-head img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; flex: 0 0 auto; }
.ud-head b { display: block; font-size: 13.5px; font-weight: 600; }
.ud-head small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.ud-balance {
  display: flex; align-items: center;
  margin: 9px 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(16, 185, 129, .2);
  font-size: 12.5px; color: var(--text-2);
}
.ud-balance b { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--g1); }

.ud-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text-2);
}
.ud-item:hover { background: #15181d; color: var(--text); }
.ud-item .ico { color: var(--muted); }
.ud-item:hover .ico { color: var(--g1); }

.ud-sep { height: 1px; background: var(--line); margin: 8px 4px; }

.ud-item.danger { color: var(--red); }
.ud-item.danger .ico, .ud-item.danger:hover .ico { color: var(--red); }
.ud-item.danger:hover { background: rgba(240, 85, 109, .1); color: var(--red); }

/* ==========================================================================
   CONTENT
   ========================================================================== */
.content { padding: 18px 22px 26px; flex: 1 1 auto; }

.layout { display: flex; gap: 16px; align-items: flex-start; }
.layout > .col-main { flex: 1 1 auto; min-width: 0; }
.layout > .col-rail { flex: 0 0 var(--rail-w); width: var(--rail-w); }
/* แถบขวาแบบกว้างพิเศษ (หน้ารายละเอียดสินค้า) — ปรับผ่านตัวแปรเพื่อให้ media query ทับได้ */
.col-rail.rail-wide { --rail-w: 360px; }

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 14px;
}
.breadcrumb a:hover { color: var(--text-2); }
.breadcrumb .sep { color: #3a4049; }
.breadcrumb .now { color: var(--text); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel-pad { padding: 18px; }

.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14px; letter-spacing: .4px; font-weight: 700; }
.panel-head .link {
  margin-left: auto;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 3px;
}
.panel-head .link:hover { color: var(--g1); }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
  margin: 0 0 14px;
}

/* ปุ่ม -------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px; font-weight: 600;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.18); }
.btn-primary {
  background: linear-gradient(180deg, var(--g2), var(--g3));
  border-color: transparent;
  color: #04150e;
  font-weight: 700;
  box-shadow: 0 6px 18px -8px var(--glow);
}
.btn-outline { background: transparent; border-color: rgba(16, 185, 129, .5); color: var(--g1); }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 12.5px; }
.btn-lg { height: 48px; font-size: 15px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 260px at 78% 45%, rgba(16, 185, 129, .22), transparent 70%),
    linear-gradient(100deg, #0b0f0d 0%, #0a0d0c 45%, #071310 100%);
  min-height: 274px;
  display: flex;
  align-items: center;
}
.hero-art {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 400px;
  /* --img-hero ตั้งจากหลังบ้าน (app/views/layouts/app.php) ถ้าไม่ได้ตั้งใช้รูปเริ่มต้น */
  background: var(--img-hero, url('../img/hero-character.png')) center/cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%);
  mask-image: linear-gradient(90deg, transparent, #000 22%);
  pointer-events: none;
}
.hero-body { position: relative; padding: 30px 34px; max-width: 640px; }
.hero-body h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--g1);
  text-shadow: 0 0 32px rgba(46, 232, 138, .3);
}
.hero-sub { margin: 12px 0 0; font-size: 17px; color: var(--text-2); font-weight: 500; }
.hero-points { display: flex; flex-wrap: wrap; gap: 22px; margin: 16px 0 22px; }
.hero-points span { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.hero-points .ico { color: var(--g1); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* หัวหน้าเพจแบบมีภาพ (categories / listing / topup) */
.page-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(520px 240px at 72% 40%, rgba(16, 185, 129, .18), transparent 70%),
    linear-gradient(100deg, #0a0d0c, #071210);
  padding: 22px 26px 26px;
  margin-bottom: 16px;
}
.page-hero .hero-art { width: 380px; opacity: .9; }
.page-hero-body { position: relative; }
.page-hero h1 {
  margin: 4px 0 0;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--g1);
  text-shadow: 0 0 30px rgba(46, 232, 138, .28);
}
.page-hero p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }

.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 10px;
  background: rgba(14, 16, 19, .8);
  border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 600;
}
.hero-badge .ico { color: var(--g1); }

/* ==========================================================================
   STAT ROW
   ========================================================================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
}
.stat-ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.stat-card b { display: block; font-size: 21px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
.stat-card small { display: block; font-size: 10px; letter-spacing: .7px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.t-green  { color: var(--g1);    background: rgba(16, 185, 129, .12); }
.t-red    { color: var(--red);   background: rgba(240, 85, 109, .12); }
.t-purple { color: var(--purple);background: rgba(168, 85, 247, .12); }
.t-blue   { color: var(--blue);  background: rgba(59, 130, 246, .12); }
.t-amber  { color: var(--amber); background: rgba(251, 191, 36, .12); }

.stat-card.b-green  { border-color: rgba(16, 185, 129, .3); }
.stat-card.b-red    { border-color: rgba(240, 85, 109, .3); }
.stat-card.b-purple { border-color: rgba(168, 85, 247, .3); }
.stat-card.b-blue   { border-color: rgba(59, 130, 246, .3); }
.stat-card.b-amber  { border-color: rgba(251, 191, 36, .3); }

/* ==========================================================================
   FILTERS
   ========================================================================== */
.filters { flex: 0 0 190px; width: 190px; }

.field {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.field:focus { border-color: rgba(16, 185, 129, .45); }
.field::placeholder { color: var(--muted); }

select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d848e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.check {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.check input { display: none; }
.check .box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line-2);
  background: var(--input);
  display: grid; place-items: center;
  flex: 0 0 auto;
  transition: background .15s, border-color .15s;
}
.check .box svg { width: 11px; height: 11px; stroke: #04150e; stroke-width: 3.2; opacity: 0; }
.check input:checked + .box { background: var(--g2); border-color: var(--g2); }
.check input:checked + .box svg { opacity: 1; }
.check:hover { color: var(--text); }

.filters .btn-primary { margin: 16px; width: calc(100% - 32px); }

/* ==========================================================================
   TOOLBAR (sort / view)
   ========================================================================== */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .spacer { margin-left: auto; }
.toolbar .count { font-size: 14px; color: var(--text-2); }
.toolbar .count b { color: var(--g1); }

.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel);
}
.view-toggle button {
  width: 42px; height: 40px;
  background: none; border: 0;
  color: var(--muted);
  display: grid; place-items: center;
}
.view-toggle button.active { background: rgba(16, 185, 129, .12); color: var(--g1); }

/* ==========================================================================
   LISTING CARDS
   ========================================================================== */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.listing-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .18s, transform .18s;
  display: flex;
  flex-direction: column;
}
.card:hover { border-color: rgba(16, 185, 129, .4); transform: translateY(-2px); }

.card-thumb { position: relative; aspect-ratio: 222 / 140; overflow: hidden; background: #0a0c0e; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  position: absolute; top: 10px; left: 10px;
  height: 21px; padding: 0 9px;
  border-radius: 5px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .7px;
  display: inline-flex; align-items: center;
  color: #fff;
}
.b-premium { background: #0f9d63; }
.b-og      { background: #6d28d9; }
.b-limited { background: #d9480f; }
.b-epic    { background: #7c3aed; }
.b-high    { background: #c1121f; }
.b-legend  { background: #d61f4a; }

.fav-star {
  position: absolute; top: 8px; right: 8px;
  background: none; border: 0; padding: 4px;
  color: var(--amber);
  line-height: 0;
}
.fav-star .ico { width: 19px; height: 19px; }

.card-body { padding: 12px 13px 13px; display: flex; flex-direction: column; flex: 1 1 auto; }
.card-title { font-size: 14px; font-weight: 700; margin: 0 0 7px; line-height: 1.3; }
.card-game {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: .8px; font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.card-meta { font-size: 11.5px; color: var(--text-2); margin-bottom: 10px; }
.card-price { font-size: 20px; font-weight: 800; margin-bottom: 12px; }

.card-foot {
  display: flex; align-items: center; gap: 7px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.stock {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-2);
  min-width: 0; white-space: nowrap;
}
.stock .ico { width: 12px; height: 12px; color: var(--muted); }
.stock.low, .stock.low .ico { color: var(--amber); }
.rating { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-2); }
.rating .ico { width: 12px; height: 12px; color: var(--amber); }

.buy-btn {
  margin-left: auto;
  width: 34px; height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, .4);
  background: rgba(16, 185, 129, .08);
  color: var(--g1);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.buy-btn:hover { background: rgba(16, 185, 129, .2); }

/* ==========================================================================
   RIGHT RAIL
   ========================================================================== */
.rail-stack { display: flex; flex-direction: column; gap: 14px; }

.wallet-box {
  margin: 16px;
  padding: 16px;
  border-radius: var(--r);
  border: 1px solid rgba(16, 185, 129, .22);
  background: linear-gradient(160deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .02));
}
.wallet-box small { font-size: 10.5px; letter-spacing: 1.2px; color: var(--text-2); font-weight: 600; }
.wallet-box .amount { font-size: 30px; font-weight: 800; margin: 6px 0 14px; letter-spacing: .5px; }
.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tx-list { padding: 6px 8px 10px; }
.tx {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
}
.tx:hover { background: #13161a; }
.tx-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.tx-main { min-width: 0; flex: 1 1 auto; }
.tx-main b { display: block; font-size: 13px; font-weight: 600; }
.tx-main small { display: block; font-size: 11px; color: var(--muted); }
.tx-amt { text-align: right; font-size: 13px; font-weight: 700; white-space: nowrap; }
.tx-amt small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.up { color: var(--g1); }
.down { color: var(--red); }

/* สินค้ายอดนิยม (แถบขวาหน้าแรก) */
.pop-list { padding: 6px 8px 12px; }
.pop-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 10px;
}
.pop-row:hover { background: #13161a; }
.pop-row .rank { width: 14px; flex: 0 0 auto; text-align: center; font-size: 12px; color: var(--muted); }
.pop-row img { width: 46px; height: 33px; border-radius: 7px; object-fit: cover; flex: 0 0 auto; background: #0a0c0e; }
.pop-row .pm { flex: 1 1 auto; min-width: 0; }
.pop-row .pm b {
  display: block;
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pop-row .pm span {
  display: flex; align-items: center; gap: 7px;
  margin-top: 3px;
  font-size: 11.5px; color: var(--muted);
}
.pop-row .pm .ico { width: 11px; height: 11px; color: var(--amber); }

.help-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(16, 185, 129, .10), rgba(14, 16, 19, .6));
}
.help-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.help-card p { margin: 0 0 14px; font-size: 12.5px; color: var(--text-2); max-width: 190px; }
.help-card .art {
  position: absolute; right: -6px; bottom: 10px;
  color: rgba(46, 232, 138, .5);
}
.help-card .art .ico { width: 84px; height: 84px; stroke-width: 1.1; }

/* ==========================================================================
   FOOTER FEATURE BAR
   ========================================================================== */
.feature-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
  padding: 18px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--panel);
}
.feature {
  display: flex; align-items: center; gap: 13px;
}
.feature .fi {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; flex: 0 0 auto;
}
.feature b { display: block; font-size: 12px; letter-spacing: .8px; font-weight: 700; }
.feature small { display: block; font-size: 11.5px; color: var(--muted); }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 22px 0 6px;
}
.pagination button, .pagination span {
  min-width: 38px; height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  display: grid; place-items: center;
  font-size: 13px;
}
.pagination button:hover { border-color: var(--line-2); color: var(--text); }
.pagination button.active {
  border-color: rgba(16, 185, 129, .55);
  color: var(--g1);
  background: rgba(16, 185, 129, .1);
}
.pagination .dots { border: 0; background: none; }
.page-note { text-align: right; font-size: 12.5px; color: var(--muted); margin-top: -30px; }

/* ==========================================================================
   TABS
   ========================================================================== */
.tabs {
  display: flex; align-items: center; gap: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  background: none; border: 0;
  padding: 12px 2px;
  color: var(--muted);
  font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--g1); border-bottom-color: var(--g2); }
.tab .n {
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 20px;
  background: rgba(251, 191, 36, .18);
  color: var(--amber);
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}

/* ==========================================================================
   UTIL
   ========================================================================== */
.muted { color: var(--muted); }
.green { color: var(--g1); }
.red { color: var(--red); }
.hide { display: none !important; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ==========================================================================
   PAGE: CATEGORIES
   ========================================================================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.cat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .18s, transform .18s;
}
.cat-card:hover { border-color: rgba(16, 185, 129, .35); transform: translateY(-2px); }
.cat-thumb { display: block; aspect-ratio: 293 / 118; overflow: hidden; background: #0a0c0e; }
.cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cat-body { padding: 16px 17px 17px; display: flex; flex-direction: column; flex: 1 1 auto; }
.cat-body h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.cat-count {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 11px;
  font-size: 12.5px; color: var(--text-2);
}
.cat-count i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }

/* สีตามธีมของเกม/หมวดย่อย — ชื่อคลาสถูกต่อขึ้นตอนรัน (dot-<accent>, c-<accent>)
   ค้นด้วยการหาข้อความในโค้ดจะไม่เจอ ห้ามลบทิ้งเวลาไล่เก็บโค้ดที่ไม่ได้ใช้ */
.dot-green  { background: var(--g1); box-shadow: 0 0 8px var(--glow); }
.dot-red    { background: var(--red); }
.dot-purple { background: var(--purple); }
.dot-blue   { background: var(--blue); }
.dot-amber  { background: var(--amber); }

.c-green  { border-color: rgba(16, 185, 129, .45); color: var(--g1); }
.c-red    { border-color: rgba(240, 85, 109, .45); color: var(--red); }
.c-purple { border-color: rgba(168, 85, 247, .45); color: var(--purple); }
.c-blue   { border-color: rgba(59, 130, 246, .45); color: var(--blue); }
.c-amber  { border-color: rgba(251, 191, 36, .45); color: var(--amber); }
.cat-desc {
  margin: 0 0 16px;
  font-size: 12.5px; line-height: 1.75;
  color: var(--muted);
  min-height: 44px;
}
.cat-btn { width: 100%; justify-content: space-between; margin-top: auto; }

.cat-grid.is-list { grid-template-columns: 1fr; }
.cat-grid.is-list .cat-card { flex-direction: row; align-items: stretch; }
.cat-grid.is-list .cat-thumb { flex: 0 0 240px; aspect-ratio: auto; }
.cat-grid.is-list .cat-btn { width: 220px; }

/* ==========================================================================
   PAGE: GAMES
   ========================================================================== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.game-card:hover { border-color: rgba(16, 185, 129, .4); transform: translateY(-2px); }

.game-banner { position: relative; display: block; aspect-ratio: 293 / 118; background: #0a0c0e; }
.game-banner > img:first-child { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.game-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(6, 7, 8, .85));
}
.game-icon {
  position: absolute;
  left: 16px; bottom: -22px;
  z-index: 1;
  width: 54px; height: 54px;
  border-radius: 15px;
  object-fit: cover;
  border: 2px solid var(--panel);
  background: var(--panel-2);
}

.game-body { display: block; padding: 30px 16px 16px; }
.game-name { display: block; font-size: 16px; font-weight: 700; }
.game-stats {
  display: flex; align-items: center; gap: 8px;
  margin-top: 7px;
  font-size: 12.5px; color: var(--text-2);
}
.game-stats i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.game-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.game-foot b { font-size: 16px; font-weight: 800; color: var(--g1); }

.game-grid.is-list { grid-template-columns: 1fr; }
.game-grid.is-list .game-card { flex-direction: row; align-items: center; }
.game-grid.is-list .game-banner { flex: 0 0 240px; aspect-ratio: 293 / 118; }
.game-grid.is-list .game-icon { bottom: 14px; }
.game-grid.is-list .game-body { flex: 1 1 auto; padding: 16px 20px; }
.game-grid.is-list .game-foot { border: 0; margin-top: 10px; padding-top: 0; justify-content: flex-start; gap: 10px; }

/* ==========================================================================
   PAGE: LISTINGS (product.html)
   ========================================================================== */
.hero-title-row { display: flex; align-items: center; gap: 18px; }
.hero-icon {
  width: 62px; height: 62px;
  border-radius: 16px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .3);
  color: var(--g1);
}
.hero-icon .ico { width: 30px; height: 30px; }
.hero-game-icon {
  width: 62px; height: 62px;
  border-radius: 16px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(16, 185, 129, .3);
  background: var(--panel-2);
}
.hero-title-row h1 { font-size: 38px; margin: 0; }
.hero-title-row p { margin: 4px 0 0; }

.listing-grid.is-list { grid-template-columns: 1fr; }
.listing-grid.is-list .card { flex-direction: row; }
.listing-grid.is-list .card-thumb { flex: 0 0 220px; aspect-ratio: auto; }
.listing-grid.is-list .card-body { flex-direction: row; align-items: center; gap: 20px; }
.listing-grid.is-list .card-price { margin: 0 0 0 auto; }
.listing-grid.is-list .card-foot { border: 0; margin: 0; padding: 0; }

/* ==========================================================================
   PAGE: PRODUCT DETAIL (buy.html)
   ========================================================================== */
.pd-top { display: flex; gap: 18px; align-items: flex-start; }
.pd-gallery { flex: 0 0 476px; max-width: 476px; }

.pd-stage {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 476 / 302;
  background: #0a0c0e;
}
.pd-stage img { width: 100%; height: 100%; object-fit: cover; }
.pd-stage .badge { top: 14px; left: 14px; }
.pd-stage .fav-star { top: 12px; right: 12px; color: var(--text-2); }
.pd-stage .fav-star.is-on { color: var(--amber); }
.pd-stage .fav-star.is-on .ico { fill: currentColor; }

/* ปุ่มเลื่อนรูปซ้าย/ขวา */
.pd-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(6, 7, 8, .6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: var(--text);
  display: grid; place-items: center;
  opacity: .85;
  transition: opacity .16s, background .16s, border-color .16s;
}
.pd-nav:hover {
  opacity: 1;
  background: rgba(16, 185, 129, .35);
  border-color: rgba(16, 185, 129, .6);
}
.pd-nav.prev { left: 12px; }
.pd-nav.next { right: 12px; }

.pd-count {
  position: absolute;
  right: 12px; bottom: 12px;
  height: 24px; padding: 0 11px;
  border-radius: 20px;
  background: rgba(6, 7, 8, .68);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: center;
}

.pd-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.pd-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  aspect-ratio: 106 / 68;
  background: #0a0c0e;
  padding: 0;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumb.active { border-color: var(--g2); }

.pd-info { flex: 1 1 auto; min-width: 0; }
.pd-title { font-size: 27px; font-weight: 800; margin: 8px 0 12px; line-height: 1.2; }
.chip {
  display: inline-flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px; font-weight: 500;
}
.chip .ico { color: var(--g1); }
.about-list { list-style: none; margin: 14px 0 0; padding: 0; }
.about-list li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--text-2); }
.about-list .ico { color: var(--g1); margin-top: 2px; }

/* กล่องราคาในแถบขวา */
.price-box .label { font-size: 15px; font-weight: 700; }
.price-box .price { font-size: 33px; font-weight: 800; margin: 10px 0 4px; letter-spacing: .5px; }
.price-box .vat { font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.price-box .btn + .btn { margin-top: 10px; }
.price-box .pb-stats {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 16px; padding-top: 15px;
  border-top: 1px solid var(--line);
}
.price-box .pb-stats span { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); }
.price-box .pb-stats .ico { color: var(--muted); }
.price-box .pb-stats b { margin-left: auto; color: var(--text); font-weight: 600; }

.kv-list { margin: 18px 0 0; }
.kv {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  font-size: 13px; color: var(--text-2);
}
.kv .ico { color: var(--muted); }
.kv b { margin-left: auto; color: var(--text); font-weight: 600; }
.kv > .ico:last-child { margin-left: auto; }
a.kv:hover { color: var(--g1); }

.safe-list { list-style: none; margin: 12px 0 0; padding: 0; }
.safe-list li { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); }
.safe-list .ico { color: var(--g1); flex: 0 0 auto; margin-top: 1px; }

/* ==========================================================================
   PAGE: TOP UP
   ========================================================================== */
.step-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.step-n {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: rgba(16, 185, 129, .16);
  border: 1px solid rgba(16, 185, 129, .35);
  color: var(--g1);
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.step-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* กล่องกรอกลิงก์ซองอั่งเปา — คุมความกว้างไว้ ไม่ให้ช่องกรอกยาวเต็มจอ
   แล้วปุ่มสั้นกว่าจนดูไม่เข้าคู่กัน */
.angpao-box { max-width: 620px; margin: 0 auto; }
.angpao-box .btn-lg { width: 100%; margin-top: 18px; }
.angpao-box .about-list { margin-top: 20px; }
.ribbon {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  height: 20px; padding: 0 12px;
  border-radius: 20px;
  background: var(--g2);
  color: #04150e;
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
  white-space: nowrap;
}

.pay-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.pay-card {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel-2);
  text-align: left;
  transition: border-color .15s, background .15s;
}
.pay-card:hover { border-color: var(--line-2); }
.pay-card.active { border-color: rgba(16, 185, 129, .6); background: rgba(16, 185, 129, .06); }
.pay-card img { width: 36px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.pay-card b { display: block; font-size: 13.5px; font-weight: 600; }
.pay-card small { display: block; font-size: 12px; color: var(--muted); }
.pay-card .ribbon { top: 8px; left: auto; right: 10px; transform: none; }

.steps-timeline { list-style: none; margin: 0; padding: 0; }
.steps-timeline li {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 0 0 18px 0;
  font-size: 13px; color: var(--text-2);
}
.steps-timeline li:last-child { padding-bottom: 0; }
.steps-timeline .si {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(16, 185, 129, .1);
  border: 1px solid rgba(16, 185, 129, .28);
  color: var(--g1);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.steps-timeline li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px; top: 36px; bottom: 6px;
  width: 1px;
  background: repeating-linear-gradient(180deg, var(--line-2) 0 4px, transparent 4px 8px);
}

/* ==========================================================================
   PAGE: ORDER HISTORY
   ========================================================================== */
.page-title { font-size: 27px; font-weight: 800; margin: 0 0 16px; }

.order-table { width: 100%; }
.order-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 95px 100px 150px 215px;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 95px 100px 150px 215px;
  gap: 14px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.order-row:last-child { border-bottom: 0; }
.order-row:hover { background: #101317; }

.o-item { display: flex; align-items: center; gap: 14px; min-width: 0; }
.o-item img { width: 70px; height: 50px; border-radius: 9px; object-fit: cover; flex: 0 0 auto; background: #0a0c0e; }
.o-item b { font-size: 14px; font-weight: 700; }

.o-price { font-size: 15px; font-weight: 700; color: var(--g1); }
.o-date { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.st {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 11px;
  border-radius: 7px;
  font-size: 12px; font-weight: 600;
}
.st-done    { background: rgba(16, 185, 129, .12); color: var(--g1);    border: 1px solid rgba(16, 185, 129, .3); }
.st-pending { background: rgba(251, 191, 36, .12); color: var(--amber); border: 1px solid rgba(251, 191, 36, .3); }
.st-cancel  { background: rgba(120, 130, 145, .12);color: var(--text-2);border: 1px solid var(--line-2); }
.st-refund  { background: rgba(59, 130, 246, .12); color: var(--blue);  border: 1px solid rgba(59, 130, 246, .3); }

.o-actions { display: flex; align-items: center; gap: 8px; }
.o-actions .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; padding: 0 10px; }

.spend-box .amount { font-size: 31px; font-weight: 800; color: var(--g1); margin: 10px 0 0; }

/* ==========================================================================
   PAGE: REVIEWS
   ========================================================================== */
.rating-summary { display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.rating-big {
  text-align: center;
  padding-right: 30px;
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
}
.rating-big .score { font-size: 50px; font-weight: 800; line-height: 1; }
.rating-big .stars { display: flex; gap: 3px; justify-content: center; margin: 10px 0 7px; color: var(--amber); }
.rating-big .stars .ico { width: 16px; height: 16px; }
.rating-big small { font-size: 12.5px; color: var(--muted); }

.rating-bars { flex: 1 1 260px; min-width: 0; }
.rbar { display: flex; align-items: center; gap: 12px; padding: 4px 0; font-size: 12.5px; color: var(--text-2); }
.rbar .lab { width: 32px; display: flex; align-items: center; gap: 4px; }
.rbar .lab .ico { width: 11px; height: 11px; color: var(--amber); }
.rbar .track { flex: 1 1 auto; height: 7px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.rbar .fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--g3), var(--g1)); }
.rbar .pct { width: 48px; text-align: right; color: var(--muted); }

.review { display: flex; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review > img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.review-main { flex: 1 1 auto; min-width: 0; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-head b { font-size: 14px; }
.review-stars { display: flex; gap: 2px; color: var(--amber); }
.review-stars .ico { width: 13px; height: 13px; }
.review-date { margin-left: auto; font-size: 12px; color: var(--muted); }
.review-main p { margin: 9px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.85; }
.review-product {
  display: inline-flex; align-items: center; gap: 11px;
  margin-top: 12px;
  padding: 7px 14px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 12.5px;
}
.review-product img { width: 48px; height: 33px; border-radius: 6px; object-fit: cover; }

/* ==========================================================================
   PAGE: HOW TO BUY
   ========================================================================== */
.step-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-top: 24px; }
.step-card {
  position: relative;
  padding: 28px 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: center;
}
.step-card .num {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--g2);
  color: #04150e;
  font-size: 14px; font-weight: 800;
  display: grid; place-items: center;
}
.step-card .si {
  width: 58px; height: 58px;
  margin: 6px auto 15px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: rgba(16, 185, 129, .1);
  border: 1px solid rgba(16, 185, 129, .28);
  color: var(--g1);
}
.step-card .si .ico { width: 26px; height: 26px; }
.step-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.step-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.8; }

.faq {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel-2);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary > .ico:last-child { margin-left: auto; color: var(--muted); transition: transform .18s; }
.faq[open] summary { color: var(--g1); }
.faq[open] summary > .ico:last-child { transform: rotate(180deg); color: var(--g1); }
.faq .ans { padding: 0 18px 16px 48px; font-size: 13px; color: var(--text-2); line-height: 1.9; }

.cta-band {
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  padding: 26px 30px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(16, 185, 129, .28);
  background: linear-gradient(120deg, rgba(16, 185, 129, .13), rgba(14, 16, 19, .5));
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.cta-band h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.cta-band p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.cta-band .btn { margin-left: auto; }

/* ==========================================================================
   PAGE: HELP CENTER
   ========================================================================== */
.help-hero-search { max-width: 620px; margin-top: 20px; }
.help-hero-search .search { height: 52px; border-radius: 12px; flex: 1 1 auto; }
.help-hero-search .search input { font-size: 14.5px; }

.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.topic {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  transition: border-color .18s, transform .18s;
}
.topic:hover { border-color: rgba(16, 185, 129, .4); transform: translateY(-2px); }
.topic .ti { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }
.topic b { display: block; font-size: 15px; margin-bottom: 7px; }
.topic p { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.topic .n { font-size: 12px; color: var(--g1); }

.art-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.art-row:last-child { border-bottom: 0; }
.art-row:hover { background: #13161a; }
.art-row > .ico:first-child { color: var(--muted); }
.art-row .views { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ==========================================================================
   PAGE: TERMS / PRIVACY
   ========================================================================== */
.legal { counter-reset: legal-sec; }
.legal-sec { padding: 18px; border-bottom: 1px solid var(--line); }
.legal-sec:last-child { border-bottom: 0; }
.legal-sec h3 {
  display: flex; align-items: center; gap: 11px;
  margin: 0 0 12px;
  font-size: 15px; font-weight: 700;
}
.legal-sec h3::before {
  counter-increment: legal-sec;
  content: counter(legal-sec);
  width: 27px; height: 27px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .3);
  color: var(--g1);
  font-size: 12.5px;
}
.legal-sec p { margin: 0 0 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.95; }
.legal-sec p:last-child { margin-bottom: 0; }
.legal-sec ul { margin: 0; padding-left: 21px; font-size: 13.5px; color: var(--text-2); line-height: 1.95; }
.legal-sec li { padding: 2px 0; }
.legal-sec li::marker { color: var(--g1); }
.legal-sec b { color: var(--text); }
.legal-updated { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.legal-updated .ico { color: var(--muted); }

/* ==========================================================================
   PAGE: ACCOUNT SETTINGS
   ========================================================================== */
.avatar-row {
  display: flex; align-items: center; gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.avatar-row img { width: 78px; height: 78px; border-radius: 20px; object-fit: cover; flex: 0 0 auto; }
.avatar-row b { display: block; font-size: 15px; }
.avatar-row small { display: block; font-size: 12.5px; color: var(--muted); margin: 5px 0 12px; }
.avatar-row .btn + .btn { margin-left: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; margin-top: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.fld > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
/* ข้อความอธิบายใต้ช่องกรอก — เดิมมีแต่ใน auth.css ทำให้หน้าอื่นตัวโตผิดปกติ */
.hint { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.fld textarea.field { height: auto; min-height: 96px; padding: 12px; resize: vertical; line-height: 1.75; }
.switch { position: relative; width: 44px; height: 24px; margin-left: auto; flex: 0 0 auto; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  display: block; width: 44px; height: 24px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  transition: background .18s, border-color .18s;
}
.switch .track::after {
  content: '';
  position: absolute; top: 4px; left: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: rgba(16, 185, 129, .25); border-color: rgba(16, 185, 129, .55); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--g1); }

.panel.danger { border-color: rgba(240, 85, 109, .3); }
.panel.danger h4 { color: var(--red); }
.btn-danger { border-color: rgba(240, 85, 109, .5); color: var(--red); background: transparent; }
.btn-danger:hover { background: rgba(240, 85, 109, .12); }

/* ==========================================================================
   PAGE: CONTACT SUPPORT
   ========================================================================== */
.channel { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.channel:last-child { border-bottom: 0; }
.channel .ci { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.channel b { display: block; font-size: 13.5px; }
.channel small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.channel .go { margin-left: auto; color: var(--muted); }

.upload-box {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.upload-box:hover { border-color: rgba(16, 185, 129, .5); }
.upload-box .ico { color: var(--g1); }
.upload-box small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ==========================================================================
   MODAL (รายละเอียดคำสั่งซื้อ)
   ========================================================================== */
.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 4, 5, .74);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.35; }
.modal-head p { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); }
.modal-head .st { flex: 0 0 auto; margin-top: 3px; }
.modal-x { margin-left: 4px; background: none; border: 0; padding: 4px; color: var(--muted); line-height: 0; flex: 0 0 auto; }
.modal-x:hover { color: var(--text); }

.modal-body { padding: 20px 22px; }
.modal-sec + .modal-sec { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal-sec.first-vis { margin-top: 0; padding-top: 0; border-top: 0; }
.modal-sec h4 { margin: 0 0 13px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-sec h4 .ico { color: var(--g1); }

.modal-foot {
  display: flex; gap: 10px; align-items: center;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
}
.modal-foot .btn-primary { margin-left: auto; }

.cred-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 13px;
}
.cred-row + .cred-row { margin-top: 9px; }
.cred-k { width: 104px; flex: 0 0 auto; color: var(--muted); }
.cred-v {
  flex: 1 1 auto; min-width: 0;
  font-weight: 600;
  font-family: Consolas, 'Courier New', monospace;
  word-break: break-all;
}
.cred-btn {
  flex: 0 0 auto;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 11.5px;
  display: flex; align-items: center; gap: 5px;
}
.cred-btn:hover { border-color: rgba(16, 185, 129, .5); color: var(--g1); }
.cred-btn.copied { border-color: rgba(16, 185, 129, .6); color: var(--g1); }

.tips { list-style: none; counter-reset: tip; margin: 0; padding: 0; }
.tips li {
  counter-increment: tip;
  display: flex; gap: 12px;
  padding: 7px 0;
  font-size: 13px; color: var(--text-2); line-height: 1.7;
}
.tips li::before {
  content: counter(tip);
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(16, 185, 129, .14);
  color: var(--g1);
  font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center;
  margin-top: 1px;
}

.modal-empty {
  display: flex; gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 13px; color: var(--text-2); line-height: 1.75;
}
.modal-empty .ico { flex: 0 0 auto; margin-top: 2px; color: var(--muted); }

.warn-box {
  display: flex; gap: 12px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 10px;
  background: rgba(251, 191, 36, .07);
  font-size: 12.5px; color: var(--text-2); line-height: 1.75;
}
.warn-box .ico { color: var(--amber); flex: 0 0 auto; margin-top: 2px; }

body.modal-open { overflow: hidden; }

/* ==========================================================================
   ข้อความแจ้งเตือน / ข้อความในฟอร์ม / ข้อมูลไอดีใน modal
   ========================================================================== */
.toast-wrap {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 44px));
}
.toast {
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .8);
  font-size: 13.5px;
  animation: toast-in .18s ease-out;
}
.toast.ok  { border-color: rgba(16, 185, 129, .45); }
.toast.err { border-color: rgba(240, 85, 109, .5); color: #ffd9df; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.form-msg { margin: 4px 0 0; font-size: 13px; min-height: 0; }
.form-msg.err { color: var(--red); margin: 14px 0 0; }
.form-msg.ok  { color: var(--g1); margin: 14px 0 0; }

.cred-block + .cred-block { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.cred-idx { font-size: 12px; color: var(--muted); margin-bottom: 9px; }

/* กล่องโต้ตอบกลาง (แทน alert / confirm / prompt) ------------------------- */
.dlg-box { max-width: 440px; }

.dlg-head { display: flex; gap: 15px; padding: 24px 24px 0; }
.dlg-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .3);
  color: var(--g1);
}
.dlg-box.danger .dlg-icon {
  background: rgba(240, 85, 109, .12);
  border-color: rgba(240, 85, 109, .35);
  color: var(--red);
}
.dlg-head h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; }
.dlg-head p { margin: 8px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.75; }

.dlg-body { padding: 20px 24px 0; }
.dlg-body:empty { display: none; }
.dlg-body .fld label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.dlg-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 22px 24px 24px;
}

.dlg-stars { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.dlg-star { background: none; border: 0; padding: 3px; line-height: 0; color: var(--line-2); transition: transform .12s; }
.dlg-star:hover { transform: scale(1.12); }
.dlg-star .ico { width: 32px; height: 32px; }
.dlg-star.on { color: var(--amber); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* ≤1500 — จอโน้ตบุ๊กกว้าง ------------------------------------------------- */
@media (max-width: 1500px) {
  .cat-grid, .game-grid, .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ≤1400 -------------------------------------------------------------------- */
@media (max-width: 1400px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ≤1250 — แท็บเล็ตแนวนอน --------------------------------------------------- */
@media (max-width: 1250px) {
  .pd-cols { grid-template-columns: 1fr; }
  /* stretch สำคัญ — ไม่งั้นลูกในแนวตั้งจะกว้างเท่าเนื้อหาแทนที่จะเต็มความกว้าง */
  .pd-top { flex-direction: column; align-items: stretch; }
  .pd-gallery { flex: 1 1 auto; max-width: 100%; width: 100%; }
  .amount-grid, .pay-grid { grid-template-columns: repeat(2, 1fr); }
  .order-head { display: none; }
  .order-row { grid-template-columns: minmax(0, 1fr) 130px; row-gap: 10px; align-items: start; }
  .o-item    { grid-column: 1 / -1; }
  .o-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .o-actions .btn { flex: 0 0 auto; }
  .step-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ≤1180 — คอลัมน์หลัก + แถบขวาเรียงลงมา ------------------------------------ */
@media (max-width: 1180px) {
  .layout { flex-direction: column; align-items: stretch; }
  .layout > .col-main { width: 100%; }
  .layout > .col-rail { width: 100%; flex: 1 1 auto; }
  .rail-stack { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-bar { grid-template-columns: repeat(2, 1fr); }
  .spec-row { grid-template-columns: 150px 1fr; }
}

/* ≤1000 -------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .cat-grid, .game-grid, .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-2col, .form-grid { grid-template-columns: 1fr; }
  .rating-big { border-right: 0; padding-right: 0; }
}

/* ≤900 — เมนูกลายเป็นลิ้นชัก ------------------------------------------------ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .2s;
    box-shadow: 0 0 40px rgba(0, 0, 0, .6);
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  /* ฉากหลังสีเข้มตอนเปิดเมนู — กดที่ใดก็ได้เพื่อปิด */
  body.nav-open::before {
    content: '';
    position: fixed; inset: 0;
    z-index: 39;
    background: rgba(3, 4, 5, .62);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .nav-burger { display: grid; }

  .main { width: 100%; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { gap: 12px; padding: 0 14px; }
  .top-actions { gap: 12px; }
  .search { flex: 1 1 auto; }
  .kbd, .top-btn span, .user-chip .u-name, .user-chip .u-bal { display: none; }
  .user-chip { min-width: 0; }
  .hero-body h1 { font-size: 30px; }
  .hero-art, .page-hero .hero-art { opacity: .28; }
  .filters, .filters-wide { width: 100%; flex: 1 1 auto; }
  .col-main .layout { flex-direction: column; }

  .hero-title-row h1 { font-size: 28px; }
  .page-title { font-size: 24px; }
  .pd-title { font-size: 23px; }
  .item-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 16px; }

  /* แท็บเลื่อนแนวนอนแทนการล้นออกนอกจอ */
  .tabs { overflow-x: auto; overflow-y: hidden; gap: 20px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; margin-bottom: 0; }
}

/* ≤700 — มือถือแนวนอน / แท็บเล็ตเล็ก ---------------------------------------- */
@media (max-width: 700px) {
  .cat-grid, .game-grid, .topic-grid, .step-cards { grid-template-columns: 1fr; }
  .cta-band { padding: 20px; }
  .cta-band .btn { margin-left: 0; }
  .amount-grid, .pay-grid { grid-template-columns: 1fr; }
  .custom-amount { flex-wrap: wrap; }
  .custom-amount .inp { width: 100%; max-width: 100%; margin-left: 0; }
  .order-row { grid-template-columns: 1fr; }

  /* มุมมองแบบรายการ กลับไปเป็นการ์ดแนวตั้งเมื่อพื้นที่ไม่พอ */
  .cat-grid.is-list .cat-card { flex-direction: column; }
  .cat-grid.is-list .cat-thumb { flex: 1 1 auto; aspect-ratio: 293 / 118; }
  .cat-grid.is-list .cat-btn { width: 100%; }
  .game-grid.is-list .game-card { flex-direction: column; }
  .game-grid.is-list .game-banner { flex: 1 1 auto; }
  .game-grid.is-list .game-icon { bottom: -22px; }
  .game-grid.is-list .game-body { padding: 30px 16px 16px; }
  .listing-grid.is-list .card { flex-direction: column; }
  .listing-grid.is-list .card-thumb { flex: 1 1 auto; aspect-ratio: 222 / 140; }
  .listing-grid.is-list .card-body { flex-direction: column; align-items: stretch; gap: 0; }
  .listing-grid.is-list .card-price { margin: 0 0 12px; }
  .listing-grid.is-list .card-foot { border-top: 1px solid var(--line); margin-top: auto; padding-top: 11px; }

  .spec-row { grid-template-columns: 1fr; gap: 2px; padding: 7px 0; }
  .avatar-row { flex-wrap: wrap; }
  .review-date { margin-left: 0; }
  .rating-summary { gap: 20px; }
  .modal-foot { flex-wrap: wrap; }
  .help-hero-search .search { height: 46px; }
  /* ระยะติดลบมีไว้ให้บรรทัดนี้ไปอยู่ข้างแถบหน้า — จอแคบแถบหน้าขึ้นบรรทัดใหม่แล้ว */
  .page-note { margin-top: 10px; }

  /* ฟอร์มเรียง/ค้นหาในแถบเครื่องมือ — เต็มความกว้างแทนความกว้างตายตัว */
  .toolbar > form { flex: 1 1 100%; }
  .toolbar > form .field { width: 100% !important; }
}

/* ≤640 — มือถือ ------------------------------------------------------------- */
@media (max-width: 640px) {
  .content {
    padding: 14px max(14px, env(safe-area-inset-right)) 20px max(14px, env(safe-area-inset-left));
  }
  .listing-grid, .listing-grid.cols-3 { grid-template-columns: 1fr; }
  .rail-stack { grid-template-columns: 1fr; }
  .feature-bar { grid-template-columns: 1fr; padding: 16px; }
  .stat-row { grid-template-columns: 1fr; }

  .hero { min-height: 0; }
  .hero-body { padding: 22px 18px; max-width: 100%; }
  .hero-body h1 { font-size: 26px; }
  .hero-sub { font-size: 15px; }
  .hero-points { gap: 12px 18px; margin: 14px 0 18px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .page-hero { padding: 18px 16px 20px; }
  .page-hero h1 { font-size: 26px; }
  .page-hero p { font-size: 13.5px; }
  .hero-title-row { gap: 12px; }
  .hero-title-row h1 { font-size: 24px; }
  .hero-icon, .hero-game-icon { width: 48px; height: 48px; border-radius: 13px; }
  .hero-icon .ico { width: 24px; height: 24px; }
  .hero-badge { height: 36px; padding: 0 12px; font-size: 12px; }

  .panel-pad { padding: 14px; }
  .panel-head { padding: 13px 14px; }
  .breadcrumb { flex-wrap: wrap; }
  .toolbar { gap: 10px; }
  .page-title { font-size: 22px; }
  .card-title, .o-item b, .pd-title { overflow-wrap: anywhere; }
  .o-item img { width: 56px; height: 40px; }
  .pagination { flex-wrap: wrap; }
  .price-box .price { font-size: 28px; }
  .wallet-box { margin: 12px; padding: 14px; }
  .wallet-box .amount { font-size: 26px; }
  .amount-card .amt { font-size: 22px; }
  .custom-amount { padding: 14px; }
  .sum-total b { font-size: 20px; }
  .review { padding: 14px; gap: 12px; }
  .review > img { width: 38px; height: 38px; }
  .step-card { padding: 24px 16px 20px; }
  .topic { padding: 16px; }
  .faq summary { padding: 13px 14px; }
  .faq .ans { padding: 0 14px 14px; }
  .art-row { padding: 12px 14px; flex-wrap: wrap; }

  /* หน้าต่างซ้อน — ใช้พื้นที่จอเกือบเต็มบนมือถือ */
  .modal { padding: 10px; }
  .modal-box { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .modal-head { padding: 16px 16px 14px; }
  .modal-head h3 { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 14px 16px 16px; }
  .dlg-head { padding: 20px 18px 0; }
  .dlg-body { padding: 16px 18px 0; }
  .dlg-foot { padding: 18px 18px 20px; }
  .dlg-foot .btn { flex: 1 1 auto; }
  .cred-row { flex-wrap: wrap; }
  .cred-k { width: auto; }
  .cred-btn { margin-left: auto; }
  .cred-v { flex: 1 1 100%; order: 3; }
}

/* ≤560 — แถบบนแยกเป็นสองแถว ------------------------------------------------- */
@media (max-width: 560px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }
  .nav-burger { order: -1; margin-left: -6px; }
  .top-actions { order: 2; margin-left: auto; }
  .search { order: 3; flex: 1 1 100%; }
  .admin-title { font-size: 15.5px; }
}

/* ≤480 — จอแคบสุด ----------------------------------------------------------- */
@media (max-width: 480px) {
  .stat-card { padding: 14px; }
  .user-dropdown { width: min(250px, calc(100vw - 24px)); }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .o-actions { flex-wrap: wrap; }
  .o-actions .btn { flex: 1 1 auto; }
  .chips { gap: 8px; }
  .chip { height: 40px; padding: 0 14px; }
}

/* ทัชสกรีน ------------------------------------------------------------------ */
@media (hover: none) {
  /* เอฟเฟกต์ยกการ์ดค้างอยู่หลังแตะบนจอสัมผัส */
  .card:hover, .cat-card:hover, .game-card:hover, .topic:hover { transform: none; }
}

@media (pointer: coarse) {
  /* ขยายพื้นที่กดให้ถึง 44px โดยขนาดที่มองเห็นเท่าเดิม */
  .buy-btn, .fav-star, .modal-x, .top-btn, .brand-toggle, .cred-btn, .pd-nav, .nav-burger { position: relative; }
  .buy-btn::after, .fav-star::after, .modal-x::after, .top-btn::after,
  .brand-toggle::after, .cred-btn::after, .pd-nav::after {
    content: '';
    position: absolute; top: 50%; left: 50%;
    width: 44px; height: 44px;
    transform: translate(-50%, -50%);
  }
}

@media (pointer: coarse) and (max-width: 900px) {
  /* iOS ซูมหน้าจอเองถ้าตัวอักษรในช่องกรอกเล็กกว่า 16px */
  .field, select.field, textarea.field, .search input, .input-wrap input { font-size: 16px; }
  .check { padding: 8px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
