html,
body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #f8fafc;
  color: #172033;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  width: 100%;
  height: 100%;
}

.app-loading-feedback {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(23, 32, 51, .9);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.app-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: app-loading-spin .7s linear infinite;
}

@keyframes app-loading-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading-spinner { animation: none; }
}
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: #f8fafc;
}

.titlebar {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr 88px;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  padding: env(safe-area-inset-top) 12px 0;
  background: #2563eb;
  color: #fff;
  flex: 0 0 auto;
}

.titlebar h1 {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.title-left,
.title-right {
  min-width: 0;
}

.title-right {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.back,
.ghost,
.titlebar button {
  border: 0;
  background: transparent;
  color: inherit;
}

.title-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.title-icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.back {
  padding: 10px 0;
  text-align: left;
}

.page-body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  text-align: left;
  font-weight: 650;
}

.menu-item:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: default;
}

.settings-page {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
}

.settings-page.scroll-area {
  overflow-y: auto;
  padding-bottom: 10px;
}

.settings-action-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  padding-top: 10px;
  padding-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.settings-section {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
}

.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-check-list,
.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-check {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 10px;
  color: #172033;
  font-size: 14px;
}

.settings-check input {
  flex: 0 0 auto;
}

.settings-check small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #172033;
  font-size: 14px;
  font-weight: 650;
}

.settings-field input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #172033;
  font: inherit;
}

.settings-action-footer.inline {
  padding-top: 0;
}

.sync-alert {
  margin: 0;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 14px;
}

.hidden-file-input {
  display: none;
}

.secondary {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  font-weight: 700;
}

.icp-link {
  color: #2563eb;
  font-size: 14px;
  text-decoration: none;
}

.icp-link:active {
  color: #1d4ed8;
}

.help-page {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
}

.help-page.scroll-area {
  display: block;
}

.help-page.scroll-area > .help-section {
  margin-bottom: 12px;
}

.help-section-head,
.help-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.help-text {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.help-muted {
  color: #64748b;
  font-size: 12px;
}

.help-link-list,
.help-list {
  display: flex;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  flex-direction: column;
  gap: 10px;
}

.help-section {
  display: flex;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.help-info-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-info-row {
  min-height: 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
}

.help-info-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.help-info-row strong {
  font-weight: 600;
  word-break: break-all;
  text-align: right;
}

.help-icp {
  color: #2563eb;
  font-size: 14px;
  font-weight: 600;
}

.help-list-item {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
}

.help-item-title {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.help-item-text {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.help-iframe-page {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.help-iframe-shell {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  overflow: hidden;
}

.help-iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.scroll-area {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.row-actions,
.inline-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions button,
.inline-actions button,
.ghost,
.modal button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #172033;
}

.row-actions button:disabled,
.inline-actions button:disabled,
.ghost:disabled {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
}

select,
input,
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #172033;
}

select,
input {
  min-height: 34px;
  padding: 0 8px;
}

textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  resize: none;
}

.primary {
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
}

.primary:disabled {
  background: #bfdbfe;
  color: #eff6ff;
}

.wide {
  width: 100%;
  min-height: 44px;
}

.panel,
.form-section {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
}

.panel-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.panel-title,
.section-title {
  font-size: 14px;
  font-weight: 700;
}

.muted,
.empty {
  color: #64748b;
  font-size: 13px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px;
  border-bottom: 1px solid #eef2f7;
}

.toolbar-action {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
}

.toolbar-action .ghost {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #fff;
}

.fixed-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 10px 0 0;
  color: gray;
  font-size: 13px;
  text-align: center;
}

.unfinished-list {
  flex: 1 1 auto;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
}

.unfinished-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) 56px auto;
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
}

.unfinished-row > span {
  min-width: 0;
}

.modal-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 20;
}

