/* The big-win moment (public/fx-bigwin.js): the page dims, the won skin stands out as a card with a gold frame and a
   glow in its rarity colour, with its drop chance; an ember burst, rising embers, a quick release.
   One overlay over the whole page; only opacity and transform move. */

.bigwin {
  --bigwin-gold: #ffd56a;
  position: fixed;
  inset: 0;
  z-index: 200;
  cursor: pointer;
  /* The page dims around the result; the light stays where the win is */
  background: radial-gradient(circle at var(--bigwin-x) var(--bigwin-y), rgba(10, 8, 6, 0.15) 0, rgba(10, 8, 6, 0.55) 260px, rgba(8, 6, 5, 0.78) 70%);
  animation: bigwin-in 0.35s ease-out both;
}

.bigwin.is-leaving {
  animation: bigwin-out 0.38s ease-in forwards;
}

@keyframes bigwin-in {
  from { opacity: 0; }
}

@keyframes bigwin-out {
  to { opacity: 0; }
}

/* The won skin: gold frame, glow in its rarity colour */
.bigwin-card {
  --bigwin-rarity: var(--bigwin-gold);
  position: absolute;
  top: var(--bigwin-y);
  left: var(--bigwin-x);
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 260px;
  padding: 18px 18px 16px;
  border: 2px solid var(--bigwin-gold);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1d1712, color-mix(in srgb, var(--bigwin-rarity) 22%, #14100c));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 46px 6px color-mix(in srgb, var(--bigwin-rarity) 75%, transparent),
    inset 0 0 26px color-mix(in srgb, var(--bigwin-rarity) 30%, transparent);
  transform: translate(-50%, -50%);
  animation: bigwin-card-in 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) 0.08s both;
}

@keyframes bigwin-card-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
}

.bigwin-card-image {
  width: 210px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--bigwin-rarity) 70%, transparent));
}

.bigwin-card-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--white-hot);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bigwin-card-price {
  color: var(--ember-light);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bigwin-card-caption {
  margin-top: 2px;
  padding: 3px 12px;
  border-radius: var(--radius-inner);
  background: rgba(255, 213, 106, 0.14);
  color: var(--bigwin-gold);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.bigwin-huge .bigwin-card {
  width: 290px;
}

.bigwin-sparks {
  position: absolute;
  top: var(--bigwin-y);
  left: var(--bigwin-x);
}

.bigwin-spark,
.bigwin-ember {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
}

.bigwin-spark {
  width: 5px;
  height: 5px;
  background: #ffe39a;
  box-shadow: 0 0 8px 2px rgba(255, 170, 60, 0.9);
}

.bigwin-spark-cool {
  background: #ffa04a;
  box-shadow: 0 0 8px 2px rgba(230, 90, 30, 0.85);
}

.bigwin-ember {
  width: 3px;
  height: 3px;
  background: #ffb347;
  box-shadow: 0 0 6px 1px rgba(255, 140, 40, 0.8);
}

/* Huge wins only: a white-hot flash from the result */
.bigwin-flash {
  position: absolute;
  top: var(--bigwin-y);
  left: var(--bigwin-x);
  width: 900px;
  height: 900px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 250, 235, 0.95), rgba(255, 210, 140, 0.5) 30%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: bigwin-flash 0.7s ease-out both;
  pointer-events: none;
}

@keyframes bigwin-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* Less motion: the moment only fades in and out */
@media (prefers-reduced-motion: reduce) {
  .bigwin,
  .bigwin-card {
    animation: bigwin-in 0.2s ease-out both;
  }

  .bigwin.is-leaving {
    animation: bigwin-out 0.2s ease-in forwards;
  }
}
