/* ========== VerCD - VeryCD Style ========== */
:root {
  --bg: #fff;
  --bg-white: #fff;
  --text: #333;
  --text-light: #888;
  --text-lighter: #aaa;
  --link: #c62828;
  --link-hover: #8e0000;
  --border: #ddd;
  --border-light: #eee;
  --header-bg: #fff;
  --header-text: #333;
  --header-border: #e0e0e0;
  --tag-bg: #fdeaea;
  --tag-text: #c62828;
  --score: #f90;
  --card-hover: #fafafa;
  --input-bg: #fff;
  --input-border: #ccc;
  --btn-bg: #c62828;
  --btn-text: #fff;
  --btn-hover: #8e0000;
  --danger: #d32f2f;
  --toggle-on: #c62828;
  --toggle-off: #ccc;
  --overlay-bg: rgba(0,0,0,0.85);
  --section-title: #c62828;
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: "Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
img { display:block; }

/* ===== Header ===== */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--header-border);
}
.header-left { display:flex; align-items:center; gap:24px; }
.site-logo { display:flex; align-items:center; gap:10px; cursor:pointer; }
.site-logo img { width:48px; height:48px; border-radius:10px; }
.logo-text { font-size:22px; font-weight:800; color:var(--link); letter-spacing:-0.5px; }
.nav-links { display:flex; gap:4px; }
.nav-links a {
  color: var(--text-light);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.nav-links a svg { width:16px; height:16px; flex-shrink:0; }
.nav-links a:hover, .nav-links a.active {
  color: var(--link);
  background: var(--tag-bg);
}
.header-right { display:flex; align-items:center; gap:12px; }
.admin-link {
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: color .2s;
}
.admin-link:hover { color:var(--link); }

/* ===== Announcement ===== */
.announcement-bar {
  background: #fff8e1;
  border-bottom: 1px solid #ffe082;
  padding: 8px 20px;
  font-size: 13px;
  color: #795548;
  display: none;
}
.announcement-bar.show { display:block; }

/* ===== Search Box (Homepage) ===== */
.search-hero {
  background: var(--bg-white);
  text-align: center;
}
.hero-brand {
  padding: 48px 20px 24px;
}
.search-hero-bar {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: var(--bg-white);
  padding: 10px 20px 14px;
  text-align: center;
  transition: background .3s, box-shadow .3s, backdrop-filter .3s;
}
.search-hero-bar.is-stuck {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.search-hero .hero-logo {
  display: inline-block;
  cursor: pointer;
  margin-bottom: 6px;
}
.search-hero .hero-logo img {
  height: 72px;
  width: auto;
  border-radius: 14px;
}
.search-hero .hero-sub {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 24px;
}
.search-box {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  position: relative;
}
.search-box-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #bbb;
  pointer-events: none;
  z-index: 1;
}
.search-box input {
  flex: 1;
  height: 44px;
  padding: 0 18px 0 44px;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: 22px 0 0 22px;
  font-size: 15px;
  outline: none;
  background: var(--input-bg);
  transition: border-color .2s, box-shadow .2s;
}
.search-box input:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(198,40,40,0.1); }
.search-box button {
  height: 44px;
  padding: 0 28px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 0 22px 22px 0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.search-box button:hover { background: var(--btn-hover); }

/* Toggle VOD List */
.toggle-vod-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 18px auto 0;
  padding: 6px 18px;
  font-size: 13px;
  color: var(--link);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.toggle-vod-btn:hover { background: var(--link); color: #fff; border-color: var(--link); }
.toggle-vod-btn .arrow { display: inline-block; transition: transform .2s; font-size: 11px; }
.toggle-vod-btn.open .arrow { transform: rotate(180deg); }

/* Danmaku Input */
.danmaku-input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  min-width: 0;
}
.danmaku-input::placeholder { color: rgba(255,255,255,0.4); }
.danmaku-input:focus { border-color: var(--link); }

.search-tags {
  max-width: 640px;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.search-tags a {
  font-size: 12px;
  color: var(--text-light);
  background: var(--border-light);
  padding: 3px 10px;
  border-radius: 12px;
  transition: all .2s;
}
.search-tags a:hover { background: var(--tag-bg); color: var(--tag-text); }

/* ===== Section ===== */
.content-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}
.section { margin-bottom: 28px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--link);
  padding-bottom: 8px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--section-title);
}
.section-more {
  font-size: 13px;
  color: var(--text-light);
}
.section-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}

