body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #2a2a2a, #0a0a0a); /* Dark gradient background */
    color: #e0e0e0; /* Light text color */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px; /* Add some padding for smaller screens */
    box-sizing: border-box; /* Include padding in element's total width and height */
}

.container {
    background-color: rgba(45, 45, 45, 0.95); /* Slightly transparent dark background */
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); /* More pronounced shadow */
    width: 90%;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
    position: relative; /* Added for absolute positioning of reset button */
}

/* Style for the top-right reset button */
.top-right-button {
    position: absolute;
    top: 15px; /* Adjust as needed */
    right: 15px; /* Adjust as needed */
    padding: 0.4rem 0.8rem; /* Smaller padding for reset button */
    font-size: 0.8rem; /* Smaller font size */
    z-index: 10; /* Ensure it's above other content */
}

h1 {
    text-align: center;
    margin-bottom: 2.5rem;
    color: #4CAF50; /* Accent color for heading */
    font-weight: 700;
}

.input-container {
    margin-bottom: 1.5rem;
    display: flex; /* Make input-container a flex container */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 10px; /* Space between items */
    align-items: center; /* Align items vertically */
}

textarea {
    width: 60%; /* Occupy approximately 60% of the layout width */
    min-height: 120px; /* Slightly increased height */
    padding: 1rem;
    border: 1px solid #555;
    border-radius: 8px;
    resize: vertical;
    background-color: #3a3a3a; /* Darker textarea background */
    color: #e0e0e0;
    font-size: 1rem;
    box-sizing: border-box; /* Include padding in element's total width and height */
    /* Removed flex-grow: 1; and width: auto; */
}

button {
    background-color: #4CAF50; /* Green accent color */
    color: #fff;
    border: none;
    padding: 0.5rem 1rem; /* Smaller padding */
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem; /* Smaller font size */
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0; /* Prevent buttons from shrinking too much */
    /* Removed display: block and width: 100% */
}

/* Specific styles for the action buttons in input-container */
#read-aloud-btn, #pause-resume-btn {
    margin-top: 0; /* Remove top margin for flex items */
    /* You can add more specific styling here if needed */
}

.output-container {
    margin-bottom: 1.5rem;
    display: flex; /* Make output-container a flex container */
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

button:hover {
    background-color: #45a049; /* Darker green on hover */
    transform: translateY(-2px); /* Slight lift effect */
}

button:active {
    transform: translateY(0);
}

/* New container for score and time taken */
.results-summary {
    display: flex;
    justify-content: space-around; /* Distribute space evenly */
    align-items: flex-start; /* Align items to the top (adjust if needed) */
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 20px; /* Space between the score and time blocks */
}

#score-container, #time-taken-container {
    text-align: center;
    margin-top: 0; /* Remove previous margin-top */
    padding-top: 0; /* Remove previous padding-top */
    border-top: none; /* Remove previous border-top */
    flex: 1; /* Allow them to grow and shrink */
    min-width: 150px; /* Ensure they don't get too small */
}

#score-container h2 {
    color: #4CAF50;
    font-size: 1.8rem;
}

#score {
    font-size: 2rem;
    font-weight: 700;
}

#time-taken-container h2 {
    color: #4CAF50;
    font-size: 1.5rem;
}

#time-taken {
    font-size: 1.8rem;
    font-weight: 700;
}

#feedback-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #555;
    border-radius: 8px;
    background-color: #3a3a3a;
    min-height: 50px; /* Ensure it has some height even when empty */
    line-height: 1.6;
}

.correct {
    color: #4CAF50; /* Green for correct words */
    font-weight: 600;
}

.incorrect {
    color: #FF6347; /* Tomato red for incorrect words */
    text-decoration: line-through;
    font-weight: 600;
}

/* Feedback Form Styles */
.feedback-section {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.feedback-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #4CAF50;
    font-size: 1.8rem;
}

.feedback-section form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    font-weight: 600;
}

.feedback-section input[type="text"],
.feedback-section input[type="email"],
.feedback-section textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #555;
    border-radius: 8px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    font-size: 1rem;
    box-sizing: border-box;
    resize: vertical; /* Allow vertical resizing for textarea */
}

.feedback-section textarea {
    min-height: 100px;
}

.feedback-section button[type="submit"] {
    /* Inherits general button styles, but can be overridden */
    margin-top: 1rem;
    width: auto; /* Override general button 100% width for feedback form */
    align-self: flex-start; /* Align button to start in flex column */
}

#form-status {
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
}

/* Speed Control Styles */
.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    margin-top: 10px; /* Add some space from buttons above */
}

.speed-control label {
    color: #e0e0e0;
    font-weight: 600;
}

#speech-speed {
    padding: 0.5rem 1rem;
    border: 1px solid #555;
    border-radius: 8px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none; /* Remove default browser styling for select */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="#e0e0e0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); /* Custom dropdown arrow */
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em;
    flex-grow: 0; /* Don't grow automatically, allow it to take natural width */
}

#speech-speed:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    button {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 1rem;
        width: 100%;
        border-radius: 8px;
    }
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    textarea {
        min-height: 100px;
        font-size: 0.9rem;
    }
    button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
    #score-container {
        margin-top: 2rem;
        padding-top: 1rem;
    }
    #score-container h2 {
        font-size: 1.5rem;
    }
    #score {
        font-size: 1.8rem;
    }
    #feedback-container {
        padding: 1rem;
        font-size: 0.9rem;
    }
}