:root {
  color-scheme: light;
  --paper: #f9f6ed;
  --cream: #fffdf8;
  --ink: #26352b;
  --muted: #59635a;
  --green: #346247;
  --green-dark: #234c35;
  --green-soft: #e9efe2;
  --line: #e7e1d3;
  --ochre: #8e552d;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'STSong', SimSun, serif;
  font: 16px/1.5 'Avenir Next', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
p, h1, h2 { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #a65725; outline-offset: 4px; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.star-icon { fill: #f4c96b; color: #955a23; }
.shell { width: min(1112px, 100% - 64px); margin-inline: auto; }
.site-header { border-bottom: 1px solid #e9e4d6; background: rgba(255, 253, 248, .72); }
.site-bar { min-height: 73px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: .055em; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 38px; height: 38px; background: var(--green); color: #fff9e6; border-radius: 11px; }
.brand-icon .icon { width: 23px; height: 23px; }
.all-progress { flex: none; display: flex; align-items: center; gap: 8px; border: 1px solid #ebddbb; background: #fff8e5; border-radius: 999px; padding: 7px 14px; color: #634a29; font-size: 14px; }
.all-progress strong { font-variant-numeric: tabular-nums; color: #51351c; }
.all-progress .icon { width: 18px; height: 18px; }
.intro { padding: clamp(27px, 4vw, 49px) 0 23px; }
.intro .intro-tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 13px; font-weight: 750; letter-spacing: .09em; }
.intro-tag span { color: var(--green); }
.intro h1 { font: 900 clamp(39px, 5.3vw, 66px)/1.17 var(--serif); letter-spacing: -.025em; margin: 12px 0 9px; }
.intro h1 .heading-accent { color: var(--green); }
.intro > p:last-child { color: var(--muted); font-size: clamp(15px, 1.8vw, 17px); }
.notice { margin-bottom: 15px; color: var(--ochre); }
.workbench { display: grid; grid-template-columns: 1.11fr 1fr; min-height: 414px; overflow: hidden; background: var(--cream); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 13px 32px #5744250d, 0 2px 4px #57442506; }
.scene-view { position: relative; background: #d6dfbd; isolation: isolate; min-width: 0; }
[data-scene='school'] .scene-view { background: #d5dcef; }
[data-scene='park'] .scene-view { background: #c7e1dd; }
[data-scene='home'] .scene-view { background: #f2d8b4; }
.scene-art, .scene-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-art { object-fit: cover; object-position: center; }
.scene-shade { background: linear-gradient(0deg, #22291d73 0%, transparent 32%); }
.scene-tag { position: absolute; top: 19px; left: 20px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: var(--cream); border-radius: 999px; color: var(--green-dark); font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px #233a2715; }
.scene-tag .icon { width: 17px; height: 17px; }
.scene-tools { position: absolute; left: 20px; bottom: 20px; }
.play-button { display: inline-flex; min-height: 50px; align-items: center; gap: 9px; padding: 6px 15px 6px 7px; border-radius: 999px; border: 1px solid #fff5dc; background: var(--cream); color: var(--green-dark); font-weight: 800; box-shadow: 0 3px 10px #262a1830; }
.play-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; background: var(--green); color: #fff; }
.play-icon .icon { width: 19px; height: 19px; }
.play-button:hover { background: #edf3e6; }
.problem-card { display: grid; min-width: 0; }
.problem-inner { display: flex; flex-direction: column; min-width: 0; padding: 29px clamp(23px, 3.4vw, 42px) 17px; }
.question-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--green-dark); font-size: 14px; font-weight: 800; }
.question-steps { display: flex; gap: 2px; justify-content: flex-end; }
.step { display: grid; place-items: center; width: 28px; height: 32px; padding: 0; border: 0; background: transparent; border-radius: 6px; color: var(--green); }
.step::before { content: ''; width: 19px; height: 6px; border-radius: 7px; background: #e2ddcf; }
.step:hover::before { background: #acbd9b; }
.step.is-done::before { background: #8fac7b; }
.step[aria-current='step']::before { height: 9px; background: var(--green); }
.question-copy { margin-top: 13px; }
.question-copy h2 { font: 850 clamp(23px, 3.1vw, 34px)/1.3 var(--serif); margin-bottom: 12px; }
.question-copy h2:focus, .scene-finish h2:focus { outline: none; }
.question-copy p { font-size: clamp(16px, 2.1vw, 19px); line-height: 1.74; color: #455047; }
.question-copy strong { display: inline-block; background: #f2edda; color: #56412c; font-weight: 800; border-radius: 5px; padding: 0 .25em; min-width: 1.5em; text-align: center; line-height: 1.32; }
.question-copy .question-ask { color: var(--ink); font-weight: 800; margin-top: 9px; }
.answer-form { margin-top: 21px; }
.answer-form label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 7px; }
.answer-controls { display: flex; gap: 9px; }
.answer-box { display: flex; min-width: 0; flex: 1 1 126px; min-height: 53px; align-items: center; padding-right: 13px; gap: 5px; background: #f8f5ec; border: 1px solid #ddd7c6; border-radius: 11px; color: var(--muted); }
.answer-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px #34624722; }
.answer-box.is-wrong { border-color: #b46637; }
.answer-box.is-right { border-color: #91a683; background: #eef3e8; color: var(--green-dark); }
.answer-box input { flex: 1; width: 0; min-width: 0; min-height: 50px; padding: 8px 0 8px 13px; font-size: 22px; font-weight: 800; background: transparent; border: 0; border-radius: 11px; color: var(--ink); outline: none; }
.answer-box input::placeholder { font-size: 16px; font-weight: 500; color: #696b60; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 53px; padding: 10px 16px; border: 1px solid var(--green); background: var(--green); color: #fff; border-radius: 11px; font-weight: 800; white-space: nowrap; }
.primary-button:hover { background: var(--green-dark); }
.primary-button .icon { width: 18px; height: 18px; }
.feedback, .hint-box { border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 15px; }
.feedback[data-result='wrong'] { color: #783d26; background: #fff0e5; }
.feedback[data-result='right'] { color: #234c35; background: #e8f0e2; }
.feedback .equation { font-size: 18px; font-weight: 800; margin-top: 2px; }
.hint-box { background: #fff3d8; color: #644324; }
.hint-box p { margin-top: 3px; }
.hint-box .equation { font-size: 20px; font-weight: 800; }
.problem-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; }
.quiet-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 5px 3px; border: 0; border-radius: 7px; background: transparent; color: var(--ochre); font-size: 14px; font-weight: 800; text-align: center; }
.quiet-button:hover { text-decoration: underline; text-underline-offset: .22em; }
.quiet-button .icon { width: 18px; height: 18px; }
.skip-button { color: var(--muted); }
.scene-finish { place-self: center; text-align: center; padding: 30px; }
.finish-icon { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px; background: #fff3cf; border-radius: 50%; }
.finish-icon .icon { width: 43px; height: 43px; }
.scene-finish h2 { font: 850 clamp(24px, 3vw, 34px)/1.25 var(--serif); }
.scene-finish p { margin-top: 10px; color: var(--muted); }
.finish-actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.locations { margin-top: 25px; }
.locations > h2 { font-size: 19px; margin-bottom: 11px; }
.location-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.location-card { --tile: #e7ede0; --tile-ink: #386349; display: flex; align-items: center; gap: 11px; min-width: 0; width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--cream); text-align: left; color: var(--ink); }
.location-card[data-scene='school'] { --tile: #e8e9f6; --tile-ink: #565e9b; }
.location-card[data-scene='park'] { --tile: #e3efed; --tile-ink: #326862; }
.location-card[data-scene='home'] { --tile: #f7e9d9; --tile-ink: #9c5a3c; }
.location-card:hover, .location-card[aria-pressed='true'] { border-color: var(--tile-ink); background: var(--tile); }
.location-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; color: var(--tile-ink); border-radius: 11px; background: var(--tile); }
.location-card[aria-pressed='true'] .location-icon { background: var(--cream); }
.location-icon .icon { width: 22px; height: 22px; }
.location-info { display: grid; min-width: 0; gap: 2px; }
.location-info strong { font-size: 15px; }
.location-info small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.location-status { font-size: 12px; margin-left: auto; flex: none; color: var(--tile-ink); font-weight: 800; }
.page-footer { display: flex; gap: 10px 18px; justify-content: space-between; flex-wrap: wrap; padding: 19px 0 23px; color: var(--muted); font-size: 12px; }

.demo { position: relative; min-height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: #eef0e4; }
.demo-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.demo-header strong { font-size: 19px; }
.demo-header p, .demo-footer p { font-size: 14px; color: #48584b; }
.icon-button { display: grid; flex: none; place-items: center; width: 42px; height: 42px; border: 1px solid #cdd7c6; border-radius: 12px; background: var(--cream); color: var(--green-dark); }
.demo-content { display: flex; flex-direction: column; flex: 1; gap: 10px; justify-content: center; }
.token-row { background: #fffdf7; border: 1px solid #dbe1d1; border-radius: 12px; padding: 9px 10px 10px; }
.token-label { font-size: 14px; font-weight: 750; color: #3b513f; margin-bottom: 6px; }
.tokens { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 28px; }
.token { display: inline-flex; align-items: center; justify-content: center; font-size: 17px; width: 24px; height: 27px; }
.token.ten { width: 46px; gap: 2px; font-size: 14px; border-radius: 7px; border: 1px solid #cee0c8; background: #ebf2e4; }
.token.ten b { font-size: 12px; color: #2d5235; }
.token.change.ten { border-color: #edca9e; background: #fff0d9; }
.token.change:not(.ten) { border-radius: 5px; background: #fff0d9; }
.token.used { opacity: .26; }
.token.matched { border-radius: 6px; background: #dce8ec; }
.token.arrive { animation: arrive .45s both; animation-delay: calc(var(--i) * 24ms); }
.token.leave { animation: leave .65s both; animation-delay: calc(var(--i) * 16ms); }
.demo-footer { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.demo-footer p { min-width: 0; }
.replay-button { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 10px; min-height: 42px; color: var(--green-dark); font-size: 14px; font-weight: 800; border: 1px solid #cdd7c6; border-radius: 9px; background: var(--cream); }
.replay-button .icon { width: 16px; height: 16px; }
@keyframes arrive { from { opacity: 0; transform: translateY(-14px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes leave { from { opacity: 1; transform: none; } to { opacity: .26; transform: translateY(-3px) scale(.91); } }

@media (max-width: 970px) {
  .location-card { gap: 8px; padding-inline: 9px; }
  .location-icon { width: 32px; height: 36px; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .site-bar { min-height: 63px; }
  .workbench { grid-template-columns: 1fr; border-radius: 20px; }
  .scene-view { min-height: clamp(200px, 46vw, 320px); }
  .scene-view:has(.demo:not([hidden])) { min-height: 300px; }
  .scene-tools { left: 13px; bottom: 13px; }
  .scene-tag { top: 13px; left: 13px; }
  .problem-inner { padding: 17px 19px 12px; }
  .question-copy { margin-top: 8px; }
  .location-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 380px) {
  .shell { width: calc(100% - 24px); }
  .brand { gap: 7px; font-size: 16px; }
  .all-progress { padding-inline: 9px; font-size: 12px; }
  .step { width: 25px; }
  .location-card { gap: 6px; }
  .location-icon { width: 27px; }
  .location-info strong { font-size: 14px; }
  .location-info small { font-size: 11px; }
  .demo { padding: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; scroll-behavior: auto !important; }
}

/* Language and narration controls */
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.language-switch { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.language-switch button { min-height: 38px; padding: 0 10px; border: 0; border-radius: 999px; color: var(--green-dark); background: transparent; font-size: 13px; font-weight: 800; }
.language-switch button[aria-pressed='true'] { background: var(--green); color: #fff; }
.language-switch button:hover:not([aria-pressed='true']) { background: var(--green-soft); }
.read-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; margin-top: 10px; padding: 4px 12px; border: 1px solid #d4decd; border-radius: 999px; color: var(--green-dark); background: #f1f5eb; font-size: 14px; font-weight: 800; }
.read-button:hover, .read-button[aria-pressed='true'] { background: #e0ebd7; border-color: #a3b296; }
.read-button .icon { width: 18px; height: 18px; }
.question-copy .audio-status { margin-top: 6px; color: var(--ochre); font-size: 14px; }
[lang='en'] .brand { letter-spacing: 0; }
[lang='en'] .intro h1, [lang='en'] .question-copy h2, [lang='en'] .scene-finish h2 { font-family: Georgia, serif; }
@media (max-width: 440px) {
  .header-actions { gap: 6px; }
  .language-switch button { padding-inline: 7px; font-size: 12px; }
  .all-progress { gap: 4px; padding-inline: 7px; font-size: 12px; }
  .all-progress .icon { width: 15px; height: 15px; }
  .progress-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (max-width: 460px) {
  .answer-box { padding-right: 8px; }
  .answer-box input { padding-left: 9px; }
  .answer-box input::placeholder { font-size: 14px; }
  #answer-unit { max-width: 48%; text-align: right; font-size: 13px; line-height: 1.15; }
  [lang='en'] .primary-button { padding-inline: 10px; }
}
