/* ============================================
   视频编辑器 - 样式文件
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
    background: #1a1a1a;
    color: #fff;
    overflow: hidden; /* 防止页面滚动 */
    height: 100vh; /* 固定高度 */
}

/* ============================================
   屏幕容器
   ============================================ */
.screen {
    display: none;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* 防止页面滚动 */
}

.screen.active {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止页面滚动 */
}

/* ============================================
   登录/注册界面
   ============================================ */
#loginScreen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-block {
    width: 100%;
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 13px;
}

.login-links a {
    color: #667eea;
    text-decoration: none;
}

.login-links a:hover {
    text-decoration: underline;
}

/* ============================================
   微信扫码登录
   ============================================ */
.wechat-login-box {
    text-align: center;
    padding: 8px 0 4px;
    color: #333;
}

.wechat-login-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wechatQrcodeContainer {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: inline-block;
}

#wechatQrcodeContainer iframe {
    display: block;
}

.wechat-login-status {
    margin-top: 12px;
    font-size: 13px;
    color: #555;
    min-height: 20px;
}

.wechat-login-tip {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

.btn-wechat-refresh {
    background: none;
    border: 1px solid #07c160;
    color: #07c160;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.btn-wechat-refresh:hover {
    background: #07c160;
    color: #fff;
}

/* ============================================
   主界面
   ============================================ */
.app-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* 顶部导航栏 */
.editor-header {
    height: 60px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;  /* 防止被压缩 */
}

.header-center {
    flex: 1;  /* 占据中间空间 */
    display: flex;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 24px;
    color: #667eea;
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    background: #3a3a3a;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: #4a4a4a;
}

.project-name {
    margin: 0 30px;
}

.project-name input {
    background: #1a1a1a;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    min-width: 200px;
}

.project-name input:focus {
    outline: none;
    background: #2a2a2a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #3a3a3a;
    border-radius: 6px;
}

.user-info i {
    font-size: 18px;
}

.btn-logout {
    padding: 6px;
    background: none;
    color: #999;
}

.btn-logout:hover {
    color: #fff;
}

/* 主编辑区域 */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 左侧边栏 */
.left-sidebar {
    width: 260px;
    background: #252525;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    padding: 15px;
    border-bottom: 1px solid #333;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ccc;
}

.pages-list,
.project-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-item,
.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.page-item:hover,
.project-item:hover {
    background: #3a3a3a;
}

.page-item.active {
    background: #667eea;
}

/* 页面操作按钮组（复制/删除） */
.page-actions {
    display: none;
    margin-left: auto;
    gap: 4px;
    flex-shrink: 0;
}

.page-item:hover .page-actions {
    display: flex;
}

.page-btn-copy,
.page-btn-delete {
    background: rgba(0,0,0,0.4);
    border: none;
    border-radius: 4px;
    color: #fff;
    width: 24px;
    height: 24px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.page-btn-copy:hover  { background: #667eea; }
.page-btn-delete:hover { background: #e74c3c; }

.page-thumb,
.project-thumb {
    width: 52px;
    height: 36px;       /* 约 16:9 缩略比 */
    flex-shrink: 0;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.page-thumb img,
.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 3px;
}

.page-name,
.project-name {
    font-size: 13px;
}

.project-date {
    font-size: 11px;
    color: #999;
    display: block;
}

.btn-add-page {
    width: 100%;
    margin-top: 10px;
    background: #667eea;
}

/* 中间画布区域 */
.editor-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.canvas-toolbar {
    height: 50px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.zoom-controls,
.edit-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── 对齐工具栏 ──────────────────────────────────── */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.align-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.15s;
}
.align-toolbar.active {
    opacity: 1;
    pointer-events: auto;
}

.btn-align {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #bbb;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    flex-shrink: 0;
}
.btn-align:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.18);
    border-color: rgba(102, 126, 234, 0.5);
    color: #a78bfa;
}
.btn-align:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.btn-align svg { display: block; }

/* 分隔线 */
.align-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #404040;
    margin: 0 3px;
    flex-shrink: 0;
}
/* ───────────────────────────────────────────────── */

.zoom-level {
    font-size: 13px;
    color: #ccc;
    min-width: 50px;
    text-align: center;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.time-display {
    font-size: 13px;
    color: #ccc;
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #181818;
    padding: 20px;
}

.canvas-container {
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: visible;
}

#mainCanvas {
    background: #fff;
}

/* ── Fabric.js 文本编辑器样式优化 ───────────────────────────── */
/* 防止文本编辑时页面跳动 */
.canvas-textarea-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    z-index: -9999 !important;
    opacity: 0 !important;
}

