:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e6e9f0;
  --primary: #3b5bdb;
  --primary-dark: #2f49b0;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }

.wrap { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #4f6ef7, #7c4dff);
  color: #fff; display: grid; place-items: center; font-size: 13px;
  box-shadow: 0 4px 12px rgba(79, 110, 247, .3);
}
.search { margin-left: auto; display: flex; gap: 8px; }
.search input {
  width: 240px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fafbfe; outline: none;
}
.search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-weight: 600; transition: .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); font-weight: 500; }
.btn-ghost:hover { background: #f8f9fc; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #e0e7ff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }

/* ---------------- 前台 ---------------- */
.hero { padding: 34px 0 20px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.5px; }
.hero p { margin: 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 8px 0 24px; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  height: 34px; padding: 0 15px; border-radius: 999px; font-weight: 500; transition: .16s;
}
.chip:hover { border-color: #c7d2fe; color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(59, 91, 219, .22); }
.chip span { opacity: .7; margin-left: 5px; font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(16, 24, 40, .12); border-color: #d7def5; }
.thumb { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #e9edf9, #dfe6f7); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #aab6da; }
.dur {
  position: absolute; right: 9px; bottom: 9px; background: rgba(17, 24, 39, .78);
  color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px;
}
.play-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(17, 24, 39, .28); opacity: 0; transition: .18s; color: #fff; font-size: 26px;
}
.card:hover .play-overlay { opacity: 1; }
.card-body { padding: 13px 15px 15px; }
.card-body h3 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px;
}
.meta { display: flex; gap: 10px; color: var(--faint); font-size: 12px; }
.meta .tag { background: var(--primary-soft); color: var(--primary); padding: 1px 8px; border-radius: 6px; }

.empty, .loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 28px 0 40px; }
.pager .page-info { color: var(--muted); }

/* ---------------- 播放器弹层 ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .72); z-index: 50;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px);
}
.player { width: min(880px, 100%); background: #111827; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, .4); }
.player-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; color: #f3f4f6; }
.player-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.player-head button { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.player video { width: 100%; max-height: 70vh; display: block; background: #000; }
.player-foot { padding: 10px 18px 16px; color: #9ca3af; font-size: 12px; }

/* ---------------- 后台通用 ---------------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; }
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: #fff; border-right: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 8px 22px; font-size: 16px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px;
  padding: 0 12px; margin-bottom: 4px; border: 0; background: transparent;
  border-radius: 9px; color: var(--muted); font-weight: 500; text-align: left;
}
.nav-item:hover { background: #f5f7fb; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar-foot { position: absolute; bottom: 18px; left: 14px; right: 14px; }
.admin-main { flex: 1; min-width: 0; }
.admin-top { height: 64px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; gap: 12px; }
.admin-top h2 { margin: 0; font-size: 17px; }
.admin-top .spacer { flex: 1; }
.admin-content { padding: 26px 28px 60px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-head .sub { color: var(--faint); font-size: 12px; }
.panel-head .spacer { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat.a .value { color: var(--primary); }
.stat.b .value { color: var(--success); }
.stat.c .value { color: var(--warn); }
.stat.d .value { color: var(--danger); }

.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 220px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 11px; color: var(--faint); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; background: #fafbfe;
  padding: 8px 11px; outline: none; color: var(--text); transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
.select { height: 36px; }
.field.grow { flex: 2 1 360px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfe; white-space: nowrap; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.tr-title { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tr-sub { color: var(--faint); font-size: 11px; font-weight: 400; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.done { background: var(--success-soft); color: var(--success); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.running { background: var(--warn-soft); color: var(--warn); }
.badge.pending { background: #f1f5f9; color: #64748b; }

.progress { height: 6px; background: #eef1f7; border-radius: 99px; overflow: hidden; min-width: 90px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #4f6ef7, #7c4dff); border-radius: 99px; transition: width .3s; }
.err-text { color: var(--danger); font-size: 11px; max-width: 280px; }

.notice { padding: 9px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.notice.ok { background: var(--success-soft); color: var(--success); }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--primary-soft); color: var(--primary); }
.pre {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: 12px;
  font-size: 12px; font-family: Consolas, "Courier New", monospace; word-break: break-all;
  white-space: pre-wrap; max-height: 220px; overflow: auto; color: #334155;
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.section-title { font-size: 13px; font-weight: 700; margin: 0 0 4px; }
.section-desc { font-size: 12px; color: var(--faint); margin: 0 0 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .wrap { width: calc(100% - 24px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 64px; flex-basis: 64px; padding: 16px 8px; }
  .sidebar .brand span:last-child, .nav-item .txt, .sidebar-foot { display: none; }
  .sidebar .brand { justify-content: center; padding: 0 0 18px; }
  .nav-item { justify-content: center; padding: 0; }
  .admin-content { padding: 20px 16px 50px; }
  .admin-top { padding: 0 16px; }
  .search input { width: 150px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .topbar-inner { height: 58px; gap: 10px; }
  .search input { width: 110px; }
  .form-row .field { flex-basis: 100%; }
}

/* ---------------- 专辑 ---------------- */
.chips.albums { margin-top: -14px; margin-bottom: 22px; }
/* 前台去掉 hero 后给分类栏留出顶部间距 */
.chips.main-chips { margin-top: 30px; }
/* 后台内嵌的专辑管理页 */
.embed-wrap { margin: 0; }
.album-frame { display: block; width: 100%; height: calc(100vh - 150px); min-height: 520px; border: 0; background: transparent; }
.embed .admin-shell { min-height: 0; }
.embed .sidebar, .embed .admin-top { display: none; }
.embed .admin-content { padding: 0; }

.chips-label { font-size: 12px; color: var(--faint); align-self: center; margin-right: 2px; }
.chip.small { height: 30px; padding: 0 12px; font-size: 13px; }
.ep {
  position: absolute; left: 9px; top: 9px; z-index: 2;
  background: rgba(59, 91, 219, .94); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
}
.meta .tag.album { background: var(--warn-soft); color: var(--warn); }
.player-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.player-foot .spacer { flex: 1; }
.player-foot button {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  border-radius: 8px; padding: 4px 12px; font-size: 12px;
}
.player-foot button:disabled { opacity: .35; cursor: not-allowed; }
.player-foot .ep-count { color: #d1d5db; font-size: 12px; }
.album-pick {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  cursor: pointer; transition: .15s;
}
.album-pick:hover { border-color: #c7d2fe; }
.album-pick.active { border-color: var(--primary); background: var(--primary-soft); }
.album-pick .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-pick .cnt { color: var(--faint); font-size: 12px; }
.ep-input { width: 74px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfe; }
.album-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .album-layout { grid-template-columns: 1fr; } }
