/* ==========================================================================
   Jeu Métamorphose
   ========================================================================== */

.metamorph-card::after {
  display: grid;
  place-items: center;
  color: var(--game-dark-deep);
  font-size: 31px;
  font-weight: 900;
}

.metamorph-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(68px, 0.7fr);
  align-items: center;
}

.metamorph-hud span,
.metamorph-status {
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 12px;
  text-align: center;
}

/* Placée ici (et non dans son fichier) pour conserver l'ordre de priorité. */
.arcade-hud span,
.metamorph-hud span,
.seek-toolbar span {
  min-height: 31px;
  padding: 7px 8px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: #6d7f42;
  box-shadow: none;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

/* Placée ici (et non dans son fichier) pour conserver l'ordre de priorité. */
.puzzle-status,
.arcade-status,
.metamorph-status,
.seek-status,
.photo-mask-status {
  display: block;
  min-height: 0;
  margin: 9px 10px 9px;
  padding: 0;
  border: 0;
  color: #687b42;
  -webkit-text-fill-color: #687b42;
  background: transparent;
  box-shadow: none;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  text-align: left;
}

.metamorph-canvas {
  max-width: none;
  height: auto;
  background: #6d7f42;
  touch-action: none;
}

.metamorph-start,
.metamorph-swim {
  touch-action: manipulation;
}

.metamorph-start:active,
.metamorph-swim:active {
  transform: translateY(2px);
}

#metamorphLives {
  width: fit-content;
  min-width: 68px;
  justify-self: center;
  padding: 3px 2px;
  border: 2px solid rgba(231, 53, 47, 0.4);
  color: #e7352f;
  -webkit-text-fill-color: #e7352f;
  background: rgba(27, 55, 48, 0.92);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(231, 53, 47, 0.36);
}

.metamorph-play .metamorph-start {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 126px;
  height: 155px;
  min-height: 155px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: url("../assets/images/jouer.png") center / contain no-repeat;
  box-shadow: none;
  font-size: 0;
  font-weight: 1000;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
}

.metamorph-hud span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.metamorph-play {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.metamorph-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 0;
  margin: 0 8px 4px;
  padding: 8px 0 4px;
}

.metamorph-start {
  justify-self: auto;
  letter-spacing: -0.02em;
  opacity: 1;
  transition: opacity 0.18s ease, transform 0.14s ease;
  pointer-events: auto;
}

.metamorph-start.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.metamorph-swim {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(92%, 248px);
  min-height: 64px;
  padding: 0 22px;
  border-radius: 999px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: #2f7ecb;
  box-shadow: 0 8px 14px rgba(29, 59, 61, 0.22);
  font-size: 18px;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  touch-action: none;
  -webkit-user-select: none;
}

.metamorph-card {
  margin-bottom: 35px;
  padding-bottom: 30px;
}

.metamorph-play .metamorph-start:active {
  box-shadow: none;
  transform: translate(-50%, -50%) scale(0.96);
}

.metamorph-play .metamorph-start.is-hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  pointer-events: none;
}

.metamorph-bravo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: min(94%, 330px);
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 7px 10px rgba(20, 45, 40, 0.24));
  transform: translate(-50%, -230%) scaleX(0.82) scaleY(1.14);
  transform-origin: 50% 78%;
  pointer-events: none;
}

.metamorph-bravo.show {
  animation: metamorphBravoDrop 2.35s cubic-bezier(0.2, 0.9, 0.18, 1) forwards;
}

.metamorph-status {
  margin: 16px 12px 18px;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.metamorph-status.is-fun-fact {
  max-width: 320px;
  margin: 16px auto 18px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.metamorph-play .metamorph-start.is-replay {
  top: auto;
  right: 56px;
  bottom: 20px;
  left: auto;
  width: 78px;
  height: 90px;
  min-height: 90px;
  background-image: url("../assets/images/rejouer.png");
  transform: none;
}

.metamorph-play .metamorph-start.is-replay:active {
  transform: scale(0.94);
}

.metamorph-play .metamorph-start.is-replay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 380px) {
  .metamorph-actions {
    gap: 48px;
  }
}

@keyframes metamorphBravoDrop {
  0% {
    opacity: 0;
    transform: translate(-50%, -230%) scaleX(0.82) scaleY(1.14);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -118%) scaleX(0.9) scaleY(1.08);
  }
  42% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1.24) scaleY(0.78);
  }
  56% {
    opacity: 1;
    transform: translate(-50%, -73%) scaleX(0.86) scaleY(1.1);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1.1) scaleY(0.9);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -56%) scaleX(0.98) scaleY(1.02);
  }
  92% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1) scaleY(1);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1) scaleY(1);
  }
}
