.card {
  position: relative;
  perspective: 1200px;
  cursor: pointer;
  min-height: 400px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.card-face {
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  opacity: 0;
  pointer-events: none;
}

/* Abierta */
.card.open .card-inner {
  transform: rotateY(180deg);
}

.card.open .card-back {
  opacity: 1;
  pointer-events: auto;
}

.card.open .card-front {
  opacity: 0;
  pointer-events: none;
}

/* Naipe */
.card.throwing {
  animation: throw-card 0.7s ease forwards;
}

.card.throwing.close {
  animation: throw-card-close 0.7s ease forwards;
}

@keyframes throw-card {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); }
  40%  { transform: translate(120px,-60px) rotate(25deg) scale(1.05); }
  70%  { transform: translate(-40px,20px) rotate(-15deg) scale(0.95); }
  100% { transform: translate(0,0) rotate(0deg) scale(1); }
}

@keyframes throw-card-close {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); }
  40%  { transform: translate(-120px,-60px) rotate(-25deg) scale(1.05); }
  70%  { transform: translate(40px,20px) rotate(15deg) scale(0.95); }
  100% { transform: translate(0,0) rotate(0deg) scale(1); }
}
