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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf2 100%);
    min-height: 100vh;
    color: #2c3e50;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.header-content {
    animation: fadeInDown 0.8s ease-out;
}

.title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: #7f8c8d;
    font-weight: 400;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    animation: fadeIn 1s ease-out;
}

/* Video Section */
.video-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

video {
    display: none;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#captureCanvas {
    display: none;
}

/* Controls Section */
.controls-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.control-group {
    margin-bottom: 28px;
}

.control-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

/* Select Dropdown */
.select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    font-size: 1rem;
    color: #495057;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.custom-select:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.custom-select:focus {
    outline: none;
    border-color: #6B7FD7;
    background-color: white;
}

/* Color Picker */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker-input {
    width: 48px;
    height: 48px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker-input:hover {
    border-color: #adb5bd;
}

.hex-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #495057;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.hex-input:focus {
    outline: none;
    border-color: #6B7FD7;
    background-color: white;
}

.hex-input::placeholder {
    color: #adb5bd;
}

.color-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.color-circle.active {
    border-color: #34495e;
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

/* Base button styles */
.btn {
    padding: 18px 32px;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Start Button - Green gradient */
.btn-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-start:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-start:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-stop {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-stop:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-stop:disabled {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    opacity: 0.6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

/* Responsive Design */
@media (min-width: 768px) {
    .app-container {
        padding: 30px;
    }

    .header {
        padding: 50px 20px;
    }

    .main-content {
        gap: 40px;
    }

    .controls-section {
        padding: 40px;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .header {
        padding: 20px 10px;
    }

    .video-section {
        padding: 10px;
    }

    .video-wrapper {
        aspect-ratio: 4 / 3;
    }

    .controls-section {
        padding: 20px;
    }

    .color-circle {
        width: 44px;
        height: 44px;
    }

    .color-picker-input {
        width: 44px;
        height: 44px;
    }

    .hex-input {
        font-size: 0.9rem;
        padding: 10px 12px;
    }
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 2fr 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 5px;
    }

    .header {
        padding: 15px 10px;
        margin-bottom: 10px;
    }

    .title {
        font-size: 1.5rem;
    }

    .video-section {
        padding: 5px;
    }

    .video-wrapper {
        aspect-ratio: auto;
        min-height: 75vh;
        height: 75vh;
    }

    .controls-section {
        padding: 20px;
    }

    .color-circle {
        width: 44px;
        height: 44px;
    }

    .color-picker-input {
        width: 44px;
        height: 44px;
    }

    .hex-input {
        font-size: 0.9rem;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0;
    }

    .header {
        padding: 8px 5px;
        margin-bottom: 5px;
    }

    .title {
        font-size: 1.3rem;
    }

    .main-content {
        gap: 10px;
    }

    .video-section {
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .video-wrapper {
        border-radius: 0;
        min-height: 80vh;
        height: 80vh;
    }

    .controls-section {
        padding: 16px;
    }

    .color-circle {
        width: 42px;
        height: 42px;
    }

    .color-picker-input {
        width: 42px;
        height: 42px;
    }

    .btn {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }
}