/* ==========================================================================
   ECTS MINI APP — AUTHENTIC APPLE iOS LIQUID GLASS (NO EMOJIS)
   ========================================================================== */

@font-face {
  font-family: 'VCR OSD Mono';
  src: url('vcrosdmonorusbyd.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --top-safe-offset: 50px;
  
  /* Apple HIG Liquid Glass System (5 Optical Rules) */
  --bg-deep: #050811;
  --bg-liquid-glass: rgba(18, 24, 38, 0.72);
  --glass-backdrop: blur(24px) saturate(190%) contrast(90%);
  --glass-specular: inset 0 1px 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 1px 0 rgba(255, 255, 255, 0.05), 0 12px 32px -4px rgba(0, 0, 0, 0.35);
  --glass-border: 1px solid rgba(255, 255, 255, 0.12);
  
  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  
  /* Accents */
  --accent-blue: #38bdf8;
  --accent-blue-glow: rgba(56, 189, 248, 0.4);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-purple: #c084fc;
  
  /* Rarity Colors */
  --rarity-common: #94a3b8;
  --rarity-rare: #38bdf8;
  --rarity-epic: #c084fc;
  --rarity-legendary: #fbbf24;
  
  /* Timing */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.25, 1, 0.5, 1);
  
  /* Layout Dimensions */
  --header-h: 48px;
  --nav-h: 58px;
  --font-pixel: 'VCR OSD Mono', monospace;
  --font-sans: 'VCR OSD Mono', monospace;
}

/* BASE RESETS */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-y;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: -0.035em;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(30, 58, 138, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(15, 23, 42, 0.6) 0%, transparent 50%);
}

button, input, select, textarea {
  font-family: var(--font-pixel);
  letter-spacing: -0.03em;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 480px;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  padding-top: 0; /* Шапка сама учитывает safe-top */
}

/* SVG ICONS BASE */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.svg-coin {
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.35));
}

.svg-star {
  filter: drop-shadow(0 2px 5px rgba(251, 191, 36, 0.45));
}

.svg-lightning {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  flex-shrink: 0;
  height: calc(var(--header-h) + var(--safe-top, 0px) + 10px);
  padding-top: calc(var(--safe-top, 0px) + 10px);
  padding-bottom: 4px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-bottom: var(--glass-border);
  box-shadow: var(--glass-specular);
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: backdrop-filter, transform;
  z-index: 30;
  position: relative;
}

/* На главном меню (тапалка): монеты НЕ отображать, по центру строго поле с ником */
.app-header.tab-tap .user-chip {
  display: flex;
  margin: 0 auto;
}
.app-header.tab-tap .balance-badge {
  display: none !important;
}

/* На плотине, в инвентаре, магазине и настройках: по центру строго баланс монет */
.app-header.tab-game .user-chip,
.app-header.tab-inventory .user-chip,
.app-header.tab-shop .user-chip,
.app-header.tab-settings .user-chip {
  display: none !important;
}
.app-header.tab-game .balance-badge,
.app-header.tab-inventory .balance-badge,
.app-header.tab-shop .balance-badge,
.app-header.tab-settings .balance-badge {
  display: flex !important;
  margin: 0 auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.user-avatar-icon {
  display: flex;
  align-items: center;
  color: var(--accent-blue);
}

.user-name {
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(30, 27, 22, 0.9), rgba(45, 34, 18, 0.8));
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.badge-icon {
  display: flex;
  align-items: center;
}

.balance-val {
  font-family: var(--font-pixel);
  font-size: 13.5px;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

/* ==========================================================================
   MAIN VIEWPORT & TABS
   ========================================================================== */
.app-main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.tab-content {
  display: none;
  height: 100%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden !important;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TAB 1: ТАПАЛКА (CLICKER)
   ========================================================================== */
.tap-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 6px 16px 6px;
  overflow: hidden;
}

/* Верхняя зона: карточка баланса центрируется строго между верхом и кнопкой кликера */
.tap-top-zone {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

/* Статистическая карточка */
.stats-card {
  width: 100%;
  flex-shrink: 0;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: var(--glass-border);
  box-shadow: var(--glass-specular);
  border-radius: 18px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: backdrop-filter, transform;
  position: relative;
}

.stat-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stat-large {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum";
}

.coin-stat-icon {
  display: flex;
  align-items: center;
}

.btn-daily {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 7px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-daily:active {
  transform: scale(0.96);
  background: rgba(56, 189, 248, 0.15);
}

.btn-daily:disabled {
  opacity: 0.45;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  cursor: not-allowed;
}

/* Кнопка тапалки */
.clicker-wrapper {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: auto 0;
}

.clicker-glow-bg {
  position: absolute;
  width: clamp(310px, 86vw, 420px);
  height: clamp(310px, 86vw, 420px);
  max-width: 46vh;
  max-height: 46vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.32) 0%, rgba(56, 189, 248, 0.22) 50%, transparent 70%);
  filter: blur(36px);
  pointer-events: none;
  animation: pulseGlow 3s ease-in-out infinite alternate;
  transition: background 0.5s ease;
}

.clicker-glow-bg.lvl-1 {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, rgba(250, 204, 21, 0.15) 50%, transparent 70%);
}

.clicker-glow-bg.lvl-2 {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.55) 0%, rgba(234, 88, 12, 0.25) 50%, transparent 70%);
}

.clicker-glow-bg.lvl-3 {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.6) 0%, rgba(59, 130, 246, 0.3) 50%, transparent 70%);
}

.clicker-glow-bg.lvl-4 {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.65) 0%, rgba(236, 72, 153, 0.35) 50%, transparent 70%);
}

.clicker-glow-bg.lvl-5 {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.75) 0%, rgba(245, 158, 11, 0.4) 50%, transparent 70%);
  animation: pulseGlow 2s ease-in-out infinite alternate;
}

