:root {
  --bg: #08080c;
  --bg-soft: #101016;
  --card: #15151d;
  --card-hover: #1c1c26;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ececf3;
  --muted: #8b8b9c;
  --muted-2: #62626f;
  --accent: #ff3b5c;
  --accent-soft: rgba(255, 59, 92, 0.14);
  --radius: 12px;
  --header-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 50% -180px, rgba(255, 59, 92, 0.18), transparent 70%),
    radial-gradient(700px 400px at 90% 0, rgba(90, 110, 255, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, button, textarea { outline: none; }

/* ---------------- 顶部固定横幅 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(14px, 4vw, 34px);
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-h) + env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-logo {
  height: 34px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  border-radius: 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #7a2bff);
  box-shadow: 0 6px 18px rgba(255, 59, 92, 0.28);
  flex: none;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  transition: background 0.2s, border-color 0.2s;
}

.back-link:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); }

.back-link .arrow { font-size: 17px; line-height: 1; transform: translateY(-1px); }

.menu-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  place-content: center;
  padding: 0;
  flex: none;
  transition: background 0.2s;
}

.menu-btn:hover { background: rgba(255, 255, 255, 0.09); }

.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  opacity: 0.85;
}

/* ---------------- 页面容器 ---------------- */

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 34px) 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.section-title::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  transform: translateY(-8px);
}

.section-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 视频网格 ---------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 18px;
}

.card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.22s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 59, 92, 0.35);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
  overflow: hidden;
}

.thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  opacity: 1;
}

.thumb img.loaded { opacity: 1; }

.card:hover .thumb img { transform: scale(1.04); }

