﻿/* ===== SpiderGift · базовые токены и каркас =====
   Палитра: чернильно-фиолетовая ночь, шёлк-фиолет для интерактива,
   янтарь зарезервирован под звёзды-валюту и больше ни под что. */
:root {
  --bg: #07060b;
  --bg-soft: #0b0911;
  --surface: #110e1a;
  --surface-2: #171324;
  --surface-3: #201b30;
  --stroke: rgba(181, 137, 255, .10);
  --stroke-strong: rgba(181, 137, 255, .24);
  --silk: rgba(181, 137, 255, .16);

  --text: #f4f1fb;
  --text-dim: #9b93b5;
  --text-mute: #635c7d;

  --accent: #7c3dff;
  --accent-soft: #b589ff;
  --green: #3ddc97;
  --red: #ff4d6d;
  --gold: #ffc93c;
  --purple: #b589ff;

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --r-full: 999px;

  --pad: 16px;
  --header-h: 64px;
  --tab-h: 78px;

  /* Сколько сверху и снизу занимает интерфейс телеграма. Числа кладёт tg.js:
     в полноэкранном режиме кнопки телеграма висят прямо над страницей, а
     env(safe-area-inset-*) внутри его webview отдаёт нули. env() остаётся
     запасным вариантом для обычного браузера. */
  --tg-top: 0px;
  --tg-bottom: 0px;
  --safe-top: max(var(--tg-top), env(safe-area-inset-top));
  --safe-bottom: max(var(--tg-bottom), env(safe-area-inset-bottom));

  --shadow-1: 0 6px 24px rgba(0, 0, 0, .45);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);

  --rarity-common: #6f6a8c;
  --rarity-rare: #4d8dff;
  --rarity-epic: #b589ff;
  --rarity-legendary: #ffc93c;
  --rarity-mythic: #ff4d6d;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

/* Geologica — только числа, множители и заголовки: у неё узкие техничные
   формы, которые держат длинные суммы и хорошо читаются крупно */
.num, .page-title, .section-head h2, .case-price, .crash-mult, .up-chance,
.prize-name, .prize-price, .dbl-cell, .p-slot-mult, .card-price {
  font-family: 'Geologica', 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: var(--accent-soft); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- фон: глубина и свечение ---------- */
.bg-aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* отдельный слой: иначе iOS перерисовывает градиенты на каждом кадре
     прокрутки и не успевает отрисовать карточки */
  transform: translateZ(0);
}
/* подвижные пятна выключены — фон теперь статический градиент */
.aura { display: none; }
.aura-1 {
  width: 320px; height: 320px;
  top: -120px; left: -80px;
  background: radial-gradient(circle, rgba(124, 61, 255, .5), transparent 70%);
  animation: float-a 18s ease-in-out infinite;
}
.aura-2 {
  width: 280px; height: 280px;
  top: 30%; right: -110px;
  background: radial-gradient(circle, rgba(181, 137, 255, .34), transparent 70%);
  animation: float-b 22s ease-in-out infinite;
}
.aura-3 {
  width: 340px; height: 340px;
  bottom: -140px; left: 10%;
  background: radial-gradient(circle, rgba(88, 40, 180, .34), transparent 70%);
  animation: float-c 26s ease-in-out infinite;
}
/* Статический градиент вместо паутины: тёплое фиолетовое свечение сверху,
   чернильная глубина внизу. Ничего не двигается — фон не отвлекает от игры. */
.bg-aura::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 78% -8%, rgba(124, 61, 255, .34), transparent 62%),
    radial-gradient(90% 55% at 6% 12%, rgba(181, 137, 255, .16), transparent 66%),
    radial-gradient(130% 80% at 50% 108%, rgba(60, 26, 120, .34), transparent 70%),
    linear-gradient(180deg, #0c0918 0%, #08070f 46%, #06050b 100%);
}
.grain {
  position: absolute;
  inset: 0;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- каркас ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: calc(var(--header-h) + var(--safe-top));
  padding: 0 var(--pad);
  padding-top: var(--safe-top);
  /* Без backdrop-filter: размывать на всю ширину каждый кадр прокрутки дорого,
     а на почти чёрном фоне разницы не видно — хватает плотного градиента. */
  background: linear-gradient(180deg, rgba(8,8,11,.985) 62%, rgba(8,8,11,0));
}
.header-right { display: flex; align-items: center; gap: 8px; }

