/* --- 全局与重置 --- */
* {
    box-sizing: border-box;
    user-select: none;
    outline: none;
}

body {
    margin: 0;
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
}

input,
button,
select,
textarea {
    font-family: inherit;
}

/* --- 布局 --- */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* --- Canva 风格左侧菜单栏 --- */
.left-sidebar {
    width: 80px;
    background: #1a1a1a;
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    position: relative;
}

.logo-area {
    margin-bottom: 24px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.logo-area:hover {
    background: rgba(255, 255, 255, 0.1);
}

.logo-area svg {
    color: #00d4ff;
}

.sidebar-nav {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
}

.nav-item {
    width: 100%;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    padding: 8px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.15);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: #00d4ff;
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.nav-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

.sidebar-footer {
    width: 100%;
    padding: 8px;
    display: flex;
    justify-content: center;
}

.btn-help {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-help:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* --- 资源面板 --- */
.resources-panel {
    width: 280px;
    background: #252526;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #000;
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid #333;
}

.panel-header h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.btn-import {
    width: 100%;
    padding: 10px 16px;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px dashed rgba(0, 212, 255, 0.3);
    cursor: pointer;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-import:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
}

.btn-import svg {
    width: 16px;
    height: 16px;
}

.assets-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

.asset-item {
    background: #1e1e1e;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    transition: 0.2s;
    position: relative;
}

.asset-item:hover {
    border-color: #555;
}

.asset-preview {
    height: 70px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #555;
    position: relative;
}

.asset-name {
    padding: 5px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
}

.model-status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.model-status-light.success {
    background: #20d58d;
    box-shadow: 0 0 8px rgba(32, 213, 141, 0.7);
}

/* --- 主工作区 --- */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0f0f0f;
}

/* 顶部视频尺寸控制 */
.video-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid #333;
}

.size-preset-select {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.custom-size-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 12px;
}

.size-input {
    width: 50px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    outline: none;
}

.size-input:focus {
    border-color: #00d4ff;
}

.aspect-ratio-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aspect-ratio-btn:hover {
    color: #fff;
    background: #333;
}

.aspect-ratio-btn.active {
    color: #00d4ff;
}

/* --- 顶部工具栏 --- */
.top-toolbar {
    min-height: 56px;
    height: auto;
    background: #1a1a1a;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 16px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.toolbar-btn.active {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.16);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.22) inset;
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #2d2d2d;
    margin: 0 4px;
}

.toolbar-center {
    flex: 1 1 360px;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.time-display {
    display: flex;
    align-items: center;
}

.time-display #timeInput {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 90px;
    text-align: center;
    border-radius: 6px;
    padding: 6px 12px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    transition: all 0.2s;
}

.time-display #timeInput:focus {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    margin-left: auto;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #8e8e93;
}

.zoom-control svg {
    width: 16px;
    height: 16px;
}

.zoom-control input {
    width: 100px;
    accent-color: #00d4ff;
}

.btn-export {
    background: #00d4ff;
    color: #000;
    border: none;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-export:hover {
    background: #00b8e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.btn-export svg {
    width: 16px;
    height: 16px;
}

.save-status {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 500;
}

/* 预览区 */
.preview-section {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.preview-area {
    flex: 1;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
}

.player-wrapper {
    flex: 1;
    position: relative;
    background: #000;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* WebM 透明预览的棋盘格背景 */
.player-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.2;
    background-image: linear-gradient(45deg, #333 25%, transparent 25%), linear-gradient(-45deg, #333 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #333 75%), linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    border-radius: 12px;
    display: block;
}

#previewPlayer {
    position: relative;
    z-index: 1;
    background: transparent;
}

#textOverlayLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

#audioPlayer {
    display: none;
    /* 隐藏音频播放器，因为它只是用来播放音频轨道 */
}

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.play-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid rgba(255, 255, 255, 0.9);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.play-button:hover {
    transform: scale(1.1);
    background: rgba(0, 212, 255, 0.8);
    border-color: #00d4ff;
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
}

.play-button svg {
    width: 48px;
    height: 48px;
    margin-left: 4px;
}

#textOverlayLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

/* 预览控制栏 */
.preview-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6), transparent);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.player-wrapper:hover .preview-controls {
    opacity: 1;
    pointer-events: auto;
}

.preview-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.preview-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.preview-control-btn:active {
    transform: scale(0.95);
}

