/* TinyMigo 进阶英语 — bright, warm, illustration first.
   Bright pink for actions, bright sunny yellow for rewards, white cards on warm cream. Solid colours only. */
:root {
  --bg: #fff8f6;
  --surface: #ffffff;
  --surface-2: #fdf0ef;
  --surface-3: #f8e4e3;
  --ink: #2b1f1c;
  --ink-2: #5e4a44;
  --muted: #a08a7e;
  --line: #f5e6e4;
  --primary: #f35fa6;
  --primary-press: #e14a93;
  --primary-ink: #ffffff;
  --primary-soft: #ffe9f4;
  --sun: #ffdb4d;
  --sun-press: #ffd21f;
  --sun-ink: #4a3500;
  --sun-soft: #fff8d6;
  --coral: #ff7a45;
  --coral-soft: #ffeadf;
  --amber: #ffbf0f;
  --amber-soft: #fff8d6;
  --good: #26a865;
  --good-soft: #e2f6ea;
  --bad: #e8463a;
  --bad-soft: #fde6e2;
  --star: #ffd23f;
  --star-off: #f0e2d8;
  --art-bg: #f1dccd;
  --k-comprehensive: #f35fa6;
  --k-vocab: #ffb800;
  --k-grammar: #9a5fe3;
  --k-listening: #3b92f0;
  --k-speaking: #ff6648;
  --k-scene: #ff8a1f;
  --k-test: #2b1f1c;
  --k-review: #a08a7e;
  --r-xl: 28px;
  --r-l: 22px;
  --r: 16px;
  --r-s: 12px;
  --shadow-1: 0 1px 2px rgba(80, 40, 30, .05), 0 4px 16px rgba(80, 40, 30, .06);
  --shadow-2: 0 14px 36px -16px rgba(80, 40, 30, .3);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --gutter: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18120f; --surface: #221a17; --surface-2: #2d2420; --surface-3: #3a2f2a; --ink: #f8efe9; --ink-2: #dacbc1;
    --muted: #a08d82; --line: #352a25; --primary: #ff7dbb; --primary-press: #ff66ae; --primary-ink: #2e0619; --primary-soft: #4a2138;
    --sun: #ffdb4d; --sun-press: #ffd21f; --sun-ink: #2e2200; --sun-soft: #3d3418;
    --coral: #ff8c5a; --coral-soft: #402619; --amber: #ffd23f; --amber-soft: #3d3418; --good: #4fcf8d; --good-soft: #173323;
    --bad: #ff7468; --bad-soft: #40201c; --star: #ffdb4d; --star-off: #463a34; --art-bg: #4a3a33; --k-test: #f8efe9;
    --k-comprehensive: #ff7dbb; --k-vocab: #ffd23f; --k-grammar: #b48cff; --k-listening: #62aeff; --k-speaking: #ff7f66; --k-scene: #ffa04d;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow-2: 0 14px 36px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #18120f; --surface: #221a17; --surface-2: #2d2420; --surface-3: #3a2f2a; --ink: #f8efe9; --ink-2: #dacbc1;
  --muted: #a08d82; --line: #352a25; --primary: #ff7dbb; --primary-press: #ff66ae; --primary-ink: #2e0619; --primary-soft: #4a2138;
  --sun: #ffdb4d; --sun-press: #ffd21f; --sun-ink: #2e2200; --sun-soft: #3d3418;
  --coral: #ff8c5a; --coral-soft: #402619; --amber: #ffd23f; --amber-soft: #3d3418; --good: #4fcf8d; --good-soft: #173323;
  --bad: #ff7468; --bad-soft: #40201c; --star: #ffdb4d; --star-off: #463a34; --art-bg: #4a3a33; --k-test: #f8efe9;
  --k-comprehensive: #ff7dbb; --k-vocab: #ffd23f; --k-grammar: #b48cff; --k-listening: #62aeff; --k-speaking: #ff7f66; --k-scene: #ffa04d;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow-2: 0 14px 36px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 600; }
img { display: block; }
.icon { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }
.muted { color: var(--muted); }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */
.primary, .secondary, .ghost, .danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: var(--r); font-size: 17px; font-weight: 600; text-align: center; transition: transform .12s ease, background .2s, opacity .2s;
}
.primary { background: var(--primary); color: var(--primary-ink); }
.primary:hover:not(:disabled) { background: var(--primary-press); }
.secondary { background: var(--surface-2); color: var(--ink); }
.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.danger { background: var(--bad); color: #fff; }
.primary:active, .secondary:active, .ghost:active, .danger:active { transform: scale(.98); }
.primary:disabled { opacity: .35; }
.wide { width: 100%; }
.link { color: var(--muted); font-size: 14px; padding: 10px 4px; text-align: center; }
.link:hover { color: var(--ink); }
.danger-link { color: var(--bad); font-size: 15px; padding: 14px 0; text-align: left; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 14px; font-weight: 600; }
.pill .icon { width: 16px; height: 16px; }
.pill.streak .icon { color: var(--coral); }
.pill.minutes .icon { color: var(--primary); }

/* ---------- shell ---------- */
.shell { max-width: 560px; margin: 0 auto; padding: 0 var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 22px 0 16px; }
.top .date { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.top-right { display: flex; gap: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 28px 2px 12px; }
.section-head small { color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); padding: 18px; }
.note { margin-top: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--amber-soft); color: var(--ink-2); font-size: 14px; }
.note.soft { background: var(--primary-soft); }
.card.stack { display: grid; gap: 14px; }
.card.stack .muted { font-size: 14px; }
.btn-s { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.continue-title { width: 100%; }
.week-days b { font-weight: 500; }
.week-days .today b { font-weight: 700; }
.result-page { position: relative; }
.result-art[hidden] + .result-main { margin-top: 56px; }
.result-main h1 { font-size: 26px; }
.big-level .icon { width: 54px; height: 54px; }
.mistakes .fine { text-align: left; margin-top: 2px; }
.scene-stage { position: relative; }
.fine { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.empty { color: var(--muted); font-size: 14px; padding: 16px 4px; }
.stars { display: inline-flex; gap: 2px; letter-spacing: 0; }
.star { color: var(--star-off); }
.star.on { color: var(--star); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; z-index: 10; width: min(560px, 100%);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 11px; color: var(--muted); }
.tabbar button .icon { width: 24px; height: 24px; }
.tabbar button.on { color: var(--primary); font-weight: 600; }
.tabbar .dot { position: absolute; top: 2px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: var(--primary-ink); font: 600 11px/18px var(--font); font-style: normal; }

/* ---------- home: continue card ---------- */
.continue { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-2); overflow: hidden; }
.continue-art { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; background: var(--art-bg); overflow: hidden; }
.continue-art > img, .continue-art .cast-strip, .continue-art > svg { width: 100%; height: 100%; object-fit: cover; }
.art-chip { position: absolute; left: 14px; top: 14px; padding: 5px 11px; border-radius: 999px; background: #ffffff; color: #2b1f1c; font-size: 13px; font-weight: 600; }
.continue-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.continue-title { display: grid; gap: 2px; text-align: left; }
.continue-title p { color: var(--muted); font-size: 14px; }
.next-line { font-size: 14px; color: var(--muted); }
.next-line b { color: var(--ink); font-weight: 600; }
.done-line { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--good); }
.done-line .icon { width: 20px; height: 20px; }

/* the day's 8 steps in one row */
.level-up-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.level-up-facts li { padding: 10px 6px; border-radius: var(--r-s); background: var(--sun-soft); text-align: center; display: grid; gap: 2px; }
.level-up-facts b { font-size: 20px; line-height: 1.1; color: var(--ink); }
.level-up-facts small { font-size: 12px; color: var(--ink-2); }
.steps { display: flex; align-items: center; justify-content: space-between; position: relative; padding: 2px 0; }
.steps::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 2px; background: var(--line); transform: translateY(-50%); }
.step { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); box-shadow: 0 0 0 3px var(--surface); }
.step .icon { width: 16px; height: 16px; }
.step .glyph { font-size: 11px; font-weight: 700; }
.step.done { background: var(--primary); color: var(--primary-ink); }
.step.current { background: var(--surface); color: var(--primary); box-shadow: 0 0 0 3px var(--surface), inset 0 0 0 2px var(--primary); animation: beacon 2s ease-out infinite; }
.step.locked { opacity: .55; }

