@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Open Sans", sans-serif;
  background: #313131;
}

.header {
  display: flex;
  justify-content: center;
  padding-block: 8px;
}

.header__title {
  font-size: 30px;
  font-weight: 900;
  color: #fff;
}

.background {
  position: relative;
  z-index: 11;
  overflow: hidden;
  max-height: 470px;
  /* overflow-x: hidden; */
}

.bg-image {
  z-index: -999;
}

.road {
  position: absolute;
  left: 215px;
  top: 0;
  z-index: 0;

  display: flex;
  gap: 194px;
}

.lane {
  display: flex;
  flex-direction: column;
  position: relative;
}

.car {
  position: absolute;
  top: -20px;
  animation: carMove 2s linear infinite;
  z-index: 5;
  transition: top 0.6s ease-out;
}

.camera {
  transition: transform 0.4s ease;
}

.manhole {
  position: absolute;
  top: 250px;
  z-index: 4;
}

.barrier {
  position: absolute;
  top: 120px;
  left: -20px;
  z-index: 10;
  display: none;
  transform: translateX(-50%);
  transition: top 0.2s ease-out;
}

.current {
  position: absolute;
  top: 400px;
  left: 25px;
  display: none;
}

.manhole:nth-child(1) {
  position: absolute;
  top: 250px;
  left: 200px;
}

.achive {
  padding-block: 10px;
  padding-inline: 18px;
  background: #424242;
  border: 3px solid #555555;
  margin-inline: 16px;
  border-radius: 20px;
  margin-top: 10px;
}

.achive-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  background: #545454;
  border-radius: 12px;
}

.achive-min {
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
  background: #656565;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  border-radius: 5px;
}

.achive-amount {
  font-size: 18px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.7);
}

.achive-max {
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
  background: #656565;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  border-radius: 5px;
}

.achive-sum {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.euro-img {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.achive-sum_euro {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  background: #545454;
  border-radius: 12px;
}

.achive-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.achive-wyplac {
  padding-block: 10px;
  border: none;
  font-weight: 900;
  color: #1d1f21;
  font-size: 14px;
  width: 100%;
  background: #ffc219;
  border-radius: 16px;
}

.achive-go {
  padding-block: 10px;
  border: none;
  font-weight: 900;
  color: #1d1f21;
  font-size: 20px;
  width: 100%;
  background: #3ec55b;
  border-radius: 16px;
  color: #fff;
}

@keyframes carMove {
  0% {
    top: -150px; /* машина над экраном */
  }
  90% {
    top: 4000px; /* уезжает вниз за пределы фона */
  }
  100% {
    top: 600px; /* остаётся за границей до ресета */
  }
}

.lane:nth-child(1) .car {
  animation-delay: 0s;
}
.lane:nth-child(2) .car {
  animation-delay: 1s;
}
.lane:nth-child(3) .car {
  animation-delay: 2s;
}
.lane:nth-child(4) .car {
  animation-delay: 3s;
}
.lane:nth-child(5) .car {
  animation-delay: 4s;
}
.lane:nth-child(6) .car {
  animation-delay: 5s;
}
.lane:nth-child(7) .car {
  animation-delay: 6s;
}

.car.paused {
  transition: none;
  animation-play-state: paused !important;
}

/* плавный прыжок по дуге: одновременно смещение вправо и подъем вверх */
.chicken {
  position: absolute;
  bottom: 130px;
  left: 20px; /* начальная позиция, Управляется JS */
  z-index: 5;
  /* сброс transform-ов, чтобы animation работала предсказуемо */
  transform: translateX(0) translateY(0);
}

/* переменная --dx будет задаваться из JS (напр. 200px) */
.chicken.jump {
  animation: chickenJump 0.55s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}

/* keyframes используют CSS-переменную --dx */
@keyframes chickenJump {
  0% {
    transform: translateX(0) translateY(0);
  }
  30% {
    transform: translateX(calc(var(--dx) * 0.45)) translateY(-90px); /* подъём к пику */
  }
  60% {
    transform: translateX(calc(var(--dx) * 0.9)) translateY(-30px); /* спад */
  }
  100% {
    transform: translateX(calc(var(--dx) * 1)) translateY(0); /* приземление впереди */
  }
}



@media (max-height: 766px) {
  .achive-sum {
    display: none;
  }

  .achive-wyplac {
    padding-block: 6px;
  }

  .achive-go {
    padding-block: 6px;
  }

  .egg {
    width: 25px;
    height: 25px;
  }

  .background {
    max-height: 460px;
  }

  .header__title {
    font-size: 28px;
  }
}

@media (max-height: 860px) {
  .egg {
    width: 25px;
    height: 25px;
  }

  .achive-wyplac {
    padding-block: 24px;
    font-size: 15px;
  }

  .achive-go {
    padding-block: 24px;
    font-size: 24px;
  }
}

@media (min-height: 860px) {

  .achive {
    padding-block: 20px;
  }

  .header__title {
    font-size: 50px;
  }

  .egg {
    width: 40px;
    height: 40px;
  }

  .header {
    padding-block: 30px;
  }

  .achive-wyplac {
    padding-block: 24px;
    font-size: 15px;
  }

  .achive-go {
    padding-block: 24px;
    font-size: 24px;
  }
}

@media (max-height: 680px) {
  .achive-wyplac {
    padding-block: 6px;
  }

  .achive-go {
    padding-block: 6px;
  }
}
