/* ============================================================================
   SHOP, FOIL SHOWCASE & PACK OPENING ANIMATIONS (BOF)
   ============================================================================ */

/* ปุ่มเหรียญทองบนหน้าล็อบบี้ */
#lb-coin-pill {
  position: absolute;
  left: 285px;
  top: 56px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(22, 26, 58, 0.92);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde047;
  font: 700 16px/1 var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s, border-color 0.2s, background-color 0.2s;
}

#lb-coin-pill:hover {
  transform: translateY(-1px);
  border-color: #fef08a;
  background: rgba(36, 42, 88, 0.96);
}

#lb-coin-pill .lb-coin-icon {
  font-size: 18px;
}

#lb-coin-pill .lb-coin-plus {
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe39a, #e0a83c);
  color: #1a1405;
  font-size: 11px;
  font-weight: 700;
}

/* หน้าต่างร้านค้า (Booster Shop Dialog) */
#bof-shop-dialog {
  margin: auto;
  border: 0;
  border-radius: 22px;
  padding: 0;
  width: min(1020px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  background: transparent;
  color: #e8eaf7;
  box-shadow: none;
  overflow: visible;
}

.holo-inspect {
  z-index: 2500 !important;
}

#bof-shop-dialog::backdrop {
  background: rgba(6, 8, 18, 0.86);
}

.bof-shop-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 28px);
  padding: 22px 24px;
  border-radius: 22px;
  background: linear-gradient(165deg, #151936 0%, #0b0d1a 100%);
  border: 1px solid rgba(243, 201, 105, 0.55);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8), 0 0 45px rgba(243, 201, 105, 0.15);
  font-family: var(--font-body, 'IBM Plex Sans Thai', sans-serif);
  overflow-x: hidden;
  overflow-y: auto;
}

.bof-shop-top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(160, 175, 255, 0.18);
}

.bof-shop-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.bof-shop-title-wrap h2 {
  margin: 0;
  font: 700 24px/1.15 var(--font-display, 'Kanit', sans-serif);
  color: #f3c969;
}

.bof-shop-title-wrap p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #94a3b8;
}

.bof-shop-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bof-shop-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #0b0d1a;
  border: 1px solid rgba(250, 204, 21, 0.5);
  color: #fde047;
  font: 700 16px var(--font-display, 'Kanit', sans-serif);
}

.bof-shop-code-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0b0d1a;
  padding: 3px 4px 3px 14px;
  border-radius: 999px;
  border: 1px solid rgba(160, 175, 255, 0.35);
}

.bof-shop-code-input {
  width: 140px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #fff;
  font: 500 13px var(--font-body, 'IBM Plex Sans Thai', sans-serif);
  outline: none;
}

.bof-shop-code-input::placeholder {
  color: #64748b;
}

.bof-shop-bonus-btn {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  color: #052e16;
  font: 700 12px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
}

.bof-shop-bonus-btn:hover {
  filter: brightness(1.08);
}

/* ---------------- แถบควบคุมตัวอย่างฟอยล์ ---------------- */
.bof-shop-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(11, 13, 26, 0.85);
  border: 1px solid rgba(160, 175, 255, 0.2);
}

.bof-foil-toggle-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.65);
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.25), rgba(147, 51, 234, 0.35));
  color: #fde047;
  font: 600 12px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: all 0.18s;
}

.bof-foil-toggle-btn:hover {
  filter: brightness(1.18);
  transform: translateY(-1px);
}

/* ---------------- ตู้โชว์ตัวอย่างการ์ดฟอยล์ทั้ง 4 ระดับ (N / R / SR / SSR) ---------------- */
.bof-foil-showcase {
  display: none;
  margin: 10px 0 16px;
  padding: 16px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 0%, rgba(88, 28, 135, 0.28), rgba(9, 11, 22, 0.96) 75%);
  border: 1px solid rgba(243, 201, 105, 0.4);
}

.bof-foil-showcase.is-open {
  display: block;
}

.bof-foil-showcase-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.bof-foil-showcase-head h3 {
  margin: 0;
  font: 700 16px var(--font-display, 'Kanit', sans-serif);
  color: #fde047;
}

.bof-foil-showcase-head span {
  font-size: 12px;
  color: #cbd5e1;
}

.bof-foil-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.bof-foil-card-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(15, 18, 36, 0.9);
  border: 1px solid rgba(160, 175, 255, 0.18);
  text-align: center;
}

.bof-foil-sample-wrap {
  position: relative;
  perspective: 750px;
  margin: 8px 0 12px;
}

/* การ์ดฟอยล์เต็มใบ (ไม่บังส่วนล่างของการ์ด และไม่กลับด้านภาพ) */
.bof-fullart-card {
  --rx: 0deg;
  --ry: 0deg;
  --px: 0;
  --py: 0;
  --hyp: 0.45;
  position: relative;
  width: 138px;
  aspect-ratio: 750 / 1050;
  border-radius: 11px;
  overflow: hidden;
  cursor: pointer;
  background: #0b0d1a;
  transform: perspective(650px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.25, 1), box-shadow 0.3s;
}

.bof-fullart-card.holo-live {
  transition: transform 0.08s linear, box-shadow 0.3s;
}

.bof-fullart-card .card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.bof-fullart-card .card-art > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ระดับ N */
.bof-fullart-card[data-rarity="N"] {
  border: 2px solid #8f97b8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* ระดับ R */
.bof-fullart-card[data-rarity="R"] {
  border: 2px solid #4fa7ff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(79, 167, 255, 0.65);
}
.bof-fullart-card[data-rarity="R"] .holo-foil {
  --strength: 0.5;
  opacity: 0.48;
}

/* ระดับ SR */
.bof-fullart-card[data-rarity="SR"] {
  border: 2px solid #ff5a6e;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.65), 0 0 22px rgba(255, 90, 110, 0.8);
}
.bof-fullart-card[data-rarity="SR"] .holo-foil {
  --strength: 0.8;
  opacity: 0.62;
}
.bof-fullart-card[data-rarity="SR"] .holo-sparkle {
  --spark: 0.65;
  opacity: 0.58;
}

/* ระดับ SSR — จัดเต็มออร่าทอง + ฟอยล์รุ้ง + ลำแสงทองวิ่งพาด + กากเพชร + ดาวทองระยิบระยับ */
.bof-fullart-card[data-rarity="SSR"] {
  border: 2.5px solid #fde047;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45),
    0 0 24px rgba(250, 204, 21, 0.95),
    0 0 46px rgba(245, 158, 11, 0.65),
    inset 0 0 18px rgba(253, 224, 71, 0.55);
  animation: bof-ssr-card-pulse 2s ease-in-out infinite alternate;
}

@keyframes bof-ssr-card-pulse {
  0% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.4),
      0 0 20px rgba(250, 204, 21, 0.85),
      0 0 38px rgba(245, 158, 11, 0.5),
      inset 0 0 14px rgba(253, 224, 71, 0.4);
  }
  100% {
    box-shadow:
      0 0 0 2px #fff,
      0 0 32px rgba(250, 204, 21, 1),
      0 0 60px rgba(245, 158, 11, 0.85),
      inset 0 0 24px rgba(253, 224, 71, 0.75);
  }
}

.bof-fullart-card[data-rarity="SSR"] .holo-foil {
  --strength: 1;
  opacity: 0.78 !important;
  -webkit-mask-image: none;
          mask-image: none;
}

.bof-fullart-card[data-rarity="SSR"] .holo-foil > i {
  animation: holo-flow 4.2s ease-in-out infinite alternate !important;
}

