:root {
  --bg: #050816;
  --bg-soft: rgba(15, 23, 42, 0.9);
  --bg-softer: rgba(15, 23, 42, 0.7);
  --accent: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.2);
  --accent-strong: #db2777;
  --accent-rgb: 236, 72, 153;
  --bg-grid-a: #22d3ee;
  --bg-grid-b: #ec4899;
  --danger: #f97373;
  --success: #22c55e;
  --text: #e5e7eb;
  --text-soft: #9ca3af;
  --border: rgba(148, 163, 184, 0.35);
  --shadow-soft: 0 20px 40px rgba(15, 23, 42, 0.9);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 999px;
  --transition-fast: 160ms ease-out;
  --transition-med: 220ms ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Анимированный псевдо-3D фон (перспективная сетка + частицы),
   рисуется в js/background.js. Лежит позади всего интерфейса и не
   перехватывает клики. */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: #020617;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app[style*="display: none"] {
  display: none !important;
}

.glass {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.94),
    rgba(15, 23, 42, 0.86)
  );
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-box {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 20%, #ec4899, #db2777);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 35px rgba(236, 72, 153, 0.65);
}

.logo-cube {
  font-size: 20px;
  transform: translateY(-1px);
}

.title-block h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.title-block p {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.accounts-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.9);
  font-size: 12px;
}

.stats-item.stats-online .stats-value {
  color: #22c55e;
}

.stats-item.stats-offline .stats-value {
  color: #9ca3af;
}

.balance {
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.12), transparent),
    rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.crystals-balance {
  background: radial-gradient(circle at 0 0, rgba(168, 85, 247, 0.15), transparent),
    rgba(15, 23, 42, 0.9);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.balance-label {
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.balance-value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
}

.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  padding: 7px 12px;
  font-weight: 500;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast),
    opacity 120ms ease-out;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 12px 25px rgba(236, 72, 153, 0.55);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 35px rgba(236, 72, 153, 0.7);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(30, 64, 175, 0.85);
  border-color: rgba(191, 219, 254, 0.8);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text);
}

 .main {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: flex-start;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 10;
}

.sidebar-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.sidebar-btn:hover {
  background: rgba(30, 64, 175, 0.85);
  border-color: rgba(191, 219, 254, 0.7);
  transform: translateX(2px);
}

.sidebar-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: rgba(236, 72, 153, 0.95);
  color: white;
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.5);
}

.sidebar-btn.active:hover {
  transform: translateX(2px);
  box-shadow: 0 10px 25px rgba(236, 72, 153, 0.6);
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  }
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tab-content {
  display: none !important;
}

.tab-content.active {
  display: block !important;
}

.cases-section {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cases-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cases-header h2 {
  margin: 0;
  font-size: 17px;
}

.cases-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  transition: var(--transition-fast);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
  border-radius: 999px;
  transition: var(--transition-fast);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.5);
}

input:checked + .slider {
  background-color: rgba(236, 72, 153, 0.22);
  border-color: rgba(236, 72, 153, 0.9);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 999px;
}

.slider.round:before {
  border-radius: 999px;
}

.switch-label {
  color: var(--text-soft);
}

.select {
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-soft);
  padding: 4px 9px;
  font-size: 12px;
  outline: none;
}

.select:focus {
  border-color: rgba(251, 191, 36, 0.95);
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 11px;
}

.case-card {
  position: relative;
  padding: 13px 13px 12px;
  border-radius: 16px;
  background: radial-gradient(circle at 0 0, rgba(251, 191, 36, 0.2), transparent 55%),
    rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med),
    background var(--transition-med);
}

.case-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 0, rgba(255, 255, 255, 0.18), transparent 60%);
  opacity: 0;
  transition: opacity 220ms ease-out;
  pointer-events: none;
}

.case-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.9);
  border-color: rgba(191, 219, 254, 0.7);
}

.case-card:hover::before {
  opacity: 1;
}

.case-card.selected {
  border-color: rgba(236, 72, 153, 0.95);
  box-shadow: 0 16px 30px rgba(236, 72, 153, 0.6);
}

.case-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.case-title {
  font-weight: 600;
  font-size: 15px;
}

.case-price {
  font-size: 13px;
  color: var(--text-soft);
}

.case-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text-soft);
}

.case-chances {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.case-chance-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chance-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

/* Кнопка "Что внутри?" — открывает модалку с полным списком предметов
   кейса и точным шансом выпадения каждого (см. openCasePreview в
   public/js/shop.js). */
.case-preview-trigger {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  margin-top: 2px;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.case-preview-trigger:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Иконка кейса в инвентаре тоже открывает превью по клику (см. data-preview
   в caseTileHtml, public/js/inventory.js) — курсор подсказывает это. */
.inventory-icon-case[data-preview] {
  cursor: pointer;
}

/* Иконка предмета в инвентаре открывает крупный просмотр по клику
   (см. data-view-key в weaponTileHtml, public/js/inventory.js). */
.inventory-icon-zoomable {
  cursor: pointer;
}

.case-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.case-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(31, 41, 55, 0.95);
}

.case-preview-row.rarity-common {
  border-color: rgba(75, 85, 99, 0.9);
}

.case-preview-row.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.9);
}

.case-preview-row.rarity-rare {
  border-color: rgba(56, 189, 248, 0.9);
}

.case-preview-row.rarity-epic {
  border-color: rgba(168, 85, 247, 0.95);
}

.case-preview-row.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.5);
}

.case-preview-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: radial-gradient(circle at 30% 20%, rgba(15, 23, 42, 0.4), transparent),
    rgba(15, 23, 42, 0.95);
  overflow: hidden;
}

.case-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.case-preview-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-preview-rarity {
  font-size: 11px;
}

.case-preview-value {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.case-preview-chance {
  flex: 0 0 auto;
  min-width: 52px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

/* Крупный просмотр картинки предмета/подарка по клику на его иконку
   (см. public/js/item-preview.js) — иконка/картинка увеличена,
   рядом название, редкость и ценность. */
.item-zoom-modal-content {
  position: relative;
  width: 90%;
  max-width: 360px;
  padding: 32px 28px 28px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  animation: resultAppear 0.25s ease-out;
}

.item-zoom-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition-fast);
}

.item-zoom-close:hover {
  color: var(--text);
}

