:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1d2130;
  --border: #2a2f3d;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #3f7ff0;
  --accent-3: #7a5cff;
  --ok: #28c76f;
  --warn: #ff9f43;
  --danger: #ea5455;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.38);
  --glow: rgba(79, 140, 255, 0.35);
}

* { box-sizing: border-box; }

html {
  height: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }

/* ===== 背景极光 ===== */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  pointer-events: none;
}
body::before {
  background: radial-gradient(circle at center, rgba(79, 140, 255, 0.14), transparent 62%);
  top: -22vmax;
  left: -18vmax;
  animation: aurora-1 26s ease-in-out infinite alternate;
}
body::after {
  background: radial-gradient(circle at center, rgba(122, 92, 255, 0.12), transparent 62%);
  bottom: -26vmax;
  right: -18vmax;
  animation: aurora-2 32s ease-in-out infinite alternate;
}
@keyframes aurora-1 {
  to { transform: translate(9vmax, 7vmax) scale(1.15); }
}
@keyframes aurora-2 {
  to { transform: translate(-9vmax, -7vmax) scale(1.1); }
}

/* ===== 滚动条 / 选区 / 焦点 ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2a2f3d;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #3a4258; background-clip: padding-box; }

::selection { background: rgba(79, 140, 255, 0.35); }

button:focus-visible { outline: 2px solid rgba(79, 140, 255, 0.6); outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--accent); }

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(15, 17, 23, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 140, 255, 0.55), rgba(122, 92, 255, 0.55), transparent);
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  background: linear-gradient(135deg, #4f8cff, #7a5cff, #c05cff, #4f8cff);
  background-size: 300% 300%;
  animation: logo-flow 9s ease infinite;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 20px rgba(122, 92, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
@keyframes logo-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.brand-text { min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
  background: linear-gradient(90deg, #e8eaf0, #b9c6e8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar .sub { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  max-width: 1180px;
  margin: 0 auto;
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
  transition: color 0.2s ease, background 0.2s ease;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab.active {
  color: var(--text);
  border-bottom-color: transparent;
  font-weight: 700;
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 10px rgba(79, 140, 255, 0.8);
}
.task-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--warn);
  color: #1c1c1c;
  font-size: 11px;
  text-align: center;
  animation: pulse 1.6s infinite;
}

.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 16px; animation: panel-in 0.28s ease; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 64px;
  display: grid;
  gap: 16px;
}

/* ===== Cards ===== */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 42%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  border-color: rgba(79, 140, 255, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 0 24px rgba(79, 140, 255, 0.06);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.head-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card h2 { margin: 0; font-size: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.4);
}

/* ===== Controls ===== */
input, select, textarea {
  width: 100%;
  background: #0c0e14;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.16);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%239aa3b2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 32px;
  cursor: pointer;
}

button {
  position: relative;
  background: #232a3c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease, box-shadow 0.2s ease, filter 0.16s ease;
}
button:hover:not(:disabled) {
  background: #2c3550;
  border-color: rgba(79, 140, 255, 0.45);
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: translateY(0) scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
button.primary {
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #5d6bff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 140, 255, 0.3);
}
button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-2), #5d6bff);
  box-shadow: 0 6px 22px rgba(79, 140, 255, 0.48);
}
button.primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
}
button.primary:hover::after { animation: shine 0.7s ease; }
@keyframes shine {
  from { left: -60%; }
  to { left: 120%; }
}
button.warn {
  background: linear-gradient(135deg, #ffb05c, var(--warn));
  border-color: transparent;
  color: #1c1c1c;
  box-shadow: 0 4px 14px rgba(255, 159, 67, 0.25);
}
button.warn:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(255, 159, 67, 0.4); }
button.ghost { background: transparent; }
button.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }

