/* ——— Fonts: Nunito for the UI; the Chinese fonts contain exactly three characters ——— */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url(../fonts/nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url(../fonts/nunito-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* The whole Chinese vocabulary of this app: 徐 偉 浩 (+ their zhuyin) */
@font-face {
  font-family: 'Hanzi';
  font-weight: 400 600;
  font-display: block;
  src: url(../fonts/sans-500.woff2) format('woff2');
  unicode-range: U+5F90, U+5049, U+6D69, U+3100-312F, U+02C7, U+02CA, U+02CB;
}
@font-face {
  font-family: 'Hanzi';
  font-weight: 700 900;
  font-display: block;
  src: url(../fonts/sans-900.woff2) format('woff2');
  unicode-range: U+5F90, U+5049, U+6D69, U+3100-312F, U+02C7, U+02CA, U+02CB;
}
@font-face { font-family: 'Hanzi Serif'; font-display: block; src: url(../fonts/serif.woff2) format('woff2'); }
@font-face { font-family: 'Hanzi Kai'; font-display: block; src: url(../fonts/kai.woff2) format('woff2'); }
@font-face { font-family: 'Hanzi Hand'; font-display: block; src: url(../fonts/hand.woff2) format('woff2'); }
@font-face { font-family: 'Hanzi Round'; font-display: block; src: url(../fonts/round.woff2) format('woff2'); }
@font-face { font-family: 'Hanzi Classic'; font-display: block; src: url(../fonts/classic.woff2) format('woff2'); }

/* ——— Tokens ——— */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #f0f0f0;
  --border: #e5e5e5;
  --text: #4b4b4b;
  --text-strong: #3c3c3c;
  --muted: #777777;
  --faint: #afafaf;
  --green: #58cc02;
  --green-dark: #58a700;
  --green-light: #d7ffb8;
  --green-text: #58a700;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --blue-light: #ddf4ff;
  --red: #ff4b4b;
  --red-dark: #ea2b2b;
  --red-light: #ffdfe0;
  --red-text: #ea2b2b;
  --gold: #ffc800;
  --gold-dark: #e5a800;
  --gold-light: #fff5d3;
  --orange: #ff9600;
  --orange-dark: #e08600;
  --purple: #ce82ff;
  --purple-dark: #a568cc;
  --pink: #ff86b6;
  --locked: #e5e5e5;
  --locked-dark: #c8c8c8;
  --t1: #afafaf;
  --t2: #1cb0f6;
  --t3: #ce82ff;
  --t4: #ff9600;
  --sheet-shadow: 0 -2px 0 var(--border);
  --radius: 16px;
  --font: 'Nunito', 'Hanzi', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-zh: 'Hanzi', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', 'Heiti TC', sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131f24;
    --surface: #131f24;
    --surface-2: #202f36;
    --surface-3: #2b3b43;
    --border: #37464f;
    --text: #f1f7fb;
    --text-strong: #ffffff;
    --muted: #a3b3bb;
    --faint: #52656d;
    --green-light: #1f3a14;
    --green-text: #79d634;
    --blue-light: #16303f;
    --red-light: #3f1e22;
    --red-text: #ff7878;
    --gold-light: #3a3217;
    --locked: #37464f;
    --locked-dark: #25333a;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #131f24;
  --surface: #131f24;
  --surface-2: #202f36;
  --surface-3: #2b3b43;
  --border: #37464f;
  --text: #f1f7fb;
  --text-strong: #ffffff;
  --muted: #a3b3bb;
  --faint: #52656d;
  --green-light: #1f3a14;
  --green-text: #79d634;
  --blue-light: #16303f;
  --red-light: #3f1e22;
  --red-text: #ff7878;
  --gold-light: #3a3217;
  --locked: #37464f;
  --locked-dark: #25333a;
  color-scheme: dark;
}

/* ——— Base ——— */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll {
  overflow: hidden;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  color: var(--text-strong);
  margin: 0;
  line-height: 1.2;
  font-weight: 800;
}
p {
  margin: 0;
}
.zh {
  font-family: var(--font-zh);
  font-weight: 700;
}
.muted {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--green);
}
.boot-logo,
.logo {
  font-weight: 900;
  font-size: 44px;
  letter-spacing: -1px;
  color: #fff;
}
.logo {
  color: var(--green);
}

