body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 800px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.upload-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 5px;
}

.video-container {
    margin-bottom: 20px;
    /* Add padding to potentially allow overlays */
    padding: 10px;
    background-color: #000; /* Typical video background */
    position: relative; /* Needed for absolute positioning of future overlays */
}

#videoPlayer {
    display: block; /* Remove extra space below video */
    margin: 0 auto; /* Center the video */
    max-width: 100%; /* Ensure it doesn't exceed container width */
    height: auto;
    /* Initial display quality controlled by script */
}

.controls {
    display: flex;
    flex-direction: column; /* Stack controls on small screens */
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

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

.control-group label {
    font-weight: bold;
    color: #555;
}

#speedSlider {
    width: 80%; /* Make slider take up space */
    max-width: 300px;
}

#speedValue {
    font-weight: bold;
    color: #007bff;
}

#qualitySelect {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* New styles for Meme Effects */
.meme-effects-section {
    border-top: 1px solid #eee; /* Separator for the new section */
    padding-top: 20px;
    margin-top: 20px;
    width: 100%; /* Take full width */
    align-items: center; /* Center content within the group */
}

.meme-effects-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.effect-controls {
    display: flex;
    flex-direction: column; /* Stack inputs and buttons on small screens */
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 500px; /* Limit width for better layout */
}

.effect-controls input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%; /* Take full width within parent */
    box-sizing: border-box; /* Include padding and border in element's total width and height */
}

.effect-controls button {
    padding: 10px 15px;
    background-color: #28a745; /* Green button */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.effect-controls button:hover {
    background-color: #218838;
}


/* Styles for text overlays */
.text-overlay {
    position: absolute;
    color: white; /* Default text color */
    font-size: 2em; /* Default size */
    font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; /* Meme font */
    text-align: center;
    text-shadow:
        -1px -1px 0 #000,
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000; /* Black outline */
    cursor: grab; /* Indicate it's draggable */
    padding: 5px; /* Add some padding */
    white-space: pre-wrap; /* Allow line breaks from input */
    /* Initial position - will be set by JS */
    top: 10%; /* Example default position */
    left: 50%;
    transform: translate(-50%, 0%); /* Center horizontally */
    z-index: 10; /* Ensure it's above the video */
}

.text-overlay:active {
    cursor: grabbing; /* Indicate it's being dragged */
}


/* Responsive adjustments */
@media (min-width: 600px) {
    .controls {
        flex-direction: row; /* Row layout on larger screens */
        justify-content: space-around;
        flex-wrap: wrap; /* Allow items to wrap */
    }
    .control-group {
         flex-direction: row;
         gap: 15px;
    }

    .meme-effects-section {
        flex-direction: column; /* Keep effect section stacked vertically */
        width: 100%; /* Ensure it spans full width */
        align-items: center;
    }

     .effect-controls {
        flex-direction: row; /* Arrange input and button horizontally */
        gap: 15px;
     }
     .effect-controls input[type="text"] {
        flex-grow: 1; /* Allow input to take available space */
        max-width: none; /* Remove max-width constraint for flex layout */
     }
     .effect-controls button {
        flex-shrink: 0; /* Prevent button from shrinking */
     }
}