:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --ink: #1f2a24;
  --muted: #6b7c72;
  --line: #e2e9e4;
  --brand: #2e9e6b;
  --brand-dark: #227a52;
  --brand-soft: #e7f5ee;
  --warn: #e08a2b;
  --danger: #d9534f;
  --shadow: 0 2px 10px rgba(31, 42, 36, 0.06);
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 64px; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 12px; opacity: .9; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.card.done { border-color: var(--brand); background: var(--brand-soft); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.task-head { display: flex; align-items: center; gap: 10px; }
.task-emoji { font-size: 26px; line-height: 1; }
.task-title { font-weight: 700; font-size: 17px; }
.badge-new { background: var(--warn); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.week-badge { background: rgba(255,255,255,.2); border-radius: 999px; padding: 3px 10px; font-size: 13px; }

.check {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: transparent;
  background: #fff; flex: none; transition: all .15s; cursor: pointer;
}
.check.on { background: var(--brand); border-color: var(--brand); color: #fff; }

label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=time], input[type=date], input[type=password], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 60px; }
.inline2 { display: flex; gap: 10px; }
.inline2 > div { flex: 1; }

button {
  font-family: inherit; font-size: 15px; font-weight: 600; border: none; border-radius: 12px;
  padding: 11px 16px; cursor: pointer; background: var(--brand); color: #fff;
}
button.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.subtle { background: var(--brand-soft); color: var(--brand-dark); }
button.gray { background: #eef1ef; color: var(--ink); }
button.danger { background: var(--danger); }
button.sm { padding: 7px 12px; font-size: 13px; }
button:disabled { opacity: .5; }
button.full { width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 12px; }

.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.photo-box { margin-top: 10px; }
.photo-preview { width: 100%; border-radius: 12px; display: block; margin-top: 8px; }
.ai-comment { background: #fff7ec; border: 1px solid #f2dcbb; color: #7a5b25; border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }

.stat-row { display: flex; gap: 10px; margin: 4px 0 8px; }
.stat { flex: 1; background: var(--brand-soft); border-radius: 12px; padding: 10px; text-align: center; }
.stat .n { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.stat .l { font-size: 12px; color: var(--muted); }

.list-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.list-item:last-child { border-bottom: none; }
.code-chip { font-family: monospace; letter-spacing: 2px; background: var(--brand-soft); color: var(--brand-dark); padding: 2px 8px; border-radius: 8px; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2a24; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: .95; }
a { color: var(--brand-dark); }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.grid-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 5px; }
.day-cell { aspect-ratio: 1; border-radius: 7px; background: #eef1ef; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); }
.day-cell.hit { background: var(--brand); color: #fff; }
.hist-photo { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.hidden { display: none !important; }
