:root {
  --ink: #3d2b3a;
  --ink-2: #7a6574;
  --pink: #ff7aa2;
  --pink-2: #ffe3ec;
  --go: #2fbf71;
  --go-dark: #1f9d5a;
  --sky: #dff0ff;
  --sun: #ffd166;
  --card: #ffffff;
  --line: #f1dbe6;
  --radius: 28px;
  --shadow: 0 6px 0 rgba(61, 43, 58, .08), 0 12px 28px rgba(61, 43, 58, .10);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Hiragino Maru Gothic ProN", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fff4ea; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
input { -webkit-user-select: text; user-select: text; }

#app {
  height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.home-bg { background: linear-gradient(180deg, #dff0ff 0%, #fff1f6 55%, #fff4ea 100%); }
.lesson-bg { background: linear-gradient(180deg, #fff1f6 0%, #fff8ee 100%); }
.book-bg { background: linear-gradient(180deg, #fff6d9 0%, #fff1f6 100%); }
.parent-bg { background: #f6f3f5; }

/* ───── 顶栏 ───── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; min-height: 76px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: .5px; color: var(--pink); }
.pill { background: #fff; border-radius: 99px; padding: 10px 18px; font-size: 20px; box-shadow: var(--shadow); white-space: nowrap; }
.x { width: 56px; height: 56px; border-radius: 50%; background: #fff; font-size: 24px; box-shadow: var(--shadow); flex: none; }
.gear { position: relative; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.6); font-size: 24px; flex: none; }
.gear i { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--pink); clip-path: inset(0 100% 0 0); }
.gear.holding i { transition: clip-path 1.2s linear; clip-path: inset(0 0 0 0); }
.steps { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.steps span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: #fff; opacity: .45; transition: .3s; }
.steps span.done { opacity: .85; background: #e3f8ec; }
.steps span.now { opacity: 1; transform: scale(1.18); box-shadow: 0 0 0 4px var(--pink); }

/* ───── 按钮 ───── */
.btn { border-radius: 999px; padding: 18px 34px; font-size: 26px; font-weight: 700; box-shadow: var(--shadow); transition: transform .1s; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn:active { transform: translateY(3px) scale(.98); }
.btn.go { background: var(--go); color: #fff; box-shadow: 0 6px 0 var(--go-dark), 0 12px 24px rgba(47,191,113,.3); }
.btn.soft { background: #fff; }
.btn.big { font-size: 32px; padding: 24px 48px; flex-direction: column; gap: 2px; min-width: 340px; }
.btn.big .day { font-size: 18px; opacity: .85; font-weight: 600; }
.btn.small { font-size: 17px; padding: 10px 18px; }
.btn.danger { background: #ffe4e4; color: #c0392b; }
.btn.next { font-size: 40px; width: 96px; height: 96px; padding: 0; }
.row { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; }

/* ───── 首页 ───── */
.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 10px 20px 30px; }
.stage-bunny { width: min(40vh, 70vw); max-width: 360px; cursor: pointer; }
.stage-bunny.big { width: min(44vh, 60vw); }
.stage-bunny svg { width: 100%; height: auto; display: block; overflow: visible; }
.bubble { background: #fff; border-radius: 24px; padding: 14px 24px; font-size: 22px; box-shadow: var(--shadow); position: relative; text-align: center; max-width: 90vw; }
.bubble::before { content: ""; position: absolute; top: -12px; left: 50%; margin-left: -12px; border: 12px solid transparent; border-top: 0; border-bottom-color: #fff; }
.home-actions { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.boing { animation: boing .5s; }
@keyframes boing { 30% { transform: scale(1.08, .92); } 60% { transform: scale(.95, 1.06); } }

/* ───── 小兔 ───── */
.bunny .shadow { fill: rgba(61,43,58,.10); }
.bunny .head-g { animation: bob 2.6s ease-in-out infinite; transform-origin: 100px 180px; }
.bunny .ear { transform-box: fill-box; transform-origin: 50% 90%; }
.bunny .ear-l { animation: earL 4s ease-in-out infinite; }
.bunny .ear-r { animation: earR 4s ease-in-out infinite .3s; }
.bunny .eyes-open { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
.bunny .eyes-closed, .bunny .eyes-happy, .bunny .mouth-open, .bunny .zz, .bunny .crack { display: none; }
.bunny.sleep .eyes-open, .bunny.happy .eyes-open { display: none; }
.bunny.sleep .eyes-closed, .bunny.sleep .zz { display: inline; }
.bunny.sleep .head-g { animation: breathe 3.2s ease-in-out infinite; }
.bunny.happy .eyes-happy { display: inline; }
.bunny.talk .mouth-open { display: inline; transform-box: fill-box; transform-origin: center top; animation: talk .22s ease-in-out infinite alternate; }
.bunny.talk .mouth { display: none; }
.bunny .zz text { font: 800 24px ui-rounded, system-ui; fill: #9aa7ff; animation: zz 2.4s ease-in-out infinite; }
.bunny .zz text:nth-child(2) { animation-delay: .8s; font-size: 30px; }
.bunny.egg .egg-body { transform-box: fill-box; transform-origin: 50% 100%; animation: wobble 2.8s ease-in-out infinite; }
.bunny.egg.cracking .crack { display: inline; }
.bunny.egg.cracking .egg-body { animation: shakeFast .12s infinite; }
.shake .bunny .head-g, .shake .bunny.egg .egg-body { animation: shakeFast .15s infinite; }
.hatch { animation: hatch .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes earL { 0%, 70%, 100% { transform: rotate(-10deg); } 80% { transform: rotate(-22deg); } }
@keyframes earR { 0%, 70%, 100% { transform: rotate(10deg); } 85% { transform: rotate(24deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes breathe { 50% { transform: translateY(3px) scale(1.01, .99); } }
@keyframes talk { from { transform: scaleY(.3); } to { transform: scaleY(1); } }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 8px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -12px); } }
@keyframes wobble { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-6deg); } 80% { transform: rotate(5deg); } 90% { transform: rotate(-3deg); } }
@keyframes shakeFast { 0% { transform: translateX(-3px) rotate(-2deg); } 100% { transform: translateX(3px) rotate(2deg); } }
@keyframes hatch { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ───── 课程舞台 ───── */
.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 24px 80px; min-height: 0; overflow-y: auto; }
.stage > div { margin: auto 0; }
.stage > div { width: 100%; max-width: 1000px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; transition: transform .15s; }
.card:active { transform: scale(.97); }
.card b { font-size: 30px; }
.card small { font-size: 18px; color: var(--ink-2); }
.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.emo { font-size: 96px; line-height: 1.1; }
.blob { width: 110px; height: 110px; border-radius: 46% 54% 50% 50% / 55% 45% 55% 45%; background: var(--c); box-shadow: inset -8px -10px 0 rgba(0,0,0,.08); }
.blob.light { border: 4px solid #e6e1e4; }
.num { display: flex; flex-direction: column; align-items: center; }
.num b { font-size: 96px !important; line-height: 1; color: var(--pink); }
.num span { font-size: 16px; letter-spacing: 3px; color: #ffb3c9; max-width: 150px; text-align: center; word-break: break-all; }

.grid { display: grid; gap: 20px; width: 100%; }
.grid.g2, .grid.g4 { grid-template-columns: repeat(2, 1fr); max-width: 620px; }
.grid.g3, .grid.g6, .grid.g5 { grid-template-columns: repeat(3, 1fr); }
.grid .item { min-height: 180px; }
.item.lit { transform: scale(1.08); box-shadow: 0 0 0 6px var(--sun), var(--shadow); }
.item.right { box-shadow: 0 0 0 6px var(--go), var(--shadow); transform: scale(1.06); }
.item.wrong { animation: no .4s; }
.item.glow { animation: glow 1s infinite; }
@keyframes no { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 8px var(--sun), var(--shadow); } }

.say-line { font-size: 30px; font-weight: 800; background: #fff; border-radius: 99px; padding: 12px 28px; box-shadow: var(--shadow); }
.meter { width: min(420px, 80vw); height: 22px; background: #fff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.08); }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sun), var(--pink)); border-radius: 99px; transition: width .08s; }
.meter[hidden] { display: none; }

/* 新词 + 气球 */
.words { position: relative; }
.word-card { width: min(340px, 70vw); min-height: 280px; }
.word-card .emo { font-size: 140px; }
.word-card .blob { width: 160px; height: 160px; }
.word-card b { font-size: 44px; }
.balloon-zone { height: 170px; display: flex; align-items: flex-end; justify-content: center; }
.balloon { --s: .55; width: 110px; height: 136px; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.7) 0 10%, transparent 11%), var(--c); border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%; transform: scale(var(--s)); transform-origin: 50% 100%; transition: transform .1s; position: relative; }
.balloon i { position: absolute; left: 50%; bottom: -26px; width: 2px; height: 26px; background: #b9a6b3; }
.balloon.popped { animation: popped .35s forwards; }
.balloon.away { animation: away 1.4s ease-in forwards; }
@keyframes popped { 50% { transform: scale(1.5); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes away { to { transform: translateY(-60vh) scale(.6) rotate(10deg); opacity: 0; } }
.count { font-size: 18px; color: var(--ink-2); }

/* 游戏 */
.listen { width: 96px; height: 96px; font-size: 44px; padding: 0; }

/* 故事 */
.scene { background: #fff; border-radius: 40px; box-shadow: var(--shadow); width: min(620px, 86vw); height: min(40vh, 340px); position: relative; display: grid; place-items: center; }
.scene .emo { font-size: min(18vh, 150px); letter-spacing: -6px; text-align: center; max-width: 90%; word-break: break-all; }
.scene .mini { position: absolute; right: 12px; bottom: 6px; width: 96px; }
.scene .mini svg { width: 100%; height: auto; }
.line { font-size: 36px; font-weight: 800; text-align: center; margin: 0; max-width: 860px; line-height: 1.3; }
.line.reading { color: var(--pink); }
.zh { margin: -10px 0 0; font-size: 20px; color: var(--ink-2); }

/* 教小兔 */
.teach { flex-direction: row !important; justify-content: center; gap: 40px !important; flex-wrap: wrap; }
.teach .stage-bunny { width: min(38vh, 42vw); }
.board { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.board .item { width: min(280px, 40vw); min-height: 240px; }
.board .item .emo { font-size: 130px; }
.board .item .blob { width: 150px; height: 150px; }

/* 晚安 + 贴纸 */
.sleep-step { gap: 14px !important; }
.sleep-step .stage-bunny { transition: width .5s; }
.sleep-step.rewarded .stage-bunny { width: min(22vh, 30vw); }
.sleep-step.rewarded .sticker-big { font-size: 90px; }
.gift { font-size: 120px; animation: giftBounce 1s infinite; }
@keyframes giftBounce { 50% { transform: translateY(-14px) rotate(-5deg); } }
.gift[hidden] { display: none; }
.reward { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sticker-big { font-size: 110px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.15)); }
.grew { font-size: 24px; font-weight: 800; color: var(--pink); margin: 0; }
.parent-tip { background: #fff; border-radius: 22px; padding: 14px 22px; box-shadow: var(--shadow); max-width: 640px; }
.parent-tip b { font-size: 16px; color: var(--ink-2); }
.parent-tip p { margin: 6px 0; font-size: 24px; font-weight: 800; }
.parent-tip small { font-size: 17px; color: var(--ink-2); line-height: 1.5; }
.say-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--pink-2); font-size: 18px; vertical-align: middle; }

/* 中文提示条 */
.hint { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: rgba(61,43,58,.88); color: #fff; font-size: 22px; padding: 12px 24px; border-radius: 99px; opacity: 0; transition: .3s; pointer-events: none; max-width: 92vw; text-align: center; }
.hint.show { opacity: 1; transform: translate(-50%, 0); }

/* 贴纸本 */
.book { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 10px 24px 30px; align-content: center; max-width: 900px; margin: 0 auto; width: 100%; }
.slot { aspect-ratio: 1; border-radius: 22px; background: rgba(255,255,255,.55); border: 3px dashed #eed3de; font-size: 52px; display: grid; place-items: center; }
.slot small { font-size: 20px; color: #d9bccb; }
.slot.got { background: #fff; border: 0; box-shadow: var(--shadow); }
.overlay { position: fixed; inset: 0; background: rgba(61,43,58,.35); display: grid; place-items: center; z-index: 10; }
.overlay .card { padding: 30px 40px; gap: 14px; }
.overlay p { text-align: center; font-size: 24px; margin: 0; }

/* 家长页 */
.parent { flex: 1; overflow-y: auto; padding: 0 20px 40px; max-width: 760px; margin: 0 auto; width: 100%; -webkit-overflow-scrolling: touch; }
.parent section { background: #fff; border-radius: 20px; padding: 18px 22px; margin-bottom: 16px; }
.parent h3 { margin: 0 0 10px; font-size: 20px; }
.parent p { margin: 8px 0; font-size: 17px; }
.parent .note { color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.parent label { display: block; font-size: 16px; margin: 10px 0; color: var(--ink-2); }
.parent input:not([type]) { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 20px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); color: var(--ink); }
.parent label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); }
.parent label.check input { width: 24px; height: 24px; }
.days { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 10px 0; }
.days span { aspect-ratio: 1; border-radius: 10px; background: #f3eef1; display: grid; place-items: center; font-size: 14px; color: #b7a7b1; }
.days span.on { background: var(--go); color: #fff; }
.seg { display: inline-flex; background: #f3eef1; border-radius: 12px; padding: 4px; }
.seg button { padding: 10px 18px; border-radius: 9px; font-size: 17px; }
.seg button.on { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.1); font-weight: 700; }
.recs { list-style: none; padding: 0; margin: 10px 0 0; }
.recs li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f3eef1; font-size: 17px; }
.recs small { color: var(--ink-2); margin-left: auto; }

/* 彩纸 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.confetti span { position: absolute; font-size: 30px; animation: burst 1.2s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 80px)) rotate(var(--r)) scale(1); opacity: 0; } }

/* 竖屏 iPad / 手机 */
@media (max-aspect-ratio: 1/1) {
  .teach { flex-direction: column !important; gap: 10px !important; }
  .teach .stage-bunny { width: min(30vh, 60vw); }
}
@media (max-width: 600px) {
  .brand { font-size: 20px; }
  .btn.big { min-width: 0; width: 100%; font-size: 26px; }
  .emo { font-size: 64px; }
  .grid .item { min-height: 130px; }
  .grid { gap: 12px; }
  .line { font-size: 26px; }
  .book { grid-template-columns: repeat(5, 1fr); }
  .steps span { width: 34px; height: 34px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; } }

/* ───── 多邻国式反馈 ───── */
/* 顶部进度条 */
.progress { height: 14px; margin: 0 24px 4px; background: rgba(255,255,255,.8); border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 3px rgba(0,0,0,.06); }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #58cc02, #89e219); transition: width .6s cubic-bezier(.3, 1.3, .5, 1); position: relative; }
.progress i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 99px; background: rgba(255,255,255,.45); }

/* 底部反馈横幅：绿=答对 金=说得准 暖黄=差一点（不用红色） */
.fb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 16px;
  padding: 20px 32px calc(22px + env(safe-area-inset-bottom)); transform: translateY(110%); transition: transform .28s cubic-bezier(.3, 1.3, .5, 1);
  border-radius: 26px 26px 0 0; pointer-events: none; }
.fb.show { transform: translateY(0); }
.fb b { display: block; font-size: 30px; font-weight: 800; }
.fb small { display: block; font-size: 20px; margin-top: 2px; }
.fb-icon { width: 58px; height: 58px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 30px; flex: none; }
.fb.good { background: #d7ffb8; color: #3f8a0a; }
.fb.perfect { background: linear-gradient(90deg, #fff1b8, #ffe17a); color: #a36a00; }
.fb.perfect .fb-icon { animation: spin .8s ease-out; }
.fb.try { background: #fff4d6; color: #b7791f; }
.fb.combo { background: linear-gradient(90deg, #ffd6a5, #ffb3c7); color: #c2410c; }
.fb.combo .fb-icon { animation: flame .5s ease-in-out infinite alternate; }
@keyframes spin { from { transform: rotate(-180deg) scale(.3); } to { transform: rotate(0) scale(1); } }
@keyframes flame { to { transform: scale(1.15) rotate(6deg); } }

/* 课程结束的成绩 */
.stats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.stats span { background: #fff; border-radius: 99px; padding: 8px 18px; font-size: 19px; box-shadow: var(--shadow); }
.stats b { color: var(--pink); font-size: 22px; }

/* 家长页：语音选择 */
.voices { list-style: none; padding: 0; margin: 6px 0 10px; max-height: 280px; overflow-y: auto; }
.voices li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; }
.voices li.on { background: #e9f9ef; }
.voices .vname { flex: 1; text-align: left; font-size: 18px; padding: 8px 4px; }
.voices .vname small { font-size: 13px; color: #fff; background: var(--go); border-radius: 99px; padding: 2px 8px; margin-left: 6px; }
