/* ==========================================================================
   成长小树 · 打卡与奖励
   草地天空 + 奶油卡片 + 成长树
   ========================================================================== */

:root {
  --cream: #fff9ee;
  --card: #fffdf8;
  --ink: #2f3b33;
  --ink-soft: #68786d;
  --ink-faint: #9bab9f;
  --line: rgba(47, 59, 51, 0.1);
  --line-strong: rgba(47, 59, 51, 0.18);

  --green: #4f9e62;
  --green-deep: #2f6b4f;
  --green-soft: #e8f5e6;
  --sun: #f6c74f;
  --sun-soft: #fff4d4;
  --coral: #e8735a;
  --blue: #4c97c9;
  --sky: #cdeffa;
  --sky-deep: #8ed6f0;

  --shadow-sm: 0 4px 14px rgba(47, 67, 51, 0.07);
  --shadow-md: 0 14px 34px rgba(47, 67, 51, 0.13);

  --radius-lg: 26px;
  --radius: 20px;
  --radius-sm: 14px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 10% -10%, #d9f2fb 0%, rgba(217, 242, 251, 0) 62%),
    radial-gradient(900px 560px at 96% 0%, #eaf6d9 0%, rgba(234, 246, 217, 0) 58%),
    radial-gradient(900px 600px at 50% 110%, #d8f0d2 0%, rgba(216, 240, 210, 0) 62%),
    var(--cream);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(120, 160, 120, 0.08) 1.2px, transparent 1.4px),
    radial-gradient(rgba(120, 180, 210, 0.08) 1px, transparent 1.2px);
  background-size: 44px 44px, 64px 64px;
  background-position: 8px 12px, 26px 30px;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3, b, strong { font-weight: 800; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible { outline: 3px solid rgba(79, 158, 98, 0.5); outline-offset: 3px; }

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 max(16px, var(--safe-l)) calc(104px + var(--safe-b)) max(16px, var(--safe-r));
  position: relative;
}

.muted { color: var(--ink-faint); font-size: 12.5px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(255, 249, 238, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-titles p { font-size: 12px; color: var(--ink-soft); }

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform 0.14s ease;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn--ghost { background: transparent; box-shadow: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pill b { color: var(--ink); font-size: 15px; }
.pill--star { background: var(--sun-soft); color: #9a7420; }
.pill--streak { background: #fdeee8; color: #b8543f; }

/* ---------- 首页头 ---------- */
.home-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(16px + var(--safe-t)) 2px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sprout-logo { width: 46px; height: 46px; filter: drop-shadow(0 6px 10px rgba(79, 158, 98, 0.25)); }
.brand-text h1 { font-size: 22px; line-height: 1.15; letter-spacing: 0.02em; }
.brand-text p { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-pills { display: flex; gap: 7px; }

/* ---------- 成长树 ---------- */
.tree-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 14px 16px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #cdeffa 0%, #e6f7f1 58%, #fdf7e4 100%);
  border: 1px solid rgba(76, 151, 201, 0.18);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  isolation: isolate;
}

.sun {
  position: absolute;
  right: 22px;
  top: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a3, #f6c74f 70%);
  box-shadow: 0 0 34px rgba(246, 199, 79, 0.55);
}
.cloud {
  position: absolute;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.cloud--1 { left: 18px; top: 34px; width: 54px; }
.cloud--1::before { width: 24px; height: 24px; left: 10px; top: -11px; }
.cloud--1::after { width: 17px; height: 17px; left: 32px; top: -8px; }
.cloud--2 { right: 84px; top: 76px; width: 40px; opacity: 0.7; }
.cloud--2::before { width: 18px; height: 18px; left: 8px; top: -8px; }

.tree-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding-top: 4px;
}
.tree {
  width: min(62vw, 230px);
  height: auto;
  animation: tree-sway 5s ease-in-out infinite;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 12px 16px rgba(47, 107, 79, 0.14));
}
.tree-face circle, .tree-face path { animation: tree-blink 6s infinite; transform-origin: center; }

.tree-info {
  position: relative;
  background: rgba(255, 253, 248, 0.82);
  border-radius: 16px;
  padding: 10px 12px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.stage-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green-deep);
  background: #e2f4dc;
  border-radius: 999px;
  padding: 2px 9px;
}
.tree-tagline { font-size: 13px; font-weight: 600; color: #3f5a48; margin: 5px 0 6px; }
.tree-progress { height: 10px; border-radius: 999px; background: #e7efe2; overflow: hidden; }
.tree-progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8fd98c, #4f9e62); transition: width 0.5s ease; }
.tree-next { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; }
.tree-next b { color: var(--green-deep); }
.tree-total { font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.tree-total b { color: var(--ink-soft); }
.hero-pet {
  position: absolute;
  left: 2%;
  bottom: -6px;
  width: 32%;
  max-width: 118px;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(47, 107, 79, 0.16));
  animation: pet-bob 3.6s ease-in-out infinite;
}
.hero-pet .pet { width: 100%; height: auto; }
.hero-pet-link {
  display: inline-block;
  margin-top: 7px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green-deep);
  background: #e6f4df;
  border-radius: 999px;
  padding: 4px 9px;
}
.hero-pet-link:active { transform: scale(0.97); }

/* ---------- 卡片 / 按钮 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 15px;
  margin-top: 12px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.card-head h2 { font-size: 16.5px; letter-spacing: 0.02em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.42; pointer-events: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #63b977, #3f8a57); box-shadow: 0 8px 20px rgba(79, 158, 98, 0.3); }
.btn-ghost { background: var(--card); border: 1.5px solid var(--line-strong); color: var(--ink); }
.btn-danger { background: linear-gradient(135deg, #e8735a, #c9553e); color: #fff; }
.btn-danger-ghost { color: #b8543f; background: #fdeeea; border: 1.5px solid rgba(232, 115, 90, 0.24); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 13px; font-size: 13px; border-radius: 12px; }
.btn-xs { min-height: 32px; padding: 0 10px; font-size: 11.5px; border-radius: 9px; }

.link-btn { font-size: 12px; font-weight: 800; color: var(--green-deep); padding: 4px 7px; border-radius: 7px; }
.link-btn:active { background: var(--green-soft); }

/* ---------- 安装提示 ---------- */
.install-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 13px;
  background: #eaf6ff;
  border: 1px dashed rgba(76, 151, 201, 0.42);
  font-size: 11.5px;
  color: #386c8c;
}
.install-tip p { flex: 1; line-height: 1.5; }
.install-tip button { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: var(--blue); background: #fff; padding: 5px 8px; border-radius: 7px; }

/* ---------- 今日目标 ---------- */
.goal-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "ring text" "cta cta";
  align-items: center;
  gap: 10px 14px;
}
.goal-ring { grid-area: ring; }
.ring {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), #e9f0e4 0);
  display: grid;
  place-items: center;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); }
.ring-inner { position: relative; text-align: center; line-height: 1; }
.ring-inner b { display: block; font-size: 22px; }
.ring-inner span { font-size: 9px; color: var(--ink-faint); }
.goal-text { grid-area: text; }
.goal-text h2 { font-size: 16px; margin-bottom: 2px; }
.goal-text p { font-size: 12px; color: var(--ink-soft); }
.goal-cta { grid-area: cta; width: 100%; }

/* ---------- 任务列表 ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.task-row:first-child { border-top: 0; }
.task-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 13px; background: #f4f8ef; display: grid; place-items: center; font-size: 21px; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-main b { font-size: 14px; line-height: 1.4; }
.task-main small { font-size: 10px; color: var(--ink-faint); }
.task-stars { flex: 0 0 auto; font-size: 11.5px; font-weight: 800; color: #b58a1f; background: var(--sun-soft); border-radius: 999px; padding: 3px 8px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.task-stars em { font-style: normal; font-size: 8.5px; font-weight: 700; color: #9a7a2c; opacity: .85; }
.task-check {
  flex: 0 0 auto;
  min-width: 64px;
  height: 38px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(79, 158, 98, 0.26);
  transition: transform 0.12s ease, background 0.16s ease;
}
.task-check:active { transform: scale(0.94); }
.task-check.is-done { background: #e3f3df; color: #3f8a57; box-shadow: none; font-size: 17px; }
.task-row.is-done .task-main b { color: var(--ink-faint); text-decoration: line-through; }
.task-row.is-done .task-icon { filter: grayscale(0.4); opacity: 0.8; }
.task-subhead { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.task-subhead span { font-size: 13px; font-weight: 800; }
.task-subhead em { font-style: normal; font-size: 10px; color: var(--ink-faint); }

/* ---------- 快捷卡 ---------- */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quick-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.quick-card:active { transform: scale(0.98); }
.quick-icon { width: 40px; height: 40px; border-radius: 13px; background: #fff3d6; display: grid; place-items: center; font-size: 21px; }
.quick-card b { display: block; font-size: 13.5px; }
.quick-card small { display: block; font-size: 10px; color: var(--ink-faint); }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 720px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 10px calc(6px + var(--safe-b));
  background: rgba(255, 253, 248, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px rgba(47, 67, 51, 0.08);
  z-index: 60;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 12px;
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 700;
}
.nav-item svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.is-active { color: var(--green-deep); background: var(--green-soft); }
.nav-item:active { transform: scale(0.95); }

/* ---------- 奖励页 ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: calc(16px + var(--safe-t)) 2px 12px;
}
.page-header h1 { font-size: 23px; line-height: 1.2; }
.page-header p { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.balance-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff6dd, #ffeec3);
  border: 1px solid rgba(246, 199, 79, 0.4);
  box-shadow: var(--shadow-sm);
}
.balance-icon { width: 48px; height: 48px; border-radius: 15px; background: #fff; display: grid; place-items: center; font-size: 25px; }
.balance-card b { font-size: 28px; line-height: 1; }
.balance-card span { font-size: 12px; color: #8f6a1b; }
.balance-card p { margin-left: auto; font-size: 10.5px; color: #a07a28; text-align: right; line-height: 1.4; }

.pending-card { background: #fff8ea; border-color: rgba(192, 138, 62, 0.28); }
.pending-row, .approve-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.pending-row:first-of-type, .approve-row:first-of-type { border-top: 0; }
.reward-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow-sm); }
.reward-icon--big { width: 52px; height: 52px; font-size: 27px; }
.pending-main, .approve-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pending-main b, .approve-main b { font-size: 13px; }
.pending-main small, .approve-main small { font-size: 10px; color: var(--ink-faint); }

.reward-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.reward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 13px 10px 11px;
  border-radius: 17px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.reward-title { font-size: 13px; line-height: 1.4; }
.reward-cost { font-size: 11.5px; font-weight: 800; color: #b58a1f; margin-bottom: 3px; }
.reward-card .btn { min-width: 92px; }

.tip-card { background: #f4f9ef; border-color: rgba(79, 158, 98, 0.2); }
.tip-card h2 { font-size: 15px; margin-bottom: 5px; }
.tip-card p { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }

.history-list, .activity-list { list-style: none; margin: 0; padding: 0; }
.history-list li, .activity-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.history-list li:first-child, .activity-list li:first-child { border-top: 0; }
.history-icon { width: 34px; height: 34px; border-radius: 10px; background: #f5f8f1; display: grid; place-items: center; font-size: 18px; }
.history-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history-main b { font-size: 12.5px; }
.history-main small { font-size: 10px; color: var(--ink-faint); }
.history-status { font-size: 10px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: #eef3ea; color: var(--ink-soft); }
.history-status--pending { background: var(--sun-soft); color: #8f6a1b; }
.history-status--approved { background: var(--green-soft); color: var(--green-deep); }
.history-status--rejected, .history-status--cancelled { background: #f2f0ec; color: var(--ink-faint); }

/* ---------- 成就页 ---------- */
.achievement-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eef8e8, #fffaf0);
  border: 1px solid rgba(79, 158, 98, 0.2);
  box-shadow: var(--shadow-sm);
}
.achieve-ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: conic-gradient(var(--sun) 0deg, var(--sun) 0deg);
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--green) 0%, var(--green) 0%, #e9f0e4 0);
}
.achieve-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--card); }
.achieve-ring-inner { position: relative; text-align: center; line-height: 1; }
.achieve-ring-inner b { font-size: 21px; }
.achieve-ring-inner span { font-size: 9px; color: var(--ink-faint); }
.achievement-head h2 { font-size: 15px; }
.achievement-head p { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.achieve-bar { height: 8px; border-radius: 999px; background: #e9f0e4; overflow: hidden; margin-top: 6px; }
.achieve-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8fd98c, #4f9e62); }

.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 10px;
  border-radius: 16px;
  background: #f5f3ed;
  border: 1px solid var(--line);
  opacity: 0.72;
  text-align: center;
}
.badge.is-unlocked { background: linear-gradient(160deg, #fff8e2, #eef8e7); opacity: 1; border-color: rgba(246, 199, 79, 0.4); box-shadow: var(--shadow-sm); }
.badge-icon { font-size: 28px; line-height: 1.3; }
.badge-name { font-size: 12.5px; }
.badge-desc { font-size: 9.5px; color: var(--ink-faint); min-height: 27px; line-height: 1.4; }
.badge-state { font-size: 9px; font-weight: 800; color: var(--green-deep); background: var(--green-soft); border-radius: 999px; padding: 2px 8px; align-self: center; margin-top: 3px; }
.badge-progress { height: 5px; border-radius: 999px; background: #e7e5de; overflow: hidden; margin-top: 5px; }
.badge-progress i { display: block; height: 100%; background: var(--sun); border-radius: 999px; }
.badge-count { font-size: 9px; color: var(--ink-faint); }

.stage-list { display: flex; flex-direction: column; gap: 7px; }
.stage-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); }
.stage-item:first-child { border-top: 0; }
.stage-dot { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: #eef1ea; color: var(--ink-faint); }
.stage-item.is-done .stage-dot { background: var(--green-soft); color: var(--green-deep); }
.stage-item.is-current .stage-dot { background: var(--green); color: #fff; box-shadow: 0 0 0 4px rgba(79, 158, 98, 0.15); }
.stage-main { flex: 1; display: flex; flex-direction: column; }
.stage-main b { font-size: 12.5px; }
.stage-main small { font-size: 9.5px; color: var(--ink-faint); }
.stage-now { font-size: 9px; font-weight: 800; color: var(--green-deep); background: var(--green-soft); border-radius: 999px; padding: 2px 8px; }
.stage-done { font-size: 9px; color: var(--ink-faint); }
.stage-remain { font-size: 9.5px; color: var(--ink-faint); }

/* ---------- 家长 PIN ---------- */
.pin-card { max-width: 420px; margin: 12px auto 0; text-align: center; padding: 10px 4px; }
.pin-lock { font-size: 34px; }
.pin-card h2 { font-size: 20px; margin-top: 4px; }
.pin-card > p { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.pin-dots { display: flex; justify-content: center; gap: 13px; margin: 18px 0 2px; }
.pin-dots span { width: 15px; height: 15px; border-radius: 50%; background: #e6ece2; transition: background 0.15s ease, transform 0.15s ease; }
.pin-dots span.on { background: var(--green); transform: scale(1.08); }
.pin-dots.is-shake { animation: shake 0.35s ease; }
.pin-error { font-size: 11px; color: #c9553e; min-height: 17px; }
.pin-error.is-error { font-weight: 700; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 310px; margin: 10px auto 0; }
.pin-key {
  height: 58px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  font-size: 22px;
  font-weight: 700;
}
.pin-key:active { transform: scale(0.95); background: #f1f7ed; }
.pin-key--soft { font-size: 18px; color: var(--ink-soft); }
.pin-key--ok { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 6px 14px rgba(79, 158, 98, 0.28); }
.pin-hint { font-size: 10px; color: var(--ink-faint); margin-top: 12px; }

/* ---------- 宠物乐园 ---------- */
.pet { width: 100%; height: auto; display: block; }

.pet-hero {
  position: relative;
  display: grid;
  grid-template-columns: 42% 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 14px 8px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #e9f7e0, #fff8e4 62%, #e4f4fb);
  border: 1px solid rgba(79, 158, 98, 0.2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  isolation: isolate;
}
.pet-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 22%, rgba(246, 199, 79, 0.35), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(142, 214, 240, 0.45), transparent 28%),
    radial-gradient(circle at 50% 118%, rgba(79, 158, 98, 0.22), transparent 46%);
  pointer-events: none;
}
.pet-hero-art { position: relative; display: grid; place-items: center; }
.pet-hero-art .pet { width: min(100%, 180px); animation: pet-bob 3.8s ease-in-out infinite; filter: drop-shadow(0 10px 14px rgba(47, 107, 79, 0.16)); }
.pet-hero-info { position: relative; min-width: 0; }
.pet-hero-info h2 { font-size: 17px; margin: 5px 0 2px; }
.pet-hero-info h2 em { font-style: normal; font-size: 10px; font-weight: 800; color: var(--green-deep); background: #dff1d8; border-radius: 999px; padding: 2px 7px; margin-left: 4px; vertical-align: 2px; }
.pet-desc { font-size: 11px; color: var(--ink-soft); }
.pet-xp { height: 9px; border-radius: 999px; background: #e4efdd; overflow: hidden; margin: 8px 0 5px; }
.pet-xp i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f6c74f, #e8a93e); transition: width .45s ease; }
.pet-xp-text { font-size: 11px; color: var(--ink-soft); }
.pet-xp-text b { color: #a8771d; }

.level-card .level-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.level-card .level-row b { font-size: 26px; line-height: 1.1; color: var(--green-deep); }
.level-card .level-row span { font-size: 13px; font-weight: 800; }
.level-card .level-row em { font-style: normal; font-size: 10.5px; color: var(--ink-faint); margin-left: auto; }
.level-bar { height: 9px; border-radius: 999px; background: #e8efdf; overflow: hidden; margin: 8px 0 5px; }
.level-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9be08f, #4f9e62); transition: width .5s ease; }
.level-hint { line-height: 1.5; }

.pet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.pet-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 9px 9px;
  border-radius: 17px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: center;
  overflow: hidden;
}
.pet-card.is-active { border-color: rgba(79, 158, 98, 0.55); box-shadow: 0 10px 24px rgba(79, 158, 98, 0.16); background: linear-gradient(180deg, #f4fbef, #fffdf8); }
.pet-card.is-locked { opacity: .82; }
.pet-card.is-locked .pet { filter: grayscale(1); opacity: .5; }
.pet-card-art { width: 92px; height: 92px; display: grid; place-items: center; }
.pet-card-art .pet { width: 100%; }
.pet-card-name { font-size: 12px; line-height: 1.35; }
.pet-card-desc { font-size: 9px; color: var(--ink-faint); line-height: 1.4; min-height: 25px; }
.pet-stage-chip { font-size: 9px; font-weight: 800; color: var(--green-deep); background: var(--green-soft); border-radius: 999px; padding: 2px 7px; }
.pet-mini-bar { width: 100%; height: 5px; border-radius: 999px; background: #e9eee4; overflow: hidden; }
.pet-mini-bar i { display: block; height: 100%; border-radius: 999px; background: var(--sun); }
.pet-lock { font-size: 9.5px; font-weight: 800; color: var(--ink-faint); background: #f0f0e9; border-radius: 999px; padding: 3px 8px; }
.pet-card .btn { width: 100%; min-height: 34px; font-size: 11px; border-radius: 10px; margin-top: 2px; }
.balance-hint { font-size: 10.5px; color: var(--ink-soft); line-height: 1.55; margin: 7px 2px 0; padding: 0 3px; }

@keyframes pet-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-5px) rotate(1.2deg); }
}

/* ---------- 家长看板 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 11px; }
.stat-card b { display: block; font-size: 22px; line-height: 1.15; }
.stat-card b em { font-style: normal; font-size: 11px; color: var(--ink-faint); }
.stat-card span { font-size: 10.5px; color: var(--ink-soft); }

.approve-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; background: #fff4dc; display: grid; place-items: center; font-size: 19px; }
.approve-row { gap: 7px; }
.approve-row .btn { flex: 0 0 auto; }

.day-bars { display: flex; align-items: flex-end; gap: 6px; height: 126px; margin-top: 4px; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.day-val { font-size: 9px; font-weight: 800; color: var(--ink-soft); }
.day-bar { width: 100%; max-width: 28px; min-height: 4px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #8fd98c, #4f9e62); transition: height 0.4s ease; }
.day-label { font-size: 8.5px; color: var(--ink-faint); white-space: nowrap; }

.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: grid; grid-template-columns: 68px 1fr 32px; align-items: center; gap: 8px; }
.cat-name { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); }
.cat-name i { font-style: normal; font-size: 13px; }
.cat-bar { height: 7px; border-radius: 999px; background: #eef1ea; overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; }
.cat-val { font-size: 10.5px; font-weight: 800; text-align: right; color: var(--ink-soft); }

.manage-list { list-style: none; margin: 0; padding: 0; }
.manage-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); }
.manage-row:first-child { border-top: 0; }
.manage-row.is-off { opacity: 0.55; }
.manage-icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: #f4f8ef; display: grid; place-items: center; font-size: 18px; }
.manage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.manage-main b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-main small { font-size: 9.5px; color: var(--ink-faint); }
.manage-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.manage-actions button { font-size: 10px; font-weight: 700; color: var(--ink-soft); background: #f3f6f0; border-radius: 7px; padding: 5px 7px; }
.manage-actions button:active { background: #e6eee1; }

.settings-card .setting-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.settings-card .setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-text { flex: 1; }
.setting-text b { display: block; font-size: 12.5px; }
.setting-text span { display: block; font-size: 10px; color: var(--ink-faint); }
.switch { position: relative; width: 46px; height: 27px; border-radius: 999px; background: #e2e8de; transition: background 0.2s ease; flex: 0 0 auto; }
.switch.is-on { background: var(--green); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(47, 59, 51, 0.2); transition: transform 0.2s ease; }
.switch.is-on .switch-thumb { transform: translateX(19px); }
.setting-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.setting-actions .btn { flex: 1; min-width: 100px; }

.activity-dot { flex: 0 0 auto; width: 36px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; background: #eef3ea; color: var(--ink-soft); }
.activity-dot.is-earn { background: var(--sun-soft); color: #8f6a1b; }
.activity-dot.is-spend { background: #fdeeea; color: #b8543f; }
.activity-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.activity-main b { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-main small { font-size: 9.5px; color: var(--ink-faint); }

/* ---------- 表单 ---------- */
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }
.field-input {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}
.field-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(79, 158, 98, 0.15); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin-top: 4px; }
.icon-choice { height: 38px; border-radius: 10px; background: #f5f7f1; border: 1.5px solid transparent; font-size: 20px; display: grid; place-items: center; }
.icon-choice.is-on { background: var(--green-soft); border-color: var(--green); }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: #f1f4ee; }
.segmented button { flex: 1; min-height: 38px; border-radius: 10px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }
.segmented button.is-on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- 弹层 / toast ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(33, 42, 35, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.22s ease; }
.sheet {
  position: relative;
  width: min(540px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + var(--safe-b));
  box-shadow: var(--shadow-md);
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-layer.open .sheet { transform: none; }
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; background: #f1f4ee; color: var(--ink-soft); font-size: 14px; font-weight: 800; }
.sheet-title { font-size: 20px; margin: 0 0 12px; padding-right: 28px; }
.sheet-text { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 9px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translate(-50%, 12px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(47, 59, 51, 0.92);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 36px);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { font-size: 14px; }

.confetti-layer { position: fixed; inset: 0; z-index: 140; pointer-events: none; overflow: hidden; }
.confetti-layer i { position: absolute; top: -20px; display: block; animation: confetti-fall linear forwards; }

.error-card { margin-top: 30px; text-align: center; }
.error-card h2 { font-size: 18px; margin-bottom: 6px; }
.error-card p { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- 动画 ---------- */
@keyframes tree-sway {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1.4deg); }
}
@keyframes tree-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94%, 96% { transform: scaleY(0.1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes confetti-fall {
  0% { transform: translate(0, -10px) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: 0.9; }
}

/* ---------- 响应式 ---------- */
@media (min-width: 660px) {
  .app { padding-left: max(24px, var(--safe-l)); padding-right: max(24px, var(--safe-r)); }
  .topbar { margin: 0 -24px; padding-left: 24px; padding-right: 24px; }
  .tree-hero { grid-template-columns: 250px 1fr; align-items: center; padding: 18px 22px; }
  .tree { width: 230px; }
  .tree-info { padding: 14px 16px; }
  .goal-card { grid-template-columns: auto 1fr auto; grid-template-areas: "ring text cta"; }
  .goal-cta { width: auto; min-width: 150px; }
  .reward-grid { grid-template-columns: repeat(3, 1fr); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .pet-grid { grid-template-columns: repeat(3, 1fr); }
  .pet-hero { grid-template-columns: 200px 1fr; padding: 18px 22px; }
  .pet-hero-art .pet { width: 190px; }
  .pet-card-art { width: 108px; height: 108px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .sheet { border-radius: 24px; margin-bottom: 4vh; }
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet { max-height: 84dvh; }
  .settings-card .setting-row { padding: 11px 0; }
}

@media (min-width: 980px) {
  .app { max-width: 920px; }
  .tree-hero { grid-template-columns: 300px 1fr; }
  .tree { width: 260px; }
}

@media (max-width: 430px) {
  .brand-sub { display: none; }
  .balance-card p { display: none; }
}

@media (max-width: 360px) {
  .brand-text h1 { font-size: 20px; }
  .header-pills .pill { padding: 0 8px; font-size: 11px; }
  .task-check { min-width: 56px; font-size: 11.5px; }
  .task-stars { font-size: 9.5px; padding: 2px 6px; }
  .task-stars em { font-size: 8px; }
  .reward-grid { gap: 8px; }
  .reward-card { padding: 11px 7px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .topbar { position: static; }
  .tree-hero { grid-template-columns: 190px 1fr; }
  .tree { width: 175px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .tree { animation: none; }
}