.coin-button-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.coin-button {
  position: relative;
  width: clamp(280px, 78vw, 360px);
  height: clamp(280px, 78vw, 360px);
  max-width: 42vh;
  max-height: 42vh;
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s var(--ease-spring);
  touch-action: manipulation;
  filter: drop-shadow(0 16px 36px rgba(0, 0, 0, 0.75));
  overflow: visible;
}

.coin-button:active {
  transform: scale(0.94) translate3d(0, 0, 0);
}

/* Нижняя зона: блок энергии и шкала уровня бобра центрируются строго между кнопкой и низом */
.tap-bottom-zone {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0;
}

/* Шкала уровня бобра */
.level-container {
  width: 100%;
  flex-shrink: 0;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  padding: 8px 14px;
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.level-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 7px;
}

.level-row-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.level-row-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.level-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: -0.02em;
}

.level-icon-slot {
  display: flex;
  align-items: center;
}

.level-text {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(253, 230, 138, 0.9);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

.level-bar {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.level-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.level-fill.lvl-4 {
  background: linear-gradient(90deg, #a855f7, #ec4899);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.7);
}

.level-fill.lvl-5 {
  background: linear-gradient(90deg, #f59e0b, #ef4444, #7c3aed);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.85);
}

.coin-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coin-button .coin-svg,
.tree-wrapper svg {
  width: 90% !important;
  height: 90% !important;
  margin: auto !important;
  display: block !important;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
}

/* Частицы вылетающих золотых монеток */
.tap-particle {
  position: absolute;
  pointer-events: none;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.75));
  animation: floatUpCoin 0.75s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes floatUpCoin {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.8) rotate(0deg);
  }
  35% {
    transform: translateY(-30px) scale(1.22) rotate(15deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-90px) scale(1.35) rotate(-25deg);
  }
}

/* Энергия */
.energy-container {
  width: 100%;
  flex-shrink: 0;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: var(--glass-border);
  box-shadow: var(--glass-specular);
  border-radius: 14px;
  padding: 8px 14px;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: backdrop-filter, transform;
  position: relative;
}

.energy-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.energy-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-tertiary);
}

.energy-icon-slot {
  display: flex;
  align-items: center;
  color: #38bdf8;
}

.energy-text {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

.energy-bar {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
}

.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  transition: width 0.25s ease-out;
}

/* ==========================================================================
   TAB 2: ИНВЕНТАРЬ
   ========================================================================== */
.inventory-header {
  position: relative;
  z-index: 10;
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  background: linear-gradient(180deg, rgba(5, 8, 17, 0.98) 0%, rgba(5, 8, 17, 0.88) 60%, rgba(5, 8, 17, 0) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: -6px;
}

.inventory-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
  margin: 0;
}

.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Постоянная всплывающая подсказка внизу экрана над таб-баром (закрывается крестиком насовсем) */
.inventory-bottom-hint {
  position: fixed;
  bottom: calc(var(--nav-h) + max(14px, env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px)));
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.15);
  padding: 8px 14px 8px 12px;
  border-radius: 24px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 150;
  white-space: nowrap;
  transition: opacity 0.25s var(--ease-spring), transform 0.25s var(--ease-spring);
}

.inventory-bottom-hint.show {
  display: flex;
  animation: hintSlideUp 0.3s var(--ease-spring) forwards;
}

.inventory-bottom-hint.dismissed {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
}

@keyframes hintSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hint-icon {
  display: flex;
  align-items: center;
  color: var(--accent-blue);
}

.hint-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.hint-close-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.hint-close-btn:active {
  color: #fff;
}

/* Кнопка сортировки в инвентаре (на одном уровне справа от заголовка "Мои темы") */
.inv-sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.18s ease;
}
.inv-sort-btn:active {
  background: rgba(51, 65, 85, 0.95);
  transform: scale(0.96);
}

.inv-sort-icon {
  display: flex;
  align-items: center;
  color: var(--accent-blue);
}

.inventory-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(165px, max-content);
  gap: 8px;
  padding: 14px 10px 85px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  align-content: start;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  mask-image: linear-gradient(to bottom, transparent 0%, black 14px, black calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14px, black calc(100% - 14px), transparent 100%);
}

.inv-card {
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  touch-action: pan-y;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 165px;
  height: 100%;
  flex-shrink: 0;
}

.inv-card:active {
  transform: scale(0.97);
}

/* Свечение и тонированный фон карточек по редкостям (без наплыва на соседние карточки) */
.inv-card[data-cat="common"] {
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.92) 100%);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(148, 163, 184, 0.15);
}
.inv-card[data-cat="common"] .inv-name {
  color: #cbd5e1;
}

.inv-card[data-cat="rare"] {
  background: linear-gradient(160deg, rgba(14, 45, 75, 0.8) 0%, rgba(15, 23, 42, 0.92) 100%);
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.22);
}
.inv-card[data-cat="rare"] .inv-name {
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.inv-card[data-cat="epic"] {
  background: linear-gradient(160deg, rgba(45, 20, 65, 0.8) 0%, rgba(15, 23, 42, 0.92) 100%);
  border: 1px solid rgba(192, 132, 252, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 12px rgba(192, 132, 252, 0.25);
}
.inv-card[data-cat="epic"] .inv-name {
  color: #c084fc;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.45);
}

.inv-card[data-cat="legendary"] {
  background: linear-gradient(160deg, rgba(55, 40, 10, 0.85) 0%, rgba(20, 15, 5, 0.95) 100%);
  border: 1px solid rgba(251, 191, 36, 0.65);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 14px rgba(251, 191, 36, 0.28);
}
.inv-card[data-cat="legendary"] .inv-name {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.inv-card.active {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

.inv-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 11;
  min-height: 90px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.4);
  margin-bottom: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inv-img-wrap img, .inv-img-wrap video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.inv-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.inv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  align-self: flex-start;
}

.inv-badge.equipped {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.inv-badge.perm {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.inv-badge.expiring {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   TAB 3: МАГАЗИН (КИНЕМАТИЧЕСКАЯ КАРУСЕЛЬ ОТ КРАЯ ДО КРАЯ)
   ========================================================================== */
.shop-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  padding: 6px 14px 10px;
  overflow-x: hidden !important;
  overflow-y: hidden;
  touch-action: pan-y;
  overscroll-behavior: none;
}

/* Сцена карусели */
.carousel-stage {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: visible;
  touch-action: pan-y;
  overscroll-behavior: none;
  padding: 4px 0;
}

/* Окружающий диффузный неоновый ореол на заднем плане карточки с вращением */
.carousel-ambient-glow {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 115%;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.88;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
  animation: ambientSwirl 12s linear infinite;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 0.6) 48%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 0.6) 48%, transparent 72%);
}

@keyframes ambientSwirl {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) rotate(180deg) scale(1.04);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg) scale(1);
  }
}

