/* ==========================================================
   난장 카드게임 이펙트 + 품질 업그레이드 (cardgame-vfx.js 짝) — 2026-10-24
   cardgame-v2.css 뒤에 로드
   ========================================================== */
.cgx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1900; overflow: hidden; } /* 대상 선택·궁극기 창(2000)보다 아래 — 눌러야 할 버튼을 가리지 않게 */
.cgx { position: absolute; transform: translate(-50%, -50%); }

/* 입자 */
.cgx-burst i { position: absolute; left: 0; top: 0; font-style: normal; will-change: transform, opacity; animation: cgxFly 900ms cubic-bezier(.15, .8, .3, 1) both; }
.cgx-dot { width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.cgx-emo { font-size: var(--s); line-height: 1; }
@keyframes cgxFly {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r)); opacity: 0; }
}
.cgx-rise i { animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
.cgx-soft .cgx-dot { filter: blur(3px); }

/* 링 / 빛 / 화면 */
.cgx-ring { width: var(--sz); height: var(--sz); border-radius: 50%; border: var(--w) solid var(--c); box-shadow: 0 0 18px var(--c), inset 0 0 18px var(--c); animation: cgxRing 600ms ease-out both; }
@keyframes cgxRing { from { transform: translate(-50%, -50%) scale(.15); opacity: 1; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.cgx-glow { width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, var(--c), transparent 65%); animation: cgxGlow 900ms ease-out both; }
@keyframes cgxGlow { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; } }
.cgx-flash { position: fixed; inset: 0; transform: none; background: var(--c); animation: cgxFade 350ms ease-out both; }
.cgx-vignette { position: fixed; inset: 0; transform: none; box-shadow: inset 0 0 120px 30px rgba(255, 30, 60, .55); animation: cgxFade 700ms ease-out both; }
@keyframes cgxFade { from { opacity: 1; } to { opacity: 0; } }

/* 글자 / 큰 이모지 */
.cgx-text b { display: block; font-family: "Arial Black", Impact, system-ui, sans-serif; font-size: 30px; letter-spacing: 2px; -webkit-text-stroke: 2px rgba(0, 0, 0, .7); paint-order: stroke fill; animation: cgxText 1s cubic-bezier(.2, .9, .25, 1.3) both; }
@keyframes cgxText { 0% { transform: scale(.3) rotate(-10deg); opacity: 0; } 25% { transform: scale(1.25) rotate(4deg); opacity: 1; } 70% { transform: scale(1) translateY(-10px); opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }
.cgx-blue b { color: #8ab8ff; } .cgx-white b { color: #fff; } .cgx-cyan b { color: #67e8f9; } .cgx-yellow b { color: #fde047; } .cgx-red b { color: #ff4f5e; }
.cgx-pop span { display: block; font-size: 46px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); animation: cgxPop 1s cubic-bezier(.2, .9, .25, 1.4) both; }
.cgx-pop.cgx-big span { font-size: 70px; }
@keyframes cgxPop { 0% { transform: scale(0) rotate(-20deg); } 30% { transform: scale(1.3) rotate(8deg); } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9) translateY(-20px); opacity: 0; } }
.cgx-pop.cgx-spin span { animation: cgxSpin 1s ease-out both; }
@keyframes cgxSpin { 0% { transform: scale(.2) rotate(0); } 40% { transform: scale(1.2) rotate(540deg); } 100% { transform: scale(1) rotate(900deg); opacity: 0; } }
.cgx-pop.cgx-spinback span { animation: cgxSpinBack 1s ease-out both; }
@keyframes cgxSpinBack { 0% { transform: scale(.2) rotate(0); } 50% { transform: scale(1.3) rotate(-360deg); } 100% { transform: scale(1) rotate(-540deg); opacity: 0; } }
.cgx-pop.cgx-drop span { animation: cgxDrop 1s cubic-bezier(.5, 0, .7, 1.5) both; }
@keyframes cgxDrop { 0% { transform: translateY(-120px) scale(.8); opacity: 0; } 35% { transform: translateY(60px) scale(1.1); opacity: 1; } 55% { transform: translateY(45px) scale(1, .85); } 80% { transform: translateY(60px); opacity: 1; } 100% { transform: translateY(60px); opacity: 0; } }
.cgx-pop.cgx-hop span { animation: cgxHop 1s ease-out both; }
@keyframes cgxHop { 0% { transform: scale(0); } 20% { transform: translateY(-30px) scale(1.2); } 40% { transform: translateY(0) scale(1, .8); } 60% { transform: translateY(-18px); } 80% { transform: translateY(0); opacity: 1; } 100% { opacity: 0; } }
.cgx-pop.cgx-shakebox span { animation: cgxShakeBox 1s ease-in-out both; }
@keyframes cgxShakeBox { 0% { transform: scale(0); } 15% { transform: scale(1.2); } 25%, 45%, 65% { transform: rotate(-12deg); } 35%, 55%, 75% { transform: rotate(12deg); } 90% { transform: scale(1.5); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
.cgx-pop.cgx-snatch span { animation: cgxSnatch 900ms ease-in both; }
@keyframes cgxSnatch { 0% { transform: translateX(-60px) scale(.6); opacity: 0; } 40% { transform: translateX(0) scale(1.2); opacity: 1; } 60% { transform: translateX(0) scale(1); } 100% { transform: translateX(80px) scale(.6); opacity: 0; } }
.cgx-pop.cgx-cardpop span { font-size: 40px; color: #c4b5fd; animation: cgxCardPop 800ms ease-out both; }
@keyframes cgxCardPop { 0% { transform: translateY(40px) scale(.5); opacity: 0; } 50% { transform: translateY(-20px) scale(1.1); opacity: 1; } 100% { transform: translateY(-50px); opacity: 0; } }

/* 베기 */
.cgx-slash { width: 180px; height: 6px; border-radius: 6px; background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent); box-shadow: 0 0 14px #fff, 0 0 30px rgba(255, 79, 94, .8); animation: cgxSlash 420ms cubic-bezier(.2, .8, .3, 1) both; }
@keyframes cgxSlash { 0% { transform: translate(-50%, -50%) rotate(var(--rot)) scaleX(0); opacity: 1; } 45% { transform: translate(-50%, -50%) rotate(var(--rot)) scaleX(1.1); opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(var(--rot)) scaleX(1.2) translateY(6px); opacity: 0; } }
/* 화살 */
.cgx-arrow i { position: absolute; left: -60px; top: -2px; width: 120px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, #ffe9a8); box-shadow: 0 0 10px #ffe9a8; animation: cgxArrow 300ms ease-in both; }
@keyframes cgxArrow { from { transform: rotate(var(--rot)) translateX(-140px); opacity: 0; } 30% { opacity: 1; } to { transform: rotate(var(--rot)) translateX(30px); opacity: 0; } }
/* 번개 */
.cgx-bolt { left: 0; top: 0; transform: none; }
.cgx-bolt svg { position: fixed; inset: 0; overflow: visible; }
.cgx-bolt polyline { fill: none; stroke: #e0f2ff; stroke-width: 5; stroke-linejoin: round; filter: drop-shadow(0 0 8px #7cc4ff) drop-shadow(0 0 16px #7cc4ff); animation: cgxBolt 500ms steps(4) both; }
@keyframes cgxBolt { 0%, 40% { opacity: 1; } 20%, 60% { opacity: .2; } 100% { opacity: 0; } }
/* 조준경 */
.cgx-crosshair { width: 110px; height: 110px; border-radius: 50%; border: 3px solid #ff4f5e; box-shadow: 0 0 14px rgba(255, 79, 94, .8); animation: cgxScope 700ms ease-out both; }
.cgx-crosshair::before, .cgx-crosshair::after { content: ""; position: absolute; left: 50%; top: 50%; background: #ff4f5e; transform: translate(-50%, -50%); }
.cgx-crosshair::before { width: 140%; height: 2px; }
.cgx-crosshair::after { width: 2px; height: 140%; }
@keyframes cgxScope { 0% { transform: translate(-50%, -50%) scale(2.2) rotate(90deg); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.8); opacity: 0; } }
/* 송곳니 */
.cgx-fang { width: 70px; height: 50px; }
.cgx-fang i { position: absolute; top: 0; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 34px solid #fff; filter: drop-shadow(0 0 6px rgba(255, 60, 80, .9)); animation: cgxBite 600ms ease-in both; }
.cgx-fang i:first-child { left: 8px; }
.cgx-fang i:last-child { right: 8px; }
@keyframes cgxBite { 0% { transform: translateY(-40px); opacity: 0; } 40% { transform: translateY(8px); opacity: 1; } 70% { transform: translateY(0); } 100% { opacity: 0; } }
/* 방어막 / 거울 / 소용돌이 */
.cgx-bubble { width: 150px; height: 150px; border-radius: 50%; border: 3px solid var(--c); background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), color-mix(in srgb, var(--c) 25%, transparent) 60%); box-shadow: 0 0 24px var(--c); animation: cgxBubble 800ms cubic-bezier(.2, .9, .25, 1.3) both; }
@keyframes cgxBubble { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 35% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
.cgx-mirror { width: 90px; height: 130px; border-radius: 45%; background: linear-gradient(120deg, #cffafe, #67e8f9 40%, #fff 50%, #67e8f9 60%, #0891b2); box-shadow: 0 0 30px #22d3ee; animation: cgxMirror 700ms ease-out both; }
@keyframes cgxMirror { 0% { transform: translate(-50%, -50%) rotateY(90deg); opacity: 0; } 40% { transform: translate(-50%, -50%) rotateY(0); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; } }
.cgx-vortex { width: 160px; height: 160px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, #b26bff, transparent, #22d3ee, transparent); animation: cgxVortex 800ms ease-in both; }
@keyframes cgxVortex { 0% { transform: translate(-50%, -50%) scale(1.3) rotate(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(0) rotate(720deg); opacity: 0; } }
/* 기절 별 */
.cgx-orbit { width: 120px; height: 50px; animation: cgxOrbitFade 1.4s ease both; }
.cgx-orbit i { position: absolute; left: 50%; top: 50%; font-style: normal; font-size: 22px; animation: cgxOrbit 1.1s linear infinite; }
.cgx-orbit i:nth-child(2) { animation-delay: -.37s; }
.cgx-orbit i:nth-child(3) { animation-delay: -.74s; }
@keyframes cgxOrbit { from { transform: translate(-50%, -50%) rotate(0) translateX(50px) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg) translateX(50px) rotate(-360deg); } }
@keyframes cgxOrbitFade { 0% { opacity: 0; } 15%, 80% { opacity: 1; } 100% { opacity: 0; } }
/* 끌려오는 카드 (자석) */
.cgx-pull span { display: block; font-size: 30px; color: #c4b5fd; }
.cgx-pull { animation: cgxPull 800ms ease-in both; }
@keyframes cgxPull { to { left: var(--tx); top: var(--ty); opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(360deg); } }
/* 카드 던지기 */
.cgx-throw { animation: cgxThrow 600ms cubic-bezier(.3, .2, .3, 1) both; }
.cgx-throw .cg-card { width: 64px !important; height: 92px !important; box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 18px color-mix(in srgb, var(--tc) 70%, transparent) !important; }
@keyframes cgxThrow {
  0% { transform: translate(-50%, -50%) scale(.6) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  50% { transform: translate(calc(-50% + var(--dx) * .5), calc(-50% + var(--dy) * .5 + var(--arc))) scale(1.15) rotate(calc(var(--rot) * .5)); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.7) rotate(var(--rot)); opacity: 0; }
}
.cgx-flyemo span { display: block; font-size: 40px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.cgx-flyemo { animation: cgxFlyEmo 800ms cubic-bezier(.3, .2, .3, 1) both; }
@keyframes cgxFlyEmo { 0% { transform: translate(-50%, -50%) scale(.5); } 50% { transform: translate(calc(-50% + var(--dx) * .5), calc(-50% + var(--dy) * .5 - 80px)) scale(1.3) rotate(180deg); } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(360deg); opacity: .4; } }
/* 배너 (내 차례 등) */
.cgx-banner { position: fixed; left: 0 !important; right: 0; top: 34% !important; transform: none; display: flex; justify-content: center; }
.cgx-banner-in {
  padding: 12px 60px; font-family: "Arial Black", Impact, system-ui, sans-serif; font-size: 32px; letter-spacing: 3px; color: #2a1a00; white-space: nowrap;
  background: linear-gradient(90deg, transparent, #ffe08a 15%, #ffbe2e 85%, transparent);
  box-shadow: 0 10px 30px rgba(255, 190, 46, .35);
  animation: cgxBanner 1.4s cubic-bezier(.2, .9, .25, 1) both;
}
.cgx-banner.cgx-ult .cgx-banner-in { color: #fff; background: linear-gradient(90deg, transparent, #ff4f5e 15%, #b26bff 85%, transparent); }
@keyframes cgxBanner { 0% { transform: translateX(-120%) skewX(-20deg); opacity: 0; } 20% { transform: translateX(0) skewX(-8deg); opacity: 1; } 75% { transform: translateX(0) skewX(-8deg); opacity: 1; } 100% { transform: translateX(120%) skewX(-20deg); opacity: 0; } }
/* 컨페티 */
.cgx-confetti { position: fixed; inset: 0; transform: none; }
.cgx-confetti i { position: absolute; top: -20px; background: var(--c); border-radius: 2px; animation: cgxConf linear both; }
@keyframes cgxConf { from { transform: translateY(0) rotate(var(--r)); opacity: 1; } to { transform: translateY(105vh) rotate(calc(var(--r) + 720deg)); opacity: .8; } }
/* 화면 흔들림 */
.cgx-shake { animation: cgxShake 400ms cubic-bezier(.36, .07, .19, .97) both; }
@keyframes cgxShake {
  10%, 90% { transform: translate(calc(var(--shk) * -.3), 0); }
  20%, 80% { transform: translate(calc(var(--shk) * .5), calc(var(--shk) * .2)); }
  30%, 50%, 70% { transform: translate(calc(var(--shk) * -1), calc(var(--shk) * -.3)); }
  40%, 60% { transform: translate(var(--shk), calc(var(--shk) * .3)); }
}

/* ===================== 품질 업그레이드 ===================== */
/* 손패 3D 기울기 (JS가 --tx/--ty) + 마우스 따라가는 하이라이트 */
.cg-app .cg-hand .cg-card { --tx: 0; --ty: 0; }
@media (hover: hover) {
  .cg-app .cg-hand .cg-card:hover {
    transform: translateY(-26px) scale(1.12) perspective(500px) rotateX(calc(var(--ty) * -14deg)) rotateY(calc(var(--tx) * 16deg)) !important;
  }
  .cg-app .cg-hand .cg-card:hover::before {
    display: block; content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
    background: radial-gradient(circle at calc(50% + var(--tx) * 50%) calc(50% + var(--ty) * 50%), rgba(255, 255, 255, .32), transparent 55%);
  }
}
/* 희귀 카드: 그림 칸 홀로그램 무지개 */
.cg-card.cg-rare .cg-card-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; opacity: .35;
  background: linear-gradient(115deg, #ff4f5e, #ffcf4d, #34d399, #22d3ee, #b26bff, #ff4f5e);
  background-size: 300% 300%; animation: cgxHolo 4s linear infinite;
}
@keyframes cgxHolo { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
/* 현재 차례 판: 회전하는 무지개 테두리 */
@property --cgx-ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.cg-app .cg-player.current {
  border: 2px solid transparent !important;
  background: linear-gradient(165deg, rgba(48, 36, 82, .96), rgba(22, 16, 42, .97)) padding-box,
              conic-gradient(from var(--cgx-ang), #ffcf4d, #ff4f5e, #b26bff, #22d3ee, #ffcf4d) border-box !important;
  animation: cgxTurnRing 2.4s linear infinite;
}
@keyframes cgxTurnRing { to { --cgx-ang: 360deg; } }
/* 맞을 때 판 하얗게 번쩍 + 흔들 */
.cg-app .cg-player.cg-player-shake { animation: cgxHitFlash .35s ease-out; }
@keyframes cgxHitFlash { 0% { filter: brightness(2.2) saturate(0); transform: translateX(-6px); } 30% { transform: translateX(6px); } 60% { transform: translateX(-3px); filter: brightness(1.3); } 100% { filter: none; transform: none; } }
/* 데미지 숫자 크게 */
.cg-app .cg-dmg-pop { font-family: "Arial Black", Impact, system-ui, sans-serif !important; font-size: 38px !important; -webkit-text-stroke: 2px rgba(0, 0, 0, .65); paint-order: stroke fill; text-shadow: 0 0 18px currentColor !important; }
/* 배경 불씨 */
.cg-app::before {
  /* z-index 없이 맨 앞(::before) + 아래 자식들이 position만 가짐 → 불씨는 내용 뒤에, 쌓임 맥락은 안 만듦
     (예전처럼 자식에 z-index를 주면 그 안의 팝업(대상 선택 등)이 이펙트·메뉴 아래로 갇힘) */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background-image:
    radial-gradient(2px 2px at 10% 90%, rgba(255, 207, 77, .8), transparent),
    radial-gradient(2px 2px at 30% 70%, rgba(255, 79, 94, .7), transparent),
    radial-gradient(1.5px 1.5px at 55% 80%, rgba(178, 107, 255, .8), transparent),
    radial-gradient(2px 2px at 75% 60%, rgba(34, 211, 238, .7), transparent),
    radial-gradient(1.5px 1.5px at 90% 85%, rgba(255, 207, 77, .7), transparent);
  background-size: 300px 400px;
  animation: cgxEmbers 14s linear infinite;
  opacity: .7;
}
@keyframes cgxEmbers { from { background-position: 0 0; } to { background-position: 0 -400px; } }
.cg-app > * { position: relative; }
@media (prefers-reduced-motion: reduce) {
  .cg-app::before, .cg-app .cg-player.current, .cg-card.cg-rare .cg-card-art::after { animation: none !important; }
}
