/* ดูรอหวย (DooRohuay) — โทนเขียวมรกตเข้ม + ทอง + แดงมงคล
 * ชุดสีหลัก (ลูกค้ากำหนด ต.ค. 2026): พื้น #061F18 · การ์ด #10352B · ทอง #E5B83F · ทองสว่าง #F8DC7A
 * ตัวหนังสือ #FFF9EA · ปุ่มสำคัญ/ปุ่มแทงหวย แดงส้ม #F04438 */

:root {
  /* Keep page controls below the iOS status bar in edge-to-edge/PWA mode. */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --bg:        #061f18;
  --bg-2:      #082a20;
  --panel:     #10352b;
  --panel-2:   #164237;
  --line:      #1f4d3f;

  --gold:      #e5b83f;
  --gold-lt:   #f8dc7a;
  --gold-dp:   #a8842a;

  --ink:       #fff9ea;
  --ink-dim:   #d6d0bc;
  --ink-mute:  #93a596;

  --red-btn:   #f04438;  /* ปุ่มสำคัญ / ปุ่มแทงหวย */
  --red-btn-dp: #c4301f;

  --radius:    14px;
  --shadow:    0 18px 50px rgba(0, 0, 0, .55);
  --wrap:      1240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/*
 * Prompt เป็นฟอนต์ทรงเรขาคณิต ตัวกว้างและช่องในตัวอักษรโปร่งกว่า Sarabun
 * จึงต้องปรับสองอย่างตามไปด้วย ไม่งั้นจะดูอึดอัดและรกตา
 *   1. ลดขนาดลงครึ่งพอยต์ — ที่ 15px ตัวจะดูใหญ่เกินไปเทียบกับฟอนต์เดิม
 *   2. เพิ่มระยะบรรทัดเป็น 1.72 — สระบนกับวรรณยุกต์ของ Prompt สูงกว่า
 *      ถ้าใช้ 1.65 เท่าเดิม ไม้เอกของบรรทัดล่างจะเกือบชนสระอุของบรรทัดบน
 */
body {
  margin: 0;
  /* แสงทองเรืองจาง ๆ จากหัวเว็บ */
  background:
    radial-gradient(1000px 340px at 50% -120px, rgba(229, 184, 63, .15), transparent 65%),
    var(--bg);
  color: var(--ink);
  font-family: "Prompt", "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*
 * หัวข้อใช้ระยะบรรทัดแคบกว่าเนื้อความ
 * หัวข้อมักสั้นแค่บรรทัดสองบรรทัด ถ้าปล่อยหลวมเท่าเนื้อความจะดูหลุดออกจากกัน
 * และบีบระยะห่างตัวอักษรนิดหน่อย ตัวใหญ่ ๆ ของ Prompt จะได้เกาะกลุ่มกัน
 */
h1, h2, h3, .brand-name, .sec-title, .btn {
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* ดาวจาง ๆ เป็นพื้นหลัง — ทำจาก gradient ล้วน ไม่ต้องโหลดรูปเพิ่ม */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(244, 217, 139, .55), transparent),
    radial-gradient(1px 1px at 68% 8%,  rgba(244, 217, 139, .40), transparent),
    radial-gradient(1px 1px at 84% 34%, rgba(244, 217, 139, .50), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(244, 217, 139, .30), transparent),
    radial-gradient(1px 1px at 52% 84%, rgba(244, 217, 139, .35), transparent),
    radial-gradient(1200px 600px at 50% -10%, rgba(12, 68, 51, .55), transparent 70%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { width: min(var(--wrap), 92vw); margin-inline: auto; position: relative; z-index: 1; }

/* --------------------------------- หัวเว็บ --------------------------------- */
.site-head {
  position: sticky;
  top: 0;
  padding-top: var(--safe-area-top);
  z-index: 50;
  background: rgba(4, 28, 21, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.head-in { display: flex; align-items: center; gap: 22px; padding: 14px 0; }

.brand { display: flex; align-items: center; gap: 10px; flex: none; text-decoration: none; }
.brand-mark-tv {
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(229, 184, 63, 0.4));
}
.brand-text-col { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-size: 23px; font-weight: 900; letter-spacing: .2px;
  background: linear-gradient(180deg, #fff2be 0%, #f8dc7a 40%, #e5b83f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
.brand-sub {
  display: block; font-size: 10.5px; color: #8ec3b2; letter-spacing: 0.5px; font-weight: 600;
  margin-top: 1px;
}

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 8px 15px; border-radius: 999px; font-size: 14px;
  color: var(--ink-dim); border: 1px solid transparent; transition: .18s;
}
.nav a:hover { color: var(--gold-lt); border-color: var(--line); background: var(--panel); }
.nav a.on {
  color: #1a1204; font-weight: 700;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
  border-color: var(--gold);
}

/* ช่องค้นหายืดกินที่ว่างของ header (รื้อ UI 5 ส.ค. 2026 — ตามเว็บตัวอย่าง) */
.search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 430px; margin-left: auto; }
.search input {
  flex: 1; min-width: 0; padding: 9px 16px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; outline: none; transition: .18s;
}
.search input::placeholder { color: var(--ink-mute); }
.search input:focus { border-color: var(--gold-dp); }
.search button {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--gold-dp); border-radius: 50%; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold)); color: #1a1204;
}

/* แบนเนอร์เรื่องแนะนำถูกเอาออกแล้ว — CSS ของมันลบทิ้งไปด้วย ไม่เหลือของตาย */

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-dim); background: var(--panel);
}
.chip.gold { border-color: var(--gold-dp); color: var(--gold-lt); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 26px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--gold); cursor: pointer; transition: .18s;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold)); color: #1a1204;
  /*
   * ห้ามให้ข้อความบนปุ่มขึ้นบรรทัดใหม่
   * ปุ่มเป็นวงรี (border-radius 999px) พอข้อความขึ้นสองบรรทัดจะกลายเป็นวงกลมป้อม ๆ
   * ที่สูงผิดจากปุ่มข้างเคียง แถวปุ่มจึงดูสูงต่ำไม่เท่ากันทั้งแถว
   */
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: var(--panel); color: var(--gold-lt); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold-dp); }

/* --------------------------------- หัวข้อ --------------------------------- */
/* ---- หัวข้อ section แบบใหม่ (รื้อ UI 5 ส.ค. 2026): เหรียญไอคอนทอง + ชื่อ + คำโปรยรอง ---- */
.sec { margin: 44px 0; }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.sec-ico {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 19px; color: #241903;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp));
  box-shadow: 0 6px 18px rgba(229, 184, 63, .28);
}
.sec-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sec-title {
  margin: 0; font-size: 20px; font-weight: 800; line-height: 1.35;
  background: linear-gradient(100deg, var(--ink) 30%, var(--gold-lt) 85%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sec-sub { font-size: 12px; color: var(--ink-mute); display: flex; align-items: center; gap: 7px; }
.sec-sub .dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 8px #3ddc84; }
.sec-more {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--gold); padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px; transition: .18s;
}
.sec-more:hover { color: var(--gold-lt); border-color: var(--gold-dp); }

.rule { height: 1px; border: 0; margin: 44px 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }

/* ---------------------------------- การ์ด ---------------------------------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }

/*
 * การ์ดแบบกล่องเต็มใบ (รื้อ UI 5 ส.ค. 2026 ตามเว็บตัวอย่าง):
 * รูป + แถบข้อมูลอยู่ในกล่องพื้นเข้มขอบมนใบเดียวกัน
 * ป้ายพากย์/ซับ = เม็ดยาทองมุมขวาบน · ป้ายจำนวนตอน = เม็ดยาดำมุมล่างซ้ายของรูป
 */
.card {
  position: relative; display: block; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); transition: .22s;
}
.card:hover { border-color: var(--gold-dp); transform: translateY(-4px); box-shadow: var(--shadow); }
.card-art {
  /* โปสเตอร์จากตัวอัปโหลดเป็น 480×636 ทุกแพลตฟอร์ม — กรอบต้องตรงสัดส่วนนี้
   * ไม่งั้น object-fit: cover จะตัดขอบรูป (ตัวอักษรบนโปสเตอร์หายข้าง) */
  position: relative; aspect-ratio: 480/636; overflow: hidden; background: var(--panel);
}
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.card-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp));
  color: #241903; box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
}
.card-ep {
  position: absolute; bottom: 8px; left: 8px; z-index: 2;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(7, 11, 22, .82); border: 1px solid rgba(229, 184, 63, .35); color: var(--gold-lt);
}
.card-title {
  margin: 9px 10px 0; font-size: 13.5px; line-height: 1.45; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .card-title { color: var(--gold-lt); }
.card-sub {
  font-size: 11.5px; color: var(--ink-mute); margin: 2px 10px 0; padding-bottom: 10px;
  display: flex; align-items: center; gap: 5px;
}

/* แถบความคืบหน้าที่ดูค้างไว้ — เติมด้วย JS จาก localStorage */
.card-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.55); z-index: 2; }
.card-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-lt)); }

/* --------------------------------- เลื่อนแนวนอน --------------------------------- */
/*
 * ความกว้างการ์ดต้องเป็นค่าคงที่ ห้ามใช้ 1fr
 *
 * ใน grid ที่เลื่อนแนวนอน 1fr จะคิดจากความกว้างของกล่อง ไม่ใช่ความกว้างเนื้อหา
 * แถวที่มีการ์ดใบเดียวจึงยืดเต็มจอ (เคยได้ 610px แทนที่จะเป็น 158px)
 * ตรึงเป็น px ไปเลย การ์ดจะเท่ากันทุกแถวไม่ว่าจะมีกี่ใบ
 */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

/*
 * หลัง Swiper เข้าครอบ (ทำใน app.js) โครงจะเปลี่ยนเป็น
 *   .rail-shell > .rail.swiper > .swiper-wrapper > .swiper-slide > .card
 * ต้องล้างกฎ grid ข้างบนทิ้ง ไม่งั้นชนกับ flex ของ Swiper แล้วการ์ดซ้อนกัน
 *
 * เขียนเป็น .rail.swiper (ไม่ใช่แค่ .swiper) เพื่อให้ชนะกฎ .rail ข้างบนด้วยความเฉพาะเจาะจง
 * ถ้า Swiper โหลดไม่ขึ้น คลาสนี้ไม่ถูกใส่ แถวก็ยังเป็น grid ที่เลื่อนได้ตามเดิม
 */
.rail-shell { position: relative; }
.rail.swiper { display: block; overflow: hidden; padding-bottom: 8px; }
.rail.swiper .swiper-wrapper { display: flex; }
.rail.swiper .swiper-slide { width: 158px; flex: 0 0 auto; height: auto; }

/* ==================================================================
 * ชุดรื้อ UI หน้าแรก 5 ส.ค. 2026 — ตามเว็บตัวอย่างที่ลูกค้าเลือก (โทนทองของเรา)
 * ================================================================== */

/* หัวเรื่องใหญ่ไล่เฉดทองกลางหน้า + คำโปรย */
.site-intro { text-align: center; margin: 34px 0 30px; }
.site-h1 {
  margin: 0; font-size: clamp(21px, 3.4vw, 34px); font-weight: 800; line-height: 1.4;
  background: linear-gradient(100deg, var(--gold-lt) 10%, var(--gold) 45%, #e8953a 90%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.site-tag { margin: 6px 0 0; font-size: 14px; color: var(--ink-dim); }

/* ---- เรื่องเด่นเต็มความกว้าง ----
 * โปสเตอร์เป็นแนวตั้ง 480×636 ถ้าขยายเป็นฉากหลังจอกว้างตรง ๆ จะแตก
 * จึงทำสองชั้น: ชั้นหลังเบลอขยาย (บรรยากาศ) + โปสเตอร์คมชิดขวา (จอกว้างเท่านั้น)
 */
/* กล่องสไลด์ครอบ hero — margin อยู่ที่นี่ ตัว .fhero ในสไลด์ต้องเต็มกรอบพอดี
 * overflow:hidden ต้องใส่เอง — สไลด์ถัดไปจะโผล่พ้นขอบขวาก่อน Swiper เริ่มทำงาน (FOUC) */
.fhero-slider { margin: 26px 0 8px; border-radius: 18px; overflow: hidden; }
.fhero-slider .swiper-pagination-bullet { background: var(--ink-mute); opacity: .55; }
.fhero-slider .swiper-pagination-bullet-active { background: var(--gold); opacity: 1; }
.fhero {
  position: relative; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); min-height: 460px;
  display: flex; align-items: flex-end; background: var(--panel);
}
/* สไลด์รูปโฆษณาในแถบแนะนำ — รูปเดียวเต็มกรอบ คลิกได้ทั้งใบ ไม่มีเงา/ตัวอักษรทับ */
.fhero-ad { display: block; padding: 0; }
.fhero-ad::after { content: none; }
.fhero-ad .fhero-ad-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.fhero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(28px) saturate(1.15); transform: scale(1.25); opacity: .5;
}
.fhero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 11, 22, .1) 20%, rgba(7, 11, 22, .93) 82%),
    linear-gradient(100deg, rgba(7, 11, 22, .82) 25%, transparent 65%);
}
.fhero-art {
  position: absolute; right: 44px; bottom: 0; z-index: 1; width: 285px; height: auto;
  border-radius: 14px 14px 0 0; border: 1px solid var(--gold-dp); border-bottom: 0;
  box-shadow: var(--shadow);
}
.fhero-in { position: relative; z-index: 2; max-width: 640px; padding: 44px 44px 40px; }
.fhero-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; padding: 5px 13px; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp)); color: #241903;
  box-shadow: 0 6px 18px rgba(229, 184, 63, .3);
}
.fhero-title { margin: 14px 0 0; font-size: clamp(24px, 3.6vw, 40px); font-weight: 800; line-height: 1.3; }
.fhero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; color: var(--ink-dim); font-size: 14px; }
.fhero-meta .bi-eye { color: var(--gold); }
.fhero-syn {
  margin: 12px 0 0; color: var(--ink-dim); font-size: 14px; max-width: 560px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.fhero-act { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.fhero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* เลขอันดับบนการ์ดแถวยอดนิยม */
.ranked { position: relative; display: block; }
.rank-n {
  position: absolute; top: -7px; left: -7px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #241903;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp));
  box-shadow: 0 5px 14px rgba(0, 0, 0, .5);
}

/* ปุ่มลอยกลับขึ้นบนสุด — โผล่เมื่อเลื่อนลงมาแล้ว (JS ใส่คลาส on) */
.to-top {
  /* เว้นเหนือปุ่ม LINE: ฐาน 68px + พื้นที่ปุ่ม 44px + ช่องว่าง 12px และขอบจอ */
  position: fixed; right: 18px; bottom: calc(68px + 44px + 12px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 19px; color: #241903;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: .22s;
}
.to-top.on { opacity: 1; visibility: visible; transform: none; }

/* -------------------------------- หน้าเรื่อง -------------------------------- */
.detail { display: grid; grid-template-columns: 250px 1fr; gap: 34px; margin: 30px 0; }
.detail-poster { border-radius: 14px; border: 1px solid var(--gold-dp); overflow: hidden; box-shadow: var(--shadow); }
/*
 * height:auto จำเป็น — img มี attribute height ติดมาจาก HTML ถ้าไม่ทับด้วย CSS
 * ความสูงจะถูกล็อกตายตัว แล้ว aspect-ratio ใด ๆ จะถูกเมิน (เจอเป็นบัคโปสเตอร์
 * โดนบีบกรอบแคบแล้ว object-fit ตัดข้อความในรูปทิ้ง) — ให้รูปสูงตามสัดส่วนจริงของมัน
 */
.detail-poster img { width: 100%; height: auto; }
.detail h1 { margin: 0 0 10px; font-size: clamp(23px, 3vw, 34px); line-height: 1.3; }
.synopsis { color: var(--ink-dim); margin: 0 0 20px; max-width: 76ch; }

.ep-grid { display: grid; gap: 9px; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.ep {
  display: grid; place-items: center; padding: 11px 6px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); font-size: 14px;
  font-variant-numeric: tabular-nums; transition: .15s; position: relative; overflow: hidden;
}
.ep:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.ep.seen { color: var(--ink-mute); }
.ep.seen::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: linear-gradient(90deg, var(--gold-dp), var(--gold));
}
.ep.now { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-lt), var(--gold)); color: #1a1204; font-weight: 700; }
.ep.off { opacity: .34; pointer-events: none; }

/* --------------------------------- หน้าเล่น --------------------------------- */
/*
 * ซีรีส์สั้นถ่ายแนวตั้ง (1080×1920) ห้ามบังคับกรอบเป็น 16/9
 * ไม่งั้นวิดีโอจะหดไปอยู่กลางจอ มีแถบดำกินพื้นที่สองข้างเกินครึ่ง
 * ปล่อยให้วิดีโอกำหนดสัดส่วนเอง แล้วคุมแค่ความสูงไม่ให้ล้นจอ
 */
.player-wrap {
  position: relative;   /* จุดยึดของแผ่นนับถอยหลัง .next-up ที่ทับอยู่ข้างบน */
  display: grid; place-items: center;
  background: #000; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  margin-inline: auto;
}
/*
 * คลิปแนวตั้ง: บีบกรอบให้กว้างพอดีตัวคลิป ไม่งั้นได้กล่องดำเต็มจอที่มีคลิปเล็ก ๆ อยู่ตรงกลาง
 * ใส่คลาสด้วย JS หลังรู้สัดส่วนจริงของไฟล์ — บังคับจาก CSS ล่วงหน้าไม่ได้
 */
.player-wrap.portrait { max-width: min(430px, 100%); }
.player-wrap video {
  display: block;
  width: auto; max-width: 100%;
  max-height: min(76vh, 720px);
  background: #000;
}
.player-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 26px; }
.player-nav { display: flex; gap: 9px; }

/* Plyr วางตัวเองแทน <video> — ต้องคุมความสูงที่ตัวมันแทน ไม่ใช่ที่ <video> ข้างใน */
.player-wrap .plyr { width: 100%; max-height: min(76vh, 720px); }
.player-wrap.portrait .plyr { max-height: min(80vh, 860px); }
.player-wrap .plyr video { max-height: inherit; }

/*
 * <video> ต้องอยู่กลางกล่องที่ห่อมันเสมอ
 *
 * <video> เป็น block element ที่ความกว้างคิดจากเนื้อหา เวลาถูกจำกัดความสูงไว้
 * มันจะแคบกว่ากล่อง แล้วชิดซ้ายตามค่าเริ่มต้นของ block
 * ปกติมองไม่เห็นเพราะ .player-wrap.portrait บีบกล่องเหลือ 430px พอดีตัวคลิปอยู่แล้ว
 */
.player-wrap .plyr__video-wrapper {
  display: flex; align-items: center; justify-content: center;
}

/*
 * เต็มจอ
 * --------------------------------------------------------------------------
 * ตอนเต็มจอ กล่องของ Plyr กว้างเท่าจอ (1920) แต่คลิปแนวตั้งกว้างแค่ราว 600
 * ตัวบีบกล่อง 430px ใช้ไม่ได้แล้ว เพราะของที่เต็มจออยู่ในชั้นบนสุดของหน้า
 * ไม่ได้อยู่ในกรอบของพ่อมันอีกต่อไป — คลิปจึงไปกองอยู่ซ้ายมือ เหลือพื้นดำครึ่งจอ
 *
 * ⚠️ ห้ามแก้ด้วยการตั้ง width:auto + height:100%
 *    วิธีนั้นพึ่งให้เบราว์เซอร์คำนวณความกว้างจากสัดส่วนไฟล์เอง ซึ่งเชื่อไม่ได้
 *    เมื่อมีกฎ max-width/max-height จากที่อื่นมาผสม ลองแล้วได้สัดส่วน 0.755
 *    ทั้งที่ไฟล์จริงเป็น 0.563 — ภาพยืดออกข้างจนหน้าคนผิดรูป
 *
 *    ใช้ object-fit: contain แทน สั่งให้กล่องเต็มจอไปเลย แล้วบอกว่า
 *    "เอาภาพมาใส่ให้พอดีกรอบ" เบราว์เซอร์จะย่อตามสัดส่วนจริงและจัดกลางให้เอง
 *    ไม่มีทางยืดผิดรูปไม่ว่ากฎอื่นจะมาผสมยังไง
 *
 * เขียนไว้ที่นี่ไม่ใช่ vendor.css เพราะกฎเรื่องขนาดของ .player-wrap อยู่ไฟล์นี้
 * ถ้าไปเขียนที่ vendor.css จะโดนกฎในไฟล์นี้ทับ (vendor.css โหลดก่อน)
 */
