:root {
  color-scheme: dark;
  /* Палитра снята с реального сайта-референса (musor1.win, Chakra-based drop-платформа):
     фон почти чёрный с фиолетовым, текст — тёплый лавандовый, а не чистый белый. */
  --bg: var(--tg-theme-bg-color, #100f12);
  --text: var(--tg-theme-text-color, #f1e7ff);
  --hint: var(--tg-theme-hint-color, #948da8);
  --button: var(--tg-theme-button-color, #966ee5);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --surface: var(--tg-theme-secondary-bg-color, #16141a);
  --surface-2: #211f28;
  --border: rgba(241, 231, 255, 0.08);
  --accent-a: #966ee5; /* сверено с реальным замером цвета референса (skillui-экстракция musor1.win) */
  --accent-b: #7356bf;
  --accent-grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --lav: #f1e7ff;
  --gold: #ee9121;
  --green: #8affc7;
  --red: #e5484d;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.55);
  /* Отдельный синий акцент для депозита/Stars — снят с референса пользователя
     (скрин кейс-опенинг платформы): тёмно-синяя карточка, яркий синий CTA.
     Специально отличается от золота/фиолетового остальной игры — сигнализирует
     "здесь тратятся настоящие деньги", а не игровая валюта. */
  --deposit-blue: #3f74e0;
  --deposit-blue-dark: #1f3d7a;
  --deposit-blue-light: #7aa6ff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
/* Скрытый скроллбар — деталь фирменного стиля референса */
::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; }

::selection {
  background: var(--accent-a);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  /* Двойной тап по боссу (частые повторные тапы) распознавался мобильным
     Chrome как жест "zoom by double-tap" и приближал экран — viewport
     meta с user-scalable=no это не всегда подавляет (многие браузеры его
     игнорируют из соображений доступности). touch-action:manipulation
     явно отключает именно двойной-тап-зум и pinch, оставляя обычный тап
     и скролл рабочими. */
  touch-action: manipulation;
}

/* Мягкое фиолетовое свечение фона — единственный акцент, без мультиколорных пятен */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 360px;
  height: 360px;
  top: -140px;
  left: -100px;
  background: var(--accent-b);
  opacity: 0.28;
}

.bg-glow-2 {
  width: 300px;
  height: 300px;
  bottom: -120px;
  right: -80px;
  background: var(--accent-a);
  opacity: 0.16;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 106px;
}

/* Вне Telegram (body.web-mode, см. app.js — определяется по пустой initData)
   и на широком экране — сайт ведёт себя как обычный веб-сайт, подстраивается
   под монитор, а не остаётся узкой мобильной колонкой. Внутри самого
   Telegram (initData непустая) этот блок вообще не применяется — там всегда
   мобильная адаптивная вёрстка, как и была, по прямому запросу пользователя. */
@media (min-width: 720px) {
  body.web-mode .app {
    max-width: 960px;
    padding-left: 32px;
    padding-right: 32px;
  }

  body.web-mode .shop-list,
  body.web-mode .inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    align-items: start;
  }

  body.web-mode .cases-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  body.web-mode .tabbar {
    max-width: 640px;
  }

  body.web-mode .boss-tap-wrap {
    width: min(420px, 60vw);
  }

  body.web-mode .case-reel-wrap {
    width: clamp(280px, 60vw, 820px);
  }

  body.web-mode .case-idle-reel-wrap {
    max-width: 820px;
  }

  body.web-mode .case-result {
    width: min(60vw, 460px);
  }

  body.web-mode .case-menu,
  body.web-mode .case-overlay-inner {
    max-width: 820px;
    margin: 0 auto;
  }
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.profile-button {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.profile-button:active {
  transform: scale(0.94);
}

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

.profile-button .icon {
  width: 18px;
  height: 18px;
  color: var(--hint);
}

.brand-text {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--lav);
}

.topbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
  color: currentColor;
}

.stat-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--lav);
}

