/* ============================================================
   打卡硬币系统 · 蛋仔派对风格
   只借用视觉语言：圆润造型、蓝绿黄马卡龙、胶囊按钮、弹动动效、蛋形轮廓
   不使用任何官方角色原画 / 皮肤 / Logo
   ============================================================ */

:root {
  --primary: #5bc8e8;
  --primary-dark: #2fa8c9;
  --primary-light: #d6f4fa;
  --yellow: #ffd84d;
  --yellow-deep: #e8b92a;
  --yellow-soft: #fff4cc;
  --purple: #b89cff;
  --pink: #ff9fbf;
  --bg: #f2fbfd;
  --card: #ffffff;
  --text: #1f3440;
  --text2: #6b8794;
  --line: #dceff5;
  --st-pending-bg: #fff8e0;
  --st-pending-fg: #b07d10;
  --st-ok-bg: #e6f9f0;
  --st-ok-fg: #1f7a4d;
  --st-no-bg: #fdecec;
  --st-no-fg: #b03a3a;
  --st-done-bg: #e6f3fd;
  --st-done-fg: #2a6fad;
  --r-card: 24px;
  --r-card-p: 20px;
  --shadow: 0 6px 18px rgba(47, 168, 201, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #e9f7fb;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--primary-dark); text-decoration: none; }

/* ---------- 外壳 ---------- */
#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}
#app.parent-mode { max-width: 480px; }
.screen { padding: 18px 16px 92px; animation: slide-in 220ms ease-out; }
.screen.no-nav { padding-bottom: 24px; }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.topbar .title { font-size: 19px; font-weight: 700; letter-spacing: 0.3px; }
.topbar .sub { color: var(--text2); font-size: 12px; }
.topbar .spacer { flex: 1; }

/* ---------- 蛋形头像 ---------- */
.egg-avatar {
  width: 44px; height: 48px;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: var(--primary-light);
  display: grid; place-items: center;
  font-size: 22px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  flex: none;
  overflow: hidden;
}
.egg-avatar.lg { width: 64px; height: 70px; font-size: 32px; }
.egg-avatar.sm { width: 32px; height: 35px; font-size: 16px; }
.egg-avatar.sel { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow); animation: pop 260ms ease-out; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.parent-mode .card { border-radius: var(--r-card-p); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }

/* ---------- 硬币余额条 ---------- */
.coinbar {
  background: linear-gradient(180deg, #fff9dd 0%, var(--yellow-soft) 100%);
  border-radius: 50% 50% 46% 46% / 30% 30% 22% 22%;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: inset 0 -3px 0 rgba(232, 185, 42, 0.25), 0 6px 16px rgba(232,185,42,.14);
  margin-bottom: 14px;
}
.coinbar .coin-ico {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff3b8, var(--yellow) 60%, var(--yellow-deep));
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 2px 0 #d9a81f, inset 0 0 0 2px rgba(255,255,255,.5);
  flex: none;
}
.coinbar .num {
  font-size: 30px; font-weight: 800; color: var(--yellow-deep);
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
  line-height: 1;
}
.coinbar .unit { font-size: 12px; color: #a8873a; align-self: flex-end; margin-bottom: 3px; }
.coinbar .frozen { margin-left: auto; font-size: 12px; color: #a8873a; }
.parent-mode .coinbar { border-radius: 20px; }
.parent-mode .coinbar .num { font-size: 20px; }

/* ---------- 进度条 ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.progress {
  position: relative; flex: 1; height: 12px; border-radius: 999px;
  background: #e8f6fa; overflow: visible;
}
.progress .fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #7ad8ef);
  transition: width 320ms cubic-bezier(.34,1.56,.64,1);
}
.progress .egg-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 18px; border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: #fff; border: 2px solid var(--primary);
  transition: left 320ms cubic-bezier(.34,1.56,.64,1);
}
.progress-num { font-size: 13px; font-weight: 700; color: var(--text2); font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 54px; padding: 0 22px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 16px;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform 90ms ease, box-shadow 90ms ease;
  user-select: none;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn.block { width: 100%; }
.btn.sm { height: 44px; font-size: 14px; padding: 0 16px; box-shadow: 0 3px 0 var(--primary-dark); }
.btn.sm:active { box-shadow: 0 1px 0 var(--primary-dark); }
.btn.ghost { background: var(--primary-light); color: var(--primary-dark); box-shadow: 0 3px 0 #b9e6f2; }
.btn.ghost:active { box-shadow: 0 1px 0 #b9e6f2; }
.btn.danger { background: #ffe3e3; color: #b03a3a; box-shadow: 0 3px 0 #f3c6c6; }
.btn.danger:active { box-shadow: 0 1px 0 #f3c6c6; }
.btn.gray { background: #edf3f5; color: var(--text2); box-shadow: 0 3px 0 #dbe6ea; }
.btn:disabled, .btn.disabled { background: #edf3f5; color: #a9bcc5; box-shadow: 0 3px 0 #dfe9ed; pointer-events: none; }
.btn .ico { font-size: 18px; }
.parent-mode .btn { height: 48px; font-size: 15px; }
.parent-mode .btn.sm { height: 40px; font-size: 13px; }

/* ---------- 任务卡 ---------- */
.task-card {
  background: #fff; border-radius: var(--r-card); padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.task-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.task-head { display: flex; align-items: flex-start; gap: 10px; }
.cat-egg {
  width: 34px; height: 37px; border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  display: grid; place-items: center; font-size: 17px; flex: none;
}
.cat-阅读 { background: #e2f6fc; }
.cat-运动 { background: #e4f8ee; }
.cat-家务 { background: #fff5d6; }
.cat-学习 { background: #f0e9ff; }
.cat-其他 { background: #eef3f5; }
.task-title { font-size: 16px; font-weight: 600; margin-top: 2px; }
.task-desc { font-size: 13px; color: var(--text2); margin-top: 3px; }
.coin-pill {
  margin-left: auto; flex: none;
  background: var(--yellow-soft); color: var(--yellow-deep);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 3px;
}
.task-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.task-foot .spacer { flex: 1; }

/* ---------- 状态标签 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .65; }
.pill.pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.pill.approved { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.pill.rejected { background: var(--st-no-bg); color: var(--st-no-fg); }
.pill.fulfilled, .pill.done { background: var(--st-done-bg); color: var(--st-done-fg); }
.pill.muted { background: #eef3f5; color: var(--text2); }

/* ---------- 徽章 ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.badge-card {
  background: #fff; border-radius: 50% 50% 46% 46% / 40% 40% 26% 26%;
  padding: 12px 6px 10px; text-align: center; box-shadow: var(--shadow);
  min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; position: relative;
}
.badge-card .ico { font-size: 26px; filter: grayscale(1); opacity: .45; }
.badge-card .nm { font-size: 12px; font-weight: 600; color: var(--text2); }
.badge-card.on { background: linear-gradient(180deg, #e8fbff 0%, #fff9dd 100%); }
.badge-card.on .ico { filter: none; opacity: 1; animation: glow 380ms ease-out; }
.badge-card.on .nm { color: var(--text); }
.badge-card .lock { font-size: 11px; color: #b9c9d1; }
.badge-card.on .date { font-size: 10px; color: var(--text2); }
@keyframes glow {
  0% { transform: scale(.7); text-shadow: 0 0 0 rgba(255,216,77,0); }
  60% { transform: scale(1.15); text-shadow: 0 0 14px rgba(255,216,77,.9); }
  100% { transform: scale(1); text-shadow: 0 0 0 rgba(255,216,77,0); }
}

/* ---------- 列表行 ---------- */
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 4px; border-bottom: 1px dashed var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .nm { font-weight: 600; }
.row .meta { font-size: 12px; color: var(--text2); }
.row .arrow { color: #c4d6dd; font-size: 16px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: #fbfeff;
  border-radius: 14px; padding: 12px 14px; outline: none; font-size: 15px;
  transition: border-color 140ms, background 140ms;
}
.input:focus { border-color: var(--primary); background: #fff; }
textarea.input { min-height: 76px; resize: vertical; border-radius: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: #f0f7f9; color: var(--text2);
  font-size: 13px; border: 1px solid transparent;
}
.chip.on { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); font-weight: 600; }
.chip.egg { width: 46px; height: 50px; padding: 0; border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%; display: grid; place-items: center; font-size: 22px; }
.chip.egg.on { background: #fff8e0; border-color: var(--yellow); }
.stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; font-size: 20px; color: var(--primary-dark); background: #f4fbfd; }
.stepper input { width: 62px; height: 40px; border: 0; text-align: center; font-weight: 700; outline: none; }

/* ---------- 底部导航 ---------- */
.navbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 560px;
  background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 30;
}
.parent-mode .navbar { max-width: 480px; }
.nav-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 0 4px; color: var(--text2); font-size: 11px;
}
.nav-item .ico { font-size: 20px; line-height: 1; transition: transform 140ms; }
.nav-item.on { color: var(--primary-dark); font-weight: 600; }
.nav-item.on .ico { transform: translateY(-1px) scale(1.06); animation: nav-pop 220ms ease-out; }
.nav-item.on::after {
  content: ""; position: absolute; bottom: 0; width: 8px; height: 4px;
  border-radius: 999px; background: var(--primary);
}
@keyframes nav-pop { 0% { transform: translateY(0) scale(.9); } 60% { transform: translateY(-2px) scale(1.1); } 100% { transform: translateY(-1px) scale(1.06); } }
.nav-item .dot {
  position: absolute; top: 2px; right: 50%; margin-right: -14px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #f06a6a; color: #fff; font-size: 10px; line-height: 16px; text-align: center;
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(31, 52, 64, .35);
  z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  animation: fade 160ms ease-out;
}
.sheet {
  width: 100%; max-width: 560px; background: #fff;
  border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: sheet-up 240ms cubic-bezier(.34,1.4,.64,1);
  max-height: 88vh; overflow-y: auto;
}
.parent-mode .sheet { max-width: 480px; }
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sub { color: var(--text2); font-size: 13px; margin-bottom: 14px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet .actions .btn { flex: 1; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(31, 52, 64, .92); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; z-index: 60;
  animation: toast-in 200ms ease-out; max-width: 86%; text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 金币飞入 ---------- */
.fly-coin {
  position: fixed; z-index: 70; width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff3b8, var(--yellow) 60%, var(--yellow-deep));
  box-shadow: 0 2px 6px rgba(232,185,42,.5);
  pointer-events: none;
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 34px 10px; color: var(--text2); }
.empty .egg-shape {
  width: 96px; height: 108px; margin: 0 auto 12px;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: linear-gradient(180deg, #eaf9fd, #d6f4fa);
  position: relative; border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.empty .egg-shape::before, .empty .egg-shape::after {
  content: ""; position: absolute; top: 44px; width: 7px; height: 7px;
  border-radius: 50%; background: #7fb7c9;
}
.empty .egg-shape::before { left: 30px; }
.empty .egg-shape::after { right: 30px; }
.empty .egg-mouth {
  position: absolute; left: 50%; top: 60px; width: 18px; height: 9px;
  margin-left: -9px; border-bottom: 2px solid #7fb7c9; border-radius: 0 0 12px 12px;
}
.empty .t { font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.login-hero { text-align: center; margin-bottom: 22px; }
.login-hero .big-egg {
  width: 108px; height: 120px; margin: 0 auto 14px;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: linear-gradient(160deg, #d6f4fa, #5bc8e8);
  display: grid; place-items: center; font-size: 46px;
  box-shadow: 0 10px 24px rgba(91,200,232,.35), inset 0 -6px 0 rgba(47,168,201,.25);
  animation: float 3.4s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.login-hero h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: 1px; }
.login-hero p { color: var(--text2); font-size: 13px; margin: 0; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 16px 0 6px; }
.pin-dots i {
  width: 14px; height: 16px; border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: #e6f4f8; border: 1px solid var(--line);
}
.pin-dots i.on { background: var(--primary); border-color: var(--primary-dark); animation: pop 160ms ease-out; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.keypad button {
  height: 58px; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 #dceaf0;
  font-size: 22px; font-weight: 600; color: var(--text);
}
.keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #dceaf0; }
.keypad button.ghostkey { background: #f2f9fb; box-shadow: none; font-size: 16px; color: var(--text2); }
.avatar-pick { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 14px 0 4px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); margin: 10px 0 16px; }
.checkline input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- 家长端 ---------- */
.chip-tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.chip-tabs .chip { flex: none; }
.seg { display: flex; background: #eef7fa; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; height: 38px; border-radius: 999px; font-size: 14px; color: var(--text2); }
.seg button.on { background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 2px 6px rgba(47,168,201,.15); }
.review-card { background: #fff; border-radius: var(--r-card-p); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.review-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.review-mid { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.review-mid .t { font-weight: 600; font-size: 15px; }
.review-note { background: #f7fcfd; border-radius: 12px; padding: 8px 10px; font-size: 13px; color: var(--text2); margin-bottom: 10px; }
.review-actions { display: flex; gap: 8px; }
.review-actions .btn { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.stat { background: #fff; border-radius: 16px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stat .n { font-size: 20px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--text2); margin-top: 2px; }
.code-box {
  display: flex; align-items: center; gap: 10px; background: #f4fbfd;
  border: 1px dashed var(--primary); border-radius: 14px; padding: 12px 14px;
  font-size: 22px; font-weight: 800; letter-spacing: 4px; color: var(--primary-dark);
  justify-content: center;
}
.hint { font-size: 12px; color: var(--text2); line-height: 1.6; }
.divider { height: 1px; background: var(--line); margin: 12px 0; border: 0; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 一键生成任务 ---------- */
.tpl-head { display: flex; align-items: center; gap: 4px; margin: 6px 0 8px; }
.tpl-count { flex: 1; font-size: 13px; color: var(--text2); }
.tpl-count b { color: var(--primary-dark); font-size: 15px; }
.tpl-link { font-size: 13px; font-weight: 600; color: var(--primary-dark); padding: 6px 8px; border-radius: 999px; }
.tpl-link:active { background: var(--primary-light); }
.tpl-list {
  border: 1px solid var(--line); border-radius: 16px;
  padding: 2px 12px 8px; margin-bottom: 10px;
  max-height: 40vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
/* 生成按钮常驻在弹层底部，列表再长也不用翻到底才能点 */
.sheet.has-sticky { padding-bottom: 0; }
.sheet .actions.sticky {
  position: sticky; bottom: 0; z-index: 2;
  margin-top: 0; background: #fff;
  /* 弹层自身不留底部内边距，由常驻按钮提供，避免按钮下方漏出滚动内容 */
  padding: 10px 0 calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 10px -8px rgba(31, 52, 64, .22);
}
.tpl-cat { font-size: 12px; font-weight: 700; color: var(--text2); padding: 12px 0 6px; }
.tpl-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.tpl-item input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.tpl-item .grow { flex: 1; min-width: 0; }
.tpl-item .nm { font-size: 14px; font-weight: 600; }
.tpl-item .meta { font-size: 12px; color: var(--text2); }
.tpl-item.off { opacity: .55; cursor: default; }
.tpl-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  font-size: 11px; font-weight: 600; line-height: 18px; border-radius: 999px;
  background: #eef3f5; color: var(--text2);
}
.tpl-tag.note { background: var(--yellow-soft); color: #8a6d12; }

/* ============================================================
   手机 / 平板适配（iPhone、iPad、安卓）
   ============================================================ */

/* ---------- 全局：禁止自动放大字体、去掉点击高亮、关掉下拉刷新 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none; /* 安卓/苹果下拉刷新会打断孩子操作 */
}
button, .btn, .chip, .nav-item, .row, .task-card, .badge-card, .seg button,
.keypad button, .tpl-item, .checkline, .stepper button, .tpl-link {
  touch-action: manipulation;      /* 去掉双击缩放和 300ms 延迟 */
  -webkit-touch-callout: none;    /* 长按不弹菜单 */
}

/* 输入框统一 16px：低于 16px 时 iOS 聚焦会自动把页面放大 */
.input, select.input, textarea.input { font-size: 16px; }
.stepper input { font-size: 16px; }

/* ---------- 安全区：刘海、灵动岛、底部横条、横屏时左右缺口 ---------- */
#app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.screen { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.screen.no-nav { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.navbar {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh; /* 苹果浏览器地址栏收起后，用可视高度更准 */
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* ---------- 触屏：加大可点区域 ---------- */
@media (hover: none) and (pointer: coarse) {
  .chip { min-height: 38px; padding: 9px 16px; font-size: 14px; }
  .chip.egg { min-height: 50px; padding: 0; }
  .seg button { height: 42px; }
  .nav-item { min-height: 48px; justify-content: center; }
  .checkline input { width: 20px; height: 20px; }
  .row { padding: 15px 4px; }
  .tpl-link { padding: 8px 10px; }
}

/* ---------- 小屏手机（iPhone SE / 安卓小屏） ---------- */
@media (max-width: 380px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .topbar { gap: 6px; }
  .topbar .title { font-size: 17px; }
  .btn.sm { padding: 0 12px; font-size: 13px; }
  .coinbar { padding: 12px 14px; }
  .coinbar .num { font-size: 26px; }
  .task-card { padding: 14px; }
  .task-title { font-size: 15px; }
  .keypad button { height: 52px; font-size: 20px; }
  .stat-grid { gap: 8px; }
  .stat .n { font-size: 18px; }
  .badge-grid { gap: 8px; }
}


/* ---------- 平板竖屏 / 大屏手机（iPad mini、iPad 竖屏） ---------- */
@media (min-width: 700px) {
  html, body { font-size: 16px; }
  #app { max-width: 860px; }
  #app.parent-mode { max-width: 760px; }
  .screen { padding: 26px 28px 116px; }
  .topbar .title { font-size: 21px; }
  .navbar {
    max-width: 860px; border-radius: 24px 24px 0 0;
    box-shadow: 0 -6px 20px rgba(47, 168, 201, .12); padding-top: 8px;
  }
  .parent-mode .navbar { max-width: 760px; }
  .nav-item { font-size: 13px; padding: 8px 0 6px; }
  .nav-item .ico { font-size: 24px; }

  /* 任务卡两栏 */
  .task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .task-grid .task-card { margin-bottom: 0; }
  .task-grid .empty { grid-column: 1 / -1; }
  .task-title { font-size: 17px; }
  .task-desc { font-size: 14px; }
  .coin-pill { font-size: 14px; padding: 5px 12px; }

  .badge-grid { grid-template-columns: repeat(6, 1fr); gap: 14px; }
  .badge-card { min-height: 118px; }
  .badge-card .ico { font-size: 30px; }
  .badge-card .nm { font-size: 13px; }

  .btn { height: 58px; font-size: 17px; }
  .btn.sm { height: 48px; font-size: 15px; padding: 0 20px; }
  .parent-mode .btn { height: 52px; font-size: 16px; }
  .parent-mode .btn.sm { height: 44px; font-size: 14px; }
  .coinbar { padding: 18px 22px; }
  .coinbar .num { font-size: 34px; }
  .coinbar .coin-ico { width: 46px; height: 46px; font-size: 23px; }
  .stat .n { font-size: 24px; }
  .stat .l { font-size: 13px; }

  .login-wrap { max-width: 520px; margin: 0 auto; }
  .login-hero .big-egg { width: 124px; height: 138px; font-size: 54px; }
  .login-hero h1 { font-size: 26px; }
  .login-hero p { font-size: 15px; }
  .keypad button { height: 66px; font-size: 25px; border-radius: 22px; }
  .avatar-pick { gap: 18px; }
  .egg-avatar.lg { width: 76px; height: 84px; font-size: 38px; }

  .sheet {
    max-width: 620px; border-radius: 28px 28px 0 0;
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  }
  .parent-mode .sheet { max-width: 580px; }
  .sheet h3 { font-size: 19px; }
  .tpl-list { max-height: 46vh; }
  .tpl-item { padding: 11px 0; }
  .tpl-item .nm { font-size: 15px; }
  .tpl-item .meta { font-size: 13px; }
  .sheet .actions.sticky { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ---------- 平板横屏 / 大平板（iPad Pro、12.9 寸） ---------- */
@media (min-width: 1100px) {
  #app { max-width: 1080px; }
  .navbar { max-width: 1080px; }
  .screen { padding: 30px 36px 120px; }
  .task-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .badge-grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }
  .sheet { max-width: 680px; }
  .parent-mode .sheet { max-width: 620px; }
}

/* ---------- 手机横屏（放在最后，优先级高于平板规则） ---------- */
@media (max-height: 480px) {
  .screen { padding: 12px 16px calc(66px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 8px; }
  .topbar .title { font-size: 17px; }
  .egg-avatar { width: 36px; height: 40px; font-size: 18px; }
  .coinbar { padding: 8px 14px; margin-bottom: 8px; }
  .coinbar .coin-ico { width: 30px; height: 30px; font-size: 15px; }
  .coinbar .num { font-size: 22px; }
  .progress-row { margin: 2px 0 8px; }
  .task-card { padding: 12px; margin-bottom: 10px; }
  .task-title { font-size: 15px; }
  .task-foot { margin-top: 8px; }
  .btn.sm, .parent-mode .btn.sm { height: 38px; font-size: 14px; }
  .navbar { padding-top: 2px; border-radius: 0; }
  .nav-item { padding: 2px 0; min-height: 38px; font-size: 11px; }
  .nav-item .ico { font-size: 19px; }
  .login-hero { margin-bottom: 8px; }
  .login-hero .big-egg { width: 60px; height: 68px; font-size: 28px; margin-bottom: 4px; }
  .login-hero h1 { font-size: 17px; }
  .login-hero p { font-size: 12px; }
  .keypad button { height: 42px; font-size: 19px; border-radius: 14px; }
  .pin-dots { margin: 8px 0 2px; }
  .card { padding: 12px; }
  .sheet { max-height: 94vh; padding-top: 14px; }
  .sheet .actions.sticky { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .tpl-list { max-height: 34vh; }
  .stat-grid { margin: 8px 0; }
  .badge-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .badge-card { min-height: 84px; }
}