:root {
  color-scheme: light;
  --ink: #20242d;
  --muted: #687385;
  --line: #d8dee8;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --soft-2: #edf5f2;
  --accent: #216869;
  --accent-2: #c85a36;
  --accent-3: #4c6fb1;
  --good: #277a48;
  --warn: #b65722;
  --bad: #b73b3b;
  --shadow: 0 18px 42px rgba(39, 49, 69, 0.11);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f9fc 0%, #edf3f6 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  min-height: 100vh;
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.history-panel {
  display: grid;
  min-width: 0;
  height: 100vh;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 24px;
  overflow: hidden;
  background: #fbfcfe;
  border-left: 1px solid var(--line);
}

.history-records {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.history-list,
.history-group {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.history-list {
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
}

.history-group {
  align-content: start;
  gap: 5px;
}

.history-group > strong {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.history-item {
  display: grid;
  align-self: start;
  gap: 3px;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.history-item.is-active {
  border-color: #bdd6d1;
  background: var(--soft-2);
}

.history-title {
  overflow: hidden;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta,
.history-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.encouragement-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.encouragement-card {
  display: grid;
  gap: 8px;
  border: 1px solid #b7dbd6;
  border-radius: 8px;
  padding: 14px;
  background: #f5fffc;
}

.encouragement-card.stage,
.encouragement-card.strong {
  border-color: #f0be7a;
  background: #fffaf0;
}

.encouragement-card strong {
  font-size: 17px;
}

.encouragement-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.encouragement-badge {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.encouragement-card.stage .encouragement-badge,
.encouragement-card.strong .encouragement-badge {
  background: #d97706;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
}

.brand-block p,
.screen-heading p,
.field-label,
.toggle-row,
.sentence-item p,
.translation-text,
#currentHint {
  color: var(--muted);
}

.brand-block p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.55;
}

.api-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.api-status.is-online {
  border-color: #b9d9c4;
  background: #edf8f1;
  color: var(--good);
}

.api-status.is-local {
  border-color: #e2d1b9;
  background: #fff7ea;
  color: var(--warn);
}

.step-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.step-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.step-item span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e6ebf2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.step-item.is-active {
  border-color: #bdd6d1;
  background: var(--soft-2);
  color: var(--accent);
}

.step-item.is-active span {
  background: var(--accent);
  color: white;
}

.settings-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h2,
.section-title h3 {
  font-size: 16px;
}

.field-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="range"],
textarea {
  width: 100%;
}

select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  font-size: 14px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.main-panel {
  min-width: 0;
  padding: 30px;
}

.screen {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
}

.screen.is-visible {
  display: block;
}

.screen-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.screen-heading h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.18;
}

.upload-grid,
.confirm-layout,
.practice-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(360px, 1.08fr);
  gap: 20px;
  align-items: stretch;
}

.practice-layout.is-hidden {
  display: none;
}

.practice-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.drop-zone,
.text-import,
.sentence-list-panel,
.analysis-preview,
.dictation-panel,
.result-panel,
.review-summary,
.wrong-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.drop-zone {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
}

.drop-zone input {
  display: none;
}

.drop-zone h3 {
  font-size: 22px;
}

.drop-zone p {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.7;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #f0f8f5;
}

.page-preview {
  width: min(100%, 280px);
  aspect-ratio: 3 / 4;
  padding: 30px 24px;
  border: 1px solid #ced8e5;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 14px 32px rgba(45, 42, 35, 0.12);
}

.page-preview.has-image {
  padding: 0;
  overflow: hidden;
}

.page-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-line {
  height: 12px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: #cbd4dc;
}

.preview-line.wide {
  width: 100%;
}

.preview-line.mid {
  width: 76%;
}

.preview-line.short {
  width: 48%;
}

.text-import {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.text-import label {
  font-size: 15px;
  font-weight: 800;
}

textarea {
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  line-height: 1.65;
}

.text-import textarea {
  flex: 1;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.action-row.compact {
  flex-wrap: nowrap;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.round-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button.muted {
  background: var(--accent-3);
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--accent);
}

.compact-text {
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--soft);
  color: var(--accent);
}

.round-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 25px;
}

.sentence-list-panel,
.analysis-preview,
.dictation-panel,
.result-panel,
.wrong-list {
  padding: 18px;
}

.is-hidden {
  display: none !important;
}

.sentence-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  margin-top: 14px;
  overflow: auto;
  padding-right: 4px;
}

.sentence-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  text-align: left;
}

.sentence-item.is-selected {
  border-color: var(--accent);
  background: #edf7f4;
}

.sentence-item.has-warning {
  border-color: #d97706;
  background: #fff8ed;
}

