/* ========== Global Reset & Base Styles ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: sans-serif;
  text-transform: capitalize;
}

body {
  background-color: #333;
  overflow: hidden;
}

/* ========== Game Container ========== */
.game {
  background-image: url(1995.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}

.hide {
  display: none !important;
}

/* ========== Start Screen ========== */
.startScreen {
  width: 500px;
  max-width: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  margin: auto;
  box-shadow: 1px 1px 30px black;
  text-align: center;
  color: white;
  padding: 30px;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.7);
}

.clickToStart {
  cursor: pointer;
  background-color: rgb(245, 200, 0);
  border-radius: 20px;
  font-size: 22px;
  padding: 16px;
  margin-bottom: 10px;
  color: black;
  font-weight: bold;
  display: inline-block;
  transition: 0.2s;
}
.clickToStart:hover {
  background-color: rgb(7, 173, 1);
  color: white;
}

/* ========== Score Panels ========== */
.score,
.highScore {
  position: absolute;
  padding: 12px 20px;
  text-align: center;
  background-color: rgb(0, 121, 55);
  color: white;
  line-height: 1.5;
  border-radius: 10px;
  font-size: 1.5rem;
  border: 2px double white;
  z-index: 2;
}

.score {
  top: 10px;
  left: 15%;
}

.highScore {
  top: 80px;
  left: 15%;
}

/* ========== Game Area ========== */
.gameArea {
  height: 100vh;
  width: 400px;
  margin: auto;
  position: relative;
  background-color: rgb(89, 89, 89);
  overflow: hidden;
  border-left: 6px dashed rgb(255, 221, 0);
  border-right: 6px dashed rgb(255, 221, 0);
}

/* ========== Player Car ========== */
.car {
  background-image: url(car.png);
  background-repeat: no-repeat;
  background-size: cover;
  background-color: black;
  box-shadow: 0px 0px 20px black;
  border-radius: 20px;
  height: 90px;
  width: 42px;
  position: absolute;
  top: 520px;
  animation: vibrate 2ms infinite alternate;
}

@keyframes vibrate {
  0% {
    height: 90px;
    width: 40px;
  }
  100% {
    height: 92px;
    width: 41px;
  }
}

/* ========== Opponent Cars ========== */
.Opponents {
  background-image: url(opponant.png);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: center;
  box-shadow: 0px 0px 20px black;
  animation: vibrate 2ms infinite alternate;
  height: 90px;
  width: 42px;
  position: absolute;
  border-radius: 10px;
}

/* ========== Road Lines ========== */
.roadLines {
  height: 100px;
  width: 10px;
  background-color: white;
  position: absolute;
  margin-left: calc(50% - 5px);
}

/* ========== Mobile Controls (hidden by default) ========== */
/* ========== Responsive (Mobile) Styles ========== */
@media screen and (max-width: 768px) {
  .game {
    padding-bottom: 120px; /* reserve space for buttons */
  }

  .gameArea {
    width: 85%; /* slightly narrower but proportional */
    height: calc(75vh - 120px); /* leave room for buttons */
    border-left: 3px dashed rgb(255, 221, 0);
    border-right: 3px dashed rgb(255, 221, 0);
  }

  /* Scale down score panels */
  .score,
  .highScore {
    font-size: 0.9rem;
    padding: 6px 12px;
    left: 5%;
  }

  .highScore {
    top: 55px;
  }

  .startScreen {
    width: 90%;
    font-size: 1rem;
    padding: 15px;
  }

  /* Scale player & opponent cars */
  .car,
  .Opponents {
    width: 28px;
    height: 60px;
    border-radius: 8px;
  }

  @keyframes vibrate {
    0% {
      height: 60px;
      width: 28px;
    }
    100% {
      height: 62px;
      width: 29px;
    }
  }

  /* Scale road lines */
  .roadLines {
    width: 6px;
    height: 70px;
    margin-left: calc(50% - 3px);
  }

  /* Show on-screen buttons below game */
  .controls {
    display: flex;
    position: relative; /* no overlap */
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    align-items: center;
    z-index: 10;
    gap: 30px;
  }

  .controls .up-down {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .btn-control {
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
    transition: 0.2s;
  }

  .btn-control:active {
    background: rgba(0, 150, 0, 0.7);
    transform: scale(0.95);
  }
}
