: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 */
  /* PERF: shadows are expensive on mobile WebViews; default to none */
  --shadowLarge: none;
  --shadowSmall: none;
  --shadowInset: none;

  /* 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: none;
  --shadow-glow-accent: none;

  /* 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;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --tg-app-inset-top: 52px;
  --tg-app-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: не передавать вертикальный оверскролл родителю (сворачивание мини-приложения)
   ВАЖНО: на Android это может ломать скролл, поэтому ограничиваемся iOS. */
html.tg-webapp.platform-ios {
  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.platform-ios 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;
  }
}

/* Android Telegram WebView: один скроллер — body.
   html overflow:auto + body overflow:auto + non-passive touchmove = мёртвый скролл. */
html.platform-android {
  height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
}
html.platform-android body {
  height: 100% !important;
  max-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
  -webkit-overscroll-behavior-y: auto !important;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
}
html.platform-android .content-shell,
html.platform-android .dl-page,
html.platform-android .profile-page {
  flex-shrink: 0;
}

/* 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;
  flex-shrink: 0;
}

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

/* Редкость скинов: циан / фиолетовый / розовый / золото */
:root {
  --rarity-border-common: var(--dl-cyan, #5cf0ff);
  --rarity-border-uncommon: var(--dl-violet, #8b6cff);
  --rarity-border-rare: var(--dl-violet, #8b6cff);
  --rarity-border-unique: var(--dl-coral, #ff4d6d);
  --rarity-border-limited: var(--dl-gold, #ffd166);
  --rarity-glow-common: rgba(92, 240, 255, 0.32);
  --rarity-glow-uncommon: rgba(139, 108, 255, 0.32);
  --rarity-glow-rare: rgba(139, 108, 255, 0.34);
  --rarity-glow-unique: rgba(255, 77, 109, 0.36);
  --rarity-glow-limited: rgba(255, 209, 102, 0.4);
}

.skin-card.rarity-common,
.shop-item-card.rarity-common,
.trading-card.rarity-common,
.sell-card.rarity-common,
.gift-modal-item.rarity-common,
.inventory-view-card.rarity-common,
.profile-inventory-slot.rarity-common {
  border: 2px solid var(--rarity-border-common) !important;
  box-shadow: 0 0 10px var(--rarity-glow-common);
}

.skin-card.rarity-uncommon,
.shop-item-card.rarity-uncommon,
.trading-card.rarity-uncommon,
.sell-card.rarity-uncommon,
.gift-modal-item.rarity-uncommon,
.inventory-view-card.rarity-uncommon,
.profile-inventory-slot.rarity-uncommon {
  border: 2px solid var(--rarity-border-uncommon) !important;
  box-shadow: 0 0 10px var(--rarity-glow-uncommon);
}

.skin-card.rarity-rare,
.shop-item-card.rarity-rare,
.trading-card.rarity-rare,
.sell-card.rarity-rare,
.gift-modal-item.rarity-rare,
.inventory-view-card.rarity-rare,
.profile-inventory-slot.rarity-rare {
  border: 2px solid var(--rarity-border-rare) !important;
  box-shadow: 0 0 10px var(--rarity-glow-rare);
}

.skin-card.rarity-unique,
.shop-item-card.rarity-unique,
.trading-card.rarity-unique,
.sell-card.rarity-unique,
.gift-modal-item.rarity-unique,
.inventory-view-card.rarity-unique,
.profile-inventory-slot.rarity-unique {
  border: 2px solid var(--rarity-border-unique) !important;
  box-shadow: 0 0 12px var(--rarity-glow-unique);
}

.skin-card.rarity-limited,
.shop-item-card.rarity-limited,
.trading-card.rarity-limited,
.sell-card.rarity-limited,
.gift-modal-item.rarity-limited,
.inventory-view-card.rarity-limited,
.profile-inventory-slot.rarity-limited {
  border: 2px solid var(--rarity-border-limited) !important;
  box-shadow: 0 0 14px var(--rarity-glow-limited);
}

.profile-inventory-slot.slot-present.rarity-common {
  border-color: var(--rarity-border-common) !important;
  box-shadow: 0 0 10px var(--rarity-glow-common);
}
.profile-inventory-slot.slot-present.rarity-rare {
  border-color: var(--rarity-border-rare) !important;
  box-shadow: 0 0 10px var(--rarity-glow-rare);
}
.profile-inventory-slot.slot-present.rarity-unique {
  border-color: var(--rarity-border-unique) !important;
  box-shadow: 0 0 12px var(--rarity-glow-unique);
}

.skin-card[data-equipped="1"] {
  box-shadow:
    0 0 0 2px var(--primary-strong),
    0 0 12px rgba(127, 93, 255, 0.28) !important;
}

.skin-card.rarity-common[data-equipped="1"] {
  box-shadow:
    0 0 0 2px var(--primary-strong),
    0 0 10px var(--rarity-glow-common) !important;
}
.skin-card.rarity-uncommon[data-equipped="1"] {
  box-shadow:
    0 0 0 2px var(--primary-strong),
    0 0 10px var(--rarity-glow-uncommon) !important;
}
.skin-card.rarity-rare[data-equipped="1"] {
  box-shadow:
    0 0 0 2px var(--primary-strong),
    0 0 10px var(--rarity-glow-rare) !important;
}
.skin-card.rarity-unique[data-equipped="1"] {
  box-shadow:
    0 0 0 2px var(--primary-strong),
    0 0 12px var(--rarity-glow-unique) !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: var(--rarity-border-common); }
.rarity-label.rarity-uncommon { color: var(--rarity-border-uncommon); }
.rarity-label.rarity-rare { color: var(--rarity-border-rare); }
.rarity-label.rarity-unique { color: var(--rarity-border-unique); }
.rarity-label.rarity-limited { color: var(--rarity-border-limited); }

/* 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;
  height: auto;
  min-height: 112px;
  overflow: visible;
}

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

.avatar-stack .avatar-frame-img,
.avatar-stack .avatar-frame-video {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  object-fit: contain;
}

.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-name-color-card__icon--gradient.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);
}

.shop-name-color-card__username.username-gradient-animated,
.shop-name-color-card__username .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: none !important;
  -webkit-transform: none !important;
  will-change: background-position;
}
/* Никнейм в рейтинге мини-игр (2048 / Only One): overflow:hidden у .rating-username */
#rating-modal .rating-username.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;
  display: inline-block;
  max-width: 100%;
  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%; }
}

/* Premium-ник: переливка без исчезновения текста */
@keyframes premium-nick-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@-webkit-keyframes premium-nick-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes premium-wordmark-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@-webkit-keyframes premium-wordmark-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.username-gradient-animated.username-premium-shine,
.hero-info h1.username-gradient-animated.username-premium-shine,
.market-info h3 .username-gradient-animated.username-premium-shine,
.shop-name-color-card__icon--gradient.username-gradient-animated.username-premium-shine,
.shop-name-color-card__username.username-gradient-animated.username-premium-shine,
.shop-name-color-card__username .username-gradient-animated.username-premium-shine,
#rating-modal .rating-username.username-gradient-animated.username-premium-shine,
.inventory-stage__name .username-gradient-animated.username-premium-shine {
  background-size: 200% 100% !important;
  background-repeat: no-repeat !important;
  animation: premium-nick-shine 4.8s ease-in-out infinite !important;
  -webkit-animation: premium-nick-shine 4.8s ease-in-out infinite !important;
}

.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.with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title.with-action h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.buyout-history-btn {
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.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;
  height: 100%;
}

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

.character-card-mini.is-you {
  position: relative;
  border: 1px solid var(--dl-mint, #2fffc1) !important;
  background: var(--dl-tint-mint-bg, rgba(47, 255, 193, 0.08)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 14px rgba(47, 255, 193, 0.18) !important;
}

.character-card-mini.is-you::after {
  display: block !important;
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid var(--dl-mint, #2fffc1);
  pointer-events: none;
  box-sizing: border-box;
  z-index: 2;
}

.card-avatar-large {
  width: 100%;
  height: 70px;
  min-height: 70px;
  max-height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.character-card-mini .pf-slave-frame-wrap {
  position: relative;
  display: block;
  width: 70px;
  height: 70px;
  min-width: 70px;
  min-height: 70px;
  max-width: 70px;
  max-height: 70px;
  flex: 0 0 70px;
  overflow: visible;
}

.character-card-mini .pf-slave-photo {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 60px;
  height: 60px;
}

.character-card-mini .pf-slave-frame-wrap .pf-slave-frame,
.character-card-mini .pf-slave-frame-wrap .avatar-frame-img,
.character-card-mini .pf-slave-frame-wrap .avatar-frame-video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 70px !important;
  height: 70px !important;
  max-width: 70px !important;
  max-height: 70px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain !important;
  pointer-events: none;
  transform: translate(var(--frame-overlay-x, 0px), var(--frame-overlay-y, 0px))
    scale(var(--frame-overlay-scale, 1));
  transform-origin: center center;
}

.card-avatar-large img:not(.pf-slave-frame):not(.avatar-frame-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;
  flex: 1 1 auto;
}

.character-card-mini .card-name-line {
  justify-content: center;
  width: 100%;
  min-height: 1.2em;
}

/* Ник не растягивается на всю карточку — подарок сразу после текста */
.character-card-mini .card-name-line .card-name {
  width: auto;
  max-width: calc(100% - 1.1em);
}

.character-card-mini .card-job,
.character-card-mini .card-price,
.character-card-mini .card-income {
  min-height: 1.15em;
}

.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: auto;
  width: 100%;
}

.card-info-vertical .slave-buy-btn-vertical.market-buy-btn {
  padding: 9px 10px;
  font-size: 0.78rem;
}

.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;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}

.carousel-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 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: 3px;
  flex-wrap: nowrap;
  justify-content: center;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.page-numbers > span {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 28px;
}

.page-number {
  min-width: 28px;
  width: auto;
  height: 28px;
  padding: 0 6px;
  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.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.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 v2 — code-only neon championship ===== */
.podium-v2 {
  position: relative;
  margin: 20px 0 10px;
  padding: 22px 18px 18px;
  border-radius: var(--rCard);
  overflow: visible;
  background:
    linear-gradient(165deg, rgba(11, 26, 58, 0.92) 0%, rgba(4, 5, 11, 0.96) 45%, rgba(28, 10, 48, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(46, 242, 255, 0.06) inset,
    0 16px 48px rgba(0, 0, 0, 0.35);
}

.podium-v2__aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 15% 15%, rgba(46, 242, 255, 0.18), transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 20%, rgba(177, 140, 255, 0.2), transparent 60%),
    radial-gradient(ellipse 80% 45% at 50% 100%, rgba(255, 209, 102, 0.12), transparent 65%);
  animation: podium-v2-aurora 10s ease-in-out infinite alternate;
}

.podium-v2__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 85%);
}

@keyframes podium-v2-aurora {
  0% { opacity: 0.75; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.04); }
}

.podium-v2__header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 18px;
}

.podium-v2__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffe566, #fff, #2ef2ff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: podium-v2-title-shine 4s linear infinite;
}