.preview-progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-progress-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    overflow: visible;
}

.preview-progress-fill {
    height: 100%;
    background: #00d4ff;
    border-radius: 3px;
    transition: width 0.1s linear;
    position: relative;
}

.preview-progress-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: #00d4ff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.5);
}

.preview-progress-bar:hover .preview-progress-handle {
    opacity: 1;
}

.preview-progress-handle:active {
    cursor: grabbing;
}

.preview-time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.preview-volume-control {
    display: flex;
    align-items: center;
    width: 80px;
}

.volume-slider {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    accent-color: #00d4ff;
    cursor: pointer;
}

/* 资源搜索 */
.assets-search-container {
    padding: 12px;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: #252526;
    z-index: 10;
}

.assets-search-input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    transition: all 0.2s;
}

.assets-search-input:focus {
    outline: none;
    border-color: #00d4ff;
    background: #252525;
}

.assets-search-input::placeholder {
    color: #666;
}

.assets-search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.assets-search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.overlay-text {
    position: absolute;
    white-space: pre-wrap;
    cursor: move;
    pointer-events: auto;
    border: 1px dashed transparent;
    padding: 2px;
    z-index: 10;
    transform-origin: center center;
    /* 确保文本清晰可见 */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    transition: border-color 0.2s ease;
}

.overlay-text:hover {
    border-color: #00E5C0;
}

.overlay-text.selected {
    border: 2px solid #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3), 0 0 8px rgba(0, 212, 255, 0.5);
    z-index: 20;
}

.preview-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: #00d4ff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    cursor: nwse-resize;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-resize-handle::before,
.preview-resize-handle::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
}

.preview-resize-handle::before {
    width: 6px;
    height: 1px;
}

.preview-resize-handle::after {
    width: 1px;
    height: 6px;
}

.text-resize-handle {
    right: -10px;
    bottom: -10px;
}

.video-resize-handle {
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

#previewPlayer.selected {
    outline: 3px solid #00d4ff;
    outline-offset: -3px;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3), 0 0 12px rgba(0, 212, 255, 0.6);
    z-index: 15;
}

/* 播放控制已移至顶部工具栏 */

/* --- 属性面板 --- */
.properties-panel {
    width: 280px;
    background: #252526;
    border-left: 1px solid #000;
    display: flex;
    flex-direction: column;
}

.prop-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    height: 40px;
}

.prop-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.prop-tab.active {
    color: #00E5C0;
    border-bottom-color: #00E5C0;
    font-weight: bold;
}

.props-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.empty-tip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8e8e93;
    text-align: center;
    padding: 40px 20px;
}

.empty-tip svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-tip p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.prop-group {
    margin-bottom: 15px;
}

.prop-label {
    display: block;
    color: #888;
    font-size: 11px;
    margin-bottom: 6px;
}

.prop-textarea {
    width: 100%;
    background: #151515;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    resize: vertical;
    min-height: 60px;
}

.prop-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.prop-select,
.prop-number,
.prop-color {
    background: #151515;
    border: 1px solid #333;
    color: #fff;
    padding: 5px;
    border-radius: 4px;
    flex: 1;
}

.prop-slider {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    accent-color: #00d4ff;
    cursor: pointer;
}

.prop-slider::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.prop-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

.prop-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.prop-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #ccc;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.prop-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
    color: #fff;
}

.prop-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
}

.prop-btn svg {
    width: 14px;
    height: 14px;
}

.prop-btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #ccc;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
    flex: 1;
}

.prop-btn-small:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    color: #00d4ff;
}

/* --- 时间轴 (Timeline) --- */
.timeline-area {
    height: 320px;
    background: #1a1a1a;
    border-top: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
}

.timeline-toolbar {
    height: 40px;
    background: #151515;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.timeline-toolbar-spacer {
    flex: 1;
}

.track-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #00d4ff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
}

.track-add-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
}

.track-add-btn svg {
    width: 14px;
    height: 14px;
}

.track-delete-btn {
    background: rgba(255, 71, 87, 0.08);
    border-color: rgba(255, 71, 87, 0.4);
    color: #ff6b81;
}

.track-delete-btn:hover {
    background: rgba(255, 71, 87, 0.15);
    border-color: rgba(255, 71, 87, 0.7);
    color: #ff4757;
}

.track-row.selected .track-lane {
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.7);
}

