:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5a616b;
  --done: #4b525c;
  --line: #e3e6ea;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --danger: #b42318;
  --notice-bg: #fff4e5;
  --notice-text: #7a4100;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --card: #1c1f25;
    --text: #eceef1;
    --muted: #a6adb8;
    --done: #a6adb8;
    --line: #2d323a;
    --accent: #6b8cff;
    --accent-text: #0d1020;
    --danger: #ff8a80;
    --notice-bg: #3a2a12;
    --notice-text: #ffd59a;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 24px 16px;
}

.card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
  padding: 20px;
}

.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }

.counter { margin: 0; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.notice {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.add { display: flex; gap: 8px; }

.add input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.add input::placeholder { color: var(--muted); }

.add button {
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

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

.item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line);
}

.item:first-child { border-top: 0; }

.item label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0;
  cursor: pointer;
}

.item input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0 0 0 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.item .text { overflow-wrap: anywhere; }

.item.done .text { color: var(--done); text-decoration: line-through; }

.delete {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.delete:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.empty { color: var(--muted); text-align: center; margin: 24px 0 8px; }

.foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
