:root {
  color-scheme: dark;
  --bg: #111113;
  --fg: #ececee;
  --muted: #8b8b93;
  --faint: #3a3a40;
  --hover: #1c1c20;
  --check: #6ee7a8;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 16px calc(env(safe-area-inset-bottom) + 48px);
}

h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.error { color: #ff8a8a; }

/* sign in */
#signin { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; }
#signin h1 { font-size: 40px; }
#signin p { margin: 0; }
#dev-login { display: flex; gap: 8px; }
#dev-login input, #dev-login button { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--faint); background: var(--hover); }

/* list */
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.account {
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid var(--faint); background: var(--hover) center / cover no-repeat;
  font-size: 14px; font-weight: 600;
}

#add input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--faint);
  background: var(--hover);
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s;
}
#add input:focus { border-color: var(--muted); }
#add input::placeholder { color: var(--muted); }

ul { list-style: none; margin: 8px 0 0; padding: 0; }
li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 4px 4px 4px 8px;
  border-radius: 10px;
}
li.new { animation: in 0.2s ease-out; }
li:hover { background: var(--hover); }
@keyframes in { from { opacity: 0; transform: translateY(-4px); } }

.check {
  flex: none;
  width: 24px; height: 24px; padding: 0;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: transparent;
  display: grid; place-items: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.check svg { width: 14px; height: 14px; }
.check path { fill: none; stroke: var(--bg); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.25s ease 0.05s; }
.check:active { transform: scale(0.85); }
li.done .check, li.ticking .check { background: var(--check); border-color: var(--check); }
li.done .check path, li.ticking .check path { stroke-dashoffset: 0; }
li.ticking .check { animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
li.ticking { animation: out 0.35s ease-in 0.25s forwards; }
@keyframes pop { 50% { transform: scale(1.25); } }
@keyframes out { to { opacity: 0; transform: translateX(12px); } }

.text {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  outline: none;
  border-radius: 4px;
}
.text:focus { background: var(--hover); box-shadow: 0 0 0 4px var(--hover); }
li.done .text { color: var(--muted); text-decoration: line-through; }

.delete {
  flex: none;
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px; line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
li:hover .delete, .delete:focus-visible { opacity: 1; }
.delete:hover { background: var(--faint); color: var(--fg); }
@media (hover: none) { .delete { opacity: 0.6; } }

.empty { padding: 24px 8px; margin: 0; }

#done-section { margin-top: 24px; }
.done-head { display: flex; justify-content: space-between; padding: 0 8px; }
.link { border: none; background: none; padding: 6px 0; color: var(--muted); font-size: 14px; }
.link:hover { color: var(--fg); }
#done-section.collapsed ul { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); translate: -50% 0;
  margin: 0; padding: 10px 16px; border-radius: 99px;
  background: #2a2a30; font-size: 14px;
}
