:root {
    --bg: #f0f2f5;
    --card: #fff;
    --primary: #6c5ce7;
    --primary-hover: #5a4bd1;
    --text: #2d3436;
    --text-light: #888;
    --border: #e8ecf1;
    --danger: #e74c3c;
    --success: #00b894;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(160deg, #f3f0ff 0%, #f0f2f5 35%, #fff5f5 70%, #f0faff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.app {
    width: 100%;
    max-width: 520px;
    background: var(--card);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 30px 26px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
}
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.3px;
}
.header h1 .icon {
    font-size: 1.7rem;
    animation: bounce 2s infinite;
}
@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
    50% {
        transform: translateY(0);
    }
    70% {
        transform: translateY(-2px);
    }
}
.stats {
    font-size: 0.82rem;
    color: var(--text-light);
    background: #f7f8fc;
    padding: 7px 14px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--transition);
}
.stats.pulse {
    transform: scale(1.08);
    color: var(--primary);
}
.input-row {
    display: flex;
    gap: 10px;
}
.input-row input {
    flex: 1;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition);
    background: #fafbfc;
    color: var(--text);
}
.input-row input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08);
}
.input-row input::placeholder {
    color: #c0c7cf;
}
.btn {
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.93rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.btn-add {
    background: var(--primary);
    color: #fff;
}
.btn-add:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(108, 92, 231, 0.35);
}
.btn-add:active {
    transform: scale(0.95);
}
.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 9px 18px;
    border: 2px solid var(--border);
    background: #fff;
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all var(--transition);
}
.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 3px 12px rgba(108, 92, 231, 0.25);
}
.filter-btn:hover:not(.active) {
    border-color: #d5d8e8;
    background: #fafbfd;
    transform: translateY(-1px);
}
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 440px;
    overflow-y: auto;
    padding-right: 3px;
    min-height: 60px;
}
.task-list::-webkit-scrollbar {
    width: 4px;
}
.task-list::-webkit-scrollbar-thumb {
    background: #e0e4ee;
    border-radius: 10px;
}
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fafbfd;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border: 2px solid transparent;
    animation: slideIn 0.35s ease;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}
.task-item.removing {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
    max-height: 0;
    padding: 0 14px;
    margin: 0;
    border-width: 0;
    overflow: hidden;
    gap: 0;
}
.task-item:hover {
    border-color: #e4e8f2;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.task-item.completed .task-text {
    text-decoration: line-through;
    color: #c0c7cf;
}
.task-item.completed {
    background: #f8faf9;
    opacity: 0.7;
}
.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d0d5e0;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 0.65rem;
    font-weight: 700;
    color: transparent;
    background: #fff;
    margin-top: 1px;
    user-select: none;
}
.task-checkbox:hover {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(0, 184, 148, 0.1);
}
.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.task-text {
    font-size: 0.93rem;
    color: var(--text);
    word-break: break-word;
    line-height: 1.45;
    cursor: pointer;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 5px;
    transition: background var(--transition);
    outline: none;
}
.task-text:hover {
    background: #f0f2f8;
}
.task-text.editing {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary), 0 0 0 5px rgba(108, 92, 231, 0.12);
    cursor: text;
    border-radius: 6px;
}
.task-time {
    font-size: 0.7rem;
    color: #c0c7cf;
    letter-spacing: 0.2px;
    user-select: none;
}
.btn-del {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    color: #d5d8e0;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all var(--transition);
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}
.btn-del:hover {
    color: var(--danger);
    background: #fef2f2;
}
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #ddd;
    display: none;
}
.empty-state.show {
    display: block;
}
.empty-state .emoji {
    font-size: 3.2rem;
    display: block;
    margin-bottom: 14px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}
.empty-state p {
    font-size: 0.9rem;
    color: #c0c7cf;
}
.action-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}
.btn-clear {
    background: transparent;
    border: none;
    color: #c0c7cf;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all var(--transition);
}
.btn-clear:hover {
    color: var(--danger);
    background: #fef2f2;
}
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: #2d3436;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.toast .undo-link {
    color: #74b9ff;
    cursor: pointer;
    pointer-events: auto;
    font-weight: 600;
    text-decoration: underline;
    margin-left: 4px;
}
@media (max-width: 480px) {
    .app {
        padding: 22px 14px 16px;
        border-radius: 16px;
        gap: 14px;
        max-width: 100%;
    }
    .header h1 {
        font-size: 1.25rem;
    }
    .stats {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    .input-row input {
        padding: 11px 13px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
    }
    .btn {
        padding: 11px 16px;
        font-size: 0.85rem;
        border-radius: var(--radius-sm);
    }
    .btn-add {
        padding: 11px 14px;
    }
    .task-item {
        padding: 10px 12px;
        gap: 8px;
        border-radius: 8px;
    }
    .filter-btn {
        padding: 7px 13px;
        font-size: 0.78rem;
    }
    .toast {
        bottom: 18px;
        padding: 10px 18px;
        font-size: 0.8rem;
        border-radius: 24px;
    }
}