.item-zoom-image {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  background: radial-gradient(circle at 30% 20%, rgba(30, 41, 59, 0.6), transparent),
    rgba(2, 6, 23, 0.9);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  margin-bottom: 8px;
}

.item-zoom-image .item-img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.item-zoom-name {
  font-size: 19px;
  font-weight: 700;
}

.item-zoom-rarity {
  font-size: 13px;
  font-weight: 600;
}

.item-zoom-value {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.rarity-common {
  color: #9ca3af;
}

.rarity-uncommon {
  color: #22c55e;
}

.rarity-rare {
  color: #38bdf8;
}

.rarity-epic {
  color: #a855f7;
}

.rarity-legendary {
  color: #fbbf24;
}

.rarity-common-dot {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.rarity-uncommon-dot {
  background: linear-gradient(135deg, #22c55e, #4ade80);
}

.rarity-rare-dot {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.rarity-epic-dot {
  background: linear-gradient(135deg, #a855f7, #d946ef);
}

.rarity-legendary-dot {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.case-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.case-footer small {
  font-size: 11px;
  color: var(--text-soft);
}

.case-card.opening {
  animation: case-opening 700ms ease-out forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes case-opening {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.9);
  }
  40% {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.96);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.9);
  }
}

.result-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.last-drop {
  padding: 14px 15px 15px;
}

.last-drop h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.drop-display {
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  padding: 10px 11px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.drop-placeholder {
  font-size: 13px;
  color: var(--text-soft);
}

.drop-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drop-main {
  display: flex;
  align-items: center;
  gap: 9px;
}

.drop-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

/* Предметы с настоящей картинкой вместо эмодзи (см. ITEM_IMAGES в utils.js) */
.item-img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.drop-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drop-name {
  font-weight: 600;
  font-size: 14px;
}

.drop-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.drop-value {
  font-weight: 600;
  font-size: 14px;
}

.drop-card.appearing {
  animation: drop-appear 320ms ease-out;
}

@keyframes drop-appear {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stats {
  padding: 12px 14px 13px;
}

.stats h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.stats-item {
  padding: 7px 8px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.stats-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 2px;
}

.stats-value {
  font-size: 14px;
  font-weight: 600;
}

.stats h3 {
  margin: 3px 0 4px;
  font-size: 13px;
  color: var(--text-soft);
}

.rarity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rarity-stat-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rarity-stat-pill span:nth-child(2) {
  color: var(--text-soft);
}

.inventory {
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inventory-header h2 {
  margin: 0;
  font-size: 15px;
}

.inventory-list {
  max-height: 210px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding-right: 4px;
}

/* Объединённый инвентарь (кейсы + предметы в одной сетке, без вкладок) —
   уже не тесная 210px-плашка, а полноценная сетка на всю секцию. */
.inventory-list-combined {
  max-height: none;
  overflow: visible;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* Плитка кейса в инвентаре — картинка настоящего ящика вместо иконки
   предмета, золотистая рамка-акцент и бейдж "НОВОЕ" (как в референсе). */
.inventory-item.is-case {
  border-color: rgba(217, 119, 6, 0.55);
  background: linear-gradient(160deg, rgba(120, 53, 15, 0.25), #020617 55%);
}

.inventory-item.is-case:hover {
  border-color: rgba(251, 191, 36, 0.85);
}

.inventory-icon-case {
  background: radial-gradient(circle at 30% 20%, rgba(120, 53, 15, 0.35), transparent),
    rgba(15, 23, 42, 0.95);
}

.case-tile-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}

.case-tile-fallback {
  font-size: 34px;
}

.inventory-badge {
  position: absolute;
  top: 6px;
  left: 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.inventory-item.is-case .case-open-btn {
  width: 100%;
  font-size: 12px;
  padding: 7px 10px;
}

.inventory-item {
  position: relative;
  padding: 8px 7px 7px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(31, 41, 55, 0.95);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast);
}

.inventory-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.inventory-icon {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: radial-gradient(circle at 30% 20%, rgba(15, 23, 42, 0.4), transparent),
    rgba(15, 23, 42, 0.95);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.85);
  overflow: hidden;
}

.inventory-icon .item-img {
  width: 78%;
  height: 78%;
}

.inventory-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.inventory-name {
  font-size: 12px;
}

.inventory-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.inventory-count {
  position: absolute;
  top: 6px;
  right: 7px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.95);
}

.empty-inventory {
  font-size: 13px;
  color: var(--text-soft);
}

.inventory-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.95);
}

/* Цветовые рамки инвентаря по редкости (напоминает карточки из шутеров) */
.inventory-item.rarity-common {
  border-color: rgba(75, 85, 99, 0.9);
}

.inventory-item.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.9);
}

.inventory-item.rarity-rare {
  border-color: rgba(56, 189, 248, 0.9);
}

.inventory-item.rarity-epic {
  border-color: rgba(168, 85, 247, 0.95);
}

.inventory-item.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6), 0 18px 32px rgba(15, 23, 42, 0.98);
}

/* Вкладки инвентаря */
.inventory-tabs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.inventory-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.inventory-tab-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
}