.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
.hidden { display: none !important; }

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: #2a2f3d;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.badge:hover { border-color: var(--accent); color: var(--text); }
.badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  vertical-align: 1px;
}
.badge.ok {
  background: rgba(40, 199, 111, 0.14);
  color: var(--ok);
  border-color: var(--ok);
}
.badge.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2.2s infinite; }
.badge.bad {
  background: rgba(234, 84, 85, 0.14);
  color: var(--danger);
  border-color: var(--danger);
}
.badge.bad::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* ===== Filters ===== */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}
.dynamic-filters { display: contents; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--muted); font-size: 12px; }
.search-group { display: flex; gap: 8px; grid-column: 1 / -1; flex-wrap: wrap; }
.search-group input { flex: 1; min-width: 180px; }

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.spacer { flex: 1 1 auto; min-width: 8px; }
.check-all { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-all input { width: auto; cursor: pointer; }
.online-field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.online-field select { width: auto; }
.page-group { display: flex; align-items: center; gap: 8px; }
.page-info { color: var(--muted); font-size: 13px; min-width: 60px; text-align: center; }
.action-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Video grid ===== */
.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}
.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.25s ease;
  animation: card-in 0.45s cubic-bezier(0.22, 0.9, 0.35, 1.15) backwards;
}
.video-card:nth-child(2) { animation-delay: 0.03s; }
.video-card:nth-child(3) { animation-delay: 0.06s; }
.video-card:nth-child(4) { animation-delay: 0.09s; }
.video-card:nth-child(5) { animation-delay: 0.12s; }
.video-card:nth-child(6) { animation-delay: 0.15s; }
.video-card:nth-child(7) { animation-delay: 0.18s; }
.video-card:nth-child(8) { animation-delay: 0.21s; }
.video-card:nth-child(9) { animation-delay: 0.24s; }
.video-card:nth-child(10) { animation-delay: 0.27s; }
.video-card:nth-child(11) { animation-delay: 0.3s; }
.video-card:nth-child(12) { animation-delay: 0.33s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
}
.video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 18px rgba(79, 140, 255, 0.15);
}
.video-card.selected,
.video-card:has(.pick:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.4), 0 6px 20px rgba(79, 140, 255, 0.16);
}
.video-card .poster { position: relative; aspect-ratio: 3 / 4; background: #0c0e14; overflow: hidden; }
.video-card .poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.video-card:hover .poster img { transform: scale(1.07); }
.video-card .poster::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.25) 0%, transparent 30%, rgba(8, 10, 16, 0.7) 100%);
  pointer-events: none;
}
.video-card .poster .vip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: linear-gradient(135deg, #ff6b6b, var(--danger));
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(234, 84, 85, 0.5);
}
.video-card .poster .pick {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  background: rgba(8, 10, 16, 0.45);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}
.video-card .poster .pick::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0) translateY(1px);
  transition: transform 0.15s ease;
}
.video-card .poster .pick:hover { border-color: var(--accent); box-shadow: 0 0 10px rgba(79, 140, 255, 0.6); }
.video-card .poster .pick:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-color: transparent;
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.7);
}
.video-card .poster .pick:checked::after { transform: rotate(-45deg) scale(1) translateY(0); }
.video-card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 8px; }
.video-card .title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.video-card:hover .title { color: #cfe0ff; }
.video-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.video-card .meta .id { color: var(--muted); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.video-card .actions { display: flex; gap: 6px; }
.video-card .preview-btn, .video-card .add-btn { padding: 5px 10px; font-size: 12px; }
.video-card .preview-btn { background: rgba(255, 255, 255, 0.06); }
.video-card .preview-btn:hover { background: rgba(255, 255, 255, 0.13); }
.video-card .add-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 140, 255, 0.25);
}
.video-card .add-btn:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(79, 140, 255, 0.45); filter: brightness(1.08); }

