/* Modern Template Base Framework — shared across all 20 templates */
/* 统一现代模板框架：响应式、CSS 变量主题、无依赖 */

:root {
  --tpl-font: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --tpl-font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  --tpl-max-width: 1280px;
  --tpl-gap: 24px;
  --tpl-radius: 12px;
  --tpl-radius-sm: 8px;
  --tpl-header-height: 64px;
  --tpl-nav-height: 48px;
  --tpl-card-ratio: 56.25%; /* 16:9 */

  /* Default dark theme (overridden per template) */
  --tpl-bg: #0f0f13;
  --tpl-bg-elevated: #16161d;
  --tpl-surface: #1e1e27;
  --tpl-surface-2: #2a2a36;
  --tpl-text: #f1f1f7;
  --tpl-text-muted: #9ca3af;
  --tpl-text-inverse: #0f0f13;
  --tpl-primary: #6366f1;
  --tpl-primary-hover: #818cf8;
  --tpl-secondary: #ec4899;
  --tpl-accent: #a855f7;
  --tpl-border: rgba(255, 255, 255, 0.08);
  --tpl-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --tpl-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --tpl-glow: 0 0 30px rgba(99, 102, 241, 0.15);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--tpl-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tpl-text);
  background: var(--tpl-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s, opacity .2s; }
a:hover { color: var(--tpl-primary-hover); }

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

@media (min-width: 768px) {
  .container { padding: 0 24px; }
}

/* Utility */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--tpl-header-height);
  background: rgba(var(--tpl-bg-rgb, 15,15,19), 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tpl-border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; gap: 16px;
}

.brand {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}

.brand-logo {
  height: 38px; width: auto; object-fit: contain;
}

.brand-text {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--tpl-primary), var(--tpl-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex; align-items: center; gap: 10px;
}

/* Search */
.header-search {
  flex: 1; max-width: 420px;
}

.header-search-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 4px;
  border: 1px solid var(--tpl-border); border-radius: 999px;
  background: var(--tpl-surface);
  transition: border-color .2s, box-shadow .2s;
}

.header-search-bar:focus-within {
  border-color: var(--tpl-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.header-search-bar .search-type {
  flex-shrink: 0;
  height: 32px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--tpl-surface-2); color: var(--tpl-text); cursor: pointer; font-size: 12px;
}

.header-search-bar input {
  flex: 1; min-width: 0;
  height: 32px; padding: 0 8px;
  border: 0; border-radius: 0;
  background: transparent; color: var(--tpl-text);
  font-size: 14px; outline: none;
}

.header-search-bar button[type="submit"] {
  flex-shrink: 0;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--tpl-primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.header-search-bar button[type="submit"]:hover { opacity: .9; }

.mobile-menu-toggle {
  display: none; width: 40px; height: 40px; border: 0; border-radius: var(--tpl-radius-sm);
  background: var(--tpl-surface); color: var(--tpl-text); cursor: pointer;
}

/* Navigation */
.site-nav {
  background: var(--tpl-bg-elevated);
  border-bottom: 1px solid var(--tpl-border);
  overflow-x: auto; scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.nav-inner {
  display: flex; align-items: center; gap: 6px; min-height: var(--tpl-nav-height);
}

.nav-group {
  display: flex; align-items: center; gap: 4px;
  padding-right: 14px; margin-right: 14px;
  border-right: 1px solid var(--tpl-border);
}
.nav-group:last-child { border-right: 0; }

.nav-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--tpl-text-muted); padding: 0 6px; white-space: nowrap;
}

.nav-link {
  padding: 6px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  color: var(--tpl-text-muted); transition: .2s;
}
.nav-link:hover,
.nav-link.active {
  color: var(--tpl-text); background: var(--tpl-surface);
}

/* Hero / search area */
.hero {
  padding: 48px 0; text-align: center; background:
    radial-gradient(ellipse at top, rgba(99,102,241,0.12), transparent 60%),
    var(--tpl-bg-elevated);
  border-bottom: 1px solid var(--tpl-border);
}

.hero h1 {
  font-size: 32px; font-weight: 800; margin: 0 0 12px; line-height: 1.2;
}

.hero p { color: var(--tpl-text-muted); margin: 0 0 24px; }

.hero-search {
  max-width: 640px; margin: 0 auto;
}

.hero-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px;
  border: 1px solid var(--tpl-border); border-radius: 999px;
  background: var(--tpl-surface);
  transition: border-color .2s, box-shadow .2s;
}

