/* ============ 登录页面样式 ============ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 7, 14, 0.96);
}

.login-card {
  width: min(100%, 360px);
  padding: 32px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.login-title {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.login-subtitle {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 14px;
}

.login-input {
  width: 100%;
  margin-top: 24px;
  padding: 11px 13px;
  background: #11111d;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  font-size: 15px;
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.16);
}

.login-btn {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { cursor: wait; opacity: 0.65; }

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: #ff7675;
  font-size: 13px;
}

:root {
  --bg: #0f0f0f;
  --card-bg: #1a1a2e;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #6c5ce7;
  --accent-hover: #5a4bd1;
  --border: #2a2a4a;
  --radius: 8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.site-select, .feed-select {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  max-width: 180px;
}

.search-box {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.search-box input {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 14px;
  width: 200px;
}

.search-box button, .history-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.search-box button:hover, .history-btn:hover {
  background: var(--accent-hover);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
}

.video-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.2);
}

.video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #111;
  display: block;
}

.video-card .duration {
  position: absolute;
  bottom: 40px;
  right: 6px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.video-card .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.video-card .card-title {
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  max-height: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.video-card .card-meta {
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 16px;
}

.error-msg {
  text-align: center;
  padding: 40px;
  color: #e74c3c;
  font-size: 15px;
}

.load-more {
  display: block;
  margin: 20px auto 40px;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 30px;
  font-size: 14px;
  cursor: pointer;
}

.load-more:hover {
  background: var(--accent);
}

.hidden { display: none !important; }

/* 播放器弹窗 */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: 20px;
}

.player-container {
  background: var(--bg);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  position: relative;
  padding: 20px;
}

.player-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--card-bg);
  color: var(--text);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-close:hover {
  background: #e74c3c;
  color: white;
}

.player-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 12px;
  padding-right: 50px;
}

#video-player {
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: var(--radius);
}

.player-info {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.comments-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.comments-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.comment-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item .comment-author {
  font-weight: bold;
  font-size: 13px;
  color: var(--accent);
}

.comment-item .comment-body {
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.5;
}

/* 历史 */
.history-container {
  max-width: 700px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.history-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: var(--card-bg);
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
}

.history-item:hover {
  background: var(--accent);
}

.history-item img {
  width: 80px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.history-item .h-title {
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-item .h-site {
  font-size: 11px;
  color: var(--text-muted);
}

.no-comments {
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px 0;
}

@media (max-width: 600px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .search-box input { width: 120px; }
  .site-select, .feed-select { max-width: 120px; font-size: 12px; }
}
