/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  background: #111;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ff4d6a;
  white-space: nowrap;
}
.nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-item {
  padding: 8px 16px;
  border-radius: 20px;
  color: #888;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-item.active { background: #ff4d6a; color: #fff; }
.nav-item:hover:not(.active) { background: #222; color: #ccc; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Buttons */
.btn-text {
  background: none;
  border: 1px solid #444;
  color: #ccc;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-text:hover { background: #222; }
.btn-vip {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  border: none;
  color: #000;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-primary {
  background: #ff4d6a;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
}
.btn-primary:hover { background: #e0435e; }
.btn-outline {
  background: none;
  border: 2px solid #ff4d6a;
  color: #ff4d6a;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-outline:hover { background: #ff4d6a; color: #fff; }
.user-name { color: #aaa; font-size: 0.85rem; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }
.hero { text-align: center; padding: 40px 0 20px; }
.hero h2 { font-size: 1.8rem; margin-bottom: 8px; }
.hero p { color: #888; }

/* Series Grid */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.series-card {
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.series-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(255,77,106,0.2); }


.ep-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.card-body { padding: 12px; }
.card-body h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-desc {
  font-size: 0.8rem;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-tags { margin-top: 6px; }
.badge {
  display: inline-block;
  background: #333;
  color: #aaa;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-right: 4px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 32px;
  width: 90%;
  max-width: 400px;
  position: relative;
}
.modal-content h3 { margin-bottom: 20px; font-size: 1.3rem; }
.modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
}
.modal-content input:focus { outline: none; border-color: #ff4d6a; }
.close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
}
.switch-text { text-align: center; margin-top: 16px; font-size: 0.85rem; color: #888; }
.switch-text a { color: #ff4d6a; text-decoration: none; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: #c0392b; }
.toast.success { background: #27ae60; }

/* Loading */
.loading, .empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: #666;
}
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Player Page */
.player-container { max-width: 900px; margin: 0 auto; padding: 0; }
.video-wrapper {
  background: #000;
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 70vh;
  overflow: visible;
}
.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
/* 确保原生 controls 可见 */
video::-webkit-media-controls { display: flex !important; }
video::-webkit-media-controls-panel { display: flex !important; }
.player-info { padding: 16px; }
.player-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.player-info .meta { color: #888; font-size: 0.85rem; }
.episode-list { padding: 0 16px 40px; }
.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #1a1a1a;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.episode-item:hover { background: #222; }
.episode-item.active { background: #2a1a1f; border: 1px solid #ff4d6a; }
.episode-item .ep-num {
  width: 36px;
  height: 36px;
  background: #333;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.episode-item.active .ep-num { background: #ff4d6a; }
.episode-item .ep-info { flex: 1; min-width: 0; }
.episode-item .ep-title { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-item .ep-dur { font-size: 0.75rem; color: #888; }
.episode-item .ep-lock { color: #ffd700; font-size: 0.8rem; }

/* Paywall */
.paywall {
  text-align: center;
  padding: 40px 16px;
  background: linear-gradient(135deg, #1a1a1a, #2a1a1f);
  border-radius: 12px;
  margin: 20px 16px;
}
.paywall h3 { margin-bottom: 8px; }
.paywall p { color: #888; margin-bottom: 20px; }
.paywall .price { font-size: 2rem; font-weight: 700; color: #ffd700; }

/* Pricing Page */
.pricing-container { max-width: 900px; margin: 0 auto; padding: 40px 16px; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.pricing-card {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  border: 1px solid #222;
  transition: border-color 0.2s;
}
.pricing-card.featured { border-color: #ff4d6a; }
.pricing-card h4 { font-size: 1.2rem; margin-bottom: 12px; }
.pricing-card .price { font-size: 2.2rem; font-weight: 700; color: #ffd700; margin-bottom: 4px; }
.pricing-card .period { color: #888; font-size: 0.85rem; margin-bottom: 16px; }
.pricing-card ul { list-style: none; text-align: left; margin-bottom: 20px; }
.pricing-card ul li { padding: 6px 0; color: #aaa; font-size: 0.9rem; }
.pricing-card ul li::before { content: "\2713\00a0"; color: #27ae60; }

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #888;
  text-decoration: none;
  padding: 8px 0;
  font-size: 0.9rem;
}
.back-btn:hover { color: #fff; }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .logo { font-size: 1.1rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-item { padding: 6px 12px; font-size: 0.8rem; }
  .series-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hero h2 { font-size: 1.2rem; }
  .hero p { font-size: 0.85rem; }
  .container { padding: 12px 10px; }
  .series-card { border-radius: 10px; }
  .card-body { padding: 8px; }
  .card-body h4 { font-size: 0.85rem; }
  .btn-text, .btn-vip { padding: 6px 12px; font-size: 0.8rem; }
  .modal-content { padding: 20px; width: 95%; }
  .player-container { padding: 0; }
  .video-wrapper { aspect-ratio: 16/9; max-height: 50vh; }
  .episode-item { padding: 10px; }
  .comments-section { padding: 0 10px 30px; }
}
@media (max-width: 400px) {
  .series-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-cover { aspect-ratio: 2/3; }
}
/* Touch improvements */
.series-card, .episode-item, .nav-item, button { 
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.series-card:active { transform: scale(0.97); transition: transform 0.1s; }


/* Comments */
.comments-section { padding: 0 16px 40px; }
.comments-section h4 { margin-bottom: 12px; }
.comment-input { margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start; }
.comment-input textarea {
  flex: 1; padding: 10px; background: #111; border: 1px solid #333;
  border-radius: 8px; color: #fff; font-size: 0.9rem; resize: vertical;
}
.comment-input textarea:focus { outline: none; border-color: #ff4d6a; }
.comment-list { margin-top: 8px; }
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #1a1a1a; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #ff4d6a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 0.9rem; }
.comment-time { font-size: 0.75rem; color: #666; }
.comment-text { font-size: 0.9rem; color: #ccc; line-height: 1.4; }
.login-to-comment a { color: #ff4d6a; text-decoration: none; }


/* Cover placeholder when image fails */
.card-cover { position: relative; aspect-ratio: 3/4; background: #1a1a1a; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.card-cover .cover-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; color: #fff; font-size: 1.1rem; font-weight: 700;
  text-align: center; padding: 16px; word-break: break-word; line-height: 1.3;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}
.card-cover .cover-placeholder .placeholder-icon {
  font-size: 2.8rem; margin-bottom: 10px; opacity: 0.8;
}
.card-cover .cover-placeholder .placeholder-title {
  font-size: 0.95rem; opacity: 0.9; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}


/* 全屏视频样式 */
.video-wrapper:fullscreen,
.video-wrapper:-webkit-full-screen {
  width: 100vw !important; height: 100vh !important; max-height: none !important;
}
.video-wrapper video { width: 100%; height: 100%; object-fit: contain; }

/* 移动端伪全屏退出按钮 */
.exit-fullscreen-btn {
  position: fixed; top: 10px; right: 10px; z-index: 10000;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem;
  cursor: pointer; display: none;
}

/* ── 自定义播放器控件 ── */
.player-controls-bar {
  background: #0a0a0a; padding: 8px 12px 12px;
}
.player-controls-bar * { pointer-events: auto; }
.ctrl-buttons-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ctrl-progress {
  width: 100%; height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; margin-bottom: 10px; cursor: pointer; position: relative;
  -webkit-appearance: none; appearance: none; outline: none;
}
.ctrl-progress::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #ff4d6a; cursor: pointer; margin-top: -5px;
}
.ctrl-progress::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #ff4d6a; cursor: pointer; border: none;
}
.ctrl-progress::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: rgba(255,255,255,0.2);
}

.ctrl-btn {
  background: none; border: none; color: #fff; font-size: 1.3rem;
  cursor: pointer; padding: 4px; line-height: 1;
}
.ctrl-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ctrl-spacer { flex: 1; }
.ctrl-center-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 3rem; color: #fff; z-index: 25; cursor: pointer;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.ctrl-center-play.show { opacity: 1; pointer-events: auto; }

.ctrl-btn {
  background: #1a1a1a; border: 1px solid #333; color: #fff;
  font-size: 0.8rem; cursor: pointer; padding: 6px 10px; border-radius: 6px;
  white-space: nowrap;
}
.ctrl-play-btn { font-size: 1.2rem; padding: 6px 14px; background: #ff4d6a; border-color: #ff4d6a; }
.ctrl-time { color: #ccc; font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ctrl-progress {
  width: 100%; height: 6px; background: #333; border-radius: 3px;
  margin-bottom: 8px; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.ctrl-progress::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #ff4d6a; cursor: pointer; margin-top: -5px;
}
.ctrl-progress::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #ff4d6a; cursor: pointer; border: none;
}


#dplayer { min-height: 300px; width: 100%; background: #000; }
#dplayer video { display: block; width: 100%; }
