:root {
  --bg: #0b0d12;
  --surface: #14171f;
  --surface2: #1b1f2a;
  --surface3: #232834;
  --border: #252a36;
  --text: #e8eaef;
  --muted: #7d8595;
  --accent: #fe2c55;
  --accent-h: #e62248;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px; height: 58px;
  background: rgba(20, 23, 31, .9);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: baseline; gap: 9px; flex: none; }
.logo { font-size: 18px; font-weight: 800; letter-spacing: .4px; }
.tagline { color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; background: var(--surface2); padding: 3px; border-radius: 10px; }
.tab {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: .15s;
}
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface3); color: var(--text); font-weight: 600; }
.topright { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.dot { font-size: 15px; color: #4b5563; line-height: 1; }
.engine-text { color: var(--muted); font-size: 12.5px; }
.who {
  color: var(--muted); font-size: 12.5px; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 20px;
}
.who b { color: var(--text); font-weight: 600; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 22px 80px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.sec-head h2 { font-size: 15px; font-weight: 600; margin: 0; }

/* ---------- 输入 ---------- */
.input-panel { display: flex; gap: 14px; align-items: stretch; }
.input-panel textarea {
  flex: 1; min-height: 84px; resize: vertical; padding: 13px 15px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; outline: none; transition: border-color .15s;
}
.input-panel textarea:focus { border-color: var(--accent); }
.input-panel textarea::placeholder { color: #5a6373; }
.input-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.chk {
  display: flex; align-items: center; gap: 6px; color: var(--muted);
  font-size: 12.5px; cursor: pointer; justify-content: center;
}
.chk input { accent-color: var(--accent); }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 18px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface2); cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-tall { flex: 1; font-weight: 600; padding: 0 26px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-accent { background: #fff; border-color: #fff; color: #12151b; font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: #dfe3ea; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: #3a2630; }
.btn-danger:hover:not(:disabled) { background: #2a1a20; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }

/* ---------- 结果卡片 ---------- */
.results { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card.main { display: flex; gap: 20px; padding: 18px; }
.card-mini {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer;
}
.card-mini:hover { background: var(--surface2); }
.card-mini img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface2); }
.mini-info { flex: 1; min-width: 0; }
.mini-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { color: var(--muted); font-size: 12px; }

.stage {
  width: 280px; height: 380px; flex: none; border-radius: 10px; overflow: hidden;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  cursor: pointer; position: relative;
}
.stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img {
  width: 40px; height: 52px; object-fit: cover; border-radius: 6px;
  border: 2px solid transparent; cursor: pointer; opacity: .55; transition: .15s;
}
.thumbs img:hover, .thumbs img.on { opacity: 1; }
.thumbs img.on { border-color: var(--accent); }

.info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.title { font-size: 16px; font-weight: 600; margin: 0 0 8px; line-height: 1.5; }
.meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.author { color: var(--accent); font-weight: 600; font-size: 13px; }
.muted { color: var(--muted); font-size: 12.5px; }

.field { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 12.5px; flex: none; }
select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; min-width: 200px; outline: none; max-width: 100%;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* ---------- 进度 ---------- */
.bar { height: 7px; background: #232833; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .15s; }
.bar > i.done { background: var(--ok); }
.bar > i.fail { background: var(--err); }
.dl-box { margin-top: 14px; }
.dl-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.dl-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; }
.batch-bar { padding: 14px 18px; }

/* ---------- 历史 ---------- */
.hist-list { display: flex; flex-direction: column; }
.hist-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.hist-row:last-child { border-bottom: none; }
.hist-row:hover { background: var(--surface2); }
.hist-row img { width: 44px; height: 44px; border-radius: 7px; object-fit: cover; flex: none; background: var(--surface2); }
.hist-time { color: var(--muted); font-size: 12px; flex: none; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }

/* ---------- 用户管理 ---------- */
.add-user { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.add-user input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 13px; outline: none; min-width: 160px;
}
.add-user input:focus { border-color: var(--accent); }
.users-list { display: flex; flex-direction: column; gap: 10px; }
.user-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 16px;
}
.user-card.off { opacity: .55; }
.user-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.user-name { font-weight: 600; font-size: 14px; }
.pill {
  font-size: 11.5px; padding: 2px 9px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--muted);
}
.pill.on { color: var(--ok); border-color: #1d3a2a; background: #12210f; }
.pill.off { color: var(--err); border-color: #3a2630; background: #241419; }
.pill.admin { color: var(--accent); border-color: #3d1b26; background: #241218; }
.token-row {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  overflow: hidden;
}
.token-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.kv { display: flex; flex-direction: column; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv b { font-weight: 500; color: var(--muted); }
.linkish { color: var(--accent); cursor: pointer; font-size: 12.5px; }
.linkish:hover { text-decoration: underline; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(6, 8, 12, .8);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px); padding: 18px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 15px; padding: 26px; width: 430px; max-width: 100%;
}
.modal-box h3 { margin: 0 0 10px; font-size: 16px; }
.modal-box p { margin: 0 0 16px; line-height: 1.7; }
.modal-box input {
  width: 100%; padding: 12px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px; outline: none;
}
.modal-box input:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.modal-wide {
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px;
  width: 900px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-stage { background: #000; display: flex; align-items: center; justify-content: center; min-height: 300px; flex: 1; }
.pv-stage video { width: 100%; max-height: 72vh; display: block; }
.pv-stage img { max-width: 100%; max-height: 72vh; object-fit: contain; display: block; }
.pv-thumbs { display: flex; gap: 6px; padding: 12px 18px; overflow-x: auto; }
.pv-thumbs img {
  width: 46px; height: 60px; object-fit: cover; border-radius: 6px;
  border: 2px solid transparent; cursor: pointer; opacity: .55; flex: none;
}
.pv-thumbs img.on { border-color: var(--accent); opacity: 1; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast {
  background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: 9px; font-size: 13px; max-width: 380px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5); animation: slide .22s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .tab { flex: 1; text-align: center; padding: 7px 8px; }
  .brand .tagline { display: none; }
  .engine-text { display: none; }
  .wrap { padding: 14px 14px 60px; }
  .panel { padding: 14px; }
  .input-panel { flex-direction: column; }
  .input-actions { flex-direction: row; }
  .input-actions .btn-tall { flex: 1; padding: 10px; }
  .card.main { flex-direction: column; padding: 14px; gap: 16px; }
  .stage { width: 100%; height: 300px; }
  select { min-width: 0; width: 100%; }
  .field { flex-direction: column; align-items: stretch; gap: 6px; }
  .actions .btn { flex: 1; }
  .modal-wide { max-height: 96vh; }
}