.logo-btn { display: grid; place-items: center; width: 44px; height: 44px; }
/* у спрайта паука фон залит чёрным, а не прозрачный — screen его убирает */
.logo-btn img {
  width: 40px; height: 40px;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 14px rgba(181, 137, 255, .5));
}
.logo-btn:active img { transform: scale(.92); }

.btn-topup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 6px;
  border-radius: var(--r-full);
  background: #15161d;
  border: 1px solid var(--stroke);
  font-weight: 600;
  font-size: 15px;
  transition: transform .18s var(--ease-spring), box-shadow .25s;
}
.btn-topup .plus {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 12px;
  background: linear-gradient(145deg, #4d9dff, #2f6bff);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(47,107,255,.5);
}
.btn-topup:active { transform: scale(.95); }

.avatar {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  /* аватар в цветах приложения: фиолетовое свечение вместо зелёного */
  color: #1b0b36;
  background: linear-gradient(145deg, #c9a6ff, #7c3dff);
  box-shadow: 0 6px 18px rgba(124, 61, 255, .4);
  overflow: hidden;
  transition: transform .18s var(--ease-spring);
}
/* С фотографией подложка не нужна: если снимок не квадратный, она вылезает
   полосами по бокам. Цветной остаётся только фон под буквой. */
.avatar.has-photo { background: var(--surface-2); }
/* Абсолютом, а не просто 100%: в шапке аватар — это <button>, и внутри кнопки
   высота в процентах не разрешается — фото вписывалось по высоте и оставляло
   полосы по бокам. */
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.avatar:active { transform: scale(.94); }

.view {
  position: relative;
  z-index: 1;
  /* снизу место под нижнюю панель вместе с её отступом под домашнюю полоску —
     без --safe-bottom последние карточки уезжали под панель */
  padding: 4px var(--pad) calc(var(--tab-h) + var(--safe-bottom) + 28px);
  /* за вычетом шапки: иначе короткая страница всё равно прокручивается */
  min-height: calc(100vh - var(--header-h) - var(--safe-top));
  animation: view-in .32s var(--ease-out);
}

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  /* матовость оставили, но дешевле: меньше радиус и без saturate */
  background: rgba(13, 13, 18, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--stroke);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 18px;
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 600;
  transition: color .2s, background .25s, transform .18s var(--ease-spring);
}
.tab-ic { width: 24px; height: 24px; fill: currentColor; transition: transform .25s var(--ease-spring); }
.tab.active {
  color: #fff;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.tab.active .tab-ic { transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 0 8px rgba(255,255,255,.35)); }
.tab:active { transform: scale(.93); }

/* ---------- загрузчик ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity .4s ease, visibility .4s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-logo img {
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 28px rgba(181, 137, 255, .55));
  animation: pulse-glow 2.2s ease-in-out infinite;
}
.boot-bar {
  width: 150px; height: 4px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.boot-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: linear-gradient(90deg, #3d8bff, #a45cff);
  animation: boot-slide 1.1s ease-in-out infinite;
}
.boot-text { color: var(--text-mute); font-size: 13px; margin: 0; }

/* ---------- типографика ---------- */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; }
.page-title { font-size: 27px; line-height: 1.15; }
.page-sub { margin: 8px 0 0; color: var(--text-mute); font-size: 15px; line-height: 1.35; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 16px;
}
.section-head .ic {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  font-size: 18px;
  filter: drop-shadow(0 0 10px rgba(255,255,255,.25));
}
.section-head h2 { font-size: 24px; }
/* иконка-картинка у заголовка раздела (иконки категорий кейсов) */
.section-pic {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
}
.section-pic img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .55));
}
/* кристалл у «Магических стикерпаков» вытянутый: делаем чуть меньше остальных
   и приподнимаем, чтобы он не сидел ровно на базовой линии заголовка */
.section-pic.pic-mythic {
  width: 28px; height: 28px;
  transform: translateY(-11px);
}

.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
