:root {
  /* Typography — keep as is */
  font-family: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  color: var(--textPrimary);

  /* ===== LIQUID GLASS 2.0 (THIN + NEON) ===== */

  /* Background base */
  --bg0: #04050B;
  --bg1: #060A18;
  --bg2: #0B1A3A;

  /* Surfaces (thin glass) */
  --surface: rgba(255, 255, 255, 0.045);
  --surfaceStrong: rgba(255, 255, 255, 0.075);

  /* Strokes */
  --strokeWeak: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.14);
  --strokeStrong: rgba(255, 255, 255, 0.20);

  /* Text */
  --textPrimary: rgba(255, 255, 255, 0.92);
  --textSecondary: rgba(255, 255, 255, 0.68);
  --textDisabled: rgba(255, 255, 255, 0.40);

  /* Neon accents */
  --accentCyan: #2EF2FF;
  --accentViolet: #B18CFF;
  --accentPink: #FF4DDA;

  --dangerCoral: #FF4D6D;
  --successMint: #2FFFC1;
  --warnGold: #FFD166;

  /* Compatibility aliases (do not remove) */
  --text: var(--textPrimary);
  --text-muted: var(--textSecondary);

  --primary: var(--accentViolet);
  --primary-strong: #C2A6FF;

  --accent: var(--accentCyan);
  --accent-strong: #67F7FF;

  --success: var(--successMint);
  --warning: var(--warnGold);
  --danger: var(--dangerCoral);

  --bg: var(--bg0);
  --bg-soft: rgba(6, 10, 24, 0.78);

  /* Radius (keep values to avoid layout shifts) */
  --rCard: 28px;
  --rInner: 20px;
  --rPill: 16px;
  --rButton: 18px;

  /* Legacy Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: var(--rPill);

  /* Glass blur (keep moderate for mobile perf) */
  --glassBlur-sm: 16px;
  --glassBlur-md: 20px;
  --glassBlur-lg: 24px;
  --glassBlur-xl: 28px;

  /* Thin glass variables */
  --glass-bg: rgba(255, 255, 255, 0.040);
  --glass-bg-strong: rgba(255, 255, 255, 0.070);

  /* Fallback (no backdrop-filter) — more opaque for readability */
  --glass-bg-fallback: rgba(7, 9, 20, 0.88);
  --glass-bg-strong-fallback: rgba(7, 9, 20, 0.94);

  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-highlight: rgba(255, 255, 255, 0.10);

  --glass-blur: 14px;
  --glass-saturate: 160%;

  /* Legacy blur aliases */
  --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.40);
  --shadowSmall: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadowInset: inset 0 1px 0 rgba(0, 0, 0, 0.25);

  /* Legacy shadows */
  --shadow-1: var(--shadowSmall);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-3: var(--shadowLarge);
  --shadow-4: 0 12px 48px rgba(0, 0, 0, 0.34);
  --shadow-inset-light: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  --shadow-inset-dark: var(--shadowInset);

  --shadow-glow-primary: 0 0 26px rgba(177, 140, 255, 0.28);
  --shadow-glow-accent: 0 0 26px rgba(46, 242, 255, 0.26);

  /* Borders (legacy) */
  --border-subtle: var(--strokeWeak);
  --border-medium: var(--stroke);
  --border-strong: rgba(255, 255, 255, 0.28);
  --border: var(--stroke);
  --border-accent: rgba(46, 242, 255, 0.42);

  /* Spacing (8px grid) — keep values */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;
  --spacing-3xl: 32px;

  /* Legacy surface aliases */
  --glass: var(--surface);
  --surface-tint-light: rgba(255, 255, 255, 0.16);
  --surface-tint-medium: rgba(255, 255, 255, 0.12);
  --surface-tint-dark: rgba(255, 255, 255, 0.08);
  --surface-base-dark: rgba(5, 6, 13, 0.78);
  --surface-base-medium: rgba(10, 11, 21, 0.84);

  /* Telegram Mini Apps viewport & safe-area */
  --tg-viewport-height: 100vh;
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
}

