html {
  box-sizing: border-box;
}

body {
  background: linear-gradient(#a2d2ff, #EFB0C9);
  margin: 0;
}

.song {
  visibility: hidden;
}

.container {
  height: 100vh; /* 高度设置为视口高度 */
  width: 100vw; /* 宽度设置为视口宽度 */
  margin: 0; /* 清除默认边距 */
  overflow: hidden; /* 隐藏超出容器的内容 */
  position: relative; /* 相对定位以支持绝对定位的子元素 */
  display: flex; /* 使用 flexbox 来实现垂直居中 */
  flex-direction: column; /* 垂直排列子元素 */
  align-items: center; /* 水平居中所有子元素 */
  justify-content: center; /* 垂直居中所有子元素 */
  visibility: hidden; /* 默认隐藏容器 */
}


.container > div {
  position: absolute; /* 绝对定位以支持水平居中 */
  left: 50%; /* 从左边缘的 50% 开始 */
  transform: translateX(-50%); /* 通过负的水平位移将其水平居中 */
  text-align: center; /* 文本中心对齐 */
}

.three, .four, .five, .six, .nine {
  display: block; /* 确保所有这些子元素都居中 */
  margin: 0 auto; /* 在水平方向上自动居中 */
  text-align: center; /* 文本中心对齐 */
}

.one, .four, .nine {
  position: relative;
}

.one {
  text-align: center;
  font-family: "Quicksand", sans-serif;
  font-size: 8vw;
}

.three {
  font-family: "Quantico", sans-serif;
  font-size: 3vw;
  font-weight: lighter;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#threeone {
  font-size: 2rem;
}


.three h1{
  color: rgb(147, 52, 147);
}

.card {
  background: rgb(234, 234, 227);
  border-radius: 15px;
  height: 80vh;
  width: 45vw;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1em;
  overflow: hidden;
}

#bday-date {
  font-size: 30px;
  margin: 0;
  padding: 5px 10px;
  background: rgb(231, 186, 193);
  border-radius: 15px;
  display: inline-block;
}

.cake {
  display: block;
  width: 300px;
  height: 300px;
  background-size: cover;
  background-position: center;
  background-image: url('img/cake.gif');
  position: relative;
  transition: opacity 0.7s ease, transform 0.7s ease;
  margin-top: -20px; /* 负值将 cake 元素往上移动 */
}

.four {
  position: relative; /* 使子元素的绝对定位相对于该容器 */
  max-width: 90%; /* 宽度相对屏幕进行自适应 */
  width: 600px; /* 初始最大宽度 */
  margin: 0 auto; /* 居中 */
}

.text-box {
  display: inline-block;
  border: 5px solid rgb(188, 186, 186);
  border-radius: 5px;
  padding-bottom: 5px;
  position: relative;
  text-align: left;
  width: 100%; /* 使 text-box 自适应父容器 */
  box-sizing: border-box; /* 包括内边距和边框在内的宽度计算 */
}

.text-box span {
  visibility: hidden;
}

.to {
  position: absolute;
  top: 1px;
  left: 10px;
}

.from {
  position: absolute;
  bottom: 1px; 
  right: 10px;
}

.hbd-chatbox {
  position: relative; /* 确保文本换行和内容显示 */
  white-space: pre-wrap; /* 保留空格和换行符 */
  margin: 10px;
  padding: 10px 0;
  display: block; /* 块级元素，确保换行 */
  opacity: 1; /* 确保元素可见 */
}

.fake-btn {
  background-color: rgb(21, 161, 237);
  border-radius: 3px;
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 1vw;
  position: absolute;
  bottom: -4.5rem; /* 调整到 text-box 下方 */
  right: 2px; /* 靠右对齐 */
  text-align: center;
  white-space: nowrap; /* 防止文本换行 */
  box-sizing: border-box;
}

.five {
  font-family: "Cormorant", serif;
  position: relative; /* 确保子元素定位正确 */
}

.gift-title {
  font-size: 4vw;
  white-space: nowrap;
}

#you {
  border-radius: 5px;
  display: inline-block;
  padding: 2px 3px;
  margin-right: 10px; 
  z-index: 1; 
  transition: transform 0.7s ease, color 0.7s ease, background-color 0.7s ease;
  animation: moveRight 0.7s ease forwards; /* 自动向右移动 */
}

