:root {
  color-scheme: light;
  --board: #f4fbf8;
  --board-deep: #eaf7f2;
  --board-soft: #edf8f4;
  --chalk: #173b32;
  --muted: #66847b;
  --line: #cfe4dc;
  --mint: #a9d6e5;
  --mint-deep: #174b5a;
  --blue: #278bb7;
  --yellow: #f5da72;
  --red: #de5d57;
  --anymo-word-1: #3120ea;
  --anymo-word-2: #45f6d6;
  --anymo-phonetic: #b7b7b7;
  --anymo-base: #acb8cc;
  --anymo-key: #32d8c4;
  --anymo-root: #f9bf79;
  --anymo-exam-en: #1c1b1f;
  --anymo-exam-cn: #71829e;
  --anymo-exam-key: #19ed83;
  --anymo-exam-key-2: #f61358;
  --anymo-etymology: #fa466d;
  --anymo-book: #0f4b48;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--board-deep);
  color: var(--chalk);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--board-deep); }
body { margin: 0; min-height: 100dvh; background: radial-gradient(circle at 50% -20%, #d5f5e8 0, var(--board) 38%, #f8fcfa 100%); }
button { font: inherit; }
button:active { transform: translateY(1px); }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px;
  min-height: 46px; padding: 5px max(8px, env(safe-area-inset-left));
  background: rgba(250, 254, 252, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { margin: 0; white-space: nowrap; font-size: 15px; font-weight: 800; letter-spacing: .03em; }
.source-label { display: none; }
.header-tools { display: flex; align-items: center; gap: 3px; }
.icon-button { width: 28px; height: 28px; padding: 0; color: var(--chalk); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.icon-button[aria-pressed="true"] { color: #4d3d00; background: #fff0aa; border-color: #ead06e; }

.app-shell { width: min(100%, 760px); margin: auto; padding: 7px 10px calc(22px + env(safe-area-inset-bottom)); }
.summary { display: flex; align-items: center; gap: 2px; }
.stat { display: flex; align-items: baseline; gap: 1px; padding: 1px 2px; white-space: nowrap; text-align: center; }
.stat strong { font-size: 11px; color: var(--mint-deep); }
.stat span { font-size: 9px; color: var(--muted); }
.stat-button { appearance: none; color: inherit; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.stat-button.active { background: #fff0aa; }
.wrong-summary { position: relative; }
.wrong-study-menu { position: absolute; top: calc(100% + 8px); right: -34px; z-index: 60; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; width: 188px; padding: 8px; background: #fff; border: 1px solid #b9dce8; border-radius: 11px; box-shadow: 0 10px 28px rgba(23,75,90,.2); }
.wrong-study-menu > strong, .wrong-study-menu > small { grid-column: 1 / -1; color: #315f6b; font-size: 11px; }
.wrong-study-menu button { min-height: 31px; padding: 4px 5px; color: #174b5a; background: #eef7fa; border: 1px solid #b9dce8; border-radius: 7px; font-size: 10px; font-weight: 800; }
.wrong-study-menu .wrong-study-exit { grid-column: 1 / -1; color: #7c4050; background: #fff3f6; border-color: #efc1cc; }

.mode-nav { display: grid; grid-template-columns: repeat(5, minmax(31px, 1fr)); gap: 1px; min-width: 0; padding: 1px; margin: 0; background: transparent; border: 0; box-shadow: none; }
.mode-nav button { min-height: 30px; padding: 2px 1px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 10px; font-weight: 700; }
.mode-nav button.active { color: #174b5a; background: #a9d6e5; }

.module-progress { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 6px; margin: 0 2px 5px; padding: 3px 7px; color: var(--chalk); background: rgba(255,255,255,.74); border: 1px solid var(--line); border-radius: 8px; }
.module-progress > div:first-child { display: flex; align-items: baseline; gap: 5px; }
.module-progress strong { color: var(--mint-deep); font-size: 10px; }
.module-progress span { color: var(--muted); font-size: 9px; }
.progress-track { height: 4px; overflow: hidden; background: #dcecf2; border-radius: 99px; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, #a9d6e5, #7fb8cc); border-radius: inherit; }
.pronunciation-control { position: relative; }
.pronunciation-toggle { min-width: 54px; min-height: 27px; padding: 2px 6px; color: #174b5a; background: #eef7fa; border: 1px solid #b9dce8; border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.pronunciation-menu { position: absolute; top: calc(100% + 5px); right: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 126px; padding: 5px; background: #fff; border: 1px solid #b9dce8; border-radius: 9px; box-shadow: 0 8px 24px rgba(23,75,90,.16); }
.pronunciation-menu button { min-height: 30px; padding: 2px; color: #315f6b; background: #f5fafc; border: 1px solid #d7e9ef; border-radius: 6px; font-size: 11px; }
.pronunciation-menu button.active { color: #174b5a; background: #a9d6e5; border-color: #7fb8cc; font-weight: 800; }

.workspace { min-height: 440px; }
.panel { overflow: hidden; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 38px rgba(35, 110, 85, .1); }
.panel-body { padding: 20px; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.review-return { width: 100%; min-height: 40px; margin: -8px 0 12px; padding: 7px 11px; color: #174b5a; text-align: left; background: #e7f3f7; border: 1px solid #a9d6e5; border-radius: 10px; font-size: 12px; font-weight: 800; }
.study-location { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 7px; padding: 7px 12px; color: #526f77; background: #eef7fa; border-bottom: 1px solid #d7e9ef; font-size: 10px; font-variant-numeric: tabular-nums; }
.study-location span { color: #718992; }
.study-location strong { color: #315f6b; font-size: 10px; }
.study-location strong:last-child { padding: 2px 6px; color: #174b5a; background: #d1f1e4; border: 1px solid #a8d9c8; border-radius: 6px; font-size: 11px; font-weight: 900; }
.meta-row .study-location { margin: -20px -20px 0; padding-left: 20px; background: transparent; border: 0; }
.word { margin: 24px 0 4px; color: transparent; background: linear-gradient(45deg, var(--anymo-word-1), var(--anymo-word-2)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: clamp(36px, 11vw, 58px); line-height: 1; text-align: center; overflow-wrap: anywhere; }
.phonetics { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; color: var(--anymo-phonetic); font-size: 14px; font-weight: 700; }
.card-tool-row { display: flex; justify-content: center; gap: 6px; margin: -7px 0 10px; }
.audio-button { min-height: 30px; padding: 3px 8px; color: #174b5a; background: #eef7fa; border: 1px solid #b9dce8; border-radius: 8px; font-size: 10px; font-weight: 800; }
.audio-button:disabled { opacity: .45; }
.note-button { min-height: 30px; padding: 3px 8px; color: #72541c; background: #fff8df; border: 1px solid #e7d797; border-radius: 8px; font-size: 10px; font-weight: 800; }
.note-button.has-note { color: #174b5a; background: #dceff5; border-color: #9ccadb; }
.note-editor { margin: -8px 0 16px; padding: 12px; background: #f5fafc; border: 1px solid #b9dce8; border-radius: 12px; }
.note-editor label { display: block; margin-bottom: 7px; color: #174b5a; font-size: 13px; font-weight: 800; }
.note-editor textarea { box-sizing: border-box; width: 100%; padding: 10px; color: #284a53; background: #fff; border: 1px solid #b9dce8; border-radius: 9px; font: inherit; line-height: 1.55; resize: vertical; }
.note-editor > div { display: flex; gap: 7px; margin-top: 8px; }
.note-editor .button { min-height: 38px; padding: 5px 10px; }
.note-editor .note-delete { margin-left: auto; color: #9a2945; border-color: #efb2c0; }
.supplement-note { margin: 3px 0 8px; padding: 12px 14px; color: #294e58; background: #fff8df; border: 1px solid #e7d797; border-left: 4px solid #d1a934; border-radius: 12px; }
.supplement-note strong { display: block; margin-bottom: 6px; color: #72541c; font-size: 13px; }
.supplement-note div { white-space: pre-wrap; line-height: 1.65; overflow-wrap: anywhere; }
.answer-board { margin-top: 2px; padding: 4px 12px 14px; color: #f4fbfa; background-color: var(--anymo-book); background-image: radial-gradient(ellipse at 18% 8%, rgba(120,205,198,.10), transparent 42%), radial-gradient(ellipse at 82% 94%, rgba(3,35,37,.18), transparent 48%), repeating-linear-gradient(173deg, rgba(255,255,255,.018) 0 1px, rgba(0,0,0,.014) 1px 3px); border: 1px solid rgba(176,224,217,.26); border-radius: 12px; box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 0 24px rgba(0,22,23,.18); }
.mnemonic-fold { margin-top: 8px; padding: 0; }
.mnemonic-fold > summary { cursor: pointer; padding: 11px 13px; color: #ffeb3b; font-size: 14px; font-weight: 800; }
.mnemonic-fold[open] > summary { border-bottom: 1px solid rgba(102,204,255,.25); }
.meaning { padding: 14px 4px; color: #f4fbfa; background: transparent; border: 0; border-radius: 0; line-height: 1.8; }
.meaning [fre] { color: inherit; }
.meaning > div { display: flex; gap: 12px; }
.meaning > div > span:first-child { color: #d8e8e6; font-weight: 800; }
.meaning > div > span:last-child { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.meaning b { display: inline-block; margin-right: 4px; color: #66ccff; font-weight: 700; }
.meaning b::after { content: "；"; margin-left: 2px; color: #f4fbfa; }
.meaning b:last-child::after { content: ""; }
.meaning b[fre] { color: var(--anymo-key); font-weight: 800; text-shadow: 0 1px 0 rgba(0, 20, 18, .26); }
.hidden { display: none !important; }
.detail-loading { margin-top: 8px; padding: 18px; color: var(--muted); text-align: center; background: #f2faf6; border-radius: 12px; }
.rich-meaning { color: #4e6471; }
.rich-meaning .lan { display: inline; padding: 0 2px; color: #087653; background: #ddf6ec; border-radius: 4px; font-weight: 850; }

.result-badge { position: fixed; top: max(54px, calc(env(safe-area-inset-top) + 50px)); right: 12px; z-index: 80; display: grid; place-items: center; width: 32px; height: 32px; pointer-events: none; border: 1px solid; border-radius: 10px; box-shadow: 0 6px 18px rgba(23,59,50,.18); font-size: 18px; animation: result-pop .9s ease both; }
.result-badge.success { color: #725400; background: #fff6bf; border-color: #ecd56a; }
.result-badge.error { color: #9a2945; background: #fff0f4; border-color: #ef9aad; }
@keyframes result-pop { 0% { opacity: 0; transform: translateY(-5px) scale(.7); } 18%, 72% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-2px) scale(.9); } }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.button { min-height: 48px; padding: 8px 12px; color: #315f52; background: #f8fcfa; border: 1px solid var(--line); border-radius: 12px; font-weight: 750; }
.button.primary { color: #174b5a; background: #a9d6e5; border-color: #7fb8cc; }
.button.favorite.active { color: #604b00; background: #fff0aa; border-color: #ead06e; }

.mnemonic-direct { margin-top: 0; padding: 12px 4px 2px; background: transparent; border: 0; border-top: 1px solid rgba(102,204,255,.25); border-radius: 0; }
.mnemonic-direct h2 { margin: 0 0 7px; color: #c62828; font-size: 15px; }
.mnemonic-direct .detail-content { padding: 0; color: #f4fbfa; }
.mnemonic-direct .mnemonic { color: #f4fbfa; }
.mnemonic-direct .mne_h { color: #f4fbfa; font-weight: 700; }
.mnemonic-direct .mne_en { color: #ffeb3b; font-weight: 800; }
.mnemonic-direct .mne_cn { color: #f4fbfa; }

.details { margin-top: 14px; border-top: 1px solid var(--line); }
.details details { border-bottom: 1px solid var(--line); }
.details summary { cursor: pointer; min-height: 48px; padding: 14px 2px; color: var(--blue); font-weight: 750; }
.detail-content { padding: 2px 2px 18px; color: #385c52; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.detail-content p { margin: 6px 0; }
.detail-content .pp-key, .detail-content .ppi-title, .detail-content .pos { color: #8a6500; font-weight: 800; }
.detail-content .lan, .detail-content .lan1, .detail-content b { color: #087653; }
.detail-content .stc, .detail-content .ppi, .detail-content .mnemonic, .detail-content ._ciyuan, .detail-content .affix-box { margin: 10px 0; padding: 12px; background: #f2faf6; border-radius: 12px; }
.detail-content svg, .detail-content img, .detail-content .interactions { display: none; }
.answer-board .mnemonic-direct .detail-content .mnemonic { margin: 0; padding: 0; color: #f4fbfa; background: transparent; border-radius: 0; }
.answer-board .mnemonic-direct .mne_c { display: block; }
.answer-board .mnemonic-direct .mne_ec { margin: 10px 0; }
.book-colors[open] { margin: 8px 0; overflow: hidden; background: var(--anymo-book); border: 1px solid rgba(176,224,217,.35); border-radius: 12px; }
.book-colors[open] summary { padding-left: 12px; color: #66ccff; }
.book-colors .detail-content { padding: 4px 14px 16px; color: #f4fbfa; }
.book-colors .detail-content .pp1, .book-colors .detail-content .pp0, .book-colors .detail-content .yuanshu { color: #f4fbfa; }
.book-colors .detail-content .pp-key, .book-colors .detail-content .ppi-title { color: #c62828; font-weight: 800; }
.book-colors .detail-content .lan { color: #66ccff; font-weight: 700; }
.book-colors .detail-content .lan1, .book-colors .detail-content .bold, .book-colors .detail-content b, .book-colors .detail-content strong { color: #ffeb3b; }
.book-colors .detail-content .pos { color: #d8e8e6; }
.book-colors .detail-content .ppi { background: rgba(99,201,232,.10); }
.book-preview { margin: 3px 0 8px; overflow: hidden; background: var(--anymo-book); border: 1px solid rgba(176,224,217,.35); border-radius: 12px; }
.book-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px 3px; color: #66ccff; }
.book-preview-head strong { font-size: 14px; }
.book-head-actions { display: flex; align-items: center; gap: 4px; }
.book-edit-button { min-width: 38px; min-height: 28px; padding: 2px 7px; color: #d1f1e4; background: rgba(255,255,255,.06); border: 1px solid rgba(209,241,228,.3); border-radius: 8px; font-size: 10px; font-weight: 800; }
.book-edit-button:disabled { opacity: .55; }
.book-toggle { min-width: 42px; min-height: 28px; padding: 2px 8px; color: #ffeb3b; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; font-size: 11px; font-weight: 800; }
.book-editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px 10px; background: rgba(2,38,40,.56); border-top: 1px solid rgba(102,204,255,.22); border-bottom: 1px solid rgba(102,204,255,.22); }
.book-editor-toolbar button { min-height: 28px; padding: 2px 7px; color: #f4fbfa; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 7px; font-size: 10px; font-weight: 800; }
.book-color-modes { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; background: rgba(255,255,255,.06); border-radius: 8px; }
.book-editor-toolbar .book-color-mode { min-height: 24px; padding: 1px 5px; color: #b9d9df; border-color: transparent; }
.book-editor-toolbar .book-color-mode.active { color: #173f47; background: #a9d6e5; border-color: #7fb8cc; }
.book-editor-toolbar .book-color { width: 28px; padding: 1px; color: #173f47; }
.book-editor-toolbar .blue { background: #66ccff; }.book-editor-toolbar .green { background: #d1f1e4; }.book-editor-toolbar .yellow { background: #ffeb3b; }.book-editor-toolbar .pink { color: #fff; background: #fa466d; }
.book-editor-toolbar .save { color: #174b5a; background: #a9d6e5; border-color: #7fb8cc; }
.book-edit-content { min-height: 150px; outline: 2px solid rgba(102,204,255,.5); outline-offset: -4px; caret-color: #ffeb3b; }
.book-edit-content:focus { outline-color: #66ccff; }
.book-edit-content [data-study-mark] { padding: 0 2px; color: #173f47; border-radius: 3px; }
.book-inline-note { margin-left: 4px; color: #ffeb3b; font-size: .88em; text-decoration: underline; text-decoration-color: #66ccff; }
.book-preview .detail-content { padding-top: 3px; }
.book-preview-short, .book-preview-full { max-height: max(150px, calc(100dvh - 355px)); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.exam-colors .stc .from { color: #444; }
.exam-colors .stc .en, .exam-colors .stc .en a { color: var(--anymo-exam-en); }
.exam-colors .stc .cn { display: block; color: var(--anymo-exam-cn); }
.exam-colors .stc .en b { color: var(--anymo-exam-key); }
.exam-colors .stc .en bl { color: var(--anymo-exam-key-2); }
.etymology-colors ._ciyuan h2 a { color: var(--anymo-etymology); }
.etymology-colors ._ciyuan h2 { color: #555; }
.etymology-colors ._ciyuan p { color: #333; }
.distribution-colors .zt_syfb .progress-bar { background: linear-gradient(315deg, #05e8ba 0, #62b2f3 74%); }
.distribution-colors .zt_en .key { color: #00a015; text-decoration-color: #51f3ca; }

.quiz-prompt { padding: 24px 20px 10px; text-align: center; }
.quiz-prompt small { color: var(--muted); }
.quiz-prompt h2 { margin: 12px 0 6px; color: transparent; background: linear-gradient(45deg, var(--anymo-word-1), var(--anymo-word-2)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: clamp(28px, 8vw, 42px); overflow-wrap: anywhere; }
.quiz-prompt h2 .rich-meaning { color: #4e6471; background: none; -webkit-text-fill-color: #4e6471; font-size: clamp(20px, 6vw, 30px); }
.quiz-prompt h2 .rich-meaning .lan { color: #087653; -webkit-text-fill-color: #087653; }
.choices { display: grid; gap: 10px; padding: 16px 20px; }
.choice { display: flex; align-items: center; gap: 9px; min-height: 56px; padding: 12px 14px; color: #2d5147; text-align: left; background: #f8fcfa; border: 1px solid var(--line); border-radius: 12px; }
.choice-pos { flex: 0 0 auto; min-width: 38px; padding: 3px 7px; color: #72541c; text-align: center; background: #fff0cf; border-left: 3px solid var(--anymo-root); border-radius: 7px; font-size: 12px; font-weight: 800; }
.choice.selected { border-color: #55a9ca; background: #edf8fc; }
.choice.correct { color: #075b39; border-color: var(--anymo-exam-key); background: #dcfaeb; }
.choice.wrong { border-color: var(--anymo-exam-key-2); background: #fff0f4; }
.choice.review { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.4fr); align-items: center; gap: 12px; opacity: 1; }
.choice.review:active { transform: translateY(1px); }
.review-english { display: flex; flex-direction: column; gap: 3px; }
.review-english b { color: transparent; background: linear-gradient(45deg, var(--anymo-word-1), var(--anymo-word-2)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 16px; overflow-wrap: anywhere; }
.review-english em { color: var(--anymo-phonetic); font-size: 11px; font-style: normal; font-weight: 800; }
.review-chinese { color: #4e6471; line-height: 1.45; }
.choice.review.correct .review-chinese { color: #075b39; font-weight: 750; }
.choice.review.wrong .review-chinese { color: #8b294b; }
.rich-meaning .synced-blue-meaning { padding: 0 2px; color: #087653 !important; background: #d1f1e4 !important; border-radius: 3px; font-weight: 850; text-decoration: underline; text-decoration-color: #55a9ca; text-decoration-thickness: 2px; text-underline-offset: 2px; -webkit-text-fill-color: #087653 !important; }
.feedback { min-height: 50px; margin: 0 20px; padding: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.feedback.success { color: var(--mint-deep); }
.feedback.error { color: var(--red); }
.quiz-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 20px 20px; }

.match-help { margin: 0; padding: 18px 18px 10px; color: var(--muted); font-size: 13px; }
.match-board { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 34px; padding: 12px 18px 22px; }
.match-column { display: grid; gap: 10px; align-content: start; z-index: 2; }
.match-item { min-height: 58px; padding: 10px; color: #f4fbfa; background: var(--anymo-book); border: 2px solid rgba(176,224,217,.22); border-radius: 12px; overflow-wrap: anywhere; }
.match-en { color: #fff; background: none; -webkit-text-fill-color: #fff; font-weight: 800; }
.match-zh { color: #fff; font-weight: 700; }
.match-zh .rich-meaning { color: #fff; }
.match-zh .rich-meaning .lan { color: #ffeb3b; background: transparent; }
.match-item.selected { position: relative; z-index: 3; border-color: #ffeb3b; box-shadow: 0 0 0 3px rgba(255,235,59,.58), 0 4px 14px rgba(63,55,0,.24); transform: translateY(-1px); }
.match-item.correct { color: #06492f; background: #c9f8df; border-color: var(--anymo-exam-key); }
.match-item.wrong { border-color: var(--anymo-exam-key-2); background: #fff0f4; }
.match-item.correct .match-en, .match-item.correct .match-zh { color: #06492f; background: none; -webkit-text-fill-color: #06492f; }
.match-item.wrong .match-en, .match-item.wrong .match-zh { color: #8b294b; background: none; -webkit-text-fill-color: #8b294b; }
.match-item[data-review-word] { cursor: pointer; }
.match-lines { position: absolute; inset: 12px 18px 22px; z-index: 1; width: calc(100% - 36px); height: calc(100% - 34px); pointer-events: none; overflow: visible; }
.match-line { stroke: var(--anymo-exam-key); stroke-width: 4; stroke-linecap: round; }
.match-line.wrong { stroke: var(--anymo-exam-key-2); stroke-dasharray: 7 5; }
.match-feedback { min-height: 48px; margin: 0 18px 18px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.match-feedback.error { color: var(--red); border-color: rgba(255,123,114,.5); }
.match-feedback.success { color: var(--mint-deep); border-color: #89d5b9; }

.study-stats { margin-bottom: 7px; padding: 10px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 26px rgba(35,110,85,.08); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.stats-grid > div { display: grid; gap: 2px; min-width: 0; padding: 7px 5px; text-align: center; background: #f3f9fb; border-radius: 8px; }
.stats-grid span { color: var(--muted); font-size: 9px; }
.stats-grid strong { color: #174b5a; font-size: 12px; }
.stats-history { margin-top: 6px; border-top: 1px solid #dcecf2; }
.stats-history > summary { padding: 7px 3px 1px; cursor: pointer; color: #315f6b; font-size: 11px; font-weight: 800; }
.stats-history-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px 8px; padding: 7px 3px; color: var(--muted); border-bottom: 1px solid #edf4f6; font-size: 11px; }
.stats-history-row strong { color: #174b5a; }
.stats-export { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 4px; }
.stats-export button { min-height: 26px; padding: 2px 6px; color: #174b5a; background: #eef7fa; border: 1px solid #b9dce8; border-radius: 6px; font-size: 9px; font-weight: 800; }

.directory-panel { padding: 14px; }
.directory-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-bottom: 8px; }
.directory-search input { min-width: 0; min-height: 42px; padding: 8px 11px; color: #254e59; background: #f8fcfd; border: 1px solid #b9dce8; border-radius: 10px; font: inherit; }
.directory-search button { min-width: 64px; color: #174b5a; background: #a9d6e5; border: 1px solid #7fb8cc; border-radius: 10px; font-weight: 800; }
.directory-search-results { max-height: 310px; margin-bottom: 10px; overflow: auto; background: #f8fcfd; border: 1px solid #b9dce8; border-radius: 10px; }
.directory-search-head { position: sticky; top: 0; z-index: 1; padding: 7px 10px; color: #526f77; background: #eaf4f7; font-size: 10px; font-weight: 800; }
.directory-search-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; color: #315f6b; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #e2eef2; }
.directory-search-result > span { display: grid; gap: 3px; min-width: 0; }
.directory-search-result strong { color: #245f4f; font-size: 15px; }
.directory-search-result small { color: #526f67; line-height: 1.4; }
.directory-search-result em { flex: 0 0 auto; color: #718983; font-size: 9px; font-style: normal; }
.directory-search-empty { margin: 0; padding: 18px; color: var(--muted); text-align: center; font-size: 11px; }
.directory-root { display: grid; gap: 3px; padding: 14px; margin-bottom: 10px; background: #e9f8f2; border: 1px solid #c8e7dc; border-radius: 12px; }
.directory-root span { color: var(--muted); font-size: 11px; }
.directory-root strong { color: #17684f; }
.directory-root small { color: var(--muted); }
.deck-group, .list-group { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.deck-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.deck-directory-toggle { display: flex; justify-content: space-between; gap: 10px; min-height: 48px; padding: 12px 10px 12px 14px; color: #245f4f; text-align: left; background: transparent; border: 0; font-weight: 800; }
.deck-directory-toggle small { color: var(--muted); font-weight: 500; }
.deck-directory-toggle[aria-expanded="true"] { background: #f0f7fa; }
.deck-favorites-toggle { min-width: 55px; padding: 4px 8px; color: #725400; background: #fffaf0; border: 0; border-left: 1px solid #eadc9a; font-size: 11px; font-weight: 800; }
.deck-favorites-toggle[aria-expanded="true"] { background: #fff0aa; }
.list-group > summary { display: flex; justify-content: space-between; gap: 10px; padding: 14px; cursor: pointer; color: #245f4f; font-weight: 800; }
.list-group > summary small { color: var(--muted); font-weight: 500; }
.list-sections { display: grid; gap: 8px; padding: 0 10px 10px; }
.list-group { background: #fbfefd; }
.list-group > summary { padding: 11px 12px; }
.directory-words { display: grid; gap: 1px; padding: 0 8px 8px; }
.group-favorites { margin: 0 8px 8px; padding: 7px; background: #fffaf0; border: 1px solid #eadc9a; border-radius: 10px; }
.group-favorites-title { display: flex; justify-content: space-between; gap: 8px; padding: 3px 4px 8px; color: #725400; font-size: 11px; }
.group-favorites-title span { color: #8a7440; }
.group-favorite-words { display: grid; gap: 1px; }
.group-favorites-empty { margin: 0; padding: 12px; color: #9a8b65; text-align: center; font-size: 11px; }
.directory-all-label { padding: 7px 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.directory-word-row { display: grid; grid-template-columns: minmax(0, 1fr) 78px 34px; align-items: center; gap: 4px; background: #f0f9f5; border-bottom: 1px solid #dcece6; }
.directory-word-row.current { background: #e4f2f7; box-shadow: inset 4px 0 0 var(--mint-deep); }
.directory-word-row.favorite-list-row { background: #fffdf6; }
.directory-word-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 9px 5px 9px 10px; color: #31594e; text-align: left; background: transparent; border: 0; }
.directory-favorite { align-self: center; width: 30px; height: 30px; margin-right: 4px; color: #8b7a4b; background: #fff; border-color: #ddd2ab; }
.directory-favorite.active { color: #725400; background: #fff0aa; border-color: #ead06e; }
.directory-entry { display: grid; gap: 4px; min-width: 0; }
.directory-entry strong { display: flex; align-items: baseline; gap: 6px; color: #245f4f; }
.directory-headword { color: #245f4f; font-size: inherit; }
.directory-entry small { color: #526f67; text-align: left; line-height: 1.45; }
.directory-entry small b { color: #8a6500; }
.directory-entry .rich-meaning .lan { color: #087653; background: #d1f1e4; }
.directory-status { flex: 0 0 auto; padding-top: 2px; color: var(--muted); font-size: 10px; font-style: normal; white-space: nowrap; }
.directory-location { display: grid; gap: 1px; color: #718983; text-align: right; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.directory-location strong { color: #315f6b; font-size: 9px; }
.directory-location span:last-child { justify-self: end; padding: 2px 5px; color: #174b5a; background: #d1f1e4; border: 1px solid #a8d9c8; border-radius: 5px; font-size: 10px; font-weight: 900; }
.directory-word-row.current .directory-status { color: var(--mint-deep); font-weight: 800; }
.directory-top-sentinel { display: block; width: 1px; height: 1px; }
.directory-float-tools { position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)); z-index: 50; display: grid; gap: 4px; width: 66px; }
.directory-mask-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.directory-mask-button { min-width: 0; min-height: 28px; padding: 2px; color: #315f6b; background: rgba(246,251,252,.96); border: 1px solid #b9dce8; border-radius: 7px; box-shadow: 0 4px 12px rgba(23,75,90,.12); font-size: 9px; font-weight: 800; }
.directory-mask-button[aria-pressed="true"] { color: #fff; background: #376f7e; border-color: #2e626f; }
.directory-back-top { width: 100%; min-height: 36px; padding: 5px 7px; color: #174b5a; background: rgba(238,247,250,.96); border: 1px solid #7fb8cc; border-radius: 9px; box-shadow: 0 7px 20px rgba(23,75,90,.18); font-size: 10px; font-weight: 800; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.directory-back-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.quick-review-button { position: fixed; right: max(11px, env(safe-area-inset-right)); bottom: max(15px, calc(env(safe-area-inset-bottom) + 11px)); z-index: 50; min-width: 54px; min-height: 38px; padding: 5px 8px; color: #174b5a; background: rgba(238,247,250,.96); border: 1px solid #7fb8cc; border-radius: 10px; box-shadow: 0 7px 20px rgba(23,75,90,.18); font-size: 10px; font-weight: 900; }
.quick-review-button.active { color: #fff; background: #376f7e; border-color: #2e626f; }
.mask-english .directory-headword, .mask-english .directory-search-result strong, .mask-english .directory-current-word { color: transparent !important; -webkit-text-fill-color: transparent !important; background: #b5cdd5 !important; border-radius: 4px; text-shadow: none !important; user-select: none; }
.mask-chinese .directory-entry small, .mask-chinese .directory-search-result small { color: transparent !important; -webkit-text-fill-color: transparent !important; background: #c8dce2 !important; border-radius: 4px; text-shadow: none !important; user-select: none; }
.mask-chinese .directory-entry small *, .mask-chinese .directory-search-result small * { color: transparent !important; -webkit-text-fill-color: transparent !important; background: transparent !important; text-shadow: none !important; }
.deck-row { display: flex; justify-content: space-between; gap: 10px; padding: 13px 14px; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; }
.deck-row small { color: var(--muted); }
.deck-row.unavailable { color: #8da099; background: #f6faf8; }

.empty { padding: 46px 22px; text-align: center; color: var(--muted); }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.loading div { display: inline-block; width: 8px; height: 24px; margin: 4px; background: var(--mint); animation: pulse 1s ease-in-out infinite alternate; }
.loading div:nth-child(2) { animation-delay: .2s; }.loading div:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { transform: scaleY(.35); opacity: .4; } }

@media (min-width: 640px) {
  .topbar { grid-template-columns: auto minmax(320px, 520px) auto; justify-content: center; }
  .app-shell { padding-top: 10px; }
  .panel-body { padding: 28px; }
  .meta-row .study-location { margin-left: -28px; margin-right: -28px; padding-left: 28px; }
  .choices { grid-template-columns: 1fr 1fr; }
  .mode-nav button { font-size: 11px; }
  .action-row { grid-template-columns: 1fr 1fr 1.4fr 1fr; }
  .action-row.review-card-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 390px) {
  .topbar { gap: 3px; padding-left: 6px; padding-right: 6px; }
  .brand { font-size: 13px; }
  .app-shell { padding-left: 7px; padding-right: 7px; }
  .mode-nav { grid-template-columns: repeat(5, minmax(29px, 1fr)); }
  .mode-nav button { font-size: 9px; }
  .module-progress span { font-size: 8px; }
  .book-preview-short, .book-preview-full { max-height: max(140px, calc(100dvh - 345px)); }
  .deck-directory-toggle, .deck-row { flex-direction: column; gap: 2px; }
  .match-board { gap: 26px; padding-left: 10px; padding-right: 10px; }
  .match-lines { left: 10px; right: 10px; width: calc(100% - 20px); }
  .match-item { padding: 7px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