.canvas-textarea-wrapper textarea {
    position: fixed !important;
    top: 0 !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    resize: none !important;
    overflow: hidden !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: transparent !important;
    background: transparent !important;
}
/* ───────────────────────────────────────────────────────────────── */

/* 右侧边栏 */
.right-sidebar {
    width: 300px;
    background: #252525;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.sidebar-tabs {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid #333;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-bottom: 2px solid #667eea;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;  /* 防止横向溢出 */
}

.tab-pane {
    display: none;
    padding: 15px 12px 15px 15px;  /* 右侧稍小，给滚动条让路 */
}

.tab-pane.active {
    display: block;
}

/* 元素分类 */
.element-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 12px;
    background: #2a2a2a;
    border: none;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.category-btn:hover {
    color: #fff;
    background: #3a3a3a;
}

.category-btn.active {
    background: #667eea;
    color: #fff;
}

.elements-list {
    display: block;
}

.element-category-content {
    display: none;
}

.element-category-content.active {
    display: block;
}



.element-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #2a2a2a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.element-item:hover {
    background: #3a3a3a;
}

.element-item i {
    font-size: 18px;
    color: #667eea;
}

/* 动画面板 */
.animation-types {
    margin-bottom: 20px;
}

.animation-type-group {
    margin-bottom: 20px;
}

.animation-type-group h4 {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 10px;
}

