/* Общие стили */
body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #333;
}
.start-overlay {
  /* УБЕРИТЕ position: absolute */
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 55px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
  pointer-events: auto; /* Добавьте это */
}

#start-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  font-family: Arial, sans-serif;
  background-image: url("https://i.imgur.com/rr39k7V.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.start-logo {
  width: 200px;
  height: auto;
  margin-bottom: 20px;
}

#player-name {
  padding: 10px;
  font-size: 16px;
  margin-bottom: 10px;
  border: 2px solid #4caf50;
  border-radius: 5px;
  text-align: center;
}

#start-button {
  padding: 10px 20px;
  font-size: 18px;
  cursor: pointer;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
}

#start-button:hover {
  background-color: #45a049;
}

.hidden {
  display: none !important;
}

/* Контейнер для UI-элементов */
#ui-container {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px; /* Расстояние между элементами */
  pointer-events: none; /* Чтобы элементы не мешали взаимодействию */
  display: none;
}
#ui-container.active {
  display: flex; /* Показываем при активной игре */
}

/* Жизни */
#lives-container {
  display: flex;
  gap: 5px;
}

.life-heart {
  width: 30px;
  height: 30px;
}

/* Шкала ярости */
#rage-bar {
  width: 200px;
  height: 20px;
  background-color: #444;
  border: 2px solid #fff;
  border-radius: 10px;
  overflow: hidden;
}

#rage-fill {
  height: 100%;
  background-color: darkred;
  transition: width 0.3s ease;
}

/* Шкала замедления времени */
#time-slow-bar {
  width: 200px;
  height: 20px;
  background-color: #444;
  border: 2px solid #fff;
  border-radius: 10px;
  overflow: hidden;
}

#time-slow-fill {
  height: 100%;
  background-color: blueviolet;
  transition: width 0.3s ease;
}

/* Счёт */
#score {
  color: white;
  font-family: Arial, sans-serif;
  font-size: 16px;
  text-align: left; /* Выравниваем текст по левому краю */
  padding: 5px 10px; /* Уменьшите отступы */
  border: 2px solid white; /* Рамка */
  border-radius: 5px; /* Закругленные углы */
  background-color: rgba(0, 0, 0, 0.5); /* Полупрозрачный фон */
  width: auto; /* Автоматическая ширина */
  max-width: 150px; /* Максимальная ширина */
  margin: 0; /* Убираем внешние отступы */
  align-self: flex-start; /* Выравниваем элемент по левому краю */
}

/* Игровая область */
#game-area {
  position: relative;
  width: 300px; /* Фиксированная ширина */
  height: 600px; /* Фиксированная высота */
  background-image: url("https://i.imgur.com/QhMmR0M.jpeg");
  background-size: 300px 600px; /* Фиксированный размер */
  background-repeat: repeat-y; /* Повторяем по вертикали */
  background-position: center;
  overflow: hidden;
  border: 2px solid #fff;

  /* Анимация движения дороги */
  animation: move-background 10s linear infinite;
}

/* Ключевые кадры для анимации */
@keyframes move-background {
  from {
    background-position: 0px 0px; /* Начальная позиция */
  }
  to {
    background-position: 0px 600px; /* Смещаем фон вниз */
  }
}

.enemy-car {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.1s;
}

/* Стили для конкретных типов */
.enemy-car.huge-truck {
  width: 60px;
  height: 130px;
}

.enemy-car.big-car {
  width: 50px;
  height: 100px;
}

.enemy-car.medium-car {
  width: 45px;
  height: 85px;
}

.enemy-car.small-car {
  width: 35px;
  height: 70px;
}

/* Бонусы */
.bonus {
  position: absolute;
  width: 30px;
  height: 30px;
  top: -40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: pulse 1.5s infinite;
}

/* Анимация для бонуса жизни (зелёное свечение) */
@keyframes pulse-life {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  }
}

/* Анимация для бонуса замедления (фиолетовое свечение) */
@keyframes pulse-time {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5); /* Фиолетовый */
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
  }
}

/* Анимация для бонуса ярости (красное свечение) */
@keyframes pulse-rage {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); /* Красный */
  }
  50% {
    transform: scale(1.1); /* Увеличиваем масштаб */
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  }
}

/* Стили для конкретных бонусов */
/* Бонус замедления */
.bonus-time {
  background-image: url("https://i.imgur.com/GgjDnXV.png");
  animation: pulse-time 1.5s infinite;
}