.bof-fullart-card[data-rarity="SSR"] .holo-sparkle {
  --spark: 1;
  opacity: 0.82 !important;
  -webkit-mask-image: none;
          mask-image: none;
}

.bof-fullart-card[data-rarity="SSR"] .holo-sheen {
  mix-blend-mode: screen;
}

.bof-fullart-card[data-rarity="SSR"] .holo-sheen::before {
  content: "";
  position: absolute;
  inset: -20% -150%;
  background: linear-gradient(
    112deg,
    transparent 30%,
    rgba(255, 215, 0, 0.35) 42%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 215, 0, 0.45) 58%,
    transparent 70%
  );
  animation: holo-sheen 2.2s ease-in-out infinite !important;
}

/* ละอองแสงสีทองลอยรอบการ์ด SSR */
.bof-ssr-aura-sparks {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}

.bof-ssr-orb {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #fde047 50%, transparent 100%);
  box-shadow: 0 0 10px #fde047, 0 0 18px #f59e0b;
  animation: bof-ssr-orb-float var(--orb-dur, 2.4s) var(--orb-delay, 0s) ease-in-out infinite;
}

@keyframes bof-ssr-orb-float {
  0% { transform: translateY(12px) scale(0.3); opacity: 0; }
  40% { opacity: 1; transform: translateY(-8px) scale(1.15); }
  100% { transform: translateY(-34px) scale(0.2); opacity: 0; }
}

.bof-foil-tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font: 700 11px var(--font-display, 'Kanit', sans-serif);
  margin-bottom: 4px;
}

.bof-foil-tier-badge.tier-N { background: rgba(143, 151, 184, 0.2); color: #cbd5e1; border: 1px solid #8f97b8; }
.bof-foil-tier-badge.tier-R { background: rgba(79, 167, 255, 0.2); color: #93c5fd; border: 1px solid #4fa7ff; }
.bof-foil-tier-badge.tier-SR { background: rgba(255, 90, 110, 0.2); color: #fda4af; border: 1px solid #ff5a6e; }
.bof-foil-tier-badge.tier-SSR { background: rgba(243, 201, 105, 0.28); color: #fde047; border: 1px solid #f3c969; box-shadow: 0 0 12px rgba(250, 204, 21, 0.45); }

.bof-foil-spec-list {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
  text-align: left;
  width: 100%;
  margin: 4px 0 0;
  padding-left: 14px;
}

/* ---------------- ตู้ซองทั้ง 6 สายเด็ค ---------------- */
.bof-packs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 6px;
}

.bof-pack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(30, 38, 78, 0.75) 0%, rgba(12, 15, 32, 0.95) 100%);
  border: 2px solid var(--pack-color, #3ee08f);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.bof-pack-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 22px var(--pack-color, #3ee08f);
}

.bof-pack-foil {
  position: relative;
  width: 118px;
  aspect-ratio: 750 / 1050;
  border-radius: 12px;
  padding: 5px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.55));
  border: 2px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.bof-pack-foil::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.35) 50%, transparent 58%);
  animation: bof-pack-sheen 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bof-pack-sheen {
  0%, 100% { transform: translateX(-45%) rotate(10deg); }
  50% { transform: translateX(45%) rotate(10deg); }
}

.bof-pack-foil img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.bof-pack-ribbon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  padding: 3px 0;
  background: rgba(11, 13, 26, 0.88);
  border-top: 1px solid var(--pack-color, #3ee08f);
  border-bottom: 1px solid var(--pack-color, #3ee08f);
  font: 700 10px var(--font-display, 'Kanit', sans-serif);
  color: #ffe39a;
  letter-spacing: 0.06em;
}

.bof-pack-name {
  margin: 10px 0 2px;
  font: 700 16px var(--font-display, 'Kanit', sans-serif);
  color: #fff;
}

.bof-pack-sub {
  font-size: 11px;
  color: #94a3b8;
  min-height: 28px;
}

.bof-pack-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  margin-top: 10px;
}

.bof-buy-btn {
  position: relative;
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe39a, #e0a83c);
  color: #1a1405;
  font: 700 12.5px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}

.bof-buy-btn.is-ten {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
}

.bof-discount-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fde047;
  color: #1a1405;
  font-size: 10px;
  font-weight: 800;
}

.bof-buy-btn:hover {
  filter: brightness(1.09);
  transform: translateY(-1px);
}

/* ============================================================================
   ฉากแอนิเมชันเปิดซองสุ่มการ์ด (🌌 วงเวทมิติพลังงาน — Dimensional Portal Summon)
   ============================================================================ */
.bof-pack-anim-stage {
  position: fixed;
  inset: 0;
  z-index: 10004 !important;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(17, 24, 59, 0.96) 0%, rgba(4, 6, 14, 0.98) 80%);
  overflow: hidden;
  user-select: none;
}

.bof-pack-anim-stage.is-playing {
  display: flex;
}

.bof-anim-caption {
  margin-top: 26px;
  font: 700 18px var(--font-display, 'Kanit', sans-serif);
  color: #fde047;
  text-shadow: 0 0 16px rgba(250, 204, 21, 0.7);
  letter-spacing: 0.04em;
  z-index: 5;
}

.bof-anim-pack-wrap {
  position: relative;
  width: 210px;
  aspect-ratio: 750 / 1050;
  z-index: 4;
}

