@font-face {
  font-family: 'NotoSansThai';
  src:
    url('../../../FONTS/NotoSansThai-ExtraBold.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.customize-popup-dialog,
.customize-popup-dialog * {
  font-family: 'NotoSansThai', 'Kanit', system-ui, sans-serif;
}

.customize-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.8);
}

.customize-popup-overlay.is-hidden,
.customize-popup-overlay.hidden,
#room-cz-overlay.is-hidden,
#room-cz-overlay.hidden {
  display: none !important;
}

/* room-lobby ใช้ #room-cz-overlay + คลาส customize-popup (production) */
#room-cz-overlay.customize-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.8);
}

.customize-popup-dialog {
  position: relative;
  width: min(1600px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  min-height: 0;
  --cc-scale: 1;
  --cc-layout-shift-x: calc(64px * var(--cc-scale));
}

.customize-popup-content {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: calc(14px * var(--cc-scale));
  min-height: 0;
  transform: translateX(var(--cc-layout-shift-x));
}

.customize-popup-char-col {
  position: relative;
  width: min(500px, 36vw);
  min-width: 330px;
  height: calc(860px * var(--cc-scale));
  padding-top: calc(18px * var(--cc-scale));
  flex: 0 0 auto;
  --cc-char-preview-left: 40%;
  --cc-char-preview-top: calc(130px * var(--cc-scale));
  --cc-char-preview-size: calc(800px * var(--cc-scale));
}

.customize-popup-char-bg {
  position: absolute;
  left: var(--cc-char-preview-left);
  top: var(--cc-char-preview-top);
  transform: translateX(-50%);
  width: var(--cc-char-preview-size);
  height: var(--cc-char-preview-size);
  aspect-ratio: 789 / 789;
  object-fit: contain;
  display: block;
  z-index: 1;
}

.customize-popup-char-preview {
  position: absolute;
  left: var(--cc-char-preview-left);
  top: var(--cc-char-preview-top);
  transform: translateX(-50%);
  width: var(--cc-char-preview-size);
  height: var(--cc-char-preview-size);
  object-fit: contain;
  image-rendering: auto;
  z-index: 2;
}

.customize-popup-player-name {
  position: absolute;
  left: var(--cc-char-preview-left);
  top: calc(114px * var(--cc-scale));
  transform: translateX(-50%);
  width: var(--cc-char-preview-size);
  margin: 0;
  text-align: center;
  color: #ffffff;
  font-size: calc(55px * var(--cc-scale));
  font-weight: 700;
  font-family: 'NotoSansThai', 'Kanit', system-ui, sans-serif;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
  white-space: nowrap;
  z-index: 3;
}

.customize-popup-coin-wrap {
  position: absolute;
  top: calc(8px * var(--cc-scale));
  left: calc(0px * var(--cc-scale));
  width: calc(237px * var(--cc-scale));
  height: calc(97px * var(--cc-scale));
  z-index: 4;
}

.customize-popup-coin-bg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.customize-popup-coin-val {
  position: absolute;
  top: 50%;
  left: 58%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: calc(30px * var(--cc-scale));
  font-weight: 700;
  font-family: 'NotoSansThai', 'Kanit', system-ui, sans-serif;
  text-shadow: 0 0 8px rgba(54, 255, 255, 0.45);
  white-space: nowrap;
}

.customize-popup-panel-shell {
  position: relative;
  width: min(
    990px,
    calc((100dvh - 24px) * (990 / 951)),
    calc(100vw - 24px - min(500px, 36vw) - calc(14px * var(--cc-scale)))
  );
  aspect-ratio: 990 / 951;
  max-height: calc(100dvh - 24px);
  min-width: 0;
  flex: 0 0 auto;
  overflow: hidden;
  --cc-shell-scale: var(--cc-scale);
}

.customize-popup-cloth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.customize-popup-close {
  position: absolute;
  top: calc(78px * var(--cc-shell-scale));
  right: calc(86px * var(--cc-shell-scale));
  width: calc(84px * var(--cc-shell-scale));
  height: calc(84px * var(--cc-shell-scale));
  border: none;
  background: #ffffff;
  cursor: pointer;
  border-radius: 0;
  z-index: 3;
  opacity: 0;
  color: transparent;
  font-size: 0;
  line-height: 0;
}

.customize-popup-panel {
  position: absolute;
  top: calc(165px * var(--cc-shell-scale));
  left: calc(118px * var(--cc-shell-scale));
  right: calc(119px * var(--cc-shell-scale));
  bottom: calc(39px * var(--cc-shell-scale));
  min-width: 0;
  display: flex;
  flex-direction: column;
  z-index: 2;
  pointer-events: auto;
}

@media (max-width: 1200px) {
  .customize-popup-dialog {
    width: min(1280px, calc(100vw - 24px));
  }
  .customize-popup-char-col {
    width: min(430px, 34vw);
    min-width: 300px;
    height: calc(740px * var(--cc-scale));
  }
  .customize-popup-tabs {
    --customize-tab-line-shift-x: calc(12px * var(--cc-shell-scale));
    --customize-tab-line-extend-left: calc(10px * var(--cc-shell-scale));
    --customize-tab-right-line-shift-x: calc(-12px * var(--cc-shell-scale));
  }
}

@media (max-height: 820px) and (min-width: 961px) {
  .customize-popup-content {
    gap: calc(10px * var(--cc-scale));
    transform: translateX(calc(36px * var(--cc-scale)));
  }
  .customize-popup-char-col {
    width: min(420px, 32vw);
    min-width: 280px;
    height: calc(700px * var(--cc-scale));
  }
  .customize-popup-panel-shell {
    width: min(
      920px,
      calc((100dvh - 24px) * (990 / 951)),
      calc(100vw - 24px - min(420px, 32vw) - calc(10px * var(--cc-scale)))
    );
  }
}

@media (max-width: 960px) {
  .customize-popup-content {
    flex-direction: column;
    align-items: center;
    transform: none;
  }
  .customize-popup-coin-wrap {
    left: calc(8px * var(--cc-scale));
  }
  .customize-popup-char-col {
    width: min(520px, 84vw);
    min-width: 0;
    height: calc(760px * var(--cc-scale));
  }
  .customize-popup-panel-shell {
    width: min(920px, calc(100vw - 24px));
    flex: 0 0 auto;
  }
}

/* มือถือแนวนอน (จอเตี้ย) — ไม่ stack แนวตั้งแบบ ≤960px (panel จะสูงล้นจอ) → ใช้เลย์เอาต์ "แนวนอน"
   ตัวละครซ้าย + แผงขวา ขนาดอิงความสูงจอ ให้พอดีไม่ล้น · ต้องอยู่หลัง max-width:960px เพื่อ override */
@media (orientation: landscape) and (max-height: 540px) {
  .customize-popup-content {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: calc(10px * var(--cc-scale));
    transform: none;
  }
  .customize-popup-char-col {
    width: min(340px, 30vw);
    min-width: 0;
    height: calc(100dvh - 26px);
    padding-top: calc(8px * var(--cc-scale));
  }
  .customize-popup-coin-wrap {
    left: calc(4px * var(--cc-scale));
  }
  .customize-popup-panel-shell {
    width: min(
      calc((100dvh - 26px) * (990 / 951)),
      calc(100vw - 20px - min(340px, 30vw) - calc(10px * var(--cc-scale)))
    );
    max-height: calc(100dvh - 26px);
    flex: 0 0 auto;
  }
}

.customize-popup-theme-row {
  position: relative;
  display: block;
  height: calc(97px * var(--cc-shell-scale));
  margin-bottom: calc(-3px * var(--cc-shell-scale));
}

.customize-popup-theme-label {
  position: absolute;
  left: calc(43px * var(--cc-shell-scale));
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: calc(100px * var(--cc-shell-scale));
  height: calc(79px * var(--cc-shell-scale));
  object-fit: contain;
  display: block;
}

.customize-popup-theme-frame {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  height: calc(97px * var(--cc-shell-scale));
  width: auto;
  z-index: 1;
}

.customize-popup-theme-frame > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.customize-popup-color-list {
  position: absolute;
  top: calc(16px * var(--cc-shell-scale));
  right: calc(18px * var(--cc-shell-scale));
  bottom: calc(16px * var(--cc-shell-scale));
  left: calc(170px * var(--cc-shell-scale));
  display: flex;
  align-items: center;
  gap: calc(16px * var(--cc-shell-scale));
}

.customize-popup-color-btn {
  position: relative;
  display: inline-block;
  vertical-align: top;
  /* [2026-08-11] QA P11: ปุ่มสี/สีผิว 46x43*scale เล็กเกินกดบนมือถือแนวนอน — floor ของ --cc-shell-scale
     (0.28) ทำให้ปุ่มเหลือ ~13px จริง (จอ 667x375 วัดได้ ~17x16px) ยกพื้นความกว้างตรง ๆ ไม่ได้เพราะ
     .customize-popup-color-list เป็น flex row ความกว้างคงที่ (fix จาก inset ไม่ยืดตามเนื้อหา) ปุ่มกว้างขึ้น
     จะดันแถวล้นกรอบ popup (คำนวณจริงที่ 667x375 ล้นเกิน 50px) → ชดเชยด้วย margin ซ้าย/ขวาติดลบเท่ากับ
     ครึ่งหนึ่งของส่วนต่าง ทำให้พื้นที่ที่ปุ่มใช้ไปในแถว (outer width) เท่าเดิม ปุ่มแค่ "ล้น" ทับข้างเคียง
     เล็กน้อยที่จอแคบสุด แทนที่จะดันทั้งแถว ส่วนสูงไม่ต้องชดเชยเพราะคำนวณแล้วยังอยู่ในกรอบแถว (theme-row)
     ทุกค่า --cc-shell-scale ที่เป็นไปได้ (พื้นสเกล 0.28 จาก customize-popup.js) */
  --customize-color-btn-floor: 28px;
  width: max(calc(46px * var(--cc-shell-scale)), var(--customize-color-btn-floor));
  height: max(calc(43px * var(--cc-shell-scale)), var(--customize-color-btn-floor));
  margin-left: min(0px, calc((46px * var(--cc-shell-scale) - var(--customize-color-btn-floor)) / 2));
  margin-right: min(0px, calc((46px * var(--cc-shell-scale) - var(--customize-color-btn-floor)) / 2));
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  isolation: isolate;
  overflow: visible;
}

.customize-popup-color-btn > .customize-popup-color-swatch {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.customize-popup-color-btn > .customize-popup-color-swatch--hex {
  border-radius: calc(8px * var(--cc-shell-scale));
  border: calc(2px * var(--cc-shell-scale)) solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
}

.customize-popup-color-btn > .customize-popup-color-highlight {
  position: absolute !important;
  left: 50%;
  top: 50%;
  width: calc(78px * var(--cc-shell-scale));
  height: calc(75px * var(--cc-shell-scale));
  transform: translate(-50%, -50%);
  object-fit: contain;
  display: none !important;
  z-index: 5;
  pointer-events: none;
}

.customize-popup-color-btn.is-active > .customize-popup-color-highlight {
  display: block !important;
}

.customize-popup-color-btn.is-taken:not(.is-active) {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(0.45);
}

.customize-popup-color-btn.is-taken:not(.is-active) > .customize-popup-color-swatch--hex {
  border-color: rgba(255, 80, 80, 0.65);
}

.customize-popup-tabs {
  display: flex;
  align-items: flex-end;
  --customize-tab-gap: calc(-5px * var(--cc-shell-scale));
  --customize-tab-line-bottom: calc(4px * var(--cc-shell-scale)); /* ระยะจากล่างของเส้นใต้แท็บ */
  --customize-tab-line-shift-x: calc(25px * var(--cc-shell-scale));
  --customize-tab-line-extend-left: calc(21px * var(--cc-shell-scale));
  --customize-tab-line-extend-right: calc(0px * var(--cc-shell-scale));
  --customize-tab-left-shift-x: calc(0px * var(--cc-shell-scale));
  --customize-tab-mid-shift-x: calc(0px * var(--cc-shell-scale));
  --customize-tab-right-shift-x: calc(0px * var(--cc-shell-scale));
  --customize-tab-mid-line-shift-x: calc(0px * var(--cc-shell-scale)); /* เส้นใต้ปุ่มกลาง(ทรงผม) ขยับซ้าย/ขวา */
  --customize-tab-right-line-shift-x: calc(-28px * var(--cc-shell-scale)); /* เส้นใต้ปุ่มขวา(ชุด) ขยับซ้าย/ขวา */
  gap: 0;
  margin: calc(6px * var(--cc-shell-scale)) 0 calc(8px * var(--cc-shell-scale));
}

.customize-popup-tab-btn + .customize-popup-tab-btn {
  margin-left: var(--customize-tab-gap);
}

.customize-popup-tab-btn {
  position: relative;
  width: calc(256px * var(--cc-shell-scale));
  height: calc(100px * var(--cc-shell-scale));
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.customize-popup-tab-btn:first-child {
  transform: translateX(var(--customize-tab-left-shift-x));
}

.customize-popup-tab-btn:nth-child(2) {
  transform: translateX(var(--customize-tab-mid-shift-x));
}

.customize-popup-tab-btn:last-child {
  transform: translateX(var(--customize-tab-right-shift-x));
}

.customize-popup-tab-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  pointer-events: none;
  transition: filter .18s ease, opacity .18s ease;
}

/* inactive: ลดความสว่าง/ความอิ่มสี ให้ดูเป็นแท็บที่ยังไม่เลือก */
.customize-popup-tab-btn:not(.is-active) .customize-popup-tab-img {
  filter: saturate(0.35) brightness(0.78) contrast(0.95);
  opacity: 0.85;
}

.customize-popup-tab-btn:not(.is-active):hover .customize-popup-tab-img {
  filter: saturate(0.55) brightness(0.92);
  opacity: 0.95;
}

.customize-popup-tab-btn.is-active .customize-popup-tab-img {
  filter: none;
  opacity: 1;
}

.customize-popup-tab-btn-line {
  position: absolute;
  left: calc(
    (-0.5 * var(--customize-tab-gap))
    + var(--customize-tab-line-shift-x)
    - var(--customize-tab-line-extend-left)
  );
  bottom: var(--customize-tab-line-bottom) !important;
  width: calc(
    100% + var(--customize-tab-gap)
    + var(--customize-tab-line-extend-left)
    + var(--customize-tab-line-extend-right)
  );
  height: auto;
  display: block;
  pointer-events: none;
}

.customize-popup-tab-btn:first-child .customize-popup-tab-btn-line {
  left: calc(var(--customize-tab-line-shift-x) - var(--customize-tab-line-extend-left));
  width: calc(
    100% + (0.5 * var(--customize-tab-gap))
    + var(--customize-tab-line-extend-left)
    + var(--customize-tab-line-extend-right)
  );
}

.customize-popup-tab-btn:nth-child(2) .customize-popup-tab-btn-line {
  left: calc(
    (-0.5 * var(--customize-tab-gap))
    + var(--customize-tab-line-shift-x)
    - var(--customize-tab-line-extend-left)
    + var(--customize-tab-mid-line-shift-x)
  );
}

.customize-popup-tab-btn:last-child .customize-popup-tab-btn-line {
  left: calc(
    (-0.5 * var(--customize-tab-gap))
    + var(--customize-tab-line-shift-x)
    - var(--customize-tab-line-extend-left)
    + var(--customize-tab-right-line-shift-x)
  );
  width: calc(
    100% + (0.5 * var(--customize-tab-gap))
    + var(--customize-tab-line-extend-left)
    + var(--customize-tab-line-extend-right)
  );
}

.customize-popup-tab-btn.is-active .customize-popup-tab-btn-line {
  display: none;
}

.customize-popup-items-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: calc(180px * var(--cc-shell-scale));
  overflow: hidden;
  padding-right: calc(2px * var(--cc-shell-scale));
  padding-left: calc(2px * var(--cc-shell-scale));
}

.customize-popup-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(12px * var(--cc-shell-scale));
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.customize-popup-items::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.customize-popup-item {
  position: relative;
  width: 100%;
  aspect-ratio: 181 / 171;
  min-height: 0;
  isolation: isolate;
  overflow: hidden;
}

.customize-popup-item-bg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 181 / 171;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.customize-popup-item-face {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 17.5%;
  transform: translateX(-50%);
  width: 56%;
  height: auto;
  max-height: 59%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.customize-popup-item-price {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: -5%;
  transform: translateX(-50%);
  width: 67%;
  height: auto;
  aspect-ratio: 121 / 51;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.customize-popup-item-price-text {
  position: absolute;
  z-index: 4;
  left: 54%;
  bottom: 3%;
  transform: translateX(-50%);
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(10px, calc(16px * var(--cc-shell-scale)), 18px);
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.customize-popup-item:first-child .customize-popup-item-price,
.customize-popup-item:first-child .customize-popup-item-price-text {
  display: none !important;
}

.customize-popup-item-highlight {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 106%;
  height: auto;
  aspect-ratio: 191 / 181;
  transform: translate(-50%, -50%);
  object-fit: contain;
  display: none;
  z-index: 5;
  pointer-events: none;
}

.customize-popup-item.is-active .customize-popup-item-highlight {
  display: block;
}

.customize-popup-scroll {
  position: absolute;
  top: 0;
  right: calc(-17px * var(--cc-shell-scale));
  bottom: 0;
  width: calc(14px * var(--cc-shell-scale));
  pointer-events: auto;
}

.customize-popup-scroll.is-hidden {
  display: none !important;
}

.customize-popup-scroll-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #1b2740;
  border: 1px solid #22324f;
  box-shadow: inset 0 0 6px rgba(8, 13, 24, 0.45);
  pointer-events: auto;
  cursor: pointer;
}

.customize-popup-scroll-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  border-radius: 999px;
  background: #f04cdc;
  border: 1px solid #ffb8f5;
  box-shadow: 0 0 6px rgba(240, 76, 220, 0.55);
  pointer-events: auto;
  cursor: grab;
}

.customize-popup-scroll-thumb.is-dragging {
  cursor: grabbing;
}

.customize-popup-confirm {
  align-self: center;
  width: calc(351px * var(--cc-shell-scale));
  height: calc(128px * var(--cc-shell-scale));
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  margin-top: calc(8px * var(--cc-shell-scale));
  margin-bottom: calc(-42px * var(--cc-shell-scale));
}

.customize-popup-confirm img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [2026-09-03 · เจ้าของงานสั่ง "ปรับแทบเลือกสี (customize-popup-color-btn)
   ให้ไม่ทับซ้อนกันแบบในภาพ ในหน้าจอมือถือแนวนอน"]

   อาการ: ปุ่มธีมสี 8 ช่องเบียดทับกันจนดูเป็นแถบเดียว (เห็นชัดในภาพที่ส่งมา)

   ต้นเหตุ — เป็นผลข้างเคียงที่ "ตั้งใจ" ของกฎฐาน .customize-popup-color-btn ด้านบน:
     พื้นปุ่ม --customize-color-btn-floor: 28px (มาจาก QA P11 เรื่องพื้นที่แตะ)
     แต่ความกว้างที่ปุ่ม "กิน" ในแถวถูกหักกลับด้วย margin ซ้าย/ขวาติดลบ ((46s-28)/2)
     ⇒ ปุ่มกินพื้นที่แค่ 46s แต่วาดจริง 28px ⇒ ระยะห่างจุดกึ่งกลาง = 46s + gap 16s = 62s
     จะไม่ทับกันก็ต่อเมื่อ 62s >= 28  ⇒  s >= 0.4516  ซึ่งมือถือแนวนอนไม่มีทางถึง
     (บล็อก landscape/max-height:540 ผูก shell กับความสูงจอ ⇒ s = (dvh-26)*1.041/990
      ต้องสูงเกิน ~456px ถึงจะพ้น) คอมเมนต์กฎฐานเขียนไว้เองว่ายอมให้ "ล้นทับข้างเคียง
      เล็กน้อย" แลกกับไม่ให้แถวล้นกรอบ — บนจอจริงมันไม่เล็กน้อย

   วัดจริงด้วย headless Chrome (สร้าง DOM จริง + สูตร syncScale() ตัวจริงจาก
   js/customize-popup.js · วัดในไอเฟรมขนาดคงที่เพื่อคุมขนาด viewport ให้ตรง):
     viewport   ทับกัน(ก่อน)  วงแหวน is-active ล้ำสวอตช์ข้าง ๆ (ก่อน)
     700x300    10.2px        25.2px
     800x320     8.8px        26.1px
     921x370     5.6px         5.7px   ← ใกล้เคียงเครื่องที่เจ้าของงานส่งภาพมา
     844x390     4.3px         5.2px
     926x428     1.8px         4.3px
   และปุ่มยังล้น "แนวตั้ง" ออกนอกกล่องแถวอีก 0.5-9.3px ด้วย (สูง 28px ในกล่องสูง ~23px)

   วิธีแก้: เลิกใช้คู่ "พื้น 28px + margin ติดลบ" ในบักเก็ตนี้ แล้วให้ปุ่มแบ่งความกว้าง
   ที่มีจริงแทน (flex: 1 1 0) — แถวจึงพอดีกรอบเสมอโดยไม่ต้องมีใครทับใคร
     · max-width: 28px  = เพดานเท่าพื้นเดิม ⇒ แถวสีผิว (3 ช่อง มีที่เหลือเฟือ)
       ยังได้ 28px เท่าเดิมทุกจอ ไม่ถูกลดขนาดโดยไม่จำเป็น
     · aspect-ratio: 46/43 = สัดส่วนเดิมของปุ่ม (แทน height ที่ถูกพื้น 28px ตรึงไว้)
       ⇒ ปุ่มกลับเข้ามาอยู่ในกล่องแถวตามแนวตั้งด้วย
     · วงแหวน .customize-popup-color-highlight เดิมเป็น 78s x 75s (คงที่ ไม่ผูกกับปุ่ม)
       พอปุ่มเล็กลงมันจะยิ่งล้ำ ⇒ ผูกเป็น % ของปุ่มแทน 130% = ยังเห็นเป็นวงรอบสวอตช์
       (ของเดิมสัดส่วน 78/46 = 170% แต่ที่ 170% วงจะไปแตะสวอตช์ข้าง ๆ พอดี จึงลดเหลือ 130%)

   ผลหลังแก้ (วัดชุดเดียวกัน): ทับกัน 0 · วงแหวนล้ำสวอตช์ข้างเคียง 0 · ไม่ล้นกรอบแถว
   ทั้งแนวนอนและแนวตั้ง · แถวสีผิวยังเป็น 28px เท่าเดิม ทุก viewport ที่ทดสอบ
   ปุ่มธีมสีเหลือ 16.3-28px ตามความกว้างที่มีจริง — พื้นที่แตะ "ที่กดได้จริง" ไม่ได้แย่ลง
   เพราะของเดิมส่วนที่ถูกใบถัดไปทับก็กดไม่ได้อยู่แล้ว (28 - 10.2 = 17.8px ที่จอแคบสุด)

   ต้องอยู่ท้ายไฟล์: selector เท่ากับกฎฐานเป๊ะ · @media ไม่เพิ่ม specificity
   ⇒ ตัวที่มาทีหลังเท่านั้นที่ชนะ ห้ามย้ายขึ้นไปรวมกับบล็อก landscape ด้านบน (บรรทัด ~262)
   บักเก็ต max-height:540 = บักเก็ตมือถือแนวนอนของไฟล์นี้เอง และครอบคลุมทุกกรณีที่ทับกัน
   (ต้องเตี้ยกว่า ~456px ถึงจะทับ) ⇒ จอที่สูงกว่านั้นในบักเก็ตนี้ปุ่มติดเพดาน 28px = เท่าเดิม
   ═══════════════════════════════════════════════════════════════════════════ */
/* [2026-09-03 · รอบสอง · เจ้าของงานสั่ง "ทำให้ช่องสีทั้ง 2 แถว ช่องเท่ากัน"]
   รอบแรกใช้ flex: 1 1 0 = "แบ่งความกว้างที่มี" ⇒ ขนาดช่องขึ้นกับ "จำนวนช่องในแถวนั้น"
     แถวธีมสี 8 ช่อง ได้ 16.3-28px (หารกัน 8 ทาง)  ·  แถวสีผิว 3 ช่อง เหลือเฟือจนติดเพดาน 28px
   ⇒ สองแถวช่องไม่เท่ากัน (เห็นชัดเพราะวางซ้อนกันพอดี)

   แก้: เลิกให้ความกว้าง "ขึ้นกับจำนวนช่องในแถว" แล้วคิดจาก "ช่องมาตรฐาน 8 ช่อง" ทั้งคู่แทน
     width = min(28px, (ความกว้างแถว - gap 7 ช่อง) / 8)
   ทั้งสองแถวเป็น .customize-popup-color-list ที่มี inset เท่ากันเป๊ะ (left 170s / right 18s
   ในกรอบเดียวกัน) ⇒ 100% ของทั้งคู่เท่ากัน ⇒ ได้ช่องเท่ากันทุกจอโดยไม่ต้องฮาร์ดโค้ดตัวเลข
   แถวสีผิวจึงเหลือที่ว่างท้ายแถว (3 ช่อง) ซึ่งถูกต้องแล้ว — ของเดิมก่อนแก้ทั้งหมดก็ชิดซ้ายเหมือนกัน

   --cz-slot-gap ประกาศที่ตัวแถวและใช้เป็นทั้ง gap จริงและตัวหารในสูตร = แหล่งความจริงเดียว
   (ถ้าแก้ค่า gap ในบักเก็ตนี้ทีหลัง สูตรความกว้างจะตามไปเอง ไม่หลุดกัน) */
@media (orientation: landscape) and (max-height: 540px) {
  .customize-popup-color-list {
    --cz-slot-gap: calc(16px * var(--cc-shell-scale));
    gap: var(--cz-slot-gap);
  }

  .customize-popup-color-btn {
    flex: 0 0 auto;
    min-width: 0;
    width: min(28px, calc((100% - 7 * var(--cz-slot-gap)) / 8));
    height: auto;
    aspect-ratio: 46 / 43;
    margin-left: 0;
    margin-right: 0;
  }

  .customize-popup-color-btn > .customize-popup-color-highlight {
    width: 130%;
    height: 130%;
  }
}

/* [2026-09-09] ของที่ยังไม่ได้ซื้อ + กล่องยืนยันซื้อ
   ของที่ยังไม่ได้ซื้อยังต้องมองเห็นรูปชัด (ผู้เล่นต้องอยากได้) แค่หรี่ลงและมีป้ายราคา
   ไม่ใช้ pointer-events:none เพราะยังต้องกดเพื่อเปิดกล่องซื้อได้ */
.customize-popup-item.is-locked .customize-popup-item-face {
  opacity: 0.55;
  filter: grayscale(0.55);
}

.customize-popup-item.is-locked .customize-popup-item-bg {
  opacity: 0.8;
}

.customize-popup-buy {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 14, 28, 0.62);
}

.customize-popup-buy.is-hidden {
  display: none !important;
}

.customize-popup-buy-card {
  width: min(86%, 360px);
  padding: 18px 20px 16px;
  border-radius: 14px;
  background: #14203a;
  border: 2px solid #46c8ff;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  color: #eaf6ff;
  text-align: center;
}

.customize-popup-buy-text {
  margin: 0 0 6px;
  font-size: clamp(14px, calc(18px * var(--cc-shell-scale, 1)), 20px);
  font-weight: 700;
  line-height: 1.35;
}

.customize-popup-buy-note {
  margin: 0 0 14px;
  font-size: clamp(11px, calc(14px * var(--cc-shell-scale, 1)), 15px);
  line-height: 1.4;
  color: #a9c6dd;
}

.customize-popup-buy-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.customize-popup-buy-actions button {
  min-width: 104px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 0;
  font-size: clamp(13px, calc(16px * var(--cc-shell-scale, 1)), 17px);
  font-weight: 700;
  cursor: pointer;
}

.customize-popup-buy-yes {
  background: #2fb673;
  color: #ffffff;
}

.customize-popup-buy-yes:disabled {
  background: #4a5a6d;
  color: #b6c3cf;
  cursor: not-allowed;
}

.customize-popup-buy-no {
  background: #37475e;
  color: #e6eef6;
}

/* ซื้อแล้ว = ไม่ต้องมีป้ายราคา (เดิมป้ายยังอยู่ อ่านไม่ออกว่าซื้อไปหรือยัง) */
.customize-popup-item.is-owned .customize-popup-item-price,
.customize-popup-item.is-owned .customize-popup-item-price-text {
  display: none !important;
}

/* [2026-09-09] สถานะ "ยังไม่รู้ว่ามีอะไร" — ต่างจาก "ล็อก" ชัดเจน
   ก่อนหน้านี้ตอน API ยังไม่ตอบ ทุกชิ้นถูกตีเป็นล็อกพร้อมป้ายราคา
   ผู้เล่นที่ซื้อไปแล้วเปิดมาเห็นของหายหมด นึกว่าโดนริบ */
.customize-popup-item.is-pending {
  opacity: 0.45;
  pointer-events: auto;
}

.customize-popup-item.is-pending .customize-popup-item-price,
.customize-popup-item.is-pending .customize-popup-item-price-text {
  visibility: hidden;
}

.customize-popup-shop-notice {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: 78%;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 30, 52, 0.92);
  color: #dceaf7;
  font-size: clamp(11px, calc(14px * var(--cc-shell-scale, 1)), 15px);
  line-height: 1.3;
  cursor: pointer;
}

.customize-popup-shop-notice.is-hidden {
  display: none !important;
}
