/* 灵动岛风格弹幕样式 */
.barrage {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: inline-block;
  z-index: 99999;
  /* 增加弹幕出现动画 */
  animation: islandEnter 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* 灵动岛进入动画 */
@keyframes islandEnter {
  from { 
    transform: translateY(20px) scale(0.95); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

/* 灵动岛退出动画 */
@keyframes islandExit {
  from { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
  to { 
    transform: translateY(-20px) scale(0.95); 
    opacity: 0; 
  }
}

  .barrage_box {
      background: rgba(30, 30, 30, 0.7); /* 深灰底 */
      backdrop-filter: blur(24px); /* 强烈毛玻璃 */
      -webkit-backdrop-filter: blur(24px);
      border-radius: 28px; /* 胶囊形（高度约56px）*/
      height: 50px;
      padding: 0 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08); /* 内发光边框 */
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      color: #fff;
    }

/* 灵动岛扩展动画 */
.barrage_box.expanding {
  animation: islandExpand 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes islandExpand {
  0% { width: 36px; }
  100% { width: auto; }
}

/* 鼠标悬停效果 */
.barrage_box:hover {
  background-color: rgba(80, 80, 80, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

 /* 头像 */
    .barrage_box .portrait {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
    }

    .barrage_box .portrait img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    /* 文字区域 */
    .barrage_box .message {
      font-size: 17px;
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 180px;
      color: #f5f5f7;
    }
.barrage_box:hover .portrait {
  transform: scale(1.1);
}

.barrage_box div.p a {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  line-height: 1;
  padding: 0 12px;
  max-width: 280px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; /* 苹果系统字体 */
}

/* 灵动岛状态指示器 */
.barrage_box div.p a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
 background-color: rgba(76, 175, 80, 0.99); /* 类似默认绿色 (#4CAF50) 带 50% 透明度 */
}

.barrage_box div.p a:hover {
  color: rgba(255, 255, 255, 0.8);
}

.barrage_box .close {
  visibility: hidden;
  opacity: 0;
  width: 24px;
  height: 24px;
  margin-left: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-size: 13px;
  background-position: center;
  background-repeat: no-repeat;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.barrage_box:hover .close {
  visibility: visible;
  opacity: 0.7;
}

.barrage_box .close:hover {
  opacity: 1;
  transform: rotate(90deg);
  background-color: rgba(255, 255, 255, 0.2);
}

/* 控制按钮 - 灵动岛风格 */
#danmu {
  position: fixed;
  right: 30px;
  bottom: 100px;
  font-size: 12px;
  color: #fff;
  background-color: rgba(60, 60, 67, 0.6);
  width: 80px;
  padding: 8px 0;
  text-align: center;
  border-radius: 18px;
  z-index: 10;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 500;
}

#danmu:hover {
  background-color: rgba(70, 70, 77, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

#danmu.disabled {
  background-color: rgba(60, 60, 67, 0.3);
  cursor: not-allowed;
  opacity: 0.7;
}

#danmu.disabled:hover {
  transform: none;
}
