* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #FFF8EE;
  --card: #FFFFFF;
  --primary: #FF8A5C;
  --primary-dark: #E96F3F;
  --accent: #4ECDC4;
  --yellow: #FFD166;
  --purple: #9B8CF2;
  --text: #4A4036;
  --text-light: #9A8F82;
  --radius: 20px;
  --shadow: 0 4px 16px rgba(74, 64, 54, .08);
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ===== 通用 ===== */
.btn {
  border: none; border-radius: 999px; padding: 14px 32px;
  font-size: 18px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn-ghost { background: #F1EBE2; color: var(--text); box-shadow: none; font-size: 14px; padding: 10px 20px; }
.btn-accent { background: var(--accent); box-shadow: 0 4px 0 #35A89F; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; max-width: 720px; margin: 0 auto;
}
.star-pill {
  background: var(--card); border-radius: 999px; padding: 8px 18px;
  font-size: 18px; font-weight: 700; box-shadow: var(--shadow);
}
.parent-link { background: none; border: none; font-size: 14px; color: var(--text-light); cursor: pointer; text-decoration: underline; }

.page { max-width: 720px; margin: 0 auto; padding: 0 20px 40px; }

.greeting { font-size: 26px; font-weight: 800; margin: 8px 0 4px; }
.sub-greeting { color: var(--text-light); margin-bottom: 20px; }

/* ===== 任务卡 ===== */
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.task-card {
  background: var(--card); border-radius: var(--radius); padding: 22px 16px;
  text-align: center; cursor: pointer; box-shadow: var(--shadow);
  border: 3px solid transparent; transition: transform .15s;
  position: relative;
}
.task-card:hover { transform: translateY(-3px); }
.task-card .emoji { font-size: 44px; }
.task-card .name { font-size: 20px; font-weight: 700; margin-top: 8px; }
.task-card .meta { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.task-card.done { border-color: var(--accent); opacity: .75; }
.task-card .done-badge {
  position: absolute; top: 8px; right: 10px; font-size: 13px;
  color: var(--accent); font-weight: 700;
}

/* ===== 宠物条 ===== */
.pet-strip {
  margin-top: 20px; background: linear-gradient(135deg, #FFF3D6, #FFE9E0);
  border-radius: var(--radius); padding: 18px 20px; display: flex;
  align-items: center; gap: 16px; cursor: pointer; box-shadow: var(--shadow);
}
.pet-strip .pet-face { font-size: 46px; }
.pet-strip .pet-info { flex: 1; }
.pet-strip .pet-name { font-weight: 700; font-size: 17px; }
.pet-strip .pet-hint { font-size: 13px; color: var(--text-light); }
.exp-bar { height: 10px; background: #fff; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.exp-bar > div { height: 100%; background: var(--yellow); border-radius: 99px; transition: width .4s; }

/* ===== 答题页 ===== */
.quiz-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 18px; }
.quiz-progress { flex: 1; height: 12px; background: #EFE7DA; border-radius: 99px; overflow: hidden; }
.quiz-progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.quiz-count { font-weight: 700; color: var(--text-light); font-size: 14px; white-space: nowrap; }
.back-btn { background: none; border: none; font-size: 22px; cursor: pointer; }

.quiz-prompt {
  background: var(--card); border-radius: var(--radius); padding: 36px 20px;
  text-align: center; box-shadow: var(--shadow); margin-bottom: 20px;
}
.quiz-prompt .big-char { font-size: 88px; font-weight: 800; line-height: 1.2; }
.quiz-prompt .big-formula { font-size: 56px; font-weight: 800; }
.quiz-prompt .prompt-text { font-size: 20px; color: var(--text-light); margin-top: 10px; }
.speak-btn {
  margin-top: 14px; border: none; background: #EFF9F8; color: var(--accent);
  border-radius: 999px; padding: 10px 22px; font-size: 16px; cursor: pointer; font-weight: 600;
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.option {
  background: var(--card); border: 3px solid #EFE7DA; border-radius: var(--radius);
  padding: 22px 10px; font-size: 26px; font-weight: 700; text-align: center;
  cursor: pointer; transition: all .15s; font-family: inherit; color: var(--text);
}
.option:hover { border-color: var(--accent); }
.option.correct { background: #E6FAF0; border-color: #2ECC71; color: #1E9E57; }
.option.wrong { background: #FDECEA; border-color: #E74C3C; color: #C0392B; }
.option.disabled { pointer-events: none; }

/* ===== 结果页 ===== */
.result-card { text-align: center; padding: 40px 20px; }
.result-emoji { font-size: 80px; }
.result-title { font-size: 28px; font-weight: 800; margin: 12px 0 6px; }
.result-sub { color: var(--text-light); font-size: 17px; margin-bottom: 8px; }
.result-stars { font-size: 24px; font-weight: 800; color: #F5A623; margin: 14px 0 26px; }
.celebrate { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ===== 打卡 ===== */
.habit-list { display: flex; flex-direction: column; gap: 12px; }
.habit-item {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px; cursor: pointer; box-shadow: var(--shadow);
  border: 3px solid transparent;
}
.habit-item.checked { border-color: var(--accent); background: #F2FBFA; }
.habit-item .h-emoji { font-size: 34px; }
.habit-item .h-name { flex: 1; font-size: 18px; font-weight: 600; }
.habit-item .h-check { font-size: 24px; color: #D8CFC2; }
.habit-item.checked .h-check { color: var(--accent); }
.streak-banner {
  text-align: center; background: #FFF3D6; border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px; font-weight: 700;
}

/* ===== 宠物页 ===== */
.pet-page { text-align: center; padding-top: 20px; }
.pet-big { font-size: 110px; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.pet-level { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.pet-mood { color: var(--text-light); margin-bottom: 18px; }

/* ===== 徽章墙 ===== */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.badge-cell { background: var(--card); border-radius: var(--radius); padding: 16px 8px; text-align: center; box-shadow: var(--shadow); }
.badge-cell .b-emoji { font-size: 36px; }
.badge-cell .b-name { font-size: 13px; margin-top: 6px; font-weight: 600; }
.badge-cell.locked { opacity: .35; filter: grayscale(1); }

/* ===== 家长端 ===== */
.gate-card { max-width: 380px; margin: 80px auto; background: var(--card); border-radius: var(--radius); padding: 36px 28px; text-align: center; box-shadow: var(--shadow); }
.gate-card h2 { margin-bottom: 8px; }
.gate-card .gate-q { font-size: 30px; font-weight: 800; margin: 18px 0; }
.gate-card input {
  width: 120px; font-size: 24px; text-align: center; padding: 10px;
  border: 2px solid #EFE7DA; border-radius: 12px; outline: none;
}
.gate-card .gate-err { color: #E74C3C; font-size: 13px; margin-top: 10px; min-height: 18px; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .s-label { font-size: 13px; color: var(--text-light); }
.stat-card .s-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.panel { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.panel h3 { font-size: 16px; margin-bottom: 12px; }
.panel canvas { width: 100%; }
.readiness-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.readiness-row .r-name { width: 72px; }
.readiness-row .r-bar { flex: 1; height: 12px; background: #EFE7DA; border-radius: 99px; overflow: hidden; }
.readiness-row .r-bar > div { height: 100%; background: var(--purple); border-radius: 99px; }
.readiness-row .r-val { width: 44px; text-align: right; font-weight: 700; }

.plan-day { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dashed #EFE7DA; flex-wrap: wrap; }
.plan-day .d-name { width: 88px; font-weight: 700; font-size: 14px; }
.plan-chip {
  border: 2px solid #EFE7DA; background: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--text);
}
.plan-chip.on { background: #EFF9F8; border-color: var(--accent); color: #1E8A82; font-weight: 700; }

.parent-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.parent-tab {
  flex: 1; text-align: center; padding: 12px; border-radius: 14px;
  background: #F1EBE2; font-weight: 700; cursor: pointer; border: none; font-size: 15px; font-family: inherit; color: var(--text);
}
.parent-tab.active { background: var(--text); color: #fff; }

.record-list { font-size: 14px; }
.record-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #EFE7DA; }
.record-item .r-mod { font-weight: 600; }
.record-item .r-detail { color: var(--text-light); }

/* ===== 锁屏 ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(58, 80, 72, .92);
  display: flex; align-items: center; justify-content: center; z-index: 99;
}
.rest-card { text-align: center; color: #fff; padding: 20px; }
.rest-emoji { font-size: 90px; }
.rest-card h2 { font-size: 30px; margin: 16px 0 8px; }
.rest-card p { opacity: .85; }
.rest-countdown { font-size: 56px; font-weight: 800; margin: 24px 0; font-variant-numeric: tabular-nums; }

.section-title { font-size: 18px; font-weight: 800; margin: 24px 0 12px; }
.empty-hint { text-align: center; color: var(--text-light); padding: 30px 0; font-size: 14px; }

@media (max-width: 480px) {
  .quiz-prompt .big-char { font-size: 72px; }
  .option { font-size: 22px; }
}