.carousel-ambient-glow.common {
  background: conic-gradient(from 0deg, #64748b, #94a3b8, #cbd5e1, #475569, #94a3b8, #64748b);
  animation-duration: 14s;
}
.carousel-ambient-glow.rare {
  background: conic-gradient(from 0deg, #0284c7, #38bdf8, #06b6d4, #60a5fa, #38bdf8, #0284c7);
  animation-duration: 11s;
}
.carousel-ambient-glow.epic {
  background: conic-gradient(from 0deg, #7c3aed, #a855f7, #c084fc, #e879f9, #a855f7, #7c3aed);
  animation-duration: 9s;
}
.carousel-ambient-glow.legendary {
  background: conic-gradient(from 0deg, #ea580c, #f59e0b, #fbbf24, #fef08a, #f59e0b, #ea580c);
  animation-duration: 8s;
}



/* Видовой экран для свайпа */
.stage-viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 4px;
}

/* Главная витринная карточка (Liquid Glass) */
.showcase-card {
  position: relative;
  z-index: 2;
  width: 100%;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: var(--glass-border);
  border-radius: 20px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--glass-specular);
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: backdrop-filter, transform;
  touch-action: pan-y;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Цветовые акценты рамки и глубокое свечение карточки в зависимости от категории */
.showcase-card.common-accent { 
  border-color: rgba(148, 163, 184, 0.55); 
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 46px rgba(148, 163, 184, 0.38), inset 0 0 16px rgba(148, 163, 184, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.25);
}
.showcase-card.rare-accent { 
  border-color: rgba(56, 189, 248, 0.8); 
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 56px rgba(56, 189, 248, 0.52), 0 0 20px rgba(14, 165, 233, 0.4), inset 0 0 18px rgba(56, 189, 248, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}
.showcase-card.epic-accent { 
  border-color: rgba(192, 132, 252, 0.85); 
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 62px rgba(192, 132, 252, 0.58), 0 0 24px rgba(168, 85, 247, 0.45), inset 0 0 20px rgba(192, 132, 252, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}
.showcase-card.legendary-accent { 
  border-color: rgba(251, 191, 36, 0.9); 
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 68px rgba(251, 191, 36, 0.65), 0 0 28px rgba(245, 158, 11, 0.5), inset 0 0 22px rgba(251, 191, 36, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* 3D Анимации плавного кинематического перелистывания карточек */
.slide-in-right {
  animation: cardSlideInRight 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-in-left {
  animation: cardSlideInLeft 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardSlideInRight {
  0% {
    opacity: 0.15;
    transform: perspective(1000px) translateX(70px) rotateY(-10deg) scale(0.93);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) translateX(0) rotateY(0deg) scale(1);
  }
}

@keyframes cardSlideInLeft {
  0% {
    opacity: 0.15;
    transform: perspective(1000px) translateX(-70px) rotateY(10deg) scale(0.93);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) translateX(0) rotateY(0deg) scale(1);
  }
}

/* Медиа-контейнер темы (без черных полей 100%) */
.card-media-wrapper {
  position: relative;
  width: min(100%, calc(38vh * 800 / 670));
  aspect-ratio: 800 / 670;
  max-height: 38vh;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background-color: #06090e;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: aspect-ratio 0.25s ease, width 0.25s ease;
}

.card-media-wrapper.common,
.card-media-wrapper.rare {
  width: min(100%, calc(38vh * 800 / 670));
  aspect-ratio: 800 / 670;
}

.card-media-wrapper.epic {
  width: min(100%, calc(38vh * 800 / 686));
  aspect-ratio: 800 / 686;
}

.card-media-wrapper.legendary {
  width: min(100%, calc(38vh * 800 / 616));
  aspect-ratio: 800 / 616;
}

.card-image, .card-video, video.cached-media, img.cached-media {
  width: 100%;
  height: 100%;
  max-height: 38vh;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.media-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Бейдж редкости */
.rarity-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2;
}

.rarity-badge.common { background: rgba(15, 23, 42, 0.7); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.rarity-badge.rare { background: rgba(12, 34, 56, 0.75); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.45); }
.rarity-badge.epic { background: rgba(35, 18, 56, 0.75); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.45); }
.rarity-badge.legendary { background: rgba(48, 32, 10, 0.8); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.5); }

/* Метаданные темы */
.card-meta {
  text-align: center;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.card-title.common {
  color: #e2e8f0;
  text-shadow: 0 0 10px rgba(226, 232, 240, 0.4);
}

.card-title.rare {
  color: #38bdf8;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
}

.card-title.epic {
  color: #c084fc;
  text-shadow: 0 0 16px rgba(192, 132, 252, 0.75);
}

.card-title.legendary {
  color: #fbbf24;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.85), 0 0 32px rgba(245, 158, 11, 0.45);
}

.card-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 3px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.status-dot.active {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

/* Сегментированный переключатель периода (30 дней / Навсегда) */
.period-selector-wrapper {
  display: flex;
  justify-content: center;
}

.segmented-control {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  width: 100%;
}

.seg-btn {
  flex: 1;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.seg-btn.active {
  color: #fff;
}

.seg-pill-backdrop {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--bg-elevated);
  border-radius: 9px;
  border: 1px solid var(--border-medium);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s var(--ease-spring);
  pointer-events: none;
  z-index: 1;
}

.segmented-control.perm-active .seg-pill-backdrop {
  transform: translateX(100%);
}

/* Кнопки покупки и применения */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-action {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s var(--ease-spring), opacity 0.15s ease;
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-action-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-action-stars {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}

.btn-action-owned {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  justify-content: center;
  gap: 8px;
}

.btn-action-equip {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
  justify-content: center;
  gap: 8px;
}

.price-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-feature-settings: "tnum";
}

/* Единая горизонтальная панель навигации магазина (стрелки и точки на одном уровне) */
.shop-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
  margin-top: 3px;
  margin-bottom: 6px;
  z-index: 10;
  position: relative;
  gap: 8px;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  overscroll-behavior: none !important;
}

.shop-nav-row .stage-nav-pill {
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: var(--glass-border);
  box-shadow: var(--glass-specular);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s var(--ease-spring);
  touch-action: manipulation;
}

.shop-nav-row .stage-nav-pill:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

.shop-nav-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  overflow: hidden;
}

.dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: all 0.25s var(--ease-spring);
  cursor: pointer;
}

.dot.active {
  width: 16px;
  border-radius: 6px;
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue-glow);
}

.dot.dot-edge {
  transform: scale(0.7);
  opacity: 0.5;
}

.shop-swipe-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.2px;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.shop-swipe-hint.dismissed {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.swipe-hint-icon {
  display: flex;
  align-items: center;
  color: var(--accent-blue);
  animation: swipePulse 2s ease-in-out infinite;
}

@keyframes swipePulse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Док категорий внизу магазина (Liquid Glass) */
.shop-categories-dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(15, 21, 34, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-subtle);
  padding: 5px;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  overscroll-behavior: none !important;
}

.cat-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0.55;
  transition: all 0.25s var(--ease-spring);
}

.cat-tab.active {
  opacity: 1;
  animation: catGlowPulse 2.4s ease-in-out infinite alternate;
}

@keyframes catGlowPulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.02); filter: brightness(1.2); }
}

