/* =========================
   Mise en page générale
   ========================= */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;

  background-color: #001133;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Arial, sans-serif;

  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;

  /* Évite le rebond/scroll du navigateur pendant un swipe */
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;

  box-sizing: border-box;

  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}


/* =========================
   Zone de la pioche
   ========================= */

.container {
  width: 100vw;
  height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  overflow: hidden;

  /* IMPORTANT sur smartphone */
  touch-action: none;
  overscroll-behavior: none;
}

.deck {
  position: relative;

  height: 55vh;
  max-height: 82vh;

  aspect-ratio: 63 / 88;

  display: flex;
  justify-content: center;
  align-items: center;

  touch-action: none;
}


/* =========================
   Cartes
   ========================= */

.card {
  position: absolute;
  inset: 0;

  box-sizing: border-box;

  border-radius: 20px;
  overflow: hidden;

  background: white;
  padding: 2.5%;

  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);

  will-change: transform, opacity;

  -webkit-user-drag: none;
  user-drag: none;

  touch-action: none;
}

.card img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;
  border-radius: 12px;
  margin: 0;

  pointer-events: none;

  -webkit-user-drag: none;
  user-drag: none;
}


/* Carte manipulable */
.card-top {
  z-index: 2;
  cursor: grab;

  transform: translate3d(0, 0, 0) rotate(0deg);

  /* Très important sur mobile */
  touch-action: none;
}

.card-top.dragging {
  cursor: grabbing;

  /* Aucun délai/transition pendant que le doigt bouge */
  transition: none !important;
}


/* Carte qui attend dessous */
.card-next {
  z-index: 1;

  transform: translate3d(0, 8px, 0) scale(0.97);
  opacity: 0.94;

  pointer-events: none;
}


/* Animation uniquement lorsque le doigt est relâché */
.card.animating {
  transition:
    transform 240ms cubic-bezier(.18, .78, .22, 1),
    opacity 240ms ease;
}


/* =========================
   Chargement
   ========================= */

.loading {
  position: absolute;
  z-index: 5;

  color: #ccd6ff;
  font-size: clamp(15px, 2.5vmin, 22px);

  text-align: center;
  pointer-events: none;
}


/* =========================
   Sélection
   ========================= */

::selection {
  background: transparent;
}

::-moz-selection {
  background: transparent;
}
