/* ── Deck area layout ── */
#deck-area {
  grid-area: deck;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ── Card stack container (the clickable deck) ── */
#card-stack-container {
  position: relative;
  width: 78px;
  height: 112px;
  cursor: pointer;
  perspective: 500px;
}

#card-stack-container.disabled {
  cursor: default;
  pointer-events: none;
}

#card-stack-container.pulse {
  animation: deck-pulse 1.1s ease-in-out infinite;
}

@keyframes deck-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.07); filter: brightness(1.15); }
}

/* Stack depth layers */
.stack-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(135deg, #ff6ec7, #9c27b0, #2196f3, #4caf50);
  border: 2.5px solid rgba(255,255,255,0.55);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.stack-b1 { top: 0;   left: 0;   z-index: 1; }
.stack-b2 { top: 3px; left: 3px; z-index: 0; opacity: 0.65; }
.stack-b3 { top: 6px; left: 6px; z-index: -1; opacity: 0.38; }

/* ── Active (flippable) card ── */
#active-card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.44s ease-in-out;
  z-index: 2;
  border-radius: 11px;
}

#active-card.flipped {
  transform: rotateY(180deg);
}

/* Both faces share .card-face */
.card-face {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 2.5px solid rgba(255,255,255,0.6);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

/* Back face */
.back-face {
  background: linear-gradient(135deg, #ff6ec7, #9c27b0, #2196f3);
}

.back-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-back-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ff6ec7, #9c27b0, #2196f3, #4caf50, #ffeb3b, #ff9800);
}

/* Front face */
.front-face {
  transform: rotateY(180deg);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}

.front-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
}

/* Color swatch on front face */
.card-color-swatch {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  border: 3px solid rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
  flex-shrink: 0;
}

/* Double card swatch offset shadow */
.card-color-swatch.double::after {
  content: '';
  position: absolute;
  top: 7px;
  left: 7px;
  right: -7px;
  bottom: -7px;
  border-radius: 10px;
  border: 3px solid rgba(0,0,0,0.12);
  background: inherit;
  z-index: -1;
}

/* Label below swatch */
.card-drawn-label {
  font-size: 11px;
  font-family: 'Bubblegum Sans', cursive;
  color: #333;
  text-align: center;
  line-height: 1.25;
  max-width: 90px;
}

/* Deck count label */
#deck-count {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-family: 'Bubblegum Sans', cursive;
  text-align: center;
}

/* Reshuffle flash */
@keyframes reshuffle-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}
.reshuffling {
  animation: reshuffle-flash 0.3s ease-in-out 3;
}
