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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.page {
  position: relative;
  width: 100dvw;
  min-height: 100dvh;
  background: url("./assets/bg.png") no-repeat center/cover;
  font-family: Roboto, sans-serif;
}

.logo {
  position: absolute;
  top: 50%;
  left: 50%;

  z-index: 650;

  transform: translateX(-50%) translateY(-50%) scale(0);
  transition:
    top 0.3s linear,
    transform 0.3s ease-in;
}

.logo-init {
  transform: translateX(-50%) translateY(-50%) scale(0.5);
}

.logo-up {
  top: 0;
  transform: translateX(-50%) translateY(0) scale(0.5);
}

.play-btn,
.result-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 600;
  transform: translateX(-50%) translateY(-50%);

  width: 100%;
  max-width: 250px;
  border-radius: 25px;
  border: none;
  outline: none;
  padding: 5px;
  background-color: #93c738;
  color: #ffffff;
  font-family: Roboto, sans-serif;
  font-size: clamp(28px, 10vw, 32px);
  font-weight: 600;

  opacity: 0;
  visibility: hidden;
  display: none;

  cursor: pointer;

  transition:
    transform 0.3s linear,
    opacity 0.3s linear;
}

.play-btn:active {
  transform: translateX(-50%) translateY(-50%) scale(0.95);
}

.play-btn-visible {
  display: block;
  visibility: visible;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  opacity: 100%;
  overflow: hidden;

  transition: opacity 0.3s linear;
}

.overlay::before {
  content: "";
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    to bottom right,
    rgba(45, 79, 120, 1) 50%,
    rgba(45, 79, 120, 0) 50%
  );

  transition: transform 0.3s ease-in;
}

.overlay::after {
  content: "";
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translateX(100%);
  background: linear-gradient(
    to top left,
    rgba(255, 255, 255, 1) 50%,
    rgba(255, 255, 255, 0) 50%
  );

  transition: transform 0.3s ease-in;
}

.overlay-init::before {
  transform: translateX(0%);
}

.overlay-init::after {
  transform: translateX(0%);
}

.overlay-hidden {
  opacity: 0;
}

.player,
.enemy,
.vs-sign {
  position: absolute;
  z-index: 60;
  width: fit-content;
}

.player {
  left: -25%;
  top: 25%;
  transform: translateX(-50%) translateY(-50%);
  transition: left 0.3s ease-in;
}

.player-init {
  left: 25%;
}

.enemy {
  right: -25%;
  bottom: 25%;
  transform: translateX(50%) translateY(50%);
  transition: right 0.3s ease-in;
}

.enemy-init {
  right: 25%;
}

@media (max-width: 376px) {
  .player,
  .enemy {
    width: 50%;
  }

  .player-init {
    left: calc(25% + 20px);
  }

  .enemy-init {
    right: calc(25% + 20px);
  }
}

.vs-sign {
  top: 50%;
  left: 50%;
  max-width: 85%;
  transform: translateX(-50%) translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.vs-sign-init {
  opacity: 100%;
}

.player__name,
.enemy__name {
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: bold;
  font-style: italic;
}

.player__name {
  color: #ffffff;
}

.enemy__name {
  color: #000000;
}

.backdrop {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  background-color: hsla(0, 0%, 0%, 0.5);

  opacity: 0;

  transition: opacity 0.3s ease-in-out;
}

.backdrop-visible {
  opacity: 100%;
}

.role-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
}

.role {
  width: 100%;
  text-align: center;
  color: #ffffff;
  font-size: 24px;
  position: absolute;
  bottom: 10%;
}

.game {
  position: relative;
  z-index: 600;
  max-width: 412px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(56px, 12dvh, 100px) 10px 10px;

  display: none;
  visibility: hidden;
  opacity: 0;

  transition: opacity 0.3s linear;
}

.top-panel {
  display: flex;
  justify-content: space-between;
}

.stats {
  flex: 0 0 48%;
  display: grid;
  grid-template: 1fr 1fr 1fr /30% 1fr;
}

.stats-enemy {
  grid-template: 1fr 1fr 1fr /1fr 30%;
}

.stats-enemy .player__icon {
  grid-column: 2/3;
}

.stats-enemy .player-stats__name {
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 0;
  flex-direction: row-reverse;
}

.stats-enemy .player__role {
  justify-self: right;
}

.stats-enemy .results {
  justify-self: right;
}

.player__icon {
  grid-row: 1/3;
  background-color: #ffffff;
  padding: 5px;
  border-radius: 50%;

  align-self: center;
  justify-self: center;
}