/* Бонус ярости */
.bonus-rage {
  background-image: url("https://i.imgur.com/sBMrex5.png");
  animation: pulse-rage 1.5s infinite;
  width: 40px; /* Увеличиваем ширину */
  height: 40px; /* Увеличиваем высоту */
}

/* Бонус жизни */
.bonus-life {
  background-image: url("https://i.imgur.com/FU8mPWe.png");
  animation: pulse-life 1.5s infinite;
}

/* Анимация заполнения шкалы */
@keyframes rage-fill-animation {
  0% {
    width: 0%;
    background-color: red;
  }
  100% {
    width: 100%;
    background-color: darkred;
  }
}

/* Экран проигрыша */
#end-screen {
  color: white !important;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: url("https://i.imgur.com/oduHiku.jpeg") center/cover;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Quicksand", sans-serif !important;
  letter-spacing: 1px;
}

.overlay {
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 55px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

#restart-button {
  margin-top: 20px;
  padding: 12px 30px;
  background: #cc00ffb0;
  border: none;
  border-radius: 25px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}

#restart-button:hover {
  background: #6200ff;
  transform: scale(1.05);
}
/* Контейнер выбора персонажей */
#character-selection {
  display: flex;
  justify-content: center;
  gap: 20px; /* Расстояние между карточками */
  margin-top: 20px;
}

/* Карточки персонажей */
.character-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* Расстояние между аватаром и именем */
  cursor: pointer;
  transition: transform 0.3s ease; /* Плавное увеличение при наведении */
}

.character-card:hover {
  transform: scale(1.1); /* Увеличиваем карточку при наведении */
}

/* Контейнер аватара */
.avatar-container {
  width: 80px;
  height: 80px;
  border-radius: 50%; /* Скругляем углы */
  overflow: hidden; /* Обрезаем изображение по краям */
}

.avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Сохраняем пропорции изображения */
}

/* Имя персонажа */
.character-name {
  font-size: 14px;
  color: white;
  text-align: center;
}

#player-car {
  will-change: transform, filter; /* Оптимизация анимации */
  position: absolute;
  bottom: 20px; /* Расстояние от нижнего края */
  left: 50%; /* Центрирование по горизонтали */
  transform: translateX(-50%);
  width: 40px; /* Ширина машины */
  height: 80px; /* Высота машины */
  background-size: cover; /* Изображение масштабируется под размеры элемента */
  transition: left 0.1s ease; /* Плавное перемещение */
}
/* Машина Чумабоя */
#player-car.character-1 {
  position: absolute;
  bottom: 20px;
  left: 50%; /* Изменили с 60% на 50% */
  transform: translateX(-50%);
  width: 35px; /* Увеличили ширину */
  height: 60px; /* Увеличили высоту */
  background-image: url("https://i.imgur.com/qqLCWPw.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain; /* Вернули contain */
  object-fit: scale-down; /* Добавили object-fit */
  aspect-ratio: 16/9; /* Добавили соотношение сторон */
  border-radius: 15px; /* Добавили скругление углов */
}

/* Машина Ебулата */
#player-car.character-2 {
  position: absolute;
  bottom: 20px;
  left: 50%; /* Изменили с 60% на 50% */
  transform: translateX(-50%);
  width: 35px; /* Увеличили ширину */
  height: 50px; /* Увеличили высоту */
  background-image: url("https://i.imgur.com/f24CQKi.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain; /* Вернули contain */
  object-fit: scale-down; /* Добавили object-fit */
  aspect-ratio: 16/9; /* Добавили соотношение сторон */
  border-radius: 15px; /* Добавили скругление углов */
}

#player-car.character-3 {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 35px; /* Фиксированная ширина */
  height: 70px; /* Фиксированная высота */
  background-image: url("https://i.imgur.com/ZCmb4t5.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain; /* Важно: используйте contain */
  border-radius: 15px;
  transition: left 0.1s ease;
  padding: 5px; /* Добавьте внутренний отступ */
  box-sizing: border-box; /* Убедитесь, что padding входит в размеры */
}

/* Анимация дыма */
@keyframes smoke-drift {
  0% {
    opacity: 0.8;
    transform: translate(-50%, 0) scale(1);
    filter: blur(2px);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -40px) scale(3);
    filter: blur(8px);
  }
}

