.live-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16/9;
  margin: auto;
  background: black;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 中间层 */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* 不挡点击 */
}

/* 大播放按钮 */
.overlay-btn {
  opacity: 0.9;
  display: none;
}
.center_play_icon {
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}
.center_play_icon:hover {
  transform: scale(1.1);
  opacity:1;
}
/* 加载动画 */
.spinner {
  width: 25px;
  height: 25px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#tip {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  display: none;
}

/* 控制条 */
.controls {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;

  display: flex;
  justify-content: space-between;
  align-items: center;

  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  transition: bottom 0.3s ease-out, opacity 0.5s, visibility 0.5s;
}

.live-wrapper.hide-controls .controls {
  opacity: 0;
}

.left, .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon {
  width: 24px;
  height: 24px;
  cursor: pointer;
}

input[type="range"] {
  width: 60px;
}

/* 网页全屏 */
.live-wrapper.page-full {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  z-index: 9999;
}

/* 弹幕展示容器 */
#danmakuContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* 【关键】绝对不能挡住视频点击 */
  overflow: hidden;
  z-index: 10; 
}

/* 弹幕动画和单条样式 */
.danmaku-item {
  position: absolute;
  white-space: nowrap;
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
  right: -10%;
  animation: danmakuMove 6s linear forwards;
}
@keyframes danmakuMove {
  0% { right: -10%; transform: translateX(100%); }
  100% { right: 100%; transform: translateX(0); }
}

.controls .center {
  flex: 1; /* 占据中间所有剩余空间 */
  display: flex;
  gap: 8px;
  margin: 0 15px;
}

.controls .center input {
  background: rgba(255, 255, 255, 0.2); /* 半透明背景 */
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  font-size: 13px;
  transition: background 0.2s;
}

.controls .center input:focus {
  background: rgba(255, 255, 255, 0.4); /* 聚焦时变亮 */
}

/* 限制 ID 输入框宽度 */
#danmakuUser {
  width: 32px;
  text-align: center;
}

/* 弹幕内容输入框自适应变宽 */
#danmakuText {
  flex: 1;
  min-width: 40px;
}

.controls .center button {
  background: #00a1d6; /* B站蓝，你可以换成你喜欢的颜色 */
  border: none;
  color: white;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.controls .center button:hover {
  background: #00b5e5;
}

@media screen and (max-width: 768px) and (orientation: portrait) {
  
  /* 1. 允许控制条换行，并调整高度 */
  .controls {
    flex-wrap: wrap;
    padding-bottom: 15px; /* 增加一点底部间距，防止太贴边 */
  }

  /* 2. 重新排序：左侧按钮放第一排左边 */
  .controls .left {
    order: 1;
  }

  /* 3. 重新排序：右侧按钮放第一排右边 */
  .controls .right {
    order: 2;
  }

  /* 4. 【核心】把输入区挤到第二排，并强制占满 100% 宽度 */
  .controls .center {
    order: 3;
    width: 100%;
    margin: 10px 10px 0 10px; /* 增加顶部边距，和第一排按钮隔开 */
    flex: none; /* 取消原来的 flex: 1，防止变形 */
  }

  /* 5. 隐藏手机端不需要的元素（音量控制） */
  #volumeIcon, 
  #muteIcon, 
  #volumeRange {
    display: none !important;
  }

  /* 6. 稍微缩小 ID 输入框，给弹幕内容留出更多打字空间 */
  #danmakuUser {
    width: 45px;
    padding: 6px 4px; /* 稍微增加一点高度，方便手指点击 */
  }

  #danmakuText, #danmakuSend {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* ===== 弹幕侧栏 ===== */
.danmaku-sidebar {
  position: absolute;
  left: 10px;           /* 靠右侧显示，可改为 left:10px 靠左 */
  bottom: 75px;          /* 避开底部控制条 */
  width: 200px;          /* 宽度可调 */
  height: 200px;         /* 高度可调 */
  pointer-events: none;  /* 不遮挡视频点击 */
  z-index: 15;
  
  /* 透明背景，加一点半透明底纹便于阅读 */
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 8px;
  box-sizing: border-box;
  
  /* 消息从底部向上堆叠 */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  
  /* 渐变遮罩（可选） */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
  
  transition: opacity 0.3s;
}

/* 侧栏中的单条消息 */
.sidebar-msg {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.6;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
  word-wrap: break-word;
  margin-top: 2px;       /* 消息间距 */
  animation: slideUp 0.2s ease-out;
}

.sidebar-msg .user {
  color: #00a1d6;
  font-weight: bold;
  margin-right: 5px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}