/* 时间轴工具栏已移至顶部 */

/* 轨道容器 */
.timeline-scroll-area {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.timeline-scroll-area::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

#rulerCanvas {
    display: block;
    background: #1a1a1a;
    border-bottom: 1px solid #2d2d2d;
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
}

.tracks-container {
    padding: 10px 0;
    position: relative;
    min-width: 100%;
}

/* min-width 保证点击空白能生效 */
.track-row {
    display: flex;
    height: 60px;
    margin-bottom: 2px;
    position: relative;
    transition: box-shadow 0.14s ease, border-color 0.14s ease;
}

.track-header {
    height: 100%;
    background: #131313;
    border-top: 1px solid #2d2d2d;
    border-right: 1px solid #2d2d2d;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8e8e93;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.track-header:hover {
    background: #252525;
}

.track-header.dragging {
    opacity: 0.5;
    background: rgba(0, 212, 255, 0.2);
}

.track-row.drag-over .track-lane,
.track-row.drag-over .track-header {
    background: rgba(0, 212, 255, 0.12);
}

.track-row.dragging .track-header,
.track-row.dragging .track-lane {
    border-top: 1px solid rgba(255, 214, 64, 0.9);
    border-bottom: 1px solid rgba(255, 214, 64, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 214, 64, 0.95), 0 0 10px rgba(255, 214, 64, 0.35);
}

.track-header .track-remove-btn {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.track-header:hover .track-remove-btn {
    opacity: 1;
}

.track-header .track-remove-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.track-header svg {
    width: 14px;
    height: 14px;
    color: #8e8e93;
}

.track-header span {
    color: #8e8e93;
}

.track-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.track-control-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
}

.track-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
    color: #fff;
}

.track-control-btn.active {
    opacity: 1;
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.15);
}

.track-control-btn.danger {
    color: #ff8b8b;
}

.track-control-btn.danger:hover {
    color: #ff4f4f;
    background: rgba(255, 79, 79, 0.18);
}

.track-control-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.track-drag-handle-btn {
    cursor: grab;
}

.track-drag-handle-btn:active {
    cursor: grabbing;
}

.track-control-btn svg {
    width: 12px;
    height: 12px;
}

.track-header.locked {
    opacity: 0.7;
}

.track-header.hidden {
    opacity: 0.5;
}

.track-lane {
    flex: 1;
    background: #151515;
    position: relative;
    border-top: 1px solid #2d2d2d;
    overflow: hidden;
}

.track-lane.locked {
    opacity: 0.5;
    pointer-events: none;
}

.track-lane.hidden {
    opacity: 0.3;
    pointer-events: none;
}

.track-lane.hidden .clip {
    display: none;
}

.track-lane.locked .clip {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Clips */
.clip {
    position: absolute;
    height: 80%;
    top: 10%;
    border-radius: 4px;
    cursor: grab;
    overflow: hidden;
    font-size: 11px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border: 2px solid transparent;
    transition: opacity 0.1s;
    will-change: transform;
}

.clip.snapping {
    border-color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

.clip:active {
    cursor: grabbing;
}

.clip.selected {
    border-color: #00d4ff;
    z-index: 100;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
}

.clip-label {
    padding: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
}

.clip-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    background: rgba(0, 212, 255, 0.3);
    cursor: ew-resize;
    z-index: 10;
    transition: background 0.2s;
    border-radius: 2px;
}

.clip-resize-handle:hover {
    background: rgba(0, 212, 255, 0.8);
    width: 8px;
}

.clip-resize-left {
    left: 0;
    border-radius: 4px 0 0 4px;
}

.clip-resize-right {
    right: 0;
    border-radius: 0 4px 4px 0;
}

.resize-guide-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 212, 255, 0.8);
    z-index: 1200;
    pointer-events: none;
}

.clip.selected .clip-resize-handle {
    background: rgba(0, 212, 255, 0.5);
}

.clip.video {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.clip.text {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.clip.audio {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    height: 50%;
    top: 25%;
}

/* --- 播放头 --- */
.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    z-index: 999;
    pointer-events: none;
}

.playhead-line {
    width: 3px;
    height: 100%;
    background: #fff;
    position: absolute;
    left: 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.playhead-handle {
    width: 24px;
    height: 24px;
    background: #00d4ff;
    position: absolute;
    top: -24px;
    left: -12px;
    font-size: 12px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    pointer-events: auto;
    cursor: ew-resize;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
    transition: all 0.2s;
}

.playhead-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.6);
}