/*
 * ⚠️ ต้องเขียน .plyr.plyr--fullscreen-active ติดกัน ห้ามเขียนแค่ .plyr--fullscreen-active
 *    เพราะตัวที่ต้องเอาชนะคือ ".player-wrap.portrait .plyr" ซึ่งมี 3 คลาส
 *    ถ้าเขียน ".player-wrap .plyr--fullscreen-active" จะมีแค่ 2 คลาส = แพ้
 *    ผลคือเต็มจอแล้วยังติดเพดาน 80vh คลิปสูงแค่ 656px บนจอ 820px
 */
.player-wrap .plyr.plyr--fullscreen-active { max-height: none; }
.player-wrap .plyr.plyr--fullscreen-active .plyr__video-wrapper { height: 100%; }
.player-wrap .plyr--fullscreen-active video {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  object-fit: contain;
}

/*
 * แผ่นนับถอยหลังไปตอนถัดไป
 * ทับบนวิดีโอไม่ใช่ดันเนื้อหาลง ไม่งั้นหน้าจะกระตุกตอนตอนจบพอดี
 */
.next-up {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: rgba(4, 7, 15, .84);
  backdrop-filter: blur(7px);
  animation: next-up-in .22s ease-out;
}
@keyframes next-up-in { from { opacity: 0; } }
.next-up-in { text-align: center; padding: 22px; }
.next-up-t { margin: 0 0 16px; font-size: 16px; color: var(--ink-dim); }
.next-up-t b {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px;
  margin: 0 4px; border-radius: 50%; font-size: 17px; color: #1a1204;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
  font-variant-numeric: tabular-nums;
}
.next-up-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/*
 * ภาพนิ่งของเฟรมสุดท้าย ค้างทับไว้ระหว่างสลับไฟล์
 *
 * ระหว่างที่เบราว์เซอร์ล้างตัวเล่นเพื่อโหลดไฟล์ใหม่ ตรงนั้นจะว่างเปล่าชั่วขณะ
 * เอาภาพเฟรมสุดท้ายมาค้างไว้แทน ตาจึงไม่เห็นรอยต่อ — เหมือนภาพเดินต่อไปเรื่อย ๆ
 */
.freeze {
  position: absolute; z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;      /* ใช้ตอน "จางออก" เท่านั้น */
}
/*
 * ⚠️ ตอนขึ้นต้องทันที ห้ามมี transition
 *    ถ้าให้ค่อย ๆ ชัดขึ้น ระหว่างนั้นจะยังเห็นความว่างข้างหลังอยู่ดี
 *    ซึ่งคือสิ่งเดียวกับที่ตั้งใจจะกลบพอดี
 *    ส่วนตอนเอาออกค่อยจางได้ เพราะข้างหลังมีภาพวิดีโอจริงรออยู่แล้ว
 */
.player-wrap.swapping .freeze { opacity: 1; transition: none; }

/*
 * ระหว่างสลับต้องซ่อนของที่ Plyr เด้งขึ้นมาตอนกลับสู่สถานะ "หยุด"
 * ปุ่มเล่นวงกลมกลางจอกับแถบควบคุมที่โผล่เอง — ทั้งคู่บอกผู้ชมผิดว่าหยุดไปแล้ว
 */
.player-wrap.swapping .plyr__control--overlaid,
.player-wrap.swapping .plyr__poster { opacity: 0 !important; visibility: hidden !important; }
.player-wrap.swapping .plyr__controls { opacity: 0; transition: opacity .1s; }

/*
 * ป้ายเลขตอนที่แวบขึ้นมาตอนเปลี่ยนตอนในโหมดรวมตอน
 * แทนที่จะเด้งแจ้งเตือนมุมจอ ซึ่งคนดูรวดเดียวเป็นชั่วโมงจะเจอทุก 3 นาที
 * วางไว้มุมบนซ้ายเหนือแถบควบคุม แล้วจางหายเองใน 2.6 วินาที
 */
.ep-flash {
  position: absolute; top: 14px; left: 14px; z-index: 4;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--gold-lt);
  background: rgba(4, 7, 15, .82); border: 1px solid var(--gold-dp);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
}
.ep-flash.on { animation: ep-flash 2.6s ease-out; }
@keyframes ep-flash {
  0%   { opacity: 0; transform: translateY(-6px); }
  10%  { opacity: 1; transform: none; }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .ep-flash.on { animation-duration: 2.6s; } }

/* กำลังขอลิงก์ตอนถัดไปในโหมดรวมตอน — บอกว่าไม่ได้ค้าง กำลังทำงานอยู่ */
.player-wrap.loading::after {
  content: ""; position: absolute; inset: 0; z-index: 4;
  background: rgba(4, 7, 15, .55) no-repeat center;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 42 42'%3E%3Ccircle cx='21' cy='21' r='17' fill='none' stroke='%231e2a52' stroke-width='4'/%3E%3Cpath d='M21 4a17 17 0 0 1 17 17' fill='none' stroke='%23d4af37' stroke-width='4' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 21 21' to='360 21 21' dur='.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
}

/* ==========================================================================
   Popup แทงหวยลอยระหว่างการดูวิดีโอ (Watch Lottery Floating Popup)
   ========================================================================== */
.watch-lotto-popup {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: calc(100% - 20px);
  max-width: 430px;
  background: rgba(2, 28, 19, 0.94);
  border: 1px solid rgba(16, 185, 129, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 14px rgba(16, 185, 129, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  user-select: none;
  pointer-events: auto;
  box-sizing: border-box;
  animation: watchLottoPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.watch-lotto-popup.closing {
  animation: watchLottoPopOut 0.28s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes watchLottoPopIn {
  from {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes watchLottoPopOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.92);
  }
}

.watch-lotto-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.watch-lotto-flag {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.watch-lotto-flag .flag-badge {
  width: 100%;
  height: 100%;
  display: block;
}

.watch-lotto-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}

.watch-lotto-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.watch-lotto-sub {
  font-size: 10.5px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}

.watch-lotto-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.watch-lotto-digits {
  display: flex;
  align-items: center;
  gap: 2px;
}

.watch-lotto-num {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-width: 20px;
  text-align: center;
  line-height: 1.25;
}

.watch-lotto-colon {
  color: #34d399;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
}

.watch-lotto-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  font-size: 8px;
  color: #6ee7b7;
  text-align: center;
  margin-top: 1px;
  opacity: 0.9;
}

.watch-lotto-right {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.watch-lotto-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff !important;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}

.watch-lotto-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.03);
}

.watch-lotto-btn:active {
  transform: scale(0.97);
}

.watch-lotto-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.15s ease;
}

.watch-lotto-close:hover {
  color: #ffffff;
}

@media (max-width: 380px) {
  .watch-lotto-popup {
    padding: 5px 8px;
    gap: 5px;
  }
  .watch-lotto-flag {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }
  .watch-lotto-title {
    font-size: 12px;
  }
  .watch-lotto-sub {
    font-size: 9.5px;
  }
  .watch-lotto-num {
    font-size: 11.5px;
    padding: 1px 3px;
    min-width: 17px;
  }
  .watch-lotto-btn {
    font-size: 11.5px;
    padding: 4px 9px;
  }
}

/* ตัวช่วยจำวิธีใช้ */
.keyhint { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 22px; font-size: 12px; color: var(--ink-mute); }
.keyhint kbd {
  font: inherit; font-size: 11px; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
}
.keyhint-tap {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
}
.keyhint-tap .bi { color: var(--gold); }

/*
 * มือถือไม่มีคีย์บอร์ด ให้เหลือแต่คำอธิบายการแตะ
 * เดิมซ่อนทั้งแถว ซึ่งทำให้คนบนมือถือไม่มีทางรู้เลยว่าแตะสองครั้งกรอได้
 */
@media (max-width: 900px) {
  .keyhint > span:not(.keyhint-tap) { display: none; }
  .keyhint-tap { font-size: 11.5px; }
}

/* -------------------------------- แบ่งหน้า -------------------------------- */
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 36px 0; }
.pager a, .pager span {
  min-width: 40px; padding: 9px 13px; text-align: center; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); font-size: 14px; color: var(--ink-dim);
}
.pager a:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.pager .on { background: linear-gradient(180deg, var(--gold-lt), var(--gold)); color: #1a1204; border-color: var(--gold); font-weight: 700; }

/* ============================ แถบเมนูล่าง (จอเล็ก) ============================
 * ซ่อนบนจอใหญ่ — ที่นั่นเมนูอยู่บนหัวเว็บซึ่งเห็นตลอดอยู่แล้ว
 * ============================================================================ */
/*
 * แถบเมนูล่าง — แสดง "ทุกขนาดจอ" (รื้อ UI 5 ส.ค. 2026 ตามเว็บตัวอย่าง:
 * เขาใช้เมนูล่างทั้งเดสก์ท็อปและมือถือ header เหลือแค่โลโก้กับช่องค้นหา)
 * จอกว้างจำกัดความกว้างปุ่มแล้วจัดกลาง ไม่งั้นปุ่ม 4 ตัวกระจายกันคนละมุมจอ
 */
.bnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: grid; grid-template-columns: repeat(5, minmax(60px, 120px));
    justify-content: center;
    background: linear-gradient(180deg, #07261c 0%, #03140e 100%);
    backdrop-filter: blur(16px);
    border-top: 1.5px solid rgba(229, 184, 63, 0.45);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bnav-i {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 4px 8px; min-height: 58px;
    background: none; border: 0; cursor: pointer;
    color: #ffffff; font: inherit; font-size: 11px; font-weight: 500;
    transition: color .16s ease, transform .16s ease;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
  }
  .bnav-i svg { width: 22px; height: 22px; flex: none; }
  .bnav-i span { line-height: 1.2; letter-spacing: 0.2px; }
  .bnav-i:hover, .bnav-i:focus-visible { color: #f0cf65; }

  /* ปุ่มแทงหวยตรงกลางเด่นเป็นเหรียญทอง ตามแบบภาพเป๊ะ */
  .bnav-center-btn {
    position: relative;
    top: -22px;
    min-height: 64px;
  }
  .bnav-center-circle {
    width: 58px; height: 58px; border-radius: 50%;
    background: #06241a;
    border: 2px solid #ecd07d;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7), 0 0 16px rgba(236, 208, 125, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 3px;
    transition: transform .18s ease, box-shadow .18s ease;
  }
  .bnav-center-btn:hover .bnav-center-circle {
    transform: scale(1.08);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.8), 0 0 24px rgba(236, 208, 125, 0.65);
  }
  .bnav-coin-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }
  .bnav-center-text {
    font-size: 11.5px; font-weight: 600;
    color: #ffffff; margin-top: 5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  }

  /* หน้าที่กำลังอยู่ — สีทองสว่าง ตามแบบภาพ */
  .bnav-i.on { color: #f0cf65; font-weight: 700; }
  .bnav-dot { width: 21px; height: 21px; font-size: 11px; }

  /*
   * กันไม่ให้แถบล่างทับเนื้อหาท้ายหน้า
   * ต้องเผื่อที่เท่าความสูงแถบ + แถบขีดของเครื่อง ไม่งั้นลิงก์แถวสุดท้ายกดไม่ได้
   */
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }

  /* แจ้งเตือนต้องลอยเหนือแถบล่าง ไม่ใช่ซ่อนอยู่ใต้มัน */
  .toast-stack { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

  /*
   * หัวเว็บบนจอเล็กตัดเมนูหมวดกับปุ่มบัญชีออก — ย้ายลงไปอยู่แถบล่างหมดแล้ว
   * เหลือแค่โลโก้กับช่องค้นหา หัวเว็บจึงเตี้ยลง ได้พื้นที่อ่านเนื้อหาเพิ่ม
   */
  .site-head .acct-nav { display: none; }
  .head-in { padding: 11px 0; }

/* --------------------------------- ท้ายเว็บ --------------------------------- */
.site-foot { margin-top: 60px; border-top: 1px solid var(--line); background: var(--bg-2); }

/*
 * ⚠️ align-items ต้องกำหนดเองทั้งสองชั้น ห้ามปล่อยเป็นค่าเริ่มต้น
 *
 * ค่าเริ่มต้นของ flex คือ stretch — ลูกจะยืดสูงเท่าตัวที่สูงที่สุดในแถวเดียวกัน
 * ที่นี่มีการยืดซ้อนกันสองชั้น:
 *   .foot-links โดนยืดให้สูงเท่ากล่องชื่อเว็บ (63px)
 *   แล้วปุ่มข้างในก็โดนยืดตาม .foot-links อีกที
 * ผลคือปุ่มที่ควรสูง 34px กลายเป็น 63px หน้าตาเป็นก้อนกลม ๆ ป้อม ๆ
 *
 * ที่หายากคือมันโผล่เฉพาะ "จอกว้างพอให้สองกล่องอยู่แถวเดียวกัน" (ราว 1000px ขึ้นไป)
 * จอแคบกว่านั้นสองกล่องขึ้นคนละแถว แต่ละแถวสูงเท่าเนื้อหาตัวเอง เลยดูปกติดี
 */
.foot-in {
  padding: 34px 0;
  display: flex; flex-wrap: wrap; gap: 26px;
  align-items: flex-start;
  justify-content: space-between;
}
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.foot-links a {
  font-size: 13px; color: var(--ink-dim); padding: 5px 11px;
  border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap;      /* ชื่อหมวดยาว ๆ ห้ามขึ้นบรรทัดใหม่จนปุ่มบวม */
  transition: .16s;
}
.foot-links a:hover { color: var(--gold-lt); border-color: var(--gold-dp); }
.foot-links a.foot-lotto-gold {
  border-color: rgba(229, 184, 63, 0.45);
  color: #f5d77f;
  background: rgba(229, 184, 63, 0.08);
  font-weight: 500;
}
.foot-links a.foot-lotto-gold:hover {
  background: rgba(229, 184, 63, 0.22);
  border-color: #e5b83f;
  color: #fff;
}
.foot-links a.foot-lotto-line {
  border-color: rgba(6, 199, 85, 0.45);
  color: #2ee279;
  background: rgba(6, 199, 85, 0.08);
  font-weight: 600;
}
.foot-links a.foot-lotto-line:hover {
  background: #06c755;
  border-color: #06c755;
  color: #fff;
}
.foot-note { font-size: 12.5px; color: var(--ink-mute); max-width: 52ch; }

/*
 * จอแคบ: ให้กล่องชื่อเว็บกับแถวลิงก์กว้างเต็มแถว
 * ไม่งั้น justify-content: space-between จะดันสองกล่องไปคนละมุมจนดูขาดจากกัน
 */
@media (max-width: 700px) {
  .foot-in { flex-direction: column; gap: 20px; padding: 28px 0; }
  .foot-links { width: 100%; }
}

.crumbs { font-size: 12.5px; color: var(--ink-mute); margin: 20px 0 4px; }
.crumbs a:hover { color: var(--gold-lt); }
.crumbs span { margin: 0 7px; opacity: .5; }

.empty { text-align: center; padding: 70px 20px; color: var(--ink-dim); }
.empty h2 { color: var(--gold-lt); font-size: 22px; margin: 0 0 8px; }

/* ============================ หน้าแจ้งปัญหา ============================
 * ใช้ร่วมกันทั้ง 404 (ไม่พบหน้า) และ 503 (เชื่อมต่อไม่ได้)
 * ====================================================================== */
.oops { text-align: center; padding: 56px 20px 20px; position: relative; }

/* เลข 404 ตัวใหญ่จาง ๆ เป็นฉากหลัง ไม่ใช่ตัวเอก — ตัวเอกคือช่องค้นหา */
.oops-num {
  font-size: clamp(84px, 17vw, 168px);
  font-weight: 700; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(180deg, var(--gold-lt), rgba(168, 132, 42, .18));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 4px;
  filter: drop-shadow(0 12px 40px rgba(229, 184, 63, .16));
}
.oops-num-sm { font-size: clamp(56px, 11vw, 92px); color: var(--gold-dp); background: none; -webkit-text-fill-color: currentColor; }

.oops-t { margin: 0 0 10px; font-size: clamp(21px, 4vw, 28px); color: var(--gold-lt); }
.oops-p { margin: 0 auto 28px; color: var(--ink-dim); max-width: 46ch; }

.oops-search {
  display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
  max-width: 520px; margin: 0 auto 22px;
}
.oops-search input {
  flex: 1; min-width: 210px; padding: 13px 20px; font: inherit; font-size: 15px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; outline: none; transition: .18s;
}
.oops-search input::placeholder { color: var(--ink-mute); }
.oops-search input:focus { border-color: var(--gold-dp); background: var(--panel-2); }

.oops-links { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.oops-links .btn { font-size: 14px; padding: 10px 20px; }

@media (max-width: 640px) {
  .oops { padding-top: 34px; }
  .oops-search input { min-width: 0; }
  .oops-links .btn { font-size: 13px; padding: 9px 15px; }
}

/* ========================= แถบโหลดบนสุดของจอ =========================
 * บาง สูงแค่ 3px และอยู่เหนือทุกอย่าง — บอกว่ากำลังทำงานโดยไม่บังเนื้อหา
 * ==================================================================== */
.nprog {
  position: fixed; top: var(--safe-area-top); left: 0; right: 0; height: 3px;
  z-index: 2000; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.nprog.on { opacity: 1; }
.nprog i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-dp), var(--gold), var(--gold-lt));
  box-shadow: 0 0 12px rgba(229, 184, 63, .75);
  transition: width .18s ease-out;
}

/* ===================== ลายวิ่งตอนรูปยังโหลดไม่เสร็จ =====================
 * โปสเตอร์มาจาก CDN ของ Discord ซึ่งบางครั้งช้า
 * ระหว่างรอจะเป็นกล่องว่างเปล่าที่ดูเหมือนรูปเสีย ใส่ลายวิ่งไว้แทน
 * ==================================================================== */
.card-art, .detail-poster {
  background-image: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* รูปโหลดเสร็จแล้ว — หยุดลายวิ่งแล้วให้รูปจางเข้ามา ไม่ใช่กระตุกโผล่ */
.card-art img, .detail-poster img { opacity: 0; transition: opacity .35s ease; }
.card-art img.on, .detail-poster img.on { opacity: 1; }
.card-art:has(img.on), .detail-poster:has(img.on) { animation: none; }

/*
 * เบราว์เซอร์เก่าที่ไม่รู้จัก :has() จะข้ามกฎข้างบนไป ลายวิ่งจะวิ่งอยู่ใต้รูปตลอด
 * มองไม่เห็นเพราะรูปทับอยู่ แต่กิน CPU ฟรี ๆ — ตัดทิ้งด้วยการเช็คว่ารองรับไหม
 */
@supports not selector(:has(*)) {
  .card-art, .detail-poster { animation: none; }
  .card-art img, .detail-poster img { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .card-art, .detail-poster { animation: none; }
  .card-art img, .detail-poster img { transition: none; opacity: 1; }
}

/* --------------------------------- จอเล็ก --------------------------------- */
@media (max-width: 900px) {
  /*
   * จอแคบ: จัดเป็น 2 แถว — แถวบน โลโก้ + บัญชี · แถวล่าง ค้นหา + เมนูหมวด
   * ต้องกำหนด order ให้ครบทุกตัว ไม่งั้นตัวที่ไม่ได้กำหนดจะไปกองรวมกันแถวบนแบบสุ่มลำดับ
   */
  .head-in { flex-wrap: wrap; gap: 10px 12px; }
  .brand    { order: 1; }
  .acct-nav { order: 2; margin-left: auto; }
  .search   { order: 3; width: 100%; }
  .search input { width: 100%; }
  .search input:focus { width: 100%; }
  .nav      { order: 4; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .nav a    { white-space: nowrap; }

  /* จอแคบ: hero เตี้ยลง ไม่มีโปสเตอร์คมข้าง (ที่ไม่พอ) — เหลือฉากหลังเบลอ + ข้อความ */
  .fhero { min-height: 380px; }
  .fhero-art { display: none; }
  .fhero-in { padding: 26px 20px 26px; }
  .site-intro { margin: 24px 0 20px; }

  /*
   * หน้าเรื่องจอแคบ (ผู้ใช้สั่ง 10 ส.ค. 2026: "pc อยู่ที่เดิม ย้ายแค่ mobile"):
   * ปลดคอลัมน์ซ้ายด้วย display:contents แล้วจัดลำดับ — โปสเตอร์ (กึ่งกลาง) →
   * เนื้อหา+รายการตอน → โฆษณาไปท้ายสุด (= ใต้รายการตอน) เรียงแนวนอนย่อพอดี
   */
  .detail { grid-template-columns: 1fr; gap: 22px; }
  .detail > div:first-child { display: contents; }
  .detail-poster { width: 178px; margin: 0 auto; order: -1; }
  .detail .ad-row-series {
    order: 10; margin-top: 4px;
    flex-direction: row; flex-wrap: nowrap; justify-content: center;
  }
  .detail .ad-row-series .ad-box { flex: 1 1 0; min-width: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px; }
  .rail { grid-auto-columns: 132px; gap: 13px; }
  .rail.swiper .swiper-slide { width: 132px; }   /* ต้องตรงกับ .rail ข้างบน ไม่งั้นการ์ดสองแบบไม่เท่ากัน */
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
  .player-bar { flex-direction: column; align-items: stretch; }
  .player-nav { justify-content: space-between; }
}

/*
 * แถวปุ่มใต้ตัวเล่นบนจอแคบ
 * ---------------------------------------------------------------------------
 * ปุ่ม 4 ตัวพร้อมข้อความไทยเต็ม ๆ ยาวเกินจอมือถือ ผลคือปุ่มสุดท้าย (เฟือง) หลุดออกนอกจอ
 * และข้อความในปุ่มขึ้นบรรทัดสองจนปุ่มบวมสูงไม่เท่ากัน
 *
 * เหลือแต่ไอคอนสำหรับปุ่มรอง ส่วน "ตอนถัดไป" เป็นปุ่มที่คนกดบ่อยที่สุด
 * จึงคงข้อความไว้และให้กินที่ที่เหลือทั้งหมด — กดง่ายที่สุดในแถว
 */
@media (max-width: 640px) {
  .player-nav { display: flex; gap: 8px; width: 100%; }
  .player-nav .btn { padding: 11px 15px; font-size: 14px; flex: none; }
  .player-nav .btn-t { display: none; }
  .player-nav .btn-main { flex: 1; min-width: 0; }
  .player-nav .btn .bi { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------ บัญชีผู้ใช้ ------------------------------ */
.acct-nav { position: relative; flex: none; }

/* ปุ่มกลม — ยังไม่ล็อกอินเป็นรูปคน ล็อกอินแล้วเป็นอักษรตัวแรกของชื่อ */
.acct-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel); color: var(--ink-dim); transition: .18s;
}
.acct-btn svg { width: 20px; height: 20px; }
.acct-btn:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.acct-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold-lt); }

.acct-dot {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 50%; font-weight: 800; font-size: 14px; color: #1a1204;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
}
.acct-dot.lg { width: 40px; height: 40px; font-size: 17px; flex: none; }

/* ---- เมนูที่กางออกมา ---- */
/*
 * ⚠️ การจัดตำแหน่ง (absolute/top/right) ต้องผูกกับ .acct-nav เท่านั้น
 *
 * รายการเมนูชุดเดียวกันถูกใช้ซ้ำในแผงที่เลื่อนขึ้นจากล่างบนจอเล็กด้วย
 * ถ้าเขียน position: absolute ไว้บน .acct-menu ลอย ๆ แผงล่างจะพังทันที —
 * เนื้อหาหลุดออกจากการไหลปกติ กล่องเลยสูงศูนย์ เห็นแต่หัวแผงกับพื้นที่ว่าง
 * ส่วนตัวเมนูจริงไปโผล่ใต้จอเพราะ top: calc(100% + 10px)
 *
 * ที่เหลือ (หน้าตาของแต่ละรายการ) ปล่อยไว้บน .acct-menu ได้ เพราะใช้ร่วมกันทั้งสองที่
 */
.acct-nav .acct-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  min-width: 216px; padding: 7px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); box-shadow: var(--shadow);
  animation: acct-in .13s ease-out;
}
@keyframes acct-in { from { opacity: 0; transform: translateY(-5px); } }
.acct-menu[hidden] { display: none; }

.acct-menu-head {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px 12px; margin-bottom: 5px; border-bottom: 1px solid var(--line);
}
.acct-menu-head b { display: block; font-size: 14px; }
.acct-menu-head em { display: block; font-size: 11.5px; color: var(--ink-mute); font-style: normal; }
.acct-menu-note { padding: 10px 11px 12px; margin-bottom: 5px; font-size: 12.5px; color: var(--ink-mute); border-bottom: 1px solid var(--line); }

/* ลิงก์กับปุ่มออกจากระบบต้องหน้าตาเหมือนกัน (ตัวหลังเป็น <button> เพราะต้องส่งแบบ POST) */
.acct-menu a,
.acct-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 11px; border-radius: 9px; font: inherit; font-size: 14px; text-align: left;
  color: var(--ink-dim); background: none; border: 0; cursor: pointer; transition: .14s;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--panel-2); color: var(--gold-lt); }
