/* 底部浮动下载条（PC 560×80 胶囊） */
.download-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translateX(-50%);
  width: 560px;
  max-width: calc(100vw - 32px);
  height: 80px;
  padding: 0 16px 0 24px;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0%, #fdfcff 65%, #f3ecff 100%);
  box-shadow:
    0 8px 24px -6px rgba(61, 38, 112, 0.06),
    0 4px 6px rgba(110, 71, 194, 0.04),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
  border-radius: 100px;
  outline: 1px solid rgba(224, 217, 245, 0.55);
  outline-offset: -1px;
}

.download-bar[hidden] {
  display: none !important;
}

.download-bar__body {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.download-bar__logo-wrap {
  width: 88px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(90deg, #fff 0%, #fff2eb 100%);
  box-shadow:
    0 4px 13px -4px rgba(153, 79, 33, 0.1),
    inset 0 1px 1px #fff;
  border-radius: 13px;
  overflow: hidden;
}

.download-bar__logo {
  display: block;
  width: 77px;
  height: auto;
  max-height: 26px;
  object-fit: contain;
}

.download-bar__copy {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
}

.download-bar__title {
  color: rgba(0, 0, 0, 0.9);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-bar__desc {
  color: rgba(0, 0, 0, 0.55);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-bar__cta {
  flex-shrink: 0;
  width: 84px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  background: linear-gradient(118deg, #9c7efc 0%, #8859f9 65%, #6e3bd6 100%);
  box-shadow:
    0 4px 10px -3px rgba(120, 71, 227, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  outline: 1px solid rgba(255, 255, 255, 0.28);
  outline-offset: -1px;
}

.download-bar__body:hover .download-bar__cta {
  filter: brightness(1.05);
}

.download-bar__close {
  flex-shrink: 0;
  width: 24px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.download-bar__close-icon {
  display: block;
  width: 12px;
  height: 12px;
  opacity: 0.55;
}

.download-bar__close:hover .download-bar__close-icon {
  opacity: 0.85;
}

/* 有下载条时给 footer 留空，避免被挡住；并上移返回顶部 */
body:has(.download-bar:not([hidden])) .site-footer {
  /* 原 padding-bottom 36 + 条高 80 + 底边距 24 + 间距 16 */
  padding-bottom: calc(36px + 80px + 24px + 16px);
}

body:has(.download-bar:not([hidden])) .to-top {
  bottom: 120px;
}

/* H5：64 高，左右 12，logo 62×42，标题 16/副文 12，按钮仍 84×40 */
@media (max-width: 768px) {
  .download-bar {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: none;
    width: auto;
    max-width: none;
    height: 64px;
    padding: 0 12px;
    gap: 8px;
  }

  .download-bar__logo-wrap {
    width: 62px;
    height: 42px;
    border-radius: 9px;
    box-shadow:
      0 3px 9px -3px rgba(153, 79, 33, 0.1),
      inset 0 1px 1px #fff;
  }

  .download-bar__logo {
    width: 54px;
    max-height: 18px;
  }

  .download-bar__copy {
    gap: 0;
  }

  .download-bar__title {
    font-size: 16px;
    line-height: 22px;
  }

  .download-bar__desc {
    font-size: 12px;
    line-height: 18px;
  }

  .download-bar__cta {
    width: 84px;
    height: 40px;
    font-size: 14px;
    line-height: 20px;
  }

  .download-bar__close {
    width: 24px;
    height: 40px;
  }

  body:has(.download-bar:not([hidden])) .site-footer {
    /* H5 原 padding-bottom 12 + 条高 64 + 底边距 16 + 间距 16 + safe-area */
    padding-bottom: calc(12px + 64px + 16px + 16px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.download-bar:not([hidden])) .to-top {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .download-bar__cta {
    transition: none;
  }
}
