:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1d2530;
  --text: #eef2f7;
  --muted: #93a0af;
  --line: #2b3542;
  --green: #18c46b;
  --gold: #d2a84e;
  --danger: #ff5964;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
button:hover { border-color: var(--green); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--green); border-color: var(--green); color: #07130d; font-weight: 800; }
.dirty-dot { display: inline-block; width: 8px; height: 8px; margin-left: 7px; border-radius: 50%; background: #ffd44d; box-shadow: 0 0 0 2px rgba(0,0,0,.2); vertical-align: middle; }
.save-status { color: var(--muted); font-size: 12px; font-weight: 800; }
a { color: inherit; }
.brand-link { color: var(--text); font-weight: 900; text-decoration: none; }
.brand-link:hover { color: #a8ffca; }
button.wide { width: 100%; margin-bottom: 8px; text-align: left; }
input, select, textarea { width: 100%; background: #0b0f15; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { resize: vertical; line-height: 1.45; min-height: 180px; }
.caption-textarea { min-height: 88px; }
.hidden { display: none !important; }
.login { min-height: 100vh; display: grid; place-items: center; }
.auth-shell { width: min(440px, calc(100vw - 32px)); }
.auth-shell .login-card { width: 100%; }
.login-card { width: min(380px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 28px; }
.login-card p, small { color: var(--muted); margin: 0; }
.login-card label { display: grid; gap: 6px; color: var(--muted); }
.app { height: 100vh; min-height: 0; display: grid; grid-template-columns: 260px 1fr 320px; overflow: hidden; }
.left-panel, .right-panel { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.right-panel { border-right: 0; border-left: 1px solid var(--line); }
.brand-row, .section-head, .topbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.side-nav { display: grid; gap: 8px; margin-top: 16px; }
.side-nav a { text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #0f141b; color: var(--muted); }
.side-nav a:hover, .side-nav a.active { color: var(--text); border-color: var(--green); }
.profile-context { display: grid; gap: 6px; margin-top: 14px; }
.profile-context label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.profile-context select { background: #0b0f15; border-color: var(--green); font-weight: 800; }
section { margin-top: 18px; }
.section-head { margin-bottom: 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.scene-list { display: grid; gap: 8px; }
.template-select { margin-bottom: 8px; }
.template-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.list-item { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #0f141b; cursor: pointer; }
.list-item.active { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.list-item.dragging { opacity: .55; border-style: dashed; }
.list-item small { display: block; margin-top: 4px; }
.mini-actions { display: flex; gap: 6px; margin-top: 8px; }
.mini-actions button { padding: 4px 7px; font-size: 12px; }
.stage-wrap { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr 160px; }
.topbar { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #0f141b; justify-content: flex-start; }
.topbar input { max-width: 260px; }
.topbar select { max-width: 140px; }
.stage-shell { overflow: auto; display: grid; place-items: center; padding: 18px; position: relative; min-height: 0; }
.stage { width: 405px; height: 720px; position: relative; background: #111827; outline: 1px solid #3b4655; box-shadow: 0 24px 80px rgba(0,0,0,.45); overflow: hidden; --guide-image: none; --guide-opacity: .45; }
.stage.has-guide::after { content: ""; position: absolute; inset: 0; background-image: var(--guide-image); background-size: contain; background-position: center; background-repeat: no-repeat; opacity: var(--guide-opacity); pointer-events: none; z-index: 50; }
.stage-guide { position: absolute; pointer-events: none; z-index: 2000; background: rgba(24,196,107,.34); }
.stage-guide.v { top: 0; bottom: 0; left: 50%; width: 1px; }
.stage-guide.h { left: 0; right: 0; top: 50%; height: 1px; }
.element { position: absolute; border: 1px dashed transparent; display: grid; place-items: center; user-select: none; cursor: move; transform-origin: center; }
.element.selected { border-color: var(--green); }
.element.text, .element.hook_title, .element.subtitles, .element.bullet_list, .element.question { white-space: pre-wrap; text-align: center; font-weight: 900; line-height: 1.05; padding: 8px; }
.element.media { background: linear-gradient(145deg, rgba(24,196,107,.25), rgba(210,168,78,.18)); border: 1px solid rgba(255,255,255,.28); }
.element.logo { color: var(--gold); border: 1px solid rgba(210,168,78,.4); font-weight: 900; letter-spacing: .12em; }
.element.sound { background: rgba(128,90,213,.75); border: 1px solid rgba(255,255,255,.35); color: #fff; font-weight: 800; }
.handle { position: absolute; width: 14px; height: 14px; right: -7px; bottom: -7px; border-radius: 50%; background: var(--green); border: 2px solid #08120d; cursor: nwse-resize; }
.center-dot { position: absolute; width: 10px; height: 10px; left: 50%; top: 50%; transform: translate(-50%,-50%); border-radius: 50%; background: var(--green); border: 2px solid #07130d; z-index: 5; }
.center-line { position: absolute; background: rgba(24,196,107,.55); pointer-events: none; }
.center-line.x { left: -18px; right: -18px; top: 50%; height: 1px; }
.center-line.y { top: -18px; bottom: -18px; left: 50%; width: 1px; }
.scope-badge { position: absolute; left: 6px; top: 6px; padding: 2px 5px; border-radius: 4px; background: rgba(24,196,107,.9); color: #06110b; font: 800 10px/1 Inter, Arial, sans-serif; -webkit-text-stroke: 0 transparent; }
.floating-panel { position: absolute; width: 260px; max-height: 430px; z-index: 3000; background: rgba(15,20,27,.96); border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(0,0,0,.42); border-radius: 10px; overflow: hidden; }
.floating-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #151b23; border-bottom: 1px solid var(--line); cursor: move; }
.floating-panel-head button { padding: 4px 8px; font-size: 12px; }
.floating-panel-body { padding: 10px; overflow: auto; max-height: 370px; }
.json-preview { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line); background: #080b10; color: #a8ffca; overflow: auto; font-size: 12px; }
.inspector { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact { margin-top: 14px; }
.layer-list { display: grid; gap: 6px; }
.layer-item { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; text-align: left; gap: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 7px; cursor: pointer; }
.layer-item.active { border-color: var(--green); }
.layer-item.is-hidden { opacity: .62; }
.layer-item span:not(.eye-spacer) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-item small { color: var(--muted); white-space: nowrap; }
.eye-btn { padding: 4px 6px; border-radius: 6px; font-size: 11px; line-height: 1; text-align: center; }
.eye-spacer { display: block; width: 30px; height: 1px; }
.advanced { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #10161e; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.advanced .field { margin-top: 10px; }
.danger { color: #fff; background: #42171b; border-color: #80323a; }
.dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.dashboard-sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; }
.dashboard-main { margin-top: 0; padding: 34px; overflow: auto; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.page-head h1 { margin: 2px 0 0; font-size: 34px; }
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 8px 12px; text-decoration: none; }
.primary-link { background: var(--green); color: #07130d; border-color: var(--green); font-weight: 800; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.compact-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.home-card, .project-card, .empty-panel, .panel-form { display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; text-decoration: none; }
.home-card:hover { border-color: var(--green); }
.home-card strong, .project-card strong { font-size: 18px; }
.home-card span, .project-card span, .empty-panel p, .status-line { color: var(--muted); }
.project-card { position: relative; align-content: start; }
.project-card.is-current { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.project-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.project-card-title { min-width: 0; display: grid; gap: 4px; }
.project-card-title strong { overflow-wrap: anywhere; }
.project-number { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border-radius: 999px; background: #101713; border: 1px solid rgba(24,196,107,.45); color: #a8ffca; font-weight: 900; white-space: nowrap; }
.project-select { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.project-select input { width: 16px; height: 16px; accent-color: var(--green); }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.project-actions button { padding: 7px 9px; font-size: 13px; }
.batch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: -2px 0 14px; }
.panel-form { margin-bottom: 0; }
.settings-form { max-width: 900px; }
.admin-license-form { max-width: 720px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.admin-section { margin-top: 28px; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); }
.admin-table th, .admin-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.admin-table tr:last-child td { border-bottom: 0; }
.license-features { display: grid; gap: 6px; min-width: 170px; }
.license-features label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.license-features input { width: 16px; height: 16px; accent-color: var(--green); }
.hint-line { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.generate-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: 22px; align-items: start; margin-bottom: 24px; }
.script-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: start; }
.shortcode-panel { border: 1px solid var(--line); border-radius: 8px; background: #0f141b; padding: 10px; max-height: 360px; overflow: auto; }
.shortcode-head { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.shortcode-list { display: grid; gap: 10px; }
.shortcode-group { display: grid; gap: 6px; }
.shortcode-group strong { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.shortcode-chip { text-align: left; padding: 6px 8px; font-size: 12px; border-radius: 7px; overflow-wrap: anywhere; }
.generate-preview { display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.preview-video-wrap { overflow: hidden; border-radius: 8px; background: #050608; aspect-ratio: 9 / 16; }
.preview-video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; }
.caption-preview-frame { position: relative; overflow: hidden; border-radius: 8px; background: #050608; aspect-ratio: 9 / 16; }
.caption-preview-frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
.caption-preview-frame div { position: absolute; left: 50%; top: 61.5%; transform: translate(-50%, -50%); color: #fff; -webkit-text-stroke: 2px #000; text-shadow: 0 2px 0 #000; font: 900 32px/1 Bangers, Impact, sans-serif; pointer-events: none; }
.video-link { color: #67e49f; font-weight: 800; text-decoration: none; }
.run-status { display: grid; gap: 10px; }
.run-log { min-height: 70px; border-radius: 8px; padding: 12px; background: #101713; color: #cbd8cf; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; white-space: pre-wrap; }
.jobs-live-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 390px); gap: 22px; align-items: start; margin-bottom: 24px; }
.jobs-live-layout .run-log { min-height: 360px; }
.jobs-section { display: grid; gap: 12px; margin-top: 20px; }
.jobs-list { display: grid; gap: 10px; }
.job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.job-row strong { display: block; overflow-wrap: anywhere; }
.job-row small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.job-row.processing, .job-row.rendering, .job-row.queued { border-color: rgba(24,196,107,.45); }
.job-row.failed, .job-row.process_error, .job-row.render_error { border-color: rgba(255,96,96,.58); }
.job-badge { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: #d7e4dd; background: #101713; font-size: 12px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.media-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; margin-bottom: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.media-card { display: grid; gap: 10px; align-content: start; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-height: 132px; }
.media-card strong { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.media-card video { width: 100%; max-height: 360px; background: #050608; border-radius: 8px; }
.media-card small, .media-meta { color: var(--muted); }
.media-meta { min-height: 18px; font-size: 13px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; color: #cfe4d6; background: #101713; font-size: 12px; }
.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 22px; align-items: start; }
.minimax-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 22px; align-items: start; }
.minimax-form { max-width: none; }
.mode-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-option { display: grid; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option strong { color: var(--text); }
.mode-option small { line-height: 1.35; }
.mode-option.active { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: rgba(24,196,107,.08); }
.reference-preview { display: grid; gap: 10px; }
.reference-file { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: hidden; }
.reference-file span { color: var(--muted); overflow-wrap: anywhere; }
.reference-file audio { width: 100%; }
.error-text { color: #ff8e8e !important; }
.upload-progress { display: grid; gap: 8px; margin-top: 8px; }
.upload-file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.03); }
.upload-file-row.active { border-color: rgba(24,196,107,.65); background: rgba(24,196,107,.08); }
.upload-file-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-row span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.button-row { display: flex; justify-content: flex-end; gap: 10px; }
.status-line { min-height: 22px; margin: 0; }
.check-row { display: inline-flex; width: fit-content; align-items: center; gap: 9px; color: var(--text); font-weight: 800; }
.check-row input { width: 18px; height: 18px; accent-color: var(--green); }
.empty-panel.small { padding: 12px; }
@media (max-width: 1050px) { .app { grid-template-columns: 220px 1fr; } .right-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); } }
@media (max-width: 820px) { .dashboard-shell { grid-template-columns: 1fr; } .dashboard-sidebar { border-right: 0; border-bottom: 1px solid var(--line); } .page-head, .button-row { flex-direction: column; align-items: stretch; } .head-actions { justify-content: stretch; } .generate-layout, .jobs-live-layout, .upload-layout, .minimax-layout, .mode-picker, .form-grid, .media-toolbar, .batch-row, .script-layout, .job-row, .upload-file-row { grid-template-columns: 1fr; } .job-actions { justify-content: stretch; } }
