:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --text: #e6e8ec; --mute: #8a93a3; --accent: #4f8cff; --accent2: #2f6be0;
  --err: #ff5d5d; --warn: #f2b84b; --ok: #3ccf8e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel2);
  border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: #3a4150; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent2); }
button.ghost { background: transparent; }
.hidden { display: none !important; }

.top { height: 48px; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 700; font-size: 15px; }
.brand span { color: var(--mute); font-weight: 400; margin-left: 6px; }
.title { flex: 1; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layout { display: grid; grid-template-columns: 300px 1fr 360px; height: calc(100% - 48px); }
.side, .inspector { background: var(--panel); overflow: auto; }
.side { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.inspector { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--mute); font-weight: 600; }
textarea { width: 100%; background: #12151b; color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px; font: inherit; resize: vertical; }
.compose button.primary { width: 100%; margin-top: 8px; padding: 9px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.examples button { font-size: 12px; padding: 3px 8px; color: var(--mute); }
.progress { margin-top: 10px; }
.steps div { padding: 3px 0 3px 18px; position: relative; color: var(--mute); font-size: 12px; }
.steps div::before { content: "•"; position: absolute; left: 4px; }
.steps div.cur { color: var(--text); }
.steps div.cur::before { content: ""; width: 9px; height: 9px; left: 2px; top: 8px; border: 2px solid var(--accent);
  border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.steps div.bad { color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

.projects { list-style: none; margin: 0; padding: 0; }
.projects li { padding: 8px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.projects li:hover { background: #252a35; }
.projects li.on { background: #263453; }
.projects .pt { display: flex; justify-content: space-between; gap: 6px; }
.projects .pt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects .ps { color: var(--mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects .del { padding: 0 6px; border: none; background: none; color: var(--mute); visibility: hidden; }
.projects li:hover .del { visibility: visible; }
.badge { font-size: 11px; padding: 0 6px; border-radius: 9px; background: #2a2f3a; color: var(--mute); }
.badge.err { background: rgba(255,93,93,.15); color: var(--err); }
.badge.warn { background: rgba(242,184,75,.15); color: var(--warn); }
.badge.ok { background: rgba(60,207,142,.15); color: var(--ok); }
.badge.run { background: rgba(79,140,255,.15); color: var(--accent); }

.stage { display: flex; flex-direction: column; min-width: 0; }
.viewer-wrap { flex: 1; position: relative; background: #000; min-height: 0; display: flex; align-items: center; justify-content: center; }
#view { display: block; width: 100%; height: 100%; }
.hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none;
  font: 12px/1.4 ui-monospace, Menlo, monospace; color: #fff; text-shadow: 0 1px 2px #000; }
.hud-right { text-align: right; }
.viewbar { position: absolute; bottom: 10px; left: 12px; display: flex; gap: 6px; align-items: center; }
.seg { background: rgba(20,22,28,.8); padding: 4px 10px; font-size: 12px; }
.seg.on { background: var(--accent); border-color: var(--accent); }
.chk { display: inline-flex; gap: 4px; align-items: center; color: var(--mute); font-size: 12px; background: rgba(20,22,28,.6);
  padding: 3px 8px; border-radius: 6px; }
#btnExport { font-size: 12px; padding: 4px 10px; background: rgba(20,22,28,.8); }
#btnExport:hover { background: rgba(79,140,255,.2); border-color: var(--accent); }
#btnExport:disabled { opacity: 0.6; }
.empty { position: absolute; color: var(--mute); }

.transport { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.icon { padding: 4px 10px; }
.icon.big { font-size: 16px; padding: 4px 16px; }
.time { font: 12px ui-monospace, Menlo, monospace; color: var(--mute); width: 130px; }
.scrub { flex: 1; height: 6px; background: #2a2f3a; border-radius: 3px; position: relative; cursor: pointer; }
.scrub-fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0; }
.scrub-head { position: absolute; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-left: -7px; left: 0; }
select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px; }

.timeline { height: 96px; background: var(--panel); border-top: 1px solid var(--line); display: flex; gap: 2px; padding: 8px 12px; overflow-x: auto; }
.clip { flex: none; height: 100%; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); padding: 6px 8px;
  cursor: pointer; overflow: hidden; position: relative; min-width: 70px; }
.clip.on { border-color: var(--accent); background: #213052; }
.clip .cn { font-weight: 700; }
.clip .cd { color: var(--mute); font-size: 11px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clip .cm { position: absolute; bottom: 4px; left: 8px; right: 8px; display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); }
.clip .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.clip.scene-start { margin-left: 10px; }
.clip.scene-start::before { content: attr(data-scene); position: absolute; top: 0; right: 6px; font-size: 10px; color: var(--accent); }
.clip .err-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.clip .warn-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: none; border-radius: 0; background: none; padding: 10px 0; color: var(--mute); border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab b { color: var(--warn); font-weight: 600; }
.tabpane { padding: 12px; overflow: auto; flex: 1; }
#tab-json { display: flex; flex-direction: column; gap: 8px; }
#jsonEdit { flex: 1; min-height: 300px; font: 12px/1.45 ui-monospace, Menlo, monospace; white-space: pre; }
.row { display: flex; gap: 8px; align-items: center; }
#jsonMsg { color: var(--mute); font-size: 12px; }

.kv { display: grid; grid-template-columns: 76px 1fr; gap: 4px 8px; margin-bottom: 12px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }
.sec { margin: 14px 0 6px; color: var(--mute); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.list li .t { color: var(--mute); font: 12px ui-monospace, Menlo, monospace; width: 44px; flex: none; }
.list li.now { color: #fff; }
.list li.now .t { color: var(--accent); }
.issue { padding: 8px; border-radius: 6px; background: var(--panel2); margin-bottom: 6px; border-left: 3px solid var(--mute); cursor: pointer; }
.issue.error { border-left-color: var(--err); }
.issue.warning { border-left-color: var(--warn); }
.issue .ic { font: 11px ui-monospace, Menlo, monospace; color: var(--mute); }
.issue .ih { color: var(--mute); font-size: 12px; margin-top: 2px; }
.prompt { background: var(--panel2); padding: 10px; border-radius: 6px; white-space: pre-wrap; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 12px; }
.chip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.okbox { color: var(--ok); padding: 10px; }

.top-actions { display: flex; gap: 8px; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; max-width: 420px; box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 50; }
.toast ul { margin: 6px 0 0; padding-left: 18px; color: var(--mute); }
.clip .frame-dot { position: absolute; top: 6px; right: 18px; font-size: 10px; color: var(--warn); }
.scorebar { height: 6px; border-radius: 3px; background: #2a2f3a; overflow: hidden; margin-top: 4px; }
.scorebar i { display: block; height: 100%; }

.subtitle { position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); max-width: 80%; text-align: center;
  background: rgba(0,0,0,.6); color: #fff; padding: 6px 14px; border-radius: 6px; font-size: 16px; pointer-events: none; }
.subtitle b { color: #ffd34d; font-weight: 600; }

.issue { position: relative; padding-right: 58px; }
.fixbtn { position: absolute; right: 8px; top: 8px; font-size: 12px; padding: 2px 10px; background: #263453; border-color: #34508a; }
.fixbtn:hover { background: var(--accent); }

/* account, feedback, group modals */
.modal-mask { position: fixed; inset: 0; background: rgba(5,7,10,.72); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 380px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal label { display: flex; flex-direction: column; gap: 4px; color: var(--mute); }
.modal input:not([type=checkbox]) { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--accent); }
.modal .chk { flex-direction: row; align-items: center; }
.modal p { margin: 0; }
.seg-row { display: flex; gap: 6px; }
.seg-row .seg { flex: 1; }
.err { color: var(--err); min-height: 1em; }
.hint { color: var(--mute); font-size: 12px; }
.wx { color: var(--ok); font-size: 15px; user-select: all; }
.who { color: var(--mute); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-link { color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }
.ghost-link:hover { border-color: #3a4150; }
#tab-adjust { display: flex; flex-direction: column; gap: 10px; }
#tab-adjust.hidden { display: none !important; }
