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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 16px;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 80vw;
  min-width: 320px;
  padding: 28px;
}

header h1 {
  font-size: 26px;
  color: #1f2937;
}

.sub {
  color: #9ca3af;
  font-size: 13px;
  margin-top: 4px;
}

/* 添加行 */
.add-row {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.add-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.add-row input:focus {
  border-color: #667eea;
}

.add-row button {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #667eea;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}

.add-row button:hover {
  background: #5a6fdb;
}

/* 列表 */
.todo-list {
  list-style: none;
  margin-top: 20px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #f3f4f6;
  animation: fade-in 0.2s ease;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  cursor: pointer;
  flex-shrink: 0;
}

.todo-text {
  flex: 1;
  font-size: 15px;
  color: #374151;
  word-break: break-all;
}

.todo-item.done .todo-text {
  color: #b0b7c3;
  text-decoration: line-through;
}

.todo-item .edit-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #667eea;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}

.actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
}

.icon-btn:hover {
  background: #f3f4f6;
}

.icon-btn.del:hover {
  background: #fee2e2;
}

.link-btn {
  border: none;
  background: transparent;
  color: #667eea;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

.link-btn:hover {
  text-decoration: underline;
}

/* 底部 */
.todo-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  color: #9ca3af;
  font-size: 13px;
}

.empty-tip {
  text-align: center;
  color: #c4c9d2;
  font-size: 14px;
  padding: 28px 0 12px;
}

.error {
  margin-top: 12px;
  color: #dc2626;
  font-size: 13px;
  background: #fef2f2;
  padding: 8px 12px;
  border-radius: 8px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
