/* Colors live here so they are easy to change. Dark mode swaps them below. */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6c6c70;
  --accent: #34c759;
  --btn: #e5e5ea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #ffffff;
    --muted: #98989d;
    --btn: #2c2c2e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* keeps content clear of the iPhone notch and home bar */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

h1 { margin: 8px 0 0; font-size: 2rem; }
.date { margin: 0 0 16px; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
}

h2 { margin: 0 0 12px; font-size: 1.2rem; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count {
  font-size: 3.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Big buttons: 72px is comfortable for a thumb */
.btn {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: var(--btn);
  color: var(--text);
  font-size: 2.2rem;
  cursor: pointer;
  touch-action: manipulation; /* avoids double-tap zoom delay */
}
.btn.plus { background: var(--accent); color: #fff; }
.btn:active { transform: scale(0.94); }

.bar {
  height: 10px;
  background: var(--btn);
  border-radius: 5px;
  margin: 12px 0;
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}

.goal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}
.goal input {
  width: 90px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  color: var(--text);
  font-size: 1.1rem; /* 16px+ stops iPhone from zooming on focus */
  text-align: center;
}

/* ---- To-do list ---- */
.task-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.task-form input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  color: var(--text);
  font-size: 1.1rem; /* 16px+ stops iPhone from zooming on focus */
}
.btn-add {
  padding: 0 18px;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

#task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.task label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px; /* whole row is tappable */
  cursor: pointer;
}
.task-text {
  overflow-wrap: anywhere;
  font-size: 1.1rem;
}
.task.done .task-text {
  text-decoration: line-through;
  color: var(--muted);
}
.empty {
  color: var(--muted);
  padding: 12px 0;
}

/* Big custom checkbox (32px) */
.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 32px;
  height: 32px;
  margin: 0;
  border: 2px solid var(--muted);
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-content: center;
}
.task input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task input[type="checkbox"]:checked::after {
  content: "✓";
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
}

.del {
  flex: none;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}