/* Токен валюты — растровая иконка монеты, размер подогнан под соседние line-иконки */
.token-icon {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.chip-coin-img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-label {
  font-size: 10px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Плашка монет — зелёная pill-капсула, как индикатор баланса на референсе */
.stat.stat-highlight {
  background: linear-gradient(180deg, #26d97e, #16b869);
  border-color: transparent;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(38, 217, 126, 0.3);
}

.stat-highlight .stat-label {
  color: rgba(6, 46, 28, 0.65);
}

.stat-highlight .stat-value {
  color: #06301c;
}

.stat-highlight .stat-icon {
  color: #06301c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Баннер активного ивента-мутации — по референсу пользователя: иконка со
   свечением/искрами + брендовый "Brainrot Farm" рисованным шрифтом
   (Luckiest Guy) по центру баннера + множитель/таймер справа. Цвет акцента
   — из event.color, JS ставит --event-color на :root (document.documentElement,
   см. app.js/renderEvent), а не на самом баннере — так его видит и бейдж
   мутации на боссе (.mutation-badge), который лежит в другом поддереве DOM.

   ВАЖНО — реальный найденный баг: тут раньше была строка
   "--event-color: var(--gold);" как "золотой фолбэк на случай, если
   переменная не задана". Это НЕ фолбэк, а безусловное локальное
   переопределение: раз .event-banner сам объявляет --event-color в своём
   CSS-правиле, это правило переопределяет унаследованное с :root значение
   ДЛЯ ЭТОГО ЖЕ ЭЛЕМЕНТА и всех его потомков — из-за этого сама плашка
   (рамка/фон/текст) была намертво прибита к золотому цвету всегда, а
   иконка (.event-banner-icon, свой color-mix уже без локального
   переопределения) корректно красилась в цвет РЕАЛЬНОГО текущего ивента.
   Результат — на скрине пользователя golden-рамка при АЛМАЗНОЙ иконке и
   множителе (репортнуто как "почему во время голд ивента берёт иконку
   даймонд"). Фолбэк теперь не нужен: баннер всё равно скрыт (.hidden), пока
   JS не выставит реальный цвет.

   Раньше все три блока лежали в ОДНОЙ грид-ячейке (наложены друг на друга)
   с justify-self start/center/end и text-overflow-обрезкой у бренд-текста —
   это давало математически точный центр на широких экранах, но на узких
   (реальный телефон ~360px, проверено playwright-cli) правый блок
   (множитель+таймер, ~104px) физически не помещается в отведённое при
   центрировании место — обрезка не спасала, и правый блок наезжал поверх
   бренд-текста (баннер красился позже в DOM = поверх). Заменено на
   настоящую 3-колоночную сетку (реальные колонки, не наложение) —
   переполнение в принципе невозможно, крайняя левая колонка нарочно широкая
   (минимум 90px), чтобы центр текста визуально был близко к центру всего
   баннера. Фон тонирован цветом ивента, плюс лёгкое звёздное поле (россыпь
   точек через radial-gradient) — как на референсе. Без фоновых КАРТИНОК
   намеренно (в прошлый раз были баги с регистрацией/затемнением слоёв на
   разных ширинах экрана — тут только чистый CSS: цвет, точки-звёзды, текст). */
.event-banner {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(58px, auto) 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border-radius: 14px;
  background:
    radial-gradient(1.5px 1.5px at 15% 30%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 30% 70%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 45% 20%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 60% 60%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 75% 35%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 88% 65%, rgba(255,255,255,0.7), transparent),
    color-mix(in srgb, var(--event-color) 26%, #0a0910);
  border: 1px solid color-mix(in srgb, var(--event-color) 55%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--event-color) 30%, transparent);
  animation: event-banner-pulse 1.8s ease-in-out infinite;
}

@keyframes event-banner-pulse {
  0%, 100% { box-shadow: 0 0 18px color-mix(in srgb, var(--event-color) 25%, transparent); }
  50% { box-shadow: 0 0 26px color-mix(in srgb, var(--event-color) 50%, transparent); }
}

/* Стилистические эффекты под конкретную мутацию — по прямому запросу
   пользователя. Один общий слой (#eventBanner::before, JS ставит
   data-event="<ключ ивента>" в renderEvent), под каждый ивент — свой
   background/animation через атрибутный селектор. Слой поверх тонированного
   фона банера, но позади иконки/текста (z-index:0, контент выше через
   натуральный порядок — grid-элементы уже позиционированы своими областями).
   pointer-events:none — эффект чисто декоративный, клики сквозь него не
   блокирует. overflow:hidden на самом .event-banner обрезает всё по
   скруглённым углам плашки. */
#eventBanner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* -1, не 0 — иконка/бренд/правый блок это position:relative элементы
     (z-index:auto), а z-index:0 у абсолютного слоя рисуется ПОВЕРХ них
     (явный z-index всегда перед auto на том же уровне) — эффект бы закрывал
     текст. -1 гарантированно держит его позади содержимого, но перед
     фоном самой плашки. */
  z-index: -1;
}

/* Голд — блик, скользящий по диагонали, как отражение на металле */
#eventBanner[data-event="gold"]::before {
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.4) 48%, transparent 66%);
  background-size: 250% 100%;
  animation: fx-sweep 2.2s ease-in-out infinite;
}

/* Алмаз/Кристалл — россыпь мерцающих бликов */
#eventBanner[data-event="diamond"]::before,
#eventBanner[data-event="crystal"]::before {
  background-image:
    radial-gradient(2px 2px at 12% 35%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 70%, #fff, transparent),
    radial-gradient(2px 2px at 55% 25%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 75% 60%, #fff, transparent),
    radial-gradient(2px 2px at 90% 40%, #fff, transparent);
  animation: fx-twinkle 1.7s ease-in-out infinite;
}

/* Блудрот — стекающие вниз тёмно-красные потёки */
#eventBanner[data-event="bloodrot"]::before {
  background: repeating-linear-gradient(180deg, transparent 0 10px, rgba(200, 20, 20, 0.45) 10px 13px, transparent 13px 46px);
  background-size: 100% 200%;
  animation: fx-drip-down 2.8s linear infinite;
}

/* Кенди — пузырьки/искры, всплывающие вверх */
#eventBanner[data-event="candy"]::before {
  background-image:
    radial-gradient(2px 2px at 20% 85%, rgba(255, 130, 220, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 50% 90%, rgba(255, 170, 235, 0.8), transparent),
    radial-gradient(2px 2px at 78% 80%, rgba(255, 130, 220, 0.9), transparent);
  background-size: 100% 200%;
  animation: fx-drip-up 2.4s linear infinite;
}

/* Лава — поднимающиеся угольки/искры */
#eventBanner[data-event="lava"]::before {
  background-image:
    radial-gradient(2px 2px at 15% 90%, rgba(255, 140, 30, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 45% 85%, rgba(255, 190, 60, 0.8), transparent),
    radial-gradient(2px 2px at 70% 95%, rgba(255, 120, 20, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 90% 88%, rgba(255, 170, 50, 0.8), transparent);
  background-size: 100% 220%;
  animation: fx-drip-up 1.9s linear infinite;
}

/* Гэлакси — плавно уплывающее звёздное поле (гуще, чем базовый фон) */
#eventBanner[data-event="galaxy"]::before {
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 25% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 15%, #fff, transparent),
    radial-gradient(1px 1px at 60% 75%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 80% 30%, #fff, transparent),
    radial-gradient(1px 1px at 95% 65%, #fff, transparent);
  background-size: 200% 100%;
  animation: fx-drift 9s linear infinite;
}

/* Инь Янь — вращающийся чёрно-белый вихрь */
#eventBanner[data-event="yin-yang"]::before {
  background: conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.22), transparent 25%, rgba(0, 0, 0, 0.32) 50%, transparent 75%);
  animation: fx-spin 5s linear infinite;
}

/* Радиоактив — пульсирующее ядовито-зелёное свечение из центра */
#eventBanner[data-event="radioactive"]::before {
  background: radial-gradient(circle at 50% 50%, rgba(140, 230, 40, 0.4), transparent 70%);
  animation: fx-pulse 1s ease-in-out infinite;
}

/* Курсед — тревожное мерцание тёмно-красной ауры (рваное, не плавное) */
#eventBanner[data-event="cursed"]::before {
  background: radial-gradient(circle at 50% 50%, rgba(160, 20, 20, 0.4), transparent 70%);
  animation: fx-flicker 2.2s steps(5) infinite;
}

/* Дивайн — медленно вращающиеся лучи света */
#eventBanner[data-event="divine"]::before {
  background: repeating-conic-gradient(from 0deg, rgba(255, 250, 220, 0.28) 0deg 3deg, transparent 3deg 30deg);
  animation: fx-spin 10s linear infinite;
}