@supports (height: 100dvh) {
  :root {
    --tg-viewport-height: 100dvh;
  }
}

/* iOS safe-area fallback (Telegram may also provide these via JS) */
:root {
  --tg-safe-area-inset-top: env(safe-area-inset-top, 0px);
  --tg-safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}



html {
  background: var(--bg0);
  color: var(--textPrimary);
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Telegram WebView: не передавать вертикальный оверскролл родителю (сворачивание мини-приложения) */
html.tg-webapp {
  overscroll-behavior-y: none;
  -webkit-overscroll-behavior-y: none;
}

* {
  box-sizing: border-box;
}

/* Consistent dark UI on iOS/Android */
input,
button,
select,
textarea {
  color: inherit;
  background-color: inherit;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* Force dark appearance even if OS is light */
@media (prefers-color-scheme: light) {
  html,
  body {
    background: var(--bg0) !important;
    color: var(--textPrimary) !important;
  }
}

body {
  margin: 0;
  min-height: var(--tg-viewport-height, 100vh);
  padding: 10px;

  /* Safe areas (Telegram vars + iOS env fallbacks) */
  padding-top: calc(10px + var(--tg-safe-area-inset-top, 0px) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(100px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px));

  /* Liquid background: neon fog + deep gradient */
  background:
    radial-gradient(1200px 900px at 15% 10%, rgba(46, 242, 255, 0.12) 0%, transparent 55%),
    radial-gradient(900px 700px at 85% 20%, rgba(177, 140, 255, 0.10) 0%, transparent 55%),
    radial-gradient(1000px 900px at 55% 95%, rgba(255, 77, 218, 0.08) 0%, transparent 60%),
    linear-gradient(160deg, var(--bg0) 0%, var(--bg1) 42%, var(--bg2) 100%);

  color: var(--textPrimary);
  display: flex;
  flex-direction: column;

  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* pan-y: keep vertical scroll; manipulation: no 300ms delay */
  touch-action: pan-y manipulation;
  -webkit-touch-callout: none;
}

html.tg-webapp body {
  overscroll-behavior-y: none;
  -webkit-overscroll-behavior-y: none;
}

@supports (height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

/* Mobile/touch: единая схема скролла для iOS и Android (document scroll) */
@media (pointer: coarse) {
  html {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    -webkit-overscroll-behavior-y: auto;
    touch-action: pan-y manipulation;
  }
}

/* Desktop: default overscroll */
@media (hover: hover) and (pointer: fine) {
  html,
  body {
    overflow-y: auto;
    overscroll-behavior-y: auto;
    -webkit-overscroll-behavior-y: auto;
  }

  /* On desktop only: slightly parallax feel */
  body {
    background-attachment: fixed;
  }
}

/* Global focus ring (accessible, non-invasive) */
:where(a, button, input, select, textarea, [role="button"]) {
  outline: none;
}

:where(a, button, input, select, textarea, [role="button"]):focus-visible {
  box-shadow: 0 0 0 3px rgba(46, 242, 255, 0.16), 0 0 0 1px rgba(46, 242, 255, 0.22);
}


.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,
.orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Subtle glass-grid (helps orientation, doesn't distract) */
.bg-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.32;
  mask-image: radial-gradient(circle at 50% 10%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0) 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 10%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0) 80%);
}

/* Neon fog orbs */
.orb {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.28;
  mix-blend-mode: screen;
}

.orb-one {
  background: radial-gradient(circle at 30% 30%, rgba(46, 242, 255, 0.75) 0%, transparent 60%);
  top: -90px;
  right: 8%;
}

.orb-two {
  background: radial-gradient(circle at 30% 30%, rgba(177, 140, 255, 0.70) 0%, transparent 60%);
  bottom: -140px;
  left: 4%;
}

.orb-three {
  background: radial-gradient(circle at 30% 30%, rgba(255, 77, 218, 0.55) 0%, transparent 60%);
  top: 42%;
  left: 70%;
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .bg-grid::before {
    animation: none !important;
  }
}


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

/* GlassCard - Premium glass card component */
/* ===== PREMIUM LIQUID GLASS COMPONENTS ===== */

/* GlassCard / Glass panel — thin liquid glass with readable fallback */
.glass-card,
.glass {
  position: relative;
  z-index: 1;

  /* Fallback (no backdrop-filter): slightly more opaque for readability */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--glass-bg-strong-fallback);

  border: 1px solid var(--glass-border);
  border-radius: var(--rCard);
  padding: var(--spacing-xl);

  color: var(--textPrimary);
  overflow: hidden;

  box-shadow:
    var(--shadowLarge),
    var(--shadowSmall),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);

  /* Helps avoid blur “tearing” on some Android WebViews */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
}