.inventory-tab-btn.active {
  background: rgba(236, 72, 153, 0.15);
  color: var(--accent);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.inventory-tab-content {
  display: none;
}

.inventory-tab-content.active {
  display: block;
}

/* Стили для списка кейсов в инвентаре */
.cases-inventory-list {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.footer {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
}

/* Кнопка поддержки */
.support-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
  transition: all var(--transition-fast);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.support-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.support-button:active {
  transform: translateY(0);
}

/* Счетчик символов */
.char-counter {
  font-size: 12px;
  color: var(--text-soft);
  text-align: right;
  margin-top: 4px;
}

.char-counter.warning {
  color: var(--accent);
}

.char-counter.error {
  color: #ef4444;
}

/* Текстовое поле для поддержки */
textarea.form-control {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Профиль */
.profile {
  padding: 20px 24px;
}

.profile-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.profile-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-username-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-username {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-username.admin-user {
  color: var(--accent);
}

.rarity-stat-item.rarity-common {
  border-left-color: rgba(148, 163, 184, 0.8);
}

.rarity-stat-item.rarity-uncommon {
  border-left-color: rgba(34, 197, 94, 0.8);
}

.rarity-stat-item.rarity-rare {
  border-left-color: rgba(59, 130, 246, 0.8);
}

.rarity-stat-item.rarity-epic {
  border-left-color: rgba(168, 85, 247, 0.8);
}

.rarity-stat-item.rarity-legendary {
  border-left-color: rgba(251, 191, 36, 0.8);
}

.rarity-label {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.rarity-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rarest-item-card.rarity-common {
  border-color: rgba(148, 163, 184, 0.6);
}

.rarest-item-card.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.6);
}

.rarest-item-card.rarity-rare {
  border-color: rgba(59, 130, 246, 0.6);
}

.rarest-item-card.rarity-epic {
  border-color: rgba(168, 85, 247, 0.6);
}

.profile-modal-content {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Улучшенный заголовок профиля */
.profile-header-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-header-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    rgba(251, 191, 36, 0.8),
    rgba(168, 85, 247, 0.8),
    rgba(59, 130, 246, 0.8)
  );
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.profile-avatar {
  position: relative;
  flex-shrink: 0;
}

.avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(168, 85, 247, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  border: 3px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-med);
  overflow: hidden;
}

.avatar-circle.has-avatar-image {
  background: rgba(15, 23, 42, 0.6);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-edit-btn {
  position: absolute;
  bottom: -6px;
  left: -6px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast);
}

.avatar-edit-btn:hover {
  transform: scale(1.08);
}

.avatar-circle.admin-avatar {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.4), rgba(245, 158, 11, 0.4));
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 4px 25px rgba(251, 191, 36, 0.4);
}

.avatar-circle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.admin-badge-icon {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.profile-header-info {
  flex: 1;
  min-width: 0;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.profile-meta-item {
  font-size: 13px;
  color: var(--text-soft);
  padding: 4px 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.rank-badge {
  padding: 4px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
}

/* Улучшенные карточки статистики */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.profile-stat-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  transition: all var(--transition-med);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.profile-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--transition-med);
}

.profile-stat-card:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.profile-stat-card:hover::before {
  transform: scaleY(1);
}

.stat-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.profile-stat-card.stat-primary {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.1));
  border-color: rgba(34, 197, 94, 0.3);
}

.profile-stat-card.stat-crystals {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(139, 92, 246, 0.1));
  border-color: rgba(168, 85, 247, 0.3);
}

.profile-stat-card.stat-value {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
  border-color: rgba(251, 191, 36, 0.3);
}

.profile-stat-card.stat-opens {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
  border-color: rgba(59, 130, 246, 0.3);
}

.profile-stat-card.stat-spent {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
  border-color: rgba(239, 68, 68, 0.3);
}

.profile-stat-card.stat-items {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(2, 132, 199, 0.1));
  border-color: rgba(14, 165, 233, 0.3);
}

.profile-stat-card.stat-cases {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(219, 39, 119, 0.1));
  border-color: rgba(236, 72, 153, 0.3);
}

.profile-stat-card.stat-legendary {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.profile-stat-label {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 500;
}

.profile-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.profile-stat-sub {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 4px;
}

.profile-stat-sub.profit {
  color: #22c55e;
}

.profile-stat-sub.loss {
  color: #ef4444;
}

/* Улучшенная статистика по редкости с прогресс-барами */
.profile-rarity-stats {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 24px;
}

.profile-rarity-stats h4 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rarity-stats-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rarity-stat-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: all var(--transition-fast);
}

.rarity-stat-item:hover {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.4);
  transform: translateX(4px);
}

.rarity-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rarity-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.8);
  overflow: hidden;
  position: relative;
}

.rarity-progress-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.rarity-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.rarity-progress-fill.rarity-common {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.8), rgba(148, 163, 184, 1));
}

.rarity-progress-fill.rarity-uncommon {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.8), rgba(34, 197, 94, 1));
}

.rarity-progress-fill.rarity-rare {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.8), rgba(59, 130, 246, 1));
}

.rarity-progress-fill.rarity-epic {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.8), rgba(168, 85, 247, 1));
}

.rarity-progress-fill.rarity-legendary {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.8), rgba(251, 191, 36, 1));
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

/* Топ предметы */
.profile-top-items {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 24px;
}

.profile-top-items h4 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.top-item-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid;
  transition: all var(--transition-med);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.top-item-card.rarity-common {
  border-color: rgba(148, 163, 184, 0.6);
}

.top-item-card.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.6);
}

.top-item-card.rarity-rare {
  border-color: rgba(59, 130, 246, 0.6);
}

.top-item-card.rarity-epic {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.top-item-card.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
}

.top-item-rank {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.top-item-icon {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.top-item-icon .item-img {
  width: 40px;
  height: 40px;
}

.top-item-info {
  flex: 1;
  min-width: 0;
}

.top-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-item-details {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.top-item-count {
  color: var(--text-soft);
}

.top-item-value {
  color: var(--accent);
  font-weight: 600;
}

/* Улучшенный самый редкий предмет */
.profile-rarest-item {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.profile-rarest-item h4 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rarest-item-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid;
  transition: all var(--transition-med);
  position: relative;
  overflow: hidden;
}

.rarest-item-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.rarest-item-card:hover::before {
  opacity: 1;
}

.rarest-item-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.rarest-item-card.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.4);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
  animation: legendaryGlow 3s ease-in-out infinite;
}

@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 60px rgba(251, 191, 36, 0.6); }
}

.rarest-item-icon {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  animation: itemFloat 3s ease-in-out infinite;
}

.rarest-item-icon .item-img {
  width: 64px;
  height: 64px;
}

@keyframes itemFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.rarest-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rarest-item-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.rarest-item-details {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  flex-wrap: wrap;
}

.rarest-item-rarity {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-soft);
  font-weight: 600;
}

.rarest-item-count {
  color: var(--text-soft);
  font-weight: 500;
}

.rarest-item-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}

/* Карточки профиля */
.profile-cards-section {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 24px;
}

.profile-cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.profile-cards-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-cards-display {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 80px;
  align-items: center;
}

@keyframes cardGlow {
  0%, 100% { box-shadow: 0 4px 24px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 6px 32px rgba(251, 191, 36, 0.7); }
}

/* Модальное окно выбора карточек */
.cards-selection-modal-content {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.cards-selection-info {
  margin-bottom: 20px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.cards-selection-info p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
}

.cards-selection-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #3b82f6;
  font-weight: 600;
  font-size: 13px;
}