.acct-menu svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.acct-menu form { margin: 5px 0 0; padding-top: 5px; border-top: 1px solid var(--line); }

.acct {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
}
.acct-avatar {
  width: 62px; height: 62px; flex: none; display: grid; place-items: center;
  border-radius: 50%; font-size: 26px; font-weight: 800; color: #1a1204;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
}

.btn.fav-on { border-color: var(--gold); color: var(--gold-lt); }

/* -------------------------------- ฟอร์ม -------------------------------- */
.auth-card {
  max-width: 420px; margin: 44px auto 70px; padding: 32px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 25px; }
.auth-note { color: var(--ink-mute); font-size: 13.5px; margin: 0 0 20px; }
.auth-swap { text-align: center; margin: 20px 0 0; font-size: 13.5px; color: var(--ink-dim); }
.auth-swap a { color: var(--gold); }
.auth-swap a:hover { color: var(--gold-lt); }

.fld { display: block; margin-bottom: 15px; }
.fld > span { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 6px; }
.fld > span em { color: var(--ink-mute); font-style: normal; }
.fld input {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; outline: none; transition: .18s;
}
.fld input:focus { border-color: var(--gold-dp); background: var(--panel-2); }
.hint { display: block; font-size: 11.5px; color: var(--ink-mute); margin-top: 5px; font-style: normal; }

/* ============================== หน้าบัญชี ==============================
 * ซ้าย = ตัวตน (ดูอย่างเดียว)  ·  ขวา = การตั้งค่า (ลงมือทำ)
 * แยกกันแบบนี้ตากวาดหาของเจอเร็วกว่าไล่ลงเป็นพืดยาว ๆ
 * ==================================================================== */
.page-h { margin: 22px 0 20px; font-size: clamp(22px, 3vw, 27px); }

.acct-page { display: grid; grid-template-columns: 316px 1fr; gap: 22px; align-items: start; }

@media (max-width: 900px) {
  .acct-page { grid-template-columns: 1fr; gap: 16px; }
}

/*
 * กล่องเรียงลงล่างคอลัมน์เดียว — สำหรับหน้าที่มีเนื้อหาชุดเดียว เช่น หน้าแก้ไขเรื่อง
 * มีไว้เพื่อไม่ให้ใครเผลอเอา .acct-page ไปใช้กับหน้าที่ไม่มีคอลัมน์ซ้าย
 * (ถ้าใช้ เนื้อหาจะไปนั่งในช่อง 316px แล้วบีบจนอ่านไม่ได้)
 *
 * 860px ≈ ยาวประมาณ 90 ตัวอักษรต่อบรรทัดในฟอนต์นี้ — กว้างกว่านี้ตาจะไล่บรรทัดไม่ทัน
 */
.edit-stack { display: grid; gap: 22px; max-width: 860px; }

/*
 * ⚠️ ลูกของ grid มี min-width:auto โดยปริยาย = หดให้เล็กกว่าเนื้อหาข้างในไม่ได้
 *    การ์ดที่มีตาราง DataTables อยู่ข้างในจึงถูกดันกว้างกว่าจอ ทั้งที่ตาราง
 *    ครอบด้วยกล่องเลื่อน (.adm-tbl) แล้ว — ทั้งหน้าเลยมีแถบเลื่อนล่างบนมือถือ
 *    min-width:0 คืนสิทธิ์ให้การ์ดหดตามจอ แล้วปล่อยให้กล่องเลื่อนทำงานของมัน
 */
.edit-stack > * { min-width: 0; }

@media (max-width: 900px) {
  .edit-stack { gap: 16px; }
}

/* ---- คอลัมน์ซ้าย ---- */
.acct-side {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
  /*
   * ตรึงไว้ตอนเลื่อน จะได้เห็นตลอดว่ากำลังตั้งค่าของบัญชีไหนอยู่
   * เว้นระยะจากหัวเว็บที่ก็ตรึงอยู่เหมือนกัน ไม่งั้นซ้อนทับกัน
   */
  position: sticky; top: 86px;
}
@media (max-width: 900px) { .acct-side { position: static; } }

.acct-id { text-align: center; padding: 26px 20px 20px; border-bottom: 1px solid var(--line); }
.acct-id .acct-avatar { margin: 0 auto 13px; width: 72px; height: 72px; font-size: 30px; }
.acct-name { font-size: 18px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.acct-at { font-size: 13px; color: var(--ink-mute); margin-top: 2px; }
.acct-mail { font-size: 12px; color: var(--ink-mute); margin-top: 7px; word-break: break-all; }
.acct-mail .bi { color: var(--gold-dp); }

/* ตัวเลขสองช่อง กดเข้าไปดูรายการจริงได้ ไม่ใช่แค่ป้ายโชว์ */
.acct-stats { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.acct-stats a { padding: 15px 8px; text-align: center; transition: background .16s; }
.acct-stats a + a { border-left: 1px solid var(--line); }
.acct-stats a:hover { background: var(--panel-2); }
.acct-stats b { display: block; font-size: 21px; font-weight: 700; color: var(--gold-lt); font-variant-numeric: tabular-nums; }
.acct-stats em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }

.acct-since {
  padding: 11px 18px; font-size: 11.5px; color: var(--ink-mute);
  border-bottom: 1px solid var(--line); text-align: center;
}
.acct-since .bi { color: var(--gold-dp); }

.acct-quick { display: flex; flex-direction: column; padding: 7px; }
.acct-quick a, .acct-quick button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; border-radius: 10px;
  font: inherit; font-size: 14px; text-align: left; color: var(--ink-dim);
  background: none; border: 0; cursor: pointer; transition: .14s;
}
.acct-quick a:hover, .acct-quick button:hover { background: var(--panel-2); color: var(--gold-lt); }
.acct-quick .bi:first-child { color: var(--gold-dp); font-size: 15px; }
/* ลูกศรท้ายรายการถูกดันไปชิดขวาเสมอ ไม่ว่าข้อความจะยาวสั้นแค่ไหน */
.acct-quick .bi:last-child { margin-left: auto; font-size: 12px; opacity: .5; }

.acct-out { padding: 7px 7px 12px; }
.acct-out .btn { width: 100%; font-size: 13.5px; padding: 10px 16px; }

/* ---- คอลัมน์ขวา ---- */
.acct-main { display: flex; flex-direction: column; gap: 18px; }

.set-card {
  padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
}
.set-card h2 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 7px; font-size: 16px; font-weight: 600;
}
.set-card h2 > .bi { color: var(--gold); font-size: 17px; }
.set-card h2 .tag {
  margin-left: auto; font-size: 12px; font-weight: 500;
  padding: 2px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-mute);
}
.set-card > p { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-mute); line-height: 1.7; }
.set-card > p strong { color: var(--gold-lt); font-weight: 600; }

/* คำเตือนที่ต้องอ่านก่อนกด — ให้ต่างจากคำอธิบายทั่วไปด้วยกรอบและสี */
.set-card > p.warn {
  display: flex; gap: 9px;
  padding: 11px 14px; border-radius: 10px;
  background: rgba(229, 184, 63, .07); border: 1px solid var(--gold-dp);
  color: var(--ink-dim);
}
.set-card > p.warn .bi { color: var(--gold); flex: none; margin-top: 2px; }

.set-form { max-width: 460px; }
.set-form .btn { margin-top: 2px; }
/* สองช่องเคียงกันบนจอกว้าง — รหัสใหม่กับยืนยันควรอยู่ระดับสายตาเดียวกัน */
.fld-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .fld-2 { grid-template-columns: 1fr; gap: 0; } }

/* ---- อุปกรณ์ที่ล็อกอินค้างอยู่ ---- */
.dev-list { display: flex; flex-direction: column; gap: 8px; }
.dev {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg-2);
}
.dev > .bi { color: var(--gold-dp); font-size: 18px; flex: none; }
.dev b { display: block; font-size: 13.5px; font-weight: 500; word-break: break-word; }
.dev em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; line-height: 1.6; }

