body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px; /* Added padding for small screens */
    box-sizing: border-box; /* Ensures padding is included in the element's total width and height */
}

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

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #333;
    margin: 0;
    font-size: 2em; /* Responsive font size */
}

.header p {
    color: #888;
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#taskInput {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#dateInput {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#addTaskBtn {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

#addTaskBtn:hover {
    background-color: #45a049;
}

.controls {
    text-align: center;
    margin-bottom: 20px;
}

#rewardBtn {
    padding: 10px 20px;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

#rewardBtn:hover {
    background-color: #f57c00;
}

#taskList {
    list-style: none;
    padding: 0;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 10px; /* Add gap between items */
}

.task-item.completed span {
    text-decoration: line-through;
    color: #aaa;
}

.task-item input[type="checkbox"] {
    margin-right: 15px;
}

.task-item span {
    flex-grow: 1;
}

.task-item .due-date {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
    width: 100%; /* Take full width on a new line if needed */
    text-align: left; /* Align to the left */
    padding-left: 25px; /* Align with task text */
}

.task-item .edit-btn, .task-item .delete-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white;
    margin-left: 5px;
}

.task-item .edit-btn {
    background-color: #2196F3;
}

.task-item .delete-btn {
    background-color: #f44336;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    text-align: center;
    border-radius: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    .input-section {
        flex-direction: column; /* Stack input fields vertically */
    }

    #dateInput {
        width: 100%; /* Make date input full width */
        box-sizing: border-box; /* Include padding and border in the element's total width and height */
    }

    .task-item {
        flex-direction: column; /* Stack task items vertically */
        align-items: flex-start;
    }

    .task-item .due-date {
        padding-left: 0; /* Remove padding for due date */
    }

    .task-item .edit-btn, .task-item .delete-btn {
        margin-top: 10px; /* Add some space above buttons */
    }

    .header h1 {
        font-size: 1.5em; /* Smaller font size for smaller screens */
    }
}