/* 인디언 포커 — 가족 카드 컴포넌트 (발라트로 무드, 2026-07) */
/* 홀로그램 포일 + 3D 틸트 + 캐릭터 아트. poker-cards.js와 세트. */

.pcard {
  --pc-theme: #e8b54a;
  --pc-rx: 0deg;
  --pc-ry: 0deg;
  --pc-mx: 50%;
  --pc-my: 50%;
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 12px;
  background: linear-gradient(160deg, #221a3e 0%, #120d24 55%, #0a0716 100%);
  border: 2px solid color-mix(in srgb, var(--pc-theme) 55%, #1a1430);
  box-shadow:
    0 5px 14px rgba(10, 5, 30, 0.45),
    0 0 16px color-mix(in srgb, var(--pc-theme) 28%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transform: perspective(650px) rotateX(var(--pc-rx)) rotateY(var(--pc-ry));
  transition: transform 0.18s ease-out, box-shadow 0.25s ease;
  isolation: isolate;
}
.pcard--tilt {
  transition: transform 0.05s linear;
  box-shadow:
    0 10px 24px rgba(10, 5, 30, 0.5),
    0 0 26px color-mix(in srgb, var(--pc-theme) 45%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  z-index: 5;
}

/* 크기 프리셋 */
.pcard--lg { width: 180px; }
.pcard--md { width: 116px; }
.pcard--sm { width: 100%; max-width: 92px; }

/* ── 아트 영역 ── */
.pcard-art {
  position: absolute;
  inset: 0 0 24% 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pcard-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.pcard-art-emoji {
  font-size: 3.2rem;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--pc-theme) 70%, transparent));
}
.pcard--md .pcard-art-emoji { font-size: 2.4rem; }
.pcard--sm .pcard-art-emoji { font-size: 1.9rem; }

/* 아트 하단을 플레이트로 자연스럽게 잇는 비네트 */
.pcard-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 30%, transparent 55%, rgba(8, 5, 20, 0.5) 100%),
    linear-gradient(to bottom, transparent 58%, rgba(8, 5, 20, 0.85) 82%);
  pointer-events: none;
}

/* ── 랭크 뱃지 — 다크 칩 + 테마 글로우 (2026-07 가시성 강화) ── */
.pcard-rank {
  position: absolute;
  z-index: 3;
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1;
  padding: 3px 6px 4px;
  min-width: 1.55em;
  text-align: center;
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(16, 11, 36, 0.88), rgba(8, 5, 20, 0.82));
  border: 1.5px solid color-mix(in srgb, var(--pc-theme) 80%, #fff);
  color: color-mix(in srgb, var(--pc-theme) 32%, #fff);
  text-shadow:
    0 0 7px color-mix(in srgb, var(--pc-theme) 95%, transparent),
    0 0 2px rgba(255, 255, 255, 0.6);
  box-shadow:
    0 0 9px color-mix(in srgb, var(--pc-theme) 45%, transparent),
    0 1px 3px rgba(0, 0, 0, 0.55);
}
.pcard-rank--tr { top: 6px; right: 6px; }
.pcard--sm .pcard-rank { font-size: 0.92rem; padding: 2px 4px 3px; border-radius: 6px; border-width: 1px; }
.pcard--sm .pcard-rank--tr { top: 4px; right: 4px; }
.pcard--lg .pcard-rank { font-size: 1.45rem; }

/* ── 이름 플레이트 ── */
.pcard-plate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 4px 6px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
}
.pcard-name {
  font-weight: 900;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px color-mix(in srgb, var(--pc-theme) 80%, transparent), 0 1px 2px rgba(0, 0, 0, 0.9);
}
.pcard-title {
  font-weight: 700;
  font-size: 0.58rem;
  color: color-mix(in srgb, var(--pc-theme) 75%, #fff);
  letter-spacing: 0.06em;
  opacity: 0.95;
}
.pcard--sm .pcard-name { font-size: 0.68rem; }
.pcard--sm .pcard-title { display: none; }
.pcard--lg .pcard-name { font-size: 1.05rem; }
.pcard--lg .pcard-title { font-size: 0.68rem; }

/* ── 홀로그램 포일 ── */
.pcard-foil {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle at var(--pc-mx) var(--pc-my),
      rgba(255, 255, 255, 0.22) 0%, transparent 42%),
    linear-gradient(115deg,
      transparent 18%,
      rgba(140, 230, 255, 0.14) 34%,
      rgba(255, 255, 255, 0.22) 45%,
      rgba(255, 160, 255, 0.14) 56%,
      rgba(255, 230, 140, 0.12) 66%,
      transparent 82%);
  background-size: 100% 100%, 240% 240%;
  mix-blend-mode: overlay;
  animation: pcardFoilSweep 5.5s ease-in-out infinite;
}
@keyframes pcardFoilSweep {
  0%, 100% { background-position: 0 0, 15% 0; }
  50% { background-position: 0 0, 85% 100%; }
}
/* 틸트 중엔 커서 추적 하이라이트가 주인공 — 스윕은 멈춤 */
.pcard--tilt .pcard-foil { animation-play-state: paused; }

/* ── 카드 뒷면 ── */
.pcard--back {
  background: linear-gradient(160deg, #3d4426 0%, #262b15 60%, #171a0c 100%);
  border-color: rgba(232, 181, 74, 0.55);
}
.pcard-back-pattern {
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(232, 181, 74, 0.35);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 9px, rgba(232, 181, 74, 0.08) 9px 10px),
    repeating-linear-gradient(-45deg,
      transparent 0 9px, rgba(232, 181, 74, 0.08) 9px 10px);
}
.pcard-back-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 2;
}
.pcard-back-gecko {
  font-size: 2.1rem;
  filter: drop-shadow(0 0 10px rgba(232, 181, 74, 0.6));
}
.pcard-back-q {
  font-size: 1.6rem;
  font-weight: 900;
  color: #e8b54a;
  text-shadow: 0 0 12px rgba(232, 181, 74, 0.8);
}

/* ── 상태 변형 ── */
.pcard--winner {
  border-color: #ffd76a;
  box-shadow:
    0 5px 14px rgba(10, 5, 30, 0.45),
    0 0 22px rgba(255, 215, 106, 0.75),
    inset 0 0 0 1px rgba(255, 235, 170, 0.35);
  animation: pcardWinner 1.6s ease-in-out infinite;
}
@keyframes pcardWinner {
  0%, 100% { box-shadow: 0 5px 14px rgba(10,5,30,.45), 0 0 16px rgba(255,215,106,.55), inset 0 0 0 1px rgba(255,235,170,.3); }
  50% { box-shadow: 0 5px 14px rgba(10,5,30,.45), 0 0 30px rgba(255,215,106,.95), inset 0 0 0 1px rgba(255,235,170,.5); }
}
.pcard--fold {
  filter: grayscale(0.85) brightness(0.75);
}
.pcard--fold .pcard-foil { display: none; }

/* 공개 플립 */
.pcard--flip {
  animation: pcardFlipIn 0.65s cubic-bezier(0.2, 0.8, 0.25, 1.1);
}
@keyframes pcardFlipIn {
  0% { transform: perspective(650px) rotateY(90deg) scale(0.88); }
  100% { transform: perspective(650px) rotateY(0deg) scale(1); }
}

/* ── 도감 ── */
.card-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.gallery-caption {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-text-secondary, #888);
  white-space: nowrap;
}

/* color-mix 미지원 구형 브라우저 폴백 */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .pcard { border-color: var(--pc-theme); }
  .pcard-title { color: var(--pc-theme); }
}