/* Кибер — бегущая сканирующая полоса */
#eventBanner[data-event="cyber"]::before {
  background: linear-gradient(90deg, transparent, rgba(60, 220, 255, 0.45), transparent);
  background-size: 35% 100%;
  animation: fx-scan 1.8s linear infinite;
}

/* Рэйнбоу — переливающийся радужный градиент, мягко наложен поверх */
#eventBanner[data-event="rainbow"]::before {
  background: linear-gradient(90deg, #ff5b5b, #ffb84d, #fff45b, #6ee06e, #5bb8ff, #b585ff, #ff5b5b);
  background-size: 300% 100%;
  opacity: 0.25;
  mix-blend-mode: overlay;
  animation: fx-hue-shift 3.5s linear infinite;
}

/* Фантом — размытые дрейфующие сгустки тумана */
#eventBanner[data-event="phantom"]::before {
  background: radial-gradient(circle at 30% 50%, rgba(210, 210, 255, 0.28), transparent 55%),
              radial-gradient(circle at 75% 50%, rgba(180, 180, 230, 0.22), transparent 55%);
  filter: blur(3px);
  animation: fx-drift-alt 4.5s ease-in-out infinite alternate;
}

@keyframes fx-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -50% 0; }
}

@keyframes fx-twinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes fx-drip-down {
  from { background-position-y: -100%; }
  to { background-position-y: 100%; }
}

@keyframes fx-drip-up {
  from { background-position-y: 100%; }
  to { background-position-y: -100%; }
}

@keyframes fx-drift {
  from { background-position-x: 0%; }
  to { background-position-x: -100%; }
}

@keyframes fx-drift-alt {
  from { transform: translateX(-4px); }
  to { transform: translateX(4px); }
}

@keyframes fx-spin {
  to { transform: rotate(360deg); }
}

@keyframes fx-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes fx-flicker {
  0%, 19%, 21%, 49%, 51%, 100% { opacity: 1; }
  20%, 50% { opacity: 0.35; }
}

@keyframes fx-scan {
  from { background-position-x: -40%; }
  to { background-position-x: 140%; }
}

@keyframes fx-hue-shift {
  from { background-position-x: 0%; }
  to { background-position-x: -300%; }
}

.event-banner-icon-wrap {
  justify-self: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.event-banner-icon-wrap::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--event-color) 65%, transparent), transparent 72%);
}

.event-banner-icon {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--event-color) 70%, transparent));
}

.event-banner-brand {
  min-width: 0;
  text-align: center;
  font-family: "Luckiest Guy", "Unbounded", cursive;
  font-size: clamp(14px, 4.5vw, 19px);
  line-height: 1;
  letter-spacing: 0.5px;
  color: var(--event-color);
  text-shadow:
    0 0 10px color-mix(in srgb, var(--event-color) 70%, transparent),
    1px 1px 0 rgba(0, 0, 0, 0.7),
    -1px 1px 0 rgba(0, 0, 0, 0.7),
    1px -1px 0 rgba(0, 0, 0, 0.7),
    -1px -1px 0 rgba(0, 0, 0, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-banner-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.event-banner-multiplier {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--event-color);
  text-shadow: 0 0 8px color-mix(in srgb, var(--event-color) 55%, transparent);
  flex-shrink: 0;
}

.event-banner-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.event-banner-timer-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--hint);
  flex-shrink: 0;
}

.event-banner-timer-wrap .icon {
  width: 13px;
  height: 13px;
}

.energy-bar-wrap {
  margin-bottom: 22px;
}

.energy-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.energy-bar-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--gold), #ffb44d);
  transition: transform 0.3s ease;
}

.energy-hint {
  color: var(--red);
  font-weight: 600;
}

/* Баннер отыгрыша депозита — блокирует магазин, пока остаток не потрачен на
   кейсы (по прямому запросу пользователя, "вариант B" системы отыгрыша). */
.wager-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(238, 145, 33, 0.1);
  border: 1px solid rgba(238, 145, 33, 0.35);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
}

.wager-banner .icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--gold);
  margin-top: 1px;
}

.wager-banner strong {
  color: var(--gold);
}

.view {
  flex: 1;
  animation: view-in 0.25s ease;
}

.hidden { display: none !important; }

/* Фон страницы кейса — фирменная картинка (фасад "Brainrot Farm"), затемнена
   градиентом сверху вниз: вверху фон виден чуть сильнее (атмосфера), к низу
   уходит в сплошной var(--bg), чтобы текст/карточки меню оставались
   читаемыми поверх неё. Отрицательные отступы компенсируют padding у .app,
   чтобы картинка доходила до самых краёв экрана, а не только до внутренней
   рамки. */
#caseOverlay {
  position: relative;
  margin: -16px -16px 0;
  padding: 16px 16px 24px;
}

/* Фон на весь экран (position:fixed на псевдоэлементах, а не background
   прямо на #caseOverlay) — иначе картинка была бы ограничена шириной/высотой
   самого блока (узкая колонка .app), а не растягивалась на весь вьюпорт.
   z-index:-1 держит оба слоя позади содержимого страницы, но выше базового
   фона приложения.
   Фото — на ::before (нижний слой, проявляется через opacity, см. bg-ready
   ниже), лёгкое затемнение — на ::after (верхний слой, красится ПОВЕРХ фото,
   т.к. ::after у одного элемента всегда красится позже/выше ::before при
   равном z-index — перепутанный порядок ранее полностью прятал либо
   затемнение под фото, либо фото под затемнением). Затемнение специально
   лёгкое (0.25/0.55, было 0.6/0.96) — по прямому запросу пользователя,
   чтобы надпись "BRAINROT FARM" на фото оставалась видна, а не тонула в
   сплошном чёрном. */
#caseOverlay::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("/case-bg.webp");
  background-size: cover;
  background-position: center 25%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#caseOverlay.bg-ready::before {
  opacity: 1;
}

/* Лёгкое затемнение — только градиент, без сети, рисуется на первом кадре
   независимо от того, успела ли докачаться фото-картинка, и всегда поверх
   неё (см. комментарий выше). ВАЖНО: никакого background-color здесь быть
   не должно — сплошная заливка красится ПОЗАДИ собственного градиента этого
   же слоя (а не позади фото в ::before), и тогда весь ::after целиком
   становится непрозрачным сам по себе, наглухо закрывая фото под ним, какой
   бы лёгкой ни была альфа у градиента (реальный баг — именно из-за него
   фон казался полностью чёрным независимо от яркости фото/градиента). */
