/** COMMON **/


body {
  font-family: "Mali", cursive;
  font-weight: 400;
  font-style: normal;
}

#app {
  width: 100dvw;
  height: 100dvh;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  color: black;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* Ensures space is distributed between elements */
  text-align: center;
  background-color: orange;
  background-image: url("./assets/hatchbg8-elevated.webp");
  background-color: rgba(255, 255, 255, 0.5);
  background-blend-mode: lighten;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  padding: 2dvh 0; /* Adds a little padding at the top and bottom */
}

#game {
  border: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  z-index: -1;
}

#title {
  position: fixed;
  top: 2vh;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5em;
  font-weight: bold;

  display: flex;
  align-items: center;
  gap: 0.25em;

  white-space: pre;
}

#title #change_name {
  display: none;
  height: 1.2em;
}

#stars {
  position: fixed;
  top: calc(2vh + 3em);
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2vh;
}

.star-container {
  position: relative;
  display: flex;
  gap: 1rem;
  border-radius: 15px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;

  transform: scale(1);

  transition: transform 0.3s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  @starting-style {
    transform: scale(0);
  }
}

.star {
  width: 50px;
  height: 50px;
  position: relative;
  transition: transform 0.3s, margin 0.5s;
}

.star svg {
  width: 100%;
  height: 100%;

  transition: stroke 0.5s;
}

.star.disabled {
  margin-right: -4.2rem;
}

.star.disabled path {
  stroke: grey;
}

.star path {
  stroke: gold;
  stroke-width: 2;
  fill: transparent;
  transition: fill 0.5s;
}

.star.filled path {
  fill: gold;
}

.star.fill-anim {
  animation: bounce 0.5s cubic-bezier(0.36, 0, 0.66, -0.56) 0s,
    rotate 0.5s linear 0.5s;
}

.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background-color: gold;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.sparkle::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  transform: rotate(45deg);
}

@keyframes bounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.5);
  }
}

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

@keyframes sparkleAnim {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)))
      rotate(180deg) scale(1);
    opacity: 0;
  }
}

.thought-bubble-container {
  position: fixed;
  top: 50%;
  left: 0;
  width: 100%;
  height: 20vh;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateY(-50%);
}

.thought-bubble-wrapper {
  position: fixed;
  left: 25%;
  top: 30%;
  transform: translate(-50%, -50%);
}

.thought-bubble {
  position: relative;
  width: 100px; /* Reduced by 50% from 200px */
  height: 100px; /* Reduced by 50% from 200px */
  background: rgba(255, 255, 255, 0.5); /* Semi-transparent white */
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0px 13px 36px -10px rgba(0, 0, 0, 0.3);
  animation: zoom-in 0.7s cubic-bezier(0.645, 0.045, 0.355, 1) forwards;
  transform: scale(0);
}

/* Just two bubbles now */
.thought-bubble::before,
.thought-bubble::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9); /* Semi-transparent white */
  border-radius: 50%;
  animation: zoom-in 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) 0.2s forwards;
  transform: scale(0);
}

.thought-bubble::before {
  width: 25px; /* Reduced by 50% from 50px */
  height: 25px;
  bottom: -20px;
  right: 10px;
}

.thought-bubble::after {
  width: 15px; /* Reduced by 50% from 30px */
  height: 15px;
  bottom: -30px;
  right: 0;
  animation-delay: 0.4s;
}

.candy-gif {
  width: 80px;
  height: 80px;
  border-radius: 5px;
  opacity: 0;
  animation: fade-in 0.3s ease forwards 0.7s;
}

@keyframes zoom-in {
  100% {
    transform: scale(1);
  }
}

@keyframes fade-in {
  100% {
    opacity: 1;
  }
}
.zzz-container {
  position: fixed;
  right: 50%;
  top: 70%;
  transform: translate(50%, -50%);
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}


.z {
  position: absolute;
  font-family: "Arial", sans-serif;
  font-weight: bold;
  opacity: 0;
  animation: moveZ 3s ease-in-out infinite;
}

.z1 {
  font-size: 20px;
  animation-delay: 0s;
}

.z2 {
  font-size: 30px;
  animation-delay: 1s;
}

.z3 {
  font-size: 40px;
  animation-delay: 2s;
}

@keyframes moveZ {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(100px, -100px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(200px, -200px) scale(1.5);
  }
}

#player-container {
  position: fixed;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  height: 45vh;
  width: 45vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#player-container::after {
  content: "";
  position: absolute;
  top: 75%;
  left: 55%;
  transform: translate(-50%, -50%);
  width: 9rem;
  height: 2rem;
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 1rem 0.5rem rgba(0, 0, 0, 0.2);
  border-radius: 50%;
}

#player-container > div {
  z-index: 1;
}

.game-button {
  position: fixed;
  bottom: 2vh;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 60px;
  font-size: 22px;
  transition: width 0.3s, height 0.3s, background-color 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  white-space: pre;
  z-index: 999;
}

.game-button.big {
  width: 230px;
  height: 80px;
}

