/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-light: #8a8a8a;
  --border: #e6e6e6;
  --primary: #4a6cf7;
  --primary-hover: #3a5ae0;
  --success: #34c759;
  --danger: #ff3b30;
  --radius: 10px;
}

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

/* ===== 容器 ===== */
.container {
  width: 100%;
  max-width: 520px;
}

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

.header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}

/* ===== 表单 ===== */
.todo-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.todo-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--card);
}

.todo-form input:focus {
  border-color: var(--primary);
}

.todo-form button {
  padding: 12px 22px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.todo-form button:hover {
  background: var(--primary-hover);
}

/* ===== 列表 ===== */
.todo-list {
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: opacity 0.2s;
}

.todo-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--success);
}

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

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-light);
}

.todo-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.todo-item:hover .todo-delete {
  opacity: 1;
}

/* ===== 空状态 ===== */
.empty-tip {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  margin-top: 30px;
}

.hidden {
  display: none;
}
