* {
	box-sizing: border-box;
}

body {
	display: grid;
	place-items: center;
	min-height: 100vh;
	margin: 0;
	padding: 1.5rem;
	background: #f4f4f6;
	font-family: system-ui, sans-serif;
	color: #1c1c22;
}

.todo {
	width: min(30rem, 100%);
	padding: 2rem;
	border-radius: 1.5rem;
	background: #ffffff;
	box-shadow: 0 10px 30px -15px rgb(0 0 0 / 0.25);
}

.todo-title {
	margin: 0 0 1.25rem;
	font-size: 1.75rem;
}

.todo-label {
	display: block;
	margin-bottom: 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
}

.todo-row {
	display: flex;
	gap: 0.5rem;
}

.todo-input {
	flex: 1;
	min-width: 0;
	padding: 0.625rem 0.875rem;
	border: 2px solid #1c1c22;
	border-radius: 999px;
	font: inherit;
}

.todo-add {
	padding: 0.625rem 1.25rem;
	border: 0;
	border-radius: 999px;
	background: #1c1c22;
	font: inherit;
	font-weight: 600;
	color: #ffffff;
	cursor: pointer;
}

.todo-add:hover {
	background: #3a3a44;
}

.todo-input:focus-visible,
.todo-add:focus-visible,
.todo-item input:focus-visible,
.todo-delete:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 2px;
}

.todo-count {
	margin: 1.5rem 0 0.5rem;
	font-size: 0.875rem;
	color: #6b6b76;
}

.todo-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

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

.todo-item input {
	width: 1.125rem;
	height: 1.125rem;
	accent-color: #1c1c22;
}

/* The label takes the spare room, so Delete sits at the far end. */
.todo-item label {
	flex: 1;
	overflow-wrap: anywhere;
	cursor: pointer;
}

/* :checked + label strikes through a done task, no JavaScript needed. */
.todo-item input:checked + label {
	color: #9a9aa6;
	text-decoration: line-through;
}

.todo-delete {
	padding: 0.25rem 0.75rem;
	border: 1px solid #e4e4e8;
	border-radius: 999px;
	background: none;
	font: inherit;
	font-size: 0.875rem;
	color: #6b6b76;
	cursor: pointer;
}

.todo-delete:hover {
	border-color: #b91c1c;
	color: #b91c1c;
}

.todo-empty {
	margin: 0.5rem 0 0;
	color: #6b6b76;
}
