body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f5f5f5;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
}

/* 视频墙 */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.video-item {
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s;
}

.video-item:hover {
  transform: scale(1.03);
}

.video-item img {
  width: 100%;
  border-radius: 4px;
}

.video-item .title {
  margin-top: 10px;
  font-weight: bold;
}

/* 弹窗 */
.video-popup {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.popup-content {
  position: relative;
  width: 90%;
  max-width: 800px;
}

.popup-content iframe {
  width: 100%;
  height: 450px;
}

.close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 24px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
}

.controls {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.controls button {
  padding: 8px 12px;
  border: none;
  background: #007BFF;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

/* 移动端自适应 */
@media (max-width: 768px) {
  .popup-content iframe {
    height: 60vh;
  }
  .video-grid {
    display: block;
  }
  .video-item {
    margin-bottom: 20px;
  }
}

/* 弹窗 iframe 淡入淡出效果 */
#popupVideo {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.fade-out {
  opacity: 0;
}


/* 缩略图容器 */
.thumb {
  position: relative;
  width: 100%;
  background: #000;      /* iframe 加载前不闪白 */
  overflow: hidden;
}

/* 图片和 iframe 都覆盖整个容器 */
.thumb img,
.thumb iframe {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;     /* 保证图片/视频填满 */
}

/* iframe 绝对定位覆盖图片 */
.thumb iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: none;
  pointer-events: none;  /* 不抢鼠标事件 */
}