body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.password-display-section {
    display: flex;
    margin-bottom: 25px;
    align-items: stretch;
}

#password-display {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    font-size: 1.1em;
    background-color: #e9ecef;
    color: #495057;
    outline: none;
}

#copy-btn {
    padding: 12px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#copy-btn:hover {
    background-color: #0056b3;
}

.controls-section div {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.controls-section label {
    /* flex-basis: 70%; Default for other labels */
    color: #555;
    font-size: 0.95em;
    margin-right: 10px; /* Add some space between label and control */
}

/* Specific styling for the label associated with the length slider */
label[for="length-slider"] {
    flex-basis: auto; /* Allow label to size based on content */
    display: flex; /* To align "密码长度:" and #length-value nicely */
    align-items: center;
}

#length-value {
    font-weight: bold;
    margin-left: 8px;
    color: #333;
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

#length-slider {
    flex-grow: 1; /* Allow slider to take remaining space */
    width: auto; /* Override any potential fixed width from general input styles */
    cursor: pointer;
    /* margin-left: 10px; /* Rely on label's margin-right for spacing */ */
}

/* Remove margin-left for checkboxes if general label gets margin-right */
.controls-section input[type="checkbox"] {
    /* margin-left: 10px; Replaced by label's margin-right */
    transform: scale(1.2); /* Makes checkbox slightly larger */
    cursor: pointer;
}

/* Remove the specific input[type="number"] styles as it's replaced */
/*
.controls-section input[type="number"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 60px; 
    font-size: 0.95em;
}
*/

#generate-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 15px;
}

#generate-btn:hover {
    background-color: #1e7e34;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        margin: 20px;
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .password-display-section {
        flex-direction: column;
    }

    #password-display {
        border-radius: 5px;
        margin-bottom: 10px;
        text-align: center;
    }

    #copy-btn {
        border-radius: 5px;
        width: 100%;
    }

    .controls-section label {
        font-size: 0.9em; /* Slightly smaller font for labels on small screens */
        /* flex-basis: 60%; Removed to allow natural sizing or specific overrides */
    }

    label[for="length-slider"] { /* Ensure it behaves well in flex-wrap scenario */
        flex-basis: auto; /* Keep it auto */
    }

    #length-slider { /* Ensure slider takes full width if wrapped */
        min-width: 100px; /* Prevent it from becoming too small before wrapping */
    }

    .controls-section div {
        flex-wrap: wrap; /* Allow items to wrap if needed */
    }
    
    #generate-btn {
        padding: 12px;
        font-size: 1em;
    }
}

@media (max-width: 400px) {
    .controls-section label { /* General labels stack */
        flex-basis: 100%; 
        margin-bottom: 5px;
    }
    label[for="length-slider"] { /* Specific label for slider */
        flex-basis: 100%; /* It should also stack */
        margin-bottom: 8px; /* A bit more space before the slider below it */
        justify-content: flex-start; /* Align items to the start */
    }
    #length-slider { /* Slider below its label */
        width: 100%;
        margin-left: 0; /* Reset margin from desktop view */
        margin-top: 5px; /* Add some space above the slider if label is stacked */
    }
    .controls-section input[type="checkbox"] {
        margin-left: 0; /* Remove margin when stacked if not already handled by label margin */
    }
    /* Removed .controls-section input[type="number"] related styles from here */
}
