/* === Base Reset & Variables === */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Hide scrollbars globally but keep functionality */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
*::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

:root {
  /* Glassmorphism Theme */
  --bg-primary: #667eea;
  --bg-secondary: rgba(255,255,255,0.1);
  --bg-card: rgba(255,255,255,0.15);
  --accent-green: #00d9a5;
  --accent-blue: #00b4d8;
  --accent-yellow: #ffd93d;
  --accent-red: #ff6b6b;
  --accent-purple: #a29bfe;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --border-color: rgba(255,255,255,0.2);
  
  /* Glass effect */
  --glass-bg: rgba(255,255,255,0.1);
  --glass-bg-strong: rgba(255,255,255,0.2);
  --glass-border: rgba(255,255,255,0.3);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.1);
  --glass-blur: blur(20px);
  
  /* Seasons */
  --spring-bg: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
  --summer-bg: linear-gradient(135deg, #f37335 0%, #fdc830 100%);
  --autumn-bg: linear-gradient(135deg, #8e2de2 0%, #f09819 100%);
  --winter-bg: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  /* Фиолетовый градиент */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-attachment: fixed;
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 140px; /* Space for bottom-quick-bar + tab-bar */
}

.hidden { display: none !important; }

/* === Header === */
.header {
  background: rgba(60,50,90,0.85);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.season-badge {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.25);
}

.season-badge.summer { background: rgba(255,217,61,0.3); }
.season-badge.autumn { background: rgba(255,107,107,0.3); }
.season-badge.winter { background: rgba(0,180,216,0.3); }

/* === Onboarding === */
.onboarding {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1000;
}

.onboarding-skip {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 8px 16px;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.onboarding-skip:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

.onboarding-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.onboarding-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: bounce 1s infinite;
}

.onboarding-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.onboarding-text {
  font-size: 16px;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  max-width: 300px;
}

.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.3s;
}

.onboarding-dot.active {
  background: white;
  transform: scale(1.2);
}

/* === Event Alert === */
.event-alert {
  background: rgba(255,107,107,0.2);
  border: 1px solid rgba(255,107,107,0.4);
  border-radius: 12px;
  margin: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease-out;
}

.event-alert.positive {
  background: rgba(0,217,165,0.2);
  border-color: rgba(0,217,165,0.4);
}