.gift-hint {
  font-size: 2rem;
  margin-top: 10px;
}

.gift-section {
  display: flex;
  justify-content: center; /* 确保子元素水平居中 */
  align-items: center; /* 垂直居中 */
  position: relative;
  width: 800px; /* 调整宽度以匹配 gift-cover 和 gift-gif */
  height: 400px;
  margin: 0 auto; /* 使整个 section 居中 */
  margin-top: 20px; /* 添加需要的上边距 */
}

.gift-gif {
  display: block;
  width: 300px;
  height: 300px;
  border: 6px solid white;
  border-radius: 50px;
  background-size: cover;
  background-position: center;
  position: absolute;
  top: 50%; /* 从容器的顶部开始 */
  left: 50%; /* 从容器的左边开始 */
  transform: translate(-50%, -50%); /* 通过负的平移使其完全居中 */
  background-image: url(img/Lana.gif);
  z-index: 2; /* 确保 gift-gif 在上面 */
  opacity: 0; /* 初始状态隐藏 */
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.merrywrap {
  position: absolute;
  right: 40px;
  left: 42px;
  bottom: 80px;
  top: 40px;
}

.giftbox {
  position: absolute;
  width: 300px;
  height: 300px;
  left: 50%;
  margin-left: -150px;
  bottom: 0;
  z-index: 10;
  animation: wobble 0.5s linear infinite forwards; /* 触发动画 */
}

.giftbox > div {
  background: #F64747;
  position: absolute;
  box-shadow: 5px 10px 18px rgba(0, 0, 0, 0.4);
}

.giftbox .cover {
  width: 100%;
  top: 0;
  left: 0;
  height: 25%;
  z-index: 2;
}

.giftbox .cover:before {
  position: absolute;
  content: '';
  height: 50%;
  left: 50%;
  width: 25%;
  height: 100%;
  left: 154px;
  background: #2C3E50;
  transform: translateX(-50%);
}

.giftbox .cover > div {
  position: absolute;
  width: 50px;
  height: 50px;
  left: 50%;
  top: -50px;
  transform: translateX(-50%);
}

.giftbox .cover > div:before, .giftbox .cover > div:after {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  content: "";
  box-shadow: inset 0 0 0 15px #2C3E50;
  border-radius: 30px;
  transform-origin: 50% 100%;
}

.giftbox .cover > div:before {
  transform: translateX(-45%) skewY(40deg);
}

.giftbox .cover > div:after {
  transform: translateX(45%) skewY(-40deg);
}

.giftbox .box {
  right: 5%;
  left: 5%;
  height: 80%;
  bottom: 0;
  border-radius: 0 0 18px 18px;
}

.step-1 .giftbox {
  animation: wobble 0.5s linear infinite forwards;
}

.step-2 .giftbox .cover {
  animation: flyUp 2s ease-in forwards;
}

.step-2 .giftbox .box {
  animation: flyDown 2s ease-in 0.05s forwards;
}

.giftbox .box:before {
  position: absolute;
  content: '';
  width: 25%;
  height: 100%;
  bottom: 0;
  left: 106px;
  right: 0;
  background: #2C3E50;
}

@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(5deg); }
  50% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

@keyframes flyUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-200px); opacity: 0; }
}

