/* 快乐启蒙乐园 —— 面向幼儿的大按钮、高对比、卡通风格样式。 */
:root {
  --yellow: #ffcc4d;
  --cream: #fff8e1;
  --orange: #ff914d;
  --green: #7bc96f;
  --blue: #5aa9e6;
  --pink: #ff8fab;
  --ink: #4a3b2a;
}

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

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  user-select: none;
}

#app { max-width: 720px; margin: 0 auto; padding: 16px; }

/* 首页 */
.home-header { text-align: center; margin: 24px 0; }
.home-header h1 { font-size: 2rem; margin: 0 0 8px; }
.stars { font-size: 1.2rem; margin: 0; }
.warn { text-align: center; color: #b00; font-size: .95rem; }

.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.menu-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 32px 12px; border-radius: 24px; text-decoration: none;
  color: var(--ink); font-size: 1.4rem; font-weight: 700;
  box-shadow: 0 6px 0 rgba(0,0,0,.12); transition: transform .1s;
}
.menu-card:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.menu-card .emoji { font-size: 3.4rem; }
.menu-card.pinyin { background: var(--pink); }
.menu-card.math { background: var(--blue); }

/* 返回与标题 */
.back {
  display: inline-block; margin-bottom: 12px; padding: 8px 16px;
  background: var(--yellow); border-radius: 16px; text-decoration: none;
  color: var(--ink); font-weight: 700;
}
.screen-title { text-align: center; font-size: 1.6rem; }

