@font-face {
  font-family: Atma-SemiBold;
  src: url(./assets/fonts/Atma-SemiBold.ttf);
}

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

body {
  margin: 0;
  padding: 0;
  background-color: black;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
}

.game-scene {
  height: 100vh;
  max-height: -webkit-fill-available;
  min-width: 320px;
  max-width: 100%;
  position: relative;
}

img {
  max-width: 100%;
  user-drag: none;
  /* Disables dragging on Chrome, Edge, and Safari */
  -webkit-user-drag: none;
  /* Ensures dragging is disabled in Safari */
  pointer-events: none;
  /* Prevents mouse events like dragging and clicking on the image */
}

#discription-text {
  position: absolute;
  display: none;
  left: 50%;
  bottom: 0%;
  width: 100%;
  max-width: 420px;
  height: 30%;
  background-color: rgba(0, 0, 0, 0.5);
  transform: translate(-50%, 0%);
  z-index: 100;
}

#loading {
  position: absolute;
  left: 50%;
  top: 0%;
  z-index: -1;
  transform: translate(-50%, 0%);
}

#discription-text p,
#about-company p {
  margin-top: 10%;
  line-height: 1.8;
  color: white;
  text-align: center;
}

#monster {
  border: 1px solid;
}

#rivecanvas {
  position: absolute;
  z-index: 4;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

#treasurecanvas {
  display: none;
  width: 100%;
  height: 100%;
}

#canvas {
  position: absolute;
  left: 50%;
  top: 0%;
  transform: translate(-50%, 0%);
  max-height: -webkit-fill-available;
  z-index: 4;
  background-repeat: no-repeat;
  background-size: cover;
}

#canvas-timer {
  position: absolute;
  left: 50%;
  top: 0%;
  transform: translate(-50%, 0%);
  max-height: -webkit-fill-available;
}

.loader {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  width: 100px;
  height: 100px;
  position: absolute;
  left: 30%;
  bottom: 50%;
  transform: rotate(90deg);
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  transform: translate(-50%, 0%);
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

#loading-gif {
  display: flex;
  height: 100%;
  width: 100%;
  position: absolute;
  /* Position it within #loading-screen */
}

#progress-bar-container {
  display: none;
  position: relative;
  /* Keep this for proper positioning */
  width: 90%;
  height: 4vh;
  background-color: #000000;
  border: 1px solid #f1b82d;
  margin-top: 20vh;
  z-index: 9999;
  /* Update z-index to place it above #loading-gif */
}

#progress-bar {
  display: none;
  height: 100%;
  background-color: #f1b82d;
  transition: width 0.3s ease-in-out;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  /* color of spinner */
  border-top: 4px solid #3498db;
  /* color of spinning part */
  border-radius: 50%;
  position: absolute;
  left: calc(50% - 25px);
  top: 40%;
  animation: spin 0.8s linear infinite;
}

/* Define the animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Apply the animation to the ball element */

#version-info-id {
  position: absolute;
  right: 20px;
  bottom: 20px;
  color: #ffffff45;
  font-size: small;
  z-index: 9;
}

#toggle-btn {
  position: absolute;
  left: 30%;
  top: 5px;
  width: 80px;
  height: 40px;
  border-radius: 20px;
  border: none;
  background-color: #bbb;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  outline: none;
  z-index: 9;
}

#toggle-btn.on {
  background-color: #4caf50 !important;
}

#toggle-btn.off {
  background-color: #bbb;
  display: none;
}

.feedback-text {
  font-family: 'Atma-SemiBold', system-ui;
  font-size: 10vw;
  font-weight: 700;
  position: absolute;
  top: 22%;
  width: 100%;
  color: #fff;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  text-shadow:
    -2px -2px 0 #261C03,
    2px -2px 0 #261C03,
    -2px 2px 0 #261C03,
    2px 2px 0 #261C03,
    -3px 0 0 #261C03,
    3px 0 0 #261C03,
    0 -3px 0 #261C03,
    0 3px 0 #261C03;
  letter-spacing: 3px;
  z-index: 0;
}

