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

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  padding: 20px;
}

.container {
  max-width: 500px;
  margin: auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1 {
  text-align: center;
  margin-bottom: 20px;
}

.task-input {
  display: flex;
  gap: 10px;
}

#new-task {
  flex: 1;
  padding: 10px;
  font-size: 16px;
  outline-offset: 2px;
}

#add-task {
  padding: 10px 15px;
  font-size: 16px;
  background-color: #28a745;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  outline-offset: 2px;
}

#add-task:hover {
  background-color: #218838;
}

ul {
  list-style: none;
  margin-top: 20px;
  padding-left: 0;
}

li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background-color: #f9f9f9;
  border-radius: 8px;
  flex-wrap: nowrap; /* Default to no wrap */
}

li span {
  flex: 1;
  word-break: break-word;
}

li.completed span {
  text-decoration: line-through;
  color: gray;
}

li input[type="checkbox"] {
  margin-right: 12px;
  cursor: pointer;
}

.task-controls {
  display: flex;
  gap: 10px;
}

button.edit, button.delete {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  outline-offset: 2px;
}

.edit {
  background-color: #007bff;
  color: #fff;
}

.edit:hover {
  background-color: #0056b3;
}

.delete {
  background-color: #dc3545;
  color: #fff;
}

.delete:hover {
  background-color: #bd2130;
}

/* Focus outlines for accessibility */
#new-task:focus, #add-task:focus, button.edit:focus, button.delete:focus {
  outline: 2px solid #80bdff;
}

/* Responsive styling */
@media (max-width: 500px) {
  .task-input {
    flex-direction: column;
  }

  #add-task {
    width: 100%;
  }

  li {
    flex-wrap: wrap;
  }

  li span {
    width: 100%;
  }

  .task-controls {
    margin-top: 8px;
    width: 100%;
    justify-content: flex-start;
    gap: 15px;
  }
}
