@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/Roboto-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/Roboto-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/Roboto-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/Roboto-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/Roboto-Bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}

:root {
  --bg-blue-gradient: radial-gradient(circle, #1f3756 50%, #141539);
}

body {
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  background-image: var(--bg-blue-gradient);
}

header {
  margin-top: 1rem;
  width: min(95%, 30rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px solid rgba(119 136 153 / 0.4);
  border-radius: 7px;
  padding: 0.7rem;
  margin-inline: auto;

  .logo {
    height: 6rem;
  }

  .score-board {
    align-content: center;
    padding: 0.4rem 1rem;
    background-color: azure;
    border-radius: 7px;
    box-shadow: 1px 1px 5px #000000c4;

    h3 {
      text-align: center;
      font-size: 0.7rem;
      color: #2a46c0;
    }

    p {
      color: #111111b6;
      text-align: center;
      margin-bottom: 0;
      font-size: 2rem;
      font-weight: 700;
    }
  }
}

main {
  align-content: center;
  container-type: inline-size;
}

footer {
  margin-bottom: 1rem;
  text-align: center;

  > :first-child {
    font-size: 1.1rem;
    font-weight: 700;
    color: azure;
    padding: 0.5rem 2rem;
    border: 2px solid rgba(192 192 192 0.7);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;

    &:active {
      transform: translateY(4px);
    }
  }
}

/* ANCHOR Game Wrapper Structure */
.game-wrapper {
  width: clamp(21rem, 70svw, 31rem);
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;

  .btn-paper {
    background: linear-gradient(hsl(230 89% 62%), hsl(230 89% 65%));
    box-shadow:
      inset 0 -6px 0 rgba(0 0 0 / 0.15),
      0 6px 0 #2844a1;

    &:active {
      box-shadow:
        inset 0 -4px 0 rgba(0 0 0 / 0.15),
        0 2px 0 #2844a1;
    }
  }

  .btn-scissors {
    background: linear-gradient(hsl(39 89% 49%), hsl(40 84% 53%));
    box-shadow:
      inset 0 -6px 0 rgba(0, 0, 0, 0.15),
      0 6px 0 #c76c18;

    &:active {
      box-shadow:
        inset 0 -4px 0 rgba(0 0 0 / 0.15),
        0 2px 0 #c76c18;
    }
  }

  .btn-rock {
    background: linear-gradient(hsl(349 71% 52%), hsl(349 70% 56%));
    box-shadow:
      inset 0 -6px 0 rgba(0 0 0 / 0.15),
      0 6px 0 #9d1634;

    &:active {
      box-shadow:
        inset 0 -4px 0 rgba(0 0 0 / 0.15),
        0 2px 0 #9d1634;
    }
  }

  .btn-lizard {
    background: linear-gradient(hsl(261 73% 60%), hsl(261 72% 63%));
    box-shadow:
      inset 0 -6px 0 rgba(0 0 0 / 0.15),
      0 6px 0 #5f37a8;

    &:active {
      box-shadow:
        inset 0 -4px 0 rgba(0 0 0 / 0.15),
        0 2px 0 #5f37a8;
    }
  }

  .btn-spock {
    background: linear-gradient(hsl(189 59% 53%), hsl(189 58% 57%));
    box-shadow:
      inset 0 -6px 0 rgba(0 0 0 / 0.15),
      0 6px 0 #2d8dab;

    &:active {
      box-shadow:
        inset 0 -4px 0 rgba(0 0 0 / 0.15),
        0 2px 0 #2d8dab;
    }
  }
}

/* ANCHOR Game Board Design */
.game-board {
  height: 50%;
  background-image: url(assets/images/bg-pentagon.svg);
  background-size: 80% auto;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  transition: allow-discrete opacity 0.7s linear;

  .btn-hand {
    width: 6rem;
    aspect-ratio: 1;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    transition: transform 0.1s;

    &:active {
      transform: translateY(4px);
    }

    &:before {
      content: "";
      position: absolute;
      width: 75%;
      aspect-ratio: 1;
      background-color: #e1e4ed;
      border-radius: 50%;
    }

    img {
      z-index: 1;
      width: 40%;
      pointer-events: none;
    }

    &.btn-paper {
      top: 25%;
      right: 0;
    }

    &.btn-scissors {
      top: 0;
      left: 50%;
      transform: translateX(-50%);

      &:active {
        transform: translateX(-50%) translateY(4px);
      }
    }

    &.btn-rock {
      bottom: 0;
      right: 0;
      transform: translateX(-50%);

      &:active {
        transform: translateX(-50%) translateY(4px);
      }
    }

    &.btn-lizard {
      bottom: 0;
      left: 0;
      transform: translateX(50%);

      &:active {
        transform: translateX(50%) translateY(4px);
      }
    }

    &.btn-spock {
      top: 25%;
      left: 0;
    }
  }
}

/* ANCHOR Game Decision Design */
.game-decision-board {
  display: none;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
  transition: allow-discrete opacity 0.7s linear;
  color: azure;

  .picked-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.3rem;

    > :last-child {
      font-weight: 600;
      text-transform: uppercase;
      text-align: center;
      margin-bottom: 0;
    }
  }

  .btn-hand {
    width: 6.3rem;
    aspect-ratio: 1;
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 50%;
    z-index: 0;
    position: relative;

    &:before {
      content: "";
      position: absolute;
      width: 75%;
      aspect-ratio: 1;
      background-color: #e1e4ed;
      border-radius: 50%;
    }

    img {
      z-index: 1;
      width: 40%;
      pointer-events: none;
    }

    &:active {
      transform: none;
      box-shadow:
        inset 0 -6px 0 rgba(0 0 0 / 0.15),
        0 6px 0 #1b2b46;
    }

    &.btn-paper {
      box-shadow:
        inset 0 -6px 0 rgba(0 0 0 / 0.15),
        0 6px 0 #2844a1;
    }
    &.btn-scissors {
      box-shadow:
        inset 0 -6px 0 rgba(0 0 0 / 0.15),
        0 6px 0 #c76c18;
    }
    &.btn-rock:active {
      box-shadow:
        inset 0 -6px 0 rgba(0 0 0 / 0.15),
        0 6px 0 #9d1634;
    }

    &.winner::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      z-index: -1;
      box-shadow:
        0 0 0 40px rgba(255 255 255 / 0.04),
        0 0 0 80px rgba(255 255 255 / 0.03),
        0 0 0 130px rgba(255 255 255 / 0.02);
      animation: ripple 1s ease-out forwards infinite;
    }
  }

  .mystery-hand {
    width: 6.3rem;
    aspect-ratio: 1;
    border-radius: 50%;
    border: none;
    background-color: rgb(0 0 0 / 0.2);
    animation: reveal 1.5s 2 forwards;
  }

  .verdict {
    width: 100%;
    text-align: center;
    visibility: hidden;
    margin-top: 3rem;

    h3 {
      font-size: 2.3rem;
      font-weight: bolder;
      text-shadow: 1px 1px 7px #000000;
    }

    button {
      margin-top: 0.5rem;
      width: 100%;
      background-color: azure;
      color: #333;
      border: none;
      border-radius: 10px;
      padding-block: 1rem;
    }
  }
}