.cards-selection-counter #selectedCardsCount {
  font-size: 16px;
  color: var(--accent);
}

.cards-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.card-selection-item {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px solid;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: all var(--transition-med);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card-selection-item:hover:not(.disabled) {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-selection-item.selected {
  border-width: 3px;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.card-selection-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.card-selection-item.rarity-common {
  border-color: rgba(148, 163, 184, 0.5);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0.05));
}

.card-selection-item.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
}

.card-selection-item.rarity-rare {
  border-color: rgba(59, 130, 246, 0.6);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
}

.card-selection-item.rarity-epic {
  border-color: rgba(168, 85, 247, 0.7);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(168, 85, 247, 0.15));
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.card-selection-item.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.8);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.2));
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.card-selection-item.selected.rarity-common {
  border-color: rgba(148, 163, 184, 0.9);
  box-shadow: 0 0 15px rgba(148, 163, 184, 0.5);
}

.card-selection-item.selected.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
}

.card-selection-item.selected.rarity-rare {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.card-selection-item.selected.rarity-epic {
  border-color: rgba(168, 85, 247, 0.9);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.7);
}

.card-selection-item.selected.rarity-legendary {
  border-color: rgba(251, 191, 36, 1);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.8);
}

.card-selection-emoji {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.card-selection-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.card-selection-rarity {
  font-size: 11px;
  color: var(--text-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.8);
}

.card-selection-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.card-selection-limit {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.9);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--bg);
}

/* Модальное окно выбора иконки профиля — квадратные превью, выбор один
   из вариантов (в отличие от карточек, тут не до двух, а ровно одна). */
.avatar-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.avatar-selection-item {
  position: relative;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: all var(--transition-med);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.avatar-selection-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.avatar-selection-item.selected {
  border-color: var(--accent);
  border-width: 3px;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
}

.avatar-selection-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}

.avatar-selection-emoji {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(168, 85, 247, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}

.avatar-selection-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* Рынок — игроки продают свои кейсы/предметы друг другу за свою цену */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
}

.market-card {
  position: relative;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.market-card.rarity-common {
  border-color: rgba(148, 163, 184, 0.5);
}

.market-card.rarity-uncommon {
  border-color: rgba(34, 197, 94, 0.5);
}

.market-card.rarity-rare {
  border-color: rgba(59, 130, 246, 0.6);
}

.market-card.rarity-epic {
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

.market-card.rarity-legendary {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.35);
}

.market-card-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: radial-gradient(circle at 30% 20%, rgba(15, 23, 42, 0.4), transparent), rgba(15, 23, 42, 0.95);
  overflow: hidden;
}

.market-card-icon .item-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.market-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.market-card-rarity {
  font-size: 11px;
  color: var(--text-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.8);
}

.market-card-seller {
  font-size: 11px;
  color: var(--text-soft);
}

.market-card-price {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.market-card .btn {
  width: 100%;
  margin-top: 4px;
}

/* Адаптивность */
@media (max-width: 768px) {
  .profile-header-card {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .top-items-grid {
    grid-template-columns: 1fr;
  }
  
  .profile-meta {
    justify-content: center;
  }
  
  .cards-selection-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
  }
  
  .profile-cards-display {
    justify-content: center;
  }
}

@media (max-width: 960px) {
  .main {
    grid-template-columns: 1fr;
  }

  .stats-and-inventory {
    grid-template-columns: 1fr;
  }
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.username {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.username.admin-user {
  color: var(--accent);
  font-weight: 600;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  font-size: 12px;
  font-weight: bold;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.admin-badge {
  font-size: 16px;
  margin-right: 4px;
}

/* Модальное окно авторизации */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  padding-bottom: 12px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.auth-tab:hover {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

.auth-form h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-group input {
  padding: 10px 14px;
  padding-right: 42px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.form-group input::placeholder {
  color: var(--text-soft);
}

.password-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  color: var(--text-soft);
}

.password-toggle:hover {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

.password-toggle:active {
  transform: scale(0.95);
}

.eye-icon {
  font-size: 18px;
  display: inline-block;
  user-select: none;
  line-height: 1;
  animation: eye-blink 4s infinite;
  transform-origin: center center;
}

.password-toggle.active .eye-icon {
  opacity: 0.7;
}

@keyframes eye-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  94% {
    transform: scaleY(0.1);
  }
  96% {
    transform: scaleY(1);
  }
}

.auth-error {
  min-height: 20px;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.auth-success {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #22c55e;
  font-size: 14px;
  margin-top: 12px;
  text-align: center;
  font-weight: 500;
}

#promoCodeBtn {
  margin-left: 12px;
  font-size: 14px;
  padding: 8px 16px;
}

#promoCodeInput {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

#promoCodeInput::placeholder {
  text-transform: none;
  font-weight: normal;
  letter-spacing: normal;
}

.auth-form .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .app {
    padding-inline: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .user-info {
    order: -1;
    width: 100%;
    justify-content: space-between;
  }

  .auth-container {
    padding: 24px 20px;
  }
}

/* Магазин */
.shop {
  padding: 16px 18px;
}

.shop h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

@keyframes rewardPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
  }
}

@keyframes giftBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.05);
  }
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.shop-container {
  position: relative;
}

/* Карточки кейсов переносятся на новую строку вместо горизонтальной
   прокрутки со скрытым скроллбаром — так их видно все сразу, без
   дополнительных кнопок-стрелок. */
.shop-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.shop-grid .case-card {
  width: 100%;
}

/* ==========================================================================
   Магазин в стиле мобильных gacha-игр: горизонтальные карточки спецпредложений,
   нижняя панель вкладок, "3D"-ящики кейсов.
   ========================================================================== */

.shop-bs {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.shop-bs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.shop-bs-header h2 {
  margin: 0;
  font-size: 20px;
}

.shop-bs-currencies {
  display: flex;
  gap: 8px;
}

.shop-bs-currency {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}

.shop-bs-currency-crystals {
  border-color: rgba(56, 189, 248, 0.4);
}

.shop-bs-body {
  padding: 18px 20px;
  min-height: 320px;
}

.shop-bs-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--text-soft);
}

/* Горизонтальная лента карточек-предложений */
.shop-bs-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x proximity;
}

.shop-bs-strip::-webkit-scrollbar {
  height: 8px;
}

.shop-bs-strip::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.4);
  border-radius: 999px;
}

