/* ===== 头部 ===== */
.header-row { display: flex; align-items: center; gap: 10px; }
.header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: var(--primary-soft);
}
.header-name { font-size: 17px; font-weight: 700; }
.header-motto { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ===== 通用 ===== */
.section-title { font-size: 16px; font-weight: 700; margin: 4px 2px 12px; }
.muted { color: var(--text-3); }
.empty {
  text-align: center; color: var(--text-3);
  padding: 48px 16px; font-size: 14px;
}

/* ===== 录入条 ===== */
.add-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.add-bar input[type="text"] {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); outline: none;
}
.add-bar input[type="text"]:focus { border-color: var(--primary); }
.add-bar input[type="date"] {
  width: 132px; padding: 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); color: var(--text-2);
}
.btn-primary {
  padding: 10px 16px; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600; white-space: nowrap;
}
.btn-primary:disabled { opacity: 0.5; }
.btn-ghost {
  padding: 7px 14px; background: transparent; color: var(--text-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); white-space: nowrap;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

/* ===== 身份（按名字隔离） ===== */
.owner-tip { font-size: 13px; color: var(--text-2); line-height: 1.6; margin: 0 0 14px; }
.owner-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 14px; box-sizing: border-box;
}
.owner-input:focus { border-color: var(--primary); outline: none; }
.owner-ok { width: 100%; margin-top: 12px; }
.owner-tip b { color: var(--text); font-weight: 600; }

/* ===== 修改任务弹窗 ===== */
.edit-input { resize: none; line-height: 1.6; font-family: inherit; }
.edit-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px;
}
.edit-count { font-size: 12px; color: var(--text-3); }
.edit-actions { display: flex; gap: 8px; }
/* 未填名字时抖动提示 */
.owner-input.shake { border-color: #f56c6c; animation: owner-shake 0.35s ease; }
@keyframes owner-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.owner-field .owner-current {
  font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px;
}

/* ===== 首页「今天」条 ===== */
.today-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.today-title { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.today-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.badge-lg {
  font-size: 13px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border-radius: 14px; padding: 4px 12px;
}

/* ===== 分组 ===== */
.group { margin-bottom: 16px; }
.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 4px 8px; font-size: 13px; color: var(--text-2);
}
.group-head .badge {
  font-size: 12px; color: var(--text-3);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 8px;
}
.task-list { list-style: none; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* ===== 任务行三态 ===== */
.task {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); flex: 0 0 auto; }
.task-text { flex: 1; word-break: break-word; }
/* 首页任务文字可点击修改（只读列表不受影响） */
#home-list .task:not([data-status="deleted"]) .task-text {
  cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px;
  transition: background 0.15s;
}
#home-list .task:not([data-status="deleted"]) .task-text:hover { background: var(--bg); }
.task .btn-del {
  font-size: 16px; color: var(--text-3); padding: 4px 6px; border-radius: 6px;
}
.task .btn-del:hover { background: var(--bg); color: var(--danger); }

.task[data-done="1"] .task-text { color: var(--primary); }
.task[data-status="deleted"] .task-text { color: var(--text-3); text-decoration: line-through; }
.task[data-status="deleted"] { opacity: 0.55; }
.task[data-status="deleted"] input[type="checkbox"] { pointer-events: none; }

/* 分组切换处（待完成 → 已完成 → 已删除）的分隔线，仅首页可编辑列表生效 */
.task-list:not(.readonly) .task.group-start { border-top: 3px solid var(--bg); }

/* ===== 概览页 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; text-align: center;
}
.stat-card .num { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.tree-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-align: center; margin-bottom: 16px;
}
.tree-card svg { width: 160px; height: 160px; }
.tree-stage { font-size: 16px; font-weight: 700; margin-top: 4px; }
.tree-hint { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.tree-hint b { color: var(--primary); }
.progress { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--primary); transition: width 0.4s; }
.drops-num { font-size: 13px; color: var(--text-3); margin-top: 6px; }

/* 迷你日历热力图 */
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 6px; }
.heat-cell {
  aspect-ratio: 1 / 1; border-radius: 5px; background: var(--bg);
  display: grid; place-items: center; font-size: 10px; color: var(--text-3);
}
.heat-cell.filled { color: #fff; }
.heat-cell.day { cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.heat-cell.day:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--primary-soft); }
.heat-cell.day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-tip { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 10px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(31, 35, 41, 0.42);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.16s ease;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: 100%; max-width: 480px; max-height: 78vh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(16px); transition: transform 0.2s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.modal-mask.show .modal { transform: translateY(0); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { font-size: 15px; color: var(--text-3); padding: 4px 6px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 14px 16px 20px; overflow-y: auto; }
.modal-body .empty { padding: 32px 12px; }

@media (min-width: 560px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 16px; max-height: 72vh; }
}

/* 弹窗内：当天统计 + 只读任务清单 */
.day-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 12px;
  background: var(--bg); color: var(--text-2);
}
.chip.ok { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip.gray { color: var(--text-3); }
.chip.water { background: #e8f1fb; color: #3a7bd5; font-weight: 600; }

.task-list.readonly { box-shadow: none; border: 1px solid var(--line); }
.task-list.readonly .task { padding: 11px 12px; }
.task-mark {
  width: 20px; flex: 0 0 auto; text-align: center;
  font-size: 14px; color: var(--text-3);
}
.task[data-done="1"] .task-mark { color: var(--primary); }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg); color: var(--text-3); flex: 0 0 auto;
}
.tag.ok { background: var(--primary-soft); color: var(--primary); }
.tag.gray { background: var(--bg); color: var(--text-3); }

/* ===== 我的页 ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); outline: none;
}
.field input[type="text"]:focus { border-color: var(--primary); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-opt {
  aspect-ratio: 1/1; display: grid; place-items: center; font-size: 22px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--card);
}
.avatar-opt.active { border-color: var(--primary); background: var(--primary-soft); }
.profile-readonly { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-top: 8px; font-size: 14px; }
.profile-readonly div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--text-2); }
.profile-readonly b { color: var(--text); }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.9); color: #fff; padding: 9px 16px;
  border-radius: 20px; font-size: 13px; z-index: 100; max-width: 80%;
  text-align: center; animation: toast-in 0.2s ease;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
