:root {
    --primary: #EF4444;
    --primary-hover: #DC2626;
    --secondary: #F97316;
    --accent: #3B82F6;
    --bg-main: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-panel: rgba(15, 23, 42, 0.8);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --radius: 12px;
    --border: rgba(255, 255, 255, 0.1);
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(239, 68, 68, 0.08), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(249, 115, 22, 0.08), transparent 30%);
}

header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo {
    color: var(--primary);
}

main {
    flex: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.controls-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: var(--transition);
}

.toggle-label:hover {
    background: rgba(255, 255, 255, 0.06);
}

.toggle-label span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.toggle-label.active span {
    color: var(--text-main);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: white;
}

.btn {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

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

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

.btn-primary:disabled {
    background: rgba(239, 68, 68, 0.3);
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.5);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    width: 100%;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-success {
    background: #10B981;
    color: white;
    width: 100%;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 700px;
}

.video-wrapper {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 16/9;
    position: relative;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.no-video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 1rem;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background-color 0.3s;
}

.recording .dot {
    background: var(--primary);
    animation: pulse 1.5s infinite;
}

.recording .recording-text {
    color: var(--primary);
}

.timer {
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

#canvas-composer {
    display: none;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@media (max-width: 800px) {
    main {
        flex-direction: column;
    }

    .card,
    .preview-container {
        max-width: 100%;
    }
}