body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 调整为flex-start，让内容从顶部开始 */
    min-height: 100vh;
    margin: 0;
    padding: 20px; /* 增加整体内边距 */
    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: 600px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-weight: 700;
}

.input-section {
    display: flex;
    margin-bottom: 25px;
    gap: 10px; /* 增加间距 */
}

#todo-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#todo-input:focus {
    border-color: #007bff;
}

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

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

.progress-section {
    margin-bottom: 25px;
    text-align: center;
}

.progress-bar-container {
    background-color: #e9ecef;
    border-radius: 5px;
    height: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    background-color: #28a745;
    width: 0%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.95rem;
    color: #555;
    margin-top: 8px;
    display: block;
}

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

.todo-item {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.todo-item.completed {
    background-color: #e6ffe6; /* 更浅的绿色背景 */
    opacity: 0.8;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #888;
}

.todo-item input[type="checkbox"] {
    margin-right: 15px;
    transform: scale(1.3); /* 放大复选框 */
    cursor: pointer;
}

.todo-text {
    flex-grow: 1;
    font-size: 1.1rem;
    color: #333;
    word-break: break-word; /* 确保长文本换行 */
    cursor: pointer; /* 表示可编辑 */
    padding: 5px; /* 增加点击区域 */
}

.todo-text:focus {
    outline: 2px solid #007bff;
    border-radius: 3px;
}


.todo-item .actions {
    display: flex;
    gap: 10px; /* 按钮间距 */
    margin-left: 15px; /* 与文本的距离 */
}

.todo-item button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: transform 0.2s ease;
}

.todo-item button:hover {
    transform: scale(1.1);
}

.todo-item .edit-btn {
    color: #ffc107; /* 黄色 */
}

.todo-item .delete-btn {
    color: #dc3545; /* 红色 */
}

/* 移动设备适配 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .input-section {
        flex-direction: column;
    }

    #add-todo-btn {
        width: 100%;
        margin-top: 10px;
    }

    .todo-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .todo-item input[type="checkbox"] {
        margin-bottom: 10px;
    }

    .todo-text {
        width: 100%; /* 文本占据更多宽度 */
        margin-bottom: 10px;
    }

    .todo-item .actions {
        width: 100%;
        justify-content: flex-end; /* 按钮靠右 */
        margin-left: 0;
        margin-top: 10px;
    }
}