* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #0f1218;
  color: #e8ebf0;
}

.app { display: flex; flex-direction: column; min-height: 100%; }
.app-header, .app-footer { padding: 12px 16px; background: #121621; border-bottom: 1px solid #1e2433; }
.app-footer { border-top: 1px solid #1e2433; border-bottom: none; padding-bottom: 15px; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  height: auto;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}

.source-loader {
  display: flex;
  gap: 8px;
  align-items: center;
}

.source-loader input[type="url"] { flex: 1; min-width: 280px; }

input[type="url"], input[type="text"], input[type="number"], input[type="file"], select, button {
  background: #161b29;
  border: 1px solid #2a344a;
  color: #e8ebf0;
  padding: 8px 10px;
  border-radius: 8px;
}
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.file-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.file-label input[type="file"] { display: none; }
.file-label { background: #161b29; border: 1px solid #2a344a; color: #e8ebf0; padding: 8px 10px; border-radius: 8px; font-size: inherit; }
.file-label:hover { background: #1a2031; }

.player-container { display: grid; grid-template-columns: 1fr 320px; gap: 12px; padding: 12px 16px; }
.video-wrapper { position: relative; background: #0b0e14; border: 1px solid #1e2433; border-radius: 10px; overflow: hidden; }
video { width: 100%; height: auto; min-height: 400px; max-height: 70vh; background: black; display: block; }
.video-wrapper.mirrored video { transform: scaleX(-1); }
.video-wrapper.mirrored-v video { transform: scaleY(-1); }


/* 全屏模式样式 */
:fullscreen .video-wrapper {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  background: black;
}

:fullscreen video {
  width: 100%;
  height: 100%;
  min-height: unset;
  max-height: unset;
  object-fit: contain;
}

/* 浏览器前缀兼容性 */
:-webkit-full-screen .video-wrapper {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  background: black;
}

:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  min-height: unset;
  max-height: unset;
  object-fit: contain;
}

/* Toast */
#toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); background: rgba(20,24,36,0.9); color: #e8ebf0; padding: 8px 12px; border: 1px solid #2a344a; border-radius: 8px; pointer-events: none; opacity: 0; transition: opacity .2s ease; font-size: 14px; }

/* 循环按钮样式 */
#loopBtn {
  transition: opacity 0.2s ease;
  opacity: 0.5; /* 默认半透明，表示未启用 */
}
#toast.show { opacity: 1; }

.controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px; background: linear-gradient(180deg, rgba(12,14,20,0.0), rgba(12,14,20,0.65)); display: flex; flex-direction: column; gap: 8px; }
.controls .row { display: flex; gap: 8px; align-items: center; }
.controls .row.primary { justify-content: flex-start; flex-wrap: wrap; }
.controls .row.secondary { align-items: center; gap: 12px; }
.controls .row.tertiary { justify-content: space-between; }

#seekBar { flex: 1; }
.seekbar-wrapper { position: relative; display: flex; flex: 1; align-items: center; }
.seekbar-wrapper input[type="range"] { width: 100%; }
#abMarkers { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
.ab-marker { position: absolute; top: 0; transform: translate(-50%, -100%); width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; }
.ab-marker.a { border-bottom: 10px solid #4caf50; }
.ab-marker.b { border-bottom: 10px solid #e91e63; }
.volume { display: inline-flex; align-items: center; gap: 6px; }
.rate { display: inline-flex; align-items: center; gap: 6px; }
.ab-controls { display: inline-flex; gap: 6px; }

.playlist { background: #0b0e14; border: 1px solid #1e2433; border-radius: 10px; padding: 8px; overflow: auto; max-height: 80vh; }
.playlist-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 4px 4px 6px 4px; border-bottom: 1px solid #1e2433; margin-bottom: 8px; min-width: 0; }
.playlist-header strong { word-break: break-word; line-height: 1.2; font-size: 14px; }
.playlist-add { display: flex; gap: 6px; }
/* 修复按钮已移除 */
.playlist ul, #playlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#playlist li { padding: 6px 8px; border-radius: 8px; border: 1px solid #1e2433; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
#playlist li.active { background: #182034; }
#playlist li button { padding: 4px 8px; }
#playlist li span { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
#playlist li div { display: flex; gap: 4px; flex-shrink: 0; }

/* 快捷键说明样式 */
.shortcuts-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #b0b7c3;
  line-height: 1.4;
}

.shortcuts-help strong {
  color: #e8ebf0;
}

.shortcuts-help span {
  padding: 2px 6px;
  background: #161b29;
  border-radius: 4px;
  border: 1px solid #2a344a;
}

/* Mobile */
@media (max-width: 900px) {
  .player-container { grid-template-columns: 1fr; }
  video { max-height: 55vh; }
  
  .shortcuts-help {
    font-size: 11px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .controls { gap: 10px; }
  .controls button, .controls select { padding: 10px 12px; font-size: 16px; }
  #seekBar, #volumeBar { height: 36px; }
}
/* ===== 百度网盘功能样式 ===== */
.baidu-section {
  background: #161b29;
  border: 1px solid #2a344a;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.baidu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a344a;
}

.baidu-header strong {
  font-size: 14px;
  color: #e8ebf0;
}

.baidu-status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #1e2433;
  color: #9ca3af;
}

.baidu-status.logged-in {
  background: #065f46;
  color: #4ade80;
}

.baidu-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.baidu-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.baidu-btn-primary {
  background: #2563eb;
  color: white;
}

.baidu-btn-primary:hover {
  background: #1d4ed8;
}

.baidu-btn-secondary {
  background: #374151;
  color: #e8ebf0;
}

.baidu-btn-secondary:hover {
  background: #4b5563;
}

.baidu-btn-small {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: #2563eb;
  color: white;
}

.baidu-btn-small:hover {
  background: #1d4ed8;
}

.baidu-path {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.baidu-path input {
  flex: 1;
  padding: 6px 8px;
  background: #0b0e14;
  border: 1px solid #2a344a;
  border-radius: 4px;
  color: #e8ebf0;
  font-size: 13px;
}

.baidu-file-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.baidu-file-item {
  background: #0b0e14;
  border: 1px solid #2a344a;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.baidu-file-item:hover {
  background: #121621;
}

.baidu-file-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.baidu-file-name {
  font-size: 13px;
  color: #e8ebf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.baidu-file-size {
  font-size: 11px;
  color: #6b7280;
}

.baidu-file-item button {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.baidu-file-item button:hover {
  background: #1d4ed8;
}

.baidu-file-item button:disabled {
  background: #374151;
  cursor: not-allowed;
}

.baidu-loading {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 13px;
}

.baidu-loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #374151;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.baidu-empty {
  text-align: center;
  padding: 20px;
  color: #6b7280;
  font-size: 13px;
}

/* 滚动条样式 */
.baidu-file-list::-webkit-scrollbar {
  width: 6px;
}

.baidu-file-list::-webkit-scrollbar-track {
  background: #0b0e14;
  border-radius: 3px;
}

.baidu-file-list::-webkit-scrollbar-thumb {
  background: #2a344a;
  border-radius: 3px;
}

.baidu-file-list::-webkit-scrollbar-thumb:hover {
  background: #374151;
}

/* 移动端适配 */
@media (max-width: 900px) {
  .baidu-section {
    padding: 10px;
  }
  
  .baidu-file-list {
    max-height: 200px;
  }
  
  .baidu-file-name {
    font-size: 12px;
  }
}