.empty {
  grid-column: 1 / -1;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.empty.loading {
  background: linear-gradient(100deg, var(--panel-2) 40%, #272e42 50%, var(--panel-2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.empty.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -3px;
  animation: spin 0.8s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Jobs ===== */
.job-list { display: grid; gap: 10px; }
.job-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--panel-2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  animation: card-in 0.35s ease backwards;
}
.job-item:hover { border-color: rgba(79, 140, 255, 0.35); }
.job-item .head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.job-item .head .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-item .head .state { color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.state.status-done { color: var(--ok); }
.state.status-running, .state.status-queued { color: var(--accent); }
.state.status-failed { color: var(--danger); }
.state.status-running::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.4s infinite;
}
.job-item .bar { height: 7px; border-radius: 999px; background: #2a2f3d; overflow: hidden; margin: 10px 0 6px; }
.job-item .bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 10px rgba(79, 140, 255, 0.5);
  transition: width 0.25s ease;
}
.job-item[data-status="running"] .bar > span,
.job-item[data-status="queued"] .bar > span {
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent));
  background-size: 200% 100%;
  animation: bar-flow 1.6s linear infinite;
}
@keyframes bar-flow { to { background-position: -200% 0; } }
.job-item .stats { color: var(--muted); font-size: 12px; }
.job-log { max-height: 180px; overflow: auto; margin-top: 8px; font-size: 12px; line-height: 1.6; }
.job-log .log-success { color: var(--ok); }
.job-log .log-error { color: var(--danger); }
.job-log .log-warn { color: var(--warn); }
.job-log .log-skip { color: #8a6d3b; }

/* ===== Modals ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}
.modal:not(.hidden) .modal-card { animation: modal-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
}
.modal-card {
  width: min(760px, 100%);
  max-height: min(90vh, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 40px rgba(79, 140, 255, 0.08);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  flex: none;
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px; overflow: auto; min-height: 0; }

.login-card { width: min(720px, 100%); }
.login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%), var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.panel:hover { border-color: rgba(79, 140, 255, 0.3); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.domain { color: var(--muted); font-weight: 400; font-size: 12px; }

.qr-wrap { margin-top: 12px; text-align: center; }
.qr-wrap img {
  width: min(210px, 70vw);
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 24px rgba(79, 140, 255, 0.25);
  animation: qr-glow 2.4s ease-in-out infinite;
}
@keyframes qr-glow {
  50% { box-shadow: 0 0 36px rgba(79, 140, 255, 0.55); }
}
.qr-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.qr-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.preview-meta { display: flex; gap: 14px; margin-bottom: 14px; }
.preview-meta img {
  width: 96px;
  height: 136px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.preview-meta > div { min-width: 0; }
.preview-meta h4 { margin: 0 0 6px; font-size: 15px; }
.preview-actions { margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.modal textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.6; }

.bar { height: 8px; border-radius: 999px; background: #2a2f3d; overflow: hidden; margin: 10px 0; }
.modal .bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.5);
  transition: width 0.25s ease;
  animation: bar-flow 1.6s linear infinite;
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(88vw, 480px);
  padding: 12px 18px;
  background: rgba(18, 22, 33, 0.96);
  color: #fff;
  border: 1px solid rgba(79, 140, 255, 0.4);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 24px rgba(79, 140, 255, 0.12);
  backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -16px) scale(0.95); }
}

.player-card { width: min(760px, 100%); }
.player-body { padding: 16px; }
.player-card video {
  width: 100%;
  max-height: 48vh;
  background: #000;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border), 0 8px 24px rgba(0, 0, 0, 0.4);
}
.player-actions { margin: 12px 0; }
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 8px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.6);
}
.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}
.episode-list button { min-width: 0; height: 34px; padding: 0 8px; font-size: 13px; }
.episode-list button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 140, 255, 0.4);
}

/* ===== Auth gate ===== */
.auth-modal {
  z-index: 200;
  background: rgba(8, 10, 15, 0.78);
}
.auth-card {
  width: min(360px, 100%);
  border-color: rgba(79, 140, 255, 0.35);
  box-shadow: var(--shadow), 0 0 44px rgba(79, 140, 255, 0.14);
}
.auth-card .modal-body { display: grid; gap: 14px; }
.auth-card .primary { width: 100%; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .topbar { padding: 10px 14px; }
  .topbar .sub { display: none; }
  main { padding: 14px 12px 56px; }
  .filters { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .video-list { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 10px; }
  .card { padding: 14px; }
}

@media (max-width: 480px) {
  .top-actions { width: 100%; }
  .top-actions button { flex: 1; }
  .filters { grid-template-columns: 1fr; }
  .video-list { grid-template-columns: repeat(2, 1fr); }
  .toolbar { gap: 8px; }
  .toolbar .action-group { width: 100%; }
  .toolbar .action-group button { flex: 1; }
  .page-group { width: 100%; justify-content: space-between; }
  .preview-meta { flex-direction: column; }
  .preview-meta img { width: 100%; height: auto; aspect-ratio: 16 / 10; }
}

/* ===== 无障碍：减少动态效果 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 映射表弹窗 + 映射行（后台 ID ↔ 分类/题材/年份/地区/栏目）===== */
.hint.warn { color: var(--warn, #d97706); }
.mapping-line {
  color: var(--accent, #2563eb);
  font-size: 12px;
  margin: 4px 0 0;
  word-break: break-all;
}
.map-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.map-table h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text);
}
.map-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.map-table th, .map-table td {
  border-bottom: 1px solid var(--line, rgba(128,128,128,0.2));
  padding: 4px 6px;
  text-align: left;
}
.map-table th { color: var(--muted); font-weight: 500; }
.map-table td.map-id {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--accent, #2563eb);
  width: 72px;
}
.map-table tr.map-fallback td { color: var(--warn, #d97706); }
/* 采集器会自动用到的 ID：淡底色 + 左侧竖条，一眼看出哪些是"活的" */
.map-table tr.map-use td { background: rgba(37, 99, 235, 0.07); }
.map-table tr.map-use td:first-child { box-shadow: inset 3px 0 0 var(--accent, #2563eb); }
.map-table tr.map-use td.map-id { font-weight: 600; }
/* 后台有、但程序不选的项：灰掉 */
.map-table tr:not(.map-use):not(.map-fallback) td { color: var(--muted); }
.map-table .map-tag {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(128,128,128,0.3));
  color: var(--muted);
  white-space: nowrap;
}
.map-legend {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
  grid-column: 1 / -1; /* 说明文字要横跨整行，不能占掉表格的格子 */
}
/* 已停用但"重开就自动生效"的那些选项 */
.map-optional {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0.85;
}

/* ===== 写入后台（手动指定四个后台 ID）===== */
.force-row {
  border-top: 1px solid var(--line, rgba(128,128,128,0.2));
  margin-top: 12px;
  padding-top: 10px;
}
.force-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.force-title strong { font-size: 13px; }
.force-title .hint { margin: 0; flex: 1 1 320px; }
.force-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
/* ===== 本批会写进后台的四个筛选框（逐行显示：后台项 ← 源站哪个框给的）===== */
#batchPreview { line-height: 1.9; }
#batchPreview .bp-title { display: block; margin-bottom: 2px; }
#batchPreview .bp-row {
  display: block;
  font-size: 12px;
  color: var(--accent, #2563eb);
  padding-left: 4px;
  word-break: break-all;
}
#batchPreview .bp-row b { color: var(--muted); font-weight: 500; margin-right: 4px; }
#batchPreview .bp-from { color: var(--muted); margin-left: 6px; }
#batchPreview .bp-hint { display: block; margin-top: 4px; }

/* ===== 同片检测：卡片上的"后台已有"标记 ===== */
.poster.is-dup { outline: 2px solid var(--warn, #d97706); outline-offset: -2px; border-radius: 8px; }
.dup-tag {
  position: absolute;
  left: 4px;
  top: 4px;
  max-width: calc(100% - 8px);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.6;
  color: #fff;
  background: rgba(217, 119, 6, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dup-tag.same { background: rgba(107, 114, 128, 0.92); }
#dupInfo { margin: 6px 0 0; }

/* ===== 自动翻页：页面内确认面板 + 后台运行进度条 ===== */
.auto-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warn, #d97706);
  border-radius: 10px;
  background: rgba(217, 119, 6, 0.07);
}
.auto-panel .auto-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auto-panel .auto-head strong { font-size: 13px; }
.auto-panel .auto-head button { margin-left: auto; }
.auto-detail {
  margin: 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow: auto;
  color: var(--text);
  font-family: inherit;
}
.auto-panel .auto-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.auto-running {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.4);
  font-size: 12px;
  color: var(--accent, #2563eb);
}
.auto-running .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  animation: autoPulse 1.2s ease-in-out infinite;
}
@keyframes autoPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.auto-running .spacer { flex: 1; }
.force-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.force-field select { min-width: 200px; }
.mapping-line.warn { color: var(--warn, #d97706); }
#forceInfo { margin: 8px 0 0; }
