:root {
  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-hanzi: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Source Han Sans SC', sans-serif;
  --canvas: #FAF9F6;
  --paper: #FFFEFB;
  --paper-beige: #F3ECE4;
  --sand: #EADFD2;
  --ink: #1E293B;
  --muted: #5B6472;
  --jade: #0D9488;
  --jade-dark: #0F766E;
  --jade-soft: #DDF3EC;
  --coral: #E11D48;
  --coral-dark: #BE123C;
  --coral-soft: #FCE7ED;
  --sun: #F2C94C;
  --sun-soft: #FFF4C9;
  --lime: #DBFF85;
  --line: #DEDCD5;
  --line-dark: #B9B8B0;
  --shadow: 0 12px 0 rgba(30, 41, 59, .035);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --header-h: 72px;
  --dock-h: 88px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, [role="button"] { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--jade); outline-offset: 3px; }
::selection { background: var(--lime); color: var(--ink); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
.font-hanzi { font-family: var(--font-hanzi); font-style: normal; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 200; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.loading-screen { position: fixed; inset: 0; z-index: 150; display: grid; place-content: center; justify-items: center; background: var(--canvas); }
.loading-mark { width: 78px; height: 78px; display: grid; place-items: center; margin-bottom: 18px; border: 2px solid var(--ink); border-radius: 22px 8px 22px 8px; background: var(--sun); font-size: 42px; font-weight: 800; animation: loading-bob 1.5s var(--ease) infinite alternate; }
.loading-screen > strong { font-size: 32px; letter-spacing: -.07em; }
.loading-screen > strong span { color: var(--jade); }
.loading-screen p { color: var(--muted); font-size: 13px; }
@keyframes loading-bob { to { transform: translateY(-8px) rotate(3deg); } }

.topbar { position: sticky; top: 0; z-index: 40; height: var(--header-h); border-bottom: 1px solid var(--line); background: rgba(250, 249, 246, .95); backdrop-filter: blur(16px); }
.topbar-inner { max-width: 1440px; height: 100%; margin: auto; padding: 0 32px; display: flex; align-items: center; gap: 30px; }
.brand { min-height: 48px; padding: 0; display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; }
.brand-symbol { width: 38px; height: 38px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 12px 5px 12px 5px; background: var(--sun); font-size: 21px; font-weight: 800; transition: transform 180ms var(--ease); }
.brand:hover .brand-symbol { transform: rotate(-6deg) scale(1.05); }
.brand-word { font-size: 29px; font-weight: 800; letter-spacing: -.075em; }
.brand-word > span { color: var(--jade); }
.desktop-nav { display: flex; align-items: center; gap: 3px; }
.nav-btn { min-height: 44px; padding: 9px 13px; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; transition: background 150ms, color 150ms, transform 150ms; }
.nav-btn svg { width: 17px; height: 17px; }
.nav-btn:hover { background: var(--paper-beige); color: var(--ink); }
.nav-btn:active { transform: scale(.96); }
.nav-btn.active { background: var(--ink); color: white; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.language-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.language-switch button { width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.language-switch button.active { background: var(--jade-soft); color: var(--jade-dark); }
.xp-chip { min-height: 44px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--ink); border-radius: 12px; background: var(--lime); font-size: 12px; box-shadow: 2px 2px 0 var(--ink); transition: transform 150ms, box-shadow 150ms; }
.xp-chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.xp-chip svg { width: 16px; height: 16px; fill: var(--ink); }
.icon-btn { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 11px; background: transparent; color: var(--muted); transition: background 150ms, color 150ms, transform 150ms; }
.icon-btn:hover { background: var(--jade-soft); color: var(--jade-dark); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.speaking { background: var(--sun-soft); color: var(--ink); animation: sound-pulse .8s infinite alternate; }
@keyframes sound-pulse { to { transform: scale(1.08); } }

.curriculum-dock { position: sticky; top: var(--header-h); z-index: 30; min-height: var(--dock-h); border-bottom: 1px solid var(--line); background: rgba(255, 254, 251, .96); backdrop-filter: blur(14px); }
.curriculum-inner { max-width: 1440px; min-height: var(--dock-h); margin: auto; padding: 12px 32px; display: flex; align-items: center; gap: 24px; }
.version-switch { flex: 0 0 auto; display: flex; gap: 5px; padding: 4px; border-radius: 12px; background: var(--paper-beige); }
.version-switch button { min-width: 112px; min-height: 52px; padding: 7px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.version-switch button strong { display: block; font-size: 12px; }
.version-switch button span { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; }
.version-switch button i { padding: 1px 4px; border-radius: 3px; background: var(--coral); color: white; font-size: 7px; font-style: normal; letter-spacing: .08em; vertical-align: 2px; }
.version-switch button.active { border-color: var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.version-switch button[data-version="3.0"].active { border-color: var(--coral); box-shadow: 2px 2px 0 var(--coral); }
.level-track { flex: 1; min-width: 0; padding: 2px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(74px, 1fr); gap: 8px; overflow-x: auto; scrollbar-width: none; }
.level-track::-webkit-scrollbar { display: none; }
.level-btn { position: relative; min-height: 54px; padding: 7px 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--canvas); text-align: left; transition: transform 150ms, border-color 150ms, background 150ms; }
.level-btn:hover { transform: translateY(-2px); border-color: var(--jade); }
.level-btn strong { position: relative; z-index: 1; display: block; font-size: 13px; }
.level-btn span { position: relative; z-index: 1; display: block; color: var(--muted); font-size: 9px; }
.level-btn .level-mini-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #ECEAE4; }
.level-btn .level-mini-track i { display: block; height: 100%; background: var(--jade); }
.level-btn.active { border-color: var(--ink); background: var(--jade-soft); box-shadow: 2px 2px 0 var(--ink); }
.level-btn.active span { color: var(--jade-dark); }
.level-btn.v3.active { background: var(--coral-soft); }
.level-btn.v3 .level-mini-track i { background: var(--coral); }
.streak-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; color: var(--coral); font-size: 12px; }
.streak-chip svg { fill: var(--coral-soft); }
.streak-chip span { color: var(--muted); font-size: 10px; }

.app-main { max-width: 1280px; min-height: calc(100dvh - 210px); margin: auto; padding: 38px 32px 70px; outline: 0; }
.view-enter { animation: view-in 320ms var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 12px; color: var(--jade-dark); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 20px; height: 2px; background: currentColor; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1, h2, h3 { margin-top: 0; }
.page-title { margin: 0; font-size: clamp(31px, 4vw, 48px); line-height: 1.12; letter-spacing: -.05em; }
.page-subtitle { max-width: 640px; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.section-head { margin: 36px 0 16px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.text-link { min-height: 44px; padding: 8px 0; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--jade-dark); font-size: 12px; font-weight: 800; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.btn { min-height: 48px; padding: 12px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 800; text-decoration: none; transition: transform 150ms var(--ease), box-shadow 150ms, background 150ms; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn-primary { background: var(--ink); color: white; box-shadow: 3px 3px 0 rgba(30, 41, 59, .25); }
.btn-primary:hover { background: #0F172A; box-shadow: 5px 5px 0 var(--jade); }
.btn-jade { background: var(--jade); color: white; }
.btn-jade:hover { box-shadow: 4px 4px 0 var(--ink); }
.btn-coral { border-color: var(--coral-dark); background: var(--coral); color: white; }
.btn-coral:hover { box-shadow: 4px 4px 0 var(--coral-dark); }
.btn-soft { border-color: transparent; background: var(--jade-soft); color: var(--jade-dark); }
.btn-soft:hover { box-shadow: 3px 3px 0 var(--jade); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper-beige); box-shadow: none; }
.btn-small { min-height: 42px; padding: 9px 13px; font-size: 11px; }
.btn svg { width: 17px; height: 17px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 22px; align-items: stretch; }
.mission-card { position: relative; min-height: 414px; padding: 36px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(250px, .95fr); overflow: hidden; border: 1.5px solid var(--ink); border-radius: 25px 9px 25px 9px; background: var(--sun); box-shadow: var(--shadow); }
.mission-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .12; background-image: radial-gradient(var(--ink) .8px, transparent .8px); background-size: 7px 7px; mask-image: linear-gradient(90deg, transparent 35%, black); }
.mission-copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; }
.mission-label { padding: 6px 10px; border: 1px solid var(--ink); border-radius: 6px; background: rgba(255,255,255,.4); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mission-card h1 { max-width: 460px; margin: 23px 0 13px; font-size: clamp(38px, 4.3vw, 59px); line-height: 1.02; letter-spacing: -.06em; }
.mission-card h1 .hanzi-accent { font-family: var(--font-hanzi); font-weight: 800; }
.mission-card p { max-width: 430px; margin: 0 0 25px; font-size: 14px; line-height: 1.7; }
.mission-copy .button-row { margin-top: auto; }
.mission-visual { position: relative; z-index: 1; min-height: 260px; display: grid; place-items: center; }
.mission-visual .scene { width: 118%; max-width: 390px; transform: rotate(2deg); filter: drop-shadow(8px 12px 0 rgba(30,41,59,.1)); }
.daily-panel { padding: 28px; display: flex; flex-direction: column; border: 1.5px solid var(--ink); border-radius: 9px 25px 9px 25px; background: var(--ink); color: white; }
.daily-panel .eyebrow { color: var(--lime); }
.daily-panel h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.daily-ring { width: 156px; height: 156px; margin: 25px auto 20px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--lime) var(--ring-angle), rgba(255,255,255,.13) 0); transform: rotate(-35deg); }
.daily-ring::before { content: ''; grid-area: 1/1; width: 122px; height: 122px; border-radius: 50%; background: var(--ink); }
.daily-ring > div { position: relative; grid-area: 1/1; text-align: center; transform: rotate(35deg); }
.daily-ring strong { display: block; font-size: 31px; line-height: 1.1; }
.daily-ring span { color: #CBD5E1; font-size: 10px; }
.daily-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; padding-top: 18px; border-top: 1px solid #475569; }
.daily-stats strong { display: block; font-size: 19px; }
.daily-stats span { color: #CBD5E1; font-size: 10px; }

.quick-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; margin-top: 22px; }
.quick-card { min-height: 150px; padding: 24px; display: flex; align-items: center; gap: 22px; border: 1px solid var(--line-dark); border-radius: 18px; background: var(--paper); text-align: left; transition: transform 180ms var(--ease), box-shadow 180ms; }
.quick-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 6px 7px 0 var(--sand); }
.quick-card:nth-child(2):hover { transform: translateY(-4px) rotate(.4deg); }
.quick-icon { width: 66px; height: 66px; flex: 0 0 auto; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50% 50% 12px 50%; background: var(--jade-soft); }
.quick-card:nth-child(2) .quick-icon { border-radius: 12px 50% 50% 50%; background: var(--coral-soft); }
.quick-icon svg { width: 28px; height: 28px; }
.quick-card h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.03em; }
.quick-card p { margin: 0; color: var(--muted); font-size: 12px; }
.quick-card > svg { margin-left: auto; }
.week-card { margin-top: 22px; padding: 24px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.week-head h2 { margin: 0; font-size: 16px; }
.week-head span { color: var(--muted); font-size: 11px; }
.week-bars { height: 130px; margin-top: 18px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; align-items: end; }
.day-bar { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 8px; align-items: end; text-align: center; }
.day-bar-track { width: min(34px, 80%); height: 100%; margin: auto; display: flex; align-items: end; border-radius: 7px 7px 3px 3px; background: var(--paper-beige); overflow: hidden; }
.day-bar-fill { width: 100%; min-height: 3px; border-radius: inherit; background: var(--jade); }
.day-bar.today .day-bar-fill { background: var(--coral); }
.day-bar span { color: var(--muted); font-size: 10px; font-weight: 700; }
.discover-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.discover-word { min-height: 96px; padding: 17px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); text-align: left; }
.discover-word:hover { border-color: var(--jade); background: var(--jade-soft); }
.discover-word .mini-hanzi { font-family: var(--font-hanzi); font-size: 30px; font-weight: 700; }
.discover-word strong { display: block; font-size: 12px; }
.discover-word span { display: block; color: var(--muted); font-size: 10px; }

/* Illustrated, flat geometric learning scenes */
.scene { display: block; width: 100%; height: auto; }
.scene .scene-outline { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.scene .scene-hanzi { font-family: var(--font-hanzi); font-weight: 800; fill: var(--ink); }
.scene-wrap { position: relative; overflow: hidden; border-radius: 14px; background: var(--paper-beige); }
.scene-wrap::after { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(30,41,59,.23) .65px, transparent .65px); background-size: 6px 6px; mix-blend-mode: multiply; opacity: .25; }
.scene-caption { position: absolute; left: 12px; bottom: 10px; z-index: 2; padding: 3px 7px; border: 1px solid var(--ink); border-radius: 5px; background: var(--paper); font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

.explore-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.level-total-badge { flex: 0 0 auto; padding: 13px 17px; border: 1px solid var(--ink); border-radius: 10px; background: var(--sun-soft); text-align: right; }
.level-total-badge strong { display: block; font-size: 23px; line-height: 1; }
.level-total-badge span { font-size: 9px; font-weight: 700; }
.explore-toolbar { position: relative; display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.search-box { min-height: 52px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); border-radius: 13px; background: var(--paper); }
.search-box > svg { color: var(--muted); }
.search-box input { width: 100%; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.search-box input::placeholder { color: #747B87; }
.filter-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper-beige); }
.filter-btn { min-height: 44px; padding: 8px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.filter-btn.active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(30,41,59,.1); }
.pinyin-toggle.active { background: var(--sun-soft); color: var(--ink); }
.results-line { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
.results-line p { margin: 0; }
.vocab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.word-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 17px 6px 17px 6px; background: var(--paper); transition: transform 180ms var(--ease), border-color 180ms, box-shadow 180ms; }
.word-card:hover { transform: translateY(-4px); border-color: var(--ink); box-shadow: 5px 6px 0 var(--sand); }
.word-card.known { border-color: #8ACFC1; }
.word-scene-button { position: relative; width: 100%; height: 124px; padding: 0; display: block; overflow: hidden; border: 0; background: var(--paper-beige); text-align: left; }
.word-scene-button .scene-wrap { height: 100%; border-radius: 0; }
.word-scene-button .scene { width: 100%; height: 100%; object-fit: cover; }
.word-scene-button .scene-caption { bottom: 8px; }
.word-known-flag { position: absolute; top: 10px; right: 10px; z-index: 2; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; background: var(--lime); }
.word-known-flag svg { width: 14px; height: 14px; stroke-width: 3; }
.word-body { padding: 18px; }
.word-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.word-hanzi { font-family: var(--font-hanzi); font-size: 32px; line-height: 1.2; font-weight: 700; }
.word-pinyin { margin: 5px 0 0; color: var(--jade-dark); font-size: 12px; font-weight: 700; }
.word-pinyin.concealed { color: var(--muted); font-weight: 500; }
.word-meaning { min-height: 42px; margin: 10px 0 0; display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink); font-size: 12px; line-height: 1.7; }
.word-footer { margin-top: 14px; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.word-topic { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: capitalize; }
.word-audio { width: 44px; height: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--canvas); }
.word-audio svg { width: 16px; height: 16px; }
.pagination { margin-top: 26px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.pagination span { min-width: 110px; color: var(--muted); font-size: 11px; text-align: center; }
.empty-state { grid-column: 1/-1; padding: 55px 24px; border: 1.5px dashed var(--line-dark); border-radius: 18px; background: var(--paper); text-align: center; }
.empty-state .empty-hanzi { width: 65px; height: 65px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 50%; background: var(--sun-soft); font-family: var(--font-hanzi); font-size: 31px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { max-width: 470px; margin: 0 auto 20px; color: var(--muted); font-size: 13px; }

/* Flashcards and quiz */
.study-shell { max-width: 960px; margin: auto; }
.study-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.study-heading h1 { margin: 0; font-size: 30px; letter-spacing: -.045em; }
.study-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.study-progress-meta { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 700; }
.study-progress-track { height: 8px; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--ink); border-radius: 8px; background: var(--paper); }
.study-progress-fill { height: 100%; background: var(--jade); transition: width 300ms var(--ease); }
.study-progress-fill.coral { background: var(--coral); }
.flashcard { position: relative; height: 520px; perspective: 1400px; outline-offset: 5px; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 420ms var(--ease); }
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; padding: 25px 32px 30px; display: flex; flex-direction: column; align-items: center; border: 1.5px solid var(--ink); border-radius: 24px 8px 24px 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--paper); box-shadow: 7px 8px 0 var(--sand); text-align: center; overflow: auto; }
.flashcard-back { transform: rotateY(180deg); background: var(--jade-soft); box-shadow: 7px 8px 0 #A5D8CE; }
.flashcard-face .scene-wrap { width: min(390px, 80%); height: 188px; flex: 0 0 auto; border: 1px solid var(--ink); transform: rotate(-1deg); }
.flashcard-face .scene { width: 100%; height: 100%; }
.flashcard-face .scene-caption { display: none; }
.card-kicker { position: absolute; top: 22px; left: 25px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.card-audio { position: absolute; top: 12px; right: 15px; z-index: 2; border: 1px solid var(--line); background: var(--paper); }
.flashcard-hanzi { margin: 22px 0 0; font-family: var(--font-hanzi); font-size: clamp(58px, 8vw, 83px); line-height: 1.2; font-weight: 700; }
.flashcard-pinyin { margin: 8px 0 0; color: var(--jade-dark); font-size: 19px; font-weight: 700; }
.flashcard-pinyin.concealed { color: var(--muted); font-size: 12px; font-weight: 500; }
.flip-hint { margin-top: auto; padding-top: 16px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.flashcard-back .flashcard-face-title { margin: 25px 0 0; font-size: clamp(24px, 4vw, 35px); line-height: 1.3; letter-spacing: -.035em; }
.flashcard-back .back-pinyin { margin: 4px 0 0; color: var(--jade-dark); font-size: 15px; font-weight: 700; }
.card-example { width: 100%; margin-top: 20px; padding-top: 17px; border-top: 1px solid #A8D4CA; }
.example-hanzi { margin: 0; font-family: var(--font-hanzi); font-size: 18px; font-weight: 600; line-height: 1.6; }
.example-pinyin { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.example-meaning { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.flashcard-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 22px; }
.flashcard-actions .card-prev { justify-self: start; }
.flashcard-actions .card-flip { justify-self: center; }
.flashcard-actions .card-next { justify-self: end; }
.know-review-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-top: 13px; }
.know-review-actions .btn { min-height: 54px; }
.review-action { border-color: var(--coral); color: var(--coral-dark); }
.review-action:hover { box-shadow: 4px 4px 0 var(--coral); }
.study-complete { position: relative; max-width: 760px; margin: 25px auto; padding: 42px; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 25px 8px 25px 8px; background: var(--sun-soft); text-align: center; box-shadow: 7px 8px 0 var(--sand); }
.study-complete .scene-wrap { width: 250px; height: 150px; margin: 0 auto 20px; border: 1px solid var(--ink); }
.complete-mark { width: 58px; height: 58px; margin: 0 auto 17px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--lime); }
.complete-mark svg { width: 28px; height: 28px; stroke-width: 2.5; }
.study-complete h1 { margin: 0; font-size: 34px; letter-spacing: -.05em; }
.study-complete > p { max-width: 500px; margin: 10px auto 22px; color: var(--muted); font-size: 13px; }
.complete-stats { display: flex; justify-content: center; gap: 45px; margin: 23px 0; }
.complete-stats strong { display: block; font-size: 29px; }
.complete-stats span { color: var(--muted); font-size: 10px; }
.study-complete .button-row { justify-content: center; }

.quiz-intro { display: grid; grid-template-columns: 1fr 310px; min-height: 350px; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 24px 8px 24px 8px; background: var(--paper); }
.quiz-intro-copy { padding: 42px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.quiz-intro h1 { margin: 0; font-size: 39px; letter-spacing: -.05em; }
.quiz-intro p { margin: 12px 0 24px; color: var(--muted); font-size: 13px; }
.quiz-intro .scene-wrap { min-height: 100%; border-left: 1px solid var(--ink); border-radius: 0; background: var(--coral-soft); }
.quiz-intro .scene { width: 100%; height: 100%; }
.quiz-facts { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.quiz-facts span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; }
.quiz-facts svg { width: 15px; height: 15px; color: var(--jade); }
.quiz-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.quiz-topline h1 { margin: 0; font-size: 22px; }
.quiz-score { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.quiz-score svg { width: 15px; height: 15px; color: var(--coral); }
.quiz-card { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 475px; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 23px 8px 23px 8px; background: var(--paper); }
.quiz-scene { position: relative; min-height: 100%; border-right: 1px solid var(--ink); background: var(--paper-beige); }
.quiz-scene .scene { width: 100%; height: 100%; }
.quiz-scene .scene-caption { left: 18px; bottom: 18px; }
.quiz-content { min-width: 0; padding: 29px; display: flex; flex-direction: column; }
.quiz-type { margin: 0 0 13px; color: var(--jade-dark); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.quiz-prompt { margin: 0 0 20px; text-align: left; }
.prompt-instruction { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.prompt-hanzi { display: inline-block; font-family: var(--font-hanzi); font-size: clamp(44px, 6vw, 65px); line-height: 1.3; font-weight: 700; }
.prompt-pinyin { display: inline-block; font-size: clamp(27px, 4vw, 40px); line-height: 1.35; font-weight: 800; letter-spacing: -.03em; }
.prompt-sentence { display: block; font-family: var(--font-hanzi); font-size: 23px; line-height: 1.7; font-weight: 600; }
.prompt-audio { margin-left: 8px; vertical-align: 10px; border: 1px solid var(--line); }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quiz-option { position: relative; min-height: 59px; padding: 11px 35px 11px 13px; border: 1px solid var(--line-dark); border-radius: 11px; background: var(--canvas); text-align: left; font-size: 11px; font-weight: 700; transition: transform 140ms, border-color 140ms, background 140ms; }
.quiz-option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--jade); background: var(--jade-soft); }
.quiz-option .option-hanzi { font-family: var(--font-hanzi); font-size: 23px; font-weight: 600; }
.quiz-option.correct { border-color: var(--jade-dark); background: var(--jade-soft); color: var(--jade-dark); opacity: 1; }
.quiz-option.incorrect { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-dark); opacity: 1; }
.quiz-option.dimmed { opacity: .5; }
.option-state { position: absolute; top: 50%; right: 11px; width: 17px; height: 17px; transform: translateY(-50%); }
.quiz-feedback { min-height: 67px; margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-feedback:empty { display: none; }
.feedback-copy strong { display: block; font-size: 12px; }
.feedback-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.combo-pop { animation: combo-pop 300ms var(--ease); color: var(--coral); }
@keyframes combo-pop { 50% { transform: scale(1.2) rotate(-4deg); } }
.score-ring { width: 120px; height: 120px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--jade) var(--score-angle), var(--sand) 0); }
.score-ring::before { content: ''; grid-area: 1/1; width: 94px; height: 94px; border-radius: 50%; background: var(--sun-soft); }
.score-ring strong { position: relative; grid-area: 1/1; font-size: 30px; }

/* Placement and first-run story */
.onboarding { position: fixed; inset: 0; z-index: 100; overflow: auto; background: var(--canvas); }
.onboarding-top { min-height: 72px; padding: 12px 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.onboarding-top .brand { cursor: default; }
.onboarding-main { max-width: 1160px; min-height: calc(100dvh - 72px); margin: auto; padding: 38px 32px 50px; display: grid; align-items: center; }
.welcome-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 60px; align-items: center; }
.welcome-copy .eyebrow { color: var(--coral); }
.welcome-copy h1 { max-width: 650px; margin: 0; font-size: clamp(48px, 6vw, 77px); line-height: .99; letter-spacing: -.065em; }
.welcome-copy h1 span { position: relative; display: inline-block; color: var(--jade-dark); }
.welcome-copy h1 span::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 9px; z-index: -1; background: var(--lime); transform: rotate(-1deg); }
.welcome-copy > p { max-width: 550px; margin: 22px 0 25px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.welcome-points { margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; }
.welcome-points li { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.welcome-points svg { width: 15px; height: 15px; color: var(--jade); }
.welcome-art { position: relative; }
.welcome-art .scene-wrap { border: 1.5px solid var(--ink); border-radius: 32px 10px 32px 10px; box-shadow: 10px 11px 0 var(--sand); transform: rotate(2deg); }
.welcome-sticker { position: absolute; right: -16px; bottom: -26px; width: 115px; height: 115px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--sun); font-size: 12px; font-weight: 800; line-height: 1.35; text-align: center; transform: rotate(-9deg); }
.curriculum-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.curriculum-choice button { min-height: 85px; padding: 16px; border: 1px solid var(--line-dark); border-radius: 14px; background: var(--paper); text-align: left; }
.curriculum-choice button strong { display: block; font-size: 15px; }
.curriculum-choice button span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.curriculum-choice button.active { border: 1.5px solid var(--ink); background: var(--jade-soft); box-shadow: 3px 3px 0 var(--ink); }
.curriculum-choice button[data-onboard-version="3.0"].active { background: var(--coral-soft); box-shadow: 3px 3px 0 var(--coral); }
.onboard-narrow { max-width: 780px; margin: auto; }
.onboard-narrow > h1 { margin: 0; font-size: clamp(35px, 5vw, 52px); line-height: 1.1; letter-spacing: -.055em; }
.onboard-narrow > p { color: var(--muted); font-size: 14px; }
.placement-meta { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.placement-card { display: grid; grid-template-columns: 290px 1fr; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 23px 8px 23px 8px; background: var(--paper); }
.placement-card > .scene-wrap { min-height: 100%; border-radius: 0; border-right: 1px solid var(--ink); }
.placement-card .scene { width: 100%; height: 100%; }
.placement-content { padding: 30px; }
.placement-content h2 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.placement-prompt { min-height: 82px; margin-bottom: 18px; }
.placement-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.placement-skip { width: 100%; margin-top: 10px; }
.result-hero { text-align: center; }
.result-hero .scene-wrap { width: 290px; margin: 0 auto 22px; border: 1.5px solid var(--ink); box-shadow: 7px 7px 0 var(--sand); transform: rotate(-2deg); }
.result-level { display: inline-flex; align-items: center; gap: 9px; margin: 12px 0; padding: 8px 15px; border: 1px solid var(--ink); border-radius: 10px; background: var(--lime); font-weight: 800; }
.result-note { max-width: 540px; margin: 12px auto 25px; color: var(--muted); font-size: 13px; }
.plan-preview { margin: 25px 0; padding: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
.plan-preview h3 { margin-bottom: 5px; }
.plan-preview > p { margin-top: 0; color: var(--muted); font-size: 12px; }
.minute-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.minute-options button { min-height: 64px; border: 1px solid var(--line-dark); border-radius: 11px; background: var(--paper); }
.minute-options button strong { display: block; font-size: 20px; }
.minute-options button span { color: var(--muted); font-size: 9px; }
.minute-options button.active { border-color: var(--ink); background: var(--sun-soft); box-shadow: 2px 2px 0 var(--ink); }
.goal-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.goal-options button { min-height: 56px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 10px; font-weight: 700; }
.goal-options button.active { border-color: var(--jade); background: var(--jade-soft); color: var(--jade-dark); }
.placement-benefits { margin: 0 auto 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.placement-benefits span { min-height: 38px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted); font-size: 10px; font-weight: 700; }
.placement-benefits svg, .placement-time svg { width: 15px; height: 15px; color: var(--jade); }
.placement-time { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 11px; }
.placement-content .prompt-sentence { font-size: clamp(20px, 3vw, 26px); }
.placement-content .prompt-instruction { margin: 0; text-align: center; }
.placement-options .sentence-option { line-height: 1.55; }
.result-wide { max-width: 980px; }
.result-wide .result-hero { max-width: 760px; margin: 0 auto; }
.result-hero h1 { margin: 0; font-size: clamp(35px, 5vw, 52px); line-height: 1.1; letter-spacing: -.055em; }
.analysis-grid { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.analysis-card { padding: 24px; border: 1px solid var(--line-dark); border-radius: 20px 7px 20px 7px; background: var(--paper); }
.analysis-card:nth-child(2) { background: var(--jade-soft); }
.analysis-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.analysis-heading h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.035em; }
.analysis-heading > span { padding: 6px 10px; border-radius: 8px; background: var(--sun-soft); font-size: 12px; font-weight: 800; }
.analysis-card > p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.skill-results { display: grid; gap: 15px; margin-top: 20px; }
.skill-result-head { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.skill-result-head strong { font-size: 12px; }
.skill-result-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--paper-beige); }
.skill-result-track i { display: block; height: 100%; border-radius: inherit; background: var(--jade); }
.profile-insight { margin-top: 22px; padding-top: 17px; display: flex; align-items: start; gap: 10px; border-top: 1px solid var(--line); }
.profile-insight > svg { flex: 0 0 auto; color: var(--coral); }
.profile-insight strong, .profile-insight span { display: block; font-size: 11px; line-height: 1.6; }
.profile-insight span { margin-top: 3px; color: var(--muted); }
.level-evidence { margin-top: 19px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.level-evidence-item { position: relative; min-height: 77px; padding: 12px; border: 1px solid var(--line-dark); border-radius: 10px; background: var(--paper); }
.level-evidence-item span, .level-evidence-item strong { display: block; }
.level-evidence-item span { color: var(--muted); font-size: 9px; }
.level-evidence-item strong { margin-top: 5px; font-size: 17px; }
.level-evidence-item > i { position: absolute; top: 10px; right: 10px; color: var(--muted); font-style: normal; }
.level-evidence-item > i svg { width: 15px; height: 15px; }
.level-evidence-item.passed { border-color: var(--jade); background: var(--paper); }
.level-evidence-item.passed > i { color: var(--jade-dark); }
.estimate-note { margin: 16px 0 0; padding: 17px 20px; display: flex; align-items: start; gap: 11px; border: 1px dashed var(--line-dark); border-radius: 13px; background: var(--sun-soft); text-align: left; }
.estimate-note > svg { flex: 0 0 auto; color: var(--coral); }
.estimate-note strong { font-size: 11px; }
.estimate-note p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.result-finish { text-align: center; }

/* Progress and personal plan */
.last-placement { margin-top: 25px; padding: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line-dark); border-radius: 13px; background: var(--jade-soft); }
.last-placement strong { display: block; margin-top: 5px; font-size: 13px; }
.last-placement p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.last-placement .btn { flex: 0 0 auto; padding: 9px 11px; font-size: 10px; }
.progress-hero { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.stat-block { min-height: 155px; padding: 23px; border: 1px solid var(--line-dark); border-radius: 17px 6px 17px 6px; background: var(--paper); }
.stat-block:nth-child(2) { background: var(--jade-soft); }
.stat-block:nth-child(3) { background: var(--coral-soft); }
.stat-block svg { margin-bottom: 17px; }
.stat-block strong { display: block; font-size: 35px; line-height: 1.1; letter-spacing: -.05em; }
.stat-block span { color: var(--muted); font-size: 11px; }
.progress-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 24px; margin-top: 25px; }
.level-progress-list { display: grid; gap: 10px; }
.level-progress-row { padding: 17px 18px; display: grid; grid-template-columns: 95px minmax(0, 1fr) 65px; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.level-progress-row strong { font-size: 12px; }
.level-progress-row span { color: var(--muted); font-size: 10px; text-align: right; }
.big-progress { height: 10px; overflow: hidden; border-radius: 10px; background: var(--paper-beige); }
.big-progress i { display: block; height: 100%; border-radius: inherit; background: var(--jade); }
.big-progress.coral i { background: var(--coral); }
.badge-list { display: grid; gap: 10px; }
.badge-item { padding: 15px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.badge-item.locked { opacity: .52; filter: grayscale(1); }
.badge-icon { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50% 50% 10px 50%; background: var(--sun); }
.badge-item strong { display: block; font-size: 12px; }
.badge-item span { color: var(--muted); font-size: 10px; }
.local-note { margin-top: 22px; padding: 16px; display: flex; gap: 10px; border: 1px dashed var(--line-dark); border-radius: 12px; color: var(--muted); font-size: 11px; }
.local-note svg { color: var(--jade); }

.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 25px; margin-top: 28px; }
.plan-form { padding: 28px; border: 1px solid var(--line-dark); border-radius: 19px 7px 19px 7px; background: var(--paper); }
.plan-group { padding: 22px 0; border-bottom: 1px solid var(--line); }
.plan-group:first-child { padding-top: 0; }
.plan-group:last-child { border-bottom: 0; }
.plan-group h3 { margin: 0 0 4px; font-size: 14px; }
.plan-group > p { margin: 0 0 13px; color: var(--muted); font-size: 11px; }
.weekday-options { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-options button { min-height: 45px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); color: var(--muted); font-size: 10px; font-weight: 800; }
.weekday-options button.active { border-color: var(--ink); background: var(--ink); color: white; }
.plan-summary { padding: 28px; border: 1.5px solid var(--ink); border-radius: 8px 22px 8px 22px; background: var(--sun); align-self: start; }
.plan-summary h2 { margin: 0 0 20px; font-size: 21px; }
.plan-summary-number { padding: 20px 0; border-top: 1px solid rgba(30,41,59,.3); border-bottom: 1px solid rgba(30,41,59,.3); }
.plan-summary-number strong { display: block; font-size: 45px; line-height: 1; letter-spacing: -.05em; }
.plan-summary-number span { font-size: 11px; }
.plan-summary ul { margin: 20px 0 25px; padding: 0; display: grid; gap: 11px; list-style: none; }
.plan-summary li { display: flex; gap: 8px; font-size: 11px; }
.plan-summary li svg { width: 15px; height: 15px; }
.plan-summary .btn { width: 100%; }
.danger-zone { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.danger-link { min-height: 44px; padding: 8px 0; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--coral-dark); font-size: 11px; font-weight: 700; }

.site-footer { max-width: 1280px; margin: auto; padding: 24px 32px 35px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.site-footer button { min-height: 44px; padding: 0; display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.mobile-nav { display: none; }

/* Dialogs, detail view, feedback */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; padding: 25px; display: grid; place-items: center; background: rgba(15,23,42,.55); backdrop-filter: blur(5px); animation: fade-in 180ms; }
@keyframes fade-in { from { opacity: 0; } }
.modal { width: min(650px, 100%); max-height: min(820px, calc(100dvh - 50px)); overflow: auto; border: 1.5px solid var(--ink); border-radius: 22px 8px 22px 8px; background: var(--paper); box-shadow: 9px 10px 0 rgba(15,23,42,.3); }
.modal-wide { width: min(760px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; min-height: 65px; padding: 12px 18px 12px 25px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); background: rgba(255,254,251,.96); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 25px; }
.word-detail-scene { height: 220px; border: 1px solid var(--ink); }
.word-detail-scene .scene { width: 100%; height: 100%; }
.word-detail-title { margin-top: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.word-detail-title h3 { margin: 0; font-family: var(--font-hanzi); font-size: 50px; line-height: 1.2; }
.word-detail-title p { margin: 4px 0 0; color: var(--jade-dark); font-weight: 700; }
.word-detail-meaning { margin: 17px 0; font-size: 17px; font-weight: 700; }
.detail-example { padding: 18px; border-radius: 12px; background: var(--paper-beige); }
.detail-example .example-hanzi { font-size: 20px; }
.detail-example .example-pinyin, .detail-example .example-meaning { font-size: 13px; }
.detail-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 9px; }
.about-section { margin-bottom: 22px; }
.about-section h3 { margin-bottom: 7px; font-size: 14px; }
.about-section p, .about-section li { color: var(--muted); font-size: 12px; line-height: 1.75; }
.about-section ul { padding-left: 18px; }
.about-section a { color: var(--jade-dark); font-weight: 700; }
.data-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.data-counts div { padding: 15px; border-radius: 10px; background: var(--paper-beige); }
.data-counts strong { display: block; font-size: 21px; }
.data-counts span { color: var(--muted); font-size: 10px; }
.confirm-copy { color: var(--muted); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 180; max-width: calc(100% - 32px); padding: 13px 18px; border: 1px solid #475569; border-radius: 11px; background: var(--ink); color: white; box-shadow: 4px 4px 0 var(--jade); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: opacity 180ms, transform 180ms; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.celebration { position: fixed; inset: 0; z-index: 170; overflow: hidden; pointer-events: none; }
.confetti { position: absolute; top: -20px; width: 10px; height: 18px; background: var(--jade); animation: confetti-fall 1.7s var(--ease) forwards; }
.confetti:nth-child(3n) { background: var(--coral); }
.confetti:nth-child(3n+1) { background: var(--sun); }
.confetti:nth-child(4n) { border-radius: 50%; background: var(--lime); }
@keyframes confetti-fall { to { transform: translate(var(--drift), 105dvh) rotate(720deg); } }
.skeleton { min-height: 300px; border-radius: 20px; background: linear-gradient(100deg, var(--paper-beige) 30%, var(--paper) 50%, var(--paper-beige) 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1120px) {
  .topbar-inner, .curriculum-inner { padding-left: 22px; padding-right: 22px; }
  .desktop-nav .nav-btn { padding: 8px 9px; }
  .desktop-nav .nav-btn svg { display: none; }
  .info-button { display: none; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .daily-panel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
  .daily-ring { margin: 0; width: 135px; height: 135px; }
  .daily-ring::before { width: 105px; height: 105px; }
  .daily-stats { margin: 0; padding: 0 0 0 20px; border-top: 0; border-left: 1px solid #475569; }
  .vocab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explore-toolbar { grid-template-columns: 1fr auto; }
  .filter-tabs { grid-column: 1/-1; grid-row: 2; justify-self: start; }
}

@media (max-width: 900px) {
  .weekday-options { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
  .topbar-inner { gap: 14px; }
  .desktop-nav { gap: 0; }
  .desktop-nav .nav-btn { padding: 8px 6px; }
}

@media (max-width: 767px) {
  :root { --header-h: 64px; --dock-h: 116px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar-inner { padding: 0 15px; gap: 10px; }
  .brand-symbol { width: 34px; height: 34px; font-size: 18px; }
  .brand-word { font-size: 26px; }
  .desktop-nav { display: none; }
  .header-actions { gap: 6px; }
  .language-switch button { width: 44px; min-height: 44px; }
  .xp-chip { min-height: 44px; padding: 7px 9px; box-shadow: none; }
  .xp-chip span { display: none; }
  .curriculum-inner { min-height: var(--dock-h); padding: 9px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  .version-switch { grid-column: 1; grid-row: 1; justify-self: start; }
  .version-switch button { min-width: 100px; min-height: 44px; padding: 5px 9px; }
  .version-switch button strong { font-size: 11px; }
  .version-switch button span { font-size: 8px; }
  .streak-chip { grid-column: 2; grid-row: 1; }
  .level-track { grid-column: 1/-1; grid-row: 2; grid-auto-columns: minmax(60px, 1fr); gap: 5px; }
  .level-btn { min-height: 46px; padding: 5px 7px; }
  .level-btn strong { font-size: 11px; }
  .level-btn span { font-size: 8px; }
  .app-main { min-height: calc(100dvh - 230px); padding: 25px 15px 45px; }
  .page-title { font-size: 32px; }
  .page-subtitle { font-size: 13px; }
  .section-head { margin-top: 29px; }
  .mission-card { min-height: 0; padding: 25px 21px; grid-template-columns: minmax(0, 1fr); }
  .mission-card h1 { margin-top: 19px; font-size: 42px; }
  .mission-card p { font-size: 13px; }
  .mission-copy .button-row { margin-top: 5px; }
  .mission-visual { min-height: 205px; margin-top: 14px; }
  .mission-visual .scene { width: 90%; }
  .mission-card .btn { flex: 1; }
  .daily-panel { padding: 23px; grid-template-columns: 1fr auto; }
  .daily-panel .daily-ring { width: 120px; height: 120px; }
  .daily-ring::before { width: 94px; height: 94px; }
  .daily-stats { grid-column: 1/-1; padding: 15px 0 0; border-left: 0; border-top: 1px solid #475569; }
  .quick-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .quick-card { min-height: 120px; padding: 19px; }
  .week-card { padding: 21px 8px; }
  .week-bars { gap: 6px; }
  .discover-strip { grid-template-columns: minmax(0, 1fr); }
  .explore-head { align-items: flex-start; }
  .level-total-badge { padding: 10px; }
  .level-total-badge strong { font-size: 19px; }
  .explore-toolbar { grid-template-columns: 1fr auto; gap: 8px; }
  .filter-tabs { width: 100%; overflow-x: auto; }
  .filter-btn { flex: 1; padding: 8px 7px; font-size: 10px; }
  .pinyin-toggle { width: 48px; padding: 0; }
  .pinyin-toggle span { display: none; }
  .vocab-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .word-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); border-radius: 14px 6px 14px 6px; }
  .word-scene-button { height: 100%; min-height: 173px; }
  .word-scene-button .scene { height: 100%; object-fit: cover; }
  .word-scene-button .scene-caption { display: none; }
  .word-body { padding: 15px; }
  .word-hanzi { font-size: 28px; }
  .word-meaning { min-height: 0; }
  .word-footer { margin-top: 10px; padding-top: 8px; }
  .word-audio { width: 44px; height: 44px; }
  .study-heading { align-items: flex-start; }
  .study-heading h1 { font-size: 25px; }
  .study-heading .btn { width: 46px; padding: 0; }
  .study-heading .btn span { display: none; }
  .flashcard { height: 555px; }
  .flashcard-face { padding: 20px 18px 22px; }
  .flashcard-face .scene-wrap { width: 95%; height: 185px; margin-top: 24px; }
  .flashcard-hanzi { margin-top: 18px; font-size: 59px; }
  .card-kicker { top: 16px; left: 17px; }
  .card-audio { top: 8px; right: 9px; }
  .flashcard-actions { grid-template-columns: 1fr 1fr; gap: 9px; }
  .flashcard-actions .card-flip { grid-column: 1/-1; grid-row: 1; width: 100%; }
  .flashcard-actions .card-prev, .flashcard-actions .card-next { width: 100%; }
  .know-review-actions { gap: 9px; }
  .know-review-actions .btn { padding: 10px 8px; font-size: 11px; }
  .study-complete { padding: 30px 19px; }
  .study-complete h1 { font-size: 29px; }
  .quiz-intro { grid-template-columns: minmax(0, 1fr); }
  .quiz-intro-copy { padding: 28px 22px; }
  .quiz-intro h1 { font-size: 33px; }
  .quiz-intro .scene-wrap { min-height: 210px; border-left: 0; border-top: 1px solid var(--ink); }
  .quiz-card { grid-template-columns: minmax(0, 1fr); }
  .quiz-scene { min-height: 170px; height: 170px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .quiz-content { padding: 20px 16px; }
  .quiz-options { grid-template-columns: minmax(0, 1fr); }
  .quiz-option { min-height: 52px; }
  .quiz-feedback { align-items: stretch; flex-direction: column; }
  .quiz-feedback .btn { width: 100%; }
  .onboarding-top { padding: 10px 16px; }
  .onboarding-main { padding: 28px 16px 40px; align-items: start; }
  .welcome-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .welcome-copy h1 { font-size: 49px; }
  .welcome-copy > p { font-size: 13px; }
  .welcome-art { width: 92%; margin: auto; }
  .welcome-sticker { width: 90px; height: 90px; right: -10px; font-size: 10px; }
  .curriculum-choice { grid-template-columns: minmax(0, 1fr); }
  .placement-card { grid-template-columns: minmax(0, 1fr); }
  .placement-card > .scene-wrap { min-height: 160px; height: 160px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .placement-content { padding: 20px 16px; }
  .placement-options { grid-template-columns: minmax(0, 1fr); }
  .analysis-grid { grid-template-columns: minmax(0, 1fr); }
  .analysis-card { padding: 20px 16px; }
  .estimate-note { padding: 15px; }
  .minute-options { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .goal-options { grid-template-columns: 1fr 1fr; }
  .progress-hero { grid-template-columns: 1fr 1fr; }
  .stat-block:last-child { grid-column: 1/-1; }
  .progress-layout, .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .level-progress-row { grid-template-columns: 75px minmax(0,1fr) 48px; gap: 9px; padding: 15px 4px; }
  .plan-form { padding: 21px 16px; }
  .weekday-options { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
  .plan-summary { order: -1; }
  .site-footer { padding: 22px 16px 28px; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; min-height: 68px; padding: 5px 7px calc(5px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--line); background: rgba(250,249,246,.97); backdrop-filter: blur(16px); }
  .mobile-nav .nav-btn { min-height: 54px; padding: 5px 2px; flex-direction: column; justify-content: center; gap: 2px; font-size: 9px; }
  .mobile-nav .nav-btn svg { display: block; width: 19px; height: 19px; }
  .mobile-nav .nav-btn.active { background: var(--jade-soft); color: var(--jade-dark); }
  .modal-backdrop { padding: 12px; align-items: end; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 20px 20px 8px 8px; }
  .modal-body { padding: 18px; }
  .word-detail-scene { height: 180px; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .data-counts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 374px) {
  .brand-word { font-size: 23px; }
  .brand-symbol { display: none; }
  .version-switch button { min-width: 92px; }
  .level-track { grid-auto-columns: minmax(53px, 1fr); }
  .mission-card h1 { font-size: 37px; }
  .welcome-copy h1 { font-size: 43px; }
  .filter-btn { font-size: 9px; }
  .word-card { grid-template-columns: 105px minmax(0,1fr); }
  .level-evidence { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .flashcard-inner { transition: none; }
}

/* Dynamic component refinements */
.loading-screen.loaded { opacity: 0; pointer-events: none; transition: opacity 250ms; }
.muted { color: var(--muted); }
.mission-visual .scene-wrap { width: 100%; }
.mission-visual .scene-caption { display: none; }
.daily-word-peek { position: absolute; right: 3%; bottom: 8%; z-index: 3; min-width: 112px; min-height: 68px; padding: 10px 14px; border: 1.5px solid var(--ink); border-radius: 12px 5px 12px 5px; background: var(--paper); box-shadow: 4px 4px 0 var(--ink); transform: rotate(-4deg); }
.daily-word-peek > span { display: block; font-family: var(--font-hanzi); font-size: 25px; font-weight: 700; }
.daily-word-peek small { display: block; max-width: 150px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.daily-panel p { margin: 5px 0 0; color: #CBD5E1; font-size: 11px; }
.quick-card > span:nth-child(2) { flex: 1; min-width: 0; }
.quick-card strong { display: block; margin-bottom: 5px; font-size: 18px; letter-spacing: -.03em; }
.quick-card .quick-arrow { margin-left: auto; }
.quick-grid .quick-card:last-child:nth-child(3) { grid-column: 1/-1; }
.play-grid { grid-template-columns: 1fr 1fr; }
.play-grid .play-mode { min-height: 310px; align-items: flex-start; }
.play-mode > span:nth-child(2) { display: flex; flex-direction: column; align-items: flex-start; height: 100%; }
.play-mode small { margin: 15px 0; color: var(--muted); font-size: 10px; }
.play-mode .btn { margin-top: auto; }
.week-day { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 8px; align-items: end; text-align: center; }
.bar-track { width: min(34px,80%); height: 100%; margin: auto; display: flex; align-items: end; overflow: hidden; border-radius: 7px 7px 3px 3px; background: var(--paper-beige); }
.bar-track i { width: 100%; height: var(--h); min-height: 3px; border-radius: inherit; background: var(--jade); }
.week-day:last-child .bar-track i { background: var(--coral); }
.week-day > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.discover-card { min-width: 0; min-height: 105px; padding: 15px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); text-align: left; transition: background 150ms, transform 150ms; }
.discover-card:hover { transform: translateY(-3px) rotate(-.5deg); background: var(--jade-soft); }
.discover-card > span:nth-child(2) { flex: 1; min-width: 0; }
.discover-card strong { display: block; font-family: var(--font-hanzi); font-size: 27px; line-height: 1.3; }
.discover-card > span:nth-child(2) > span { display: block; color: var(--jade-dark); font-size: 10px; }
.discover-card p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.discover-num { color: var(--muted); font-size: 10px; font-weight: 800; align-self: flex-start; }
.results-meta { min-height: 36px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.word-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.word-title h2 { margin: 0; }
.word-status { min-height: 26px; padding: 3px 7px; display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; background: var(--paper-beige); color: var(--muted); font-size: 9px; font-weight: 700; }
.word-status svg { width: 12px; height: 12px; }
.word-status.known { background: var(--jade-soft); color: var(--jade-dark); }
.word-status.review { background: var(--coral-soft); color: var(--coral-dark); }
.word-status.new { background: var(--paper-beige); }
.level-progress-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.level-progress-row:hover { background: var(--paper-beige); }
.goal-options svg { display: block; margin: 0 auto 3px; width: 15px; height: 15px; }
.modal-body > .scene-wrap { height: 220px; }
.modal-body > .scene-wrap .scene { height: 100%; }
.word-detail-title + .word-detail-meaning { margin-bottom: 10px; }
@media (max-width:767px) {
  .play-grid { grid-template-columns: minmax(0, 1fr); }
  .play-grid .play-mode { min-height: 260px; }
  .quick-grid .quick-card:last-child:nth-child(3) { grid-column: auto; }
  .daily-word-peek { right: 0; bottom: 0; }
  .modal-body > .scene-wrap { height: 180px; }
}

@media (max-width:767px) {
  .pagination { gap: 6px; }
  .pagination .btn { min-width: 0; flex: 1; padding: 10px 8px; font-size: 10px; }
  .pagination > span { min-width: 46px; flex: 0 0 46px; }
}


/* ===== Latihan bicara (Speaking Lab) ===== */
.quick-icon.sun { background: var(--sun-soft); }
.sp-lab { display: grid; gap: 18px; margin-top: 22px; max-width: 920px; }
.sp-panel { padding: 18px 20px; border: 1px solid var(--line-dark); border-radius: 18px 7px 18px 7px; background: var(--paper); }
.sp-panel-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.sp-seg-group { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line-dark); border-radius: 12px; background: var(--canvas); }
.sp-seg { min-height: 40px; padding: 6px 13px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; line-height: 1.2; transition: background 140ms, color 140ms; }
.sp-seg small { font-size: 9px; font-weight: 600; opacity: .8; }
.sp-seg:hover:not(:disabled) { background: var(--paper-beige); color: var(--ink); }
.sp-seg.active { background: var(--ink); color: #fff; }
.sp-ai { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-dark); }
.sp-ai p { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.sp-models { margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; color: var(--muted); }
.sp-progress { height: 8px; margin: 4px 0 8px; overflow: hidden; border: 1px solid var(--ink); border-radius: 8px; background: var(--paper); }
.sp-progress i { display: block; height: 100%; background: var(--jade); transition: width 250ms var(--ease); }
.sp-ai p.sp-status, .sp-status { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.sp-status.ok { color: var(--jade-dark); font-weight: 700; }
.sp-status.err { color: var(--coral-dark); }
.sp-status svg { width: 14px; height: 14px; }

.sp-card { display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; border: 1.5px solid var(--ink); border-radius: 23px 8px 23px 8px; background: var(--paper); }
.sp-card-scene .scene-wrap { height: 100%; min-height: 190px; border-radius: 0; border-right: 1px solid var(--ink); }
.sp-card-body { padding: 24px 28px; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.sp-card-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sp-best { padding: 2px 8px; border-radius: 6px; background: var(--jade-soft); color: var(--jade-dark); }
.sp-hanzi { margin: 6px 0 0; font-family: var(--font-hanzi); font-size: clamp(48px, 8vw, 76px); line-height: 1.2; font-weight: 700; word-break: keep-all; }
.sp-hanzi.long { font-size: clamp(26px, 4vw, 38px); line-height: 1.5; }
.sp-pinyin { margin: 0; font-size: 20px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.sp-pt { display: inline-block; padding: 0 1px; border-bottom: 3px solid currentColor; }
.sp-pt.t1 { color: #B42318; } .sp-pt.t2 { color: #B54708; } .sp-pt.t3 { color: #0F766E; } .sp-pt.t4 { color: #1D4ED8; } .sp-pt.t5 { color: var(--muted); border-bottom-style: dotted; }
.sp-meaning { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.sp-recorder { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line-dark); border-radius: 18px; background: var(--paper); }
.sp-rec-btn { width: 76px; height: 76px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--coral); color: #fff; box-shadow: 4px 4px 0 var(--ink); transition: transform 150ms var(--ease), box-shadow 150ms; }
.sp-rec-btn svg { width: 30px; height: 30px; }
.sp-rec-btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.sp-rec-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.sp-rec-btn.on { background: var(--ink); animation: sp-pulse 1s infinite alternate; }
@keyframes sp-pulse { to { box-shadow: 4px 4px 0 var(--coral), 0 0 0 9px rgba(225, 29, 72, .18); } }
.sp-rec-side { display: grid; gap: 4px; min-width: 0; }
.sp-rec-side strong { font-size: 15px; }
.sp-hint { color: var(--muted); font-size: 12px; min-height: 1.4em; }
.sp-meter { height: 8px; margin-top: 4px; overflow: hidden; border-radius: 8px; background: var(--paper-beige); }
.sp-meter i { display: block; width: 0; height: 100%; background: var(--jade); transition: width 60ms linear; }
.sp-rec-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sp-error { display: flex; gap: 10px; margin: 12px 0 0; padding: 14px 16px; border: 1px solid var(--coral); border-radius: 12px; background: var(--coral-soft); color: var(--coral-dark); font-size: 12px; }
.sp-error svg { flex: 0 0 auto; }

.sp-result { margin-top: 16px; padding: 22px; display: grid; gap: 16px; border: 1.5px solid var(--ink); border-radius: 20px 7px 20px 7px; background: var(--sun-soft); box-shadow: 6px 7px 0 var(--sand); }
.sp-result-top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.sp-ring { margin: 0; flex: 0 0 auto; }
.sp-result h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.04em; }
.sp-metrics { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.sp-metrics strong { display: block; font-size: 22px; line-height: 1.1; }
.sp-metrics span { color: var(--muted); font-size: 10px; }
.sp-chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.sp-chip { min-width: 108px; padding: 10px 12px; display: grid; gap: 2px; border: 1px solid var(--line-dark); border-radius: 12px; background: var(--paper); font-size: 11px; color: var(--muted); }
.sp-chip b { font-size: 16px; color: var(--ink); }
.sp-chip i { font-style: normal; font-weight: 800; color: var(--ink); font-size: 14px; }
.sp-chip em { font-style: normal; font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.sp-chip.ok { border-color: var(--jade-dark); background: var(--jade-soft); } .sp-chip.ok em { color: var(--jade-dark); }
.sp-chip.near { border-color: #B54708; background: #FFF4E5; } .sp-chip.near em { color: #B54708; }
.sp-chip.bad { border-color: var(--coral); background: var(--coral-soft); } .sp-chip.bad em { color: var(--coral-dark); }
.sp-figure { margin: 0; padding: 12px; border: 1px solid var(--line-dark); border-radius: 14px; background: var(--paper); }
.sp-figure figcaption { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 10px; }
.sp-chart { width: 100%; height: auto; display: block; overflow: visible; }
.sp-chart rect, .sp-chart text { stroke: none; }
.sp-band { fill: var(--paper-beige); opacity: .55; } .sp-band.alt { fill: var(--jade-soft); opacity: .7; }
.sp-user { fill: none; stroke: var(--jade-dark); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.sp-exp { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; }
.sp-band-label { font-family: var(--font-ui); font-size: 14px; font-weight: 700; fill: var(--ink); stroke: none; }
.sp-band-glyph { font-size: 12px; font-weight: 800; fill: var(--muted); stroke: none; }
.sp-band-glyph.ok { fill: var(--jade-dark); } .sp-band-glyph.bad { fill: var(--coral-dark); } .sp-band-glyph.near { fill: #B54708; }
.lg { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--jade-dark); vertical-align: middle; }
.lg.exp { border-top: 3px dashed var(--coral); margin-left: 4px; }
.sp-asr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: baseline; padding: 12px 14px; border: 1px solid var(--line-dark); border-radius: 12px; background: var(--paper); }
.sp-asr-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sp-asr-text { font-family: var(--font-hanzi); font-size: 22px; font-weight: 600; letter-spacing: .04em; }
.sp-asr-text .ok { color: var(--jade-dark); } .sp-asr-text .bad { color: var(--coral-dark); text-decoration: underline wavy; text-underline-offset: 5px; } .sp-asr-text .miss { opacity: .55; } .sp-asr-text .extra { color: #B54708; }
.sp-tips { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink); font-size: 12px; line-height: 1.6; }
.sp-disclaimer { margin: 0; display: flex; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.sp-disclaimer svg { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; }
.sp-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 14px; }

@media (max-width: 767px) {
  .sp-card { grid-template-columns: minmax(0, 1fr); }
  .sp-card-scene .scene-wrap { min-height: 150px; height: 150px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .sp-card-body { padding: 18px 18px 20px; }
  .sp-recorder { grid-template-columns: auto minmax(0, 1fr); }
  .sp-rec-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .sp-rec-btn { width: 68px; height: 68px; }
  .sp-result { padding: 16px; }
  .sp-asr { grid-template-columns: minmax(0, 1fr); }
  .sp-nav .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .sp-rec-btn.on { animation: none; } .sp-meter i, .sp-progress i { transition: none; } }


/* ===== v9: Neuroscience SRS, Lab Bunyi ID, Kalibrasi, Backup & Aksesibilitas ===== */
:focus-visible { outline: 2.5px solid var(--jade-dark); outline-offset: 2px; }
.srs-due-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 11px; border: 1px solid var(--coral); border-radius: 999px; background: var(--coral-soft); color: var(--coral-dark); font-size: 11px; font-weight: 800; }
.srs-due-pill.done { border-color: var(--jade-dark); background: var(--jade-soft); color: var(--jade-dark); }
.srs-grade-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.srs-btn { padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1.5px solid var(--line-dark); border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 800; transition: transform 130ms var(--ease), border-color 130ms, background 130ms; }
.srs-btn small { font-size: 10px; font-weight: 600; color: var(--muted); }
.srs-btn:hover { transform: translateY(-1px); border-color: var(--ink); }
.srs-btn.g1 { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-dark); }
.srs-btn.g2 { border-color: #B54708; background: #FFF4E5; color: #B54708; }
.srs-btn.g3 { border-color: var(--jade-dark); background: var(--jade-soft); color: var(--jade-dark); }
.srs-btn.g4 { border-color: #1D4ED8; background: #EFF6FF; color: #1D4ED8; }
.srs-kbd-hint { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 11px; }

.srs-retention-card { padding: 18px 20px; border: 1px solid var(--line-dark); border-radius: 18px 7px 18px 7px; background: var(--paper); margin-bottom: 18px; }
.srs-retention-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--paper-beige); margin: 12px 0; border: 1px solid var(--line-dark); }
.srs-retention-bar i { display: block; height: 100%; }
.srs-retention-bar .seg-due { background: var(--coral); }
.srs-retention-bar .seg-learn { background: #F59E0B; }
.srs-retention-bar .seg-young { background: var(--jade); }
.srs-retention-bar .seg-mature { background: var(--ink); }
.srs-retention-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.srs-retention-stats div { padding: 10px 12px; border-radius: 12px; background: var(--canvas); border: 1px solid var(--line); }
.srs-retention-stats strong { display: block; font-size: 20px; line-height: 1.1; }
.srs-retention-stats span { font-size: 11px; color: var(--muted); }

.backup-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; margin-top: 16px; border: 1px solid var(--line-dark); border-radius: 16px; background: var(--paper); }
.backup-bar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sp-ai-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.sp-tools-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sp-mini-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line-dark); border-radius: 999px; background: var(--canvas); color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; transition: background 140ms, border-color 140ms; }
.sp-mini-pill svg { width: 13px; height: 13px; }
.sp-mini-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.sp-cal-tag { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; background: var(--jade-soft); color: var(--jade-dark); font-size: 11px; font-weight: 700; }
.sp-link-btn { border: 0; background: transparent; color: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; padding: 0; font-size: 11px; }
.sp-recall-btn { margin-top: 10px; padding: 12px 14px; display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--line-dark); border-radius: 12px; background: var(--canvas); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
.sp-recall-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.sp-traps { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line-dark); border-radius: 12px; background: var(--canvas); }
.sp-traps-label { display: block; margin-bottom: 4px; color: var(--jade-dark); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sp-traps ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; font-size: 11px; color: var(--ink); line-height: 1.5; }
.sp-drill-cue { margin: 2px 0 0; font-size: 12px; color: var(--ink); line-height: 1.55; }

.sp-drill-card { padding: 18px 20px; display: grid; gap: 14px; border: 1.5px solid var(--ink); border-radius: 23px 8px 23px 8px; background: var(--paper); }
.sp-drill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sp-drill-half { padding: 16px; display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--line-dark); border-radius: 16px; background: var(--canvas); min-width: 0; }
.sp-drill-half.active { border-color: var(--ink); background: var(--sun-soft); box-shadow: 4px 4px 0 var(--sand); }
.sp-drill-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

@media (max-width: 767px) {
  .srs-grade-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .srs-retention-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-drill-grid { grid-template-columns: minmax(0, 1fr); }
}


/* ===== v10: Dual-Coding Tone Pinyin, Leech, HVPT Blind Test, Share, Offline & Install ===== */
.tone-py { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
.tone-py.left { justify-content: flex-start; }
.tone-py .sp-pt { border-bottom-width: 2.5px; }
.leech-pill { display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 2px; padding: 4px 10px; border: 1px solid #B54708; border-radius: 999px; background: #FFF4E5; color: #B54708; font-size: 11px; font-weight: 800; }
.leech-pill svg { width: 13px; height: 13px; }
.sp-hvpt { padding: 12px 14px; display: grid; gap: 8px; border: 1.5px dashed var(--ink); border-radius: 14px; background: var(--sun-soft); }
.sp-hvpt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sp-hvpt-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.offline-banner { max-width: var(--max-w); margin: 10px auto 0; padding: 9px 14px; display: flex; align-items: center; gap: 8px; border: 1px solid #B54708; border-radius: 12px; background: #FFF4E5; color: #B54708; font-size: 12px; font-weight: 700; }
.offline-banner[hidden] { display: none; }
.offline-banner svg { width: 15px; height: 15px; flex: 0 0 auto; }
.install-btn[hidden] { display: none; }
.install-btn svg { width: 14px; height: 14px; }


/* ===== v11: Account, Cloud Sync, Pro Upgrade Modal & Legal Footer ===== */
.footer-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.footer-links a { color: inherit; text-decoration: underline; font-weight: 700; }
.pro-box { display: grid; gap: 12px; }
.pro-form { display: grid; gap: 10px; }
.pro-form input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line-dark); border-radius: 10px; background: var(--canvas); font: inherit; font-size: 14px; }
.pro-tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pro-tier { padding: 14px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--sun-soft); display: grid; gap: 6px; }
.pro-tier strong { font-size: 15px; }
.pro-tier span { font-size: 12px; color: var(--muted); }
.level-btn.locked { opacity: .68; }
@media (max-width: 767px) { .pro-tiers { grid-template-columns: minmax(0, 1fr); } }
