/* CS:GO-style unbox overlay */
.unbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unbox-overlay.hidden {
  display: none;
}

body.unbox-active {
  overflow: hidden;
}

.unbox-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.92);
}

.unbox-overlay-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: 92vh;
  overflow: auto;
}

.unbox-overlay-body {
  padding: 1.5rem 1rem 2rem;
}

.unbox-reel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.unbox-reel-status {
  text-align: center;
  font-size: 0.82rem;
  max-width: 100%;
  margin: 0;
  line-height: 1.35;
}

.unbox-reel-skip-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 0.25rem;
}

.unbox-skip-btn {
  position: static;
  min-width: 5.5rem;
}

.case-open-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.case-open-all-btn {
  font-size: 0.85rem;
}

/* Reel */
.unbox-multi-reel-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 0.25rem 0;
}

.unbox-reel-row {
  width: 100%;
  opacity: 0.72;
  transform: scale(0.94);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.unbox-reel-row-middle {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

.unbox-reel-row-above,
.unbox-reel-row-below {
  filter: saturate(0.85);
}

.unbox-reel-stage {
  position: relative;
  padding: 1.5rem 0 2rem;
  width: 100%;
}

.unbox-reel-stage-compact {
  padding: 0.65rem 0 0.85rem;
}

.unbox-reel-stage-compact .unbox-reel-marker {
  top: 0.35rem;
  bottom: 0.35rem;
}

.unbox-reel-stage-compact .unbox-reel-item-img {
  height: 58px;
}

.unbox-reel-stage-compact .unbox-reel-item-img img {
  max-height: 54px;
}

.unbox-reel-item-compact {
  flex: 0 0 118px;
}

.unbox-reel-marker {
  position: absolute;
  left: 50%;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, #58a6ff 20%, #58a6ff 80%, transparent);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.65);
  z-index: 2;
  pointer-events: none;
}

.unbox-reel-viewport {
  overflow: hidden;
  margin: 0 auto;
  max-width: 100%;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.unbox-reel-strip {
  display: flex;
  gap: 10px;
  will-change: transform;
  padding: 0.5rem 0;
}

.unbox-reel-item {
  flex: 0 0 152px;
  border: 2px solid #8b949e;
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.95);
  padding: 0.45rem;
  text-align: center;
}

.unbox-reel-item-img {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unbox-reel-item-img img {
  max-height: 84px;
  max-width: 100%;
  object-fit: contain;
}

.unbox-reel-placeholder {
  font-size: 2rem;
  color: #ffd700;
}

.unbox-reel-item-name,
.unbox-reel-item-skin {
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unbox-reel-item-skin {
  color: var(--muted, #8b949e);
}

.unbox-reel-stage.unbox-reel-landed .unbox-reel-item:nth-child(n) {
  opacity: 0.45;
}

/* Single reveal */
.unbox-single-reveal {
  text-align: center;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid var(--reveal-color, #8b949e);
  background: rgba(22, 27, 34, 0.9);
}

.unbox-single-reveal.unbox-shake {
  animation: unbox-shake 0.45s ease-out;
}

@keyframes unbox-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.unbox-glow {
  filter: drop-shadow(0 0 18px var(--reveal-color, #58a6ff));
}

/* Multi results */
.unbox-multi-wrap {
  max-width: 880px;
  margin: 0 auto;
}

.unbox-multi-header {
  text-align: center;
  margin-bottom: 1rem;
}

.unbox-multi-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.unbox-multi-sort-note {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}

.unbox-multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.25rem;
  margin-bottom: 1rem;
}

.unbox-multi-card {
  border: 2px solid #8b949e;
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.92);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.unbox-multi-img {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unbox-multi-img img {
  max-height: 68px;
  max-width: 100%;
  object-fit: contain;
}

.unbox-multi-name {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.unbox-multi-wear {
  font-size: 0.65rem;
}

.unbox-multi-sell {
  font-size: 0.68rem;
  padding: 0.2rem 0.35rem;
  margin-top: auto;
}

.unbox-multi-sell.sold {
  opacity: 0.55;
}

.unbox-reveal-stickers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.65rem 0 0.25rem;
  max-width: 280px;
}

.unbox-reveal-sticker img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 2px;
}

.unbox-reveal-sticker-fallback {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  color: var(--muted);
}

.unbox-reveal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 320px;
}

.unbox-reveal-actions .case-open-btn {
  flex: 1 1 140px;
  min-width: 120px;
}

.unbox-reveal-sell,
.unbox-reveal-equip {
  flex: 0 1 auto;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
}

.unbox-reveal-sell.sold,
.unbox-reveal-equip.equipped {
  opacity: 0.55;
}

.unbox-multi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.unbox-multi-sell,
.unbox-multi-equip {
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
}

.unbox-multi-equip.equipped {
  opacity: 0.55;
}
