/* 365存钱挑战 —— 苹果简约浅色大厂风
   tokens：大留白 / 超大数字 / 黑白灰骨架 / 克制蓝色点缀（单一强调色 #2563eb）
   系统字体栈，不链任何外部字体；圆角 8/12/16 三档；发丝线边框；单层极淡阴影。 */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-muted: #f2f2f0;
  --text: #111111;
  --text-2: #555555;
  --text-3: #6e6e6e; /* 弱文字：#8a8a8a 在 #f7f7f5 上仅 3.22:1，未达 4.5:1；#6e6e6e 为 4.75:1 */
  --border: rgba(17, 17, 17, 0.10);
  --accent: #2563eb;
  --accent-soft: #eaf1fe;
  --accent-text: #1d4ed8;
  --good: #127a37; /* 零广告徽章绿：#15803d 在 #e8f5ec 上仅 4.47:1，未达 4.5:1；#127a37 为 4.84:1 */
  --good-soft: #e8f5ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --num: -apple-system, BlinkMacSystemFont, "SF Mono", ui-monospace, "PingFang SC", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
}
a { color: var(--accent-text); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button { font-family: var(--font); cursor: pointer; }
input, select { font-family: var(--font); font-size: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 247, 245, 0.92);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1024px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand-tag { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.lang-btn, .login-link {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; line-height: 1.2;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.lang-btn:hover, .login-link:hover { background: var(--surface-muted); }
.zero-ads-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--good-soft); color: var(--good);
  border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.zero-ads-badge svg { width: 14px; height: 14px; }

/* ---------- 布局 ---------- */
.page { max-width: 1024px; margin: 0 auto; padding: 32px 20px 120px; }
.view { display: none; }
.view.active { display: block; animation: fadeUp 220ms var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view.active { animation: none; }
  * { transition: none !important; }
}
.section { margin-top: 40px; }
.section-head { margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.section-head p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.kicker { font-size: 13px; color: var(--text-3); margin: 0 0 8px; }
.hero-title { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.demo-note {
  margin-top: 16px; padding: 10px 14px; border-radius: var(--radius-m);
  background: var(--warn-soft); color: var(--warn); font-size: 13px;
}

/* ---------- 首页 ---------- */
.today-card { padding: 32px 28px; text-align: center; }
.today-label { font-size: 14px; color: var(--text-2); }
.today-amount {
  font-family: var(--num); font-size: 84px; font-weight: 600; line-height: 1.1;
  letter-spacing: -0.03em; margin: 8px 0 4px; font-variant-numeric: tabular-nums;
}
.today-amount .cur { font-size: 34px; font-weight: 500; margin-right: 4px; }
.checkin-btn {
  margin-top: 20px; min-height: 52px; padding: 0 36px;
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  font-size: 17px; font-weight: 500;
  transition: background 150ms var(--ease), transform 100ms var(--ease);
}
.checkin-btn:hover { background: #1d4ed8; }
.checkin-btn:active { transform: scale(0.98); }
.checkin-btn:disabled { background: var(--good); cursor: default; }
.checkin-btn:disabled:active { transform: none; }
.today-meta { margin-top: 18px; font-size: 14px; color: var(--text-2); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.stat-card { padding: 20px 22px; }
.stat-label { font-size: 14px; color: var(--text-2); }
.stat-num { font-family: var(--num); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-num .unit { font-size: 16px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.progress-wrap { display: flex; align-items: center; gap: 24px; padding: 24px; margin-top: 16px; }
.ring { flex: none; width: 128px; height: 128px; }
.ring .ring-bg { stroke: var(--surface-muted); }
.ring .ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 400ms var(--ease); }
.ring text { font-family: var(--num); font-size: 22px; font-weight: 600; fill: var(--text); }
.progress-text .big { font-size: 20px; font-weight: 600; }
.progress-text p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin-top: 14px; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 400ms var(--ease); }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 4px; }
.week-cell {
  border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface);
  padding: 12px 4px; text-align: center; min-height: 76px;
}
.week-cell .wd { font-size: 12px; color: var(--text-3); }
.week-cell .wa { font-family: var(--num); font-size: 17px; font-weight: 600; margin-top: 4px; }
.week-cell .ws { font-size: 12px; margin-top: 2px; color: var(--text-3); }
.week-cell.done { background: var(--good-soft); border-color: transparent; }
.week-cell.done .ws { color: var(--good); }
.week-cell.today { border-color: var(--accent); }
.week-cell.missed .ws { color: var(--warn); }
.tip-card { padding: 20px 22px; }
.tip-card h3 { margin: 0 0 6px; font-size: 16px; }
.tip-card p { margin: 0; color: var(--text-2); font-size: 15px; }

/* ---------- 计划页 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { padding: 24px; display: flex; flex-direction: column; position: relative; }
.plan-card.current { border-color: var(--accent); }
.plan-card h3 { margin: 0; font-size: 19px; font-weight: 600; }
.plan-card p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; flex: 1; }
.plan-meta { margin-top: 16px; font-family: var(--num); font-size: 15px; font-weight: 600; color: var(--accent-text); }
.plan-btn {
  margin-top: 18px; min-height: 44px; width: 100%;
  border-radius: 999px; border: 1px solid var(--accent); background: var(--surface);
  color: var(--accent-text); font-size: 15px; font-weight: 500;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.plan-btn:hover { background: var(--accent-soft); }
.plan-btn.primary { background: var(--accent); color: #fff; }
.plan-btn.primary:hover { background: #1d4ed8; }
.plan-btn:disabled { border-color: var(--border); color: var(--text-3); background: var(--surface-muted); cursor: default; }
.current-tag {
  position: absolute; top: 16px; right: 16px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 500; border-radius: 999px; padding: 3px 9px;
}
.calc-card { padding: 24px; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface);
}
.calc-result { margin-top: 18px; font-size: 17px; }
.calc-result strong { font-family: var(--num); font-size: 22px; }
.ai-card { padding: 24px; }
.btn-primary {
  min-height: 48px; padding: 0 22px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: background 150ms var(--ease);
}
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost {
  min-height: 48px; padding: 0 22px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap;
}
.btn-ghost:hover { background: var(--surface-muted); }
.ai-result { margin-top: 16px; }
.ai-result table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ai-result th, .ai-result td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.ai-result th { color: var(--text-3); font-weight: 400; font-size: 13px; }
.form-msg { margin-top: 12px; font-size: 14px; color: var(--text-2); min-height: 20px; }
.form-msg.ok { color: var(--good); }
.form-msg.err { color: #b91c1c; }

/* ---------- 成就页 ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.badge-card { padding: 20px 16px; text-align: center; }
.badge-icon { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.badge-icon svg { width: 28px; height: 28px; stroke: var(--accent-text); }
.badge-card.locked { opacity: 0.55; }
.badge-card.locked .badge-icon { background: var(--surface-muted); }
.badge-card.locked .badge-icon svg { stroke: var(--text-3); }
.badge-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.badge-card p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.badge-state { margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--good); }
.badge-card.locked .badge-state { color: var(--text-3); }
.pet-card { padding: 28px; display: flex; align-items: center; gap: 28px; }
.pet-art { flex: none; width: 140px; height: 140px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.pet-art svg { width: 96px; height: 96px; }
.pet-info h3 { margin: 0; font-size: 20px; }
.pet-info p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }

/* ---------- 家庭页 ---------- */
.family-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex: none; }
.member-row .m-name { font-weight: 500; }
.member-row .m-sub { font-size: 13px; color: var(--text-3); }
.member-row .m-amt { margin-left: auto; font-family: var(--num); font-weight: 600; font-variant-numeric: tabular-nums; }
.invite-code {
  font-family: var(--num); font-size: 30px; font-weight: 600; letter-spacing: 0.18em;
  text-align: center; padding: 18px 0; background: var(--surface-muted);
  border-radius: var(--radius-m); margin: 12px 0;
}

/* ---------- 我的页 ---------- */
.me-list .row { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.me-list .row:last-child { border-bottom: none; }
.me-list .row .t { font-weight: 500; }
.me-list .row .s { margin-left: auto; color: var(--text-3); font-size: 14px; }
.me-list a.row { color: var(--text); display: flex; }
.me-list a.row:hover { background: var(--surface-muted); }
.me-list a.row:first-child { border-radius: var(--radius-l) var(--radius-l) 0 0; }
.me-list a.row:last-child { border-radius: 0 0 var(--radius-l) var(--radius-l); }
.me-list button.row { width: 100%; background: none; border: none; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.me-list button.row:hover { background: var(--surface-muted); }
.me-list button.row:last-child { border-radius: 0 0 var(--radius-l) var(--radius-l); }
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.price-card { padding: 24px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--accent); }
.price-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.price-amount { font-family: var(--num); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; margin: 10px 0 4px; }
.price-amount .per { font-size: 14px; font-weight: 400; color: var(--text-3); }
.price-card ul { margin: 14px 0 0; padding: 0; list-style: none; flex: 1; }
.price-card li { font-size: 14px; color: var(--text-2); padding: 5px 0 5px 20px; position: relative; }
.price-card li::before { content: ""; position: absolute; left: 0; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.55; }
.price-note { margin-top: 14px; font-size: 13px; color: var(--text-3); }
.redeem-row { display: flex; gap: 12px; margin-top: 16px; }
.redeem-row input { flex: 1; min-height: 48px; padding: 0 14px; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); }

/* ---------- 登录 / 关于 ---------- */
.narrow { max-width: 560px; margin: 0 auto; }
.auth-card { padding: 32px 28px; }
.auth-card h1 { margin: 0; font-size: 24px; font-weight: 600; }
.auth-card .sub { color: var(--text-2); margin: 8px 0 24px; font-size: 15px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface);
}
.code-row { display: flex; gap: 12px; }
.code-row input { flex: 1; min-width: 0; }
.about-body p { color: var(--text-2); font-size: 16px; }
.about-body .lead { color: var(--text); font-size: 19px; line-height: 1.5; }

/* ---------- 底栏导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar-inner { max-width: 1024px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 10px; background: none; border: none; color: var(--text-3);
  font-size: 11px; min-height: 56px;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; }
.tab.active { color: var(--accent-text); }
.tab:hover { color: var(--text); }
.footer { text-align: center; color: var(--text-3); font-size: 13px; padding: 8px 0 24px; }

/* ---------- 断点：320 / 390 / 768 / 834 / 1024 ---------- */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 834px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .plan-card:last-child { grid-column: 1 / -1; }
  .family-grid { grid-template-columns: 1fr; }
  .pet-card { flex-direction: column; text-align: center; gap: 16px; }
}
@media (max-width: 768px) {
  .page { padding: 24px 16px 112px; }
  .topbar-inner { padding: 10px 16px; }
  .brand-tag { display: none; }
  .today-amount { font-size: 68px; }
  .hero-title { font-size: 26px; }
}
@media (max-width: 390px) {
  body { font-size: 15px; }
  .page { padding: 20px 14px 108px; }
  .today-card { padding: 24px 16px; }
  .today-amount { font-size: 60px; }
  .checkin-btn { width: 100%; padding: 0; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-num { font-size: 28px; }
  .progress-wrap { flex-direction: column; align-items: flex-start; gap: 16px; }
  .plan-grid { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
  .calc-row { grid-template-columns: 1fr; }
  .redeem-row { flex-direction: column; }
  .redeem-row .btn-primary { width: 100%; }
  .week-cell { min-height: 68px; padding: 10px 2px; }
  .week-cell .wa { font-size: 15px; }
  .zero-ads-badge { display: none; }
  .topbar .zero-ads-badge { display: none; }
}
@media (max-width: 320px) {
  .today-amount { font-size: 52px; }
  .stat-num { font-size: 24px; }
  .brand-name { font-size: 16px; }
  .invite-code { font-size: 24px; }
}