.bof-anim-pack-body {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(15, 23, 42, 0.92));
  border: 3px solid var(--anim-glow, #facc15);
  box-shadow: 0 0 38px var(--anim-glow, #facc15), 0 18px 45px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.bof-anim-pack-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.bof-portal-ring,
.bof-portal-ring-inner {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  border: 3px dashed var(--anim-glow, #38bdf8);
  box-shadow: 0 0 35px var(--anim-glow, #38bdf8), inset 0 0 25px var(--anim-glow, #38bdf8);
  pointer-events: none;
  z-index: 2;
}
.bof-portal-ring-inner {
  width: 255px;
  height: 255px;
  border-style: double;
  border-width: 4px;
}
.bof-anim-style-portal.is-active .bof-portal-ring {
  animation: bof-portal-spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.bof-anim-style-portal.is-active .bof-portal-ring-inner {
  animation: bof-portal-spin-rev 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.bof-anim-style-portal.is-active .bof-anim-pack-wrap {
  animation: bof-portal-pack-vortex 1.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes bof-portal-spin {
  0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
  30% { transform: scale(1) rotate(120deg); opacity: 1; }
  80% { transform: scale(1.15) rotate(540deg); opacity: 1; }
  100% { transform: scale(2.4) rotate(720deg); opacity: 0; }
}
@keyframes bof-portal-spin-rev {
  0% { transform: scale(0.2) rotate(0deg); opacity: 0; }
  30% { transform: scale(1) rotate(-140deg); opacity: 1; }
  80% { transform: scale(0.6) rotate(-520deg); opacity: 1; }
  100% { transform: scale(2.2) rotate(-720deg); opacity: 0; }
}
@keyframes bof-portal-pack-vortex {
  0% { transform: perspective(800px) rotateY(0deg) scale(0.7); filter: brightness(1); }
  45% { transform: perspective(800px) rotateY(360deg) scale(1.06); filter: brightness(1.4); }
  80% { transform: perspective(800px) rotateY(1080deg) scale(0.25); filter: brightness(2.8); opacity: 1; }
  100% { transform: perspective(800px) rotateY(1440deg) scale(2.2); filter: brightness(3.5); opacity: 0; }
}

.bof-anim-burst-flash {
  position: absolute;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--anim-glow, #fde047) 35%, transparent 72%);
  opacity: 0;
  pointer-events: none;
  z-index: 7;
  animation: bof-burst-pop 0.65s 0.9s ease-out forwards;
}

@keyframes bof-burst-pop {
  0% { transform: scale(0.2); opacity: 0; }
  45% { transform: scale(1.35); opacity: 0.95; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ============================================================================
   หน้าต่างป๊อปอัปแสดงผลการเปิดซอง (ขึ้นทันทีหลังจากจบแอนิเมชันวงเวทมิติพลังงาน!)
   ============================================================================ */
.bof-reveal-stage {
  position: fixed;
  inset: 0;
  z-index: 10005 !important;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 15, 0.94);
  backdrop-filter: blur(8px);
}

.bof-reveal-stage.is-open {
  display: flex;
  animation: bof-reveal-fade-in 0.3s ease-out;
}

@keyframes bof-reveal-fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.bof-reveal-box {
  width: min(940px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(28, 38, 78, 0.95) 0%, rgba(8, 10, 22, 0.98) 75%);
  border: 1.5px solid rgba(250, 204, 21, 0.55);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(56, 189, 248, 0.18);
  overflow: hidden;
}

.bof-reveal-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.bof-sum-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font: 700 12px var(--font-display, 'Kanit', sans-serif);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bof-reveal-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  max-height: 54vh;
  overflow-y: auto;
  padding: 14px 10px;
  width: 100%;
}

.bof-flip-card {
  position: relative;
  width: 146px;
  aspect-ratio: 750 / 1050;
  border-radius: 12px;
  cursor: pointer;
  perspective: 1000px;
  transition: transform 0.2s;
  animation: bof-card-deal 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
}

@keyframes bof-card-deal {
  from { opacity: 0; transform: translateY(28px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bof-flip-card:hover {
  transform: translateY(-6px) scale(1.03);
}

.bof-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.bof-flip-card.is-flipped .bof-flip-inner {
  transform: rotateY(180deg);
}

.bof-flip-back,
.bof-flip-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
}

.bof-flip-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #0d1024;
  background-image: var(--bof-card-back-url, url('../images/card-back.png'));
  background-size: cover;
  background-position: center;
  border: 2px solid #f3c969;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65);
  color: #ffe39a;
  font: 700 13px var(--font-display, 'Kanit', sans-serif);
}

.bof-flip-back.hint-SSR {
  border-color: #fde047;
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.95), 0 0 44px rgba(245, 158, 11, 0.6);
  animation: bof-hint-ssr 1.4s ease-in-out infinite;
}
.bof-flip-back.hint-SR {
  border-color: #ff5a6e;
  box-shadow: 0 0 18px rgba(255, 90, 110, 0.75);
  animation: bof-hint-sr 1.8s ease-in-out infinite;
}
.bof-flip-back.hint-R {
  border-color: #4fa7ff;
  box-shadow: 0 0 14px rgba(79, 167, 255, 0.6);
}
@keyframes bof-hint-ssr {
  0%, 100% { box-shadow: 0 0 22px rgba(250, 204, 21, 0.85), 0 0 40px rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 34px rgba(253, 224, 71, 1), 0 0 58px rgba(245, 158, 11, 0.85); }
}
@keyframes bof-hint-sr {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 90, 110, 0.65); }
  50% { box-shadow: 0 0 24px rgba(255, 90, 110, 0.95); }
}
#bof-reveal-flip-all:disabled {
  opacity: 0.55;
  cursor: default;
  filter: grayscale(0.25);
}

/* .bof-flip-front รับผิดชอบเฉพาะการหมุนหน้าการ์ด 180deg เพื่อไม่ให้ถูกทับจนภาพกลับด้าน */
.bof-flip-front {
  transform: rotateY(180deg);
}

.bof-flip-front .bof-fullart-card {
  width: 100%;
  height: 100%;
}

.bof-rarity-pill {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 8;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(11, 13, 26, 0.92);
  border: 1.5px solid #f3c969;
  color: #ffe39a;
  font: 700 11px var(--font-display, 'Kanit', sans-serif);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

@media (max-width: 767px) {
  #lb-coin-pill {
    position: relative;
    left: auto;
    top: auto;
    height: 34px;
    font-size: 13.5px;
  }

  #bof-shop-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
  }

  .bof-shop-panel {
    padding: 14px 12px;
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
  }

  .bof-shop-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-bottom: 10px;
  }

  .bof-shop-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
  }

  .bof-shop-title-wrap h2 {
    font-size: 16.5px;
    line-height: 1.25;
  }

  .bof-shop-title-wrap p {
    font-size: 11px;
    line-height: 1.3;
  }

  .bof-shop-top-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .bof-shop-balance {
    font-size: 13px;
    padding: 5px 10px;
    gap: 5px;
  }

  .bof-shop-code-box {
    flex: 1;
    min-width: 160px;
    padding: 2px 3px 2px 10px;
  }

  .bof-shop-code-input {
    width: 100%;
    min-width: 80px;
    height: 28px;
    font-size: 16px; /* ป้องกัน iOS ซูมอัตโนมัติ */
  }

  .bof-shop-bonus-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .bof-shop-rate-banner {
    font-size: 11px;
    padding: 6px 10px;
    line-height: 1.4;
  }

  .bof-packs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .bof-pack-card {
    padding: 10px 8px;
    border-radius: 12px;
  }

  .bof-pack-art-wrap {
    width: 80px;
    margin-bottom: 8px;
  }

  .bof-pack-card h3 {
    font-size: 14px;
  }

  .bof-pack-desc {
    font-size: 10.5px;
    margin: 2px 0 4px;
    line-height: 1.25;
  }

  .bof-pack-owned-badge {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .bof-pack-actions {
    gap: 5px;
  }

  .bof-buy-btn {
    height: 32px;
    font-size: 11.5px;
    padding: 0 6px;
    border-radius: 8px;
    touch-action: manipulation;
  }

  .bof-buy-btn-10x {
    height: 32px;
    font-size: 11.5px;
    padding: 0 4px;
    border-radius: 8px;
    touch-action: manipulation;
  }

  .bof-discount-tag {
    font-size: 9.5px;
    padding: 1px 4px;
  }

  .bof-foil-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .bof-foil-card-item {
    padding: 8px 6px;
  }

  .bof-foil-card-thumb {
    width: 85px;
  }

  /* Reveal popup stage */
  .bof-reveal-stage {
    padding: 10px 8px;
  }

  .bof-reveal-box {
    width: 96vw;
    max-height: 92dvh;
    padding: 14px 10px;
    border-radius: 16px;
  }

  #bof-reveal-title {
    font-size: 12.5px;
    line-height: 1.35;
    text-align: center;
  }

  .bof-reveal-summary {
    gap: 5px;
    margin-top: 6px;
  }

  .bof-sum-badge {
    font-size: 10.5px;
    padding: 2px 8px;
  }

  .bof-reveal-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    max-height: 56dvh;
    padding: 6px 2px;
  }

  .bof-flip-card {
    width: clamp(94px, 28vw, 130px);
    touch-action: manipulation;
  }

  .bof-flip-back {
    font-size: 11px;
  }

  .bof-reveal-actions {
    gap: 8px;
    margin-top: 6px;
    width: 100%;
    justify-content: center;
  }

  .bof-reveal-btn {
    height: 38px;
    font-size: 13px;
    padding: 0 14px;
    flex: 1;
    max-width: 170px;
    touch-action: manipulation;
  }
}

/* ============================================================================
   SHOP TABS, CRAFTING SYSTEM, DAILY QUESTS & PITY METER
   ============================================================================ */
