:root {
  --bg: #fafaf9; --panel: #fff; --ink: #18181b; --muted: #6b6b70; --faint: #a1a1aa; --line: #e7e5e4;
  --accent: #ea580c; --done: #16a34a; --on-ink: #fff; --danger: #c2410c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111113; --panel: #1a1a1d; --ink: #f4f4f5; --muted: #a1a1aa; --faint: #71717a; --line: #2a2a2e; --on-ink: #111113; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom); }
.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, monospace; font-size: 14px; }
.status { flex: 1; font-size: 12px; color: var(--muted); text-align: right; }
.home-link { font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 6px 10px; border: 1px solid var(--accent); border-radius: 999px; }
.page { max-width: 640px; margin: 0 auto; }
h1 { font-size: 21px; margin: 20px 16px 6px; }
h2 { font-size: 17px; margin: 0; display: flex; gap: 6px; align-items: baseline; }
.count { font-size: 13px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.lead, .hint { margin: 8px 16px; color: var(--muted); font-size: 14px; }
.sub { margin: 2px 0 6px; color: var(--muted); font-size: 13px; min-height: 0; }
.block { margin: 12px 12px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.list { list-style: none; margin: 4px 0 8px; padding: 0; }
.item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 48px;
  border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item.need { grid-template-columns: minmax(0, 1fr); padding-left: 4px; }
.name { overflow-wrap: anywhere; }
.by { font-size: 12px; color: var(--faint); }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--faint); background: transparent; padding: 0; cursor: pointer; }
.item.done .check { background: var(--done); border-color: var(--done); position: relative; }
.item.done .check::after { content: ""; position: absolute; left: 9px; top: 4px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.item.done .name { text-decoration: line-through; color: var(--muted); }
.check:disabled { opacity: .4; }
.add { display: flex; gap: 8px; margin-top: 8px; }
input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
button { font: inherit; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
#pairForm { display: flex; flex-direction: column; gap: 10px; margin: 16px; }
label { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); margin: 0; }
[hidden] { display: none !important; }