#caseOverlay::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(180deg, rgba(16, 15, 18, 0.85) 0%, rgba(16, 15, 18, 0.97) 55%, rgba(16, 15, 18, 1) 85%);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#farmView {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 58vh;
}

.boss-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pet-name-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 18px;
}

.pet-name {
  font-family: "Fraunces", serif;
  font-size: 17px;
  font-weight: 600;
  font-style: italic;
  color: var(--lav);
}

.hp-bar-wrap {
  width: clamp(180px, 62vw, 230px);
}

.hp-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  border: 1px solid var(--border);
}

.hp-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--green), #4de3a0);
  transition: transform 0.4s ease, background 0.4s ease;
}

.hp-bar-fill.hit {
  background: linear-gradient(90deg, var(--red), #b63c3c);
}

.hp-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: var(--hint);
  margin-top: 6px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hp-icon { width: 12px; height: 12px; color: var(--hint); }

.boss-tap-wrap {
  position: relative;
  width: clamp(190px, 58vw, 250px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boss-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 110, 229, 0.28), transparent 70%);
  filter: blur(4px);
}

.boss-ring {
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* Кнопка-босс: пет стоит "на арене" без квадратного фона */
.boss-tap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.08s ease;
}

.boss-tap:active {
  transform: scale(0.95);
}

.boss-tap.depleted {
  cursor: not-allowed;
}

.boss-tap.depleted .boss-image {
  filter: grayscale(1) brightness(0.55);
}

.boss-image {
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.55));
}

.boss-image.hit {
  animation: boss-hit 0.15s ease;
}

.boss-image.pet-pulse {
  animation: pet-pulse 0.5s ease;
}

/* Подсветка босса во время ивента — цветная заливка через саму картинку как
   маску (mask-image), поэтому красит только силуэт персонажа, не квадрат
   вокруг. Цвет берётся из event.color (JS ставит через background инлайном). */
.boss-color-overlay {
  position: absolute;
  width: 84%;
  height: 84%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: color;
  opacity: 0;
  background: var(--gold);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: opacity 0.4s ease;
}

.event-active .boss-color-overlay {
  opacity: 0.85;
}

/* Бейдж мутации — иконка активного ивента, приколота к боссу сверху справа.
   top/right раньше были 2% — это угол КВАДРАТНОЙ .boss-tap-wrap, а видимый
   контент (кольцо/свечение/сам питомец) занимает только круглую область
   внутри неё (см. .boss-ring inset:15%) — бейдж визуально "висел в пустом
   углу", оторванный от персонажа (жалоба пользователя "выглядит ужасно").
   Подвинуто ближе к кольцу, чтобы читалось как бейдж НА питомце. */
