/* Базові стилі */
body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
  background: #000D50;
}

/* Shared layout sizing variables */
:root {
  --bottom-bar-height: 78px;
  --inventory-bar-height: 77px;
  --inventory-spacing: 12px;
}

@media (max-width: 420px) {
  :root {
    --inventory-bar-height: 65px;
  }
}

/* === ЕКРАН ЗАВАНТАЖЕННЯ === */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #001a33 0%, #000d1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.loading-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/assets/images/ice-texture.png');
  background-repeat: repeat;
  opacity: 0.05;
  pointer-events: none;
}

.loading-screen__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 400px;
  padding: 20px;
}

.loading-screen__logo {
  width: 180px;
  height: 180px;
  margin-bottom: 40px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    filter: drop-shadow(0 0 20px rgba(100, 200, 255, 0.5));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(100, 200, 255, 0.8));
    transform: scale(1.05);
  }
}

.loading-screen__text {
  color: #ffffff;
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
  min-height: 24px;
  opacity: 0.9;
}

.loading-screen__progress {
  width: 100%;
  max-width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.loading-screen__bar {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #0099ff);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.loading-screen__bar.error {
  background: linear-gradient(90deg, #ff4444, #cc0000);
  animation: shake 0.5s;
}

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

.loading-screen__text.error {
  color: #ff6666;
  font-weight: 500;
}

.loading-screen__version {
  position: absolute;
  bottom: 20px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}


/* Карта */
#map {
  position: absolute;
  top: 40px;
  bottom: 6px;
  width: 100%;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.radius-circle {
  position: fixed;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(64, 179, 255, 0.5);
  background: transparent;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 500;
  transition: width 0.3s ease, height 0.3s ease;
}

.user-location-marker {
  width: 16px;
  height: 16px;
  background-color: #FFFFFF;
  border: 2px solid rgba(64, 179, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(64, 179, 255, 0.4);
}

/* Верхня та нижня панелі */
.top-bar {
  position: fixed;
  top: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, #000D50 0%, #001666 100%);
  color: white;
  display: flex;
  padding: 8px 16px;
  box-sizing: border-box;
  z-index: 1001;
}

.top-bar .info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.level-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

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

.level-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4CAF50 0%, #45A049 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.user-info {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
}

.coin-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.coin-container img {
  width: 20px;
  height: 20px;
}

.coin-container span {
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 500;
}

/* Енергетичний бар */
.energy-bar-container {
  position: fixed;
  bottom: calc(var(--bottom-bar-height, 78px) + var(--inventory-bar-height, 77px) + var(--inventory-spacing, 12px) - 10px);
  width: 100%;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px 0 0; /* Змінено: 0 зверху, 10px справа, 0 знизу, 0 зліва */
  box-sizing: border-box;
  z-index: 999;
  background: linear-gradient(to bottom, #050024, #15008A);
  overflow: hidden;
  font-size: 0;
}

/* Приховуємо можливу зайву іконку-зображення на початку контейнера */
.energy-bar-container > img:first-child {
  display: none !important;
}
.energy-bar-container > img {
  display: none !important;
}

/* Переконаємося, що прогрес-бар XP правильно стилізований */
.level-bar-fill {
  height: 100% !important;
  background-color: #4DFF00 !important;
  border-radius: 16px !important;
  transition: width 0.3s ease !important;
  min-width: 0 !important; /* Щоб бар починався з 0% */
}
.energy-bar-container > * {
  font-size: 12px;
}

.energy-bar {
  flex: 1;
  height: 100% !important; /* Встановлюємо висоту 26px */
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 11px 11px 0;
  overflow: hidden;
  position: relative;
  max-width: 500px;
  margin-right: 70px;
}

.energy-fill {
  min-width: 15px;
  height: 100%; /* Шкала енергії займає всю висоту батьківського .energy-bar */
  background: none;
  border-radius: 0 11px 11px 0;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.energy-lightning {
  position: absolute;
  height: 100%; /* Блискавка займає всю висоту батьківського .energy-fill */
  width: 100%; /* Змушуємо зображення заповнювати всю ширину батьківського .energy-fill */
  left: 0;
  top: 0;
  object-fit: cover;
  object-position: left;
}

.energy-text {
  color: #ffffff;
  font-size: 12px;
  min-width: 70px;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  position: absolute;
  right: 10px;
  padding-left: 7px;
  z-index: 1000;
}

.energy-text::before {
  content: '';
  position: absolute;
  left: -4px; /* Відсуваємо іконку на 2px вліво */
  top: 50%;
  transform: translateY(-50%);
  width: 26px; /* Змінено ширину іконки */
  height: 26px; /* Змінено висоту іконки, щоб відповідати висоті панелі */
  background-image: url('/assets/icons/gold-lightning.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.energy-text.no-energy::before {
  background-image: url('/assets/icons/red-lightning.png');
}

/* Стани без енергії */
.energy-bar-container.no-energy-state {
  display: flex;
  align-items: center;
  padding: 0 10px;
  /* Прибираємо непотрібні властивості flexbox */
}

/* Приховуємо ТІЛЬКИ бар енергії, НЕ лічильник */
.energy-bar-container.no-energy-state .energy-bar {
  display: none !important;
}

.energy-refresh-timer {
  order: 1;
  color: white;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  margin-left: 0; /* Прибираємо лівий відступ */
  margin-right: 8px; /* Залишаємо невеликий відступ справа */
  line-height: 26px;
  height: 26px;
  flex-grow: 1; /* Дозволяємо таймеру зайняти доступний простір */
  min-width: 150px; /* Мінімальна ширина для тексту таймера, можна підібрати */
}

.energy-ad-button {
  order: 2;
  cursor: pointer;
  height: 26px; /* Встановлюємо висоту 26px */
  margin: 0 10px 0 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 180px;
  overflow: hidden;
  z-index: 1003;
}

.energy-ad-button img {
  height: 20px;
  width: auto;
}

/* Нижня панель */
.bottom-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 78px; /* Змінено: збільшуємо висоту на 10px */
  background: #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  z-index: 1001;
  box-sizing: border-box;
}

.menu-icon {
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  font-size: 10px;
  position: relative;
  padding: 6px 4px 15px 4px; /* Змінено: верхній відступ 6px, нижній 15px */
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Змінено: вирівнювання вмісту по верху */
  gap: 5px;
  min-width: 75px;
  max-width: 140px;
  width: 25%;
  transition: all 0.3s ease;
}

.menu-icon img {
  width: auto;
  height: 24px;
  max-width: 100%;
  opacity: 0.5;
  transition: all 0.3s ease;
  margin-bottom: 4px;
}

.menu-icon.active {
  color: white;
}

.menu-icon.active img {
  opacity: 1;
}

.menu-icon.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 1px;
  background: #FFFFFF;
  border-radius: 0.5px;
}

.soon-badge {
  position: absolute;
  top: 0px;
  right: 25px;
  background-color: #FFD700;
  color: #333;
  font-size: 8px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 10px;
  z-index: 1002;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Прогрес будівель */
.tap-progress-container {
  position: absolute;
  width: 46px;
  height: 46px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 900;
  filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.25));
}

.tap-progress {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.tap-progress-text {
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: color 0.3s ease;
}

.tap-progress::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: conic-gradient(
    #FFFFFF 0,
    #FFFFFF calc(var(--progress, 0) * 3.6deg),
    #00DDFF calc(var(--progress, 0) * 3.6deg)
  );
  mask: radial-gradient(closest-side, transparent 75%, white 76%);
  -webkit-mask: radial-gradient(closest-side, transparent 75%, white 76%);
  transition: all 0.3s ease;
  filter: drop-shadow(0px 2px 4px rgba(0, 157, 255, 0.25));
}

.tap-progress.generating-coins::before {
  background: conic-gradient(
    #FFFFFF 0,
    #FFFFFF calc((100 - var(--progress, 0)) * 3.6deg),
    #00DDFF calc((100 - var(--progress, 0)) * 3.6deg)
  );
}

.tap-progress-text.generating-coins {
  color: #ffffff;
  animation: coinPulse 2s infinite;
}

.user-avatar {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #FFD700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%) rotate(-45deg);
  z-index: 901;
  top: 25%;
  left: -15px;
  background-color: #222;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generating-coins ~ .user-avatar {
  animation: avatarPulse 2s infinite;
}

/* Логотип */
#icetown-logo {
  position: absolute;
  top: 45px;
  left: 5px;
  z-index: 900;
  width: 64px;
  height: 64px;
  pointer-events: auto;
  cursor: pointer;
}

#icetown-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Стилі для сторінки профілю */
.screen-container {
  position: fixed;
  top: 40px;
  bottom: 78px; /* Змінено: піднімаємо нижню межу на 10px */
  left: 0;
  right: 0;
  z-index: 900;
  /* Змінено однотонний фон на градієнт */
  background-image: linear-gradient(to bottom, #0009FF, #000599);
}

#profile-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 15px 0;
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
}

#profile-page,
.profile-content,
.profile-stats,
.stat-rows,
.stat-group {
  box-sizing: border-box;
}

.profile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto; /* Ensure centering for max-width */
  max-width: 500px;
  padding-bottom: 20px;
}

