:root {
  font-family: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  color: var(--textPrimary);
  
  /* ===== PREMIUM LIQUID GLASS DESIGN TOKENS ===== */
  
  /* Background Colors */
  --bg0: #050B1A;
  --bg1: #071D3A;
  
  /* Surface Tints (for glass effect) */
  --surface: rgba(255, 255, 255, 0.06);
  --surfaceStrong: rgba(255, 255, 255, 0.10);
  
  /* Strokes */
  --stroke: rgba(255, 255, 255, 0.14);
  --strokeWeak: rgba(255, 255, 255, 0.08);
  
  /* Text Colors */
  --textPrimary: rgba(255, 255, 255, 0.92);
  --textSecondary: rgba(255, 255, 255, 0.68);
  --textDisabled: rgba(255, 255, 255, 0.4);
  
  /* Accent Colors */
  --accentCyan: #45D7FF;
  --accentViolet: #A78BFA;
  --dangerCoral: #FF5B6B;
  --successMint: #39E6B0;
  --warnGold: #F7C94B;
  
  /* Legacy Colors (for compatibility) */
  --text: var(--textPrimary);
  --text-muted: var(--textSecondary);
  --primary: var(--accentViolet);
  --primary-strong: #B78BFA;
  --accent: var(--accentCyan);
  --accent-strong: #65E7FF;
  --success: var(--successMint);
  --warning: var(--warnGold);
  --danger: var(--dangerCoral);
  --bg: var(--bg0);
  --bg-soft: rgba(7, 29, 58, 0.7);
  
  /* Radius */
  --rCard: 28px;
  --rInner: 20px;
  --rPill: 16px;
  --rButton: 18px;
  
  /* Legacy Radius (for compatibility) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: var(--rPill);
  
  /* Glass Blur (adaptive by component size) */
  --glassBlur-sm: 18px;
  --glassBlur-md: 22px;
  --glassBlur-lg: 26px;
  --glassBlur-xl: 28px;
  
  /* Legacy Blur (for compatibility) */
  --blur-sm: var(--glassBlur-sm);
  --blur-md: var(--glassBlur-md);
  --blur-lg: var(--glassBlur-lg);
  --blur-xl: var(--glassBlur-xl);
  
  /* Shadows */
  --shadowLarge: 0 18px 60px rgba(0, 0, 0, 0.35);
  --shadowSmall: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadowInset: inset 0 1px 0 rgba(0, 0, 0, 0.25);
  
  /* Legacy Shadows (for compatibility) */
  --shadow-1: var(--shadowSmall);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.18);
  --shadow-3: var(--shadowLarge);
  --shadow-4: 0 12px 48px rgba(0, 0, 0, 0.3);
  --shadow-inset-light: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --shadow-inset-dark: var(--shadowInset);
  --shadow-glow-primary: 0 0 20px rgba(167, 139, 250, 0.4);
  --shadow-glow-accent: 0 0 20px rgba(69, 215, 255, 0.4);
  
  /* Borders (Legacy for compatibility) */
  --border-subtle: var(--strokeWeak);
  --border-medium: var(--stroke);
  --border-strong: rgba(255, 255, 255, 0.28);
  --border: var(--stroke);
  --border-accent: rgba(69, 215, 255, 0.4);
  
  /* Spacing (8px grid) */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;
  --spacing-3xl: 32px;
  
  /* Legacy (for compatibility) */
  --glass: var(--surface);
  --surface-tint-light: rgba(255, 255, 255, 0.18);
  --surface-tint-medium: rgba(255, 255, 255, 0.14);
  --surface-tint-dark: rgba(255, 255, 255, 0.1);
  --surface-base-dark: rgba(5, 6, 13, 0.75);
  --surface-base-medium: rgba(10, 11, 21, 0.8);
  
  /* Telegram WebApp viewport and safe-area variables */
  --tg-viewport-height: 100vh;
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
}

html {
  background-color: #05060d;
  color: var(--text);
  height: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  /* Полная блокировка закрытия приложения при свайпе */
  overscroll-behavior-y: none !important;
  -webkit-overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
  -webkit-overscroll-behavior: none !important;
}

* {
  box-sizing: border-box;
}

/* Принудительная тёмная тема для iOS и других устройств */
input, button, select, textarea {
  color: inherit;
  background-color: inherit;
  font-family: inherit;
}

/* Отключаем автоматическую подстройку цвета в iOS Safari */
@media (prefers-color-scheme: light) {
  html, body {
    background-color: #05060d !important;
    color: var(--text) !important;
  }
}

body {
  margin: 0;
  min-height: var(--tg-viewport-height, 100vh);
  padding: 10px;
  padding-top: calc(10px + var(--tg-safe-area-inset-top, 0px));
  padding-bottom: calc(100px + var(--tg-safe-area-inset-bottom, 0px));
  /* Premium gradient background */
  background: 
    linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 50%, var(--bg0) 100%),
    radial-gradient(circle at 20% 20%, rgba(69, 215, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--textPrimary);
  display: flex;
  flex-direction: column;
  position: static; /* Changed from relative to avoid positioning context issues with fixed nav */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Полная блокировка закрытия приложения при свайпе */
  overscroll-behavior-y: none !important;
  -webkit-overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
  -webkit-overscroll-behavior: none !important;
  overflow-y: auto;
  touch-action: pan-y pinch-zoom;
  -webkit-touch-callout: none;
}

/* На мобильных не блокируем overscroll полностью, чтобы скролл работал */
@media (pointer: coarse) {
  body, html {
    overscroll-behavior-y: auto !important;
    -webkit-overscroll-behavior-y: auto !important;
  }
}

/* Десктоп: скролл и overscroll */
@media (hover: hover) and (pointer: fine) {
  body {
    overflow-y: auto;
    overscroll-behavior-y: auto !important;
    -webkit-overscroll-behavior-y: auto !important;
    overscroll-behavior: auto !important;
    -webkit-overscroll-behavior: auto !important;
  }
  
  html {
    overflow-y: auto;
    overscroll-behavior-y: auto !important;
    -webkit-overscroll-behavior-y: auto !important;
    overscroll-behavior: auto !important;
    -webkit-overscroll-behavior: auto !important;
  }
}

.content-shell {
  width: min(1100px, 100%);
  margin: 10px auto 10px;
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bg-grid,
.orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.4;
}

.orb {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
}

.orb-one {
  background: var(--primary);
  top: -60px;
  right: 10%;
}