/* Learning group shortcut */
.group-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--primary-soft);
  text-align: left;
  transition: background .15s;
}
@media (hover: hover) {
  .group-card:hover { background: var(--surface-3); }
}
.group-card:focus-visible { border-radius: var(--r-l); }
.group-card-avatar { object-fit: cover; border-radius: var(--r-s); }
.group-card-copy { display: grid; gap: 2px; }
.group-card-copy b { font-size: 17px; line-height: 1.3; }
.group-card-copy small { font-size: 13px; color: var(--ink-2); }
.group-card > .icon { color: var(--ink-2); }

/* small row cards on home */
.row-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); text-align: left; margin-top: 12px; }
.row-card .row-icon { width: 44px; height: 44px; }
.row-card .row-text b { font-size: 16px; }
.chev { color: var(--muted); width: 18px; height: 18px; }
.week { margin-top: 12px; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.week-head small { color: var(--muted); font-size: 13px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week-days span { display: grid; gap: 6px; justify-items: center; font-size: 12px; color: var(--muted); }
.week-days i { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-style: normal; color: var(--primary-ink); }
.week-days i.on { background: var(--sun); color: var(--sun-ink); }
.week-days i .icon { width: 16px; height: 16px; }
.week-days i.some { background: var(--sun-soft); box-shadow: inset 0 0 0 2px var(--sun); }
/* 打卡: 30 minutes of finished study in a day */
.checkin { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "mark text" "bar bar"; align-items: center; gap: 10px 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.checkin-mark { grid-area: mark; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sun-soft); color: var(--sun-ink); }
.checkin-mark .icon { width: 20px; height: 20px; }
.checkin.done .checkin-mark { background: var(--sun); }
.checkin-text { grid-area: text; display: grid; gap: 2px; }
.checkin-text b { font-size: 16px; }
.checkin-text small { font-size: 13px; color: var(--muted); }
.checkin-bar { grid-area: bar; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.checkin-bar i { display: block; height: 100%; border-radius: 999px; background: var(--sun); }
.checkin-banner { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 12px; padding: 12px 14px; border-radius: var(--r-s); background: var(--sun); color: var(--sun-ink); font-weight: 700; font-size: 15px; }
.checkin-banner .icon { width: 20px; height: 20px; }
/* relearn after a failed 关卡测试 */
.again-line { font-size: 14px; color: var(--primary); }
.again-line b { font-weight: 700; }
.again-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
.step.again:not(.current) { background: var(--primary-soft); color: var(--primary); }
.week-days .today b { color: var(--ink); }

/* ---------- lists (day page, review) ---------- */
.list { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; transition: background .15s; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.row-icon { --k: var(--k-comprehensive); width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--k); background: color-mix(in srgb, var(--k) 13%, var(--surface)); }
.row-icon .icon { width: 21px; height: 21px; }
.row-icon .glyph { font-size: 15px; font-weight: 700; }
.k-comprehensive { --k: var(--k-comprehensive); } .k-vocab { --k: var(--k-vocab); } .k-grammar { --k: var(--k-grammar); }
.k-listening { --k: var(--k-listening); } .k-speaking { --k: var(--k-speaking); } .k-scene { --k: var(--k-scene); }
.k-test { --k: var(--k-test); } .k-review { --k: var(--amber); }
.row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-text b { font-size: 16px; font-weight: 600; }
.row-text small { font-size: 13px; color: var(--muted); }
.row-end { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.row-end .stars { font-size: 13px; }
.row-end .icon { width: 18px; height: 18px; }
.go-pill { padding: 7px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 14px; font-weight: 600; }
.row.locked .row-text b { color: var(--muted); font-weight: 500; }
.row.locked .row-icon { filter: saturate(.55); opacity: .7; }
.row.current { background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.check-badge { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: var(--sun-ink); }
.check-badge .icon { width: 14px; height: 14px; }

/* ---------- day page ---------- */
.day-page { margin: 0 calc(-1 * var(--gutter)); }
.day-hero { position: relative; aspect-ratio: 3 / 2; background: var(--art-bg); overflow: hidden; }
.day-hero > img, .day-hero .cast-strip, .day-hero > svg { width: 100%; height: 100%; object-fit: cover; }
.float-back { position: absolute; left: 14px; top: calc(14px + env(safe-area-inset-top)); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #ffffff; color: #2b1f1c; box-shadow: 0 4px 14px rgba(80, 40, 30, .14); }
.sheet { position: relative; margin-top: -26px; padding: 22px var(--gutter) 24px; background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; display: grid; gap: 16px; }
.sheet .kicker { font-size: 13px; color: var(--primary); font-weight: 600; }
.sheet .title-block { display: grid; gap: 4px; }
.can-list { background: var(--sun-soft); border-radius: var(--r-l); padding: 14px 16px 8px; }
.can-list h3 { font-size: 14px; color: var(--sun-ink); margin: 0 0 4px; }
.can-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 0; text-align: left; }
.can-row + .can-row { border-top: 1px solid #f6e7a6; }
.can-row .icon { flex: none; width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--sun); fill: var(--sun-ink); }
.can-row span { display: grid; gap: 1px; }
.can-row b { font-weight: 600; font-size: 15px; }
.can-row small { color: var(--ink-2); font-size: 13px; }
.progress-line { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.dock { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 5; padding: 10px 0 12px; background: var(--bg); }

/* ---------- course ---------- */
.level-pills { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; scrollbar-width: none; }
.level-pills::-webkit-scrollbar { display: none; }
.level-pills button { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 9px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.level-pills button small { font-weight: 400; color: var(--muted); }
.level-pills button.on { background: var(--primary); color: var(--primary-ink); }
.level-pills button.on small { color: color-mix(in srgb, var(--primary-ink) 75%, transparent); }
.level-pills .icon { width: 13px; height: 13px; opacity: .6; }
.level-summary { margin-top: 16px; display: grid; gap: 10px; }
.level-summary .head { display: flex; align-items: center; gap: 10px; }
.cefr { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.level-summary p { color: var(--ink-2); font-size: 15px; }
.unit-head { margin: 28px 2px 12px; display: grid; gap: 2px; }
.unit-head small { color: var(--muted); font-size: 13px; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.day-card { display: grid; gap: 8px; text-align: left; align-content: start; }
.day-thumb { position: relative; aspect-ratio: 3 / 2; border-radius: var(--r); overflow: hidden; background: var(--art-bg); box-shadow: var(--shadow-1); }
.day-thumb > img, .day-thumb .cast-strip, .day-thumb > svg { width: 100%; height: 100%; object-fit: cover; }
.day-thumb.empty { background: var(--surface-2); box-shadow: none; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.day-card .badge { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #2b1f1c; color: #fff; }
.day-card .badge .icon { width: 15px; height: 15px; }
.day-card .badge.done { background: var(--sun); color: var(--sun-ink); }
.day-card .badge.progress { width: auto; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #ffffff; color: #2b1f1c; }
.day-card.locked .day-thumb > img { filter: grayscale(.85) brightness(1.05); opacity: .75; }
.day-card .meta { padding: 0 2px; display: grid; }
.day-card .meta small { font-size: 12px; color: var(--muted); }
.day-card .meta b { font-size: 15px; font-weight: 600; line-height: 1.3; }
.level-test { margin-top: 24px; }

/* ---------- welcome ---------- */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.welcome-art { position: relative; aspect-ratio: 3 / 2; background: var(--art-bg); overflow: hidden; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.welcome-art > img, .welcome-art .cast-strip { width: 100%; height: 100%; object-fit: cover; }
.welcome-body { flex: 1; display: grid; align-content: start; gap: 16px; padding: 22px 24px calc(28px + env(safe-area-inset-bottom)); position: relative; }
.brand { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--primary); text-transform: uppercase; }
.welcome h1 { font-size: 32px; line-height: 1.2; }
.lead { color: var(--ink-2); font-size: 16px; }
.faces { display: flex; align-items: center; }
.faces img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--art-bg); box-shadow: 0 0 0 3px var(--bg); }
.faces img + img { margin-left: -10px; }
.faces span { margin-left: 12px; font-size: 13px; color: var(--muted); }
.stack { display: grid; gap: 10px; margin-top: 4px; }
.features { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.features li { display: flex; gap: 14px; align-items: center; }
.features .row-icon { width: 42px; height: 42px; }
.features b { display: block; font-size: 16px; }
.features small { color: var(--muted); font-size: 14px; }

/* ---------- results ---------- */
.result-page { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 var(--gutter); }
.result-art { position: relative; margin: 0 calc(-1 * var(--gutter)); aspect-ratio: 3 / 2; background: var(--art-bg); overflow: hidden; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.result-art > img, .result-art .cast-strip { width: 100%; height: 100%; object-fit: cover; }
.result-main { position: relative; margin-top: 22px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.result-main .kicker { font-size: 13px; color: var(--muted); }
.result-stars .stars { font-size: 46px; gap: 6px; }
.result-stars .star.on { text-shadow: 0 4px 14px color-mix(in srgb, var(--star) 45%, transparent); }
.big-level { width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--sun); color: var(--sun-ink); box-shadow: 0 0 0 8px var(--sun-soft); line-height: 1.1; }
.big-level small { font-size: 12px; font-weight: 600; opacity: .8; letter-spacing: .1em; }
.big-level b { font-size: 46px; line-height: 1; }
.stat-trio { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.stat-trio > div { padding: 14px 6px; display: grid; gap: 2px; text-align: center; }
.stat-trio > div + div { border-left: 1px solid var(--line); }
.stat-trio b { font-size: 22px; }
.stat-trio small { font-size: 12px; color: var(--muted); }
.section-scores { width: 100%; }
.section-scores .row { cursor: default; }
.section-scores .pass { color: var(--good); font-weight: 600; font-size: 14px; }
.section-scores .fail { color: var(--bad); font-weight: 600; font-size: 14px; }
.mistakes { width: 100%; display: grid; gap: 8px; text-align: left; }
.mistakes h3 { margin: 8px 2px 2px; }
.mistake { padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: 2px; }
.mistake small { color: var(--muted); font-size: 13px; }
.mistake b { font-weight: 600; }
.result-actions { margin-top: auto; position: sticky; bottom: 0; z-index: 3; padding: 16px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg); display: grid; gap: 8px; width: 100%; }

/* ---------- review & me ---------- */
.big-due { display: flex; align-items: center; gap: 16px; }
.big-due .num { font-size: 44px; font-weight: 700; line-height: 1; }
.big-due p { color: var(--muted); font-size: 14px; }
.stat-trio.flat { margin-top: 12px; }
.word-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "en due" "zh dots"; align-items: center; gap: 2px 12px; width: 100%; padding: 13px 16px; text-align: left; }
.word-row + .word-row { border-top: 1px solid var(--line); }
.word-row .en { grid-area: en; font-weight: 600; font-size: 16px; }
.word-row .zh { grid-area: zh; color: var(--muted); font-size: 13px; }
.word-row .dots { grid-area: dots; display: flex; gap: 4px; justify-self: end; }
.word-row .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--star-off); }
.word-row .dots i.on { background: var(--primary); }
.word-row small { grid-area: due; color: var(--muted); font-size: 12px; justify-self: end; }
.profile { display: flex; align-items: center; gap: 16px; }
.lv-badge { width: 60px; height: 60px; border-radius: 18px; display: grid; place-content: center; text-align: center; background: var(--sun); color: var(--sun-ink); line-height: 1.1; }
.lv-badge small { font-size: 11px; opacity: .8; }
.lv-badge b { font-size: 24px; }
.profile .info { flex: 1; display: grid; gap: 2px; }
.profile .info small { color: var(--muted); font-size: 13px; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 132px; align-items: end; margin-top: 4px; }
.chart .col { display: grid; grid-template-rows: 16px 1fr 16px; height: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.chart .track { position: relative; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.chart .track i { position: absolute; inset: auto 0 0 0; border-radius: 8px; background: color-mix(in srgb, var(--primary) 45%, var(--surface)); transition: height .7s cubic-bezier(.2, .8, .2, 1); }
.chart .track i.met { background: var(--primary); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.stat-grid > div { padding: 10px 4px; border-radius: var(--r-s); background: var(--surface-2); text-align: center; display: grid; gap: 1px; }
.stat-grid b { font-size: 18px; }
.stat-grid small { font-size: 11px; color: var(--muted); }
.radar { width: min(300px, 100%); height: auto; overflow: visible; display: block; margin: 0 auto; }
.radar .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar .shape { fill: color-mix(in srgb, var(--primary) 22%, transparent); stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.radar text { font: 12px var(--font); fill: var(--muted); }
.settings { padding-top: 6px; padding-bottom: 6px; }
.settings .setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.settings .setting + .setting { border-top: 1px solid var(--line); }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.segmented button { min-height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.about { margin-top: 12px; }
.about p { font-size: 14px; color: var(--muted); padding: 8px 0; }
.about b { color: var(--ink); margin-right: 6px; }

/* ---------- sheets & toasts ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(43, 24, 18, .42); animation: fade .15s ease; }
.sheet-box { width: min(560px, 100%); padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); display: grid; gap: 10px; animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-box::before { content: ""; justify-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--surface-3); margin-bottom: 8px; }
.sheet-box h3 { font-size: 20px; }
.sheet-box p { color: var(--ink-2); font-size: 15px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%); width: max-content; max-width: calc(100% - 40px); padding: 11px 18px; border-radius: 14px; background: var(--ink); color: var(--surface); font-size: 14px; box-shadow: var(--shadow-2); animation: toast 2.4s ease forwards; pointer-events: none; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- player ---------- */
.player { max-width: 600px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 var(--gutter); }
.player-top { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 0 8px; background: var(--bg); }
.player-top .icon-btn { margin-left: -8px; }
.player-top .bar { height: 8px; border-radius: 4px; }
.count { display: none; }
.points { display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; border-radius: 999px; background: var(--sun); color: var(--sun-ink); font-size: 14px; font-weight: 700; }
.player-sub { font-size: 13px; color: var(--muted); text-align: center; padding: 0 0 10px; }
.stage { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.item { flex: 1; display: flex; flex-direction: column; gap: 16px; animation: slide-in .3s cubic-bezier(.2, .8, .2, 1); }
.speaker { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; }
.speaker.muted { color: var(--muted); font-weight: 500; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; color: var(--primary); background: var(--primary-soft); }
.prompt { font-size: 20px; line-height: 1.4; font-weight: 700; }
.hint { font-size: 13px; color: var(--muted); text-align: center; }
.controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.actions { margin-top: auto; position: sticky; bottom: 0; display: grid; gap: 6px; padding: 12px 0 calc(4px + env(safe-area-inset-bottom)); background: var(--bg); z-index: 3; }

.play { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); font-size: 14px; font-weight: 600; }
.play .icon { width: 18px; height: 18px; color: var(--primary); }
.play.big { width: 64px; height: 64px; padding: 0; background: var(--primary); color: var(--primary-ink); box-shadow: 0 10px 24px -10px var(--primary); }
.play.big .icon { width: 30px; height: 30px; color: var(--primary-ink); margin-left: 3px; }
.play.playing { animation: breathe 1s ease-in-out infinite; }
.chip-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1); font-size: 15px; font-weight: 600; color: var(--ink-2); }
.chip-btn.on { background: var(--primary-soft); color: var(--primary); }
.mini-play { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--primary); }

/* pictures */
.scene-card { position: relative; width: 100%; border-radius: var(--r-l); overflow: hidden; background: var(--art-bg); aspect-ratio: 3 / 2; flex: none; }
.scene-card.small { aspect-ratio: 16 / 9; }
.scene-card svg { display: block; width: 100%; height: 100%; }
.scene-card.photo img { width: 100%; height: 100%; object-fit: cover; }
.scene-card.photo > img { animation: ken 14s ease-in-out infinite alternate; }
/* moving pictures (lib/motion.mjs): the 3:2 picture plus cut-out layers, cropped like object-fit: cover */
.motion-stage { position: absolute; left: 0; top: 50%; width: 100%; aspect-ratio: 3 / 2; transform: translateY(-50%); animation: ken-stage 14s ease-in-out infinite alternate; }
.motion-stage img { position: absolute; display: block; }
.scene-card.photo .motion-stage img.base { left: 0; top: 0; }
.motion-stage .part { opacity: 0; pointer-events: none; }
.motion-stage .part.on { opacity: 1; }
.motion-stage .part[data-part="gesture"] { transition: opacity .1s linear; }
.scene-card.photo::after, .talking .pf.speaking::after {
  content: ""; position: absolute; width: 40px; height: 26px; border-radius: 999px; opacity: 0; transition: opacity .2s; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .35);
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 26'%3E%3Cg fill='white'%3E%3Crect x='12' y='10' width='3' height='6' rx='1.5'/%3E%3Crect x='18.5' y='6' width='3' height='14' rx='1.5'/%3E%3Crect x='25' y='10' width='3' height='6' rx='1.5'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.scene-card.photo::after { left: 14px; bottom: 14px; }
.scene-card.photo.talking::after, .talking .pf.speaking::after { opacity: 1; animation: breathe .8s ease-in-out infinite; }
.scene-card.portraits { display: flex; align-items: flex-end; justify-content: center; }
.portraits .pf { margin: 0; height: 100%; aspect-ratio: 1; position: relative; transition: transform .35s ease, filter .35s ease, opacity .35s; }
.portraits.n2 .pf { height: 94%; }
.portraits.n2 .pf + .pf { margin-left: -6%; }
.portraits .pf img, .cast-strip .pf img { width: 100%; height: 100%; object-fit: cover; }
.portraits .pf.dim { filter: saturate(.8); transform: scale(.94); transform-origin: 50% 100%; opacity: .88; }
.portraits .pf.speaking { z-index: 1; }
.talking .pf.speaking { animation: speak-bob .7s ease-in-out infinite; transform-origin: 50% 100%; }
.talking .pf.speaking::after { right: 12%; top: 14%; }
.cast-strip { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; background: var(--art-bg); }
.cast-strip .pf { margin: 0; height: 100%; aspect-ratio: 1; }
.cast-strip .pf + .pf { margin-left: -8%; }
.scene .mouth-open { display: none; }
.talking .person.speaker .mouth { display: none; }
.talking .person.speaker .mouth-open { display: inline; transform-box: fill-box; transform-origin: center; animation: talk .17s ease-in-out infinite alternate; }
.scene .person { transform-box: fill-box; transform-origin: 50% 100%; animation: idle 4.5s ease-in-out infinite; }
.scene .spin { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }
.scene .drift { animation: drift 7s ease-in-out infinite alternate; }
.scene .rain { animation: rain .8s linear infinite; }
.scene .snow { animation: snow 4s linear infinite; }
.scene .prop, .word-pic .prop { transform-box: fill-box; transform-origin: 50% 100%; animation: pop-in .5s cubic-bezier(.2, .9, .3, 1.4) both .15s; }

/* subtitle */
.subtitle { display: grid; gap: 8px; justify-items: center; align-content: center; text-align: center; padding: 4px 6px; }
.item-line .subtitle { flex: 1; min-height: 120px; }
.actions .controls { margin-bottom: 4px; }
.actions .hint:empty { display: none; }
.subtitle .who { font-size: 13px; font-weight: 600; color: var(--primary); }
.line-text { font-size: 24px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; transition: color .3s, background .3s; padding: 0 6px; }
.line-text.hidden-text { color: transparent; background: var(--surface-3); border-radius: 10px; user-select: none; cursor: pointer; }
.line-zh { color: var(--muted); font-size: 15px; }
.line-card { display: grid; gap: 6px; text-align: center; padding: 18px 16px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); }

/* word & grammar cards */
.word-card { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 28px 20px 22px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); }
.word-card.compact { padding: 24px 18px 20px; }
.word-pic svg { width: 120px; height: 92px; }
.word-en { font-size: 42px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.word-ipa { color: var(--muted); font-size: 15px; }
.pos { font-style: italic; color: var(--primary); }
.word-zh { font-size: 19px; font-weight: 600; margin-top: 4px; }
.example { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; width: 100%; }
.example-en { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.example-en .icon { color: var(--primary); width: 18px; height: 18px; }
.example-zh { color: var(--muted); font-size: 14px; }
.note-card { display: grid; gap: 14px; padding: 22px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); }
.note-card h3 { font-size: 20px; }
.note-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.note-card li { position: relative; padding-left: 16px; color: var(--ink-2); }
.note-card li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--k-grammar); }
.examples { display: grid; gap: 8px; }
.examples .example-en { justify-content: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); text-align: left; }
.examples .example-en span { display: grid; }
.examples .example-en small { color: var(--muted); font-weight: 400; font-size: 13px; }

/* answers */
.options { display: grid; gap: 10px; }
.options.grid { grid-template-columns: 1fr 1fr; }
.option { min-height: 56px; padding: 14px 18px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow-1); font-size: 17px; font-weight: 500; text-align: left; transition: box-shadow .2s, background .2s, transform .12s; }
.option:active:not(:disabled) { transform: scale(.985); }
.options.grid .option { display: grid; place-items: center; gap: 4px; text-align: center; padding: 18px 8px 14px; }
.option .emoji { font-size: 46px; line-height: 1.1; }
.option .label { font-size: 14px; color: var(--muted); }
.options.answered .option:not(.right):not(.wrong) { opacity: .45; }
.option.right { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); }
.option.wrong { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.option.unsure { box-shadow: inset 0 0 0 1.5px var(--line); background: transparent; color: var(--muted); text-align: center; font-size: 15px; }
.sentence { font-size: 24px; line-height: 1.6; font-weight: 600; padding: 24px 20px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); text-align: center; }
.blank { display: inline-block; min-width: 3em; padding: 0 8px; margin: 0 4px; border-bottom: 3px solid var(--primary); color: var(--primary); text-align: center; }
.blank.right { color: var(--good); border-color: var(--good); }
.blank.wrong { color: var(--bad); border-color: var(--bad); }
.order-answer { min-height: 80px; padding: 14px; border-radius: var(--r-l); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.order-answer.right { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); }
.order-answer.wrong { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.order-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { min-height: 46px; padding: 0 16px; border-radius: var(--r-s); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 var(--line); font-size: 17px; font-weight: 600; transition: transform .1s, opacity .2s; }
.tile:active { transform: translateY(2px); }
.order-bank .tile:disabled { opacity: .15; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: grid; gap: 10px; }
.match .tile { min-height: 56px; width: 100%; font-weight: 500; }
.match .tile.en { font-weight: 600; }
.tile.picked { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.tile.right { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); color: var(--good); opacity: .75; }
.type-in { width: 100%; min-height: 56px; padding: 0 18px; border-radius: var(--r); border: 0; box-shadow: inset 0 0 0 1.5px var(--line); background: var(--surface); color: var(--ink); font: 19px var(--font); }
.type-in:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
.type-row { display: flex; gap: 8px; }
.type-row .primary { min-height: 56px; }
.diff { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 20px; font-weight: 600; }
.diff .ok { color: var(--good); }
.diff .miss { color: var(--bad); text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 5px; }

/* speaking */
.mic-wrap { display: grid; justify-items: center; gap: 8px; }
.mic { position: relative; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--k-speaking); color: #fff; box-shadow: 0 12px 26px -12px var(--k-speaking); transition: transform .15s; }
.mic .icon { width: 32px; height: 32px; }
.mic:active { transform: scale(.95); }
.mic[data-state="listening"] { animation: breathe 1.1s ease-in-out infinite; box-shadow: 0 0 0 10px color-mix(in srgb, var(--k-speaking) 18%, transparent); }
.mic[data-state="preparing"], .mic[data-state="recognizing"], .mic[data-state="requesting"] { background: var(--muted); box-shadow: none; }
.mic:disabled { opacity: .4; }
.meter { position: absolute; right: -10px; bottom: 14px; width: 5px; height: 30px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter i { position: absolute; inset: 0; background: var(--good); transform-origin: bottom; transform: scaleY(.15); transition: transform .08s; }
.mic-status { font-size: 13px; color: var(--muted); text-align: center; min-height: 1.5em; }
.speech-result { padding: 16px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: 8px; text-align: center; }
.heard small { display: block; color: var(--muted); font-size: 12px; }
.verdict { font-weight: 600; color: var(--bad); }
.verdict.good { color: var(--good); }

/* feedback sheet */
.feedback { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; z-index: 20; width: min(600px, 100%); padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); border-radius: var(--r-xl) var(--r-xl) 0 0; display: grid; gap: 8px; background: var(--surface); box-shadow: 0 -12px 40px -16px rgba(0, 0, 0, .3); }
.fb-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; }
.fb-title .icon { width: 28px; height: 28px; padding: 5px; border-radius: 50%; color: #fff; }
.feedback.good .fb-title { color: var(--good); }
.feedback.good .fb-title .icon { background: var(--good); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback.bad .fb-title .icon { background: var(--bad); }
.combo { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--sun); color: var(--sun-ink); }
.fb-answer { font-size: 17px; font-weight: 600; }
.fb-answer small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.fb-explain { font-size: 14px; color: var(--muted); }
.fb-actions { display: flex; gap: 10px; margin-top: 6px; }
.fb-actions .primary { flex: 1; }
.fb-actions .ghost { padding: 0 16px; }

/* role-play */
.chat { display: grid; gap: 10px; }
.bubble { display: flex; gap: 8px; align-items: flex-start; max-width: 88%; }
.bubble > div { padding: 10px 14px; border-radius: 6px 18px 18px 18px; background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: 2px; }
.bubble.me { margin-left: auto; flex-direction: row-reverse; }
.bubble.me > div { border-radius: 18px 6px 18px 18px; background: var(--primary); color: var(--primary-ink); }
.bubble.me .bubble-zh { color: color-mix(in srgb, var(--primary-ink) 75%, transparent); }
.bubble.me .mini-play { color: var(--primary-ink); }
.avatar { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.bubble-en { font-weight: 600; }
.bubble-zh { font-size: 13px; color: var(--muted); }
.scene-intro { padding: 18px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: 14px; color: var(--ink-2); }
.scene-turn { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-l); background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); }
.scene-goal b { color: var(--primary); }

/* ---------- motion ---------- */
.pop { animation: pop .35s ease; }
.shake { animation: shake .4s ease; }
.rise { animation: rise .25s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes beacon { 0% { box-shadow: 0 0 0 3px var(--surface), inset 0 0 0 2px var(--primary), 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent); } 70%, 100% { box-shadow: 0 0 0 3px var(--surface), inset 0 0 0 2px var(--primary), 0 0 0 12px transparent; } }
@keyframes speak-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes talk { from { transform: scaleY(.3); } to { transform: scaleY(1.15); } }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ken { from { transform: scale(1); } to { transform: scale(1.035); } }
@keyframes ken-stage { from { transform: translateY(-50%) scale(1); } to { transform: translateY(-50%) scale(1.035); } }
@keyframes drift { from { transform: translateX(-8px); } to { transform: translateX(10px); } }
@keyframes rain { from { transform: translateY(-14px); } to { transform: translateY(14px); } }
@keyframes snow { from { transform: translateY(-10px); } to { transform: translateY(12px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
.float-text { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%); font-size: 22px; font-weight: 800; color: var(--amber); text-shadow: 0 2px 0 #ffffff; animation: float-up 1s cubic-bezier(.2, .8, .2, 1) forwards; white-space: nowrap; }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -90%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -250%) scale(1); } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti i { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; animation: fall 1.9s cubic-bezier(.25, .6, .4, 1) forwards; }
@keyframes fall { to { transform: translate(var(--drift), 560px) rotate(var(--spin)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 380px) {
  :root { --gutter: 16px; }
  .line-text, .sentence { font-size: 21px; }
  .word-en { font-size: 36px; }
}
@media (min-width: 600px) {
  .day-page { margin: 0; }
  .day-hero { border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .result-art, .welcome-art { border-radius: 0 0 var(--r-xl) var(--r-xl); }
}
.player:has(.feedback:not([hidden])) .stage { padding-bottom: 200px; }

.gate-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(100%, 430px); padding: clamp(20px, 6vw, 34px); }
.gate-card h1 { margin: 4px 0 8px; }
.gate-brand { font-weight: 750; margin: 0; }
.gate-email { overflow-wrap: anywhere; }
.gate-form { display: grid; gap: 12px; margin-top: 20px; }
.gate-form label { display: grid; gap: 5px; }
.gate-form input { width: 100%; min-width: 0; min-height: 44px; padding: 8px 11px; font: inherit; border: 1px solid currentColor; border-radius: 10px; background: transparent; color: inherit; }
.gate-status { min-height: 1.2em; margin: 0; }
.gate-status:empty { display: none; }
.gate-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.code-admin { max-width: 680px; margin: 0 auto; padding: 16px; }
.code-admin section { margin-block: 12px; }
.code-admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 8px; }
.code-admin-row code { font-weight: 700; overflow-wrap: anywhere; }

/* Study-time leaderboard (学习时长排行榜) */
.rank-card { background: var(--sun-soft); }
.rank-card-badge { width: 52px; height: 52px; display: grid; place-items: center; border-radius: var(--r-s); background: var(--sun); color: var(--sun-ink); }
.rank-card-badge .icon { width: 28px; height: 28px; }
.rank-top { display: flex; align-items: center; gap: 4px; padding: 18px 0 14px; margin-left: -8px; }
.rank-top h1 { font-size: 24px; }
.rank-tabs { display: flex; width: 100%; margin-bottom: 14px; }
.rank-tabs button { flex: 1; min-height: 38px; font-size: 15px; }
.rank-avatar { border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.rank-me { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; background: var(--primary-soft); }
.rank-me-copy { display: grid; gap: 2px; min-width: 0; }
.rank-me-copy b { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.rank-me-copy small { font-size: 13px; color: var(--ink-2); }
.rank-streak { display: inline-flex; align-items: center; gap: 4px; }
.rank-streak .icon { width: 14px; height: 14px; color: var(--coral); }
.rank-me-time { display: grid; text-align: right; }
.rank-me-time b { font-size: 20px; line-height: 1.2; color: var(--primary); white-space: nowrap; }
.rank-me-time small { font-size: 12px; color: var(--muted); }
.rank-edit { grid-column: 1 / -1; justify-self: start; background: var(--surface); }
.rank-list { list-style: none; margin: 12px 0 0; padding: 6px 10px; }
.rank-list li { display: grid; grid-template-columns: 30px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li.me { background: var(--primary-soft); border-radius: var(--r-s); border-bottom-color: transparent; }
.rank-no { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 700; color: var(--muted); }
.rank-no.top1 { background: var(--sun); color: var(--sun-ink); }
.rank-no.top2, .rank-no.top3 { background: var(--primary-soft); color: var(--primary); }
.rank-list li.me .rank-no.top2, .rank-list li.me .rank-no.top3 { background: var(--surface); }
.rank-name { display: grid; min-width: 0; }
.rank-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { font-size: 12px; color: var(--muted); }
.rank-me-tag { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-style: normal; font-weight: 600; vertical-align: 1px; }
.rank-time { font-size: 15px; font-weight: 600; white-space: nowrap; }
.rank-status { display: grid; justify-items: center; gap: 10px; margin-top: 12px; text-align: center; }
.rank-foot { margin: 16px 4px 0; font-size: 13px; }
.rank-sheet { max-height: 92vh; overflow-y: auto; }
.rank-label { margin-top: 4px; color: var(--ink); font-size: 14px; font-weight: 600; }
.rank-input { width: 100%; min-height: 46px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: inherit; }
.rank-input:focus { outline: none; border-color: var(--primary); }
.rank-avatars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.rank-avatars button { display: grid; justify-items: center; gap: 4px; padding: 6px 2px; border-radius: var(--r-s); }
.rank-avatars button.on { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.rank-avatars .rank-avatar { width: 100%; max-width: 48px; height: auto; aspect-ratio: 1; }
.rank-avatars small { color: var(--ink-2); font-size: 12px; }
.rank-show { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 15px; }
.rank-error { color: var(--bad); font-size: 14px; }
