/**
 * 로딩 오버레이 카드 + 카드 셔플 VFX (shuffle-vfx.js)
 * #loading-overlay 표시는 JS 인라인 display 로 제어
 */
/* 애니메이션 카드 초기 크기 고정 (깜빡임 방지) */
.shuffle-card,
.shuffle-card img {
  width: 50px !important;
  height: 74px !important;
  max-width: 50px;
  max-height: 74px;
}
body.m-mobile #loading-overlay .loading-container {
  max-width: 100%;
  box-sizing: border-box;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

body.m-mobile #loading-overlay .loading-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: min(280px, 80vw);
  margin-left: auto;
  margin-right: auto;
}
body.m-mobile #loading-overlay .loading-card--flower {
  overflow: visible;
  max-width: min(250px, 75vw);
}

body.m-mobile #loading-overlay .loading-card img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(50vh, 350px);
  margin: 0 auto;
  object-fit: contain;
}

body.m-mobile #loading-overlay .loading-card--flower img {
  max-height: min(45vh, 300px);
  object-fit: contain;
}

/* 예비: 영혼의 세 카드 / 카드 그리드 */
body.m-mobile .m-cards {
  width: 100%;
  max-width: 640px;
  margin: 1rem auto 0;
}

body.m-mobile .m-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

body.m-mobile .m-cards-grid__item {
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(182, 192, 255, 0.15);
}

body.m-mobile .m-cards-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== SHUFFLE CARD STYLES ===== */
body.m-mobile .shuffle-card {
  position: absolute;
  width: 44px;
  height: 66px;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  will-change: transform;
}

body.m-mobile .shuffle-card:hover {
  border-color: var(--color-gold-primary, #d4af37);
  box-shadow:
    0 4px 15px rgba(212, 175, 55, 0.6),
    inset 0 0 10px rgba(212, 175, 55, 0.3);
  transform: scale(1.1);
}

body.m-mobile .shuffle-card.selected {
  border: 3px solid var(--color-gold-primary, #d4af37);
  box-shadow:
    0 0 20px rgba(212, 175, 55, 0.8),
    inset 0 0 15px rgba(212, 175, 55, 0.4);
  animation: cardSelected 0.5s ease-out;
}

@keyframes cardSelected {
  0% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.15) rotate(5deg);
  }
  100% {
    transform: scale(1.1) rotate(0deg);
  }
}

body.m-mobile .cards-selection-info {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
  border: 2px solid var(--color-gold-primary, #d4af37);
  border-radius: 12px;
  padding: 20px 40px;
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
  text-align: center;
  animation: cardsSlideUp 0.5s ease-out;
}

body.m-mobile .cards-selection-info.complete {
  animation: pulseComplete 0.8s ease-in-out;
}

body.m-mobile .selection-counter {
  font-family: 'Noto Serif KR', serif;
  font-size: 16px;
  color: var(--color-silver-light, #f0f0f0);
  margin-bottom: 10px;
}

body.m-mobile .selection-message {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-style: italic;
  color: var(--color-gold-primary, #d4af37);
  text-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
  letter-spacing: 2px;
}

@keyframes cardsSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes pulseComplete {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.08);
  }
}

@media (max-width: 480px) {
  body.m-mobile .shuffle-card {
    width: 40px;
    height: 60px;
  }

  body.m-mobile .cards-selection-info {
    padding: 15px 30px;
    bottom: 20px;
  }

  body.m-mobile .selection-message {
    font-size: 16px;
  }
}