.player-stats__name {
  background: linear-gradient(to left top, #002f5e, #0062c4);
  border: 1px solid #ffffff;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 5px;
  color: #ffffff;
  font-size: 15px;
  font-weight: bold;
  font-style: italic;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-role-icon {
  max-width: 24px;
}

.player__role {
  width: 100%;
  max-width: 65%;
  color: #ffffff;
  font-size: clamp(10px, 5vw, 12px);
  background: linear-gradient(180deg, #0e83d3, #14a0ff);
  border: 1px solid #ffffff;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;

  justify-self: left;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 10px;
}

.results {
  grid-column: 1/3;
  background-color: hsla(0, 0%, 100%, 0.25);
  width: fit-content;
  border-radius: 20px;
  margin-top: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 5px;
}

.round {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: rgba(58, 58, 58, 0.5);
  color: #ffffff;
  text-align: center;
  font-size: 12px;
}

.round-current {
  background-color: #93c738;
  border: 1px solid #ffffff;
}

.round-prev {
  background-color: rgba(58, 58, 58, 0.8);
}

.game-field {
  margin-top: clamp(16px, 5dvh, 50px);
}

@media (max-height: 850px) {
  .game-field {
    margin-top: 24px;
  }
}

.chosen-number {
  text-align: center;
  font-weight: bold;
  font-style: italic;
  font-size: clamp(46px, 10dvh, 72px);
  color: #ffffff;
  -webkit-text-stroke: 2px black;
  paint-order: stroke fill;
}

.hand-field {
  margin-top: clamp(18px, 8dvh, 80px);
  height: clamp(112px, 16dvh, 220px);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.hand {
  width: 46%;
  height: 100%;
  object-fit: scale-down;
}

.hand-left {
}
.hand-right {
  transform: scaleX(-1);
}

.timer {
  position: relative;

  width: clamp(54px, 10dvh, 80px);
  height: clamp(54px, 10dvh, 80px);
  margin: clamp(12px, 4dvh, 40px) auto 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  background: #ffffff;
  border-radius: 50%;

  color: #000000;
  font-size: clamp(22px, 5dvh, 32px);
  font-weight: bold;
}

.timer__inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 10px;

  /* default fill for progress (JS will update this) */
  background: conic-gradient(#93c738 360deg, #e6e6e6 0deg);
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 18px),
    black calc(100% - 17px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 18px),
    black calc(100% - 17px)
  );
  z-index: 0;
}

.timer__inner::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #ffffff;
  z-index: 0;
}

.timer-value {
  position: relative;
  z-index: 2;
  display: inline-block;
}

.bottom-panel {
  margin-top: 10px;
}

.tip {
  text-align: center;
  color: #ffffff;
  font-size: 16px;
  background-color: hsla(0, 0%, 0%, 0.3);
}

.numbers {
  padding: clamp(12px, 3dvh, 24px) 16px 0 16px;
  display: grid;
  grid-template: repeat(2, 1fr) / repeat(3, 1fr);
  gap: clamp(8px, 2dvh, 16px);
}
.number {
  cursor: pointer;

  color: #000000;
  font-weight: bold;
  font-style: italic;
  min-height: clamp(48px, 9dvh, 74px);
  font-size: clamp(32px, 7dvh, 48px);
  background: linear-gradient(180deg, #ffffff, #d6dee7);
  border: none;
  outline: none;
  border-radius: 10px;
  box-shadow: 0px 7px 0px 0px #949eab;
  transition: scale 0.3s linear;
}

@media (max-height: 680px) {
  .logo-up {
    top: -25px;
    transform: translateX(-50%) translateY(0) scale(0.34);
  }

  .game {
    padding-top: 60px;
  }

  .results {
    margin-top: 6px;
    gap: 4px;
    padding: 4px;
  }

  .round {
    width: 14px;
    height: 14px;
    font-size: 10px;
  }

  .game-field {
    margin-top: 12px;
  }

  .hand-field {
    margin-top: 14px;
  }

  .bottom-panel {
    margin-top: 6px;
  }

  .tip {
    font-size: 14px;
  }
}

.number:active {
  scale: 0.95;
}

.number:hover {
  background:
    linear-gradient(hsla(57, 91%, 50%, 0.6), hsla(57, 91%, 50%, 0.6)),
    linear-gradient(180deg, #ffffff, #d6dee7);
}

.number-active {
  background:
    linear-gradient(hsla(57, 91%, 50%, 0.6), hsla(57, 91%, 50%, 0.6)),
    linear-gradient(180deg, #ffffff, #d6dee7);
}

.result-backdrop {
  z-index: 900;
  display: none;
  visibility: hidden;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background-color: hsla(0, 0%, 0%, 0.35);
}

.result-modal {
  position: relative;
  width: min(100%, 380px);
  height: min(100%, 480px);
  box-shadow: 0 0 15px 2px hsla(88, 67%, 50%, 0.6);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  gap: 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 35px 15px;
}

.result-backdrop-lost .result-modal {
  backdrop-filter: blur(10px);
}

.result-backdrop-lost .result-modal::before {
  content: "";
  position: absolute;
  inset: 38px 40px 132px;
  background: url("./assets/player.png") left bottom/58px auto no-repeat;
  filter: blur(6px);
  opacity: 0.18;
}

.result-backdrop-win .result-modal {
  border-color: transparent;
  background: linear-gradient(135deg, #cbffd8 0%, #fff19a 48%, #ff7c7f 100%);
  justify-content: center;
  align-items: center;
}

.result-title {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: 32px;
  line-height: 1.18;
  font-weight: 600;
  text-align: center;
  white-space: pre-line;
}

.result-backdrop-win .result-title {
  color: #0050b8;
}

.result-prize {
  position: relative;
  z-index: 2;
  display: none;
  margin-top: 22px;
  gap: 3px;
}

.result-backdrop-win .result-prize {
  display: none;
}

.result-prize span {
  width: 24px;
  height: 38px;
  border: 2px solid #f4d159;
  border-radius: 4px;
  background: #ffffff;
  color: #d32929;
  font-size: 24px;
  line-height: 34px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 10px hsla(0, 0%, 0%, 0.16);
}

.result-promo {
  position: relative;
  z-index: 2;
  display: none;
  min-width: 168px;
  border: 2px dashed hsla(212, 100%, 36%, 0.7);
  border-radius: 8px;
  padding: 9px 12px;
  background: hsla(0, 0%, 100%, 0.5);
  color: #0050b8;
  font-size: 18px;
  font-weight: 800;
  font-family: Roboto, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.result-backdrop-win .result-promo {
  display: block;
}

.result-btn {
  opacity: 1;
  display: block;
  visibility: visible;
  position: static;
  transform: none;
}
