* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #0a0a0a;
    color: #fff;
}

#three-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    /* Vendor prefix for compatibility */
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 3em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Prefix Order */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.header p {
    color: #a0a0a0;
}

.main-content {
    flex: 1;
    display: flex;
    gap: 20px;
    overflow: hidden;
}

.control-panel {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-panel .glass-panel:first-child {
    flex: 1;
}

.section {
    padding: 20px;
}

.section h2 {
    margin-bottom: 15px;
    font-size: 1.3em;
    color: #667eea;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
    margin-bottom: 10px;
}

.btn.cancel-crop {
    background: rgba(255, 255, 255, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn:active {
    transform: translateY(0);
}

.btn.recording {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s infinite;
}

.btn.stop {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(245, 87, 108, 0.8); }
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #a0a0a0;
    font-size: 0.9em;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1em;
}

.preview-video {
    width: 100%;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    max-height: 400px;
}

.timeline {
    position: relative;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
}

.timeline-track {
    position: relative;
    height: 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    padding: 10px;
}

.video-clip {
    position: absolute;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    overflow: hidden;
}

.video-clip:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.trim-handle {
    position: absolute;
    width: 10px;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    cursor: ew-resize;
    top: 0;
}

.trim-handle.left {
    left: 0;
}

.trim-handle.right {
    right: 0;
}

.status-bar {
    padding: 15px;
    text-align: center;
    font-size: 0.9em;
    color: #a0a0a0;
}

.status-bar.recording {
    color: #f5576c;
    font-weight: 600;
}

.editor-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-controls .btn {
    flex: 1;
    min-width: 140px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 30px;
}

.recording-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: rgba(245, 87, 108, 0.9);
    border-radius: 30px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    font-weight: 600;
}

.recording-indicator.active {
    display: flex;
}

.rec-dot {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.video-thumbnail:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.video-thumbnail.selected {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px;
    background: rgba(0, 0, 0, 0.7);
    font-size: 0.7em;
    text-align: center;
}

.crop-container {
    position: relative;
    width: 100%;
    max-height: 300px;
    margin: 15px 0;
}

.crop-preview {
    width: 100%; 
    display: block;
}

.crop-area {
    position: absolute;
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.1);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
}

.crop-handle.tl { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle.tr { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle.bl { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-handle.br { bottom: -5px; right: -5px; cursor: se-resize; }

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}