.hero-search-bar:focus-within {
  border-color: var(--tpl-primary); box-shadow: var(--tpl-glow);
}

.hero-search-bar .search-type {
  flex-shrink: 0;
  height: 42px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--tpl-surface-2); color: var(--tpl-text); cursor: pointer; font-size: 13px;
}

.hero-search-bar input {
  flex: 1; min-width: 0;
  height: 42px; padding: 0 12px;
  border: 0; border-radius: 0;
  background: transparent; color: var(--tpl-text);
  font-size: 16px; outline: none;
}

.hero-search-bar button[type="submit"] {
  flex-shrink: 0;
  height: 42px; padding: 0 28px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--tpl-primary), var(--tpl-accent));
  color: #fff; font-weight: 600; cursor: pointer; transition: opacity .2s;
}
.hero-search-bar button[type="submit"]:hover { opacity: .9; }

.hot-tags {
  margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}

.hot-tags a {
  padding: 5px 12px; border-radius: 999px; font-size: 13px;
  background: var(--tpl-surface); border: 1px solid var(--tpl-border);
  color: var(--tpl-text-muted);
}
.hot-tags a:hover { border-color: var(--tpl-primary); color: var(--tpl-primary-hover); }

/* Main layout */
.site-main { padding: 24px 0 48px; min-height: 50vh; }

/* Section */
.section {
  margin-bottom: 36px;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 16px;
}

.section-title {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-size: 20px; font-weight: 700;
}

.section-title::before {
  content: ''; width: 4px; height: 22px; border-radius: 2px;
  background: linear-gradient(180deg, var(--tpl-primary), var(--tpl-secondary));
}

.section-more {
  font-size: 14px; color: var(--tpl-text-muted); display: inline-flex; align-items: center; gap: 4px;
}
.section-more:hover { color: var(--tpl-primary-hover); }

/* Grid */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.grid.list-page { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px)  { .grid.list-page { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid.list-page { grid-template-columns: repeat(4, 1fr); } }

/* Card */
.card {
  background: var(--tpl-surface);
  border: 1px solid var(--tpl-border);
  border-radius: var(--tpl-radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--tpl-shadow);
  border-color: rgba(99, 102, 241, 0.25);
}

.card-media {
  position: relative; padding-top: var(--tpl-card-ratio); overflow: hidden;
  background: var(--tpl-surface-2);
}

.card-media img,
.card-media .thumb {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s;
}

.card:hover .card-media img { transform: scale(1.05); }

.card-body {
  padding: 12px;
}

.card-title {
  margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--tpl-text);
}

.card-title a:hover { color: var(--tpl-primary-hover); }

.card-meta {
  margin-top: 8px; font-size: 12px; color: var(--tpl-text-muted);
  display: flex; gap: 12px;
}

/* Player */
.player-section { margin-bottom: 24px; }

.page-title {
  font-size: 22px; font-weight: 700; line-height: 1.3; margin: 0 0 16px;
}

/* Detail */
.detail-meta {
  background: var(--tpl-surface); border: 1px solid var(--tpl-border);
  border-radius: var(--tpl-radius); padding: 18px; margin-bottom: 24px;
}

.detail-meta p { margin: 6px 0; color: var(--tpl-text-muted); font-size: 14px; }
.detail-meta strong { color: var(--tpl-text); margin-right: 6px; }

/* Torrent actions */
.action-list {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--tpl-radius-sm); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: .2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--tpl-primary), var(--tpl-accent));
  color: #fff;
}
.btn-primary:hover { opacity: .9; color: #fff; }

.btn-secondary {
  background: var(--tpl-surface-2); color: var(--tpl-text); border-color: var(--tpl-border);
}
.btn-secondary:hover { border-color: var(--tpl-primary); color: var(--tpl-primary-hover); }

/* Pagination */
.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin-top: 32px;
}