.orb-two {
  background: linear-gradient(135deg, #5d7fff, #7f9bff);
  bottom: -120px;
  left: 5%;
}

.orb-three {
  background: linear-gradient(135deg, #7f9bff, #9fb3ff);
  top: 40%;
  left: 70%;
}

/* ===== PREMIUM LIQUID GLASS COMPONENTS ===== */

/* GlassCard - Premium glass card component */
.glass-card,
.glass {
  position: relative;
  z-index: 1;
  /* Premium liquid glass effect */
  background: 
    /* Vertical gradient tint (top lighter, bottom darker) */
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.04) 100%
    ),
    /* Base surface tint */
    var(--surface);
  /* External stroke */
  border: 1px solid var(--stroke);
  border-radius: var(--rCard);
  padding: var(--spacing-xl);
  /* Backdrop blur (adaptive) */
  backdrop-filter: blur(var(--glassBlur-lg)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-lg)) saturate(180%);
  /* Premium shadows with internal stroke */
  box-shadow: 
    var(--shadowLarge),
    var(--shadowSmall),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  color: var(--textPrimary);
  overflow: hidden;
}

/* Specular highlight overlay */
.glass-card::before,
.glass::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 60%
  );
  pointer-events: none;
  border-radius: var(--rCard) var(--rCard) 0 0;
  z-index: 0;
}

/* Subtle grain/noise overlay */
.glass-card::after,
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0px,
      transparent 1px,
      transparent 2px,
      rgba(255, 255, 255, 0.02) 3px
    );
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

.glass-card > *,
.glass > * {
  position: relative;
  z-index: 2;
}

/* GlassCard variants */
.glass-card[data-size="sm"],
.glass[data-variant="card"] {
  border-radius: var(--rInner);
  padding: var(--spacing-lg);
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
}

.glass-card[data-size="xs"],
.glass[data-variant="listRow"] {
  border-radius: var(--rInner);
  padding: var(--spacing-md) var(--spacing-lg);
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  box-shadow: var(--shadowSmall);
}

/* Редкость скинов: вертикальный маркер + цветная рамка (считывается периферийным зрением) */
.rarity-common {
  border: 3px solid #8FA3B8 !important;
}
.rarity-rare {
  border: 3px solid #E6B65C !important;
}
.rarity-unique {
  border: 3px solid #ff4d4d !important;
}
.rarity-label {
  font-size: 0.65rem;
  font-weight: 500;
  margin-top: 0.15rem;
  display: block;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}
.rarity-label.rarity-common { color: #8FA3B8; }
.rarity-label.rarity-rare { color: #E6B65C; }
.rarity-label.rarity-unique { color: #ff4d4d; }

/* Legacy glass variants for compatibility */
.glass[data-variant="panel"] {
  border-radius: var(--rCard);
  padding: var(--spacing-xl);
  backdrop-filter: blur(var(--glassBlur-lg)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-lg)) saturate(180%);
}

/* ===== GLASS TOP BAR / HEADER ===== */

.app-header,
.app-footer {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
}

.app-header {
  padding: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
  flex-wrap: wrap;
  gap: var(--spacing-md);
  /* Glass top bar style */
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  border: 1px solid var(--stroke);
  border-radius: var(--rInner);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
  border-radius: var(--rInner) var(--rInner) 0 0;
  z-index: 0;
}

.app-header > * {
  position: relative;
  z-index: 1;
}

.app-header + .content-shell {
  margin-top: 10px;
}

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

.logo .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5d7fff, var(--primary));
  box-shadow: 0 0 20px rgba(93, 127, 255, 0.6);
}

.primary-nav {
  display: none !important; /* Hide old navigation - use bottom-nav instead */
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: 0.2s;
  font-size: 0.85rem;
  white-space: nowrap;
}

.primary-nav a.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.primary-nav a.admin-link {
  color: var(--accent);
  border-color: rgba(93, 127, 255, 0.3);
  background: rgba(93, 127, 255, 0.1);
}

.primary-nav a.admin-link:hover,
.primary-nav a.admin-link.active {
  color: var(--accent-light);
  border-color: rgba(127, 153, 255, 0.4);
  background: rgba(93, 127, 255, 0.2);
}

/* ===== GLASS BUTTON COMPONENT ===== */

.btn {
  font-family: inherit;
  border: none !important;
  border-radius: var(--rButton);
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: var(--textPrimary);
  /* Base glass button style */
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  border: 1px solid var(--stroke) !important;
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
  border-radius: var(--rButton) var(--rButton) 0 0;
  z-index: 0;
}

.btn > * {
  position: relative;
  z-index: 1;
}

.btn:focus,
.btn:active,
.btn:focus-visible {
  outline: none !important;
}