.playhead-scissor-btn {
    position: absolute;
    top: 50px;
    left: -16px;
    width: 32px;
    height: 32px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    transition: all 0.2s;
    z-index: 1000;
}

.playhead-scissor-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.8);
}

.playhead-scissor-btn.active {
    background: #ff6b7a;
    transform: scale(1.1);
}

.playhead-scissor-btn svg {
    width: 16px;
    height: 16px;
}

/* 拖拽提示框 */
.drag-tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.resize-guide-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #00d4ff;
    z-index: 100;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 4px rgba(0, 212, 255, 0.5);
}

.clip.snapping {
    outline: 2px solid #ffd700;
    z-index: 100;
}

/* --- 导出弹窗 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-window.wide-modal {
    width: 500px;
    background: #1a1a1a;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #333;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.modal-body {
    padding: 20px;
    color: #ccc;
}

.form-group {
    margin-bottom: 15px;
}

.modal-input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    padding: 8px;
    color: #fff;
    border-radius: 4px;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-select {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #2d2d2d;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-primary-large {
    background: #00d4ff;
    color: #000;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-large:hover {
    background: #00b8e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: #8e8e93;
    border: 1px solid #2d2d2d;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: #3d3d3d;
}

.badge-ai {
    color: #00d4ff;
    font-size: 10px;
    margin-left: 5px;
    font-weight: 600;
}

.resolution-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-input-small {
    width: 80px;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 6px;
    text-align: center;
}

.resolution-presets {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid #333;
    background: #111;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    color: #00d4ff;
}

.close-btn {
    cursor: pointer;
}

/* --- 过渡动画网格 --- */
.transition-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.transition-item {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.transition-item:hover {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.transition-item.active {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.transition-icon {
    font-size: 24px;
    color: #00d4ff;
    font-weight: bold;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transition-name {
    font-size: 11px;
    color: #ccc;
    text-align: center;
    line-height: 1.2;
}

.transition-duration {
    font-size: 9px;
    color: #888;
    margin-top: 2px;
}

.transition-grid::-webkit-scrollbar {
    width: 6px;
}

.transition-grid::-webkit-scrollbar-track {
    background: #151515;
    border-radius: 3px;
}

.transition-grid::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.transition-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 滤镜预设网格 */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.filter-item {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    position: relative;
}

.filter-item:hover {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.filter-item.active {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.filter-name {
    font-size: 11px;
    color: #ccc;
    margin-top: 4px;
}

.filter-description {
    font-size: 9px;
    color: #888;
    margin-top: 2px;
}

/* 改进的资源网格 */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
    padding-bottom: 20px;
}

.asset-item {
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.asset-item:hover {
    border-color: #00d4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.asset-preview {
    height: 70px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #555;
    position: relative;
    overflow: hidden;
}

.asset-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-preview.scrollable {
    overflow-y: auto;
    overflow-x: hidden;
}

.asset-name {
    padding: 8px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
    background: #1a1a1a;
}

/* 改进的属性面板 */
.prop-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.prop-group:last-child {
    border-bottom: none;
}

.prop-label {
    display: block;
    color: #ccc;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 改进的滑块样式 */
.prop-slider {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    accent-color: #00d4ff;
    cursor: pointer;
    transition: all 0.2s;
}

.prop-slider:hover {
    accent-color: #00b8e6;
}

.prop-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 212, 255, 0.4);
}

.prop-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.6);
}

/* 改进的按钮样式 */
.prop-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #ccc;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.prop-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
    color: #fff;
    transform: translateY(-1px);
}

.prop-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* 响应式改进 */
@media (max-width: 1400px) {
    .resources-panel {
        width: 240px;
    }

    .properties-panel {
        width: 240px;
    }

    .left-sidebar {
        width: 70px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asset-item {
    animation: fadeIn 0.3s ease-out;
}

/* 改进的滚动条 */
.assets-list-container::-webkit-scrollbar,
.props-content::-webkit-scrollbar {
    width: 8px;
}

.assets-list-container::-webkit-scrollbar-track,
.props-content::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.assets-list-container::-webkit-scrollbar-thumb,
.props-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    transition: background 0.2s;
}

.assets-list-container::-webkit-scrollbar-thumb:hover,
.props-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}
