* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    font-family: sans-serif;
    background-color: #3B4049;
  }
  
.animated-text span {
    font-size: 50px;
    color: #fff;
    font-family: 'Arial';
    text-transform: uppercase;
    display: inline-block;
    transform: rotateY(0deg);
    transition: 0.3s;
    animation: bounce 0.5s cubic-bezier(0.42, 0, 0.58, 1) infinite alternate;
    position: relative;
}
  
  .animated-text h1 span:nth-child(1) {
    animation-delay: 0s;
  }
  .animated-text h1 span:nth-child(2) {
    animation-delay: 0.1s;
  }
  .animated-text h1 span:nth-child(3) {
    animation-delay: 0.2s;
  }
  .animated-text h1 span:nth-child(4) {
    animation-delay: 0.3s;
  }
  .animated-text h1 span:nth-child(5) {
    animation-delay: 0.4s;
  }
    .animated-text h1 span:nth-child(6) {
        animation-delay: 0.5s;
    }
    .animated-text h1 span:nth-child(7) {
            animation-delay: 0.6s;
        }
    .animated-text h1 span:nth-child(8) {
            animation-delay: 0.7s;
        }
    .animated-text h1 span:nth-child(9) {
            animation-delay: 0.8s;
        }
    .animated-text h1 span:nth-child(10) {
            animation-delay: 0.9s;
        }
    .animated-text h1 span:nth-child(11) {
            animation-delay: 1s;
        }
    .animated-text h1 span:nth-child(12) {
            animation-delay: 1.1s;
        }
    .animated-text h1 span:nth-child(13) {
            animation-delay: 1.2s;
        }
    .animated-text h1 span:nth-child(14) {
            animation-delay: 1.3s;
        }
    .animated-text h1 span:nth-child(15) {
            animation-delay: 1.4s;
        }
    .animated-text h1 span:nth-child(16) {
            animation-delay: 1.5s;
        }
    .animated-text h1 span:nth-child(17) {
            animation-delay: 1.6s;
        }
    .animated-text h1 span:nth-child(18) {
            animation-delay: 1.7s;
        }
    .animated-text h1 span:nth-child(19) {
            animation-delay: 1.8s;
        }
  
  @keyframes bounce {
    0% {
        top: 0;
        text-shadow: none;
    }
    50% {
        top: -10px;
        text-shadow: 0 1px 0 #ccc,
                     0 2px 0 #ccc,
                     0 3px 0 #ccc,
                     0 4px 0 #ccc;
    }
    100% {
        top: -20px;
        text-shadow: 0 1px 0 #ccc,
                     0 2px 0 #ccc,
                     0 3px 0 #ccc,
                     0 4px 0 #ccc,
                     0 5px 0 #ccc,
                     0 6px 0 #ccc,
                     0 7px 0 #ccc,
                     0 8px 0 #ccc;
    }
  }
  
  .wrapper {
    height: 200px;
    width: 300px;
    background-color: #3760C9;
    position: relative;
    display: flex;
    justify-content: center;
    z-index: 0;
  }
  
  .lid {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    border-right: 150px solid transparent;
    border-bottom: 100px solid transparent;
    border-left: 150px solid transparent;
    transform-origin: top;
    transition: transform 0.25s linear;
  }
  
  /* Lid when closed */
  .lid.one {
    border-top: 100px solid #658ced;
    transform: rotateX(0deg);
    z-index: 3;
    transition-delay: 0.75s;
  }
  
  /* Lid when opened */
  .lid.two {
    border-top: 100px solid #3760C9;
    transform: rotateX(90deg);
    z-index: 1;
    transition-delay: 0.5s;
  }
  
  .envelope {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    border-top: 100px solid transparent;
    border-right: 150px solid #C4DFF0;
    border-bottom: 100px solid #C4DFF0;
    border-left: 150px solid #a4d4f2;
    z-index: 3;
  }
  
  .letter {
    position: absolute;
    top: 0;
    width: 80%;
    height: 80%;
    background-color: white;
    border-radius: 15px;
    z-index: 2;
    transition: 0.5s;
  }
  
  .letter p {
    text-align: center;
    font-size: 30px;
    margin-top: 30px;
    color: #3B4049;
  }
  
  .wrapper:hover .lid.one {
      transform: rotateX(90deg);
      transition-delay: 0s;
  }
  
  .wrapper:hover .lid.two {
      transform: rotateX(180deg);
      transition-delay: 0.25s;
  }
  
  .wrapper:hover .letter {
    transform: translateY(-50px);
    transition-delay: 0.5s;
  }

.wrapper:hover ~ .instruction {
    opacity: 0;
    visibility: hidden;
}

.instruction {
    color: white;
    margin-top: 7vh;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

  .animated-text{
    margin-bottom: 2vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-direction: column;
    height: 20vh;
    padding:10px;
  }

  /* Add responsive styles */
  @media screen and (max-width: 768px) {
      .animated-text span {
          font-size: 35px;
      }
      .animated-text {
          height: 15vh;
          margin-bottom: 1vh;
      }
  }

  @media screen and (max-width: 480px) {
      .animated-text span {
          font-size: 20px;
      }
      .animated-text {
          height: 12vh;
          margin-bottom: 0.5vh;
      }
  }

  @media screen and (max-width: 320px) {
      .animated-text span {
          font-size: 17.5px;
      }
      .animated-text {
          height: 10vh;
      }
  }