.mutation-badge {
  position: absolute;
  top: 18%;
  right: 14%;
  width: 40px;
  height: 40px;
  object-fit: contain;
  z-index: 4;
  pointer-events: none;
  border-radius: 50%;
  /* Круглое свечение позади иконки — раньше его не было, только
     drop-shadow по угловатому силуэту кубика, из-за чего бейдж выглядел
     "неровно" на реальном телефоне. Тот же приём, что и у иконки в баннере
     ивента (.event-banner-icon-wrap::before), --event-color теперь ставится
     на :root (см. app.js/renderEvent), поэтому доступен и здесь. */
  background: radial-gradient(circle, color-mix(in srgb, var(--event-color, var(--gold)) 60%, transparent), transparent 72%);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
  animation: mutation-badge-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mutation-badge-in {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Всплывающая надпись с монетами за тап — отплывает вверх от босса и тает */
.coin-popup {
  position: absolute;
  left: 50%;
  top: 22%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 3px;
  transform: translate(-50%, 0);
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.9s ease 0.15s;
}

.coin-popup.rise {
  transform: translate(calc(-50% + var(--dx, 0px)), -60px);
  opacity: 0;
}

.popup-coin-icon {
  width: 13px;
  height: 13px;
  object-fit: contain;
}

/* Удача: x2 — фиолетовый акцент чуть крупнее; x10 — самый заметный, золотой с свечением */
.coin-popup.luck-2 {
  font-size: 17px;
  color: var(--accent-a);
  text-shadow: 0 0 10px rgba(150, 110, 229, 0.65), 0 2px 8px rgba(0, 0, 0, 0.6);
}

.coin-popup.luck-2 .popup-coin-icon {
  width: 15px;
  height: 15px;
}

.coin-popup.luck-10 {
  font-size: 21px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(238, 145, 33, 0.85), 0 2px 10px rgba(0, 0, 0, 0.6);
}

.coin-popup.luck-10 .popup-coin-icon {
  width: 18px;
  height: 18px;
}

@keyframes boss-hit {
  0% { transform: scale(1) translateX(0); }
  40% { transform: scale(0.96) translateX(-4px); }
  100% { transform: scale(1) translateX(0); }
}

@keyframes pet-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.hint {
  color: var(--hint);
  font-size: 13px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tap-power-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
  color: var(--text);
}

/* Плашка-предложение пополнить монеты за Stars — верх вкладки "Кейсы",
   адаптивная (растягивается на всю ширину, переносит текст на узких
   экранах), сам список кейсов идёт сразу под ней в обычном скролле.
   Стиль — по референсу пользователя (скрин кейс-опенинг платформы): тёмная
   синяя карточка, бирка "TELEGRAM STARS", жирный капслок-заголовок, строка
   мини-статов по пакетам и CTA со стрелкой снизу справа. */
.coins-topup-banner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 14px;
  margin-bottom: 16px;
  border-radius: 18px;
  border: 1px solid rgba(63, 116, 224, 0.35);
  background: linear-gradient(160deg, rgba(63, 116, 224, 0.16), var(--surface) 60%);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.coins-topup-banner:active {
  transform: scale(0.98);
}

.coins-topup-banner-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(63, 116, 224, 0.2);
  color: var(--deposit-blue-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.coins-topup-banner-title {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #fff;
}

.coins-topup-banner-hint {
  margin-top: -6px;
  margin-bottom: 2px;
  font-size: 12px;
  color: var(--hint);
}

.coins-topup-banner-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: flex-end;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--deposit-blue-light);
}

.coins-topup-banner-cta .icon {
  width: 14px;
  height: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 10px;
}

.section-title.muted {
  color: var(--hint);
  font-size: 12.5px;
  margin-top: 20px;
}

.profile-history-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-history-toggle span {
  flex: 1;
  text-align: left;
}

.profile-history-chevron {
  width: 16px;
  height: 16px;
  color: var(--hint);
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.profile-history-toggle[aria-expanded="true"] .profile-history-chevron {
  transform: rotate(-90deg);
}

.shop-list, .inventory-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-item, .inventory-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.shop-item-info, .inventory-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shop-item-thumb, .inventory-item-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.shop-item-left, .inventory-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.shop-item-name, .inventory-item-name {
  font-weight: 700;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-desc {
  font-size: 11.5px;
  color: var(--hint);
}

.buy-button, .withdraw-button {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 12.5px;
  background: var(--accent-grad);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(150, 110, 229, 0.35);
  transition: transform 0.1s ease;
}

.buy-button:active, .withdraw-button:active {
  transform: scale(0.96);
}

.buy-button:disabled {
  background: var(--surface-2);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.empty-hint {
  color: var(--hint);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

.cases-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.case-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.case-card:active {
  transform: scale(0.97);
}

.case-icon {
  position: relative;
  width: 100%;
  aspect-ratio: 1.2 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

/* Энергетический ореол за кейсом — как аура вокруг сундука на референсе */
.case-icon::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 145, 33, 0.35), rgba(150, 110, 229, 0.2) 55%, transparent 75%);
  filter: blur(6px);
  animation: case-aura-pulse 3s ease-in-out infinite;
}

@keyframes case-aura-pulse {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

.case-icon-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.case-name {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.25;
}

.case-stats-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  gap: 6px;
}

.case-item-count {
  font-size: 11px;
  color: var(--hint);
  white-space: nowrap;
}

.case-price {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.case-price-free {
  color: var(--green);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Одинокая карточка в последней строке (нечётное число кейсов) растягивается
   на всю ширину вместо пустоты справа от неё. Иконка при этом НЕ растягивается
   вместе с карточкой (у неё width:100% от родителя) — иначе при aspect-ratio
   1.2/1 на весь разворот сетки она станет непропорционально огромной; вместо
   этого ограничиваем её тем же максимумом, что и обычная карточка в 2 колонки. */
.case-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.case-card:last-child:nth-child(odd) .case-icon {
  max-width: 200px;
}

.case-open-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(150, 110, 229, 0.55);
  border-radius: 999px;
  padding: 14px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent-grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(150, 110, 229, 0.35), 0 0 0 4px rgba(150, 110, 229, 0.12);
  transition: transform 0.1s ease;
}

.case-open-button-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-variant-numeric: tabular-nums;
}

.case-open-button-price .chip-coin-img {
  width: 16px;
  height: 16px;
}

.case-open-button:active {
  transform: scale(0.97);
}

.case-open-button:disabled {
  background: var(--surface-2);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.case-open-button.opening {
  animation: case-shake 0.5s ease infinite;
}

/* Кейс FRIENDS: бесплатный, открывается через шаринг мини-аппа, а не за монеты */
.case-share-button {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--green), #1fae63);
  color: #06301c;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(56, 217, 122, 0.35);
  transition: transform 0.1s ease;
}

.case-share-button:active {
  transform: scale(0.97);
}

.case-share-hint {
  color: var(--hint);
  font-size: 12.5px;
  text-align: center;
  margin: 8px 0 0;
}

@keyframes case-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* ===== Полноэкранная анимация открытия кейса ===== */

.case-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 5, 10, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.case-overlay.show {
  opacity: 1;
  pointer-events: auto;
  background: rgba(6, 5, 10, 0.86);
  backdrop-filter: blur(6px);
}

.case-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px;
  width: 100%;
}

.case-overlay-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-overlay-close:active {
  transform: scale(0.94);
}

/* Кейс теперь открывается отдельной страницей (обычный .view), а не
   модалкой с затемнением поверх списка кейсов — по прямому запросу
   пользователя ("у них открывается отдельная страничка, а не сверху меню
   кейсов с затемнением"). Кнопка "Назад" — обычный элемент в потоке
   страницы (не плавающий крестик поверх бэкдропа, бэкдропа больше нет). */
.case-page-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.case-page-back:active {
  transform: scale(0.96);
}

.case-page-back .icon {
  width: 16px;
  height: 16px;
}

/* ===== Профиль игрока ===== */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 8px 0 20px;
}

.profile-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid rgba(150, 110, 229, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.profile-avatar-fallback {
  width: 32px;
  height: 32px;
  color: var(--hint);
}

.profile-name {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--lav);
}

.profile-username {
  font-size: 13px;
  color: var(--hint);
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.profile-stat-card .icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
  margin-bottom: 2px;
}

/* "Любимый кейс" / "Лучший выигрыш" — по мотивам скрина референса
   (страница аккаунта той же кейс-опенинг платформы), но на наших данных:
   считаются на бэкенде из dropHistory (см. routes/api.js/profile), не
   выдуманы. Своей логотип/Steam-привязку/вкладку "Скины" с референса не
   повторял — не применимо к нашей игре. */
.profile-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-highlight-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(150, 110, 229, 0.14), var(--surface) 60%);
  border: 1px solid var(--border);
  overflow: hidden;
}

.profile-highlight-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--hint);
}

