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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --bg-dark: #1e1e2e;
    --bg-light: #2a2a3e;
    --bg-lighter: #353548;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --border-color: #404058;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    margin-bottom: 40px;
}

/* Preview Section */
.preview-section {
    background: var(--bg-light);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#compositeCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.status-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.recording .status-dot {
    background: var(--danger-color);
}

.status-indicator.paused .status-dot {
    background: #f59e0b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow: hidden;
}

.control-group {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.control-group h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    white-space: nowrap;
    min-width: 0;
}

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

.btn-icon {
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
}

.btn-text {
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-lighter);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3);
}

.button-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.recording-controls {
    text-align: center;
}

.recording-timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 15px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Position Grid */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.position-btn {
    padding: 15px;
    background: var(--bg-lighter);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.position-btn:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.position-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

/* Shape Options */
.shape-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.shape-btn {
    padding: 15px 10px;
    background: var(--bg-lighter);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.shape-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.shape-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.shape-preview {
    width: 40px;
    height: 40px;
    background: currentColor;
}

.shape-preview.circle {
    border-radius: 50%;
}

.shape-preview.rounded {
    border-radius: 12px;
}

.shape-preview.square {
    border-radius: 0;
}

/* Slider */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-container label {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

#sizeValue {
    color: var(--primary-color);
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-lighter);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Recordings Section */
.recordings-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.recordings-section h3 {
    margin-bottom: 20px;
}

.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recording-item {
    background: var(--bg-lighter);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.recording-name {
    font-weight: 600;
    color: var(--text-primary);
}

.recording-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.recording-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .controls-section {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .recording-controls {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .btn {
        padding: 10px 12px;
        font-size: 0.9rem;
        gap: 4px;
    }
    
    .button-group {
        gap: 6px;
    }
}

@media (max-width: 640px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .controls-section {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
}

