:root {
  --red: #c62828; --red2: #e53935; --gold: #f4b942; --gold2: #ffd54f; --ink: #2b1b10; --paper: #fffaf0; --cream: #fdf3dc;
  --jade: #2e8b73; --night: #1b2346; --shadow: 0 6px 0 rgba(90, 20, 10, .15), 0 14px 30px rgba(90, 20, 10, .18);
  --zhfont: 'KaiTi', 'STKaiti', 'Kaiti SC', 'Noto Serif SC', 'SimSun', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Fredoka', 'Trebuchet MS', sans-serif; color: var(--ink); min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, #fff1d6 0%, #ffd9a8 35%, #f5a46c 75%, #d9603b 100%) fixed;
}
button { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.zh { font-family: var(--zhfont); font-weight: 700; }
.py, .gp-btn small, .zh-chip small { font-family: 'Segoe UI', 'Noto Sans', Arial, sans-serif; font-weight: 600; color: #8a5a2b; }
.muted { opacity: .7; }
#app { position: relative; z-index: 1; min-height: 100vh; }
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-deco span { position: absolute; top: -60px; opacity: .28; animation: drift linear infinite; }
@keyframes drift { to { transform: translateY(115vh) rotate(260deg); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 19px; border: none; border-radius: 16px; padding: 11px 22px; background: var(--red); color: #fff; box-shadow: 0 5px 0 #7f1414; cursor: pointer; transition: transform .08s, filter .15s; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #7f1414; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.big { font-size: 25px; padding: 15px 32px; border-radius: 20px; }
.btn.small { font-size: 16px; padding: 8px 14px; border-radius: 13px; box-shadow: 0 4px 0 #7f1414; }
.btn.green { background: var(--jade); box-shadow: 0 5px 0 #145243; }
.btn.small.green { box-shadow: 0 4px 0 #145243; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .15); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(255, 250, 240, .82); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.tb-title { flex: 1; font-weight: 700; font-size: 20px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-btn { min-width: 42px; height: 42px; border-radius: 21px; border: none; background: #fff; font-size: 19px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; }
.tb-btn.off { opacity: .4; text-decoration: line-through; }

/* home */
.home { max-width: 1120px; margin: 0 auto; padding: 10px 16px 40px; }
.hero { text-align: center; padding: 14px 0 4px; }
.hero-art { position: relative; width: 170px; height: 170px; margin: 0 auto; }
.hero-moon { width: 170px; filter: drop-shadow(0 0 30px rgba(255, 236, 160, .9)); animation: bob 4s ease-in-out infinite; }
.hero-rabbit { position: absolute; right: -16px; bottom: 0; font-size: 64px; animation: hop 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-22px) rotate(-8deg); } 60% { transform: translateY(0); } }
.hero h1 { font-size: clamp(34px, 6.4vw, 62px); margin: 4px 0 0; color: #fff; -webkit-text-stroke: 2px #7f1414; text-shadow: 0 4px 0 #7f1414, 0 10px 22px rgba(90, 20, 10, .35); line-height: 1.05; }
.hero h1 span { color: var(--gold2); }
.hero-zh { display: inline-flex; align-items: baseline; gap: 10px; margin-top: 8px; background: var(--red); color: var(--gold2); padding: 6px 18px; border-radius: 14px; cursor: pointer; box-shadow: 0 4px 0 #7f1414; }
.hero-zh .zh { font-size: 30px; letter-spacing: 4px; }
.hero-zh .py { color: #ffe9b0; }
.hero-zh i { color: #fff; font-size: 14px; }
.sub { font-size: 18px; font-weight: 500; max-width: 760px; margin: 12px auto; line-height: 1.4; }
.rooms { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; margin-top: 14px; }
.room { display: block; background: var(--paper); border-radius: 26px; padding: 20px; box-shadow: var(--shadow); border: 5px solid #fff; transition: transform .15s; position: relative; overflow: hidden; }
.room:hover { transform: translateY(-4px) rotate(-.4deg); }
.room::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 10px; background: var(--rc); }
.r-little { --rc: #ff8a65; } .r-harvest { --rc: #43a047; } .r-gobble { --rc: #5c6bc0; }
.room-e { font-size: 58px; }
.room-name { font-size: 28px; font-weight: 700; color: var(--rc); }
.room-age { font-weight: 700; opacity: .65; }
.room p { margin: 8px 0 12px; line-height: 1.35; }
.room-prog { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 12px; background: #eee3cf; border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--rc); border-radius: 8px; }
.room-stickers { margin-top: 10px; font-size: 24px; letter-spacing: 3px; }
.room-stickers span { filter: grayscale(1); opacity: .3; }
.room-stickers span.got { filter: none; opacity: 1; }
.home-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* track page */
.track-page { max-width: 900px; margin: 0 auto; padding: 14px 16px 40px; }
.track-head { display: flex; gap: 16px; align-items: center; background: var(--paper); border-radius: 22px; padding: 14px 20px; box-shadow: var(--shadow); }
.th-e { font-size: 60px; }
.track-head h2 { margin: 0; font-size: 30px; }
.track-head p { margin: 4px 0 0; }
.path { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.lcard { display: flex; align-items: center; gap: 14px; background: var(--paper); border-radius: 22px; padding: 12px 16px; box-shadow: var(--shadow); border-left: 10px solid var(--rc); transition: transform .12s; }
.lcard:nth-child(even) { margin-left: 34px; } .lcard:nth-child(odd) { margin-right: 34px; }
.lcard:hover { transform: translateX(4px) scale(1.01); }
.lc-num { width: 40px; height: 40px; border-radius: 50%; background: var(--rc); color: #fff; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; flex: none; }
.lc-e { font-size: 44px; flex: none; }
.lc-body { flex: 1; min-width: 0; }
.lc-title { font-size: 22px; font-weight: 700; }
.lc-zh { color: var(--red); font-size: 18px; }
.lc-blurb { font-size: 15px; opacity: .85; }
.lc-meta { font-size: 13px; opacity: .6; margin-top: 2px; }
.lc-sticker { font-size: 38px; text-align: center; flex: none; width: 64px; filter: grayscale(1); opacity: .45; }
.lc-sticker.got { filter: none; opacity: 1; animation: bob 3s ease-in-out infinite; }
.lc-sticker small { display: block; font-size: 12px; }

/* lesson */
.lesson { max-width: 1100px; margin: 0 auto; padding: 8px 12px 30px; }
.steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 4px 0 10px; }
.step { background: rgba(255, 255, 255, .55); border-radius: 14px; padding: 4px 10px; display: flex; align-items: center; gap: 5px; font-size: 18px; opacity: .6; }
.step small { font-size: 12px; font-weight: 600; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.on { background: #fff; opacity: 1; box-shadow: 0 3px 0 var(--rc); transform: scale(1.06); }
.step.past { opacity: .95; background: #fff3d6; }
.step.past span::after { content: '✔'; font-size: 11px; color: var(--jade); margin-left: 2px; }

/* movie */
.movie { position: relative; }
.stage-wrap { width: min(100%, calc((100vh - 300px) * 16 / 9)); min-width: min(100%, 320px); margin: 0 auto; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; container-type: inline-size; box-shadow: var(--shadow); border: 5px solid #fff; }
.bg-night { background: linear-gradient(180deg, #0d1333 0%, #1b2a5c 60%, #34407a 100%); }
.bg-space { background: radial-gradient(circle at 70% 30%, #1d2550 0%, #05070f 70%); }
.bg-dusk { background: linear-gradient(180deg, #2a2050 0%, #6b3f7a 45%, #f08a5d 100%); }
.bg-day { background: linear-gradient(180deg, #8fd3ff 0%, #c9ecff 60%, #e9f8d9 100%); }
.bg-heaven { background: linear-gradient(180deg, #ffe7b0 0%, #ffd27a 50%, #f7b267 100%); }
.bg-spring { background: linear-gradient(180deg, #ffd6e7 0%, #fff1c9 55%, #c8ecb5 100%); }
.bg-festive { background: radial-gradient(circle at 50% 40%, #e53935 0%, #b71c1c 65%, #7f1414 100%); }
.bg-paper { background: linear-gradient(180deg, #fffaf0, #fbefd5); }
.bg-scroll { background: repeating-linear-gradient(90deg, #f4e4bf 0 2px, #f8ebcc 2px 9px), #f6e7c4; }
.bg-class { background: linear-gradient(180deg, #2f5d50 0 78%, #8b5a2b 78% 100%); }
.decor { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.d-cloud { position: absolute; animation: cloudDrift linear infinite alternate; opacity: .95; }
.d-cloud.low { animation: none; opacity: 1; }
@keyframes cloudDrift { to { transform: translateX(14cqw); } }
.d-mountains { position: absolute; left: 0; right: 0; bottom: 0; height: 32%; }
.d-mountains svg, .d-river svg { width: 100%; height: 100%; display: block; }
.d-river { position: absolute; left: 0; right: 0; bottom: 8%; height: 26%; }
.d-pattern { position: absolute; inset: 0; opacity: .14; background-image: radial-gradient(circle, #ffd54f 2px, transparent 3px); background-size: 34px 34px; }
.d-lantern { position: absolute; top: -2%; width: 6%; animation: sway 3s ease-in-out infinite; transform-origin: top center; }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.it { position: absolute; transform: translate(-50%, -50%) var(--tf,); opacity: 0; transition: opacity .5s; line-height: 1; text-align: center; }
.it.show { opacity: 1; }
.it.gone { opacity: 0 !important; transition: opacity .6s; }
.it-svg svg { width: 100%; height: auto; display: block; }
.it-zh { background: #fffaf0; border: .35cqw solid var(--red); border-radius: 1.4cqw; padding: .6cqw 1.4cqw; box-shadow: 0 .6cqw 0 rgba(127, 20, 20, .3); display: flex; flex-direction: column; align-items: center; gap: .3em; }
.it-zh.plain { background: none; border: none; box-shadow: none; color: #fff; text-shadow: 0 .3cqw 0 rgba(0, 0, 0, .35); }
.it-zh .zh { line-height: 1; }
.it-zh .py { font-size: .3em; }
.it-zh.plain .py { color: #ffe9a8; }
.it-zh i { font-size: .24em; font-style: normal; font-weight: 600; }
.it-text { font-weight: 700; background: rgba(255, 255, 255, .88); padding: .5cqw 1.2cqw; border-radius: 1.2cqw; white-space: nowrap; box-shadow: 0 .4cqw 0 rgba(0, 0, 0, .12); }
.it-text.plain { background: none; box-shadow: none; color: #fff; text-shadow: 0 .25cqw 0 rgba(0, 0, 0, .45); }
.it-label { font-size: max(11px, 1.6cqw); font-weight: 700; background: rgba(255, 255, 255, .9); border-radius: 1cqw; padding: .2cqw .8cqw; margin: .4cqw auto 0; white-space: nowrap; display: block; width: max-content; color: var(--ink); }
.title-card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1cqw; font-size: 6cqw; font-weight: 700; color: #fff; text-shadow: 0 .5cqw 0 #7f1414; text-align: center; padding: 0 6cqw; animation: titleIn 1s ease-out both; z-index: 5; }
.title-card .zh { font-size: 9cqw; color: var(--gold2); }
@keyframes titleIn { from { opacity: 0; transform: scale(.8); } }

/* item animations */
.a-pop.show { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0) var(--tf,); } }
.a-grow.show { animation: grow 2.2s ease-out both; }
@keyframes grow { from { transform: translate(-50%, -50%) scale(.2) var(--tf,); } }
.a-float.show { animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translate(-50%, -62%) var(--tf,); } }
.a-hop.show { animation: hopit .8s ease-in-out infinite; }
@keyframes hopit { 50% { transform: translate(-50%, -75%) var(--tf,); } }
.a-swim.show { animation: swim 1.2s ease-in-out infinite; }
@keyframes swim { 0%, 100% { transform: translate(-50%, -50%) rotate(-6deg) var(--tf,); } 50% { transform: translate(-50%, -42%) rotate(6deg) var(--tf,); } }
.a-spin.show { animation: spin 8s linear infinite; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.a-spinOnce.show { animation: spin1 1.6s ease-in-out both; }
@keyframes spin1 { from { transform: translate(-50%, -50%) rotate(-200deg) scale(.4); } }
.a-pulse.show { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.12) var(--tf,); } }
.a-shake.show { animation: shakeit .5s ease-in-out 3; }
@keyframes shakeit { 25% { transform: translate(-56%, -50%) var(--tf,); } 75% { transform: translate(-44%, -50%) var(--tf,); } }
.a-glow.show { filter: drop-shadow(0 0 2.4cqw rgba(255, 230, 140, .95)); }
.a-sway.show { animation: swayit 2.6s ease-in-out infinite; }
@keyframes swayit { 0%, 100% { transform: translate(-50%, -50%) rotate(-6deg) var(--tf,); } 50% { transform: translate(-50%, -50%) rotate(6deg) var(--tf,); } }
.a-slideL.show { animation: slideL .9s ease-out both; }
@keyframes slideL { from { transform: translate(-250%, -50%) var(--tf,); } }
.a-slideR.show { animation: slideR .9s ease-out both; }
@keyframes slideR { from { transform: translate(150%, -50%) var(--tf,); } }
.a-slideU.show { animation: slideU .9s ease-out both; }
@keyframes slideU { from { transform: translate(-50%, 120%) var(--tf,); } }
.a-drop.show { animation: drop .9s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes drop { from { transform: translate(-50%, -300%) var(--tf,); } }
.a-firework.show { animation: firework 1.6s ease-out infinite; }
@keyframes firework { 0% { transform: translate(-50%, -50%) scale(.1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }
.a-wiggle.show { animation: wiggle 1s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: translate(-50%, -50%) rotate(-10deg) var(--tf,); } 50% { transform: translate(-50%, -50%) rotate(10deg) var(--tf,); } }

.caption { min-height: 64px; margin: 10px auto 0; max-width: 980px; background: rgba(255, 250, 240, .95); border-radius: 18px; padding: 10px 18px; font-size: clamp(17px, 2.1vw, 22px); font-weight: 600; text-align: center; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 rgba(0, 0, 0, .1); line-height: 1.3; }
.cap-zh { display: inline-flex; align-items: baseline; gap: 12px; }
.cap-zh .zh { font-size: 1.9em; color: var(--red); }
.cap-zh i { font-style: normal; opacity: .75; }
.mv-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mv-btn { height: 44px; min-width: 48px; border-radius: 22px; border: none; background: #fff; font-size: 20px; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); padding: 0 12px; font-weight: 700; }
.mv-btn.play { background: var(--red); color: #fff; min-width: 64px; }
.mv-btn.skip { font-size: 15px; }
.scene-dots { display: flex; gap: 5px; flex-wrap: wrap; max-width: 420px; justify-content: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; background: rgba(255, 255, 255, .45); cursor: pointer; padding: 0; }
.dot.seen { background: var(--gold); } .dot.on { background: var(--red); transform: scale(1.3); }
.movie-end { position: absolute; inset: 0 0 auto 0; aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 300px) * 16 / 9)); margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; background: rgba(43, 27, 16, .45); border-radius: 22px; z-index: 10; }

/* activities */
.act-title { text-align: center; font-size: 26px; font-weight: 700; margin: 6px 0 8px; color: #fff; text-shadow: 0 3px 0 #7f1414; }
.act { background: var(--paper); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); max-width: 980px; margin: 0 auto; border: 5px solid #fff; position: relative; }
.act-prompt { font-size: 23px; font-weight: 700; text-align: center; margin: 4px 0 14px; line-height: 1.3; }
.act-count { text-align: center; font-weight: 700; opacity: .5; }
.act-next { text-align: center; margin-top: 14px; }
.act-done { text-align: center; margin-top: 18px; padding-top: 14px; border-top: 3px dashed #eadbbd; font-size: 24px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stars { font-size: 36px; letter-spacing: 4px; }
.stars.big { font-size: 48px; }
.fact { display: none; background: #fff3c4; border-radius: 16px; padding: 12px 16px; font-size: 18px; margin-top: 14px; line-height: 1.4; border-left: 6px solid var(--gold); }
.fact.show { display: block; animation: titleIn .4s ease-out; }
.quiz-pic { display: flex; justify-content: center; gap: 16px; margin-bottom: 6px; }
.quiz-pic .val-svg { width: 160px; }
.quiz-pic .val-e { font-size: 90px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.choices.long { grid-template-columns: 1fr; }
.choice { background: #fff; border: 4px solid #eadbbd; border-radius: 20px; padding: 14px 10px; font-size: 21px; font-weight: 600; cursor: pointer; min-height: 84px; display: flex; align-items: center; justify-content: center; transition: transform .1s, border-color .15s; box-shadow: 0 4px 0 #eadbbd; }
.choice:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); }
.choice.right { border-color: #2e7d32; background: #e8f5e9; box-shadow: 0 4px 0 #2e7d32; animation: pop .4s; }
.choice.wrong { border-color: #c62828; background: #ffebee; opacity: .6; }
.val-e { font-size: 46px; line-height: 1; }
.val-e.big { font-size: 58px; }
.val-zh { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.val-zh .zh { font-size: 40px; line-height: 1.1; color: var(--ink); }
.val-zh .py { font-size: 15px; }
.val-zh i { font-size: 14px; font-style: normal; opacity: .75; }
.val-svg { display: inline-flex; flex-direction: column; align-items: center; width: 84px; }
.val-svg svg { width: 100%; height: auto; }
.val-t { font-size: inherit; }
.val-et { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.hint { animation: hintglow 1.4s ease-in-out; }
@keyframes hintglow { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 185, 66, 0); } 50% { box-shadow: 0 0 0 10px rgba(244, 185, 66, .9); } }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.mcard { background: #fff; border: 4px solid #eadbbd; border-radius: 18px; min-height: 76px; font-size: 20px; font-weight: 600; cursor: pointer; padding: 8px; display: flex; align-items: center; justify-content: center; }
.mcard.sel { border-color: var(--gold); background: #fff8dc; transform: scale(1.03); }
.mcard.done { border-color: #2e7d32; background: #e8f5e9; opacity: .75; cursor: default; }
.mcard .val-e { font-size: 40px; }

.order-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.slot { width: 92px; min-height: 92px; border: 3px dashed #d6c29a; border-radius: 16px; display: flex; align-items: center; justify-content: center; position: relative; background: #fffdf6; font-size: 15px; padding: 4px; text-align: center; }
.slot small { position: absolute; top: 2px; left: 6px; font-weight: 700; opacity: .45; }
.slot.filled { border-style: solid; border-color: #2e7d32; background: #e8f5e9; animation: pop .35s; }
.slot .val-e { font-size: 42px; } .slot .val-zh .zh { font-size: 30px; } .slot .val-svg { width: 70px; }
.order-pool { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ocard { width: 104px; min-height: 96px; background: #fff; border: 4px solid #eadbbd; border-radius: 18px; cursor: pointer; font-size: 16px; font-weight: 600; padding: 6px; box-shadow: 0 4px 0 #eadbbd; display: flex; align-items: center; justify-content: center; }
.ocard.gone { visibility: hidden; }
.ocard .val-svg { width: 76px; }

.flash { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.fcard { height: 190px; perspective: 800px; border: none; background: none; cursor: pointer; position: relative; padding: 0; }
.fcard > div { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; transition: transform .5s; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 4px solid #fff; box-shadow: 0 5px 0 rgba(127, 20, 20, .25); }
.f-front { background: var(--red); color: var(--gold2); }
.f-front .zh { font-size: 76px; }
.f-back { background: #fffaf0; transform: rotateY(180deg); padding: 6px; }
.f-back .zh { font-size: 34px; color: var(--red); }
.f-back i { font-style: normal; font-weight: 600; font-size: 15px; }
.f-back .val-svg { width: 64px; }
.fcard.flip .f-front { transform: rotateY(180deg); }
.fcard.flip .f-back { transform: rotateY(360deg); }

.trace { display: flex; gap: 20px; justify-content: center; align-items: center; flex-wrap: wrap; }
.trace-pad { width: 300px; max-width: 80vw; aspect-ratio: 1; position: relative; background: #fffaf0; border: 4px solid var(--red); border-radius: 12px; touch-action: none; background-image: linear-gradient(#f3c6c6 1px, transparent 1px), linear-gradient(90deg, #f3c6c6 1px, transparent 1px); background-size: 50% 50%; background-position: center; }
.trace-pad .hw, .trace-pad canvas, .trace-ghost { position: absolute; inset: 0; width: 100%; height: 100%; }
.trace-ghost svg { width: 100%; height: 100%; }
.trace-info { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 280px; text-align: center; }
.trace-info .zh.big { font-size: 90px; color: var(--red); line-height: 1; }
.trace-info .py { font-size: 22px; }
.trace-info i { font-style: normal; font-size: 20px; font-weight: 600; }
.trace-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

.moondial { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; background: linear-gradient(180deg, #0d1333, #2a3770); border-radius: 22px; padding: 18px; }
.md-moon { width: min(220px, 50vw); filter: drop-shadow(0 0 26px rgba(255, 236, 160, .7)); }
.md-name { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; cursor: pointer; min-width: 180px; }
.md-name .zh { font-size: 74px; color: var(--gold2); }
.md-name .py { color: #ffe9a8; font-size: 22px; }
.md-name i { font-style: normal; font-size: 17px; opacity: .85; }
.md-slider { width: 100%; margin: 16px 0 6px; accent-color: var(--red); height: 30px; }
.md-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

.cal-month { text-align: center; margin: -6px 0 10px; display: flex; gap: 10px; justify-content: center; align-items: baseline; }
.cal-month .zh { font-size: 30px; color: var(--red); }
.lunar-cal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.cal-day { background: #fff; border: 3px solid #eadbbd; border-radius: 14px; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cal-day .zh { font-size: 21px; }
.cal-day small { font-size: 12px; opacity: .55; }
.cal-moon { width: 34px; display: block; }
.cal-moon svg { width: 100%; display: block; }
.cal-day.right { border-color: #2e7d32; background: #e8f5e9; animation: pop .4s; }

.zwheel { position: relative; width: min(560px, 92vw); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle, #fdf3dc 0 36%, #c62828 36.5% 100%); box-shadow: var(--shadow); }
.zw-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; display: flex; flex-direction: column; }
.zw-center .zh { font-size: clamp(30px, 7vw, 46px); color: var(--red); }
.zw-animal { position: absolute; transform: translate(-50%, -50%); width: 17%; aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--gold); background: #fff8e1; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1; transition: transform .15s; }
.zw-animal:hover { transform: translate(-50%, -50%) scale(1.1); }
.zw-animal .e { font-size: clamp(22px, 4.6vw, 36px); }
.zw-animal .zh { font-size: clamp(13px, 2.6vw, 20px); color: var(--red); }
.zw-animal small { font-size: clamp(8px, 1.6vw, 11px); font-weight: 600; }
.zw-animal.right { background: #c8e6c9; border-color: #2e7d32; transform: translate(-50%, -50%) scale(1.18); }
.zw-animal.shake { animation: none; background: #ffcdd2; }

.race { position: relative; height: 420px; border-radius: 22px; overflow: hidden; background: linear-gradient(180deg, #8fd3ff 0 22%, #b5e08c 22% 36%, #3d8bd9 36% 66%, #b5e08c 66% 100%); }
.race-river { position: absolute; left: 0; right: 0; top: 33%; height: 8%; }
.race-river svg { width: 100%; height: 100%; display: block; }
.race-finish { position: absolute; right: 10px; top: 4px; font-size: 40px; }
.race-palace { position: absolute; right: 54px; top: 4px; width: 56px; }
.race-palace svg { width: 100%; }
.race-bank { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px; }
.race-animal { width: 76px; height: 76px; border-radius: 18px; border: 3px solid #fff; background: rgba(255, 255, 255, .75); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 36px; line-height: 1; transition: transform .6s ease-in; }
.race-animal small { font-size: 11px; font-weight: 700; }
.race-animal.crossing { transform: translateY(-260px) scale(.7); opacity: .2; transition: transform .65s ease-in, opacity .65s; }
.race-done { position: absolute; left: 0; right: 110px; top: 6px; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; }
.race-spot { background: #fff; border-radius: 14px; padding: 2px 6px; display: flex; align-items: center; gap: 2px; font-size: 26px; animation: pop .4s; }
.race-spot b { font-size: 14px; color: var(--red); }

.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 16px; }
.scard { background: #fff; border: 4px solid #eadbbd; border-radius: 16px; padding: 8px 12px; font-size: 18px; font-weight: 600; cursor: pointer; min-height: 60px; }
.scard.sel { border-color: var(--gold); background: #fff8dc; transform: scale(1.05); }
.scard .val-e { font-size: 34px; } .scard .val-zh .zh { font-size: 28px; } .scard .val-svg { width: 54px; }
.sort-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.sbin { background: #fdf3dc; border: 4px dashed var(--gold); border-radius: 20px; min-height: 160px; cursor: pointer; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; }
.sbin-head { display: flex; align-items: center; gap: 8px; }
.sbin-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.sb-item { background: #fff; border-radius: 12px; padding: 3px 8px; font-size: 15px; animation: pop .35s; }
.sb-item .val-e { font-size: 26px; } .sb-item .val-zh .zh { font-size: 22px; } .sb-item .val-svg { width: 40px; }

.gz { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; }
.gz-rings { width: min(340px, 80vw); }
.gz-rings svg { width: 100%; display: block; transition: transform .3s; }
.gz-read { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-width: 220px; }
.gz-year { font-size: 52px; font-weight: 700; color: var(--red); line-height: 1; }
.gz-read .zh { font-size: 70px; line-height: 1.1; }
.gz-read .py { font-size: 22px; }
.gz-desc { font-weight: 600; font-size: 17px; }
.gz-count { text-align: center; font-weight: 600; opacity: .7; margin-top: 8px; min-height: 20px; }

.gp-shown { text-align: center; }
.gp-shown .zh { font-size: 64px; color: var(--red); letter-spacing: 6px; }
.gp-label { font-weight: 700; margin: 12px 0 6px; text-align: center; }
.gp-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.gp-btn { width: 66px; padding: 6px 2px; border-radius: 14px; border: 3px solid var(--c, var(--gold)); background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.gp-btn .zh { font-size: 30px; }
.gp-btn small { font-size: 12px; color: #8a5a2b; }
.gp-btn i { font-style: normal; font-size: 13px; opacity: .7; }
.gp-btn.on { background: #fff3c4; transform: scale(1.1); box-shadow: 0 0 0 3px var(--red); }

.yf-form { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; font-size: 20px; font-weight: 600; }
.yf-year { font-size: 26px; width: 120px; padding: 6px 10px; border-radius: 12px; border: 3px solid var(--gold); font-family: inherit; text-align: center; }
.yf-sel { font-size: 19px; padding: 6px; border-radius: 10px; border: 3px solid var(--gold); font-family: inherit; margin-left: 4px; }
.yf-out { text-align: center; margin-top: 16px; min-height: 120px; }
.yf-animal { font-size: 110px; line-height: 1; animation: pop .5s; }
.yf-name { font-size: 30px; font-weight: 700; }
.yf-name .zh { font-size: 48px; color: var(--red); }
.yf-gz { font-size: 22px; font-weight: 600; margin-top: 4px; }
.yf-gz .zh { font-size: 34px; }
.yf-note { background: #fff3c4; border-radius: 14px; padding: 10px; max-width: 600px; margin: 10px auto 0; }

/* lesson end */
.lesson-end { background: var(--paper); border-radius: 28px; padding: 22px; box-shadow: var(--shadow); max-width: 820px; margin: 0 auto; text-align: center; border: 5px solid #fff; }
.le-sticker { font-size: 120px; line-height: 1; animation: pop .8s cubic-bezier(.3, 1.6, .5, 1), bob 3s 1s ease-in-out infinite; }
.lesson-end h2 { font-size: 36px; margin: 6px 0; color: var(--red); }
.recap { text-align: left; background: #fffdf6; border-radius: 18px; padding: 10px 18px; margin-top: 14px; border: 3px solid #f2e3c4; }
.recap h3 { margin: 6px 0; }
.recap li { margin: 6px 0; font-size: 18px; line-height: 1.35; }
.le-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.zh-chip { display: inline-flex; flex-direction: column; align-items: center; background: #fff; border: 3px solid #eadbbd; border-radius: 14px; padding: 6px 10px; cursor: pointer; line-height: 1.15; min-width: 70px; }
.zh-chip .zh { font-size: 30px; color: var(--red); }
.zh-chip small { font-size: 13px; }
.zh-chip i { font-size: 12px; font-style: normal; opacity: .75; }
.zh-chip.learned { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.zh-chip:hover { transform: translateY(-2px); }

.book { max-width: 980px; margin: 0 auto; padding: 14px 16px 40px; }
.book h3 { color: #fff; text-shadow: 0 2px 0 #7f1414; font-size: 24px; margin: 22px 0 8px; }
.parents { background: var(--paper); border-radius: 24px; margin-top: 16px; box-shadow: var(--shadow); padding: 18px 26px; font-size: 18px; line-height: 1.5; }
.parents h2 { color: var(--red); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: #2b1b10; color: #fff; padding: 12px 20px; border-radius: 16px; font-size: 18px; max-width: min(92vw, 680px); z-index: 90; transition: transform .35s; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); line-height: 1.35; }
.toast.show { transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall linear forwards; }
.confetti .bit { width: 10px; height: 14px; border-radius: 2px; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
#autotest { white-space: pre-wrap; font-size: 12px; background: #fff; padding: 10px; }

@media (max-width: 640px) {
  .lcard:nth-child(n) { margin: 0; }
  .lunar-cal { grid-template-columns: repeat(5, 1fr); }
  .act { padding: 12px; }
  .act-prompt { font-size: 19px; }
  .race { height: 470px; }
  .race-animal { width: 62px; height: 62px; font-size: 30px; }
  .slot { width: 72px; min-height: 72px; }
  .ocard { width: 84px; }
  .caption { font-size: 16px; }
  .step small { display: none; }
}
