.yc-spin {
  position: relative;
  color: rgb(var(--primary-6));
  width: fit-content;
  height: fit-content;

  .yc-spin-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    &.yc-spin-icon-loading {
      animation: spin 1s infinite cubic-bezier(0, 0, 1, 1);
    }
  }

  .yc-dot-loading {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 8px;
    transform-style: preserve-3d;
    perspective: 200px;
    .yc-dot-loading-item {
      position: absolute;
      top: 0;
      left: 50%;
      width: 8px;
      height: 8px;
      background-color: rgb(var(--primary-6));
      border-radius: var(--border-radius-circle);
      transform: translate(-50%) scale(0);
      animation: dot-loading 2s cubic-bezier(0, 0, 1, 1) infinite forwards;
      &:nth-child(2) {
        background-color: rgb(var(--primary-5));
        animation-delay: 0.4s;
      }
      &:nth-child(3) {
        background-color: rgb(var(--primary-4));
        animation-delay: 0.8s;
      }
      &:nth-child(4) {
        background-color: rgb(var(--primary-4));
        animation-delay: 1.2s;
      }
      &:nth-child(5) {
        background-color: rgb(var(--primary-2));
        animation-delay: 1.6s;
      }
    }
  }

  .yc-spin-tip {
    margin-top: 6px;
    color: rgb(var(--primary-6));
    font-weight: 500;
    font-size: 14px;
    line-height: 21px;
  }

  .yc-spin-mask {
    z-index: 11;
    position: absolute;
    height: 100%;
    width: 100%;
    background-color: var(--color-spin-layer-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}

// 旋转
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* prettier-ignore */
@keyframes dot-loading {
    each(range(36), {
      @percent: round(percentage(((@value - 1) / 36)), 3);
      @radius: 280%;
      @xOffset: round(sin((pi() / 180 * @value * 10)) * @radius, 3) * -1;
      @zOffset: round(cos((pi() / 180 * @value * 10)), 3) * -1px;
      @scaleOffset: round((1 - cos((pi() / 180) * @value * 10)) * 0.75 + 0.5, 3);
      @{percent} {
        transform: ~'translate3D(@{xOffset}, 0, @{zOffset}) scale(@{scaleOffset})'
      }
    });
  }
