:root {
  /* 随机平面旋转角度 */
  --rotateYRandom: 0deg;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-image: url(./img/bg.jpeg);
  background-size: 100% auto;
  background-repeat: round;
}

#result {
  position: fixed;
  top: 6vh;
  color: white;
  text-align: center;
  width: 100%;
  z-index: 1;
}

#jiangxiang {
  position: absolute;
  top: 15vh;
  width: 100%;
  text-align: center;
  font-size: 2rem;
  font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
  text-transform: uppercase; /* 全开大写 */
  color: #f1ebe5;
  text-shadow: 0 8px 9px #c4b59d, 0px -2px 1px #fff;
  font-weight: bold;
  letter-spacing: 1vh;
  z-index: 1;
}

#ruleText {
  position: absolute;
  top: 7vh;
  color: white;
  text-align: right;
  right: 2vh;
  z-index: 1;
}

#myBlog {
  position: absolute;
  top: 2vh;
  color: white;
  text-align: right;
  right: 2vh;
  z-index: 1;
}

#rule {
  background-image: url(./img/rule.png);
  background-repeat: no-repeat;
  background-size: 97% auto;
  background-position: center;
  height: 100%;
  width: 100%;
  text-align: center;
  position: absolute;
  top: -5vh;
  display: none;
  z-index: 2;
}

#musicBox {
  background-image: url(./img/music.png);
  background-repeat: no-repeat;
  width: 13vw;
  height: 13vw;
  background-size: 100%;
  position: absolute;
  top: 7vh;
  z-index: 2;
}

#musicBox.ani {
  animation: musicRotate 5s linear infinite;
}

/* 360°旋转动画 */
@keyframes musicRotate {
  /* 需要兼容的自行补入噢 */
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.dice-box {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  position: relative;
  background-image: url(./img/wan.png);
  background-repeat: no-repeat;
  background-size: 220% auto;
  background-position: center;
}

/* 按钮样式 */
.btn-group {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  bottom: 5vh;
}

.btn-group button,
.btn-group span {
  padding: 2vw 3vw;
  margin: 0 1.5vw;
}

.btn-group .btn {
  width: 50%;
  height: 7vh;
  line-height: 7vh;
  text-align: center;
  background-image: url(./img/btn.png);
  background-size: 100%;
  background-repeat: no-repeat;
  background-position: center;
  font-size: 1.2rem;
  color: white;
  animation: scaleDraw 3s ease-in-out infinite;
}

/*骰子动画*/
.dice.ani .vertical {
  animation: jump 1s linear;
}
.dice.ani .horizontal {
  animation: rotateY 2s ease-out;
}
.dice.ani .cube {
  transition: transform 2.1s;
}

@keyframes scaleDraw {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.1);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.1);
  }
}

@keyframes rotateY {
  from {
    transform: rotateY(0);
  }
  to {
    transform: rotateY(1800deg);
  }
}
@keyframes jump {
  from {
    transform: translateY(-3.6em);
  }
  30% {
    transform: translateY(-3em);
  }
  60% {
    transform: translateY(0);
  }
  70% {
    transform: translateY(-1.5em);
  }
  80% {
    transform: translateY(0);
  }
  90% {
    transform: translateY(-0.6em);
  }
  to,
  10% {
    transform: translateY(0);
  }
}

/*转到对应点数的动画*/
.cube {
  transform: rotateX(-10deg) rotateY(10deg);
}

/*面的样式*/
.dice,
.vertical,
.horizontal,
.cube,
.face {
  transform-style: preserve-3d;
}
.dice,
.vertical,
.horizontal,
.cube,
.face,
.face::after,
.axis-face {
  width: 1em;
  height: 1em;
}
.dice {
  margin: auto;
  transform: scale(2.5);
  position: absolute;
}
.cube {
  position: relative;
}
.face,
.face::after,
.axis-face {
  position: absolute;
  top: 0;
  left: 0;
}
.face {
  box-sizing: border-box;
  padding: 0.15em;
  background-color: white;
  border-radius: 40%;
  box-shadow: 0 0 0.2em #ccc inset;
  background-size: 100% 100%;
  /* background-image: url('568957ab-f153-4af2-b37e-cbe308c6c75f.jpg'); */
}
.face::after {
  content: '';
  display: block;
  border-radius: 0.2em;
  transform: translateZ(-0.1px);
  background-color: #e0e0e0;
}
.axis-face {
  background: #e0e0e0;
}

/*点的样式*/
.dot {
  width: 0.2em;
  height: 0.2em;
  display: inline-block;
  background: #444;
  border-radius: 50%;
  box-shadow: inset 0.05em 0.05em 0.1em black;
}
/* 面的方位*/
.face.front {
  transform: translateZ(0.5em);
}
.face.back {
  transform: translateZ(-0.5em) rotateY(180deg);
}
.face.up {
  transform: translateY(-50%) rotateX(90deg);
}
.face.down {
  transform: translateY(50%) rotateX(-90deg);
}
.face.left {
  transform: translateX(-50%) rotateY(-90deg);
}
.face.right {
  transform: translateX(50%) rotateY(90deg);
}
.axis-face.x {
  transform: rotateY(90deg);
}
.axis-face.y {
  transform: rotateX(90deg);
}
.axis-face.z {
}

/* 点的排列布局*/
.face,
.dot-row {
  display: flex;
}
.face.one {
  align-items: center;
  justify-content: center;
}
.one .dot,
.four .dot {
  background: red;
}
.face.two {
  justify-content: space-around;
}
.face.two .dot:nth-child(2) {
  align-self: flex-end;
}
.face.three {
  justify-content: space-around;
}
.face.three .dot:nth-child(2) {
  align-self: center;
}
.face.three .dot:nth-child(3) {
  align-self: flex-end;
}
.face.four {
  flex-direction: column;
  justify-content: space-between;
}
.face.four .dot-row {
  justify-content: space-between;
}
.face.five {
  flex-direction: column;
  justify-content: space-between;
}
.face.five .dot-row {
  justify-content: space-between;
}
.face.five .dot-row:nth-child(2) {
  justify-content: center;
}
.face.six {
  flex-direction: column;
  justify-content: space-around;
}
.face.six .dot-row {
  justify-content: space-between;
}
