/* Дизайн-система и переменные */
:root {
  --font-primary: 'Outfit', sans-serif;
  --font-secondary: 'Roboto', sans-serif;
  
  --bg-app: #090a0f;
  --bg-card: rgba(22, 24, 32, 0.7);
  --bg-card-hover: rgba(28, 31, 42, 0.9);
  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: #ffffff;
  --text-secondary: #8a8f9f;
  --text-muted: #525768;
  
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --neon-orange: #ff6a00;
  --neon-orange-glow: rgba(255, 106, 0, 0.3);
  --neon-cyan-glow: rgba(0, 242, 254, 0.25);
  
  --grad-balance: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --grad-orange: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
  --grad-neon-orange: linear-gradient(135deg, #ff6a00 0%, #ee0979 100%);
  
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --shadow-card-glow: 0 0 15px rgba(0, 242, 254, 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Сброс стилей для гигиены PWA на iOS */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Отключает вспышку при нажатии в Safari */
}

html, body {
  position: fixed; /* Предотвращает rubber-banding (прокрутку всей страницы) */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Отключаем копирование и контекстные меню */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Контейнер приложения */
.app-container {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
  padding-left: env(safe-area-inset-left, 16px);
  padding-right: env(safe-area-inset-right, 16px);
}

/* Шапка приложения */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.header-logo h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #a5abbf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Карточка баланса */
.global-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
}

.global-balance:active {
  transform: scale(0.97);
}

.balance-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-family: var(--font-secondary);
}

.balance-value {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--grad-balance);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--neon-cyan-glow));
}

/* Прокручиваемая область контента */
.app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Включает плавный инерционный скролл на iOS */
  padding: 24px 8px;
}

/* Отключение индикатора прокрутки для минимализма (опционально) */
.scrollable::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* Группа игр */
.game-group {
  margin-bottom: 32px;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
}

.group-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

.group-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Карточки игр */
.games-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 16px;
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-smooth);
}

/* Эффекты при наведении (на десктопе) и тапе (на мобильных) */
@media (hover: hover) {
  .game-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card), 0 5px 15px rgba(0, 0, 0, 0.2);
  }
  
  .game-card:hover .game-card-arrow {
    transform: translateX(4px);
    color: var(--text-primary);
  }
}

.game-card:active {
  transform: scale(0.98) translateY(0);
  background: rgba(255, 255, 255, 0.02);
}

/* Иконки карточек */
.game-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  position: relative;
}

.game-card-icon svg {
  width: 26px;
  height: 26px;
  color: #ffffff;
}

/* Неоновые градиенты и свечения для иконок */
.game-card-icon.neon-orange {
  background: var(--grad-neon-orange);
  box-shadow: 0 0 15px var(--neon-orange-glow);
}

.game-card-info {
  flex: 1;
}

.game-card-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.game-card-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-secondary);
  line-height: 1.35;
}

.game-card-arrow {
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.game-card-arrow svg {
  width: 20px;
  height: 20px;
}

/* Футер */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.version-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-secondary);
}

/* Кнопка обновления */
.update-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--neon-cyan);
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: var(--transition-smooth);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.05);
}

.update-btn:active {
  transform: scale(0.95);
  background: rgba(0, 242, 254, 0.2);
}

.update-icon {
  width: 14px;
  height: 14px;
}

/* Анимация вращения иконки при показе обновления */
.update-btn:not(.hidden) .update-icon {
  animation: spin 3s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