.profile-avatar {
  text-align: center;
  margin-bottom: 30px;
}

.avatar-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid #0099FF;
  margin: 0 auto;
  background-color: #222;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.profile-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto; /* Ensure centering for max-width */
  max-width: 500px; /* Обмежуємо ширину */
}

.level-label {
  font-size: 26px;
  color: white;
  margin-bottom: 10px;
  text-align: center;
}

/* ОНОВЛЕНО: Стилі для рівня - окремо, бо він має іншу структуру */
.level-bar-wrapper {
  position: relative;
  width: 80%;
  max-width: 240px;
  margin: 0 auto 10px; /* Зменшуємо нижній відступ з 15px до 10px */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-bar-container {
  height: 35px;
  background-color: #3A4B3D;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid #0099FF;
  width: 100%;
  position: relative;
}

/* Прибираємо старий стиль для .level-info, який позиціонувався некоректно */
/*
.level-info {
  position: absolute;
  right: -30px;
  top: 16px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.level-info img {
  width: 100%;
  height: 100%;
  display: block;
}
*/

/* Спеціальний стиль для .info-icon-wrapper в level-bar-wrapper */
.level-bar-wrapper .info-icon-wrapper {
  position: absolute;
  right: -30px;
  top: 0; /* Позиціонуємо відносно верху wrapper'а */
  width: 18px; /* Ширина обгортки */
  height: 32px; /* Робимо висоту рівну висоті графічного бару */
  display: flex;
  align-items: center; /* Центруємо іконку всередині 32px висоти */
  justify-content: center;
  transform: none; /* Скидаємо будь-які трансформації на обгортці */
  z-index: 10; /* Переконуємось, що вона над баром */
}

/* Стиль для самої іконки info в level-bar */
.level-bar-wrapper .info-icon.level-info {
  position: static; /* Скидаємо absolute позиціонування */
  width: 18px; /* Розмір самої іконки */
  height: 18px;
  cursor: pointer;
  display: flex; /* Використовуємо flex для центрування img всередині, якщо .level-info - це div */
  align-items: center;
  justify-content: center;
  transform: none; /* Скидаємо будь-які трансформації на іконці */
  top: auto; /* Скидаємо top */
  right: auto; /* Скидаємо right */
}

/* ОНОВЛЕНО: Стилі для цифрового лічильника XP на сторінці профілю */
.xp-counter-text {
  font-size: 14px;
  color: #FFFFFF;
  text-align: center;
  margin-top: 5px; /* Зменшуємо відступи */
  margin-bottom: 5px;
  line-height: 1; /* Фіксуємо висоту лінії */
}

.xp-counter-text::before {
  content: "XP: ";
}

/* ОНОВЛЕНО: Контейнер для рядків статистики */
.stat-rows {
  width: 100%;
  margin: 5px 0; /* Зменшуємо відступи */
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center; /* Центруємо всі рядки */
}
.stat-rows { margin: 0 auto; } /* Ensure centering for max-width */

/* ОНОВЛЕНО: Контейнер для статистики */
.stats-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px; /* Зменшуємо відступ між рядками з 20px до 8px */
}