.animation-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.anim-btn {
    padding: 10px;
    background: #2a2a2a;
    border: none;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.anim-btn:hover {
    background: #3a3a3a;
    color: #fff;
}

.anim-btn.selected {
    background: #667eea;
    color: #fff;
}

.animation-settings {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 8px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.setting-group input[type="number"],
.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 8px;
    background: #1a1a1a;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
}

.setting-group input[type="range"] {
    cursor: pointer;
}

.volume-value {
    font-size: 12px;
    color: #999;
    display: block;
    text-align: right;
    margin-top: 4px;
}

.btn-apply-anim {
    width: 100%;
    background: #667eea;
}

/* 音乐面板 */
.music-upload {
    margin-bottom: 20px;
}

.upload-area {
    background: #2a2a2a;
    border: 2px dashed #3a3a3a;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #667eea;
}

.upload-area i {
    font-size: 36px;
    color: #667eea;
    margin-bottom: 10px;
}

.upload-area h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.upload-area p {
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
}

.btn-upload-music {
    background: #667eea;
}

.music-settings {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.music-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #3a3a3a;
}

.music-icon {
    width: 40px;
    height: 40px;
    background: #667eea;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-details {
    flex: 1;
    min-width: 0;
}

.music-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-duration {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.btn-remove-music {
    padding: 6px;
    background: #ff4757;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.music-preview {
    display: flex;
    gap: 8px;
}

.btn-play-music {
    flex: 1;
    background: #2ed573;
}

.music-library h4 {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 10px;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.library-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 6px;
}

.library-item span {
    flex: 1;
    font-size: 13px;
}

.library-item .btn {
    padding: 6px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 900px;
}

.modal-full {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #333;
}

.modal-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #fff;
}


.modal-body {
    padding: 20px;
}

/* 导出设置 */
.export-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.export-progress {
    margin-bottom: 20px;
}

.progress-bar {
    height: 20px;
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    display: block;
    text-align: center;
    font-size: 12px;
    color: #ccc;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel {
    background: #ff4757;
    color: #fff;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .left-sidebar {
        width: 200px;
    }
    
    .right-sidebar {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .editor-header {
        padding: 0 10px;
    }
    
    .logo h1 {
        display: none;
    }
    
    .project-name {
        display: none;
    }
    
    .left-sidebar,
    .right-sidebar {
        display: none;
    }
    
    .canvas-toolbar {
        padding: 0 10px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* ============================================
   重构后的属性面板
   ============================================ */
.prop-section {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.prop-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prop-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.prop-row:last-child { margin-bottom: 0; }

.prop-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prop-field label {
    font-size: 11px;
    color: #888;
}

.prop-field input,
.prop-field select {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 5px;
    color: #fff;
    padding: 6px 8px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.prop-field input:focus,
.prop-field select:focus {
    outline: none;
    border-color: #667eea;
}

/* 字体选择器特殊样式 - 防止下拉时字体变形 */
#propFontFamily {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    min-height: 32px;
    line-height: 1.4;
}

#propFontFamily option {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    padding: 4px 8px;
    line-height: 1.5;
}

.prop-field input[type="color"] {
    height: 32px;
    padding: 2px 4px;
    cursor: pointer;
}

.prop-field-full {
    margin-bottom: 8px;
}

.prop-field-full:last-child { margin-bottom: 0; }

.prop-field-full label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.prop-field-full label span {
    color: #aaa;
}

.prop-field-full input,
.prop-field-full select,
.prop-field-full textarea {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 5px;
    color: #fff;
    padding: 6px 8px;
    font-size: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.prop-field-full input:focus,
.prop-field-full select:focus,
.prop-field-full textarea:focus {
    outline: none;
    border-color: #667eea;
}

.prop-field-full input[type="range"] {
    padding: 0;
    border: none;
    background: transparent;
    accent-color: #667eea;
}

.prop-textarea {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 5px;
    color: #fff;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
    font-family: inherit;
}

.prop-textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 文字样式按钮 */
.prop-style-btns {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.prop-style-btn {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 5px;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.prop-style-btn:hover {
    border-color: #667eea;
    color: #fff;
}

.prop-style-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

/* 艺术字 */
.art-styles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.art-style-item {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.art-style-item:hover {
    border-color: #667eea;
}

.art-style-item.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.15);
}

/* ============================================
   背景面板
   ============================================ */
.bg-type-switcher {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.bg-type-btn {
    flex: 1;
    padding: 8px 6px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.bg-type-btn:hover { color: #fff; }

.bg-type-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.bg-color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.bg-preset {
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bg-preset:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 2px #667eea;
}

.bg-gradient-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.bg-grad-preset {
    height: 44px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bg-grad-preset:hover {
    transform: scale(1.06);
    box-shadow: 0 0 0 2px #fff;
}

/* tab-nav 5个时自动等分 */
.tab-nav .tab-btn {
    font-size: 11px;
    padding: 10px 4px;
    gap: 3px;
    flex-direction: column;
}

.tab-nav .tab-btn i {
    font-size: 14px;
}

/* no-selection 美化 */
.no-selection {
    text-align: center;
    padding: 40px 20px;
    color: #555;
}

.no-selection i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    color: #444;
}

.no-selection p {
    font-size: 13px;
}

/* 动画面板选中状态增强 */
.anim-btn.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

/* property-group 兼容旧版（防止残留报错） */
.property-group { margin-bottom: 12px; }
.property-group label { display: block; font-size: 12px; color: #999; margin-bottom: 4px; }
.property-group input, .property-group select, .property-group textarea {
    width: 100%; background: #1a1a1a; border: none; border-radius: 4px;
    color: #fff; padding: 8px; font-size: 13px; box-sizing: border-box;
}

/* ============================================
   我的素材库面板
   ============================================ */
.my-media-section {
    margin-top: 12px;
}

.my-media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px;
    font-size: 12px;
    color: #aaa;
    border-top: 1px solid #2a2a2a;
    margin-bottom: 8px;
}

.my-media-header span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-refresh-media {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
    font-size: 11px;
}

.btn-refresh-media:hover {
    color: #667eea;
}

.btn-refresh-media.spinning i {
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes progressSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}


/* 视频列表项 */
.video-item {
    background: #2a2a2a;
}

/* 视频列表项底部虚线 */
.video-item,
.video-item-clickable {
    border-bottom: 1px dashed #999 !important;
}
.video-item.selected,
.video-item.selected:hover {
    background: #3a506b !important;
    border-left: 3px solid #4a90d9;
}
.video-item .video-name {
    color: #e0e0e0 !important;
}
.video-item:hover {
    background: #3a3a3a !important;
}
.video-edit-name:hover {
    color: #4a90d9 !important;
}
.video-generate-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10 !important;
    position: relative !important;
}
.video-generate-btn:hover {
    background: #357abd !important;
}
.video-proj-del-btn,
.video-delete-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10 !important;
    position: relative !important;
}

/* 图片缩略图网格 */
.my-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding-right: 2px;
    /* 不限高度：由外层 tab-content 统一滚动，避免内容截断 */
}

/* 背景图库：3 列满铺，竖版比例 */
#myBgMediaGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

#myBgMediaGrid .media-thumb-item {
    aspect-ratio: 9 / 16;
    border-radius: 4px;
}

.my-media-grid::-webkit-scrollbar { width: 4px; }
.my-media-grid::-webkit-scrollbar-track { background: #1a1a1a; }
.my-media-grid::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 2px; }

.media-thumb-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
    background: #1e1e1e;
}

.media-thumb-item:hover {
    border-color: #667eea;
    transform: scale(1.04);
}

.media-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-thumb-item .thumb-type-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.media-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #555;
    padding: 20px;
    font-size: 18px;
}

.media-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #555;
    padding: 16px;
    font-size: 12px;
}

/* 音乐列表 */
.my-music-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
}

