:root {
  --bg: #F7F2E8;
  --card: #FFFDF8;
  --ink: #3B2A1C;
  --muted: #8A7663;
  --line: #E8DDCB;
  --accent: #9A6A3C;
  --accent-ink: #FFFDF8;
  --accent-soft: #F1E4CF;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1712;
    --card: #27201A;
    --ink: #F1E7D8;
    --muted: #A8957F;
    --line: #3A3027;
    --accent: #D9A866;
    --accent-ink: #1C1712;
    --accent-soft: #3A2E22;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

.top { padding: 20px 22px 4px; max-width: 560px; margin: 0 auto; }
.date { margin: 0; color: var(--muted); font-size: 15px; }
h1 { margin: 2px 0 4px; font-size: 30px; font-weight: 700; letter-spacing: 0.04em; }
.summary { margin: 0; color: var(--muted); font-size: 15px; }

.list {
  display: grid;
  gap: 10px;
  padding: 12px 16px 28px;
  max-width: 560px;
  margin: 0 auto;
}

.card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px 12px 20px;
}
.name { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.06em; }
.counts { margin: 2px 0 0; display: flex; gap: 18px; align-items: baseline; color: var(--muted); font-size: 15px; }
.counts b { color: var(--ink); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 2px; }
.counts .total b { font-size: 17px; }

.actions { display: flex; flex-direction: column; align-items: center; gap: 0; }
.plus {
  width: 66px; height: 66px;
  border: 0; border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit; font-size: 25px; font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease;
}
.plus:active { transform: scale(0.93); }
.plus.done { animation: pop 0.35s ease; }
@keyframes pop { 50% { transform: scale(1.08); } }

.undo {
  border: 0; background: none;
  color: var(--muted);
  font: inherit; font-size: 14px;
  padding: 4px 10px;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}
.undo:active { background: var(--accent-soft); }
.undo[hidden] { display: block; visibility: hidden; }

.toast {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 15px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .plus, .toast { transition: none; }
  .plus.done { animation: none; }
}