.bof-shop-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 8px;
  overflow-x: auto;
}

.bof-shop-tab {
  background: #0f172a;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.bof-shop-tab:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

.bof-shop-tab.is-active {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #0f172a;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* --- Gacha Pity Meter --- */
.bof-pity-counter {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
}

.bof-pity-text {
  font-size: 11px;
  color: #fef08a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.bof-pity-track {
  width: 100%;
  height: 5px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}

.bof-pity-fill {
  height: 100%;
  background: linear-gradient(90deg, #eab308, #facc15);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* --- Crafting Panel & Disenchant Box --- */
.bof-craft-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bof-disenchant-box {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.7), rgba(88, 28, 135, 0.4));
  border: 1px solid #7c3aed;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.bof-disenchant-info h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: #c084fc;
}

.bof-disenchant-info p {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
}

.bof-btn-disenchant {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bof-btn-disenchant:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.5);
}

.bof-btn-disenchant:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bof-craft-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.bof-craft-filter-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bof-craft-filter-btn.is-active {
  background: #7c3aed;
  color: #fff;
  border-color: #a855f7;
}

.bof-craft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

.bof-craft-card {
  background: #111422;
  border: 1px solid #232840;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.bof-craft-card img {
  width: 90px;
  height: 125px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.bof-craft-card-name {
  font-size: 12px;
  font-weight: bold;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.bof-craft-card-owned {
  font-size: 11px;
  color: #94a3b8;
}

.bof-craft-action-btn {
  width: 100%;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bof-craft-action-btn:hover:not(:disabled) {
  background: #22c55e;
}

.bof-craft-action-btn:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
}

/* --- Quests & Daily Login Panel --- */
.bof-quests-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 58vh;
  overflow-y: auto;
}

.bof-daily-login-card {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(202, 138, 4, 0.25));
  border: 1px solid #eab308;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.bof-quest-row {
  background: #111422;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.bof-quest-meta h5 {
  margin: 0 0 4px 0;
  font-size: 14px;
  color: #f8fafc;
}

.bof-quest-meta p {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}

.bof-quest-reward {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bof-quest-claim-btn {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bof-quest-claim-btn:hover:not(:disabled) {
  background: #0369a1;
  transform: translateY(-1px);
}

.bof-quest-claim-btn:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
}

.bof-quest-claim-btn.is-claimed {
  background: #14532d;
  color: #4ade80;
  cursor: default;
}

@media (max-width: 767px) {
  .bof-shop-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: 10px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    overflow-x: visible;
  }

  .bof-shop-tab {
    padding: 7px 3px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bof-shop-tab .bof-tab-sub {
    display: none;
  }

  .bof-pity-counter {
    padding: 4px 6px;
  }

  .bof-pity-text {
    font-size: 10px;
    white-space: nowrap;
    gap: 4px;
  }

  .bof-pack-foil {
    width: 96px;
    margin: 0 auto 6px;
  }

  .bof-pack-name {
    font-size: 13.5px;
  }

  .bof-pack-sub {
    font-size: 10px;
    line-height: 1.25;
  }

  .bof-craft-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .bof-craft-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 750 / 1050;
  }
}


/* ================= ปรับหน้าเควสต์รายวันให้อ่านง่าย ชัดเจน (Desktop & Mobile) ================= */
.bof-quests-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: none;
  overflow-y: visible;
  padding-bottom: 6px;
}

.bof-daily-login-card {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.16), rgba(161, 98, 7, 0.28));
  border: 1.5px solid rgba(250, 204, 21, 0.65);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.bof-daily-login-info {
  flex: 1;
  min-width: 0;
}

.bof-daily-login-title {
  margin: 0 0 6px 0;
  color: #fde047;
  font-size: 15.5px;
  line-height: 1.3;
}

.bof-daily-login-desc {
  margin: 0;
  font-size: 13px;
  color: #f8fafc;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.4;
}

.bof-quest-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 2px 0;
}

.bof-quest-section-title {
  margin: 0;
  color: #38bdf8;
  font-size: 15px;
  font-weight: 700;
}

.bof-quest-reset-pill {
  font-size: 12px;
  color: #cbd5e1;
  background: #1e293b;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #334155;
  line-height: 1.3;
}

.bof-quest-reset-pill b {
  color: #fde047;
}

