:root {
  color-scheme: light dark;
  --forest: #0f3a4a;
  --mint: #e3f3f7;
  --cream: #eef5f8;
  --paper: #ffffff;
  --ink: #10202b;
  --muted: #637481;
  --line: #d5e2e8;
  --orange: #2f8fb3;
  --blue: #218faf;
  --blue-soft: #d9eef6;
  --blue-faint: #f6fbfd;
  --deep-blue: #0b2f42;
  --shadow: #0a385214;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #eaf3f7; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% -6%, #c7e8f4 0, transparent 34%),
    radial-gradient(circle at -10% 18%, #dcecf7 0, transparent 34%),
    linear-gradient(180deg, #f4fafc 0%, #eaf3f7 100%);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin-top: 0; }
.app-shell { max-width: 680px; min-height: 100vh; margin: auto; padding-bottom: calc(92px + var(--safe-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 14px; }
.topbar h1 { margin: 0; color: var(--deep-blue); font-size: 26px; letter-spacing: -.5px; }
.eyebrow { margin-bottom: 4px; color: #4c8298; font-size: 11px; font-weight: 850; letter-spacing: 1.6px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.round-button { width: 44px; height: 44px; border: 1px solid #c9dde6; border-radius: 50%; background: #ffffffd9; color: var(--forest); font-weight: 800; box-shadow: 0 8px 20px var(--shadow); }
.material-only-action { display: none; }
body[data-current-page="material"] .top-actions .material-only-action { display: inline-flex; align-items: center; justify-content: center; }
body[data-current-page="material"] .top-actions .material-only-action[hidden] { display: none; }
main { padding: 4px 16px 24px; }
.page { display: none; animation: rise .22s ease; }
.page.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.hero {
  min-height: 300px; padding: 26px; border-radius: 30px; color: white;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    linear-gradient(145deg, #ffffff24 0%, transparent 48%),
    linear-gradient(135deg, #0c4258 0%, #155d78 52%, #258eaa 100%);
  box-shadow: 0 18px 42px #0a4a651f;
}
.hero h2 { margin: 18px 0 12px; font-size: clamp(29px, 8vw, 42px); line-height: 1.18; letter-spacing: -1.1px; }
.hero p { max-width: 390px; color: #dff4fb; line-height: 1.65; }
.pill { display: inline-flex; width: fit-content; padding: 6px 11px; border-radius: 999px; background: var(--blue-soft); color: var(--forest); font-size: 12px; font-weight: 800; }
.primary, .secondary, .text-button, .listen-button, .reveal-button {
  min-height: 50px; padding: 12px 18px; border: 0; border-radius: 14px; font-weight: 750;
}
.primary { color: white; background: linear-gradient(135deg, #1e86aa, #2aa8c6); box-shadow: 0 10px 22px #1687a833; }
.secondary { color: var(--forest); background: var(--blue-soft); }
.wide { width: 100%; }
.hero .primary { color: var(--forest); background: white; }
.text-button { padding-inline: 8px; color: var(--forest); background: transparent; }

.section-title { display: flex; justify-content: space-between; align-items: end; margin: 26px 2px 12px; }
.section-title h2, .section-title h3 { margin-bottom: 0; }
.section-title > span { color: var(--muted); font-size: 13px; }
.section-title.compact-title { justify-content: flex-end; margin-top: 18px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metrics article, .panel, .action-card, .audio-player, .shadow-card, .score-card, .review-card, .dictation-panel {
  border: 1px solid #d3e4eb; border-radius: 22px; background: #ffffffea;
  box-shadow: 0 10px 28px var(--shadow);
}
.metrics article { padding: 16px 12px; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: inline-block; margin: 8px 3px 4px 0; color: #12617d; font-size: 28px; }
.action-card { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 15px; }
.action-card h3, .action-card p { margin-bottom: 3px; }
.action-card p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.action-icon { display: grid; place-items: center; flex: 0 0 46px; height: 46px; border-radius: 16px; color: var(--forest); background: var(--blue-soft); font-weight: 800; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }

.notice { margin: 2px 0 14px; padding: 14px 16px; border-radius: 16px; color: #22576a; background: #e4f5fb; }
.notice p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; }
.panel { padding: 18px; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-bottom: 20px; padding: 4px; border-radius: 14px; background: #dfeaf0; }
.segmented button { min-height: 42px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-weight: 700; }
.segmented button.selected { color: var(--forest); background: white; box-shadow: 0 2px 8px #0000000f; }
.translation-label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; padding: 13px 15px; border-radius: 16px; color: var(--forest); background: var(--blue-soft); }
.translation-label span { color: var(--muted); font-size: 12px; }
.selection-tip { margin: -5px 3px 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
label { display: block; margin: 14px 0 8px; font-weight: 750; }
textarea, .search {
  width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 18px;
  outline: none; resize: vertical; color: var(--ink); background: #fbfdfe; line-height: 1.65;
}
.text-input {
  width: 100%; height: 52px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 18px; outline: none; color: var(--ink); background: #fbfdfe;
}
textarea:focus, .search:focus, .text-input:focus { border-color: #55a9c4; box-shadow: 0 0 0 4px #55a9c424; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 3px; scrollbar-width: none; }
.chip { white-space: nowrap; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 13px; }
.chip.selected { color: white; border-color: #1e86aa; background: #1e86aa; }
.vocab-category-bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.vocab-category-bar .chip-row { min-width: 0; }
.small-action { min-height: 38px; padding: 8px 12px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.help { text-align: right; color: var(--muted); font-size: 12px; }
.input-note { margin: 8px 2px 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.material-head { display: flex; justify-content: space-between; align-items: start; margin: 8px 2px 18px; }
.material-head h2 { margin: 10px 0 0; }
.material-trash-button { min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.audio-player { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px; }
.play-button { flex: 0 0 50px; width: 50px; height: 50px; border: 0; border-radius: 50%; color: white; background: #12617d; box-shadow: 0 9px 20px #12617d2b; }
.play-button.playing, .sentence-actions button.playing { color: white; background: var(--orange); }
.loop-button { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--forest); background: white; font-weight: 800; }
.loop-button.active { color: white; border-color: var(--forest); background: var(--forest); }
.audio-player strong { font-size: 14px; }
.audio-player select { border: 0; color: var(--forest); background: transparent; }
.progress-slider { width: 100%; height: 24px; margin-top: 5px; accent-color: var(--orange); cursor: pointer; }
.progress-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: #dceaf0; }
.progress-slider::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--orange); box-shadow: 0 2px 8px #0a38522b; }
.progress { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #dceaf0; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--orange); transition: width .25s; }
.progress.large { height: 8px; margin: 0 0 18px; }
.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.sentence-list { display: grid; gap: 10px; }
.sentence-card { padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: #ffffff; box-shadow: 0 8px 22px #0a38520d; }
.sentence-card .english { margin-bottom: 9px; font-size: 17px; line-height: 1.55; font-weight: 650; }
.sentence-card .english { user-select: text; -webkit-user-select: text; cursor: text; }
.sentence-card .chinese { margin-bottom: 12px; color: var(--muted); line-height: 1.55; }
.sentence-actions { display: flex; justify-content: space-between; align-items: center; }
.sentence-actions button { min-height: 40px; padding: 5px 8px; border: 0; color: var(--forest); background: transparent; }
.sentence-recording { margin-top: 12px; padding: 10px; border-radius: 16px; background: var(--blue-faint); }
.sentence-recording-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sentence-recording-actions button {
  width: auto; min-height: 38px; padding: 8px 12px; border: 1px solid #c9e1ea; border-radius: 999px;
  color: var(--forest); background: #ffffff; box-shadow: none; font-size: 13px;
}
.sentence-recording-actions button.recording { color: #ffffff; background: #d94b5d; border-color: #d94b5d; }
.sentence-recording small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.sentence-recording-audio { width: 100%; height: 42px; margin-top: 8px; }
.phrase-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.phrase-button { padding: 8px 10px; border: 0; border-radius: 10px; color: var(--forest); background: var(--blue-soft); font-size: 12px; }
.phrase-button.saved { color: white; background: var(--forest); }
.sticky-action { position: sticky; bottom: calc(78px + var(--safe-bottom)); margin-top: 18px; padding: 8px; border-radius: 18px; background: #f6fbfde6; backdrop-filter: blur(10px); }

.shadow-card { min-height: 250px; padding: 24px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.english-large { font-family: Georgia, serif; font-size: clamp(23px, 6vw, 29px); line-height: 1.55; }
.muted { color: var(--muted); line-height: 1.6; }
.listen-button { align-self: center; min-height: 44px; border: 1px solid var(--line); color: var(--forest); background: transparent; }
.review-card .listen-button {
  color: #ffffff; background: var(--blue, #218faf); border-color: var(--blue, #218faf); font-weight: 900;
}
.review-card .listen-button.speaking { color: #ffffff; background: #126e8d; border-color: #126e8d; }
.record-zone { padding: 28px 0 20px; text-align: center; }
.record-button { width: 80px; height: 80px; border: 9px solid white; border-radius: 50%; background: #2f8fb3; box-shadow: 0 0 0 2px #8cc9dc, 0 9px 24px #2f8fb347; }
.record-button span { display: block; width: 24px; height: 24px; margin: auto; border-radius: 50%; background: white; }
.record-button.recording span { border-radius: 5px; }
.record-zone strong { display: block; margin-top: 14px; }
.record-zone p { color: var(--muted); font-size: 12px; }
.score-card { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 18px; }
.score-ring { width: 86px; height: 86px; display: grid; place-content: center; text-align: center; border: 7px solid white; border-radius: 50%; background: conic-gradient(var(--orange) 0 82%, #dbe8ee 82%); box-shadow: 0 0 0 1px var(--line); }
.score-ring strong { font-size: 24px; }
.score-ring span { color: var(--muted); font-size: 10px; }
.score-detail { flex: 1; }
.score-detail p { display: flex; justify-content: space-between; margin: 8px 0; color: var(--muted); }
.score-note { width: 100%; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.recording-playback { width: 100%; height: 48px; margin-top: 4px; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.button-row.single { grid-template-columns: 1fr; }
.expand-row { display: grid; grid-template-columns: 1fr 128px; gap: 10px; align-items: end; }
.expand-row label { margin-bottom: 8px; }
.compact-material-head { justify-content: flex-end; margin-bottom: 8px; }
.compact-material-head > div, .translation-label, .selection-tip { display: none; }
.account-status p { color: var(--muted); line-height: 1.65; }
.account-shortcut { font-size: 12px; }
.db-status { display: grid; gap: 5px; margin: 14px 0 18px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--blue-faint); color: var(--forest); }
.db-status span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.db-status.ok { border-color: #cdeee0; background: #effaf4; }
.db-status.bad { border-color: #f2c7bd; background: #fff1ec; }
.sync-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0; padding: 14px; border-radius: 16px; background: var(--blue-soft); color: var(--forest); }
.sync-card span { color: var(--muted); font-size: 12px; text-align: right; }
#accountPanel { display: grid; gap: 10px; }

.review-card { min-height: 400px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.review-card[hidden] { display: none; }
.review-start-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.review-start-row button {
  color: var(--forest); border: 1px solid #c9dfe8; background: #e7f3f8; box-shadow: none;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.review-start-row button.active { color: #fff; border-color: #0b536d; background: #0b6d8e; box-shadow: 0 10px 22px rgba(11, 109, 142, .28); transform: translateY(-1px); }
[data-page="review"][data-review-mode="dictation"] #openDictation { color: #fff; border-color: #0b536d; background: #0b6d8e; box-shadow: 0 10px 22px rgba(11, 109, 142, .28); transform: translateY(-1px); }
[data-page="review"][data-review-mode="dictation"] #startDueReview,
[data-page="review"][data-review-mode="dictation"] #startAllReview { color: var(--forest); border-color: #c9dfe8; background: #e7f3f8; box-shadow: none; transform: none; }
[data-page="review"][data-review-mode="dictation"] #reviewCard { display: none !important; }
.dictation-panel { display: grid; gap: 12px; margin: 14px 0; padding: 16px; }
.dictation-panel[hidden] { display: none; }
.dictation-panel label { font-weight: 900; }
.dictation-panel textarea { min-height: 180px; }
.dictation-result { display: grid; gap: 12px; margin-top: 4px; }
.dictation-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--blue-soft); color: var(--forest); }
.dictation-summary strong { font-size: 28px; }
.dictation-summary span { color: var(--muted); font-size: 13px; text-align: right; }
.dictation-list { display: grid; gap: 10px; }
.dictation-sentence { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #ffffff; }
.dictation-sentence.correct { background: #f6fffb; }
.dictation-sentence-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--forest); }
.dictation-sentence-head span { color: var(--muted); font-size: 12px; }
.dictation-sentence small { display: block; margin-top: 8px; color: var(--muted); font-weight: 900; }
.dictation-sentence p { margin: 5px 0 0; line-height: 1.75; }
.dictation-token { display: inline-block; padding: 1px 2px; border-radius: 5px; }
.dictation-error { color: #d6424f; background: #ffe8ec; font-weight: 900; }
@media (max-width: 420px) {
  .review-start-row { grid-template-columns: 1fr; }
  .topbar { padding-inline: 12px; }
  .topbar h1 { font-size: 23px; }
  .top-actions { gap: 5px; }
  .top-actions .round-button { width: 40px; height: 40px; }
  .top-actions .material-trash-button { min-height: 40px; padding: 6px 10px; font-size: 13px; }
}
.review-prompt { max-width: 340px; margin: 22px auto; font-size: 20px; line-height: 1.6; }
.reveal-button { color: white; background: var(--forest); }
#reviewAnswer h2 { margin: 18px 0 7px; font-family: Georgia, serif; font-size: 29px; }
.example { margin: 18px 0; padding: 15px; border-radius: 16px; text-align: left; background: var(--blue-soft); }
.example p { margin-bottom: 7px; line-height: 1.5; }
.example small { color: var(--muted); }
.review-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.review-actions button { min-height: 66px; padding: 7px 3px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.review-actions strong, .review-actions small { display: block; }
.review-actions small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.review-quiz { width: 100%; max-width: 430px; }
.choice-grid { display: grid; gap: 10px; margin-top: 14px; }
.choice-grid button { min-height: 50px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); }
.choice-grid button.correct, .review-feedback.correct { color: #12617d; border-color: #98d1e2; background: #e2f5fb; }
.choice-grid button.wrong, .review-feedback.wrong { color: #8b3a5b; border-color: #e8b7ca; background: #fbe8f0; }
.review-input { width: 100%; height: 52px; margin-bottom: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.review-feedback { min-height: 28px; margin-top: 12px; padding: 8px 10px; border-radius: 12px; font-weight: 700; }
.review-feedback:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }

.search { height: 52px; resize: none; }
.vocab-item, .material-item { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #ffffff; box-shadow: 0 8px 22px #0a38520d; }
.vocab-head, .material-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.vocab-item h3, .material-item h3 { margin-bottom: 5px; }
.vocab-item p, .material-item p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.vocab-details { margin-top: 12px; border-top: 1px solid var(--line); }
.vocab-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 12px; color: var(--forest); font-size: 13px; font-weight: 900; cursor: pointer;
  list-style: none;
}
.vocab-details summary::-webkit-details-marker { display: none; }
.vocab-details .expand-arrow { transition: transform .18s ease; font-size: 16px; }
.vocab-details[open] .expand-arrow { transform: rotate(180deg); }
.vocab-details-body { display: grid; gap: 8px; margin-top: 10px; }
.vocab-details-body small { color: var(--muted); font-weight: 900; }
.vocab-details-body .definition-list { display: grid; gap: 9px; }
.speak-line { display: inline-flex; align-items: center; gap: 6px; }
.speak-label { display: inline-flex; align-items: center; gap: 5px; }
.phonetic { color: #587283; font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.speaker-button {
  width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  color: var(--forest); background: var(--blue-soft); font-size: 13px; line-height: 1;
}
.speaker-button.small { width: 24px; height: 24px; font-size: 12px; }
.speaker-button.tiny { width: 21px; height: 21px; margin-left: 4px; font-size: 10px; background: #f6fbfd; }
.speaker-button.speaking {
  color: #fff;
  background: var(--blue);
  animation: speakingPulse 1s ease-in-out infinite;
}
.listen-button.speaking {
  color: #fff;
  background: var(--blue);
}
.review-memory-button { margin-top: 12px; }
.review-memory-box {
  width: 100%; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 14px; color: #244f63; background: var(--blue-faint); text-align: left; line-height: 1.6;
}
.review-memory-box p { margin: 0; }
@keyframes speakingPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(28, 150, 187, .35); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(28, 150, 187, 0); }
}
.stage { flex: 0 0 auto; padding: 5px 8px; border-radius: 9px; color: var(--forest); background: var(--blue-soft); font-size: 11px; }
.mini-tag { display: inline-block; margin-right: 5px; padding: 2px 6px; border-radius: 7px; color: var(--forest); background: var(--blue-soft); font-size: 11px; font-weight: 700; }
.pos-tag { display: inline-block; min-width: 25px; margin-right: 8px; color: #6c7d89; font-family: Georgia, "Times New Roman", serif; font-size: 13px; font-style: italic; font-weight: 700; }
.form-inline { display: block; margin-top: 5px; color: #587283; font-size: 12px; }
.vocab-example { margin-top: 10px; padding: 10px; border-radius: 12px; background: #eef7fb; }
.vocab-example small { color: var(--muted); }
.vocab-example p { margin-top: 6px; line-height: 1.5; }
.vocab-cn { color: #587283 !important; }
.dictionary-box { margin-top: 10px; padding: 11px; border-radius: 14px; background: var(--blue-faint); border: 1px solid var(--line); }
.dictionary-box small { color: var(--muted); font-weight: 800; }
.dictionary-box p { margin: 5px 0 9px; line-height: 1.5; }
.sense-list { display: grid; gap: 8px; margin: 7px 0 10px; }
.sense-item { padding: 9px 10px; border-radius: 14px; background: #ffffff; border: 1px solid #dbe8ee; }
.sense-cn { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.sense-cn span { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; color: var(--forest); background: var(--blue-soft); font-size: 11px; font-weight: 900; }
.sense-cn b { font-size: 14px; }
.sense-cn em { color: var(--muted); font-size: 11px; font-style: normal; }
.sense-item p { margin: 5px 0 0; font-size: 12px; }
.sense-note { color: #587283 !important; }
.english-definition-list .sense-cn { justify-content: space-between; }
.english-definition-list .sense-item p b { color: var(--ink); font-weight: 700; }
.sense-translation { color: #587283 !important; font-size: 12px !important; }
.chinese-definition-list .sense-item { background: #f6fbfd; }
.example-list { display: grid; gap: 8px; margin: 7px 0 10px; }
.dictionary-example { padding: 9px 10px; border-radius: 14px; background: #eef7fb; }
.dictionary-example p { margin: 0 0 5px; color: var(--ink); font-size: 12px; }
.dictionary-example em { color: #587283; font-size: 12px; font-style: normal; line-height: 1.45; }
.collocation-list { display: grid; gap: 6px; margin-top: 6px; }
.collocation-list span { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 14px; color: var(--forest); background: var(--blue-soft); font-size: 12px; }
.collocation-item b { flex: 1; font-weight: 800; }
.collocation-item em { color: #637481; font-style: normal; }
.dictionary-result { margin-top: 16px; }
.page[data-page="dictionary"] .panel label { display: block; margin-bottom: 12px; }
.page[data-page="dictionary"] #dictionaryInput { margin-bottom: 12px; }
.page[data-page="dictionary"] #dictionarySearchButton { margin-top: 2px; }
.dictionary-result[hidden] { display: none; }
.dictionary-result.empty { padding: 14px; border-radius: 16px; color: var(--muted); background: var(--blue-faint); }
.dictionary-result h3 { margin-bottom: 8px; font-size: 22px; }
.dictionary-result small { display: block; margin-top: 12px; color: var(--muted); font-weight: 800; }
.dictionary-result .definition-list { display: grid; gap: 9px; margin: 12px 0; }
.dictionary-result .definition-list p { margin: 0; line-height: 1.55; }
.dictionary-related { display: grid; gap: 6px; margin-top: 12px; padding: 10px; border-radius: 14px; background: var(--blue-faint); color: var(--muted); font-size: 13px; line-height: 1.5; }
.dictionary-related p { margin: 0; }
.vocab-dictionary-example { margin-top: 10px; }
.memory-box { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #f4fbfd; color: #31586b; font-size: 13px; line-height: 1.5; }
.memory-box p { margin: 0; }
.word-part-list { display: grid; gap: 6px; }
.word-part-list span { display: grid; grid-template-columns: minmax(70px, auto) 1fr; gap: 8px; align-items: start; padding: 7px 8px; border-radius: 11px; background: #e6f5fa; }
.word-part-list b { color: var(--forest); }
.word-part-list em { color: #587283; font-style: normal; }
.form-list { display: grid; gap: 6px; margin: 7px 0 10px; }
.form-list span { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 12px; background: var(--blue-faint); border: 1px solid var(--line); font-size: 12px; }
.form-list b { color: var(--forest); }
.form-list em { color: var(--muted); font-style: normal; text-align: right; }
.form-summary { margin-top: 5px !important; color: #587283 !important; font-size: 12px !important; line-height: 1.45; }

.bottom-nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(680px, 100%); height: calc(72px + var(--safe-bottom));
  display: grid; grid-template-columns: repeat(7, 1fr); align-items: start;
  padding: 8px 8px var(--safe-bottom); border-top: 1px solid #d3e4ebe6;
  background: #f9fdffed; backdrop-filter: blur(18px);
}
.bottom-nav button { border: 0; color: #758591; background: transparent; font-size: 10px; }
.bottom-nav span { display: grid; place-items: center; width: 31px; height: 31px; margin: 0 auto 2px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.bottom-nav button.active { color: var(--forest); font-weight: 800; }
.bottom-nav button.active span { color: white; background: linear-gradient(135deg, #12617d, #2f8fb3); }

dialog { width: min(430px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: 24px; color: var(--ink); background: var(--paper); box-shadow: 0 14px 50px #0a38523d; }
dialog::backdrop { background: #07192380; backdrop-filter: blur(4px); }
dialog p { color: var(--muted); line-height: 1.7; }
.dialog-options { display: grid; gap: 8px; margin: 14px 0; }
.dialog-options button {
  min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); background: var(--blue-faint); text-align: left; font-weight: 750;
}
.dialog-options button.selected { color: white; border-color: #1e86aa; background: linear-gradient(135deg, #1e86aa, #2aa8c6); }
.material-trash-dialog { width: min(560px, calc(100% - 24px)); max-height: min(78vh, 720px); overflow: auto; }
.material-trash-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.material-trash-heading h3 { margin: 4px 0 0; }
.material-trash-heading p { margin: 6px 0 12px; }
.material-trash-list { display: grid; gap: 10px; }
.material-trash-item { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--blue-faint); }
.material-trash-copy { display: grid; gap: 5px; min-width: 0; }
.material-trash-copy strong { overflow-wrap: anywhere; }
.material-trash-copy span { color: var(--muted); font-size: 12px; }
.material-trash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.material-trash-actions button { min-height: 42px; padding: 8px 12px; }
.trash-empty { padding: 36px 12px; color: var(--muted); text-align: center; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translate(-50%, 15px); width: max-content; max-width: calc(100% - 36px); padding: 11px 16px; border-radius: 12px; color: white; background: #102f40; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.selection-action {
  position: fixed; z-index: 60; left: 50%; bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%); min-height: 46px; padding: 10px 18px; border: 0;
  border-radius: 999px; color: white; background: #12617d; box-shadow: 0 8px 25px #12617d40;
}

@media (prefers-color-scheme: dark) {
  :root {
    --forest: #b9edf7;
    --mint: #102a36;
    --cream: #000000;
    --paper: #0f2029;
    --ink: #e8f6fb;
    --muted: #9db7c4;
    --line: #254555;
    --orange: #45b8da;
    --blue-soft: #173b4a;
    --blue-faint: #0d2632;
    --deep-blue: #e8f6fb;
    --shadow: #00000055;
  }

  html { background: #000000; }
  body {
    background:
      radial-gradient(circle at 92% -6%, #123949 0, transparent 32%),
      radial-gradient(circle at -10% 18%, #0c2634 0, transparent 32%),
      linear-gradient(180deg, #000000 0%, #05090c 100%);
  }

  .round-button,
  .metrics article,
  .panel,
  .action-card,
  .audio-player,
  .shadow-card,
  .score-card,
  .review-card,
  .dictation-panel,
  .sentence-card,
  .vocab-item,
  .material-item {
    border-color: var(--line);
    background: #102632e8;
    box-shadow: 0 12px 34px var(--shadow);
  }

  .hero {
    background:
      linear-gradient(145deg, #ffffff14 0%, transparent 48%),
      linear-gradient(135deg, #082331 0%, #0b3d52 52%, #12617d 100%);
    box-shadow: 0 18px 42px #0000004d;
  }
  .hero p { color: #bfe6f2; }
  .hero .primary { color: #073040; background: #d8f4fb; }

  .round-button { background: #123240d9; }
  .eyebrow { color: #80c6dc; }
  .metrics strong { color: #77d5ec; }

  textarea,
  .search,
  .text-input,
  .review-input {
    color: var(--ink);
    background: #0b202b;
    border-color: var(--line);
  }
  textarea::placeholder,
  input::placeholder { color: #7894a2; }

  .chip,
  .loop-button,
  .segmented button.selected,
  .review-actions button,
  .choice-grid button,
  .sentence-recording-actions button,
  .sense-item,
  .dictation-sentence {
    color: var(--ink);
    background: #102c39;
    border-color: var(--line);
  }

  .chip.selected,
  .primary,
  .review-start-row button.active,
  [data-page="review"][data-review-mode="dictation"] #openDictation,
  .dialog-options button.selected {
    color: #ffffff;
    background: linear-gradient(135deg, #1e86aa, #35b8d8);
  }

  .secondary,
  .pill,
  .action-icon,
  .translation-label,
  .phrase-button,
  .sync-card,
  .dictation-summary,
  .example,
  .stage,
  .mini-tag,
  .speaker-button,
  .collocation-list span {
    color: var(--forest);
    background: var(--blue-soft);
  }

  .notice,
  .sentence-recording,
  .dictionary-box,
  .dictionary-result.empty,
  .dictionary-related,
  .memory-box,
  .dictionary-example,
  .vocab-example {
    background: var(--blue-faint);
    color: var(--muted);
  }

  .word-part-list span,
  .chinese-definition-list .sense-item,
  .form-list span {
    background: #133747;
  }

  .db-status.ok { border-color: #276147; background: #102f25; }
  .db-status.bad { border-color: #724033; background: #351d18; }
  .dictation-sentence.correct { background: #0f2f27; }
  .dictation-error { color: #ff9bab; background: #4a1722; }
  .choice-grid button.correct, .review-feedback.correct { color: #9ce8f6; border-color: #256b7e; background: #123847; }
  .choice-grid button.wrong, .review-feedback.wrong { color: #ffadc6; border-color: #77425a; background: #3b1d2a; }
  .play-button { background: #1e86aa; box-shadow: 0 9px 20px #00000045; }
  .progress,
  .progress-slider::-webkit-slider-runnable-track { background: #203d4d; }

  .bottom-nav {
    border-top-color: #254555e6;
    background: #0b202bed;
  }
  .bottom-nav button { color: #8ba5b1; }

  dialog {
    color: var(--ink);
    background: #102632;
  }
  dialog::backdrop { background: #02090dcc; }
  .dialog-options button {
    color: var(--ink);
    background: #0b202b;
    border-color: var(--line);
  }
  .toast,
  .selection-action {
    color: #ffffff;
    background: #1e86aa;
  }
}

html.dark-theme {
  color-scheme: dark;
  --forest: #b9edf7;
  --mint: #102a36;
  --cream: #000000;
  --paper: #0f2029;
  --ink: #e8f6fb;
  --muted: #9db7c4;
  --line: #254555;
  --orange: #45b8da;
  --blue-soft: #173b4a;
  --blue-faint: #0d2632;
  --deep-blue: #e8f6fb;
  --shadow: #00000066;
  background: #000000;
}

html.dark-theme body {
  background:
    radial-gradient(circle at 92% -6%, #123949 0, transparent 32%),
    radial-gradient(circle at -10% 18%, #0c2634 0, transparent 32%),
    linear-gradient(180deg, #000000 0%, #05090c 100%);
}

html.dark-theme .round-button,
html.dark-theme .metrics article,
html.dark-theme .panel,
html.dark-theme .action-card,
html.dark-theme .audio-player,
html.dark-theme .shadow-card,
html.dark-theme .score-card,
html.dark-theme .review-card,
html.dark-theme .dictation-panel,
html.dark-theme .sentence-card,
html.dark-theme .vocab-item,
html.dark-theme .material-item {
  border-color: var(--line);
  background: #102632e8;
  box-shadow: 0 12px 34px var(--shadow);
}

html.dark-theme .hero {
  background:
    linear-gradient(145deg, #ffffff14 0%, transparent 48%),
    linear-gradient(135deg, #061923 0%, #0b3d52 52%, #12617d 100%);
  box-shadow: 0 18px 42px #00000066;
}
html.dark-theme .hero p { color: #bfe6f2; }
html.dark-theme .hero .primary { color: #073040; background: #d8f4fb; }
html.dark-theme .round-button { background: #123240d9; }
html.dark-theme .eyebrow { color: #80c6dc; }
html.dark-theme .metrics strong { color: #77d5ec; }

html.dark-theme textarea,
html.dark-theme .search,
html.dark-theme .text-input,
html.dark-theme .review-input {
  color: var(--ink);
  background: #0b202b;
  border-color: var(--line);
}
html.dark-theme textarea::placeholder,
html.dark-theme input::placeholder { color: #7894a2; }

html.dark-theme .chip,
html.dark-theme .loop-button,
html.dark-theme .segmented button.selected,
html.dark-theme .review-actions button,
html.dark-theme .choice-grid button,
html.dark-theme .sentence-recording-actions button,
html.dark-theme .sense-item,
html.dark-theme .dictation-sentence {
  color: var(--ink);
  background: #102c39;
  border-color: var(--line);
}

html.dark-theme .chip.selected,
html.dark-theme .primary,
html.dark-theme .review-start-row button.active,
html.dark-theme [data-page="review"][data-review-mode="dictation"] #openDictation,
html.dark-theme .dialog-options button.selected {
  color: #ffffff;
  background: linear-gradient(135deg, #1e86aa, #35b8d8);
}

html.dark-theme .secondary,
html.dark-theme .pill,
html.dark-theme .action-icon,
html.dark-theme .translation-label,
html.dark-theme .phrase-button,
html.dark-theme .sync-card,
html.dark-theme .dictation-summary,
html.dark-theme .example,
html.dark-theme .stage,
html.dark-theme .mini-tag,
html.dark-theme .speaker-button,
html.dark-theme .collocation-list span {
  color: var(--forest);
  background: var(--blue-soft);
}

html.dark-theme .notice,
html.dark-theme .sentence-recording,
html.dark-theme .dictionary-box,
html.dark-theme .dictionary-result.empty,
html.dark-theme .dictionary-related,
html.dark-theme .memory-box,
html.dark-theme .review-memory-box,
html.dark-theme .dictionary-example,
html.dark-theme .vocab-example {
  background: var(--blue-faint);
  color: var(--muted);
}

html.dark-theme .word-part-list span,
html.dark-theme .chinese-definition-list .sense-item,
html.dark-theme .form-list span {
  background: #133747;
}

html.dark-theme .db-status.ok { border-color: #276147; background: #102f25; }
html.dark-theme .db-status.bad { border-color: #724033; background: #351d18; }
html.dark-theme .dictation-sentence.correct { background: #0f2f27; }
html.dark-theme .dictation-error { color: #ff9bab; background: #4a1722; }
html.dark-theme .choice-grid button.correct,
html.dark-theme .review-feedback.correct { color: #9ce8f6; border-color: #256b7e; background: #123847; }
html.dark-theme .choice-grid button.wrong,
html.dark-theme .review-feedback.wrong { color: #ffadc6; border-color: #77425a; background: #3b1d2a; }
html.dark-theme .play-button { background: #1e86aa; box-shadow: 0 9px 20px #00000045; }
html.dark-theme .progress,
html.dark-theme .progress-slider::-webkit-slider-runnable-track { background: #203d4d; }

html.dark-theme .bottom-nav {
  border-top-color: #254555e6;
  background: #0b202bed;
}
html.dark-theme .bottom-nav button { color: #8ba5b1; }

html.dark-theme dialog {
  color: var(--ink);
  background: #102632;
}
html.dark-theme dialog::backdrop { background: #02090dcc; }
html.dark-theme .dialog-options button {
  color: var(--ink);
  background: #0b202b;
  border-color: var(--line);
}
html.dark-theme .toast,
html.dark-theme .selection-action {
  color: #ffffff;
  background: #1e86aa;
}

@media (min-width: 681px) {
  html.dark-theme .app-shell {
    background: rgba(4, 12, 17, .94);
    box-shadow: 0 22px 80px #00000080;
  }
}

@media (min-width: 681px) {
  body { padding-block: 20px; }
  .app-shell { min-height: calc(100vh - 40px); overflow: hidden; border-radius: 30px; background: rgba(238,245,248,.92); box-shadow: 0 22px 80px #0a385226; }
  .bottom-nav { bottom: 20px; border-radius: 0 0 30px 30px; }
}
