/* Base */
:root {
  --ink: #26362f;
  --muted: #66736d;
  --green: #345f4d;
  --green-dark: #284c3c;
  --green-pale: #f1f6f3;
  --line: #dfe5e1;
  --surface: #f7f9f8;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font: 14px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid #9db8a8;
  outline-offset: 2px;
}
button:disabled:focus-visible { outline: none; }
/* 键盘可达性保留，视觉反馈轻柔：导航和文字按钮点击不再出现粗框 */
.main-nav a:focus-visible { outline: none; }
.main-nav a:focus-visible:not(.active)::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: #c3d6ca; }
.text-button:focus-visible, .sound-button:focus-visible, #cloud-entry:focus-visible { outline: none; box-shadow: 0 0 0 2px #dce9e1; border-radius: 6px; }
/* 轻柔的按压反馈 */
button, summary, .main-nav a { transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.main-nav a:active { background: #f2f6f3; border-radius: 6px 6px 0 0; }
.text-button:active:not(:disabled) { background: #eef2ef; border-radius: 6px; }
.secondary-button:active:not(:disabled), .primary-button:active:not(:disabled) { filter: brightness(.97); }
.course-option:active { background: var(--green-pale); }
svg.icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex: none;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 26px; line-height: 1.5; font-weight: 650; }
h1 em { font-style: normal; }
h2 { font-size: 20px; line-height: 1.6; }

/* Page header and navigation */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 884px;
  min-height: 88px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #d1ded6;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-pale);
  font-size: 25px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
}
.brand strong { display: block; font-size: 19px; font-weight: 650; line-height: 1.4; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions button, .sound-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px 2px;
  font-size: 13px;
  color: var(--muted);
  border-radius: 6px;
}
.header-actions button:hover { color: var(--green); }
.main-nav {
  max-width: 884px;
  width: 100%;
  display: flex;
  gap: 30px;
  margin: 0 auto;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}
.main-nav a {
  position: relative;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 1px;
  color: var(--muted);
  white-space: nowrap;
}
.main-nav a:hover { color: var(--green); }
.main-nav a.active { color: var(--green); font-weight: 600; }
.main-nav a.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--green);
}
.main-nav .icon { width: 17px; height: 17px; }
.nav-dot { display: none; }
main#main-content {
  width: 100%;
  max-width: 884px;
  margin: 0 auto;
  padding: 34px 32px 0;
  flex: 1;
}
.page-intro { display: block; margin-bottom: 24px; }
.intro-sub { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.session-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 15px; color: var(--muted); font-size: 13px; }
.session-meta a { display: inline-flex; align-items: center; gap: 5px; color: var(--green); }
.session-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.session-meta .icon { width: 15px; height: 15px; }
.page-footer {
  max-width: 884px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.page-footer .icon { width: 15px; height: 15px; margin-right: 5px; }

/* Selected lesson scope */
.study-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.study-context label, .study-context strong { font-size: 13px; font-weight: 600; }
.study-context p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.study-context button { flex: none; }
.scope-settings-form { margin-top: 18px; }
.form-field { display: block; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.form-field > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-field > input, .form-field > textarea, .form-field > select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bccbc2;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
  font-weight: 400;
  margin-top: 6px;
}
.form-field > textarea { min-height: 82px; resize: vertical; }
.form-field > input:focus, .form-field > textarea:focus { border-color: var(--green); }
.scope-character-list, .scope-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.scope-character-list label, .scope-grid label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 22px;
  cursor: pointer;
}
.scope-character-list label:has(input:checked), .scope-grid label:has(input:checked) { background: var(--green-pale); border-color: #93ad9d; color: var(--green-dark); }
.scope-character-list input, .scope-grid input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); }
.scope-note { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 10px 0; }
.form-error { margin: 12px 0; color: #9a4034; font-size: 13px; line-height: 1.7; }

/* Main lesson panel */
.learning-layout { display: block; }
.lesson-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.panel-label .icon { color: var(--green); width: 18px; height: 18px; }
.lesson-count { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.steps { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 0 24px; margin: 25px auto 0; }
.step { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.step-number { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #cbd5ce; border-radius: 50%; font-size: 13px; }
.step.active { color: var(--green); font-weight: 600; }
.step.active .step-number { color: #fff; background: var(--green); border-color: var(--green); }
.step.done { color: var(--green); }
.step.done .step-number { background: var(--green-pale); border-color: #aac0b2; }
.step-number .icon { width: 14px; height: 14px; }
.step-connector, .connector { height: 1px; width: 44px; flex: 0 1 44px; background: var(--line); }
.exercise { padding: 28px 36px 30px; text-align: center; min-height: 440px; }
.exercise h2 { font-size: 20px; font-weight: 600; margin: 8px 0; }
.exercise-desc { margin: 0 0 21px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.lesson-kicker { color: var(--muted); font-size: 13px; }
.character-wrap { position: relative; display: inline-block; margin: 18px auto 15px; }
.character-grid {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 154px;
  height: 154px;
  border: 1px solid #cedbd2;
  border-radius: 4px;
  background: #fafcfb;
  color: #274d3c;
  font: 500 110px/1 "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
}
.character-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent calc(50% - .5px), #dfe7e1 calc(50% - .5px), #dfe7e1 calc(50% + .5px), transparent calc(50% + .5px)), linear-gradient(0deg, transparent calc(50% - .5px), #dfe7e1 calc(50% - .5px), #dfe7e1 calc(50% + .5px), transparent calc(50% + .5px));
  pointer-events: none;
}
.character-grid span { position: relative; z-index: 1; }
.favorite-char { position: absolute; top: 0; right: -44px; min-width: 36px; min-height: 36px; color: #798980; padding: 6px; }
.favorite-char.saved, .collection-heart.saved { color: var(--green); }
.favorite-char.saved .icon, .collection-heart.saved .icon { fill: #e0ece4; }
.pinyin-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 480px; margin: 0 auto; }
.pinyin-option { position: relative; display: flex; align-items: center; min-height: 62px; padding: 12px 16px; border: 1px solid #cfd9d2; border-radius: 6px; background: #fff; text-align: left; }
.pinyin-option:hover { border-color: #799b88; background: #f7faf8; }
.pinyin-option:disabled { cursor: default; }
.option-letter { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 12px; flex: none; }
.pinyin { position: absolute; left: 50%; transform: translateX(-50%); font-size: 26px; line-height: 1.4; color: var(--ink); pointer-events: none; }
.pinyin-option.selected { border: 2px solid var(--green); padding: 11px 15px; background: var(--green-pale); }
.pinyin-option.selected .option-letter { background: var(--green); color: #fff; }
.pinyin-option.correct { border-color: #5f8a71; background: #edf6f0; }
.pinyin-option.incorrect { border-color: #c5897a; background: #fff8f5; }
.option-check { margin-left: auto; color: var(--green); }
.option-check .icon { width: 18px; height: 18px; }
.feedback { display: flex; align-items: flex-start; gap: 8px; max-width: 480px; margin: 16px auto 0; padding: 12px 14px; border-radius: 5px; text-align: left; font-size: 14px; line-height: 1.8; }
.feedback.success { background: #edf6f0; color: #355e46; }
.feedback.error { background: #fff4ef; color: #8d4a38; }
.feedback .icon { width: 18px; height: 18px; margin-top: 3px; }
.lesson-bottom { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 24px; border-top: 1px solid var(--line); background: #fafbfa; }
.quiet-note { display: flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1.8; color: var(--muted); }
.quiet-note .icon { width: 17px; height: 17px; }

/* Common controls */
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border: 1px solid var(--green); border-radius: 5px; font-size: 14px; line-height: 1.6; white-space: nowrap; min-height: 44px; }
.primary-button { color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); border-color: var(--green-dark); }
.primary-button:disabled { color: #fff; background: #8c9e93; border-color: #8c9e93; }
.secondary-button { color: var(--green); background: #fff; border-color: #bfcec4; }
.secondary-button:hover { background: var(--green-pale); }
.primary-button .icon, .secondary-button .icon { width: 17px; height: 17px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 4px 6px; margin: -4px -6px; color: var(--green); font-size: 13px; line-height: 1.7; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button .icon { width: 16px; height: 16px; }

/* Word and sentence practice */
.compact-character { display: flex; align-items: center; gap: 16px; text-align: left; padding: 12px 16px; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.compact-character .small-char { color: var(--green); font: 500 46px/1.2 "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif; }
.compact-character strong { font-size: 16px; font-weight: 500; }
.compact-character p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.word-fields { display: flex; flex-direction: column; gap: 12px; max-width: 480px; margin: 20px auto 12px; text-align: left; }
.word-field { display: flex; align-items: center; gap: 12px; padding: 0 15px; border: 1px solid #cbd7cf; border-radius: 5px; background: #fff; }
.word-field:focus-within { border-color: var(--green); outline: 2px solid #dce9e1; outline-offset: 1px; }
.word-field > span, .word-field > label { color: var(--muted); font-size: 13px; flex: none; }
.word-field input { width: 100%; min-width: 0; padding: 13px 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 17px; }
.word-field input:focus-visible { outline: none; }
.word-field input::placeholder { color: #7c8981; font-size: 14px; }
.word-counter { font-size: 13px; color: var(--muted); }
.helper-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; max-width: 480px; margin: 0 auto; }
.word-hint { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.word-select { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 18px 0; }
.word-chip { padding: 9px 18px; border: 1px solid #cbd8cf; border-radius: 5px; background: #fff; color: var(--green); font-size: 16px; min-height: 44px; }
.word-chip.active { border: 2px solid var(--green); padding: 8px 17px; background: var(--green-pale); }
.sentence-input { display: block; width: 100%; min-height: 146px; resize: vertical; padding: 14px 16px; border: 1px solid #cbd7cf; border-radius: 5px; background: #fff; color: var(--ink); font-size: 17px; line-height: 1.9; }
.sentence-input:focus { border-color: var(--green); }
.sentence-input::placeholder { color: #7c8981; font-size: 14px; }
.sentence-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.sentence-tips { padding: 13px 15px; margin: 16px 0; border-radius: 5px; background: var(--surface); text-align: left; color: var(--muted); font-size: 13px; line-height: 1.9; }
.sentence-tips strong { font-weight: 500; color: #4c6054; }
.sentence-tip-list { display: flex; flex-wrap: wrap; gap: 3px 16px; margin-top: 5px; }
.recording { color: #9b4436 !important; }
.self-check { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; text-align: left; color: var(--muted); font-size: 14px; line-height: 1.8; }
.self-check input { width: 17px; height: 17px; margin: 4px 0 0; flex: none; accent-color: var(--green); }
.complete-state { padding: 16px 0 4px; text-align: center; }
.complete-state h2 { margin: 10px 0; font-size: 22px; }
.complete-state > p { margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.complete-summary { padding: 20px; margin: 24px 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: left; }
.summary-top { display: flex; align-items: center; gap: 20px; }
.summary-char { color: var(--green); font: 500 56px/1.3 "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif; }
.complete-summary strong { font-size: 17px; font-weight: 500; }
.summary-words { margin-top: 5px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.summary-sentence { padding-top: 14px; margin: 15px 0 0; border-top: 1px solid var(--line); color: var(--ink); font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; }

/* Character collection */
.collection-tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 20px; }
.search-input { flex: 1; min-width: 180px; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd7cf; border-radius: 5px; background: #fff; color: var(--ink); font-size: 14px; }
.search-input::placeholder { color: #748078; }
.filter-button { min-height: 42px; padding: 8px 12px; border: 1px solid #d3ded6; border-radius: 5px; color: var(--muted); background: #fff; font-size: 13px; }
.filter-button.active { color: var(--green); background: var(--green-pale); border-color: #91ad9b; }
.character-collection { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.character-card { position: relative; padding: 20px 10px 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-align: center; }
.collection-char { color: var(--green-dark); font: 500 52px/1.4 "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif; }
.collection-pinyin { color: var(--muted); font-size: 16px; margin-top: 5px; }
.collection-status { display: inline-block; margin: 9px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.collection-status.mastered { color: var(--green); }
.collection-heart { position: absolute; right: 5px; top: 5px; min-width: 32px; min-height: 32px; padding: 6px; color: #7c8b81; }
.collection-heart .icon { width: 17px; height: 17px; }
.card-study-button { display: block; width: calc(100% + 20px); margin-left: -10px; padding: 11px 5px; border-top: 1px solid var(--line); color: var(--green); font-size: 12px; min-height: 42px; }
.card-study-button:hover { background: var(--green-pale); }
.empty-state { padding: 50px 24px; text-align: center; border: 1px solid var(--line); border-radius: 6px; }
.empty-state > .icon { width: 38px; height: 38px; color: #789483; }
.empty-state h2 { margin: 16px 0 8px; font-size: 20px; font-weight: 600; }
.empty-state p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* Practice records */
.record-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.record-stat { padding: 19px 20px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.record-stat > span { color: var(--muted); font-size: 13px; }
.record-stat strong { display: block; margin-top: 7px; color: var(--green); font-size: 28px; font-weight: 600; }
.record-stat small { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.history-list { display: flex; flex-direction: column; gap: 14px; }
.history-item { display: flex; align-items: flex-start; gap: 20px; padding: 21px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.history-char { width: 46px; flex: none; color: var(--green); font: 500 42px/1.3 "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif; }
.history-content { flex: 1; min-width: 0; }
.history-content strong { font-size: 14px; font-weight: 500; }
.history-content p { margin: 10px 0 2px; color: var(--ink); font-size: 15px; line-height: 1.9; overflow-wrap: anywhere; }
.history-words { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.history-words span { padding: 2px 7px; border-radius: 3px; background: var(--surface); color: var(--muted); font-size: 13px; }
.history-date { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.below-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.below-card > div, .below-card a { display: flex; align-items: center; gap: 7px; }
.below-card .icon { width: 17px; height: 17px; }
.storage-notice { padding: 11px 14px; margin-bottom: 18px; border: 1px solid #e7d1aa; border-radius: 5px; background: #fffaf1; color: #84632e; font-size: 13px; }

/* Dialogs and status */
dialog { position: fixed; width: calc(100% - 32px); max-width: 520px; max-height: calc(100dvh - 48px); overflow: auto; padding: 28px; border: 1px solid #cbd7cf; border-radius: 8px; color: var(--ink); background: #fff; box-shadow: 0 16px 64px #1d332333; }
dialog::backdrop { background: #22352a66; }
.dialog-close { position: absolute; top: 9px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--muted); font-size: 26px; line-height: 1; }
.dialog-close:hover { color: var(--green); background: var(--surface); border-radius: 4px; }
dialog h2 { margin: 0 28px 14px 0; font-size: 21px; font-weight: 600; }
dialog p, dialog li { color: var(--muted); font-size: 14px; line-height: 1.9; }
dialog ol { padding-left: 21px; }
.dialog-content-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 0 17px; border: 1px solid #dae6de; border-radius: 5px; color: var(--green); background: var(--green-pale); }
.dialog-content-icon .icon { width: 23px; height: 23px; }
.dialog-note { padding: 13px 15px; margin: 17px 0; border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.9; }
.dialog-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.dialog-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.toast { position: fixed; z-index: 100; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); width: max-content; padding: 12px 18px; border-radius: 6px; background: #345442; color: #fff; font-size: 14px; line-height: 1.8; text-align: center; opacity: 0; visibility: hidden; }
.toast.show { opacity: 1; visibility: visible; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Narrow screens */
@media (max-width: 640px) {
  .header-inner { min-height: 80px; padding: 16px 20px; gap: 12px; }
  .brand { gap: 9px; }
  .brand-mark { width: 37px; height: 37px; font-size: 23px; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 11px; }
  .header-actions { gap: 12px; }
  .header-actions button { font-size: 12px; }
  .header-actions .icon { width: 16px; height: 16px; }
  .main-nav { gap: 0; justify-content: space-between; padding: 0 20px; }
  .main-nav a { font-size: 13px; gap: 5px; min-height: 52px; }
  .main-nav a .icon { display: none; }
  main#main-content { padding: 25px 20px 0; }
  .page-intro { display: block; margin-bottom: 20px; }
  h1 { font-size: 24px; }
  .intro-sub { font-size: 14px; }
  .session-meta { margin-top: 9px; padding-top: 0; font-size: 12px; }
  .study-context { align-items: flex-start; padding: 13px 14px; gap: 10px; }
  .study-context p { font-size: 12px; }
  .study-context .text-button { font-size: 12px; }
  .panel-top { padding: 14px 18px; }
  .panel-label { gap: 6px; }
  .lesson-count { font-size: 11px; }
  .steps { gap: 9px; padding: 0 16px; margin-top: 23px; }
  .step { gap: 6px; font-size: 13px; }
  .step-number { width: 23px; height: 23px; font-size: 12px; }
  .step-connector, .connector { width: 24px; flex-basis: 24px; }
  .exercise { padding: 25px 20px; min-height: 430px; }
  .exercise h2 { font-size: 20px; }
  .exercise-desc { font-size: 14px; }
  .character-grid { width: 148px; height: 148px; font-size: 110px; }
  .pinyin-options { gap: 10px; }
  .pinyin-option { padding: 12px; min-height: 60px; }
  .pinyin-option.selected { padding: 11px; }
  .pinyin { font-size: 25px; }
  .option-letter { width: 21px; height: 21px; font-size: 11px; }
  .lesson-bottom { padding: 16px 18px; flex-wrap: wrap; gap: 12px; }
  .quiet-note { font-size: 12px; }
  .lesson-bottom .primary-button { margin-left: auto; }
  .primary-button, .secondary-button { padding: 10px 14px; font-size: 14px; }
  .compact-character { padding: 12px; gap: 12px; }
  .compact-character .small-char { font-size: 40px; }
  .compact-character strong { font-size: 15px; }
  .compact-character p { font-size: 12px; }
  .sentence-tip-list { display: block; }
  .sentence-tip-list span { display: block; margin-top: 3px; }
  .collection-tools { gap: 8px; }
  .search-input { flex-basis: 100%; }
  .filter-button { flex: 1; padding: 8px; font-size: 12px; }
  .character-collection { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .character-card { padding-top: 23px; }
  .collection-char { font-size: 46px; }
  .collection-pinyin { font-size: 15px; }
  .collection-status { font-size: 10px; }
  .card-study-button { font-size: 11px; }
  .record-stats { gap: 9px; }
  .record-stat { padding: 14px 10px; }
  .record-stat > span { font-size: 11px; }
  .record-stat strong { font-size: 25px; }
  .history-item { padding: 17px 15px; gap: 13px; flex-wrap: wrap; }
  .history-char { width: 35px; font-size: 36px; }
  .history-content { min-width: calc(100% - 60px); }
  .history-content p { font-size: 14px; }
  .history-date { margin-left: 48px; margin-top: -8px; font-size: 11px; }
  .below-card { align-items: flex-start; flex-direction: column; gap: 5px; }
  .page-footer { padding: 24px 20px; font-size: 11px; }
  dialog { padding: 25px 22px; }
  dialog h2 { font-size: 20px; }
  .dialog-buttons { gap: 9px; }
  .scope-character-list, .scope-grid { grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .scope-character-list label, .scope-grid label { min-height: 43px; font-size: 20px; gap: 4px; }
}

@media (max-width: 380px) {
  .header-inner { padding-left: 16px; padding-right: 16px; }
  .header-actions { gap: 9px; }
  .header-actions .icon { display: none; }
  .header-actions button { font-size: 11px; }
  .main-nav { padding-left: 16px; padding-right: 16px; }
  main#main-content { padding-left: 14px; padding-right: 14px; }
  .panel-top { padding-left: 15px; padding-right: 15px; }
  .exercise { padding-left: 16px; padding-right: 16px; }
  .step { font-size: 12px; gap: 5px; }
  .steps { gap: 7px; }
  .step-connector, .connector { flex-basis: 16px; }
  .pinyin { font-size: 24px; }
  .favorite-char { right: -39px; }
  .scope-character-list, .scope-grid { grid-template-columns: repeat(4, 1fr); }
}

/* One-time textbook confirmation */
.course-chooser { border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.course-chooser h2 { margin: 0 0 12px; font-size: 20px; }
.course-chooser > p { color: var(--muted); line-height: 1.9; }
.course-options { display: grid; gap: 12px; margin: 24px 0; }
.course-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 16px 20px; border: 1px solid #cbd7cf; border-radius: 6px; text-align: left; }
.course-option:hover { background: var(--green-pale); border-color: var(--green); }
.course-option strong { font-size: 18px; font-weight: 600; }
.course-option span { color: var(--muted); font-size: 12px; margin-left: auto; }
.course-option .icon { color: var(--green); }
@media(max-width:640px) { .course-chooser { padding: 22px 18px; } .course-option { flex-wrap: wrap; gap: 7px; padding: 14px; } .course-option strong { font-size: 17px; } .course-option span { width: 100%; order: 3; margin-left: 0; } .course-option .icon { margin-left: auto; } }

.course-option { flex-wrap: wrap; }
.course-characters { flex-basis: 100%; color: var(--muted); font-size: 13px; line-height: 1.8; }
.course-unit .course-option > * { max-width: 100%; }
.course-unit .course-option .course-characters { flex-basis: auto; width: 100%; overflow-wrap: anywhere; }

/* Tap-to-build word practice */
.tap-progress {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.formed-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  margin: 12px 0 20px;
}
.formed-word {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid #c9dacd;
  border-radius: 5px;
  background: var(--green-pale);
  color: var(--green);
  font-size: 15px;
}
.formed-word .icon { width: 15px; height: 15px; }
.puzzle-clue {
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}
.word-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 18px 0 22px;
}
.char-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px;
  height: 58px;
  padding: 0;
  border: 1px solid #aec6b6;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font-size: 30px;
  line-height: 1;
}
button.char-slot:hover { border-color: var(--green); background: #f7faf8; }
.char-slot.fixed {
  border-color: #a8c0b1;
  background: #eaf2ed;
  color: var(--green-dark);
  font-weight: 500;
  cursor: default;
}
.char-slot.empty {
  border: 1px dashed #b9c8be;
  background: #fafcfb;
  color: #8b9b90;
}
.card-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 16px auto;
}
.letter-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 54px;
  padding: 0;
  border: 1px solid #becfc3;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}
.letter-tile:hover:not(:disabled) { border-color: var(--green); background: var(--green-pale); }
.letter-tile.tile-used, .letter-tile:disabled {
  border-color: #e1e6e2;
  background: #f3f5f3;
  color: #a8b1aa;
  cursor: default;
}
.puzzle-tools {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 12px 0 0;
}
.success-word {
  margin: 16px auto 0;
  color: var(--green);
  font-size: 16px;
  line-height: 1.9;
}

/* Tap-to-build sentences and oral practice */
.sentence-mode-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
}
.sentence-mode-tabs button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #cfdbd2;
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.sentence-mode-tabs button.active {
  border-color: var(--green);
  background: var(--green-pale);
  color: var(--green);
  font-weight: 500;
}
.sentence-builder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 88px;
  padding: 14px;
  margin: 16px 0;
  border: 1px dashed #a8bcb0;
  border-radius: 6px;
  background: #fafcfb;
  text-align: left;
}
.sentence-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid #bfcec4;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
button.sentence-token:hover:not(:disabled) { background: var(--green-pale); border-color: var(--green); }
.sentence-builder .sentence-token { border-color: #b8cfc0; background: #edf4ef; color: var(--green-dark); }
.sentence-token.tile-used, .sentence-token:disabled {
  border-color: #e1e6e2;
  background: #f3f5f3;
  color: #a8b1aa;
  cursor: default;
}
.sentence-placeholder { margin: 0; color: #77877b; font-size: 14px; line-height: 1.9; }
.sentence-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin: 20px 0 14px;
}
.oral-guide {
  padding: 18px;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.9;
}
.oral-guide strong { color: var(--green); font-size: 18px; font-weight: 600; }
.oral-guide p { margin: 8px 0; }
.oral-guide ol { margin: 10px 0 0; padding-left: 24px; font-size: 15px; }
.oral-guide li + li { margin-top: 5px; }
.adult-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}
.adult-check input { width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--green); flex: none; }

@media (max-width: 640px) {
  .sentence-builder { padding: 12px; gap: 7px; }
  .sentence-token { font-size: 16px; padding: 9px 11px; }
  .sentence-bank { gap: 8px; }
  .oral-guide { padding: 15px; font-size: 15px; }
  .oral-guide strong { font-size: 17px; }
}

@media (max-width: 380px) {
  .word-slots { gap: 7px; }
  .char-slot { width: clamp(34px, 10vw, 42px); height: 54px; font-size: 28px; }
  .sentence-mode-tabs button { padding-left: 12px; padding-right: 12px; }
  .sentence-builder { padding: 10px; }
}

/* Short practice sessions and recall */
.practice-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 15px 18px;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.practice-plan strong { color: var(--ink); font-weight: 600; }
.practice-plan p { margin: 3px 0 0; }
.practice-plan button { min-height: 40px; }
.plan-chars {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.plan-chars > span, .plan-chars > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 35px;
  min-height: 35px;
  padding: 3px 8px;
  border: 1px solid #d5dfd7;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}
.plan-chars > .active, .plan-chars > [aria-current="step"] {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-pale);
  font-weight: 600;
}
.plan-chars > .done { background: #f0f4f1; color: #536c5d; border-color: #cad7ce; }
.practice-mode-label {
  display: inline-block;
  padding: 3px 8px;
  margin-left: 6px;
  border: 1px solid #d5dfd7;
  border-radius: 4px;
  background: #f7faf8;
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: middle;
}
.recall-panel {
  max-width: 480px;
  margin: 18px auto 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
  font-size: 15px;
  line-height: 1.9;
}
.recall-panel p { margin: 0 0 15px; color: var(--muted); }
.recall-panel > button { margin: 4px; }
.recall-panel .dialog-buttons { justify-content: center; margin-top: 12px; }
.review-summary {
  max-width: 520px;
  padding: 18px 20px;
  margin: 20px auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
.review-summary strong { color: var(--green); font-weight: 600; }
.review-summary p { margin: 6px 0; }
.session-finished {
  padding: 32px 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  background: #fff;
}
.session-finished h2 { margin: 0 0 12px; font-size: 22px; font-weight: 600; }
.session-finished p { margin: 10px auto; max-width: 490px; color: var(--muted); font-size: 15px; line-height: 1.9; }
.session-finished .plan-chars { justify-content: center; margin: 18px 0; }
.session-finished button { margin: 12px 4px 0; }

/* Short original reading passages */
.reading-heading { margin: 0 0 9px; font-size: 23px; line-height: 1.6; font-weight: 600; }
.reading-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.reading-source { padding: 10px 13px; margin: 12px 0 20px; border-left: 2px solid #b8ccbf; background: #f7faf8; color: var(--muted); font-size: 13px; line-height: 1.85; }
.reading-text {
  margin: 22px 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 400;
  line-height: 2.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}
.reading-target {
  display: inline;
  padding: 2px 1px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #a9c0b1;
  border-radius: 2px;
  background: #f1f6f3;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  vertical-align: baseline;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.reading-target:hover { background: #e6f0e9; border-bottom-color: var(--green); }
.reading-target:focus-visible { outline: 2px solid #719381; outline-offset: 2px; }
.reading-controls { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px 18px; margin: 18px 0 24px; }
.reading-question { margin: 24px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 18px; font-weight: 600; line-height: 1.8; }
.reading-options { display: flex; flex-direction: column; gap: 11px; margin: 14px 0; }
.reading-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 13px 16px;
  border: 1px solid #ccd9d0;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 16px;
  line-height: 1.75;
}
.reading-option:hover:not(:disabled) { border-color: #819f8c; background: #f7faf8; }
.reading-option.selected { border-color: var(--green); background: var(--green-pale); }
.reading-option.correct { border-color: #6b947a; background: #edf6f0; color: #315f42; }
.reading-option.incorrect { border-color: #c39182; background: #fff6f1; color: #8d4a38; }
.reading-option:disabled { cursor: default; }
.reading-explanation { padding: 14px 16px; margin: 16px 0; border-radius: 5px; background: var(--surface); color: #4d6556; font-size: 15px; line-height: 1.9; }
.reading-explanation p { margin: 3px 0; }
.reading-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.reading-links a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

/* Review dates in the parent record view */
.review-list { margin: 18px 0 24px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 16px;
  padding: 13px 16px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.review-row + .review-row { border-top: 1px solid var(--line); }
.review-row strong { color: var(--ink); font-size: 17px; font-weight: 500; }
.review-row time { color: #536d5d; font-variant-numeric: tabular-nums; }
.review-row .text-button { margin-left: auto; }

@media (max-width: 640px) {
  .main-nav a { flex: 1; font-size: 12px; padding-left: 2px; padding-right: 2px; }
  .practice-plan { padding: 13px 14px; gap: 10px 12px; }
  .practice-plan > div { min-width: 0; }
  .plan-chars { gap: 6px; }
  .plan-chars > span, .plan-chars > button { min-width: 33px; min-height: 33px; font-size: 17px; }
  .recall-panel { padding: 17px 14px; }
  .review-summary { padding: 16px; }
  .session-finished { padding: 26px 18px; }
  .session-finished h2 { font-size: 21px; }
  .reading-heading { font-size: 22px; }
  .reading-text { font-size: 22px; line-height: 2.3; }
  .reading-controls { gap: 9px 12px; }
  .reading-option { padding: 12px 14px; min-height: 56px; font-size: 16px; }
  .review-row { padding: 12px 14px; gap: 7px 12px; }
}

@media (max-width: 380px) {
  .main-nav a { font-size: 11px; padding-left: 0; padding-right: 0; }
  .practice-mode-label { margin-left: 3px; padding: 2px 5px; font-size: 11px; }
  .recall-panel > button { margin-left: 2px; margin-right: 2px; }
  .reading-controls .primary-button, .reading-controls .secondary-button { padding-left: 12px; padding-right: 12px; }
}

.reading-panel { padding: 24px; }
.reading-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.reading-heading h2 { margin: 0; }
.reading-heading .reading-meta { margin: 0; flex: none; }
.review-list > h2, .review-list > p { margin: 12px 16px; }
.scope-settings-form select { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
@media (max-width: 640px) { .reading-panel { padding: 18px; } }

/* Safe areas and Safari viewport behavior */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --page-gutter: 32px;
}
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.app-shell { min-height: 100svh; }
.site-header { padding-top: var(--safe-top); }
.header-inner, .main-nav, main#main-content, .page-footer {
  padding-left: max(var(--page-gutter), var(--safe-left));
  padding-right: max(var(--page-gutter), var(--safe-right));
}
.page-footer { padding-bottom: calc(24px + var(--safe-bottom)); }
.toast { bottom: calc(24px + var(--safe-bottom)); }
dialog {
  max-height: calc(100dvh - max(24px, var(--safe-top)) - max(24px, var(--safe-bottom)));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Touch controls work without a hover state or precise pointer. */
@media (any-pointer: coarse) {
  button, a { -webkit-user-select: none; user-select: none; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
  .header-actions button { min-width: 44px; min-height: 44px; padding: 8px 6px; }
  .brand { min-height: 44px; }
  .main-nav { gap: 8px; }
  .main-nav a { flex: 1; min-width: 44px; min-height: 56px; padding: 10px 4px; }
  .text-button, .filter-button, .card-study-button,
  .primary-button, .secondary-button, .word-chip,
  .sentence-mode-tabs button, .practice-plan button {
    min-height: 44px;
    min-width: 44px;
  }
  .text-button { padding: 9px 6px; }
  .puzzle-tools { gap: 8px 18px; }
  .dialog-close { width: 44px; height: 44px; right: 8px; top: 8px; }
  dialog h2 { margin-right: 42px; }
  .favorite-char, .collection-heart { min-width: 44px; min-height: 44px; padding: 10px; }
  .favorite-char { right: -49px; }
  .plan-chars > button { min-width: 44px; min-height: 44px; padding: 5px 9px; }
  .scope-character-list label, .scope-grid label { min-height: 48px; }
  .scope-character-list input, .scope-grid input { width: 19px; height: 19px; }
  .self-check, .adult-check { min-height: 48px; padding: 8px 0; cursor: pointer; }
  .self-check input, .adult-check input { width: 21px; height: 21px; margin-top: 3px; }
  .session-meta a, .practice-plan > a,
  .reading-links a, .below-card a, .session-finished > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .scope-settings-form select { min-height: 44px; font-size: 16px; }
  .sentence-token { min-width: 44px; min-height: 48px; padding: 10px 12px; }
  .reading-option { min-height: 60px; }
  /* Grow the hit area vertically while keeping the character in the text flow. */
  .reading-target { position: relative; padding: 4px 2px; }
  .reading-target::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
  .reading-target:active { background: #e4eee7; border-bottom-color: var(--green); }
  .letter-tile:active:not(:disabled), .sentence-token:active:not(:disabled),
  button.char-slot:active:not(:disabled) { background: #e8f1eb; border-color: var(--green); }
}

/* iPad portrait and landscape; keep the desktop layout unchanged. */
@media (any-pointer: coarse) and (min-width: 641px) {
  .header-inner { min-height: 94px; }
  .header-actions button { font-size: 15px; }
  .main-nav a { min-height: 60px; font-size: 16px; }
  main#main-content { padding-top: 32px; }
  .intro-sub { font-size: 16px; line-height: 1.9; }
  .study-context { gap: 18px; padding: 18px 20px; }
  .study-context strong { font-size: 15px; }
  .study-context p { font-size: 14px; line-height: 1.85; }
  .practice-plan { padding: 17px 20px; font-size: 15px; }
  .panel-top { padding: 19px 24px; }
  .panel-label { font-size: 16px; }
  .practice-mode-label { font-size: 13px; }
  .exercise { padding: 30px 32px 32px; min-height: 465px; }
  .exercise h2 { font-size: 23px; }
  .exercise-desc, .puzzle-clue { font-size: 16px; line-height: 1.9; }
  .character-grid { width: 168px; height: 168px; font-size: 118px; }
  .pinyin-options { max-width: 520px; gap: 14px; }
  .pinyin-option { min-height: 70px; }
  .pinyin { font-size: 29px; }
  .option-letter { width: 26px; height: 26px; font-size: 13px; }
  .feedback { max-width: 520px; font-size: 16px; }
  .primary-button, .secondary-button { min-height: 50px; padding: 12px 20px; font-size: 16px; }
  .text-button { font-size: 15px; }
  .quiet-note { font-size: 14px; }
  .lesson-bottom { padding: 19px 24px; }
  .step { font-size: 15px; }
  .step-number { width: 28px; height: 28px; }
  .compact-character p { font-size: 14px; }
  .word-slots { gap: 12px; margin-top: 22px; margin-bottom: 26px; }
  .char-slot { width: 54px; height: 64px; font-size: 34px; }
  .letter-tile { width: 56px; height: 60px; font-size: 31px; }
  .card-pool { max-width: 530px; gap: 12px; }
  .word-hint, .tap-progress { font-size: 15px; }
  .sentence-builder { min-height: 104px; padding: 18px; gap: 10px; }
  .sentence-bank { gap: 12px; }
  .sentence-token { min-height: 52px; padding: 12px 15px; font-size: 19px; }
  .sentence-mode-tabs { gap: 12px; }
  .sentence-mode-tabs button { min-height: 48px; padding: 10px 17px; font-size: 16px; }
  .self-check, .adult-check { font-size: 16px; }
  .oral-guide { font-size: 17px; }
  .reading-panel { padding: 28px; }
  .reading-text { max-width: 32em; margin: 24px auto; font-size: 24px; line-height: 2.3; }
  .reading-heading h2 { font-size: 25px; }
  .reading-source, .reading-meta { font-size: 14px; }
  .reading-controls { gap: 12px 22px; }
  .reading-option { min-height: 64px; padding: 15px 18px; font-size: 18px; }
  .reading-explanation { font-size: 16px; }
  .collection-pinyin { font-size: 18px; }
  .card-study-button { font-size: 14px; }
  dialog { max-width: 580px; padding: 30px; }
  dialog p, dialog li { font-size: 16px; }
  .dialog-note { font-size: 15px; }
  .scope-character-list, .scope-grid { gap: 10px; }
  .scope-character-list label, .scope-grid label { min-height: 54px; font-size: 24px; }
  .toast { font-size: 16px; }
}

/* Split View and compact touch screens retain comfortable action targets. */
@media (max-width: 640px) {
  :root { --page-gutter: 20px; }
}
@media (max-width: 380px) {
  :root { --page-gutter: 14px; }
}
@media (any-pointer: coarse) and (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .header-actions { margin-left: auto; gap: 6px 10px; }
  .main-nav { gap: 0; }
  .main-nav a { min-height: 54px; padding: 10px 1px; }
  .study-context { flex-wrap: wrap; }
  .study-context > div { flex: 1 1 180px; }
  .study-context .secondary-button { margin-left: auto; }
  .panel-top { flex-wrap: wrap; gap: 5px 12px; }
  .panel-top .text-button { margin-left: auto; }
  .practice-plan > div { max-width: 100%; }
  .char-slot { min-width: 44px; min-height: 58px; font-size: 30px; }
  .word-slots { gap: 8px; }
  .scope-character-list, .scope-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dialog-buttons > button { white-space: normal; }
  .reading-heading { align-items: flex-start; gap: 12px; }
}

/* Reading choices, vocabulary help, and parent book recommendations */
.reading-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.reading-mode-tabs button {
  min-width: 100px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #cbd8cf;
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.reading-mode-tabs button.active,
.reading-mode-tabs button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-pale);
  color: var(--green);
  font-weight: 600;
}
.reading-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 22px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.reading-picker label { font-size: 14px; font-weight: 500; }
.reading-picker select {
  flex: 1 1 240px;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  max-width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid #bdcec2;
  border-radius: 5px;
  color: var(--ink);
  background-color: #fff;
  font: 400 16px/1.6 var(--font);
}
.reading-source { line-height: 1.95; overflow-wrap: anywhere; }
.reading-source a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.reading-difficulty { margin: 12px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.reading-text { font-size: 24px; line-height: 2.3; }
.reading-text p { margin: 0 0 1em; font: inherit; }
.reading-text p:last-child { margin-bottom: 0; }
.reading-discussion {
  margin: 26px 0 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.95;
}
.reading-discussion h2, .reading-discussion h3 { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
.reading-discussion p { margin: 8px 0; }
.reading-discussion > p:first-of-type { color: var(--muted); font-size: 14px; }
.reading-discussion ol, .reading-discussion ul { margin: 12px 0; padding-left: 24px; }
.reading-discussion li + li { margin-top: 10px; }
.reading-glossary {
  margin: 20px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.reading-glossary summary {
  min-height: 48px;
  padding: 12px 0;
  color: var(--green);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  cursor: pointer;
  touch-action: manipulation;
}
.reading-glossary summary::marker, .book-recommendations summary::marker { color: #6e8978; }
.reading-glossary[open] > summary,
.reading-glossary details[open] > summary { margin-bottom: 6px; }
.reading-glossary button {
  min-width: 44px;
  min-height: 44px;
  margin: 0 8px 12px 0;
  padding: 8px 14px;
  border: 1px solid #cbd8cf;
  border-radius: 5px;
  background: #fff;
  color: var(--green);
  font-size: 16px;
  line-height: 1.6;
}
.reading-glossary p { color: var(--muted); font-size: 14px; line-height: 1.9; }
.reading-glossary summary:focus-visible, .book-recommendations summary:focus-visible {
  outline: 2px solid #9db8a8;
  outline-offset: 2px;
}
.book-recommendations {
  margin: 26px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.book-recommendations summary {
  min-height: 52px;
  padding: 14px 17px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
  cursor: pointer;
  touch-action: manipulation;
}
.book-list { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0 18px; }
.book-list article { padding: 18px 0; border-top: 1px solid var(--line); min-width: 0; }
.book-list h2, .book-list h3 { margin: 0 0 6px; color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.7; }
.book-list p { margin: 6px 0; font-size: 14px; line-height: 1.9; }
.book-author { color: var(--muted); font-size: 13px; }
.book-fit { color: var(--ink); font-size: 14px; line-height: 1.9; }
.book-note { color: var(--muted); font-size: 13px; line-height: 1.9; }
.book-source { color: var(--muted); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
a.book-source, .book-source a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .reading-mode-tabs button:hover, .reading-glossary button:hover { border-color: #849f8d; background: #f5f9f6; }
  .reading-mode-tabs button.active:hover { background: var(--green-pale); }
}
@media (any-pointer: coarse) {
  .reading-mode-tabs button, .reading-picker select { min-height: 50px; }
  .reading-glossary summary, .book-recommendations summary { min-height: 52px; }
  .reading-glossary button { min-height: 48px; margin-right: 10px; padding: 10px 15px; }
}
@media (any-pointer: coarse) and (min-width: 641px) {
  .reading-discussion { font-size: 18px; }
  .reading-discussion h2, .reading-discussion h3 { font-size: 21px; }
  .reading-difficulty { font-size: 15px; }
  .book-recommendations summary { font-size: 16px; }
  .book-list p { font-size: 15px; }
}
@media (max-width: 640px) {
  .reading-mode-tabs { gap: 9px; margin-bottom: 17px; }
  .reading-mode-tabs button { flex: 1; min-width: 0; padding: 10px 12px; font-size: 15px; }
  .reading-picker { display: block; margin-bottom: 18px; }
  .reading-picker label { display: block; margin-bottom: 6px; }
  .reading-picker select { display: block; margin-top: 6px; }
  .reading-discussion { margin-top: 22px; }
  .book-recommendations summary { padding: 13px 14px; font-size: 14px; }
  .book-list { padding: 0 14px; }
}

/* Course catalogue, grouped by the textbook's actual units. */
.course-selection-head {
  margin: 0 0 22px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
.course-selection-head h1, .course-selection-head h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.7;
}
.course-selection-head p { margin: 5px 0; }
.course-selection-head strong { color: var(--ink); font-weight: 600; }
.course-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}
.course-filter label { color: var(--ink); font-weight: 500; }
.course-filter select {
  flex: 1 1 180px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 34px 9px 12px;
  border: 1px solid #bdcec2;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
}
.course-unit {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.course-unit > summary {
  min-height: 54px;
  padding: 14px 17px;
  color: var(--ink);
  background: #f8faf9;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.8;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}
.course-unit > summary::marker { color: #6e8978; }
.course-unit > summary h2 { display: inline; margin: 0; font: inherit; }
.course-unit > summary span, .course-unit > summary small {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.course-unit > summary:focus-visible {
  outline: 2px solid #9db8a8;
  outline-offset: -2px;
}
.course-unit[open] > summary { border-bottom: 1px solid var(--line); }
.course-unit > h2 {
  margin: 0;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.8;
}
.course-unit .course-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 16px;
}
.course-unit .course-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 112px;
  padding: 15px 17px;
  border: 1px solid #d0dcd3;
  border-radius: 5px;
  background: #fff;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.course-unit .course-option strong {
  display: block;
  width: 100%;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.7;
}
.course-unit .course-option span {
  width: auto;
  margin-left: 0;
  order: 0;
}
.course-unit .course-option .icon { flex: none; }
.course-unit .course-option .course-focus {
  display: block;
  width: 100%;
  margin: 0;
  color: #54695b;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.9;
}
.course-unit .course-option .course-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
}
.course-unit .course-option .course-meta span { font: inherit; color: inherit; }
.course-unit .course-option .course-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 27px;
  margin: 2px 0 0;
  padding: 2px 8px;
  border: 1px solid #d9e3dc;
  border-radius: 4px;
  color: #536c5d;
  background: #f4f8f5;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
}
.course-unit .course-option.active,
.course-unit .course-option[aria-current="true"],
.course-unit .course-option[aria-current="page"],
.course-unit .course-option[aria-pressed="true"] {
  border-color: #759580;
  background: #f2f7f3;
}
.course-unit .course-option:disabled { background: #f8faf8; border-color: var(--line); cursor: default; }
#choose-course {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #c8d7cd;
  border-radius: 5px;
  color: var(--green);
  background: #fff;
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .course-unit .course-option:hover:not(:disabled), #choose-course:hover {
    border-color: #759580;
    background: #f4f8f5;
  }
}
@media (any-pointer: coarse) {
  .course-unit > summary { min-height: 58px; padding-top: 16px; padding-bottom: 16px; }
  .course-unit .course-option { padding: 17px 19px; }
  .course-unit .course-option .course-focus { font-size: 15px; }
  .course-unit .course-option .course-meta { font-size: 14px; }
  .course-filter select, #choose-course { min-height: 48px; }
  #choose-course { font-size: 15px; }
}
@media (max-width: 640px) {
  .course-selection-head { padding: 14px 15px; font-size: 13px; }
  .course-selection-head h1, .course-selection-head h2 { font-size: 20px; }
  .course-unit { margin-bottom: 14px; }
  .course-unit > summary, .course-unit > h2 { padding-left: 13px; padding-right: 13px; font-size: 16px; }
  .course-unit > summary span, .course-unit > summary small { font-size: 12px; }
  .course-unit .course-options { gap: 10px; padding: 12px; }
  .course-unit .course-option { padding: 13px; gap: 6px; }
  .course-unit .course-option strong { font-size: 17px; }
  .course-unit .course-option .course-meta { gap: 3px 10px; font-size: 12px; }
  .course-unit .course-option .course-focus { font-size: 14px; }
  #choose-course { font-size: 13px; padding-left: 10px; padding-right: 10px; }
}

.course-context-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.course-current-focus { margin: -4px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.course-knowledge { margin-bottom: 18px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.course-knowledge summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--ink); }
.course-knowledge ul { margin-top: 0; padding-left: 22px; }
.course-selection-head .form-field { min-width: min(100%, 250px); }
.course-selection-head select { max-width: 100%; min-height: 48px; }
@media(max-width:600px) { .course-context-actions { width:100%; } .course-selection-head select { width:100%; } }


/* Reading-first child flow. Parent tools retain their own routes. */
.main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.main-nav a { min-width: 0; min-height: 54px; padding: 10px 14px; font-size: 16px; }
.main-nav a.active::after { left: 14px; right: 14px; }
.header-inner { min-height: 78px; padding-top: 14px; padding-bottom: 14px; }
.header-actions { gap: 8px 16px; }
.header-actions button { min-height: 44px; padding: 6px; }
#parent-guide { font-size: 13px; }

.today-home { display: grid; gap: 20px; margin-bottom: 24px; }
.today-home .page-intro { margin-bottom: 0; }
.today-reading-card { padding: 24px; border: 1px solid #a4b9aa; border-radius: 8px; background: var(--green-pale); }
.today-reading-card h2 { margin: 0 0 10px; font-size: 27px; line-height: 1.65; }
.today-reading-card p { margin: 8px 0 18px; font-size: 17px; line-height: 1.9; }
.today-reading-card .reading-meta { font-size: 14px; }
.today-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.today-actions .primary-button, .today-actions .secondary-button { min-height: 52px; padding: 12px 20px; font-size: 17px; white-space: normal; }
.today-actions .text-button { min-height: 48px; padding: 8px 4px; font-size: 16px; }
.home-course { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.home-course a { display: inline-flex; align-items: center; min-height: 44px; color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.daily-practice-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; }
.daily-practice-heading h2 { margin: 0; font-size: 21px; }
.daily-practice-heading p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.child-practice .exercise { min-height: 0; padding: 24px 28px; }
.child-practice .exercise h2 { font-size: 24px; line-height: 1.7; }
.child-practice .panel-top { padding: 14px 22px; }
.child-practice .lesson-bottom { gap: 12px; flex-wrap: wrap; padding: 16px 22px; }
.child-practice .lesson-bottom .primary-button { min-height: 50px; font-size: 17px; white-space: normal; }
.child-practice .steps { margin-top: 18px; }
.child-practice .compact-character { flex-wrap: wrap; text-align: left; }
.child-practice .compact-character > div { min-width: 0; }
.child-practice .exercise-desc { margin-bottom: 16px; font-size: 16px; line-height: 1.85; }
.practice-exit { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 0; color: var(--green); font-size: 15px; }
.target-word-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px auto; max-width: 580px; }
.target-word-option { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; min-height: 72px; min-width: 0; padding: 14px 18px; border: 1px solid #7c9082; border-radius: 6px; color: var(--ink); background: #fff; font-size: 27px; line-height: 1.65; overflow-wrap: anywhere; }
.target-word-option.selected, .target-word-option[aria-pressed="true"] { border-color: var(--green); background: var(--green-pale); box-shadow: inset 0 0 0 1px var(--green); }
.target-word-option.correct { border-color: var(--green); background: #eaf3ed; }
.target-word-option.incorrect { border-color: #a05b4d; background: #fcf5f2; }
.target-word-option small { color: var(--muted); font-size: 14px; line-height: 1.7; }
.context-read-card { max-width: 27em; margin: 20px auto; padding: 22px; border: 1px solid #ccd9d0; border-radius: 6px; background: #f8faf9; color: var(--ink); font-size: 27px; font-weight: 400; line-height: 1.95; text-align: left; }
.context-read-card p { margin: 0 0 12px; font: inherit; }
.context-read-card p:last-child { margin-bottom: 0; }
.context-read-card .text-button { min-height: 44px; padding: 8px 0; font-size: 15px; }
.target-highlight { padding: 0 2px; border-bottom: 2px solid var(--green); background: #e6efe8; color: var(--ink); }
.recognition-cue { margin: 14px auto; max-width: 34em; padding: 12px 16px; border-left: 3px solid #759580; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.9; text-align: left; }
.recognition-cue strong { font-weight: 600; }

/* One natural paragraph, with help at the point of difficulty. */
.reading-segment-panel { min-height: 0; padding: 24px 26px; }
.reading-segment-panel .reading-heading { align-items: flex-start; margin-bottom: 10px; }
.reading-segment-panel .reading-heading h2 { margin: 0; font-size: 25px; }
.reader-progress { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 16px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.reader-progress progress { flex: 1 1 120px; width: 100%; height: 7px; accent-color: var(--green); }
.reading-segment-count { color: var(--ink); font-weight: 600; }
.reading-segment-status { color: var(--muted); font-size: 14px; }
.reading-segment-panel .reading-source { margin: 12px 0 16px; padding: 8px 12px; font-size: 13px; }
.reading-segment-panel .reading-controls { gap: 8px 18px; margin: 10px 0 14px; }
.reading-segment-panel .reading-controls .text-button { min-height: 44px; padding: 8px 0; font-size: 15px; }
.reading-text.reading-segment-text { max-width: 28em; margin: 18px auto 24px; color: var(--ink); font-size: 28px; font-weight: 400; line-height: 1.95; white-space: normal; overflow-wrap: anywhere; }
.reading-segment-text .reader-sentence { display: inline; font: inherit; line-height: inherit; }
.reader-sentence-text { font: inherit; line-height: inherit; }
.reading-segment-text .sentence-listen { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin: 0 2px; padding: 10px; border: 0; border-radius: 5px; background: transparent; color: var(--green); font-size: 14px; line-height: 1; vertical-align: middle; text-decoration: none; }
.reading-segment-text .sentence-listen .icon { width: 18px; height: 18px; }
.reading-segment-text .sentence-listen:focus-visible { outline: 3px solid #537461; outline-offset: 1px; }
.reading-segment-text .reader-word-help { display: inline; padding: 2px 1px; color: inherit; font: inherit; line-height: inherit; border-bottom-color: #6e8e7b; background: #f1f6f3; }
.reader-actions, .segment-controls { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px 16px; }
.reader-actions { margin: 20px 0 12px; }
.reader-actions .primary-button, .reader-actions .secondary-button { min-height: 52px; padding: 12px 18px; font-size: 17px; white-space: normal; }
.reader-actions .text-button, .segment-controls .text-button { min-height: 48px; padding: 9px 0; font-size: 15px; }
.segment-controls { justify-content: space-between; margin: 16px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.segment-controls .secondary-button { min-height: 48px; padding: 10px 16px; white-space: normal; }
.reader-hint { margin: 16px 0; padding: 14px 16px; border-left: 3px solid #759580; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 400; line-height: 1.9; }
.reader-check { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.reader-check h3 { margin: 0 0 14px; font-size: 20px; line-height: 1.8; }
.reader-check .reading-option { min-height: 56px; padding: 13px 16px; font-size: 17px; }
.reader-check .reading-explanation { font-size: 16px; font-weight: 400; }
.reading-segment-panel .reading-links { margin-top: 22px; gap: 10px 16px; }
.reading-segment-panel .reading-links a, .reading-segment-panel .reading-links button { min-height: 44px; }

/* Adult tools are available without occupying the child's main reading area. */
.parent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0 26px; }
.parent-card { display: block; min-width: 0; padding: 20px; border: 1px solid #c6d4cb; border-radius: 6px; background: #fff; }
.parent-card h2, .parent-card h3 { margin: 0 0 8px; color: var(--ink); font-size: 20px; line-height: 1.7; }
.parent-card p { margin: 7px 0; color: var(--muted); font-size: 15px; line-height: 1.85; }
.parent-card a, a.parent-card, button.parent-card { min-height: 48px; }
.parent-card a { display: inline-flex; align-items: center; color: var(--green); line-height: 1.8; }
.parent-card .text-button, .parent-card .primary-button, .parent-card .secondary-button { min-height: 48px; font-size: 16px; }
.parent-grid input, .parent-grid select, .parent-grid textarea, .parent-card input, .parent-card select, .parent-card textarea { max-width: 100%; font-size: 16px; }
.evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 20px 0; }
.evidence-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 15px; line-height: 1.85; }
.evidence-card strong { display: block; margin: 5px 0; color: var(--ink); font-size: 24px; font-weight: 600; }
.evidence-card p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.evidence-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.85; }

@media (hover: hover) and (pointer: fine) {
  .target-word-option:hover:not(:disabled) { border-color: var(--green); background: #f5f9f6; }
  .reading-segment-text .sentence-listen:hover { background: var(--green-pale); text-decoration: none; }
  a.parent-card:hover, button.parent-card:hover { border-color: #759580; background: #f8faf9; }
}
@media (any-pointer: coarse) and (min-width: 641px) {
  .reading-text.reading-segment-text { font-size: 30px; line-height: 1.95; }
  .context-read-card { font-size: 29px; }
  .child-practice .exercise { min-height: 0; padding: 24px 28px; }
  .child-practice .character-grid { width: 145px; height: 145px; font-size: 105px; }
}
@media (max-width: 640px) {
  .main-nav a { min-height: 52px; padding: 10px 6px; font-size: 15px; }
  .today-home { gap: 16px; }
  .today-reading-card { padding: 20px; }
  .today-reading-card h2 { font-size: 24px; }
  .today-reading-card p { font-size: 16px; }
  .today-actions { align-items: stretch; gap: 10px; }
  .today-actions > .primary-button, .today-actions > .secondary-button { flex: 1 1 180px; }
  .child-practice .exercise { padding: 21px 16px; min-height: 0; }
  .child-practice .exercise h2 { font-size: 22px; }
  .child-practice .panel-top, .child-practice .lesson-bottom { padding-left: 16px; padding-right: 16px; }
  .target-word-options { gap: 10px; }
  .target-word-option { min-height: 68px; padding: 12px 10px; font-size: 25px; }
  .context-read-card { margin: 16px auto; padding: 17px; font-size: 26px; }
  .reading-segment-panel { padding: 20px 17px; }
  .reading-text.reading-segment-text { margin: 16px auto 20px; font-size: 26px; line-height: 1.95; }
  .reading-segment-panel .reading-heading h2 { font-size: 23px; }
  .reader-actions { gap: 10px 12px; }
  .reader-actions > .primary-button, .reader-actions > .secondary-button { flex: 1 1 180px; }
  .parent-grid, .evidence-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .parent-card, .evidence-card { padding: 17px; }
}
@media (max-width: 380px) {
  .header-inner { gap: 8px; }
  .header-actions { gap: 4px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 17px; }
  .header-actions button { padding-left: 4px; padding-right: 4px; }
  #parent-guide { font-size: 12px; }
  .reading-segment-panel { padding: 18px 14px; }
  .reading-text.reading-segment-text { font-size: 25px; }
  .target-word-options { grid-template-columns: minmax(0, 1fr); }
}

/* Quiet, immediate responses to deliberate taps. Native actions stay intact. */
:where(button, a[href], summary, input[type="checkbox"], input[type="radio"], select) {
  -webkit-tap-highlight-color: rgba(66, 111, 83, .13);
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 90ms ease;
}
:where(button, a[href], summary, input[type="checkbox"], input[type="radio"], select).is-pressing {
  transform: translateY(1px) scale(.985);
  box-shadow: inset 0 0 0 2px rgba(47, 88, 62, .22);
}
:where(button, a[href], summary, input[type="checkbox"], input[type="radio"], select).just-tapped {
  box-shadow: 0 0 0 3px rgba(73, 117, 86, .20);
}
button:disabled, [aria-disabled="true"] { transform: none; }
.child-practice .feedback.success {
  border-left: 3px solid #56866b;
}
.child-practice .feedback.success .icon {
  animation: quiet-confirmation 210ms ease-out both;
}
.target-word-option.correct, .pinyin-option.correct, .reading-option.correct {
  box-shadow: inset 0 0 0 1px #56866b;
}
.target-word-option.incorrect, .pinyin-option.incorrect, .reading-option.incorrect {
  animation: none;
  box-shadow: inset 0 0 0 1px rgba(160, 91, 77, .18);
}
.self-check input[type="checkbox"], .scope-character-list input[type="checkbox"] {
  accent-color: #386e57;
}
.self-check input:checked + span { color: #315b42; }
.self-check:has(input:checked) { background: #edf5ef; border-color: #91af9c; }
.reading-celebrate {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #c7dacd;
  border-left: 3px solid #56866b;
  border-radius: 5px;
  background: #edf5ef;
  color: #315b42;
  font-size: 16px;
  line-height: 1.8;
}
@keyframes quiet-confirmation {
  from { transform: scale(.88); opacity: .75; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  :where(button, a[href], summary, input[type="checkbox"], input[type="radio"], select) { transition: none; }
  :where(button, a[href], summary, input[type="checkbox"], input[type="radio"], select).is-pressing { transform: none; }
  .child-practice .feedback.success .icon { animation: none; }
}

/* Low-distraction breadth practice: generous touch areas, no drag gestures. */
.breadth-parent, .stage-reference { margin-bottom: 20px; }
.breadth-track-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.breadth-track-buttons [aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }
.stage-reference summary { cursor: pointer; min-height: 48px; display: list-item; font-size: 17px; font-weight: 600; }
.home-instruction-link { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; padding: 18px; min-height: 70px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.home-instruction-link > span { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.home-instruction-link strong { font-size: 19px; }
.home-instruction-link small { flex-basis: 100%; font-size: 15px; color: var(--muted); }
.foundation-skip { display: block; min-height: 48px; margin: 16px auto 0; }
.instruction-panel { padding: 24px; margin-top: 16px; }
.instruction-term-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.instruction-term-row p { margin: 4px 0; }
.instruction-term-row .instruction-word { font-size: 32px; line-height: 1.5; margin: 4px 0; letter-spacing: .04em; }
.instruction-meaning { font-size: 21px; line-height: 1.85; margin: 14px 0; }
.instruction-passage { white-space: pre-line; font-size: 22px; line-height: 1.95; padding: 16px; border-radius: 6px; background: var(--green-pale); }
.instruction-prompt { font-size: 21px; line-height: 1.8; margin: 18px 0 14px; }
.instruction-panel .text-button { min-height: 48px; padding-top: 10px; padding-bottom: 10px; }
.instruction-filter select { min-height: 48px; max-width: 100%; font-size: 18px; }
.instruction-choice, .instruction-pair-button { min-height: 56px; font-size: 20px; padding: 12px 16px; line-height: 1.7; }
.instruction-choice.selected:not(.correct):not(.incorrect), .instruction-pair-button.selected { border-color: var(--green); background: var(--green-pale); }
.instruction-pair-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; margin: 14px 0; }
.instruction-pair-column { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.instruction-pair-button.matched { background: var(--green-pale); color: var(--green-dark); border-color: #799a86; opacity: 1; }
.instruction-order-list, .instruction-order-pool { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; min-height: 52px; }
.instruction-order-list { padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.instruction-order-pool .sentence-token { min-height: 52px; font-size: 20px; }
.instruction-order-list .sentence-token { cursor: default; font-size: 18px; }
.instruction-mark-area { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; margin: 18px 0; }
.instruction-mark-token { min-height: 52px; min-width: 48px; padding: 8px 10px; font-size: 23px; line-height: 1.7; border: 2px solid transparent; border-radius: 6px; }
.instruction-mark-token:disabled { opacity: 1; }
.instruction-mark-area.is-circle .is-marked { border: 2px solid var(--green); border-radius: 999px; background: var(--green-pale); }
.instruction-mark-area.is-underline .is-marked { border-bottom: 3px solid var(--green); border-radius: 0; background: var(--green-pale); }
.instruction-status { min-height: 34px; margin: 18px 0; color: var(--green-dark); font-size: 18px; line-height: 1.8; }
.instruction-answer { margin: 16px 0; padding: 16px; background: #f5f6f4; border-left: 3px solid #8c9e91; font-size: 18px; line-height: 1.8; }
@media (max-width: 640px) {
  .instruction-panel { padding: 18px; }
  .instruction-pair-grid { gap: 12px; }
  .instruction-choice, .instruction-pair-button { font-size: 19px; padding: 10px 12px; }
  .instruction-passage { padding: 12px; }
}
