:root {
  --bg: #0a0a0e;
  --bg-soft: #101016;
  --surface: #16161d;
  --surface-2: #1e1e28;
  --surface-3: #262633;
  --border: #262632;
  --text: #f4f4f6;
  --muted: #9a9aad;
  --muted-2: #6e6e80;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --gold: #f5c518;
  --green: #46d369;
  --amber: #f5a623;
  --danger: #ff4d4f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

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

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", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: rgba(10, 10, 14, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: 0.5px; white-space: nowrap; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: block;
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.45);
}
.logo small { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 1px; }
.topbar nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar .admin-link { text-decoration: none; }
.nav-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 13px; border-radius: 999px; font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: all 0.15s;
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-btn.active { color: #fff; background: var(--accent); }
.nav-btn.nav-cta { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(229, 9, 20, 0.4); }
.nav-btn.nav-cta:hover { background: var(--accent-hover); color: #fff; }

/* ---------- 页面导航（横幅下面，最新上架上面；全端可见） ---------- */
.page-nav { display: flex; gap: 8px; padding: 4px 0 18px; flex-wrap: wrap; }
.page-nav .nav-btn { border: 1px solid var(--border); background: var(--surface-2); }
.page-nav .nav-btn.active { background: var(--accent); border-color: transparent; }
@media (max-width: 700px) {
  .page-nav .nav-btn { flex: 1; text-align: center; }
}
.admin-link {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.admin-link:hover { color: var(--text); border-color: var(--muted-2); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 22%;
  filter: blur(2px) brightness(0.5) saturate(1.2);
  transform: scale(1.08);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,14,0.25) 0%, rgba(10,10,14,0.55) 55%, var(--bg) 100%);
}
.hero-inner { position: relative; z-index: 2; padding: 52px 20px 30px; max-width: 1100px; margin: 0 auto; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); font-weight: 800; letter-spacing: 0.5px; line-height: 1.2; }
.hero h1 span { color: var(--accent); }
.hero p { margin-top: 8px; color: #cfcfda; font-size: 15px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero-cta { font-size: 16px; padding: 14px 30px; border-radius: 999px; box-shadow: 0 6px 20px rgba(229, 9, 20, 0.45); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 20px 60px; }
.view { display: none; }
.view.active { display: block; }
.section { margin-top: 30px; }
.section:first-child { margin-top: 6px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: 0.3px; }
.section-head h2::before {
  content: ""; display: inline-block; width: 4px; height: 18px;
  background: var(--accent); border-radius: 2px; margin-right: 9px;
  vertical-align: -2px;
}
.section-head .sub { color: var(--muted); font-size: 13px; }
.section-head .count {
  margin-left: auto; font-size: 12.5px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}

/* ---------- 海报卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #343444; }
.poster { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); overflow: hidden; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .no-poster {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); font-size: 34px; font-weight: 800;
  background: linear-gradient(160deg, #23232f, #17171f);
}
.badge-new {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.badge-type {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card-body { padding: 11px 12px 13px; }
.card-title {
  font-size: 14.5px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 39px;
}
.card-meta { margin-top: 5px; color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-meta .ep { color: var(--gold); font-weight: 700; }
.card .add-btn { width: 100%; margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font-size: 14.5px; font-weight: 700; padding: 11px 18px;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: var(--surface-3); color: var(--text); }
.btn.ghost:hover { background: #30303e; }
.btn.small { padding: 8px 13px; font-size: 13.5px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 77, 79, 0.5); }
.btn.danger:hover { background: rgba(255, 77, 79, 0.12); }
.btn.block { width: 100%; }

/* ---------- 输入 ---------- */
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 15px; padding: 12px 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.22); }
.input::placeholder { color: var(--muted-2); }
.input[readonly] { background: rgba(255, 255, 255, 0.04); color: var(--muted); cursor: not-allowed; }
/* 首页横幅文档式编辑器（像改 Word 一样点文字直接改） */
.hero-doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.hero-color-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer; }
.hero-color-label input[type="color"] { width: 44px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); cursor: pointer; }
.hero-doc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 18px; margin-top: 4px; }
.hero-doc-title { font-size: 26px; font-weight: 800; line-height: 1.3; outline: none; border-radius: 4px; }
.hero-doc-sub { font-size: 14px; color: var(--muted); line-height: 1.6; margin-top: 10px; outline: none; border-radius: 4px; }
.hero-doc-title:focus, .hero-doc-sub:focus { outline: 2px solid var(--accent); outline-offset: 3px; }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted-2); margin-top: 6px; line-height: 1.5; }