.game-button:not(:disabled):hover {
  background-color: #45a049;
}

.game-button:disabled {
  filter: grayscale(1);
  cursor: default;
}

.purchase-button {
  position: absolute;
  top: calc(2rem + 50px);
  left: 50%;
  width: calc(100% - 40px);
  height: 60px;
  font-size: 22px;

  transform: translateX(-50%) scale(1);
  transform-origin: center;
  
  transition: transform 0.3s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s;

  @starting-style {
    transform: translateX(-50%) scale(0);
  }
}

.purchase-button:hover {
  background-color: #45a049;
}

.game-container {
  text-align: center;
  margin-top: 50px;
}

#gameFrame {
  margin-top: 20px;
  border: none;
  width: 800px;
  height: 600px;
  display: none;
}

.hidden {
  visibility: hidden;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 20px;
  border-radius: 30px;
  text-align: center;
  max-width: 80%;
  width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;

  box-shadow:
    inset 0 0.2rem rgba(255, 255, 255, 0.2),
    inset 0 -0.2rem 0 0.1rem rgba(0, 0, 0, 0.2),
    inset 0 -0.1rem 3rem 1rem rgba(0, 0, 0, 0.2);

  outline: 0.5rem solid rgb(122 111 175);
  box-sizing: border-box;
  
  transform: scale(0) translateY(-75%);
  transition: transform 0s 0.3s;
}

.modal-overlay.visible .modal-content {
  transition: transform 0.3s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: scale(1) translateY(0%);
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 0.4rem;
  width: 4rem;
  height: 2rem;
  background-color: rgba(255, 255, 255, 0.5);
  border-top-left-radius: 50% 70%;
  border-bottom-left-radius: 20% 30%;
  border-top-right-radius: 30% 50%;
  border-bottom-right-radius: 60% 50%;
}

.modal-content .close {
  position: relative;
  align-self: flex-end;
  margin-bottom: -1rem;
  margin-top: -0.5rem;
  margin-right: -0.25rem;
  box-sizing: border-box;
  width: 2rem;
  height: 2.1rem;
  background-color: #ff6464;
  text-shadow: none;
  border-color: #5d2120;
  transition: background-color 0.3s;
}

.modal-content .close:hover {
  background-color: #ff8b64;
}

.modal-image {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.modal-text {
  font-size: 18px;
  margin: 10px 0;
}

.modal-button {
  position: relative;
  height: 60px;
  width: 160px;
  font-size: 18px;
  transition: background-color 0.3s;
}

.modal-button:hover {
  background-color: #45a049;
}

@media only screen
  and (max-height: 700px) {
  .zzz-container {
    right: 45%;
    width: 80px;
    height: 80px;
  }

  #player-container {
    bottom: 7vh;
  }
}

.button {
  background-color: #a1d101;
  color: white;
  text-shadow: 0.1rem 0.1rem 0.1rem #355e12;
  border: 0.2rem solid #355e12;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow:
    inset 0 -0.4rem 0rem 0.1rem rgba(0, 0, 0, 0.2),
    inset 0 -0.3rem rgba(0, 0, 0, 0.4),
    inset 0 0.2rem rgba(255, 255, 255, 0.3);
  padding-bottom: 0.5rem;
}

.button::after {
  content: "";
  position: absolute;
  top: 0.1rem;
  right: 0.2rem;
  width: 0.6rem;
  height: 0.2rem;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: rotate(15deg);
}

.button::before {
  content: "";
  position: absolute;
  top: 0.1rem;
  left: 0.2rem;
  width: 0.4rem;
  height: 0.2rem;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.input {
  outline: none;
  background-color: white;
  color: black;
  border: 0.2rem solid #355e12;
  border-radius: 0.75rem;
  font-size: 1.5rem;
  padding: 0.5rem;
  box-shadow: inset 0 -0.1rem 0rem 0.1rem rgba(0, 0, 0, 0.2);

  transition: border-color 0.3s;
  width: 95%;
}

.input:focus {
  border-color: #a1d103;
}

.input.error {
  border-color: #cd5050;
}

.name-error-message {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -1rem;
  background-color: #cd5050;
  padding: 0rem 0.5rem;
  color: white;
  border-radius: 0.5rem;
  height: 0rem;
  opacity: 0;
  transition: height 0.15s, opacity 0.15s;
}

.name-error-message.visible {
  height: 3.75rem;
  opacity: 1;

  transition: height 0.2s, opacity 0.2s 0.2s;
}

.name-input {
  margin-top: 1rem;
}

.game-overlay {
  position: absolute;
  width: 100%;
  height: 0%;
  bottom: 0;
  background-color: black;
  visibility: visible;
  opacity: 1;
  z-index: 1000;
}

.game-overlay.visible {
  transition: height 0.3s, opacity 0.3s 0.3s, visibility 0s 0.6s;
  height: 100%;
  visibility: hidden;
  opacity: 0;
}

.tutorial-button {
  display: none;
  position: absolute;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  font-size: 1.75rem;
  width: 2.5rem;
  height: 2.5rem;
  bottom: 1rem;
  right: 1rem;
  color: white;
  background-color: #36aae2;
  border-color: #1c536e;
  visibility: visible;
  z-index: 999;
  border-radius: 1.25rem;
  box-shadow:
    inset 0 -0.2rem rgba(0, 0, 0, 0.4);
}

.tutorial-button::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.6rem;
  width: 0.25rem;
  height: 0.25rem;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.tutorial-button::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 0.4rem;
  width: 0.15rem;
  height: 0.15rem;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.promo-button {
  position: absolute;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  width: 3rem;
  height: 3rem;
  bottom: 1rem;
  right: 1rem;
  visibility: visible;
  z-index: 999;
  background-image: url(./assets/jest.svg);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;

  transform: scale(0);
  transition: transform 0.3s;
}

.promo-button.visible {
  transform: scale(1);
}

.promo-button::after {
  content: "1";
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 1.25rem;
  height: 1.25rem;
  line-height: 1.2rem;
  background-color: red;
  color: white;
  border-radius: 50%;
  transition: transform 0.3s 0.2s;
  transform: scale(0);
}

.promo-button.visible::after {
  transform: scale(1);
}

#promoModal .title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

#promoModal .hero {
  width: 60%;
  aspect-ratio: 1;
  border-radius: 1rem;
  cursor: pointer;
}

