/* 清新薄荷绿 主题 - 移动优先响应式 */
:root {
  --green-50:  #f0faf4;
  --green-100: #d9f2e3;
  --green-200: #b3e5c7;
  --green-400: #5fcf90;
  --green-500: #3cb878;
  --green-600: #2a9a5e;
  --green-700: #1f7a4a;
  --text:      #1f2d27;
  --text-2:    #5a6b63;
  --text-3:    #95a59c;
  --bg:        #f7fbf8;
  --card:      #ffffff;
  --border:    #e6efe9;
  --shadow:    0 4px 20px rgba(60, 184, 120, 0.08);
  --shadow-lg: 0 10px 40px rgba(60, 184, 120, 0.15);
  --radius:    16px;
  --radius-sm: 10px;
  --danger:    #e85d5d;
  --warning:   #f0a040;
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; font-size: inherit; }

/* 通用 */
.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 12px; }
.hint { color: var(--text-2); font-size: 13px; margin: 8px 0; }
.full-width { width: 100%; }

.btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn.primary {
  background: var(--green-500);
  color: white;
  box-shadow: 0 2px 8px rgba(60, 184, 120, 0.3);
}
.btn.primary:active { background: var(--green-600); transform: scale(0.98); }
.btn.ghost {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-100);
}
.btn.ghost:active { background: var(--green-100); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  transition: background 0.2s;
}
.icon-btn:hover, .icon-btn:active { background: var(--green-50); }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 45, 39, 0.92);
  color: white;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  z-index: 9999;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 认证页 */
.auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand { text-align: center; margin-bottom: 40px; }
.brand-icon { font-size: 56px; margin-bottom: 12px; }
.brand h1 { font-size: 28px; font-weight: 600; color: var(--green-700); }
.brand-sub { color: var(--text-2); margin-top: 6px; }

.auth-step h2 { text-align: center; margin-bottom: 8px; }
.auth-step input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-top: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 16px;
  transition: border-color 0.2s;
}
.auth-step input:focus { outline: none; border-color: var(--green-400); }
.auth-step .btn { width: 100%; margin-top: 16px; }
.link { text-align: center; color: var(--green-600); margin-top: 16px; font-size: 14px; cursor: pointer; }

.backup-box {
  margin-top: 20px;
  padding: 16px;
  background: #fff8e6;
  border: 1px solid #ffe0a3;
  border-radius: var(--radius-sm);
  text-align: center;
}
.backup-box code {
  display: block;
  margin: 12px 0;
  padding: 12px;
  background: white;
  border-radius: 8px;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--warning);
  font-weight: 600;
  word-break: break-all;
}
.backup-box .btn { margin-top: 8px; }
.backup-box .btn + .btn { margin-left: 8px; }

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
.title { font-size: 17px; font-weight: 600; color: var(--green-700); }
.date { font-size: 12px; color: var(--text-2); }
.topbar-right { display: flex; gap: 4px; }

/* 内容区 */
.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: calc(40px + var(--safe-bottom));
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-chip {
  font-size: 12px;
  color: var(--text-2);
  background: var(--green-50);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: normal;
}
.today-section, .stats-preview { margin-bottom: 28px; }

/* 任务列表 */
.task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.task-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border-left: 4px solid var(--green-400);
}
.task-item.checked {
  background: var(--green-50);
  border-left-color: var(--green-500);
}
.task-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--green-50);
  border-radius: 12px;
  margin-right: 14px;
  flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-name { font-weight: 500; font-size: 15px; }
.task-repeat { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.task-streak { font-size: 12px; color: var(--green-600); margin-top: 2px; }

.check-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}
.check-btn.checked {
  background: var(--green-500);
  border-color: var(--green-500);
}
.check-btn.checked::after {
  content: "✓";
  color: white;
  font-size: 16px;
  font-weight: bold;
}
.task-item .delete-btn {
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.task-item:active .delete-btn,
.task-item:hover .delete-btn { opacity: 0.6; }

.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-card {
  background: var(--card);
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num {
  font-size: 28px;
  font-weight: 600;
  color: var(--green-600);
  line-height: 1.2;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 45, 39, 0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  background: white;
  width: 100%;
  max-width: 520px;
  border-radius: 24px 24px 0 0;
  padding-bottom: var(--safe-bottom);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}
.modal-card.large { max-height: 92vh; }
@keyframes slideUp { from { transform: translateY(100%); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-footer .btn { flex: 1; max-width: 140px; }
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; }
}

.modal-body label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin: 14px 0 6px;
}
.modal-body label:first-child { margin-top: 0; }
.modal-body input[type="text"],
.modal-body input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.modal-body input:focus { outline: none; border-color: var(--green-400); }

/* 图标/颜色选择 */
.icon-picker, .color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.icon-picker button {
  width: 44px;
  height: 44px;
  font-size: 22px;
  background: var(--green-50);
  border-radius: 12px;
  transition: all 0.15s;
}
.icon-picker button.selected {
  background: var(--green-200);
  transform: scale(1.1);
}
.color-picker button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid white;
  outline: 1.5px solid transparent;
  transition: all 0.15s;
}
.color-picker button.selected {
  outline-color: var(--text);
  transform: scale(1.1);
}

