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

.container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 600px; /* Limit maximum width on larger screens */
    box-sizing: border-box;
}

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

p {
    color: #555;
    margin-bottom: 20px;
}

textarea {
    width: calc(100% - 20px); /* Adjust for padding/border */
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    resize: vertical; /* Allow vertical resizing */
    min-height: 100px; /* Ensure enough space for typing */
    box-sizing: border-box;
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%; /* Full width button on mobile */
    box-sizing: border-box;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#resultArea {
    margin-top: 20px;
    padding: 15px;
    background-color: #e9e9e9;
    border-radius: 4px;
    text-align: left;
    word-wrap: break-word; /* Prevent long words from overflowing */
}

#resultArea h3 {
    margin-top: 0;
    color: #333;
}

#resultArea p {
    /* Adjust margin for paragraphs inside resultArea */
    margin-bottom: 10px;
    color: #555;
}

#resultArea p:last-child {
    margin-bottom: 0; /* Remove margin from the last paragraph */
}

#resultArea .grade {
    font-size: 1rem; /* Slightly smaller size for individual grades */
    font-weight: bold;
    color: #007bff; /* Default grade color */
    display: inline-block; /* Allow padding and margin */
    min-width: 25px; /* Ensure consistent width for grades */
    text-align: center;
}

/* Specific colors for grades */
#resultArea .grade.A { color: #28a745; } /* Green */
#resultArea .grade.B { color: #17a2b8; } /* Cyan */
#resultArea .grade.C { color: #ffc107; } /* Yellow */
#resultArea .grade.D { color: #fd7e14; } /* Orange */
#resultArea .grade.F { color: #dc3545; } /* Red */

.ratings-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc; /* Add a separator line */
}

.ratings-summary p {
    margin-bottom: 5px; /* Less space between ratings */
}

/* Mobile specific styles */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    textarea {
        font-size: 1rem;
    }

    button {
        font-size: 1rem;
    }

    #resultArea .grade {
        font-size: 1rem; /* Keep consistent on mobile */
    }
}