.smoke-particle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(rgba(150, 150, 150, 0.8), rgba(200, 200, 200, 0));
  border-radius: 50%;
  animation: smoke-drift 1.2s ease-out forwards;
  pointer-events: none;
}
.life-glow {
  border-radius: 35px; /* Добавили скругление */
  animation: glow-green 1.2s;
}

@keyframes glow-green {
  0% {
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
  }
  50% {
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.8);
  }
  100% {
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
  }
}

/* Анимация ярости свечение*/
.rage-glow {
  border-radius: 20px;
  animation: shake 0.1s infinite, glow-red 0.5s infinite;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}
@keyframes glow-red {
  border-radius: 20px; /* Добавили скругление */
  0% {
    box-shadow: 0 0 15px red;
  }
  50% {
    box-shadow: 0 0 25px darkred;
  }
  100% {
    box-shadow: 0 0 15px red;
  }
}

/* Кратковременная вспышка при подборе бонуса */
@keyframes rage-pulse {
  0% {
    box-shadow: 0 0 0 rgba(255, 0, 0, 0);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 0, 0, 0);
  }
}

.rage-pulse {
  animation: rage-pulse 0.5s ease-out;
  border-radius: 20px;
}

/* Анимация замедления свечение*/

.slow-glow {
  border-radius: 35px; /* Добавили скругление */
  animation: glow-purple 1s infinite;
}
@keyframes glow-purple {
  0% {
    box-shadow: 0 0 15px #8a2be2;
  }
  50% {
    box-shadow: 0 0 25px #4b0082;
  }
  100% {
    box-shadow: 0 0 15px #8a2be2;
  }
}
.red-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  animation: flash 0.001s linear;
}

@keyframes flash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.character-card {
  position: relative;
}

.character-details {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: 360px;
  background: white;
  border-radius: 12px;
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
  padding: 20px 15px;
  cursor: pointer;
}

.character-details .profile-pic {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
}

.character-details .name {
  font-size: 20px;
  font-weight: bold;
  margin-top: 8px;
  color: #333;
}

/* Остальные стили из примера карточки */
.stats {
  display: flex;
  justify-content: space-between;
  margin: 12px 20px;
}
.stats div {
  text-align: center;
}
.stats div strong {
  display: block;
  font-size: 17px;
  color: black;
}
.stats div span {
  font-size: 12px;
  color: #777;
}
.divider {
  height: 1px;
  background: #ddd;
  margin: 15px 0;
}
.badges {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 10px;
}
.badge {
  width: 80px;
  text-align: center;
}
.badge img {
  width: 28px;
  height: 28px;
}
.badge div {
  font-size: 14px;
  font-weight: bold;
  color: black;
}
.badge span {
  font-size: 12px;
  color: #777;
}
.car-info {
  font-size: 14px;
  text-align: left;
  padding: 0 10px;
  margin-top: 10px;
  color: #333;
}
.car-info strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

/*ggg*/
.pulse-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #4caf50, #009688);
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
  transition: 0.3s;
  cursor: pointer;
  animation: pulse 2s infinite;
}

.pulse-button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.5);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.5);
  }
  100% {
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
  }
}

.achievements-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
}

#achievements-window {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #4caf50;
  border-radius: 15px;
  overflow: hidden;
  font-size: 14px;
}

.header {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  background: #2c2c2c;
  border-bottom: 2px solid #4caf50;
  padding: 15px;
}

.body {
  max-height: calc(80vh - 60px);
  overflow-y: auto;
}

.achievement-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  padding: 10px 15px;
  border-bottom: 1px solid #444;
}

.achievement-row.completed {
  color: #4caf50;
}

.achievement-row:hover {
  background: #3a3a3a;
}

.col {
  word-wrap: break-word;
  white-space: normal;
  padding: 5px 0;
}

.name {
  font-weight: bold;
}
.desc {
  font-style: italic;
}
.progress {
  text-align: center;
}

/* Адаптивность */
@media (max-width: 600px) {
  #achievements-window {
    font-size: 12px;
  }

  .header {
    padding: 10px;
  }

  .achievement-row {
    padding: 8px;
  }
}

/* Уведомления */
#achievement-notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
}

.achievement-notification {
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-left: 5px solid #4caf50;
  border-radius: 8px;
  padding: 15px;
  margin: 10px 0;
  display: flex;
  gap: 15px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.5s ease;
}

.achievement-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.achievement-icon {
  font-size: 24px;
}

.achievement-notification {
  animation: slideIn 0.5s ease, fadeIn 0.5s ease;
}
