/* 影视站群模版 - 公共样式 */
:root {
  --bg: #0f1117;
  --bg-card: #1a1d26;
  --bg-hover: #242833;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --accent: #e50914;
  --accent-hover: #f40612;
  --border: #2d323c;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,.35);
  --header-h: 56px;
  --max-w: 1280px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: var(--safe-bottom);
}

body.drawer-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }

/* 头部 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,17,23,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .25s;
}
.site-header.is-scrolled { box-shadow: 0 4px 24px rgba(0,0,0,.4); }

.header-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.menu-toggle {
  order: 1;
  flex-shrink: 0;
}

.header-search {
  order: 2;
  flex: 1;
  min-width: 0;
  max-width: none;
}

.header-inner {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 12px;
}

.logo { flex-shrink: 0; }
.logo img { height: 36px; width: auto; }

.main-nav { display: none; }
.main-nav ul { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-muted);
  transition: background .2s, color .2s;
}
.main-nav a:hover,
.main-nav a.active { color: var(--text); background: var(--bg-hover); }

.search-form { display: flex; }
.search-form input {
  flex: 1;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form button {
  min-height: 44px;
  min-width: 64px;
  padding: 10px 16px;
  background: var(--accent);
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.search-form button:hover { background: var(--accent-hover); }

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  margin-right: 0;
}
.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform .25s, opacity .25s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 移动端侧栏 */
.mobile-drawer {
  visibility: hidden;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .25s, visibility .25s;
}
.mobile-drawer.open {
  visibility: visible;
  opacity: 1;
}
.drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--bg-card);
  padding: 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .28s ease;
  -webkit-overflow-scrolling: touch;
}
.mobile-drawer.open .drawer-panel { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 16px;
}
.drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-hover);
  border-radius: 50%;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.drawer-body { padding: 8px 20px 24px; }
.drawer-body h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 20px 0 8px;
}
.drawer-body a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  min-height: 44px;
  line-height: 20px;
}

/* 返回顶部 */
.back-top {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 80;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s;
}
.back-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-top:hover { background: var(--accent-hover); }

/* 面包屑 */
.breadcrumb {
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; opacity: .6; }
.breadcrumb strong { color: var(--text); font-weight: 500; }

/* 区块标题 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}
.section-head h2,
.section-head h3 { font-size: 17px; font-weight: 600; }
.section-head .more {
  font-size: 13px;
  color: var(--accent);
  padding: 6px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* 视频网格 */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
@media (hover: hover) {
  .video-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
  }
  .video-card:hover .play-icon { opacity: 1; }
}
.video-card:active { transform: scale(.98); }

.video-card .thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #1e2229;
}
.video-card .thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1e2229 0%, #2a2f3a 50%, #1e2229 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  z-index: 0;
  opacity: 0;
  transition: opacity .2s;
}
.video-card .thumb.is-loading::before { opacity: 1; }
.video-card .thumb.is-loaded::before { opacity: 0; animation: none; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.video-card .thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s;
}
.video-card .thumb.is-loaded img,
.video-card .thumb img[src]:not([src=""]) { opacity: 1; }

.video-card .thumb.is-error::after {
  content: "暂无封面";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  background: #1e2229;
}

