:root {
  color-scheme: light;
  --ink: #29263c;
  --muted: #665d74;
  --violet: #4c3566;
  --gold: #f5d897;
  --paper: #fcfaf6;
  font-family: system-ui, "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, #f3edf8, #faf7f3 65%);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #9566c1; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { font-size: clamp(2.25rem, 5.4vw, 4rem); line-height: 1.03; letter-spacing: -.045em; }
h2 { font-size: clamp(1.85rem, 3.4vw, 2.7rem); letter-spacing: -.035em; }
.masthead {
  display: flex; align-items: center; gap: 11px; padding: 9px 5%;
  border-bottom: 1px solid #e9e1ee; background: #fffcfa; font-weight: 760;
}
.brand-icon { flex: none; border-radius: 11px; box-shadow: 0 2px 6px #a85b8433; }
main { max-width: 1120px; margin: auto; padding: clamp(13px, 3.5vw, 34px); }
.eyebrow { color: #735887; font-size: .71rem; font-weight: 800; letter-spacing: .15em; }
.cover {
  min-height: min(580px, 78vh); border-radius: 28px; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: .88fr 1.12fr; align-items: stretch;
  background: #191a35; color: #fff8ee; box-shadow: 0 17px 45px #2d244438;
}
.cover-copy { padding: clamp(27px, 6vw, 78px); align-self: center; position: relative; z-index: 1; }
.cover .eyebrow { color: #f0d293; }
.cover h1 { font-size: clamp(3.7rem, 8vw, 7rem); line-height: .91; margin: 14px 0 19px; }
.cover p { color: #e8deee; font-size: clamp(.99rem, 2vw, 1.12rem); line-height: 1.55; max-width: 22ch; margin-bottom: 25px; }
.cover-art { position: relative; min-height: 0; min-width: 0; background: url(art/cover.jpg) 60% center / cover; }
.cover-art .portrait { position: absolute; inset: 6% 8% auto; width: 84%; height: 90%; object-position: center bottom; filter: drop-shadow(0 8px 8px #17132988); }
.cover .gold { display: inline-flex; gap: 14px; align-items: center; }
.button, .audio { min-height: 46px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; font-weight: 760; }
.button { transition: background .2s, box-shadow .2s; }
.button:hover { box-shadow: 0 3px 12px #36274523; }
.gold { background: var(--gold); color: #342641; }
.quiet, .audio { background: #fffdfb; border-color: #e1d8e7; }
.primary { background: var(--violet); color: white; }
.lilac { background: #ece1f4; border-color: #e4d4ee; color: #4d3267; }
.arcade-launch {
  background: linear-gradient(135deg, #7354b6, #503084); color: white;
  border-color: #523482; box-shadow: 0 3px 0 #39225c; text-shadow: 0 1px 1px #32204c;
}
.arcade-launch:hover { box-shadow: 0 3px 0 #39225c, 0 5px 15px #6a489b54; }
.arcade-launch:active { transform: translateY(2px); box-shadow: 0 1px 0 #39225c; }
.arcade-launch span { margin-right: 3px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.section-heading { margin: 13px 0 12px; }
.section-heading h1, .section-heading h2, .scene-heading h1 { margin-top: 4px; }
.royals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(6px, 1.5vw, 14px); }
.royal {
  min-width: 0; padding: 0 0 9px; border: 1px solid #e7ddec; border-radius: 15px;
  background: var(--paper); overflow: hidden; box-shadow: 0 4px 14px #46354d0d;
}
.royal[aria-pressed="true"] { border-color: #795798; box-shadow: 0 0 0 2px #795798; }
.royal strong { display: block; margin: 7px 1px 0; font-size: clamp(.69rem, 1.8vw, 1rem); }
.royal-picture { display: block; aspect-ratio: .92; overflow: hidden; background: radial-gradient(ellipse at 50% 80%, #fff9e9, var(--accent)); }
.portrait { display: block; width: 100%; height: 100%; object-fit: contain; }
.royal .portrait { transform-origin: 50% 92%; padding: 6% 4% 3%; }
.royal.greet .portrait { animation: curtsy .8s ease-in-out both; }
.greeting { display: flex; align-items: center; min-height: 46px; margin: 10px 0 15px; color: #57436d; font-size: .91rem; }
.places { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.place { min-width: 0; padding: 0; overflow: hidden; border: 1px solid #e6dce9; border-radius: 14px; background: var(--paper); text-align: left; }
.place:hover { border-color: #795798; }
.place-picture { display: block; aspect-ratio: 2.05; background: var(--scene) center / cover; }
.place-name { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 9px 10px; font-weight: 800; font-size: clamp(.78rem, 1.7vw, 1rem); }
.park { --scene: url(art/park.jpg); }
.home { --scene: url(art/home.jpg); }
.school { --scene: url(art/school.jpg); }
.festival { --scene: url(art/festival.jpg); }
.animals { --scene: url(art/animals.jpg); }
.transport { --scene: url(art/transport.jpg); }
.food { --scene: url(art/food.jpg); }
.family { --scene: url(art/family.jpg); }
.scene-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin: 12px 0; }
.scene-heading p { color: var(--muted); margin-top: 6px; }
output { color: #5a416e; background: #eee5f1; border-radius: 40px; padding: 7px 12px; font-size: .81rem; white-space: nowrap; font-weight: 780; }
.world { position: relative; border-radius: 18px; overflow: hidden; isolation: isolate; background: #d9cedd; box-shadow: 0 8px 26px #35274922; }
.world-art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: fill; }
.target {
  position: absolute; left: var(--x); top: var(--y); width: max(44px, var(--w)); height: max(44px, var(--h));
  transform: translate(-50%, -50%); background: transparent; border: 1px solid transparent;
  border-radius: 24%; color: #fff; padding: 0;
}
.target span { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 35%); display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff5cd; background: #654172d9; box-shadow: 0 1px 9px #26193690; }
.target:hover:not(:disabled), .target:focus-visible { background: #fff2b72b; border-color: #fff2ba; }
.target.visited span, .target.correct span { background: #23694d; }
.target.visited span::after, .target.correct span::after { content: '✓'; font-size: .7rem; font-weight: 800; line-height: 1; }
.target.correct { border: 2px solid #d2ffd5; background: #a0f4ac35; box-shadow: 0 0 18px #d2ffd5; z-index: 1; }
.target.try-again { animation: nudge .33s ease both; }
.walker { position: absolute; left: 48%; top: 94%; width: clamp(45px, 12.5%, 136px); height: 35%; transform: translate(-50%, -100%); pointer-events: none; z-index: 2; transition: left .64s cubic-bezier(.27,.6,.35,1), top .64s cubic-bezier(.27,.6,.35,1); }
.walker .portrait { object-position: center bottom; filter: drop-shadow(2px 4px 3px #211b3c72); transform-origin: 50% 97%; }
.walker.walking .portrait { animation: step .2s infinite alternate ease-in-out; }
.walker.pose .portrait { animation: curtsy .4s ease-in-out both; }
.complete, .prompt, .feedback { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.complete, .prompt { background: #f7f1fc; border: 1px solid #e9dff0; border-radius: 13px; padding: 9px 12px; margin: 10px 0; }
.prompt p { font-size: .79rem; color: var(--muted); }
.languages { display: flex; gap: 5px; }
.languages button { padding-inline: 8px; font-size: .78rem; }
.languages [aria-pressed="true"] { background: #e8d9f4; border-color: #956db1; }
.game-picker, .quiz-choices { display: grid; gap: clamp(7px, 2vw, 16px); }
.game-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-choice, .quiz-choice {
  min-width: 0; border: 1px solid #e3d7e8; border-radius: 14px;
  background: #fffdfa; text-align: center; padding: 12px 7px;
}
.game-choice {
  --game-accent: #5b388e; --game-shadow: #e0ccf3; --game-bg: #f1e5ff;
  display: grid; grid-template-rows: auto 1fr auto; place-items: center; gap: 10px;
  padding: 0 0 13px; overflow: hidden; box-shadow: 0 4px 0 var(--game-shadow);
  transition: transform .18s, box-shadow .18s;
}
.game-choice[data-game="picture"] { --game-accent: #166960; --game-shadow: #b8ddd3; --game-bg: #dff5e8; }
.game-choice:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--game-shadow); }
.game-choice:active { transform: translateY(3px); box-shadow: none; }
.game-preview {
  isolation: isolate; position: relative; display: flex; align-items: center; justify-content: center;
  gap: clamp(3px, 2vw, 14px); width: 100%; min-height: clamp(98px, 21vw, 172px); overflow: hidden;
  background: radial-gradient(circle at 50% 15%, #fff8c6, transparent 65%), var(--game-bg);
  color: var(--game-accent);
}
.game-preview .object-picture, .game-letters {
  display: grid; place-items: center; width: clamp(33px, 10vw, 78px); aspect-ratio: 1;
  border: 3px solid #fff; border-radius: 15%; background: white; box-shadow: 0 4px 8px #35274932;
}
.game-preview .object-picture { object-fit: cover; transform: rotate(-9deg); }
.game-letters { transform: rotate(9deg); font: 800 clamp(1.1rem, 4vw, 2.2rem) Georgia, serif; }
.game-arrow { font-weight: 800; font-size: clamp(1rem, 3vw, 1.6rem); }
.game-spark { position: absolute; z-index: -1; color: var(--game-accent); opacity: .42; }
.spark-one { left: 8%; top: 13%; }
.spark-two { right: 8%; bottom: 12%; font-size: 1.3rem; }
.game-info { display: grid; gap: 4px; padding: 0 7px; }
.game-info strong { font-size: clamp(1rem, 3.2vw, 1.28rem); }
.game-info span { font-size: .84rem; color: var(--muted); }
.game-note { color: var(--muted); margin-top: 7px; }
.game-play { padding: 7px 19px; border-radius: 40px; color: white; background: var(--game-accent); font-weight: 800; }
.quiz-score { background: #fff0bf; color: #654421; }
.quiz-trail { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; max-width: 420px; margin: 8px 0; }
.quiz-trail span { display: grid; place-items: center; min-height: 25px; border-radius: 7px; background: #eee7f2; color: #735887; font-weight: 800; }
.quiz-trail .earned { background: #ffe69b; color: #694417; }
.quiz-trail .current { background: #d9c7ef; color: #4d3267; }
.replay { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.quiz-clue {
  display: grid; place-items: center; min-height: 100px; padding: 12px; margin-bottom: 13px;
  background: #f5edf8; border-radius: 15px;
}
.quiz-clue strong { font-size: clamp(1.75rem, 6vw, 2.65rem); line-height: 1.15; }
.quiz-clue .object-picture { width: min(100%, 212px); height: clamp(120px, 29vw, 183px); }
.quiz-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quiz-choice { min-height: 58px; font-size: clamp(.95rem, 3vw, 1.35rem); font-weight: 760; overflow-wrap: break-word; }
.quiz-choice .object-picture { width: 100%; height: clamp(75px, 21vw, 145px); }
.quiz-choice:has(.object-picture) { padding: 5px; }
.quiz-choice:hover:not(:disabled) { border-color: #956db1; background: #f7f1fb; }
.quiz-choice.correct { border: 2px solid #43845f; background: #e7f4e6; }
.quiz-choice.try-again:not(.correct) { animation: nudge .33s ease both; }
.quiz-choice:disabled { opacity: .64; cursor: default; }
.quiz-choice.correct:disabled { opacity: 1; }
.feedback { min-height: 53px; margin-top: 8px; font-weight: 760; }
.practice-finish { text-align: center; background: #f0e7f6; border-radius: 17px; padding: 20px; }
.practice-finish .portrait { height: 160px; margin: auto; animation: curtsy .8s ease both; }
.practice-finish p { margin: 10px 0; }
dialog { width: min(calc(100% - 25px), 465px); max-height: 92dvh; border: 1px solid #e7dcea; border-radius: 19px; padding: 17px; background: #fffdfa; color: inherit; box-shadow: 0 12px 48px #25193755; }
dialog::backdrop { background: #271e3c83; }
.object-picture {
  display: block; object-fit: contain; border-radius: 10px;
}
.word-picture { width: min(100%, 148px); height: 108px; margin-top: 4px; object-position: left center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.close-card { width: 44px; height: 44px; border: 1px solid #e1d8e7; border-radius: 50%; background: #fffdfa; font-size: 1.45rem; line-height: 1; }
.word-chinese { font-size: clamp(1.25rem, 4vw, 1.72rem); margin: 0 0 12px; }
dialog .word { margin: 3px 0 8px; }
dialog .word h2 { font-family: inherit; font-size: clamp(1.55rem, 6vw, 2.25rem); font-weight: 760; letter-spacing: -.04em; }
dialog form .button, #talk { width: 100%; }
#dialogue { margin-top: 9px; }
.bubble { margin: 0 0 6px; background: #f3ecfa; border-radius: 12px; padding: 8px; }
.bubble.answer { margin: 6px 0 0; background: #e9f1e5; }
.bubble h3 { font-size: .74rem; }
.spoken { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.audio { flex: 0 0 44px; padding: 0; }
.audio-status { font-size: .84rem; min-height: 7px; margin: 3px 0; }
footer { padding: 5px 10px 24px; text-align: center; color: var(--muted); font-size: .81rem; }
@keyframes curtsy { 0%, 100% { transform: none; } 38% { transform: translateY(5%) rotate(-7deg) scale(.96); } 68% { transform: translateY(-1%) rotate(3deg) scale(1.04); } }
@keyframes step { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-3%) rotate(2deg); } }
@keyframes nudge { 33% { translate: -3px; } 66% { translate: 3px; } }
@media (max-width: 580px) {
  .cover { grid-template-columns: 1fr; min-height: 0; }
  .cover-art { grid-row: 1; height: min(40vh, 320px); background-position: 60% 43%; }
  .cover-copy { padding: 20px 24px 27px; }
  .cover h1 { font-size: 3.7rem; }
  .cover h1 br { display: none; }
  .cover p { max-width: none; margin-bottom: 16px; }
  .places { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .royals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .royal { border-radius: 9px; }
  .scene-heading { align-items: start; }
  .scene-heading p { font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
