/* ── Playing Card Shared Styles ── */

.playing-card {
  position: relative;
  width: clamp(55px, 9vw, 90px);
  aspect-ratio: 5 / 7;
  perspective: 600px;
  cursor: default;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Flip states */
.playing-card.face-down .card-inner {
  transform: rotateY(180deg);
}
.playing-card.face-up .card-inner {
  transform: rotateY(0deg);
}

/* Card faces (front + back) */
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}

.card-front {
  background: #fff;
  border: 1px solid #d0d0d0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-back {
  background: #1a5c2a;
  border: 1px solid #145222;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: rotateY(180deg);
}

.card-back-pattern {
  position: absolute;
  inset: 4px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 4px,
      rgba(255, 255, 255, 0.06) 4px,
      rgba(255, 255, 255, 0.06) 8px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 4px,
      rgba(255, 255, 255, 0.06) 4px,
      rgba(255, 255, 255, 0.06) 8px
    );
}

/* ── Corners ── */
.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 0;
}

.card-corner-tl {
  top: 4px;
  left: 5px;
}

.card-corner-br {
  bottom: 4px;
  right: 5px;
  transform: rotate(180deg);
}

.card-rank {
  font-size: clamp(10px, 1.6vw, 16px);
  font-weight: 700;
  font-family: 'Georgia', serif;
}

.card-suit-small {
  font-size: clamp(8px, 1.2vw, 13px);
  line-height: 1;
}

/* ── Suit Colors ── */
.suit-hearts .card-front,
.suit-diamonds .card-front {
  color: #c0392b;
}

.suit-clubs .card-front,
.suit-spades .card-front {
  color: #1a1a2e;
}

/* ── Center Content ── */
.card-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.card-suit-ace {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.card-face-symbol {
  font-size: clamp(18px, 3vw, 30px);
  line-height: 1;
  opacity: 0.7;
}

.card-suit-large {
  font-size: clamp(14px, 2.2vw, 22px);
  line-height: 1;
}

/* ── Pip layouts ── */
.card-pips {
  display: grid;
  gap: 1px;
  font-size: clamp(10px, 1.6vw, 16px);
  line-height: 1;
}

.card-pip {
  text-align: center;
}

.pips-2, .pips-3 { grid-template-columns: 1fr; }
.pips-4, .pips-6, .pips-8, .pips-10 { grid-template-columns: 1fr 1fr; }
.pips-5, .pips-7, .pips-9 { grid-template-columns: 1fr 1fr; }

.pips-5 .card-pip:last-child,
.pips-7 .card-pip:last-child,
.pips-9 .card-pip:last-child {
  grid-column: 1 / -1;
}

/* ── Deal Animation ── */
@keyframes card-deal {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-dealing {
  animation: card-deal 0.3s ease-out forwards;
}

/* ── Slide Animation ── */
@keyframes card-slide-in {
  from {
    transform: translateX(-60px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.card-slide {
  animation: card-slide-in 0.25s ease-out;
}

/* ── Highlight (valid drop target) ── */
.card-highlight {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ── Dragging state ── */
.card-dragging {
  z-index: 1000 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3) !important;
  cursor: grabbing !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .playing-card {
    width: clamp(42px, 12vw, 70px);
  }

  .card-corner-tl { top: 2px; left: 3px; }
  .card-corner-br { bottom: 2px; right: 3px; }
  .card-back-pattern { inset: 3px; }
}

@media (max-width: 480px) {
  .playing-card {
    width: clamp(36px, 13vw, 55px);
  }
  .card-rank { font-size: 9px; }
  .card-suit-small { font-size: 7px; }
}