/* ——— Buttons ——— */
.btn {
  --b: var(--green);
  --b-dark: var(--green-dark);
  --b-text: #fff;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--b);
  color: var(--b-text);
  box-shadow: 0 4px 0 var(--b-dark);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: filter 0.1s, transform 0.05s, box-shadow 0.05s;
  margin-bottom: 4px;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--b-dark);
}
.btn:disabled {
  --b: var(--locked);
  --b-dark: var(--locked);
  --b-text: var(--faint);
  cursor: default;
  filter: none;
}
.btn.wide {
  width: 100%;
}
.btn.blue {
  --b: var(--blue);
  --b-dark: var(--blue-dark);
}
.btn.red {
  --b: var(--red);
  --b-dark: var(--red-dark);
}
.btn.gold {
  --b: var(--gold);
  --b-dark: var(--gold-dark);
  --b-text: #fff;
}
.btn.orange {
  --b: var(--orange);
  --b-dark: var(--orange-dark);
}
.btn.ghost {
  --b: var(--surface);
  --b-dark: var(--border);
  --b-text: var(--blue);
  border: 2px solid var(--border);
}
.btn.ghost.plain {
  --b-text: var(--muted);
}
.btn.text {
  background: none;
  box-shadow: none;
  color: var(--blue);
  min-height: 40px;
}
.btn.text.muted {
  color: var(--muted);
}
.btn.small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 12px;
}
.btn.on-green {
  --b: #fff;
  --b-dark: rgba(0, 0, 0, 0.15);
  --b-text: var(--green);
}
.icon-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px;
  border-radius: 12px;
  color: var(--faint);
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* ——— App shell ——— */
.shell {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
.main {
  max-width: 600px;
  margin: 0 auto;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: calc(8px + var(--safe-t)) 16px 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stat-chip {
  appearance: none;
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  color: var(--faint);
}
.stat-chip:hover {
  background: var(--surface-2);
}
.stat-chip.on {
  color: var(--orange);
}
.stat-chip.xp {
  color: var(--gold-dark);
}
.stat-chip.pearls {
  color: var(--purple-dark);
}
.stat-chip.hearts {
  color: var(--red);
}
.stat-chip svg {
  width: 26px;
  height: 26px;
}
.course-flag {
  width: 36px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-family: var(--font-zh);
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 3px 0 var(--green-dark);
}
.nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--bg);
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.nav a {
  flex: 1;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 12px;
  border: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.nav a svg {
  width: 30px;
  height: 30px;
}
.nav a.active {
  color: var(--blue);
  background: var(--blue-light);
  border-color: #84d8ff;
}
.nav .nav-logo {
  display: none;
}
@media (min-width: 900px) {
  .shell {
    padding-bottom: 0;
    padding-left: 256px;
  }
  .nav {
    top: 0;
    right: auto;
    width: 256px;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    padding: 24px 16px;
    border-top: 0;
    border-right: 2px solid var(--border);
  }
  .nav .nav-logo {
    display: block;
    font-size: 32px;
    padding: 0 12px 20px;
  }
  .nav a {
    flex: 0;
    max-width: none;
    flex-direction: row;
    gap: 16px;
    padding: 10px 14px;
    font-size: 15px;
  }
  .nav a svg {
    width: 32px;
    height: 32px;
  }
}

/* ——— Learn: unit banners + path ——— */
.unit {
  padding: 20px 16px 8px;
}
.unit-banner {
  --u: var(--green);
  --u-dark: var(--green-dark);
  position: sticky;
  top: calc(56px + var(--safe-t));
  z-index: 10;
  background: var(--u);
  color: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 0 var(--u-dark);
}
.unit-banner .kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.85;
}
.unit-banner h2 {
  color: #fff;
  font-size: 20px;
}
.unit-banner .guide {
  flex: none;
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: none;
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}
.unit-banner .guide svg {
  width: 22px;
  height: 22px;
}
.path {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 72px 0 20px;
}
.path-node-wrap {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 66px;
}
.path-node-wrap.open {
  z-index: 12;
}
.path-node {
  --n: var(--green);
  --n-dark: var(--green-dark);
  appearance: none;
  border: 0;
  position: absolute;
  inset: 0;
  width: 72px;
  height: 64px;
  border-radius: 50%;
  background: var(--n);
  box-shadow: 0 8px 0 var(--n-dark);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.08s, box-shadow 0.08s;
}
.path-node svg {
  width: 34px;
  height: 34px;
}
.path-node:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--n-dark);
}
.path-node.locked {
  --n: var(--locked);
  --n-dark: var(--locked-dark);
  color: var(--faint);
}
.path-node.done {
  --n: var(--gold);
  --n-dark: var(--gold-dark);
}
.path-node.chest {
  background: none;
  box-shadow: none;
}
.path-node.chest svg {
  width: 64px;
  height: 64px;
}
.path-node.big {
  width: 86px;
  height: 78px;
  left: -7px;
  top: -6px;
}
.path-ring {
  position: absolute;
  left: -13px;
  top: -12px;
  width: 98px;
  height: 94px;
  pointer-events: none;
}
.start-bubble {
  position: absolute;
  left: 50%;
  top: -54px;
  transform: translateX(-50%);
  background: var(--bg);
  color: var(--green);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  animation: bob 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
.start-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 14px;
  height: 14px;
  background: var(--bg);
  border-right: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}
