/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1216;
  --bg-card: #1a1f26;
  --bg-hover: #222932;
  --text: #e6e9ee;
  --text-dim: #9aa4b0;
  --accent: #e05260;
  --accent-2: #4c8dff;
  --border: #2a313b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }

/* ===== 头部 ===== */
.site-header, .admin-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 18, 22, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.logo { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.logo:hover { text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  color: var(--text-dim); padding: 6px 14px; border-radius: 999px;
  font-size: 14px; transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--text); text-decoration: none; background: var(--bg-hover); }
.tabs a.active { color: #fff; background: var(--accent); }
.search-form { margin-left: auto; display: flex; gap: 8px; flex: 0 1 320px; min-width: 180px; }
.search-form input {
  flex: 1; min-width: 0; padding: 8px 12px; font-size: 14px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.search-form input:focus { border-color: var(--accent-2); }
.search-form button, .btn {
  padding: 8px 16px; font-size: 14px; cursor: pointer;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  white-space: nowrap;
}
.search-form button:hover, .btn:hover { filter: brightness(1.1); }
.admin-user { margin-left: auto; font-size: 14px; color: var(--text-dim); }
.admin-user a { margin-left: 8px; }

/* ===== 卡片网格 ===== */
.page-title { font-size: 20px; margin-bottom: 16px; }
.page-title .total { font-size: 13px; font-weight: 400; color: var(--text-dim); margin-left: 8px; }
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-items: start;
}
.card {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  display: block;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0, 0, 0, .45); text-decoration: none; }
.card-cover { position: relative; aspect-ratio: 3 / 4; background: #11151a; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
/* 横版封面（JS 检测后加 .ls）：横着完整展示 */
.card-cover.ls { aspect-ratio: 3 / 2; }
.card-cover.ls img { object-fit: contain; }
.badge {
  position: absolute; top: 8px; right: 8px; padding: 2px 8px;
  font-size: 12px; border-radius: 6px; color: #fff;
}
.badge-uncen { background: rgba(224, 82, 96, .9); }
.detail-code .badge-uncen { position: static; font-size: 13px; vertical-align: middle; }
.card-body { padding: 10px 12px 12px; }
.card-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-code { font-weight: 700; font-size: 14px; color: var(--accent-2); }
.card-date { font-size: 12px; color: var(--text-dim); }
.card-title {
  margin-top: 4px; font-size: 13px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4; min-height: 2.8em;
}
.empty { color: var(--text-dim); padding: 32px 0; text-align: center; }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; text-align: center; padding: 7px 12px; font-size: 14px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
.page-btn:hover { background: var(--bg-hover); text-decoration: none; }
.page-btn.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== 详情页 ===== */
.detail { display: flex; gap: 28px; align-items: flex-start; }
.detail-cover { flex: 0 0 58%; max-width: 720px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.detail-cover img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: #11151a; }
.detail-info { flex: 1; min-width: 0; }
.detail-code { font-size: 26px; color: var(--accent-2); }
.detail-title { font-size: 16px; font-weight: 500; color: var(--text); margin: 8px 0 16px; }
.info-list { display: grid; grid-template-columns: 84px 1fr; row-gap: 8px; font-size: 14px; }
.info-list dt { color: var(--text-dim); }
.info-list dd { min-width: 0; word-break: break-all; }
.tag {
  display: inline-block; margin: 0 6px 6px 0; padding: 3px 10px;
  font-size: 13px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
}
.tag:hover { border-color: var(--accent-2); text-decoration: none; }
.tag-star { color: var(--accent); }
.section-title { font-size: 18px; margin: 32px 0 14px; }
.sample-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.sample { border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.sample img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform .2s; }
.sample:hover img { transform: scale(1.04); }

/* ===== 磁链 ===== */
.magnet-list { display: flex; flex-direction: column; gap: 10px; }
.magnet-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.magnet-main { flex: 1; min-width: 0; }
.magnet-name {
  font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.magnet-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); margin-top: 2px; flex-wrap: wrap; }
.copy-btn {
  flex-shrink: 0; padding: 7px 16px; font-size: 13px; cursor: pointer;
  background: var(--accent-2); color: #fff; border: none; border-radius: 8px;
}
.copy-btn:hover { filter: brightness(1.1); }
.copy-btn.copied { background: #2ea36b; }

/* ===== 页脚 ===== */
.site-footer {
  text-align: center; padding: 24px; font-size: 13px;
  color: var(--text-dim); border-top: 1px solid var(--border);
}

/* ===== 后台 ===== */
.admin-body { background: #14181d; }
.admin-container { max-width: 1100px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: rgba(46, 163, 107, .15); color: #57d997; border: 1px solid rgba(46, 163, 107, .4); }
.flash-err { background: rgba(224, 82, 96, .12); color: #ff8f9a; border: 1px solid rgba(224, 82, 96, .4); }
.stat-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 26px; font-weight: 800; color: var(--accent-2); }
.stat-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.admin-panels { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.panel-wide { grid-column: 1 / -1; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.btn-warn { background: #c98a1b; }
.btn-primary { background: var(--accent-2); }
.btn-danger { background: var(--accent); }
.btn-small { padding: 5px 12px; font-size: 13px; display: inline-block; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-toolbar .page-title { margin-bottom: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-dim); font-weight: 600; font-size: 13px; }
.admin-table .empty { text-align: center; padding: 24px; }
.cell-title { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { white-space: nowrap; }
.cell-actions form { display: inline; }
.err-text { color: #ff8f9a; word-break: break-all; }
.admin-movie-summary {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; font-size: 14px; margin-bottom: 12px;
}
.magnet-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.magnet-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim); }
.magnet-form label.full { grid-column: 1 / -1; }
.magnet-form input {
  padding: 8px 12px; font-size: 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.magnet-form input:focus { border-color: var(--accent-2); }
.magnet-form .btn { justify-self: start; }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 32px 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.login-card h1 { font-size: 20px; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.login-card input {
  padding: 10px 12px; font-size: 15px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.login-card input:focus { border-color: var(--accent-2); }

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .header-inner { gap: 10px; }
  .search-form { order: 3; flex: 1 1 100%; margin-left: 0; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail { flex-direction: column; }
  .detail-cover { flex: none; width: 100%; max-width: 100%; margin: 0 auto; }
  .sample-grid { grid-template-columns: repeat(2, 1fr); }
  .cell-title { max-width: 140px; }
  .admin-table { font-size: 13px; }
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
}

/* ===== 广告 ===== */
.ad-wrap:empty { display: none; }
.ad-box {
  position: relative; margin: 14px auto; max-width: 900px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow);
  text-align: center; overflow: hidden;
}
.ad-box img { max-width: 100%; height: auto; margin: 0 auto; border-radius: 6px; }
.ad-flag {
  position: absolute; top: 4px; left: 4px; z-index: 2;
  padding: 1px 7px; font-size: 11px; line-height: 1.6;
  color: var(--text-dim); background: rgba(15, 18, 22, .75);
  border: 1px solid var(--border); border-radius: 5px;
}
.ad-card { position: relative; display: block; overflow: hidden; }
.ad-card img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 4; }
.ad-card .ad-flag { top: 8px; left: 8px; }

/* ===== 后台：广告 ===== */
.slot-tag {
  display: inline-block; padding: 2px 8px; font-size: 12px;
  border-radius: 6px; background: var(--bg); border: 1px solid var(--border);
  color: var(--accent-2);
}
.ad-preview img { max-width: 90px; max-height: 60px; border-radius: 6px; }
.ad-html-flag { font-size: 12px; color: var(--text-dim); }
.ad-form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.ad-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.ad-form input[type="text"], .ad-form input[type="number"], .ad-form select, .ad-form textarea {
  padding: 8px 12px; font-size: 14px; font-family: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.ad-form input:focus, .ad-form select:focus, .ad-form textarea:focus { border-color: var(--accent-2); }
.ad-form textarea { resize: vertical; font-family: ui-monospace, monospace; }
.ad-kind-row { display: flex; align-items: center; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.ad-kind-row > span { color: var(--text-dim); font-size: 13px; }
.ad-kind-row .radio { display: flex; align-items: center; gap: 6px; flex-direction: row; color: var(--text); }
.ad-current-img img { max-width: 220px; border-radius: 8px; border: 1px solid var(--border); }

/* ===== 后台：统计柱状图 ===== */
.bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 12px 4px 4px; overflow-x: auto;
}
.bar-col { flex: 1; min-width: 26px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-num { font-size: 11px; color: var(--text-dim); }
.bar-stack { display: flex; align-items: flex-end; gap: 2px; height: 140px; }
.bar { width: 12px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-pv { background: var(--accent-2); }
.bar-uv { background: #2ea36b; }
.bar-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.chart-legend { font-size: 12px; color: var(--text-dim); margin: 6px 0 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 5px 0 12px; vertical-align: -1px; }
.dot-pv { background: var(--accent-2); }
.dot-uv { background: #2ea36b; }
.stat-num a { color: inherit; text-decoration: none; }
.stat-num a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .ad-box { margin: 10px 0; }
  .bar { width: 9px; }
  .bar-col { min-width: 20px; }
}
.ad-wrap.container { padding-top: 0; padding-bottom: 0; }

/* ===== 广告：关闭按钮 ===== */
.ad-close {
  position: absolute; top: 4px; right: 4px; z-index: 3;
  min-width: 28px; min-height: 28px; padding: 0 6px;
  border: none; border-radius: 7px; cursor: pointer;
  background: rgba(0, 0, 0, .45); color: #fff;
  font-size: 17px; line-height: 1;
}
.ad-close:hover { background: rgba(0, 0, 0, .7); }
.ad-card { position: relative; }

/* ===== 广告：飘带 / 竖条（仅 PC） ===== */
.ad-overlay[hidden], .ad-popup-mask[hidden] { display: none !important; }
.ad-overlay {
  position: fixed; z-index: 2000;
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden;
}
.ad-overlay img { max-width: 100%; height: auto; display: block; }
.ad-float-top {
  top: 0; left: 0; right: 0;
  display: flex; justify-content: center;
  border-left: none; border-right: none; border-top: none;
}
.ad-float-top img, .ad-float-bottom img { max-height: 90px; width: auto; }
.ad-float-bottom {
  bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center;
  border-left: none; border-right: none; border-bottom: none;
}
.ad-rail-left, .ad-rail-right {
  top: 28%; width: 140px; z-index: 1000; border-radius: var(--radius);
}
.ad-rail-left { left: calc(50% - 720px); }
.ad-rail-right { right: calc(50% - 720px); }

/* ===== 广告：弹窗 ===== */
.ad-popup-mask {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(0, 0, 0, .65);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s ease;
}
.ad-popup-mask.show { opacity: 1; }
.ad-popup-card {
  position: relative; max-width: min(400px, 88vw); max-height: 85vh;
  overflow: auto; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.ad-popup-card img { max-width: 100%; height: auto; border-radius: 8px; }
.ad-popup-card .ad-close { top: 6px; right: 6px; }

/* 端限制：竖条仅 PC 宽屏（≥1400px）；飘带 PC+H5 都显示，移动端收窄 */
@media (max-width: 1399px) {
  .ad-rail-left, .ad-rail-right { display: none !important; }
}
@media (max-width: 768px) {
  .ad-float-top img, .ad-float-bottom img { max-height: 54px; }
}

/* ===== 404 ===== */
.not-found { text-align: center; padding: 64px 16px; }
.not-found h1 { font-size: 64px; color: var(--accent); margin-bottom: 8px; }
.not-found p { color: var(--text-dim); margin-bottom: 20px; }
.not-found .search-form { max-width: 420px; margin: 0 auto 20px; }
.not-found .btn { display: inline-block; }

/* ===== 商店 ===== */
.kefu-banner {
  background: rgba(76, 141, 255, .12); border: 1px solid rgba(76, 141, 255, .4);
  color: var(--accent-2); border-radius: var(--radius);
  padding: 10px 16px; font-size: 14px; margin-bottom: 18px;
}
.product-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.product-name { font-size: 17px; }
.product-descr { font-size: 13px; color: var(--text-dim); flex: 1; white-space: pre-wrap; }
.product-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-dim); }
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.product-price { font-size: 22px; font-weight: 800; color: var(--accent); }
.pay-card {
  max-width: 560px; margin: 24px auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.pay-amount { font-size: 22px; font-weight: 800; color: var(--accent); }
.pay-section { margin-top: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pay-btn { min-width: 140px; text-align: center; }
.pay-note { width: 100%; font-size: 13px; color: var(--text-dim); }
.pay-ok { color: #57d997; }
.kefu-line { margin-top: 18px; font-size: 13px; color: var(--text-dim); }
.dl-error { color: #ff8f9a; font-size: 15px; }

/* ===== 会员 ===== */
.vip-link { color: #f0c040 !important; font-weight: 600; }
.product-vip { border-color: rgba(240, 192, 64, .4); }
.renew-box { font-size: 13px; color: var(--text-dim); }
.renew-box summary { cursor: pointer; padding: 4px 0; }
.renew-box input {
  margin-top: 8px; width: 100%; padding: 8px 12px; font-size: 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.renew-box input:focus { border-color: var(--accent-2); }
.member-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px; letter-spacing: 1px; color: #f0c040;
  background: var(--bg); padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border);
}
.member-code-row { display: flex; align-items: center; gap: 10px; }
.member-warn { color: #ff8f9a; font-size: 14px; font-weight: 600; width: 100%; }
.vip-activate-form { display: flex; gap: 10px; }
.vip-activate-form input {
  flex: 1; padding: 10px 12px; font-size: 15px;
  font-family: ui-monospace, Menlo, monospace;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.vip-activate-form input:focus { border-color: var(--accent-2); }
.vip-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 5000; max-width: min(440px, 92vw);
}
.vip-toast[hidden] { display: none !important; }
.vip-toast-body {
  background: var(--bg-card); border: 1px solid var(--accent-2);
  border-radius: 12px; padding: 14px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  font-size: 14px; display: flex; flex-direction: column; gap: 8px;
}
.vip-toast-body button {
  align-self: flex-end; background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 12px; padding: 4px;
}
.vip-toast-body button:hover { color: var(--text); }

/* ===== 相册灯箱 ===== */
.img-lightbox { position: fixed; inset: 0; z-index: 9995; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; }
.img-lightbox .lb-body { position: relative; max-width: 92vw; max-height: 92vh; }
.img-lightbox .lb-body img { max-width: 92vw; max-height: 92vh; display: block; border-radius: 8px; }
.img-lightbox .lb-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--bg-card,#222); color: #fff; font-size: 20px; cursor: pointer; }
.img-lightbox .lb-loading { color: #aaa; padding: 40px; }