/* ОНОВЛЕНО: Контейнер для групи статистики */
.stat-group {
  width: 100%;
  max-width: 400px; /* Обмежуємо максимальну ширину для кращого центрування */
  position: relative;
  margin-bottom: 10px; /* Зменшуємо відступ між рядками з 20px до 10px */
  height: 40px; /* Зменшуємо висоту з 50px до 40px */
  display: flex;
  align-items: center; /* Вирівнюємо всі елементи по центру рядка */
  justify-content: center; /* Центруємо контент горизонтально */
}

/* ОНОВЛЕНО: Стиль для центрального значення */
.stat-value {
  font-size: 30px;
  font-weight: bold;
  color: #ECBE01;
  text-align: center;
  z-index: 5;
  line-height: 1; /* Фіксуємо висоту лінії */
  display: flex;
  align-items: center; /* Вирівнюємо текст по центру */
  position: relative;
}

.stat-value.energy {
  color: white;
}

.stat-value.crystals {
  color: #B626E3;
}

/* ОНОВЛЕНО: Стиль для іконки статистики */
.stat-icon {
  width: 36px; /* Трохи зменшуємо розмір іконки */
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 0; /* Розташовуємо зліва */
  top: 50%;
  transform: translateY(-50%); /* Центруємо вертикально */
}

.stat-icon img {
  max-width: 32px; /* Зменшуємо розмір зображення */
  max-height: 32px;
  display: block; /* Прибираємо inline поведінку */
}