.rules-design {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: translateX(-100%);
  transition: transform 0.3s ease-out;
  background-color: azure;
  display: flex;
  justify-content: space-evenly;
  flex-direction: column;
  align-items: center;
  z-index: 1;

  h3 {
    color: #000000;
    font-size: 1.3rem;
    font-weight: bolder;
  }

  > :last-child {
    border: none;
    background: none;

    img {
      height: 1.5rem;
      aspect-ratio: 1;
    }
  }

  &.reveal {
    transform: translateX(0);
  }
}

@keyframes ripple {
  from {
    opacity: 0.3;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes reveal {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px azure);
  }
  50% {
    transform: scale(1.3);
    filter: drop-shadow(0 0 1rem azure);
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px azure);
  }
}

@container (width >= 46rem) {
  .game-wrapper {
    aspect-ratio: 5 / 4;

    .game-board {
      height: 100%;
      background-size: 80% auto;
    }
  }
}

@media (width >= 46rem) {
  footer {
    text-align: end;
    margin-right: 1rem;
  }

  .rules-design {
    position: fixed;
    max-width: 900px;
    border-radius: 10px;
    height: auto;
    aspect-ratio: 5 / 4;
    left: 50%;
    top: 50%;
    transform: translate(-50%, 175%);
    bottom: -100%;

    &.reveal {
      transform: translate(-50%, -50%);
    }
  }
}
