/* CLINED Card Shop */

.card-shop-fab {
  position: fixed;
  left: 14px;
  top: 33vh;
  z-index: 900;
  width: 62px;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 20px;
  border: 2.5px solid #6d28d9;
  border-bottom-width: 5px;
  background: linear-gradient(160deg, #a855f7, #7c3aed);
  box-shadow: 0 6px 0 #4c1d95, 0 10px 26px rgba(124, 58, 237, .35);
  cursor: grab;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(.85);
  transition: opacity .18s ease, transform .18s ease;
}
.card-shop-fab.is-visible { opacity: 1; pointer-events: auto; transform: scale(1); }
.card-shop-fab:active { cursor: grabbing; }
.card-shop-fab .fab-basket-img { width: 34px; height: 34px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); }
.card-shop-fab .fab-dia { font: 800 11px system-ui, sans-serif; color: #fff; background: rgba(0, 0, 0, .22); border-radius: 99px; padding: 2px 7px; pointer-events: none; white-space: nowrap; }

.card-shop-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; visibility: hidden; }
.card-shop-modal.open { visibility: visible; }
.card-shop-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s ease; }
.card-shop-modal.open .card-shop-backdrop { opacity: 1; }
.card-shop-sheet {
  position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--card, #fff); color: var(--text, #111); border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .3, 1);
  display: flex; flex-direction: column; gap: 14px;
}
.card-shop-modal.open .card-shop-sheet { transform: translateY(0); }
.card-shop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-shop-eyebrow { font: 900 11px system-ui, sans-serif; letter-spacing: .06em; color: #a855f7; }
.card-shop-head h3 { margin: 2px 0 2px; font-size: 22px; font-weight: 950; }
.card-shop-head p { margin: 0; color: var(--muted, #6b7280); font-size: 13px; font-weight: 700; }
.card-shop-close { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line, #e5e7eb); background: var(--surface, #f4f4f4); color: var(--text, #111); font-size: 15px; cursor: pointer; flex: none; }

.card-shop-dia-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.card-shop-dia-badge { display: inline-flex; align-items: center; gap: 5px; font: 900 15px system-ui, sans-serif; background: rgba(168, 85, 247, .12); color: #7c3aed; padding: 5px 12px; border-radius: 99px; }
.card-shop-dia-hint { font-size: 11px; color: var(--muted, #6b7280); font-weight: 700; }

.card-pack-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; border: 2px solid var(--line, #e5e7eb); background: linear-gradient(135deg, rgba(168, 85, 247, .1), rgba(124, 58, 237, .05)); }
.card-pack-img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.card-pack-info { display: flex; flex-direction: column; gap: 3px; }
.card-pack-info b { font-size: 17px; font-weight: 950; }
.card-pack-info small { color: var(--muted, #6b7280); font-weight: 700; }
.card-rarity-odds { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.card-rarity-odds span { font: 800 10px system-ui, sans-serif; padding: 2px 7px; border-radius: 99px; background: var(--surface, #eee); color: var(--muted, #555); }
.card-rarity-odds .odd-rare { background: rgba(59, 130, 246, .15); color: #2563eb; }
.card-rarity-odds .odd-epic { background: rgba(168, 85, 247, .15); color: #7c3aed; }
.card-rarity-odds .odd-legendary { background: rgba(245, 201, 122, .25); color: #b8860b; }

.card-buy-btn { width: 100%; min-height: 52px; border-radius: 16px; border: 2px solid #6d28d9; background: linear-gradient(160deg, #a855f7, #7c3aed); color: #fff; font: 950 15px system-ui, sans-serif; letter-spacing: .02em; box-shadow: 0 4px 0 #4c1d95; cursor: pointer; }
.card-buy-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.card-collection-head { display: flex; align-items: center; justify-content: space-between; font-weight: 900; font-size: 13px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: .04em; }
.card-collection-head b { color: var(--text, #111); font-size: 15px; }
.card-collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.coll-card-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--card-color) 50%, var(--line, #e5e7eb)); background: color-mix(in srgb, var(--card-color) 8%, var(--card, #fff)); }
.coll-card-slot img { width: 56px; height: 78px; object-fit: cover; border-radius: 8px; }
.coll-card-slot b { font-size: 11px; font-weight: 900; text-align: center; }
.coll-card-slot small { font-size: 10px; font-weight: 800; color: var(--muted, #6b7280); }
.coll-card-slot.locked { opacity: .4; filter: grayscale(1); }

/* ══════════════ Pack Opening Sequence (ala TCG) ══════════════ */
.pack-open-overlay { position: fixed; inset: 0; z-index: 2147483001; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 35%, rgba(88, 28, 135, .35), rgba(0, 0, 0, .82)); opacity: 0; transition: opacity .25s ease; padding: 20px; }
.pack-open-overlay.show { opacity: 1; }
.pack-open-stage { position: relative; width: 100%; max-width: 300px; min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Fase 1: pack menunggu diketuk, berdenyut pelan */
.pack-tap { position: relative; background: none; border: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 14px; animation: pack-idle-pulse 1.6s ease-in-out infinite; }
.pack-open-img { width: 140px; height: 140px; object-fit: contain; filter: drop-shadow(0 0 22px var(--rarity-color, #a855f7)); }
.pack-tap-hint { font: 900 13px system-ui, sans-serif; color: #fff; background: rgba(255, 255, 255, .12); padding: 5px 14px; border-radius: 99px; letter-spacing: .02em; }
@keyframes pack-idle-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }

.phase-burst .pack-tap { animation: pack-shake .45s ease both; pointer-events: none; }
@keyframes pack-shake {
  0% { transform: scale(1) rotate(0); }
  20% { transform: scale(1.08) rotate(-4deg); }
  40% { transform: scale(1.1) rotate(4deg); }
  60% { transform: scale(1.05) rotate(-3deg); }
  80% { transform: scale(.4) rotate(2deg); opacity: 1; }
  100% { transform: scale(.2) rotate(0); opacity: 0; }
}

/* Flash cahaya saat pack pecah */
.pack-flash { position: absolute; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, var(--rarity-color, #a855f7) 45%, transparent 72%); opacity: 0; pointer-events: none; }
.phase-burst .pack-flash { animation: pack-flash-pop .55s ease .35s both; }
@keyframes pack-flash-pop { 0% { opacity: 0; transform: scale(.3); } 35% { opacity: 1; } 100% { opacity: 0; transform: scale(6); } }

/* Fase 2: kartu terbang masuk sambil membalik (3D flip) */
.pack-card-flip { position: relative; width: 190px; height: 266px; perspective: 900px; opacity: 0; transform: translateY(26px) scale(.85); }
.phase-flip .pack-card-flip, .phase-reveal .pack-card-flip { opacity: 1; transform: translateY(0) scale(1); transition: opacity .35s ease, transform .5s cubic-bezier(.2, .8, .3, 1.15); }
.pack-card-rays { position: absolute; inset: -60px; background: repeating-conic-gradient(from 0deg, var(--rarity-color, #a855f7) 0deg 4deg, transparent 4deg 16deg); opacity: 0; border-radius: 50%; filter: blur(1px); }
.rarity-epic .pack-card-rays, .rarity-legendary .pack-card-rays { animation: rays-spin 6s linear infinite; }
.phase-flip .pack-card-rays, .phase-reveal .pack-card-rays { opacity: .35; transition: opacity .5s ease .1s; }
@keyframes rays-spin { to { transform: rotate(360deg); } }

.pack-card-inner { position: relative; width: 100%; height: 100%; }.phase-flip .pack-card-inner, .phase-reveal .pack-card-inner { opacity: 0; transform: scale(.88); transition: opacity .25s ease, transform .35s ease; }.phase-reveal .pack-card-inner { opacity: 1; transform: scale(1); }.pack-card-back, .pack-card-front { position: absolute; inset: 0; border-radius: 16px; backface-visibility: visible; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }.pack-card-back { background: linear-gradient(155deg, #7c3aed, #4c1d95); flex-direction: column; gap: 2px; border: 3px solid rgba(255, 255, 255, .25); opacity: 0; }.pack-card-front { transform: none; background: #fff; border: 3px solid var(--rarity-color, #a855f7); overflow: hidden; }.pack-card-front img { width: 100%; height: 100%; object-fit: cover; }
.pack-card-front img { width: 100%; height: 100%; object-fit: cover; }

/* Fase 3: info kartu (nama, fakta, tombol) muncul di bawah kartu */
.pack-result-info { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .3s ease, transform .3s ease; width: 100%; }
.phase-reveal .pack-result-info { opacity: 1; transform: translateY(0); pointer-events: auto; transition-delay: .1s; }
.card-reveal-rarity { font: 950 12px system-ui, sans-serif; letter-spacing: .06em; padding: 3px 12px; border-radius: 99px; color: #fff; background: var(--rarity-color, #888); text-transform: uppercase; }
.pack-result-info h4 { margin: 2px 0 0; font-size: 21px; font-weight: 950; color: #fff; }
.pack-result-info p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .75); font-weight: 700; max-width: 260px; }
.pack-result-info .card-dup-note { color: rgba(255, 255, 255, .55); font-size: 11px; }
.pack-result-info .ml-next { margin-top: 10px; max-width: 220px; }



.card-confetti-layer { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 5; }
.card-confetti-layer i { position: absolute; top: 40%; left: 50%; width: 8px; height: 12px; border-radius: 2px; opacity: 0; transform: translate(-50%, -50%); animation: confetti-burst 1s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes confetti-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.4); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1); }
}

.diamond-earn-pop { position: fixed; top: 18%; left: 50%; transform: translateX(-50%); z-index: 3000; background: #7c3aed; color: #fff; font-weight: 900; font-size: 14px; padding: 10px 18px; border-radius: 99px; box-shadow: 0 6px 18px rgba(124, 58, 247, .4); animation: dia-pop 1.6s ease forwards; }
@keyframes dia-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(.95); }
}
/* iOS Safari FAB rendering fix — does not affect desktop/Android */
@supports (-webkit-touch-callout: none) {
  .card-shop-fab {
    -webkit-appearance: none !important;
    appearance: none !important;
    -webkit-transform: translate3d(0, 0, 0) scale(1) !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    -webkit-backface-visibility: visible !important;
    backface-visibility: visible !important;
    will-change: transform, opacity;
    isolation: isolate;
  }

  .card-shop-fab.is-visible {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
  }
}