/* ОНОВЛЕНО: Стиль для іконки info */
.info-icon {
  width: 18px; /* Трохи зменшуємо розмір */
  height: 18px;
  cursor: pointer;
  position: absolute;
  right: 0; /* Розташовуємо справа */
  top: 50%;
  transform: translateY(-50%); /* Центруємо вертикально */
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-icon img {
  width: 100%;
  height: 100%;
  display: block; /* Прибираємо inline поведінку */
}

/* ОНОВЛЕНО: Обгортка для іконки info (якщо вона є) */
.info-icon-wrapper {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; /* Відповідно зменшуємо */
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Анімації */
@keyframes coinPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes avatarPulse {
  0% { transform: translate(-50%, -50%) rotate(-45deg) scale(1); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
  50% { transform: translate(-50%, -50%) rotate(-45deg) scale(1.1); box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5); }
  100% { transform: translate(-50%, -50%) rotate(-45deg) scale(1); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
}

@keyframes redPulse {
  0% { opacity: 1; text-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
  50% { opacity: 0.6; text-shadow: 0 0 10px rgba(255, 0, 0, 0.8); }
  100% { opacity: 1; text-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
}

/* Схованка для сервісних елементів */
.mapboxgl-control-container,
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib {
  display: none !important;
}

.energy-bar-container.no-energy-state {
  display: flex;
  align-items: center;
  padding: 0 10px; /* Встановлюємо відступи для забезпечення правильного розташування */
}

.energy-bar-container.no-energy-state .energy-bar {
  display: none !important; /* Приховуємо ТІЛЬКИ бар енергії */
}

.energy-bar-container.no-energy-state #energy-text {
  display: block !important;
  position: absolute;
  right: 10px;
  z-index: 1000;
}

.energy-refresh-timer {
  color: white;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  margin-left: 10px;
  white-space: nowrap;
  line-height: 26px;
  /* Важливо: прибираємо order та flex-grow, які могли зламати макет */
}

.energy-ad-button {
  cursor: pointer;
  height: 26px;
  flex-grow: 1; 
  min-width: 0; 
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px; /* Відступ від таймера */
  /* Важливо: прибираємо margin-right: auto, який міг зламати макет */
}

/* Стилі для системи скринь - додати до styles.css */

/* Маркери скринь */
.chest-marker {
  width: 40px;
  height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: all 0.3s ease;
  filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.3));
  z-index: 800;
}

.chest-marker:hover {
  transform: scale(1.1);
  filter: drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.4));
}

/* Анімація появи скрині */
.chest-marker.spawning {
  animation: chestSpawn 0.6s ease-out;
}

@keyframes chestSpawn {
  0% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(90deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Анімація збору скрині */
.chest-marker.collecting {
  animation: chestCollect 0.5s ease-in forwards;
}

@keyframes chestCollect {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.3) rotate(180deg);
    opacity: 0.6;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

/* Попап нагороди */
#chest-reward-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 0;
  box-sizing: border-box;
}

#chest-reward-popup.hidden {
  display: none;
}

/* Контейнер попапу */
.chest-reward-container {
  width: 388px;
  height: 483px;
  background-image: url('/assets/images/chest-crystal-popup.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin-bottom: 20px;
}

/* Анімація появи попапу */
#chest-reward-popup.showing .chest-reward-container {
  transform: translateY(0);
}

/* Анімація зникнення попапу */
#chest-reward-popup.hiding .chest-reward-container {
  transform: translateY(100%);
}

/* Текст з кількістю кристалів */
.chest-reward-text {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  color: #FFFFFF;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 10001;
}

/* Анімація появи тексту */
.chest-reward-text.showing {
  animation: textAppear 0.6s ease-out 0.2s both;
}

@keyframes textAppear {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* Ефект блискавки навколо тексту */
.chest-reward-text::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: sparkle 2s ease-in-out infinite;
  z-index: -1;
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
}

/* Кнопка закриття (невидима, на весь попап) */
.chest-reward-close {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10002;
}

/* Блокування взаємодії з іншими елементами */
.ui-blocked {
  pointer-events: none;
  user-select: none;
}

.ui-blocked .bottom-bar,
.ui-blocked .top-bar,
.ui-blocked .energy-bar-container,
.ui-blocked #map {
  pointer-events: none;
}

/* --- Виправлення для центрування в таблиці лідерів --- */
.leaderboard-entry .entry-position,
.leaderboard-entry .entry-xp,
.leaderboard-entry .entry-prize {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 480px) {
  .chest-reward-container {
    width: 90%;
    max-width: 350px;
    height: auto;
    aspect-ratio: 388/483;
  }
  
  .chest-reward-text {
    font-size: 20px;
  }
}

@media (max-height: 600px) {
  .chest-reward-container {
    height: 70vh;
    width: auto;
    aspect-ratio: 388/483;
  }
  
  #chest-reward-popup {
    align-items: center;
    padding-bottom: 0;
  }
}

/* Ефект пульсації для маркера скрині коли користувач поблизу */
.chest-marker.in-range {
  animation: chestPulse 1.5s ease-in-out infinite;
}

@keyframes chestPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.3));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0px 6px 12px rgba(255, 215, 0, 0.6));
  }
}

/* Ефект мерехтіння для нових скринь */
.chest-marker.new {
  animation: chestGlow 2s ease-in-out infinite;
}

@keyframes chestGlow {
  0%, 100% {
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.3));
  }
  50% {
    filter: drop-shadow(0px 4px 16px rgba(83, 95, 229, 0.8)) 
            drop-shadow(0px 0px 20px rgba(162, 202, 251, 0.4));
  }
}

/* CSS стилі для таймера життя скрині - додати до styles.css */

