/* 套娃拆拆乐 v2 · 嵌套盒视觉 + 小松鼠礼物塔 */
:root {
  --cream: #fff6e5;
  --pink: #ff8fb3;
  --gold: #ffd54f;
  --choco: #6b4a2b;
  --ink: #3a2e1f;
  --green: #6ec96e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: linear-gradient(180deg, #ffe3b3 0%, var(--cream) 60%, #b8e6b8 100%);
  color: var(--ink); user-select: none; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
#app { max-width: 760px; margin: 0 auto; padding: 12px; min-height: 100vh; }
.screen { display: none; }
.screen.active { display: block; }

.title { text-align: center; font-size: 2rem; margin: 18px 0 4px; text-shadow: 2px 2px 0 rgba(255,255,255,.6); }
.subtitle { text-align: center; font-size: 1.05rem; margin-bottom: 16px; color: #8a6a3f; }
.animal-picker { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 18px 0; }
.animal-picker button {
  font-size: 2.4rem; width: 84px; height: 84px; border-radius: 50%;
  border: 4px solid var(--choco); background: #fff; cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,.18); transition: transform .15s;
}
.animal-picker button:active { transform: scale(.9); }
.mode-picker { display: flex; gap: 14px; justify-content: center; margin-top: 22px; }
.mode-btn {
  font-size: 1.15rem; padding: 16px 22px; border-radius: 20px;
  border: 4px solid var(--choco); cursor: pointer; background: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,.18);
}
.mode-btn small { display: block; font-size: .8rem; color: #8a7a5f; margin-top: 4px; }
.mode-btn.baby { border-color: var(--pink); }
.mode-btn.challenge { border-color: #5c9cff; }

.game-header { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.animal-face { font-size: 2.6rem; background: #fff; border-radius: 50%; width: 66px; height: 66px;
  display: flex; align-items: center; justify-content: center; border: 4px solid var(--choco); }
.header-info { flex: 1; }
.hint { font-size: 1.1rem; font-weight: 700; }
.status-line { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: .9rem; flex-wrap: wrap; }

/* ---------- 俄罗斯套娃视觉 ---------- */
.nest-zone {
  min-height: 330px; position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 10px 0;
}
.doll-shape {
  position: absolute; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  border: 3px solid #8a5a2b;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -10px 14px rgba(0,0,0,.12), 0 5px 14px rgba(0,0,0,.2);
  transition: transform .3s ease;
}
/* 未拆开的完整娃娃：上脸下裙 */
.doll-shape.solid {
  background: linear-gradient(180deg,
    #ffe0c0 0%, #ffd9b3 38%,
    #ff8a50 39%, #ff7043 78%,
    #ffb74d 100%);
}
.doll-shape.solid .doll-face { position: absolute; top: 8%; }
.doll-flower { position: absolute; bottom: 10%; }
.doll-seam {
  position: absolute; top: 38%; left: 5%; right: 5%;
  border-top: 3px dashed rgba(107,74,43,.55);
}
.doll-tag {
  position: absolute; bottom: -22px; background: #fff;
  border: 3px solid #ffd54f; border-radius: 14px;
  font-size: .9rem; font-weight: 800; padding: 1px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  white-space: nowrap;
}
/* 已打开的壳：浅色 + 空心感 */
.doll-shape.shell {
  background: linear-gradient(180deg, #f7ead8 0%, #f0ddc4 100%);
  opacity: .85;
}
.doll-shape.shell::after {
  content: ''; position: absolute; left: 16%; right: 16%; top: 14%; bottom: 34%;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: radial-gradient(ellipse at 50% 35%, rgba(138,106,74,.35), rgba(138,106,74,.08) 70%);
}
/* 基线空娃娃 */
.doll-shape.base { background: radial-gradient(circle, #fff 40%, #e8f7e8 100%); }
.doll-base-mark { font-size: 1.1rem; animation: base-glow 1s ease infinite alternate; }
@keyframes base-glow { from { opacity: .5; transform: scale(.85); } to { opacity: 1; transform: scale(1.15); } }
.nest-caption {
  position: absolute; bottom: -6px; width: 100%; text-align: center;
  font-size: .95rem; font-weight: 700; color: #8a6a3f;
}
.reveal { animation: open-pop .45s ease; }
@keyframes open-pop {
  0% { transform: scale(.2) rotate(-12deg); opacity: 0; }
  70% { transform: scale(1.2) rotate(4deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 回溯数字气泡（从里往外传） */
.bubble {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, #fff, #ffe082);
  border: 4px solid var(--gold); font-size: 2.6rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px rgba(255,213,79,.8);
}
.bubble.travel { animation: travel-out .6s ease; }
@keyframes travel-out {
  0% { transform: scale(.3); opacity: .4; }
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); }
}

/* 挑战模式：追踪卡片 */
.trace-card {
  background: #fff; border: 4px solid #5c9cff; border-radius: 20px;
  padding: 18px 26px; text-align: center; font-size: 1.2rem; line-height: 2;
  box-shadow: 0 6px 16px rgba(0,0,0,.15); z-index: 6; position: relative;
}
.trace-in b { color: #5c9cff; font-size: 1.5rem; }
.trace-plus b.trace-num { color: #ff7043; font-size: 1.5rem; }
.trace-eq { font-size: 1.4rem; font-weight: 900; }

/* 操作区 */
.action-zone { text-align: center; margin: 10px 0; }
.btn-open {
  font-size: 1.3rem; padding: 16px 44px; border-radius: 22px;
  border: 4px solid var(--choco); background: #fff; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.btn-open:active { transform: scale(.94); }

.backtrack-zone { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.backtrack-zone .hint { width: 100%; text-align: center; font-size: 1.05rem; margin-bottom: 4px; }
.num-btn {
  min-width: 58px; min-height: 58px; border-radius: 16px; font-size: 1.3rem; font-weight: 800;
  border: 3px solid var(--choco); background: #fff; cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,.15);
}
.num-btn:active { transform: scale(.92); }

.feedback { text-align: center; font-size: 1.3rem; font-weight: 800; min-height: 2.2rem; margin: 8px 0; }
.feedback.ok { color: #2e7d32; }
.feedback.no { color: #d32f2f; }

.btn-reset, .btn-home {
  display: block; margin: 10px auto; padding: 13px 26px; font-size: 1.05rem;
  border-radius: 18px; border: 3px solid var(--choco); cursor: pointer;
  background: #fff; box-shadow: 0 4px 8px rgba(0,0,0,.18);
}
.btn-home { background: #ffe9d6; }

.stats-title { text-align: center; margin: 20px 0 10px; }
.stats-box { background: rgba(255,255,255,.85); border-radius: 18px; padding: 16px; margin: 12px 0; font-size: 1.02rem; line-height: 1.9; }
.stats-box .big { font-size: 1.35rem; font-weight: 800; }

@keyframes celebrate-pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.4) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
.celebrate { animation: celebrate-pop .6s ease; display: inline-block; }

@media (max-width: 480px) {
  .animal-picker button { width: 64px; height: 64px; font-size: 1.9rem; }
  .box1 { width: 190px; height: 190px; }
  .box2 { width: 140px; height: 140px; }
  .box3 { width: 92px; height: 92px; }
  .inner-box { width: 100px; height: 100px; }
  .title { font-size: 1.5rem; }
}

/* ===== 通用：回游乐场 + 奖励评价 ===== */
.btn-portal {
  display: block; margin: 8px auto; padding: 12px 26px; font-size: 1.05rem;
  border-radius: 18px; border: 3px solid #ff8fb3; cursor: pointer;
  background: linear-gradient(160deg, #fff, #ffe4ec); box-shadow: 0 4px 10px rgba(0,0,0,.15);
  animation: portal-bob 2s ease-in-out infinite; text-decoration: none; text-align: center;
  color: #3a2e1f; font-weight: 800; width: fit-content;
}
.btn-portal:hover { transform: scale(1.05); }
@keyframes portal-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.btn-portal-mini {
  position: absolute; top: 10px; left: 10px; z-index: 20;
  background: rgba(255,255,255,.9); border: 2px solid #ff8fb3; border-radius: 16px;
  padding: 4px 12px; font-size: .82rem; font-weight: 800; color: #3a2e1f;
  text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.reward-card {
  text-align: center; background: linear-gradient(160deg, #fffbe6, #ffe9d9);
  border: 4px solid #ffd54f; border-radius: 20px; padding: 14px; margin: 10px auto;
  font-weight: 900; color: #b8860b; max-width: 360px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  animation: reward-pop .6s ease;
}
.reward-card .reward-text { font-size: 1.2rem; margin-top: 4px; }
.confetti { position: relative; min-height: 40px; }
.confetti span {
  position: absolute; top: -8px; font-size: 1.3rem;
  animation: confetti-fall 2.2s ease-in infinite;
}
.confetti span:nth-child(1) { left: 8%; animation-delay: 0s; }
.confetti span:nth-child(2) { left: 28%; animation-delay: .3s; }
.confetti span:nth-child(3) { left: 48%; animation-delay: .6s; }
.confetti span:nth-child(4) { left: 68%; animation-delay: .9s; }
.confetti span:nth-child(5) { left: 88%; animation-delay: 1.2s; }
@keyframes confetti-fall {
  0% { transform: translateY(-8px) rotate(0); opacity: 1; }
  80% { transform: translateY(40px) rotate(300deg); opacity: 1; }
  100% { transform: translateY(40px) rotate(360deg); opacity: 0; }
}
@keyframes reward-pop {
  0% { transform: scale(.3) rotate(-10deg); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* 家长折叠区 + 生活任务 */
.dad-note {
  max-width: 600px; margin: 8px auto; background: #fff8e7;
  border: 3px dashed #b08968; border-radius: 14px; padding: 8px 14px;
}
.dad-note summary { font-weight: 900; color: #8a6a4f; cursor: pointer; font-size: .98rem; }
.dad-text { font-size: .92rem; color: #5a4a35; line-height: 1.7; margin: 4px 0; }
.life-task {
  text-align: center; font-size: 1rem; font-weight: 900; color: #2e7d32;
  background: #e8f5e9; border: 2px solid #6ec96e; border-radius: 12px;
  padding: 8px 12px; margin: 8px auto; max-width: 600px;
}