.event-icon { font-size: 28px; }
.event-info { flex: 1; }
.event-title { font-weight: 600; font-size: 14px; color: white; }
.event-desc { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.event-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

/* === Stats Bar === */
.stats-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.stats-bar::-webkit-scrollbar { display: none; }

.stat-item {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-icon { font-size: 20px; }
.stat-value { font-weight: 700; font-size: 15px; color: white; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.6); }

/* === Weather Widget === */
.weather-widget {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px;
  margin: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.weather-icon { font-size: 48px; }
.weather-info { flex: 1; }
.weather-temp { font-size: 28px; font-weight: 700; color: white; }
.weather-desc { font-size: 13px; color: rgba(255,255,255,0.7); }
.weather-effect {
  font-size: 12px;
  color: var(--accent-green);
  margin-top: 4px;
  font-weight: 500;
}

.weather-effect.negative { color: var(--accent-red); }

/* === Section Title === */
.section-title {
  font-size: 18px;
  font-weight: 600;
  padding: 16px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.section-title .btn-link {
  font-size: 13px;
  color: #00b4d8;
  background: none;
  border: none;
  cursor: pointer;
}

/* === Plot Grid === */
.plot-container {
  padding: 12px;
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: linear-gradient(145deg, #8B7355 0%, #6B5344 100%);
  border-radius: 16px;
  padding: 12px;
  border: 3px solid #a08060;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

.plot-cell {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #9B8B75 0%, #7B6B55 100%);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2);
}

.plot-cell:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.plot-cell.planted { background: linear-gradient(145deg, #55a630 0%, #3d8b24 100%); }
.plot-cell.ready { animation: glow 1.5s infinite; border-color: var(--accent-yellow); box-shadow: 0 0 12px var(--accent-yellow); }
.plot-cell.locked {
  background: rgba(0,0,0,0.3);
  cursor: not-allowed;
}
.plot-cell.locked::after {
  content: '🔒';
  font-size: 20px;
}
.plot-cell.affected { border-color: var(--accent-red); animation: shake 0.5s; }

.cell-plant { font-size: 28px; }
.cell-stage { font-size: 10px; color: rgba(255,255,255,0.6); margin-top: 2px; }

.cell-progress {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  height: 4px;
  background: rgba(0,0,0,0.3);
  border-radius: 2px;
  overflow: hidden;
}

.cell-progress-fill {
  height: 100%;
  background: var(--accent-green);
  transition: width 0.3s;
}

/* === Buildings === */
.buildings-row {
  display: flex;
  gap: 12px;
  padding: 0 12px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.buildings-row::-webkit-scrollbar { display: none; }

.building-item {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px;
  min-width: 100px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.building-item:hover { transform: translateY(-2px); background: rgba(255,255,255,0.15); }
.building-item.locked { opacity: 0.5; }
.building-icon { font-size: 36px; }
.building-name { font-size: 12px; margin-top: 6px; color: white; }
.building-level { font-size: 10px; color: #ffd93d; font-weight: 600; }

/* === Quick Actions === */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
}

.quick-action {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.quick-action:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }
.quick-action-icon { font-size: 24px; margin-bottom: 6px; }
.quick-action-label { font-size: 11px; color: rgba(255,255,255,0.7); }

/* === Neighbors / Cards List === */
.cards-list {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-item {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.card-item:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }

.card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.card-info { flex: 1; }
.card-name { font-weight: 600; font-size: 15px; color: white; }
.card-desc { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.card-stats { display: flex; gap: 12px; margin-top: 6px; }
.card-stat { font-size: 11px; color: rgba(255,255,255,0.6); }
.card-stat span { color: white; font-weight: 600; }

.card-action {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,184,148,0.3);
  transition: all 0.2s;
}

.card-action:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,184,148,0.4);
}

/* === Map === */
.map-container {
  padding: 12px;
}

.map-view {
  background: linear-gradient(180deg, #81c995 0%, #4a9f5e 100%);
  border-radius: 16px;
  height: 250px;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.map-marker {
  position: absolute;
  font-size: 28px;
  cursor: pointer;
  transition: transform 0.2s;
  /* animation: float 3s ease-in-out infinite; -- DISABLED for performance */
}

.map-marker:hover { transform: scale(1.3); }
.map-marker.self { filter: drop-shadow(0 0 8px var(--accent-green)); }

.map-regions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.map-region {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.map-region:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }
.map-region.selected { border-color: #00d9a5; background: rgba(0,217,165,0.2); }
.region-name { font-weight: 600; font-size: 14px; color: white; }
.region-climate { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.region-players { font-size: 11px; color: #00b4d8; margin-top: 6px; font-weight: 500; }

/* === Shop === */
.shop-tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.shop-tab {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
  color: rgba(255,255,255,0.7);
}

.shop-tab:hover { background: rgba(255,255,255,0.15); color: white; }
.shop-tab.active { background: linear-gradient(135deg, #00d9a5 0%, #00b894 100%); color: white; font-weight: 600; border-color: transparent; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 12px 12px;
}

.shop-item {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.shop-item:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }
.shop-item.locked { opacity: 0.5; }
.shop-item-icon { font-size: 40px; margin-bottom: 8px; }
.shop-item-name { font-weight: 600; font-size: 14px; color: white; }
.shop-item-desc { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.shop-item-price {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #ffd93d;
}

/* === Profile === */
.profile-header {
  text-align: center;
  padding: 24px 16px;
  margin: 12px 16px;
  background: rgba(60,50,90,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.profile-avatar {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(60,50,90,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  margin: 0 auto 12px;
  border: 3px solid #ffd93d;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 20px rgba(255,215,61,0.3);
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name { font-size: 22px; font-weight: 700; color: white; }
.profile-level {
  display: inline-block;
  background: var(--accent-purple);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  margin-top: 8px;
}

.profile-exp {
  margin-top: 12px;
  padding: 0 40px;
}

.exp-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.exp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
}

.exp-text {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.profile-stat {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.profile-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #00d9a5;
}

.profile-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}

/* === Achievements === */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px 16px;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.achievement {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: transform 0.15s ease;
}

.achievement.unlocked {
  border-color: #ffd93d;
  background: rgba(255,217,61,0.2);
}

.achievement.locked { opacity: 0.4; }
.achievement-icon { font-size: 28px; }
.achievement-name { font-size: 10px; margin-top: 4px; color: rgba(255,255,255,0.7); }

/* === Leaderboard === */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  margin: 0 12px 8px;
  border-radius: 12px;
}

.leaderboard-rank {
  font-size: 18px;
  font-weight: 700;
  min-width: 30px;
  color: white;
}

.leaderboard-rank.gold { color: #ffd700; }
.leaderboard-rank.silver { color: #c0c0c0; }
.leaderboard-rank.bronze { color: #cd7f32; }

.leaderboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.leaderboard-info { flex: 1; }
.leaderboard-name { font-weight: 600; font-size: 14px; color: white; }
.leaderboard-region { font-size: 11px; color: rgba(255,255,255,0.6); }
.leaderboard-score { font-weight: 700; color: #ffd93d; }

/* === SmartGarden Promo === */
.promo-banner {
  background: linear-gradient(135deg, rgba(0,217,165,0.3) 0%, rgba(102,126,234,0.3) 100%);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  margin: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.promo-banner:hover { transform: scale(1.02); background: linear-gradient(135deg, rgba(0,217,165,0.4) 0%, rgba(102,126,234,0.4) 100%); }
.promo-icon { font-size: 40px; }
.promo-info { flex: 1; }
.promo-title { font-weight: 700; font-size: 15px; }
.promo-desc { font-size: 12px; opacity: 0.95; margin-top: 4px; }
.promo-arrow { font-size: 20px; opacity: 0.8; }

/* === Modals === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
  padding: 20px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.modal-overlay.active { display: flex; }

.modal-content {
  background: rgba(30,30,50,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  width: 100%;
  max-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  animation: modalPop 0.25s ease-out;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  color: white;
}

@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  background: rgba(0,217,165,0.2);
}

.modal-title { font-size: 18px; font-weight: 600; color: white; }
.modal-close {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 0.2s;
}
.modal-close:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

.modal-body { padding: 20px 22px; color: rgba(255,255,255,0.9); }

/* === Buttons === */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #00d9a5 0%, #00b894 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(0,217,165,0.4);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-primary:hover { transform: scale(1.02); box-shadow: 0 6px 25px rgba(0,217,165,0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
}

.btn-secondary:hover { background: rgba(255,255,255,0.25); }

/* === Snackbar === */
.snackbar {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,50,0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 14px;
  display: none;
  z-index: 1001;
  box-shadow: 0 4px 25px rgba(0,0,0,0.3);
  animation: slideUp 0.3s;
}

.snackbar.show { display: block; }
.snackbar.success { background: rgba(0,217,165,0.9); }
.snackbar.error { background: rgba(255,107,107,0.9); }

/* === Tab Bar === */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(60,50,90,0.95);
  border-top: 1px solid rgba(255,255,255,0.15);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 20px;
  z-index: 100;
  box-shadow: 0 -4px 25px rgba(0,0,0,0.15);
}

/* Скрываем tab-bar на главном экране (ферма) */
.game-fullscreen ~ .tab-bar,
body:has(.game-fullscreen) .tab-bar {
  display: none !important;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
  padding: 4px 12px;
  border-radius: 12px;
}

.tab-item.active { color: #00d9a5; background: rgba(0,217,165,0.2); }
.tab-item:hover { background: rgba(255,255,255,0.1); color: white; }
.tab-icon { font-size: 22px; }

.tab-badge {
  position: absolute;
  top: -4px;
  right: 0;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* === Animations === */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes crisisGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(231, 76, 60, 0.3); }
  50% { box-shadow: 0 0 20px rgba(231, 76, 60, 0.6); }
}

@keyframes leaderGlow {
  0%, 100% { box-shadow: 0 2px 10px rgba(0,0,0,0.2), 0 0 15px rgba(255, 215, 0, 0.4); }
  50% { box-shadow: 0 2px 10px rgba(0,0,0,0.2), 0 0 30px rgba(255, 215, 0, 0.7); }
}

/* Leader avatar frames */
.leader-frame-gold { border: 3px solid #ffd700 !important; box-shadow: 0 0 20px rgba(255, 215, 0, 0.5) !important; }
.leader-frame-silver { border: 3px solid #c0c0c0 !important; box-shadow: 0 0 15px rgba(192, 192, 192, 0.5) !important; }
.leader-frame-bronze { border: 3px solid #cd7f32 !important; box-shadow: 0 0 12px rgba(205, 127, 50, 0.5) !important; }

@keyframes warningBlink {
  0%, 100% { background-color: rgba(231, 76, 60, 0.1); }
  50% { background-color: rgba(231, 76, 60, 0.3); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px var(--accent-yellow); }
  50% { box-shadow: 0 0 16px var(--accent-yellow); }
}

@keyframes gemGlow {
  0%, 100% { 
    box-shadow: 0 0 15px rgba(102,126,234,0.3), inset 0 0 20px rgba(102,126,234,0.1);
    border-color: rgba(102,126,234,0.5);
  }
  50% { 
    box-shadow: 0 0 20px rgba(102,126,234,0.5), inset 0 0 25px rgba(102,126,234,0.15);
    border-color: rgba(102,126,234,0.7);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === Match Game === */
.match-screen {
  padding: 0 12px;
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.match-level-bar {
  flex: 1;
}

.match-level-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.match-level-badge {
  background: var(--accent-purple);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.match-xp-text {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.match-xp-bar {
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.match-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), #a29bfe);
  transition: width 0.3s;
}

.match-currency {
  display: flex;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.match-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.match-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: white;
}

.match-stat-label {
  color: rgba(255,255,255,0.6);
}

.match-stat-value {
  font-weight: 600;
  color: var(--accent-green);
}

.match-combo {
  background: linear-gradient(135deg, #f39c12, #e74c3c);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  /* animation: pulse 0.5s ease infinite; -- DISABLED for performance */
}

.match-combo-mega {
  background: linear-gradient(135deg, #9b59b6, #e74c3c);
  /* animation: pulse 0.3s ease infinite, glow 0.5s ease infinite; -- DISABLED */
}

.match-grid-container {
  background: rgba(60,50,90,0.7);
  border-radius: 24px;
  padding: 12px;
  margin: 0 auto;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  /* Адаптивная ширина */
  width: 100%;
  max-width: min(90vw, 480px);
  position: relative;
  overflow: hidden;
}

/* Декоративный градиент сверху */
.match-grid-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.4), rgba(255,255,255,0.1));
  border-radius: 24px 24px 0 0;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(40px, 60px));
  gap: clamp(4px, 1vw, 8px);
  padding: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 18px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
  /* GPU acceleration */
  transform: translateZ(0);
  contain: layout style paint;
}

/* === ОПТИМИЗИРОВАННЫЕ СТИЛИ ЯЧЕЕК === */
.match-cell {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.75);
  border-radius: clamp(10px, 2vw, 16px);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  position: relative;
  /* GPU acceleration - только transform, не shadow/filter */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.match-cell:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.95);
  border-color: rgba(0,217,165,0.5);
}

.match-cell:active {
  transform: scale(0.98);
}

.match-cell.selected {
  background: rgba(0,217,165,0.4);
  transform: scale(1.1);
  border-color: #00d9a5;
  border-width: 3px;
  animation: selectedPulse 0.6s ease infinite;
}

@keyframes selectedPulse {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.15); }
}

/* Подсветка пары при бездействии */
.match-cell.idle-hint {
  background: rgba(0,217,165,0.2);
  border-color: rgba(0,217,165,0.6);
  border-width: 2px;
  animation: idleHintPulse 1.2s ease-in-out infinite;
}

@keyframes idleHintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.match-cell.hint {
  animation: hintPulse 0.8s ease infinite;
  background: linear-gradient(145deg, #a29bfe, #6c5ce7);
  border-color: #6c5ce7;
}

.match-cell.hint .match-cell-icon,
.match-cell.hint .match-cell-img {
  animation: hintBounce 0.8s ease infinite;
}

@keyframes hintBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.match-cell.match-collected {
  animation: collected 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.match-cell.match-wrong {
  animation: shake 0.35s ease;
  background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
  border-color: #e74c3c;
}

/* Эффект сбора - упрощённый */
.match-cell.match-collected::after {
  content: '✨';
  position: absolute;
  font-size: 18px;
  animation: sparkle 0.35s ease forwards;
  pointer-events: none;
}

@keyframes sparkle {
  0% { opacity: 1; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(1.3) translateY(-15px); }
}

/* Иконки БЕЗ тяжёлых фильтров */
.match-cell-icon {
  font-size: clamp(22px, 5.5vw, 34px);
  user-select: none;
  pointer-events: none;
  width: 85%;
  height: 85%;
  object-fit: contain;
  transition: transform 0.12s ease;
}

/* Изображения культур БЕЗ drop-shadow */
.match-cell-img {
  width: 85%;
  height: 85%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  border-radius: 8px;
  transition: transform 0.12s ease;
  /* GPU acceleration */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.match-cell:hover .match-cell-img,
.match-cell:hover .match-cell-icon {
  transform: scale(1.08);
}

.match-cell.selected .match-cell-img,
.match-cell.selected .match-cell-icon {
  transform: scale(1.12);
}

.match-reward-float {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-green);
  animation: floatUp 0.8s ease forwards;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1.5); }
}

@keyframes collected {
  0% { 
    transform: scale(1); 
    opacity: 1; 
  }
  30% { 
    transform: scale(1.4) rotate(10deg); 
    opacity: 1;
  }
  60% {
    transform: scale(1.2) rotate(-5deg);
  }
  100% { 
    transform: scale(0) rotate(20deg); 
    opacity: 0; 
  }
}

@keyframes hintPulse {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.5), 0 0 20px rgba(108, 92, 231, 0.2);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.8), 0 0 40px rgba(108, 92, 231, 0.4);
    transform: scale(1.05);
  }
}

/* Анимация для комбо */
@keyframes comboGlow {
  0% { box-shadow: 0 0 10px rgba(253, 203, 110, 0.5); }
  50% { box-shadow: 0 0 30px rgba(253, 203, 110, 0.8), 0 0 50px rgba(253, 203, 110, 0.4); }
  100% { box-shadow: 0 0 10px rgba(253, 203, 110, 0.5); }
}

.match-grid-container.combo-active {
  animation: comboGlow 0.5s ease;
  border-color: rgba(253, 203, 110, 0.6);
}

.match-boosters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.match-booster-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
}

.match-booster-btn:hover:not(.disabled) {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

.match-booster-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.match-booster-btn.match-booster-shop {
  background: linear-gradient(135deg, #00d9a5, #00b894);
  border: none;
  color: white;
}

.match-booster-icon {
  font-size: 20px;
}

.match-booster-count {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--accent-purple);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

.match-moves-bar {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.match-moves-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.match-moves-count {
  font-weight: 600;
}

.match-moves-progress {
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.match-moves-fill {
  height: 100%;
  transition: width 0.3s;
}

.match-moves-regen {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  margin-top: 4px;
}

.match-daily-goal {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.match-goal-text {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.match-goal-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.match-goal-bar {
  flex: 1;
  height: 6px;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.match-goal-fill {
  height: 100%;
  background: var(--accent-purple);
  transition: width 0.3s;
}

.match-goal-progress span {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-purple);
}

/* === Fullscreen Game UI === */
.game-fullscreen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  position: relative;
  padding: 0;
  overflow-x: hidden;
  overflow-y: scroll; /* Always show scroll space to prevent layout shift */
  -webkit-overflow-scrolling: touch;
}

/* Compact HUD */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(60,50,90,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  margin: 8px;
  color: white;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  position: relative;
}

.game-hud::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.hud-left { display: flex; align-items: center; gap: 8px; }
.hud-center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; }
.hud-right { display: flex; align-items: center; gap: 8px; }

.hud-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s;
  margin-right: 8px;
}
.hud-avatar-block:hover { background: rgba(255,255,255,0.25); }

.hud-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
}

.hud-avatar-rank {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-top: 3px;
  white-space: nowrap;
}

.hud-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  background: rgba(255,255,255,0.25);
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
  min-width: 70px;
}

.hud-level:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

.hud-level-num {
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.hud-level-bar {
  width: 50px;
  height: 7px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.hud-level-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffeaa7, #fdcb6e);
  transition: width 0.3s ease;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(253,203,110,0.5);
}

.hud-title {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  white-space: nowrap;
  margin-top: 2px;
}

.hud-currency {
  font-weight: 600;
  font-size: 13px;
  background: rgba(255,255,255,0.2);
  padding: 5px 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Иконки в HUD - Glass */
.hud-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.hud-currency:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.hud-moves {
  font-weight: 600;
  font-size: 13px;
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

.hud-moves.low {
  background: rgba(231,76,60,0.8);
  /* animation: pulse-red 1s infinite; -- DISABLED for performance */
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.hud-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Floating Icons - Glassmorphism */
.floating-icons {
  position: fixed;
  top: 90px; /* 4px ниже HUD (~86px) */
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
  padding: 12px;
  background: rgba(60,50,90,0.75);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.floating-icons.left { left: calc(50% - 260px - 30px - 70px); } /* 260=половина поля, 30=отступ, 70=ширина панели */
.floating-icons.right { right: calc(50% - 260px - 30px - 70px); }

/* Меню справа */
.floating-icons.menu {
  background: rgba(60,50,90,0.9);
  padding: 10px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.25);
}

.float-icon.menu-item {
  background: transparent;
  box-shadow: none;
  border: none;
}

.float-icon.menu-item:hover {
  background: rgba(0,0,0,0.05);
}

.float-icon.menu-item.active {
  background: linear-gradient(145deg, var(--accent-green), #27ae60);
  color: white;
  box-shadow: 0 2px 8px rgba(46,204,113,0.4);
}

/* === SIDE NAV: Боковая навигация для всех экранов === */
.side-nav {
  position: fixed;
  right: calc(50% - 260px - 30px - 70px); /* привязка к полю: 260=половина поля, 30=отступ, 70=ширина панели */
  top: 90px; /* 4px от верхней панели (header ~86px) */
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(60,50,90,0.85);
  padding: 10px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  z-index: 100;
}

.side-nav-item {
  width: 54px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  border: 1px solid transparent;
}

.side-nav-label {
  font-size: 8px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
  white-space: nowrap;
}

.side-nav-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.side-nav-item:hover .side-nav-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.side-nav-item.active .side-nav-icon {
  filter: drop-shadow(0 2px 6px rgba(255,255,255,0.5));
}

.side-nav-item:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

.side-nav-item.active {
  background: rgba(0,217,165,0.5);
  border-color: rgba(0,217,165,0.6);
}

.side-nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: var(--accent-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Контент экранов с side-nav (отступ справа) */
#screen-map,
#screen-quests,
#screen-inventory,
#screen-farm,
#screen-shop,
#screen-profile {
  padding-right: 60px;
  box-sizing: border-box;
  overflow-y: scroll;
  max-height: calc(100vh - 70px);
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Адаптивность side-nav */
@media (max-width: 480px) {
  .side-nav {
    right: 4px;
    padding: 6px;
    gap: 4px;
  }
  
  .side-nav-item {
    width: 40px;
    height: 40px;
    font-size: 16px;
    border-radius: 10px;
    gap: 1px;
  }
  
  .side-nav-label {
    font-size: 6px;
  }
  
  #screen-map,
  #screen-quests,
  #screen-inventory,
  #screen-farm,
  #screen-shop,
  #screen-profile {
    padding-right: 48px;
  }
}

@media (min-width: 768px) {
  .side-nav {
    right: 16px;
    padding: 10px;
    gap: 8px;
  }
  
  .side-nav-item {
    width: 58px;
    height: 58px;
    font-size: 22px;
  }
  
  .side-nav-label {
    font-size: 9px;
  }
}

.float-icon {
  width: 54px;
  height: 54px;
  background: rgba(255,255,255,0.2);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  color: white;
  border: 1px solid rgba(255,255,255,0.8);
  overflow: hidden;
}

/* Подпись под иконкой */
.float-icon-label {
  font-size: 7px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1;
  white-space: nowrap;
}

/* Изображения в кнопках навигации - Glass версия */
.float-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  border-radius: 6px;
}

.float-icon:hover .float-icon-img {
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.float-icon:hover {
  transform: scale(1.08);
  background: rgba(255,255,255,0.3);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.float-icon:active {
  transform: scale(0.95);
}

/* Специальные цвета для иконок - Glass версия */
.float-icon.quests { background: rgba(162,155,254,0.3); border-color: rgba(162,155,254,0.5); }
.float-icon.seasonal { background: rgba(255,217,61,0.3); border-color: rgba(255,217,61,0.5); }
.float-icon.boosters { background: rgba(0,180,216,0.3); border-color: rgba(0,180,216,0.5); }
.float-icon.crisis { background: rgba(255,107,107,0.3); border-color: rgba(255,107,107,0.5); }

.float-icon.has-action {
  /* animation: icon-bounce 2s infinite; -- DISABLED for performance */
}

.float-icon.pulse {
  /* animation: icon-pulse 1.5s infinite; -- DISABLED for performance */
}

.float-icon.crisis {
  background: rgba(231,76,60,0.4);
  border-color: rgba(231,76,60,0.6);
}

.float-icon.tutorial {
  background: rgba(108,92,231,0.4);
  border-color: rgba(108,92,231,0.6);
}

.float-icon.event {
  background: rgba(243,156,18,0.4);
  border-color: rgba(243,156,18,0.6);
}

.float-icon.smartgarden {
  background: rgba(46,204,113,0.4);
  border-color: rgba(46,204,113,0.6);
}

.float-icon.smartgarden.has-action {
  animation: smartgardenPulse 2s infinite;
}

@keyframes smartgardenPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(46,204,113,0.4); }
  50% { box-shadow: 0 4px 25px rgba(46,204,113,0.7), 0 0 35px rgba(46,204,113,0.4); }
}

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

@keyframes icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 12px rgba(231,76,60,0.3); }
  50% { transform: scale(1.1); box-shadow: 0 5px 20px rgba(231,76,60,0.5); }
}

.float-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--accent-red);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.float-badge.danger {
  background: #e74c3c;
  /* animation: badge-pulse 1s infinite; -- DISABLED for performance */
}

.float-badge.state-stable { background: var(--accent-green); }
.float-badge.state-tension { background: var(--accent-yellow); color: #333; }
.float-badge.state-crisis { background: var(--accent-red); }
.float-badge.state-lost { background: #2d3436; }

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Floating Panels */
.float-panel {
  position: absolute;
  top: 120px;
  width: 300px;
  max-height: 450px;
  background: rgba(40,40,60,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 60;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-20px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  color: white;
}

/* Larger panel for sector with tabs */
.float-panel#float-panel-sector {
  width: 380px;
  max-height: 600px;
}

.float-panel.left { left: 80px; }
.float-panel.right { right: 80px; transform: translateX(20px) scale(0.95); }

.float-panel.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.float-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(0,217,165,0.25);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-weight: 600;
}

.float-panel-close {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

.float-panel-content {
  padding: 12px;
  max-height: 350px;
  overflow-y: auto;
}

#float-panel-sector .float-panel-content {
  max-height: 500px;
}

/* Neighbor card hover */
.neighbor-card:hover {
  border-color: rgba(255,255,255,0.3) !important;
  transform: translateY(-1px);
  background: rgba(255,255,255,0.1);
}

.float-panel-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #00d9a5, #00b894);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

/* Float Quest Items */
.float-streak {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.float-quest {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  margin-bottom: 8px;
}

.float-quest.completed { background: rgba(0,217,165,0.2); border-color: rgba(0,217,165,0.3); }
.float-quest.claimed { opacity: 0.5; }

.float-quest-icon { font-size: 20px; }

.float-quest-info { flex: 1; }

.float-quest-name {
  font-weight: 600;
  font-size: 12px;
  color: white;
}

.float-quest-progress {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.float-quest-claim {
  padding: 6px 10px;
  background: linear-gradient(135deg, #00d9a5, #00b894);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

/* Float Sector Panel */
.float-sector-state {
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.15);
}

.float-sector-state.state-stable { background: rgba(0,217,165,0.25); color: #00d9a5; }
.float-sector-state.state-tension { background: rgba(255,217,61,0.25); color: #ffd93d; }
.float-sector-state.state-crisis { background: rgba(255,107,107,0.25); color: #ff6b6b; }
.float-sector-state.state-lost { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); }

.float-resource {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: white;
}

.float-resource-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.float-resource-bar div {
  height: 100%;
  transition: width 0.3s;
}

.float-sector-region {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  color: white;
}

/* Информация о кризисе в панели Сектор */
.float-crisis-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,107,107,0.4);
}

.float-crisis-title {
  font-weight: 700;
  font-size: 13px;
  color: #ff6b6b;
  margin-bottom: 4px;
}

.float-crisis-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 10px;
}

.float-crisis-option {
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 6px;
}

.float-crisis-option.option-a {
  border-left: 3px solid #667eea;
}

.float-crisis-option.option-b {
  border-left: 3px solid #ffa500;
}

.float-crisis-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
  color: white;
}

.float-crisis-votes {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}

.float-crisis-option-desc {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}

.float-crisis-option-effects {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

.float-crisis-tip {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  background: rgba(199,146,234,0.2);
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
  text-align: center;
}

/* Float Tutorial Panel */
.float-tutorial-step {
  font-size: 11px;
  color: #c792ea;
  font-weight: 600;
}

.float-tutorial-title {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0;
  color: white;
}

.float-tutorial-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 10px;
}

.float-tutorial-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
}

.float-tutorial-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.float-tutorial-bar div {
  height: 100%;
  background: #c792ea;
}

.float-tutorial-hint {
  font-size: 11px;
  color: #c792ea;
  background: rgba(199,146,234,0.2);
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.float-tutorial-reward {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  color: white;
}

/* Float Boosters Panel */
.float-booster {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  margin-bottom: 8px;
}

.float-booster.empty { opacity: 0.5; }

.float-booster-icon { font-size: 24px; }

.float-booster-info { flex: 1; }

.float-booster-name {
  font-weight: 600;
  font-size: 13px;
  color: white;
}

.float-booster-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}

.float-booster-use {
  padding: 6px 12px;
  background: linear-gradient(135deg, #00d9a5, #00b894);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.float-booster-buy {
  padding: 6px 12px;
  background: linear-gradient(135deg, #c792ea, #764ba2);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

/* Game Grid Wrapper */
.game-grid-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Прижимаем к верху */
  padding: 4px 100px 50px 100px; /* 4px сверху, ~100px по бокам (панель 70px + 30px отступ) */
  position: relative;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Combo display moved to session-stats */

/* === STATUS BAR: Статус региона / кризис === */
.status-bar {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  color: white;
  justify-content: center;
}

.status-bar.favorable {
  background: rgba(0,217,165,0.2);
  border-color: rgba(0,217,165,0.4);
}

.status-bar.favorable .status-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-bar.tension {
  background: rgba(255,217,61,0.2);
  border-color: rgba(255,217,61,0.4);
}

.status-bar.crisis-active {
  background: rgba(255,107,107,0.2);
  border-color: rgba(255,107,107,0.4);
}

/* Competition active state */
.status-bar.competition-active {
  background: rgba(241,196,15,0.2);
  border-color: rgba(241,196,15,0.5);
}

.status-bar.competition-active .crisis-header {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  border-radius: 8px;
  padding: 6px 10px;
  margin: -8px -10px 6px -10px;
}

.status-bar.competition-active .crisis-timer {
  color: white;
  background: rgba(0,0,0,0.2);
}

.status-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-icon {
  font-size: 20px;
}

.status-text {
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.status-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

/* === ONBOARDING GOAL: Цель онбординга === */
.status-bar.onboarding-goal {
  background: linear-gradient(135deg, rgba(102,126,234,0.25), rgba(118,75,162,0.25));
  border-color: rgba(102,126,234,0.5);
}

.status-bar.onboarding-goal.complete {
  background: linear-gradient(135deg, rgba(0,217,165,0.3), rgba(0,184,148,0.3));
  border-color: rgba(0,217,165,0.6);
  animation: goalComplete 0.5s ease;
}

@keyframes goalComplete {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.onboarding-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.onboarding-level {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.onboarding-title {
  font-weight: 700;
  font-size: 15px;
  color: white;
}

.onboarding-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onboarding-goal-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.goal-icon {
  font-size: 18px;
}

.goal-text {
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex: 1;
}

.goal-count {
  font-size: 14px;
  font-weight: 700;
  color: #a29bfe;
}

.onboarding-bar {
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.onboarding-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.onboarding-bar-fill.complete {
  background: linear-gradient(90deg, #00d9a5, #00b894);
}

.onboarding-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 6px;
  font-style: italic;
}

/* Crisis active state */
.crisis-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.crisis-icon {
  font-size: 16px;
}

.crisis-name {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.crisis-timer {
  font-size: 12px;
  font-weight: 700;
  color: white;
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  background: rgba(231,76,60,0.1);
  padding: 2px 6px;
  border-radius: 6px;
}

.crisis-bar {
  display: flex;
  height: 18px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(255,255,255,0.15);
  margin-bottom: 3px;
}

.crisis-bar-a {
  background: linear-gradient(90deg, #3498db, #2980b9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  transition: width 0.5s ease;
  min-width: 25px;
}

.crisis-bar-b {
  background: linear-gradient(90deg, #e67e22, #d35400);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  transition: width 0.5s ease;
  min-width: 25px;
}

.crisis-bar-a.leading {
  box-shadow: inset 0 0 8px rgba(255,255,255,0.3);
}

.crisis-bar-b.leading {
  box-shadow: inset 0 0 8px rgba(255,255,255,0.3);
}

.crisis-labels {
  display: flex;
  justify-content: space-between;
}

.crisis-label-a,
.crisis-label-b {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crisis-label-a {
  align-items: flex-start;
}

.crisis-label-b {
  align-items: flex-end;
}

.crisis-label-name {
  font-size: 11px;
  font-weight: 600;
}

.crisis-label-a .crisis-label-name {
  color: #27ae60;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.crisis-label-b .crisis-label-name {
  color: #e74c3c;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.crisis-label-effects {
  font-size: 11px;
  color: white;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Кризисные элементы на поле */
.match-cell.crisis-element {
  /* Мягкая подсветка без изменения размера */
}

.match-cell.crisis-a {
  background: linear-gradient(145deg, #ebf5fb, #d4e6f1) !important;
  box-shadow: inset 0 0 0 2px rgba(52,152,219,0.4) !important;
}

.match-cell.crisis-b {
  background: linear-gradient(145deg, #fef5e7, #fae5c6) !important;
  box-shadow: inset 0 0 0 2px rgba(230,126,34,0.4) !important;
}

.match-cell.crisis-element .match-cell-icon {
  /* Убрана анимация масштабирования */
}

/* Кнопка справки в левой колонке - Glass */
.float-icon.help {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

/* Session Stats Bar - Glass */
.session-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px 16px;
  background: rgba(60,50,90,0.9);
  border-top: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

.session-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  transition: background 0.15s ease;
  color: white;
}

.session-stat:hover {
  background: rgba(255,255,255,0.2);
}

.session-stat.moves.low {
  color: #ff6b6b;
  background: rgba(255,107,107,0.2);
  /* animation: lowMovesPulse 1s ease infinite; -- DISABLED for performance */
}

@keyframes lowMovesPulse {
  0%, 100% { background: rgba(255,107,107,0.2); }
  50% { background: rgba(255,107,107,0.3); }
}

.session-icon { 
  font-size: 16px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.session-value {
  font-weight: 700;
  color: var(--accent-green);
}

.session-stat.moves .session-value {
  color: white;
}

.session-label {
  color: rgba(255,255,255,0.6);
  font-size: 10px;
}

/* Combo states in session stats */
.session-stat.combo.active {
  background: rgba(255,217,61,0.3);
  animation: comboActivePulse 0.5s ease;
}

.session-stat.combo.active .session-value {
  color: #ffd93d;
  font-size: 14px;
}

.session-stat.combo.hot {
  background: rgba(255,165,0,0.4);
  /* animation: comboHotPulse 0.4s ease infinite; -- DISABLED for performance */
}

.session-stat.combo.hot .session-value {
  color: #ffa500;
  font-size: 16px;
  font-weight: 800;
}

.session-stat.combo.mega {
  background: linear-gradient(145deg, rgba(255,107,107,0.6), rgba(238,90,90,0.6));
  color: white;
  /* animation: comboMegaPulse 0.3s ease infinite; -- DISABLED for performance */
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(238,90,90,0.5);
}

.session-stat.combo.mega .session-icon {
  /* animation: fireShake 0.2s ease infinite; -- DISABLED for performance */
}

.session-stat.combo.mega .session-value {
  color: white;
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.session-stat.combo.mega .session-label {
  color: rgba(255,255,255,0.9);
}

@keyframes comboActivePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes comboHotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes comboMegaPulse {
  0%, 100% { transform: scale(1.1); box-shadow: 0 4px 15px rgba(238,90,90,0.4); }
  50% { transform: scale(1.15); box-shadow: 0 6px 20px rgba(238,90,90,0.6); }
}

@keyframes fireShake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Responsive - Мобильные устройства (маленькие) */
@media (max-width: 380px) {
  .match-grid-container {
    max-width: 100%;
    padding: 6px;
  }
  
  .match-cell-icon {
    font-size: 24px;
  }
  
  .match-grid {
    gap: 3px;
  }
  
  .match-cell {
    border-radius: 6px;
  }
  
  .game-grid-wrapper {
    padding: 6px;
  }
  
  .floating-icons {
    gap: 5px;
    top: 90px;
  }
  
  .float-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: 8px;
  }
  
  .float-icon-label {
    display: none; /* Скрыть на очень маленьких экранах */
  }
  
  .float-icon-img {
    width: 22px;
    height: 22px;
  }
  
  .float-badge {
    width: 14px;
    height: 14px;
    font-size: 9px;
  }
}

/* Responsive - Мобильные устройства (средние) */
@media (min-width: 381px) and (max-width: 480px) {
  .match-grid-container {
    max-width: 380px;
    padding: 10px;
  }
  
  .match-cell-icon {
    font-size: 28px;
  }
  
  .match-grid {
    gap: 4px;
  }
  
  .game-grid-wrapper {
    padding: 8px;
  }
  
  .floating-icons {
    gap: 6px;
  }
  
  .float-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .float-icon-label {
    font-size: 6px;
  }
  
  .float-icon-img {
    width: 24px;
    height: 24px;
  }
}

/* Responsive - Планшеты */
@media (min-width: 481px) and (max-width: 767px) {
  .match-grid-container {
    max-width: 420px;
    padding: 12px;
  }
  
  .match-cell-icon {
    font-size: 32px;
  }
  
  .match-grid {
    gap: 6px;
  }
  
  .game-grid-wrapper {
    padding: 8px;
  }
  
  .floating-icons {
    gap: 8px;
  }
  
  .float-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}

/* Responsive - Десктоп */
@media (min-width: 768px) {
  body { max-width: 768px; margin: 0 auto; }
  .tab-bar { max-width: 768px; left: 50%; transform: translateX(-50%); }
  
  .floating-icons.left { left: calc(50% - 260px - 30px - 70px); }
  .floating-icons.right { right: calc(50% - 260px - 30px - 70px); }
  
  .floating-icons {
    gap: 10px;
  }
  
  .float-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
    border-radius: 14px;
  }
  
  .game-grid-wrapper {
    padding: 8px;
  }
  
  .match-grid-container {
    max-width: 480px;
    padding: 14px;
  }
  
  .match-cell-icon {
    font-size: 36px;
  }
  
  .match-grid {
    gap: 8px;
  }
  
  .match-cell {
    border-radius: 10px;
  }
  
  .float-panel {
    width: 320px;
  }
}

/* Responsive - Большой десктоп */
@media (min-width: 1024px) {
  .match-grid-container {
    max-width: 520px;
    padding: 16px;
  }
  
  .match-cell-icon {
    font-size: 40px;
  }
  
  .match-grid {
    gap: 10px;
  }
  
  .match-cell {
    border-radius: 12px;
  }
  
  .float-icon {
    width: 56px;
    height: 56px;
    font-size: 26px;
  }
}


/* === FLYING COLLECT ANIMATION (added) === */
.flying-element {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  font-size: 32px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.flying-element img {
  width: 40px;
  height: 40px;
}

.flying-element::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.6) 0%, transparent 70%);
  /* animation: trailPulse 0.2s ease-out infinite; -- DISABLED for performance */
}

@keyframes trailPulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.collect-sparkle {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
}

.collect-sparkle span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: sparkFly 0.4s ease-out forwards;
}

.collect-sparkle span:nth-child(1) { background: #ffd93d; --angle: 0deg; }
.collect-sparkle span:nth-child(2) { background: #ff6b6b; --angle: 90deg; }
.collect-sparkle span:nth-child(3) { background: #00d9a5; --angle: 180deg; }
.collect-sparkle span:nth-child(4) { background: #667eea; --angle: 270deg; }

@keyframes sparkFly {
  0% { transform: rotate(var(--angle)) translateX(0); opacity: 1; }
  100% { transform: rotate(var(--angle)) translateX(25px); opacity: 0; }
}

.target-bounce {
  animation: targetBounce 0.3s ease-out;
}

@keyframes targetBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* === TELEGRAM MOBILE OPTIMIZATION === */

/* Hide desktop elements on mobile */
.side-nav,
.floating-icons,
.session-stats {
  display: none !important;
}

/* Mobile Bottom Tab Bar */
.mobile-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(30, 25, 55, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-width: 56px;
}

.mobile-tab.active {
  background: rgba(102, 126, 234, 0.3);
}

.mobile-tab:active {
  transform: scale(0.95);
}

.mobile-tab-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.75;
  transition: all 0.2s ease;
}

.mobile-tab.active .mobile-tab-icon {
  opacity: 1;
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.4));
}

.mobile-tab-label {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mobile-tab.active .mobile-tab-label {
  color: #fff;
}

.mobile-tab-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  background: #ff6b6b;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Emoji icons for tabs */
.mobile-tab-emoji {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.mobile-tab.active .mobile-tab-emoji {
  transform: scale(1.1);
}

/* Locked tabs during onboarding */
.mobile-tab.locked {
  opacity: 0.5;
  position: relative;
}

.mobile-tab.locked .mobile-tab-emoji {
  filter: grayscale(0.7) brightness(0.7);
}

.mobile-tab-lock {
  position: absolute;
  top: 0;
  right: 4px;
  font-size: 10px;
}

/* Action Bar (above navigation) */
.action-bar {
  position: fixed;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(40, 35, 70, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  min-width: 40px;
}

.action-btn:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.15);
}

.action-btn-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.action-btn-emoji {
  font-size: 22px;
  line-height: 24px;
}

.action-btn-label {
  font-size: 8px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.action-btn.has-alert::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 8px;
  width: 8px;
  display: none; /* Disabled - using .action-badge instead */
  height: 8px;
  background: #ff6b6b;
  border-radius: 50%;
  animation: alertPulse 2s ease-in-out infinite;
}

.action-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.4);
}

.action-badge.alert {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  box-shadow: 0 2px 4px rgba(255, 107, 107, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
}

/* Fullscreen Panel */
.fullscreen-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(70px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(40,35,70,0.98) 0%, rgba(60,50,90,0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 998;
  display: none;
  flex-direction: column;
  animation: slideUpPanel 0.25s ease-out;
}

.fullscreen-panel.active {
  display: flex;
}

@keyframes slideUpPanel {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fullscreen-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(60,50,90,0.5);
}

.fullscreen-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.fullscreen-panel-close {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-panel-close:active {
  background: rgba(255,255,255,0.2);
}

.fullscreen-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Help topic buttons */
.help-topic-btn {
  background: rgba(255,255,255,0.9);
  color: #333;
  border: none;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-topic-btn:active {
  transform: scale(0.95);
  background: rgba(255,255,255,0.7);
}

/* Mobile Quick Actions (top-left corner) - DEPRECATED, now using bottom-quick-bar */
.mobile-quick-actions {
  display: none !important;
}

.quick-action-btn {
  width: 40px;
  height: 40px;
  background: rgba(60, 50, 90, 0.85);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action-btn:active {
  transform: scale(0.9);
  background: rgba(102, 126, 234, 0.5);
}

.quick-action-btn.has-alert::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #ff6b6b;
  border-radius: 50%;
}

/* Float panel mobile style */
.float-panel.mobile {
  position: fixed;
  bottom: 70px;
  left: 8px;
  right: 8px;
  max-height: 60vh;
  background: rgba(40, 35, 70, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  overflow-y: auto;
}

/* Optimize HUD for mobile */
.game-hud {
  padding: 8px 12px !important;
  gap: 8px !important;
}

.hud-center {
  gap: 8px !important;
}

.hud-currency {
  font-size: 13px !important;
  padding: 4px 8px !important;
}

.hud-icon {
  width: 16px !important;
  height: 16px !important;
}

.hud-moves {
  font-size: 13px !important;
  padding: 4px 8px !important;
}

.hud-level-num {
  width: 28px !important;
  height: 28px !important;
  font-size: 12px !important;
}

.hud-avatar-img {
  width: 32px !important;
  height: 32px !important;
}

.hud-avatar-rank {
  font-size: 8px !important;
}

/* Optimize game grid for mobile full-screen */
.game-fullscreen {
  padding-bottom: 70px !important; /* Space for tab bar */
}

.game-grid-wrapper {
  padding: 0 4px !important;
}

.match-grid-container {
  padding: 8px !important;
  border-radius: 16px !important;
}

.match-grid {
  gap: 4px !important;
}

.match-cell {
  border-radius: 10px !important;
}

/* Status bar compact */
.status-bar {
  padding: 6px 12px !important;
  font-size: 11px !important;
  margin-bottom: 8px !important;
}

/* Onboarding goal compact */
.onboarding-goal {
  padding: 8px 12px !important;
  margin-bottom: 8px !important;
}

.goal-text {
  font-size: 13px !important;
}

.goal-progress {
  height: 6px !important;
}

/* Make screens scroll properly with tab bar */
#screen-map,
#screen-quests,
#screen-inventory,
#screen-farm,
#screen-shop,
#screen-profile {
  padding-bottom: 80px !important;
  padding-right: 0 !important; /* Remove side-nav space */
}

/* Modal adjustments for mobile */
.modal-content {
  max-width: 95vw !important;
  max-height: 85vh !important;
  margin: 10px !important;
}

/* Optimize touch targets */
button, .btn, .card-item, .quest-item {
  min-height: 44px;
}

/* Prevent zoom on double-tap */
* {
  touch-action: manipulation;
}