.sentence-item strong {
  display: block;
  margin-bottom: 5px;
  line-height: 1.5;
}

.sentence-warning {
  margin-top: 6px;
  color: #9a4b13;
  font-weight: 800;
}

.source-warning-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  border: 1px solid #f0be7a;
  border-radius: 8px;
  padding: 16px;
  background: #fff8ed;
}

.source-warning-panel.is-ok {
  border-color: #b9d9c4;
  background: #f1fbf5;
}

.source-warning-panel.is-ok h3 {
  color: var(--good);
}

.source-warning-panel h3 {
  margin-bottom: 6px;
}

.source-warning-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.source-warning-list {
  display: grid;
  gap: 10px;
}

.source-warning-item {
  display: grid;
  gap: 6px;
  border: 1px solid #f0d2a9;
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.source-warning-item strong {
  line-height: 1.5;
}

.source-warning-item em {
  color: #9a4b13;
  font-style: normal;
  font-weight: 800;
  line-height: 1.5;
}

.analysis-preview {
  display: grid;
  align-content: start;
  gap: 18px;
}

.answer-text {
  font-size: 20px;
  line-height: 1.6;
  font-weight: 800;
}

.translation-text {
  line-height: 1.7;
}

.structure-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  min-height: 46px;
  align-items: flex-start;
}

.structure-segment {
  display: inline-grid;
  position: relative;
  min-height: 64px;
  align-items: start;
  justify-items: center;
  gap: 4px;
  border-radius: 0;
  padding: 0 0 3px;
  background: transparent;
  line-height: 1.35;
  font-weight: 800;
}

.segment-text {
  display: inline;
  order: 1;
  white-space: nowrap;
  text-align: center;
  border-radius: 4px;
  padding: 5px 8px;
}

.structure-segment.core {
  color: var(--ink);
}

.structure-segment.support {
  color: var(--ink);
}

.structure-segment.core .segment-text {
  background: #f7dfc6;
}

.structure-segment.support .segment-text {
  background: #dcefed;
}

.role-label {
  order: 2;
  color: #7d5d31;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.structure-segment.support .role-label {
  color: #407a77;
}

.word-token {
  display: inline-flex;
  position: relative;
  min-width: 20px;
  align-items: center;
  justify-content: center;
  border-bottom: 0;
  padding-bottom: 0;
  cursor: help;
}

.teacher-panel {
  display: grid;
  gap: 10px;
}

.teacher-note {
  border-left: 3px solid var(--accent-2);
  padding-left: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.knowledge-list {
  display: grid;
  gap: 8px;
}

.knowledge-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.knowledge-card strong {
  display: block;
  margin-bottom: 5px;
}

.knowledge-card p {
  color: var(--muted);
  line-height: 1.65;
}

.exercise-panel {
  display: grid;
  gap: 16px;
}

.exercise-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.exercise-heading p,
.exercise-hint {
  color: var(--muted);
  line-height: 1.6;
}

.exercise-content {
  display: grid;
  gap: 14px;
}

.exercise-empty,
.exercise-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcff;
}

.exercise-card {
  display: grid;
  gap: 12px;
}

.exercise-card strong {
  font-size: 18px;
}

.exercise-card p {
  line-height: 1.65;
}

.exercise-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.exercise-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.exercise-option.is-selected {
  border-color: var(--accent);
  background: #e7f4f1;
  color: var(--accent);
}

.exercise-option.is-correct {
  border-color: var(--accent);
  background: #e7f4f1;
  color: var(--accent);
}

.exercise-option.is-wrong {
  border-color: #ef9f9f;
  background: #fff0f0;
  color: var(--bad);
}

.exercise-target {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 4px 0;
}

.exercise-answer-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.exercise-input,
.translation-exercise-item textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}

.translation-exercise-item textarea {
  min-height: 86px;
  line-height: 1.55;
}

.exercise-input {
  min-height: 44px;
}