/* Таймер життя скрині */
.chest-lifetime-timer {
  position: absolute;
  color: white;
  font-size: 8px; 
  font-weight: bold; 
  
  z-index: 401;
  pointer-events: none;
  text-align: center;
  
  /* ДОДАНО: Півпрозорий фіолетовий фон */
  background: rgba(191, 80, 255, 0.75);
  border-radius: 50px;
  
  /* ДОДАНО: Розміри та padding */
  min-width: 85px;
  width: auto;
  height: 15px;
  padding: 1px 1px; /* Внутрішні відступи для тексту */
  
  /* Центрування тексту всередині */
  display: flex;
  align-items: center;
  justify-content: center;
  
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
  
  transition: opacity 0.3s ease;
  
  /* Прибираємо старі налаштування */
  box-shadow: none !important;
  border: none !important;
}

/* Анімація попередження коли залишається мало часу (менше 5 хвилин) */
.chest-lifetime-timer.warning {
  animation: timerWarning 1s ease-in-out infinite;
  /* Зберігаємо фон у стані warning */
  background: rgba(191, 80, 255, 0.75);
}

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

/* Критичний стан коли залишається менше 1 хвилини */
.chest-lifetime-timer.critical {
  background: rgba(191, 80, 255, 0.75);
  animation: timerCritical 0.5s ease-in-out infinite;
}

@keyframes timerCritical {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Анімація для елемента кристалів при отриманні нових кристалів */
.stat-value.crystals.crystal-added {
  animation: crystalPulse 1s ease-out;
}

@keyframes crystalPulse {
  0% {
    transform: scale(1);
    color: #B626E3;
  }
  25% {
    transform: scale(1.3);
    color: #D94BFF;
    text-shadow: 0 0 20px rgba(182, 38, 227, 0.8);
  }
  50% {
    transform: scale(1.2);
    color: #E55FFF;
    text-shadow: 0 0 30px rgba(182, 38, 227, 1);
  }
  100% {
    transform: scale(1);
    color: #B626E3;
    text-shadow: none;
  }
}

/* Додаткова анімація блиску для іконки кристалів */
.stat-value.crystals.crystal-added ~ .stat-icon img {
  animation: crystalIconGlow 1s ease-out;
}

@keyframes crystalIconGlow {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 0 transparent);
  }
  50% {
    filter: brightness(1.5) drop-shadow(0 0 15px rgba(182, 38, 227, 0.8));
  }
}

/* CSS стилі для індикатора синхронізації */
.sync-indicator {
    position: fixed;
    top: 60px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
}

.sync-icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}


/* Leaderboard Page Styles */
#leaderboard-page {
  display: none;
  flex-direction: column;
  padding: 20px 0px;
  overflow-y: auto;
}

.leaderboard-content {
  padding: 0 15px;
  box-sizing: border-box;
  overflow-x: hidden;
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  width: 100%;
}

/* Season banner */
.season-banner {
  background: linear-gradient(90deg, #FFA500 0%, #FF1493 100%);
  border-radius: 20px;
  padding: 10px 12px !important; 
  text-align: center;
  margin: 0 0 10px 0 !important;
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
  width: 100%;
  box-sizing: border-box;
}

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

/* Tabs */
.leaderboard-tabs {
  margin-bottom: 20px;
}

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

.tab-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
  position: relative;
  cursor: pointer;
}

.tab-title.active {
  color: white;
}

.tab-title.disabled {
  color: #666;
  cursor: not-allowed;
}

.soon-badge-small {
  position: absolute;
  top: -8px; /* Було -10px */
  right: -20px !important; /* Було -40px */
  background: #FFD700;
  color: #000;
  padding: 1px 4px !important; /* Було 2px 8px */
  border-radius: 6px; /* Було 10px */
  font-size: 7px !important; /* Було 10px */
  font-weight: 600;
}

/* Period tabs */
.period-tabs {
  display: flex;
  gap: 3px !important; /* Було 10px */
  background: rgba(255, 255, 255, 0.1);
  padding: 2px !important; /* Було 5px */
  border-radius: 12px !important; /* Було 20px */
  max-width: 100%;
  box-sizing: border-box;
}