.my-music-list::-webkit-scrollbar { width: 4px; }
.my-music-list::-webkit-scrollbar-track { background: #1a1a1a; }
.my-music-list::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 2px; }

.music-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    background: #1e1e1e;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.music-item:hover {
    background: #252525;
    border-color: #667eea;
}

.music-item.playing {
    border-color: #2ed573;
    background: rgba(46,213,115,0.08);
}

.music-item.active-bg {
    border-color: #667eea;
    background: rgba(102,126,234,0.1);
}

.music-item-play {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2a2a2a;
    border: none;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    font-size: 11px;
}

.music-item-play:hover {
    background: #667eea;
    color: #fff;
}

.music-item.playing .music-item-play {
    background: #2ed573;
    color: #fff;
}

.music-item-info {
    flex: 1;
    min-width: 0;
}

.music-item-name {
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-item-meta {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}

.music-item-use {
    background: none;
    border: 1px solid #3a3a3a;
    color: #888;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    white-space: nowrap;
}

.music-item-use:hover {
    border-color: #667eea;
    color: #667eea;
}

.music-item.active-bg .music-item-use {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

/* ============================================
   动画面板 - 操作按钮行 & 当前动画状态
   ============================================ */
.anim-action-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.anim-action-row .btn-apply-anim {
    flex: 1;
    width: auto;
    background: #667eea;
    color: #fff;
    font-size: 12px;
    padding: 8px 10px;
}

.anim-action-row .btn-apply-anim:hover {
    background: #5568d3;
}

.btn-remove-anim {
    background: #ff4757;
    color: #fff;
    font-size: 12px;
    padding: 8px 10px;
    flex-shrink: 0;
}

.btn-remove-anim:hover {
    background: #e0334a;
}

.current-anim-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(102,126,234,0.12);
    border: 1px solid rgba(102,126,234,0.3);
    border-radius: 6px;
    font-size: 12px;
    color: #a0adf7;
}

.current-anim-info i {
    color: #667eea;
    font-size: 13px;
}

/* ============================================
   右键上下文菜单
   ============================================ */
.canvas-context-menu {
    position: fixed;
    z-index: 100000;
    background: #2c2c2c;
    border: 1px solid #3f3f3f;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    min-width: 180px;
    padding: 6px 0;
    user-select: none;
}

.canvas-context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.canvas-context-menu ul li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    font-size: 13px;
    color: #ddd;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.canvas-context-menu ul li i {
    width: 14px;
    text-align: center;
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
}