.translation-exercise-item {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.translation-exercise-item:first-of-type {
  border-top: 0;
}

.exercise-feedback {
  border-left: 4px solid var(--line);
  padding: 10px 12px;
  background: white;
  color: var(--muted);
}

.exercise-feedback.is-correct {
  border-color: #2f855a;
}

.exercise-feedback.is-wrong {
  border-color: #d97706;
}

.exercise-next-action {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.exercise-next-action span {
  color: var(--muted);
  line-height: 1.5;
  margin-right: auto;
}

.option-explanations {
  display: grid;
  gap: 6px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.option-explanations p {
  margin: 0;
}

.knowledge-card em {
  display: block;
  margin-top: 5px;
  color: var(--accent-3);
  font-style: normal;
  line-height: 1.6;
}

.word-tooltip {
  display: none;
  position: fixed;
  z-index: 50;
  width: min(240px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  box-shadow: var(--shadow);
  color: var(--ink);
  line-height: 1.45;
}

.word-tooltip.is-visible {
  display: grid;
  gap: 4px;
}

.word-tooltip strong {
  font-size: 17px;
}

.word-tooltip span,
.word-tooltip em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mode-switch button {
  min-width: 74px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-switch button.is-selected {
  background: var(--accent);
  color: white;
}

.dictation-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.mode-switch .return-listen-tab {
  min-width: 94px;
  border-color: #e2bd45;
  background: #fff3b8;
  color: #315fba;
}

.mode-switch .return-listen-tab:hover {
  background: #ffe98a;
}

.listen-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.listen-controls h3 {
  margin-bottom: 6px;
  font-size: 20px;
}

#studentInput {
  min-height: 132px;
  font-size: 18px;
}

.dictation-level-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: white;
}

.dictation-level-switch button {
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.dictation-level-switch button.is-selected {
  background: var(--accent);
  color: white;
}

.simple-sort-panel {
  display: grid;
  gap: 12px;
}

.simple-sort-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  color: var(--muted);
}

.simple-sort-heading strong {
  color: var(--ink);
}

.simple-answer,
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.simple-answer {
  position: relative;
  background: #f8fafc;
}

.simple-answer.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.word-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  cursor: grab;
}

.word-chip:active {
  cursor: grabbing;
}

.word-chip.is-selected {
  border-color: var(--accent);
  background: #e7f4f1;
  color: var(--accent);
}

.word-chip.is-drop-before {
  box-shadow: -5px 0 0 var(--accent);
}

.simple-answer.is-drop-end {
  outline: 2px dashed #9ec8c2;
  outline-offset: -5px;
}

.reward-toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  max-width: 480px;
  border: 1px solid #b7dbd6;
  border-radius: 8px;
  padding: 14px 16px;
  background: #f5fffc;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
}

.reward-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: reward-pop 0.32s ease both;
}

.reward-toast.strong,
.reward-toast.stage {
  border-color: #f0be7a;
  background: #fffaf0;
}

.reward-toast strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.reward-toast p {
  color: var(--muted);
  line-height: 1.5;
}

.reward-buddy {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
}

.reward-buddy::before,
.reward-buddy::after {
  content: "";
  position: absolute;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.reward-buddy::before {
  left: 16px;
}

.reward-buddy::after {
  right: 16px;
}

.buddy-band {
  position: absolute;
  bottom: 13px;
  width: 24px;
  height: 8px;
  border-radius: 0 0 12px 12px;
  border-bottom: 3px solid white;
}

.buddy-ear {
  position: absolute;
  top: 17px;
  width: 8px;
  height: 18px;
  border-radius: 8px;
  background: #d9efeb;
}

.buddy-ear.left {
  left: -4px;
}

.buddy-ear.right {
  right: -4px;
}

.reward-badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.reward-toast.strong .reward-badge,
.reward-toast.stage .reward-badge {
  background: #d97706;
}

@keyframes reward-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-panel {
  display: grid;
  gap: 18px;
}

.reading-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.reading-panel.is-visible {
  display: grid;
}

.reading-list {
  height: auto;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.reading-list.is-three-line-mode {
  overflow: hidden;
}

.reading-analysis {
  padding: 18px;
  border-top: 1px solid var(--line);
  background: white;
}

.full-transcript {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  color: var(--ink);
}

.transcript-line {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  border: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  line-height: 1.55;
}

.transcript-line span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.transcript-line span:last-child {
  color: var(--ink);
  font-weight: 500;
}

.transcript-line.is-current {
  background: #d7e8ff;
}

.transcript-line:hover {
  background: #eef5ff;
}

.reading-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 92px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: white;
  transition: background 0.18s ease, transform 0.18s ease;
}

.reading-row.is-current {
  background: #d7e8ff;
}

.reading-row.is-following {
  transform: translateY(-2px);
}

.reading-row p {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.35;
}

.reading-play {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.reading-row.is-current .reading-play {
  border-color: #1570ef;
  color: #1570ef;
}

.reading-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}

.reading-shortcuts {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.reading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reading-control-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.reading-control-button input {
  width: 18px;
  height: 18px;
  accent-color: #1570ef;
}

.score-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--soft);
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-band strong {
  font-size: 34px;
}

.status-pill {
  border-radius: 999px;
  padding: 7px 11px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-pill.good {
  color: var(--good);
}

.status-pill.warn {
  color: var(--warn);
}

.status-pill.bad {
  color: var(--bad);
}

.result-block {
  display: grid;
  gap: 8px;
}

.result-block h3 {
  font-size: 15px;
}

.diff-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  line-height: 1.6;
}

.diff-token {
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--soft);
  font-weight: 800;
}