/* ---------- 到期列表 ---------- */
.expire-list { display: flex; flex-direction: column; gap: 10px; }
.expire-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px;
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #3a3a4d, #23232f);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: #fff;
  border: 1px solid var(--border);
}
.expire-info { flex: 1; min-width: 0; }
.expire-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expire-date { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.days-badge {
  flex-shrink: 0; text-align: right;
  font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px;
}
.days-badge .n { font-size: 17px; }
.expire-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
/* ---------- 续费弹窗（图一风格：黑色底 + 红色选中） ---------- */
.renew-sec-label { font-size: 14px; font-weight: 700; margin: 16px 0 10px; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2px 0 4px; }
.plan-card { display: block; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-family: inherit; }
.plan-card:active { transform: scale(0.98); }
.plan-card .plan-label { display: block; font-size: 15px; font-weight: 700; }
.plan-card .plan-price { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }
.plan-card.selected { background: var(--accent); border-color: var(--accent); }
.plan-card.selected .plan-price { color: #fff; }
.renew-amount { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.renew-amount .amount-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-size: 14px; color: var(--muted); }
.renew-amount .amount-row .amount-val { color: var(--text); font-size: 15px; }
.renew-amount .amount-row.total { font-size: 16px; font-weight: 800; color: var(--text); }
.renew-amount .amount-row.total .amount-val { font-size: 20px; font-weight: 800; }
.pay-method { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--accent); background: var(--surface-2); }
.pay-method .alipay-logo { width: 34px; height: 34px; flex: none; }
.pay-method .pay-name { font-size: 15px; font-weight: 700; }
.pay-method .pay-check { margin-left: auto; color: var(--accent); font-size: 18px; font-weight: 800; }
.days-ok { background: rgba(70, 211, 105, 0.14); color: var(--green); }
.days-warn { background: rgba(245, 166, 35, 0.14); color: var(--amber); }
.days-bad { background: rgba(255, 77, 79, 0.16); color: var(--danger); }

/* ---------- 搜索 ---------- */
.search-box { display: flex; gap: 10px; }
.search-box .input { flex: 1; font-size: 16px; padding: 13px 16px; border-radius: 999px; }
.search-box .btn { border-radius: 999px; padding: 13px 22px; }
.search-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.result-note { margin-top: 18px; }

/* ---------- 进度 ---------- */
.progress-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-top: 18px;
}
.progress-title { font-weight: 800; font-size: 16px; display: flex; gap: 10px; align-items: center; }
.progress-title .mini-poster { width: 40px; height: 60px; border-radius: 8px; object-fit: cover; }
.steps { margin-top: 16px; display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.step:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; top: 34px; bottom: -4px;
  width: 2px; background: var(--border);
}
.step.done:not(:last-child)::before { background: var(--green); }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-3); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--muted); z-index: 1;
}
.step.done .step-dot { background: var(--green); border-color: var(--green); color: #06210f; }
.step.active .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; animation: pulse 1.4s infinite; }
.step.failed .step-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.step-label { font-weight: 700; font-size: 14.5px; padding-top: 2px; }
.step.done .step-label { color: var(--muted); }
.step.active .step-label { color: #fff; }
.step-desc { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
/* 横向填充进度条（最近加片进度，A 样式） */
.hbar { margin-top: 6px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.hbar-top b { color: var(--text); }
.hbar-top .hbar-pct { color: var(--green); font-weight: 800; }
.hbar-track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-3); margin: 0 13px; }
.hbar-fill { height: 100%; border-radius: 5px; background: var(--green); transition: width .4s; }
.hbar-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.hbar-dot.done { background: var(--green); border-color: var(--green); color: #06210f; }
.hbar-dot.current { background: var(--accent); border-color: var(--accent); color: #fff; animation: pulse 1.4s infinite; }
.hbar-labels { position: relative; height: 20px; margin: 10px 13px 0; }
.hbar-label { position: absolute; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hbar-label.done { color: var(--green); }
.hbar-label.current { color: var(--text); font-weight: 700; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(229, 9, 20, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 9, 20, 0); } }

/* ---------- 提示条 ---------- */
.notice {
  border-radius: var(--radius); padding: 13px 16px; font-size: 14px; line-height: 1.6;
  background: var(--surface); border: 1px solid var(--border); color: #d6d6de;
}
.notice.warn { border-color: rgba(245, 166, 35, 0.45); background: rgba(245, 166, 35, 0.08); }
.notice.error { border-color: rgba(255, 77, 79, 0.45); background: rgba(255, 77, 79, 0.08); }
.notice.ok { border-color: rgba(70, 211, 105, 0.4); background: rgba(70, 211, 105, 0.08); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 34px 10px; }
.loading::after { content: "…"; animation: dots 1.2s infinite; }
@keyframes dots { 0% { content: "."; } 33% { content: ".."; } 66% { content: "..."; } }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px 20px 0 0; padding: 22px 20px 26px;
}
.modal h3 { font-size: 18px; font-weight: 800; }
.modal .modal-sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ---------- 管理后台 ---------- */
.admin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-top: 16px;
}
.admin-card h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.admin-card .card-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.status-pill {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.st-needs_link, .st-waiting_cms { background: rgba(245, 166, 35, 0.14); color: var(--amber); }
.st-exists { background: rgba(70, 211, 105, 0.14); color: var(--green); }
.st-queued, .st-transferring, .st-organizing { background: rgba(70, 130, 255, 0.14); color: #7ea8ff; }
.st-done { background: rgba(70, 211, 105, 0.14); color: var(--green); }
.st-failed { background: rgba(255, 77, 79, 0.14); color: var(--danger); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; }
.kv .v.ok { color: var(--green); }
.kv .v.bad { color: var(--amber); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row .input { flex: 1; min-width: 130px; }
.lib-list { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 16px; }
.lib-check { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.lib-check input { accent-color: var(--red); }

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
  .hero-cta { flex: 1; text-align: center; }
}

/* ---------- 响应式 ---------- */
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 20px; }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 14px; }
  .logo { font-size: 17px; }
  .wrap { padding: 16px 14px 48px; }
  .hero-inner { padding: 40px 16px 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
  .card-title { font-size: 13.5px; min-height: 36px; }
  .expire-row { padding: 11px 12px; gap: 10px; }
}

/* ---------- 播放排行 ---------- */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.rank-num { flex: 0 0 28px; text-align: center; font-size: 18px; font-weight: 800; color: var(--muted); }
.rank-num.top3 { color: var(--accent); }
.rank-poster { flex: 0 0 44px; width: 44px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; background: #1c1c26; }
.rank-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-poster .no-poster { font-size: 20px; height: 100%; display: flex; align-items: center; justify-content: center; }
.rank-info { min-width: 0; }
.rank-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-year { color: var(--muted); font-weight: 500; font-size: 13px; }
.rank-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
@media (max-width: 700px) {
  .rank-row { padding: 8px 10px; gap: 10px; }
  .rank-poster { flex-basis: 38px; width: 38px; }
}