.video-card .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.video-card .play-icon {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.video-card .play-icon::after {
  content: "";
  width: 44px;
  height: 44px;
  background: rgba(229,9,20,.9);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 55% center;
  background-size: 22px;
}

.video-card .info { padding: 10px 12px 12px; }
.video-card h2,
.video-card h3,
.video-card h4 {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.video-card .card-summary {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 首页 */
.page-main { padding: 12px 0 24px; }

.hero-banner {
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #1a1d26 0%, #3a1f28 50%, #1a2530 100%);
  padding: 28px 20px;
}
.hero-banner h1 {
  font-size: 20px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.hero-banner p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions a {
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.hero-actions .btn-primary {
  background: var(--accent);
  color: #fff;
}
.hero-actions .btn-primary:hover { background: var(--accent-hover); color: #fff; }
.hero-actions .btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
}
.hero-actions .btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.category-scroll {
  margin: 0 -16px 20px;
  padding: 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }

.category-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: max-content;
  padding-bottom: 4px;
}
.category-tags a {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color .2s, background .2s;
}
.category-tags a:hover,
.category-tags a:active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(229,9,20,.08);
}

.section-block { margin-bottom: 28px; scroll-margin-top: calc(var(--header-h) + 12px); }

/* 列表页 */
.list-page-title { margin-bottom: 16px; }
.list-page-title h1 { font-size: 20px; margin-bottom: 6px; line-height: 1.35; }
.list-page-title p { color: var(--text-muted); font-size: 14px; }

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.pagination a {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color .2s, background .2s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination a:active { background: var(--bg-hover); }

/* 详情页 */
.detail-layout { display: grid; gap: 20px; }

.detail-player {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
  cursor: pointer;
}
.detail-player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .7;
}
.detail-player .player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,.45);
  transition: background .2s;
}
.detail-player:hover .player-overlay { background: rgba(0,0,0,.55); }
.player-overlay .play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(229,9,20,.5);
}
.player-overlay .play-btn::after {
  content: "";
  width: 0;
  height: 0;
  border: 12px solid transparent;
  border-left: 20px solid #fff;
  margin-left: 5px;
}
.player-overlay span { font-size: 14px; color: #fff; }

.detail-info { margin-top: 4px; }
.detail-info h1 {
  font-size: 20px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.detail-chips span {
  padding: 6px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.detail-chips strong { color: var(--text); font-weight: 500; }

.detail-meta {
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-meta .row { line-height: 1.6; }
.detail-meta strong { color: var(--text); margin-right: 4px; }

.play-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.play-sources a,
.play-sources span {
  padding: 10px 18px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
}
.play-sources a:hover,
.play-sources a.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(229,9,20,.1);
}
.play-sources a.active { font-weight: 600; }

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.detail-tags a {
  padding: 6px 14px;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.detail-tags a:hover { border-color: var(--accent); color: var(--accent); }

.article-body {
  font-size: 15px;
  line-height: 1.85;
  color: #c4c7cc;
}
.article-body p { margin-bottom: 14px; }
.article-body img { border-radius: var(--radius); margin: 12px 0; }
.article-body video { border-radius: var(--radius); width: 100%; }

.article-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 0;
  margin-bottom: 8px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.article-toggle::after {
  content: "▼";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .2s;
}
.article-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }

.article-collapse { overflow: hidden; }
.article-collapse.is-collapsed {
  max-height: 120px;
  position: relative;
}
.article-collapse.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

/* 友情链接 */
.friend-links {
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.friend-links h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }
.friend-links .links { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; }
.friend-links a {
  color: var(--text-muted);
  padding: 4px 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

/* 页脚 */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 28px 0 20px;
  margin-top: 24px;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
  font-size: 14px;
}
.footer-nav a {
  color: var(--text-muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.copyright { font-size: 12px; color: var(--text-muted); line-height: 1.85; }

/* 侧栏 */
.sidebar-block {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar-block h3 {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.rank-list li { margin-bottom: 4px; }
.rank-list a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  padding: 8px 4px;
  border-radius: 6px;
  min-height: 44px;
  transition: background .2s;
}
.rank-list a:hover { background: var(--bg-hover); }
.rank-list .num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--bg-hover);
  border-radius: 4px;
  text-align: center;
  line-height: 22px;
  font-size: 12px;
  color: var(--text-muted);
}
.rank-list li:nth-child(-n+3) .num { background: var(--accent); color: #fff; }
.rank-list .title {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
}
.skip-link:focus { left: 0; }

/* 响应式 */
@media (min-width: 768px) {
  .back-top { bottom: 24px; }
  .header-wrap {
    flex-wrap: nowrap;
    gap: 16px;
    height: var(--header-h);
    padding: 0;
  }
  .menu-toggle { display: none; }
  .header-search {
    order: 3;
    flex: 0 1 320px;
  }
  .header-inner {
    order: 1;
    flex: 1;
    width: auto;
    justify-content: flex-start;
    min-width: 0;
  }
  .main-nav { display: block; margin-left: auto; }
  .video-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .hero-banner { padding: 40px 32px; }
  .hero-banner h1 { font-size: 26px; }
  .category-scroll { margin: 0 0 24px; padding: 0; overflow: visible; }
  .category-tags { flex-wrap: wrap; width: auto; }
  .detail-layout { grid-template-columns: 1fr 280px; }
  .detail-layout .detail-side { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
  .article-collapse.is-collapsed { max-height: none; }
  .article-collapse.is-collapsed::after { display: none; }
  .article-toggle { display: none; }
}

@media (min-width: 1024px) {
  .video-grid { grid-template-columns: repeat(6, 1fr); }
  .list-page .video-grid { grid-template-columns: repeat(5, 1fr); }
  .header-inner { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