.path-mascot {
  position: absolute;
  width: 110px;
  pointer-events: none;
}
.path-popover {
  position: absolute;
  z-index: 15;
  left: 50%;
  top: 84px;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 32px));
  background: var(--green);
  color: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 0 var(--green-dark);
  animation: pop 0.18s ease-out;
}
.path-popover.locked {
  background: var(--surface-2);
  color: var(--muted);
  border: 2px solid var(--border);
  box-shadow: none;
}
.path-popover.done {
  background: var(--gold);
  box-shadow: 0 4px 0 var(--gold-dark);
}
.path-popover h3 {
  color: inherit;
  font-size: 18px;
  margin-bottom: 4px;
}
.path-popover p {
  font-size: 15px;
  margin-bottom: 14px;
  opacity: 0.95;
}
.path-popover::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -8px;
  width: 16px;
  height: 16px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 3px;
}
.path-popover.locked::before {
  border-left: 2px solid var(--border);
  border-top: 2px solid var(--border);
  top: -9px;
}
.path-popover .btn {
  width: 100%;
}
.path-popover.locked .btn {
  margin-top: 4px;
}
.unit-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-weight: 800;
  padding: 8px 16px 0;
}
.unit-divider::before,
.unit-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
}
.course-end {
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--muted);
}
.course-end .bobo {
  width: 120px;
  margin: 0 auto 8px;
}
.broken-streak {
  margin: 16px 16px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid var(--border);
}
.broken-streak .bobo {
  width: 64px;
  flex: none;
}

/* ——— Cards & lists ——— */
.page {
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page-title {
  font-size: 26px;
}
.card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface);
}
.card.tap {
  appearance: none;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom-width: 4px;
  transition: transform 0.05s;
}
.card.tap:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  margin-bottom: 2px;
}
.card h3 {
  font-size: 18px;
}
.card .sub {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}
.card-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 30px;
  color: #fff;
}
.section-title {
  font-size: 20px;
  margin-bottom: -6px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-tile {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.stat-tile svg {
  width: 28px;
  height: 28px;
  flex: none;
}
.stat-tile b {
  display: block;
  font-size: 20px;
  color: var(--text-strong);
  font-weight: 900;
}
.stat-tile span {
  font-size: 13px;
  color: var(--muted);
}
.progress {
  height: 16px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--green);
  transition: width 0.35s cubic-bezier(0.4, 1.4, 0.6, 1);
  position: relative;
}
.progress > i::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 4px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
}
.progress.gold > i {
  background: var(--gold);
}
.progress.thin {
  height: 10px;
}
.progress.thin > i::after {
  display: none;
}