.period-tab {
  flex: 1;
  padding: 4px 8px !important; /* Було 10px 20px */
  border: none;
  background: transparent;
  color: white;
  font-size: 11px !important; /* Було 16px */
  font-weight: 600;
  border-radius: 8px !important; /* Було 15px */
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.period-tab.active {
  background: white;
  color: #0009FF;
}

/* Leaderboard table */
.leaderboard-table {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 15px;
  margin: 0 0 20px 0;  /* ✅ Без бокових margin */
  width: 100%;  /* ✅ На всю ширину */
  box-sizing: border-box;
}



.header-cell {
  color: #00BFFF;
  font-size: 14px;
  font-weight: 600;
}

.table-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.table-header {
  display: grid !important;
  grid-template-columns: 50px 1fr 100px 100px !important;
  gap: 12px !important;
}

.leaderboard-entry {
  display: grid !important;
  grid-template-columns: 50px 1fr 100px 100px !important;
  gap: 12px !important;
}

.leaderboard-entry:last-child {
  border-bottom: none;
}

.entry-position {
  color: white !important; 
  font-size: 16px;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.entry-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFD700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.player-name {
  color: white;
  font-size: 16px;
  font-weight: 500;
}

.entry-xp {
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.entry-prize {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #FFD700;
  font-size: 16px;
  font-weight: 600;
}

.coin-icon {
  width: 20px;
  height: 20px;
}

/* User position separator */
.user-separator {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 20px;
}

/* Prize section */
.prize-section {
  background: transparent;
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 15px;
  text-align: center;
}

.prize-available {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  color: white;
  font-weight: 600;
  margin-bottom: 10px;
}

.prize-timer {
  color: #FFD700;
  font-size: 14px;
  margin-bottom: 15px;
}

.collect-button {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
  box-shadow: none;
}

.collect-button:hover {
  transform: scale(1.05);
  box-shadow: none;
}

.collect-button img {
  height: 60px;
}

/* Next reward section */
.next-reward-section,
.no-rewards-section {
  text-align: center;
  color: #999;
  font-size: 16px;
  padding: 20px;
}



/* Порожній аватар */
.player-avatar.empty {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  font-weight: 600;
}

/* Стилі для порожніх записів */
.leaderboard-entry:has(.player-avatar.empty) {
  opacity: 0.5;
}

.leaderboard-entry:has(.player-avatar.empty) .entry-xp,
.leaderboard-entry:has(.player-avatar.empty) .entry-prize {
  color: rgba(255, 255, 255, 0.5);
}

/* Таймер наступної скрині */
.next-chest-container {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 950; /* Над картою, але під верхньою панеллю */
  display: none; /* Приховано за замовчуванням */
  flex-direction: column;
  align-items: center;
  gap: 4px; /* Відступ між іконкою та таймером */
  
  /* ВИДАЛЕНО: background-color, padding, border-radius, border, box-shadow */
  background-color: transparent; /* Прибираємо фон з контейнера */
  padding: 0; /* Прибираємо padding */
  
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(-20px);
  opacity: 0;
}

.next-chest-container.visible {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* Іконка скрині */
.next-chest-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); /* Додаємо тінь до іконки */
}

/* Таймер з фоном (як на маркері скрині) */
.next-chest-timer-text {
  color: white;
  font-size: 12px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.7); /* Тінь тексту */
  
  /* ДОДАНО: Фон таймера (як на маркері скрині) */
  background: rgba(191, 80, 255, 0.75);
  border-radius: 50px;
  padding: 4px 12px;
  
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  
  /* Центрування тексту */
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 85px;
  height: 20px;
}

/* ========================================================================== */
/* Arrow to Chest Pointer System - ОНОВЛЕНО                                  */
/* ========================================================================== */

/* Головний контейнер */
.chest-pointer-container {
  position: fixed;
  display: none;
  z-index: 1002;
  pointer-events: none;
  transition: opacity 0.3s ease;
  
  /* Оновлено для інфо-панелі */
  width: auto;
  min-width: 100px;
  height: auto;
}

/* Іконка-стрілка */
.chest-pointer-container .chest-pointer {
  width: 40px;
  height: 40px;
  display: block;
  background-image: url('/assets/icons/chest-arrow.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform-origin: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  position: relative;
  margin: 0 auto 8px; /* Центруємо стрілку */
  transform: rotate(var(--pointer-rotation, 90deg));
}

/* НОВИЙ: Панель з інформацією */
.chest-info-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
}

/* НОВИЙ: Таймер життя скрині */
.chest-info-timer {
  background: rgba(191, 80, 255, 0.75);
  border-radius: 50px;
  padding: 4px 12px;
  
  color: white;
  font-size: 12px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  text-align: center;
  letter-spacing: 0.5px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Стани таймера */
.chest-info-timer.warning {
  background: rgba(255, 165, 0, 0.85);
}

.chest-info-timer.critical {
  background: rgba(255, 69, 0, 0.9);
  animation: timerBlink 0.5s ease-in-out infinite;
}

@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* НОВИЙ: Нижній рядок (відстань + іконка) */
.chest-info-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 123, 255, 0.85);
  border-radius: 50px;
  padding: 4px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Оновлена відстань */
.chest-pointer-container .chest-distance {
  color: white;
  font-size: 14px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  text-align: center;
  /* Видалено старе позиціонування */
  position: static;
  transform: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

/* НОВИЙ: Іконка скрині */
.chest-info-icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Анімації при активному вказівнику */
.chest-pointer-container.pointing .chest-pointer {
  animation: pointerPulse 1.5s ease-in-out infinite;
}

.chest-pointer-container.pointing .chest-info-timer,
.chest-pointer-container.pointing .chest-info-bottom {
  animation: infoPulse 1.5s ease-in-out infinite;
}

@keyframes pointerPulse {
  0%, 100% {
    transform: rotate(var(--pointer-rotation, 90deg)) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: rotate(var(--pointer-rotation, 90deg)) scale(1.1);
    opacity: 1;
  }
}

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

/* Анімація для тексту відстані */
@keyframes distancePulse {
  0%, 100% {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 215, 0, 0.4);
  }
  50% {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
  }
}
/* МІНІМАЛЬНЕ ВИПРАВЛЕННЯ ДЛЯ КАРТИ */
#map {
  min-height: 200px !important;
  position: absolute !important;
  top: 40px !important;
  bottom: calc(var(--bottom-bar-height, 78px) + var(--inventory-bar-height, 77px) + var(--inventory-spacing, 12px)) !important;
}

