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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

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

h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 300;
  color: #b83f45;
  margin-bottom: 1.5rem;
}

.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.todo-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.todo-form input:focus {
  border-color: #b83f45;
}

.todo-form button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: #b83f45;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.todo-form button:hover {
  background: #a33038;
}

.filters {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  color: #777;
  transition: border-color 0.2s, color 0.2s;
}

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

.filter-btn.active {
  border-color: #b83f45;
  color: #b83f45;
}

.todo-list {
  list-style: none;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.todo-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  gap: 0.75rem;
}

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

.todo-item input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #b83f45;
}

.todo-item .todo-title {
  flex: 1;
  font-size: 1rem;
  cursor: text;
  word-break: break-word;
}

.todo-item.completed .todo-title {
  text-decoration: line-through;
  color: #aaa;
}

.todo-item .todo-title.editing {
  padding: 0.25rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  outline: none;
}

.todo-item .delete-btn {
  background: none;
  border: none;
  color: #cc9a9a;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

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

.todo-item .delete-btn:hover {
  color: #b83f45;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #777;
}

.clear-btn {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #333;
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .todo-form input {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }

  .todo-form button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

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