.loot-box-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.loot-box-dialog {
  position: relative;
  isolation: isolate;
  width: min(920px, 96vw);
  border: 1px solid rgba(222, 184, 92, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(24, 23, 18, 0.98), rgba(7, 10, 9, 0.98)),
    #0b0d0b;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.loot-box-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 10, 9, 0.88), rgba(7, 10, 9, 0.18) 48%, rgba(7, 10, 9, 0.9)),
    linear-gradient(180deg, rgba(7, 10, 9, 0.22), rgba(7, 10, 9, 0.82)),
    url("../img/lootbox.webp") center / cover no-repeat;
  opacity: 0.34;
}

.loot-box-header,
.loot-box-result {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.loot-box-header {
  border-bottom: 1px solid rgba(222, 184, 92, 0.22);
}

.loot-box-header span {
  display: block;
  color: #d5ad55;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loot-box-header strong,
.loot-box-result strong {
  display: block;
  color: #d5ad55;
  font-size: 26px;
  line-height: 1.05;
}

.loot-box-header strong {
  font-family: "DonGraffiti", Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 400;
  line-height: .95;
  letter-spacing: 0;
}

.loot-box-result strong {
  font-family: inherit;
}

.loot-box-roller {
  position: relative;
  z-index: 1;
  height: 178px;
  margin: 22px;
  border: 1px solid rgba(222, 184, 92, 0.35);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.92), rgba(30, 25, 16, 0.86), rgba(0, 0, 0, 0.92)),
    #050706;
}

.loot-box-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, #f0c76c 18%, #f0c76c 82%, transparent);
  box-shadow: 0 0 16px rgba(240, 199, 108, 0.85);
}

.loot-box-track {
  display: flex;
  gap: 10px;
  height: 100%;
  align-items: center;
  padding: 16px;
  will-change: transform;
}

.loot-box-track.is-rolling {
  transition: transform 4.6s cubic-bezier(0.08, 0.82, 0.16, 1);
}

.loot-box-card {
  flex: 0 0 126px;
  height: 136px;
  border: 1px solid rgba(170, 150, 95, 0.34);
  border-radius: 6px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), transparent 54%), rgba(5, 7, 6, 0.92);
  display: grid;
  grid-template-rows: 82px 1fr;
  align-items: center;
  justify-items: center;
  padding: 10px 8px;
  color: #e9dfbf;
  text-align: center;
  overflow: hidden;
}

.loot-box-card img {
  max-width: 82px;
  max-height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55));
}

.loot-box-card span {
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.loot-box-card[data-rarity="common"] {
  border-color: rgba(170, 150, 95, 0.45);
}

.loot-box-card[data-rarity="rare"] {
  border-color: rgba(60, 156, 255, 0.7);
  box-shadow: inset 0 0 18px rgba(60, 156, 255, 0.12);
}

.loot-box-card[data-rarity="epic"] {
  border-color: rgba(174, 93, 255, 0.76);
  box-shadow: inset 0 0 18px rgba(174, 93, 255, 0.14);
}

.loot-box-card[data-rarity="legendary"] {
  border-color: rgba(255, 194, 66, 0.9);
  box-shadow: inset 0 0 22px rgba(255, 194, 66, 0.18), 0 0 20px rgba(255, 194, 66, 0.15);
}

.loot-box-card.is-winner {
  transform: translateY(-4px);
  box-shadow: 0 0 28px rgba(255, 215, 126, 0.32), inset 0 0 24px rgba(255, 215, 126, 0.16);
}

.loot-box-result {
  border-top: 1px solid rgba(222, 184, 92, 0.22);
  background: rgba(222, 184, 92, 0.07);
}

.loot-box-result p {
  margin: 4px 0 0;
  color: #d5c9a6;
  font-weight: 700;
}

.loot-box-result[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .loot-box-dialog {
    width: 100%;
  }

  .loot-box-roller {
    margin: 14px;
  }

  .loot-box-card {
    flex-basis: 108px;
  }
}