.cat-tab.active[data-cat="common"] {
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 0 24px rgba(148, 163, 184, 0.6), inset 0 0 10px rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  text-shadow: 0 0 10px rgba(148, 163, 184, 0.7);
}

.cat-tab.active[data-cat="rare"] {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.7), inset 0 0 12px rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.85);
}

.cat-tab.active[data-cat="epic"] {
  background: rgba(192, 132, 252, 0.28);
  border-color: rgba(192, 132, 252, 0.9);
  box-shadow: 0 0 34px rgba(192, 132, 252, 0.75), inset 0 0 14px rgba(192, 132, 252, 0.45);
  color: #c084fc;
  text-shadow: 0 0 12px rgba(192, 132, 252, 0.9);
}

.cat-tab.active[data-cat="legendary"] {
  background: rgba(251, 191, 36, 0.28);
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow: 0 0 38px rgba(251, 191, 36, 0.8), inset 0 0 14px rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  text-shadow: 0 0 14px rgba(251, 191, 36, 0.95);
}

.cat-name {
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR (GLASS DOCK)
   ========================================================================== */
.bottom-nav {
  flex-shrink: 0;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 58px;
  padding-top: 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px));
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-top: var(--glass-border);
  box-shadow: var(--glass-specular);
  display: flex;
  justify-content: space-around;
  align-items: center;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: backdrop-filter, transform;
  z-index: 40;
}

.nav-item {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px 3px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  touch-action: manipulation;
}

.nav-item.active {
  color: var(--accent-blue);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--accent-blue);
  box-shadow: 0 0 12px var(--accent-blue), 0 0 4px var(--accent-blue);
  border-radius: 0 0 3px 3px;
}

.nav-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ==========================================================================
   TOAST NOTIFICATION (NATIVE GLASS PILL AT BOTTOM)
   ========================================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(16, 20, 29, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-medium);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease-spring);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: pre-line;
  max-width: min(90vw, 360px);
  text-align: center;
  line-height: 1.35;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  align-self: center;
}

.toast-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.toast-text {
  white-space: pre-line;
  text-align: center;
  line-height: 1.35;
  display: inline-block;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-danger {
  background: rgba(185, 28, 28, 0.96) !important;
  border: 1px solid rgba(248, 113, 113, 0.65) !important;
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.55), 0 0 18px rgba(239, 68, 68, 0.45) !important;
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
}

.toast.toast-danger .toast-icon svg {
  stroke: #fff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

/* ==========================================================================
   DELETE THEME SHEET (LIQUID GLASS BOTTOM SHEET)
   ========================================================================== */
.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.delete-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.delete-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.delete-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  background: rgba(18, 24, 38, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.delete-modal.active .delete-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  margin: 0 auto 12px auto !important;
  align-self: center !important;
  display: block;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: none;
}

.sheet-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.sheet-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.45;
  max-width: 320px;
}

.sheet-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-sheet-cancel {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-sheet-cancel:active {
  background: rgba(255, 255, 255, 0.14);
}

.btn-sheet-confirm {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transition: transform 0.12s ease;
}

.btn-sheet-confirm:active {
  transform: scale(0.97);
}

/* Дополнительные стили для карточек инвентаря с подсказкой зажатия */
.inv-card {
  position: relative;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.inv-card:active {
  transform: scale(0.96);
}


/* ==========================================================================
   APPLE HIG LIQUID GLASS: RULES 3 & 4 (PHYSICAL GRAIN & REFRACTION SHEEN)
   ========================================================================== */

/* Rule 3: Micro-Texture (Monochromatic Physical Glass Grain) */
.app-header::after,
.stats-card::after,
.energy-container::after,
.showcase-card::after,
.inv-card::after,
.bottom-nav::after,
.shop-categories-dock::after,
.delete-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 1;
}

/* Rule 4: Dynamic Liquid Refraction / Tilt Sheen */
.stats-card::before,
.showcase-card::before,
.energy-container::before,
.inv-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle 140px at var(--sheen-x, 50%) var(--sheen-y, 30%), rgba(255, 255, 255, 0.14), transparent 70%);
  opacity: 0.6;
  z-index: 2;
  transition: opacity 0.2s ease;
}

