:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #2d2a4a;
  --ink-soft: #6b6788;
  --primary: #6c5ce7;
  --primary-soft: #efeafc;
  --accent: #ffb43a;
  --good: #2ecc71;
  --bad: #ff6b6b;
  --line: #ececf5;
  --shadow: 0 8px 24px rgba(108, 92, 231, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 24px; }
.hidden { display: none !important; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #6c5ce7, #8e7bff);
  color: #fff; padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 4px 16px rgba(108,92,231,.28);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.brand-logo { font-size: 20px; }
.view-switch { display: flex; background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px; }
.vs-btn {
  border: 0; background: transparent; color: #fff; font-weight: 700;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: .2s;
}
.vs-btn.active { background: #fff; color: var(--primary); }

/* 档案条 */
.profile-bar {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 4px;
  scrollbar-width: none;
}
.profile-bar::-webkit-scrollbar { display: none; }
.pchip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  padding: 6px 12px 6px 8px; cursor: pointer; font-weight: 700; font-size: 13px;
}
.pchip.active { border-color: var(--primary); background: var(--primary-soft); }
.pchip .pava { font-size: 18px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin: 12px 14px;
}
.section-title { font-weight: 800; font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 6px; }

/* 宠物卡 */
.pet-card {
  background: linear-gradient(160deg, #fff6e6, #ffe9f3);
  text-align: center; position: relative; overflow: hidden;
}
.pet-emoji { font-size: 84px; line-height: 1; margin: 6px 0 2px; transition: transform .3s; }
.pet-emoji.bounce { animation: bounce .6s; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-14px)} }
.pet-name { font-weight: 800; font-size: 17px; }
.pet-stage { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.pet-mood { font-size: 22px; margin-top: 4px; }
.feed-btn {
  margin-top: 12px; border: 0; border-radius: 999px; padding: 11px 22px;
  background: var(--accent); color: #5a3d00; font-weight: 800; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 14px rgba(255,180,58,.4);
}
.feed-btn:disabled { background: #e8e6f0; color: #aaa; box-shadow: none; cursor: not-allowed; }

/* 星星余额 */
.stars-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #fff0c2, #ffd97a);
  border-radius: var(--radius); padding: 14px 18px; margin: 12px 14px;
  box-shadow: var(--shadow);
}
.stars-banner .big { font-size: 30px; font-weight: 900; color: #8a5a00; }
.stars-banner .lbl { font-size: 12px; color: #8a5a00; font-weight: 700; }

/* 任务列表 */
.task {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: 0; }
.task-ico { font-size: 24px; width: 38px; text-align: center; }
.task-main { flex: 1; }
.task-name { font-weight: 700; }
.task-sub { font-size: 12px; color: var(--ink-soft); }
.task-check {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--primary);
  background: #fff; color: var(--primary); font-size: 20px; font-weight: 900;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s;
}
.task-check.done { background: var(--primary); color: #fff; border-color: var(--primary); }
.task-check:active { transform: scale(.9); }

/* 徽章 */
.badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  width: 58px; text-align: center; font-size: 11px; color: var(--ink-soft);
}
.badge .b-ico { font-size: 30px; filter: grayscale(1) opacity(.4); }
.badge.on .b-ico { filter: none; }
.badge.on { color: var(--ink); font-weight: 700; }
.badge.on .b-ico { animation: badgeSpin 8s linear infinite; transform-origin: 50% 55%; }
@keyframes badgeSpin { to { transform: rotate(360deg); } }

/* 愿望商店 */
.wish {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 2px solid var(--line); border-radius: 14px; margin-bottom: 10px;
}
.wish-info { flex: 1; }
.wish-name { font-weight: 700; }
.wish-cost { font-size: 12px; color: var(--accent); font-weight: 800; }
.wish-btn {
  border: 0; border-radius: 999px; padding: 9px 16px; background: var(--primary);
  color: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
}
.wish-btn:disabled { background: #e8e6f0; color: #aaa; cursor: not-allowed; }
.wish.redeemed { opacity: .65; }
.wish-tag { font-size: 11px; background: var(--primary-soft); color: var(--primary); padding: 3px 8px; border-radius: 999px; font-weight: 700; }

/* 家长端 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; font-size: 14px;
  cursor: pointer; background: var(--primary); color: #fff;
}
.btn.block { width: 100%; }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: #ffeaea; color: var(--bad); }
.btn.amber { background: var(--accent); color: #5a3d00; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; }

.list-item {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff;
}
.list-item .li-main { flex: 1; }
.list-item .li-title { font-weight: 700; }
.list-item .li-sub { font-size: 12px; color: var(--ink-soft); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--primary-soft);
  color: var(--primary); font-size: 16px; cursor: pointer;
}
.icon-btn.del { background: #ffeaea; color: var(--bad); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--primary-soft); border-radius: 14px; padding: 14px; text-align: center;
}
.stat .num { font-size: 26px; font-weight: 900; color: var(--primary); }
.stat .cap { font-size: 12px; color: var(--ink-soft); font-weight: 700; }

.muted { color: var(--ink-soft); font-size: 12px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; }

/* 弹层 */
.modal-root {
  position: fixed; inset: 0; z-index: 50; background: rgba(45,42,74,.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-root .sheet {
  background: #fff; width: 100%; max-width: 480px; border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 86vh; overflow-y: auto;
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 0 0 16px; font-size: 17px; }
.sheet .close { float: right; border: 0; background: var(--line); width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-weight: 700; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.footnote { text-align: center; color: var(--ink-soft); font-size: 11px; padding: 18px 20px 0; }
