/* 进度条 - 紫橙配色 */
.progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px; /* 增加高度以容纳 logo */
  background: transparent;
  z-index: 9999;
  overflow: visible !important;
  border-radius: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  display: flex;
  align-items: center;
  pointer-events: none;
}

/* 进度条背景轨道 */
.progress-bar::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(204, 211, 245, 0.3);
}

.progress-bar.loaded {
  opacity: 1;
  visibility: visible;
}

.progress-bar span { 
  display: block;
  height: 6px;
  background: #f4aba4;
  width: 0%;
  position: absolute;
  bottom: 10px;
  left: 0;
  border-radius: 0;
  transition: width 0.3s ease;
  overflow: visible;
}

/* 进度条右侧 Logo 装饰 */
.progress-bar span::after {
  content: '';
  position: absolute;
  bottom: -25px;
  right: -10px;
  transform: translateY(0);
  width: 60px;
  height: 60px;
  background-image: url(https://static.igem.wiki/teams/5878/common/process-icon.webp);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: progressFloat 2s ease-in-out infinite;
}

/* Logo 浮动动画 */
@keyframes progressFloat {
  0%, 100% { 
    transform: translateY(-4px);
  }
  50% { 
    transform: translateY(-8px);
  }
}

/* Reduced motion support for progress bar */
@media (prefers-reduced-motion: reduce) {
.progress-bar span { animation: none; }
.progress-bar span::after { animation: none; transition: none; }
}



/* 进度条 */
.diy-totop {
  position: fixed;
  right: 0;
  bottom: 20px;
  transition: transform 0.25s ease, filter 0.25s ease;
  transform: translateY(0) rotate(0deg);
  width: 160px;
  z-index: 999999;
}
.diy-totop:hover {
  transform: translateY(-2px) rotate(3deg);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.18));
}
#totopLink {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* 页面未加载完成时，强制隐藏 */
body:not(.page-loaded) #totopLink {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* 页面加载完成后，根据滚动位置显示/隐藏 */
body.page-loaded #totopLink.diy-show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1);
}

/* Gentle float animation when visible */
#totopLink.diy-show .diy-totop {
  /* animation: totopFloat 3s ease-in-out infinite, totopShadow 3s ease-in-out infinite; */
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.14));
}

@keyframes totopFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes totopShadow {
  0%, 100% { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.14)); }
  50% { filter: drop-shadow(0 5px 8px rgba(0,0,0,0.22)); }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #totopLink.diy-show .diy-totop { animation: none; }
  .diy-totop { transition: none; }
}