/* Ensure interactive targets always accept pointer events above pseudo-elements */
button, .nav-item, .cat-tab, .btn-action, .btn-daily, .coin-button, .stage-arrow, .inv-card {
  position: relative;
  z-index: 10;
  pointer-events: auto;
  touch-action: manipulation;
}

/* ==========================================================================
   ЕКТС: БОБРОВАЯ ПЛОТИНА — IDLE GAME STYLES v2
   ========================================================================== */

.game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #050811;
}

/* HUD */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(8, 12, 26, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  min-height: 40px;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.game-hud-stat {
  display: flex;
  align-items: center;
  gap: 2.5px;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.02em;
  color: #f0f0f0;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.game-hud-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.game-hud-icon svg { display: block; }

.game-hud-label {
  font-size: 8px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.game-hud-dam {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

#gameDamInfo {
  font-family: var(--font-pixel);
  font-size: 9px;
  font-weight: 700;
  color: #38bdf8;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Canvas */
.game-canvas-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  touch-action: manipulation;
}

/* Подсказка буста — скрыта по умолчанию, видна только когда буст готов */
.game-boost-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(252, 211, 77, 0.5);
  border-radius: 20px;
  padding: 5px 16px;
  color: #FCD34D;
  font-size: 12px;
  font-family: var(--font-pixel);
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

.game-boost-hint.ready {
  display: flex;
  opacity: 1;
  animation: boostHintPulse 2s ease-in-out infinite;
}

@keyframes boostHintPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Панель улучшений */
.game-upgrades-panel {
  flex-shrink: 0;
  max-height: 36%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(6, 10, 22, 0.97);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.game-upgrades-panel::-webkit-scrollbar { width: 2px; }
.game-upgrades-panel::-webkit-scrollbar-thumb { background: rgba(56,189,248,0.25); border-radius: 2px; }

.game-upgrades-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 14px 3px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.game-upgrades-title svg { opacity: 0.6; }

.game-workers-list {
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Строка рабочего */
.game-worker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.game-worker-row + .game-worker-row {
  border-top: 1px solid rgba(255,255,255,0.03);
}

.game-worker-row.can-buy {
  border-left-color: rgba(56,189,248,0.45);
  background: rgba(56,189,248,0.03);
}

.game-worker-row.is-max { opacity: 0.45; }

.game-dam-upgrade {
  border-left-color: rgba(245,158,11,0.5) !important;
  background: rgba(245,158,11,0.04) !important;
}

.game-dam-upgrade.can-buy {
  border-left-color: rgba(74,222,128,0.65) !important;
  background: rgba(74,222,128,0.06) !important;
}

.game-worker-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* SVG иконка рабочего */
.game-worker-svgicon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.game-worker-svgicon svg { display: block; }

.game-worker-name {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  color: #e0e8f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.dam-upgrade-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.15;
}

.dam-upgrade-prefix {
  font-size: 8.5px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.dam-upgrade-target {
  font-size: 10.5px;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.game-worker-count {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.game-worker-res {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-pixel);
  font-size: 9.5px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  letter-spacing: -0.02em;
}

.game-worker-res svg { display: inline-block; vertical-align: middle; opacity: 0.7; }

/* Кнопка покупки */
.game-buy-btn {
  font-family: var(--font-pixel);
  font-size: 9.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  letter-spacing: -0.02em;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-buy-btn svg { display: block; flex-shrink: 0; }

.game-buy-btn.ready {
  background: rgba(56,189,248,0.12);
  border-color: rgba(56,189,248,0.4);
  color: #38bdf8;
}

.game-buy-btn.ready:active {
  transform: scale(0.93);
  background: rgba(56,189,248,0.25);
}

.game-buy-btn.green-btn {
  background: rgba(74,222,128,0.12);
  border-color: rgba(74,222,128,0.45);
  color: #4ade80;
  animation: greenPulse 1.8s ease-in-out infinite;
}

@keyframes greenPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(74,222,128,0.15); }
  50% { box-shadow: 0 0 16px rgba(74,222,128,0.4); }
}

.game-buy-btn.maxed {
  background: rgba(74,222,128,0.06);
  border-color: rgba(74,222,128,0.2);
  color: #4ade80;
}

.game-hud-daynight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-hud-daynight svg {
  display: block;
  flex-shrink: 0;
}

/* Лимит склада в HUD */
.game-hud-max {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.38);
  font-family: var(--font-pixel);
  margin-left: 2px;
  white-space: nowrap;
}

/* Разделители секций в панели плотины */
.game-section-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-section-title svg { opacity: 0.8; }

/* Карточка статуса плотины */
.game-dam-card {
  margin: 6px 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-dam-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-dam-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  font-family: var(--font-pixel);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-dam-pill.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.game-dam-next-hint {
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-pixel);
  line-height: 1.35;
}

/* Карточка Биржи стройматериалов */
.game-market-card {
  margin: 6px 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-market-desc {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.game-market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.market-trade-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.35);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s;
  text-align: center;
  letter-spacing: -0.02em;
}

.market-trade-btn.can-trade {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde047;
  cursor: pointer;
}

.market-trade-btn.can-trade:active {
  transform: scale(0.96);
  background: rgba(245, 158, 11, 0.28);
}

.market-trade-btn.combo {
  grid-column: span 2;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}

.market-trade-btn.combo.can-trade {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(234, 179, 8, 0.2) 100%);
  border-color: rgba(234, 179, 8, 0.5);
  color: #fef08a;
}

.market-trade-btn.sell-all {
  grid-column: span 2;
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}

.market-trade-btn.sell-all.can-trade {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.market-trade-cost {
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}

.market-trade-gain {
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: -0.02em;
}

/* Док-панель из 3 кнопок внизу экрана игры */
.game-dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 10px;
  background: rgba(8, 12, 26, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  z-index: 10;
}

.game-dock-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.game-dock-btn:active {
  transform: scale(0.95);
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.game-dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.game-dock-icon svg { display: block; }

.game-dock-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  overflow: hidden;
}

.game-dock-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
}

.game-dock-sub {
  font-family: var(--font-pixel);
  font-size: 9.5px;
  color: #38bdf8;
  white-space: nowrap;
}

/* Модальное всплывающее окно (Liquid Glass Sheet) */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.game-modal.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.game-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  height: 360px;
  max-height: 54vh;
  background: rgba(13, 19, 33, 0.94);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
  touch-action: pan-y;
}

.game-modal.active .game-sheet {
  transform: translateY(0);
}

.game-sheet .sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 auto 8px;
  cursor: pointer;
}

/* Вкладки в заголовке модального окна */
.game-sheet-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.game-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.game-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.game-tab-icon svg { display: block; }

.game-sheet-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding-bottom: 4px;
}

.game-sheet-content::-webkit-scrollbar {
  width: 2px;
}

.game-sheet-content::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 2px;
}

