:root {
  color-scheme: light;
  --ink: #292b50;
  --muted: #74758e;
  --paper: #fffefa;
  --purple: #6756d9;
  --purple-dark: #5141c0;
  --mint: #bcebdc;
  --sun: #ffd875;
  --coral: #ff8f7b;
  --line: #ece9f8;
  font-family: "Nunito", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 7% 12%, rgba(255, 229, 154, .52), transparent 24rem),
    radial-gradient(ellipse at 95% 38%, rgba(188, 235, 220, .58), transparent 26rem),
    linear-gradient(180deg, #f4f2ff 0%, #f8fbff 55%, #fff9ed 100%);
  overflow-x: hidden;
}

button { font: inherit; }
button:focus-visible { outline: 4px solid #ffb547; outline-offset: 3px; }
.sky-spark { position: fixed; z-index: -1; color: #a79cf2; opacity: .6; pointer-events: none; }
.spark-one { top: 8%; left: 6%; font-size: 2.5rem; transform: rotate(-12deg); }
.spark-two { top: 38%; right: 5%; font-size: 3rem; color: #ffc95d; transform: rotate(15deg); }
.app-shell { width: min(1120px, 100%); min-height: 100vh; margin: 0 auto; padding: 22px 28px 48px; }
.loading-card { margin: 10vh auto; padding: 30px; border-radius: 28px; background: var(--paper); text-align: center; font-size: 1.4rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 12px; border: 0; padding: 0; color: var(--ink); background: transparent; cursor: pointer; text-align: left; }
.brand-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 17px; color: #fff; background: linear-gradient(145deg, #8272ec, #5e4bc9); box-shadow: 0 8px 18px #6756d932; font-size: 1.65rem; transform: rotate(-7deg); }
.brand-name { display: block; font-size: 1.2rem; font-weight: 900; letter-spacing: .02em; }
.brand-caption { display: block; margin-top: 1px; color: var(--muted); font-size: .77rem; font-weight: 700; }
.star-pill { display: flex; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid #f3e6bd; border-radius: 999px; color: #775b17; background: #fff8de; font-size: .98rem; font-weight: 900; white-space: nowrap; }
.star-pill .star-glyph { color: #f1ae24; font-size: 1.15rem; }

.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(180px, .7fr); align-items: center; gap: 20px; min-height: 232px; margin-bottom: 26px; padding: 32px clamp(24px, 5vw, 54px); border: 1px solid rgba(255,255,255,.88); border-radius: 34px; background: linear-gradient(112deg, #7361df 0%, #8a74e9 56%, #ad8ced 100%); box-shadow: 0 20px 42px #6650c329; overflow: hidden; color: white; }
.hero::after { position: absolute; right: 17%; bottom: -120px; width: 280px; height: 280px; border: 1px solid #ffffff34; border-radius: 50%; content: ""; box-shadow: 0 0 0 26px #ffffff0c, 0 0 0 52px #ffffff0a; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 11px; padding: 6px 11px; border-radius: 99px; color: #493e9a; background: #e7e0ff; font-size: .78rem; font-weight: 900; letter-spacing: .04em; }
.hero .eyebrow { color: #6049aa; background: #fff1bf; }
.hero h1 { max-width: 620px; margin: 0; font-size: clamp(2rem, 4.6vw, 3.15rem); line-height: 1.18; font-weight: 900; letter-spacing: .01em; }
.hero p { max-width: 540px; margin: 13px 0 0; color: #f4f1ff; font-size: clamp(1rem, 1.6vw, 1.13rem); line-height: 1.8; font-weight: 600; }
.hero-mascot { position: relative; z-index: 1; display: grid; min-height: 155px; place-items: center; font-size: clamp(6rem, 14vw, 9.5rem); filter: drop-shadow(0 13px 7px #35247534); animation: float 4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 30px 2px 14px; }
.section-heading h2 { margin: 0; font-size: clamp(1.35rem, 2.5vw, 1.8rem); font-weight: 900; }
.section-heading p { margin: 0; color: var(--muted); font-size: .93rem; font-weight: 700; }
.subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.subject-card { position: relative; display: flex; min-height: 202px; flex-direction: column; align-items: flex-start; padding: 23px; border: 2px solid transparent; border-radius: 27px; background: var(--paper); box-shadow: 0 10px 24px #554a9010; text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.subject-card:hover:not(:disabled) { transform: translateY(-4px); box-shadow: 0 17px 30px #554a901b; }
.subject-card:disabled { cursor: default; }
.subject-card.chinese { border-color: #f5c4a8; background: linear-gradient(145deg, #fffdfa, #fff4e9); }
.subject-card.math { border-color: #c2e9d8; background: linear-gradient(145deg, #fffefa, #eefbf5); }
.subject-card.english { border-color: #d9d4f3; background: linear-gradient(145deg, #fffefa, #f4f1ff); }
.subject-emoji { display: grid; width: 55px; height: 55px; place-items: center; margin-bottom: 12px; border-radius: 19px; background: #fff; box-shadow: 0 5px 13px #6d568b18; font-size: 1.8rem; }
.subject-card strong { font-size: 1.3rem; font-weight: 900; }
.subject-card p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; font-weight: 600; line-height: 1.55; }
.card-arrow { position: absolute; top: 25px; right: 23px; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: var(--purple); background: #f1edff; font-size: 1.1rem; font-weight: 900; }
.coming-soon { position: absolute; top: 19px; right: 18px; padding: 6px 9px; border-radius: 99px; color: #6d649a; background: #eae7f8; font-size: .72rem; font-weight: 900; }

.home-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; padding: 15px 18px; border: 1px solid #eee8d5; border-radius: 19px; color: #6d6653; background: #fffdf5; font-size: .9rem; line-height: 1.7; }
.home-note .note-icon { font-size: 1.25rem; }
.footer-note { margin-top: 26px; color: #89889d; text-align: center; font-size: .78rem; font-weight: 600; }

.page-title { display: flex; align-items: flex-start; gap: 13px; margin: 12px 0 8px; }
.back-button { flex: 0 0 auto; display: grid; width: 43px; height: 43px; place-items: center; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; box-shadow: 0 5px 12px #453d7410; font-size: 1.2rem; cursor: pointer; }
.page-title h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 900; }
.page-title p { margin: 3px 0 0; color: var(--muted); font-size: .95rem; font-weight: 600; }
.course-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 18px 0 20px; padding: 20px 24px; border-radius: 24px; background: linear-gradient(105deg, #ffefd4, #fff8e8); }
.course-banner.math-banner { background: linear-gradient(105deg, #dcf6e9, #f1fff8); }
.course-banner p { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.65; }
.course-banner strong { display: block; margin-bottom: 4px; font-size: 1.05rem; font-weight: 900; }
.banner-emoji { flex: 0 0 auto; font-size: 2.6rem; }
.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.unit-card { padding: 20px; border: 1px solid #ece9f8; border-radius: 25px; background: rgba(255,255,252,.95); box-shadow: 0 8px 20px #4d477710; }
.unit-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.unit-num { display: inline-flex; padding: 5px 10px; border-radius: 99px; color: #634ec1; background: #eee9ff; font-size: .77rem; font-weight: 900; }
.math-banner ~ .unit-grid .unit-num { color: #237957; background: #e0f6e9; }
.unit-icon { font-size: 2rem; }
.unit-card h3 { margin: 9px 0 3px; font-size: 1.22rem; font-weight: 900; }
.unit-focus { margin: 0 0 13px; color: var(--muted); font-size: .88rem; line-height: 1.55; font-weight: 600; }
.lesson-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.lesson-chip { display: inline-flex; max-width: 100%; min-width: 0; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1px solid #f0eef7; border-radius: 12px; color: #55556f; background: #faf9fe; text-align: left; font-size: .78rem; font-weight: 700; line-height: 1.35; cursor: pointer; transition: border .16s ease, background .16s ease, transform .16s ease; }
.lesson-chip:hover { border-color: #b7addf; background: #f6f3ff; transform: translateY(-1px); }
.lesson-chip > span:first-child { min-width: 0; }
.lesson-chip .chip-arrow { flex: 0 0 auto; color: #877bc6; font-size: .95rem; font-weight: 900; }
.lesson-chip.lesson-done { border-color: #bfe8cd; color: #27764c; background: #f1fbf3; }
.lesson-chip.lesson-done .chip-arrow { color: #258351; }
.unit-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid #f0eef7; }
.progress-copy { color: var(--muted); font-size: .79rem; font-weight: 700; }
.progress-copy.done { color: #23885d; }
.primary-button, .secondary-button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 14px; font-size: .93rem; font-weight: 900; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.primary-button { color: white; background: var(--purple); box-shadow: 0 7px 13px #6756d92d; }
.primary-button:hover { background: var(--purple-dark); transform: translateY(-1px); }
.math-banner ~ .unit-grid .primary-button { background: #268a66; box-shadow: 0 7px 13px #268a662b; }
.secondary-button { color: #5d568e; background: #f0edff; }
.primary-button:active, .secondary-button:active { transform: scale(.98); }

.game-layout { max-width: 830px; margin: 0 auto; }
.game-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 0 14px; }
.game-label { color: var(--muted); font-size: .86rem; font-weight: 800; }
.question-count { color: #6657c5; font-size: .9rem; font-weight: 900; white-space: nowrap; }
.progress-track { height: 11px; margin-bottom: 19px; border-radius: 20px; background: #e9e6f7; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9584ec, #6955d3); transition: width .35s ease; }
.math-game .progress-fill { background: linear-gradient(90deg, #79d1a9, #2c926a); }
.game-card { position: relative; padding: clamp(23px, 5vw, 42px); border: 1px solid #eeeaf9; border-radius: 31px; background: var(--paper); box-shadow: 0 16px 38px #554a9014; }
.game-scene { display: flex; align-items: center; gap: 12px; margin-bottom: 21px; }
.scene-avatar { display: grid; width: 64px; height: 64px; flex: 0 0 auto; place-items: center; border-radius: 22px; background: #fff2d3; font-size: 2.2rem; }
.math-game .scene-avatar { background: #dcf6e9; }
.scene-caption { color: #817d9d; font-size: .84rem; font-weight: 800; }
.scene-title { margin-top: 2px; font-size: 1rem; font-weight: 900; }
.question-text { max-width: 650px; margin: 0 0 22px; font-size: clamp(1.35rem, 3vw, 1.85rem); line-height: 1.5; font-weight: 900; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-button { display: flex; min-height: 68px; align-items: center; gap: 12px; padding: 13px 16px; border: 2px solid #ebe8f5; border-radius: 19px; color: var(--ink); background: #fff; text-align: left; font-size: 1.04rem; font-weight: 800; cursor: pointer; transition: border .16s ease, background .16s ease, transform .16s ease; }
.choice-button:hover { border-color: #aea4ec; background: #faf8ff; transform: translateY(-2px); }
.choice-letter { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #6553c7; background: #f0edff; font-size: .85rem; font-weight: 900; }
.choice-button.wrong { border-color: #ffc4b8; background: #fff6f3; animation: nudge .18s ease-in-out 2; }
.choice-button.wrong .choice-letter { color: #c35b47; background: #ffe4dc; }
.choice-button.correct { border-color: #8bd7ae; background: #effbf3; }
.choice-button.correct .choice-letter { color: #22734c; background: #d5f3df; }
.choice-button:disabled { cursor: default; }
@keyframes nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.feedback { min-height: 49px; margin-top: 16px; padding: 12px 15px; border-radius: 15px; color: #655d8b; background: #f5f2ff; font-size: .95rem; font-weight: 800; line-height: 1.55; }
.feedback.success { color: #26704a; background: #e9f8ed; }
.feedback.try-again { color: #785c26; background: #fff7df; }
.game-actions { display: flex; justify-content: flex-end; margin-top: 13px; }
.game-actions .primary-button { min-width: 148px; }
.game-note { margin: 13px 2px 0; color: #848199; font-size: .79rem; font-weight: 700; }

.result-card { max-width: 680px; margin: 30px auto; padding: clamp(28px, 6vw, 50px); border: 1px solid #eeeaf9; border-radius: 32px; background: var(--paper); box-shadow: 0 16px 38px #554a9014; text-align: center; }
.result-emoji { font-size: 4.3rem; animation: float 4s ease-in-out infinite; }
.result-card h1 { margin: 7px 0 8px; font-size: clamp(1.8rem, 4vw, 2.45rem); font-weight: 900; }
.result-card p { margin: 0 auto 20px; max-width: 480px; color: var(--muted); font-size: 1rem; line-height: 1.7; font-weight: 600; }
.result-stars { margin-bottom: 23px; color: #efad26; font-size: 2rem; letter-spacing: .18em; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.empty-state { padding: 38px; border-radius: 25px; background: white; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .app-shell { padding: 16px 18px 34px; }
  .hero { grid-template-columns: 1fr 130px; min-height: 210px; padding: 25px; border-radius: 28px; }
  .hero-mascot { min-height: 120px; font-size: 6.5rem; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subject-card { min-height: 188px; padding: 19px; }
  .subject-card.english { grid-column: 1 / -1; min-height: 142px; }
  .unit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .app-shell { padding: 13px 13px 28px; }
  .topbar { margin-bottom: 18px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 15px; }
  .brand-name { font-size: 1.05rem; }
  .brand-caption { font-size: .7rem; }
  .star-pill { padding: 8px 11px; font-size: .85rem; }
  .hero { grid-template-columns: 1fr 78px; gap: 8px; min-height: 185px; padding: 20px 17px; border-radius: 23px; }
  .hero h1 { font-size: 1.65rem; }
  .hero p { font-size: .9rem; line-height: 1.55; }
  .hero-mascot { min-height: 100px; font-size: 4.8rem; }
  .hero .eyebrow { font-size: .68rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .section-heading p { font-size: .83rem; }
  .subject-grid { gap: 10px; }
  .subject-card { min-height: 174px; padding: 16px; border-radius: 21px; }
  .subject-card strong { font-size: 1.1rem; }
  .subject-card p { font-size: .83rem; }
  .subject-emoji { width: 48px; height: 48px; border-radius: 16px; font-size: 1.55rem; }
  .card-arrow { top: 17px; right: 15px; width: 29px; height: 29px; }
  .coming-soon { top: 14px; right: 12px; font-size: .65rem; }
  .home-note { padding: 12px 13px; font-size: .82rem; }
  .course-banner { padding: 15px 16px; border-radius: 20px; }
  .course-banner p { font-size: .9rem; }
  .banner-emoji { font-size: 2rem; }
  .unit-card { padding: 16px; border-radius: 21px; }
  .lesson-chip { font-size: .73rem; }
  .page-title h1 { font-size: 1.55rem; }
  .page-title p { font-size: .85rem; }
  .choice-grid { grid-template-columns: 1fr; gap: 9px; }
  .choice-button { min-height: 59px; padding: 10px 12px; font-size: .98rem; }
  .game-card { padding: 21px 16px; border-radius: 24px; }
  .question-text { font-size: 1.28rem; }
  .game-actions .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* The game uses a storybook scene and a tiny original guide character. */
.hero-mascot {
  position: relative;
  display: grid;
  width: min(100%, 250px);
  min-height: 208px;
  justify-self: center;
  place-items: center;
  border: 1px solid #ffffff47;
  border-radius: 48% 52% 47% 53%;
  background: radial-gradient(circle at 50% 38%, #fff5d7 0 47%, #fff0 48%), #ffffff20;
  overflow: hidden;
}
.fox-illustration { display: block; width: 100%; height: auto; }
.hero-mascot > .fox-illustration { position: relative; z-index: 2; width: 83%; filter: drop-shadow(0 10px 6px #45378b34); animation: fox-bob 3.2s ease-in-out infinite; }
.hero-hill { position: absolute; bottom: -28px; width: 72%; height: 76px; border-radius: 50% 50% 0 0; background: #7ad4b1; }
.hill-one { left: -21px; transform: rotate(-9deg); }
.hill-two { right: -35px; bottom: -38px; background: #f5d47b; transform: rotate(8deg); }
.hero-orbit { position: absolute; z-index: 3; color: #fff2b5; font-size: 2rem; animation: twinkle 1.9s ease-in-out infinite alternate; }
.orbit-one { top: 24px; left: 25px; }
.orbit-two { top: 58px; right: 20px; color: #d9fff3; animation-delay: .7s; }
@keyframes fox-bob { 0%, 100% { transform: translateY(3px) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes twinkle { from { opacity: .42; transform: scale(.78) rotate(-9deg); } to { opacity: 1; transform: scale(1.08) rotate(12deg); } }

.subject-card { overflow: hidden; }
.subject-card::after { position: absolute; right: -24px; bottom: -37px; width: 105px; height: 88px; border-radius: 60% 40% 0 0; background: #ffc07845; content: ""; transform: rotate(-18deg); }
.subject-card.math::after { background: #79d4ab55; }
.subject-card.english::after { background: #9d8bf34d; }
.subject-emoji { position: relative; z-index: 1; }
.subject-card strong, .subject-card p { position: relative; z-index: 1; }
.card-arrow, .coming-soon { z-index: 2; }
.unit-card { position: relative; overflow: hidden; }
.unit-card::after { position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: #fff5d6; content: ""; opacity: .58; }
.unit-card > * { position: relative; z-index: 1; }
.lesson-chip { flex: 1 1 210px; }
.chapter-count { flex: 0 0 auto; padding: 3px 7px; border-radius: 99px; color: #715ec5; background: #efebff; font-size: .68rem; font-weight: 900; white-space: nowrap; }
.lesson-chip.lesson-done .chapter-count { color: #23734b; background: #d8f3e1; }

.game-card { overflow: hidden; background: linear-gradient(180deg, #fff 0%, #fffef9 100%); }
.game-card::before { position: absolute; top: -45px; right: -32px; width: 160px; height: 125px; border-radius: 50%; background: #fff2ce80; content: ""; pointer-events: none; }
.game-scene { position: relative; z-index: 1; min-height: 120px; align-items: center; gap: 12px; margin: -5px -3px 20px; padding: 10px 13px; border: 1px solid #efe9d9; border-radius: 22px; background: linear-gradient(115deg, #fff8e2, #eef9f5); overflow: hidden; }
.game-scene::after { position: absolute; right: 14%; bottom: -26px; width: 180px; height: 52px; border-radius: 50%; background: #b9e8d3; content: ""; opacity: .72; }
.math-game .game-scene { background: linear-gradient(115deg, #e5f8eb, #eaf5ff); }
.math-game .game-scene::after { background: #a8d8f1; }
.scene-fox { position: relative; z-index: 2; display: grid; width: 90px; height: 90px; flex: 0 0 auto; place-items: center; border-radius: 27px 27px 34px 27px; background: #ffe9c8; box-shadow: inset 0 -5px #f4d4ab; }
.scene-fox .fox-illustration { width: 90px; margin-top: 7px; }
.scene-dialog { position: relative; z-index: 2; flex: 1; padding: 13px 17px; border: 2px solid #dfd8f5; border-radius: 19px 19px 19px 7px; background: #fff; box-shadow: 0 5px 0 #e9e3fb; }
.scene-caption { display: block; color: #7363c6; font-size: .73rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.scene-title { display: block; margin-top: 1px; font-size: 1rem; font-weight: 900; }
.scene-dialog p { margin: 3px 0 0; color: #79768d; font-size: .79rem; line-height: 1.45; font-weight: 700; }
.scene-sticker { position: relative; z-index: 2; display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 2px solid #fff; border-radius: 17px; background: #fff5d6; box-shadow: 0 4px 0 #f0ddad; font-size: 1.65rem; transform: rotate(7deg); }
.question-text { position: relative; z-index: 1; }
.feedback { border: 1px dashed #dcd5f1; }
.feedback.success { border-color: #a6dfb6; animation: feedback-pop .32s ease-out; }
@keyframes feedback-pop { 0% { transform: scale(.98); } 65% { transform: scale(1.015); } 100% { transform: scale(1); } }

.picture-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.picture-choice { display: flex; min-height: 120px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px 9px; border: 3px solid #ece7f6; border-radius: 22px; color: var(--ink); background: linear-gradient(180deg, #fff, #faf8ff); box-shadow: 0 5px 0 #e6e1f1; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.picture-choice:nth-child(3n + 1) { background: linear-gradient(180deg, #fffdf5, #fff4dc); }
.picture-choice:nth-child(3n + 2) { background: linear-gradient(180deg, #f6fffb, #eaf9f2); }
.picture-choice:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 8px 0 #e6e1f1; }
.picture-glyph { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 18px; background: #ffffffbd; font-size: 2rem; }
.picture-label { text-align: center; font-size: .93rem; line-height: 1.3; font-weight: 900; }
.picture-choice.wrong { border-color: #ffbdb1; background: #fff4f1; animation: nudge .18s ease-in-out 2; }
.picture-choice.correct { border-color: #8bd7ae; background: #effbf3; }
.wordbank-challenge { padding: 18px; border: 2px dashed #d9d1f1; border-radius: 22px; background: linear-gradient(145deg, #faf8ff, #fffef8); }
.wordbank-prompt { padding: 13px 15px; border-radius: 16px; color: #39345d; background: #fff; box-shadow: 0 4px 0 #eee9fa; font-size: 1.05rem; font-weight: 900; line-height: 1.55; }
.wordbank-hint { margin: 11px 2px 8px; color: #817d9d; font-size: .78rem; font-weight: 800; }
.wordbank-tray { display: flex; flex-wrap: wrap; gap: 9px; }
.word-piece { display: inline-flex; min-height: 50px; align-items: center; gap: 8px; padding: 8px 14px; border: 2px solid #ded8f1; border-radius: 15px 15px 15px 5px; color: #494269; background: #fff; box-shadow: 0 4px 0 #e8e3f5; font-size: .96rem; font-weight: 900; cursor: pointer; transition: transform .16s ease; }
.word-piece:hover { transform: translateY(-2px) rotate(-1deg); }
.word-glyph { font-size: 1.15rem; }
.word-piece.wrong { border-color: #ffc4b8; color: #ac5748; background: #fff3ef; }
.word-piece.correct { border-color: #8bd7ae; color: #26704a; background: #effbf3; }
.number-challenge { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(210px, 1fr); gap: 14px; align-items: center; padding: 15px; border: 2px solid #cfeee0; border-radius: 23px; background: linear-gradient(145deg, #f4fff9, #f8fbff); }
.number-display { display: flex; min-height: 100px; flex-direction: column; align-items: center; justify-content: center; border: 3px dashed #92d2b1; border-radius: 20px; color: #276c50; background: #fff; }
.number-display span { color: #7b9688; font-size: .77rem; font-weight: 800; }
.number-display strong { min-height: 50px; font-size: 2.2rem; font-weight: 900; }
.number-display.has-value strong { color: #24835f; }
.number-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.keypad-key { min-height: 43px; border: 1px solid #cce8dc; border-radius: 13px; color: #316e58; background: #fff; box-shadow: 0 3px 0 #d9eee4; font-size: 1rem; font-weight: 900; cursor: pointer; }
.keypad-key:hover:not(:disabled) { background: #e9f9f0; transform: translateY(-1px); }
.keypad-tool { color: #77718e; background: #f5f3fb; }
.keypad-key:disabled { opacity: .55; cursor: default; }
.check-number { grid-column: 1 / -1; width: 100%; background: #268a66; box-shadow: 0 5px 0 #1e7456; }
.check-number:disabled { opacity: .5; cursor: default; }
.order-challenge { padding: 16px; border: 2px solid #eee1bb; border-radius: 22px; background: linear-gradient(145deg, #fffaf0, #fffef8); }
.order-path { display: flex; min-height: 65px; flex-wrap: wrap; align-items: center; gap: 7px; padding: 10px; border: 2px dashed #e8d5a5; border-radius: 16px; background: #fff; }
.path-label { width: 100%; color: #857653; font-size: .75rem; font-weight: 900; }
.path-empty { color: #a59b84; font-size: .82rem; font-weight: 700; }
.path-stop { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 11px; color: #5e4d31; background: #fff2ce; font-size: .82rem; font-weight: 900; }
.path-stop b { display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: white; background: #e59d45; font-size: .7rem; }
.order-pieces { display: flex; flex-wrap: wrap; gap: 9px; margin: 13px 0; }
.order-piece { min-height: 46px; padding: 9px 13px; border: 2px solid #e9dba8; border-radius: 15px 15px 15px 5px; color: #665335; background: #fff; box-shadow: 0 4px 0 #eee4c8; font-size: .9rem; font-weight: 900; cursor: pointer; }
.order-piece:hover:not(:disabled) { background: #fff5d5; transform: rotate(-1deg) translateY(-2px); }
.order-piece.piece-used { opacity: .35; }
.order-actions { display: flex; justify-content: flex-end; gap: 9px; }
.order-actions button:disabled { opacity: .5; cursor: default; }

/* Touch-first Chinese language play: collect, trace, pair, and invent. */
.character-gallery { padding: 15px; border: 2px solid #eee4c7; border-radius: 23px; background: linear-gradient(145deg, #fffaf0, #f6fff9); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.character-card { min-width: 0; padding: 8px; border: 2px solid #f0e5c9; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 #eee7d5; }
.character-glyph { position: relative; display: grid; width: 100%; min-height: 69px; place-items: center; border: 0; border-radius: 13px; color: #514481; background: linear-gradient(145deg, #fff8d8, #f2eefe); font-size: 2.25rem; font-weight: 900; cursor: pointer; }
.character-glyph > span { position: absolute; top: 4px; right: 8px; color: #8b7ad2; font-size: .85rem; }
.character-found { border-color: #a2ddb5; background: #f5fff7; box-shadow: 0 4px 0 #d9efdf; }
.character-found .character-glyph { color: #26764d; background: linear-gradient(145deg, #effff2, #e2f7e8); }
.character-card-foot { display: flex; min-height: 28px; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 2px 0; color: #77718d; font-size: .69rem; font-weight: 800; }
.character-card-foot > span { overflow-wrap: anywhere; }
.sound-chip { display: inline-grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 11px; color: #6554c4; background: #f1edff; cursor: pointer; }
.gallery-detail { display: flex; min-height: 57px; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 12px; border-radius: 15px; color: #655d80; background: #fff; font-size: .85rem; font-weight: 800; }
.gallery-detail > span:nth-child(2) { flex: 1; }
.detail-glyph { color: #d4784e; font-size: 1.8rem; font-weight: 900; }
.gallery-progress { margin-top: 11px; color: #7a7097; text-align: right; font-size: .78rem; font-weight: 900; }
.character-hunt { display: grid; gap: 14px; }
.hunt-target { display: flex; min-height: 103px; align-items: center; justify-content: center; gap: 13px; padding: 11px; border: 2px dashed #e3d9b5; border-radius: 20px; background: #fff9e9; }
.hunt-target > span { color: #8a7e5e; font-size: .8rem; font-weight: 900; }
.hunt-target > strong { color: #dc7951; font-size: 3.25rem; line-height: 1; }
.character-hunt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.character-hunt-tile { display: grid; min-height: 114px; place-items: center; gap: 2px; border: 3px solid #e9e4f1; border-radius: 20px; color: #504476; background: linear-gradient(180deg, #fff, #f6f2ff); box-shadow: 0 5px 0 #e5e0ee; cursor: pointer; transition: transform .16s ease; }
.character-hunt-tile:hover:not(:disabled) { transform: translateY(-3px) rotate(1deg); }
.character-hunt-tile > span { font-size: 2.35rem; font-weight: 900; }
.character-hunt-tile > small { color: #918aa7; font-size: .68rem; font-weight: 800; }
.character-hunt-tile.wrong { border-color: #ffc5b9; background: #fff3ef; }
.character-hunt-tile.correct { border-color: #8ed5a9; color: #27704b; background: #effbf2; }
.character-hunt-tile:disabled { cursor: default; }
.trace-game { padding: 14px; border: 2px solid #f0dfbc; border-radius: 22px; background: linear-gradient(145deg, #fff9ec, #fffefa); }
.trace-caption { display: flex; justify-content: space-between; gap: 10px; margin: 1px 2px 9px; color: #71648e; font-size: .82rem; font-weight: 900; }
.trace-caption span:last-child { color: #958b9b; font-size: .72rem; }
.trace-canvas { display: block; width: 100%; height: 300px; border: 2px solid #eadfc9; border-radius: 17px; background: #fffdf5; cursor: crosshair; touch-action: none; }
.trace-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 11px; }
.trace-note { margin: 8px 1px 0; color: #8c8495; font-size: .74rem; font-weight: 700; line-height: 1.5; }
.pair-game { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair-column { display: grid; align-content: start; gap: 8px; }
.pair-heading { padding: 4px 3px; color: #77718e; font-size: .77rem; font-weight: 900; }
.pair-card { display: flex; min-height: 67px; align-items: center; gap: 8px; padding: 10px; border: 2px solid #e8e2f1; border-radius: 16px; color: #4c456b; background: #fff; box-shadow: 0 4px 0 #eeeaf5; text-align: left; font-size: .84rem; line-height: 1.35; font-weight: 850; cursor: pointer; transition: transform .13s ease, background .13s ease; }
.pair-card > span { flex: 0 0 auto; font-size: 1.25rem; }
.pair-card:hover:not(:disabled) { transform: translateY(-2px); }
.pair-card.pair-selected { border-color: #a89be8; background: #f4f0ff; }
.pair-card.pair-matched { border-color: #9ad7ac; color: #32704a; background: #effaf1; box-shadow: 0 3px 0 #d9efde; }
.pair-card:disabled { cursor: default; }
.sound-words { grid-column: 1 / -1; min-height: 42px; border: 0; border-radius: 13px; color: #6554c4; background: #f2efff; font-weight: 900; cursor: pointer; }
.compose-game { display: grid; gap: 12px; padding: 14px; border: 2px solid #e9dcae; border-radius: 22px; background: linear-gradient(145deg, #fff9e7, #fffef8); }
.compose-result { display: grid; min-height: 88px; align-content: center; gap: 5px; padding: 11px 14px; border: 2px dashed #ead394; border-radius: 17px; background: #fff; }
.compose-result > span { color: #9a875c; font-size: .72rem; font-weight: 900; }
.compose-result > strong { color: #514477; font-size: 1.15rem; line-height: 1.55; overflow-wrap: anywhere; }
.sentence-inspiration { padding: 9px 11px; border-radius: 14px; color: #746a91; background: #f5f1ff; font-size: .82rem; font-weight: 800; }
.sentence-inspiration summary { cursor: pointer; }
.sentence-inspiration p { margin: 8px 1px 1px; color: #4f4777; line-height: 1.5; }
.compose-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.compose-token { min-height: 44px; padding: 8px 12px; border: 2px solid #e5d9b4; border-radius: 14px 14px 14px 5px; color: #65553a; background: #fff; box-shadow: 0 4px 0 #eee4cc; font-size: .9rem; font-weight: 900; cursor: pointer; }
.compose-token:hover:not(:disabled) { transform: translateY(-2px) rotate(-1deg); }
.compose-token.token-used { opacity: .36; }
.compose-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.compose-actions button:disabled { opacity: .5; cursor: default; }
.compose-note { margin: -3px 2px 0; color: #8d8497; font-size: .74rem; font-weight: 700; }
.result-stars { letter-spacing: normal; font-size: 1.2rem; }

@media (max-width: 560px) {
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .character-card { padding: 5px; border-radius: 14px; }
  .character-glyph { min-height: 55px; font-size: 1.85rem; }
  .character-card-foot { min-height: 25px; font-size: .59rem; }
  .character-hunt-grid { gap: 6px; }
  .character-hunt-tile { min-height: 91px; border-radius: 15px; }
  .character-hunt-tile > span { font-size: 1.9rem; }
  .trace-canvas { height: 235px; }
  .trace-caption { flex-direction: column; gap: 2px; }
  .pair-game { gap: 7px; }
  .pair-card { min-height: 70px; gap: 5px; padding: 7px; font-size: .74rem; }
  .pair-card > span { font-size: 1rem; }
  .compose-actions { justify-content: stretch; }
  .compose-actions button { flex: 1 1 auto; }
}

.topbar-tools { display: flex; align-items: center; gap: 9px; }
.history-pill { min-height: 40px; padding: 8px 12px; border: 1px solid #e5dff4; border-radius: 999px; color: #62558f; background: #fff; font-size: .82rem; font-weight: 900; white-space: nowrap; cursor: pointer; }
.history-pill:hover { background: #f7f4ff; }
.history-teaser { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 13px 16px; border: 1px solid #e5e0f0; border-radius: 17px; color: #615b7d; background: linear-gradient(110deg, #fff, #f7f4ff); font-size: .85rem; font-weight: 800; }
.history-teaser .secondary-button { flex: 0 0 auto; }
.lesson-chip.lesson-in-progress { border-color: #e8d8a5; background: #fffcf1; }
.lesson-chip.lesson-in-progress .chapter-count { color: #8a6a17; background: #fff1c8; }
.activity-map { display: flex; gap: 7px; margin: -8px 0 17px; padding: 3px 2px 8px; overflow-x: auto; scrollbar-color: #d8d2ec transparent; scrollbar-width: thin; }
.activity-marker { display: grid; min-width: 76px; min-height: 56px; align-content: center; justify-items: center; gap: 3px; padding: 5px 7px; border: 1px solid #e8e4ef; border-radius: 14px; color: #89849a; background: #faf9fc; text-align: center; }
.activity-marker b { display: grid; min-width: 23px; height: 23px; place-items: center; border-radius: 50%; color: #77718f; background: #ece9f4; font-size: .73rem; }
.activity-marker small { max-width: 100%; overflow: hidden; color: #89849a; font-size: .63rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.activity-marker.marker-played { border-color: #b8e3c4; color: #27754c; background: #f2fbf4; }
.activity-marker.marker-played b { color: #fff; background: #48a873; }
.activity-marker.marker-played small { color: #39805a; }
.activity-marker.marker-current { outline: 2px solid #a99ce8; outline-offset: 1px; }
.history-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 850px; margin: 0 auto 16px; padding: 18px; border: 1px solid #e8e2f2; border-radius: 22px; background: linear-gradient(120deg, #fff8de, #f3efff); }
.history-summary > div { display: grid; gap: 5px; padding: 5px 8px; }
.history-summary > div span { color: #7b748f; font-size: .77rem; font-weight: 800; }
.history-summary > div strong { color: #514477; font-size: 1.45rem; font-weight: 950; }
.history-summary > p { grid-column: 1 / -1; margin: 0; padding: 9px 10px 0; border-top: 1px solid #e8e0ef; color: #7e778f; font-size: .78rem; font-weight: 700; }
.history-list { display: grid; max-width: 850px; gap: 9px; margin: 0 auto; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border: 1px solid #eeeaf3; border-radius: 18px; background: #fff; box-shadow: 0 5px 17px #5144770c; }
.history-row-main { display: grid; min-width: 0; gap: 4px; }
.history-subject { color: #7e70bb; font-size: .72rem; font-weight: 900; }
.history-row-main > strong { color: #423c60; font-size: .94rem; line-height: 1.4; }
.history-row-main > small { color: #908aa0; font-size: .72rem; }
.history-score { display: grid; flex: 0 0 auto; justify-items: end; }
.history-score strong { color: #bd871e; font-size: 1.3rem; font-weight: 950; }
.history-score span { color: #938254; font-size: .66rem; font-weight: 800; }
.history-empty { display: grid; justify-items: center; gap: 5px; padding: 40px 20px; border: 1px dashed #ded8ec; border-radius: 22px; color: #7c7593; background: #fff; text-align: center; }
.history-empty > span { font-size: 2.8rem; }
.history-empty strong { color: #514477; }
.history-empty p { margin: 3px 0 0; font-size: .84rem; }
.score-note { color: #8a8297 !important; font-size: .8rem !important; }

@media (max-width: 560px) {
  .topbar { gap: 7px; }
  .topbar-tools { gap: 5px; }
  .history-pill { min-height: 36px; padding: 7px 8px; font-size: .69rem; }
  .star-pill { gap: 4px; padding: 7px 8px; font-size: .7rem; }
  .history-teaser { align-items: flex-start; flex-direction: column; font-size: .78rem; }
  .history-summary { gap: 6px; padding: 13px; }
  .history-row { padding: 11px 12px; }
  .activity-marker { min-width: 70px; }
}
.reset-level-button { min-height: 38px; padding: 7px 11px; border: 1px solid #efd1c5; border-radius: 13px; color: #a4563f; background: #fff8f4; font-size: .78rem; font-weight: 900; white-space: nowrap; cursor: pointer; }
.reset-level-button:hover { background: #fff0e8; }
.next-level-button { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 150px; }
.next-level-button small { max-width: 205px; overflow: hidden; font-size: .69rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.reset-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: #29234488; backdrop-filter: blur(4px); }
.reset-dialog { width: min(100%, 430px); padding: 25px; border: 1px solid #eee5f4; border-radius: 27px; background: #fffdfa; box-shadow: 0 22px 70px #201a3b4a; text-align: center; animation: feedback-pop .2s ease-out; }
.reset-emoji { font-size: 2.6rem; }
.reset-dialog h2 { margin: 4px 0 9px; color: #504474; font-size: 1.35rem; font-weight: 950; }
.reset-dialog p { margin: 0 auto 20px; max-width: 340px; color: #777187; font-size: .91rem; line-height: 1.65; font-weight: 650; }
.reset-dialog-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.reset-dialog-actions button { min-height: 47px; }
.reset-confirm-button { padding: 10px 17px; border: 0; border-radius: 14px; color: #fff; background: #c9684d; box-shadow: 0 5px 0 #a94e3c; font-size: .88rem; font-weight: 900; cursor: pointer; }
.reset-confirm-button:hover { background: #b95a43; }

@media (max-width: 560px) {
  .game-topline { flex-wrap: wrap; gap: 8px; }
  .game-topline .game-label { flex: 1 1 130px; }
  .game-topline .question-count { margin-left: auto; }
  .result-actions { align-items: stretch; }
  .result-actions > button { flex: 1 1 145px; }
  .next-level-button { min-width: 0; }
  .reset-dialog { padding: 21px 17px; }
}

@media (max-width: 560px) {
  .hero-mascot { width: 125px; min-height: 137px; }
  .hero-mascot > .fox-illustration { width: 96%; }
  .hero-orbit { font-size: 1.3rem; }
  .hero-hill { height: 48px; }
  .game-scene { min-height: 101px; gap: 8px; padding: 8px; }
  .scene-fox { width: 67px; height: 72px; border-radius: 20px; }
  .scene-fox .fox-illustration { width: 76px; }
  .scene-dialog { padding: 10px 11px; }
  .scene-dialog p { font-size: .72rem; }
  .scene-sticker { width: 39px; height: 39px; border-radius: 14px; font-size: 1.3rem; }
  .picture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .picture-choice { min-height: 100px; }
  .picture-glyph { width: 43px; height: 43px; font-size: 1.7rem; }
  .number-challenge { grid-template-columns: 1fr; }
  .number-display { min-height: 72px; }
  .number-display strong { min-height: 38px; font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .hero-mascot { width: 74px; min-height: 96px; }
  .hero-mascot > .fox-illustration { width: 115%; }
  .hero-orbit { font-size: 1rem; }
  .orbit-one { top: 10px; left: 7px; }
  .orbit-two { top: 29px; right: 5px; }
}
