body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f4f8; /* Soft light blue */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top */
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 30px 40px;
    max-width: 800px;
    width: 100%;
    margin-top: 50px; /* Space from the top */
    text-align: center;
}

h1 {
    color: #334e68; /* Darker blue-grey */
    font-weight: 600;
    margin-bottom: 10px;
}

.description {
    color: #627d98; /* Medium blue-grey */
    margin-bottom: 30px;
    line-height: 1.5;
}

.section-block {
    background-color: #f7f9fc;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: left;
}

.section-block h2 {
    color: #4a658a;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.speaker-definition, .dialogue-line {
    background-color: #ffffff; /* Lighter background for individual items */
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.speaker-definition:hover, .dialogue-line:hover {
    border-color: #cbd6e2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.speaker-definition h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 500;
    color: #4a658a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: 500;
    color: #5a6e7f;
    margin-bottom: 8px;
}

select, textarea, input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    font-size: 1rem;
    color: #334e68;
    background-color: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus, textarea:focus, input[type="text"]:focus {
    border-color: #8bb3e8;
    box-shadow: 0 0 0 3px rgba(139, 179, 232, 0.3);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.controls.speaker-controls, .controls.dialogue-controls {
    margin-top: 0;
    margin-bottom: 10px;
    justify-content: flex-start;
    padding-left: 15px;
    padding-right: 15px;
}

.controls.generate-controls {
    margin-top: 30px;
    margin-bottom: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.download-options, .language-options {
    margin-bottom: 0;
    flex-grow: 1;
    text-align: left;
    max-width: 200px;
}

.action-btn, .primary-btn, .download-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn {
    background-color: #e3effc;
    color: #4b89dc;
}

.action-btn:hover {
    background-color: #d1e5fb;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.primary-btn {
    background-color: #4b89dc;
    color: #ffffff;
}

.primary-btn:hover {
    background-color: #3c7ac9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.primary-btn:disabled, .action-btn:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


.download-btn {
    background-color: #66bb6a;
    color: #ffffff;
    padding: 12px 30px;
}

.download-btn:hover {
    background-color: #5cb85f;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4b89dc;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: #e53e3e;
    background-color: #fed7d7;
    border: 1px solid #ef8a8a;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    font-weight: 500;
}

.hidden {
    display: none;
}

.audio-output {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed;
}

.audio-output h2 {
    color: #334e68;
    margin-bottom: 20px;
    font-weight: 600;
}

#audio-player {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    display: block;
}

.note {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 15px;
    line-height: 1.4;
}

.delete-btn {
    background: none;
    border: none;
    color: #e53e3e;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.delete-btn:hover {
    transform: scale(1.1);
}

.dialogue-line-controls {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 10px;
}

.dialogue-line-controls button {
    background-color: #e3effc;
    color: #4b89dc;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
}

.dialogue-line-controls button:hover {
    background-color: #d1e5fb;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin-top: 20px;
    }
    h1 {
        font-size: 1.8rem;
    }
    .action-btn, .primary-btn, .download-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .controls.generate-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .download-options, .language-options {
        width: 100%;
        max-width: none;
    }
}