.game-dock-bar.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 8px;
}

.dock-manage-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.88), rgba(15, 23, 42, 0.96));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-manage-btn:active {
  transform: scale(0.96);
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

.dock-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #38bdf8;
}

.dock-btn-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.dock-status-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1.5px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.dock-status-card:active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.dock-status-line {
  font-family: var(--font-pixel);
  white-space: nowrap;
  line-height: 1.2;
  width: 100%;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.dock-dam-title {
  font-size: 8.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.dock-dam-rate {
  font-size: 8px;
  font-weight: 600;
  color: #fde047;
}

.dock-dam-workers {
  font-size: 8px;
  color: #38bdf8;
}

/* Вертикальный столбик характеристик плотины */
.game-dam-stat-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 6px;
}

.dam-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  gap: 6px;
}

.dam-stat-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-shrink: 0;
}

.dam-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #38bdf8;
  flex-shrink: 0;
}

.dam-stat-title {
  font-family: var(--font-pixel);
  font-size: 9.5px;
  color: #cbd5e1;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.dam-stat-value {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-pixel);
  font-size: 9.5px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.dam-stat-value.highlight {
  color: #fde047;
}

/* Зеленая индикация доступности покупки */
.game-worker-row.can-buy .game-worker-svgicon {
  background: rgba(34, 197, 94, 0.15) !important;
  border: 1px solid rgba(34, 197, 94, 0.5) !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25) !important;
}

.game-buy-btn.green-btn {
  background: linear-gradient(135deg, #15803d, #22c55e) !important;
  color: #ffffff !important;
  border: 1px solid #4ade80 !important;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.45) !important;
  font-weight: 800;
}

.game-buy-btn.green-btn:active {
  transform: scale(0.95);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.65) !important;
}

/* ==========================================================================
   INTERACTIVE ONBOARDING TOUR (ОБУЧЕНИЕ ДЛЯ НОВИЧКА)
   ========================================================================== */
.header-help-btn {
  position: absolute;
  left: 14px;
  right: auto;
  top: calc(var(--safe-top, 0px) + 10px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-blue);
  font-family: var(--font-pixel);
  font-size: 15px;
  font-weight: 800;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}

.header-help-btn:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-overlay.show {
  opacity: 1;
}

.tour-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
}

.tour-spotlight {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(3, 7, 18, 0.84),
              0 0 0 3px rgba(56, 189, 248, 0.95),
              0 0 26px rgba(56, 189, 248, 0.6);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  animation: tourGlowPulse 2.2s infinite ease-in-out;
}

@keyframes tourGlowPulse {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(3, 7, 18, 0.84),
                0 0 0 3px rgba(56, 189, 248, 0.9),
                0 0 22px rgba(56, 189, 248, 0.45);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(3, 7, 18, 0.84),
                0 0 0 4px rgba(56, 189, 248, 1),
                0 0 34px rgba(56, 189, 248, 0.85);
  }
}

.tour-card {
  position: absolute;
  left: 14px;
  right: 14px;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.93);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.25),
              0 18px 45px -8px rgba(0, 0, 0, 0.75),
              0 0 25px rgba(56, 189, 248, 0.2);
  border-radius: 20px;
  padding: 16px 18px 14px;
  color: var(--text-primary);
  z-index: 10000;
  transition: top 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.tour-card-header {
  margin-bottom: 10px;
}

.tour-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-step-badge {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 3px 8px;
  border-radius: 8px;
}

.tour-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94a3b8;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
}
.tour-close-btn:active {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
}

.tour-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.32s ease;
  border-radius: 4px;
}

.tour-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: var(--font-pixel);
  color: #fde047;
  background: rgba(253, 224, 71, 0.12);
  border: 1px solid rgba(253, 224, 71, 0.25);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.tour-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fde047;
  box-shadow: 0 0 6px #fde047;
}

.tour-card-title {
  font-family: var(--font-pixel);
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.tour-card-text {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.35;
  color: #cbd5e1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tour-tip-box {
  background: rgba(30, 41, 59, 0.65);
  border-left: 3px solid #38bdf8;
  border-radius: 0 8px 8px 0;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 10px;
  line-height: 1.3;
  color: #94a3b8;
  letter-spacing: -0.02em;
}

.tour-tip-label {
  font-family: var(--font-pixel);
  font-weight: 700;
  color: #38bdf8;
  margin-right: 4px;
}

.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tour-nav-btn {
  font-family: var(--font-pixel);
  font-size: 10.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: -0.02em;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-btn-prev {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}
.tour-btn-prev:active {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(0.96);
}

.tour-btn-prev:disabled {
  opacity: 0.28;
  pointer-events: none;
}

.tour-btn-next {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
  color: #ffffff;
}
.tour-btn-next:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.6);
}