#promoModal .game-title {
  font-size: 1.5rem;
  margin-top: -1rem;
  margin-bottom: -0.5rem;
}

.modal-text.title {
  font-size: 2rem;
  margin-bottom: -1rem;
}

.tutorial-1 img {
  width: 70%;
  transform: translate(3rem, -1rem) rotate(-10deg);
}

.tutorial-1 p {
  width: 70%;
}

.tutorial-2 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tutorial-2 .jar {
  position: relative;
  width: 40%;
  aspect-ratio: 0.8;
  border-radius: 0.4rem;
  background-color: rgba(122, 111, 175, 0.7);
}

.tutorial-2 .jar img {
  width: 70%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.tutorial-2 .jar .candy img {
  width: 30%;
}

.tutorial-2 .jar .candy img:nth-child(1) {
  left: 30%;
  top: 77%;
}

.tutorial-2 .jar .candy img:nth-child(2) {
  left: 49%;
  top: 79%;
  filter: hue-rotate(140deg);
}

.tutorial-2 .jar .candy img:nth-child(3) {
  left: 69%;
  top: 75%;
}

.tutorial-2 .jar .candy img:nth-child(4) {
  left: 42%;
  top: 67%;
  filter: hue-rotate(286deg);
}

.tutorial-2 .jar .candy img:nth-child(5) {
  left: 59%;
  top: 63%;
  filter: sepia(1) saturate(2);
}

.tutorial-3 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tutorial-3 .candy {
  position: relative;
  width: 30%;
  flex-shrink: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: rgba(122, 111, 175, 0.7);
  margin-left: 1rem;
}

.tutorial-3 .candy::before {
  content: "!";
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  font-size: 1.75rem;
  line-height: 1.75rem;
  font-weight: bolder;
  width: 1.75rem;
  height: 1.75rem;
  color: #ffd649;
  background-color: #fcf697;
  border: 0.2rem solid #ffd649;
  border-radius: 50%;
}

.tutorial-3 .candy img {
  position: absolute;
  width: 50%;
  top: 4%;
  right: 4%;
}

.tutorial-3 .candy .white {
  position: absolute;
  width: 28%;
}

.tutorial-3 .candy img:nth-child(2) {
  left: 24%;
  top: 65%;
}

.tutorial-3 .candy img:nth-child(3) {
  left: 4%;
  top: 43%;
}

.tutorial-3 .candy img:nth-child(4) {
  left: 54%;
  top: 61%;
}

.tutorial-3 .candy img:nth-child(5) {
  left: 34%;
  top: 37%;
}

.godrays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.godray {
  position: absolute;
  top: -10rem;
  transform: rotate(-15deg);
  height: 100%;
  background-image: linear-gradient(white, transparent);
}

.godray:nth-child(1) {
  left: 10%;
  width: 8rem;
  animation:
    fade 30s linear infinite;
}

.godray:nth-child(2) {
  left: 30%;
  width: 3rem;
  animation:
    fade 30s -10s linear infinite;
}

.godray:nth-child(3) {
  left: 50%;
  width: 5rem;
  animation:
    fade 30s -20s linear infinite;
}

.godray:nth-child(4) {
  left: 25%;
  width: 1.5rem;
  animation:
    fade 30s -12s linear infinite;
}

.godray:nth-child(5) {
  left: 80%;
  width: 3rem;
  animation:
    fade 30s -1s linear infinite;
}

.godray:nth-child(6) {
  left: 70%;
  width: 2.5rem;
  animation:
    fade 30s -7s linear infinite;
}

@keyframes move {
  0% {
    left: -50%;
  }
  100% {
    left: 120%;
  }
}

@keyframes fade {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.2;
  }
  40% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