.offer-card {
  scroll-snap-align: start;
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--border);
  transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med);
}

.offer-card:hover {
  transform: translateY(-4px);
  border-color: rgba(236, 72, 153, 0.7);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.85);
}

.offer-ribbon {
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  color: white;
}

.offer-ribbon-hot {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.offer-ribbon-always {
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
}

.offer-ribbon-timer {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.offer-card-body {
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  flex: 1;
}

.offer-card-name {
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}

.offer-card-tag {
  font-size: 11px;
  color: var(--text-soft);
}

.offer-card-chances {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}

.offer-card-footer {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offer-card-price-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.offer-price-original {
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: line-through;
}

.offer-price-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.offer-buy-btn {
  width: 100%;
}

/* Нижняя панель вкладок магазина */
.shop-bs-tabs {
  display: flex;
  border-top: 1px solid var(--border);
  background: rgba(8, 12, 24, 0.85);
}

.shop-bs-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px 12px;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-top: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.shop-bs-tab-icon {
  font-size: 17px;
}

.shop-bs-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.shop-bs-tab.active {
  color: var(--accent);
  border-top-color: var(--accent);
  background: rgba(236, 72, 153, 0.08);
}

/* Ресурсы */
.shop-resources {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

.shop-resource-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
}

.shop-resource-icon {
  font-size: 26px;
}

.shop-resource-label {
  font-size: 12px;
  color: var(--text-soft);
}

.shop-resource-value {
  font-size: 18px;
  font-weight: 700;
}

.shop-resource-note {
  font-size: 12px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}

/* "3D"-ящик кейса: три грани-параллелограмма на clip-path, лёгкий наклон
   по наведению через perspective — создаёт объём без WebGL/библиотек. */
.box3d-wrap {
  perspective: 500px;
  width: 78px;
  height: 74px;
  margin: 4px auto 2px;
}

.box3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-8deg) rotateY(-22deg);
  transition: transform 260ms ease-out;
  animation: box3d-float 3.6s ease-in-out infinite;
}

.offer-card:hover .box3d,
.case-card:hover .box3d {
  transform: rotateX(-8deg) rotateY(18deg) translateY(-2px);
}

@keyframes box3d-float {
  0%, 100% { transform: rotateX(-8deg) rotateY(-22deg) translateY(0); }
  50% { transform: rotateX(-8deg) rotateY(-22deg) translateY(-4px); }
}

.offer-card:hover .box3d,
.case-card:hover .box3d {
  animation-play-state: paused;
}

.box3d-top,
.box3d-left,
.box3d-right {
  position: absolute;
}

.box3d-top {
  width: 100%;
  height: 46%;
  top: 0;
  clip-path: polygon(50% 0%, 100% 26%, 50% 52%, 0% 26%);
}

.box3d-left {
  width: 50%;
  height: 60%;
  bottom: 0;
  left: 0;
  clip-path: polygon(0 14%, 100% 0%, 100% 86%, 0 100%);
}

.box3d-right {
  width: 50%;
  height: 60%;
  bottom: 0;
  right: 0;
  clip-path: polygon(0 0%, 100% 14%, 100% 100%, 0 86%);
}

.box3d-shine {
  position: absolute;
  top: 2%;
  left: 20%;
  width: 22%;
  height: 20%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(3px);
  clip-path: polygon(50% 0%, 100% 30%, 50% 60%, 0% 30%);
  opacity: 0.7;
  pointer-events: none;
}

/* Палитра граней по "тиру" ящика */
.box3d-steel .box3d-top { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }
.box3d-steel .box3d-left { background: #475569; }
.box3d-steel .box3d-right { background: #64748b; }

.box3d-green .box3d-top { background: linear-gradient(135deg, #86efac, #22c55e); }
.box3d-green .box3d-left { background: #15803d; }
.box3d-green .box3d-right { background: #16a34a; }

.box3d-blue .box3d-top { background: linear-gradient(135deg, #7dd3fc, #0ea5e9); }
.box3d-blue .box3d-left { background: #0369a1; }
.box3d-blue .box3d-right { background: #0284c7; }

.box3d-purple .box3d-top { background: linear-gradient(135deg, #d8b4fe, #a855f7); }
.box3d-purple .box3d-left { background: #6b21a8; }
.box3d-purple .box3d-right { background: #7e22ce; }

.box3d-red .box3d-top { background: linear-gradient(135deg, #fca5a5, #ef4444); }
.box3d-red .box3d-left { background: #991b1b; }
.box3d-red .box3d-right { background: #b91c1c; }

.box3d-gold .box3d-top { background: linear-gradient(135deg, #fef08a, #fbbf24); }
.box3d-gold .box3d-left { background: #b45309; }
.box3d-gold .box3d-right { background: #d97706; }

/* Кейс со своей картинкой ящика (например "Тишка") вместо CSS-«3D»-кубика
   — тот же контейнер/анимация плавания, что у .box3d-wrap, но внутри
   обычный <img> с настоящим изображением. */
.case-icon-wrap {
  width: 120px;
  height: 108px;
  margin: 4px auto 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: box3d-float 3.6s ease-in-out infinite;
}

.case-icon-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  transition: transform 260ms ease-out;
  user-select: none;
}

.offer-card:hover .case-icon-image,
.case-card:hover .case-icon-image {
  transform: translateY(-2px) scale(1.04);
}

.offer-card:hover .case-icon-wrap,
.case-card:hover .case-icon-wrap {
  animation-play-state: paused;
}

.case-card-bs {
  align-items: center;
  text-align: center;
}

.case-card-bs .case-header {
  width: 100%;
}

/* Кейсы со своей фоновой картинкой (например "Тишка") — фото на всю
   карточку, тёмный градиент поверх для читаемости текста, обычный
   3D-ящик прячется, чтобы не спорить с фотографией. */
.offer-card.has-bg-image,
.case-card-bs.has-bg-image {
  position: relative;
  background-size: cover;
  background-position: center 30%;
}

.offer-card.has-bg-image::before,
.case-card-bs.has-bg-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 8, 20, 0.32) 0%, rgba(10, 8, 20, 0.58) 55%, rgba(10, 8, 20, 0.9) 100%);
  z-index: 0;
  pointer-events: none;
}

.offer-card.has-bg-image > *,
.case-card-bs.has-bg-image > * {
  position: relative;
  z-index: 1;
}

.has-bg-image .box3d-wrap {
  display: none;
}

/* В сетке "Все кейсы" карточка растягивается по высоте ряда — прижимаем
   цену/кнопку к низу, чтобы они не повисали сразу под шансами, оставляя
   фото пустым куском ниже. */
.case-card-bs.has-bg-image .case-footer {
  margin-top: auto;
  width: 100%;
}

/* Обычный приглушённый цвет цены (var(--text-soft)) теряется на светлом
   фото — делаем его белым с тенью, чтобы читалось поверх любой картинки. */
.case-card-bs.has-bg-image .case-footer small {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

@media (prefers-reduced-motion: reduce) {
  .box3d,
  .case-icon-wrap {
    animation: none;
  }
}


/* Визуальные линии на ползунке */
.scroll-grip-line {
  width: 2px;
  height: 2px;
  background: #d1d5db;
  border-radius: 1px;
  box-shadow: 
    0 0 1px rgba(0, 0, 0, 0.2),
    inset 0 0 1px rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  pointer-events: none;
  margin: 0 1px;
}

.timer-icon {
  font-size: 14px;
}

.timer-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* Таблица лидеров */
.leaderboard {
  padding: 16px 18px;
}

.leaderboard-header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.leaderboard h2 {
  margin: 0;
  font-size: 18px;
}

.search-user-section {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-user-input {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  min-width: 200px;
  transition: all var(--transition-fast);
}

.search-user-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.leaderboard-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.leaderboard-filter {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.leaderboard-filter.active {
  background: var(--accent);
  color: #020617;
  border-color: var(--accent);
  font-weight: 600;
}

.leaderboard-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 60px 1fr 120px 100px 100px;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 60px 1fr 120px 100px 100px;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  align-items: center;
}

.leaderboard-row:hover {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateX(2px);
}

.leaderboard-row.current-user {
  background: radial-gradient(circle at 0 0, rgba(251, 191, 36, 0.15), transparent 55%),
    rgba(15, 23, 42, 0.9);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2);
}

.leaderboard-rank {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 768px) {
  .leaderboard-header,
  .leaderboard-row {
    grid-template-columns: 50px 1fr 90px;
    gap: 8px;
    padding: 10px 12px;
  }
  
  .leaderboard-other {
    display: none;
  }
}

/* Админ-панель */
.admin-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.admin-panel-header {
  padding: 8px 12px;
  margin-bottom: 8px;
}

.admin-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-btn {
  width: 100%;
  justify-content: flex-start;
  font-size: 13px;
  margin-bottom: 4px;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.admin-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.5);
}

/* Админ-модальные окна */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.admin-modal-content {
  width: 90%;
  max-width: 450px;
  padding: 24px;
  border-radius: var(--radius-lg);
}

.admin-modal-content h2 {
  margin: 0 0 20px;
  font-size: 18px;
}

.form-control,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.form-control optgroup,
.form-select optgroup {
  font-weight: 600;
  color: var(--accent);
  background: rgba(15, 23, 42, 0.9);
}

.form-control option,
.form-select option {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  padding: 8px;
}

/* Спин для открытия кейса (как в шутерах) — на весь экран, чтобы ящик и
   приз были по-настоящему крупными, а не мелкой плашкой в центре. */
.spin-modal-content {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
  background: rgba(2, 6, 23, 0.98);
  border-radius: 0;
}

.spin-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.spin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0;
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.spin-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.spin-header .close-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.spin-header .close-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}

/* Общая "сцена" модалки открытия — растягивается на всё доступное место
   между шапкой и нижней панелью с кнопкой; и лента, и режим "клик по
   ящику", и итоговая карточка приза лежат внутри неё друг на друге. */
.spin-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.spin-track-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  border-top: 2px solid rgba(251, 191, 36, 0.3);
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
  transform: translateZ(0); /* Аппаратное ускорение */
  will-change: contents;
  /* Улучшение качества рендеринга */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.spin-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transform: translateZ(0); /* Аппаратное ускорение */
  backface-visibility: hidden; /* Улучшение производительности */
  perspective: 1000px; /* 3D эффект */
}

.spin-item {
  flex-shrink: 0;
  width: 200px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px solid rgba(148, 163, 184, 0.2);
  position: relative;
  transform: translateZ(0); /* Аппаратное ускорение */
  backface-visibility: hidden;
  transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}

.spin-item-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  width: 100%;
  height: 100%;
  justify-content: center;
  transform: translateZ(0); /* Аппаратное ускорение */
  backface-visibility: hidden;
  /* Улучшение качества текста */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.spin-item-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transform: translateZ(0);
  will-change: transform;
  transition: transform 0.2s ease-out;
}

.spin-item-emoji .item-img {
  width: 64px;
  height: 64px;
}

.spin-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.spin-item-rarity {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-soft);
}

.spin-center-line {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, 
    transparent 0%,
    var(--accent) 10%,
    var(--accent) 90%,
    transparent 100%
  );
  box-shadow: 0 0 20px var(--accent), 
              -2px 0 10px rgba(0, 0, 0, 0.5),
              2px 0 10px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}

.spin-center-line::before,
.spin-center-line::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
}

.spin-center-line::before {
  top: 0;
  border-top: 20px solid var(--accent);
}

.spin-info {
  text-align: center;
  width: 100%;
  padding: 20px 30px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0;
  border-top: 2px solid rgba(251, 191, 36, 0.3);
}

.spin-btn {
  padding: 14px 32px;
  font-size: 18px;
  font-weight: 600;
}

/* Итог открытия — теперь крупная плашка по центру сцены (поверх ленты
   или картинки ящика), а не мелкая карточка внизу под кнопкой. */
.spin-result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 10, 20, 0.97);
  z-index: 5;
  animation: resultAppear 0.4s ease-out;
}

.spin-result .drop-card {
  width: auto;
  max-width: min(520px, 90%);
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 56px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid var(--accent);
}

.spin-result .drop-main {
  flex-direction: column;
  gap: 18px;
}

.spin-result .drop-icon {
  width: 140px;
  height: 140px;
  border-radius: 24px;
  font-size: 64px;
}

.spin-result .drop-info {
  align-items: center;
  text-align: center;
  gap: 6px;
}

.spin-result .drop-name {
  font-size: 24px;
}

.spin-result .drop-meta {
  font-size: 15px;
}

.spin-result .drop-value {
  font-size: 20px;
}

@media (max-width: 640px) {
  .spin-result .drop-icon {
    width: 100px;
    height: 100px;
    font-size: 46px;
  }
  .spin-result .drop-card {
    padding: 28px 32px;
  }
}

@keyframes resultAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Альтернативное открытие "кликом по ящику" (например, кейс "Тишка") —
   вместо ленты прокрутки показываем саму картинку ящика по центру,
   игрок кликает по ней, ящик потряхивает и "лопается", открывая приз. */
.click-open-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-top: 2px solid rgba(251, 191, 36, 0.3);
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.click-open-box-img {
  width: min(420px, 46vw);
  max-width: 80%;
  cursor: pointer;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55));
  animation: click-open-idle 2.6s ease-in-out infinite;
  transition: transform 150ms ease-out;
  user-select: none;
}

.click-open-box-img:hover {
  transform: scale(1.05);
}

.click-open-box-img.is-shaking {
  animation: click-open-shake 0.7s ease-in-out infinite;
  cursor: default;
}

.click-open-box-img.is-opened {
  animation: click-open-pop 0.42s ease-in forwards;
  cursor: default;
}

.click-open-hint {
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 600;
}

.click-open-hint.is-hidden {
  visibility: hidden;
}

@keyframes click-open-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-2deg); }
}

@keyframes click-open-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-5px, 0) rotate(-4deg); }
  20% { transform: translate(5px, 0) rotate(4deg); }
  30% { transform: translate(-5px, 0) rotate(-4deg); }
  40% { transform: translate(5px, 0) rotate(4deg); }
  50% { transform: translate(-4px, 0) rotate(-3deg); }
  60% { transform: translate(4px, 0) rotate(3deg); }
  70% { transform: translate(-3px, 0) rotate(-2deg); }
  80% { transform: translate(3px, 0) rotate(2deg); }
  90% { transform: translate(-2px, 0) rotate(-1deg); }
}

@keyframes click-open-pop {
  0% { transform: scale(1); opacity: 1; }
  55% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .click-open-box-img {
    animation: none;
  }
  .click-open-box-img.is-opened {
    opacity: 0;
  }
}

/* Цвета предметов спина по редкости */
.spin-item.common {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.1));
  border-left: 3px solid rgba(148, 163, 184, 0.5);
}

.spin-item.uncommon {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
  border-left: 3px solid rgba(34, 197, 94, 0.5);
}

.spin-item.rare {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
  border-left: 3px solid rgba(59, 130, 246, 0.5);
}

.spin-item.epic {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.1));
  border-left: 3px solid rgba(168, 85, 247, 0.5);
}