.podium-v2__title-icon {
  font-size: 1.3rem;
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

@keyframes podium-v2-title-shine {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.podium-v2__subtitle {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--textSecondary);
  letter-spacing: 0.02em;
}

.podium-v2__stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  max-width: 540px;
  margin: 0 auto;
  padding-top: 8px;
}

.podium-v2__slot {
  flex: 1;
  min-width: 0;
  max-width: 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.podium-v2__slot--silver { order: 1; }
.podium-v2__slot--gold {
  order: 2;
  transform: translateY(-14px);
}
.podium-v2__slot--bronze { order: 3; }

.podium-v2__card {
  width: 100%;
  text-align: center;
  padding: 8px 6px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  gap: 6px;
}

.podium-v2__slot--gold .podium-v2__card {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 28px rgba(255, 215, 0, 0.18), 0 0 0 1px rgba(255, 215, 0, 0.08) inset;
}

.podium-v2__slot--silver .podium-v2__card {
  border-color: rgba(46, 242, 255, 0.3);
  box-shadow: 0 0 20px rgba(46, 242, 255, 0.1);
}

.podium-v2__slot--bronze .podium-v2__card {
  border-color: rgba(205, 127, 50, 0.35);
  box-shadow: 0 0 18px rgba(205, 127, 50, 0.12);
}

.podium-v2__slot--gold .podium-v2__card:hover {
  box-shadow: 0 0 36px rgba(255, 215, 0, 0.28), 0 0 0 1px rgba(255, 215, 0, 0.15) inset;
  transform: translateY(-3px);
}

.podium-v2__slot--silver .podium-v2__card:hover,
.podium-v2__slot--bronze .podium-v2__card:hover {
  transform: translateY(-2px);
}

.podium-v2__medal {
  font-size: 1.15rem;
  line-height: 1;
  margin: 0;
  animation: podium-v2-float 3s ease-in-out infinite;
}

.podium-v2__slot--gold .podium-v2__medal {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.7));
}

