* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* 头部 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.header h1 {
  font-size: 1.8em;
}

.logout-btn {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 15px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  transition: all 0.3s;
}

.logout-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

/* 输入区 */
.input-section {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#magnetInput {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 14px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  outline: none;
  transition: border-color 0.3s;
}

#magnetInput:focus {
  border-color: #e94560;
}

#magnetInput::placeholder {
  color: rgba(255,255,255,0.4);
}

#playBtn {
  padding: 16px 35px;
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

#playBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(233, 69, 96, 0.3);
}

#playBtn:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 状态 */
.status {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 10px;
  text-align: center;
  display: none;
  background: rgba(255,255,255,0.1);
}

.status.show {
  display: block;
}

.status.error {
  background: rgba(255, 71, 87, 0.2);
  color: #ff6b6b;
}

.status.success {
  background: rgba(78, 204, 163, 0.2);
  color: #4ecca3;
}

/* 文件列表 */
.file-list {
  margin-bottom: 20px;
}

.file-item {
  padding: 15px 20px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 8px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.file-item:hover {
  background: rgba(255,255,255,0.1);
}

.file-item.active {
  background: rgba(233, 69, 96, 0.2);
  border-color: #e94560;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 15px;
}

.file-size {
  color: rgba(255,255,255,0.5);
  font-size: 0.9em;
  white-space: nowrap;
}

/* 播放器 */
.player-container {
  display: none;
  margin-bottom: 30px;
  border-radius: 15px;
  overflow: hidden;
  background: #000;
}

.player-container.show {
  display: block;
}

#videoPlayer {
  width: 100%;
  max-height: 70vh;
  display: block;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: rgba(255,255,255,0.05);
  flex-wrap: wrap;
  gap: 15px;
}

#progressInfo {
  font-size: 0.9em;
  color: rgba(255,255,255,0.7);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-control label {
  font-size: 0.9em;
  color: rgba(255,255,255,0.6);
}

#speedSelect {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  outline: none;
}

#speedSelect option {
  background: #1a1a2e;
}

.download-btn {
  padding: 10px 20px;
  background: #4ecca3;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s;
}

.download-btn:hover {
  background: #3db892;
}

.download-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

/* 历史记录 */
.history-section {
  background: rgba(255,255,255,0.05);
  padding: 25px;
  border-radius: 15px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-header h3 {
  font-weight: 500;
}

.clear-btn {
  padding: 6px 15px;
  background: transparent;
  border: 1px solid rgba(255,100,100,0.5);
  border-radius: 5px;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s;
}

.clear-btn:hover {
  background: rgba(255,100,100,0.2);
}

#historyList {
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
}

#historyList::-webkit-scrollbar {
  width: 6px;
}

#historyList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

#historyList li {
  padding: 12px 15px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s;
}

#historyList li:hover {
  background: rgba(255,255,255,0.1);
}

.history-info {
  flex: 1;
  overflow: hidden;
  margin-right: 10px;
}

.history-name {
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-meta {
  font-size: 0.8em;
  color: rgba(255,255,255,0.4);
}

.history-progress {
  font-size: 0.85em;
  color: #4ecca3;
  white-space: nowrap;
  background: rgba(78,204,163,0.1);
  padding: 4px 10px;
  border-radius: 4px;
}

.empty-tip {
  text-align: center;
  color: rgba(255,255,255,0.3);
  padding: 30px;
  display: none;
}

.empty-tip.show {
  display: block;
}

/* 响应式 */
@media (max-width: 600px) {
  .header h1 { font-size: 1.4em; }
  
  .input-section {
    flex-direction: column;
  }
  
  #playBtn {
    width: 100%;
  }
  
  .player-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .control-group {
    justify-content: space-between;
  }
}

/* ========== Tab 切换 ========== */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 15px;
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
}

.tab:hover {
  background: rgba(255,255,255,0.1);
}

.tab.active {
  background: rgba(233, 69, 96, 0.2);
  border-color: #e94560;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== 搜索区 ========== */
.search-section {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#searchInput {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 15px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  outline: none;
  transition: border-color 0.3s;
}

#searchInput:focus {
  border-color: #4ecca3;
}

#searchInput::placeholder {
  color: rgba(255,255,255,0.4);
}

#searchBtn {
  padding: 16px 35px;
  background: linear-gradient(135deg, #4ecca3, #3db892);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  white-space: nowrap;
}

#searchBtn:hover {
  transform: translateY(-2px);
}

#searchBtn:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

/* 搜索状态 */
.search-status {
  padding: 12px 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  text-align: center;
  display: none;
  font-size: 14px;
}

.search-status.show {
  display: block;
  background: rgba(255,255,255,0.1);
}

.search-status.error {
  background: rgba(255,100,100,0.15);
  color: #ff6b6b;
}

.search-status.loading {
  background: rgba(78,204,163,0.15);
  color: #4ecca3;
}

/* 搜索结果 */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.result-item {
  padding: 18px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.3s;
}

.result-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}

.result-title {
  font-size: 15px;
  margin-bottom: 10px;
  line-height: 1.4;
  word-break: break-word;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.result-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.result-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.play-result-btn {
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  color: #fff;
}

.play-result-btn:hover {
  transform: translateY(-1px);
}

.copy-result-btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.copy-result-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* 无结果 */
.no-results {
  text-align: center;
  padding: 40px;
  color: rgba(255,255,255,0.4);
}

/* ========== 响应式补充 ========== */
@media (max-width: 600px) {
  .tabs {
    flex-direction: column;
  }
  
  .search-section {
    flex-direction: column;
  }
  
  #searchBtn {
    width: 100%;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-actions button {
    width: 100%;
  }
}