/* Забезпечуємо що canvas карти має правильний розмір */
.mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* КРИТИЧНЕ ВИПРАВЛЕННЯ: Забезпечуємо що карта завжди видима коли потрібно */
#map {
  min-height: 300px !important;
}

#map.map-loading {
  background: linear-gradient(135deg, #001a33 0%, #000d1a 100%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#map.map-loading::after {
  content: 'Завантаження карти...' !important;
  color: white !important;
  font-size: 16px !important;
}

/* КРИТИЧНЕ ВИПРАВЛЕННЯ: Форсування видимості скринь */
.mapboxgl-marker .chest-marker {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Fallback стилі для скринь без зображення */
.chest-marker.fallback {
  background-color: #FFD700 !important;
  border: 2px solid #FFA500 !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 20px !important;
  color: white !important;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7) !important;
}
/* === МОБІЛЬНА АДАПТАЦІЯ ДЛЯ ЛІДЕРБОРДА === */

/* === ТАБЛИЦЯ ЛІДЕРБОРДА === */
.leaderboard-table {
  padding: 10px 6px !important; /* Ще менші відступи */
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  box-sizing: border-box;
}

/* Мобільна сітка для заголовків */
.table-header {
  display: grid !important;
  grid-template-columns: 28px 1fr 70px 75px !important; /* Ще компактніше */
  gap: 4px !important; /* Менший проміжок */
  padding: 6px 8px !important; /* Менші відступи */
}

/* Зменшуємо шрифти заголовків */
.header-cell {
  font-size: 11px !important;
  font-weight: 600;
  color: #00BFFF;
}

