:root {
    --bg-main: #121214;
    --bg-card: #1e1e24;
    --accent: #6200ee;
    --text: #ffffff;
}

body {
    margin: 0;
    background-color: var(--bg-main);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr 250px;
    height: 100vh;
}

.asset-panel {
    background: var(--bg-card);
    padding: 20px;
    border-right: 1px solid #2d2d35;
}

.upload-box { margin-bottom: 20px; }
.upload-box input { display: block; margin: 10px 0 20px; }

.preview-monitor {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #09090b;
}

.canvas-wrapper canvas {
    max-width: 90%;
    box-shadow: 0px 10px 30px rgba(0,0,0,0.5);
    background: #000;
}

.controls {
    margin-top: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
}

button {
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

button.export-btn { background: var(--accent); }
button:hover { opacity: 0.8; }

.timeline-container {
    grid-column: 1 / span 2;
    background: var(--bg-card);
    border-top: 1px solid #2d2d35;
    padding: 15px;
    position: relative;
    overflow-x: auto;
}

.track {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    margin: 10px 0;
    height: 60px;
    border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.track h3 {
    position: absolute;
    left: 10px;
    margin: 0;
    font-size: 12px;
    color: #8a8a93;
    z-index: 10;
    line-height: 60px;
    pointer-events: none;
}

.timeline-block {
    position: absolute;
    height: 44px;
    top: 8px;
    background: linear-gradient(135deg, #6200ee, #3700b3);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    cursor: grab;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-block:active {
    cursor: grabbing;
    background: #03dac6;
    color: #000;
}

.resize-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; background: rgba(255, 255, 255, 0); transition: background 0.2s; }
.resize-handle:hover { background: rgba(255, 255, 255, 0.3); }
.resize-handle.left { left: 0; border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.resize-handle.right { right: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }

.timeline-block.selected {
    box-shadow: 0 0 0 2px var(--bg-main), 0 0 0 4px #fff;
    z-index: 5;
}

.delete-btn {
    position: absolute;
    top: 4px;
    right: 10px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 10;
}
.delete-btn:hover { background: #f44336; }

#playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: red; z-index: 10; left: 80px; }

@media (max-width: 768px) {
    .app-container {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow-x: hidden;
    }

    .asset-panel {
        width: 100%;
        box-sizing: border-box;
        border-right: none;
        border-bottom: 1px solid #2d2d35;
    }

    .canvas-wrapper canvas {
        width: 100vw;
        height: auto;
    }

    .timeline-container {
        width: 100vw;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .controls {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
    }

    button {
        min-height: 50px; 
        font-size: 16px;
        font-weight: bold;
        border-radius: 12px;
        border: none;
        background: #252529;
        color: white;
    }

    .export-btn {
        grid-column: span 2;
        background: linear-gradient(135deg, #00cb82, #009661);
        box-shadow: 0 4px 15px rgba(0, 203, 130, 0.3);
    }

    .preset-badge-grid { display: flex; gap: 8px; overflow-x: auto; padding: 5px 0; scrollbar-width: none; }
    .preset-badge-grid::-webkit-scrollbar { display: none; }
    
    .badge-btn { white-space: nowrap; padding: 8px 16px; background: rgba(255,255,255,0.08); border-radius: 20px; font-size: 13px; min-height: auto; }
    
    .track { height: 80px; }
    .timeline-block { height: 60px; top: 10px; }
}