* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f9fafb; color: #222; min-height: 100vh;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 24px; border-radius: 20px;
  font-size: 14px; z-index: 99999; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ── Header ── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid #eee; gap: 6px;
}
.top-btn {
  background: none; border: 1px solid #2E7D32; color: #2E7D32;
  padding: 6px 12px; font-size: 13px; cursor: pointer; border-radius: 4px;
}
.top-btn.gold { border-color: #F9A825; color: #F9A825; }

main { max-width: 460px; margin: 0 auto; padding: 16px; }

/* ── 今日统计卡 ── */
.today-card {
  background: #fff; border-radius: 12px; padding: 20px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px;
}
.today-row { display: flex; align-items: center; }
.today-stat { flex: 1; text-align: center; }
.today-num { display: block; font-size: 36px; font-weight: 700; color: #2E7D32; }
.today-label { display: block; font-size: 13px; color: #999; margin-top: 2px; }
.today-divider { width: 1px; height: 40px; background: #eee; }

/* ── 按钮区 ── */
.btn-wrap { text-align: center; margin-bottom: 20px; }
.main-btn {
  width: 150px; height: 150px; border-radius: 50%; border: none;
  background: #2E7D32; color: #fff; font-size: 24px; font-weight: 700;
  cursor: pointer; line-height: 1.3;
}
.main-btn:active { background: #1B5E20; }
.main-btn small { font-size: 14px; font-weight: 400; display: block; }
.undo-btn {
  display: block; margin: 8px auto 0; background: none; border: none;
  color: #999; font-size: 13px; cursor: pointer; padding: 4px 12px;
}

/* ── 今日记录列表 ── */
.section { margin-bottom: 20px; }
.section-title { font-size: 14px; color: #666; margin-bottom: 8px; padding: 0 4px; }
.log-list { background: #fff; border-radius: 8px; overflow: hidden; }
.log-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.log-item:last-child { border-bottom: none; }
.log-time { color: #999; font-weight: 500; }
.log-note { color: #333; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-hint { padding: 24px; text-align: center; color: #bbb; font-size: 14px; }

/* ── 图表 ── */
.chart-wrap {
  background: #fff; border-radius: 8px; padding: 12px 8px 4px;
}
.chart-wrap canvas { width: 100%; height: 180px; display: block; }

/* ── 连续天数 ── */
.streak {
  text-align: center; padding: 12px; background: #fff;
  border-radius: 8px; font-size: 14px; color: #666;
}
.streak span { color: #2E7D32; font-weight: 700; }

/* ── 遮罩 / 卡片 ── */
.mask {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 9999; padding: 20px;
}
.card {
  background: #fff; width: 100%; max-width: 360px; padding: 24px; text-align: center;
  border-radius: 8px; max-height: 90vh; overflow-y: auto;
}
.card h3 { font-size: 20px; margin-bottom: 16px; }
.card p { font-size: 14px; color: #666; margin-bottom: 12px; }
.card .big { font-size: 18px; color: #2E7D32; font-weight: 700; margin: 16px 0; }

.form-group { text-align: left; margin-bottom: 12px; }
.form-group label { display: block; font-size: 14px; color: #333; margin-bottom: 4px; }
.form-group input {
  width: 100%; padding: 12px; border: 1px solid #ccc; font-size: 16px;
  border-radius: 4px; box-sizing: border-box;
}
.form-group input:focus { border-color: #2E7D32; outline: none; }
.form-hint { font-size: 13px; color: #2E7D32; margin-bottom: 16px; }

.green-btn {
  width: 100%; padding: 14px; border: none; background: #2E7D32;
  color: #fff; font-size: 16px; cursor: pointer; margin-bottom: 10px; border-radius: 4px;
}
.green-btn:disabled { background: #81C784; cursor: default; }
.close-btn {
  width: 100%; padding: 12px; border: 1px solid #eee; background: #fff;
  color: #666; font-size: 14px; cursor: pointer; border-radius: 4px;
}
.link-btn {
  display: block; padding: 12px; background: #2E7D32; color: #fff;
  text-decoration: none; margin-bottom: 16px; border-radius: 4px;
}
.code-area {
  margin: 16px 0; padding: 16px; border: 1px solid #2E7D32; border-radius: 4px;
}
.code-area input {
  width: 100%; padding: 12px; border: 1px solid #eee; font-size: 16px;
  text-align: center; margin: 8px 0; border-radius: 4px;
}
.code-area .small { font-size: 12px; color: #999; }

/* ── 后台数据 ── */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.stat-item { background: #f5f5f5; padding: 10px 6px; text-align: center; border-radius: 4px; }
.stat-val { display: block; font-size: 18px; font-weight: 700; color: #2E7D32; }
.stat-label { display: block; font-size: 10px; color: #999; margin-top: 2px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 6px 4px; border: 1px solid #eee; text-align: center; white-space: nowrap; }
.data-table th { background: #f5f5f5; font-weight: 600; color: #333; }
.data-table tbody tr:nth-child(even) { background: #fafafa; }

/* ── 同步状态 ── */
.sync-badge {
  text-align: center; font-size: 11px; color: #999; padding: 2px 0;
  background: #fafafa; border-bottom: 1px solid #f0f0f0;
}

/* ── 分享链接 ── */
.share-box {
  background: #E8F5E9; padding: 12px; margin-bottom: 12px; border-radius: 4px; text-align: left;
}
.share-label { font-size: 13px; color: #333; margin-bottom: 6px; font-weight: 600; }
.share-box input {
  width: 100%; padding: 10px; border: 1px solid #C8E6C9; font-size: 12px;
  background: #fff; margin-bottom: 4px; border-radius: 4px; word-break: break-all;
}
.share-box .small { font-size: 11px; color: #666; }
.copy-btn {
  padding: 10px 14px; background: #1565C0; color: #fff; border: none;
  font-size: 13px; cursor: pointer; border-radius: 4px; white-space: nowrap;
}
.copy-btn:active { background: #0D47A1; }
.share-status { font-size: 12px; color: #666; margin-top: 4px; }

/* ── 只读模式 ── */
.view-mode .btn-wrap { display: none; }
.view-mode .sync-badge { background: #FFF3E0; color: #E65100; }