.spin-item.legendary {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.15));
  border-left: 3px solid rgba(251, 191, 36, 0.7);
  box-shadow: inset 0 0 20px rgba(251, 191, 36, 0.2);
}

.spin-item.common .spin-item-rarity {
  background: rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.spin-item.uncommon .spin-item-rarity {
  background: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.spin-item.rare .spin-item-rarity {
  background: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.spin-item.epic .spin-item-rarity {
  background: rgba(168, 85, 247, 0.3);
  color: #a855f7;
}

.spin-item.legendary .spin-item-rarity {
  background: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

/* Эффекты редкости для модального окна */
#spinModal.rarity-effect-common {
  animation: subtlePulse 3s ease-in-out;
}

#spinModal.rarity-effect-uncommon {
  animation: subtlePulse 3.5s ease-in-out;
}

#spinModal.rarity-effect-rare {
  animation: glowPulse 4s ease-in-out;
}

#spinModal.rarity-effect-epic {
  animation: epicGlow 5s ease-in-out;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.4);
}

#spinModal.rarity-effect-legendary {
  animation: legendaryExplosion 6s ease-in-out;
  box-shadow: 0 0 60px rgba(251, 191, 36, 0.6);
}

@keyframes subtlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}

@keyframes glowPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }
  50% { 
    transform: scale(1.02);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
  }
}