/* 关卡选择 */
.level-grid, .mode-switch { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.level-card, .mode-btn {
  padding: 18px 20px; font-size: 1.2rem; font-weight: 700; border: none;
  border-radius: 18px; background: var(--green); color: #fff;
  box-shadow: 0 5px 0 rgba(0,0,0,.12); cursor: pointer;
}
.level-card:active, .mode-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.mode-btn { background: #cbb; }
.mode-btn.active { background: var(--orange); }

/* 题目与选项 */
.progress { text-align: center; font-size: 1.1rem; margin: 16px 0; }
.question, .quiz-zi {
  text-align: center; font-size: 3rem; font-weight: 800; background: #fff;
  border: 4px dashed var(--yellow); border-radius: 24px; padding: 28px 12px;
  margin: 12px auto; max-width: 420px; cursor: pointer;
}
.quiz-zi { font-size: 4.5rem; display: block; width: 100%; }
.quiz-zi small { font-size: 1rem; color: #999; font-weight: 400; }
.quiz-tip { text-align: center; font-size: 1.2rem; }

.options { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 20px; }
.option-btn {
  min-width: 96px; padding: 24px; font-size: 2rem; font-weight: 800; border: none;
  border-radius: 20px; background: var(--yellow); color: var(--ink);
  box-shadow: 0 5px 0 rgba(0,0,0,.12); cursor: pointer;
}
.option-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.option-btn.right { background: var(--green); color: #fff; }
.option-btn.wrong { background: #e57373; color: #fff; }
.feedback { text-align: center; font-size: 1.5rem; min-height: 2rem; margin-top: 16px; }

/* 拼音认读卡片 */
.pinyin-group { margin: 20px 0; }
.pinyin-group h3 { text-align: center; font-size: 1.3rem; }
.card-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.pinyin-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 84px; padding: 14px 8px; border: none; border-radius: 18px;
  background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.1); cursor: pointer;
}
.pinyin-card .py { font-size: 1.8rem; font-weight: 800; color: var(--orange); }
.pinyin-card .zi { font-size: 1.6rem; }
.pinyin-card.tapped { transform: scale(1.08); background: var(--yellow); }

/* 结算 */
.result { text-align: center; margin-top: 32px; }
.result .big { font-size: 5rem; }
.primary-btn {
  margin-top: 16px; padding: 18px 28px; font-size: 1.3rem; font-weight: 700;
  border: none; border-radius: 20px; background: var(--orange); color: #fff;
  box-shadow: 0 5px 0 rgba(0,0,0,.12); cursor: pointer;
}

/* ---------- 首页装饰与通用动画 ---------- */
.home-header { position: relative; }
.gear { position: absolute; right: 0; top: 0; font-size: 1.8rem; text-decoration: none; }
.mascot { font-size: 4rem; animation: float 2.4s ease-in-out infinite; }
.menu { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.menu-card.counting { background: #ffb703; }
.menu-card.shapes { background: #06d6a0; }
.menu-card.memory { background: #b388eb; }
.menu-card.shapes-fun { background: #4ecdc4; }
.menu-card.coloring { background: #ff6b6b; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pop-in { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
.pop-in { animation: pop-in .3s ease-out; }
.shake { animation: shake .4s; }
.bounce { animation: bounce 1s infinite; }
/* ---------- 测验徽标 / 形状 / 数一数 ---------- */
.badge { width: fit-content; margin: 8px auto; padding: 6px 16px;
  background: var(--yellow); border-radius: 999px; font-weight: 700; }
.prompt { text-align: center; }
.instruction { font-size: 1.8rem; font-weight: 800; margin: 16px 0; }
.shape-svg { width: 88px; height: 88px; }
.count-stage { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  max-width: 460px; margin: 12px auto; min-height: 120px; align-items: center; }
.count-item { font-size: 2.4rem; animation: pop-in .3s ease-out; }
/* ---------- 记忆配对 ---------- */
.memory-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  max-width: 460px; margin: 16px auto; }
.mem-card { height: 86px; border: none; border-radius: 16px; background: var(--blue);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.mem-back { color: #fff; font-size: 2rem; font-weight: 800; }
.mem-front { display: none; }
.mem-card.open, .mem-card.done { background: #fff; }
.mem-card.open .mem-back, .mem-card.done .mem-back { display: none; }
.mem-card.open .mem-front, .mem-card.done .mem-front { display: inline-flex; }
.mem-card.open { animation: pop-in .25s; }
.mem-card.done { opacity: .55; }
.mem-digit { font-size: 2.4rem; font-weight: 800; color: var(--ink); }
.mem-dots { font-size: 1rem; color: var(--orange); max-width: 70px;
  text-align: center; line-height: 1.1; word-break: break-all; }

/* ---------- 设置页 ---------- */
.settings { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.field select, .field input[type=range], .field textarea {
  font-size: 1rem; padding: 10px; border-radius: 12px; border: 2px solid var(--yellow);
  font-family: inherit; }
.settings-actions { display: flex; gap: 12px; justify-content: center; }

/* ---------- 庆祝动画 ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 9999; }
.confetti-piece { position: absolute; top: 16%; font-size: 1.8rem;
  animation: confetti-fall 1.1s ease-out forwards; }
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* ---------- 涂色书 ---------- */
.coloring-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.coloring-templates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.coloring-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 12px;
  border: 3px solid transparent; cursor: pointer; flex: 0 0 auto; }
.coloring-thumb.active { border-color: var(--orange); }
.coloring-palette { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(0,0,0,.15);
  cursor: pointer; padding: 0; }
.color-swatch.active { border-color: var(--ink); transform: scale(1.15); }
.coloring-tools { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tool-btn { font-size: 1.4rem; padding: 8px 12px; border: none; border-radius: 14px;
  background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.12); cursor: pointer; }
.tool-btn.active { background: var(--yellow); }
.coloring-tools input[type=range] { width: 110px; }
.coloring-stage { position: relative; width: 100%; background: #fff; border-radius: 16px;
  overflow: hidden; box-shadow: 0 4px 0 rgba(0,0,0,.1); touch-action: none; }
.coloring-stage canvas { display: block; }
.coloring-stage #draw { position: absolute; inset: 0; }

/* ---------- 形状乐园：拖拽通用 ---------- */
.shapes-fun-menu .menu-card { border: none; cursor: pointer; font-family: inherit; }
.dragging { opacity: .85; z-index: 50; filter: drop-shadow(0 6px 6px rgba(0,0,0,.3)); }
.fun-back { border: none; cursor: pointer; font-family: inherit; font-size: 1rem; }

/* 树叶分类 */
.leaf-field { position: relative; height: 320px; background: #e8f5e9; border-radius: 20px;
  overflow: hidden; margin-bottom: 14px; }
.leaf-piece { position: absolute; width: 64px; height: 64px; cursor: grab; }
.leaf-piece svg { width: 100%; height: 100%; pointer-events: none; }
.leaf-baskets { display: flex; gap: 10px; justify-content: center; }
.leaf-basket { width: 72px; height: 72px; border: 6px solid; border-radius: 16px;
  background: #fff; display: flex; align-items: flex-end; justify-content: center;
  font-size: .85rem; font-weight: 700; padding-bottom: 2px; }

/* 形状拼图 */
.puzzle-wrap { position: relative; }
.puzzle-target { position: relative; height: 340px; background: #fff; border-radius: 20px;
  box-shadow: inset 0 0 0 4px var(--yellow); margin-bottom: 14px; }
.puzzle-slot { position: absolute; opacity: .55; }
.puzzle-slot.filled { opacity: 1; }
.puzzle-slot svg { width: 100%; height: 100%; display: block; }
.puzzle-bin { position: relative; height: 110px; background: var(--cream); border-radius: 16px; }
.puzzle-piece { position: absolute; cursor: grab; }
.puzzle-piece svg { width: 100%; height: auto; display: block; pointer-events: none; }

/* 混色实验 */
.mixing-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0; }
.paint-blob { width: 64px; height: 64px; border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  border: 3px solid rgba(0,0,0,.15); margin: 0 auto; }
.math-symbol { font-size: 2rem; font-weight: 800; }
.question-mark-box { width: 64px; height: 64px; border: 4px dashed var(--orange); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; }

/* 涂色书专注模式：固定铺满屏幕，禁止页面滚动（手机涂鸦防误拖页面） */
body.no-scroll { overflow: hidden; }
.coloring-focus { position: fixed; inset: 0; z-index: 100; background: var(--cream);
  overflow: auto; padding: 12px; }
.coloring-focus .screen-title { display: none; }
.coloring-focus .coloring-templates { display: none; } /* 专注时隐藏模板条，把空间留给画板 */
.coloring-focus .coloring-stage { box-shadow: none; }