/* Primary Glass Button (with cyan accent) */
.btn.primary {
  background: 
    linear-gradient(180deg, rgba(69, 215, 255, 0.12) 0%, rgba(69, 215, 255, 0.06) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  border: 1px solid rgba(69, 215, 255, 0.3) !important;
  color: var(--textPrimary);
  box-shadow: 
    var(--shadowSmall),
    0 0 20px rgba(69, 215, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.primary:hover:not(:disabled) {
  background: 
    linear-gradient(180deg, rgba(69, 215, 255, 0.16) 0%, rgba(69, 215, 255, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surface);
  border-color: rgba(69, 215, 255, 0.4) !important;
  box-shadow: 
    var(--shadowSmall),
    0 0 24px rgba(69, 215, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn.primary:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
  opacity: 0.9;
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--surface);
  border-color: var(--strokeWeak) !important;
  box-shadow: none;
  color: var(--textDisabled);
}

/* Secondary Glass Button */
.btn.secondary {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  color: var(--textPrimary);
  border: 1px solid var(--stroke) !important;
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover:not(:disabled) {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%),
    var(--surfaceStrong);
  border-color: var(--stroke) !important;
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn.secondary:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
  opacity: 0.9;
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
}

.btn.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--surface);
  border-color: var(--strokeWeak) !important;
  box-shadow: none;
  color: var(--textDisabled);
}

/* Destructive Glass Button (coral accent) */
.btn.destructive,
.btn.warning {
  background: 
    linear-gradient(180deg, rgba(255, 91, 107, 0.12) 0%, rgba(255, 91, 107, 0.06) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  border: 1px solid rgba(255, 91, 107, 0.3) !important;
  color: var(--textPrimary);
  box-shadow: 
    var(--shadowSmall),
    0 0 20px rgba(255, 91, 107, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.destructive:hover:not(:disabled),
.btn.warning:hover:not(:disabled) {
  background: 
    linear-gradient(180deg, rgba(255, 91, 107, 0.16) 0%, rgba(255, 91, 107, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surface);
  border-color: rgba(255, 91, 107, 0.4) !important;
  box-shadow: 
    var(--shadowSmall),
    0 0 24px rgba(255, 91, 107, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn.destructive:active:not(:disabled),
.btn.warning:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
  opacity: 0.9;
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
}

/* Accent button (legacy compatibility) */
.btn.accent {
  background: 
    linear-gradient(180deg, rgba(69, 215, 255, 0.12) 0%, rgba(69, 215, 255, 0.06) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  border: 1px solid rgba(69, 215, 255, 0.3) !important;
  color: var(--textPrimary);
  box-shadow: 
    var(--shadowSmall),
    0 0 20px rgba(69, 215, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Ghost Glass Button (minimal style) */
.btn.ghost {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%),
    var(--surface);
  color: var(--textPrimary);
  border: 1px solid var(--strokeWeak) !important;
  outline: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn.ghost:hover:not(:disabled) {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surfaceStrong);
  border-color: var(--stroke) !important;
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn.ghost:focus,
.btn.ghost:active,
.btn.ghost:focus-visible {
  outline: none !important;
  border-color: var(--stroke) !important;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%),
    var(--surfaceStrong);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

.btn.subtle {
  padding: 10px 14px;
}

.btn.icon-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
}

.app-footer {
  padding: 18px 24px;
  justify-content: space-between;
  margin-bottom: 100px; /* Add space for fixed bottom navigation */
  position: relative;
  z-index: 1; /* Ensure footer is below navigation */
}

.footer-badges {
  display: flex;
  gap: 8px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl);
  /* Uses GlassCard base style */
  border-radius: var(--rCard);
  padding: var(--spacing-xl);
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-top-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-top-row .avatar-stack {
  flex-shrink: 0;
}

.hero-top-row .bonus-card {
  flex-shrink: 0;
  margin-left: auto;
  min-width: 160px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avatar-stack {
  position: relative;
}

.avatar-stack img {
  width: 112px;
  height: 112px;
  border-radius: 22px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
}

.avatar-stack {
  height: 112px;
}

.avatar-stack .pulse {
  position: absolute;
  inset: -10px;
  border-radius: 39px;
  border: 2px solid rgba(127, 93, 255, 0.5);
  animation: pulse 2.8s infinite;
}

.gradient-text {
  background: linear-gradient(120deg, #ffffff, var(--primary-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.referral-share-btn {
  background: linear-gradient(120deg, #5dade2, #3498db);
  color: #fff;
  box-shadow: 0 10px 25px rgba(52, 152, 219, 0.35);
  width: 100%;
  max-width: 100%;
}

.referral-share-btn:hover:not(:disabled) {
  background: linear-gradient(120deg, #3498db, #2980b9);
  box-shadow: 0 12px 30px rgba(52, 152, 219, 0.5);
  transform: translateY(-2px);
}

/* На мобильных устройствах делаем кнопку равной ширине ownership-alert, если он есть */
@media (max-width: 640px) {
  .hero-badges {
    width: 100%;
  }
  
  .referral-share-btn {
    width: 100%;
  }
}

/* Bonus Card */
.bonus-card {
  position: relative;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, #ff7b5d, #ffbe5d, #7f5dff, #ff7b5d);
  background-size: 300% 300%;
  animation: gradient-shift 4s ease infinite;
  overflow: hidden;
}

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

/* Анимированный градиент никнейма (скины с skin_data.animated = true) */
/* Когда у элемента кастомный градиент — не вешаем .gradient-text, чтобы анимация работала (profile/player_view) */
.username-gradient-animated {
  background-size: 200% 200% !important;
  background-repeat: no-repeat !important;
  background-position: 0% 50%;
  animation: gradient-flow 5s ease infinite;
  -webkit-animation: gradient-flow 5s ease infinite;
}
/* Никнейм в профиле и просмотре игрока: гарантированная анимация градиента */
.hero-info h1.username-gradient-animated {
  animation: gradient-flow 5s ease infinite !important;
  -webkit-animation: gradient-flow 5s ease infinite !important;
}
/* Никнейм на маркете рабов: анимация name_color (класс на span внутри h3) */
/* transform: translateZ(0) — отдельный слой, чтобы анимация перерисовывалась внутри overflow:hidden (Android/WebKit) */
.market-info h3 .username-gradient-animated {
  background-size: 200% 200% !important;
  background-repeat: no-repeat !important;
  background-position: 0% 50%;
  animation: gradient-flow 5s ease infinite !important;
  -webkit-animation: gradient-flow 5s ease infinite !important;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@-webkit-keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.bonus-card-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 123, 93, 0.3) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.bonus-card-content {
  background: linear-gradient(135deg, rgba(5, 6, 13, 0.85), rgba(10, 11, 21, 0.9));
  border-radius: 18px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 86px;
  box-sizing: border-box;
  min-width: 160px;
  width: auto;
}

.bonus-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bonus-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 123, 93, 0.2), rgba(255, 190, 93, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  animation: icon-bounce 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.bonus-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}

.bonus-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.bonus-percent {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff7b5d, #ffbe5d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  white-space: nowrap;
}

.bonus-stats {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.bonus-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.bonus-stat-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

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

.bonus-stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.bonus-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 640px) {
  .bonus-card-content {
    padding: 8px 10px;
    gap: 8px;
    height: 86px;
  }
  
  .bonus-main {
    gap: 8px;
  }
  
  .bonus-icon-wrap {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  
  .bonus-title {
    font-size: 0.65rem;
  }
  
  .bonus-percent {
    font-size: 1rem;
  }
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06)),
    linear-gradient(135deg, rgba(5, 6, 13, 0.65), rgba(10, 11, 21, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.pill.glow {
  background: 
    linear-gradient(180deg, rgba(167, 139, 250, 0.15) 0%, rgba(167, 139, 250, 0.08) 100%),
    var(--surface);
  border: 1px solid rgba(167, 139, 250, 0.4);
  box-shadow: 
    var(--shadowSmall),
    0 0 16px rgba(167, 139, 250, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.pill.success {
  color: var(--successMint);
  border-color: rgba(57, 230, 176, 0.3);
}

.pill.warning {
  background: 
    linear-gradient(180deg, rgba(247, 201, 75, 0.12) 0%, rgba(247, 201, 75, 0.06) 100%),
    var(--surface);
  border-color: rgba(247, 201, 75, 0.3);
  color: var(--warnGold);
}

.pill.linkish {
  border: 1px dashed var(--stroke);
  cursor: pointer;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-chip {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 16px;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06)),
    linear-gradient(135deg, rgba(5, 6, 13, 0.7), rgba(10, 11, 21, 0.75));
  backdrop-filter: blur(35px) saturate(180%);
  -webkit-backdrop-filter: blur(35px) saturate(180%);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: var(--text);
}

.stat-chip:hover {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.1)),
    linear-gradient(135deg, rgba(5, 6, 13, 0.75), rgba(10, 11, 21, 0.8));
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 
    0 6px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.stat-chip h3 {
  margin: 8px 0;
  font-size: 22px;
}

.capacity-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.capacity-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.popularity-chip {
  background: linear-gradient(135deg, rgba(255, 123, 93, 0.15), rgba(127, 93, 255, 0.15));
  border-color: rgba(255, 123, 93, 0.3);
}

.popularity-chip h3 {
  color: var(--accent);
}

.popularity-chip small {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Стили для блока владельца */
.ownership-alert {
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(255, 107, 107, 0.15) !important;
  border: 1px solid rgba(255, 107, 107, 0.3) !important;
}

.ownership-alert > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ownership-alert > div > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.owner-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.owner-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.owner-link:hover {
  opacity: 0.8;
  color: var(--accent);
}

.owner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 107, 107, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: block;
}

.owner-link:hover .owner-avatar {
  transform: scale(1.05);
  border-color: rgba(255, 107, 107, 0.5);
}

.ownership-alert p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.ownership-alert .muted {
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  line-height: 1.3;
}

.ownership-alert .chained-info {
  color: #ffc107;
}

.ownership-alert button {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .ownership-alert {
    padding: 0.75rem;
  }
  
  .ownership-alert > div {
    flex-direction: column;
    align-items: stretch;
  }
  
  .ownership-alert > div > div:first-child {
    width: 100%;
  }
  
  .ownership-alert button {
    width: 100%;
  }
}

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

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

.section-title {
  margin-bottom: 12px;
}

.section-title.compact {
  margin-bottom: 0;
}

.chart-line {
  margin-top: 20px;
  height: 130px;
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
  border-radius: 18px;
  overflow: hidden;
}

.chart-line span {
  position: absolute;
  inset: 10px 10px 10px 10px;
  background: url("data:image/svg+xml,%3Csvg width='240' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 70 Q60 20 120 40 T238 10' stroke='%23ff7b5d' stroke-width='4' fill='transparent' stroke-linecap='round'/%3E%3C/svg%3E")
    center/cover no-repeat;
  opacity: 0.8;
}

.legend {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.legend .dot.primary {
  background: var(--primary);
}

.legend .dot.accent {
  background: var(--accent);
}

.status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-list li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-list strong {
  font-size: 26px;
}

.ref-card {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.mechanics-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mechanics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.mechanic-card {
  min-height: 140px;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s, border-color 0.2s;
}

.mechanic-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
}

.layout-split {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.character-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.25s;
}

.character-card:hover {
  transform: translateY(-6px);
}

/* Компактные карточки рабов */
.slaves-carousel {
  width: 100%;
}

.card-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
}

/* Гарантируем 2 колонки на десктопе (такое же отображение, как на мобильной) */
@media (min-width: 641px) {
  .card-grid-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

.character-card-mini {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.character-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px rgba(127, 93, 255, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card-avatar-large {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.card-avatar-large img {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
}

.card-avatar-large .chain-overlay {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background-image: url('/static/images/chain-overlay1.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  border-radius: 12px;
}

.card-info-vertical {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.card-info-vertical .card-name {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.card-info-vertical .card-job {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.card-info-vertical .card-price {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.card-info-vertical .card-income {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.card-info-vertical .card-chained {
  font-size: 0.7rem;
  color: #ffc107;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.card-info-vertical .slave-buy-btn-vertical {
  margin-top: 4px;
  padding: 6px 12px;
  font-size: 0.7rem;
  width: 100%;
}

.slave-count {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.no-slaves {
  grid-column: 1 / -1;
  padding: 1.5rem;
  text-align: center;
}

.no-slaves .btn {
  margin-top: 0.75rem;
}

/* Навигация карусели */
.carousel-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-default);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover:not(:disabled) {
  background: rgba(127, 93, 255, 0.2);
  border-color: var(--primary);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 50px;
  text-align: center;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-number {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-default);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-number:hover {
  background: rgba(127, 93, 255, 0.2);
  border-color: var(--primary);
}

.page-number.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrades {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.characters footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chip-list li {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.attack-panel {
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 14px;
}

.attack-actions {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 1.5rem;
}

.page-hero > div:first-child {
  flex: 1;
  min-width: 0;
}

.page-hero .eyebrow {
  margin-bottom: 0.5rem;
}

.page-hero h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.page-hero > div:first-child > p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.market-header-block {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  padding: 0;
}

.market-header-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.market-header-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.market-header-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-height: 180px;
  padding: 1.5rem;
}

.market-refresh-text-overlay {
  font-size: 1rem;
  color: var(--text-default);
  text-align: center;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px 18px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  align-self: center;
  margin-bottom: 1rem;
}

.market-refresh-text-overlay strong {
  color: #7f5dff;
  font-weight: 600;
}

.market-balance-section {
  padding: 1rem;
  margin: 0.5rem auto;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.hero-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.hero-controls .btn {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 10px 16px;
}

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

.highlight-card {
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(7, 8, 20, 0.7));
}

.highlight-card .income {
  font-size: 20px;
  color: var(--accent);
}

/* Podium styles */
.podium-section {
  margin: 20px 0 10px 0;
}

.rating-podium-image {
  position: relative;
  min-height: 400px;
  overflow: hidden;
  padding: 0;
  border-radius: var(--rCard);
  margin-bottom: 0.25rem;
  /* Unified overlay over art (blue/violet tint + light haze/gradient) */
}

.rating-podium-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(180deg, rgba(69, 215, 255, 0.08) 0%, rgba(167, 139, 250, 0.06) 50%, transparent 100%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.2) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
  border-radius: var(--rCard);
}

.podium-image-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.podium-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.podium-overlay-container {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--spacing-xl);
  box-sizing: border-box;
}

.podium-player {
  position: absolute;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.podium-player::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 150%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0.2) 70%, transparent 85%);
  filter: blur(20px);
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
}

.podium-player::after {
  content: '';
  position: absolute;
  top: 60%;
  left: 45%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 120%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.15) 80%, transparent 90%);
  filter: blur(25px);
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
}

.podium-player-first:hover {
  transform: translateX(-50%);
}

.podium-player-second:hover {
  transform: translateX(-50%);
}

.podium-player-third:hover {
  transform: translateX(50%);
}

.podium-player-avatar {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  margin-bottom: 0px;
}

.podium-player-first .podium-player-avatar {
  border: 3px solid #ffd700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.podium-player-second .podium-player-avatar {
  border: 3px solid #87ceeb;
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.5);
}

.podium-player-third .podium-player-avatar {
  border: 3px solid #cd7f32;
  box-shadow: 0 4px 12px rgba(205, 127, 50, 0.5);
}

.podium-player-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  border-radius: 12px;
}

/* Обёртка аватарки + рамки на пьедестале: размер как у аватарки */
.podium-avatar-frame-wrap {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.podium-avatar-frame-wrap .podium-player-avatar,
.podium-avatar-frame-wrap .podium-player-avatar-placeholder {
  position: relative;
  z-index: 1;
  width: 70px;
  height: 70px;
  border: none !important;
  border-radius: 12px !important;
}

.podium-avatar-frame-wrap .podium-frame-img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  height: 110%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 3;
  pointer-events: none;
  border: none;
  outline: none;
}

.podium-player-info {
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 120px;
  margin-top: -18px;
}

.podium-player-name {
  margin: -12px 0 4px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.podium-player-first .podium-player-name {
  background: linear-gradient(135deg, #ffd700, #ffed4e, #ffd700, #ffaa00);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gold-shimmer 3s ease infinite;
  text-shadow: none;
  font-weight: 700;
}

.podium-player-second .podium-player-name {
  background: linear-gradient(135deg, #c0c0c0, #87ceeb, #e8e8e8, #5dade2, #c0c0c0, #a0a0a0);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: silver-shimmer 3s ease infinite;
  text-shadow: none;
  font-weight: 700;
}

.podium-player-third .podium-player-name {
  background: linear-gradient(135deg, #cd7f32, #e6a85c, #cd7f32, #a0522d);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: bronze-shimmer 3s ease infinite;
  text-shadow: none;
  font-weight: 700;
}

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

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

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

.podium-player-balance {
  margin: 0 0 2px 0;
  font-size: 0.75rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.podium-player-income {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.podium-player-first .podium-player-income {
  color: #ffd700;
  text-shadow: 0 1px 2px rgba(255, 215, 0, 0.8);
}

.podium-player-second .podium-player-income {
  color: #87ceeb;
  text-shadow: 0 1px 2px rgba(135, 206, 235, 0.8);
}

.podium-player-third .podium-player-income {
  color: #cd7f32;
  text-shadow: 0 1px 2px rgba(205, 127, 50, 0.8);
}

/* Позиционирование игроков на пьедесталах */
.podium-player-first {
  bottom: 45%;
  left: 50%;
  transform: translateX(-50%);
}

.podium-player-second {
  bottom: 35%;
  left: 20%;
  transform: translateX(-50%);
}

.podium-player-third {
  bottom: 33%;
  right: 20%;
  transform: translateX(50%);
}

.podium-player-info {
  margin-top: 12px;
}

.rating-refresh-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.25rem 0;
  margin: 0.25rem 0;
}

@media (max-width: 768px) {
  .rating-podium-image {
    min-height: 300px;
  }
  
  .podium-overlay-container {
    min-height: 300px;
  }
  
  .podium-player-avatar {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .podium-avatar-frame-wrap {
    width: 50px;
    height: 50px;
  }

  .podium-avatar-frame-wrap .podium-player-avatar,
  .podium-avatar-frame-wrap .podium-player-avatar-placeholder {
    width: 50px;
    height: 50px;
  }
  
  .podium-player-info {
    padding: 6px 10px;
    min-width: 100px;
  }
  
  .podium-player-name {
    font-size: 0.8rem;
    max-width: 120px;
  }
  
  .podium-player-balance {
    font-size: 0.7rem;
  }
  
  .podium-player-income {
    font-size: 0.75rem;
  }
  
  .podium-player-first {
    bottom: 45%;
  }
  
  .podium-player-second {
    bottom: 35%;
    left: 18%;
  }
  
  .podium-player-third {
    bottom: 33%;
    right: 18%;
  }
}

.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  padding-bottom: 20px;
}

.podium-card {
  text-align: center;
  position: relative;
  flex: 1;
  max-width: 220px;
  padding: 20px 16px;
  padding-bottom: 60px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
  min-width: 0;
  overflow: visible;
}

.podium-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.podium-first:hover {
  transform: translateY(-48px);
}

.podium-second:hover {
  transform: translateY(-28px);
}

.podium-third:hover {
  transform: translateY(-18px);
}

.podium-place {
  font-size: 2.5rem;
  margin-bottom: 8px;
  line-height: 1;
}

.podium-first {
  order: 2;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.15), rgba(7, 8, 20, 0.8));
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.2);
  margin-bottom: 0;
  transform: translateY(-40px);
}

.podium-second {
  order: 1;
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.15), rgba(7, 8, 20, 0.8));
  border: 2px solid rgba(192, 192, 192, 0.3);
  box-shadow: 0 8px 30px rgba(192, 192, 192, 0.15);
  margin-bottom: 0;
  transform: translateY(-20px);
}

.podium-third {
  order: 3;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.15), rgba(7, 8, 20, 0.8));
  border: 2px solid rgba(205, 127, 50, 0.3);
  box-shadow: 0 8px 30px rgba(205, 127, 50, 0.15);
  margin-bottom: 0;
  transform: translateY(-10px);
}

.podium-base {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-radius: 0 0 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.podium-base-first {
  height: 40px;
  bottom: 0;
  background: linear-gradient(180deg, 
    rgba(255, 215, 0, 0.4) 0%,
    rgba(255, 215, 0, 0.25) 20%,
    rgba(255, 215, 0, 0.15) 50%,
    rgba(255, 215, 0, 0.08) 80%,
    rgba(255, 215, 0, 0.02) 100%);
  border-top: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 0 0 20px 20px;
  box-shadow: 
    0 0 30px rgba(255, 215, 0, 0.3),
    0 0 60px rgba(255, 215, 0, 0.15),
    0 0 90px rgba(255, 215, 0, 0.08);
}

.podium-base-second {
  height: 25px;
  bottom: 0;
  background: linear-gradient(180deg, 
    rgba(192, 192, 192, 0.3) 0%,
    rgba(192, 192, 192, 0.18) 20%,
    rgba(192, 192, 192, 0.1) 50%,
    rgba(192, 192, 192, 0.05) 80%,
    rgba(192, 192, 192, 0.02) 100%);
  border-top: 1px solid rgba(192, 192, 192, 0.3);
  border-radius: 0 0 20px 20px;
  box-shadow: 
    0 0 20px rgba(192, 192, 192, 0.2),
    0 0 40px rgba(192, 192, 192, 0.1);
}

.podium-base-third {
  height: 18px;
  bottom: 0;
  background: linear-gradient(180deg, 
    rgba(205, 127, 50, 0.3) 0%,
    rgba(205, 127, 50, 0.18) 20%,
    rgba(205, 127, 50, 0.1) 50%,
    rgba(205, 127, 50, 0.05) 80%,
    rgba(205, 127, 50, 0.02) 100%);
  border-top: 1px solid rgba(205, 127, 50, 0.3);
  border-radius: 0 0 20px 20px;
  box-shadow: 
    0 0 15px rgba(205, 127, 50, 0.2),
    0 0 30px rgba(205, 127, 50, 0.1);
}

.podium-card .leader-avatar {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin-bottom: 12px;
  border-width: 3px;
}

.podium-first .leader-avatar {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.podium-second .leader-avatar {
  border-color: rgba(192, 192, 192, 0.5);
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.2);
}

.podium-third .leader-avatar {
  border-color: rgba(205, 127, 50, 0.5);
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.2);
}

.leader-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

.podium-card h3 {
  margin: 8px 0 4px;
  font-size: 0.95rem;
}

.podium-card .income {
  font-size: 18px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.3px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  flex-wrap: nowrap;
  justify-content: center;
}

.podium-card .eyebrow {
  font-size: 0.7rem;
}

.podium-card .muted {
  font-size: 0.7rem;
}

@media (max-width: 640px) {
  .podium-container {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    padding-bottom: 20px;
  }
  
  .podium-card {
    max-width: none;
    flex: 1;
    padding: 12px 8px;
    padding-bottom: 50px;
    min-width: 0;
    overflow: visible;
  }
  
  .podium-base {
    display: block;
  }
  
  .podium-place {
    font-size: 1.5rem;
  }
  
  .podium-card .leader-avatar {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
  }
  
  .podium-card h3 {
    font-size: 0.9rem;
    margin: 4px 0 2px;
  }
  
  .podium-card .income {
    font-size: 16px;
    max-width: 100%;
    overflow: hidden;
  }
  
  .podium-card .eyebrow {
    font-size: 0.7rem;
  }
  
  .podium-card .muted {
    font-size: 0.75rem;
  }
  
  .podium-first {
    transform: translateY(-25px);
  }
  
  .podium-second {
    transform: translateY(-12px);
  }
  
  .podium-third {
    transform: translateY(-5px);
  }
  
  .podium-first:hover {
    transform: translateY(-30px);
  }
  
  .podium-second:hover {
    transform: translateY(-17px);
  }
  
  .podium-third:hover {
    transform: translateY(-10px);
  }
  
  .podium-base-first {
    height: 30px;
    bottom: 0;
  }
  
  .podium-base-second {
    height: 20px;
    bottom: 0;
  }
  
  .podium-base-third {
    height: 15px;
    bottom: 0;
  }
}

.rating-board {
  padding: 0;
  overflow: hidden;
  margin-top: 0.25rem;
  opacity: 1 !important;
  transform: none !important;
}

.rating-row {
  display: grid;
  grid-template-columns: 50px 1fr 100px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: none;
  font: inherit;
}

.rating-row:last-child {
  border-bottom: none;
}

.rating-row.head {
  color: var(--textSecondary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  /* Glass panel for header */
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%);
  border-bottom: 1px solid var(--stroke);
  border-radius: var(--rInner) var(--rInner) 0 0;
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rating-row:not(.head) {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  /* Subtle alternating tint for rhythm */
}

.rating-row:not(.head):nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.rating-row:not(.head):hover {
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  border-left: 2px solid var(--stroke);
  transform: translateX(2px);
}

.rating-row .player {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-width: 0;
  overflow: hidden;
}

.rating-row .player p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--textPrimary);
}

.rating-row .income {
  text-align: right;
  font-weight: 700;
  color: var(--accentCyan);
  font-size: 0.95rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.3px;
  max-width: 100%;
  overflow: hidden;
  justify-content: flex-end;
  /* Enhanced contrast for income numbers */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.rating-row.head span:last-child {
  text-align: right;
}

.rating-row.current-user {
  background: 
    linear-gradient(180deg, rgba(69, 215, 255, 0.2) 0%, rgba(69, 215, 255, 0.15) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glassBlur-sm)) saturate(180%);
  border-left: 3px solid var(--accentCyan);
  box-shadow: var(--shadowSmall), inset 0 0 0 1px rgba(69, 215, 255, 0.2);
}

.rating-row.separator {
  padding: 8px 20px;
  pointer-events: none;
}

.rating-row.separator .dots {
  color: var(--text-muted);
  font-size: 1.2rem;
  letter-spacing: 4px;
}

.you-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
  font-weight: 600;
  vertical-align: middle;
}

.avatar-s {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-s.avatar-img {
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

/* Список рейтинга: все аватарки одного размера (42px) */
.rating-list-avatar-wrap {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}
.rating-list-avatar-wrap .avatar-s,
.rating-list-avatar-wrap .rating-list-avatar-placeholder {
  position: relative;
  z-index: 1;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px;
  min-height: 42px;
  border: none !important;
  border-radius: 14px !important;
}
.rating-list-avatar-wrap .rating-list-frame-img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  height: 110%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 3;
  pointer-events: none;
  border: none;
  outline: none;
  border-radius: 14px;
}
.rating-row .player .avatar-s.rating-list-avatar-img,
.rating-row .player .rating-list-avatar-placeholder {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px;
  min-height: 42px;
  flex-shrink: 0;
}

.leader-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.donate-card {
  text-align: center;
  background: linear-gradient(180deg, rgba(127, 93, 255, 0.08), rgba(5, 6, 13, 0.8));
}

.donate-card h2 {
  margin: 8px 0 4px;
}

.perks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.perk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perk-list li::before {
  content: "✦";
  margin-right: 8px;
  color: var(--accent);
}

dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(420px, 90vw);
}

/* Улучшенный backdrop для модальных окон */
dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-content header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 12px;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 8px 12px;
}

.icon.close {
  font-size: 22px;
  line-height: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
  color: var(--textSecondary);
  margin: 0 0 4px;
  font-weight: 500;
}

.muted {
  color: var(--textSecondary);
  margin: 0;
}

.ref-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.ref-link code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.ref-link button {
  flex-shrink: 0;
  background: rgba(127, 93, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.ref-link button:hover {
  background: rgba(127, 93, 255, 0.4);
}

code {
  font-family: "JetBrains Mono", monospace;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  animation: fade 2.2s ease forwards;
  z-index: 10;
}

[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  15%,
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.25);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@media (max-width: 900px) {
  .app-header,
  .app-footer,
  .content-shell {
    width: 100%;
  }

  .layout-split {
    grid-template-columns: 1fr;
  }

  .page-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.25rem;
  }

  .page-hero h1 {
    font-size: 1.3rem;
  }

  .hero-controls .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 640px) {
  body {
    padding: 8px;
    padding-bottom: 100px !important; /* Ensure space for fixed nav */
    position: static !important; /* Don't create positioning context */
  }
  
  html {
    position: relative !important;
    height: 100% !important;
    overflow-x: hidden !important;
  }

  .app-header,
  .app-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .app-header .logo {
    margin-bottom: 8px;
  }

  .primary-nav {
    display: none !important; /* Hide old navigation on mobile too */
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  .primary-nav a {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .hero-meta {
    gap: 12px;
  }
  
  .hero-top-row {
    gap: 10px;
  }
  
  .hero-top-row .bonus-card {
    margin-left: auto;
    max-width: calc(50% - 5px);
    flex: 0 0 auto;
    min-width: 140px;
  }
  
  .bonus-card-content {
    min-width: 140px;
    padding: 8px 16px;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .rating-row {
    grid-template-columns: 30px 1fr 90px;
  }

  .section-title h1,
  .section-title h2 {
    font-size: 1.3rem;
  }

  .section-title p {
    font-size: 0.85rem;
  }

  .hero-panel {
    padding: 1rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-chip {
    padding: 0.75rem;
  }

  .stat-chip h3 {
    font-size: 1.1rem;
  }

  .mechanics-grid {
    grid-template-columns: 1fr;
  }

  .mechanic-card {
    padding: 1rem;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* Отступ сверху только на мобильных устройствах (touch-устройства) */
@media (hover: none) and (pointer: coarse) {
  .app-header {
    margin-top: 100px;
  }

  .app-header + .content-shell {
    margin-top: 10px !important;
  }

  .content-shell {
    margin-top: 100px;
  }
}

/* ===== AUTH FORMS ===== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  position: relative;
  overflow: visible;
}

.input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.input-group input:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.input-group input:focus {
  background: rgba(127, 93, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(127, 93, 255, 0.15), 0 4px 20px rgba(127, 93, 255, 0.1);
}

.input-group .input-icon {
  position: absolute;
  right: 1rem;
  top: 2.4rem;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.3s;
}

.input-group input:focus + .input-icon {
  opacity: 0.7;
}

.auth-error {
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #ff6b81;
  font-size: 0.875rem;
  text-align: center;
}

.auth-success {
  background: rgba(75, 225, 160, 0.1);
  border: 1px solid rgba(75, 225, 160, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--success);
  font-size: 0.875rem;
  text-align: center;
}

.auth-submit {
  margin-top: 0.5rem;
  padding: 1rem 2rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(127, 93, 255, 0.3);
}

.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(127, 93, 255, 0.4);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-link a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.input-status {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  min-height: 1.4rem;
  line-height: 1.4;
  overflow: visible;
  transition: all 0.2s ease;
}

.input-status.checking {
  color: var(--text-muted);
}

.input-status.success {
  color: var(--success);
}

.input-status.error {
  color: #ff6b81;
}

.input-group input.input-valid {
  border-color: var(--success);
}

.input-group input.input-invalid {
  border-color: #ff6b81;
}

/* Стили для страницы мини-игр */
.minigames-section {
  margin-top: 1.5rem;
}

.minigames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.minigame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.minigame-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.minigame-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.minigame-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.minigame-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1.5rem 0;
  flex: 1;
}

.minigame-btn {
  width: 100%;
  margin-top: auto;
  font-size: 1rem;
  padding: 14px 24px;
}

@media (max-width: 480px) {
  .minigames-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .minigame-card {
    padding: 1.5rem;
  }
  
  .minigame-icon {
    font-size: 3rem;
  }
  
  .minigame-title {
    font-size: 1.3rem;
  }
  
  .minigame-description {
    font-size: 0.85rem;
  }
}

/* Стили для игры 2048 */
.game-score {
  display: flex;
  gap: 20px;
  margin-top: 1rem;
  justify-content: center;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.score-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.game-info {
  margin-bottom: 1.5rem;
  text-align: center;
}

.game-instructions {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.game-container {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.game-board {
  position: relative;
  width: 320px;
  height: 320px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 16px;
  padding: 10px;
  box-sizing: border-box;
  touch-action: none; /* Отключаем обработку жестов браузером для предотвращения скролла страницы */
  overflow: hidden; /* Предотвращаем прокрутку содержимого */
  -webkit-user-select: none; /* Предотвращаем выделение текста */
  user-select: none;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  height: 100%;
}

.grid-row {
  display: contents;
}

.grid-cell {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  aspect-ratio: 1;
}

.tile-container {
  position: absolute;
  top: 10px;
  left: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  pointer-events: none;
  touch-action: none; /* Полностью отключаем обработку касаний для контейнера плиток */
}

.tile {
  position: absolute;
  /* Ширина и высота плитки = (100% - 3*gap) / 4, где gap = 10px */
  width: calc((100% - 30px) / 4);
  height: calc((100% - 30px) / 4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 8px;
  transition: top 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.15s ease-out,
              opacity 0.15s ease-out;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  will-change: top, left, transform;
}

.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.3rem; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.3rem; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.3rem; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.1rem; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.1rem; box-shadow: 0 0 20px rgba(237, 194, 46, 0.5); }

.game-message {
  margin-top: 1.5rem;
  padding: 1.5rem;
  text-align: center;
  display: none;
}

.game-message.game-won,
.game-message.game-over {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 16px;
}

.game-message.game-won {
  background: rgba(75, 225, 160, 0.15);
  border: 1px solid rgba(75, 225, 160, 0.3);
}

.game-message.game-over {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.game-message p {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.game-message.game-won p {
  color: #4be1a0;
}

.game-message.game-over p {
  color: #ff6b6b;
}

@media (max-width: 480px) {
  .game-board {
    width: 280px;
    height: 280px;
  }
  
  .tile {
    font-size: 1.2rem;
  }
  
  .tile-128,
  .tile-256,
  .tile-512 {
    font-size: 1rem;
  }
  
  .tile-1024,
  .tile-2048 {
    font-size: 0.9rem;
  }
  
  .game-score {
    gap: 12px;
  }
  
  .score-item {
    padding: 6px 12px;
  }
  
  .score-value {
    font-size: 1rem;
  }
}

/* ===== GLASS TAB BAR COMPONENT ===== */

.bottom-nav {
  position: fixed !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 24px) !important;
  max-width: min(1100px, calc(100% - 24px)) !important;
  /* Premium glass tab bar */
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%),
    var(--surface);
  backdrop-filter: blur(var(--glassBlur-md)) saturate(180%) !important;
  -webkit-backdrop-filter: blur(var(--glassBlur-md)) saturate(180%) !important;
  border: 1px solid var(--stroke) !important;
  border-radius: var(--rInner) !important;
  padding: var(--spacing-md) var(--spacing-lg) !important;
  margin: 0 !important;
  box-shadow: var(--shadowLarge), var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  display: flex !important;
  gap: var(--spacing-sm) !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  z-index: 2147483647 !important;
  -webkit-transform: translateX(-50%) translateZ(0) !important;
  transform: translateX(-50%) translateZ(0) !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
  will-change: transform !important;
  isolation: isolate !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  overflow: hidden;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
  border-radius: var(--rInner) var(--rInner) 0 0;
  z-index: 0;
}

.bottom-nav > * {
  position: relative;
  z-index: 1;
}

.bottom-nav a {
  text-decoration: none !important;
  color: var(--textSecondary) !important;
  padding: var(--spacing-sm) var(--spacing-md) !important;
  border-radius: var(--rPill) !important;
  border: 1px solid transparent !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 !important;
  min-width: 0 !important;
  min-height: 44px !important;
  -webkit-tap-highlight-color: transparent !important;
  position: relative;
}

.bottom-nav .nav-icon {
  width: 24px !important;
  height: 24px !important;
  object-fit: contain !important;
  opacity: 0.7 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.bottom-nav a:hover .nav-icon,
.bottom-nav a:active .nav-icon {
  opacity: 0.9 !important;
  transform: scale(1.05) !important;
}

.bottom-nav a.active .nav-icon {
  opacity: 1 !important;
}

.bottom-nav a:hover,
.bottom-nav a:active {
  border-color: var(--strokeWeak) !important;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%),
    var(--surface) !important;
}

.bottom-nav a.active {
  border-color: var(--stroke) !important;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surfaceStrong) !important;
  color: var(--textPrimary) !important;
  /* Soft highlight indicator */
  box-shadow: 
    0 0 16px rgba(69, 215, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.bottom-nav a.admin-link .nav-icon {
  opacity: 0.8 !important;
  filter: sepia(1) saturate(1.5) hue-rotate(0deg) !important;
}

.bottom-nav a.admin-link:hover .nav-icon,
.bottom-nav a.admin-link:active .nav-icon {
  opacity: 1 !important;
  filter: sepia(1) saturate(1.5) hue-rotate(0deg) !important;
  transform: scale(1.1) !important;
}

.bottom-nav a.admin-link.active .nav-icon {
  opacity: 1 !important;
  filter: sepia(1) saturate(1.5) hue-rotate(0deg) !important;
}

.bottom-nav a.admin-link {
  border-color: rgba(167, 139, 250, 0.3) !important;
  background: 
    linear-gradient(180deg, rgba(167, 139, 250, 0.08) 0%, rgba(167, 139, 250, 0.04) 100%),
    var(--surface) !important;
}

.bottom-nav a.admin-link:hover,
.bottom-nav a.admin-link:active,
.bottom-nav a.admin-link.active {
  border-color: rgba(167, 139, 250, 0.4) !important;
  background: 
    linear-gradient(180deg, rgba(167, 139, 250, 0.12) 0%, rgba(167, 139, 250, 0.06) 100%),
    var(--surfaceStrong) !important;
  box-shadow: 
    0 0 16px rgba(167, 139, 250, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

/* Ensure content doesn't overlap with fixed nav */
.content-shell {
  padding-bottom: 20px !important;
}

/* Beta test badge */
.beta-badge {
  text-align: center;
  padding: 8px 16px;
  margin: 0 auto 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

.beta-badge p {
  margin: 0;
}

/* Ensure bottom-nav is visible on all screen sizes */
@media (min-width: 641px) {
  .bottom-nav {
    position: fixed !important;
    bottom: 24px !important; /* Floating above bottom edge */
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 24px) !important;
    max-width: min(1100px, calc(100% - 24px)) !important;
    display: flex !important;
    z-index: 2147483647 !important;
  }
}

@media (max-width: 640px) {
  .bottom-nav {
    bottom: 20px !important;
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    padding: var(--spacing-sm) var(--spacing-xs) !important;
    gap: var(--spacing-xs) !important;
    border-radius: var(--rInner) !important;
  }

  .bottom-nav a {
    padding: 10px 8px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .bottom-nav .nav-icon {
    width: 22px !important;
    height: 22px !important;
  }

  .content-shell {
    padding-bottom: 15px !important;
  }
  
  .beta-badge {
    padding: 6px 12px;
    font-size: 0.7rem;
    margin-bottom: 4px;
  }
  
  /* Ensure body doesn't interfere with fixed nav */
  body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* Дополнительная защита от закрытия приложения на мобильных устройствах */
@media (hover: none) and (pointer: coarse) {
  html, body {
    overscroll-behavior-y: none !important;
    -webkit-overscroll-behavior-y: none !important;
    overscroll-behavior: none !important;
    -webkit-overscroll-behavior: none !important;
    /* Блокируем все жесты закрытия, но разрешаем прокрутку и масштабирование */
    touch-action: pan-y pinch-zoom !important;
    -webkit-touch-callout: none !important;
  }
}