@keyframes flyDown {
  0% { transform: translateY(-200px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 自动触发动画 */
.giftbox {
  animation: none;
}

.six {
  position: relative;
  top: 10vh;
  z-index: 1;
}

.six img {
  display: inline-block;
  height: 50vh;
  max-width: 100%;
}

.six .hat {
  left: 44%;
  position: absolute;
  /* transform: scale(0.1); */
  top: -35%;
  width: 80px;
}

.baloons img {
  display: inline-block;
  position: absolute;
}

.baloons img:nth-child(even) {
  left: -10%;
}

.baloons img:nth-child(odd) {
  right: -10%;
}

.baloons img:nth-child(3n + 0) {
  left: 30%;
}

.seven, .eight {
  height: 100vh;
  position: fixed;
  top: 0;
  width: 100vw;
}

.eight svg {
  left: 0;
  position: absolute;
  top: 0;
  visibility: hidden;
  width: 25px;
  z-index: -1;
}

.eight svg:nth-child(1) {
  fill: #bd6ecf;
  left: 5vw;
  top: 7vh;
}

.eight svg:nth-child(2) {
  fill: #7dd175;
  left: 35vw;
  top: 23vh;
}

.eight svg:nth-child(3) {
  fill: #349d8b;
  left: 23vw;
  top: 33vh;
}

.eight svg:nth-child(4) {
  fill: #347a9d;
  left: 57vw;
  top: 43vh;
}

.eight svg:nth-child(5) {
  fill: #c66053;
  left: 7vw;
  top: 68vh;
}

.eight svg:nth-child(6) {
  fill: #bfaa40;
  left: 77vw;
  top: 42vh;
}

.eight svg:nth-child(7) {
  fill: #e3bae8;
  left: 83vw;
  top: 68vh;
}

.eight svg:nth-child(8) {
  fill: #8762cb;
  left: 37vw;
  top: 86vh;
}

.eight svg:nth-child(9) {
  fill: #9a90da;
  left: 87vw;
  top: 94vh;
}

.wish-hbd {
  font-size: 4.5vw;
  margin: 0;
  text-transform: uppercase;
}

.wish h5 {
  font-size: 2.5vw;
  font-family: "Cormorant", serif;
  font-style: italic;
  font-weight: normal;
  margin: 10px 0 0;
}

.eight p {
  font-size: 2rem;
  font-weight: lighter;
}

.nine p{
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: lighter;
  white-space: nowrap;
}

#replay {
  cursor: pointer;
  z-index: 3;
}


/* Media Queries */
@media screen and (max-height: 1000px) {
  .seven .hat {
    left: 40%;
  }
}

@media screen and (max-height: 800px) {
  .seven .hat {
    left: 37%;
  }
}

@media screen and (max-height: 700px) {
  .seven .hat {
    left: 32%;
  }
}

@media screen and (max-height: 850px) and (max-width: 450px) {
  .seven .hat {
    left: 32%;
  }
}

@media screen and (max-width: 500px) {
  .container {
    width: 90%;
  }

  .five .text-box {
    width: 90%;
  }

  .text-box .fake-btn {
    bottom: -38px;
    right: 5px;
  }

  .six .hat {
    width: 50px;
  }

  .six img {
    height: 30vh; 
  }

  .wish-hbd {
    font-size: 5vw;
  }

  .wishText {
    font-size: 5vw;
  }

  .nine p {
    font-size: 3vw;
    font-weight: lighter;
    text-shadow: 0px 0px 1px black;
  }

  /* 针对 .four 和 .fake-btn 的样式 */
  .four {
    width: 100%; /* 使容器在小屏幕上占满宽度 */
    margin: 0 auto;
  }

  .fake-btn {
    bottom: -60px; /* 在小屏幕上稍微上移 */
    right: 5px; /* 增加右边距，避免溢出 */
    font-size: 0.875rem; /* 缩小字体尺寸以适应小屏幕 */
  }
}

@media (max-width: 768px) {
  .four {
    width: 100%; /* 使容器在小屏幕上占满宽度 */
    margin: 0 auto;
  }

  .fake-btn {
    bottom: -60px; /* 在小屏幕上稍微上移 */
    right: 5px; /* 增加右边距，避免溢出 */
    font-size: 0.875rem; /* 缩小字体尺寸以适应小屏幕 */
  }
}

@media (max-width: 500px) {
  .one {
    font-size: 8vw;
  }

  .three{
    font-size: 7vw; 
  }

  .card {
    width: 90vw; /* 自适应 */
  }

  .fake-btn {
    padding: 0.5rem 0.5rem; /* 自适应 */
    font-size: 1rem; /* 自适应 */
  }
}

#footer {
  font-size: 11px;
  font-weight: lighter;
  text-shadow: 0px 0px 1px black;
  position: fixed; 
  bottom: 3px;
  left: 50%; 
  transform: translateX(-50%); 
  text-align: center; 
  width: auto; 
  margin: 0; 
}