/* ——— Toggles (settings) ——— */
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 2px solid var(--border);
}
.setting:last-child {
  border-bottom: 0;
}
.setting .sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}
.switch {
  appearance: none;
  flex: none;
  width: 52px;
  height: 32px;
  border-radius: 99px;
  background: var(--locked);
  position: relative;
  border: 0;
  transition: background 0.15s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch[aria-checked='true'] {
  background: var(--blue);
}
.switch[aria-checked='true']::after {
  transform: translateX(20px);
}
.seg {
  display: inline-flex;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.seg button {
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
}
.seg button[aria-pressed='true'] {
  background: var(--blue-light);
  color: var(--blue);
}

/* ——— Overlays: full-screen lesson, modal, sheet ——— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: fade-in 0.15s ease-out;
}
.overlay-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.15s ease-out;
}
@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}
.modal {
  width: min(560px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + var(--safe-b));
  animation: slide-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@media (min-width: 640px) {
  .modal {
    border-radius: 20px;
    padding-bottom: 20px;
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 {
  font-size: 22px;
}
.modal .stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--text-strong);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.2s ease-out;
  text-align: center;
}
.toast button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 900;
  margin-left: 8px;
  text-transform: uppercase;
}

/* ——— Lesson ——— */
.lesson-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 8px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}
.lesson-head .progress {
  flex: 1;
}
.hearts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--red);
  font-weight: 900;
  font-size: 18px;
}
.hearts svg {
  width: 28px;
  height: 28px;
}
.hearts.lost {
  animation: shake 0.4s;
}
.lesson-body {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ex-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-strong);
}
.ex-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--purple-dark);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.ex-kicker.new {
  color: var(--purple-dark);
}
.lesson-foot {
  border-top: 2px solid var(--border);
  padding: 16px 16px calc(16px + var(--safe-b));
}
.lesson-foot-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.lesson-foot .btn.check {
  min-width: 150px;
}
@media (max-width: 640px) {
  .lesson-foot-inner {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .lesson-foot .btn {
    width: 100%;
  }
  .lesson-foot .btn.text {
    min-height: 32px;
    margin: -4px 0;
  }
}
.feedback {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 16px 16px calc(16px + var(--safe-b));
  background: var(--green-light);
  animation: slide-up 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
.feedback.bad {
  background: var(--red-light);
}
.feedback.meh {
  background: var(--gold-light);
}
.feedback-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.feedback .verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--green-text);
  flex: 1 1 260px;
  min-width: 0;
}
.feedback.bad .verdict {
  color: var(--red-text);
}
.feedback.meh .verdict {
  color: var(--gold-dark);
}
.feedback .badge {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
}
.feedback .badge svg {
  width: 38px;
  height: 38px;
}
.feedback h2 {
  color: inherit;
  font-size: 24px;
}
.feedback .answer {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}
.feedback .answer .zh {
  font-size: 20px;
}
.feedback .btn {
  min-width: 150px;
}
@media (max-width: 640px) {
  .feedback .btn {
    width: 100%;
  }
  .feedback .badge {
    display: none;
  }
}

/* Prompts */
.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.bubble-row .bobo {
  width: 96px;
  flex: none;
}
.bubble {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  background: var(--bg);
  margin-bottom: 28px;
  min-width: 0;
}
.bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 18px;
  width: 16px;
  height: 16px;
  background: var(--bg);
  border-left: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  transform: rotate(45deg);
}
.audio-btn {
  --a: var(--blue);
  --a-dark: var(--blue-dark);
  appearance: none;
  border: 0;
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--a);
  box-shadow: 0 4px 0 var(--a-dark);
  color: #fff;
  display: grid;
  place-items: center;
}
.audio-btn svg {
  width: 36px;
  height: 36px;
}
.audio-btn.big {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  box-shadow: 0 6px 0 var(--a-dark);
}
.audio-btn.big svg {
  width: 64px;
  height: 64px;
}
.audio-btn.slow {
  width: 52px;
  height: 52px;
  --a: var(--blue);
}
.audio-btn.slow svg {
  width: 30px;
  height: 30px;
}
.audio-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--a-dark);
}
.audio-btn.playing svg {
  animation: pulse 0.6s ease-in-out infinite;
}
.audio-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
}
.big-hanzi {
  font-family: var(--font-zh);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.1;
  letter-spacing: 2px;
}
.ruby {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 3px;
}
.ruby rt,
.ruby .rt {
  font-family: var(--font);
  font-size: 0.32em;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.2;
}
.ruby .rt.zy {
  font-family: var(--font-zh);
}
.tone-2 {
  color: var(--t2);
}
.tone-3 {
  color: var(--t3);
}
.tone-4 {
  color: var(--t4);
}
.tone-1 {
  color: var(--t1);
}