.tour-skip-link {
  background: none;
  border: none;
  color: #64748b;
  font-family: var(--font-sans);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.tour-skip-link:hover, .tour-skip-link:active {
  color: #94a3b8;
}

/* ==========================================================================
   TREE CLICKER ANIMATIONS & EFFECTS (РАБОТА НА СЕБЯ)
   ========================================================================== */
.tree-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.1s ease-out;
  border-radius: 50%;
  overflow: hidden;
}

/* Эффект удара топором (вибрация и отдача дерева) */
.tree-shake {
  animation: treeChopImpact 0.12s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes treeChopImpact {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(0.96) rotate(-2.5deg) translate(-2px, 1px); }
  60% { transform: scale(0.98) rotate(2deg) translate(1px, -1px); }
  100% { transform: scale(1) rotate(0deg) translate(0, 0); }
}

/* Анимация падения срубленного дерева (10 ударов) */
.tree-falling {
  transform-origin: 50% 88%;
  animation: treeFallAndBreak 0.35s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes treeFallAndBreak {
  0% {
    transform: rotate(0deg) translateY(0) scale(1);
    opacity: 1;
    filter: brightness(1.2);
  }
  35% {
    transform: rotate(22deg) translateY(6px) scale(0.95);
    opacity: 0.9;
  }
  70% {
    transform: rotate(65deg) translateY(24px) scale(0.8);
    opacity: 0.5;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.8));
  }
  100% {
    transform: rotate(90deg) translateY(45px) scale(0.5);
    opacity: 0;
  }
}

/* Анимация прорастания нового дерева из земли */
.tree-sprouting {
  transform-origin: 50% 88%;
  animation: treeGrowth 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes treeGrowth {
  0% {
    transform: scale(0.2) translateY(30px);
    opacity: 0;
  }
  70% {
    transform: scale(1.05) translateY(-2px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Панель прогресса ударов по дереву под маскотом */
.tree-chop-hud {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 3px 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}

.tree-chop-pills {
  display: flex;
  gap: 3px;
  align-items: center;
}

.tree-chop-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.15s ease;
}

.tree-chop-dot.hit {
  background: #f59e0b;
  border-color: #fde047;
  box-shadow: 0 0 6px #f59e0b;
}

.tree-chop-text {
  font-family: var(--font-pixel);
  font-size: 10.5px;
  font-weight: 700;
  color: #fde047;
}

/* Разлетающиеся щепки дерева при ударе топором */
.wood-chip-particle {
  position: fixed;
  pointer-events: none;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #b45309;
  border: 1px solid #d97706;
  z-index: 9999;
  animation: woodChipFly 0.45s ease-out forwards;
}

@keyframes woodChipFly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--vx), var(--vy)) rotate(var(--rot)) scale(0.3); opacity: 0; }
}

/* ==========================================================================
   SETTINGS TAB (НАСТРОЙКИ: LIQUID GLASS DESIGN)
   ========================================================================== */
#tab-settings {
  padding: 14px 12px 90px;
  overflow-y: auto;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.settings-wrapper {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden !important;
}

.settings-header {
  padding-bottom: 4px;
}

.settings-header h2 {
  font-family: var(--font-pixel);
  font-size: 19px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding-left: 4px;
}

.settings-card {
  background: var(--bg-liquid-glass);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--glass-specular);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.settings-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-blue);
  flex-shrink: 0;
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

.settings-row-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.settings-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0 16px;
}

/* Переключатель (Toggle Switch) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: #3B82F6;
  border-color: #60A5FA;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Кнопки действий в настройках */
.settings-action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  color: inherit;
}

.settings-action-btn:active {
  background: rgba(255, 255, 255, 0.05);
}

.settings-action-btn .settings-chevron {
  display: flex;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 16px;
  font-weight: 700;
}

.settings-action-btn.bug-report-btn .settings-row-icon {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Информационные строки */
.info-card {
  padding: 4px 0;
}

.settings-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 13px;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.info-label {
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.info-value {
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  text-align: right;
  word-break: break-word;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-value.status-online {
  color: #34D399;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ==================== BAN SCREEN OVERLAY ==================== */
.ban-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(5, 5, 10, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ban-card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(35, 10, 15, 0.95) 0%, rgba(18, 5, 8, 0.98) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.25), inset 0 0 20px rgba(239, 68, 68, 0.1);
  border-radius: 24px;
  padding: 28px 22px;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: banCardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes banCardPop {
  0% { opacity: 0; transform: scale(0.9) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.ban-badge-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.6));
}

.ban-title {
  font-family: var(--font-pixel);
  font-size: 18px;
  font-weight: 800;
  color: #ef4444;
  letter-spacing: 0.05em;
  margin: 0 0 10px 0;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.ban-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  margin: 0 0 18px 0;
}

.ban-reason-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px dashed rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  text-align: left;
}

.ban-reason-label {
  font-family: var(--font-pixel);
  font-size: 9.5px;
  font-weight: 700;
  color: #f87171;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.ban-reason-val {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  word-break: break-word;
}

.ban-uid-info {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 18px;
  font-family: monospace;
}

.btn-ban-exit {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transition: transform 0.15s ease;
}

.btn-ban-exit:active {
  transform: scale(0.97);
}

/* ==========================================================================
   FLOATING TROPHY BUTTON (ЗАЛ СЛАВЫ В КЛИКЕРЕ)
   ========================================================================== */
.floating-trophy-btn {
  position: absolute;
  right: 0px;
  bottom: calc(100% + 12px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.32), rgba(15, 23, 42, 0.94));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(251, 191, 36, 0.7);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  touch-action: manipulation;
  animation: trophyFloat 2.8s ease-in-out infinite alternate;
}

.floating-trophy-btn:active {
  transform: scale(0.9) !important;
}

@keyframes trophyFloat {
  0% { transform: translateY(0); box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35); }
  100% { transform: translateY(-5px); box-shadow: 0 14px 28px rgba(245, 158, 11, 0.55); }
}