@keyframes epicGlow {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
  }
  25% { 
    transform: scale(1.02);
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.6);
  }
  50% { 
    transform: scale(1.01);
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.5);
  }
  75% { 
    transform: scale(1.02);
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.6);
  }
}

@keyframes legendaryExplosion {
  0% { 
    transform: scale(1);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
  }
  20% { 
    transform: scale(1.05);
    box-shadow: 0 0 80px rgba(251, 191, 36, 0.8);
  }
  40% { 
    transform: scale(1.02);
    box-shadow: 0 0 60px rgba(251, 191, 36, 0.6);
  }
  60% { 
    transform: scale(1.04);
    box-shadow: 0 0 70px rgba(251, 191, 36, 0.7);
  }
  80% { 
    transform: scale(1.03);
    box-shadow: 0 0 65px rgba(251, 191, 36, 0.65);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 0 60px rgba(251, 191, 36, 0.6);
  }
}

/* Эффект частиц для легендарных предметов */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, #fbbf24, transparent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) translateX(var(--particle-x, 0)) scale(0);
  }
}

@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes resultSlideInBounce {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.8) rotate(-5deg);
  }
  60% {
    transform: translateY(-10px) scale(1.05) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes resultEpicReveal {
  0% {
    opacity: 0;
    transform: scale(0.5) rotateY(90deg);
    filter: blur(10px);
  }
  50% {
    transform: scale(1.1) rotateY(0deg);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
    filter: blur(0);
  }
}

@keyframes resultLegendaryReveal {
  0% {
    opacity: 0;
    transform: scale(0.3) rotateY(180deg) rotateZ(-20deg);
    filter: blur(15px) brightness(0.5);
  }
  30% {
    transform: scale(1.2) rotateY(0deg) rotateZ(10deg);
    filter: blur(8px) brightness(1.2);
  }
  60% {
    transform: scale(0.95) rotateY(0deg) rotateZ(-5deg);
    filter: blur(3px) brightness(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg) rotateZ(0deg);
    filter: blur(0) brightness(1);
  }
}

@keyframes glowRotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes resultPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
  }
}

/* Улучшенные эффекты для центральной линии при разных редкостях */
.spin-track-wrapper.rarity-effect-rare .spin-center-line {
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.6),
              -2px 0 15px rgba(0, 0, 0, 0.5),
              2px 0 15px rgba(0, 0, 0, 0.5);
  animation: centerLinePulse 2s ease-in-out infinite;
}

