:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f0f0f6;
  --text: #1b1b25;
  --muted: #6c6c7e;
  --border: #e4e4ee;
  --accent: #5b4be6;
  --accent-contrast: #ffffff;
  --done: #9aa0b4;
  --danger: #d6455d;
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 8px 28px rgba(20, 20, 40, 0.06);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e16;
    --surface: #181826;
    --surface-2: #20202f;
    --text: #ececf3;
    --muted: #9a9ab0;
    --border: #2a2a3c;
    --accent: #8b7cff;
    --accent-contrast: #12121c;
    --done: #5a5a72;
    --danger: #ff6b82;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}
.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  display: inline-block;
}

header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
}
header.top .links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 16px;
}
header.top .links a:hover { color: var(--text); }

h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 12px;
}
.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 32px;
  max-width: 30em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.row { display: flex; gap: 10px; }
.row.stack { flex-direction: column; }

input[type="text"], input[type="url"] {
  flex: 1;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
}
input[type="text"]:focus, input[type="url"]:focus {
  border-color: var(--accent);
}

button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-contrast);
  transition: filter 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button.ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.icon {
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 1.1rem;
}
button.icon:hover { color: var(--danger); }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }

/* ---- list view ---- */
.list-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.list-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border: none;
  background: transparent;
  color: var(--text);
  width: 100%;
  padding: 4px 0;
}
.list-title:focus { outline: none; border-bottom: 2px solid var(--accent); }

.meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 22px; }
.meta .count { color: var(--text); font-weight: 600; }

ul.items { list-style: none; margin: 0; padding: 0; }
li.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
li.item:last-child { border-bottom: none; }

.check {
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin-top: 1px;
  border: 2px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  background: var(--surface);
}
.check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.item-text {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1.02rem;
  line-height: 1.45;
  padding: 1px 0;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.item-text:focus { outline: none; }
li.item.done .item-text {
  color: var(--done);
  text-decoration: line-through;
}

.item .icon { margin-top: 1px; }

.add-row { margin-top: 18px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

.footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  gap: 10px;
  flex-wrap: wrap;
}

code.id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
}