.bof-quest-row {
  background: linear-gradient(180deg, #161b2e 0%, #101424 100%);
  border: 1px solid #26324d;
  border-left: 4px solid #38bdf8;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.bof-quest-row.is-completed {
  border-color: rgba(34, 197, 94, 0.45);
  border-left: 4px solid #22c55e;
}

.bof-quest-meta {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bof-quest-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bof-quest-title {
  margin: 0 !important;
  font-size: 15px !important;
  font-weight: 700;
  color: #f8fafc !important;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.bof-quest-progress-badge {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

.bof-quest-progress-badge.is-done {
  background: rgba(20, 83, 45, 0.65);
  border-color: rgba(74, 222, 128, 0.5);
  color: #4ade80;
}

.bof-quest-desc {
  margin: 0 !important;
  font-size: 13px !important;
  color: #cbd5e1 !important;
  line-height: 1.45;
}

.bof-quest-bar-track {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(51, 65, 85, 0.6);
}

.bof-quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bof-quest-bar-fill.is-done {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

.bof-quest-reward {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(51, 65, 85, 0.55);
}

.bof-quest-reward-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bof-quest-reward-label {
  font-size: 12px;
  color: #94a3b8;
  margin-right: 2px;
}

.bof-reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.bof-reward-pill.is-coin {
  background: rgba(234, 179, 8, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde047;
}

.bof-reward-pill.is-shard {
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.45);
  color: #d8b4fe;
}

.bof-quest-claim-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
}

.bof-quest-claim-btn.is-ready {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #0f172a;
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.45);
}

@media (max-width: 767px) {
  .bof-daily-login-card {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
  }

  .bof-daily-claim-btn {
    width: 100%;
    padding: 9px 14px;
    font-size: 13px;
  }

  .bof-quest-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .bof-quest-reset-pill {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-size: 11.5px;
    padding: 5px 10px;
  }

  .bof-quest-row {
    padding: 12px 14px;
    gap: 10px;
  }

  .bof-quest-title {
    font-size: 14.5px !important;
  }

  .bof-quest-desc {
    font-size: 12.5px !important;
  }

  .bof-quest-reward-label {
    display: none;
  }

  .bof-quest-reward-items {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .bof-reward-pill {
    padding: 3px 8px;
    font-size: 11.5px;
  }
}

/* ============================================================================
   🎨 COSMETICS SHOP & PROFILE CUSTOMIZATION (ของตกแต่งโปรไฟล์ / ลายหลังการ์ด / สนาม)
   ============================================================================ */
.bof-cosmetics-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 10px;
}

.bof-cosmetics-equipped-bar {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 27, 75, 0.9));
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.bof-cos-eq-head {
  font-size: 13px;
  font-weight: 800;
  color: #fde047;
  margin-bottom: 9px;
  letter-spacing: 0.02em;
}

.bof-cos-eq-pills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.bof-cos-eq-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(9, 13, 28, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 11px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
  min-width: 0;
}

.bof-cos-eq-pill:hover {
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.bof-cos-eq-mini-cb {
  width: 26px !important;
  height: 36px !important;
  max-width: 26px !important;
  max-height: 36px !important;
  border-radius: 4px;
  object-fit: cover !important;
  border: 1px solid #facc15;
  flex-shrink: 0;
}

.bof-cos-eq-mini-avatar {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 50%;
  object-fit: cover !important;
  border: 2px solid #64748b;
  flex-shrink: 0;
}

.bof-cos-eq-mini-swatch {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.bof-cos-eq-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.bof-cos-eq-meta span {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.bof-cos-eq-meta b {
  font-size: 12px;
  color: #f8fafc;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bof-cosmetics-cat-row {
  margin-top: 2px;
}

.bof-cosmetics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 2px 4px 8px 2px;
}

.bof-cosmetic-card {
  position: relative;
  background: linear-gradient(180deg, #161d34 0%, #0c1020 100%);
  border: 1.5px solid #283554;
  border-radius: 15px;
  padding: 11px 11px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.bof-cosmetic-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.bof-cosmetic-card.rarity-border-SR {
  border-color: rgba(192, 132, 252, 0.45);
}

.bof-cosmetic-card.rarity-border-SSR {
  border-color: rgba(250, 204, 21, 0.6);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.14);
}

.bof-cosmetic-card.is-owned-card {
  border-color: rgba(56, 189, 248, 0.55);
}

.bof-cosmetic-card.is-equipped-card {
  border: 2px solid #facc15 !important;
  background: linear-gradient(180deg, rgba(66, 32, 6, 0.5) 0%, #0d1120 100%);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.32);
}

.bof-cosmetic-badge-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.bof-cos-cat-tag {
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  padding: 2px 8px;
}

.bof-cosmetic-status-tag,
.bof-cosmetic-rarity-tag {
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
}

.bof-cosmetic-status-tag.is-eq {
  background: rgba(250, 204, 21, 0.22);
  border: 1px solid #facc15;
  color: #fde047;
}

.bof-cosmetic-status-tag.is-own {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.5);
  color: #86efac;
}

.bof-cosmetic-rarity-tag.is-N {
  background: rgba(100, 116, 139, 0.25);
  color: #cbd5e1;
}
.bof-cosmetic-rarity-tag.is-R {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}
.bof-cosmetic-rarity-tag.is-SR {
  background: rgba(192, 132, 252, 0.22);
  border: 1px solid rgba(192, 132, 252, 0.55);
  color: #e9d5ff;
}
.bof-cosmetic-rarity-tag.is-SSR {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.28), rgba(244, 63, 94, 0.28));
  border: 1px solid #fde047;
  color: #fde047;
}

/* กล่องพรีวิว: ล็อกขนาดตายตัวและ overflow: hidden ไม่ให้รูปทะลุกรอบเด็ดขาด */
.bof-cos-preview-box {
  width: 100%;
  height: 126px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(30, 41, 59, 0.78) 0%, rgba(8, 11, 24, 0.92) 100%);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.bof-cos-preview-cardback {
  position: relative;
  width: 78px !important;
  height: 108px !important;
  max-width: 78px !important;
  max-height: 108px !important;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #f3c969;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.bof-cos-preview-cardback img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  display: block;
}

.bof-cos-cb-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  pointer-events: none;
}

.bof-cos-preview-frame-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.bof-cos-avatar-sample {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  border-radius: 50%;
  object-fit: cover !important;
  display: block;
  border: 3px solid #64748b;
  transition: all 0.2s ease;
}

/* Profile Frame styles shared by preview, mini-avatar & lobby auth avatar */
.bof-cos-avatar-sample[data-frame="gold"],
.bof-cos-eq-mini-avatar[data-frame="gold"],
#bof-profile-avatar[data-frame="gold"],
#lb-auth-bar .lb-auth-avatar[data-frame="gold"] {
  border: 3px solid #fde047 !important;
  outline: 2px solid rgba(250, 204, 21, 0.45);
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.9), inset 0 0 10px rgba(250, 204, 21, 0.45) !important;
}

.bof-cos-avatar-sample[data-frame="crimson"],
.bof-cos-eq-mini-avatar[data-frame="crimson"],
#bof-profile-avatar[data-frame="crimson"],
#lb-auth-bar .lb-auth-avatar[data-frame="crimson"] {
  border: 3px solid #ef4444 !important;
  outline: 2px solid rgba(249, 115, 22, 0.55);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.95), 0 0 30px rgba(249, 115, 22, 0.65), inset 0 0 10px rgba(239, 68, 68, 0.45) !important;
}

.bof-cos-avatar-sample[data-frame="neon"],
.bof-cos-eq-mini-avatar[data-frame="neon"],
#bof-profile-avatar[data-frame="neon"],
#lb-auth-bar .lb-auth-avatar[data-frame="neon"] {
  border: 3px solid #22d3ee !important;
  outline: 2px solid rgba(244, 114, 182, 0.65);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.95), 0 0 30px rgba(244, 114, 182, 0.7), inset 0 0 10px rgba(34, 211, 238, 0.4) !important;
}

.bof-cos-avatar-sample[data-frame="abyss"],
.bof-cos-eq-mini-avatar[data-frame="abyss"],
#bof-profile-avatar[data-frame="abyss"],
#lb-auth-bar .lb-auth-avatar[data-frame="abyss"] {
  border: 3px solid #c084fc !important;
  outline: 2px solid rgba(124, 58, 237, 0.65);
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.95), 0 0 32px rgba(124, 58, 237, 0.75), inset 0 0 10px rgba(168, 85, 247, 0.45) !important;
}

.bof-cos-avatar-sample[data-frame="holo"],
.bof-cos-eq-mini-avatar[data-frame="holo"],
#bof-profile-avatar[data-frame="holo"],
#lb-auth-bar .lb-auth-avatar[data-frame="holo"] {
  border: 3px solid #fde047 !important;
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 2px;
  box-shadow: 0 0 14px #38bdf8, 0 0 26px #ec4899, 0 0 38px #fde047 !important;
  animation: bof-holo-frame 2.8s linear infinite;
}
@keyframes bof-holo-frame {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(60deg); }
}

.bof-cos-avatar-sample[data-frame="emerald"],
.bof-cos-eq-mini-avatar[data-frame="emerald"],
#bof-profile-avatar[data-frame="emerald"],
#lb-auth-bar .lb-auth-avatar[data-frame="emerald"] {
  border: 3px solid #10b981 !important;
  outline: 2px solid rgba(52, 211, 153, 0.5);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.95), 0 0 30px rgba(52, 211, 153, 0.6), inset 0 0 10px rgba(16, 185, 129, 0.4) !important;
}

.bof-cos-avatar-sample[data-frame="sakura"],
.bof-cos-eq-mini-avatar[data-frame="sakura"],
#bof-profile-avatar[data-frame="sakura"],
#lb-auth-bar .lb-auth-avatar[data-frame="sakura"] {
  border: 3px solid #f472b6 !important;
  outline: 2px solid rgba(251, 207, 232, 0.65);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(244, 114, 182, 0.95), 0 0 30px rgba(236, 72, 153, 0.65), inset 0 0 10px rgba(244, 114, 182, 0.4) !important;
}

.bof-cos-avatar-sample[data-frame="solar"],
.bof-cos-eq-mini-avatar[data-frame="solar"],
#bof-profile-avatar[data-frame="solar"],
#lb-auth-bar .lb-auth-avatar[data-frame="solar"] {
  border: 3px solid #f97316 !important;
  outline: 2px solid rgba(253, 224, 71, 0.65);
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.95), 0 0 34px rgba(251, 191, 36, 0.7), inset 0 0 10px rgba(249, 115, 22, 0.45) !important;
}