/* Animation for feedback text */
@-webkit-keyframes scale-up-center {
  0% {
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

@keyframes scale-up-center {
  0% {
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

@-webkit-keyframes scale-in-bottom {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
    -webkit-transform-origin: 50% 100%;
    transform-origin: 50% 100%;
    opacity: 1;
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    -webkit-transform-origin: 50% 100%;
    transform-origin: 50% 100%;
    opacity: 1;
  }
}

@keyframes scale-in-bottom {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
    -webkit-transform-origin: 50% 100%;
    transform-origin: 50% 100%;
    opacity: 1;
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    -webkit-transform-origin: 50% 100%;
    transform-origin: 50% 100%;
    opacity: 1;
  }
}

/* Apply the animation */
.feedback-text.show {
  -webkit-animation: scale-up-center 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;
  animation: scale-up-center 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;
  z-index: 4;
  opacity: 1;
}

/* BUTTONS */
.btn--icon {
  height: calc(100vw * 0.19);
  width: calc(100vw * 0.19);
  display: inline-block;
}

.btn--icon img {
  display: block;
  height: 100%;
  width: 100%;
  transition: transform 300ms;
}

.btn--icon:hover img {
  transform: scale(1.1);
}

.btn--icon:active img {
  transform: scale(0.9);
}

.autumn,
.summer,
.winter {
  display: none;
}

.autumn-bg .autumn,
.summer-bg .summer,
.winter-bg .winter {
  display: block;
}

#background {
  margin: auto;
  width: 100%;
  height: 100vh;
  max-width: 1024px;
  margin: auto;
  left: 0;
  top: 0;
  top: 0;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
}

.ftm-mountain {
  position: absolute;
  width: 100%;
  z-index: 2;
  bottom: -5px;
}

.ftm-totem {
  position: absolute;
  bottom: 14%;
  width: 55%;
  z-index: 1;
  right: -15%;
  max-width: 380px;
}

.ftm-fence {
  left: -120px;
  bottom: 70px;
  position: absolute;
  width: 80%;
  transform: rotate(10deg);
}

.winter-bg .ftm-fence {
  position: absolute;
  bottom: 130px;
  left: -85px;
  transform: rotate(-25deg);
  z-index: 1;
  width: 70%;
}

.autumn-bg .ftm-fence {
  left: -100px;
  position: absolute;
  bottom: 8%;
  z-index: 1;
  transform: rotate(342deg);
  width: 70%;
}

.autumn-bg .ftm-totem,
.winter-bg .ftm-totem {
  position: absolute;
  bottom: 98px;
  right: -70px;
  z-index: 1;
  width: 70%;
}

.winter-bg {
  background-image: url('./assets/images/Winter_bg_01.webp');
}

.autumn-bg {
  background-image: url('./assets/images/Autumn_bg_v01.webp');
}

.summer-bg {
  background-image: url('./assets/images/bg_v01.webp');
}

#levelEnd {
  display: none;
  height: 100vh;
  width: 100%;
  position: fixed;
  z-index: 7;
  background-image: url(./assets/images/WIN_screen_bg.webp);
  background-size: 100% 115%;
  top: 0;
  bottom: 0;
}

.stars-container {
  width: 100%;
  position: relative;
  top: 120px;
  height: 120px;
}

/* Initial styles for stars */
.stars {
  opacity: 0;
  /* Initially hidden */
  transform: scale(0);
  /* Initially scaled down */
  transition: opacity 0.5s ease, transform 0.5s ease;
  /* Smooth animation */
}

/* Animation class to reveal the stars */
.stars.show {
  opacity: 1;
  /* Fully visible */
  transform: scale(1);
  /* Full size */
}

.star1 {
  position: absolute;
  left: 3%;
  width: 60px;
  bottom: -50px;
}

.star2 {
  position: absolute;
  left: 20%;
  width: 60px;
  bottom: 0px;
}

.star3 {
  width: 65px;
  top: 20%;
  position: absolute;
  left: 0;
  right: 0;
  margin: auto;
}

.star4 {
  position: absolute;
  right: 20%;
  width: 60px;
  bottom: 0px;
}

.star5 {
  position: absolute;
  right: 3%;
  width: 60px;
  bottom: -50px;
}

/* Dynamic Buttons */
.game-control {
  position: relative;
  z-index: -1;
}

#pause-button {
  position: absolute;
  right: 0;
  top: 0;
  margin: 8px 10px;
}

.dynamic-button {
  cursor: pointer;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  max-width: 60px;
  max-height: 60px;
  width: 100%;
}

.dynamic-button .button-image {
  width: 100%;
}

.evolution-phase-bg {
  position: absolute;
  display: block;
}

#phasebg-img {
  width: 100vw;
  height: 100vh;
}

/* For small phones, up to 360px wide */
@media (min-width: 320px) and (max-width: 360px) {
  #loading-screen {
    max-width: 100%;
  }

  .ftm-totem {
    bottom: 12%;
  }

  .ftm-fence {
    left: -30%;
    bottom: 7%;
  }

  .dynamic-button {
    max-width: 52px;
    max-height: 52px;
  }


  .me-4 {
    margin-right: 22px !important;
  }


  #levelEnd {
    background-size: 100% 118%;
  }

  .confirm-message {
    font-size: 16px !important;
  }
}