.canvas-context-menu ul li:hover {
    background: rgba(102,126,234,0.18);
    color: #fff;
}

.canvas-context-menu ul li:hover i {
    color: #667eea;
}

.canvas-context-menu ul li.ctx-disabled {
    color: #555;
    cursor: default;
    pointer-events: none;
}

.canvas-context-menu ul li.ctx-disabled i {
    color: #444;
}

.canvas-context-menu ul li.ctx-danger {
    color: #ff6b7a;
}

.canvas-context-menu ul li.ctx-danger i {
    color: #ff4757;
}

.canvas-context-menu ul li.ctx-danger:hover {
    background: rgba(255,71,87,0.15);
    color: #ff4757;
}

.canvas-context-menu .ctx-divider {
    height: 1px;
    background: #3a3a3a;
    margin: 4px 0;
    padding: 0 !important;
    cursor: default !important;
    pointer-events: none !important;
}

/* ============================================
   形状网格
   ============================================ */
.shape-group-title {
    font-size: 10px;
    color: #666;
    padding: 5px 0 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.shape-item {
    aspect-ratio: 1;
    min-width: 0;
    min-height: 28px;
    background: #252525;
    border: 1.5px solid #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px;
    transition: border-color 0.15s, background 0.15s;
    color: #aaa;
    user-select: none;
    position: relative;
    z-index: 1;
}

.shape-item:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.12);
    color: #667eea;
}

.shape-item:active {
    background: rgba(102,126,234,0.25);
    transform: scale(0.95);
}

.shape-item svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* ============================================
   时长选择器
   ============================================ */
.duration-selector select {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ccc;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.duration-selector select:focus {
    outline: none;
    border-color: #667eea;
}

/* ============================================
   素材管理模式按钮
   ============================================ */
.btn-manage-mode {
    background: none;
    border: 1px solid #3a3a3a;
    color: #666;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
    line-height: 1;
}

.btn-manage-mode:hover,
.btn-manage-mode.active {
    border-color: #f39c12;
    color: #f39c12;
    background: rgba(243,156,18,0.1);
}

/* 管理模式下缩略图显示删除/重命名按钮 */
.media-thumb-item.manage-mode {
    position: relative;
}

.media-thumb-item.manage-mode::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

.media-thumb-actions {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 3px 2px;
    gap: 2px;
    justify-content: center;
}

.media-thumb-item.manage-mode .media-thumb-actions {
    display: flex;
}

.media-thumb-actions button {
    flex: 1;
    padding: 3px 2px;
    font-size: 9px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: #fff;
    line-height: 1.2;
}

.media-thumb-actions .btn-del-media {
    background: #e74c3c;
}

/* 音乐管理模式 */
.music-item .music-item-actions {
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.music-item.manage-mode .music-item-actions {
    display: flex;
}

.music-item.manage-mode .music-item-use {
    display: none;
}

.music-item-actions button {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #3a3a3a;
    color: #aaa;
    background: none;
    white-space: nowrap;
    transition: all 0.15s;
}

.music-item-actions .btn-rename-music:hover {
    border-color: #667eea;
    color: #667eea;
}

.music-item-actions .btn-del-music:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: rgba(231,76,60,0.1);
}

/* ============================================
   字体项（字体管理弹窗通用）
   ============================================ */

.font-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1e1e1e;
    border-radius: 6px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.font-item:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.08);
}