/* True glass (backdrop-filter supported) */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass-card,
  .glass {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--glass-bg);

    border: 1px solid rgba(255, 255, 255, 0.09);

    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));

    box-shadow:
      var(--shadowLarge),
      var(--shadowSmall),
      inset 0 1px 0 rgba(255, 255, 255, 0.10),
      inset 0 -1px 0 rgba(0, 0, 0, 0.16);
  }
}

/* Specular highlight (top rim) */
.glass-card::before,
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 240px at 20% 0%, rgba(46, 242, 255, 0.12) 0%, transparent 60%),
    radial-gradient(700px 220px at 80% 0%, rgba(177, 140, 255, 0.10) 0%, transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, transparent 45%);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

/* Micro-grain for “liquid” feel (very subtle) */
.glass-card::after,
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0px,
      transparent 1px,
      transparent 2px,
      rgba(255, 255, 255, 0.025) 3px
    );
  opacity: 0.035;
  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);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass-card[data-size="sm"],
  .glass[data-variant="card"] {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

.glass-card[data-size="xs"],
.glass[data-variant="listRow"] {
  border-radius: var(--rInner);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadowSmall);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass-card[data-size="xs"],
  .glass[data-variant="listRow"] {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

/* Редкость скинов: вертикальный маркер + цветная рамка (считывается периферийным зрением) */
.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);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass[data-variant="panel"] {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

/* ===== 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);

  /* Thin glass */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--glass-bg-strong-fallback);

  border: 1px solid var(--glass-border);
  border-radius: var(--rInner);
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);

  position: relative;
  overflow: hidden;
  isolation: isolate;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .app-header {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--glass-bg);

    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));

    box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 220px at 10% 0%, rgba(46, 242, 255, 0.10) 0%, transparent 55%),
    radial-gradient(720px 200px at 90% 0%, rgba(177, 140, 255, 0.10) 0%, transparent 55%);
  opacity: 0.55;
  pointer-events: none;
  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: radial-gradient(circle at 30% 30%, rgba(46, 242, 255, 1) 0%, rgba(46, 242, 255, 0.2) 60%, transparent 72%),
    radial-gradient(circle at 70% 70%, rgba(177, 140, 255, 0.9) 0%, transparent 60%);
  box-shadow: 0 0 22px rgba(46, 242, 255, 0.35), 0 0 22px rgba(177, 140, 255, 0.22);
}

/* Old top navigation stays hidden — the app uses bottom-nav */
.primary-nav {
  display: none !important;
  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.18);
  background: rgba(255, 255, 255, 0.05);
}

.primary-nav a.admin-link {
  color: var(--accent);
  border-color: rgba(46, 242, 255, 0.22);
  background: rgba(46, 242, 255, 0.06);
}

.primary-nav a.admin-link:hover,
.primary-nav a.admin-link.active {
  border-color: rgba(46, 242, 255, 0.35);
  background: rgba(46, 242, 255, 0.10);
}


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

/* Base button */
.btn {
  font-family: inherit;
  border: none !important;
  border-radius: var(--rButton);
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  color: var(--textPrimary);

  /* Fallback */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.06) 100%),
    var(--glass-bg-strong-fallback);
  border: 1px solid var(--glass-border) !important;

  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .btn {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    color: var(--textPrimary) !important;
  }
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, transparent 45%);
  opacity: 0.55;
  pointer-events: none;
  border-radius: inherit;
}

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

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

