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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: hsl(40, 20%, 97%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 16px 80px;
}

main {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Header ── */
header {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.875rem;
  font-weight: 500;
  color: hsl(130, 8%, 19%);
  letter-spacing: -0.025em;
}

.subtitle {
  font-size: 0.875rem;
  color: hsl(130, 4%, 45%);
}

/* ── Task list + add form wrapper ── */
.task-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Task list ── */
#task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Card base ── */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid hsl(40, 12%, 87%);
  box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02), 0px 1px 2px -1px rgba(0, 0, 0, 0.03);
  height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Task card drag cursor + hover ── */
li.card {
  cursor: grab;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

li.card:active {
  cursor: grabbing;
}

li.card:hover {
  box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.03), 0px 8px 16px -4px rgba(0, 0, 0, 0.09);
  border-color: hsl(126 7% 45% / 0.5);
}

/* ── Completed card ── */
li.card.is-completed {
  background: hsl(40, 15%, 98%);
}

li.card.is-completed:hover {
  box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02), 0px 4px 8px -2px rgba(0, 0, 0, 0.04);
  border-color: hsl(40, 12%, 80%);
}

/* ── Checkbox button ── */
.task-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: hsl(40, 12%, 78%);
  line-height: 0;
  transition: color 0.15s, transform 0.1s;
}

.task-check svg {
  display: block;
  width: 16px;
  height: 16px;
}

li.card:hover .task-check,
.task-check:hover {
  color: hsl(126, 10%, 60%);
  transform: scale(1.1);
}

.task-check.is-completed {
  color: hsl(126, 6%, 68%);
}

li.card:hover .task-check.is-completed,
.task-check.is-completed:hover {
  color: hsl(126, 6%, 58%);
  transform: scale(1.1);
}

/* ── Task text ── */
.task-text {
  font-size: 1rem;
  font-weight: 500;
  color: hsl(130, 8%, 19%);
  outline: none;
  word-break: break-word;
  line-height: 1.4;
  cursor: text;
  border-radius: 4px;
  padding: 2px 3px;
  margin: -2px -3px;
  transition: background 0.1s;
}

.task-text:focus {
  background: #fff;
}

.task-text.completed {
  color: hsl(130, 3%, 68%);
  cursor: default;
}

/* ── Sortable drag states ── */
.sortable-ghost {
  opacity: 0.5;
  background: hsl(40, 10%, 90%);
  border-style: dashed;
  border-color: hsl(40, 12%, 87%);
  box-shadow: none;
}

.sortable-drag {
  box-shadow:
    0 0 0 2px hsl(126 7% 45% / 0.2),
    0px 2px 0px 0px rgba(0, 0, 0, 0.02),
    0px 16px 24px -8px rgba(0, 0, 0, 0.06) !important;
  transform: scale(1.02) !important;
  opacity: 0.95 !important;
  cursor: grabbing !important;
}

.sortable-chosen {
  box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02), 0px 4px 8px -2px rgba(0, 0, 0, 0.04);
  border-color: hsl(126 7% 45% / 0.3);
}

/* ── Delete button ── */
.task-delete {
  flex-shrink: 0;
  margin-left: auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: hsl(130, 4%, 65%);
  line-height: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.task-delete svg {
  width: 14px;
  height: 14px;
}

li.card:hover .task-delete {
  opacity: 1;
}

.task-delete:hover {
  color: hsl(0, 60%, 55%);
  background: hsl(0, 80%, 97%);
}

/* ── Done subheader ── */
.done-header {
  font-size: 0.875rem;
  color: hsl(130, 4%, 45%);
  padding: 12px 8px 0;
}

/* ── Add card ── */
.add-card {
  border: 1px dashed hsl(40, 12%, 87%);
  background: transparent;
  box-shadow: none;
  cursor: text;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  border-radius: 16px;
}

.add-card:hover {
  border-color: hsl(126 7% 45% / 0.4);
}

.add-card:focus-within {
  border-color: hsl(126 7% 45% / 0.6);
}

.add-icon {
  flex-shrink: 0;
  line-height: 0;
  color: hsl(130 4% 45% / 0.5);
  transition: color 0.15s;
}

.add-card:focus-within .add-icon {
  color: hsl(126 7% 45% / 0.6);
}

.add-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.add-card input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: hsl(130, 8%, 19%);
  background: transparent;
  padding: 2px 0;
}

.add-card input::placeholder {
  color: hsl(130 4% 45% / 0.6);
  font-weight: 400;
}
