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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Preview Section - Top Half */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    position: relative;
}

.video-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1); /* Mirror the video */
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* Mirror the canvas to match video */
}

.status-bar {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    flex-wrap: wrap;
}

.status-indicator {
    font-size: 14px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    white-space: nowrap;
}

/* Controls Section - Bottom Half */
.controls-section {
    flex: 1;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    font-size: 1rem;
}

.control-group input[type="text"] {
    padding: 12px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: border-color 0.3s;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.control-group input[type="color"] {
    width: 100px;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: none;
    transition: transform 0.2s;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.color-display-text {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    display: inline-block;
    margin-left: 15px;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

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

.info-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
    margin-top: 10px;
}

.info-box h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.info-box ol {
    margin-left: 20px;
    line-height: 1.8;
}

.info-box li {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Allow scrolling on mobile */
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    /* Make preview section smaller on mobile to leave room for controls */
    .preview-section {
        min-height: 40vh;
        max-height: 50vh;
        flex: 0 0 auto;
    }

    /* Make controls section scrollable */
    .controls-section {
        padding: 20px;
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    h1 {
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }
}