/* For medium-sized phones, up to 500px wide */
@media (min-width: 361px) and (max-width: 500px) {
  .winter-bg .ftm-fence {
    position: absolute;
    bottom: 145px;
    left: -85px;
    transform: rotate(-25deg);
    z-index: 1;
    width: 70%;
  }

  .winter-bg .ftm-totem {
    position: absolute;
    bottom: 130px;
    right: -75px;
    z-index: 1;
    width: 75%;
  }

  .confirm-message {
    font-size: 18px !important;
  }

  .dynamic-button {
    max-width: 60px;
    max-height: 60px;
  }


  #levelEnd {
    background-size: 100% 118%;
  }
}

/* For tablets, up to 768px wide */
@media (min-width: 501px) and (max-width: 768px) {
  #loading-screen {
    max-width: 100%;
  }

  .summer .ftm-fence {
    left: -25%;
    bottom: 10%;
    transform: rotate(15deg);
  }

  .confirm-message {
    font-size: 24px !important;
  }

  .summer .ftm-totem {
    position: absolute;
    bottom: 18%;
    z-index: 1;
    right: -13%;
    width: 50%;
  }

  .autumn-bg .ftm-totem,
  .winter-bg .ftm-totem {
    right: -15%;
    bottom: 18%;
    width: 60%;
    max-width: 450px;
  }

  .winter-bg .ftm-fence {
    width: 70%;
    left: -22%;
    bottom: 22%;
    transform: rotate(-20deg);
  }

  .autumn-bg .ftm-fence {
    bottom: 15%;
    width: 55%;
    left: -12%;
    transform: rotate(340deg);
  }

  #title {
    margin-top: 5%;
  }

  .dynamic-button {
    max-width: 90px;
    max-height: 90px;
  }

  #play-button {
    max-width: 180px;
    max-height: 180px;
  }

  .popup #cancel-button {
    top: 15px !important;
    left: 40px !important;
  }

  .stars-container {
    top: 25%;
    height: 170px;
  }

  .star1 {
    left: 3%;
    width: 100px;
    bottom: -50px;
  }

  .star2 {
    width: 110px;
    bottom: 30px;
  }

  .star3 {
    right: 0;
    width: 120px;
    bottom: 130px;
  }

  .star4 {
    right: 20%;
    width: 110px;
    bottom: 30px;
  }

  .star5 {
    right: 3%;
    width: 100px;
    bottom: -50px;
  }

  .buttons-container {
    gap: 60px !important;
  }

  .feedback-text {
    font-size: 8vw;
  }

  #levelEnd {
    background-size: 100% 120%;
  }
}

/* For tablets, up to 992px wide */
@media (min-width: 769px) and (max-width: 992px) {
  #loading-screen {
    max-width: 100%;
  }

  .confirm-message {
    font-size: 36px !important;
  }

  .summer .ftm-fence {
    left: -25%;
    bottom: 12%;
    transform: rotate(15deg);
  }

  .summer .ftm-totem {
    position: absolute;
    bottom: 20%;
    z-index: 1;
    right: -12%;
    width: 50%;
  }

  .autumn-bg .ftm-totem,
  .winter-bg .ftm-totem {
    right: -5%;
    bottom: 25%;
    width: 60%;
    max-width: 450px;
  }

  .winter-bg .ftm-fence {
    width: 80%;
    left: -15%;
    bottom: 28%;
    transform: rotate(-20deg);
  }

  .autumn-bg .ftm-fence {
    bottom: 18%;
    width: 50%;
    left: -10%;
    transform: rotate(340deg);
  }

  #title {
    margin-top: 5%;
  }

  .dynamic-button {
    max-width: 110px;
    max-height: 110px;
  }

  .popup #cancel-button {
    top: 10px !important;
    left: 40px !important;
  }

  #levelEnd {
    background-size: 100% 120%;
  }

  .stars-container {
    top: 25%;
    height: 170px;
  }

  .star1 {
    left: 3%;
    width: 100px;
    bottom: -50px;
  }

  .star2 {
    width: 110px;
    bottom: 30px;
  }

  .star3 {
    right: 0;
    width: 120px;
    bottom: 130px;
  }

  .star4 {
    right: 20%;
    width: 110px;
    bottom: 30px;
  }

  .star5 {
    right: 3%;
    width: 100px;
    bottom: -50px;
  }


  .buttons-container {
    gap: 60px !important;
    bottom: 65px !important;
  }

  .feedback-text {
    font-size: 8vw !important;
  }
}

