@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Press Start 2P', cursive;
  position: relative;
  width: 100%;
  height: 100vh;
}

#game {
  background-color: #1100ee22;
  /* background-color: #1100ff66; */
  width: 100%;
  height: 100%;
}

/* =========== Game Canvas =========== */
#gameCanvas {
  border: 1px solid black;
  margin: 0 auto;
  display: block;
}

@media screen and (max-width: 1400px) {
  #gameCanvas {
    width: 100%;
  }
}

/* =========== Game Info =========== */
#top {
  position: absolute;
  max-width: 1400px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

.gameStatus {
  display: flex;
  align-items: center;
}

#clock {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  background-color: black;
  flex-shrink: 0;
  color: white;
  border: 5px solid white;
  font-size: clamp(0.5rem, 1.4vw, 1.5rem);
  height: clamp(30px, 7vw, 65px);
  width: clamp(50px, 10vw, 100px);
}

.playersName {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
}

#p1,
#p2 {
  width: fit-content;
  padding: 0.4rem;
  font-size: clamp(0.5rem, 1vw, 1.5rem);
}

.healthContainer {
  background: #818cf8;
  width: 100%;
  display: flex;
  position: relative;
  border-top: 5px solid white;
  border-bottom: 5px solid white;
  height: clamp(20px, 4vw, 50px);
}

#player1HealthBar {
  border-left: 5px solid white;
  justify-content: flex-end;
}

#player2HealthBar {
  border-right: 5px solid white;
}

.healthBar {
  background: yellow;
}

/* =========== Game Result =========== */
.gameOption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  position: absolute;
  background-color: #c19b9b;
  border-radius: 4px;

  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.gameOption > div {
  width: fit-content;
  cursor: pointer;
}

#choosePlayers {
  margin: 0.8rem 0 0.5rem;
}

#previewCanvasContainer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: clamp(0.5rem, 1vw, 1rem);
  margin-bottom: 0.5rem;
}

.preview canvas {
  /* border: 1px dotted black; */
  width: 100%;
}

#playerSelectionContainer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

#playerSelectionContainer > div {
  flex: 1;
}

.player1Controls,
.player2Controls {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: aliceblue;
  padding: 0.5rem;
  height: 45px;
  gap: 1rem;
}

.control {
  color: #000;
  opacity: 0.2;
  transition: background-color 0.5s ease-in-out, opacity 0.5s ease-in-out;
  border-radius: 50%;
  width: clamp(20px, 3vw, 30px);
  height: clamp(20px, 3vh, 30px);
  cursor: pointer;
}

.control img {
  width: 100%;
  height: 100%;
}

.player1Controls p,
.player2Controls p {
  flex: 1;
  text-align: center;
  font-size: clamp(0.5rem, 1vw, 1rem);
  border-bottom: 1px dotted black;
  padding-bottom: 0.2rem;
}

.preview .left {
  left: 4%;
}

.preview .right {
  right: 4%;
}

.player1Controls .left:hover,
.player1Controls .right:hover,
.player2Controls .left:hover,
.player2Controls .right:hover {
  background-color: #d1caca;
  opacity: 0.5;
}


#endGameMessage #result {
  text-align: center;
  font-weight: bold;
  font-size: clamp(0.6rem, 1vw, 1rem);
  margin-bottom: 0.5rem;
}

.gameOption .btn {
  width: 100%;
  min-width: 150px;
  background-color: rgb(221, 235, 247);
  text-align: center;
  padding: clamp(0.5rem, 1vw, 1rem);
  border-radius: 4px;
  font-size: clamp(0.5rem, 1vw, 1.5rem);
  transition: 0.2s ease-in-out;
  cursor: pointer;
  margin: 0 auto;
}

.gameOption .btn:active {
  transform: scale(0.95);
}

.hidden {
  display: none;
}

@media screen and (max-width: 1100px) {
  .gameOption {
    top: 32%;
  }
}



@media screen and (max-width: 900px) {
  #game {
    width: 100%;
  }

  #top {
    padding: 10px;
  }

  #clock {
    border: 3px solid white;
  }

  #player1HealthBar {
    border: 3px solid white;
    border-right: none;
  }

  #player2HealthBar {
    border: 3px solid white;
    border-left: none;
  }

  .playerName {
    top: 70px;
    padding: 0;
  }

  .player1Controls,
  .player2Controls {
    height: 30px;
  }
}

@media screen and (max-width: 800px) {
  .gameOption {
    top: 25%;
  }
}

@media screen and (max-width: 750px) {
  .gameOption {
    transform: translate(-50%, -50%);
    background-color: rgb(182, 175, 175);
    width: fit-content;
    gap: 0.2rem;
    border-radius: 4px;
  }

  .playerName {
    top: 60px;
    padding: 0;
  }
}

@media screen and (max-width: 650px) {
  .playerName {
    top: 55px;
  }

  .gameOption {
    top: 20%;
  }
}
