/* ==========================================================
   MUIN777 — ปรับปุ่ม/เมนูสำหรับแท็บเล็ตและมือถือ
   โหลดเป็นไฟล์ "สุดท้าย" ต่อจาก muin-buttons.css
   ฉบับ v2: เมนูแสดงครบ 9 อัน ไม่ต้องปัด
   ใช้ selector หนักขึ้น + !important เฉพาะเรื่องเลย์เอาต์เมนู
   เพื่อให้ชนะไฟล์อื่นไม่ว่าลำดับการโหลดจะเป็นอย่างไร
   ========================================================== */

/* ---------- เมนู: จอ ≤ 1150px ขึ้นบรรทัดใหม่ให้เห็นครบทั้ง 9 เมนู ---------- */
@media (max-width: 1150px) {
  header.navbar .navlinks {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    overflow: visible !important;
    gap: 6px 4px !important;
    padding: 8px 12px !important;
    min-height: 0 !important;
    border-radius: 28px !important;
    scroll-snap-type: none !important;
  }
  header.navbar .navlinks a,
  header.navbar .navlinks a:first-child,
  header.navbar .navlinks a:last-child {
    margin: 0 !important;
    min-height: 0 !important;
    flex: none;
  }
}

/* ---------- มือถือ: เมนูเป็นไทล์ไอคอนบน-ชื่อล่าง แถวละ 5 ---------- */
@media (max-width: 600px) {
  header.navbar .navlinks {
    margin: 6px 8px 12px !important;
    padding: 10px 4px 8px !important;
    gap: 8px 0 !important;
    border-radius: 22px !important;
  }
  header.navbar .navlinks a,
  header.navbar .navlinks a:first-child,
  header.navbar .navlinks a:last-child {
    flex: 0 0 20% !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 3px !important;
    padding: 2px 1px !important;
    border-radius: 14px;
    font-size: 11px !important;
    line-height: 1.2;
    text-align: center;
    white-space: normal !important;
  }
  header.navbar .navlinks a::before {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }

  /* ---------- ปุ่มสมัคร / เข้าสู่ระบบ ---------- */
  .top-actions { gap: 8px; }
  .top-actions a {
    min-width: 0;
    min-height: 40px;
    padding: 9px 14px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  /* ---------- ปุ่มกรองหมวดหวย: ขึ้นบรรทัดใหม่ เห็นครบทุกปุ่ม ---------- */
  .results-section .filters {
    flex-wrap: wrap;
    overflow: visible;
    justify-content: center;
    gap: 8px;
    padding: 6px 2px 14px;
  }
  .results-section .filter {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12.5px;
    text-align: center;
    white-space: nowrap;
  }
  .results-section .filter.active {
    transform: translateY(-1px) scale(1.03);
  }

  /* ---------- ปุ่มในแบนเนอร์ ---------- */
  .hero-links { gap: 10px; }
  .hero-links a {
    flex: 1 1 0;
    min-height: 46px;
    padding: 12px 10px;
    text-align: center;
    font-size: 13.5px;
  }

  /* ---------- ปุ่มลิงก์โปรโมชั่น / ข่าว ---------- */
  .promo-section .promo-link,
  .updates-section .promo-link {
    min-height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .section-heading .promo-link { align-self: stretch; }

  /* ---------- การ์ดเกม ---------- */
  .games-section .game-card { min-height: 84px; }

  /* ---------- หวยเลขชุด / รายการทั่วไป: ข้อความยาวต้องไม่ล้นจอ ---------- */
  .results-section .set .results-table th:first-child,
  .results-section .set .results-table td:first-child { width: 38%; }
  .results-section .set .results-table th:last-child,
  .results-section .set .results-table td:last-child  { width: 62%; }

  body .results-section .set .results-table .number-chip,
  body .results-section .generic .results-table .number-chip {
    display: inline-flex;
    max-width: 100%;
    height: auto;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 16px;       /* จากแคปซูล เป็นกล่องมุมมน เพื่อให้ขึ้นบรรทัดใหม่ได้ */
    font-size: 14px;
    line-height: 1.35;
    letter-spacing: .01em;
    text-align: center;
    white-space: normal;       /* ยกเลิก nowrap ที่ทำให้ล้นขอบ */
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .results-section .set .results-table td,
  .results-section .generic .results-table td { overflow-wrap: anywhere; }
}

/* ==========================================================
   v4: บังคับแก้หวยเลขชุด/รายการทั่วไป ให้ชนะไฟล์อื่นทุกไฟล์ (ใช้ !important)
   ========================================================== */
@media (max-width: 700px) {
  body .results-section .set .results-table .number-chip,
  body .results-section .generic .results-table .number-chip {
    display: inline-flex !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 40px !important;
    padding: 6px 10px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    letter-spacing: .01em !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .results-section .set .results-table,
  .results-section .generic .results-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }
  .results-section .set .results-table th:first-child,
  .results-section .set .results-table td:first-child { width: 38% !important; }
  .results-section .set .results-table th:last-child,
  .results-section .set .results-table td:last-child  { width: 62% !important; }
}