/* ============================================
   CASE ROULETTE — CS:GO style horizontal strip
   ============================================ */

.case-roulette-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.case-roulette-container.case-roulette-active {
  display: flex;
}

/* Overlay */
.case-roulette-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: cr-fadeIn 0.3s ease-out;
}

/* Main content card */
.case-roulette-content {
  position: relative;
  z-index: 1;
  width: 94%;
  max-width: 520px;
  background: linear-gradient(160deg, #12122a 0%, #1a1035 40%, #0d0d1f 100%);
  border-radius: 24px;
  padding: 0;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 215, 0, 0.15),
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 0 120px rgba(100, 60, 255, 0.1);
  animation: cr-cardIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Title */
.case-roulette-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  padding: 24px 20px 18px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.06) 0%, transparent 100%);
}

/* ===== ROULETTE WHEEL (the strip container) ===== */
.case-roulette-wheel {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0.4) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Edge fade gradients (hides strip edges) */
.case-roulette-wheel::before,
.case-roulette-wheel::after {
  content: '';
  position: absolute;
  top: 0;
  width: 25%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.case-roulette-wheel::before {
  left: 0;
  background: linear-gradient(90deg, #12122a 0%, transparent 100%);
}

.case-roulette-wheel::after {
  right: 0;
  background: linear-gradient(-90deg, #12122a 0%, transparent 100%);
}

/* Center indicator — triangle arrows */
.case-roulette-center {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Top triangle */
.case-roulette-center::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #ffd700;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.6));
}

/* Bottom triangle */
.case-roulette-center::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid #ffd700;
  filter: drop-shadow(0 -2px 6px rgba(255, 215, 0, 0.6));
}

/* Vertical center line (thin) */
.case-roulette-center-line {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  bottom: 14px;
  background: rgba(255, 215, 0, 0.4);
  z-index: 10;
  pointer-events: none;
}

/* ===== TRACK (scrolling strip of items) ===== */
.case-roulette-track {
  display: flex;
  align-items: center;
  height: 100%;
  will-change: transform;
  gap: 8px;
  padding: 0 20px;
}

/* ===== INDIVIDUAL ITEM ===== */
.case-roulette-item {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  padding: 8px;
  transition: none;
}

/* Tier-colored borders for items (set via data-tier attribute) */
.case-roulette-item[data-tier="common"] {
  border-color: rgba(180, 180, 180, 0.25);
}

.case-roulette-item[data-tier="rare"] {
  border-color: rgba(52, 152, 219, 0.35);
  background: rgba(52, 152, 219, 0.06);
}

.case-roulette-item[data-tier="epic"] {
  border-color: rgba(155, 89, 182, 0.35);
  background: rgba(155, 89, 182, 0.06);
}

.case-roulette-item[data-tier="legendary"] {
  border-color: rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.06);
}

.case-roulette-item[data-tier="mythic"] {
  border-color: rgba(231, 76, 60, 0.4);
  background: rgba(231, 76, 60, 0.06);
}

/* Winner highlight */
.case-roulette-item.case-roulette-winner {
  border: 3px solid #ffd700;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.5),
    0 0 60px rgba(255, 215, 0, 0.15),
    inset 0 0 20px rgba(255, 215, 0, 0.08);
  animation: cr-winnerPulse 1.5s ease-in-out infinite;
  transform: scale(1.08);
  z-index: 2;
  position: relative;
}

/* ===== RESULT SECTION ===== */
.case-roulette-result {
  padding: 28px 24px 30px;
  text-align: center;
  animation: cr-resultReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Confetti canvas */
.case-roulette-confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Result tier badge */
.case-roulette-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  animation: cr-badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.case-roulette-result-badge[data-tier="common"] {
  background: rgba(180, 180, 180, 0.15);
  color: #b4b4b4;
  border: 1px solid rgba(180, 180, 180, 0.3);
}

.case-roulette-result-badge[data-tier="rare"] {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.case-roulette-result-badge[data-tier="epic"] {
  background: rgba(155, 89, 182, 0.15);
  color: #bb8fce;
  border: 1px solid rgba(155, 89, 182, 0.3);
}

.case-roulette-result-badge[data-tier="legendary"] {
  background: rgba(255, 193, 7, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 193, 7, 0.3);
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.15);
}

.case-roulette-result-badge[data-tier="mythic"] {
  background: rgba(231, 76, 60, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(231, 76, 60, 0.3);
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.15);
}

.case-roulette-result-text {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}

.case-roulette-result-amount {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffd700 0%, #ffaa00 50%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
  animation: cr-amountCount 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

/* Close button */
.case-roulette-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6c3ce0 0%, #4a1fb8 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow:
    0 4px 16px rgba(108, 60, 224, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  letter-spacing: 0.3px;
}

.case-roulette-close-btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(108, 60, 224, 0.3);
}

/* ===== SPINNING STATE ===== */
.case-roulette-content.cr-spinning .case-roulette-title {
  animation: cr-titleGlow 2s ease-in-out infinite;
}

/* ===== ANIMATIONS ===== */

@keyframes cr-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cr-cardIn {
  from {
    transform: scale(0.9) translateY(30px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes cr-winnerPulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(255, 215, 0, 0.5),
      0 0 60px rgba(255, 215, 0, 0.15);
  }
  50% {
    box-shadow:
      0 0 30px rgba(255, 215, 0, 0.7),
      0 0 80px rgba(255, 215, 0, 0.25);
  }
}

@keyframes cr-resultReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cr-badgePop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cr-amountCount {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cr-titleGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  }
  50% {
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.2);
  }
}

/* Glow ring behind winner */
@keyframes cr-glowRing {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

.cr-glow-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255, 215, 0, 0.6);
  pointer-events: none;
  z-index: 1;
  animation: cr-glowRing 1s ease-out forwards;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .case-roulette-content {
    width: 98%;
    border-radius: 18px;
  }

  .case-roulette-wheel {
    height: 130px;
  }

  .case-roulette-item {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    padding: 6px;
  }

  .case-roulette-title {
    font-size: 18px;
    padding: 20px 16px 14px;
  }

  .case-roulette-result-amount {
    font-size: 28px;
  }

  .case-roulette-result {
    padding: 22px 18px 24px;
  }
}

/* ===== CONFETTI PARTICLE (CSS-only fallback) ===== */
.cr-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 25;
  animation: cr-particleFall var(--dur, 1.5s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes cr-particleFall {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 50px), var(--dy, 200px)) rotate(var(--rot, 360deg)) scale(0.3);
    opacity: 0;
  }
}