.thumb-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #1a1a24, #101017 70%);
  color: var(--muted-2);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.card-badge {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(6, 6, 10, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #ffd9df;
  font-variant-numeric: tabular-nums;
}

.card-badge .heart { color: var(--accent); }

.card-title {
  padding: 10px 12px 12px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}

/* ---------------- 查看更多 ---------------- */

.more-wrap {
  display: flex;
  justify-content: center;
  padding: 34px 0 10px;
}

.more-btn {
  min-width: 168px;
  height: 44px;
  padding: 0 26px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.6px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.more-btn:hover { background: rgba(255, 59, 92, 0.16); border-color: rgba(255, 59, 92, 0.5); }
.more-btn:active { transform: scale(0.97); }
.more-btn[disabled] { opacity: 0.5; cursor: default; }

/* ---------------- 空状态 ---------------- */

.empty {
  grid-column: 1 / -1;
  padding: 70px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 8px; }
.empty a { color: var(--accent); border-bottom: 1px solid rgba(255, 59, 92, 0.4); }

/* ---------------- 抽屉菜单 ---------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  z-index: 120;
  background: #0d0d13;
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}

.drawer.open { transform: translateX(0); }

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s;
}

.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.drawer-head span { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 1px; }

.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.search-box { position: relative; margin-bottom: 8px; }

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.search-box input::placeholder { color: var(--muted-2); }
.search-box input:focus { border-color: rgba(255, 59, 92, 0.55); background: rgba(255, 255, 255, 0.08); }

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}

.sr-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.18s;
}

.sr-item:hover { background: rgba(255, 255, 255, 0.06); }

.sr-thumb {
  width: 68px;
  height: 38px;
  border-radius: 7px;
  background: var(--bg-soft);
  object-fit: cover;
  flex: none;
}

.sr-body { min-width: 0; }
.sr-title { font-size: 13.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.sr-empty { padding: 10px 4px; font-size: 13px; color: var(--muted); }

.tag-block { margin-top: auto; padding-top: 18px; }

.tag-title { font-size: 12px; color: var(--muted-2); letter-spacing: 2px; margin-bottom: 12px; }

.tags { display: flex; flex-wrap: wrap; gap: 10px; }

.tag {
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13.5px;
  transition: all 0.2s;
}

.tag:hover { border-color: rgba(255, 59, 92, 0.6); color: #ffb9c6; background: var(--accent-soft); }
.tag.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------------- 播放页 ---------------- */

.watch-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px clamp(12px, 3vw, 24px) 70px;
}

.player {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.player video {
  display: block;
  width: 100%;
  max-height: 78vh;
  background: #000;
  object-fit: contain;
}

.watch-title {
  margin: 18px 0 10px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.watch-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.meta-item { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13.5px;
  transition: all 0.18s;
}

.like-btn:hover { border-color: rgba(255, 59, 92, 0.55); color: #ffbec9; }
.like-btn.on { background: var(--accent-soft); border-color: rgba(255, 59, 92, 0.6); color: #ffbec9; }
.like-btn .heart { color: var(--accent); font-size: 15px; }

.related-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 30px 0 16px;
}

.related-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.related-head span { font-size: 12.5px; color: var(--muted); }

/* ---------------- 后台 ---------------- */

.admin-body { background: #07070b; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 26px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.login-card h1 { margin: 0 0 6px; font-size: 19px; }
.login-card p { margin: 0 0 22px; font-size: 13px; color: var(--muted); }

.field { margin-bottom: 14px; }

.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.5px; }

.input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s, background 0.18s;
}

.input:focus { border-color: rgba(255, 59, 92, 0.55); background: rgba(255, 255, 255, 0.08); }
.input::placeholder { color: var(--muted-2); }

.input.textarea {
  height: auto;
  min-height: 168px;
  padding: 12px 13px;
  line-height: 1.65;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  cursor: pointer;
}

select.input option { background: #12121a; color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  transition: all 0.18s;
}

.btn:hover { background: rgba(255, 255, 255, 0.1); }

.btn.primary {
  background: linear-gradient(140deg, #ff3b5c, #e0256f);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(255, 59, 92, 0.28);
}

.btn.primary:hover { filter: brightness(1.08); }
.btn.block { width: 100%; }
.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.danger:hover { border-color: rgba(255, 59, 92, 0.6); color: #ffb0bd; background: var(--accent-soft); }

.admin-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 28px) 80px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.admin-head h1 { margin: 0; font-size: 20px; }
.admin-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.panel h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; letter-spacing: 0.4px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .row2 { grid-template-columns: 1fr; } }

.setting-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.setting-row .input { flex: 1 1 200px; width: auto; min-width: 140px; }
.setting-row .btn { flex: none; }

.logo-preview {
  width: 128px;
  height: 52px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}

.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview span { font-size: 12px; color: var(--muted-2); }

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.dropzone:hover, .dropzone.over { border-color: rgba(255, 59, 92, 0.6); background: rgba(255, 59, 92, 0.05); color: var(--text); }
.dropzone strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

.progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 12px;
}
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff3b5c, #ff8a5c); transition: width 0.2s; }

.vlist { display: flex; flex-direction: column; gap: 8px; }

.vrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.vrow .order { flex: none; width: 22px; font-size: 12px; color: var(--muted-2); text-align: center; font-variant-numeric: tabular-nums; }

.vrow .cover {
  flex: none;
  width: 88px;
  height: 50px;
  border-radius: 7px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--line);
}

.vrow .title-input { flex: 1 1 220px; min-width: 150px; height: 34px; }

.vrow .num { flex: 0 0 84px; width: 84px; height: 34px; font-variant-numeric: tabular-nums; }

.numgroup { display: flex; gap: 8px; flex: none; }

.num-cell { display: flex; align-items: center; gap: 5px; }
.num-cell > span { font-size: 11.5px; color: var(--muted-2); flex: none; }

.vrow .ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }

.arrow-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
}
.arrow-btn:hover { background: rgba(255, 255, 255, 0.12); }

.status-pill {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill.ok { color: #74e0a1; border-color: rgba(116, 224, 161, 0.35); }
.status-pill.err { color: #ff96a6; border-color: rgba(255, 59, 92, 0.45); }
.status-pill.run { color: #ffcb6b; border-color: rgba(255, 203, 107, 0.35); }

.joblist { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.jobrow { display: flex; align-items: center; gap: 10px; }
.jobrow .jt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobrow .jp { width: 90px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; flex: none; }
.jobrow .jp > i { display: block; height: 100%; background: var(--accent); width: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hint { font-size: 12px; color: var(--muted-2); margin-top: 8px; line-height: 1.6; }

/* ---------------- 移动端：两列 ---------------- */

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .card-title { font-size: 13px; padding: 8px 10px 10px; min-height: 40px; }
  .section-title { font-size: 18px; }
  .watch-title { font-size: 17px; }
  .vrow .cover { width: 72px; height: 42px; }
  .vrow .title-input { flex: 1 1 100%; }
  .vrow .ops { margin-left: 0; }
  .vrow .order { display: none; }
}

@media (max-width: 460px) {
  .brand-name { font-size: 15.5px; }
  .wrap { padding-top: 18px; }
}
