html {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Work Sans', sans-serif;
}

.container {
  height: 100vh;
  width: 100vh;
  margin: 0 auto;
  text-align: center;
  visibility: hidden;
  position: relative;
  overflow: hidden;
}

.container div.six {
  top: 10vh;
  z-index: 1;
}

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

.container>div {
  position: absolute;
  left: 0;
  right: 0;
  top: 20vh;
}

.one {
  font-size: 4.5rem;
}

.one>img {
  vertical-align: middle;
  margin-bottom: 10px;
  max-width: 100%;
  height: auto;
}

.two {
  font-size: 1.2rem;
  font-weight: lighter;
}

.three {
  font-size: 3rem;
}

.four .text-box {
  width: 600px;
  margin: 0 auto;
  border: 3px solid #aaa;
  border-radius: 5px;
  padding: 10px;
  position: relative;
}

.text-box p {
  margin: 0;
  text-align: left;
}

.text-box span {
  visibility: hidden;
}

.text-box .fake-btn {
  position: absolute;
  right: 5px;
  bottom: 5px;
  color: #fff;
  background-color: #2ba245;
  padding: 5px 8px;
  border-radius: 3px;
}

.five p {
  font-size: 2rem;
  position: absolute;
  left: 0;
  right: 0;
}

.idea-3 strong {
  padding: 3px 5px;
  border-radius: 3px;
  display: inline-block;
}

.five .idea-5 {
  font-size: 4rem;
}

.idea-5 span,
.idea-6 span,
.wish-hbd span {
  display: inline-block;
}

.idea-6 span {
  font-size: 15rem;
  color: #bfae40;
}

.six {
  position: relative;
}

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

.six .hat {
  position: absolute;
  width: 80px;
  top: -70px;
  left: 49%;
  /* 等比例扩大图片到2倍 */
  transform: scale(1.1);
}

.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%;
}

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

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

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

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

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

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

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

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

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

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

.wish-hbd {
  font-size: 3em;
  margin: 0;
  text-transform: uppercase;
}

.wish h5 {
  font-weight: lighter;
  font-size: 2rem;
  margin: 10px 0 0;
}

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

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

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

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

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

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

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

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

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

  .idea-5 span {
    display: block;
  }

  .idea-6 span {
    font-size: 10rem;
  }

  .six .hat {
    width: 50px;
    top: -20px;
  }

  .wish-hbd {
    font-size: 2.2em;
  }

  .wish h5 {
    font-size: 1.4rem;
  }

  .nine p {
    font-size: 1.5rem;
    font-weight: lighter;
  }
}

@media screen and (max-width: 768px) {
  .container {
    width: 100vw;
  }

  /* 降低动画频率，防止闪屏 */
  .eight svg {
    width: 20px;
    /* 减小SVG尺寸 */
  }
}

/* 专门针对 .eight 的动画优化 */
@media screen and (max-width: 768px) {

  /* 预先设置可见性，减少闪烁 */
  .eight svg {
    visibility: visible;
    opacity: 0.01;
    /* 几乎不可见但已经渲染 */
    transform: scale(0.1);
    /* 预先缩放 */
  }
}

@media screen and (max-width: 768px) {
  .idea-3 {
    width: 90%;
    margin: 0 auto;
    word-wrap: break-word;
  }

  .idea-3 span,
  .idea-3 strong {
    display: inline-block;
    font-size: 1.5rem;
    /* 适当减小字体大小 */
    max-width: 100%;
    padding: 2px;
  }

  .five p {
    position: relative;
    /* 改为相对定位，避免溢出 */
    width: 90%;
    margin: 10px auto;
    left: auto;
    right: auto;
    font-size: 1.5rem;
  }

  /* 专门针对 idea-5 的优化 */
  .five .idea-5 {
    position: relative;
    font-size: 1.8rem;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 90%;
  }

  /* 调整 idea-5 内的 span 元素 */
  .idea-5 span {
    display: block;
    margin-bottom: 8px;
    line-height: 1.4;
    word-wrap: break-word;
    text-align: center;
  }

  /* 调整容器使内容可滚动 */
  .container {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    width: 100%;
  }
}

/* 修复 bigTextPart1 和 bigTextPart2 在手机端居中问题 */
@media screen and (max-width: 768px) {

  /* 调整 idea-6 容器在手机端的位置 */
  .five .idea-6 {
    position: relative;
    top: auto;
    left: auto;
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
  }

  /* 调整 SO 文字大小和位置 */
  .idea-6 span {
    font-size: 8rem;
    /* 更小的字体以适应手机 */
    display: inline-block;
    position: relative;
    margin: 0 5px;
  }
}

/* 修复气球在手机端溢出问题 */
@media screen and (max-width: 768px) {

  /* 调整气球容器 */
  .seven {
    overflow: visible;
    /* 确保气球可以超出容器 */
    z-index: 0;
    /* 降低Z轴层级，避免遮挡其他内容 */
  }

  .baloons img:nth-child(even) {
    left: 5%;
    /* 调整到视口内 */
  }

  .baloons img:nth-child(odd) {
    right: 5%;
    /* 调整到视口内 */
  }

  .baloons img:nth-child(3n + 0) {
    left: 45%;
    /* 居中显示部分气球 */
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.play-pause {
  width: 50px;
  height: 50px;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url('../img/play.svg');
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 100;

  position: absolute;
  right: 5vw;
  top: 5vh;
}

.play-pause.playing {
  background-image: url('../img/pause.svg');
  animation: rotate 2s linear infinite;
}

.startSign {
  /* 居中 */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin: 20vh 5vw;
}

.startSign .button {
  padding: 1rem 1.6rem;
  border: 1px solid #2ba245;
  border-radius: 5px;
}

.startSign .button:hover {
  background-color: #2ba245;
  color: #fff;
  padding: 1rem 1.6rem;
  cursor: pointer;
}