/* For desktops or larger devices */
@media (min-width: 993px) and (max-width: 1024px) {
  #loading-screen {
    max-width: 100%;
  }

  .summer .ftm-fence {
    left: -15%;
    bottom: 18%;
    transform: rotate(10deg);
    width: 100%;
  }

  .summer .ftm-totem {
    position: absolute;
    bottom: 23%;
    z-index: 1;
    right: -10%;
    max-width: 450px;
    width: 100%;
  }

  .autumn-bg .ftm-totem,
  .winter-bg .ftm-totem {
    right: -3%;
    bottom: 26%;
    width: 50%;
  }

  .winter-bg .ftm-fence {
    width: 60%;
    left: -15%;
    bottom: 28%;
    transform: rotate(-20deg);
  }

  .autumn-bg .ftm-fence {
    bottom: 20%;
    width: 50%;
    left: -10%;
    transform: rotate(340deg);
  }

  .dynamic-button {
    max-width: 100px;
    max-height: 100px;
  }

  .popup #cancel-button {
    top: 1% !important;
    left: 10% !important;
  }

  .stars-container {
    top: 25%;
    height: 170px;
  }

  .star1 {
    left: 3%;
    width: 110px;
    bottom: -50px;
  }

  .star2 {
    width: 120px;
    bottom: 30px;
  }

  .star3 {
    right: 0;
    width: 130px;
    bottom: 130px;
  }

  .star4 {
    right: 20%;
    width: 120px;
    bottom: 30px;
  }

  .star5 {
    right: 3%;
    width: 110px;
    bottom: -50px;
  }

  .buttons-container {
    gap: 60px !important;
  }

  .feedback-text {
    font-size: 8vw !important;
  }

  #title {
    margin-top: 5%;
    font-size: 7vw;
  }

  #levelEnd {
    background-size: 100% 120%;
  }
}

@media (min-width: 1080px) {
  #background {
    width: 500px !important;
  }

  .game-scene {
    width: 500px;
    margin: auto;
  }

  #title {
    font-size: 2vw !important;
    margin-top: 10% !important;
  }

  .game-scene #play-button {
    max-width: 125px;
    max-height: 125px;
    margin: 30px auto !important;
  }

  #loading-screen {
    width: 500px;
  }

  #levelEnd {
    width: 500px;
  }

  .feedback-text {
    font-size: 2.5vw;
  }

  .popup .popup__content-wrapper {
    top: 0vw !important;
    left: 0vw !important;
    right: 0vw !important;
    height: 50vw !important;
    width: 60%;
    margin: auto;
  }

  .popup #cancel-button {
    top: 17vw !important;
    left: 0vw !important;
  }

  .ftm-fence {
    left: -130px;
    bottom: 100px;
  }

  .ftm-totem {
    position: absolute;
    bottom: 15%;
    width: 60%;
    z-index: 1;
    right: -15%;
    max-width: 300px;
  }
}

/* For ultrawide monitors or desktop screens that are not very tall  */
@media screen and (min-width: 1080px) and (max-height: 650px) {
  #background {
    width: 380px !important;
  }

  .game-scene {
    width: 380px;
    margin: auto;
  }

  .game-scene #play-button {
    max-width: 80px;
    max-height: 80px;
    margin: 30px auto !important;
  }

  .ftm-fence {
    left: -110px;
    bottom: 65px;
  }

  .ftm-totem {
    position: absolute;
    bottom: 18%;
    width: 55%;
    z-index: 1;
    right: -15%;
    max-width: 230px;
  }

  #loading-screen {
    width: 380px;
  }

  #levelEnd {
    width: 380px;
  }

  .popup .popup__content-wrapper {
    height: 48vw !important;
    width: 80%;
  }

  .popup #cancel-button {
    top: 12vw !important;
    left: 5px !important;
  }

  .dynamic-button {
    max-width: 50px;
    max-height: 50px;
  }

  .star1 {
    left: 3%;
    width: 60px;
    bottom: -50px;
  }

  .star2 {
    width: 60px;
    bottom: 30px;
  }

  .star3 {
    right: 0;
    width: 65px;
    bottom: 130px;
  }

  .star4 {
    right: 20%;
    width: 60px;
    bottom: 30px;
  }

  .star5 {
    right: 3%;
    width: 60px;
    bottom: -50px;
  }
}