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

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

html {
  font-size: 62.5%;
  box-sizing: border-box;
}

body {
  font-family: 'Press Start 2P', sans-serif;
  color: #eee;
  background: linear-gradient(90deg, #ffcc70, #ff6ec7);
  overflow-x: hidden;
}

/* LAYOUT */
header {
  position: relative;
  min-height: 35vh;
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2);
}

main {
  min-height: 65vh;
  color: #eee;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.left,
.right {
  width: 52rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* ELEMENTS STYLE */
h1 {
  font-size: 4rem;
  margin-top: 5rem;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  letter-spacing: 1px;
}

.label-cpu,
.label-human {
  text-align: center;
  position: absolute;
  width: 100%;
  transform: translate(-50%, -50%);
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.label-cpu {
  font-size: 4rem;
  top: 56%;
  left: 50%;
  margin-bottom: 2rem;
}

.label-human {
  font-size: 4rem;
  top: 30%;
  left: 50%;
}

.winners_container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30rem;
  height: auto;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
}

.unknown_winner {
  background: #eee;
  color: #333;
  font-size: 4rem;
  width: 30rem;
  height: 10rem;
  padding: 3rem 0rem;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.again {
  position: absolute;
  top: 2rem;
  left: 2rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.guess {
  background: none;
  border: 4px solid #eee;
  font-family: inherit;
  color: inherit;
  font-size: 5rem;
  padding: 2.5rem;
  width: 25rem;
  text-align: center;
  display: block;
  margin-bottom: 3rem;
}

.btn {
  border: none;
  background-color: #eee;
  color: #222;
  font-size: 2rem;
  font-family: inherit;
  padding: 2rem 3rem;
  cursor: pointer;
}

.btn:hover {
  background-color: #ccc;
}

.computer {
  pointer-events: none;
}

.message {
  font-size: 3rem;
  position: absolute;
  bottom: 55%;
  left: 50%;
  transform: translate(-50%, 50%);
}

img {
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.choice {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;

  /* important for image-only buttons */
  line-height: 0;
  cursor: pointer;

  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  overflow: hidden;

  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.picked {
  transform: scale(1.2);
  transition: 0.5s ease;
}

.dimmed {
  transform: scale(0.6);
  opacity: 0.55;
  transition: 0.5s ease;
}

.winner {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
}

/* hidden state  */
.winner.is-hidden,
.message.is-hidden {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none; /* can't click */
}

.hideme {
  display: none;
}

/* ----------- Tablet (<= 1024px) ----------- */
@media (max-width: 1024px) {
  html {
    font-size: 56.25%;
  } /* 1rem ~ 9px */

  .left,
  .right {
    width: 44rem;
  }

  .label-human,
  .label-cpu {
    font-size: 3.2rem;
  }

  h1 {
    font-size: 3.2rem;
    margin-top: 3.5rem;
  }

  .choice {
    width: 20rem;
    height: 20rem;
  }

  .hideme {
    display: none;
  }

  .tablet-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3rem;
    padding-bottom: 3rem;
  }
  img {
    /* keep winners circular but slightly smaller */
    width: 20rem;
    height: 20rem;
  }

  .unknown_winner {
    width: 24rem;
    height: 8.5rem;
    font-size: 3.2rem;
    padding: 2.6rem 0;
  }

  .btn {
    font-size: 1.8rem;
    padding: 1.6rem 2.4rem;
  }

  .message {
    font-size: 2.6rem;
  }
}

/* ----------- Small Tablet / Big Phones (<= 768px) ----------- */
@media (max-width: 768px) {
  header {
    height: auto;
    padding-bottom: 7rem;
  }
  main {
    height: auto;
    padding: 2rem 0 3rem;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2.4rem;
  }

  .left,
  .right {
    width: 100%;
    max-width: 52rem;
  }

  .tablet-mobile {
    display: block;
    padding-bottom: 0;
  }

  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .hideme {
    display: none;
  }

  .label-human,
  .label-cpu {
    position: static;
    transform: none;
    width: auto;
    margin: 1rem auto 0;
    font-size: 2.8rem;
  }

  .again {
    order: -1;
    position: static;
    margin-bottom: 1.2rem;
  }

  .winners_container {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 60%);
  }

  h1 {
    font-size: 3rem;
    margin-top: 1.8rem;
  }

  .choice {
    width: 16rem;
    height: 16rem;
  }

  img {
    width: 16rem;
    height: 16rem;
  }

  .picked {
    transform: scale(1.1);
  }
  .dimmed {
    transform: scale(0.9);
    opacity: 0.55;
  }

  .message {
    position: static;
    transform: none;
    text-align: center;
    margin: 0.6rem 0 0;
    font-size: 2.6rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 50%;
  }

  /* Stop using absolute positioning for layout on phone */
  header {
    height: auto;
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      'again'
      'human'
      'cpu';
    gap: 1rem;
    justify-items: center;
    padding: 1.2rem 1.2rem 7rem;
  }

  /* Again on top (in-flow) */
  .btn.again {
    grid-area: again;
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: calc(100% - 2.4rem);
    max-width: 48rem;
  }

  .choice img,
  .choice {
    width: 12rem;
    height: 12rem;
  }

  .left,
  .right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 4rem;
  }
  main {
    margin-top: 8rem;
  }
  .winner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 13rem;
    height: 13rem;
  }

  /* Scores in-flow */
  .label-human {
    grid-area: human;
    position: static !important;
    transform: none !important;
    width: auto;
    margin: 0;
    text-align: center;
    font-size: 2.4rem;
  }

  .label-cpu {
    grid-area: cpu;
    position: static !important;
    transform: none !important;
    width: auto;
    margin: 0;
    text-align: center;
    font-size: 2.4rem;
  }

  /* Winners stay anchored visually at the bottom of header */
  .winners_container {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 60%);
  }

  .message {
    font-size: 2rem;
    position: absolute;
    bottom: 56%;
    left: 50%;
    transform: translate(-50%, 50%);
  }
  .hideme {
    display: block;
  }
  h1 {
    font-size: 2rem;
  }
}
