:root {
  color-scheme: dark;
  --bg: #05070c;
  --panel: rgba(10, 15, 25, .88);
  --ink: #f8fafc;
  --muted: #98a6ba;
  --accent: #48e4f1;
  --gold: #f7b955;
  --green: #34d399;
  --line: 1px solid rgba(203, 213, 225, .18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100svh; color: var(--ink);
  background: radial-gradient(circle at 15% 20%, #48e4f119, transparent 30%), radial-gradient(circle at 86% 36%, #f7b95514, transparent 34%), linear-gradient(135deg, #04070d, #08111c 47%, #120d10);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", Arial, sans-serif;
  overflow-x: hidden;
}
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: repeating-linear-gradient(90deg, #ffffff03 0 1px, transparent 1px 100px); }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, a, select { transition: background .18s, border-color .18s, color .18s; }
button:disabled { cursor: default; opacity: .45; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: var(--accent); text-underline-offset: 4px; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 40; background: var(--panel); padding: 10px; }
.skip-link:focus { top: 10px; }
.site-header { max-width: 1240px; padding: 28px 32px 0; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.logo-mark { display: grid; place-items: center; width: 56px; height: 56px; background: linear-gradient(135deg, var(--accent), var(--gold)); color: #07101c; border-radius: 16px; font: italic 900 40px Georgia, serif; box-shadow: 0 12px 32px #48e4f125; }
.logo-text { display: grid; font-size: 19px; font-weight: 850; line-height: 1.4; }
.logo-text small { color: var(--muted); font: 11px/1.4 ui-monospace, monospace; letter-spacing: .12em; }
.site-nav { display: flex; gap: 4px; padding: 5px; background: #05080e99; border: var(--line); border-radius: 16px; }
.site-nav a { display: flex; align-items: center; min-height: 40px; padding: 0 14px; color: #cbd5e1; font-size: 14px; text-decoration: none; border-radius: 11px; white-space: nowrap; }
.site-nav a:hover, .site-nav .is-active { background: #48e4f118; color: var(--accent); }
.game-toolbar { max-width: 1060px; display: flex; align-items: center; justify-content: space-between; padding: 38px 32px 0; margin: auto; }
.brand { padding: 0; border: 0; background: none; font-size: 13px; font-weight: 750; color: #cbd5e1; }
.brand span { margin-left: 12px; color: var(--muted); font: 10px ui-monospace, monospace; letter-spacing: .16em; }
.game-toolbar nav { display: flex; gap: 10px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; background: #ffffff06; border: var(--line); border-radius: 12px; font-size: 21px; }
.icon-button:hover { border-color: var(--accent); background: #48e4f111; }
.icon-button[aria-pressed=true] { color: var(--gold); }
.icon-button.small { width: 36px; height: 36px; font-size: 18px; }
main { max-width: 1060px; margin: auto; padding: 40px 32px 64px; }
main:focus { outline: none; }
.home { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 70px; }
.eyebrow { display: inline-block; color: var(--accent); font: 11px/1.6 ui-monospace, monospace; letter-spacing: .16em; }
h1 { font-size: clamp(36px, 4vw, 50px); line-height: 1.3; letter-spacing: -.04em; margin: 20px 0 16px; font-weight: 850; }
h1 span { color: var(--accent); }
.intro { color: var(--muted); font-size: 14px; line-height: 1.9; }
.home-monkey { height: 272px; position: relative; max-width: 370px; margin-top: 18px; }
.home-monkey::before { content: ''; position: absolute; inset: 15% 10% 0; border-radius: 50%; background: radial-gradient(ellipse, #f7b95520, transparent 70%); }
.home-monkey img { position: absolute; left: 28px; top: -5px; width: 290px; height: 290px; object-fit: contain; animation: bob 4s ease-in-out infinite; }
.floating-char { position: absolute; display: grid; place-items: center; width: 46px; height: 48px; border: 1px solid #f7b95566; background: #29231b; color: var(--gold); border-radius: 12px; font: 800 28px Arial, sans-serif; }
.char-one { left: 8px; top: 62px; transform: rotate(-12deg); }
.char-two { right: 8px; top: 34px; transform: rotate(12deg); color: var(--accent); background: #11262d; border-color: #48e4f166; }
.monkey-bubble { position: absolute; bottom: 2px; left: 60px; border: var(--line); background: #111b27; border-radius: 18px; padding: 7px 15px; font-size: 12px; }
.record { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.record>span { color: var(--gold); font-size: 32px; }
.record strong { display: block; font-size: 13px; }
.record small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.setup-card { padding: 28px; border: var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 24px 80px #00000020; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.section-heading>span { color: var(--gold); font-size: 12px; white-space: nowrap; }
.topic-field { display: flex; align-items: center; gap: 16px; }
.topic-field label { color: #cbd5e1; font-size: 12px; white-space: nowrap; }
.topic-field select { width: 100%; min-height: 42px; background: #121c29; border: var(--line); padding: 8px 30px 8px 12px; border-radius: 10px; font-size: 13px; }
.audience-note { color: var(--muted); font-size: 11px; margin: 8px 0 22px; }
.levels { display: grid; gap: 11px; }
.level { display: flex; align-items: center; gap: 12px; padding: 15px 12px; text-align: left; border: var(--line); border-radius: 13px; background: #ffffff03; }
.level:hover { background: #ffffff08; }
.level.selected { border-color: #48e4f17a; background: #48e4f110; }
.level strong { display: block; font-size: 15px; }
.level small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.level-icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 42px; background: #48e4f115; color: var(--accent); border-radius: 10px; font-size: 18px; }
.level:nth-child(2) .level-icon { background: #f7b95515; color: var(--gold); }
.level:nth-child(3) .level-icon { background: #34d39915; color: var(--green); }
.level i { margin-left: auto; flex-shrink: 0; width: 15px; height: 15px; border: 1px solid #526077; border-radius: 50%; }
.level.selected i { background: var(--accent); border: 4px solid #243b47; box-shadow: 0 0 0 1px var(--accent); }
.primary { width: 100%; display: flex; justify-content: center; align-items: center; gap: 16px; min-height: 48px; border: 0; padding: 12px 16px; background: var(--accent); border-radius: 12px; color: #07101c; font-size: 15px; font-weight: 850; }
.primary:hover:not(:disabled) { background: #87eef7; }
.setup-card>.primary { margin-top: 24px; }
.review-button { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 9px 12px; margin-top: 12px; border: var(--line); border-radius: 11px; background: transparent; font-size: 13px; }
.review-button:hover:not(:disabled) { border-color: var(--gold); background: #f7b9550d; }
.review-button span { min-width: 24px; padding: 0 7px; border-radius: 7px; background: #f7b95520; color: var(--gold); }
.sound-note { color: var(--muted); text-align: center; font-size: 11px; margin: 16px 0 0; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; max-width: 996px; padding: 22px 0; margin: 0 auto; border-top: var(--line); color: var(--muted); font-size: 12px; }
footer a { text-decoration: none; }
footer small { width: 100%; font-size: 11px; }
.game-active footer { display: none; }
.game-active .game-toolbar { padding-top: 20px; }
.game-active main { padding-top: 20px; padding-bottom: 40px; }
.game { max-width: 590px; margin: auto; }
.game-nav, .hud, .question-label, .game-actions, .learn-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-nav { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.text-button { min-height: 36px; padding: 5px 0; background: none; border: 0; color: #cbd5e1; font-size: 13px; }
.text-button:hover { color: var(--accent); }
.hud { font-size: 11px; }
.hud>span { border: var(--line); padding: 4px 12px; border-radius: 10px; background: #ffffff04; }
.hud b { font-size: 16px; color: var(--ink); }
.hud .flower-count { color: var(--gold); border-color: #f7b95544; background: #f7b95510; }
.progress { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.progress i { flex: 1; max-width: 44px; height: 4px; border-radius: 4px; background: #273244; }
.progress i.current { background: var(--gold); }
.progress i.done { background: var(--accent); }
.game-stage { height: 155px; position: relative; }
.sunburst { position: absolute; inset: 10px 70px 0; background: radial-gradient(ellipse at center bottom, #f7b95521, transparent 70%); }
.speech { position: absolute; top: 64px; left: 0; max-width: 140px; padding: 8px 12px; background: #15202c; border: var(--line); border-radius: 12px; text-align: center; font-size: 11px; }
.streak { position: absolute; right: 7px; top: 54px; width: 115px; text-align: center; }
.streak small { display: block; font-size: 11px; color: var(--muted); }
.streak b { display: block; font-size: 28px; line-height: 1.3; color: var(--gold); }
.streak>span { font-size: 10px; color: var(--muted); }
.stage-floor { position: absolute; bottom: 0; height: 8px; width: 100%; border-top: 1px solid #f7b95522; border-radius: 50%; }
.question-card { position: relative; padding: 18px 20px 14px; background: var(--panel); border: var(--line); border-radius: 20px; text-align: center; }
.question-label { color: var(--muted); font-size: 11px; }
.question-label>span:first-child { background: #48e4f110; color: var(--accent); border-radius: 6px; padding: 3px 8px; }
.word-clue { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 14px 0 10px; }
.word-clue>span { font-size: 38px; }
.word-clue>div { text-align: left; }
#clue-topic { font-size: 11px; color: var(--muted); }
.meaning { font-size: 21px; font-weight: 750; margin: 0; }
.listen-button { min-height: 36px; padding: 5px 14px; border: 1px solid #48e4f144; background: #48e4f10c; color: var(--accent); border-radius: 10px; font-size: 12px; font-weight: 700; }
.listen-button:hover:not(:disabled) { background: #48e4f11c; }
.listen-button.secondary { color: var(--gold); border-color: #f7b95544; background: #f7b9550c; }
.voice-status { min-height: 17px; margin: 7px 0 12px; color: var(--muted); font-size: 11px; }
.slots { display: flex; justify-content: center; gap: 6px; }
.slot { position: relative; flex: 0 1 52px; min-width: 0; height: 56px; display: grid; place-items: center; font: 800 30px/1 Arial, sans-serif; border: 1px solid #48e4f155; border-radius: 10px; background: #48e4f111; }
.slot.fixed { background: #ffffff04; border-color: #ffffff0f; color: var(--muted); }
.slot.empty { background: #ffffff02; border: 1px dashed #526078; }
.slot.empty::after { content: '?'; font-size: 21px; color: #61718a; }
.slot.active { border-color: var(--gold); background: #f7b95512; }
.slot.ok { color: var(--green); background: #34d39915; border-color: #34d39966; }
.slot.pending { color: transparent; }
.slot.pending::after { content: '·'; color: var(--muted); position: absolute; }
.feedback { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.question-card.wrong { border-color: #fb71856b; }
.question-card.wrong .feedback { color: #fda4af; }
.question-card.complete { border-color: #34d39966; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.tile { position: relative; height: 58px; border: 1px solid #48e4f144; background: #10232d; border-radius: 12px; font: 800 30px/1 Arial, sans-serif; box-shadow: 0 3px 0 #00000030; }
.tile:nth-child(3n+2) { background: #282319; border-color: #f7b95544; }
.tile:nth-child(3n+3) { background: #14271f; border-color: #34d39944; }
.tile:hover:not(:disabled) { background: #1c3c49; border-color: var(--accent); }
.tile kbd { position: absolute; top: 5px; left: 8px; font: 10px/1.2 ui-monospace, monospace; color: var(--muted); }
.tile.used { background: #0e1621; border-color: #273244; opacity: 1; }
.tile.used .char, .tile.grabbed .char { visibility: hidden; }
.tile.used::after { content: '✓'; color: #547167; font-size: 19px; }
.tile.reserved:not(.used) { opacity: .7; }
.tile.hinted { outline: 2px solid var(--gold); outline-offset: 3px; }
.game-actions { margin-top: 12px; }
.hint-button { color: var(--gold); font-size: 12px; }
.keyboard-note { color: var(--muted); font-size: 10px; }
.learning { margin-top: 18px; padding: 20px; border: 1px solid #34d39944; border-radius: 16px; background: #0e1a20; }
.learn-top strong { font: 800 28px/1.3 Arial, sans-serif; letter-spacing: .02em; }
.learn-top>span { color: var(--green); font-size: 11px; background: #34d39912; border-radius: 6px; padding: 4px 8px; }
.learning p { font-size: 14px; margin: 10px 0; }
.learning .listen-button { margin-top: 10px; }
.example { display: flex; align-items: flex-start; gap: 10px; }
.example>span:first-child { flex-shrink: 0; color: var(--muted); font-size: 11px; border: var(--line); border-radius: 5px; padding: 2px 5px; }
.example [lang=en] { font-size: 17px; line-height: 1.6; }
.learning .example-zh { color: var(--muted); font-size: 12px; margin-left: 50px; }
.learning .primary { margin-top: 18px; }
.site-word-link { display: block; padding: 10px 0 0; font-size: 12px; text-decoration: none; }
.source-link { display: block; color: var(--muted); font-size: 11px; margin-top: 10px; text-align: right; }
.results { text-align: center; max-width: 540px; margin: auto; }
.result-monkey { display: block; object-fit: contain; width: 170px; height: 170px; margin: 12px auto 0; }
.results h1 { font-size: 32px; margin: 0 0 14px; }
.results>p { color: var(--muted); font-size: 13px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 22px 10px; margin: 24px 0; border: var(--line); border-radius: 18px; background: var(--panel); }
.result-stats b { display: block; font-size: 32px; color: var(--accent); line-height: 1.4; }
.result-stats span { color: var(--muted); font-size: 12px; }
.round-review { text-align: left; font-size: 13px; margin: 20px 0; }
.review-words { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.review-word { border: 1px solid #f7b95533; background: #f7b9550c; padding: 4px 10px; border-radius: 7px; color: #ebc998; font-size: 12px; }
.results>.text-button { margin-top: 15px; }
.results .local-note { font-size: 11px; }
dialog { border: var(--line); border-radius: 20px; background: #101925; color: var(--ink); width: calc(100% - 36px); max-width: 460px; max-height: 85svh; overflow: auto; padding: 28px; box-shadow: 0 28px 90px #0009; }
dialog::backdrop { background: #02050bd9; }
dialog h2 { font-size: 21px; margin: 0; }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.8; }
dialog ol { font-size: 13px; padding-left: 20px; line-height: 2.2; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.credits { font-size: 11px; border-top: var(--line); padding-top: 14px; }
.pause-symbol { color: var(--gold); font-size: 44px; }
#pause-dialog, #exit-dialog { text-align: center; }
#pause-dialog .primary, #exit-dialog .primary { margin: 24px 0 10px; }
#buddy-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; overflow: visible; pointer-events: none; z-index: 16; display: none; }
#celebration { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 20; }
.confetto { position: absolute; font-size: 23px; animation: fall .95s ease-out both; }
.shake { animation: shake .3s ease-in-out; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes fall { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--dx), 100px) rotate(150deg); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (max-width: 900px) {
  .site-header { gap: 16px; padding: 20px 24px 0; }
  .logo-text { font-size: 16px; }
  .logo-mark { width: 46px; height: 46px; font-size: 34px; }
  .site-nav a { padding: 0 10px; font-size: 13px; }
  .home { gap: 32px; }
  .setup-card { padding: 22px; }
  .home-monkey img { left: 5px; width: 255px; height: 255px; }
  .home-monkey { height: 250px; }
  .monkey-bubble { left: 24px; }
  footer { margin: 0 32px; }
}
@media (max-width: 680px) {
  .site-header { flex-direction: column; align-items: flex-start; padding: 18px 18px 0; gap: 16px; }
  .site-logo { gap: 10px; }
  .logo-text { font-size: 18px; }
  .site-nav { max-width: 100%; overflow-x: auto; width: 100%; justify-content: space-between; border-radius: 12px; }
  .site-nav a { padding: 0 10px; min-height: 38px; font-size: 12px; }
  .game-toolbar { padding: 22px 20px 0; }
  .brand span { font-size: 9px; margin-left: 7px; }
  .icon-button { width: 36px; height: 36px; }
  main { padding: 25px 20px 40px; }
  .home { display: block; max-width: 460px; margin: auto; }
  .welcome { position: relative; padding-bottom: 14px; }
  h1 { font-size: 36px; max-width: 100%; margin-top: 14px; }
  .eyebrow { font-size: 10px; }
  .intro { font-size: 12px; max-width: 205px; }
  .home-monkey { position: absolute; right: -4px; top: 126px; height: 160px; width: 145px; margin: 0; }
  .home-monkey img { width: 155px; height: 155px; left: -2px; top: -4px; }
  .char-one { top: 32px; left: -7px; }
  .char-two { top: 12px; right: -5px; }
  .floating-char { width: 28px; height: 31px; font-size: 20px; border-radius: 8px; }
  .monkey-bubble { font-size: 9px; left: 0; bottom: 0; padding: 4px 9px; white-space: nowrap; }
  .record { margin: 64px 0 16px; gap: 8px; max-width: 210px; min-height: 56px; }
  .record strong { font-size: 11px; }
  .record small { font-size: 11px; }
  .setup-card { padding: 22px; border-radius: 20px; }
  .section-heading h2 { font-size: 19px; }
  .level small { font-size: 11px; }
  .topic-field { gap: 10px; }
  footer { margin: 0 20px; }
  .game-active .site-header { padding-top: 12px; gap: 10px; }
  .game-active .site-logo .logo-mark { width: 35px; height: 35px; border-radius: 10px; font-size: 27px; }
  .game-active .site-logo .logo-text { font-size: 15px; }
  .game-active .logo-text small { display: none; }
  .game-active .game-toolbar { padding: 14px 16px 0; }
  .game-active main { padding: 12px 16px 24px; }
  .game-nav { margin-bottom: 8px; }
  .hud { gap: 5px; font-size: 10px; }
  .hud>span { padding: 3px 8px; }
  .hud b { font-size: 14px; }
  .progress { margin-top: 10px; }
  .game-stage { height: 112px; }
  .speech { top: 43px; max-width: 100px; font-size: 10px; padding: 6px 8px; }
  .streak { width: 88px; right: 0; top: 36px; }
  .streak small, .streak>span { font-size: 9px; }
  .streak b { font-size: 24px; }
  .question-card { padding: 13px 12px 12px; border-radius: 16px; }
  .question-label { font-size: 10px; }
  .word-clue { margin: 10px 0 7px; gap: 10px; }
  .word-clue>span { font-size: 32px; }
  .meaning { font-size: 18px; }
  .voice-status { font-size: 10px; }
  .slots { gap: 4px; }
  .slot { flex-basis: 45px; height: 46px; font-size: 25px; border-radius: 8px; }
  .slot.empty::after { font-size: 18px; }
  .tiles { margin-top: 14px; gap: 8px; }
  .tile { height: 50px; font-size: 27px; border-radius: 10px; }
  .feedback { font-size: 10px; }
  .keyboard-note { font-size: 9px; }
  .learning { padding: 16px; }
  .learn-top strong { font-size: 25px; }
  .learn-top>span { font-size: 10px; }
  .example [lang=en] { font-size: 15px; }
}
@media (max-width: 360px) {
  .site-nav a { padding: 0 7px; font-size: 11px; }
  .setup-card { padding: 18px; }
  .topic-field { flex-direction: column; align-items: stretch; gap: 6px; }
  .slot { height: 40px; font-size: 22px; }
  .speech { max-width: 90px; font-size: 9px; }
  .streak { width: 80px; }
  .keyboard-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