.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--tpl-radius-sm); font-size: 14px;
  background: var(--tpl-surface); border: 1px solid var(--tpl-border);
  color: var(--tpl-text-muted);
}

.pagination a:hover { border-color: var(--tpl-primary); color: var(--tpl-primary-hover); }
.pagination .current {
  background: var(--tpl-primary); border-color: var(--tpl-primary); color: #fff; font-weight: 700;
}

/* Footer */
.site-footer {
  background: var(--tpl-bg-elevated); border-top: 1px solid var(--tpl-border);
  padding: 32px 0 24px; color: var(--tpl-text-muted); font-size: 13px;
}

.footer-inner {
  display: flex; flex-direction: column; gap: 16px;
}

.footer-links {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
}

.footer-links a { color: var(--tpl-text-muted); }
.footer-links a:hover { color: var(--tpl-primary-hover); }

.footer-copy {
  text-align: center; color: var(--tpl-text-muted); opacity: .7;
}

/* Ads */
.ad-banner {
  max-width: var(--tpl-max-width); margin: 16px auto; padding: 0 16px;
  text-align: center;
}
.ad-banner img { max-width: 100%; height: auto; border-radius: var(--tpl-radius-sm); }

.ad-float {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%);
  z-index: 9998; max-width: 96vw; border-radius: var(--tpl-radius);
  box-shadow: var(--tpl-shadow); overflow: hidden;
}
.ad-float .close {
  position: absolute; top: 4px; right: 6px; width: 22px; height: 22px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; font-size: 14px;
  line-height: 22px; text-align: center; cursor: pointer; z-index: 1;
}

/* Responsive */
@media (max-width: 767px) {
  .site-header { height: auto; position: sticky; top: 0; }
  .header-inner { flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .brand { order: 1; max-width: calc(100% - 50px); min-width: 0; }
  .brand-text { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-menu-toggle { order: 2; display: flex; align-items: center; justify-content: center; }
  .header-search { order: 3; max-width: 100%; flex-basis: 100%; }
  .header-search-bar { gap: 4px; padding: 3px; }
  .header-search-bar .search-type { height: 30px; padding: 0 8px; font-size: 11px; }
  .header-search-bar input { height: 30px; font-size: 13px; }
  .header-search-bar button[type="submit"] { width: 30px; height: 30px; }

  .site-nav {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0;
    transform: translateY(100%); transition: transform .25s; z-index: 99;
    max-height: 80vh; border-radius: 16px 16px 0 0; pointer-events: none;
  }
  .site-nav.open { transform: translateY(0); pointer-events: auto; }
  .nav-inner { flex-direction: column; align-items: flex-start; padding: 20px 16px 28px; gap: 16px; }
  .nav-group { flex-direction: column; align-items: flex-start; border-right: 0; border-bottom: 1px solid var(--tpl-border); padding-bottom: 12px; width: 100%; }
  .nav-label { margin-bottom: 4px; }

  .hero { padding: 28px 0; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .hero-search-bar { padding: 4px; gap: 4px; }
  .hero-search-bar .search-type { padding: 0 8px; height: 38px; font-size: 12px; }
  .hero-search-bar input { padding: 0 6px; height: 38px; font-size: 14px; }
  .hero-search-bar button[type="submit"] { padding: 0 14px; height: 38px; font-size: 13px; }

  .site-main { padding: 16px 0 32px; }
  .section { margin-bottom: 20px; }
  .section-header { margin-bottom: 12px; }
  .section-title { font-size: 16px; }
  .grid { gap: 10px; }

  .page-title { font-size: 18px; }
  .detail-meta { padding: 12px; }
  .btn { padding: 8px 14px; font-size: 13px; }

  .pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 8px; font-size: 13px; }

  .site-footer { padding: 20px 0; font-size: 12px; }
  .footer-links { gap: 6px 12px; }
}

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