.diff-token.ok {
  background: #e4f3e9;
  color: var(--good);
}

.diff-token.missing {
  background: #fde7e7;
  color: var(--bad);
}

.diff-token.extra {
  background: #fff0dc;
  color: var(--warn);
}

.diff-token.case {
  background: #e7edf9;
  color: var(--accent-3);
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--line);
}

.review-summary div {
  padding: 18px;
  background: white;
}

.review-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.review-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
}

.lesson-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid #b7dbd6;
  border-radius: 8px;
  padding: 16px;
  background: #f5fffc;
}

.review-focus-card {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.review-focus-heading p,
.review-focus-item p {
  color: var(--muted);
  line-height: 1.55;
}

.review-focus-heading {
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff3b8;
}

.review-focus-heading h3 {
  color: #315fba;
  font-size: 22px;
  margin-bottom: 4px;
}

.review-focus-list {
  display: grid;
  gap: 10px;
}

.review-category {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  overflow: hidden;
}

.review-category summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.review-category summary::-webkit-details-marker {
  display: none;
}

.review-category summary::before {
  content: "展开";
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef5ff;
  color: #315fba;
  font-size: 12px;
  font-weight: 900;
}

.review-category[open] summary::before {
  content: "折叠";
}

.review-category summary em {
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
}

.review-category-list {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.review-focus-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfe;
}

.review-focus-item > div:first-child {
  display: grid;
  gap: 4px;
}

.review-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.review-focus-exercise {
  display: grid;
  gap: 10px;
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  background: white;
  color: var(--muted);
  line-height: 1.55;
}

.review-focus-exercise strong,
.review-focus-item strong {
  color: var(--ink);
}

.review-question-text {
  color: var(--ink);
  font-weight: 500;
}

.review-focus-exercise > div > p:not(.review-answer-note):not(.exercise-target),
.review-focus-exercise > div > strong + p:not(.review-answer-note):not(.exercise-target) {
  color: var(--ink);
}

.review-focus-exercise div {
  display: grid;
  gap: 5px;
}

.review-focus-exercise .exercise-options,
.review-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.review-focus-exercise .exercise-option,
.review-options .exercise-option {
  width: 100%;
  text-align: left;
}

.review-translation-input {
  min-height: 68px;
  max-height: 92px;
  resize: vertical;
}

.review-answer-note {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
  margin-top: 8px;
}

.review-focus-exercise span {
  color: var(--accent-3);
}

.review-focus-exercise.is-error {
  border-left-color: var(--warn);
}

.summary-buddy {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.lesson-summary-card h3 {
  margin-bottom: 6px;
}

.lesson-summary-card p {
  color: var(--muted);
  line-height: 1.6;
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.summary-tags span {
  border-radius: 999px;
  padding: 5px 9px;
  background: white;
  color: var(--accent);
  font-weight: 800;
}

.wrong-list {
  display: grid;
  gap: 10px;
  min-height: 260px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.wrong-sentence-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.wrong-sentence-heading {
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff3b8;
}

.wrong-sentence-heading h3 {
  color: #315fba;
  font-size: 22px;
  margin-bottom: 4px;
}

.wrong-sentence-heading p {
  color: #6c5d1f;
  line-height: 1.5;
}

.wrong-sentence-list {
  display: grid;
  gap: 10px;
}

.wrong-item {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.wrong-item:hover {
  border-color: #bdd6d1;
  background: var(--soft-2);
}

.wrong-item strong {
  line-height: 1.5;
}

.wrong-item p {
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace-panel,
  .history-panel {
    position: static;
    padding: 18px;
  }

  .history-panel {
    height: auto;
    grid-template-rows: auto auto;
    max-height: none;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .history-records {
    grid-template-rows: auto auto;
  }

  .history-list {
    max-height: 280px;
  }

  .history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .step-item {
    justify-content: center;
  }

  .settings-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-panel .section-title,
  .settings-panel .toggle-row {
    grid-column: 1 / -1;
  }

  .upload-grid,
  .confirm-layout,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .text-import {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .main-panel {
    padding: 18px;
  }

  .screen-heading,
  .listen-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .step-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-panel,
  .review-summary,
  .history-list {
    grid-template-columns: 1fr;
  }

  .action-row,
  .action-row.compact {
    justify-content: stretch;
  }

  .action-row > button {
    flex: 1 1 140px;
  }
}