/* Choice options */
.options {
  display: grid;
  gap: 12px;
}
.options.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.options.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.option {
  appearance: none;
  position: relative;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  transition: transform 0.05s, background 0.1s, border-color 0.1s;
}
.option:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
  margin-bottom: 2px;
}
.option .key {
  flex: none;
  width: 30px;
  height: 30px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--faint);
}
.option.tall {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  min-height: 150px;
  gap: 6px;
}
.option.tall .key {
  position: absolute;
  right: 10px;
  bottom: 10px;
}
.option .opt-hanzi {
  font-family: var(--font-zh);
  font-size: 56px;
  line-height: 1.1;
  font-weight: 700;
}
.option .opt-sub {
  color: var(--muted);
  font-size: 14px;
}
.option svg.tone-shape {
  width: 64px;
  height: 48px;
}
.option.selected {
  border-color: #84d8ff;
  background: var(--blue-light);
  color: var(--blue-dark);
}
.option.selected .key {
  border-color: #84d8ff;
  color: var(--blue);
}
.option.right {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-text);
}
.option.wrong {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red-text);
  animation: shake 0.35s;
}
.option:disabled {
  cursor: default;
}
.option.audio-option {
  justify-content: flex-start;
}
.option .mini-audio {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 var(--blue-dark);
}
.option .mini-audio svg {
  width: 26px;
  height: 26px;
}
.option.playing .mini-audio svg {
  animation: pulse 0.6s ease-in-out infinite;
}
.font-sample {
  font-size: 64px;
  line-height: 1.15;
  color: var(--text-strong);
  text-align: center;
  padding: 18px 8px;
  border: 2px solid var(--border);
  border-radius: 16px;
}
.tf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Match */
.match {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.match .col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.match .option {
  justify-content: center;
  text-align: center;
  min-height: 64px;
}
.match .option .opt-hanzi {
  font-size: 34px;
}
.match .option.gone {
  opacity: 0.35;
  border-color: var(--border);
  background: var(--bg);
  color: var(--faint);
  pointer-events: none;
}

/* Build (tile bank) */
.build-answer {
  min-height: 84px;
  border-bottom: 2px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 12px;
  align-items: center;
  justify-content: center;
}
.build-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding-top: 8px;
}
.tile {
  appearance: none;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 14px;
  min-width: 64px;
  height: 64px;
  padding: 0 12px;
  font-family: var(--font-zh);
  font-size: 34px;
  font-weight: 700;
  color: var(--text-strong);
}
.tile.latin {
  font-family: var(--font);
  font-size: 20px;
}
.tile.placeholder {
  background: var(--surface-3);
  border-color: var(--surface-3);
  color: transparent;
}
.tile:active {
  transform: translateY(2px);
}

/* Grid ("tap every 偉") and word search */
.hgrid {
  display: grid;
  gap: 8px;
  margin: 0 auto;
  width: min(100%, 380px);
}
.hgrid .cell {
  appearance: none;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 12px;
  background: var(--bg);
  font-family: var(--font-zh);
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 700;
  color: var(--text-strong);
  display: grid;
  place-items: center;
  padding: 0;
}
.hgrid .cell.selected {
  border-color: #84d8ff;
  background: var(--blue-light);
  color: var(--blue-dark);
}
.hgrid .cell.right {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-text);
}
.hgrid .cell.wrong {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red-text);
}
.hgrid .cell.missed {
  border-color: var(--gold);
  background: var(--gold-light);
}

/* Intro card */
.intro-card {
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.intro-card .big-hanzi {
  font-size: 120px;
}
.writer-box {
  width: 200px;
  height: 200px;
  position: relative;
  border-radius: 16px;
  background:
    linear-gradient(var(--border), var(--border)) center/2px 100% no-repeat,
    linear-gradient(var(--border), var(--border)) center/100% 2px no-repeat;
  display: grid;
  place-items: center;
}
.writer-box.small {
  width: 150px;
  height: 150px;
}
.writer-box svg {
  position: absolute;
  inset: 0;
}
.writer-box .big-hanzi {
  font-size: 160px;
  line-height: 1;
}
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  text-align: left;
  width: 100%;
  font-size: 16px;
}
.facts dt {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-top: 2px;
}
.facts dd {
  margin: 0;
  color: var(--text-strong);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
}

/* Tip cards */
.tip-card {
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tip-card h3 {
  font-size: 20px;
}
.tip-card p {
  font-size: 17px;
  font-weight: 700;
}
.tone-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
}
.tone-card {
  appearance: none;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-strong);
}
.tone-card .zh {
  font-size: 36px;
}
.tone-card svg {
  width: 60px;
  height: 40px;
}
.tone-card small {
  color: var(--muted);
  font-size: 13px;
}
.tone-card b {
  font-size: 15px;
}

