* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 40px 20px;
  color: #333;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 36px;
}

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

header h1 {
  font-size: 28px;
  color: #2d3748;
  margin-bottom: 6px;
}

.subtitle {
  color: #718096;
  font-size: 14px;
}

/* 添加任务表单 */
.add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#taskInput {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

#taskInput:focus {
  border-color: #667eea;
}

#prioritySelect {
  padding: 12px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  outline: none;
}

#addBtn {
  padding: 12px 22px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

#addBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 14px;
  color: #718096;
}

.filter-btn {
  padding: 6px 14px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.filter-btn.active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

.task-count {
  margin-left: auto;
  font-size: 13px;
  color: #a0aec0;
}

/* 任务列表 */
.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f7fafc;
  border-radius: 10px;
  margin-bottom: 10px;
  border-left: 4px solid #e2e8f0;
  transition: background 0.2s;
}

.task-item:hover {
  background: #edf2f7;
}

.task-item.priority-high {
  border-left-color: #e53e3e;
}
.task-item.priority-medium {
  border-left-color: #d69e2e;
}
.task-item.priority-low {
  border-left-color: #38a169;
}

.task-title {
  flex: 1;
  font-size: 15px;
  color: #2d3748;
  word-break: break-word;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: #a0aec0;
}

.priority-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.priority-badge.high {
  background: #fed7d7;
  color: #c53030;
}
.priority-badge.medium {
  background: #fefcbf;
  color: #975a16;
}
.priority-badge.low {
  background: #c6f6d5;
  color: #276749;
}

.toggle-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  background: #e2e8f0;
  color: #4a5568;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background: #cbd5e0;
}

.task-item.completed .toggle-btn {
  background: #c6f6d5;
  color: #276749;
}

.delete-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  background: #fff5f5;
  color: #c53030;
  transition: all 0.2s;
}

.delete-btn:hover {
  background: #fed7d7;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 0;
  color: #a0aec0;
}

/* 响应式 */
@media (max-width: 520px) {
  .container {
    padding: 22px;
  }
  .add-form {
    flex-wrap: wrap;
  }
  #prioritySelect {
    width: 100%;
  }
}