.podium-v2__avatar-slot {
  flex-shrink: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

@keyframes podium-v2-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.podium-v2__avatar-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 78px;
  height: 78px;
  border-radius: 16px;
  padding: 3px;
  margin-bottom: 8px;
  box-sizing: border-box;
  overflow: visible;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
}

.podium-v2__slot--gold .podium-v2__avatar-ring {
  width: 90px;
  height: 90px;
  padding: 3px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffe566, #ffd700, #ffaa00, #ffe566);
  background-size: 300% 300%;
  animation: podium-v2-ring 3s ease infinite;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.45);
}

.podium-v2__slot--silver .podium-v2__avatar-ring {
  background: linear-gradient(135deg, #e8f8ff, #2ef2ff, #5dade2, #e8f8ff);
  background-size: 300% 300%;
  animation: podium-v2-ring 4s ease infinite;
  box-shadow: 0 0 16px rgba(46, 242, 255, 0.35);
}

.podium-v2__slot--bronze .podium-v2__avatar-ring {
  background: linear-gradient(135deg, #f0c090, #cd7f32, #a0522d, #f0c090);
  background-size: 300% 300%;
  animation: podium-v2-ring 4.5s ease infinite;
  box-shadow: 0 0 14px rgba(205, 127, 50, 0.35);
}

@keyframes podium-v2-ring {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.podium-v2__info {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
  box-sizing: border-box;
}

.podium-v2__name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.podium-v2__name-text,
.podium-v2__name > span:not(.username-present-status):not(.username-present-status-wrap):not(.premium-p-badge):not(.you-badge) {
  display: inline-block !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  box-sizing: border-box;
  min-width: 0;
}

.podium-v2__slot--gold .podium-v2__name {
  font-size: 0.95rem;
}

.podium-v2__balance {
  margin: 0;
  font-size: 0.7rem;
  color: var(--textSecondary);
}

.podium-v2__income {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.podium-v2__income span {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.7;
}

.podium-v2__slot--gold .podium-v2__income {
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.podium-v2__slot--silver .podium-v2__income {
  color: #2ef2ff;
  text-shadow: 0 0 10px rgba(46, 242, 255, 0.4);
}

.podium-v2__slot--bronze .podium-v2__income {
  color: #e6a85c;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.4);
}

.podium-v2__pillar {
  width: 100%;
  margin-top: 10px;
  border-radius: 10px 10px 6px 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.podium-v2__pillar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: podium-v2-shine 3s ease-in-out infinite;
}

.podium-v2__slot--silver .podium-v2__pillar::before { animation-delay: 0.5s; }
.podium-v2__slot--bronze .podium-v2__pillar::before { animation-delay: 1s; }

@keyframes podium-v2-shine {
  0% { left: -100%; }
  40%, 100% { left: 150%; }
}

.podium-v2__pillar-num {
  position: relative;
  z-index: 1;
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  padding: 10px 0 8px;
  color: rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
}

.podium-v2__slot--gold .podium-v2__pillar {
  height: 72px;
  background: linear-gradient(180deg, #fff0a0 0%, #ffd700 25%, #d4a800 65%, #8a6d00 100%);
  box-shadow:
    0 4px 20px rgba(255, 215, 0, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.podium-v2__slot--gold .podium-v2__pillar-num {
  font-size: 2.1rem;
  color: rgba(0, 0, 0, 0.18);
}

.podium-v2__slot--silver .podium-v2__pillar {
  height: 52px;
  background: linear-gradient(180deg, #f0f8ff 0%, #a8d8f0 35%, #5a9ec0 75%, #3a6a85 100%);
  box-shadow:
    0 4px 16px rgba(46, 242, 255, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.podium-v2__slot--bronze .podium-v2__pillar {
  height: 40px;
  background: linear-gradient(180deg, #f0c090 0%, #cd7f32 40%, #a0522d 80%, #6b3a1a 100%);
  box-shadow:
    0 4px 14px rgba(205, 127, 50, 0.25),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.podium-v2__sparkles {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 60%;
  pointer-events: none;
  z-index: 2;
}

.podium-v2__sparkles span {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #ffd700, 0 0 12px #ffd700;
  animation: podium-v2-sparkle 2.5s ease-in-out infinite;
}

.podium-v2__sparkles span:nth-child(1) { top: 12%; left: 18%; animation-delay: 0s; }
.podium-v2__sparkles span:nth-child(2) { top: 8%; right: 20%; animation-delay: 0.6s; }
.podium-v2__sparkles span:nth-child(3) { top: 28%; left: 8%; animation-delay: 1.2s; }
.podium-v2__sparkles span:nth-child(4) { top: 22%; right: 10%; animation-delay: 1.8s; }

@keyframes podium-v2-sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.2); }
}

@media (max-width: 768px) {
  .podium-v2 {
    padding: 18px 10px 14px;
  }

  .podium-v2__title {
    font-size: 1rem;
  }

  .podium-v2__stage {
    gap: 6px;
  }

  .podium-v2__slot--gold {
    transform: translateY(-8px);
  }

  .podium-v2__avatar-ring {
    width: 60px;
    height: 60px;
  }

  .podium-v2__slot--gold .podium-v2__avatar-ring {
    width: 70px;
    height: 70px;
  }

  .podium-v2__name {
    font-size: 0.78rem;
  }

  .podium-v2__slot--gold .podium-v2__name {
    font-size: 0.82rem;
  }

  .podium-v2__balance {
    font-size: 0.65rem;
  }

  .podium-v2__income {
    font-size: 0.8rem;
  }

  .podium-v2__slot--gold .podium-v2__pillar {
    height: 56px;
  }

  .podium-v2__slot--silver .podium-v2__pillar {
    height: 42px;
  }

  .podium-v2__slot--bronze .podium-v2__pillar {
    height: 32px;
  }

  .podium-v2__pillar-num {
    font-size: 1.4rem;
    padding: 6px 0;
  }

  .podium-v2__slot--gold .podium-v2__pillar-num {
    font-size: 1.6rem;
  }

  .podium-v2__card {
    padding: 8px 6px 10px;
    border-radius: 14px;
  }

  .podium-v2__medal {
    font-size: 1rem;
    margin-bottom: 4px;
  }

  .podium-v2__slot--gold .podium-v2__medal {
    font-size: 1.3rem;
  }
}

/* Аватар + рамка (png или прозрачный webm) */
.avatar-frame-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.avatar-frame-wrap .avatar-frame-avatar {
  position: relative;
  z-index: 1;
  object-fit: cover;
  border: none;
}

.avatar-frame-wrap .avatar-frame-img,
.avatar-frame-wrap .avatar-frame-video {
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  z-index: 3;
  pointer-events: none;
  border: none;
  outline: none;
  background: transparent !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translate(var(--frame-overlay-x, 0px), var(--frame-overlay-y, 0px))
    scale(var(--frame-overlay-scale, 1));
  transform-origin: center center;
}

.avatar-frame-wrap .avatar-frame-css {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
  border: none;
  outline: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* FX: слои без собственного stacking — см. frame_fx.css */
.avatar-frame-wrap .avatar-frame-css.avatar-frame-css--fx {
  z-index: auto;
}

@property --frame-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@property --frame-shift {
  syntax: '<percentage>';
  initial-value: 0%;
  inherits: false;
}

@property --comet-span {
  syntax: '<angle>';
  initial-value: 70deg;
  inherits: false;
}

.avatar-frame-css {
  --frame-angle: 0deg;
  --frame-shift: 0%;
  --comet-span: 70deg;
  box-sizing: border-box;
  border-radius: var(--frame-radius, 24%);
  padding: var(--frame-thickness, 6%);
  /* Только longhands — иначе !important shorthand убивает анимацию position/size */
  background-color: transparent;
  background-image: var(--frame-fill);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 0% 50%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.avatar-frame-css--animated-hue {
  animation: frame-gradient-hue 18s linear infinite;
}

.avatar-frame-css--animated-flow,
.avatar-frame-css--animated-flow-rev {
  background-size: 300% 100%;
  background-position: var(--frame-shift) 50%;
}

.avatar-frame-css--animated-flow {
  animation: frame-shift-flow 10s linear infinite;
}

.avatar-frame-css--animated-flow-rev {
  animation: frame-shift-flow 10s linear infinite reverse;
}

/* Orbit — прежний conic через --frame-angle (чуть быстрее) */
.avatar-frame-css--animated-orbit {
  animation: frame-orbit 9s linear infinite;
}

.avatar-frame-css--animated-orbit-rev {
  animation: frame-orbit 9s linear infinite reverse;
}

.avatar-frame-css--animated-orbit-slow {
  animation: frame-orbit 12s linear infinite;
}

/* Северное сияние — крутится увеличенный слой, маска рамки статична */
.avatar-frame-css--animated-aurora {
  background-image: none;
  overflow: hidden;
}

.avatar-frame-css--animated-aurora::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  margin: 0;
  background-image: var(--frame-fill);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: frame-aurora-spin 10s linear infinite;
}

/* Комета — хвост крутится и разрастается до полной палитры */
.avatar-frame-css--animated-comet {
  animation: frame-comet 8s linear infinite;
}

/* Жидкий блик — спектр шире рамки, плавный сдвиг */
.avatar-frame-css--animated-liquid {
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: frame-liquid 5.5s ease-in-out infinite alternate;
}

.avatar-frame-css--animated-drift {
  background-size: 220% 220%;
  background-position: var(--frame-shift) var(--frame-shift);
  animation: frame-shift-drift 9s ease-in-out infinite alternate;
}

@keyframes frame-gradient-hue {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes frame-shift-flow {
  from { --frame-shift: 0%; }
  to { --frame-shift: 100%; }
}

@keyframes frame-orbit {
  from { --frame-angle: 0deg; }
  to { --frame-angle: 360deg; }
}

@keyframes frame-comet {
  0% {
    --frame-angle: 0deg;
    --comet-span: 65deg;
  }
  45% {
    --comet-span: 360deg;
  }
  70% {
    --comet-span: 360deg;
  }
  100% {
    --frame-angle: 360deg;
    --comet-span: 65deg;
  }
}

@keyframes frame-aurora-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes frame-liquid {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@keyframes frame-shift-drift {
  from { --frame-shift: 0%; }
  to { --frame-shift: 100%; }
}

/* iOS WebView: убрать чёрную подложку у HEVC-видео с alpha */
@supports (-webkit-touch-callout: none) {
  .avatar-frame-wrap .avatar-frame-video {
    background: transparent !important;
    mix-blend-mode: normal;
  }
}

.avatar-frame-wrap .avatar-present {
  position: absolute;
  bottom: 0;
  right: 0;
  object-fit: contain;
  z-index: 4;
  pointer-events: none;
  border: none;
  outline: none;
}

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

/* ===== HARD NO-SHADOW MODE for phones & Telegram WebView =====
   Goal: minimize paint cost, improve responsiveness.
   This is intentionally aggressive as requested. */
html.tg-webapp,
@media (max-width: 900px) {
}

@media (max-width: 900px) {
  /* Kill all shadows (including inline styles), keep layout intact */
  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Backdrop blur is expensive on phones; keep readable fallback backgrounds */
  .glass-card,
  .glass,
  .app-header,
  .btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Heavy blurred background orbs/grid: disable entirely on phones */
  .orb,
  .bg-grid {
    display: none !important;
  }

  /* Reduce inter-card spacing/padding for small screens */
  .content-shell {
    margin: 8px auto;
    gap: 14px;
    padding-bottom: 72px; /* keep room for bottom nav */
  }

  .glass-card,
  .glass {
    padding: 14px;
  }
}

/* Telegram WebView tends to be slower: apply same perf rules even on tablets */
html.tg-webapp * ,
html.tg-webapp *::before,
html.tg-webapp *::after {
  box-shadow: none !important;
  text-shadow: none !important;
}

html.tg-webapp .glass-card,
html.tg-webapp .glass,
html.tg-webapp .app-header,
html.tg-webapp .btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.tg-webapp .orb,
html.tg-webapp .bg-grid {
  display: none !important;
}

/* ===== PERF: Telegram WebView + mobile shadow/blur reduction ===== */
@media (max-width: 768px) {
  /* Remove glow/shadow layers that trigger extra paint work */
  .glass-card,
  .glass,
  .app-header,
  .btn,
  .btn.primary,
  .btn.destructive,
  .btn.warning,
  .btn.accent,
  .btn.ghost,
  .logo .dot,
  .podium-v2__avatar-ring,
  .podium-v2__card,
  .podium-v2__pillar {
    box-shadow: none !important;
  }

  .podium-v2__income,
  .podium-v2__slot--gold .podium-v2__income,
  .podium-v2__slot--silver .podium-v2__income,
  .podium-v2__slot--bronze .podium-v2__income {
    text-shadow: none !important;
  }

  .podium-v2__sparkles {
    display: none;
  }

  /* Avoid animating box-shadow on mobile */
  .btn {
    transition: transform 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);
  }
}

.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: visible;
}

.rating-row .player > div:not(.avatar-frame-wrap):not(.rating-player-avatar) {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.rating-row .player > .rating-player-avatar {
  flex: 0 0 48px;
  overflow: visible;
  min-width: 48px;
  width: 48px;
  max-width: 48px;
  height: 45px;
}

.rating-player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  height: 45px;
  flex-basis: 48px;
  overflow: visible;
}

.rating-row .player > .player-info {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

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

/* Rating / podium: use avatar-frame-wrap + avatar_cosmetics_profile_scale (same as profile) */
.avatar-frame-wrap--rating {
  flex-shrink: 0;
  margin: 0;
}

.avatar-frame-wrap--podium {
  flex-shrink: 0;
}

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

/*
  Modal panels: `.glass` uses translucent layers + ::before/::after highlights; on mobile /
  Telegram WebView backdrop-filter is off, so the stack reads as “washed out”. Use a solid
  surface and drop the decorative pseudo-layers inside dialogs only.
*/
dialog .modal-content.glass::before,
dialog .modal-content.glass::after,
dialog .modal-content.glass-card::before,
dialog .modal-content.glass-card::after {
  display: none !important;
}

dialog .modal-content.glass,
dialog .modal-content.glass-card,
dialog .modal-content,
dialog .inventory-view-modal-content {
  background-color: rgb(12, 16, 28) !important;
  background-image: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Telegram WebView: belt-and-suspenders over coarse-pointer mobile patch on `.glass` */
html.tg-webapp dialog .modal-content.glass,
html.tg-webapp dialog .modal-content.glass-card,
html.tg-webapp dialog .modal-content,
html.tg-webapp dialog .inventory-view-modal-content {
  background-color: rgb(12, 16, 28) !important;
  background-image: none !important;
}

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

/* Улучшенный backdrop для модальных окон */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  dialog::backdrop {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
}

.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 (profile-style) ===== */

.bottom-nav {
  position: fixed !important;
  bottom: calc(8px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px)) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 20px) !important;
  max-width: min(1100px, calc(100% - 20px)) !important;

  background: rgba(16, 18, 28, 0.46) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-radius: 18px !important;
  padding: 8px 10px !important;
  margin: 0 !important;

  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.16) !important;

  display: flex !important;
  gap: 6px !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;

  isolation: isolate !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: hidden !important;

  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bottom-nav {
    background: rgba(16, 18, 28, 0.82) !important;
  }
}

.bottom-nav::before {
  display: none !important;
}

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

.bottom-nav a,
.bottom-nav button.bottom-nav-menu {
  text-decoration: none !important;
  color: rgba(255, 255, 255, 0.62) !important;
  padding: 8px 10px !important;
  border-radius: 12px !important;
  border: 1px solid transparent !important;
  transition: transform 0.18s ease, opacity 0.18s ease !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: 42px !important;
  -webkit-tap-highlight-color: transparent !important;
  position: relative;
  overflow: hidden !important;
  background: transparent !important;
  box-shadow: none !important;
}

.bottom-nav a.bottom-nav-achievements {
  overflow: visible !important;
}

.bottom-nav .nav-notify-badge {
  position: absolute;
  top: 3px;
  right: max(2px, calc(50% - 18px));
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: var(--dl-font-mono, ui-monospace, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  color: #041510;
  background: var(--dl-cyan, #5ef0c8);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(16, 18, 28, 0.55);
  pointer-events: none;
}

.bottom-nav .nav-notify-badge[hidden] {
  display: none !important;
}

/* Тайная рулетка (!) приоритетнее ежедневки и достижений */
.bottom-nav .nav-notify-badge--daily {
  color: #1a1205;
  background: var(--dl-gold, #ffd166);
}

/* Тайная рулетка готова — восклицательный знак */
.bottom-nav .nav-notify-badge--secret {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  color: #1a0e08;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(155deg, #ffb347 0%, #ff6b6b 55%, #ff4d6d 100%);
  box-shadow:
    0 0 0 2px rgba(16, 18, 28, 0.55),
    0 0 12px rgba(255, 107, 107, 0.45);
  animation: nav-sa-badge-pulse 1.7s ease-in-out infinite;
}

@keyframes nav-sa-badge-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav .nav-notify-badge--secret {
    animation: none;
  }
}

.bottom-nav a::after {
  content: none !important;
  display: none !important;
}

.bottom-nav .nav-icon {
  width: 23px !important;
  height: 23px !important;
  object-fit: contain !important;
  opacity: 0.68 !important;
  transition: opacity 0.18s ease, transform 0.18s ease !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

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

.bottom-nav a.active .nav-icon,
.bottom-nav button.bottom-nav-menu.active .nav-icon {
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(92, 240, 255, 0.45));
}

.bottom-nav a:hover,
.bottom-nav a:active,
.bottom-nav button.bottom-nav-menu:hover,
.bottom-nav button.bottom-nav-menu:active {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.bottom-nav a:active,
.bottom-nav button.bottom-nav-menu:active {
  transform: scale(0.97);
}

.bottom-nav a.active,
.bottom-nav button.bottom-nav-menu.active {
  border-color: rgba(92, 240, 255, 0.35) !important;
  background: rgba(92, 240, 255, 0.12) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.bottom-nav a.active::after {
  content: none !important;
  display: none !important;
}

/* Admin link (violet accent) */
.bottom-nav a.admin-link.active {
  border-color: rgba(198, 168, 255, 0.38) !important;
  background: rgba(139, 108, 255, 0.12) !important;
}

.bottom-nav a.admin-link:hover,
.bottom-nav a.admin-link:active {
  border-color: rgba(198, 168, 255, 0.22) !important;
  background: rgba(139, 108, 255, 0.08) !important;
}

.bottom-nav a.admin-link .nav-icon {
  opacity: 0.78 !important;
}

.bottom-nav a.admin-link.active .nav-icon {
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(198, 168, 255, 0.45));
}

html.tg-webapp .bottom-nav {
  background: rgba(16, 18, 28, 0.46) !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

html.tg-webapp .bottom-nav a.active {
  background: rgba(92, 240, 255, 0.12) !important;
  border-color: rgba(92, 240, 255, 0.35) !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(10px + 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(6px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    padding: 6px 8px !important;
    gap: 4px !important;
    border-radius: 16px !important;
  }

  .bottom-nav a,
.bottom-nav button.bottom-nav-menu {
    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;
  }
}

.shop-notes-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}
.shop-notes-overlay.show {
  display: flex;
}
.shop-notes-modal {
  width: min(92%, 360px);
  padding: 1.25rem 1.1rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(127, 93, 255, 0.45);
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  background: #1a1c2e;
  color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#insufficient-balance-overlay .shop-notes-modal,
#shop-insufficient-notes-overlay .shop-notes-modal,
#buyout-history-overlay .shop-notes-modal {
  background: #1a1c2e;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.shop-notes-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 900;
}
.shop-notes-modal__sub {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.shop-notes-modal__offer {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.4;
}
.shop-notes-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.shop-notes-modal__btn {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  display: block;
}
.shop-notes-modal__btn--primary {
  background: linear-gradient(135deg, #7f5dff, #5a3fd4);
  color: #fff;
}
.shop-notes-modal__btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.buyout-history-modal {
  width: min(94%, 420px);
  text-align: left;
  max-height: min(82vh, 620px);
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1rem 1.15rem;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
}
.buyout-history-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.buyout-history-head-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
  background: linear-gradient(145deg, rgba(177, 140, 255, 0.28), rgba(46, 242, 255, 0.12));
  border: 1px solid rgba(177, 140, 255, 0.35);
}
.buyout-history-modal h2 {
  text-align: left;
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.buyout-history-modal .shop-notes-modal__sub {
  text-align: left;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
#buyout-history-list {
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  color: #fff;
  padding: 4px 4px 4px 2px;
  -webkit-overflow-scrolling: touch;
}
.buyout-history-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  overflow: visible;
}
.buyout-history-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  overflow: visible;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(177, 140, 255, 0.22);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}
.buyout-history-transfer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  overflow: visible;
}
.buyout-history-person-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  width: 100%;
  text-align: center;
}
.buyout-history-role {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.buyout-history-avatar-link {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  overflow: visible;
}
.buyout-history-frame-wrap {
  width: 59px;
  height: 56px;
  overflow: visible;
  flex-shrink: 0;
  transform: translateZ(0);
}
.buyout-history-frame-wrap .avatar-frame-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}
.buyout-history-frame-wrap .avatar-frame-img {
  z-index: 2;
}
.buyout-history-frame-wrap .avatar-frame-img,
.buyout-history-frame-wrap .avatar-frame-video {
  width: 59px;
  height: 56px;
  transform: translateZ(0) translate(var(--frame-overlay-x, 0px), var(--frame-overlay-y, 0px))
    scale(var(--frame-overlay-scale, 1));
  transform-origin: center center;
}
.buyout-history-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.buyout-history-avatar--anon {
  object-fit: contain;
  padding: 10px;
  box-sizing: border-box;
  background: rgba(92, 240, 255, 0.1);
  border-color: rgba(92, 240, 255, 0.45);
  box-shadow: 0 0 14px rgba(92, 240, 255, 0.18);
}
.buyout-history-frame-wrap .avatar-present {
  width: 20px;
  height: 20px;
}
.buyout-history-person:first-child .buyout-history-avatar {
  border-color: rgba(46, 242, 255, 0.45);
}
.buyout-history-person:last-child .buyout-history-avatar {
  border-color: rgba(255, 77, 218, 0.4);
}
.buyout-history-flow {
  display: flex;
  align-items: center;
  align-self: start;
  min-width: 44px;
  padding-top: 13px;
}
.buyout-history-flow-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(46, 242, 255, 0.15), rgba(177, 140, 255, 0.7), rgba(255, 77, 218, 0.15));
}
.buyout-history-flow-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: #1a1c2e;
  border: 1px solid rgba(177, 140, 255, 0.4);
  flex-shrink: 0;
}
.buyout-history-link,
.buyout-history-name {
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.buyout-history-link:hover {
  color: var(--accent-strong);
}
.buyout-history-income {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.28);
}
.buyout-history-empty {
  margin: 18px 8px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.buyout-history-empty span {
  font-size: 1.6rem;
}
.buyout-history-empty p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}
.buyout-history-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 8px;
  font-size: 0.85rem;
}
.buyout-history-modal #buyout-history-close {
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

