:root {
  --primary: #5b5ce2;
  --primary-dark: #4647c9;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a8f99;
  --border: #e8eaf0;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 35, 41, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
body.loading { visibility: hidden; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6vw; height: 64px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, #5b5ce2, #a855f7); }
.nav-right { display: flex; align-items: center; gap: 18px; font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
  padding: 10px 20px; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ---------- 首页 ---------- */
.hero {
  padding: 90px 6vw 70px; text-align: center;
  background: radial-gradient(1000px 400px at 50% -10%, rgba(91,92,226,.18), transparent 70%);
}
.hero h1 { font-size: 44px; line-height: 1.25; margin-bottom: 18px; }
.hero h1 .grad { background: linear-gradient(90deg, #5b5ce2, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 34px; line-height: 1.8; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 30px 6vw 80px; max-width: 1100px; margin: 0 auto; }
.feature-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; text-align: left; }
.feature-card .icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(91,92,226,.1); margin-bottom: 16px; }
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ---------- 表单卡片 ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 64px); padding: 40px 16px; }
.auth-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; font-family: inherit;
  background: #fbfbfe; transition: border-color .2s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.field textarea { resize: vertical; min-height: 80px; }
.form-err { color: #e5484d; font-size: 13px; min-height: 18px; margin-bottom: 10px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.full { width: 100%; }

/* ---------- 工作台 ---------- */
.workbench { max-width: 1200px; margin: 0 auto; padding: 30px 4vw 60px; display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .workbench { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.panel h3 { font-size: 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.result-empty { text-align: center; color: var(--muted); padding: 70px 20px; font-size: 14px; }
.result-empty .big { font-size: 44px; margin-bottom: 12px; }

.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.result-title { font-size: 18px; font-weight: 700; line-height: 1.5; }
.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(91,92,226,.1); color: var(--primary); white-space: nowrap; }
.badge.gray { background: #f0f1f5; color: var(--muted); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { padding: 9px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.speech-line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); font-size: 14px; line-height: 1.8; }
.speech-line:last-child { border-bottom: none; }
.speech-line .no { flex: none; width: 26px; height: 26px; border-radius: 8px; background: rgba(91,92,226,.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

.board-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.board-table th, .board-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.6; }
.board-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #f0f1f5; border-radius: 999px; padding: 6px 14px; font-size: 13px; }

/* 分镜预览播放器 */
.player { border-radius: 12px; overflow: hidden; background: #111; color: #fff; margin-bottom: 18px; }
.player-screen { aspect-ratio: 9/13; max-height: 340px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; background: linear-gradient(160deg, #2b2d5c, #111 70%); }
.player-screen .scene { font-size: 13px; color: #9ea2ff; margin-bottom: 10px; }
.player-screen .visual { font-size: 15px; line-height: 1.7; margin-bottom: 8px; }
.player-screen .time { font-size: 12px; color: rgba(255,255,255,.5); }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; }
.player-bar .progress { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
.player-bar .progress i { display: block; height: 100%; background: #7b7dff; width: 0; transition: width .3s; }
.play-btn { background: none; border: none; color: #fff; font-size: 18px; }

/* 历史记录 */
.history-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.history-item:hover .h-title { color: var(--primary); }
.history-item:last-child { border-bottom: none; }
.h-thumb { flex: none; width: 46px; height: 60px; border-radius: 8px; background: linear-gradient(160deg, #5b5ce2, #a855f7); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.h-main { flex: 1; min-width: 0; }
.h-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.h-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.h-del { flex: none; background: none; border: none; color: var(--muted); font-size: 16px; padding: 6px; }
.h-del:hover { color: #e5484d; }

.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 10px 22px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 99; }
.toast.show { opacity: .95; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* 真视频合成 */
.media-panel { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; padding: 14px 16px; background: linear-gradient(135deg, rgba(91,92,226,.06), rgba(168,85,247,.06)); border: 1px solid var(--border); border-radius: 12px; }
.media-status { font-size: 13px; color: var(--muted); }
.media-status.doing { color: var(--primary); }
.media-status.ok { color: #16a34a; }
.media-status.err { color: #e5484d; }
.media-fallback { flex-basis: 100%; font-size: 12px; color: #d97706; }
.video-wrap { margin: 0 0 16px; }
.video-wrap video { width: 100%; max-height: 460px; background: #000; border-radius: 12px; display: block; }
.video-actions { margin-top: 10px; display: flex; gap: 10px; }
.video-actions .btn { display: inline-block; }