/* ===== Video Card ===== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.video-card {
  background: var(--bg-white);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
  cursor: pointer;
  border: 1px solid var(--border-light);
}
.video-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  transform: translateY(-3px);
}
.video-card .poster {
  position: relative;
  width: 100%;
  padding-top: 130%;
  overflow: hidden;
  background: #e0e0e0;
}
.video-card .poster img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.video-card:hover .poster img {
  transform: scale(1.05);
}
.video-card .badge {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--score);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}
.video-card .source-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(198,40,40,0.85);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.4;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 2;
}
.video-card .ep-badge {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 12px;
  padding: 14px 8px 4px;
}
.video-card .card-delete-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}
.video-card:hover .card-delete-btn { display: flex; }
.video-card .card-delete-btn:hover { background: #e53935; transform: scale(1.15); }
#fav-page .video-card .card-delete-btn { display: flex; }
@media (max-width: 768px) {
  .video-card .card-delete-btn { display: flex; width: 22px; height: 22px; font-size: 10px; }
}
.video-card .info { padding: 10px 10px 12px; }
.video-card .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-card .meta {
  font-size: 12px;
  color: var(--text-lighter);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Search Page ===== */
.search-page-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0 12px;
}
.search-page-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-light);
  cursor: pointer;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.search-page-back:hover { background: var(--bg-grey); color: var(--text); }
.search-page-input-wrap {
  flex: 1;
  position: relative;
}
.search-page-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: #bbb;
  pointer-events: none;
}
.search-page-input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-white);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-page-input-wrap input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(198,40,40,0.1);
}
.search-page-btn {
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: 20px;
  background: var(--link);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.search-page-btn:hover { background: var(--btn-hover); }
.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}
.search-result-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.search-result-count {
  font-size: 13px;
  color: var(--text-lighter);
}
.search-grid {
  min-height: 200px;
}
#page-search .content-wrap,
#page-fav .content-wrap,
#page-settings .content-wrap {
  max-width: 100%;
  padding: 20px 24px;
}

/* ===== Category Tags ===== */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.category-tag {
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-light);
  background: var(--bg-white);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
}
.category-tag:hover { border-color: var(--link); color: var(--link); }
.category-tag.active {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
}

/* ===== Toggle Switch ===== */
.toggle { position:relative; display:inline-block; width:36px; height:20px; }
.toggle input { opacity:0; width:0; height:0; }
.toggle .slider {
  position:absolute; cursor:pointer;
  top:0;left:0;right:0;bottom:0;
  background:var(--toggle-off);
  border-radius:20px;
  transition:.3s;
}
.toggle .slider:before {
  content:""; position:absolute;
  height:16px; width:16px;
  left:2px; bottom:2px;
  background:#fff;
  border-radius:50%;
  transition:.3s;
}
.toggle input:checked + .slider { background:var(--toggle-on); }
.toggle input:checked + .slider:before { transform:translateX(16px); }

/* ===== Settings Page ===== */
.settings-section {
  background: var(--bg-white);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}