.font-item.active {
    border-color: #667eea;
    background: rgba(102,126,234,0.15);
}

.font-item-preview {
    font-size: 18px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eee;
}

.font-item-name {
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.font-item-del {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.font-item-del:hover {
    color: #e74c3c;
}

/* ============================================
   公共元素管理按钮
   ============================================ */
.btn-manage-lib {
    background: none;
    border: 1px solid #3a3a3a;
    color: #888;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-manage-lib:hover {
    border-color: #f39c12;
    color: #f39c12;
}

/* ============================================
   属性面板 - 实时数值
   ============================================ */
.prop-field input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: #1e1e2e;
}

/* 时间显示样式在上方 .time-display 已定义 */


/* 管理员专属元素 */
.admin-only { display: none; }

.canvas-context-menu .ctx-divider:hover {
    background: #3a3a3a !important;
}

/* 动画按钮-已应用高亮 */
.anim-btn.has-anim {
    position: relative;
}

.anim-btn.has-anim::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2ed573;
}

/* ============================================
   图层面板
   ============================================ */
.layer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 8px;
    font-size: 12px;
    color: #aaa;
    border-bottom: 1px solid #333;
    margin-bottom: 6px;
}

.layer-panel-header span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #ccc;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 400px;
    overflow-y: auto;
}

.layer-list::-webkit-scrollbar { width: 4px; }
.layer-list::-webkit-scrollbar-track { background: transparent; }
.layer-list::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 2px; }

.layer-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    background: #1e1e1e;
    border-radius: 5px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.layer-item:hover {
    border-color: #444;
    background: #252525;
}

.layer-item.layer-active {
    border-color: #667eea;
    background: rgba(102,126,234,0.12);
}

.layer-item-thumb {
    width: 28px;
    height: 28px;
    background: #333;
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #888;
    overflow: hidden;
}

.layer-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer-item-label {
    flex: 1;
    font-size: 11px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item-type {
    font-size: 9px;
    color: #555;
    background: #2a2a2a;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}

.layer-item-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.15s;
}

.layer-item:hover .layer-item-actions,
.layer-item.layer-active .layer-item-actions {
    opacity: 1;
}

.layer-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.layer-btn:hover { color: #ccc; background: rgba(255,255,255,0.08); }
.layer-btn-up:hover, .layer-btn.layer-btn-up:hover { color: #667eea; }
.layer-btn-down:hover, .layer-btn.layer-btn-down:hover { color: #667eea; }
.layer-btn-del:hover, .layer-btn.layer-btn-del:hover { color: #ff4757; background: rgba(255,71,87,0.1); }
.layer-btn.layer-btn-vis:hover { color: #2ed573; }

.layer-empty {
    text-align: center;
    padding: 20px;
    color: #555;
    font-size: 12px;
}

/* 字体管理弹出层（属性面板内） */
.font-mgr-popup {
    position: fixed;
    z-index: 20000;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    width: 260px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.font-mgr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #333;
    font-size: 12px;
    color: #ccc;
    font-weight: 600;
    flex-shrink: 0;
}

.font-mgr-close {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s;
}

.font-mgr-close:hover { color: #fff; }

.font-mgr-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.font-mgr-footer {
    border-top: 1px solid #333;
    padding: 8px;
    flex-shrink: 0;
}

.font-mgr-upload-btn {
    width: 100%;
    background: #2a7de1;
    color: #fff;
    border: none;
    padding: 7px;
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.15s;
}

.font-mgr-upload-btn:hover { background: #1a6bcf; }

/* 背景图独立上传 */
.bg-upload-btn {
    width: 100%;
    background: #667eea;
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
    margin-bottom: 10px;
}

.bg-upload-btn:hover { background: #5568d3; }



