/* ========== 重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 8px;
}

/* ========== 手机模型 ========== */
.phone {
  width: 100%; height: 100%;
  border: 12px solid #000; border-radius: 60px;
  position: relative; overflow: hidden;
}

.phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 200px; height: 20px; background: #000;
  border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; z-index: 10;
}

/* ========== 核心布局：phone-screen 绝对拉伸 ========== */
.phone-screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-color: #000;
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* ★ 滚动容器下沉到 video-list */
.video-list {
  flex: 1;                     /* 占满 phone-screen 剩余空间 */
  overflow-y: auto;            /* ★ 这里才是滚动容器 */
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  position: relative;
  background-color: #000;      /* ★ 兜底：任何间隙显示黑色，不露出相邻视频 */
}

/* 每个视频页：精确等于可视区高度 */
.video-slide {
  width: 100%;
  height: 100%;               /* 100% of video-list → 精确等于可视区 */
  scroll-snap-align: start;
  scroll-snap-stop: always;   /* ★ 强制停住 */
  position: relative;
  background-color: #000;
}

/* ========== 视频 ========== */
.video-container {
  width: 100%; height: 100%;
  position: relative; overflow: hidden;
  /* 视频/封面还没加载出来时的占位底色（避免死黑一块） */
  background: linear-gradient(160deg, #1b1b1b 0%, #0a0a0a 55%, #000 100%);
  -webkit-tap-highlight-color: transparent;
}

.video-item {
  width: 100%; height: 100%;
  object-fit: contain;      /* ★ 保持原比例：16:9 视频横在中间，上下黑边；竖屏视频左右黑边 */
  background: transparent;  /* 未加载时露出容器的深色渐变，不是死黑 */
  display: block;
}

.video-title {
  position: absolute; bottom: 60px; left: 0; width: 100%;
  padding: 15px 20px; color: #fff; font-size: 16px; font-weight: 500;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5); z-index: 10;
}

.progress-bar {
  position: absolute; bottom: 0; left: 0; width: 100%;
  height: 4px; background-color: rgba(255,255,255,0.3); z-index: 10;
}
.progress { height: 100%; background-color: #ff4757; width: 0; transition: width 0.1s linear; }

/* 缓冲/加载提示 */
.loading-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 12px;
  background-color: rgba(0,0,0,0.35);
  z-index: 20; opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease; pointer-events: none;
}
.loading-overlay.visible { opacity: 1; visibility: visible; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }

/* 暂停遮罩 */
.pause-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.35);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 12px;
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.pause-overlay.visible {
  opacity: 1; pointer-events: auto; cursor: pointer;
}
.pause-overlay img { width: 80px; height: 80px; }

/* 错误态 reload 按钮 */
.reload-btn {
  display: none; flex-direction: column; align-items: center; gap: 8px;
  color: #fff; background: rgba(0,0,0,0.6);
  border: none; border-radius: 12px; padding: 16px 24px;
  cursor: pointer; font-size: 14px;
}
.reload-btn svg { width: 40px; height: 40px; stroke: #fff; }
.pause-overlay.is-error .pause-icon { display: none; }
.pause-overlay.is-error .reload-btn { display: flex; }

/* ========== 静音开关（右上角，与右下角按钮同尺寸） ========== */
.sound-btn {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: none; color: #fff;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; z-index: 999;
  -webkit-tap-highlight-color: transparent;
}
.sound-btn.visible { display: flex; }
.sound-btn svg { width: 20px; height: 20px; }

/* ========== Toast ========== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  padding: 12px 24px; background: rgba(0,0,0,0.8); color: #fff;
  border-radius: 20px; z-index: 1000; opacity: 0;
  transition: opacity 0.3s ease; pointer-events: none; font-size: 14px;
}
.toast.show { opacity: 1; }

/* ========== 搜索按钮（fixed 固定） ========== */
.search-container {
  position: fixed; right: 40px; bottom: 40px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.search-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease; text-decoration: none; font-size: 16px;
}
.search-btn:hover { background: rgba(0,0,0,0.8); transform: scale(1.05); }

/* ========== 搜索框 ========== */
.search-box {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  width: 90%; max-width: 500px; background: white; border-radius: 25px;
  display: flex; align-items: center; padding: 0 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 200;
  opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.search-box.active { opacity: 1; visibility: visible; }

.search-input {
  flex: 1; height: 50px; border: none; outline: none; font-size: 16px;
  padding: 0 10px; border-radius: 25px;
}
.search-submit-btn, .close-btn {
  background: none; border: none; color: #666; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 5px; transition: color 0.3s ease;
}
.search-submit-btn { margin-right: 5px; }
.search-submit-btn:hover, .close-btn:hover { color: #000; }

.search-results {
  position: absolute; top: 100%; left: 0; width: 100%;
  background: white; border-radius: 0 0 25px 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3); margin-top: 5px;
  max-height: 300px; overflow-y: auto; z-index: 100;
  opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.search-results.active { opacity: 1; visibility: visible; }
.search-result-item {
  padding: 15px 20px; border-bottom: 1px solid #f0f0f0;
  cursor: pointer; transition: background-color 0.2s ease;
  color: #333; font-size: 14px;
}
.search-result-item:last-child { border-bottom: none; border-radius: 0 0 25px 25px; }
.search-result-item:hover { background: #f5f5f5; }

.page-title {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  color: white; font-size: 24px; font-weight: bold; text-align: center;
  z-index: 99;
  background: linear-gradient(45deg, #ff00cc, #3333ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3); opacity: 0.9;
}