.header-cell:nth-child(1) {
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.header-cell:nth-child(3) {
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.header-cell:nth-child(4) {
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Мобільна сітка для записів */
.leaderboard-entry {
  display: grid !important;
  grid-template-columns: 28px 1fr 70px 75px !important; /* Синхронно з заголовками */
  gap: 4px !important;
  padding: 8px !important; /* Менший padding */
  align-items: center;
  transition: background 0.3s ease;
}

/* === ВИДІЛЕННЯ ПОЗИЦІЇ КОРИСТУВАЧА === */
.leaderboard-entry.user-position {
  background: #1B0067 !important; /* Фіолетовий фон */
  border-radius: 30px !important;
  padding: 8px 10px !important;
  box-shadow: 0 0 15px rgba(27, 0, 103, 0.5); /* М'яке світіння */
  position: relative;
  z-index: 2;
}

/* Додаткове виділення для топ-5 користувача */
.leaderboard-entry.user-position .entry-position {
  color: #FFD700 !important; /* Золотий номер позиції */
  font-weight: 700 !important;
}

.leaderboard-entry.user-position .player-name {
  color: #FFFFFF !important;
  font-weight: 600 !important;
}

.leaderboard-entry.user-position .entry-xp {
  color: #00BFFF !important; /* Яскравіший синій для XP */
}

.leaderboard-entry.user-position .entry-prize {
  color: #FFD700 !important;
}

/* М'яка анімація появи виділення */
@keyframes userHighlight {
  0% {
    background: transparent;
    box-shadow: none;
  }
  100% {
    background: #1B0067;
    box-shadow: 0 0 15px rgba(27, 0, 103, 0.5);
  }
}

.leaderboard-entry.user-position {
  animation: userHighlight 0.5s ease-in-out;
}

/* === ПОЗИЦІЇ === */
.entry-position {
  font-size: 14px !important; /* Зменшено */
  color: white !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* === ГРАВЦІ === */
.entry-player {
  display: flex;
  align-items: center;
  gap: 5px !important; /* Зменшено */
  min-width: 0;
}

/* Менші аватари */
.player-avatar {
  width: 28px !important; /* Зменшено */
  height: 28px !important;
  flex-shrink: 0;
  border-radius: 50%;
  background: #FFD700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Адаптивні імена гравців */
.player-name {
  font-size: 13px !important; /* Зменшено */
  font-weight: 500;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* === XP І ПРИЗИ === */
.entry-xp {
  font-size: 13px !important; /* Зменшено */
  font-weight: 600;
  color: white;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-prize {
  font-size: 13px !important; /* Зменшено */
  font-weight: 600;
  color: #FFD700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px !important; /* Зменшено */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Менші іконки монет */
.coin-icon {
  width: 14px !important; /* Зменшено */
  height: 14px !important;
  flex-shrink: 0;
}

/* === ІНШІ ЕЛЕМЕНТИ === */

/* Банер сезону - СИНХРОНІЗОВАНО З ТАБЛИЦЕЮ */
.season-banner {
  background: linear-gradient(90deg, #FFA500 0%, #FF1493 100%);
  border-radius: 20px;
  padding: 10px 8px !important;
  text-align: center;
  margin: 0 0 10px 0 !important; /* Видаляємо бокові margin */
  box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
  box-sizing: border-box;
}

.season-text {
  color: white;
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

/* Екстремально стискаємо заголовки табів */
.tab-header {
  display: flex;
  align-items: center;
  gap: 8px !important;
  margin-bottom: 8px !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* Заголовки табів */
.tab-title {
  font-size: 14px !important;
  font-weight: 700;
  color: white;
  position: relative;
  cursor: pointer;
  flex-shrink: 1;
}

/* Таби періодів */
.period-tab {
  padding: 4px 18px;
  font-size: 12px !important;
}

/* Розділювач користувача */
.user-separator {
  font-size: 18px;
  height: 18px;
  margin: 8px 0;
  opacity: 0.7;
  color: #666;
}


/* === АДАПТАЦІЯ ДЛЯ ДУЖЕ МАЛИХ ЕКРАНІВ (320px і менше) === */
@media (max-width: 320px) {
  
  .table-header,
  .leaderboard-entry {
    grid-template-columns: 26px 1fr 65px 70px !important;
    gap: 3px !important;
  }
  
  .header-cell {
    font-size: 10px !important;
  }
  
  .entry-position {
    font-size: 13px !important;
  }
  
  .player-avatar {
    width: 26px !important;
    height: 26px !important;
  }
  
  .player-name,
  .entry-xp,
  .entry-prize {
    font-size: 11px !important;
  }
  
  .coin-icon {
    width: 12px !important;
    height: 12px !important;
  }
  
  .leaderboard-table {
    padding: 8px 4px !important;
  }
  
  .leaderboard-entry.user-position {
    border-radius: 20px !important;
    padding: 6px 8px !important;
  }
}

/* === ОПТИМІЗАЦІЯ ДЛЯ ЛАНДШАФТНОЇ ОРІЄНТАЦІЇ === */
@media (max-width: 768px) and (orientation: landscape) {
  
  .leaderboard-table {
    margin-bottom: 15px;
  }
  
  .season-banner {
    margin-bottom: 15px;
  }
  
  .leaderboard-tabs {
    margin-bottom: 15px;
  }
}

/* === ПОКРАЩЕННЯ ЧИТАБЕЛЬНОСТІ === */
@media (max-width: 480px) {
  
  .leaderboard-entry {
    min-height: 42px; /* Зменшено */
  }
  
  .entry-position,
  .player-name,
  .entry-xp {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
  
  .entry-prize {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
  
  .user-separator {
    opacity: 0.7;
    font-weight: 300;
  }
  
  .leaderboard-entry:has(.player-avatar.empty) {
    opacity: 0.6;
  }
}

/* === ДОДАТКОВІ ПОКРАЩЕННЯ === */
@media (max-width: 480px) {
  .player-name {
    max-width: 100%;
  }
}

/* Prize Notification */
.prize-notification {
  position: fixed;
  top: 20px;
  right: -400px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: right 0.3s ease;
  z-index: 10000;
  max-width: 350px;
}

.prize-notification.show {
  right: 20px;
}

.prize-notification-content {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #000;
}

.prize-notification-icon {
  font-size: 48px;
  animation: bounce 1s infinite;
}

.prize-notification-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

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

/* ==========================================
   ВИПРАВЛЕННЯ: Елементи карти під UI
   Додайте цей код в КІНЕЦЬ файлу css/styles.css
   ========================================== */

/* Mapbox маркери завжди під UI */
.mapboxgl-marker {
  z-index: 400 !important;
}

.chest-marker,
.chest-marker.fallback {
  z-index: 400 !important;
}

/* Таймер життя скрині */
.chest-lifetime-timer {
  z-index: 401 !important;
}

/* Вказівник на скриню */
.chest-pointer-container,
.chest-pointer,
.chest-distance-text {
  z-index: 450 !important;
}

/* Радіус-коло */
.radius-circle {
  z-index: 500 !important;
}

/* Маркер позиції користувача */
.user-location-marker {
  z-index: 490 !important;
}

/* Елементи прогресу */
[id^="building-progress-"],
.building-progress,
.tap-progress-container {
  z-index: 410 !important;
}

/* Карта - найнижче */
.mapboxgl-canvas-container,
.mapboxgl-canvas {
  z-index: 1 !important;
}

/* Переконуємося що UI завжди зверху */
.top-bar {
  z-index: 1001 !important;
}

.bottom-bar {
  z-index: 1000 !important;
}

.energy-bar-container {
  z-index: 999 !important;
}

.inventory-bar {
  z-index: 998 !important;
}

/* ========================================== */