/* ========================================
   Jeu de cartes - Styles
   ======================================== */

:root {
  --cards-bg: #FFFFFF;
  --cards-header-bg: #5542BC;
  --cards-header-text: #FFFFFF;
  --cards-text: #5542BC;
  --cards-btn-bg: #5542BC;
  --cards-btn-text: #FFFFFF;
  --cards-btn-hover: #4636A3;
  --cards-finished-bg: rgba(85, 66, 188, 0.06);
}

/* Page */
.cards-page {
  margin: 0;
  padding: 0;
  background: var(--cards-bg);
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.cards-container {
  width: min(500px, 100%);
  margin: 0 auto;
  padding: 32px 0 40px;
}

/* Progress */
.cards-progress {
  font-size: 13px;
  font-weight: 600;
  color: rgba(85, 66, 188, 0.5);
  text-align: center;
  margin-top: 8px;
}

/* Deck area */
.cards-deck-area {
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 400px;
  justify-content: center;
  position: relative;
}

/* Card zone: pile and flip overlap in the same space */
.cards-card-zone {
  position: relative;
  width: min(320px, 80%);
  aspect-ratio: 2.5 / 3.5;
}

/* Pile (stacked cards visual) */
.cards-pile {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow:
    2px 2px 0 rgba(85, 66, 188, 0.15),
    4px 4px 0 rgba(85, 66, 188, 0.12),
    6px 6px 0 rgba(85, 66, 188, 0.09),
    8px 8px 0 rgba(85, 66, 188, 0.06),
    10px 10px 0 rgba(85, 66, 188, 0.03);
  transition: box-shadow 0.3s ease;
}

.cards-pile--medium {
  box-shadow:
    2px 2px 0 rgba(85, 66, 188, 0.15),
    4px 4px 0 rgba(85, 66, 188, 0.10),
    6px 6px 0 rgba(85, 66, 188, 0.05);
}

.cards-pile--thin {
  box-shadow:
    2px 2px 0 rgba(85, 66, 188, 0.12),
    3px 3px 0 rgba(85, 66, 188, 0.06);
}

.cards-pile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* Flip container */
.cards-flip-container {
  perspective: 1000px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

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

.cards-flipped {
  transform: rotateY(180deg);
}

.cards-exiting {
  transition: transform 0.35s ease-in;
  transform: rotateY(180deg) translateX(-120%) scale(0.7);
}

.cards-flip-front,
.cards-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
}

.cards-flip-front img,
.cards-flip-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cards-flip-back {
  transform: rotateY(180deg);
}

/* Action button */
.cards-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
}

.cards-btn {
  display: inline-block;
  padding: 16px 36px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: var(--cards-btn-bg);
  color: var(--cards-btn-text);
  transition: background 0.2s ease, transform 0.15s ease;
}

.cards-btn:hover {
  background: var(--cards-btn-hover);
  transform: translateY(-1px);
}

.cards-btn:active {
  transform: translateY(0);
}

.cards-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Finished message */
.cards-finished {
  background: var(--cards-finished-bg);
  border-radius: 12px;
  padding: 32px;
  font-size: 18px;
  font-weight: 600;
  color: var(--cards-text);
  text-align: center;
  animation: cardsSlideUp 0.4s ease forwards;
}

@keyframes cardsSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .cards-header {
    padding: 20px;
  }

  .cards-title {
    font-size: 18px;
  }

  .cards-deck-area {
    padding: 0 16px;
    min-height: 300px;
  }

  .cards-actions {
    padding: 24px 16px;
  }

  .cards-btn {
    width: 100%;
  }
}