/* Speaking */
.speak-target {
  text-align: center;
}
.speak-target .big-hanzi {
  font-size: 64px;
}
.mic-btn {
  appearance: none;
  width: 100%;
  min-height: 76px;
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 16px;
  background: var(--bg);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.mic-btn svg {
  width: 32px;
  height: 32px;
}
.mic-btn.recording {
  border-color: var(--blue);
  background: var(--blue-light);
}
.mic-btn.busy {
  color: var(--muted);
}
.mic-btn .level {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--blue);
  width: 0;
  transition: width 0.08s;
}
.tone-graph {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.tone-graph svg {
  display: block;
  width: 100%;
  height: auto;
}
.tone-graph .hint {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  border-top: 2px solid var(--border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.legend-model,
.legend-you {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-model::before,
.legend-you::before {
  content: '';
  width: 18px;
  height: 0;
  border-top: 3px dashed var(--faint);
}
.legend-you::before {
  border-top: 4px solid var(--blue);
}
.syl-scores {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
}
.syl-score {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 8px 6px;
  text-align: center;
}
.syl-score .zh {
  font-size: 28px;
  display: block;
  line-height: 1.2;
}
.syl-score b {
  font-size: 18px;
  font-weight: 900;
}
.syl-score.good {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-text);
}
.syl-score.ok {
  border-color: var(--gold);
  background: var(--gold-light);
  color: var(--gold-dark);
}
.syl-score.bad {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red-text);
}
.score-ring {
  position: relative;
  width: 84px;
  height: 84px;
  flex: none;
}
.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-ring b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--text-strong);
}
.speak-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.speak-summary {
  display: flex;
  gap: 14px;
  align-items: center;
}
.speak-summary p {
  font-size: 16px;
}
.speak-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.speak-actions .btn {
  flex: 1;
}

/* ——— Onboarding ——— */
.onb {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.onb-body {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.onb-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 24px 16px;
}
.onb-hero .bobo {
  width: 180px;
}
.onb-hero h1 {
  font-size: 26px;
  max-width: 420px;
}
.onb-foot {
  padding: 16px 16px calc(16px + var(--safe-b));
  border-top: 2px solid var(--border);
}
.onb-foot-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.text-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 700;
  outline: none;
}
.text-input:focus {
  border-color: var(--blue);
}

/* ——— Completion / results ——— */
.result {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.result .bobo {
  width: 170px;
}
.result h1 {
  font-size: 30px;
  color: var(--gold-dark);
}
.result-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
.result-tile {
  --c: var(--gold);
  border: 2px solid var(--c);
  border-radius: 16px;
  overflow: hidden;
  background: var(--c);
}
.result-tile .label {
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px;
}
.result-tile .value {
  background: var(--bg);
  border-radius: 13px;
  padding: 12px 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 900;
  color: var(--c);
}
.result-tile .value svg {
  width: 22px;
  height: 22px;
}
.result-tile.green {
  --c: var(--green);
}
.result-tile.blue {
  --c: var(--blue);
}
.streak-big {
  font-size: 96px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
}
.week {
  display: flex;
  gap: 8px;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
}
.week span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.week i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
}
.week i.on {
  background: var(--orange);
  color: #fff;
}
.week i svg {
  width: 16px;
  height: 16px;
}

/* ——— Characters tab ——— */
.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.char-tile {
  appearance: none;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-strong);
}
.char-tile .zh {
  font-size: 48px;
  line-height: 1.1;
}
.char-tile .py {
  color: var(--muted);
  font-size: 15px;
}
.char-tile .progress {
  width: 100%;
  margin-top: 6px;
}
.font-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.font-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}
.font-card .sample {
  font-size: 40px;
  color: var(--text-strong);
  line-height: 1.25;
}
.font-card small {
  color: var(--muted);
  font-size: 12px;
}

