:root {
  --bg: #070d18;
  --bg-2: #0b1424;
  --panel: #101b2c;
  --panel-2: #16233a;
  --panel-3: #1b2a44;
  --line: rgba(94, 132, 196, 0.20);
  --line-strong: rgba(94, 132, 196, 0.40);
  --text: #e9f0fc;
  --muted: #8ba0c2;
  --dim: #64789a;
  --green: #3fd6a8;
  --blue: #5b8cff;
  --amber: #f0b64a;
  --pink: #ff7a9c;
  --danger: #ff6a6a;
  --violet: #a58bff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(3, 8, 18, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0.2px; }
p { margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }

/* ---------- 低多边形背景 ---------- */
.bg-shapes { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-shapes .shape { position: absolute; display: block; opacity: 0.5; }
.bg-shapes .s1 { width: 520px; height: 520px; top: -230px; right: -130px; background: linear-gradient(150deg, rgba(63,214,168,0.15), rgba(91,140,255,0.04)); clip-path: polygon(50% 0, 100% 38%, 78% 100%, 18% 88%, 0 30%); }
.bg-shapes .s2 { width: 440px; height: 440px; bottom: -190px; left: -150px; background: linear-gradient(40deg, rgba(91,140,255,0.16), rgba(63,214,168,0.03)); clip-path: polygon(20% 0, 90% 12%, 100% 70%, 46% 100%, 0 66%); }
.bg-shapes .s3 { width: 250px; height: 250px; top: 44%; left: 47%; background: rgba(240,182,74,0.05); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

.app { position: relative; z-index: 1; max-width: 1620px; margin: 0 auto; padding: 16px 20px 20px; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 18px; background: linear-gradient(120deg, rgba(22,35,58,0.92), rgba(16,27,44,0.92)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 290px; }
.logo { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; background: rgba(91,140,255,0.10); border: 1px solid var(--line-strong); border-radius: 12px; }
.logo svg { width: 26px; height: 26px; }
.brand-text h1 { font-size: 16px; }
.brand-text p { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 3px; background: rgba(7,13,24,0.6); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); transition: all .18s; }
.tab:hover { color: var(--text); background: rgba(91,140,255,0.08); }
.tab.active { color: #fff; background: linear-gradient(120deg, rgba(91,140,255,0.9), rgba(63,214,168,0.75)); box-shadow: 0 4px 14px rgba(91,140,255,0.3); }
.top-status { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge { display: inline-block; padding: 4px 10px; border: 1px solid rgba(63,214,168,0.35); border-radius: 999px; background: rgba(63,214,168,0.10); color: var(--green); font-size: 12px; }
.badge.soft { border-color: var(--line); color: var(--muted); background: rgba(91,140,255,0.06); }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

/* ---------- 视图 ---------- */
.workspace { margin-top: 16px; }
.view { display: none; }
.view.active { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 0 16px; flex-wrap: wrap; }
.view-head h2 { font-size: 19px; }
.view-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- 面板 ---------- */
.pane { background: linear-gradient(160deg, rgba(22,35,58,0.85), rgba(16,27,44,0.88)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pane-head h2 { font-size: 15px; }
.hint-inline { font-size: 12px; color: var(--dim); }
.req { color: var(--pink); }

/* ---------- 工作台三栏 ---------- */
.studio-grid { display: grid; grid-template-columns: 330px minmax(360px, 1fr) 400px; gap: 14px; align-items: start; }
@media (max-width: 1320px) { .studio-grid { grid-template-columns: 320px 1fr; } .preview-pane { grid-column: 1 / -1; } }
@media (max-width: 860px) { .studio-grid { grid-template-columns: 1fr; } }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=password], .field input:not([type]), .field textarea, .field select,
.modal input[type=text], .modal input[type=password], .modal input:not([type]), .modal textarea, .modal select {
  width: 100%; padding: 9px 11px; background: rgba(7,13,24,0.65); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); outline: none; transition: border-color .18s;
}
.field input:focus, .field textarea:focus, .field select:focus, .modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--blue); }
.field textarea { resize: vertical; line-height: 1.6; }
.field-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 11px; color: var(--dim); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.text-btn { border: 0; background: none; color: var(--blue); padding: 0; font-size: 11px; }
.text-btn:hover { text-decoration: underline; }

/* ---------- 按钮 ---------- */
.primary-btn { padding: 10px 16px; border: 0; border-radius: var(--radius-sm); color: #fff; background: linear-gradient(120deg, #5b8cff, #3fd6a8); font-weight: 600; box-shadow: 0 6px 18px rgba(91,140,255,0.25); transition: transform .15s, opacity .15s; }
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.primary-btn.block { display: block; width: 100%; }
.ghost-btn { padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: rgba(91,140,255,0.06); color: var(--text); }
.ghost-btn:hover { background: rgba(91,140,255,0.14); }
.ghost-btn.small { padding: 6px 10px; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(91,140,255,0.08); color: var(--text); }
.icon-btn:hover { background: rgba(91,140,255,0.18); }
.file-label { display: inline-block; cursor: pointer; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.check-line input { accent-color: var(--green); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.tip-line { margin-top: 10px; font-size: 12px; color: var(--dim); line-height: 1.6; }

/* ---------- 素材选择条 ---------- */
.mat-strip { display: flex; flex-wrap: wrap; gap: 8px; min-height: 62px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: rgba(7,13,24,0.35); }
.mat-chip { position: relative; width: 62px; height: 62px; border-radius: 9px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--panel-3); }
.mat-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-chip.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(63,214,168,0.25); }
.mat-chip .chk { position: absolute; top: 2px; right: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--green); color: #071018; font-size: 12px; font-weight: 700; display: none; place-items: center; }
.mat-chip.selected .chk { display: grid; }
.mat-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mat-empty { color: var(--dim); font-size: 12px; align-self: center; }

/* ---------- 分镜列表 ---------- */
.scene-list { min-height: 380px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.scene-item { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(7,13,24,0.4); }
.scene-item.dragging { opacity: 0.4; }
.scene-thumb { width: 90px; height: 58px; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, var(--panel-3), var(--panel-2)); display: grid; place-items: center; }
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-thumb .no { color: var(--muted); font-size: 20px; font-weight: 700; }
.scene-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.scene-text { width: 100%; padding: 5px 8px; background: rgba(22,35,58,0.8); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-size: 13px; }
.scene-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.scene-controls select, .scene-controls input { padding: 3px 7px; background: rgba(7,13,24,0.7); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 11px; }
.scene-controls input { width: 52px; }
.scene-del { border: 0; background: none; color: var(--pink); font-size: 12px; margin-left: auto; }
.scene-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- 预览 ---------- */
.preview-box { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #050a12; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center; }
.preview-box canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.preview-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--dim); background: rgba(7,13,24,0.6); }
.preview-placeholder .play-icon { font-size: 34px; color: var(--muted); }
.player-bar { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.player-bar input[type=range] { flex: 1; accent-color: var(--green); }
.time-label { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.render-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.progress-track { flex: 1; height: 7px; border-radius: 99px; background: rgba(7,13,24,0.8); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .15s; }
.render-actions { margin-top: 4px; }

/* ---------- 作品库 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 280px; max-width: 100%; padding: 8px 12px; background: rgba(7,13,24,0.65); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); }
.filters { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(7,13,24,0.5); }
.filter { padding: 5px 13px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; }
.filter.active { color: #fff; background: rgba(91,140,255,0.25); }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.work-card { background: linear-gradient(160deg, rgba(22,35,58,0.85), rgba(16,27,44,0.9)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s; }
.work-card:hover { transform: translateY(-3px); }
.work-cover { position: relative; aspect-ratio: 16/9; background: var(--panel-3); overflow: hidden; }
.work-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-cover .status-tag { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: rgba(7,13,24,0.8); color: var(--green); }
.work-cover .status-tag.draft { color: var(--amber); }
.work-cover .star { position: absolute; top: 8px; right: 8px; border: 0; background: rgba(7,13,24,0.75); color: var(--amber); width: 28px; height: 28px; border-radius: 50%; }
.work-body { padding: 12px 14px; }
.work-body h3 { font-size: 14px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-body p { font-size: 12px; color: var(--muted); height: 36px; overflow: hidden; }
.work-meta { display: flex; gap: 12px; margin-top: 10px; font-size: 11px; color: var(--dim); }
.work-actions { display: flex; gap: 8px; margin-top: 12px; }
.work-actions button { flex: 1; padding: 6px; font-size: 12px; }

/* ---------- 素材库 ---------- */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.mat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mat-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--panel-3); }
.mat-card .info { padding: 10px 12px; }
.mat-card .info strong { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-card .info span { font-size: 11px; color: var(--dim); }
.mat-card .del { margin-top: 8px; width: 100%; padding: 5px; border: 1px solid rgba(255,106,106,0.3); border-radius: 7px; background: rgba(255,106,106,0.08); color: var(--danger); font-size: 12px; }

/* ---------- 看板 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { padding: 18px; background: linear-gradient(150deg, rgba(22,35,58,0.9), rgba(16,27,44,0.9)); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { font-size: 30px; font-weight: 700; margin: 6px 0 2px; }
.stat-card .sub { font-size: 11px; color: var(--dim); }
.stat-card.c1 .value { color: var(--blue); }
.stat-card.c2 .value { color: var(--green); }
.stat-card.c3 .value { color: var(--amber); }
.stat-card.c4 .value { color: var(--violet); }
.board-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .board-cols { grid-template-columns: 1fr; } }
.log-list { max-height: 360px; overflow-y: auto; }
.log-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.log-item time { color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-item .tag { color: var(--blue); }
.log-item .text { color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; color: var(--dim); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 9px 8px; border-bottom: 1px solid rgba(94,132,196,0.08); color: var(--muted); }
.data-table td.ok { color: var(--green); }
.empty-state { display: grid; place-content: center; justify-items: center; gap: 6px; min-height: 160px; color: var(--dim); text-align: center; }
.empty-state strong { color: var(--muted); font-size: 14px; }
.empty-state span { font-size: 12px; }
.empty-state.small { min-height: 100px; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.deploy-card { margin-top: 14px; }
.deploy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.deploy-item { padding: 10px 12px; background: rgba(7,13,24,0.45); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.deploy-item.span2 { grid-column: 1 / -1; }
.deploy-item span { display: block; font-size: 11px; color: var(--dim); }
.deploy-item strong { font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(3,8,18,0.78); backdrop-filter: blur(4px); }
.modal-box { position: relative; width: 100%; max-width: 560px; max-height: 84vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-box.wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.mat-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pick-card { border: 2px solid transparent; border-radius: 9px; overflow: hidden; cursor: pointer; background: var(--panel-2); }
.pick-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.pick-card .name { padding: 5px 7px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-card.selected { border-color: var(--green); }

/* ---------- 版权栏（显著） ---------- */
.copyright-bar { margin-top: 18px; padding: 14px 18px; border: 1px solid rgba(63,214,168,0.28); border-radius: var(--radius); background: linear-gradient(100deg, rgba(63,214,168,0.10), rgba(91,140,255,0.08)); text-align: center; }
.copyright-inner { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.copyright-mark { color: var(--green); font-size: 17px; }
.copyright-main { font-size: 15px; color: #fff; letter-spacing: 0.5px; }
.copyright-sep { color: var(--dim); }
.copyright-sub { font-size: 12px; color: var(--muted); }
.copyright-version { font-size: 11px; color: var(--dim); margin-left: 8px; }

/* ---------- 提示 ---------- */
.toast { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 100; padding: 11px 20px; border-radius: 10px; background: rgba(16,27,44,0.96); border: 1px solid var(--line-strong); box-shadow: var(--shadow); color: var(--text); font-size: 13px; }
.toast.error { border-color: rgba(255,106,106,0.55); color: #ffc7c7; }
.toast.success { border-color: rgba(63,214,168,0.55); color: #bff7e5; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(94,132,196,0.3); border-radius: 99px; }
