@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,700;0,900;1,700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background: #0f1216;
  font-family: 'Montserrat', 'Stratum2', -apple-system, sans-serif;
  color: #fff;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* --- Фоны --- */
.bg-layer {
  position: fixed;
  inset: -20px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(6px) brightness(0.45) saturate(0.85);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.bg-layer.active { opacity: 1; }
.bg-modern  { background-image: url('bg_modern.webp'); }
.bg-medieval { background-image: url('bg_medieval.png'); }

/* --- Переключатель кейса --- */
.case-switch {
  position: absolute;
  top: 35px;
  right: 30px;
  display: flex;
  background: rgba(14, 18, 24, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px;
  z-index: 10;
  overflow: hidden;
}
.switch-option {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  color: #9ca3af;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.3s ease;
}
.switch-option.active { color: #fff; }
.switch-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: rgba(98, 164, 53, 0.35);
  border: 1px solid rgba(98, 164, 53, 0.6);
  border-radius: 4px;
  transition: transform 0.3s ease, background 0.3s ease;
  z-index: 1;
}
.case-switch[data-mode="medieval"] .switch-slider {
  transform: translateX(100%);
  background: rgba(180, 140, 60, 0.35);
  border-color: rgba(180, 140, 60, 0.6);
}

/* Верхний заголовок как в CS2 */
.header-ui {
  position: absolute;
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

.header-ui h1 {
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #e5e7eb;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.header-ui p {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Контейнер 3D сцены */
.viewer-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Нижняя панель действий (CS2 Bottom Bar) */
.bottom-bar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(14, 18, 24, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 8;
}

.key-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d1d5db;
  font-size: 13px;
  padding-right: 15px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.key-icon {
  font-size: 20px;
}

.btn-cs {
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  padding: 10px 24px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-unlock {
  background: #62a435;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(98, 164, 53, 0.4);
}

.btn-unlock:hover:not(:disabled) {
  background: #73be3f;
  box-shadow: 0 0 20px rgba(98, 164, 53, 0.6);
}

.btn-unlock:disabled {
  background: #374151;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

/* РУЛЕТКА (ТОЧНО КАК НА СКРИНШОТЕ №2) */
.roulette-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(16, 21, 28, 0.65) 0%, rgba(10, 12, 16, 0.88) 75%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 50;
}

.roulette-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.roulette-wrapper {
  position: relative;
  width: 960px;
  height: 220px;
  background: rgba(15, 20, 28, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 90% 100% at 50% 50%, #000 65%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 100% at 50% 50%, #000 65%, transparent 100%);
}

/* Центральный золотой визир */
.roulette-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #facc15;
  box-shadow: 0 0 14px 2px #facc15;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
}

.roulette-pointer::before, .roulette-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
}

.roulette-pointer::before {
  top: 0;
  border-top: 10px solid #facc15;
}

.pointer-triangle-bot {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid #facc15;
}

/* Лента карточек */
.roulette-tape {
  display: flex;
  position: absolute;
  top: 20px;
  left: 0;
  height: 180px;
  will-change: transform;
}

.loot-item {
  width: 140px;
  height: 175px;
  margin: 0 6px;
  background: linear-gradient(180deg, rgba(32, 38, 50, 0.8) 0%, rgba(18, 22, 30, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 15px 10px 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.loot-item-bg-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(to top, var(--glow-color, transparent), transparent);
  opacity: 0.22;
  pointer-events: none;
}

.loot-item-border {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--glow-color, #4b69ff);
  box-shadow: 0 0 10px var(--glow-color, #4b69ff);
}

.loot-icon {
  font-size: 50px;
  margin-top: 15px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.loot-title {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: #f3f4f6;
  z-index: 2;
  line-height: 1.2;
}

/* МОДАЛЬНОЕ ОКНО ДРОПА */
.win-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: radial-gradient(circle at center, #1e2638 0%, #0d1117 100%);
  border: 2px solid #ffd700;
  border-radius: 12px;
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.win-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.win-title {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 15px;
}

.win-icon {
  font-size: 80px;
  margin-bottom: 10px;
}

.win-grade {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 25px;
}