/* ——— Profile ——— */
.profile-head {
  display: flex;
  gap: 16px;
  align-items: center;
}
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 900;
  color: #fff;
  background: var(--blue);
  flex: none;
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border);
}
.avatar.small {
  width: 44px;
  height: 44px;
  font-size: 20px;
  border-width: 2px;
}
.avatar.zh {
  font-family: var(--font-zh);
}
.league-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 2px solid var(--border);
}
.league-row:last-child {
  border-bottom: 0;
}
.league-row .rank {
  width: 22px;
  text-align: center;
  font-weight: 900;
  color: var(--muted);
}
.league-row .rank.top {
  color: var(--gold-dark);
}
.league-row .who {
  flex: 1;
  min-width: 0;
}
.league-row .who small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.league-row.me {
  background: var(--blue-light);
  border-radius: 12px;
  border-bottom-color: transparent;
}
.league-row .bobo {
  width: 44px;
}
.achievement {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 2px solid var(--border);
}
.achievement:last-child {
  border-bottom: 0;
}
.achievement .medal {
  flex: none;
  width: 60px;
  height: 66px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: var(--locked);
  color: var(--faint);
  font-family: var(--font-zh);
  font-weight: 900;
}
.achievement.got .medal {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 4px 0 var(--gold-dark);
}
.achievement .info {
  flex: 1;
  min-width: 0;
}
.achievement .info small {
  color: var(--muted);
  font-size: 14px;
  display: block;
  font-weight: 700;
}

/* ——— Story ——— */
.story-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: pop 0.25s ease-out;
}
.story-line .who {
  flex: none;
  width: 52px;
}
.story-line .bobo {
  width: 52px;
}
.story-line .bubble {
  margin-bottom: 0;
  flex: 1;
}
.story-line .bubble::before {
  bottom: auto;
  top: 16px;
}
.story-line .line-zh {
  font-family: var(--font-zh);
  font-size: 30px;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-line .line-en {
  color: var(--muted);
  font-size: 15px;
  margin-top: 2px;
}
.story-narration {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 12px;
  animation: pop 0.25s ease-out;
}
.story-title {
  text-align: center;
}
.story-title .bobo {
  width: 120px;
  margin: 0 auto;
}
.mini-play {
  appearance: none;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.mini-play svg {
  width: 20px;
  height: 20px;
}

/* ——— Certificate ——— */
.cert-preview {
  width: 100%;
  border-radius: 12px;
  border: 2px solid var(--border);
  display: block;
}

/* ——— Mascot ——— */
.bobo {
  display: block;
  overflow: visible;
}
.bobo .eyes {
  transform-origin: 60px 74px;
  animation: blink 5s infinite;
}
.bobo.bob {
  animation: bob 2.2s ease-in-out infinite;
}
.bobo .arm-r {
  transform-origin: 98px 86px;
}
.bobo.wave .arm-r {
  animation: wave 0.9s ease-in-out infinite;
}
.bobo.jump {
  animation: jump 0.7s ease-in-out infinite;
}
.bobo .m {
  display: none;
}
.bobo.mood-happy .m-happy,
.bobo.mood-cheer .m-cheer,
.bobo.mood-sad .m-sad,
.bobo.mood-judge .m-judge,
.bobo.mood-wow .m-wow,
.bobo.mood-think .m-think {
  display: inline;
}
.bobo.mood-cheer .eyes-open,
.bobo.mood-judge .eyes-open-hl {
  display: none;
}

/* ——— Confetti ——— */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
}

/* ——— Animations ——— */
@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
.start-bubble {
  animation-name: bob-x;
}
@keyframes bob-x {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -6px);
  }
}
@keyframes jump {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  20% {
    transform: translateY(0) scale(1.06, 0.94);
  }
  50% {
    transform: translateY(-16px) scale(0.97, 1.03);
  }
}
@keyframes wave {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-35deg);
  }
}
@keyframes blink {
  0%,
  95%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.path-popover {
  animation-name: pop-x;
}
@keyframes pop-x {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ——— Icon sizing inside components ——— */
.ex-kicker svg {
  width: 22px;
  height: 22px;
}
.card-icon svg {
  width: 32px;
  height: 32px;
}
.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}
.result > div > svg,
.result .flame svg {
  width: 100%;
  height: auto;
}
.medal svg {
  width: 32px;
  height: 32px;
}

.feedback-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .feedback-actions {
    width: 100%;
  }
}
@media (pointer: coarse), (max-width: 640px) {
  .option .key {
    display: none;
  }
}

/* Keep the status bar aligned with the 600px content column on wide screens */
.topbar {
  padding-left: max(16px, calc((100% - 568px) / 2));
  padding-right: max(16px, calc((100% - 568px) / 2));
}
/* Room for the START bubble above the current lesson */
.path-node-wrap:has(.start-bubble) {
  margin-top: 40px;
}