.profile-highlight-name {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-highlight-image {
  align-self: center;
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.profile-highlight-button {
  border: none;
  border-radius: 999px;
  padding: 9px;
  font-weight: 800;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--accent-grad);
  color: #fff;
  cursor: pointer;
}

.profile-highlight-button:active {
  transform: scale(0.96);
}

.profile-stat-value {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.profile-stat-label {
  font-size: 11px;
  color: var(--hint);
}

.profile-history-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.profile-history-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: none;
}

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

.profile-history-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-history-case {
  font-size: 11px;
  color: var(--hint);
}

.profile-history-time {
  flex: none;
  font-size: 11px;
  color: var(--hint);
  white-space: nowrap;
}

/* Модалка пополнения монет за Stars — по референсу пользователя (скрин
   депозит-формы кейс-опенинг платформы): тёмная синяя карточка с рамкой,
   бирка-эйброу над жирным капслок-заголовком, квадратная кнопка закрытия
   в углу карточки, крупные строки пакетов с CTA-кнопкой градиентом. */
.deposit-overlay .case-overlay-inner {
  align-items: stretch;
}

.deposit-modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 22px 20px 20px;
  border-radius: 20px;
  border: 1px solid rgba(63, 116, 224, 0.35);
  background: linear-gradient(180deg, #0d1220, #090c15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.deposit-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(63, 116, 224, 0.4);
  background: rgba(63, 116, 224, 0.12);
  color: var(--deposit-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.deposit-close:active {
  transform: scale(0.94);
}

.deposit-eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--deposit-blue-light);
}

.deposit-title {
  margin: 0 0 14px;
  padding-right: 40px;
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 23px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1.1;
  color: #fff;
}

.deposit-hint {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--hint);
}

/* Свободный ввод суммы вместо готовых пакетов (по прямому запросу
   пользователя: "пользователь должен сам выбирать сколько он хочет
   задонатить и ему будет показываться сколько монет он получит") — поле
   ввода в стиле референса ("Например: 625"), живое превью суммы монет
   (см. app.js/refreshCoinsQuote) и одна широкая CTA-кнопка снизу. */
.deposit-field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--hint);
}

.deposit-input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  -moz-appearance: textfield;
}

.deposit-input::placeholder {
  color: var(--hint);
}

.deposit-input:focus {
  outline: none;
  border-color: var(--deposit-blue);
}

.deposit-input::-webkit-outer-spin-button,
.deposit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.deposit-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgba(63, 116, 224, 0.1);
  border: 1px solid rgba(63, 116, 224, 0.3);
}

.deposit-preview-label {
  font-size: 12px;
  color: var(--hint);
}

.deposit-preview-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.deposit-preview-value .chip-coin-img {
  width: 18px;
  height: 18px;
}

.deposit-submit-button {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: linear-gradient(90deg, var(--deposit-blue-dark), var(--deposit-blue));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(63, 116, 224, 0.4);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.deposit-submit-button:active {
  transform: scale(0.98);
}

.deposit-submit-button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

/* Меню кейса — по референсу пользователя (скрин кейс-опенинг платформы):
   заголовок сверху, статичный превью-барабан (case-idle-reel), кнопка
   открытия, и сетка "Возможные призы" снизу. Крейт (.case-box-wrap) в этом
   меню НЕ показывается — появляется отдельно, только в момент самой
   анимации открытия (см. app.js/playCaseOpeningAnimation). */
.case-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  opacity: 1;
  transition: opacity 0.18s ease-out;
}

.case-menu.fade-out {
  opacity: 0;
}

.case-menu-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

/* Мультипликатор открытия (x1/x2/x5/x10) — по прямому запросу пользователя
   ("добавь возможность открывать сразу несколько кейсов"), по стилю
   сегментированной пилюли похоже на референс, но у нас без "молнии/щита/
   звука" — тех фич нет. */
.case-multiplier-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.case-multiplier-button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 8px 0;
  font-weight: 700;
  font-size: 12.5px;
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.case-multiplier-button.active {
  background: var(--accent-grad);
  color: #fff;
}

/* Переключатель скорости прокрутки рулетки (быстро/медленно) — по прямому
   запросу пользователя, та же сегментированная пилюля, что и у множителя. */
.case-speed-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.case-speed-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  border-radius: 999px;
  padding: 8px 0;
  font-weight: 700;
  font-size: 12.5px;
  font-family: inherit;
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.case-speed-button .icon {
  width: 14px;
  height: 14px;
}

.case-speed-button.active {
  background: var(--accent-grad);
  color: #fff;
}

.case-menu-controls {
  width: 100%;
  max-width: 320px;
}

.case-menu-controls .case-open-button,
.case-menu-controls .case-share-button {
  width: 100%;
}

.case-preview-name {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--lav);
}

/* Превью-барабан — непрерывно едущая лента карточек призов (по прямому
   замечанию пользователя: "у нас нет анимации, а у референса есть, она
   красивее") — это НЕ спин при открытии (тот отдельно, #caseReelsGrid),
   а декоративный бегущий ряд, который просто едет по кругу сам по себе,
   пока открыт превью кейса. Затухание по краям — как у настоящего
   спин-барабана (.case-reel-wrap::before/::after), плотные мелкие карточки
   (.prize-card--reel), не крупные как в "Возможные призы" ниже. */
.case-idle-reel-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(22, 20, 26, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(150, 110, 229, 0.3);
  box-shadow: 0 0 0 1px rgba(150, 110, 229, 0.12), inset 0 0 24px rgba(150, 110, 229, 0.08);
  padding: 12px 0;
}

.case-idle-reel-wrap::before,
.case-idle-reel-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  z-index: 2;
  pointer-events: none;
}

.case-idle-reel-wrap::before {
  left: 0;
  background: linear-gradient(90deg, var(--surface), transparent);
}

.case-idle-reel-wrap::after {
  right: 0;
  background: linear-gradient(270deg, var(--surface), transparent);
}

.case-idle-reel-track {
  display: flex;
  gap: 8px;
  padding: 0 8px;
  width: max-content;
  animation: idle-reel-drift 22s linear infinite;
}

@keyframes idle-reel-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); } /* трек продублирован дважды в JS — на -50% цикл бесшовно повторяется */
}

@media (prefers-reduced-motion: reduce) {
  .case-idle-reel-track {
    animation: none;
  }
}