.settings-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--section-title);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.settings-row:last-child { border-bottom:none; }
.site-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.site-item .site-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-item .site-api {
  font-size: 11px;
  color: var(--text-lighter);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-item .badge-default {
  font-size: 10px;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.site-item .badge-user {
  font-size: 10px;
  background: #fff3e0;
  color: #e65100;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.config-input {
  flex: 1;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  min-width: 0;
  background: var(--input-bg);
}
.config-input:focus { border-color: var(--link); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary { background:var(--btn-bg); color:var(--btn-text); }
.btn-primary:hover { background:var(--btn-hover); }
.btn-danger { background:var(--danger); color:#fff; }
.btn-outline { background:transparent; border:1px solid var(--border); color:var(--text); }
.btn-outline:hover { background:var(--border-light); }

/* ===== Favorites / History ===== */
.fav-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 16px;
}
.fav-tab {
  padding: 8px 20px;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.fav-tab.active { color:var(--section-title); border-bottom-color:var(--section-title); font-weight:600; }
.fav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ===== Detail Page / Player ===== */
.detail-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay-bg);
  z-index: 200;
  overflow-y: auto;
}
.detail-overlay.show { display:block; }
.detail-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-back {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-title {
  font-size: 16px;
  color: #fff;
  font-weight: 600;
}
.player-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.player-wrap video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
/* Danmaku flying overlay on video */
.danmaku-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.danmaku-item {
  position: absolute;
  white-space: nowrap;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7), -1px -1px 2px rgba(0,0,0,0.7);
  right: -300px;
  animation: danmakuFly linear forwards;
  line-height: 1.4;
}
@keyframes danmakuFly {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% - 100vw - 300px)); }
}
.buffering-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 14px;
  text-align: center;
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.buffering-overlay.show { display:flex; }
.buffering-logo-wrap {
  position: relative;
  width: 52px; height: 52px;
  margin-bottom: 10px;
}
.buffering-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}
.buffering-spinner {
  width: 52px; height: 52px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.buffering-text {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1px;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Danmaku Section (between player and info) */
.danmaku-section {
  background: transparent;
  padding: 0 0 0;
  border-bottom: none;
}
.danmaku-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
}
.danmaku-bar .danmaku-input {
  border-color: rgba(0,0,0,0.15);
  background: #f5f5f5;
  color: #333;
}
.danmaku-bar .danmaku-input::placeholder { color: rgba(0,0,0,0.35); }
.danmaku-bar-top {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  width: 100%;
}
.dm-colors {
  display: flex;
  gap: 4px;
  align-items: center;
}
.dm-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s, transform .15s;
  flex-shrink: 0;
}
.dm-color-dot:hover { transform: scale(1.2); }
.dm-color-dot.active { border-color: var(--link); transform: scale(1.15); }
.detail-info {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
  margin-bottom: 16px;
  color: #ccc;
}
.detail-info h2 { color:#fff; font-size:18px; margin-bottom:8px; }
.detail-info .meta-line { font-size:13px; color:#999; margin-bottom:4px; }
.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.source-tab {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.source-tab.active { background:var(--link); color:#fff; }
.source-tab:hover { background:rgba(255,255,255,0.2); }
.episode-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.episode-btn {
  padding: 8px 4px;
  text-align: center;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.episode-btn.active { background:var(--link); color:#fff; }
.episode-btn:hover { background:rgba(255,255,255,0.15); }
.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.fav-btn.active { background:#d32f2f; color:#fff; }
#danmaku-toggle-btn.off { opacity: 0.5; }
#danmaku-toggle-btn.active { background: var(--link); color: #fff; }

/* ===== Admin Panel ===== */
.admin-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay-bg);
  z-index: 300;
  overflow-y: auto;
}
.admin-overlay.show { display:block; }
.admin-container {
  max-width: 700px;
  margin: 20px auto;
  background: var(--bg-white);
  border-radius: 8px;
  padding: 24px;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-header h2 { font-size:18px; color:var(--section-title); }
.admin-close {
  width:32px;height:32px;border:none;background:var(--border-light);
  border-radius:50%;cursor:pointer;font-size:16px;color:var(--text);
  display:flex;align-items:center;justify-content:center;
}
.admin-tabs { display:flex; gap:0; border-bottom:2px solid var(--border-light); margin-bottom:20px; }
.admin-tab {
  padding:8px 18px;font-size:14px;color:var(--text-light);
  cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s;
}
.admin-tab.active { color:var(--section-title);border-bottom-color:var(--section-title);font-weight:600; }
.form-group { margin-bottom:16px; }
.form-group label { display:block;font-size:13px;color:var(--text-light);margin-bottom:4px; }
.form-input {
  width:100%;height:38px;padding:0 12px;border:1px solid var(--input-border);
  border-radius:4px;font-size:13px;outline:none;background:var(--input-bg);
}
.form-input:focus { border-color:var(--link); }
textarea.form-input { height:80px;padding:8px 12px;resize:vertical; }
.source-list-item {
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 16px;border-bottom:1px solid var(--border-light);
  border-radius:8px;transition:background .15s;
}
.source-list-item:hover { background:var(--tag-bg); }
.source-list-item:last-child { border-bottom:none; }
.source-list-item .source-info { flex:1;min-width:0; }
.source-list-item .source-name { font-size:14px;font-weight:600;color:var(--text); }
.source-list-item .source-api { font-size:11px;color:var(--text-lighter);margin-top:2px;word-break:break-all; }
.btn-danger {
  background:var(--danger);color:#fff;border:none;padding:6px 16px;
  border-radius:6px;font-size:13px;cursor:pointer;transition:all .15s;flex-shrink:0;
}
.btn-danger:hover { background:#b71c1c;transform:scale(1.05); }
.btn-danger:active { transform:scale(.95); }

/* ===== Loading ===== */
.loading-overlay {
  display:none;position:fixed;top:0;left:0;right:0;bottom:0;
  background:var(--bg);z-index:400;
  flex-direction:column;align-items:center;justify-content:center;
}
.loading-overlay.show { display:flex; }
.loading-logo { width:64px;height:64px;animation:pulse 1.5s ease-in-out infinite; }
.loading-ring {
  width:80px;height:80px;border:3px solid var(--border-light);
  border-top-color:var(--link);border-radius:50%;
  animation:spin 1s linear infinite;margin-top:16px;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.9)} }

/* ===== Load More Loader ===== */
.load-more-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--text-light);
  font-size: 14px;
}
.load-more-loader .loading-ring {
  width: 24px;
  height: 24px;
  border-width: 2px;
  margin: 0;
}

/* ===== Toast ===== */
.toast-container { position:fixed;top:70px;right:20px;z-index:500; }
.toast {
  padding:10px 18px;border-radius:6px;font-size:13px;color:#fff;
  margin-bottom:8px;animation:fadeIn .3s;box-shadow:0 2px 8px rgba(0,0,0,0.15);
}
.toast.success { background:#2e7d32; }
.toast.error { background:#c62828; }
.toast.info { background:var(--link); }
/* ===== Confirm Dialog ===== */
.confirm-dialog-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 600;
  display: none; align-items: center; justify-content: center;
  animation: confirmFadeIn .2s ease;
}
.confirm-dialog-overlay.show { display: flex; }
.confirm-dialog {
  background: #fff; border-radius: 12px; padding: 28px 24px 20px;
  width: 320px; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: confirmSlideIn .25s ease;
}
.confirm-dialog-icon { font-size: 36px; margin-bottom: 12px; }
.confirm-dialog-title { font-size: 17px; font-weight: 600; color: #1a1a1a; margin-bottom: 8px; }
.confirm-dialog-msg { font-size: 14px; color: #666; margin-bottom: 24px; line-height: 1.5; }
.confirm-dialog-actions { display: flex; gap: 12px; }
.confirm-btn {
  flex: 1; height: 40px; border: none; border-radius: 8px; font-size: 15px;
  font-weight: 500; cursor: pointer; transition: all .15s;
}
.confirm-btn.cancel { background: #f0f0f0; color: #666; }
.confirm-btn.cancel:hover { background: #e0e0e0; }
.confirm-btn.danger { background: #e53935; color: #fff; }
.confirm-btn.danger:hover { background: #c62828; }
@keyframes confirmFadeIn { from{opacity:0} to{opacity:1} }
@keyframes confirmSlideIn { from{opacity:0;transform:scale(.9) translateY(10px)} to{opacity:1;transform:scale(1) translateY(0)} }

@keyframes fadeIn { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }

/* ===== Empty State ===== */
.empty-state {
  text-align:center;padding:60px 20px;color:var(--text-lighter);display:flex;flex-direction:column;align-items:center;justify-content:center;grid-column:1/-1;min-height:200px;
}
.empty-state .loading-ring { margin:0 auto; }
.empty-state .empty-icon { font-size:48px;margin-bottom:12px;opacity:.4; }
.empty-state p { font-size:14px; }

/* ===== Infinite scroll sentinel ===== */
.scroll-sentinel { height:1px; }

/* ===== Page visibility ===== */
.page { display:none; }
.page.active { display:block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .video-grid, .fav-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .episode-grid { grid-template-columns: repeat(4, 1fr); }
  .search-hero { padding: 32px 16px 24px; }
  .search-hero .hero-logo img { height: 56px; }
  .search-hero .hero-title { font-size: 22px; }
  .content-wrap { padding: 12px; }
  .site-header { padding: 0 12px; height: 54px; }
  .site-logo img { width: 40px; height: 40px; }
  .logo-text { font-size: 18px; }
  .nav-links a { padding: 6px 8px; font-size: 13px; }
  .admin-container { margin: 10px; padding: 16px; }
  .detail-container { padding: 10px; }
  .settings-section { padding: 14px; }
  .video-card .info { padding: 6px 6px 8px; }
  .video-card .title { font-size: 12px; }
  .video-card .meta { font-size: 10px; }
}
@media (max-width: 480px) {
  .video-grid, .fav-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .episode-grid { grid-template-columns: repeat(3, 1fr); }
  .search-hero .hero-logo img { height: 48px; }
  .site-header { padding: 0 10px; height: 50px; }
  .site-logo img { width: 34px; height: 34px; }
  .logo-text { font-size: 16px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 6px; font-size: 12px; }
  .category-bar { gap: 4px; }
  .category-tag { padding: 3px 8px; font-size: 11px; }
  .admin-link { font-size: 11px; }
}
@media (min-width: 1200px) {
  .video-grid, .fav-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===== Detail Info with Image ===== */
.detail-info-top {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}
.detail-pic {
  width: 120px;
  flex-shrink: 0;
}
.detail-pic img {
  width: 120px;
  height: auto;
  border-radius: 6px;
  object-fit: cover;
  max-height: 170px;
}
.detail-info-text {
  flex: 1;
  min-width: 0;
}
.detail-info-text h2 { color:#fff; font-size:18px; margin-bottom:8px; }

/* ===== Other Sources Section ===== */
.other-sources-section {
  margin-top: 20px;
  margin-bottom: 16px;
}
.other-sources-title {
  font-size: 15px;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.other-sources-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.other-source-card {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.other-source-card:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}
.other-poster {
  position: relative;
  width: 100%;
  padding-top: 130%;
  overflow: hidden;
  background: #222;
}
.other-poster img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.other-poster .source-badge {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(198,40,40,0.85);
  color: #fff;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1.3;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 2;
}
.other-poster .ep-badge {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 11px;
  padding: 12px 6px 3px;
}
.other-info { padding: 6px 8px 8px; }
.other-title {
  font-size: 12px;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Source Status Indicator ===== */
.source-status {
  display: inline-block;
  font-size: 10px;
  margin-right: 4px;
  line-height: 1;
}
.source-status-checking { color: #ffc107; }
.source-status-ok { color: #4caf50; }
.source-status-warn { color: #ff9800; }
.source-status-error { color: #f44336; }

/* ===== Admin Page Wrap ===== */
.admin-page-wrap {
  max-width: 100%;
  padding: 20px;
}

/* ===== Responsive for Other Sources ===== */
@media (max-width: 768px) {
  .other-sources-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .detail-info-top { flex-direction: column; align-items: center; text-align: center; }
  .detail-pic { width: 100px; }
  .detail-pic img { width: 100px; height: 140px; }
}
@media (max-width: 480px) {
  .other-sources-grid { grid-template-columns: repeat(2, 1fr); }
}