/* Primary — neon cyan */
.btn.primary {
  background:
    radial-gradient(120px 60px at 15% 0%, rgba(46, 242, 255, 0.26) 0%, transparent 65%),
    linear-gradient(180deg, rgba(46, 242, 255, 0.14) 0%, rgba(46, 242, 255, 0.06) 100%),
    var(--glass-bg-strong-fallback);
  border: 1px solid rgba(46, 242, 255, 0.35) !important;
  box-shadow: var(--shadowSmall), 0 0 24px rgba(46, 242, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .btn.primary {
    background:
      radial-gradient(140px 70px at 15% 0%, rgba(46, 242, 255, 0.22) 0%, transparent 65%),
      linear-gradient(180deg, rgba(46, 242, 255, 0.12) 0%, rgba(46, 242, 255, 0.04) 100%),
      var(--surface);
    border: 1px solid rgba(46, 242, 255, 0.30) !important;
    box-shadow: var(--shadowSmall), 0 0 26px rgba(46, 242, 255, 0.20),
      inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(46, 242, 255, 0.46) !important;
  box-shadow: var(--shadowSmall), 0 0 30px rgba(46, 242, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn.primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  opacity: 0.95;
}

/* Secondary */
.btn.secondary {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.btn.secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn.secondary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Destructive (danger coral) */
.btn.destructive,
.btn.warning {
  background:
    radial-gradient(120px 60px at 15% 0%, rgba(255, 77, 109, 0.22) 0%, transparent 65%),
    linear-gradient(180deg, rgba(255, 77, 109, 0.12) 0%, rgba(255, 77, 109, 0.04) 100%),
    var(--glass-bg-strong-fallback);
  border: 1px solid rgba(255, 77, 109, 0.35) !important;
  box-shadow: var(--shadowSmall), 0 0 24px rgba(255, 77, 109, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .btn.destructive,
  .btn.warning {
    background:
      radial-gradient(140px 70px at 15% 0%, rgba(255, 77, 109, 0.18) 0%, transparent 65%),
      linear-gradient(180deg, rgba(255, 77, 109, 0.10) 0%, rgba(255, 77, 109, 0.03) 100%),
      var(--surface);
    border: 1px solid rgba(255, 77, 109, 0.30) !important;
    box-shadow: var(--shadowSmall), 0 0 26px rgba(255, 77, 109, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
}

.btn.destructive:hover:not(:disabled),
.btn.warning:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 109, 0.46) !important;
  box-shadow: var(--shadowSmall), 0 0 30px rgba(255, 77, 109, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn.destructive:active:not(:disabled),
.btn.warning:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  opacity: 0.95;
}

/* Accent (legacy) */
.btn.accent {
  background:
    radial-gradient(120px 60px at 15% 0%, rgba(46, 242, 255, 0.20) 0%, transparent 65%),
    linear-gradient(180deg, rgba(46, 242, 255, 0.10) 0%, rgba(46, 242, 255, 0.04) 100%),
    var(--surface);
  border: 1px solid rgba(46, 242, 255, 0.30) !important;
  box-shadow: var(--shadowSmall), 0 0 22px rgba(46, 242, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Ghost (minimal) */
.btn.ghost {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%),
    var(--glass-bg-fallback);
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .btn.ghost {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

.btn.ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16) !important;
}

/* Helpers */
.btn.subtle {
  padding: 10px 14px;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  color: var(--textDisabled);
}

.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);
}
/* Никнейм в карточке магазина (name_color с анимацией) */
.shop-item-card .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(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%),
    var(--glass-bg-strong-fallback);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: var(--text);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .pill {
    background: 
      linear-gradient(135deg, var(--glass-highlight) 0%, transparent 50%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }
}

.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 var(--glass-border);
  padding: 16px;
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%),
    var(--glass-bg-strong-fallback);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: var(--text);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .stat-chip {
    background: 
      linear-gradient(135deg, var(--glass-highlight) 0%, transparent 50%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    box-shadow: 
      0 4px 20px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  }
}

.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;
  align-self: center;
  margin-bottom: 1rem;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .market-refresh-text-overlay {
    backdrop-filter: blur(4px);
  }
}

.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 - fallback (more opaque for readability) */
  background: 
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%),
    var(--glass-bg-strong-fallback);
  border-bottom: 1px solid var(--glass-border);
  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.12);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .rating-row.head {
    background: 
      linear-gradient(180deg, var(--glass-highlight) 0%, transparent 50%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    box-shadow: var(--shadowSmall), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }
}

.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.10) 0%, rgba(255, 255, 255, 0.06) 100%),
    var(--glass-bg-fallback);
  border-left: 2px solid var(--glass-border);
  transform: translateX(2px);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .rating-row:not(.head):hover {
    background: 
      linear-gradient(180deg, var(--glass-highlight) 0%, transparent 50%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

.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.25) 0%, rgba(69, 215, 255, 0.18) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%),
    var(--glass-bg-strong-fallback);
  border-left: 3px solid var(--accentCyan);
  box-shadow: var(--shadowSmall), inset 0 0 0 1px rgba(69, 215, 255, 0.2);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .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, var(--glass-highlight) 0%, transparent 50%),
      var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

