/* MAHAHANG999 gold-black override — on top of live template */
:root {
  --Main-Primary: #e8c547 !important;
  --Main-Primary-Light: #f5d76e !important;
  --RGB_Main-Primary-Light: 245, 215, 110 !important;
  --Main-Primary-Dark: #a67c00 !important;
  --RGB_Main-Primary-Dark: 166, 124, 0 !important;
  --Main-Secondary: #ffe566 !important;
  --RGB_Main-Secondary: 255, 229, 102 !important;
  --BG-Surface: #0a0a0a !important;
  --BG-Surface-Plane: #0a0a0a !important;
  --BG-Surface-plane: #0a0a0a !important;
  --BG-Surface-Lighter: #1a160e !important;
  --BG-Surface-Darker: #050505 !important;
  --BG-Surface-Sidebar: #111111 !important;
  --BG-Sidebar-Shadow: #e8c547 !important;
  --body: #0a0a0a !important;
  --body-bg: #0a0a0a !important;
  --background: #0a0a0a !important;
  --background-top: #1a160e !important;
  --header: #0a0a0a !important;
  --Card-Normal: #141210 !important;
  --Card-Darker: #080808 !important;
  --Card-Lighter: #242018 !important;
  --Text-Icon-Highlight: #f5d76e !important;
  --Text-Icon-Title: #f5f0e6 !important;
  --Text-Icon-Body: #a8a090 !important;
  --Text-Btn-Primary: #0a0a0a !important;
  --Input-default: #1a160e !important;
  --Input-stroke: #8b6914 !important;
  --Input-stroke-active: #f5d76e !important;
  --bo-Main-Primary-Light: #f5d76e !important;
  --bo-Main-Primary-Dark: #a67c00 !important;
  --bo-Main-Secondary: #ffe566 !important;
  --bo-BG-Surface-plane: #0a0a0a !important;
  --bo-BG-Surface-Lighter: #1a160e !important;
  --bo-BG-Surface-Darker: #050505 !important;
  --bo-BG-Surface-Sidebar: #111111 !important;
  --bo-Card-Normal: #141210 !important;
  --bo-Card-Lighter: #242018 !important;
  --bo-Card-Darker: #080808 !important;
  --bo-Input-stroke-active: #e8c547 !important;
  --bo-Text-Icon-Highlight: #f5d76e !important;
  --atomic-render-logo: url("/assets/logo.png") !important;
}
html, body { background:#0a0a0a !important; color:#f5f0e6; }
img[alt*="MAHAHANG"], img[src*="logo"] {
  background: transparent !important;
}

/* splash loader — บังคับโลโก้เรา */
html.atomic-render-pending {
  --atomic-render-logo: url("/assets/logo.png") !important;
  --atomic-render-bg: #0a0a0a !important;
}
html.atomic-render-pending::before,
html.atomic-render-layout::before,
.atomic-render-cover::before,
[class*="atomic-render"]::before {
  background-image: url("/assets/logo.png") !important;
}

/* ========== Mobile polish ========== */
@media (max-width: 768px) {
  /* ปุ่มเข้าสู่ระบบ / สมัคร — class จริงคือ btn-unified-type11 (ไม่ใช่ nl-btn) */
  .layout-header-wrapper .btn-unified,
  .layout-chrome-header .btn-unified,
  header .btn-unified,
  .btn-unified.btn-unified-type11.bt11-md,
  .btn-unified.bt11-primary.bt11-md,
  .btn-unified.bt11-secondary.bt11-md {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
    letter-spacing: 0 !important;
  }

  .layout-header-wrapper .btn-unified-content,
  .layout-chrome-header .btn-unified-content,
  header .btn-unified-content,
  .btn-unified.bt11-md .btn-unified-content {
    font-size: 13px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: auto !important;
    max-height: 100% !important;
  }

  /* แถวปุ่มในหัว — กว้างพอ ไม่บีบจนตัดบรรทัด */
  .layout-header-wrapper .flex.gap-2.p-2,
  .layout-chrome-header .flex.gap-2.p-2 {
    gap: 8px !important;
    padding: 8px 6px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  /* โลโก้หัวไม่กินที่เกิน */
  .layout-header-wrapper img[src*="logo"],
  .layout-chrome-header img[src*="logo"] {
    max-height: 44px !important;
    width: auto !important;
  }

  /* เมนูลัด — ป้ายยาวอ่านได้ (2 บรรทัด) ไม่ตัดเป็น ... */
  .sticky-promotion,
  .sticky-promotions-wrapper {
    gap: 4px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  .event-card-label {
    font-size: 10px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: keep-all !important;
    hyphens: none !important;
    max-height: 2.4em !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ปิดเทศกาลลอยกระทง — แต่คงปุ่มกลางฝาก/ถอน (.center-float-btn) */
  .festival-ambient-host,
  .festival-ambient-layer,
  .festival-sky-lantern,
  .festival-float-up,
  .festival-header-decoration,
  .festival-banner-tree,
  .festival-footer-corners,
  .layout-header-wrapper--festival-decoration .festival-header-decoration {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* footer มุมเทศกาลไม่ทับ bottom nav — อย่าซ่อนปุ่มฝาก/ถอน */
  [class*="festival-footer"],
  [class*="footer-corner"]:not(.center-float-btn):not([class*="center-float"]) {
    display: none !important;
  }

  /* ปุ่มกลางฝาก/ถอนต้องโชว์และกดได้ */
  .center-float-btn,
  [class*="center-float-btn"],
  [class*="CenterFloat"] {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    z-index: 40 !important;
  }
}

/* desktop ปุ่มก็ไม่ตัดบรรทัด */
.nl-btn,
.btn-unified {
  white-space: nowrap !important;
}
.nl-btn .btn-unified-content,
.btn-unified .btn-unified-content {
  white-space: nowrap !important;
}

/* ลดภาระ GPU: ปิดเอฟเฟกต์เทศกาล/พาร์ติเคิลที่อาจค้างบนเครื่องช้า */
.festival-ambient-host,
.festival-ambient-layer,
.festival-sky-lantern,
.festival-float-up,
[class*="festival-ambient"],
[class*="sky-lantern"],
.cbl__aurora,
.cbl__blob {
  display: none !important;
  animation: none !important;
  pointer-events: none !important;
}

/* เปิดหน้าเร็วขึ้น — อย่าค้าง splash นาน */
html.atomic-render-pending {
  --atomic-render-failsafe-delay: 1.6s !important;
}
html.atomic-render-pending.atomic-render-strict {
  --atomic-render-failsafe-delay: 2.5s !important;
}
