@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #f3f5f1;
  --surface: #ffffff;
  --ink: #18221d;
  --muted: #68736d;
  --line: #dfe5df;
  --forest: #173e32;
  --forest-2: #245744;
  --lime: #d5f276;
  --lime-dark: #b9de55;
  --mint: #e9f2ea;
  --lavender: #eff0fb;
  --peach: #fff0e9;
  --yellow: #fff6d9;
  --red: #a54332;
  --font: "DM Sans", system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --han: "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --radius: 16px;
  --shadow: 0 12px 28px rgba(21, 50, 37, 0.06);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #6d9a7d;
  outline-offset: 3px;
}
button:disabled { cursor: default; }
.app-shell { min-height: 100vh; padding-bottom: 48px; }
.hidden { display: none !important; }

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.76);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; background: var(--lime); color: var(--forest);
  font: 700 22px var(--han);
}
.brand-name b, .brand-name small { display: block; }
.brand-name b { font-size: 14px; letter-spacing: -.02em; }
.brand-name small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.install-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--forest); border-radius: 10px; background: var(--forest); color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; }
.install-button[hidden] { display: none; }
.install-compact-label { display: none; }
.xp-pill {
  height: 36px; display: flex; align-items: center; gap: 5px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #f8fbe9; font-size: 12px;
}
.xp-pill b { font-size: 14px; }
.xp-pill small { color: var(--muted); font-size: 11px; font-weight: 700; }
.icon-button {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle.muted::after { content: ""; position: absolute; width: 25px; height: 2px; transform: rotate(-45deg); border-radius: 2px; background: currentColor; }

.home-screen, .play-screen { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.home-screen { padding: 30px 0 34px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--forest-2); font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.welcome-row h1 { margin: 0; font-size: clamp(25px, 2.8vw, 32px); line-height: 1.08; letter-spacing: -.055em; }
.welcome-copy { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.mobile-break { display: none; }
.streak-chip { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.streak-spark { color: var(--forest-2); font: 700 20px var(--han); }
.streak-chip b, .streak-chip small { display: block; }
.streak-chip b { font-size: 14px; line-height: 1; }
.streak-chip small { margin-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.review-panel { display: grid; grid-template-columns: minmax(255px,.82fr) minmax(0,1.18fr); gap: 25px; padding: 22px 24px; border: 1px solid #d9e5d9; border-radius: 17px; background: var(--mint); }
.review-lead { display: flex; flex-direction: column; align-items: flex-start; }
.review-scope { margin: 0 0 8px; color: var(--forest-2); font-size: 12px; font-weight: 700; }
.review-lead h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.035em; }
.review-lead h2 span { display: block; margin-bottom: 3px; color: var(--forest); font-size: 39px; line-height: 1; font-variant-numeric: tabular-nums; }
.review-summary { max-width: 315px; min-height: 38px; margin: 8px 0 0; color: #506259; font-size: 13px; line-height: 1.5; }
.banner-button {
  min-height: 42px; display: inline-flex; align-items: center; gap: 22px; margin-top: 13px; padding: 0 14px;
  border: 0; border-radius: 9px; background: var(--forest); color: #fff; font-size: 12px; font-weight: 800;
  transition: background .15s, transform .15s;
}
.banner-button:hover { transform: translateY(-1px); background: var(--forest-2); }
.review-next { min-height: 17px; margin: 7px 0 0; color: #56665d; font-size: 11px; }
.review-suggestions { min-width: 0; padding-left: 22px; border-left: 1px solid #d2dfd2; }
.review-suggestions h3 { margin: 1px 0 8px; font-size: 14px; letter-spacing: -.015em; }
.review-disclosure { border-top: 1px solid rgba(33,72,50,.11); }
.review-disclosure summary { width: fit-content; min-height: 40px; display: flex; align-items: center; color: var(--forest-2); font-size: 12px; font-weight: 700; cursor: pointer; }
.review-disclosure[open] summary { margin-bottom: 2px; }
.due-word { min-height: 53px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 6px 0; border-top: 1px solid rgba(33,72,50,.11); }
.due-word-audio { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid #ccdbcd; border-radius: 8px; background: #f7faf5; color: var(--forest); }
.due-word-audio svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.due-word-detail { min-width: 0; display: grid; gap: 2px; }
.due-word-detail b { color: var(--forest); font: 18px/1.15 var(--han); }
.due-word-detail span { display: -webkit-box; overflow: hidden; color: #46574c; font-size: 11px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.due-word-state { color: #647168; font-size: 10px; white-space: nowrap; }
.review-empty { margin: 0; padding: 10px 0; color: #56665d; font-size: 12px; }
.review-schedule { margin: 7px 0 0; color: #59665e; font-size: 12px; line-height: 1.45; }

.game-hub { margin: 27px 0 29px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.deck-picker { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.deck-picker select { max-width: 195px; height: 37px; padding: 0 28px 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; font-weight: 700; }
.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-top: 13px; }
.game-card {
  min-height: 154px; display: flex; flex-direction: column; align-items: flex-start; padding: 14px 15px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-2px); border-color: #bfd0c3; box-shadow: var(--shadow); }
.game-icon { width: 24px; height: 24px; display: grid; place-items: center; color: var(--forest-2); }
.game-match .game-icon, .game-look .game-icon, .game-tone .game-icon, .game-flip .game-icon, .game-sentence .game-icon, .game-speak .game-icon { background: transparent; color: var(--forest-2); }
.game-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.han-icon, .sentence-icon { font: 700 19px var(--han); }
.tone-icon { font: 700 19px var(--font); }
.write-icon, .listen-meaning-icon { font: 700 19px var(--han); }
.speak-icon { font: 700 20px var(--han); }
.game-name { margin-top: 10px; font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.game-desc { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.game-play { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 9px; color: var(--forest-2); font-size: 11px; font-weight: 800; }
.game-play i { font-size: 16px; font-style: normal; }
.invader-launch { width: 100%; min-height: 83px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 13px; margin-top: 11px; padding: 12px 16px; border: 1px solid #cbd9c7; border-radius: 13px; background: #f1f5eb; color: var(--ink); text-align: left; transition: border-color .15s, transform .15s, box-shadow .15s; }
.invader-launch:hover { transform: translateY(-1px); border-color: #9db49f; box-shadow: 0 8px 20px rgba(21,50,37,.07); }
.invader-launch-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--forest); color: #eef4dc; font: 24px/1 var(--han); }
.invader-launch-copy b, .invader-launch-copy small { display: block; }
.invader-launch-copy b { font-size: 14px; font-weight: 800; }
.invader-launch-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.invader-launch-cta { display: inline-flex; align-items: center; gap: 10px; color: var(--forest-2); font-size: 12px; font-weight: 800; white-space: nowrap; }
.invader-launch-cta i { font-size: 17px; font-style: normal; }
.offline-audio { margin-top: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.offline-audio > summary { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 15px; cursor: pointer; list-style: none; }
.offline-audio > summary::-webkit-details-marker { display: none; }
.offline-audio > summary span:first-child { display: grid; gap: 3px; }
.offline-audio > summary b { font-size: 13px; }
.offline-audio > summary small { color: var(--muted); font-size: 12px; }
.audio-voice-setting { margin: 0 12px 9px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0,1fr) minmax(130px,220px); align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf6; }
.audio-voice-setting span { display: grid; gap: 3px; }
.audio-voice-setting b { font-size: 12px; }
.audio-voice-setting small { color: var(--muted); font-size: 11px; }
.audio-voice-setting select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: white; font: inherit; font-size: 12px; font-weight: 700; }
.offline-chevron { color: var(--forest-2); font-size: 20px; transition: transform .15s; }
.offline-audio[open] .offline-chevron { transform: rotate(180deg); }
.offline-note { margin: 0 15px 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.offline-pack-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 0 12px 10px; }
.offline-pack { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.offline-pack > span { min-width: 0; display: grid; gap: 3px; }
.offline-pack b { font-size: 12px; }
.offline-pack small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.offline-pack progress { width: 100%; height: 5px; grid-column: 1 / -1; accent-color: var(--forest-2); }
.offline-pack-action { min-width: 56px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8faf6; color: var(--forest); font-size: 12px; font-weight: 800; }
.offline-pack-action:disabled { opacity: .65; }
.offline-live { min-height: 18px; margin: 0; padding: 0 14px 10px; color: var(--muted); font-size: 11px; }

.vocab-section { padding: 19px 20px 21px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.word-count { padding: 5px 9px; border-radius: 999px; background: var(--mint); color: var(--forest-2); font-size: 11px; font-weight: 800; }
.vocab-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 13px 0; }
.search-box { width: min(100%, 330px); height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.search-box svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; height: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #858d88; }
.set-filters { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.set-filters::-webkit-scrollbar { display: none; }
.filter-chip { min-height: 33px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #536059; font-size: 11px; font-weight: 700; white-space: nowrap; }
.filter-chip.active { border-color: var(--forest); background: var(--forest); color: white; }
.word-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.vocab-load-more { grid-column: 1 / -1; justify-self: center; margin: 12px auto; }
.word-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: transform .14s, border-color .14s, box-shadow .14s; }
.word-card:nth-child(4n+1) { background: #fbfcf6; }
.word-card:nth-child(4n+2) { background: #f8f9fd; }
.word-card:nth-child(4n+3) { background: #f5faf7; }
.word-card:nth-child(4n) { background: #f8faf6; }
.word-card:hover { transform: translateY(-2px); border-color: #b9c9bd; box-shadow: 0 8px 20px rgba(21,50,37,.06); }
.word-listen { width: 100%; display: block; padding: 11px 12px 10px; border: 0; background: transparent; text-align: left; }
.word-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.word-hanzi { color: var(--ink); font: 38px/1.05 var(--han); letter-spacing: .015em; }
.word-audio-mark { width: 28px; height: 28px; display: grid; place-items: center; color: var(--forest-2); }
.word-audio-mark svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.word-listen:active .word-audio-mark { transform: scale(.92); }
.word-pinyin { display: block; margin: 7px 0 1px; color: var(--forest-2); font-size: 13px; font-weight: 800; }
.word-meaning { display: block; min-height: 18px; color: #58645d; font-size: 13px; line-height: 1.4; }
.word-card-foot { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px; padding: 7px 10px; border-top: 1px solid rgba(24,34,29,.08); }
.word-set-tag { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.word-status { color: #52725d; font-size: 11px; font-weight: 700; }
.card-practice { grid-column: 1 / -1; width: 100%; min-height: 32px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.75); color: var(--ink); font-size: 11px; font-weight: 700; white-space: nowrap; }
.card-practice:hover { border-color: #b9c9bd; background: var(--mint); }
.empty-words { grid-column: 1 / -1; padding: 30px 12px; color: var(--muted); text-align: center; }
.home-footer { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.home-footer span { color: var(--ink); font-weight: 800; }
.home-footer i { color: #9aa39d; font-style: normal; }

.play-screen { padding: 22px 0 38px; }
.play-top { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 12px; }
.back-button { min-height: 39px; display: flex; align-items: center; justify-self: start; gap: 7px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; font-weight: 700; }
.chapter-hanzi { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--lime); color: var(--forest); font: 17px var(--han); }
.play-chapter { display: flex; align-items: center; gap: 9px; }
.play-chapter b, .play-chapter small { display: block; }
.play-chapter b { font-size: 12px; }
.play-chapter small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.play-counter { justify-self: end; color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.round-track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 13px 0 16px; }
.track-segment { height: 5px; border-radius: 99px; background: #dfe5df; }
.track-segment.done { background: var(--forest-2); }
.track-segment.active { height: 7px; margin-top: -1px; background: var(--lime); }
.track-segment.retry { outline: 1px solid #bdb5d8; outline-offset: 2px; }
.run-scoreboard { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin: -6px 0 13px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.run-scoreboard span { display: inline-flex; align-items: baseline; gap: 5px; }
.run-scoreboard b { color: var(--ink); font-size: 14px; }
.run-scoreboard .run-combo { color: var(--forest-2); }
.run-scoreboard .run-combo b { color: var(--forest-2); }
.retry-note { margin: 0 0 8px; color: #655986; font-size: 12px; font-weight: 800; }
.question-layout { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: 13px; align-items: stretch; }
.question-card { min-height: 440px; display: flex; flex-direction: column; align-items: center; padding: 29px clamp(18px, 4vw, 44px) 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); text-align: center; animation: cardIn .2s ease both; }
.question-card:has(.speaking-hanzi) { justify-content: flex-start; }
.speaking-hanzi { margin: 16px 0 0; color: var(--forest); font: 400 clamp(64px, 10vw, 92px)/1.08 var(--han); }
.speaking-meaning { margin: 8px 0 17px; color: var(--muted); font-size: 15px; }
.speaking-actions { width: min(100%, 440px); display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.speaking-actions .voice-picker { grid-column: 1 / -1; }
.voice-picker { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.voice-picker select { min-width: 150px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.speaking-reference, .speaking-record { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--forest); font-size: 14px; font-weight: 800; }
.speaking-local-score { grid-column: 1 / -1; min-height: 48px; padding: 9px 13px; border: 1px solid #c4d8cb; border-radius: 12px; background: #edf5ef; color: var(--forest); font-size: 13px; font-weight: 800; }
.speaking-local-score:disabled { opacity: .55; }
.speaking-score-trigger { grid-column: 1 / -1; min-height: 48px; border: 1px solid #d5a33d; border-radius: 12px; background: #fff8e7; color: #714b08; font-size: 13px; font-weight: 800; }
.speaking-score-trigger:disabled { opacity: .55; }
.speaking-record { border-color: var(--forest); background: var(--forest); color: white; }
.speaking-record span { color: #ffb3a8; font-size: 13px; }
.speaking-record[aria-pressed="true"] { background: #9c342c; border-color: #9c342c; }
.speaking-record:disabled { opacity: .6; }
.speaking-status { min-height: 22px; margin: 13px 0 7px; color: var(--muted); font-size: 13px; }
.speaking-playback { width: min(100%, 380px); height: 40px; margin: 4px 0 8px; }
.speaking-playback[hidden], .speaking-answer[hidden], .speaking-ratings[hidden] { display: none; }
.speaking-answer { display: grid; gap: 3px; margin: 5px 0 8px; }
.speaking-answer b { color: var(--forest); font-size: 18px; }
.speaking-answer span { color: var(--muted); font-size: 12px; }
.speaking-ratings { width: min(100%, 450px); display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-top: 5px; }
.speaking-ratings p { grid-column: 1 / -1; margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.speaking-ratings button { min-height: 42px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8f4; color: var(--ink); font-size: 12px; font-weight: 700; }
.speaking-ratings button:last-child { border-color: #c5d6c8; background: #edf4ed; color: var(--forest); }
.speaking-ratings button:disabled { opacity: .6; }
.speaking-disclaimer { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.speech-score-result { width: min(100%, 450px); margin: 6px 0 7px; padding: 13px; border: 1px solid #e7d7ae; border-radius: 13px; background: #fffaf0; text-align: left; }
.speech-score-result[hidden] { display: none; }
.speech-score-result.local-tone-result { border-color: #c9dccb; background: #f4f8f2; }
.local-tone-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--forest); font-size: 12px; }
.local-tone-heading b { font-size: 11px; letter-spacing: .035em; }
.local-tone-heading span { padding: 4px 8px; border-radius: 99px; background: #e5efe3; font-weight: 800; white-space: nowrap; }
.tone-contour { width: 100%; height: 96px; display: block; margin: 8px 0 1px; overflow: visible; }
.tone-guide { fill: none; stroke: #d9e2d8; stroke-width: 1; }
.tone-target, .tone-user { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tone-target { stroke: #9aab9b; stroke-width: 2.5; stroke-dasharray: 4 4; }
.tone-user { stroke: #24714e; stroke-width: 3.5; }
.tone-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 10px; }
.tone-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tone-legend i { width: 14px; height: 3px; display: inline-block; border-radius: 9px; background: #24714e; }
.tone-legend .tone-legend-target { height: 0; border-top: 2px dashed #9aab9b; background: transparent; }
.score-provider { margin: 0 0 9px; color: #88651e; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.speech-score-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.speech-score-metrics span { min-width: 0; display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 9px; background: #fff; }
.speech-score-metrics b { color: var(--forest); font-size: 21px; line-height: 1; }
.speech-score-metrics small { color: var(--muted); font-size: 10px; text-align: center; }
.speech-score-note { margin: 8px 0 0; color: #5e5b51; font-size: 11px; line-height: 1.4; }
.question-card:has(.invader-arena) { min-height: 590px; }
.question-type { margin: 0; color: var(--forest-2); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.question-title { max-width: 560px; margin: 9px 0 5px; font-size: 24px; line-height: 1.22; letter-spacing: -.035em; }
.question-subtitle { max-width: 500px; margin: 0 0 15px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.listen-prompt { width: 90px; height: 90px; display: grid; place-items: center; margin: 2px 0 9px; border: 0; border-radius: 50%; background: var(--lime); color: var(--forest); transition: transform .14s; }
.listen-prompt:hover { transform: scale(1.04); }
.listen-prompt svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.audio-replay { min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 700; }
.audio-caption { margin: 6px 0 10px; color: var(--muted); font-size: 11px; }
.hanzi-prompt { margin: 5px 0; color: var(--ink); font: 56px/1.15 var(--han); }
.tone-prompt { margin: 7px 0 14px; color: var(--forest-2); font-size: 30px; font-weight: 800; }
.meaning-prompt { max-width: 760px; margin: 6px 0 15px; font-size: clamp(17px,1.5vw,20px); font-weight: 650; line-height: 1.45; }
.write-meaning { max-width: 680px; margin: 6px 0 12px; color: var(--ink); font-size: 19px; font-weight: 700; line-height: 1.4; }
.write-instructions { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.writing-board { width: min(100%, 820px); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0 10px; }
.write-cell { width: clamp(160px,25vw,195px); max-width: calc(50% - 5px); flex: 0 1 clamp(160px,25vw,195px); aspect-ratio: 1; overflow: hidden; border: 1px solid #dce5dc; border-radius: 12px; background: #fcfdfb; }
.write-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.write-tools { display: flex; justify-content: center; gap: 9px; }
.write-clear, .write-reveal-button, .write-ratings button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; font-weight: 800; }
.write-reveal-button, .write-ratings .write-known { border-color: var(--forest); background: var(--forest); color: #fff; }
.write-answer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 8px; margin-top: 12px; padding: 11px 15px; border-radius: 10px; background: #edf4e9; }
.write-answer b { color: var(--forest); font: 29px/1.1 var(--han); }
.write-answer span { color: var(--forest-2); font-size: 14px; font-weight: 800; }
.write-answer small { color: #526057; font-size: 12px; }
.write-ratings { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 10px; }
.write-ratings p { width: 100%; margin: 0; color: var(--muted); font-size: 12px; }
.write-ratings .write-again { border-color: #e7c2b8; color: #873b2e; }
.choice-grid { width: 100%; max-width: 520px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 5px; }
.choice { position: relative; min-height: 56px; display: flex; align-items: center; justify-content: center; padding: 9px 27px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; transition: border-color .13s, background .13s, transform .13s; }
.choice-text { max-width: 100%; }
.choice.hanzi-choice .choice-text { font: 30px/1.1 var(--han); }
.choice-shortcut { position: absolute; top: 6px; left: 8px; color: #7d8981; font: 10px/1 var(--body); }
.keyboard-hint { margin: 7px 0 0; color: #8a948d; font-size: 11px; }
.choice:hover:not(:disabled) { transform: translateY(-1px); border-color: #a9c1ad; background: #f8fbf8; }
.choice.correct { border-color: #8cba83; background: #eaf5e5; color: #254c2d; }
.choice.wrong { border-color: #edc5b8; background: #fff0eb; color: var(--red); }
.choice:disabled { opacity: 1; }
.feedback { min-height: 34px; margin: 9px 0 0; color: var(--forest-2); font-size: 12px; line-height: 1.5; }
.feedback.bad { color: var(--red); }
.feedback strong { display: inline-block; margin-left: 3px; color: var(--forest); font-size: 13px; }
.retry-hint { color: #655986; font-weight: 700; }
.next-button { width: min(250px, 100%); min-height: 43px; margin-top: auto; padding: 0 16px; border: 0; border-radius: 9px; background: var(--forest); color: white; font-size: 13px; font-weight: 800; }
.next-shortcut { margin-left: 5px; color: rgba(255,255,255,.72); font: 10px var(--body); }
.next-button:hover { background: var(--forest-2); }
.type-form { width: 100%; max-width: 450px; margin-top: 8px; }
.pinyin-input { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-align: center; font-size: 18px; letter-spacing: .04em; }
.input-helper { margin: 8px 0 11px; color: var(--muted); font-size: 11px; }
.input-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.tone-form { max-width: 480px; }
.tone-compose { min-height: 54px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-bottom: 8px; padding: 8px 10px; border: 1px solid #dce5dc; border-radius: 10px; background: #f8faf6; }
.tone-compose-empty { color: #849087; font-size: 12px; }
.tone-syllable-chip { min-width: 43px; min-height: 37px; padding: 3px 8px; border: 1px solid #cbd9ce; border-radius: 8px; background: white; color: var(--forest); font-size: 19px; font-weight: 800; }
.tone-syllable-chip:hover:not(:disabled) { border-color: var(--forest-2); background: #eef5e9; }
.tone-syllable-gap { width: 3px; height: 3px; border-radius: 50%; background: #a9b5aa; }
.tone-syllable-row { position: relative; }
.tone-syllable-row .pinyin-input { text-align: left; padding-left: 32px; }
.tone-caret { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-52%); color: var(--forest-2); font-size: 22px; font-weight: 800; pointer-events: none; }
.tone-keyboard { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; margin: 9px 0 11px; }
.tone-key { min-height: 61px; display: grid; place-content: center; gap: 2px; padding: 4px 3px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--forest); transition: border-color .12s,background .12s,transform .12s; }
.tone-key b { font-size: 20px; line-height: 1; }
.tone-key small { color: var(--muted); font-size: 10px; font-weight: 700; }
.tone-key:hover:not(:disabled) { transform: translateY(-1px); border-color: #a8c0aa; background: var(--mint); }
.tone-key:disabled, .tone-syllable-chip:disabled { opacity: .58; }
.tone-neutral b { font-size: 18px; }
.tone-actions { margin-top: 4px; }
.invader-status { width: min(100%,760px); display: flex; align-items: center; justify-content: space-between; margin: 3px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.invader-status b { color: var(--ink); font-variant-numeric: tabular-nums; }
.invader-lives { color: #b34c3e; font-size: 13px; letter-spacing: .1em; }
.invader-lives b { color: #9d3f34; letter-spacing: 0; }
.invader-arena { position: relative; width: min(100%,760px); height: min(43vh,405px); min-height: 305px; overflow: hidden; border: 1px solid #263f37; border-radius: 14px; background: radial-gradient(ellipse at 50% 100%,rgba(82,126,90,.25),transparent 56%),linear-gradient(180deg,#142822 0%,#19352d 62%,#11251f 100%); box-shadow: inset 0 0 34px rgba(3,14,10,.28); }
.invader-stars { position: absolute; inset: 0; opacity: .52; background-image: radial-gradient(circle at 15% 23%,#d9eab4 0 1px,transparent 1.6px),radial-gradient(circle at 72% 18%,#a9c9a4 0 1px,transparent 1.6px),radial-gradient(circle at 45% 42%,#d4e0ba 0 1px,transparent 1.6px),radial-gradient(circle at 88% 57%,#9bb89c 0 1px,transparent 1.6px),radial-gradient(circle at 27% 66%,#bed1a9 0 1px,transparent 1.6px); background-size: 170px 150px,220px 190px,260px 210px,195px 225px,240px 175px; }
.invader-layer { position: absolute; inset: 0; }
.invader-target { position: absolute; z-index: 1; top: -62px; min-width: 48px; min-height: 48px; display: grid; place-items: center; padding: 3px 8px; border: 1px solid rgba(218,242,190,.72); border-radius: 13px; background: rgba(227,241,207,.96); color: #173c2c; box-shadow: 0 5px 18px rgba(0,0,0,.24),0 0 17px rgba(208,245,172,.25); font: 31px/1.1 var(--han); animation: invaderFall linear forwards; will-change: transform; }
.invader-target.invader-static { animation: none !important; transform: none !important; will-change: auto; }
.invader-target.prefix-match { border-color: #e4c860; background: #fff4be; box-shadow: 0 0 0 3px rgba(228,200,96,.3),0 0 22px rgba(244,220,117,.58); }
.invader-ground { position: absolute; z-index: 2; right: 0; bottom: 12px; left: 0; height: 2px; background: linear-gradient(90deg,transparent,#b5db91 20%,#d4e7ae 50%,#b5db91 80%,transparent); box-shadow: 0 0 14px rgba(199,236,158,.5); }
.invader-form { width: min(100%,760px); display: grid; grid-template-columns: minmax(0,1fr) 102px; gap: 8px; margin-top: 10px; }
.invader-form .pinyin-input { text-align: left; }
.invader-fire { min-height: 50px; letter-spacing: .04em; }
.invader-fire span { margin-left: 4px; font-size: 17px; }
.invader-tone-keys { width: min(100%,760px); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; margin-top: 7px; }
.invader-tone-keys button { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; background: #f8faf6; color: var(--forest); }
.invader-tone-keys b { font-size: 16px; }
.invader-tone-keys small { color: var(--muted); font-size: 11px; }
.invader-feedback { min-height: 22px; margin: 6px 0 0; color: var(--forest-2); font-size: 12px; line-height: 1.45; }
.invader-feedback.bad { color: var(--red); }
.submit-tone, .skip-tone { min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--forest); color: white; font-size: 12px; font-weight: 800; }
.skip-tone { background: white; color: var(--ink); }
.sentence-display { max-width: 100%; min-height: 48px; margin: 5px 0 4px; padding: 10px 14px; border-radius: 10px; background: var(--mint); color: var(--forest); font: 20px/1.5 var(--han); }
.sentence-translation { margin: 3px 0 11px; color: var(--muted); font-size: 12px; }
.hint-link { margin: 4px 0; padding: 5px 8px; border: 0; background: transparent; color: var(--forest-2); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.hint-link.hint-shown { max-width: 100%; color: var(--muted); font-weight: 500; text-decoration: none; }
.token-tray { width: 100%; min-height: 54px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 5px 0; }
.token { min-width: 50px; min-height: 43px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: 18px var(--han); }
.token.selected { background: var(--yellow); }
.play-aside { display: flex; flex-direction: column; align-items: flex-start; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--mint); }
.aside-caption { margin: 0 0 7px; color: var(--forest-2); font-size: 12px; font-weight: 700; }
.play-aside h2 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.play-aside > p:not(.aside-caption):not(.aside-progress) { margin: 7px 0 0; color: #526057; font-size: 12px; line-height: 1.5; }
.aside-rule { width: 100%; height: 1px; margin: 15px 0 10px; border-top: 1px solid rgba(24,34,29,.12); }
.aside-progress { margin: 0; color: #526057; font-size: 11px; }
.aside-progress span { color: var(--ink); font-weight: 900; }
.flash-reveal { min-height: 41px; margin: 9px 0; padding: 0 14px; border: 0; border-radius: 8px; background: var(--lime); font-size: 12px; font-weight: 800; }
.flash-answer { margin: 7px 0 9px; padding: 12px 18px; border-radius: 12px; background: var(--lavender); }
.flash-answer b, .flash-answer span { display: block; }
.flash-answer b { font: 24px var(--han); }
.flash-answer span { margin-top: 3px; color: var(--forest-2); font-size: 14px; font-weight: 800; }
.flash-answer small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.flash-ratings { display: flex; gap: 8px; justify-content: center; margin: 6px 0; }
.flash-ratings button { min-height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; font-weight: 800; }
.flash-ratings button:last-child { border-color: #d1e5c8; background: var(--mint); }
.result-stamp { width: 60px; height: 60px; display: grid; place-items: center; margin: 15px 0 6px; border-radius: 16px; background: var(--lime); color: var(--forest); font: 27px var(--han); }
.result-title { max-width: 440px; margin: 7px 0 8px; font-size: 24px; line-height: 1.2; letter-spacing: -.03em; }
.result-copy { max-width: 460px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.new-words { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 7px; margin: 14px 0; }
.new-words span { display: block; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-align: left; }
.new-words b, .new-words small { display: block; }
.new-words b { font: 19px var(--han); }
.new-words small { margin-top: 3px; color: var(--forest-2); font-size: 11px; font-weight: 800; }
.new-words em { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-style: normal; }
.result-xp { margin: 3px 0 12px; color: var(--forest-2); font-size: 13px; font-weight: 900; }
.result-score-grid { width: min(560px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0 2px; border-block: 1px solid var(--line); }
.result-score-grid > div { display: grid; gap: 3px; padding: 12px 8px; }
.result-score-grid > div + div { border-left: 1px solid var(--line); }
.result-score-grid b { color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; }
.result-score-grid small { color: var(--muted); font-size: 11px; }
.result-actions { width: min(520px, 100%); display: flex; justify-content: center; gap: 9px; margin-top: auto; }
.result-actions .next-button { margin-top: 0; }
.next-button.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 13px); padding: 10px 15px; border-radius: 9px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes invaderFall { from { transform: translateY(0); } to { transform: translateY(var(--fall-distance,480px)); } }

@media (max-width: 900px) {
  .home-screen, .play-screen { width: min(100% - 36px, 760px); }
  .word-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-layout { grid-template-columns: minmax(0, 1fr) 205px; }
  .question-card { padding-left: 22px; padding-right: 22px; }
  .invader-arena { height: min(42vh,390px); }
}

@media (max-width: 680px) {
  .app-shell { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .app-shell.is-playing { padding-bottom: 16px; }
  .topbar { height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 15px 0; }
  .brand-mark { width: 35px; height: 35px; font-size: 20px; }
  .brand-name small { display: none; }
  .brand-name b { font-size: 12px; }
  .brand-name b { font-size: 13px; }
  .brand-name small { font-size: 12px; }
  .topbar-tools { gap: 8px; }
  .icon-button { width: 44px; height: 44px; }
  .install-button { min-height: 44px; padding: 0 11px; font-size: 12px; }
  .install-button { min-width: 44px; padding: 0 8px; }
  .install-wide-label { display: none; }
  .install-compact-label { display: inline; }
  .home-screen, .play-screen { width: calc(100% - 32px); }
  .home-screen { padding: 20px 0 25px; }
  .welcome-row { align-items: center; gap: 7px; margin-bottom: 14px; }
  .welcome-row h1 { font-size: 25px; }
  .mobile-break { display: inline; }
  .welcome-copy { max-width: 220px; margin-top: 6px; font-size: 12px; line-height: 1.4; }
  .eyebrow { font-size: 12px; }
  .streak-chip { gap: 6px; padding: 7px 9px; }
  .streak-spark { font-size: 17px; }
  .streak-chip small { font-size: 12px; }
  .review-panel { grid-template-columns: 1fr; gap: 14px; padding: 16px; border-radius: 14px; }
  .review-lead h2 { font-size: 20px; }
  .review-lead h2 span { font-size: 34px; }
  .review-summary { max-width: 100%; min-height: 0; font-size: 12px; }
  .banner-button { min-height: 44px; margin-top: 11px; font-size: 12px; }
  .review-next { min-height: 0; margin-top: 7px; }
  .review-suggestions { padding: 12px 0 0; border-top: 1px solid #d2dfd2; border-left: 0; }
  .review-suggestions h3 { margin-bottom: 6px; }
  .review-disclosure summary { min-height: 38px; }
  .due-word { grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; }
  .review-schedule { font-size: 12px; }
  .review-next, .due-word-state { font-size: 12px; }
  .review-panel.review-panel-empty { gap: 8px; padding: 13px 15px; }
  .review-panel-empty .review-scope { margin-bottom: 4px; }
  .review-panel-empty .review-lead h2 { display: flex; align-items: baseline; gap: 6px; }
  .review-panel-empty .review-lead h2 span { display: inline; margin: 0; font-size: 28px; }
  .review-panel-empty .review-summary { margin-top: 2px; }
  .review-panel-empty .banner-button { min-height: 40px; margin-top: 8px; }
  .review-panel-empty .review-suggestions { display: none; }
  .game-hub { margin: 22px 0 23px; }
  .section-heading h2 { font-size: 20px; }
  .deck-picker { gap: 5px; font-size: 12px; }
  .deck-picker select { max-width: 146px; height: 44px; padding-left: 8px; font-size: 12px; }
  .game-grid { gap: 8px; margin-top: 11px; }
  .game-card { min-height: 145px; padding: 11px 10px 9px; border-radius: 12px; }
  .game-icon { width: 24px; height: 24px; }
  .game-icon svg { width: 18px; height: 18px; }
  .game-name { margin-top: 8px; font-size: 13px; }
  .game-desc { font-size: 12px; line-height: 1.35; }
  .game-play { padding-top: 7px; font-size: 12px; }
  .game-play i { font-size: 14px; }
  .vocab-section { padding: 15px 12px 16px; border-radius: 14px; }
  .vocab-section .section-heading h2 { font-size: 20px; }
  .word-count { padding: 4px 8px; font-size: 12px; }
  .vocab-controls { align-items: stretch; flex-direction: column; gap: 9px; margin: 11px 0; }
  .search-box { width: 100%; height: 44px; }
  .search-box input { font-size: 13px; }
  .set-filters { width: 100%; gap: 5px; }
  .filter-chip { min-height: 40px; padding: 0 10px; font-size: 12px; }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .word-listen { padding: 10px 10px 9px; }
  .word-hanzi { font-size: 34px; }
  .word-audio-mark { width: 26px; height: 26px; }
  .word-pinyin { margin-top: 6px; font-size: 13px; }
  .word-meaning { font-size: 13px; }
  .word-card-foot { padding: 7px 8px; }
  .word-set-tag, .word-status { font-size: 12px; }
  .card-practice { padding: 4px 5px; font-size: 12px; }
  .home-footer { flex-wrap: wrap; font-size: 12px; }
  .play-screen { padding: 13px 0 23px; }
  .play-top { grid-template-columns: auto minmax(0,1fr) auto; gap: 5px; }
  .back-button { min-height: 44px; gap: 4px; padding: 4px 7px; font-size: 11px; }
  .play-chapter { gap: 5px; }
  .chapter-hanzi { width: 31px; height: 31px; font-size: 14px; }
  .play-chapter b { max-width: 130px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .play-chapter small { font-size: 11px; }
  .play-counter { font-size: 11px; }
  .round-track { gap: 3px; margin: 11px 0; }
  .run-scoreboard { justify-content: space-between; gap: 7px; margin: -3px 0 10px; font-size: 11px; }
  .run-scoreboard b { font-size: 13px; }
  .question-layout { grid-template-columns: 1fr; gap: 9px; }
  .question-card { min-height: min(480px, calc(100dvh - 176px)); padding: 20px 14px 15px; border-radius: 18px; }
  .speaking-hanzi { margin-top: 9px; font-size: 68px; }
  .speaking-meaning { margin: 4px 0 11px; font-size: 13px; }
  .speaking-actions { gap: 7px; }
  .speaking-reference, .speaking-record { min-height: 48px; padding: 8px 6px; font-size: 12px; }
  .speaking-score-trigger { min-height: 46px; font-size: 12px; }
  .speaking-status { margin: 10px 0 5px; font-size: 12px; }
  .speaking-ratings { gap: 5px; }
  .speaking-ratings button { min-height: 44px; font-size: 11px; }
  .speech-score-result { padding: 10px; }
  .speech-score-metrics b { font-size: 19px; }
  .speaking-disclaimer { margin-top: 8px; font-size: 10px; }
  .question-card:has(.invader-arena) { min-height: 0; padding: 16px 11px 13px; }
  .invader-launch { min-height: 76px; grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; margin-top: 9px; padding: 10px; border-radius: 12px; }
  .invader-launch-icon { width: 36px; height: 36px; font-size: 22px; }
  .invader-launch-copy b { font-size: 13px; }
  .invader-launch-copy small { font-size: 11px; }
  .invader-launch-cta { gap: 4px; font-size: 11px; }
  .invader-arena { height: min(34dvh,310px); min-height: 225px; border-radius: 11px; }
  .invader-target { min-width: 42px; min-height: 42px; border-radius: 11px; font-size: 27px; }
  .invader-form { grid-template-columns: minmax(0,1fr) 85px; gap: 6px; margin-top: 8px; }
  .invader-form .pinyin-input { height: 46px; padding: 0 10px; font-size: 15px; }
  .invader-fire { min-height: 46px; padding: 0 9px; font-size: 11px; }
  .invader-tone-keys { gap: 5px; margin-top: 6px; }
  .invader-tone-keys button { min-height: 44px; flex-direction: column; gap: 0; }
  .invader-tone-keys small { font-size: 10px; }
  .question-card:has(#invader-pinyin:focus) { padding-top: 10px; padding-bottom: 9px; }
  .question-card:has(#invader-pinyin:focus) .question-subtitle,
  .question-card:has(#invader-pinyin:focus) #invader-hint { display: none; }
  .question-card:has(#invader-pinyin:focus) .question-title { margin: 5px 0; font-size: 18px; }
  .question-card:has(#invader-pinyin:focus) .invader-arena { height: min(24dvh,200px); min-height: 145px; }
  .invader-hint { font-size: 11px; }
  .invader-feedback { font-size: 11px; }
  .question-type { font-size: 10px; }
  .question-title { margin: 8px 0 5px; font-size: 21px; }
  .question-subtitle { margin-bottom: 12px; font-size: 12px; }
  .listen-prompt { width: 82px; height: 82px; }
  .hanzi-prompt { font-size: 48px; }
  .tone-prompt { font-size: 27px; }
  .choice-grid { gap: 7px; }
  .choice { min-height: 53px; padding: 8px; font-size: 12px; }
  .choice-shortcut, .keyboard-hint, .next-shortcut { display: none; }
  .choice.hanzi-choice .choice-text { font-size: 25px; }
  .feedback { font-size: 11px; }
  .next-button { min-height: 44px; }
  .pinyin-input { height: 47px; font-size: 17px; }
  .input-helper { font-size: 11px; }
  .submit-tone, .skip-tone { min-height: 44px; font-size: 11px; }
  .tone-form { margin-top: 6px; }
  .tone-compose { min-height: 47px; gap: 5px; margin-bottom: 7px; padding: 6px; }
  .tone-syllable-chip { min-width: 39px; min-height: 35px; font-size: 17px; }
  .tone-keyboard { gap: 5px; margin: 8px 0 9px; }
  .tone-key { min-height: 56px; border-radius: 8px; }
  .tone-key b { font-size: 19px; }
  .tone-key small { font-size: 9px; }
  .sentence-display { font-size: 18px; }
  .token { min-width: 45px; min-height: 42px; font-size: 16px; }
  .writing-board { gap: 6px; margin: 10px 0 8px; }
  .write-cell { width: clamp(160px,35vw,170px); max-width: calc(50% - 3px); flex-basis: clamp(160px,35vw,170px); }
  .write-cell { border-radius: 8px; }
  .write-meaning { font-size: 16px; }
  .write-tools, .write-ratings { gap: 6px; }
  .write-clear, .write-reveal-button, .write-ratings button { min-height: 40px; padding: 0 10px; font-size: 11px; }
  .play-aside { display: none; }
  .result-title { font-size: 22px; }
  .result-copy { font-size: 12px; }
  .result-score-grid b { font-size: 19px; }
  .result-score-grid small { font-size: 10px; }
  .result-actions { flex-direction: column; }
  .result-actions .next-button { width: 100%; }
  .new-words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offline-audio { margin-top: 8px; border-radius: 12px; }
  .offline-audio > summary { min-height: 54px; padding: 8px 11px; }
  .offline-audio > summary b { font-size: 12px; }
  .audio-voice-setting { margin: 0 8px 8px; padding: 8px 9px; grid-template-columns: minmax(0,1fr) minmax(118px,150px); gap: 8px; }
  .audio-voice-setting select { min-height: 44px; padding: 0 7px; font-size: 11px; }
  .offline-note { margin: 0 11px 8px; }
  .offline-pack-list { grid-template-columns: 1fr; gap: 6px; padding: 0 8px 8px; }
  .offline-pack { grid-template-columns: minmax(0,1fr) minmax(70px,100px) auto; gap: 8px; padding: 7px 9px; }
  .offline-pack progress { grid-column: auto; }
  .offline-pack-action { min-height: 44px; }
  .offline-live { padding: 0 10px 8px; }
  .mobile-nav { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 5px 11px max(5px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: 7px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
  .app-shell.is-playing .mobile-nav { display: none; }
  .nav-item { min-height: 49px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 11px; font-weight: 700; }
  .nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
  .nav-item.active { border-color: #d9e7b8; background: #f4f9e7; color: var(--forest); }
}

@media (max-width: 360px) {
  .topbar-tools { gap: 5px; }
  .xp-pill { height: 34px; gap: 3px; padding: 0 8px; }
  .install-button { min-height: 44px; padding: 0 8px; }
  .brand-name b { font-size: 12px; }
  .deck-picker select { max-width: 125px; font-size: 12px; }
  .offline-pack { grid-template-columns: minmax(0,1fr) minmax(55px,72px) auto; gap: 5px; }
  .game-card { padding-right: 8px; padding-left: 8px; }
  .game-name { font-size: 12px; }
  .invader-launch-cta { font-size: 10px; }
  .invader-launch-copy small { font-size: 10px; }
}

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