.case-drop-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.case-drop-title {
  font-size: 12px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.case-drop-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

/* Карточка приза — переиспользуется и в превью-барабане, и в сетке
   "Возможные призы". Цветная подсветка за картинкой зависит от типа
   награды: золотая для реальных предметов (петов), фиолетовая для монет —
   имитирует цветные "спотлайты" за иконками с референса, без полноценной
   системы редкости (её у наград в игре нет). */
.prize-card {
  position: relative;
  flex: none;
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 10px;
  border-radius: 14px;
  background: rgba(33, 31, 40, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.prize-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 22%, var(--glow-color), transparent 70%);
  z-index: 0;
}

.prize-card.kind-item {
  --glow-color: rgba(238, 145, 33, 0.45);
}

.prize-card.kind-coins {
  --glow-color: rgba(150, 110, 229, 0.32);
}

/* Свечение по редкости — по прямому запросу пользователя: secret (сейчас
   Гарама, Дракон) — золотое, og (Хедлесс, Слоник, Мяул, Джон Порк) —
   красное. Перекрывает нейтральный kind-item/kind-coins выше (см. db.js/
   ITEMS.tier, app.js/tierGlowClass) — список пока неполный, дальше
   расширится. */
.prize-card.tier-secret {
  --glow-color: rgba(238, 145, 33, 0.55);
  border-color: rgba(238, 145, 33, 0.4);
}

.prize-card.tier-og {
  --glow-color: rgba(229, 72, 77, 0.5);
  border-color: rgba(229, 72, 77, 0.4);
}

/* Компактный вариант — для едущей ленты (плотнее, чтобы в неё помещалось
   больше карточек одновременно, как на референсе), карточки в "Возможные
   призы" остаются крупными (полный .prize-card). */
.prize-card--reel {
  width: 68px;
  padding: 10px 4px 8px;
  gap: 4px;
}

.prize-card--reel .prize-card-image {
  width: 38px;
  height: 38px;
}

.prize-card--reel .prize-card-name {
  font-size: 9.5px;
}

.prize-card-image {
  position: relative;
  z-index: 1;
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.prize-card-name {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Сцена анимации открытия (крейт → взрыв → рулетка → результат) — по
   прямому запросу пользователя выводится ТОЧНО по центру экрана, а не там,
   где случайно оказалась в потоке страницы: fixed на весь вьюпорт, flex-
   центрирование. Показывается только на время анимации (app.js добавляет/
   убирает .hidden), к превью-меню кейса эта сцена отношения не имеет. */
.case-animation-stage {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  animation: case-stage-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Плавное появление сцены анимации целиком (крейт+фон), а не резкий рывок —
   срабатывает автоматически при каждом снятии .hidden (CSS-анимации, в
   отличие от transition, сами перезапускаются при display:none -> flex). */
@keyframes case-stage-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Контейнер под 1/3/5 одновременных крейтов (см. #caseBoxesGrid в HTML) —
   flex-wrap, чтобы при x3/x5 крейты сами раскладывались "в разных частях
   экрана" (по прямому запросу пользователя), а не одной колонкой. Лишние
   слоты (сверх выбранного множителя) скрыты через app.js. Размер одного
   крейта зависит от data-count на самом гриде — чем больше открывается
   разом, тем компактнее каждый, чтобы все влезли на экран одновременно. */
.case-boxes-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.case-box-wrap {
  position: relative;
  width: clamp(180px, min(52vw, 42vh), 280px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-box-wrap.hidden {
  display: none;
}

.case-boxes-grid[data-count="3"] .case-box-wrap {
  width: clamp(110px, min(30vw, 26vh), 170px);
}

.case-boxes-grid[data-count="5"] .case-box-wrap {
  width: clamp(90px, min(24vw, 20vh), 135px);
}

.case-shockwave {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(150, 110, 229, 0.55) 45%, transparent 72%);
  opacity: 0;
}

.case-shockwave.burst {
  animation: shockwave-burst 0.55s ease-out forwards;
}

@keyframes shockwave-burst {
  0% { width: 20px; height: 20px; opacity: 1; }
  100% { width: 360px; height: 360px; opacity: 0; }
}

/* Осколки, разлетающиеся во все стороны в момент взрыва кейса */
.case-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 3px;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 8px currentColor;
  transition: transform 0.65s cubic-bezier(0.15, 0.7, 0.3, 1), opacity 0.65s ease 0.05s;
}

.case-particle.fly {
  transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) rotate(var(--rot)) scale(0.25);
  opacity: 0;
}

.case-box {
  width: 88%;
  height: 88%;
  transform: scale(0);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* "Крейт" — коробка кейса с портретом персонажа на лицевой стороне */
.case-box-crate {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-box-character {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.case-box.appear {
  transform: scale(1);
}

.case-box.wobbling {
  animation: case-wobble 1.1s ease-in-out;
}

@keyframes case-wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-9deg) scale(1.04); }
  30% { transform: rotate(8deg) scale(1.04); }
  45% { transform: rotate(-7deg) scale(1.06); }
  60% { transform: rotate(6deg) scale(1.06); }
  75% { transform: rotate(-4deg) scale(1.08); }
  90% { transform: rotate(2deg) scale(1.08); }
}

.case-box.exploding {
  animation: case-explode 0.4s ease forwards;
}

@keyframes case-explode {
  0% { transform: scale(1.08); opacity: 1; filter: brightness(1) drop-shadow(0 10px 20px rgba(0,0,0,0.5)); }
  45% { transform: scale(1.5); opacity: 1; filter: brightness(2.4) drop-shadow(0 10px 20px rgba(0,0,0,0.5)); }
  100% { transform: scale(2); opacity: 0; filter: brightness(3) drop-shadow(0 10px 20px rgba(0,0,0,0.5)); }
}

/* Контейнер под 1/3/5 одновременных лент (см. #caseReelsGrid в HTML) —
   колонка, каждая лента на всю ширину, друг под другом (по прямому запросу
   пользователя — спин должен идти у каждого кейса в пачке, не только у
   первого). Одиночное открытие использует первый слот, остальные скрыты
   через app.js (тем же .hidden). */
.case-reels-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* Рулетка наград — та же горизонтальная лента предметов, что и на референсе */
.case-reel-wrap {
  position: relative;
  width: clamp(280px, 92vw, 640px);
  height: 112px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.case-reel-wrap.fade-out {
  opacity: 0;
  transform: scale(0.92);
}

.case-reel-wrap::before, .case-reel-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  z-index: 2;
  pointer-events: none;
}

.case-reel-wrap::before {
  left: 0;
  background: linear-gradient(90deg, var(--surface), transparent);
}

.case-reel-wrap::after {
  right: 0;
  background: linear-gradient(270deg, var(--surface), transparent);
}

.case-reel-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-a);
  box-shadow: 0 0 10px var(--accent-a);
  transform: translateX(-50%);
  z-index: 3;
}

.case-reel-pointer::before, .case-reel-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.case-reel-pointer::before { top: -1px; border-top: 7px solid var(--accent-a); }
.case-reel-pointer::after { bottom: -1px; border-bottom: 7px solid var(--accent-a); }

.case-reel-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  transform: translateX(0);
}

.case-reel-track.spinning {
  transition: transform 3.4s cubic-bezier(0.09, 0.82, 0.12, 1);
}

/* Карточка ленты — по референсу пользователя (скрин кейс-опенинг сайта):
   вытянутая плитка, предмет освещён "спотлайтом" сверху (тот же приём, что
   и у .prize-card::before), название прижато к низу в отдельной тёмной
   плашке-подложке, а не просто текстом на общем фоне. */
.case-reel-chip {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 92px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  font-weight: 700;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.case-reel-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, var(--glow-color, rgba(150, 110, 229, 0.35)), transparent 65%);
  z-index: 0;
}