/* ปุ่มที่ทำแล้วกู้คืนไม่ได้ — ให้สีบอกว่าต้องคิดก่อนกด */
.btn.ghost.dang { color: #f5b5c0; border-color: #5a2430; }
.btn.ghost.dang:hover { border-color: #8d3546; color: #ffd2da; }

/* ============================ หลังบ้านผู้ดูแล ============================ */
.adm-nav { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 22px; }
.adm-nav a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px; font-size: 14px;
  color: var(--ink-dim); border: 1px solid var(--line); background: var(--panel);
  transition: .16s; white-space: nowrap;
}
.adm-nav a:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.adm-nav a.on {
  color: #1a1204; font-weight: 600; border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
}
.adm-nav .adm-out { margin-left: auto; }

/* ---- การ์ดตัวเลขบนแดชบอร์ด ---- */
.adm-cards { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.adm-card {
  display: block; padding: 18px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); transition: .16s;
}
a.adm-card:hover { border-color: var(--gold-dp); transform: translateY(-2px); }
.adm-card > .bi { color: var(--gold-dp); font-size: 18px; }
.adm-card b { display: block; font-size: 27px; font-weight: 700; color: var(--gold-lt); font-variant-numeric: tabular-nums; line-height: 1.25; }
.adm-card em { display: block; font-style: normal; font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

/* ---- ตาราง ---- */
/*
 * ห่อด้วยกล่องที่เลื่อนแนวนอนได้ — ตารางแอดมินมีหลายคอลัมน์ ยัดลงจอมือถือไม่ไหว
 * ปล่อยให้เลื่อนดูดีกว่าบีบจนอ่านไม่ออก
 */
.adm-tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.adm-tbl table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.adm-tbl th {
  text-align: left; padding: 12px 14px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-mute); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.adm-tbl td { padding: 11px 14px; border-bottom: 1px solid rgba(30, 42, 82, .5); vertical-align: middle; }
.adm-tbl tr:last-child td { border-bottom: 0; }
.adm-tbl tbody tr:hover { background: rgba(18, 26, 58, .5); }
.adm-tbl .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-tbl .n em { font-style: normal; color: var(--ink-mute); font-size: 12px; }
.adm-tbl .dim { color: var(--ink-mute); font-size: 12.5px; }
.adm-tbl td b { font-weight: 600; }
.adm-tbl td em { display: block; font-style: normal; }
.adm-tbl .act { white-space: nowrap; text-align: right; }
.adm-tbl tr.me { background: rgba(229, 184, 63, .06); }

.adm-tbl input[type="text"], .adm-tbl input:not([type]), .adm-tbl input[type="number"] {
  width: 100%; min-width: 110px; padding: 7px 10px; font: inherit; font-size: 13px;
  color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.adm-tbl input:focus { border-color: var(--gold-dp); }
.adm-tbl select {
  padding: 6px 10px; font: inherit; font-size: 12.5px; border-radius: 8px;
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); cursor: pointer;
}
/* สีบอกสถานะตั้งแต่ยังไม่ต้องอ่านตัวหนังสือ */
.adm-tbl select.st-published, .adm-tbl select.st-active { border-color: var(--gold-dp); color: var(--gold-lt); }
.adm-tbl select.st-hidden, .adm-tbl select.st-suspended { border-color: #6b2532; color: #f5b5c0; }
.adm-tbl select.rl-admin { border-color: var(--gold); color: var(--gold-lt); font-weight: 600; }

/* ห่อบรรทัดได้เสมอ — บนจอแคบ select กินเต็มแถวแล้วปุ่มตกลงมาบรรทัดใหม่
 * (ไม่ห่อ = ปุ่มถูกดันพ้นขอบจอ ทั้งหน้ามีแถบเลื่อนล่าง) */
.adm-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-status select { min-width: 0; max-width: 100%; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; }

/* checkbox ในฟอร์มตั้งค่าโดนกฎ input{width:100%} ยืดเป็นแถบเต็มจอ — บังคับกลับเป็นสี่เหลี่ยมเล็ก */
.set-form input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--gold); }

/* ====================================================================
 * แถบสถานะเผยแพร่ — หัวหน้าจัดการรายเรื่อง
 * สถานะสำคัญสุดของเรื่อง จึงให้เด่นสุดในหน้า: เผยแพร่อยู่ = เรืองทอง · ปิดอยู่ = ทึบ
 * ==================================================================== */
.pub-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin: 16px 0 6px; padding: 15px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.pub-bar.on {
  border-color: var(--gold-dp);
  background: linear-gradient(135deg, #1a1508, var(--panel) 55%);
}
.pub-state { display: flex; align-items: center; gap: 13px; }
.pub-state > .bi { font-size: 26px; color: var(--ink-mute); }
.pub-bar.on .pub-state > .bi {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(229, 184, 63, .55);
}
.pub-state b { display: block; font-size: 15.5px; }
.pub-bar.on .pub-state b { color: var(--gold-lt); }
.pub-state small { color: var(--ink-mute); font-size: 12.5px; }

/* ====================================================================
 * ตารางแอดมินบนจอแคบ — ซ่อนคอลัมน์รอง ให้คอลัมน์สำคัญอยู่ในจอเสมอ
 *
 * ⚠️ ปัญหาที่แก้: ตารางกว้าง 640px เลื่อนได้ก็จริง แต่บนมือถือไม่มีอะไร
 *    บอกเลยว่าต้องเลื่อน — คอลัมน์สถานะกับปุ่ม "จัดการ" ตกไปอยู่นอกจอ
 *    แอดมินเปิดจากมือถือแล้วทำงานหลักไม่ได้ทั้งที่ปุ่มก็อยู่ตรงนั้น
 *
 *    ทางแก้: จอแคบตัดคอลัมน์ "ดูประกอบ" ทิ้ง (วิว หมวด เวลา ฯลฯ)
 *    เหลือคอลัมน์ที่ใช้ตัดสินใจ + ปุ่มทำงาน แล้วปล่อยตารางกว้างเท่าจอพอดี
 *    ข้อมูลที่ซ่อนไม่หาย — เข้าหน้าจัดการรายตัวเห็นครบ
 *
 *    การซ่อนด้วย CSS ไม่กระทบ DataTables — ค้นหา/เรียงยังเห็นทุกคอลัมน์
 *    (ตั้งใจ: พิมพ์ค้นชื่อหมวดยังเจอเรื่อง แม้คอลัมน์หมวดถูกซ่อนอยู่)
 * ==================================================================== */
@media (max-width: 640px) {
  .adm-tbl .hide-sm { display: none; }
  /* คอลัมน์เหลือน้อยแล้ว ไม่ต้องบังคับกว้าง 640 อีก — พอดีจอ ปุ่มขวาสุดโผล่เสมอ */
  .adm-tbl table { min-width: 100%; }
}
@media (max-width: 480px) {
  .adm-tbl .hide-xs { display: none; }
  /* จอเล็กสุดลดช่องไฟเซลล์ลง — คืนที่ให้คอลัมน์ชื่อกับปุ่มทำงาน */
  .adm-tbl th, .adm-tbl td { padding: 9px 8px; }
}

/* แถบแบ่งหน้าของ DataTables บนจอแคบ: ตัดปุ่ม แรก/สุดท้าย ทิ้ง (กดเลขเอาได้)
 * และให้แถวปุ่มห่อบรรทัดแทนที่จะดันการ์ดให้กว้างกว่าจอ
 * ⚠️ เราใช้ธีม Bootstrap ของ DataTables (datatables-bs) — ปุ่มเป็น .page-link
 *    ไม่ใช่ .dt-paging-button แบบธีมมาตรฐาน (เคยเขียนผิดแล้วปุ่มไม่หาย) */
@media (max-width: 640px) {
  .dt-paging .page-link.first, .dt-paging .page-link.last,
  .dt-paging li:has(> .page-link.first), .dt-paging li:has(> .page-link.last) { display: none; }
  .dt-paging .pagination { flex-wrap: wrap; justify-content: center; }
}

/* เมนูแอดมินบนจอแคบ: แถวเดียวเลื่อนข้างได้ แทนห่อ 3 บรรทัดกินที่ครึ่งจอ */
@media (max-width: 640px) {
  .adm-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .adm-nav::-webkit-scrollbar { display: none; }
  .adm-nav a { white-space: nowrap; flex: none; }
}

/* checkbox ของ Bootstrap ใช้สีน้ำเงินของมันเอง (accent-color เอาไม่อยู่ เพราะมันวาดด้วย
 * background-image) — ทาสีทองให้เข้าธีมทั้งตอนติ๊กและตอนโฟกัส */
.form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
.form-check-input:focus { border-color: var(--gold-dp); box-shadow: 0 0 0 3px rgba(229, 184, 63, .22); }

/* ====================================================================
 * ส่วน SEO (แบบ Rank Math) — คะแนน + ตัวอย่างบน Google + เช็คลิสต์
 * ==================================================================== */
/* ====================================================================
 * กล่องลอย (modal) — Bootstrap เป็นคนเปิด/ปิด เราแค่ทาสีให้เข้าธีม
 * ==================================================================== */
.bc-modal {
  background: var(--panel); border: 1px solid var(--gold-dp);
  border-radius: var(--radius); color: var(--ink);
}
.bc-modal .modal-header, .bc-modal .modal-footer { border-color: var(--line); }
.bc-modal .modal-title { font-size: 16px; display: flex; align-items: center; gap: 9px; }
.bc-modal .modal-title .bi { color: var(--gold); }
.bc-modal .modal-body { display: grid; gap: 14px; }
/* ข้อความยืนยันมีขึ้นบรรทัดใหม่ (&#10;) — ต้องให้แสดงจริง ไม่ยุบเป็นช่องว่าง */
.bc-confirm-msg { margin: 0; white-space: pre-line; line-height: 1.7; }
.bc-modal .modal-footer .btn { min-width: 96px; justify-content: center; }
/* ปุ่มปิด (X) ของ Bootstrap เป็นไอคอนดำ — บนพื้นเข้มต้องกลับเป็นขาว */
.bc-modal .btn-close { filter: invert(1) grayscale(1) brightness(1.8); opacity: .65; }
.bc-modal .btn-close:hover { opacity: 1; }

/* ====================================================================
 * ปุ่มแชร์ในหน้าเรื่อง
 * ปกติเป็นปุ่มโทนกลาง พอชี้/แตะค่อยเปลี่ยนเป็นสีจริงของแพลตฟอร์มนั้น
 * (ถ้าใส่สีจริงตลอดเวลา แถวนี้จะแย่งสายตาไปจากปุ่ม "เริ่มดู" ซึ่งเป็นงานหลักของหน้า)
 * ==================================================================== */
.share-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 16px 0 4px; padding-top: 16px; border-top: 1px solid var(--line);
}
.share-lb { font-size: 12.5px; color: var(--ink-mute); margin-right: 2px; }
.share-lb .bi { color: var(--gold); margin-right: 4px; }

.sh {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; line-height: 1;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-dim);
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.sh .bi { font-size: 15px; }
.sh:hover, .sh:focus-visible { color: #fff; border-color: transparent; }
.sh-line:hover      { background: #06c755; }
.sh-facebook:hover  { background: #1877f2; }
.sh-x:hover         { background: #000; border-color: #555 !important; }
.sh-messenger:hover { background: #a334fa; }
.sh-whatsapp:hover  { background: #25d366; }
.sh-telegram:hover  { background: #29a9eb; }
.sh-native:hover, .sh-copy:hover { background: var(--gold); color: #1a1204; }

/* จอแคบ: เหลือแต่ไอคอน ไม่งั้น 8 ปุ่มกินพื้นที่ครึ่งจอ */
@media (max-width: 560px) {
  .sh span { display: none; }
  .sh { padding: 9px 11px; }
  .sh .bi { font-size: 17px; }
}

/* ป๊อบอัปประกาศ — รูปเต็มความกว้างกล่อง ข้อความคงการขึ้นบรรทัดที่พิมพ์มา */
.popup-img { width: 100%; height: auto; border-radius: 10px; }
.popup-body { margin: 0; white-space: pre-line; line-height: 1.75; color: var(--ink-dim); }

/* ====================================================================
 * หน้ารวมหมวดหมู่ (/หมวดหมู่) — การ์ดหมวดที่ย้ายมาจาก navbar
 * ==================================================================== */
/* min(320px, 100%) — จอที่แคบกว่า 320+ขอบ ไม่งั้น minmax บังคับการ์ดกว้างเกินจอแล้วล้น */
.cat-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.cat-grid > * { min-width: 0; } /* ลูกของ grid มี min-width:auto — บทเรียนเดิม ห้ามลืม */
.cat-card {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: var(--ink); text-decoration: none; transition: .22s;
}
.cat-card:hover { border-color: var(--gold-dp); transform: translateY(-3px); box-shadow: var(--shadow); color: var(--ink); }
/* โปสเตอร์เรื่องเด่นเรียงซ้อนเหลื่อม — ใบแรกอยู่บนสุด (ซ้อนจากขวามาซ้าย) */
.cat-deck { display: flex; flex-shrink: 0; }
.cat-deck img {
  /* height:auto จำเป็น — img มี attr height=636 ถ้าไม่ทับ ความสูงล็อกตายแล้วรูปยืดทั้งการ์ด
   * (บทเรียนเดียวกับ .detail-poster img — พลาดซ้ำในวันเดียวกันตอนเขียนการ์ดนี้ครั้งแรก) */
  width: 54px; height: auto; aspect-ratio: 480/636; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
  box-shadow: -6px 0 12px rgba(0, 0, 0, .45);
}
/*
 * ⚠️ ห้ามใช้ z-index ติดลบตรงนี้ — .cat-card ไม่ได้เป็น stacking context
 *    ลูกที่ z ติดลบจะจมลงไปใต้พื้นหลังการ์ดแล้วหายทั้งใบ ใช้เลขบวกไล่ลำดับแทน
 */
.cat-deck img { position: relative; }
.cat-deck img:nth-child(1) { z-index: 4; }
.cat-deck img:nth-child(2) { z-index: 3; }
.cat-deck img:nth-child(3) { z-index: 2; }
.cat-deck img:nth-child(4) { z-index: 1; }
.cat-deck img + img { margin-left: -32px; }
.cat-deck-empty {
  width: 54px; aspect-ratio: 480/636; border-radius: 8px; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--ink-mute); font-size: 20px;
}
.cat-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cat-card-info b { font-size: 18px; }
.cat-card-info em { font-style: normal; font-size: 13px; color: var(--ink-mute); }
.cat-card-go { color: var(--gold); font-size: 18px; }
/* ทางลัดใต้กริด — ลิงก์ชุดเดียวกับแผงหมวดหมู่บนมือถือ */
.cat-extra { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.cat-extra a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink-dim);
  font-size: 14px; text-decoration: none; transition: .18s;
}
.cat-extra a:hover { color: var(--gold-lt); border-color: var(--gold-dp); }

/* ==================== เรื่องแนะนำ + สถิติ (หลังบ้าน 5 ส.ค. 2026) ==================== */

/* ปุ่มเรียงผลค้น (เพิ่งอัปโหลด / ยอดวิว) — เม็ดยาเล็ก อันที่เลือกเป็นทอง */
.feat-modes { display: flex; gap: 8px; margin-top: 10px; }
.feat-mode {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--ink-dim); transition: .16s;
}
.feat-mode:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.feat-mode.on {
  border-color: transparent; color: #241903; font-weight: 700;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dp));
}

/* ผลค้นหาในกล่องเพิ่มเรื่อง — รายการกดเลือกได้ มีโปสเตอร์ประกอบ */
.feat-results { display: grid; gap: 8px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.feat-hit {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; transition: .16s;
}
.feat-hit:hover { border-color: var(--gold-dp); background: var(--panel-2); }
.feat-hit img { width: 38px; height: auto; aspect-ratio: 480/636; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.feat-hit .fh-info { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: start; }
.feat-hit b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feat-hit em { font-style: normal; font-size: 11.5px; color: var(--ink-mute); }

/* ส่วนตั้งค่าใต้กล่องเพิ่ม — เรียงเป็นแถวโปร่ง ๆ คั่นเส้นบาง */
.feat-opts { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.feat-sortfld { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.feat-sortfld input {
  width: 64px; padding: 6px 10px; text-align: center; font: inherit;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.feat-sortfld em { font-style: normal; font-size: 12px; color: var(--ink-mute); }
.feat-toggle { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.feat-toggle input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--gold); cursor: pointer; }
.feat-toggle span { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.feat-toggle em { font-style: normal; font-size: 12px; color: var(--ink-mute); }
.feat-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-left: 27px; }
.feat-banner > em { font-size: 11.5px; }
.feat-preview { position: relative; flex-basis: 100%; max-width: 340px; }
.feat-preview img { width: 100%; border-radius: 10px; border: 1px solid var(--gold-dp); display: block; }
.feat-preview button { position: absolute; top: 8px; right: 8px; padding: 4px 9px; background: rgba(7, 11, 22, .85); }

/* พรีวิวรูปอัตโนมัติใต้ช่องเลือกไฟล์ — ใช้ทุกหน้าหลังบ้าน (JS สร้างให้ตอนเลือกรูป) */
.file-preview { position: relative; max-width: 300px; margin-top: 10px; }
.file-preview img { width: 100%; border-radius: 10px; border: 1px solid var(--gold-dp); display: block; }
.file-preview button { position: absolute; top: 8px; right: 8px; padding: 4px 9px; background: rgba(7, 11, 22, .85); }

/* เรื่องที่เลือกแล้ว */
.feat-picked {
  display: flex; align-items: center; gap: 14px; margin-top: 4px;
  padding: 12px 14px; border: 1px solid var(--gold-dp); border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
}
.feat-picked img { width: 52px; height: auto; aspect-ratio: 480/636; object-fit: cover; border-radius: 8px; }
.feat-picked .fp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.feat-picked em { font-style: normal; font-size: 12px; color: var(--ink-mute); }

/* SweetAlert2 ให้เข้าธีมเว็บ (ตัว lib เป็นพื้นขาว) */
.bc-swal {
  background: var(--panel-2) !important; color: var(--ink) !important;
  border: 1px solid var(--line); border-radius: 16px !important;
}
.bc-swal .swal2-title { color: var(--ink); font-size: 20px; }
.bc-swal .swal2-html-container { color: var(--ink-dim); }
.bc-swal button.swal2-confirm {
  border: 0; border-radius: 999px; padding: 9px 22px; font: inherit; font-weight: 700;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold)); color: #1a1204; cursor: pointer;
}
.bc-swal button.swal2-cancel, .bc-swal button.swal2-deny {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 20px; font: inherit;
  background: none; color: var(--ink-dim); cursor: pointer; margin-inline: 6px;
}
.bc-swal button.swal2-deny { border-color: #7a2b2b; color: #e08b8b; }
.feat-thumb { height: 40px; border-radius: 7px; border: 1px solid var(--line); }
.feat-prev { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 4px; }
.feat-sort { display: flex; gap: 5px; align-items: center; }
.sort-in {
  width: 58px; padding: 5px 8px; font: inherit; text-align: center;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.chip.warn-c { border-color: #8a5a1f; color: #e8b45a; }
.stat-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); }
.stat-cards > * { min-width: 0; } /* ลูกของ grid — บทเรียนเดิม */
.stat-c {
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  display: flex; flex-direction: column; gap: 3px;
}
.stat-c b {
  font-size: 30px; font-weight: 800; line-height: 1.2;
  background: linear-gradient(100deg, var(--gold-lt), var(--gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-c span { font-size: 13.5px; color: var(--ink-dim); }
.stat-c em { font-style: normal; font-size: 11.5px; color: var(--ink-mute); }
.path-cell { font-size: 12.5px; word-break: break-all; }

/* ==================== แบนเนอร์โฆษณา (9 ส.ค. 2026) ====================
 * top = 728×200 สองชิ้น (จอกว้างเรียงคู่แบบบีบสัดส่วน จอแคบซ้อน) · home-latest = 728×90
 * รูปเสิร์ฟผ่าน /ad/{id} ของเว็บเอง — ไม่มีลิงก์ Discord ในหน้า
 */
.ad-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
/* แถวไม่เต็ม (ใบเดียว/ใบคี่ท้ายสุด) ชิดซ้ายเสมอ ไม่ลอยกลาง (ผู้ใช้สั่ง 10 ส.ค. 2026) */
.ad-row-top { margin-top: 24px; justify-content: flex-start; }
.ad-box {
  position: relative; width: 100%; max-width: 728px; min-width: 0;
  /* จงใจไม่มี border-radius — ลูกค้าสั่งป้ายเหลี่ยมทุกใบ (10 ส.ค. 2026) */
  overflow: hidden; background: var(--panel);
}
/* ใต้ header: แถวละไม่เกิน 2 ใบเสมอ แล้วปัดลงแถวใหม่ไปเรื่อย ๆ (ผู้ใช้ยำ้ 10 ส.ค.
 * — จอกว้างเคยจับ 3 ใบยัดแถวเดียว) ใบคี่ท้ายสุดยืดกึ่งกลางไม่เกิน 728 ตาม max-width เดิม */
.ad-row-top .ad-box { flex: 0 1 calc(50% - 8px); }  /* grow 0 — ใบคี่ท้ายไม่ยืดเกินเพื่อน */
@media (max-width: 720px) {
  /* มือถือเหมือนเดิม — ใบเดียวเต็มแถว */
  .ad-row-top .ad-box { flex-basis: 100%; }
}
.ad-box a { display: block; width: 100%; height: 100%; }
.ad-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ad-thumb { height: 44px; border-radius: 7px; border: 1px solid var(--line); }
/* ---- ตัวจับลากปรับขนาดกล่องข้อความ (แทนมุม resize จิ๋วของเบราว์เซอร์) ---- */
.grip-wrap { position: relative; display: block; width: fit-content; max-width: 100%; }
.grip-wrap textarea { resize: none; display: block; max-width: none; }
.grip {
  position: absolute; right: -6px; bottom: -6px;
  width: 30px; height: 30px; border-radius: 8px; cursor: nwse-resize;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  border: 1px solid var(--gold-dp); background: var(--panel); color: var(--gold);
  touch-action: none;
}
.grip:hover { color: var(--gold-lt); border-color: var(--gold); }

/* ---- โฆษณาวิดีโอก่อนเข้าตอน (preroll — 10 ส.ค. 2026) ----
 * overlay ทับตัวเล่นจริงทั้งผืน · z สูงกว่าชั้นควบคุมของ Plyr
 * ปุ่มข้ามมุมขวาล่างแบบที่ผู้ชมคุ้นเคย · ไม่มีแถบควบคุม = กรอข้ามไม่ได้ */
.player-wrap { position: relative; }
.preroll { position: absolute; inset: 0; z-index: 40; background: #000; }
.preroll video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.preroll-tag {
  position: absolute; top: 10px; left: 10px;
  font-size: 11.5px; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px;
  background: rgba(7, 11, 22, .78); color: var(--ink-dim); pointer-events: none;
}
.preroll-skip {
  position: absolute; right: 12px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 9px 16px;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(7, 11, 22, .82); color: #fff; transition: .15s;
}
.preroll-skip:disabled { cursor: default; color: var(--ink-mute); font-weight: 400; }
.preroll-skip:not(:disabled):hover { border-color: var(--gold); color: var(--gold-lt); }
.preroll-start {
  /* เบราว์เซоร์ห้าม autoplay มีเสียง → ปุ่มกดเริ่มกลางจอ (โฆษณาเล่นพร้อมเสียงเสมอ) */
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  border: 2px solid rgba(255, 255, 255, .55); background: rgba(7, 11, 22, .72); color: #fff;
  transition: .15s;
}
.preroll-start:hover { border-color: var(--gold); color: var(--gold-lt); }

/* ---- ป้ายลอยล่างสุดจอ (slot float — ปรับ 10 ส.ค. 2026 รอบสอง: "เอาแต่รูป") ----
 * ไม่มีแถบพื้นหลัง/กรอบเต็มจอ — เหลือรูปลอยเดี่ยว ๆ พร้อมเงา + ปุ่ม × มุมรูป
 * ⚠️ ตัว container ต้อง pointer-events:none — พื้นที่ว่างซ้ายขวาของรูปให้คลิกทะลุ
 *    ถึงเนื้อหาใต้ได้ (ไม่งั้นแถวล่างของหน้ากดไม่ติดทั้งแถบ) แล้วเปิด auto เฉพาะตัวรูป
 * z-index 2000 อยู่เหนือทุกอย่างตามสั่ง · JS เติม padding-bottom ให้ body ตอนแสดง
 */
.ad-float {
  position: fixed; bottom: 8px; left: 0; right: 0; z-index: 2000;
  display: flex; justify-content: center;
  pointer-events: none;
}
.ad-float-in {
  pointer-events: auto;
  position: relative; width: min(728px, calc(100vw - 20px));
  /* หลายป้ายซ้อนแนวตั้ง (10 ส.ค. รอบสาม) — ป้ายแรกในลำดับอยู่บนสุด */
  display: flex; flex-direction: column; gap: 6px;
}
.ad-float .ad-box {
  width: 100%; max-width: 728px; overflow: hidden;
  box-shadow: 0 10px 38px rgba(0, 0, 0, .6);
}
.ad-float-x {
  /* ปุ่มเดียวกึ่งกลางเหนือป้ายบนสุด — กดปิดทั้งชุด (ลูกค้าสั่ง 10 ส.ค. รอบสาม) */
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  background: var(--panel); color: var(--ink-dim); transition: .16s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
}
.ad-float-x:hover { color: var(--gold-lt); border-color: var(--gold-dp); }

/* หัวกลุ่มโฆษณาต่อตำแหน่ง (หลังบ้าน) */
.ad-group { margin-bottom: 18px; }
.ad-group-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ad-group-h h2 { margin: 0; font-size: 16.5px; display: flex; align-items: center; gap: 9px; }
.ad-group-h h2 i { color: var(--gold); }
/* slot series — จอกว้าง: ใต้โปสเตอร์ ซ้อนแนวตั้ง (ตำแหน่ง PC เดิม — ผู้ใช้ยืนยัน 10 ส.ค.)
 * จอแคบ: CSS ในบล็อก media 900 จัดไปไว้ใต้รายการตอนแบบเรียงแนวนอนแทน */
.ad-row-series { margin: 16px 0 0; flex-direction: column; align-items: center; }
.ad-row-series .ad-box { width: 100%; max-width: 300px; flex: none; }

/* slot series ในหน้าดูคลิป (10 ส.ค. 2026) — โฆษณาชุดเดียวกับหน้าเรื่อง
 * แต่หน้านี้คอลัมน์เดียวกว้าง จึงเรียงสองใบข้างกันเสมอ ย่อคงสัดส่วนบนจอแคบ */
.watch-ads .ad-row-series { flex-direction: row; flex-wrap: nowrap; justify-content: center; margin-top: 26px; }
.watch-ads .ad-row-series .ad-box { width: auto; flex: 1 1 0; min-width: 0; max-width: 300px; }

/* ---- จอเล็ก: โฆษณาเรียงลงมาครบทุกกล่อง (ผู้ใช้ยืนยัน 9 ส.ค. 2026: โชว์ครบแม้เป็น
 * กล่องตัวอย่าง — ให้เห็นภาพว่าแต่ละตำแหน่งลงได้กี่ชิ้น) แค่จัดกลางและย่อให้กะทัดรัด */
@media (max-width: 640px) {
  .ad-row { gap: 10px; margin: 14px 0; }
  .ad-row-top { margin-top: 12px; }
}

/* ---- หน้าระบบ Auto รายแพลตฟอร์ม ---- */
.plat-name { font-weight: 700; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--gold-lt); }
.plat-latest { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 7px; vertical-align: 1px; }
.sync-dot.fresh { background: #3ddc84; box-shadow: 0 0 7px #3ddc84; }
.sync-dot.warm  { background: #e8b45a; box-shadow: 0 0 7px rgba(232, 180, 90, .6); }
.sync-dot.dead  { background: #e06c75; box-shadow: 0 0 7px rgba(224, 108, 117, .6); }

/* แถวปุ่มลงมือเหนือตาราง (เพิ่มหมวด/แนว/ผู้ใช้) */
.adm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }

/* ====================================================================
 * แดชบอร์ดหน้าภาพรวม — กราฟ + อันดับเรื่อง
 * ==================================================================== */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
/* บทเรียนเดิมของ .edit-stack: ลูก grid มี min-width:auto — canvas จะดันการ์ดกว้างกว่าจอ */
.chart-row > * { min-width: 0; }
@media (max-width: 860px) { .chart-row { grid-template-columns: 1fr; } }
/* canvas ของ Chart.js ต้องมีกล่องสูงตายตัวครอบ ไม่งั้นโหมด responsive จะยืดสูงไม่หยุด */
.chart-box { position: relative; height: 220px; }

/* การ์ดเด่น (วิววันนี้) + การ์ดเตือน (มีของพัง) */
.adm-card.hi { border-color: var(--gold-dp); background: linear-gradient(160deg, #1a1508, var(--panel) 65%); }
.adm-card.bad { border-color: rgba(229, 72, 93, .5); }
.adm-card em .up { color: #7bd88f; font-weight: 700; }
.adm-card em .down { color: #f5748a; font-weight: 700; }

/* อันดับเรื่องดูมากสุด — แถบสัดส่วนให้เห็นช่องว่างระหว่างอันดับทันที */
.top-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 9px; }
.top-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.top-list .n {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); font-size: 11.5px; color: var(--ink-mute);
}
.top-list li:nth-child(1) .n { border-color: var(--gold); color: var(--gold-lt); font-weight: 700; }
.top-list a { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42%; }
.top-list .bar { flex: 1; height: 7px; border-radius: 99px; background: rgba(30, 42, 82, .6); overflow: hidden; }
.top-list .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-dp), var(--gold)); }
.top-list b { flex: none; min-width: 34px; text-align: right; }
@media (max-width: 560px) {
  .top-list a { max-width: none; flex: 1 1 100%; order: -1; }
  .top-list li { flex-wrap: wrap; row-gap: 4px; }
}

/* โลโก้ที่อัปโหลดเอง — คุมความสูงเท่าไอคอนเดิม กันโลโก้ใหญ่ดันหัวเว็บพัง */
.brand-logo { height: 38px; width: auto; max-width: 160px; object-fit: contain; border-radius: 8px; }

/* กล่องจำลองแถบหัวเว็บ — โชว์ว่า navbar กำลังใช้โลโก้ไหน+ชื่ออะไรด้วยค่าจริง */
.brand-preview {
  display: flex; flex-direction: column; gap: 6px;
  padding: 13px 16px; margin: 4px 0 18px;
  border: 1px solid var(--gold-dp); border-radius: 10px;
  background: linear-gradient(135deg, #1a1508, var(--panel) 60%);
}
.bp-cap { font-size: 11.5px; color: var(--ink-mute); letter-spacing: .04em; }
.bp-cap .bi { color: var(--gold); margin-right: 5px; }
.bp-bar { display: flex; align-items: center; gap: 11px; }
.bp-bar img { height: 34px; width: auto; max-width: 150px; object-fit: contain; border-radius: 7px; }
.bp-bar b { display: block; font-size: 17px; color: var(--gold-lt); line-height: 1.1; }
.bp-bar small { font-size: 9.5px; color: var(--ink-mute); letter-spacing: .28em; }

/* พรีวิวโลโก้ปัจจุบันในฟอร์มตั้งค่า */
.logo-now {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 8px;
  border: 1px dashed var(--line); border-radius: 9px; background: var(--bg-2);
}
.logo-now img { height: 40px; width: auto; max-width: 180px; object-fit: contain; border-radius: 6px; }
.logo-now label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; }

/* หัวส่วน SEO: ข้อความซ้าย วงแหวนคะแนนขวา */
.seo-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.seo-head h2 { margin: 0; }
/* เส้นทองของ h2 ปกติจะวิ่งชนวงแหวน — ปิดเฉพาะใน seo-head */
.seo-head h2::after { display: none; }

/*
 * วงแหวนคะแนนแบบ Rank Math — เติมสีตามสัดส่วนด้วย conic-gradient
 * รับค่าผ่านตัวแปร: --v (0-100) กับ --c (สีตามเกรด) จาก style ของ PHP
 */
.seo-ring {
  flex: none; width: 78px; height: 78px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), rgba(255, 255, 255, .07) 0);
  display: grid; place-items: center; position: relative;
}
.seo-ring::before {
  /* เจาะรูตรงกลางให้เป็นวงแหวน */
  content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--panel);
}
.seo-ring b, .seo-ring small { position: relative; line-height: 1.1; }
.seo-ring b { font-size: 21px; color: var(--c); margin-top: 14px; }
.seo-ring small { font-size: 10px; color: var(--ink-mute); margin-bottom: 12px; }

/* กล่องตัวอย่างผลค้นหา Google — เลียนสีของจริงบนพื้นมืด ให้ความรู้สึกตรงปก */
.g-prev {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; margin: 6px 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #202124;
}
.g-cap {
  display: flex; align-items: center; gap: 7px; margin-bottom: 8px; padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  color: #9aa0a6; font-size: 11.5px; letter-spacing: .04em;
}
.g-cap .bi { color: #8ab4f8; }
.g-url   { color: #bdc1c6; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-title { color: #8ab4f8; font-size: 17px; line-height: 1.3; cursor: default; }
.g-desc  { color: #bdc1c6; font-size: 13px; line-height: 1.5; }
.g-kw {
  margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255, 255, 255, .07);
  color: #9aa0a6; font-size: 12px; line-height: 1.5;
}
.g-kw .bi { margin-right: 4px; }

/* กลุ่มเช็คลิสต์: "ควรปรับ" กรอบแดงจางเด่นก่อน · "ผ่านแล้ว" พับเก็บได้ */
.seo-grp { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.seo-grp[open] > summary { margin-bottom: 9px; }
.seo-grp-t {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  cursor: default; list-style: none;
}
summary.seo-grp-t { cursor: pointer; }
summary.seo-grp-t::-webkit-details-marker { display: none; }
.seo-grp-t.bad { color: #f5b5c0; }
.seo-grp-t.ok { color: #7bd88f; }
.seo-grp-t span {
  font-size: 11px; padding: 1px 9px; border-radius: 999px;
  border: 1px solid currentColor; opacity: .85;
}
.seo-grp:has(> .seo-grp-t.bad) { border-color: rgba(229, 72, 93, .35); background: rgba(229, 72, 93, .05); }
.seo-grp-t.bad + .seo-checks { margin-top: 9px; }

.seo-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.seo-checks li { font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.seo-checks li.ok { color: var(--ink-dim); }
.seo-checks li.ok .bi { color: #7bd88f; }
.seo-checks li.bad .bi { color: #f5b5c0; }

/* ชิปตัวแปรของแม่แบบ — เห็นครบตลอด ไม่ต้องกดเปิด */
.var-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px; margin-top: 16px;
}
.var-chip {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-2); font-size: 12.5px;
}
.var-chip code { color: var(--gold-lt); flex: none; }
.var-chip span { color: var(--ink-mute); }

/* ---- แต่งหลังบ้านให้ประณีตขึ้น ---- */
/* หัวการ์ดมีเส้นทองสั้น ๆ ใต้ชื่อ — กวาดตาแยกส่วนได้เร็วขึ้น */
.set-card h2::after {
  content: ""; flex: none; width: 34px; height: 2px; margin-left: 4px;
  border-radius: 2px; background: linear-gradient(90deg, var(--gold-dp), transparent);
}
/* แถวตารางสว่างขึ้นนิดตอนชี้ — รู้ว่ากำลังจะกดแถวไหนในตารางยาว ๆ */
.adm-tbl tbody tr { transition: background .12s; }
.adm-tbl tbody tr:hover { background: rgba(229, 184, 63, .045); }
/* การ์ดยกตัวนิด ๆ ตอนชี้ ให้รู้ว่าทั้งหน้ามีชีวิต */
.set-card { transition: border-color .15s; }
.set-card:hover { border-color: rgba(229, 184, 63, .35); }

/* ลิงก์ชื่อในตารางแอดมิน (ชื่อแนว/ชื่อเรื่อง) — ต้องดูออกว่ากดได้ ไม่ใช่ข้อความเฉย ๆ */
.adm-link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.adm-link:hover { color: var(--gold-lt); text-decoration-color: var(--gold-dp); }

/* ป้ายสถานะแบบ chip — ใช้ในหน้าจัดการรายแนว/รายหมวด (ของเดิม .st-* ผูกกับ select เท่านั้น) */
.chip.ok-c { border-color: var(--gold-dp); color: var(--gold-lt); }
.chip.dim { color: var(--ink-mute); }
.chip.st-published { border-color: var(--gold-dp); color: var(--gold-lt); }
.chip.st-draft { color: var(--ink-mute); }
.chip.st-hidden { border-color: #6b2532; color: #f5b5c0; }

.pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--ink-mute); background: var(--bg-2);
}
.pill.admin { border-color: var(--gold); color: var(--gold-lt); font-weight: 600; }
.tag-me {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; color: #1a1204;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
}

/* ---- ตัวเลือกแบบติ๊ก (หมวดหมู่ / แนวเรื่องของเรื่องหนึ่ง) ---- */
/*
 * ใช้ป้ายติ๊กแทน <select multiple> เพราะ select แบบเลือกหลายตัวบนมือถือ
 * ต้องกดค้างหรือ Ctrl ค้าง ซึ่งคนส่วนใหญ่ไม่รู้ และบนมือถือทำไม่ได้เลย
 */
.pick-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.pick-grid.scroll { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.pick {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: 13.5px; color: var(--ink-dim); transition: .14s;
}
.pick:hover { border-color: var(--gold-dp); color: var(--gold-lt); }
.pick input { flex: none; margin: 0; accent-color: var(--gold); width: 16px; height: 16px; }
.pick span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick em { font-style: normal; font-size: 11.5px; color: var(--ink-mute); flex: none; }
/* ตัวที่ติ๊กแล้ว — ต้องเห็นชัดตั้งแต่กวาดตา ไม่ต้องเพ่งหาช่องติ๊ก */
.pick:has(input:checked) {
  border-color: var(--gold); background: rgba(229, 184, 63, .09); color: var(--gold-lt); font-weight: 500;
}
.pick.hide { display: none; }

.pick-find {
  width: 100%; max-width: 340px; margin-bottom: 12px;
  padding: 9px 15px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; outline: none;
}
.pick-find:focus { border-color: var(--gold-dp); }

.ta {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 14px; line-height: 1.7;
  color: var(--ink); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; outline: none; resize: vertical; min-height: 96px;
}
.ta:focus { border-color: var(--gold-dp); background: var(--panel-2); }

.adm-filter { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.adm-filter input[type="search"] {
  flex: 1; min-width: 190px; padding: 10px 15px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; outline: none;
}
.adm-filter input:focus { border-color: var(--gold-dp); }
.adm-filter select {
  padding: 10px 14px; font: inherit; font-size: 13.5px; border-radius: 999px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); cursor: pointer;
}
.adm-count { font-size: 12.5px; color: var(--ink-mute); margin: 0 0 12px; }

@media (max-width: 700px) {
  .adm-nav .adm-out { margin-left: 0; }
  .adm-nav a { font-size: 13px; padding: 8px 13px; }
}

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert.err { border-color: #6b2532; background: #22101a; color: #f5b5c0; }
.alert.ok  { border-color: var(--gold-dp); background: #1a1508; color: var(--gold-lt); }


/* ------------------------- ยอดวิว / จำนวนเรื่อง ------------------------- */
/*
 * ป้ายยอดวิววางบนโปสเตอร์ ไม่ใช่บรรทัดใต้ชื่อ
 * เพราะบรรทัดใต้ชื่อถูก JS เขียนทับด้วย "ดูถึงตอน N" เมื่อเคยดูแล้ว
 * ถ้าวางไว้ที่นั่น พอเริ่มดูปุ๊บยอดวิวจะหายไปทันที
 */
.card-views {
  /* ล่างขวาของรูป — ล่างซ้ายเป็นที่ของป้ายจำนวนตอนแล้ว (รื้อ UI 5 ส.ค. 2026) */
  position: absolute; bottom: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(7, 11, 22, .86); border: 1px solid var(--line); color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.card-views svg { width: 12px; height: 12px; opacity: .8; }

/* จำนวนเรื่องในเมนูหมวด */
.nav a { display: inline-flex; align-items: center; gap: 7px; }
.nav-n {
  font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); color: inherit; opacity: .75;
  font-variant-numeric: tabular-nums;
}
.nav a.on .nav-n { background: rgba(26, 18, 4, .18); opacity: .9; }

/* กล่องอธิบายว่าข้อมูลเก็บที่ไหน */
.hint-box {
  margin-top: 30px; padding: 14px 17px; border-radius: 12px; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-mute);
}
.hint-box strong { color: var(--ink-dim); font-weight: 700; }
.hint-box a { color: var(--gold); }
.hint-box a:hover { color: var(--gold-lt); }

/* ==========================================================================
   ดูรอหวย (DooRohuay) — Lottery Sections & Results Styling
   ========================================================================== */

/* 1. หวยมาแรง */
.lottery-trending-sec {
  margin: 18px 0 16px;
}
.lottery-sec-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 8px;
}
.lottery-head-left {
  display: flex; align-items: center; gap: 10px;
}
.ticket-icon-box {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f7e199, #e5b83f 60%, #a67c1c);
  color: #1a1002; font-weight: 900; font-size: 13px;
  padding: 4px 8px; border-radius: 6px;
  box-shadow: 0 3px 10px rgba(229, 184, 63, 0.35);
  border: 1px dashed rgba(26, 16, 2, 0.4);
  letter-spacing: 0.5px;
}
.lottery-sec-title {
  font-size: 20px; font-weight: 800; color: #fff; margin: 0; line-height: 1.2;
}
.lottery-sec-sub {
  font-size: 12px; color: #8ec3b2; margin: 2px 0 0; line-height: 1.3;
}
.btn-see-all-lotto {
  display: inline-flex; align-items: center; gap: 4px;
  background: #06281e; border: 1px solid #1c614d;
  color: var(--gold-lt); font-size: 12.5px; font-weight: 600;
  padding: 5px 14px; border-radius: 999px; text-decoration: none;
  transition: all .18s ease; flex: none;
}
.btn-see-all-lotto:hover {
  border-color: var(--gold); color: #fff; background: #09372b;
  transform: translateX(2px);
}

.lottery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.lottery-card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #09281e 0%, #061d15 100%);
  border: 1.5px solid #144937; border-radius: 16px;
  padding: 16px 12px 14px; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column; justify-content: space-between;
}
.lottery-card:hover {
  transform: translateY(-2px); border-color: #24755a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.temple-silhouette {
  display: none !important;
}
.lottery-flag-row {
  position: relative; z-index: 1; display: flex; justify-content: center;
  margin-bottom: 8px;
}
.flag-badge {
  width: 36px; height: 36px;
  border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  border: 2px solid rgba(255,255,255,0.22); display: block;
}
.lottery-card-title {
  position: relative; z-index: 1; font-size: 15px; font-weight: 700;
  color: #fff; margin: 0 0 10px; line-height: 1.3;
}
.lottery-time-list {
  position: relative; z-index: 1;
  background: #04140e;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.lottery-time-item {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0; font-size: 12px; color: #8bbfae; line-height: 1.3;
}
.time-icon-clock { font-size: 12px; margin-right: 4px; }
.time-icon-check { color: #10b981; font-size: 12px; margin-right: 4px; font-weight: bold; }
.time-label { color: #8bbfae; font-size: 12px; font-weight: 500; }
.time-value { color: #fff; font-weight: 700; font-size: 13.5px; font-family: var(--font-mono, monospace); letter-spacing: 0.5px; }
.btn-lottery-action {
  position: relative; z-index: 1; display: block; width: 100%;
  background: linear-gradient(180deg, #f04438 0%, #d9361f 100%);
  color: #fff; font-weight: 700; font-size: 14px; padding: 9px 0;
  border-radius: 10px; box-shadow: 0 4px 14px rgba(240, 68, 56, 0.45);
  text-align: center; text-decoration: none; transition: all .18s ease;
  letter-spacing: 0.3px;
}
.btn-lottery-action:hover, .btn-lottery-action:focus-visible {
  background: linear-gradient(180deg, #ff5a4d 0%, #e23a2b 100%);
  box-shadow: 0 6px 18px rgba(240, 68, 56, 0.65); color: #fff;
  outline: 2px solid rgba(132, 210, 246, 0.9);
}

/* 2. ดาวน์โหลดแอปดูรอหวย */
.app-download-banner {
  background: linear-gradient(90deg, #e8ba52 0%, #cf9b33 50%, #b47e1d 100%);
  border-radius: 16px; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0; box-shadow: 0 10px 30px rgba(229, 184, 63, 0.25);
  color: #1b1204; border: 1px solid #ffd875;
}
.app-banner-left {
  display: flex; align-items: center; gap: 14px;
}
.phone-mockup {
  position: relative; width: 44px; height: 58px;
  background: #05241b; border: 2.2px solid #fff;
  border-radius: 9px; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); flex: none;
}
.phone-screen { display: grid; place-items: center; }
.phone-link-badge {
  position: absolute; right: -6px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #07261d; border: 1.5px solid #fff;
  display: grid; place-items: center; color: #f8dc7a;
}
.app-banner-title {
  font-size: 16px; font-weight: 800; color: #150e02;
  margin: 0; line-height: 1.2;
}
.app-banner-sub {
  font-size: 12.5px; color: #3c2a08; margin: 2px 0 0; font-weight: 500;
}
.btn-app-install {
  background: #07261d; color: #f7e199; border: 1px solid #144939;
  border-radius: 999px; padding: 8px 18px; font-weight: 800;
  font-size: 13px; cursor: pointer; flex: none; transition: .18s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.btn-app-install:hover {
  background: #041a13; color: #fff;
}

/* 3. หวยมาเลย์ & นับถอยหลัง */
.countdown-banner {
  background: linear-gradient(180deg, #072a20 0%, #041f17 100%);
  border: 1.5px solid #1d6a53; border-radius: 16px;
  padding: 12px 16px; display: flex; justify-content: space-between;
  align-items: center; margin: 16px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  gap: 12px;
}
.countdown-brand {
  display: flex; align-items: center; gap: 10px;
}
.countdown-title {
  font-size: 16px; font-weight: 800; color: #fff; margin: 0; line-height: 1.2;
}
.countdown-sub {
  font-size: 11.5px; color: #7cbda9; display: flex; align-items: center; gap: 4px;
}
.countdown-timer-group {
  display: flex; align-items: center; gap: 4px;
}
.countdown-block { text-align: center; }
.countdown-box {
  background: #02140e; border: 1px solid #1b5b47;
  border-radius: 7px; padding: 5px 9px;
  font-size: 16px; font-weight: 900; color: #fff;
  min-width: 36px; font-family: monospace;
}
.countdown-unit {
  font-size: 9px; color: #69a794; display: block; margin-top: 2px;
}
.countdown-sep {
  color: #fff; font-weight: 800; font-size: 17px; margin-bottom: 12px;
}
.btn-countdown-bet {
  background: linear-gradient(180deg, #f04438 0%, #c4301f 100%);
  color: #fff; font-weight: 700; font-size: 13px;
  border-radius: 999px; padding: 8px 18px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(240, 68, 56, 0.4); flex: none;
}
.btn-countdown-bet:hover {
  background: linear-gradient(180deg, #ff5a4d 0%, #d9361f 100%);
  color: #fff;
}

/* 4. ดูเพลินระหว่างรอหวยออก */
.wait-drama-banner {
  background: linear-gradient(180deg, #09372b 0%, #06261d 100%);
  border: 1.5px solid #1a5e4b;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  padding: 18px 20px 14px;
  margin: 18px 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.wait-drama-tag {
  position: absolute;
  top: 12px;
  right: 16px;
  background: linear-gradient(90deg, #c79a32, #a17520);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 5;
  pointer-events: none;
}

.wait-slide-viewport {
  overflow: hidden;
  width: 100%;
}

.wait-slide-track {
  display: flex;
  width: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.wait-slide-item {
  width: 100%;
  flex: 0 0 100%;
  min-width: 100%;
}

.wait-drama-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.wait-drama-text {
  flex: 1;
  min-width: 0;
}

.wait-drama-title {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px;
  line-height: 1.25;
}

.wait-drama-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: #a1cbbe;
  margin: 0 0 14px;
}

.btn-wait-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #f8dc7a 0%, #e5b83f 100%);
  color: #1a1204;
  font-weight: 800;
  font-size: 13.5px;
  padding: 7px 22px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(229, 184, 63, 0.35);
  transition: transform 0.18s ease;
}

.btn-wait-play:hover {
  transform: scale(1.03);
  color: #000;
}

.wait-drama-art-wrapper {
  flex: none;
  position: relative;
  width: 220px;
  height: 185px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid #236f58;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  text-decoration: none;
  display: block;
}

.wait-drama-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wait-drama-overlay-title {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 20%, rgba(0, 0, 0, 0.5) 60%, transparent);
  padding: 14px 8px 6px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

.wait-drama-overlay-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wait-drama-overlay-title small {
  display: block;
  font-size: 8.5px;
  color: #dfb249;
  font-weight: 400;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wait-drama-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.wait-drama-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #165340;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wait-drama-dots .dot.on {
  width: 18px;
  border-radius: 3px;
  background: #e5b83f;
}

@media (max-width: 680px) {
  .wait-drama-banner {
    padding: 14px 14px 10px;
  }
  .wait-drama-title {
    font-size: 17px;
  }
  .wait-drama-desc {
    font-size: 11.5px;
    margin-bottom: 12px;
  }
  .btn-wait-play {
    padding: 6px 18px;
    font-size: 12px;
  }
  .wait-drama-art-wrapper {
    width: 145px;
    height: 160px;
    border-radius: 12px;
  }
}

@media (max-width: 400px) {
  .wait-drama-art-wrapper {
    width: 120px;
    height: 145px;
  }
  .wait-drama-title {
    font-size: 15.5px;
  }
}

/* 5. ซีรีส์กำลังมาแรง */
.sec-trending-drama { margin-top: 20px; }
.sec-t-inline { display: flex; align-items: center; gap: 8px; }
.fire-icon-badge {
  display: inline-grid; place-items: center;
  color: #ff474d; font-size: 18px;
}
.trending-drama-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px;
}
.drama-thumb-card {
  position: relative; background: #07271e;
  border: 1px solid #144f3d; border-radius: 12px;
  overflow: hidden; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: transform .18s, border-color .18s;
}
.drama-thumb-card:hover {
  transform: translateY(-2px); border-color: var(--gold-dp);
}
.thumb-art-wrap {
  position: relative; width: 100%; aspect-ratio: 3/4; overflow: hidden;
}
.thumb-art-wrap img { width: 100%; height: 100%; object-fit: cover; }
.thumb-dub-chip {
  position: absolute; top: 6px; right: 6px;
  background: rgba(229, 184, 63, 0.92); color: #1a1204;
  font-size: 9.5px; font-weight: 800; padding: 2px 6px;
  border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.thumb-views-chip {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(3, 20, 15, 0.85); color: #e6f3ee;
  border: 1px solid rgba(229, 184, 63, 0.3);
  font-size: 9.5px; font-weight: 700; padding: 1px 6px;
  border-radius: 4px; display: inline-flex; align-items: center; gap: 3px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.thumb-views-chip .bi { font-size: 9px; color: var(--gold-lt); }

.thumb-info { padding: 8px 6px; flex: 1; }
.thumb-title {
  font-size: 12.5px; font-weight: 700; color: #fff;
  margin: 0 0 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.thumb-synopsis {
  font-size: 10px; color: #76a999; margin: 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 6. ปุ่ม LINE ลอย */
.line-float-btn {
  position: fixed; right: 16px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 1040; display: flex; align-items: center; gap: 6px;
  background: rgba(3, 18, 14, 0.92); border: 1.5px solid #06c755;
  border-radius: 999px; padding: 4px 10px 4px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5); color: #fff;
  font-size: 12px; font-weight: 700; text-decoration: none;
  backdrop-filter: blur(8px); transition: transform .18s;
}
.line-float-btn:hover { transform: scale(1.05); color: #fff; }
.line-float-label { color: #fff; font-weight: 700; }
.line-float-icon { display: flex; align-items: center; }

/* 7. หน้าผลหวย & หน้าตรวจหวย (/ผลหวย) */
.lottery-results-container, .lottery-bet-container {
  padding: 20px 0 40px;
}
.results-header {
  text-align: center; margin-bottom: 22px;
}
.results-main-title {
  font-size: 26px; font-weight: 900; color: #fff;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 0 0 6px;
}
.results-sub-title {
  font-size: 14px; color: #8ec3b2; margin: 0;
}
.ticket-checker-card {
  background: linear-gradient(180deg, #09372b 0%, #06261d 100%);
  border: 1.5px solid #1a5c48; border-radius: 16px;
  padding: 20px; text-align: center; margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.checker-title { font-size: 19px; font-weight: 800; color: #fff; margin: 0 0 4px; }
.checker-desc { font-size: 13px; color: #8ec3b2; margin: 0 0 16px; }
.checker-form {
  display: flex; justify-content: center; gap: 8px; max-width: 480px; margin: 0 auto;
}
.checker-input {
  flex: 1; padding: 10px 16px; border-radius: 999px;
  border: 1px solid #1c614d; background: #031711;
  color: #fff; font-size: 16px; font-weight: 700;
  text-align: center; letter-spacing: 2px; outline: none;
}
.checker-input:focus { border-color: var(--gold); }
.checker-btn {
  background: linear-gradient(180deg, #f8dc7a 0%, #e5b83f 100%);
  color: #1a1204; border: 0; border-radius: 999px;
  padding: 10px 24px; font-size: 14px; font-weight: 800; cursor: pointer;
}
.checker-feedback {
  margin-top: 14px; padding: 10px 16px; border-radius: 8px;
  background: #031711; border: 1px solid var(--gold-dp);
  color: var(--gold-lt); font-size: 14px; font-weight: 700;
}

.results-card {
  background: linear-gradient(180deg, #072a20 0%, #041f17 100%);
  border: 1.5px solid #16533f; border-radius: 16px;
  padding: 18px 20px; margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.results-card-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #114534; padding-bottom: 12px; margin-bottom: 16px;
}
.flag-title-wrap {
  display: flex; align-items: center; gap: 12px;
}
.flag-title-wrap h3 {
  font-size: 17px; font-weight: 800; color: #fff; margin: 0; line-height: 1.2;
}
.flag-title-wrap small { color: #8ec3b2; font-size: 12px; }
.live-status-pill {
  background: rgba(6, 199, 85, 0.15); border: 1px solid #06c755;
  color: #06c755; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}

.thai-results-highlight {
  display: flex; flex-direction: column; gap: 14px;
}
.prize-box {
  background: #02140e; border: 1px solid #16533f;
  border-radius: 12px; padding: 12px; text-align: center;
}
.prize-box.prize-first {
  background: radial-gradient(circle at 50% 30%, #0b3d30 0%, #02140e 80%);
  border: 2px solid var(--gold);
}
.prize-label { font-size: 13px; color: #8ec3b2; display: block; margin-bottom: 4px; }
.prize-number { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 2px; }
.prize-number.big-num { font-size: 36px; color: var(--gold-lt); }
.prize-worth { font-size: 11px; color: #6a9c8e; display: block; margin-top: 4px; }
.prize-sub-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.text-gold { color: var(--gold-lt) !important; }

.multi-lotto-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.lotto-sub-results {
  display: flex; flex-direction: column; gap: 8px;
}
.lotto-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #02140e; border: 1px solid #134937;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
.lotto-row span { color: #8ec3b2; }
.lotto-row b { font-size: 15px; color: #fff; letter-spacing: 1px; }

/* 8. หน้าตารางแทงหวย (/แทงหวย) */
.bet-table-card {
  background: #072a20; border: 1.5px solid #16533f;
  border-radius: 16px; overflow: hidden; margin-bottom: 24px;
}
.bet-table {
  width: 100%; border-collapse: collapse; text-align: left;
}
.bet-table th {
  background: #041f17; color: var(--gold-lt); font-size: 13px;
  font-weight: 700; padding: 12px 16px; border-bottom: 1px solid #16533f;
}
.bet-table td {
  padding: 12px 16px; border-bottom: 1px solid #0d3b2c;
  color: #cfe8df; font-size: 13px; vertical-align: middle;
}
.lotto-name-cell b { color: #fff; font-size: 14px; }
.close-badge {
  background: #03140e; border: 1px solid #1b5b47;
  border-radius: 6px; padding: 3px 8px; font-size: 12px; color: #d6d0bc;
}
.rate-cell { color: var(--gold-lt); font-weight: 600; }
.btn-table-bet {
  background: linear-gradient(180deg, #f04438 0%, #c4301f 100%);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 5px 14px; border-radius: 6px; text-decoration: none;
  display: inline-block;
}
.bet-contact-box {
  background: #05241b; border: 1.5px solid #06c755;
  border-radius: 16px; padding: 24px; text-align: center;
}
.bet-contact-box h3 { font-size: 19px; font-weight: 800; color: #fff; margin: 0 0 6px; }
.bet-contact-box p { font-size: 13.5px; color: #8ec3b2; margin: 0 0 16px; }
.btn-line-contact {
  display: inline-flex; align-items: center; gap: 8px;
  background: #06c755; color: #fff; font-size: 15px; font-weight: 800;
  padding: 10px 26px; border-radius: 999px; text-decoration: none;
  box-shadow: 0 4px 16px rgba(6, 199, 85, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
  .lottery-grid { gap: 8px; }
  .lottery-card { padding: 10px 6px 8px; }
  .lottery-card-title { font-size: 14px; margin-bottom: 6px; }
  .lottery-time-list { padding: 5px 6px; font-size: 10px; }
  .btn-lottery-action { font-size: 11.5px; padding: 5px 0; }
  .multi-lotto-grid { grid-template-columns: 1fr; }
  .prize-sub-grid { grid-template-columns: 1fr; }
  .wait-drama-art-wrapper { width: 110px; height: 150px; }
  .wait-drama-title { font-size: 18px; }
  .trending-drama-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ==========================================================================
   Master Lottery Table (49 Lotteries) & Enhanced Responsive Styling
   ========================================================================== */

.master-lotto-sec {
  margin: 28px 0;
}
.master-lotto-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 14px; flex-wrap: wrap;
}
.master-head-title-wrap {
  display: flex; align-items: center; gap: 10px;
}
.gold-spark-badge {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; background: rgba(229, 184, 63, 0.15);
  border: 1px solid var(--gold-dp); font-size: 18px; flex: none;
}
.master-lotto-title {
  font-size: 20px; font-weight: 800; color: #fff; margin: 0; line-height: 1.25;
}
.master-lotto-sub {
  font-size: 12.5px; color: #8ec3b2; margin: 2px 0 0;
}
.master-search-wrap {
  flex: 1; max-width: 320px; min-width: 220px; margin-left: auto;
}
.master-search-input {
  width: 100%; padding: 8px 16px; border-radius: 999px;
  background: #031812; border: 1px solid #16533f;
  color: #fff; font-size: 13px; outline: none; transition: .18s;
}
.master-search-input:focus {
  border-color: var(--gold);
}

/* Tabs */
.master-tabs-scroll {
  overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.master-tabs-scroll::-webkit-scrollbar { display: none; }
.master-tabs-bar {
  display: flex; gap: 8px; width: max-content;
}
.master-tab-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #072a20; border: 1px solid #16533f;
  color: #9bc5b7; font-size: 13px; font-weight: 700;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  transition: all .16s ease;
}
.master-tab-btn:hover {
  background: #0b3d2f; color: #fff;
}
.master-tab-btn.active {
  background: linear-gradient(180deg, #f8dc7a, #e5b83f);
  color: #161002; border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(229, 184, 63, 0.35);
}
.tab-pill {
  background: rgba(0, 0, 0, 0.25); border-radius: 999px;
  padding: 1px 7px; font-size: 11px;
}
.master-tab-btn.active .tab-pill {
  background: rgba(26, 16, 2, 0.2); color: #000;
}

/* Desktop Table */
.master-table-card {
  background: linear-gradient(180deg, #072a20 0%, #041f17 100%);
  border: 1.5px solid #16533f; border-radius: 16px;
  overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.master-table {
  width: 100%; border-collapse: collapse; text-align: left;
}
.master-table th {
  background: #031610; color: var(--gold-lt); font-size: 12.5px;
  font-weight: 700; padding: 12px 14px; border-bottom: 1.5px solid #16533f;
  white-space: nowrap;
}
.th-center { text-align: center; }
.master-table td {
  padding: 10px 14px; border-bottom: 1px solid #0d3b2c;
  vertical-align: middle; font-size: 13px;
}
.row-flag-name {
  display: flex; align-items: center; gap: 10px;
}
.lotto-row-title {
  color: #fff; font-size: 14px; font-weight: 700; display: block;
}
.lotto-row-country {
  color: #79ae9d; font-size: 11px; display: block;
}
.time-badge {
  background: #02140e; border: 1px solid #154e3c;
  border-radius: 6px; padding: 4px 8px; font-size: 11.5px;
  color: #d6d0bc; white-space: nowrap;
}
.td-num { text-align: center; }
.num-box {
  display: inline-block; min-width: 44px; padding: 4px 8px;
  border-radius: 6px; background: #02140e; border: 1px solid #124534;
  font-family: monospace; font-size: 15px; font-weight: 800;
  color: #fff; letter-spacing: 1px;
}
.num-box.gold-border {
  border-color: #e5b83f; background: #072e23;
  color: #fff; box-shadow: 0 2px 8px rgba(229, 184, 63, 0.2);
}
.num-box.text-gold { color: var(--gold-lt); }
.td-status { text-align: center; }
.status-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap;
}
.status-ok {
  background: rgba(6, 199, 85, 0.14); border: 1px solid #06c755; color: #06c755;
}
.status-live {
  background: rgba(240, 68, 56, 0.16); border: 1px solid #f04438; color: #ff6a5c;
}
.status-wait {
  background: rgba(229, 184, 63, 0.14); border: 1px solid #e5b83f; color: #f8dc7a;
}
.btn-mini-bet {
  display: inline-block; background: linear-gradient(180deg, #f04438, #c4301f);
  color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 12px;
  border-radius: 6px; text-decoration: none; transition: .18s;
}
.btn-mini-bet:hover {
  background: linear-gradient(180deg, #f03338, #cf1b21); color: #fff;
}

/* Mobile Adaptive Cards */
.master-mobile-cards {
  display: flex; flex-direction: column; gap: 10px;
}
.lotto-mobile-card {
  background: linear-gradient(180deg, #072a20 0%, #041f17 100%);
  border: 1.5px solid #16533f; border-radius: 14px;
  padding: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.lotto-m-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; border-bottom: 1px solid #0f4030; padding-bottom: 8px;
}
.lotto-m-brand {
  display: flex; align-items: center; gap: 9px;
}
.lotto-m-name {
  font-size: 15px; font-weight: 800; color: #fff; margin: 0; line-height: 1.2;
}
.lotto-m-sub {
  font-size: 11px; color: #7cbda9;
}
.lotto-m-nums-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px;
}
.m-num-item {
  background: #02140e; border: 1px solid #124534;
  border-radius: 8px; padding: 6px 2px; text-align: center;
}
.m-num-lbl {
  display: block; font-size: 10px; color: #7cbda9; margin-bottom: 2px;
}
.m-num-val {
  font-family: monospace; font-size: 15px; font-weight: 900;
  color: #fff; letter-spacing: 0.5px; display: block;
}
.val-4d {
  color: #fff; font-size: 16px; font-weight: 900;
}
.val-gold {
  color: var(--gold-lt); font-size: 16px; font-weight: 900;
}
.lotto-m-foot {
  display: flex; justify-content: space-between; align-items: center;
}
.lotto-m-close {
  font-size: 11px; color: #6fa091;
}
.btn-m-bet {
  background: linear-gradient(180deg, #f04438, #c4301f);
  color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 4px 14px; border-radius: 6px; text-decoration: none;
}

/* Visibility helpers */
.d-none { display: none !important; }
@media (min-width: 768px) {
  .d-md-block { display: block !important; }
  .d-md-none { display: none !important; }
}

/* Extra Mobile Fine-Tuning (< 540px) */
@media (max-width: 540px) {
  .head-in { gap: 10px; padding: 8px 0; }
  .brand-name { font-size: 20px; }
  .brand-sub { font-size: 9.5px; }
  .search { max-width: 200px; }
  .search input { padding: 6px 12px; font-size: 12px; }
  .app-download-banner {
    flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px;
  }
  .btn-app-install { align-self: flex-end; padding: 6px 14px; }
  .countdown-banner { padding: 10px 12px; gap: 8px; }
  .countdown-title { font-size: 14.5px; }
  .countdown-box { min-width: 28px; font-size: 13.5px; padding: 3px 5px; }
  .btn-countdown-bet { padding: 6px 12px; font-size: 12px; }
  .wait-slide-inner { padding: 14px 12px 10px; }
  .wait-drama-title { font-size: 16px; }
  .wait-drama-art-wrapper { width: 95px; height: 130px; }
  .btn-wait-play { padding: 5px 14px; font-size: 11.5px; }
  .bnav { grid-template-columns: repeat(5, minmax(0, 1fr)); border-radius: 16px 16px 0 0; }
  .bnav-i { min-height: 54px; padding: 6px 2px; }
  .bnav-i svg { width: 21px; height: 21px; }
  .bnav-i span { font-size: 10px; }
  .bnav-center-circle { width: 52px; height: 52px; padding: 2.5px; }
  .bnav-center-btn { top: -18px; }
  .bnav-center-text { font-size: 10.5px; margin-top: 4px; }
  .line-float-btn { right: 10px; padding: 3px 8px 3px 12px; font-size: 11px; }
}

/* Waiting Status Numbers Placeholder */
.num-box.is-waiting {
  color: #6f9184 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  letter-spacing: 2.5px;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  opacity: 0.8;
}
.m-num-val.is-waiting {
  color: #6f9184 !important;
  letter-spacing: 2px;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  opacity: 0.8;
}

/* Status Sub-Filter Chips */
.master-status-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 16px;
  flex-wrap: wrap;
}
.status-filter-label {
  font-size: 12px;
  color: #8fa79c;
  font-weight: 600;
  margin-right: 4px;
}
.status-filter-chip {
  background: rgba(13, 66, 51, 0.4);
  border: 1px solid rgba(229, 184, 63, 0.2);
  color: #9fb3aa;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.status-filter-chip:hover {
  border-color: var(--gold-lt);
  color: #fff;
}
.status-filter-chip.active {
  background: linear-gradient(135deg, rgba(229, 184, 63, 0.25), rgba(6, 199, 85, 0.15));
  border-color: var(--gold-lt);
  color: #fae69e;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(229, 184, 63, 0.2);
}
.status-filter-chip.chip-announced.active {
  border-color: #06c755;
  color: #7bf1a8;
}
.status-filter-chip.chip-waiting.active {
  border-color: #e5a93b;
  color: #ffe89e;
}

/* View All CTA Banner on Home Page */
.sec-viewall-cta {
  margin: 20px 0 28px;
}
.viewall-cta-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #062b21 0%, #164237 55%, #061f18 100%);
  border: 1px solid rgba(229, 184, 63, 0.35);
  border-radius: 14px;
  padding: 16px 22px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.viewall-cta-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-lt);
  box-shadow: 0 8px 28px rgba(229, 184, 63, 0.22);
}
.viewall-cta-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.viewall-cta-icon {
  font-size: 26px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(229, 184, 63, 0.12);
  border: 1px solid rgba(229, 184, 63, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.viewall-cta-title {
  font-size: 16px;
  font-weight: 800;
  color: #fae69e;
  margin: 0 0 3px;
  letter-spacing: 0.2px;
}
.viewall-cta-desc {
  font-size: 12.5px;
  color: #9fb3aa;
  margin: 0;
  line-height: 1.4;
}
.viewall-cta-btn {
  background: linear-gradient(180deg, #fae69e, #e5b83f 60%, #99741e);
  color: #121008;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(229, 184, 63, 0.35);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
@media (max-width: 540px) {
  .viewall-cta-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
  }
  .viewall-cta-btn {
    align-self: flex-end;
  }
}

/* ======================== Hamburger Button (Top-Left) ======================== */
@keyframes hamburger-bar-wave {
  0%, 100% {
    width: 100%;
    transform: scaleX(1);
    opacity: 0.95;
  }
  50% {
    width: 60%;
    transform: scaleX(0.68);
    opacity: 0.75;
  }
}

.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: rgba(14, 60, 45, 0.65);
  border: 1.5px solid rgba(229, 184, 63, 0.45);
  color: var(--gold-lt);
  cursor: pointer;
  padding: 0;
  transition: all .18s ease;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}
.hamburger-btn:hover {
  background: rgba(22, 90, 68, 0.85);
  border-color: var(--gold);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(229, 184, 63, 0.35);
}
.hamburger-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  width: 18px;
}
.hamburger-bars .bar {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: left center;
  transition: all .22s ease;
}
.hamburger-bars .bar:nth-child(1) {
  animation: hamburger-bar-wave 2.2s ease-in-out infinite;
  animation-delay: 0s;
}
.hamburger-bars .bar:nth-child(2) {
  animation: hamburger-bar-wave 2.2s ease-in-out infinite;
  animation-delay: 0.38s;
}
.hamburger-bars .bar:nth-child(3) {
  animation: hamburger-bar-wave 2.2s ease-in-out infinite;
  animation-delay: 0.76s;
}
.hamburger-btn:hover .bar {
  animation-play-state: paused;
}
.hamburger-btn:hover .bar:nth-child(1) { width: 100%; }
.hamburger-btn:hover .bar:nth-child(2) { width: 75%; }
.hamburger-btn:hover .bar:nth-child(3) { width: 90%; }
.hamburger-user-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fae69e, #e5b83f);
  color: #121008;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #061f18;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Header Right Bet Button */
.head-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: none;
}
.btn-head-bet {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #f8dc7a, #e5b83f);
  color: #141004;
  font-weight: 800;
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(229, 184, 63, 0.35);
  transition: all .16s ease;
}
.btn-head-bet svg { width: 16px; height: 16px; stroke-width: 2.2; }
.btn-head-bet:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(229, 184, 63, 0.55);
  color: #000;
}

/* ======================== Responsive Offcanvas Sidebar ======================== */
.bc-sidebar {
  width: 320px !important;
  max-width: 86vw !important;
  background: linear-gradient(180deg, #041d16 0%, #031510 100%) !important;
  border-right: 1.5px solid rgba(229, 184, 63, 0.28) !important;
  color: #e6f3ee !important;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.75) !important;
  display: flex;
  flex-direction: column;
  z-index: 1060;
}

.sidebar-head {
  padding: calc(16px + var(--safe-area-top)) 18px 16px;
  border-bottom: 1px solid rgba(229, 184, 63, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(3, 20, 15, 0.85);
}
.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-site-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--gold-lt);
  line-height: 1.1;
  letter-spacing: 0.2px;
}
.sidebar-site-tagline {
  font-size: 10.5px;
  color: #7bb5a3;
  margin-top: 2px;
}
.sidebar-body {
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* User Card inside Sidebar */
.sidebar-user-card {
  background: rgba(6, 40, 31, 0.7);
  border: 1px solid rgba(229, 184, 63, 0.25);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fae69e, #e5b83f);
  color: #161002;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff2bd;
  box-shadow: 0 4px 12px rgba(229, 184, 63, 0.35);
  flex: none;
}
.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-handle {
  font-size: 11.5px;
  color: #82bda9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role-badge {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(229, 184, 63, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-lt);
}
.sidebar-role-badge.is-admin {
  background: rgba(240, 68, 56, 0.18);
  border-color: #f04438;
  color: #ff8588;
}

/* Guest Card inside Sidebar */
.sidebar-guest-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-guest-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.guest-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(14, 60, 45, 0.8);
  border: 1px solid rgba(229, 184, 63, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-lt);
  flex: none;
}
.guest-icon svg { width: 20px; height: 20px; }
.guest-title { font-size: 14.5px; color: #fff; font-weight: 700; }
.guest-sub { font-size: 11px; color: #86bfae; margin: 2px 0 0; }

.sidebar-auth-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn-sidebar-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #f8dc7a, #e5b83f);
  color: #121008 !important;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(229, 184, 63, 0.3);
  transition: transform .14s;
}
.btn-sidebar-login svg { width: 15px; height: 15px; stroke-width: 2.2; }
.btn-sidebar-login:hover { transform: translateY(-1px); }

.btn-sidebar-reg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(12, 50, 38, 0.7);
  border: 1px solid rgba(229, 184, 63, 0.4);
  color: var(--gold-lt) !important;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  transition: all .14s;
}
.btn-sidebar-reg svg { width: 15px; height: 15px; stroke-width: 2.2; }
.btn-sidebar-reg:hover { background: rgba(22, 85, 65, 0.8); border-color: var(--gold); }

/* Sidebar Sections & Navigation List */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  opacity: 0.9;
}
.sidebar-section-title .bi { font-size: 13px; }
.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #cde4dc;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all .16s ease;
}
.sidebar-nav-item svg, .sidebar-nav-item .bi {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--gold-lt);
}
.sidebar-nav-item:hover {
  background: rgba(20, 80, 62, 0.6);
  color: #fff;
  transform: translateX(3px);
}
.sidebar-nav-item.highlight-bet {
  background: linear-gradient(90deg, rgba(229, 184, 63, 0.18), rgba(240, 68, 56, 0.12));
  border: 1px solid rgba(229, 184, 63, 0.35);
  color: #fff;
  font-weight: 700;
}
.sidebar-nav-item.highlight-bet:hover {
  background: linear-gradient(90deg, rgba(229, 184, 63, 0.28), rgba(240, 68, 56, 0.2));
  border-color: var(--gold);
}
.sidebar-badge-hot {
  margin-left: auto;
  background: linear-gradient(135deg, #f04438, #ff6a5c);
  color: #fff;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(240, 68, 56, 0.4);
}
.sidebar-nav-item.is-admin-link {
  color: #ff9d9f;
}
.sidebar-nav-item.is-admin-link svg {
  color: #ff6a5c;
}
.sidebar-nav-item.line-item {
  color: #38df7b;
}
.sidebar-nav-item.line-item svg {
  color: #06c755;
}

/* Logout Button */
.sidebar-logout-wrap {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(229, 184, 63, 0.15);
}
.btn-sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(240, 68, 56, 0.12);
  border: 1px solid rgba(240, 68, 56, 0.35);
  color: #ff6b6e;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .16s ease;
}
.btn-sidebar-logout svg {
  width: 16px;
  height: 16px;
}
.btn-sidebar-logout:hover {
  background: rgba(240, 68, 56, 0.25);
  color: #fff;
  border-color: #ff6a5c;
}

/* ======================== Bottom Nav Adjustments ======================== */
.bnav-bet-i {
  color: var(--ink-mute);
}
.bnav-bet-i .bnav-gold-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: transform .16s ease, color .16s ease;
}
.bnav-bet-i:hover,
.bnav-bet-i:focus-visible {
  color: var(--ink-dim);
}
.bnav-bet-i:hover .bnav-gold-ico {
  transform: scale(1.15);
  color: var(--gold-lt);
}
.bnav-bet-text {
  color: inherit;
  font-weight: 500;
}

/* แสดงสีทองเฉพาะเมื่ออยู่ในสถานะ active (.on) เท่านั้น */
.bnav-bet-i.on {
  color: var(--gold-lt);
}
.bnav-bet-i.on .bnav-gold-ico {
  color: var(--gold-lt);
  filter: drop-shadow(0 2px 6px rgba(229, 184, 63, 0.4));
}
.bnav-bet-i.on .bnav-bet-text {
  color: var(--gold-lt);
  font-weight: 700;
}

/* ======================== Master Lottery Table (Schedule-Focused) ======================== */
.cat-chip {
  display: inline-block;
  background: rgba(14, 60, 45, 0.6);
  border: 1px solid rgba(229, 184, 63, 0.25);
  color: #8ed0be;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.close-time-badge {
  background: rgba(229, 184, 63, 0.12);
  border: 1px solid rgba(229, 184, 63, 0.3);
  color: var(--gold-lt);
  font-weight: 700;
}
.draw-time-badge {
  background: rgba(6, 199, 85, 0.1);
  border: 1px solid rgba(6, 199, 85, 0.25);
  color: #6fe4a0;
  font-weight: 700;
}
.status-open {
  background: rgba(6, 199, 85, 0.16);
  border: 1px solid #06c755;
  color: #38e07a;
}
.btn-table-bet-direct {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #f04438, #c4301f);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(240, 68, 56, 0.4);
  transition: all .16s ease;
  white-space: nowrap;
}
.btn-table-bet-direct svg {
  width: 14px;
  height: 14px;
}
.btn-table-bet-direct:hover {
  background: linear-gradient(180deg, #f03338, #cf1b21);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(240, 68, 56, 0.55);
}

/* Mobile Card Schedule Layout */
.lotto-m-schedule-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.m-schedule-item {
  background: #02140e;
  border: 1px solid #124534;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.m-sched-lbl {
  font-size: 10.5px;
  color: #7cbda9;
}
.m-sched-val {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.btn-m-bet-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(180deg, #f04438, #c4301f);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(240, 68, 56, 0.4);
  transition: all .16s ease;
}
.btn-m-bet-full svg {
  width: 16px;
  height: 16px;
}
.btn-m-bet-full:hover {
  background: linear-gradient(180deg, #f03338, #cf1b21);
  color: #fff;
}

/* Highlight Thai Lottery Schedule Card */
.lotto-highlight-schedule {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.highlight-sched-item {
  background: #02140e;
  border: 1px solid #144937;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.highlight-sched-lbl {
  font-size: 11.5px;
  color: #82bca8;
}
.highlight-sched-val {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.text-rate {
  color: var(--gold-lt);
  font-size: 14px;
}
.highlight-action-wrap {
  display: flex;
  justify-content: flex-end;
}
.btn-highlight-bet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #fae69e, #e5b83f 60%, #99741e);
  color: #121008;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 24px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 3px 14px rgba(229, 184, 63, 0.4);
  transition: all .16s ease;
}
.btn-highlight-bet svg {
  width: 17px;
  height: 17px;
}
.btn-highlight-bet:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 184, 63, 0.6);
  color: #000;
}

@media (max-width: 640px) {
  .lotto-highlight-schedule {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .highlight-action-wrap {
    justify-content: stretch;
  }
  .btn-highlight-bet {
    width: 100%;
    justify-content: center;
  }
}

/* All Lottery Cards Grid (like front-page card layout) */
.all-lottery-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1024px) {
  .all-lottery-cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}
@media (max-width: 680px) {
  .all-lottery-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .all-lottery-cards-grid .lottery-card {
    padding: 12px 8px 10px;
  }
  .all-lottery-cards-grid .lottery-card-title {
    font-size: 14px;
    margin-bottom: 6px;
  }
  .all-lottery-cards-grid .lottery-time-list {
    padding: 5px 6px;
    font-size: 11px;
  }
  .all-lottery-cards-grid .btn-lottery-action {
    font-size: 11.5px;
    padding: 5px 0;
  }
}
@media (max-width: 380px) {
  .all-lottery-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .all-lottery-cards-grid .lottery-card {
    padding: 10px 6px 8px;
  }
  .all-lottery-cards-grid .lottery-card-title {
    font-size: 13px;
  }
}

/* ==========================================================================
   Admin Lottery Page & Public Lottery Mobile Responsive Polish
   ========================================================================== */

/* 1. Admin Lottery Sub-Nav Bar (Smooth swipe track on mobile) */
.lotto-subnav-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  align-items: center;
}
@media (max-width: 768px) {
  .lotto-subnav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  .lotto-subnav-tabs::-webkit-scrollbar { display: none; }
  .lotto-subnav-tabs .btn {
    flex: none;
    padding: 7px 12px;
    font-size: 13px;
  }
}

/* 2. Admin Search & Filter Bar */
.lotto-head-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.lotto-head-text {
  flex: 1 1 260px;
}
.lotto-search-box {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 240px;
  max-width: 300px;
}
.lotto-admin-search-input {
  width: 100%;
  padding: 8px 14px 8px 34px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  outline: none;
}
.lotto-admin-search-input:focus {
  border-color: var(--gold-dp);
}
@media (max-width: 640px) {
  .lotto-search-box {
    max-width: 100%;
    width: 100%;
    flex: 1 1 100%;
  }
}

/* 3. Admin Filters (Category & Status horizontal scroll on mobile) */
.lotto-filters-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.lotto-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lotto-filter-lbl {
  font-size: 12px;
  color: var(--ink-mute);
  min-width: 44px;
  flex: none;
}
.lotto-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 640px) {
  .lotto-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
  }
  .lotto-filter-chips::-webkit-scrollbar { display: none; }
  .lotto-filter-chips .btn {
    flex: none;
    white-space: nowrap;
  }
}

/* 4. Admin Lottery Mobile Cards List (< 768px) */
.lotto-admin-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lotto-admin-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease;
}
.lotto-admin-card.is-off {
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.015);
}
.lotto-admin-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lotto-admin-card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.lotto-admin-card-timebox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}
.lotto-admin-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.lotto-admin-btn-action {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink-mute);
  padding: 0 4px;
  transition: all .14s ease;
}
.lotto-admin-btn-action.active {
  background: rgba(229, 184, 63, 0.12);
  border-color: var(--gold);
  color: var(--gold-lt);
}
.lotto-admin-btn-action.active-green {
  background: rgba(6, 199, 85, 0.12);
  border-color: #06c755;
  color: #06c755;
}

/* Scraper Stats Grid */
.scraper-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
@media (max-width: 480px) {
  .scraper-stats-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* 5. Mobile fine-tuning for Public Homepage components (< 540px and < 420px) */
@media (max-width: 540px) {
  .lottery-grid {
    gap: 8px;
  }
  .lottery-card {
    padding: 10px 5px 8px;
    border-radius: 12px;
  }
  .lottery-card-title {
    font-size: 13px;
    margin-bottom: 5px;
  }
  .lottery-time-list {
    padding: 5px 6px;
    gap: 4px;
    border-radius: 8px;
    margin-bottom: 8px;
  }
  .lottery-time-item {
    font-size: 11px;
  }
  .time-label {
    font-size: 10.5px;
  }
  .time-value {
    font-size: 12px;
  }
  .btn-lottery-action {
    font-size: 12px;
    padding: 6px 0;
    border-radius: 8px;
  }
}

@media (max-width: 420px) {
  /* Countdown banner stacks neatly on narrow phones */
  .countdown-banner {
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 12px;
    gap: 8px 10px;
  }
  .countdown-brand {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
    min-width: 0;
  }
  .countdown-brand > div { min-width: 0; }
  .countdown-timer-group {
    flex: 1;
    justify-content: center;
  }
  .btn-countdown-bet {
    padding: 6px 14px;
    font-size: 12px;
  }
}

@media (max-width: 375px) {
  /* Ultra-compact screen swipe for 3 hot cards */
  .lottery-grid {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    margin: 0 -4px;
    padding: 2px 4px 6px;
    scrollbar-width: none;
  }
  .lottery-grid::-webkit-scrollbar { display: none; }
  .lottery-grid .lottery-card {
    flex: 0 0 135px;
    min-width: 135px;
    scroll-snap-align: start;
  }
}

/* ==========================================================================
   RongYok Style Categories Page Styling (/หมวดหมู่)
   ========================================================================== */

.ry-cat-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 0 36px;
}

/* 1. Header Bar */
.ry-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.ry-cat-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -0.3px;
}
.ry-cat-search-form {
  flex: 1 1 200px;
  max-width: 280px;
  margin-left: auto;
}
.ry-cat-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ry-cat-search-input {
  width: 100%;
  padding: 8px 38px 8px 16px;
  font-size: 13.5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
  transition: all .18s ease;
}
.ry-cat-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.ry-cat-search-input:focus {
  border-color: #a855f7;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}
.ry-cat-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.ry-cat-search-btn:hover {
  color: #fff;
}

/* 2. Top Grid - 5 Cards */
.ry-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}
.ry-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.ry-card:hover {
  transform: translateY(-2px);
  color: #fff;
}
.ry-card-new {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.ry-card-pop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.ry-card-dub {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
.ry-card-sub {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}
.ry-card-all {
  grid-column: span 2;
  background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
  padding: 16px 20px;
}
.ry-card-ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #fff;
}
.ry-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ry-card-info b {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}
.ry-card-info em {
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

/* 3. Section Titles */
.ry-sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 26px 0 14px;
}
.ry-sec-title {
  color: #ff4747;
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.2px;
}
.ry-btn-all {
  background: rgba(185, 28, 28, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: all .16s ease;
}
.ry-btn-all:hover {
  background: rgba(185, 28, 28, 0.4);
  color: #fff;
  border-color: #ef4444;
}

/* 4. Genres Pills Wrap - High Performance & Lag-Free */
.ry-sec-genres {
  content-visibility: auto;
}
.ry-genres-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 7px;
  contain: layout style;
}
.ry-genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.ry-genre-pill:hover {
  transform: translateY(-1.5px);
}
.ry-genre-name {
  color: inherit;
}
.ry-genre-count {
  font-size: 11.5px;
  opacity: 0.8;
  font-weight: 500;
}
.ry-expand-bar {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.ry-btn-expand-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.ry-btn-expand-more:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.ry-btn-expand-more.is-expanded {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.ry-btn-expand-more.is-expanded:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
}

/* 5. Popular Now Cards Track */
.ry-pop-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .ry-pop-track {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 640px) {
  .ry-pop-track {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    gap: 10px;
    scrollbar-width: none;
  }
  .ry-pop-track::-webkit-scrollbar { display: none; }
  .ry-pop-card {
    flex: 0 0 135px;
    min-width: 135px;
    scroll-snap-align: start;
  }
}
.ry-pop-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease;
}
.ry-pop-card:hover {
  transform: translateY(-2px);
}
.ry-pop-art-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1226;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ry-pop-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ry-pop-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.ry-pop-badge.dub {
  background: #2563eb;
}
.ry-pop-badge.sub {
  background: #10b981;
}
.ry-pop-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  margin: 6px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}


/* ==========================================================================
 * ปุ่มแทงหวยทุกจุด = แดงส้ม #F04438 (ลูกค้ากำหนด ต.ค. 2026) — เดิมบางปุ่มเป็นทอง
 * ========================================================================== */
.btn-head-bet, .btn-highlight-bet {
  background: linear-gradient(180deg, #ff5a4d, var(--red-btn) 55%, var(--red-btn-dp));
  color: #fff;
  box-shadow: 0 3px 14px rgba(240, 68, 56, 0.45);
}
.btn-head-bet:hover, .btn-highlight-bet:hover { color: #fff; box-shadow: 0 6px 20px rgba(240, 68, 56, 0.6); filter: brightness(1.06); }
.sidebar-nav-item.highlight-bet {
  background: linear-gradient(90deg, rgba(240, 68, 56, 0.26), rgba(240, 68, 56, 0.1));
  border-color: rgba(240, 68, 56, 0.55);
}
.sidebar-nav-item.highlight-bet:hover {
  background: linear-gradient(90deg, rgba(240, 68, 56, 0.38), rgba(240, 68, 56, 0.16));
  border-color: var(--red-btn);
}

/* ==========================================================================
 * แถบเมนูล่าง + ระยะท้ายหน้า (แก้ ต.ค. 2026)
 * เดิมเหรียญ "แทงหวย" ใช้ top:-22px — กล่องปุ่มยังกินความสูงเต็ม แถบเลยสูง ~98px บนเดสก์ท็อป
 * แต่ body เผื่อไว้แค่ 56px → footer / ปุ่มแบ่งหน้าโดนแถบล่างทับ
 * ตอนนี้: เหรียญลอยขึ้นด้วย margin ติดลบ (ไม่เพิ่มความสูงแถบ) แถบสูงคงที่ 54px
 * แล้วเผื่อท้ายหน้า = แถบ 54 + เหรียญที่โผล่ขึ้นมา 34 + ช่องหายใจ 20 (ขยายเหรียญ 64px ตามลูกค้าขอ)
 * ========================================================================== */
.bnav-i { min-height: 54px; padding: 6px 4px; }
.bnav-center-btn { top: 0; min-height: 54px; justify-content: flex-end; padding-top: 0; padding-bottom: 6px; }
.bnav-center-circle { width: 64px; height: 64px; padding: 3px; margin-top: -34px; }
.bnav-center-text { font-size: 11px; margin-top: 2px; }
body { padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
.toast-stack { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }

/* เดสก์ท็อป: ปุ่มเล็กลง ไม่เทอะทะ */
@media (min-width: 768px) {
  .bnav-i svg { width: 20px; height: 20px; }
  .bnav-i span { font-size: 11px; }
  .bnav-center-circle { width: 62px; height: 62px; margin-top: -32px; }
  body { padding-bottom: calc(106px + env(safe-area-inset-bottom, 0px)); }
  .pager { gap: 6px; margin: 28px 0; }
  .pager a, .pager span { min-width: 34px; padding: 6px 10px; font-size: 13px; border-radius: 8px; line-height: 1.4; }
}

/* ==========================================================================
 * เหรียญ "แทงหวย" กลางแถบล่าง — เคลื่อนไหวจังหวะเดียวกับปุ่ม hamburger (2.2 วิ)
 * ลอยขึ้นลง · วงแหวนทองหมุนรอบ · แสงวาบวิ่งผ่านหน้าเหรียญ · คลื่นเรืองแสงกระจายออก
 * ชี้/แตะแล้วหยุดลอย ขยายขึ้นนิด · ผู้ใช้ที่ตั้งลดการเคลื่อนไหวในเครื่อง = นิ่ง
 * ========================================================================== */
@keyframes coin-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes coin-ring-spin { to { transform: rotate(360deg); } }
@keyframes coin-shine { 0%, 62% { transform: translateX(-130%) rotate(25deg); } 100% { transform: translateX(130%) rotate(25deg); } }
@keyframes coin-ripple { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.55); opacity: 0; } }

.bnav-center-circle {
  position: relative;
  isolation: isolate;
  animation: coin-float 2.2s ease-in-out infinite;
}
/* วงแหวนทองหมุน — conic gradient ตัดเหลือแค่ขอบด้วย mask */
.bnav-center-circle::before {
  content: ""; position: absolute; inset: -4px; z-index: -1; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(248, 220, 122, .15) 65%, #f8dc7a 82%, #fff6cf 88%, transparent 96%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: coin-ring-spin 2.2s linear infinite;
}
/* คลื่นเรืองแสงกระจายออก */
.bnav-center-circle::after {
  content: ""; position: absolute; inset: -2px; z-index: -2; border-radius: 50%;
  border: 2px solid rgba(248, 220, 122, .55);
  animation: coin-ripple 2.2s ease-out infinite;
  pointer-events: none;
}
/* แสงวาบวิ่งผ่านหน้าเหรียญ (ตัดในวงกลม) */
.bnav-coin-shine {
  position: absolute; inset: 3px; z-index: 2; border-radius: 50%; overflow: hidden; pointer-events: none;
}
.bnav-coin-shine::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 0; width: 38%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: coin-shine 3.3s ease-in-out infinite;
}
.bnav-center-btn:hover .bnav-center-circle,
.bnav-center-btn:focus-visible .bnav-center-circle { animation-play-state: paused; }
.bnav-center-btn:hover .bnav-center-circle::before { animation-duration: 1.1s; }
.bnav-center-btn:active .bnav-center-circle { transform: scale(.94); }
.bnav-center-btn.on .bnav-center-text { color: #f8dc7a; }

@media (prefers-reduced-motion: reduce) {
  .bnav-center-circle, .bnav-center-circle::before, .bnav-center-circle::after, .bnav-coin-shine::before { animation: none; }
  .bnav-center-circle::after { opacity: 0; }
}

/* ==========================================================================
 * หวยมาแรง (ต.ค. 2026) — การ์ดใหม่ .hot-* (components/lottery.tsx LotteryTrendingSec)
 * จอกว้าง 3 คอลัมน์ · < 640px ปัดซ้าย-ขวา (scroll-snap) เห็นการ์ดถัดไป ~15%
 * นาฬิกากล่องใหญ่เดินทุกวินาที · < 10 นาที = สีส้ม + จุดกะพริบ · ปิดรับแล้ว = จาง
 * ========================================================================== */
.hot-lotto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hot-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 16px; border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(229, 184, 63, .09), transparent 55%),
    linear-gradient(180deg, #0f3a2e 0%, #0a2a21 100%);
  border: 1px solid rgba(229, 184, 63, .2);
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.hot-card:hover { transform: translateY(-3px); border-color: rgba(229, 184, 63, .5); box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .9); }

/* หัวการ์ด: ธง · ชื่อ+หมวด · สถานะ */
.hot-card-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hot-flag { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; padding: 2px; background: linear-gradient(140deg, #f8dc7a, #a8842a); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.hot-flag .flag-badge { width: 100%; height: 100%; border: 0; box-shadow: none; }
.hot-card-id { min-width: 0; flex: 1; }
.hot-card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.hot-card-cat { display: block; font-size: 12px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot-status {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #86efac; background: rgba(16, 185, 129, .13); border: 1px solid rgba(52, 211, 153, .35);
}
.hot-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: hot-dot 1.8s ease-out infinite; }
@keyframes hot-dot { 0% { box-shadow: 0 0 0 0 rgba(134, 239, 172, .6); } 100% { box-shadow: 0 0 0 7px rgba(134, 239, 172, 0); } }

/* นาฬิกานับถอยหลัง */
.hot-timer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px 10px; border-radius: 14px; background: rgba(4, 20, 14, .65); border: 1px solid rgba(255, 249, 234, .06); }
.hot-timer-lbl { font-size: 12px; color: var(--ink-mute); letter-spacing: .02em; }
.hot-digits { display: flex; align-items: flex-start; justify-content: center; gap: 4px; }
.hot-unit { display: flex; align-items: flex-start; gap: 4px; }
.hot-box { display: flex; flex-direction: column; align-items: center; }
.hot-unit b {
  display: block; min-width: 46px; padding: 6px 6px 4px; border-radius: 10px; text-align: center;
  font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--gold-lt); font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #154a3b, #0c3127); border: 1px solid rgba(229, 184, 63, .28);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25);
}
.hot-unit small { display: block; margin-top: 3px; font-size: 10.5px; color: var(--ink-mute); text-align: center; }
.hot-sep { align-self: flex-start; padding-top: 6px; font-style: normal; font-size: 20px; font-weight: 800; color: rgba(248, 220, 122, .55); }
.hot-timer-plain { font-size: 20px; font-weight: 800; color: var(--ink); }
.hot-timer.is-soon .hot-unit b { color: #ffd08a; border-color: rgba(245, 158, 11, .55); background: linear-gradient(180deg, #4a3315, #2b1d0c); animation: hot-soon 1s ease-in-out infinite alternate; }
@keyframes hot-soon { to { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), 0 0 14px rgba(245, 158, 11, .35); } }

.hot-meta { display: flex; justify-content: center; font-size: 13px; color: var(--ink-dim); }
.hot-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hot-card .hot-bet { margin-top: auto; padding: 11px 0; font-size: 15px; border-radius: 12px; }

/* สถานะ */
.hot-card.is-soon { border-color: rgba(245, 158, 11, .45); }
.hot-card.is-soon .hot-status { color: #fcd34d; background: rgba(245, 158, 11, .13); border-color: rgba(245, 158, 11, .4); }
.hot-card.is-closed { opacity: .6; }
.hot-card.is-closed .hot-status { color: var(--ink-mute); background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); }
.hot-card.is-closed .hot-status i { animation: none; }

/* แท็บเล็ต: การ์ดแคบลง ตัวเลขเล็กลงนิด */
@media (max-width: 960px) {
  .hot-lotto-grid { gap: 10px; }
  .hot-card { padding: 13px; gap: 10px; }
  .hot-flag { width: 38px; height: 38px; }
  .hot-card-title { font-size: 14.5px; }
  .hot-status { padding: 3px 8px; font-size: 11px; }
  .hot-card-top { align-items: flex-start; }
  .hot-card-top .hot-status { margin-top: 2px; }
  .hot-unit b { min-width: 38px; font-size: 20px; }
}
/* มือถือ: ปัดซ้าย-ขวา */
@media (max-width: 640px) {
  .hot-lotto-grid {
    /* เลื่อนชนขอบจอ: .wrap กว้าง 92vw → ขอบข้างละ 4vw */
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 4vw;
    margin: 0 -4vw; padding: 4px 4vw 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .hot-lotto-grid::-webkit-scrollbar { display: none; }
  .hot-card { flex: 0 0 min(82%, 300px); scroll-snap-align: start; }
  .hot-card:hover { transform: none; }
  .hot-unit b { min-width: 44px; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .hot-status i, .hot-timer.is-soon .hot-unit b { animation: none; }
}

/* หวยมาแรง เกิน 3 ใบ (ตั้งในหลังบ้าน) — จอใหญ่เห็นทีละ 3 ใบ เลื่อนได้ + ปุ่มลูกศร · มือถือใช้แบบปัดด้านบน */
.hot-lotto-rail { position: relative; }
@media (min-width: 641px) {
  .hot-lotto-rail.is-scroll .hot-lotto-grid {
    display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    /* เผื่อที่ให้เงา/การ์ดที่ยกขึ้นตอนชี้ ไม่โดนตัด */
    padding: 6px 2px 14px; margin: -6px -2px -14px;
  }
  .hot-lotto-rail.is-scroll .hot-lotto-grid::-webkit-scrollbar { display: none; }
  .hot-lotto-rail.is-scroll .hot-card { flex: 0 0 calc((100% - 28px) / 3); scroll-snap-align: start; }
}
@media (min-width: 641px) and (max-width: 960px) {
  .hot-lotto-rail.is-scroll .hot-lotto-grid { gap: 10px; }
  .hot-lotto-rail.is-scroll .hot-card { flex-basis: calc((100% - 20px) / 3); }
}
.hot-nav {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 26px; line-height: 1; font-weight: 700; color: var(--gold-lt); cursor: pointer;
  background: rgba(6, 31, 24, .92); border: 1.5px solid rgba(229, 184, 63, .55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .55); transition: opacity .2s, transform .2s, background .2s;
}
.hot-nav.prev { left: -14px; }
.hot-nav.next { right: -14px; }
.hot-nav:hover:not(:disabled) { background: #10352b; transform: translateY(-50%) scale(1.08); }
.hot-nav:disabled { opacity: 0; pointer-events: none; }
@media (max-width: 640px) { .hot-nav { display: none; } }


/* Android/narrow mobile header: explicit slots prevent flex wrapping and search drift. */
@media (max-width: 540px) {
  .site-head .head-in {
    display: grid;
    grid-template-columns: 40px max-content minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 10px;
    padding: 9px 0 10px;
  }
  .site-head .hamburger-btn { grid-column: 1; grid-row: 1; }
  .site-head .head-right-actions {
    grid-column: 2; grid-row: 1; margin: 0;
  }
  .site-head .brand {
    grid-column: 3; grid-row: 1; min-width: 0; gap: 7px;
    overflow: hidden;
  }
  .site-head .brand-mark-tv { flex: none; }
  .site-head .brand-text-col { min-width: 0; }
  .site-head .brand-name, .site-head .brand-sub {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .site-head .search {
    grid-column: 1 / -1; grid-row: 2;
    width: 100%; max-width: none; min-width: 0;
    margin: 0; gap: 9px;
  }
  .site-head .search input {
    width: 100%; min-width: 0; padding: 10px 14px;
    font-size: 14px; line-height: 20px;
  }
  .site-head .search button { width: 40px; height: 40px; }
}


/* Emblem JPGs contain baked-in margin: zoom the artwork to match full-size flag badges. */
.hot-flag { overflow: hidden; }
.hot-flag > img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  flex: none;
  border-radius: 50%;
  object-fit: cover !important;
  transform: scale(1.24);
  transform-origin: center;
}

/* Fullscreen episode selector stays reachable over the video on mobile and desktop. */
.watch-episode-picker {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  z-index: 27; pointer-events: auto;
}
.watch-episode-toggle {
  width: 43px; height: 43px; padding: 8px; display: grid; place-items: center;
  background: rgba(1, 25, 20, .85); color: #fff;
  border: 1px solid rgba(248, 220, 122, .65); border-radius: 10px;
  cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.45);
}
.watch-episode-menu {
  position: absolute; right: 48px; top: 50%; transform: translateY(-50%);
  width: min(280px, 70vw); max-height: min(65vh, 420px);
  background: rgba(3, 30, 24, .97); color: #fff;
  border: 1px solid rgba(248,220,122,.55); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.7); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.watch-episode-heading { font-weight: 800; font-size: 14px; color: #f8dc7a; }
.watch-episode-grid {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 7px; overflow-y: auto; overscroll-behavior: contain;
}
.watch-episode-grid a {
  padding: 8px 2px; text-align: center; color: #fff;
  font-size: 12px; border: 1px solid #285747; border-radius: 7px;
  background: #0b392d;
}
.watch-episode-grid a.current { color: #221903; background: #f8dc7a; font-weight: 800; }
@media (max-width: 540px) {
  .watch-episode-picker { right: 7px; }
  .watch-episode-toggle { width: 36px; height: 36px; padding: 7px; }
  .watch-episode-menu { right: 41px; width: min(260px, 72vw); }
}

/* Attach episode picker to the video viewport (not Plyr's control bar). */
.player-wrap > .watch-episode-picker,
.player-wrap .plyr--fullscreen-active > .watch-episode-picker {
  position: absolute !important;
  top: 50% !important;
  bottom: auto !important;
  right: 12px !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 100 !important;
}
@media (max-width: 540px) {
  .player-wrap > .watch-episode-picker,
  .player-wrap .plyr--fullscreen-active > .watch-episode-picker { right: 8px !important; }
}

/* Balanced compact countdown card on phone screens. */
@media (max-width: 540px) {
  .countdown-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 10px;
    padding: 14px 15px;
    border-radius: 16px;
  }
  .countdown-brand {
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    text-align: left;
  }
  .countdown-brand > img, .countdown-brand > .flag-badge { flex: 0 0 36px; width: 36px; height: 36px; }
  .countdown-brand > div { flex: 1 1 auto; min-width: 0; }
  .countdown-title { font-size: 15px; line-height: 1.3; }
  .countdown-sub { font-size: 11px; margin-top: 2px; }
  .countdown-timer-group {
    grid-column: 1;
    display: flex;
    width: auto;
    min-width: 0;
    flex: none;
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
  }
  .countdown-box {
    min-width: 34px;
    padding: 5px 6px;
    font-size: 16px;
    line-height: 1.25;
    border-radius: 8px;
  }
  .countdown-sep { margin-bottom: 11px; }
  .btn-countdown-bet {
    grid-column: 2;
    align-self: center;
    white-space: nowrap;
    padding: 9px 13px;
    font-size: 12px;
    border-radius: 999px;
  }
}
@media (max-width: 360px) {
  .countdown-banner { padding: 12px; column-gap: 7px; }
  .countdown-timer-group { gap: 1px; }
  .countdown-box { min-width: 29px; padding: 5px 4px; font-size: 14px; }
  .btn-countdown-bet { padding: 8px 10px; }
}

/* Episode menu: four-square glyph only, no visible button container. */
.watch-episode-toggle,
.watch-episode-toggle:hover,
.watch-episode-toggle:active {
  width: 40px;
  height: 40px;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 7px;
  background: transparent !important;
  box-shadow: none !important;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.9));
  -webkit-tap-highlight-color: transparent;
}
.watch-episode-toggle svg { display: block; width: 26px; height: 26px; }
.watch-episode-toggle:focus-visible { outline: 2px solid #f8dc7a; outline-offset: 2px; border-radius: 5px !important; }
@media (max-width: 540px) {
  .watch-episode-toggle { width: 38px; height: 38px; padding: 6px; }
}

/* Align mobile countdown digits with the status text below the lottery title. */
@media (max-width: 540px) {
  .countdown-banner .countdown-timer-group { margin-left: 43px; }
}
@media (max-width: 360px) {
  .countdown-banner .countdown-timer-group { margin-left: 36px; }
}

/* Lower the live lottery badge away from the device top edge only in fullscreen. */
.player-wrap .plyr--fullscreen-active .watch-lotto-popup,
.player-wrap:fullscreen .watch-lotto-popup,
.plyr:fullscreen .watch-lotto-popup,
.player-wrap:-webkit-full-screen .watch-lotto-popup,
.plyr:-webkit-full-screen .watch-lotto-popup {
  top: 36px !important;
}
@media (max-width: 540px) {
  .player-wrap .plyr--fullscreen-active .watch-lotto-popup,
  .player-wrap:fullscreen .watch-lotto-popup,
  .plyr:fullscreen .watch-lotto-popup,
  .player-wrap:-webkit-full-screen .watch-lotto-popup,
  .plyr:-webkit-full-screen .watch-lotto-popup { top: 32px !important; }
}
