:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1c1a;
  --muted: #6d6a64;
  --line: #e2dfd8;
  --accent: #d9433a;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e7;
  --ok: #1f8a57;
  --warn: #c77700;
  --bad: #c9372c;
  --t1: #d9433a;
  --t2: #d97a0f;
  --t3: #1f8a57;
  --t4: #2f6fd6;
  --t5: #8a877f;
  --you: #7a4fd1;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans CJK SC", "PingFang SC", sans-serif;
  --font-zh: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151514; --surface: #1e1e1c; --surface-2: #272725; --text: #ecebe7; --muted: #9c9991; --line: #34332f;
    --accent: #ef5a4f; --accent-soft: #3a201d; --ok: #3fb67a; --warn: #e3a03a; --bad: #ef6a5f;
    --t1: #f06a5f; --t2: #f0a03c; --t3: #45c083; --t4: #6b9cf0; --t5: #8f8c85; --you: #a989f0;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151514; --surface: #1e1e1c; --surface-2: #272725; --text: #ecebe7; --muted: #9c9991; --line: #34332f;
  --accent: #ef5a4f; --accent-soft: #3a201d; --ok: #3fb67a; --warn: #e3a03a; --bad: #ef6a5f;
  --t1: #f06a5f; --t2: #f0a03c; --t3: #45c083; --t4: #6b9cf0; --t5: #8f8c85; --you: #a989f0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
kbd { font: 600 .8em var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; background: var(--surface); }
[hidden] { display: none !important; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-zh); font-size: 18px; }
.tabs { display: flex; gap: .25rem; margin: 0 auto; background: var(--surface-2); padding: .25rem; border-radius: 999px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font: 500 .92rem var(--font); padding: .4rem .9rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.top-right { display: flex; align-items: center; gap: .5rem; }
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--t5); }
.status.ok i { background: var(--ok); }
.status.bad i { background: var(--bad); }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; line-height: 1.3em; text-align: center; }

main { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
.tab { display: none; }
.tab.active { display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 .9rem var(--font); padding: .5rem .9rem; border-radius: 10px; cursor: pointer; }
.btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.on { color: var(--accent); }

/* Scenario picker */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.scen { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: .9rem 1rem; cursor: pointer; box-shadow: var(--shadow); color: var(--text); font: inherit; transition: border-color .15s; }
.scen:hover { border-color: var(--accent); }
.scen .zh { font-family: var(--font-zh); color: var(--accent); font-size: 1.05rem; float: right; }
.scen strong { display: block; font-size: 1.02rem; }
.scen p { margin: .3rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.custom { display: flex; gap: .5rem; margin-top: 1rem; }
.custom input, .composer input { flex: 1; min-width: 0; font: inherit; padding: .65rem .85rem; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.custom input:focus, .composer input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }

/* Chat */
.chat-head { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.chat-title { flex: 1; min-width: 0; text-align: center; }
.chat-title strong { display: block; }
.chat-title span { color: var(--muted); font-size: .84rem; }
#messages { display: flex; flex-direction: column; gap: .9rem; }
.msg { max-width: 92%; }
.msg.char { align-self: flex-start; }
.msg.me { align-self: flex-end; }
.who { font-size: .75rem; color: var(--muted); margin: 0 0 .25rem .2rem; text-transform: uppercase; letter-spacing: .04em; }
.msg.me .who { text-align: right; margin-right: .2rem; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; box-shadow: var(--shadow); }
.msg.me .bubble { background: var(--surface-2); }
.bubble .phrase + .phrase { border-top: 1px dashed var(--line); padding-top: .6rem; margin-top: .6rem; }
.coach { align-self: stretch; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; padding: .6rem .9rem; }
.coach .label { font-size: .75rem; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.coach p { margin: .15rem 0 0; }
.coach .phrase { margin-top: .5rem; background: var(--surface); border-radius: 10px; padding: .5rem .7rem; }
.sugg { align-self: stretch; }
.sugg .label, .section-label { font-size: .75rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .35rem; }
.sugg-list { display: grid; gap: .5rem; }
.sugg-list .phrase { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .75rem; cursor: pointer; }
.sugg-list .phrase:hover { border-color: var(--accent); }
.words { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.word { display: inline-flex; align-items: baseline; gap: .4rem; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .2rem .7rem; cursor: pointer; font-size: .9rem; }
.done-banner { align-self: stretch; text-align: center; padding: 1rem; border-radius: var(--radius); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); }
.typing { align-self: flex-start; color: var(--muted); font-size: .9rem; display: flex; gap: .3rem; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: .6rem; align-items: center; padding: .7rem max(1rem, calc((100vw - 860px) / 2 + 1rem)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.composer form { flex: 1; display: flex; gap: .5rem; min-width: 0; }

.mic { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.mic svg { width: 24px; height: 24px; }
.mic.big { width: 68px; height: 68px; }
.mic.big svg { width: 30px; height: 30px; }
.mic.rec { background: var(--bad); box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 50%, transparent); animation: pulse 1.4s infinite; }
.mic.busy { background: var(--t5); cursor: progress; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* Phrase */
.phrase { position: relative; }
.phrase .line { display: flex; align-items: flex-start; gap: .5rem; }
.phrase .main { flex: 1; min-width: 0; }
.py { font-size: 1.22rem; line-height: 1.45; letter-spacing: .005em; }
.phrase.lg .py { font-size: 1.6rem; }
.phrase.sm .py { font-size: 1.05rem; }
.py .w { display: inline-block; margin-right: .32em; }
.py .x { margin-right: .3em; color: var(--muted); }
.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); } .t4 { color: var(--t4); } .t5 { color: var(--t5); }
.hz { font-family: var(--font-zh); color: var(--muted); font-size: 1rem; margin-top: .05rem; }
.phrase.lg .hz { font-size: 1.25rem; }
body:not(.show-hanzi) .hz { display: none; }
.en { color: var(--muted); font-size: .93rem; margin-top: .1rem; }
body.hide-en .en:not(.revealed) { filter: blur(5px); cursor: pointer; user-select: none; }
body.hide-en .en { transition: filter .15s; }
.acts { display: flex; gap: .1rem; flex: none; }
.acts .icon-btn { width: 32px; height: 32px; }
.acts .speed { font: 600 .72rem var(--font); }
.phrase.playing .py { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: .3em; text-decoration-thickness: 2px; }
.me-audio { margin-top: .35rem; }

/* Lists / cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.list { display: grid; gap: .5rem; margin-top: .75rem; }
.list .card { padding: .65rem .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 .25rem; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .3rem .8rem; font: 500 .85rem var(--font); cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tones { margin-bottom: .5rem; }
.tone-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: .75rem 0 .25rem; }
.tone { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: .5rem; text-align: center; cursor: pointer; font: inherit; color: inherit; }
.tone b { display: block; font-size: 1.5rem; font-weight: 600; }
.tone svg { width: 46px; height: 22px; display: block; margin: .1rem auto 0; }
.tone span { font-size: .78rem; color: var(--muted); }

/* Ask */
.ask-grid { display: grid; gap: .9rem; margin-top: 1rem; }
.breakdown { display: flex; flex-wrap: wrap; gap: .5rem; }
.bd { border: 1px solid var(--line); border-radius: 10px; padding: .35rem .6rem; background: var(--surface-2); cursor: pointer; }
.bd .py { font-size: 1.05rem; }
.bd .en { font-size: .8rem; margin: 0; }
.alt-note { font-size: .82rem; color: var(--muted); font-style: italic; }

/* Review */
.review-card { text-align: center; padding: 2rem 1.25rem; }
.review-card .mode { font-size: .75rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.review-card .prompt-en { font-size: 1.35rem; margin: .75rem 0; }
.review-card .phrase { display: inline-block; text-align: left; margin: .5rem 0; }
.grade { display: flex; gap: .5rem; justify-content: center; margin-top: 1.25rem; }
.grade .btn { min-width: 6.5rem; justify-content: center; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); margin-bottom: 1rem; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* Overlay sheets */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 1rem; }
.sheet { width: min(640px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: 18px; padding: 1rem 1.25rem 1.25rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.sheet.narrow { width: min(460px, 100%); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.drill-actions { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1rem 0 .25rem; }
#drill-phrase { background: var(--surface-2); border-radius: 12px; padding: .8rem 1rem; }
.syl-row { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin: .5rem 0; }
.syl { min-width: 3.1rem; text-align: center; border-radius: 10px; padding: .3rem .45rem; border: 1px solid var(--line); }
.syl b { display: block; font-size: 1.1rem; font-weight: 600; }
.syl small { display: block; font-size: .72rem; color: var(--muted); min-height: 1em; }
.syl.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.syl.tone { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.syl.wrong, .syl.miss { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.score { text-align: center; font-size: .95rem; }
.score b { font-size: 1.4rem; }
.heard { text-align: center; color: var(--muted); font-size: .9rem; }
.pitch-wrap { margin-top: .75rem; }
#pitch { width: 100%; height: 160px; background: var(--surface-2); border-radius: 12px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .78rem; margin-top: .35rem; }
.legend .ref { color: var(--t4); font-weight: 600; }
.legend .you { color: var(--you); font-weight: 600; }
.sandhi { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.row.check { justify-content: flex-start; }
.row select, .row input[type=range] { font: inherit; padding: .3rem .4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.pair { display: inline-flex; gap: .4rem; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .55rem 1rem; border-radius: 10px; font-size: .9rem; z-index: 30; box-shadow: var(--shadow); max-width: calc(100vw - 2rem); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.err { color: var(--bad); }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: .5rem; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .brand span:last-child { display: none; }
  .top-right { margin-left: auto; }
  .py { font-size: 1.12rem; }
  .phrase.lg .py { font-size: 1.35rem; }
  .composer { padding: .6rem 1rem; }
  .composer .btn.primary { display: none; }
  .grade .btn { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ───────── Lessons ───────── */
.unit { margin: 1.75rem 0 0; }
.unit h2 { font-size: 1.1rem; margin: 0 0 .15rem; display: flex; align-items: baseline; gap: .5rem; }
.unit-n { font-size: .72rem; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.unit > p { margin: 0 0 .7rem; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .65rem; }
.lesson-card { position: relative; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: .8rem .95rem; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.lesson-card:hover, .lesson-card:focus-visible { border-color: var(--accent); outline: none; }
.lesson-card strong { display: block; padding-right: 1.5rem; }
.lesson-card p { margin: .25rem 0 .45rem; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.lesson-card .status { color: var(--muted); }
.lesson-card .ok { color: var(--ok); font-weight: 600; }
.lesson-card .accent { color: var(--accent); font-weight: 650; }
.lesson-card.next { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.lesson-card.done { background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.card-del { position: absolute; top: .35rem; right: .35rem; width: 28px; height: 28px; }
.lesson-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.lesson-title { flex: 1; min-width: 0; text-align: center; }
.lesson-title strong, .lesson-title span { display: block; }
.lesson-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.lesson-nav .btn { min-width: 7rem; justify-content: center; }
.kicker { font-size: .72rem; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.lesson-intro h2.lesson-goal { font-size: 1.25rem; margin: 0 0 .6rem; }
.lesson-intro p { margin: .45rem 0; }
.focus-list { display: grid; gap: .6rem; margin: 1rem 0 .5rem; }
.focus { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: .55rem .8rem; }
.focus p { margin: .2rem 0 .1rem; color: var(--muted); font-size: .92rem; }
.focus .chips { margin: .45rem 0 0; }
.chip.ex { display: inline-flex; align-items: center; gap: .4rem; }
.chip.ex .py { font-size: 1.02rem; }
.chip.ex svg:not(.tone-ico) { width: 13px; height: 13px; color: var(--muted); }
.tone-ico { width: 30px; height: 15px; flex: none; }
.learn { text-align: center; }
.learn .phrase, .speak .answer .phrase { text-align: left; display: inline-block; max-width: 100%; }
.phrase.xl .py { font-size: 2.3rem; line-height: 1.3; }
.phrase.xl .hz { font-size: 1.4rem; }
.phrase.xl .en { font-size: 1.05rem; }
.tone-badge { display: inline-flex; align-items: center; gap: .4rem; margin: .5rem 0 0; font-size: .88rem; color: var(--muted); }
.tip { text-align: left; margin: .9rem auto 0; max-width: 560px; background: var(--surface-2); border-radius: 10px; padding: .55rem .8rem; font-size: .93rem; }
.tip b { color: var(--accent); margin-right: .35rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.practice { margin-top: .6rem; }
.practice .hint { margin: .2rem 0 0; }
.result { margin-top: .5rem; }
.tone-box { text-align: left; max-width: 560px; margin: .6rem auto 0; border-radius: 10px; padding: .6rem .8rem; border: 1px solid var(--line); font-size: .95rem; }
.tone-box.ok { background: color-mix(in srgb, var(--ok) 13%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.tone-box.bad { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.tone-box.unsure { background: var(--surface-2); }
.quiz { text-align: center; padding: 1.4rem 1.1rem; }
.listen-row { display: flex; justify-content: center; gap: .6rem; margin: .4rem 0 1.1rem; }
.big-play { padding: .7rem 1.4rem; font-size: 1rem; border-radius: 999px; }
.big-play svg { width: 18px; height: 18px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .55rem; max-width: 640px; margin: 0 auto; }
.options.four { grid-template-columns: repeat(4, 1fr); }
.opt { border: 1.5px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: .7rem .6rem; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt b { font-size: 1.35rem; font-weight: 600; }
.opt span { font-size: .78rem; color: var(--muted); }
.opt .py { font-size: 1.25rem; }
.opt .tone-ico { width: 40px; height: 20px; }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.opt:disabled { cursor: default; }
.feedback { min-height: 1.5em; margin-top: .9rem; }
.feedback.ok b:first-child { color: var(--ok); }
.feedback.bad b:first-child { color: var(--bad); }
.feedback .phrase { display: inline-block; text-align: left; margin-top: .5rem; background: var(--surface-2); border-radius: 10px; padding: .5rem .7rem; }
.feedback .chips { justify-content: center; margin: .35rem 0 0; }
.speak .prompt-en { font-size: 1.4rem; margin: .4rem 0 .2rem; }
.speak .answer { margin-top: .9rem; }
.break { text-align: center; padding: 2.2rem 1rem; }
.break h2 { margin: 0 0 .3rem; }
.summary h2 { margin: 0 0 .8rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .7rem; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: .7rem; text-align: center; }
.stats b { display: block; font-size: 1.5rem; }
.stats span { font-size: .8rem; color: var(--muted); }
.summary .sugg-list { margin-bottom: .8rem; }
.summary-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
@media (max-width: 720px) {
  .options.four { grid-template-columns: repeat(2, 1fr); }
  .phrase.xl .py { font-size: 1.8rem; }
  .stats b { font-size: 1.2rem; }
}
.pitch-wrap canvas { width: 100%; height: 150px; background: var(--surface-2); border-radius: 12px; display: block; }
.learn .tone-badge { display: flex; justify-content: center; }
.learn > .phrase { margin-top: .2rem; }

/* ───────────── word card (hover a word) ───────────── */
.py .w[data-w] { cursor: help; border-radius: 5px; transition: background-color .12s; }
.py .w[data-w]:hover { background: var(--surface-2); }
.wordcard { position: fixed; z-index: 40; width: min(330px, calc(100vw - 16px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: .65rem .85rem .7rem; font-size: .88rem; line-height: 1.45; }
.wc-head { display: flex; align-items: center; gap: .15rem; }
.wc-head .py { flex: 1; font-size: 1.45rem; font-weight: 500; }
.wc-head .icon-btn { width: 30px; height: 30px; }
.wc-head .icon-btn svg { width: 18px; height: 18px; }
.wc-hz { font-family: var(--font-zh); color: var(--muted); font-size: .95rem; margin-top: -.1rem; }
.wc-tones { display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin: .4rem 0 .2rem; color: var(--muted); font-size: .8rem; }
.wc-tones span { display: inline-flex; align-items: center; gap: .3rem; }
.tone-ico { width: 24px; height: 12px; flex: none; }
.wc-note { font-size: .8rem; background: var(--accent-soft); border-radius: 8px; padding: .3rem .5rem; margin: .35rem 0; }
.wc-body { margin-top: .35rem; }
.wc-sense { margin: .15rem 0; }
.wc-alt { color: var(--muted); font-size: .8rem; }
.wc-cl { color: var(--muted); font-size: .8rem; }
.wc-chars { border-top: 1px solid var(--line); margin-top: .45rem; padding-top: .4rem; color: var(--muted); font-size: .8rem; }
.wc-chars b { color: var(--text); font-weight: 600; }
.wc-chars i { font-style: normal; margin: 0 .4rem; }
.wc-ask { display: inline-flex; align-items: center; gap: .35rem; margin-top: .5rem; border: 0; background: none; color: var(--accent); font: 600 .84rem var(--font); cursor: pointer; padding: .15rem 0; }
.wc-ask svg, .ask-chip svg { width: 16px; height: 16px; }

/* ───────────── ask panel and selection chip ───────────── */
.ask-chip { position: fixed; z-index: 35; display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: 600 .82rem var(--font); padding: .4rem .75rem; box-shadow: 0 6px 18px rgba(0,0,0,.22); cursor: pointer; }
.ask-sheet { width: min(720px, 100%); }
.ask-focus { margin-top: .5rem; color: var(--muted); font-size: .9rem; }
.ask-focus .py { font-size: 1.1rem; color: var(--text); }
.ask-notes { margin-top: .5rem; font-size: .85rem; background: var(--accent-soft); border-radius: 10px; padding: .4rem .65rem; }
.ask-quote { margin: 0; border-left: 3px solid var(--line); padding: .3rem .8rem; color: var(--muted); font-style: italic; }
.ask-thread { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.ask-q { align-self: flex-end; max-width: 85%; background: var(--surface-2); border-radius: 12px 12px 4px 12px; padding: .45rem .8rem; }
.ask-a { border-left: 3px solid var(--accent); padding: .05rem 0 .05rem .85rem; }
.ask-a.err { border-left-color: var(--bad); color: var(--bad); }
.ask-a.typing { border-left-color: var(--line); }
.ask-a.typing span { margin-left: .35rem; }
.ask-text p { margin: .3rem 0; }
.ask-text ul { margin: .3rem 0; padding-left: 1.25rem; }
.ask-text li { margin: .15rem 0; }
.py.zh-inline { font-size: 1em; cursor: pointer; }
.py.zh-inline .w { margin-right: .22em; }
.py.zh-inline .w:last-child { margin-right: 0; }
.ask-breakdown { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.ask-breakdown .bd { font: inherit; color: var(--text); text-align: left; }
.ask-examples { margin-top: .7rem; display: grid; gap: .45rem; }
.ask-examples .label { font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ask-examples .phrase { background: var(--surface-2); border-radius: 10px; padding: .4rem .6rem; }
#qa-chips { margin: .9rem 0 0; }
#qa-chips .chip:disabled { opacity: .5; cursor: default; }
.ask-form { position: sticky; bottom: -1.25rem; display: flex; gap: .5rem; margin: .7rem -1.25rem -1.25rem; padding: .7rem 1.25rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.ask-form input { flex: 1; min-width: 0; font: inherit; padding: .6rem .85rem; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ask-form input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