.bof-cos-avatar-sample[data-frame="amethyst"],
.bof-cos-eq-mini-avatar[data-frame="amethyst"],
#bof-profile-avatar[data-frame="amethyst"],
#lb-auth-bar .lb-auth-avatar[data-frame="amethyst"] {
  border: 3px solid #a855f7 !important;
  outline: 2px solid rgba(216, 180, 254, 0.55);
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.95), 0 0 30px rgba(147, 51, 234, 0.65), inset 0 0 10px rgba(168, 85, 247, 0.4) !important;
}

.bof-cos-preview-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  width: 100%;
}

.bof-user-title-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid var(--title-color, #fde047);
  color: var(--title-color, #fde047);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.bof-user-title-pill.is-large {
  font-size: 13px;
  padding: 6px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.bof-cos-preview-arena {
  width: 132px;
  height: 86px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 6px;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.7), 0 6px 14px rgba(0, 0, 0, 0.55);
}

.bof-cos-arena-grid-lines {
  display: flex;
  gap: 6px;
}

.bof-cos-arena-grid-lines span {
  width: 22px;
  height: 28px;
  border-radius: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.bof-cos-arena-divider {
  width: 90%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(250, 204, 21, 0.85), transparent);
}

.bof-cos-name {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.25;
}

.bof-cos-desc {
  margin: 0;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.35;
  flex: 1;
}

.bof-cos-action-btn {
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  transition: all 0.16s ease;
  margin-top: 2px;
}

.bof-cos-action-btn.is-buy {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.bof-cos-action-btn.is-buy:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.bof-cos-action-btn.is-buy:disabled,
.bof-cos-action-btn.is-disabled {
  background: #334155;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

.bof-cos-action-btn.is-equip {
  background: linear-gradient(135deg, #16a34a, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.bof-cos-action-btn.is-equip:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.bof-cos-action-btn.is-equipped {
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid #facc15;
  color: #fde047;
  cursor: default;
}

@media (max-width: 767px) {
  .bof-cos-eq-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .bof-cos-eq-pill {
    padding: 5px 8px;
    gap: 6px;
  }

  .bof-cosmetics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 54dvh;
  }

  .bof-cosmetic-card {
    padding: 9px 8px;
    gap: 5px;
  }

  .bof-cos-preview-box {
    height: 102px;
  }

  .bof-cos-preview-cardback {
    width: 62px !important;
    height: 86px !important;
    max-width: 62px !important;
    max-height: 86px !important;
  }

  .bof-cos-avatar-sample {
    width: 58px !important;
    height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
  }

  .bof-cos-name {
    font-size: 12.5px;
  }

  .bof-cos-desc {
    font-size: 10.5px;
  }

  .bof-cos-action-btn {
    padding: 6px 8px;
    font-size: 11px;
  }
}


/* ============================================================================
   ร้านค้า แบบ A (v0.9): หัวสองแถว + แท็บเต็มความกว้าง + สวิตช์จำนวนซอง + การ์ดซ้ำ → ชาร์ด
   ใช้ #bof-shop-dialog นำหน้าเพื่อชนะกฎเก่าด้านบน (รวมกฎมือถือ ≤767px)
   ============================================================================ */
#bof-shop-dialog .sh-top { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 0; border-bottom: 0; }
#bof-shop-dialog .sh-top h2 { margin: 0 auto 0 0; font: 700 26px/1.2 var(--font-display, 'Kanit', sans-serif); color: #ffe39a; }
.sh-wallet { display: inline-flex; align-items: stretch; border-radius: 999px; border: 1px solid rgba(160, 175, 255, .32); background: rgba(255, 255, 255, .04); }
.sh-wallet > span { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; font: 700 16px var(--font-display, 'Kanit', sans-serif); color: #e8eaf7; }
.sh-wallet > span + span { border-left: 1px solid rgba(160, 175, 255, .32); }
.sh-wallet svg { width: 18px; height: 18px; flex-shrink: 0; }
.sh-wallet small { font: 500 12px var(--font-body, sans-serif); color: #8a90b8; }
.sh-code-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px dashed rgba(243, 201, 105, .55); background: none; color: #ffe39a; display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--font-display, 'Kanit', sans-serif); cursor: pointer; }
.sh-code-btn[aria-expanded="true"] { border-style: solid; background: rgba(243, 201, 105, .1); }
.sh-code-btn svg, .sh-x svg, .sh-tab svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sh-code-btn svg { width: 16px; height: 16px; }
.sh-x { width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid rgba(160, 175, 255, .32); background: rgba(255, 255, 255, .05); color: #e8eaf7; cursor: pointer; }
.sh-x:hover { border-color: #f3c969; }
.sh-x svg { width: 18px; height: 18px; }
#bof-shop-dialog .sh-code { display: flex; gap: 8px; margin-top: 12px; padding: 0; border: 0; background: none; border-radius: 0; }
#bof-shop-dialog .sh-code[hidden] { display: none; }
#bof-shop-dialog .sh-code .bof-shop-code-input { flex: 1; width: auto; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(160, 175, 255, .32); background: #0a0c1d; font-size: 16px; }
.sh-btn-gold { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: linear-gradient(135deg, #ffe39a, #e0a83c); color: #1a1405; font: 600 15px var(--font-display, 'Kanit', sans-serif); cursor: pointer; }

/* แท็บ: เส้นทองเลื่อนตามแท็บที่เลือก (transform อย่างเดียว) */
.sh-tabs { position: relative; display: grid; grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr)); margin: 16px 0 0; border-bottom: 1px solid rgba(160, 175, 255, .18); }
.sh-tab { position: relative; min-height: 52px; padding: 6px 8px; border: 0; background: none; display: flex; align-items: center; justify-content: center; gap: 8px; color: #8a90b8; font: 600 15px var(--font-display, 'Kanit', sans-serif); cursor: pointer; transition: color .2s; touch-action: manipulation; }
.sh-tab:hover { color: #e8eaf7; }
.sh-tab[aria-selected="true"] { color: #ffe39a; }
.sh-tab svg { width: 18px; height: 18px; flex-shrink: 0; }
.sh-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ff5d73; color: #fff; font: 700 11px/18px var(--font-display, 'Kanit', sans-serif); }
.sh-badge[hidden] { display: none; }
.sh-tab-ink { position: absolute; left: 0; bottom: -1px; width: calc(100% / var(--tab-count, 4)); height: 3px; pointer-events: none; transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .38s cubic-bezier(.3, 1.4, .5, 1); }
.sh-tab-ink::before { content: ""; position: absolute; left: 16%; right: 16%; top: 0; bottom: 0; border-radius: 3px 3px 0 0; background: #f3c969; box-shadow: 0 0 12px rgba(243, 201, 105, .6); }
.sh-view { padding-top: 14px; }

/* แถบเลือกจำนวนซอง: ปุ่มเลื่อนสีทองไหลไปมา */
.sh-packs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; border-radius: 14px; background: #141834; border: 1px solid rgba(160, 175, 255, .18); }
.sh-qty { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: #0a0c1d; border: 1px solid rgba(160, 175, 255, .18); }
.sh-qty-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: #f3c969; transition: transform .34s cubic-bezier(.3, 1.35, .5, 1); }
.sh-qty[data-q="10"] .sh-qty-thumb { transform: translateX(100%); }
.sh-qty button { position: relative; min-height: 40px; padding: 0 16px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; color: #b9bee0; font: 600 14px var(--font-display, 'Kanit', sans-serif); cursor: pointer; transition: color .25s; touch-action: manipulation; }
.sh-qty button[aria-checked="true"] { color: #12142a; }
.sh-save { padding: 1px 7px; border-radius: 99px; background: #ff5d73; color: #fff; font: 700 11px/1.5 var(--font-display, 'Kanit', sans-serif); }
.sh-packs-info { margin: 0; flex: 1 1 260px; font-size: 13px; color: #8a90b8; }
.sh-packs-info b { color: #ffe39a; font-family: var(--font-display, 'Kanit', sans-serif); }
.sh-history-btn {
  min-height: 36px; padding: 0 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(160, 175, 255, .28); background: rgba(255, 255, 255, .06);
  color: #e2e8f0; font: 600 12.5px var(--font-display, 'Kanit', sans-serif); white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
.sh-history-btn:hover { border-color: #f3c969; color: #ffe39a; background: rgba(243, 201, 105, .12); }
.sh-hist-list { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 16px; max-height: 62vh; overflow-y: auto; }
.sh-hist-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(160,175,255,.12); }
.sh-hist-row img { width: 32px; aspect-ratio: 750/1050; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.sh-hist-rar { min-width: 38px; text-align: center; padding: 2px 6px; border-radius: 999px; font: 700 11px var(--font-display, 'Kanit', sans-serif); background: rgba(255,255,255,.08); color: #cbd5e1; }
.sh-hist-rar.is-r { color: #7cc0ff; background: rgba(124,192,255,.15); }
.sh-hist-rar.is-sr { color: #ff8597; background: rgba(255,133,151,.15); }
.sh-hist-rar.is-ssr { color: #fde047; background: rgba(253,224,71,.18); }
.sh-hist-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-hist-meta b { font: 600 13px/1.3 var(--font-display, 'Kanit', sans-serif); color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-hist-meta small { font-size: 11px; color: #8a90b8; }
.sh-hist-tag { padding: 2px 8px; border-radius: 999px; font: 700 11px var(--font-display, 'Kanit', sans-serif); white-space: nowrap; }
.sh-hist-tag.is-new { background: rgba(74, 222, 128, .18); color: #86efac; }
.sh-hist-tag.is-shard { background: rgba(196, 167, 255, .18); color: #ddd6fe; }
.sh-dupe-note { display: flex; align-items: center; gap: 8px; margin: 10px 2px 14px; font-size: 13px; color: #b9bee0; }
.sh-dupe-note svg { width: 16px; height: 16px; flex-shrink: 0; }

.sh-packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sh-pack {
  --c: #3ee08f; position: relative; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(160, 175, 255, .25); border-color: color-mix(in srgb, var(--c) 45%, transparent);
  background: #141834; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 12%, #141834), #10132c 55%);
}
.sh-pack-art { position: relative; height: 176px; display: grid; place-items: center; background: radial-gradient(60% 70% at 50% 60%, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%); }
.sh-pack-art img { position: relative; height: 152px; aspect-ratio: 750 / 1050; object-fit: cover; border-radius: 10px; box-shadow: 0 14px 28px rgba(0, 0, 0, .55); transform: rotate(-3deg); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.sh-pack-back { position: absolute; height: 142px; aspect-ratio: 750 / 1050; border-radius: 10px; background: linear-gradient(135deg, #2b336f, #161a40); border: 2px solid rgba(243, 201, 105, .4); transform: translateX(24px) rotate(8deg); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.sh-pack:hover .sh-pack-art img { transform: rotate(0) translateY(-6px) scale(1.04); }
.sh-pack:hover .sh-pack-back { transform: translateX(34px) rotate(14deg); }
.sh-pack-info { padding: 2px 16px 0; text-align: center; }
.sh-pack-info h3 { margin: 0; font: 700 19px/1.3 var(--font-display, 'Kanit', sans-serif); color: #e8eaf7; }
.sh-pack-info p { margin: 2px 0 0; font-size: 12.5px; color: #8a90b8; }
.sh-pack-rates { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 8px; }
.sh-rate-pill { padding: 1px 7px; border-radius: 99px; font: 600 11px/1.5 var(--font-display, 'Kanit', sans-serif); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #cbd5e1; }
.sh-rate-pill.is-r { color: #7cc0ff; border-color: rgba(124,192,255,.35); }
.sh-rate-pill.is-sr { color: #ff8597; border-color: rgba(255,133,151,.4); }
.sh-rate-pill.is-ssr { color: #fde047; border-color: rgba(253,224,71,.45); }
.sh-pity { margin: 12px 16px 14px; font-size: 12.5px; color: #b9bee0; }
.sh-pity > div:first-child { display: flex; justify-content: space-between; margin-bottom: 5px; }
.sh-pity b { color: #ffe39a; font-family: var(--font-display, 'Kanit', sans-serif); }
.sh-pity.is-hot b { color: #ff8597; }
.sh-meter { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.sh-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e0a83c, #ffe39a); transition: width .35s ease; }
.sh-pity.is-hot .sh-meter i { background: linear-gradient(90deg, #ff5d73, #fde047); box-shadow: 0 0 10px rgba(255, 93, 115, .7); }
.sh-peek-btn {
  margin: 0 16px 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid rgba(160, 175, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: 600 13px var(--font-display, 'Kanit', sans-serif);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.sh-peek-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(243, 201, 105, 0.65);
  color: #ffe39a;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.sh-peek-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.sh-buy { margin: 6px 16px 16px; margin-top: auto; min-height: 46px; border: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(135deg, #ffe39a, #e0a83c); color: #1a1405; box-shadow: 0 6px 18px rgba(224, 168, 60, .25); font: 600 15px var(--font-display, 'Kanit', sans-serif); cursor: pointer; touch-action: manipulation; }
.sh-buy:hover:not(:disabled) { filter: brightness(1.06); }
.sh-buy:disabled { opacity: 0.6; cursor: not-allowed; background: #262b48; color: #8a90b8; box-shadow: none; filter: none; }
.sh-buy.is-owned { background: rgba(30, 41, 59, 0.85); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.2); }
.sh-price { display: inline-flex; align-items: center; gap: 4px; }
.sh-ico-coin, .sh-ico-shard { width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 767px) {
  #bof-shop-dialog .sh-top { gap: 8px; }
  #bof-shop-dialog .sh-top h2 { flex-basis: calc(100% - 54px); font-size: 22px; }
  #bof-shop-dialog .sh-top .sh-x { order: -1; margin-left: auto; }
  #bof-shop-dialog .sh-top h2 { order: -2; }
  .sh-wallet > span { padding: 0 11px; font-size: 14px; }
  .sh-tab { flex-direction: column; gap: 2px; min-height: 58px; font-size: 12.5px; }
  .sh-tab .sh-badge { position: absolute; top: 4px; right: calc(50% - 26px); }
  .sh-packs { grid-template-columns: 1fr; gap: 10px; }
  .sh-pack { display: grid; grid-template-columns: 124px minmax(0, 1fr); grid-template-areas: "art info" "pity pity" "peek peek" "buy buy"; }
  .sh-pack-art { grid-area: art; height: auto; padding: 12px 0; }
  .sh-pack-art img { height: 108px; transform: translateX(-8px) rotate(-3deg); }
  .sh-pack-back { height: 100px; transform: translateX(12px) rotate(8deg); }
  .sh-pack-info { grid-area: info; align-self: center; padding: 0 12px 0 0; text-align: left; }
  .sh-pity { grid-area: pity; margin: 0 14px; }
  .sh-peek-btn { grid-area: peek; margin: 4px 14px 6px; }
  .sh-buy { grid-area: buy; margin: 6px 14px 14px; }
}

/* ---------- หน้าต่างดูการ์ดข้างใน (Card Peek Modal) ---------- */
.sh-card-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 8, 20, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: shFadeIn 0.2s ease-out;
}
@keyframes shFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sh-card-peek-box {
  position: relative;
  width: min(840px, 100%);
  max-height: min(88vh, 88dvh);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(160, 175, 255, 0.3);
  border-color: color-mix(in srgb, var(--accent, #f3c969) 55%, transparent);
  background: radial-gradient(90% 60% at 50% -10%, color-mix(in srgb, var(--accent, #f3c969) 16%, transparent), transparent 60%), linear-gradient(180deg, #151a3c, #0b0e24);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75), 0 0 40px color-mix(in srgb, var(--accent, #f3c969) 15%, transparent);
  color: #e8eaf7;
  animation: shSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes shSlideUp {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sh-card-peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sh-card-peek-title-group h3 {
  margin: 0;
  font: 700 20px/1.3 var(--font-display, 'Kanit', sans-serif);
  color: #ffe39a;
}
.sh-card-peek-title-group p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #8a90b8;
}
.sh-card-peek-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(160, 175, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #e8eaf7;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sh-card-peek-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(248, 113, 113, 0.6);
  color: #fca5a5;
  transform: rotate(90deg);
}

.sh-card-peek-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(10, 14, 32, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sh-peek-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display, 'Kanit', sans-serif);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.sh-peek-badge.r-SSR { color: #fde047; border-color: rgba(253, 224, 71, 0.5); background: rgba(253, 224, 71, 0.1); }
.sh-peek-badge.r-SR { color: #ff8597; border-color: rgba(255, 133, 151, 0.5); background: rgba(255, 133, 151, 0.1); }
.sh-peek-badge.r-R { color: #7cc0ff; border-color: rgba(124, 192, 255, 0.5); background: rgba(124, 192, 255, 0.1); }
.sh-peek-badge.r-N { color: #cbd5e1; border-color: rgba(203, 213, 225, 0.3); background: rgba(255, 255, 255, 0.05); }

.sh-card-peek-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}

.sh-peek-card-item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: 12px;
  background: #141834;
  border: 1px solid rgba(160, 175, 255, 0.16);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}
.sh-peek-card-item:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(243, 201, 105, 0.7);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), 0 0 16px rgba(243, 201, 105, 0.25);
}
.sh-peek-card-item.r-SSR { border-color: rgba(253, 224, 71, 0.45); }
.sh-peek-card-item.r-SR { border-color: rgba(255, 133, 151, 0.4); }

.sh-peek-art-wrap {
  position: relative;
  aspect-ratio: 750 / 1050;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0c1d;
}
.sh-peek-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sh-peek-rar-tag {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(10, 12, 29, 0.88);
  font: 700 11px/1.3 var(--font-display, 'Kanit', sans-serif);
  border: 1px solid currentColor;
}
.sh-peek-rar-tag.r-SSR { color: #fde047; }
.sh-peek-rar-tag.r-SR { color: #ff8597; }
.sh-peek-rar-tag.r-R { color: #7cc0ff; }
.sh-peek-rar-tag.r-N { color: #cbd5e1; }

.sh-peek-count-tag {
  position: absolute;
  bottom: 5px;
  right: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(10, 12, 29, 0.9);
  color: #38bdf8;
  font: 800 11px/1.3 var(--font-display, 'Kanit', sans-serif);
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.sh-peek-meta {
  padding: 6px 4px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sh-peek-card-name {
  font: 700 12.5px/1.3 var(--font-display, 'Kanit', sans-serif);
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sh-peek-card-type {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .sh-card-peek-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 8px;
    padding: 10px 12px;
  }
  .sh-card-peek-head {
    padding: 12px 14px 10px;
  }
  .sh-card-peek-summary-bar {
    padding: 8px 14px;
  }
}

/* ---------- ผลการเปิดซอง ---------- */
#bof-reveal-title.rv-title { margin: 0; text-align: center; font: 700 20px/1.3 var(--font-display, 'Kanit', sans-serif); color: #ffe39a; }
.rv-title span { color: #e8eaf7; }
.rv-title small { display: block; margin-top: 2px; font: 400 12.5px var(--font-body, sans-serif); color: #8a90b8; }
.rv-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(15, 23, 42, .92); border: 1px solid rgba(255, 255, 255, .16); color: #e8eaf7; font: 600 13px var(--font-display, 'Kanit', sans-serif); }
.rv-chip b { color: var(--t); }
.rv-chip-new { color: #4ade80; border-color: rgba(74, 222, 128, .45); }
.rv-chip-shard { color: #e3d6ff; border-color: rgba(196, 167, 255, .6); background: rgba(80, 50, 160, .25); }
.rv-chip-shard svg { width: 16px; height: 16px; }
.rv-chip-shard b { color: #fff; min-width: 2ch; text-align: right; }
.rv-chip-shard small { font: 500 11.5px var(--font-body, sans-serif); color: #a89bd0; }
.rv-back-n { font: 700 26px/1 var(--font-display, 'Kanit', sans-serif); margin-bottom: 4px; }
.rv-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.rv-btn { min-height: 44px; padding: 0 22px; border-radius: 12px; border: 0; font: 600 15px var(--font-display, 'Kanit', sans-serif); cursor: pointer; touch-action: manipulation; }
.rv-btn-gold { background: linear-gradient(135deg, #ffe39a, #e0a83c); color: #1a1405; }
.rv-btn-ghost { background: rgba(255, 255, 255, .05); border: 1px solid rgba(160, 175, 255, .32); color: #e8eaf7; }
.rv-btn-ghost:hover { border-color: #f3c969; }

/* ใบซ้ำ: หลังแตก การ์ดจางเหลือป้าย "+N ชาร์ด" */
.bof-flip-card.is-dupe .bof-flip-back { box-shadow: 0 0 0 2px rgba(196, 167, 255, .35), 0 12px 28px rgba(0, 0, 0, .65); }
.rv-dupe-result {
  position: absolute; inset: 0; z-index: 9; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px;
  background: radial-gradient(80% 60% at 50% 45%, rgba(124, 84, 230, .55), rgba(16, 12, 40, .92)); border: 1.5px solid rgba(196, 167, 255, .7);
  color: #efe8ff; text-align: center; opacity: 0; transform: scale(.85); transition: opacity .35s, transform .45s cubic-bezier(.3, 1.5, .5, 1); pointer-events: none;
}
.rv-dupe-result svg { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(196, 167, 255, .9)); }
.rv-dupe-result b { font: 700 24px/1.1 var(--font-display, 'Kanit', sans-serif); }
.rv-dupe-result span { font: 600 13px var(--font-display, 'Kanit', sans-serif); }
.rv-dupe-result small { margin-top: 6px; font-size: 11px; color: #b7a9e6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bof-flip-card.is-shattered .rv-dupe-result { opacity: 1; transform: none; }
.bof-flip-card.is-shattered .bof-fullart-card { filter: saturate(0) brightness(.45); }
.rv-shard-layer { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.rv-shard-bit {
  position: absolute; width: 12px; height: 16px; margin: -8px 0 0 -6px; will-change: transform, opacity;
  background: linear-gradient(160deg, #f4eeff 0%, #c4a7ff 40%, #7d5cd6 100%); clip-path: polygon(50% 0, 100% 40%, 50% 100%, 0 40%);
  filter: drop-shadow(0 0 6px rgba(196, 167, 255, .95));
}
@media (prefers-reduced-motion: reduce) {
  .sh-tab-ink, .sh-qty-thumb, .sh-pack-art img, .sh-pack-back, .rv-dupe-result { transition: none; }
}
