/* =============================================================================
   PlayAwale — Le badge gagné, à la fin d'une partie (section 84)
   -----------------------------------------------------------------------------
   UNE SEULE LIGNE (21/10/2026 : « ça prend beaucoup trop de place, ça dépasse
   en hauteur ») : le ou les badges à gauche, leur nom au milieu, « +20 » et le
   cauris à droite. Environ 70 px de haut, autant sur un téléphone que sur un
   ordinateur. Le cadre est celui des Cauris gagnés (components/cauris.css) —
   sable doré, filet ambré —, le disque celui de « Mes badges ».
   Mise en scène : assets/js/game/badge-gain.js.
   ============================================================================= */

.badge-gain {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-sm);

  margin: 0 auto var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  max-width: 21rem;

  text-align: left;

  background: linear-gradient(180deg, rgba(255, 226, 160, 0.6), rgba(240, 225, 209, 0.55));
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px rgba(216, 164, 78, 0.55);

  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.badge-gain.is-in,
.badge-gain.is-done {
  opacity: 1;
  transform: none;
}

/* --- Le ou les disques ------------------------------------------------------- */
.badge-gain__discs {
  display: flex;
  flex: none;
}

.badge-gain__disc {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;

  width: 52px;
  height: 52px;
  padding: 2px;

  background: radial-gradient(circle at 35% 30%, var(--color-brand-amber-light, #ffe7b0),
              var(--color-brand-amber, #f4b860) 60%, var(--color-brand-amber-deep, #c98a2e));
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 2px var(--color-brand-amber-deep, #c98a2e), 0 3px 10px rgba(216, 164, 78, 0.45);

  opacity: 0;
  transform: scale(0.2) rotate(-25deg);
}

/* Plusieurs badges : les disques se chevauchent, comme une petite pile. */
.badge-gain__disc + .badge-gain__disc {
  margin-left: -14px;
}

.badge-gain__disc.is-pop {
  opacity: 1;
  transform: none;
  animation: badge-gain-pop 0.7s cubic-bezier(.2, 1.7, .4, 1);
}

/* Un éclat qui tourne derrière le disque, le temps de l'arrivée. */
.badge-gain__disc.is-pop::before {
  content: '';
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: var(--radius-full);
  background: repeating-conic-gradient(rgba(255, 214, 120, 0.6) 0 10deg, transparent 10deg 30deg);
  animation: badge-gain-rays 1.4s ease-out forwards;
}

.badge-gain__face {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
}

.badge-gain__picto {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--color-text);
}

.badge-gain__picto svg {
  width: 30px;
  height: 30px;
}

.badge-gain__stamp {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--color-verdict-best);
  background-color: var(--color-surface);
  border-radius: var(--radius-full);

  opacity: 0;
  transform: rotate(-14deg) scale(2.2);
}

.badge-gain__stamp svg {
  width: 20px;
  height: 20px;
}

.badge-gain__disc.is-stamped .badge-gain__stamp {
  opacity: 1;
  transform: rotate(-14deg);
  transition: opacity 0.12s ease, transform 0.25s cubic-bezier(.3, 1.6, .5, 1);
}

/* --- Le texte ------------------------------------------------------------------ */
.badge-gain__text {
  flex: 1 1 auto;
  min-width: 0;
}

.badge-gain__label {
  margin: 0;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-brand-amber-deep, var(--color-text-muted));
}

.badge-gain__name,
.badge-gain__goal {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.badge-gain.is-named .badge-gain__name,
.badge-gain.is-named .badge-gain__goal {
  opacity: 1;
}

/* Le nom, et ce qu'il récompense : deux lignes au plus chacun — le reste se lit
   au survol. */
.badge-gain__name {
  display: -webkit-box;
  margin: 1px 0 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.15;
  color: var(--color-text);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Plusieurs badges : leurs noms à la suite, un peu plus petits, trois lignes. */
.badge-gain--many .badge-gain__name {
  font-size: 0.86rem;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.badge-gain__goal {
  display: -webkit-box;
  margin: 1px 0 0;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--color-text-muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* --- Les graines qui retombent autour du badge -------------------------------- */
.badge-gain__seed {
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 6px;
  margin: -3px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1c9, #e9b04a 55%, #a86d1c);
  pointer-events: none;
  animation: badge-gain-seed 1.2s cubic-bezier(.2, .7, .4, 1) var(--delai, 0ms) both;
}

/* --- Le bonus de Cauris ---------------------------------------------------------- */
.badge-gain__bonus {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.2em;
  margin: 0;

  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.badge-gain__bonus.is-in {
  opacity: 1;
  transform: none;
}

.badge-gain__value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-online);
}

.badge-gain__value.is-landed {
  animation: badge-gain-land 0.45s cubic-bezier(.3, 1.6, .5, 1);
}

.badge-gain__shell {
  width: 1.7rem;
  height: 1.7rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(60, 39, 35, 0.3));
}

@keyframes badge-gain-pop {
  0%   { opacity: 0; transform: scale(0.2) rotate(-25deg); }
  60%  { opacity: 1; transform: scale(1.2) rotate(6deg); }
  100% { transform: none; }
}

@keyframes badge-gain-rays {
  0%   { opacity: 0; transform: scale(0.6) rotate(0deg); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.3) rotate(90deg); }
}

@keyframes badge-gain-seed {
  0%   { opacity: 1; transform: translate(0, 0); }
  45%  { opacity: 1; transform: translate(var(--dx), var(--dy)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + var(--chute))); }
}

@keyframes badge-gain-land {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* « Réduire les animations » : tout est posé d'un coup (badge-gain.js le sait
   aussi), et rien ne bouge. */
@media (prefers-reduced-motion: reduce) {
  .badge-gain,
  .badge-gain__disc,
  .badge-gain__stamp,
  .badge-gain__name,
  .badge-gain__goal,
  .badge-gain__bonus {
    transition: none;
    animation: none;
  }

  .badge-gain__disc::before {
    display: none;
  }
}
