*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #e2e0db;
  --text: #1a1a18;
  --text-muted: #888580;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  display: flex;
  justify-content: center;
  padding: 3rem 1rem 6rem;
}

.container {
  width: 100%;
  max-width: 560px;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}

header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* Add task form */
.add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.add-form input[type="text"] {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.add-form input[type="text"]:focus {
  border-color: var(--accent);
}

.add-form input[type="text"]::placeholder {
  color: var(--text-muted);
}

.add-form button {
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.add-form button:hover {
  background: var(--accent-hover);
}

.add-form button:active {
  transform: scale(0.97);
}

/* Task list */
#todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: opacity 0.2s;
}

.task:hover {
  border-color: #ccc9c3;
}

/* Custom checkbox */
.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.task input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(0, -1px);
}

.task input[type="checkbox"]:hover:not(:checked) {
  border-color: var(--accent);
}

.task-label {
  font-size: 0.95rem;
  flex: 1;
  transition: color 0.2s;
}

.task.completed .task-label {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Empty state */
#todo-list:empty::after {
  content: "No tasks yet — add one above!";
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 2rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
}

footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1.5px solid var(--border);
  text-align: center;
}

footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