.case-reel-chip .chip-coin-img {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin-top: 12px;
  margin-bottom: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.case-reel-chip span {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 4px 3px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Фиолетовое свечение для монет в реальной рулетке спина — по прямому
   запросу пользователя (уже было в превью-барабане/"Возможные призы", тут
   не хватало). */
.case-reel-chip.kind-coins {
  --glow-color: rgba(150, 110, 229, 0.45);
}

.case-reel-chip.kind-item {
  --glow-color: rgba(238, 145, 33, 0.45);
}

.case-reel-chip.tier-secret {
  --glow-color: rgba(238, 145, 33, 0.55);
  border-color: rgba(238, 145, 33, 0.4);
}

.case-reel-chip.tier-og {
  --glow-color: rgba(229, 72, 77, 0.5);
  border-color: rgba(229, 72, 77, 0.4);
}

.case-reel-chip.chip-win {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(238, 145, 33, 0.55);
  animation: chip-win-pulse 0.6s ease 0.1s;
}

@keyframes chip-win-pulse {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.15); }
}

.case-result {
  width: min(88vw, 380px);
  background: var(--surface);
  border: 1px solid rgba(150, 110, 229, 0.4);
  border-radius: 22px;
  padding: clamp(20px, 5vw, 28px) clamp(18px, 6vw, 36px);
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(150, 110, 229, 0.2);
  transform: scale(0.85);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
}

.case-result.show {
  transform: scale(1);
  opacity: 1;
}

.case-result-title {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.case-result-amount {
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  overflow-wrap: break-word;
  /* Зернистая текстура поверх градиента — как на "98% RTP" у референса */
  background-image:
    linear-gradient(135deg, var(--gold), #ffb44d),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: cover, 120px 120px;
  background-blend-mode: normal, overlay;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.case-result.show .case-result-amount {
  animation: result-amount-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}

.result-coin-img {
  width: 28px;
  height: 28px;
  vertical-align: -6px;
  margin-right: 2px;
}

/* Сетка результатов массового открытия (x2/x5/x10) — вместо одной крупной
   суммы показываем все N результатов сразу, каждый той же карточкой, что и
   в "Возможные призы". */
.case-result-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
}

.case-result-total {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-family: "Unbounded", "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.case-result-total .chip-coin-img {
  width: 18px;
  height: 18px;
}

@keyframes result-amount-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.case-close-button {
  margin-top: 14px;
  border: none;
  border-radius: 999px;
  padding: 11px 28px;
  font-weight: 700;
  font-size: 13px;
  background: var(--accent-grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(150, 110, 229, 0.35);
}

.case-close-button:active {
  transform: scale(0.96);
}

/* "Продать"/"Крутить" на окне дропа — только когда выпал предмет (не
   монеты), по прямому запросу пользователя. Продать — сдаёт предмет обратно
   за монеты (см. db.js/sellItem), Крутить — просто возвращает в меню кейса,
   предмет остаётся в инвентаре. */
.case-item-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}

.case-sell-button,
.case-spin-again-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 11px 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.case-sell-button {
  border: 1px solid rgba(150, 110, 229, 0.4);
  background: rgba(150, 110, 229, 0.12);
  color: var(--lav);
}

.case-spin-again-button {
  border: none;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(150, 110, 229, 0.35);
}

.case-sell-button:active,
.case-spin-again-button:active {
  transform: scale(0.96);
}

.case-sell-button .case-open-button-price {
  font-size: 11px;
}

.error {
  position: fixed;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  bottom: 96px;
  background: rgba(229, 72, 77, 0.14);
  border: 1px solid rgba(229, 72, 77, 0.35);
  color: #ffb0b3;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  z-index: 20;
  box-shadow: var(--shadow-lg);
}

/* Нижний таббар — как сегментированный pill-контрол на референсе */
.tabbar {
  position: fixed;
  bottom: 14px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 5;
  display: flex;
  gap: 4px;
  background: rgba(22, 20, 26, 0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--hint);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

.tab.active {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 4px 14px rgba(150, 110, 229, 0.4);
}

/* ===== Подстройка под очень узкие экраны ===== */
/* Было 340px — реальные телефоны (360-393px, самые массовые Android-ширины)
   не попадали под это сжатие вообще, из-за чего "ЭНЕРГИЯ 100/100" и другие
   значения в карточках статистики обрезались многоточием ("4/1...") на
   самой обычной ширине экрана — найдено при полном прогоне через
   playwright-cli. Расширил порог, чтобы компактный режим реально покрывал
   типичные телефоны, а не только совсем узкие. */
@media (max-width: 400px) {
  .app {
    padding: 12px;
    padding-bottom: 98px;
  }

  .brand-text {
    font-size: 13px;
  }

  .topbar {
    gap: 6px;
  }

  .stat {
    padding: 8px 8px;
    gap: 6px;
  }

  .stat-icon {
    width: 15px;
    height: 15px;
  }

  .stat-value {
    font-size: 13px;
  }

  .stat-label {
    font-size: 9px;
  }

  .cases-list {
    gap: 8px;
  }

  .case-card {
    padding: 12px 8px 10px;
  }

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

  .case-card:last-child:nth-child(odd) .case-icon {
    max-width: 160px;
  }

  .event-banner {
    padding: 7px 10px;
    gap: 6px;
  }

  .event-banner-icon-wrap {
    width: 28px;
    height: 28px;
  }

  .event-banner-brand {
    font-size: 14px;
  }

  .event-banner-multiplier {
    font-size: 12.5px;
  }

  .event-banner-timer-wrap {
    font-size: 10px;
  }

  .mutation-badge {
    width: 32px;
    height: 32px;
  }
}
