:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6f6e68;
  --line: #dfddd6;
  --accent: #1c1c1a;
  --on-accent: #ffffff;
  --alert: #c8321e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #212120;
    --text: #efeee9;
    --muted: #9a9992;
    --line: #353533;
    --accent: #efeee9;
    --on-accent: #161615;
    --alert: #ff7a66;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom));
}

h1 { margin: 0; font-size: 1.5rem; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

input, select, button { font: inherit; color: inherit; }

input, select {
  width: 100%;
  min-width: 0;
  height: 2.75rem;
  padding: 0 .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .5rem;
}

input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

button { cursor: pointer; }

.primary {
  height: 2.75rem;
  padding: 0 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: .5rem;
  font-weight: 600;
}

.link {
  padding: .25rem;
  background: none;
  border: 0;
  color: inherit;
  text-decoration: underline;
}

.muted { color: var(--muted); }

#login, #add { display: grid; gap: .5rem; }
.row { display: grid; grid-template-columns: 3fr 2fr; gap: .5rem; }

.notice {
  display: grid;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding: .875rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .5rem;
}

#empty { margin-top: 2rem; text-align: center; }
#tasks { margin-top: 1.25rem; }

.task {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 3.5rem;
  border-top: 1px solid var(--line);
}

.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: -.5rem;
  background: none;
  border: 0;
}

.check::before {
  content: "";
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.task.overdue .check::before { border-color: var(--alert); }
.task.done .check::before { background: var(--muted); box-shadow: inset 0 0 0 3px var(--bg); }

.body { flex: 1; min-width: 0; padding: .5rem 0; }
.name { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .875rem; }
.task.overdue .meta { color: var(--alert); font-weight: 600; }
.task.done .name { color: var(--muted); text-decoration: line-through; }

.delete {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -.5rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.25rem;
}

#doneBox { margin-top: 1.25rem; }
summary { padding: .5rem 0; color: var(--muted); cursor: pointer; }

footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
}

#msg {
  position: sticky;
  bottom: 1rem;
  margin-top: 1rem;
  padding: .625rem .875rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: .5rem;
  font-size: .875rem;
}