/* 重复选项 */
.repeat-tabs {
  display: flex;
  gap: 6px;
  background: var(--green-50);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.tab {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.2s;
}
.tab.active {
  background: white;
  color: var(--green-700);
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.repeat-panel { margin-top: 12px; }
.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekday-picker button {
  aspect-ratio: 1;
  background: var(--green-50);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
}
.weekday-picker button.selected {
  background: var(--green-500);
  color: white;
  font-weight: 600;
}
.monthday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.monthday-picker button {
  aspect-ratio: 1;
  background: var(--green-50);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.monthday-picker button.selected {
  background: var(--green-500);
  color: white;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--green-500); }

/* 统计详情 */
.stats-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.big-stat-row { display: flex; gap: 12px; margin-bottom: 20px; }
.big-stat {
  flex: 1;
  background: var(--green-50);
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
}
.big-num { font-size: 36px; font-weight: 600; color: var(--green-600); }
.big-label { font-size: 13px; color: var(--text-2); margin-top: 4px; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  margin: 12px 0 20px;
  padding: 0 4px;
}
.bar {
  flex: 1;
  background: var(--green-200);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  transition: background 0.2s;
}
.bar.today { background: var(--green-500); }
.bar::after {
  content: attr(data-label);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-3);
}

.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-header h4 { font-size: 16px; font-weight: 500; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 8px;
  position: relative;
  background: white;
  border: 1px solid var(--border);
}
.cal-day.empty { border: none; background: transparent; }
.cal-day.has-checkin {
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 500;
}
.cal-day.today {
  border-color: var(--green-500);
  border-width: 2px;
}
.cal-day.full-checkin {
  background: var(--green-500);
  color: white;
  font-weight: 600;
}

#per-task-list { display: flex; flex-direction: column; gap: 10px; }
.per-task-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--green-50);
  border-radius: var(--radius-sm);
}
.per-task-item .icon { font-size: 20px; margin-right: 10px; }
.per-task-item .name { flex: 1; font-weight: 500; }
.per-task-item .count { color: var(--green-600); font-weight: 600; }

/* 分享卡 */
.share-card-wrapper {
  background: linear-gradient(135deg, #e8f7ed 0%, #d3f0de 100%);
  padding: 24px;
  border-radius: var(--radius);
  margin: 12px 0;
}
.share-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  font-family: -apple-system, "PingFang SC", sans-serif;
}
.share-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--green-100);
}
.share-brand { font-size: 14px; font-weight: 600; color: var(--green-700); }
.share-date { font-size: 13px; color: var(--text-2); }
.share-main { display: flex; align-items: center; margin-bottom: 20px; }
.share-big { text-align: center; flex: 0 0 auto; padding: 0 16px; }
.share-big-num { font-size: 48px; font-weight: 700; color: var(--green-600); line-height: 1; }
.share-big-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.share-divider { width: 1px; height: 50px; background: var(--green-100); margin: 0 16px; }
.share-row { flex: 1; display: flex; gap: 16px; }
.share-stat { text-align: center; flex: 1; }
.share-stat-num { font-size: 24px; font-weight: 600; color: var(--text); }
.share-stat-label { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.share-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.share-task-tag {
  background: var(--green-50);
  color: var(--green-700);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}
.share-quote-wrap {
  position: relative;
  margin: 14px 0 10px;
}
.share-quote {
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  font-style: italic;
  padding: 10px 36px 10px 12px;
  background: linear-gradient(135deg, #f7fbf8 0%, #e8f7ed 100%);
  border-radius: 10px;
  position: relative;
  line-height: 1.6;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.share-quote.fading { opacity: 0; }
.share-quote::before {
  content: '"';
  position: absolute;
  top: -4px;
  left: 8px;
  font-size: 28px;
  color: var(--green-200);
  font-family: Georgia, serif;
  line-height: 1;
}
.share-quote::after {
  content: '"';
  position: absolute;
  bottom: -10px;
  right: 32px;
  font-size: 28px;
  color: var(--green-200);
  font-family: Georgia, serif;
  line-height: 1;
}
.quote-refresh {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(60, 184, 120, 0.15);
  transition: transform 0.3s;
  z-index: 2;
}
.quote-refresh:hover { background: var(--green-50); }
.quote-refresh:active { transform: translateY(-50%) scale(0.9); }
.quote-refresh.spinning { animation: quoteSpin 0.4s ease; }
@keyframes quoteSpin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}
.share-footer {
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
  margin-top: 8px;
  letter-spacing: 1px;
}

/* 设置 */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row.danger { gap: 8px; justify-content: flex-end; }
.settings-row code { background: var(--green-50); padding: 4px 8px; border-radius: 6px; font-size: 12px; }

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
}
.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--green-500); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 平板/电脑适配 */
@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .content { padding: 28px; }
  .task-item { padding: 16px 20px; }
  .task-name { font-size: 16px; }
}
@media (min-width: 1024px) {
  body { background: linear-gradient(135deg, #e8f7ed 0%, #d3f0de 100%); }
  .content { padding: 32px; }
  .task-item .delete-btn { opacity: 0.5; }
}