.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);
}

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

/* Улучшенный backdrop для модальных окон */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  dialog::backdrop {
    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: calc(20px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px)) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 24px) !important;
  max-width: min(1100px, calc(100% - 24px)) !important;

  /* Thin liquid glass */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--glass-bg-strong-fallback) !important;

  border: 1px solid var(--glass-border) !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.10) !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;
  overflow: hidden !important;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bottom-nav {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--glass-bg) !important;

    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) !important;

    box-shadow:
      var(--shadowLarge),
      var(--shadowSmall),
      inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
  }
}

.bottom-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 200px at 20% 0%, rgba(46, 242, 255, 0.10) 0%, transparent 55%),
    radial-gradient(640px 180px at 80% 0%, rgba(177, 140, 255, 0.10) 0%, transparent 55%);
  opacity: 0.55;
  pointer-events: none;
  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.18s 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;
  overflow: hidden !important;
}

.bottom-nav a::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.bottom-nav .nav-icon {
  width: 24px !important;
  height: 24px !important;
  object-fit: contain !important;
  opacity: 0.72 !important;
  transition: all 0.18s 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.92 !important;
  transform: scale(1.06) !important;
}

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

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

.bottom-nav a.active {
  border-color: rgba(46, 242, 255, 0.22) !important;
  background:
    radial-gradient(140px 70px at 50% 0%, rgba(46, 242, 255, 0.14) 0%, transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%),
    var(--surfaceStrong) !important;
  color: var(--textPrimary) !important;

  box-shadow:
    0 0 22px rgba(46, 242, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
}

.bottom-nav a.active::after {
  background: linear-gradient(90deg, rgba(46, 242, 255, 0) 0%, rgba(46, 242, 255, 1) 50%, rgba(46, 242, 255, 0) 100%);
  opacity: 1;
  transform: translateY(0);
}

/* Admin link (violet accent) */
.bottom-nav a.admin-link {
  border-color: rgba(177, 140, 255, 0.22) !important;
  background:
    linear-gradient(180deg, rgba(177, 140, 255, 0.08) 0%, rgba(177, 140, 255, 0.03) 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(177, 140, 255, 0.34) !important;
  background:
    radial-gradient(140px 70px at 50% 0%, rgba(177, 140, 255, 0.14) 0%, transparent 70%),
    linear-gradient(180deg, rgba(177, 140, 255, 0.10) 0%, rgba(177, 140, 255, 0.04) 100%),
    var(--surfaceStrong) !important;
  box-shadow:
    0 0 22px rgba(177, 140, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
}

/* Keep icons for admin link as-is */
.bottom-nav a.admin-link .nav-icon {
  opacity: 0.85 !important;
}

.bottom-nav a.admin-link:hover .nav-icon,
.bottom-nav a.admin-link:active .nav-icon,
.bottom-nav a.admin-link.active .nav-icon {
  opacity: 1 !important;
  transform: scale(1.08) !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: calc(24px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    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: calc(20px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px)) !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;
  }
}


/* Дополнительные настройки для мобильных: touch-action без pinch-zoom чтобы не конфликтовал со скроллом на Huawei/Pixel */
@media (hover: none) and (pointer: coarse) {
  html, body {
    touch-action: pan-y manipulation;
    -webkit-touch-callout: none;
  }
}



/* ===========================
   MOBILE STABILITY PATCH
   - Prevent iOS/Telegram WebView overexposure from blend-mode + heavy blur
   - Keep glass thin but with a darker tint so tiles never turn "white blocks"
   =========================== */

@media (pointer: coarse), (max-width: 768px) {
  /* Reduce neon fog intensity on phones (fixes "white cards" on iOS) */
  .orb {
    opacity: 0.14 !important;
    mix-blend-mode: normal !important; /* 'screen' can blow out on iOS */
    filter: blur(140px) !important;
  }

  /* Darken glass surfaces slightly on mobile for consistent contrast */
  :root {
    --surface: rgba(10, 16, 30, 0.42);
    --surfaceStrong: rgba(10, 16, 30, 0.55);
    --strokeWeak: rgba(255, 255, 255, 0.10);
    --strokeStrong: rgba(255, 255, 255, 0.22);
  }

  /* Ensure common tile/card elements can't become pure white */
  .card,
  .panel,
  .glass,
  .tile,
  .task,
  .task-card,
  .quest-card,
  .shop-card,
  .menu-card,
  .friend-card,
  .profile-card,
  .modal,
  .popup,
  .dialog,
  .sheet,
  .bottom-sheet,
  .card-item,
  .item-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)) , var(--surface) !important;
    border-color: var(--strokeWeak) !important;
  }

  /* If any component uses image/white background, keep it subdued */
  img, video, canvas {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Accessibility / OS setting: Reduce Transparency (iOS) */
@media (prefers-reduced-transparency: reduce) {
  .orb { display: none !important; }
  .glass,
  .card,
  .panel,
  .modal,
  .sheet,
  .bottom-sheet {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(10, 16, 30, 0.78) !important;
    border-color: rgba(255,255,255,0.14) !important;
  }
}




/* =========================================================
   PATCH v3 — iOS/Telegram WebView stability + tabbar cleanup
   - Fix subtle "background jitter" in one of the menus/modals (iOS)
   - Remove underline indicator under bottom-nav icons
   ========================================================= */

/* 1) Bottom tab underline: disabled (user removed it in UI) */
.bottom-nav a::after,
.bottom-nav a.active::after {
  content: none !important;
  display: none !important;
}

/* 2) iOS/WebView: backdrop-filter on dialog ::backdrop can "swim/jitter".
      Keep dimming, but disable blur on iOS (glass stays on dialog itself). */
@supports (-webkit-touch-callout: none) {
  dialog::backdrop {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.68) !important;
  }
}

/* 3) iOS: fixed blurred layers + momentum scrolling can cause micro-jitter.
      Keep them visually the same, but stabilize compositing. */
@supports (-webkit-touch-callout: none) {
  .bg-grid,
  .orb {
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    will-change: transform !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
  }

  /* If you STILL see micro-jitter on very old iOS, uncomment the block below:
  .bg-grid, .orb { position: absolute !important; }
  */
}

/* 4) iOS safety: transform + backdrop-filter inside dialogs may re-rasterize.
      Prevent accidental transforms on glass surfaces in dialogs. */
@supports (-webkit-touch-callout: none) {
  dialog .glass,
  dialog .glass-card,
  dialog .glass-surface,
  dialog .panel,
  dialog .card {
    transform: none !important;
    -webkit-transform: none !important;
  }
}