.trophy-glow-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.45) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  animation: trophyRingPulse 2s infinite ease-in-out;
}

@keyframes trophyRingPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.18); opacity: 0.9; }
}

.trophy-center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  position: relative;
  z-index: 2;
  margin-top: -2px;
}

.trophy-mini-crown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  line-height: 1;
  margin-bottom: 1px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.trophy-rank-num {
  font-family: var(--font-pixel, inherit);
  font-size: 15px;
  font-weight: 900;
  color: #fde047;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 10px rgba(250, 204, 21, 0.6);
}

.trophy-badge {
  position: absolute;
  bottom: -6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 3;
  pointer-events: none;
  text-transform: uppercase;
}

/* ==========================================================================
   МОДАЛЬНОЕ ОКНО РЕЙТИНГА И ЗАЛА СЛАВЫ ЕКТС (LIQUID GLASS SHEET)
   ========================================================================== */
.leaderboard-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.leaderboard-modal.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.leaderboard-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  height: 82vh;
  max-height: 86vh;
  background: rgba(13, 19, 33, 0.96);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
  touch-action: pan-y;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.15);
}

.leaderboard-modal.active .leaderboard-sheet {
  transform: translateY(0);
}

.lb-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.lb-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 4px;
  text-align: center;
}

.lb-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-pixel, inherit);
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  text-align: center;
}

.lb-trophy-icon {
  display: flex;
  align-items: center;
  color: #f59e0b;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
}

.lb-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.lb-close-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.lb-tabs-dock {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 4px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-pixel, inherit);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lb-tab-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(2, 132, 199, 0.38));
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.lb-tab-btn.active .lb-tab-icon {
  color: #38bdf8;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

.lb-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

/* Топ-3 Пьедестал */
.lb-podium {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 4px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-podium-card {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.lb-podium-card.rank-1 {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.22) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(251, 191, 36, 0.6);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
  transform: translateY(-8px);
}

.lb-podium-card.rank-2 {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.18) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(203, 213, 225, 0.45);
}

.lb-podium-card.rank-3 {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.18) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(249, 115, 22, 0.45);
}

.lb-podium-medal {
  margin-bottom: 4px;
}

.lb-podium-name {
  font-family: var(--font-pixel, inherit);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lb-podium-coins {
  font-size: 11px;
  font-weight: 800;
  color: #fbbf24;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.lb-podium-sub {
  font-size: 9px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Строки рейтинга (4+) */
.lb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.15s ease;
}

/* 1-е место (Золотой фон и подсветка) */
.lb-item.lb-rank-gold {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(217, 119, 6, 0.16) 50%, rgba(15, 23, 42, 0.88) 100%) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.7) !important;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
}

.lb-item.lb-rank-gold .lb-rank-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.2));
  border: 1.5px solid rgba(251, 191, 36, 0.85);
  color: #fde047;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

/* 2-е место (Серебряный фон и подсветка) */
.lb-item.lb-rank-silver {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.28) 0%, rgba(100, 116, 139, 0.16) 50%, rgba(15, 23, 42, 0.88) 100%) !important;
  border: 1.5px solid rgba(203, 213, 225, 0.65) !important;
  box-shadow: 0 4px 18px rgba(148, 163, 184, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
}

.lb-item.lb-rank-silver .lb-rank-badge {
  background: linear-gradient(135deg, rgba(203, 213, 225, 0.3), rgba(148, 163, 184, 0.18));
  border: 1.5px solid rgba(226, 232, 240, 0.85);
  color: #f8fafc;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(203, 213, 225, 0.3);
}

/* 3-е место (Бронзовый фон и подсветка) */
.lb-item.lb-rank-bronze {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.26) 0%, rgba(180, 83, 9, 0.15) 50%, rgba(15, 23, 42, 0.88) 100%) !important;
  border: 1.5px solid rgba(249, 115, 22, 0.6) !important;
  box-shadow: 0 4px 18px rgba(217, 119, 6, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.25) !important;
}

.lb-item.lb-rank-bronze .lb-rank-badge {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.35), rgba(194, 65, 12, 0.2));
  border: 1.5px solid rgba(251, 146, 60, 0.85);
  color: #fdba74;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

.lb-item.my-group-item {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(15, 23, 42, 0.8));
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.2);
}

.lb-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lb-rank-badge {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-pixel, inherit);
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lb-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lb-item-title {
  font-family: var(--font-pixel, inherit);
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-my-tag {
  font-size: 8.5px;
  font-weight: 900;
  background: #0284c7;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.lb-item-sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
}

.lb-item-right {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
  flex-shrink: 0;
  font-feature-settings: "tnum";
}

/* Подвал со своим результатом */
.lb-footer {
  flex-shrink: 0;
  margin-top: 6px;
  min-height: 40px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.lb-my-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #e2e8f0;
  white-space: nowrap !important;
  width: 100%;
  margin: 0;
  padding: 0;
}

.lb-single-line-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  white-space: nowrap !important;
  font-size: 12.5px;
  color: #e2e8f0;
  text-align: center;
  line-height: 1;
}

.lb-stat-part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  white-space: nowrap !important;
}

.lb-footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  color: #38bdf8;
}

.lb-single-line-stat span {
  white-space: nowrap !important;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.lb-stat-sep {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 400;
  padding: 0 1px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.lb-my-stat-bold {
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.lb-coin-svg {
  display: inline-flex;
  align-items: center;
  vertical-align: -2px;
  margin-left: 2px;
}

.lb-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 0;
  color: #94a3b8;
  font-size: 12px;
}

.lb-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(245, 158, 11, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: lbSpin 0.7s linear infinite;
}

@keyframes lbSpin {
  to { transform: rotate(360deg); }
}
