:root {
  --bg: #0a0e13;
  --bg-soft: #10161f;
  --card: #141b25;
  --card-hover: #1b2431;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e9eff7;
  --muted: #8a9ab0;
  --primary: #5eead4;
  --primary-dim: rgba(94, 234, 212, 0.14);
  --accent: #818cf8;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

/* 覆盖层必须真正隐藏，否则会挡住 video 的控件点击 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 禁止横屏/系统字号设置导致的自动缩放 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 只允许滚动，禁止双击缩放与手势缩放 */
  touch-action: manipulation;
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(94, 234, 212, 0.10), transparent 60%),
    radial-gradient(800px 480px at 88% -12%, rgba(129, 140, 248, 0.10), transparent 60%);
  background-repeat: no-repeat;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 19, 0.78);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 14px rgba(94, 234, 212, 0.8);
}

.search-form {
  flex: 1;
  display: flex;
  max-width: 560px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form:focus-within {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 18px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 14px;
}

.search-form input::placeholder { color: var(--muted); }

.search-form button {
  padding: 0 20px;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #06221d;
  background: linear-gradient(135deg, var(--primary), #7dd3fc);
}

.nav {
  display: flex;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.nav a {
  padding: 8px 12px;
  border-radius: 10px;
  transition: 0.18s;
}

.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav a.on { color: var(--primary); background: var(--primary-dim); }

/* ---------- 布局 ---------- */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}

.footer {
  padding: 22px 20px 34px;
  text-align: center;
  font-size: 12px;
  color: #5d6b7d;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.section-head span { font-size: 13px; color: var(--muted); }

/* ---------- 影片卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 16px;
}

.grid.small { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 16px 12px; }

.card { display: block; }

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(150deg, #1b2431, #10161f);
  border: 1px solid var(--line);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
}

.card:hover .poster {
  transform: translateY(-4px);
  border-color: rgba(94, 234, 212, 0.35);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.45);
}

.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  background: var(--card);
}

.poster-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.13);
}

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  max-width: calc(100% - 16px);
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  color: #eafffb;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-src {
  color: var(--primary);
  background: var(--primary-dim);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
}

/* ---------- 详情页 ---------- */
.detail-head {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 26px;
  align-items: start;
}

.detail-head .poster { border-radius: 16px; }

.detail-title {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #cfe0f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.chip.primary { color: var(--primary); border-color: rgba(94, 234, 212, 0.32); background: var(--primary-dim); }

.desc {
  font-size: 13.5px;
  line-height: 1.85;
  color: #b6c4d6;
  max-height: 7.4em;
  overflow: hidden;
  transition: max-height 0.3s;
  white-space: pre-line;
}

.desc.open { max-height: none; }

.link-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: 0.18s;
  font-family: inherit;
}

.btn:hover { background: var(--card-hover); border-color: rgba(94, 234, 212, 0.3); }

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #7dd3fc);
  color: #04231e;
  border: 0;
  font-weight: 650;
}

.btn.primary:hover { filter: brightness(1.06); }
.btn.on { color: var(--primary); border-color: rgba(94, 234, 212, 0.45); }

.panel {
  margin-top: 30px;
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(20, 27, 37, 0.62);
  border: 1px solid var(--line);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(var(--primary), var(--accent));
}

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.tab {
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  cursor: pointer;
}

.tab.on {
  color: var(--primary);
  background: var(--primary-dim);
  border-color: rgba(94, 234, 212, 0.32);
}

.eps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.ep {
  padding: 9px 6px;
  text-align: center;
  font-size: 13px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid transparent;
  color: #c3d1e2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: 0.15s;
}

.ep:hover { background: rgba(94, 234, 212, 0.12); color: var(--primary); }

.ep.on {
  background: var(--primary);
  color: #04231e;
  font-weight: 650;
}

.ep .ico { font-size: 11px; opacity: 0.7; margin-right: 3px; }

/* ---------- 播放页 ---------- */
.player-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

.player-box video { width: 100%; height: 100%; display: block; background: #000; }

.player-tip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.play-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 6px;
}

.play-head h1 { margin: 0; font-size: 19px; font-weight: 650; }
.play-head .sub { font-size: 13px; color: var(--muted); }

.play-tools { display: flex; gap: 8px; }

.play-tools a, .play-tools button {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.play-tools a:hover, .play-tools button:hover { border-color: rgba(94, 234, 212, 0.35); }
.play-tools .disabled { opacity: 0.35; pointer-events: none; }

/* ---------- 搜索页 ---------- */
.search-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-head h1 { margin: 0; font-size: 19px; font-weight: 600; }
.search-head .count { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }

.filters a {
  padding: 6px 13px;
  font-size: 13px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.filters a.on { color: var(--primary); border-color: rgba(94, 234, 212, 0.4); background: var(--primary-dim); }

/* ---------- 我的 ---------- */
.list-rows { display: flex; flex-direction: column; gap: 10px; }

.row-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: 0.18s;
}

.row-item:hover { background: var(--card-hover); }

.row-item .thumb {
  width: 62px;
  height: 84px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--card);
  flex-shrink: 0;
}

.row-item .info { flex: 1; min-width: 0; }
.row-item .name { font-size: 14px; font-weight: 550; margin-bottom: 6px; }
.row-item .meta { font-size: 12px; color: var(--muted); }
.progress-bar {
  margin-top: 8px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- 表单 / 后台 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 620px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  color: #b9c7d8;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: 0.18s;
}

.field input:focus, .field textarea:focus {
  border-color: rgba(94, 234, 212, 0.5);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.field .hint { margin-top: 6px; font-size: 12px; color: #6d7d90; }

.switch { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.switch input { width: 16px; height: 16px; accent-color: #34d399; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td { padding: 11px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, 0.025); }

.table .api-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #93a5bb;
  font-size: 12.5px;
}

.pill {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid var(--line);
}
.pill.on { color: #6ee7b7; background: rgba(110, 231, 183, 0.1); border-color: rgba(110, 231, 183, 0.3); }
.pill.off { color: #94a3b8; background: rgba(148, 163, 184, 0.08); }

.mini {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: #c6d3e2;
  cursor: pointer;
  font-family: inherit;
}

.mini:hover { border-color: rgba(94, 234, 212, 0.4); color: var(--primary); }
.mini.danger:hover { border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.toast {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.toast.error { color: #fecaca; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }

.admin-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.admin-head h1 { margin: 0; font-size: 20px; }

.login-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 26px;
  border-radius: 18px;
  background: rgba(20, 27, 37, 0.85);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card p { margin: 0 0 22px; font-size: 13px; color: var(--muted); }

.test-result { margin-top: 10px; font-size: 12.5px; color: var(--muted); word-break: break-all; }
.test-result.ok { color: #6ee7b7; }
.test-result.fail { color: #fca5a5; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .detail-head { grid-template-columns: 130px 1fr; gap: 16px; }
  .detail-title { font-size: 20px; }
  .desc { font-size: 13px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .search-form { order: 3; max-width: none; flex-basis: 100%; }
  .nav { margin-left: auto; }
  .wrap { padding: 18px 14px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 16px 12px; }
  .panel { padding: 16px 14px; }
  .eps { max-height: 260px; }

  /* iOS 输入框字号小于 16px 时聚焦会自动放大页面 */
  .search-form input,
  .field input[type="text"],
  .field input[type="password"],
  .field input[type="number"],
  .field textarea,
  .field select { font-size: 16px; }
}

@media (max-width: 480px) {
  .detail-head { grid-template-columns: 1fr; }
  .detail-head .poster { width: 132px; }
  .table .api-cell { max-width: 140px; }
}