.modal {
  display: flex;
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  flex-direction: column;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-head > *,
.modal-foot > * {
  margin-left: 8px;
}

.modal-head > :first-child,
.modal-foot > :first-child {
  margin-left: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.modal-foot {
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
  justify-content: flex-end;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.modal-list {
  max-height: 42vh;
}

.fatal {
  padding: 24px;
}

@media (max-width: 380px) {
  .unfinished-row {
    grid-template-columns: 1fr 44px;
    font-size: 13px;
  }

  .unfinished-row .row-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Compatibility fallbacks for Android WebView around Chrome 61/API25. */

.help-text,
.help-item-title,
.help-item-text,
.homework-task-detail p,
.homework-row-title strong,
.english-term-header span,
.english-term-cell,
.english-term-actions,
.copybook-word-row .word,
.copybook-word-row .pinyin,
.tree-row label,
.word-row .word-main,
.result-row .word {
  overflow-wrap: break-word;
  word-break: break-word;
}

.math-toolbar button {
  font-size: 11px;
  font-size: clamp(10px, 2.8vw, 12px);
}

.mental-expression {
  font-size: 40px;
  font-size: clamp(28px, 10vw, 46px);
}

.math-size-preview {
  min-height: 200px;
  min-height: clamp(150px, 36vh, 280px);
  min-height: clamp(150px, 36svh, 280px);
}

.focus-cell {
  font-size: 34px;
  font-size: clamp(26px, 8vw, 42px);
}

.focus-target-grid {
  margin-top: 48px;
  margin-top: clamp(28px, 6vh, 64px);
}

.focus-target-item,
.focus-option {
  font-size: 30px;
  font-size: clamp(24px, 7vw, 36px);
}

.focus-option-grid {
  margin-top: 30px;
  margin-top: clamp(18px, 4vh, 42px);
}

.focus-memory-grid {
  margin-top: 40px;
  margin-top: clamp(24px, 5vh, 56px);
}

.focus-memory-card {
  font-size: 25px;
  font-size: clamp(20px, 5.5vw, 30px);
}

.focus-count-number {
  font-size: 64px;
  font-size: clamp(48px, 12vw, 72px);
}

.titlebar,
.homework-filter,
.homework-filter label,
.homework-summary label,
.homework-form label,
.homework-toolbar,
.homework-task-detail,
.copybook-actions,
.copybook-word-row,
.button-grid,
.search-form,
.unfinished-row,
.math-mode-grid,
.math-card-grid,
.math-size-form,
.math-dialog-form,
.mental-practice,
.mental-keypad,
.mental-action-row,
.mental-question-list,
.mental-question-row,
.math-size-input-grid,
.math-size-input-row,
.math-size-control-grid,
.math-size-row,
.math-size-net-actions,
.english-content .segmented,
.english-passage-main,
.english-dialog-form,
.english-reading-list,
.english-reading-row,
.focus-overview,
.focus-choice-grid,
.focus-status-row,
.focus-schulte-grid,
.focus-target-grid,
.focus-memory-grid,
.focus-option-grid,
.focus-record-row {
  grid-gap: 8px;
}

.homework-filter label,
.homework-summary label,
.homework-form label,
.english-dialog-form label,
.math-size-form label,
.math-dialog-form label {
  grid-gap: 5px;
}

.mental-question-list,
.mental-question-row,
.english-passage-main,
.english-reading-row {
  grid-gap: 4px;
}

.tree,
.math-size-form,
.math-dialog-form,
.english-dialog-form,
.english-reading-list,
.focus-current-training {
  grid-gap: 10px;
}

@media (max-width: 380px) {
  .focus-target-grid,
  .focus-option-grid {
    margin-top: 28px;
    margin-top: clamp(18px, 4vh, 36px);
  }

  .focus-memory-card {
    font-size: 24px;
    font-size: clamp(20px, 6.5vw, 30px);
  }
}

@media (max-height: 700px) {
  .math-size-preview {
    min-height: 160px;
    min-height: clamp(120px, 30vh, 200px);
    min-height: clamp(120px, 30svh, 200px);
  }
}

@media (max-height: 600px) {
  .math-size-preview {
    min-height: 128px;
    min-height: clamp(96px, 26vh, 160px);
    min-height: clamp(96px, 26svh, 160px);
  }
}

@supports not (aspect-ratio: 1) {
  .copybook-preview-image {
    width: 65%;
    height: 92%;
  }

  .focus-cell,
  .focus-memory-card {
    height: var(--focus-cell-size, 64px);
  }

  .focus-target-item,
  .focus-option {
    min-height: 64px;
  }
}

.no-flex-gap .title-right > * + * {
  margin-left: 2px;
}

.no-flex-gap .page-body > * + *,
.no-flex-gap .split-view > * + *,
.no-flex-gap .menu > * + *,
.no-flex-gap .settings-page > * + *,
.no-flex-gap .settings-action-footer > * + *,
.no-flex-gap .settings-section > * + *,
.no-flex-gap .settings-check-list > * + *,
.no-flex-gap .settings-field > * + *,
.no-flex-gap .settings-radio-group > * + *,
.no-flex-gap .help-page > * + *,
.no-flex-gap .help-link-list > * + *,
.no-flex-gap .help-list > * + *,
.no-flex-gap .help-section > * + *,
.no-flex-gap .help-info-list > * + *,
.no-flex-gap .homework-page > * + *,
.no-flex-gap .homework-list > * + *,
.no-flex-gap .setup-form > * + *,
.no-flex-gap .copybook-form > * + *,
.no-flex-gap .copybook-list-page > * + *,
.no-flex-gap .copybook-preview-page > * + *,
.no-flex-gap .copybook-word-list > * + *,
.no-flex-gap .playback > * + *,
.no-flex-gap .focus-page > * + *,
.no-flex-gap .focus-form-panel > * + *,
.no-flex-gap .focus-current-training > * + *,
.no-flex-gap .english-reader > * + * {
  margin-top: 10px;
}

.no-flex-gap .row-actions > * + *,
.no-flex-gap .inline-actions > * + *,
.no-flex-gap .settings-section-head > * + *,
.no-flex-gap .help-section-head > * + *,
.no-flex-gap .help-info-row > * + *,
.no-flex-gap .panel-head > * + *,
.no-flex-gap .detail-row > * + *,
.no-flex-gap .homework-toolbar-row > * + *,
.no-flex-gap .homework-row > * + *,
.no-flex-gap .homework-row-title > * + *,
.no-flex-gap .choice-row > * + *,
.no-flex-gap .form-section label > * + *,
.no-flex-gap .tree-row > * + *,
.no-flex-gap .tree-row label > * + *,
.no-flex-gap .word-row > * + *,
.no-flex-gap .result-row > * + *,
.no-flex-gap .english-term-actions > * + *,
.no-flex-gap .english-reader-controls > * + *,
.no-flex-gap .focus-switch > * + *,
.no-flex-gap .modal-head > * + *,
.no-flex-gap .modal-foot > * + * {
  margin-left: 8px;
}

.no-flex-gap .tree > * + *,
.no-flex-gap .word-row .word-main > * + *,
.no-flex-gap .math-page > * + *,
.no-flex-gap .math-size-card > * + *,
.no-flex-gap .math-size-form > * + *,
.no-flex-gap .math-dialog-form > * + *,
.no-flex-gap .math-size-form label > * + *,
.no-flex-gap .math-dialog-form label > * + *,
.no-flex-gap .focus-overview div > * + *,
.no-flex-gap .focus-score-panel > * + *,
.no-flex-gap .focus-entry > span:first-child > * + *,
.no-flex-gap .english-passage-main > * + *,
.no-flex-gap .english-dialog-form > * + *,
.no-flex-gap .english-dialog-form label > * + *,
.no-flex-gap .english-reading-list > * + *,
.no-flex-gap .english-reading-row > * + * {
  margin-top: 6px;
}

.no-flex-gap .modal-head > :first-child,
.no-flex-gap .modal-foot > :first-child {
  margin-left: 0;
}

.no-flex-gap .page-body > * + *,
.no-flex-gap .settings-page > * + *,
.no-flex-gap .help-page > * + *,
.no-flex-gap .focus-page > * + * {
  margin-top: 12px;
}

.no-flex-gap .playback > * + * {
  margin-top: 28px;
}

.no-flex-gap .dictation-content > * + * {
  margin-top: 0;
}