.spin-track-wrapper.rarity-effect-epic .spin-center-line {
  box-shadow: 0 0 35px rgba(168, 85, 247, 0.8),
              -2px 0 20px rgba(0, 0, 0, 0.5),
              2px 0 20px rgba(0, 0, 0, 0.5);
  animation: centerLineEpic 1.5s ease-in-out infinite;
}

.spin-track-wrapper.rarity-effect-legendary .spin-center-line {
  box-shadow: 0 0 50px rgba(251, 191, 36, 1),
              -2px 0 25px rgba(0, 0, 0, 0.5),
              2px 0 25px rgba(0, 0, 0, 0.5);
  animation: centerLineLegendary 1s ease-in-out infinite;
}

@keyframes centerLinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes centerLineEpic {
  0%, 100% { 
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
  }
  50% { 
    opacity: 0.9;
    transform: translateX(-50%) scaleY(1.05);
  }
}

@keyframes centerLineLegendary {
  0%, 100% { 
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
    filter: brightness(1);
  }
  25% { 
    opacity: 0.95;
    transform: translateX(-50%) scaleY(1.1);
    filter: brightness(1.2);
  }
  50% { 
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
    filter: brightness(1);
  }
  75% { 
    opacity: 0.95;
    transform: translateX(-50%) scaleY(1.1);
    filter: brightness(1.2);
  }
}

@media (max-width: 640px) {
  .spin-item {
    width: 150px;
  }
  
  .spin-item-emoji {
    font-size: 48px;
  }

  .spin-item-emoji img {
    width: 48px;
    height: 48px;
  }
  
  .spin-item-name {
    font-size: 12px;
    max-width: 130px;
  }
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.admin-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.admin-modal-actions .btn {
  min-width: 100px;
}

/* Инвентарь кейсов */
.cases-inventory {
  padding: 16px 18px;
  margin-top: 16px;
}

.cases-inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cases-inventory-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.cases-total {
  font-size: 13px;
  color: var(--text-soft);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.empty-cases {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}

.cases-inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.case-open-btn {
  width: 100%;
  justify-content: center;
  font-size: 14px;
  padding: 10px 16px;
  font-weight: 600;
  margin-top: 4px;
}

/* Трейды */
.trades-section {
  display: block;
}

.trades-container {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  height: calc(100vh - 200px);
}

.trades-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.trades-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trades-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.trades-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

/* Уведомления о запросах в друзья */
.notifications-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(251, 191, 36, 0.05);
}

.notifications-header {
  margin-bottom: 12px;
}

.notifications-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.3);
  transition: all var(--transition-fast);
}

.notification-item:hover {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(251, 191, 36, 0.5);
}

.trades-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trade-items-label {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
}

.trade-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
}

.trade-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(15, 23, 42, 0.5);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Модальное окно трейда */
.trade-items-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.trade-items-column h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.trade-items-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Друзья */
.friends-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
  max-height: 400px;
}

.friends-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.friends-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.friends-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  transition: all var(--transition-fast);
  position: relative;
  z-index: 1;
}

.friend-item:hover {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.5);
}

.friend-item:hover .btn {
  opacity: 1;
}

@media (max-width: 1200px) {
  .trades-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .trades-main {
    min-height: 400px;
  }
  
  .trades-sidebar {
    min-height: 400px;
  }

  .friends-section {
    max-height: 300px;
  }
}

/* Индикатор непрочитанных сообщений поддержки */
.support-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

/* Сообщения поддержки */
.support-message-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition-med);
}

.support-message-item.unread-message {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.support-message-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.support-message-from {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.support-message-date {
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.support-message-subject {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 14px;
}

.support-message-text {
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ==========================================================================
   Новые компоненты интерфейса (переработанный клиент, работающий с API)
   ========================================================================== */

/* Онлайн-индикаторы */
.dot-online,
.dot-offline {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.dot-online {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}
.dot-offline {
  background: var(--text-soft);
  opacity: 0.6;
}

/* Таблица лидеров */
.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 1.6fr 1fr 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
  margin-bottom: 8px;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  font-size: 13px;
}
.leaderboard-row:hover {
  background: rgba(30, 64, 175, 0.4);
  border-color: rgba(191, 219, 254, 0.5);
  transform: translateX(2px);
}
.leaderboard-rank {
  font-weight: 700;
  color: var(--accent);
}
.leaderboard-name {
  font-weight: 600;
  display: flex;
  align-items: center;
}
.leaderboard-value,
.leaderboard-balance,
.leaderboard-opens {
  color: var(--text-soft);
  font-size: 12px;
}
@media (max-width: 720px) {
  .leaderboard-row {
    grid-template-columns: 32px 1fr;
    grid-template-areas: "rank name" ". value" ". balance" ". opens";
  }
}

/* Уведомления о заявках в друзья */
.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.6);
  margin-bottom: 8px;
  font-size: 13px;
}

/* Друзья */
.friend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 6px;
  font-size: 13px;
}
.friend-name {
  flex: 1;
}

/* Карточки трейдов */
.trade-item-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.6);
  margin-bottom: 10px;
}
.trade-item-card.status-accepted {
  border-color: rgba(34, 197, 94, 0.5);
}
.trade-item-card.status-declined,
.trade-item-card.status-cancelled {
  opacity: 0.6;
}
.trade-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.trade-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-soft);
}
.trade-item-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Выбор предметов при создании трейда */
.trade-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 6px;
  font-size: 12px;
}
.trade-pick-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.trade-pick-qty {
  min-width: 16px;
  text-align: center;
  font-weight: 600;
}

/* Свечение модалки спина по редкости выигрыша */
.spin-glow-rare {
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.35);
}
.spin-glow-epic {
  box-shadow: 0 0 70px rgba(168, 85, 247, 0.45);
}
.spin-glow-legendary {
  box-shadow: 0 0 90px rgba(251, 191, 36, 0.55);
}

/* Тосты-уведомления */
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.toast.visible {
  opacity: 1;
  transform: translateX(0);
}
.toast-success {
  border-color: rgba(34, 197, 94, 0.6);
}
.toast-error {
  border-color: rgba(249, 115, 115, 0.7);
}
.toast-info {
  border-color: rgba(56, 189, 248, 0.6);
}

