:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #617082;
  --line: #d8dee7;
  --panel: #ffffff;
  --paper: #f4f6f8;
  --nav: #203142;
  --nav-2: #2f4659;
  --accent: #007d7e;
  --accent-2: #8a5a00;
  --danger: #a33a3a;
  --ok: #1f7a4c;
  --focus: #0c6bcb;
  --shadow: 0 10px 30px rgba(20, 31, 45, 0.12);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: #9aa9b8;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(12, 107, 203, 0.22);
  outline-offset: 1px;
}

button[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--nav);
  border-color: var(--nav);
  color: #fff;
}

.warning {
  background: #fff6e3;
  border-color: #d7a642;
  color: #5f3f00;
}

.danger {
  background: #fff2f2;
  border-color: #d58a8a;
  color: var(--danger);
}

.ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.app-shell {
  min-height: 100vh;
}

.loading-screen,
.home {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px;
}

.system-mark {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 4px;
  background: var(--nav);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.home-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.home h1,
.loading-screen h1 {
  margin: 14px 0 8px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.home p,
.loading-screen p {
  color: var(--muted);
  margin: 0;
}

.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.home-section {
  margin: 28px 0;
}

.section-title {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.section-title .meta {
  color: var(--muted);
  line-height: 1.45;
}

.exam-set-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.exam-set-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
  min-height: 270px;
}

.set-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.set-card-head h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.set-ratio {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.home-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 14px;
}

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

.settings-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.settings-list input[type="number"] {
  width: 70px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.module-card,
.result-panel,
.info-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.module-card {
  padding: 18px;
  display: grid;
  gap: 14px;
  min-height: 210px;
}

.module-card h2 {
  font-size: 18px;
  margin: 0;
  line-height: 1.3;
}

.module-card .meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-row.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-row.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric {
  min-height: 58px;
  border: 1px solid #e6ebf1;
  border-radius: 6px;
  padding: 8px;
  background: #fafbfc;
}

.metric strong {
  display: block;
  font-size: 20px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.exam {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.exam-topbar {
  background: var(--nav);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 12px 18px;
  min-height: 64px;
}

.top-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.top-title strong {
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-title span,
.top-stat span {
  font-size: 12px;
  color: #c9d4dd;
}

.top-stat {
  min-width: 92px;
  display: grid;
  gap: 3px;
  text-align: right;
}

.top-stat strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 160px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: #64c2b7;
}

.exam-main {
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.question-nav {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
}

.question-nav h3 {
  font-size: 14px;
  margin: 0 0 10px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.task-nav-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.sub-nav-title {
  margin-top: 18px !important;
}

.nav-cell {
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0;
  border-radius: 4px;
  font-size: 13px;
  background: #f8fafc;
}

.nav-cell.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.nav-cell.answered {
  border-color: var(--ok);
}

.nav-cell.marked {
  box-shadow: inset 0 -4px 0 #d7a642;
}

.nav-cell.mini {
  height: 32px;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 16px;
  min-height: 0;
}

.workspace.single {
  grid-template-columns: minmax(0, 1fr);
}

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
  overflow: auto;
}

.pane-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.pane-header h2 {
  font-size: 18px;
  margin: 0;
  line-height: 1.35;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-actions a,
.text-link {
  color: var(--focus);
  text-decoration: none;
  font-size: 13px;
}

.source-actions a:hover,
.text-link:hover {
  text-decoration: underline;
}

.text-content {
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.62;
  font-size: 15px;
}

.material-block {
  border-bottom: 1px solid #edf1f5;
  padding: 0 0 16px;
  margin: 0 0 16px;
}

.material-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.material-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.material-block p {
  margin: 0;
}

.material-text {
  white-space: pre-wrap;
}

.option-bank {
  display: grid;
  gap: 8px;
}

.option-chip {
  border: 1px solid #dfe7ef;
  border-radius: 6px;
  background: #fafcfd;
  padding: 8px 10px;
}

.transcript-box {
  margin-top: 10px;
  border: 1px solid #dfe7ef;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.transcript-box summary {
  cursor: pointer;
  color: var(--focus);
}

.transcript-box pre {
  white-space: pre-wrap;
  line-height: 1.5;
  font: inherit;
  margin: 10px 0 0;
  color: var(--muted);
}

.question-list {
  padding: 12px 16px 20px;
  display: grid;
  gap: 14px;
}

.question-block {
  border: 1px solid #e2e8ef;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.question-block h3 {
  font-size: 15px;
  line-height: 1.45;
  margin: 0 0 12px;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid #e6ebf1;
  border-radius: 6px;
  background: #fbfcfd;
}

.option input {
  margin-top: 2px;
}

.option span {
  line-height: 1.42;
}

.answer-input,
.essay-box,
.note-box {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 42px;
  line-height: 1.5;
}

.essay-box {
  min-height: 430px;
}

.note-box {
  min-height: 180px;
}

.exam-bottombar {
  min-height: 66px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bar-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.study-entry-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.study-entry-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.study-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 20px 48px;
}

.study-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.study-hero h1 {
  margin: 12px 0 8px;
  font-size: 32px;
  line-height: 1.15;
}

.study-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.study-tabs,
.speaking-top-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.study-tabs button,
.speaking-top-tabs button {
  background: #fff;
}

.study-tabs button.active,
.speaking-top-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.study-body {
  min-height: 420px;
}

.study-grid {
  display: grid;
  gap: 14px;
}

.study-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

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

.study-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.study-sidebar,
.study-card,
.phrase-card,
.drill-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.study-sidebar,
.study-card {
  padding: 16px;
}

.study-sidebar {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 12px;
}

.study-sidebar h2,
.study-card h2 {
  margin: 0;
  font-size: 20px;
}

.study-card h3,
.phrase-card h3,
.drill-card h3 {
  margin: 14px 0 8px;
  font-size: 15px;
}

.study-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.study-section {
  border-top: 1px solid #edf1f5;
  margin-top: 14px;
  padding-top: 14px;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.structure-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.structure-line span {
  border: 1px solid #dfe7ef;
  border-radius: 6px;
  padding: 7px 9px;
  background: #fafcfd;
  color: #314255;
  font-size: 13px;
}

.model-list {
  display: grid;
  gap: 8px;
  max-height: 62vh;
  overflow: auto;
}

.model-list button {
  height: auto;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.model-list button.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.model-list span {
  color: var(--muted);
  font-size: 12px;
}

.model-essay {
  white-space: pre-wrap;
  line-height: 1.62;
  border: 1px solid #e3e9f0;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.phrase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phrase-chips button {
  min-height: 32px;
  background: #f8fafc;
}

.phrase-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 10px;
  margin: 14px 0;
}

.phrase-toolbar input,
.phrase-toolbar select,
.study-sidebar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.phrase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.phrase-card,
.drill-card {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.phrase-card p,
.drill-card p {
  margin: 0;
  line-height: 1.5;
}

.analysis-list,
.drill-list,
.template-steps {
  display: grid;
  gap: 10px;
}

.analysis-card {
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  background: #fff;
}

.analysis-card summary {
  cursor: pointer;
  padding: 12px;
  line-height: 1.45;
}

.analysis-content {
  border-top: 1px solid #edf1f5;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.analysis-content p {
  margin: 0;
  line-height: 1.5;
}

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

.mini-columns section,
.template-steps section {
  border: 1px solid #e6ebf1;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.mini-columns h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.template-steps section p {
  margin: 6px 0;
  line-height: 1.5;
}

.writer-tools.slim {
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.reference-answer[hidden] {
  display: none;
}

.practice-split {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.practice-source-pane {
  min-width: 0;
}

.practice-source-hidden .practice-hideable {
  display: none;
}

.practice-source-hidden::after {
  content: "当前为默写模式，原文已隐藏。";
  display: block;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #c9d5e1;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.practice-side {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.writing-study-page {
  max-width: 1440px;
}

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

.writing-current-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.writing-current-bar h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.writing-current-bar p {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}

.writing-item-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}

.writing-item-pill {
  flex: 0 0 230px;
  min-height: 76px;
  height: auto;
  display: grid;
  gap: 4px;
  align-content: center;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border-color: #d6dee8;
  box-shadow: 0 4px 14px rgba(20, 31, 45, 0.06);
}

.writing-item-pill strong {
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.writing-item-pill span,
.writing-item-pill small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.writing-item-pill.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), 0 6px 18px rgba(0, 125, 126, 0.16);
  background: #f2fbfb;
}

.writing-study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 390px);
  gap: 22px;
  align-items: start;
}

.writing-content-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.writing-practice-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.writing-prompt-card,
.writing-model-answer-card,
.writing-template-card,
.writing-theme-card,
.writing-phrase-card,
.writing-analysis-card {
  padding: 18px;
}

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

.section-inline-head h3 {
  margin: 0;
}

.writing-model-essay {
  font-size: 16px;
  line-height: 1.78;
  padding: 16px;
}

.writing-meaning {
  margin-top: 12px;
  border: 1px solid #e4ebf2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.writing-meaning summary {
  cursor: pointer;
  color: var(--focus);
  font-weight: 700;
}

.writing-sentence-analysis-list {
  gap: 8px;
}

.writing-sentence-card {
  border-color: #dde7ef;
}

.writing-sentence-card summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.writing-sentence-card summary span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border-radius: 4px;
  background: #eef3f7;
  color: #314255;
  font-size: 12px;
  white-space: nowrap;
}

.writing-phrase-chip-list {
  gap: 8px;
}

.writing-search-row {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

.writing-phrase-list {
  display: grid;
  gap: 12px;
}

.writing-phrase-item {
  cursor: pointer;
}

.writing-phrase-item.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
  background: #f8fdfd;
}

.writing-linked-models {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.writing-linked-models button {
  min-height: 34px;
  background: #f8fafc;
}

.writing-copy-memory-panel .practice-box,
.writing-imitation-panel,
.writing-history-panel {
  box-shadow: var(--shadow);
}

.writing-copy-memory-panel .practice-reference {
  min-height: 96px;
  max-height: 180px;
}

.writing-copy-memory-panel .practice-input {
  min-height: 280px;
  resize: vertical;
}

.writing-imitation-panel,
.writing-history-panel {
  padding: 14px;
}

.writing-imitation-panel h3,
.writing-history-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.writing-imitation-panel p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.practice-box {
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.practice-box.compact {
  box-shadow: none;
  background: #fbfcfd;
}

.practice-box-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.practice-box-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.practice-modes,
.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-modes button {
  min-height: 34px;
  background: #f8fafc;
}

.practice-modes button.active {
  background: var(--nav);
  border-color: var(--nav);
  color: #fff;
}

.practice-mode-note,
.practice-hint {
  border: 1px solid #f0d38b;
  border-radius: 8px;
  padding: 10px;
  background: #fff8e8;
  color: #6b4a00;
  line-height: 1.5;
}

.practice-reference-panel {
  border: 1px solid #e2e8ef;
  border-radius: 8px;
  background: #fbfcfd;
  overflow: hidden;
}

.practice-reference-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid #e7edf3;
  background: #fff;
}

.practice-reference {
  min-height: 140px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 12px;
}

.practice-reference-panel.hidden-source .practice-reference {
  color: var(--muted);
  font-style: italic;
}

.practice-input {
  width: 100%;
  min-height: 260px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  line-height: 1.58;
  font-size: 15px;
  background: #fff;
}

.practice-box.compact .practice-input {
  min-height: 150px;
}

.practice-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.practice-compare {
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compare-grid h4 {
  margin: 0 0 8px;
}

.diff-text {
  white-space: normal;
  line-height: 1.9;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.diff-token {
  display: inline-block;
  border-radius: 4px;
  padding: 0 3px;
}

.diff-token.same {
  background: #e8f6ef;
  color: var(--ok);
}

.diff-token.missing {
  background: #fff3c4;
  color: #6b4a00;
}

.diff-token.extra {
  background: #e8f0ff;
  color: #1d4f91;
}

.practice-history summary {
  cursor: pointer;
  color: var(--focus);
}

.practice-submit {
  width: 100%;
}

.audio-player {
  border: 1px solid #d6e4e4;
  background: #f6fbfb;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.audio-player input[type="range"] {
  width: 100%;
}

.audio-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}

.audio-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.tts-player {
  border: 1px solid #d6e4e4;
  background: #f6fbfb;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.tts-head,
.tts-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  background: #eef3f7;
  color: #314255;
  font-size: 12px;
}

.tag.ok {
  background: #e8f6ef;
  color: var(--ok);
}

.tag.warn {
  background: #fff4d9;
  color: var(--accent-2);
}

.writer-tools,
.recorder-tools,
.timer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.counter {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.recorder-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.recorder-status {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--muted);
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  display: inline-block;
  margin-right: 8px;
  animation: pulse 1s infinite;
}

.speaking-entry-panel {
  border-left: 5px solid var(--accent);
}

.speaking-study-page {
  max-width: 1440px;
}

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

.speaking-current-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.speaking-current-bar h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.speaking-task-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}

.speaking-task-pill {
  flex: 0 0 210px;
  min-height: 76px;
  height: auto;
  display: grid;
  gap: 4px;
  align-content: center;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border-color: #d6dee8;
  box-shadow: 0 4px 14px rgba(20, 31, 45, 0.06);
}

.speaking-task-pill strong {
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.speaking-task-pill span,
.speaking-task-pill small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.speaking-task-pill.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), 0 6px 18px rgba(0, 125, 126, 0.16);
  background: #f2fbfb;
}

.speaking-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 390px);
  gap: 22px;
  align-items: start;
}

.speaking-content-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.speaking-practice-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.speaking-hero-card,
.speaking-image-card,
.speaking-model-answer-card,
.speaking-analysis-card,
.speaking-phrase-summary-card {
  padding: 18px;
}

.speaking-hero-card .study-section p {
  font-size: 16px;
  line-height: 1.62;
}

.speaking-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}

.speaking-sidebar .model-list {
  max-height: 70vh;
}

.speaking-detail-host {
  min-width: 0;
}

.speaking-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1fr) minmax(340px, 0.86fr);
  gap: 14px;
  align-items: start;
}

.speaking-task-card,
.speaking-analysis-card,
.speaking-practice-side {
  min-width: 0;
}

.speaking-practice-side {
  display: grid;
  gap: 12px;
}

.speaking-image-wrap {
  margin: 14px 0 0;
  border: 1px solid #dfe7ef;
  border-radius: 10px;
  background: #fbfcfd;
  padding: 12px;
}

.speaking-image-wrap figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.speaking-image {
  display: block;
  width: 100%;
  max-width: 720px;
  max-height: 560px;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
  background: #fff;
  margin: 0 auto;
}

.speaking-model-essay {
  font-size: 16px;
  line-height: 1.78;
  padding: 16px;
}

.speaking-meaning {
  margin-top: 12px;
  border: 1px solid #e4ebf2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.speaking-meaning summary {
  cursor: pointer;
  color: var(--focus);
  font-weight: 700;
}

.speaking-sentence-analysis-list {
  gap: 8px;
}

.speaking-sentence-card {
  border-color: #dde7ef;
}

.speaking-sentence-card summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.speaking-sentence-card summary span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border-radius: 4px;
  background: #eef3f7;
  color: #314255;
  font-size: 12px;
  white-space: nowrap;
}

.speaking-phrase-chip-list {
  gap: 8px;
}

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

.template-chip-list span {
  display: block;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
  line-height: 1.45;
  color: #314255;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 32, 0.82);
}

.image-modal img {
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

.image-modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.speaking-recorder {
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.speaking-recorder-compact .speaking-recorder {
  gap: 8px;
  box-shadow: var(--shadow);
}

.recorder-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.recorder-head h3 {
  margin: 0;
  font-size: 16px;
}

.recorder-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.speaking-recorder .recorder-tools {
  padding: 0;
  border-bottom: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.speaking-recorder .recorder-tools button,
.speaking-recorder .recorder-timers button {
  min-height: 36px;
  padding: 0 10px;
}

.speaking-recorder .recorder-status {
  min-height: 26px;
  font-size: 13px;
}

.speaking-recorder .recorder-timers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 13px;
}

.speaking-recorder audio,
.recording-history-card audio {
  width: 100%;
}

.speaking-copy-memory-panel .practice-box {
  box-shadow: var(--shadow);
}

.speaking-copy-memory-panel .practice-reference {
  min-height: 96px;
  max-height: 180px;
}

.speaking-copy-memory-panel .practice-input {
  min-height: 280px;
}

.practice-mini-card {
  min-width: 0;
}

.note-box.small {
  min-height: 86px;
  margin: 8px 0;
}

.recording-history-card {
  margin-top: 12px;
}

.phrase-chips .copied {
  border-color: var(--ok);
  color: var(--ok);
}

@keyframes pulse {
  50% {
    transform: scale(1.35);
    opacity: 0.5;
  }
}

.result-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px;
}

.result-page h1 {
  margin: 8px 0 16px;
  font-size: 30px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.review-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.review-section h2 {
  margin: 0;
}

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

.review-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.review-options {
  display: grid;
  gap: 6px;
}

.review-option {
  border: 1px solid #e6ebf1;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fafbfc;
}

.review-option.correct {
  border-color: rgba(31, 122, 76, 0.45);
  background: #edf8f2;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.rationale {
  margin: 0;
  padding: 10px;
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  color: #334155;
}

.result-panel,
.info-panel {
  padding: 16px;
}

.result-panel h2,
.info-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.error-screen {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px;
}

.error-screen pre {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

@media (max-width: 1040px) {
  .module-grid,
  .exam-set-grid,
  .result-grid,
  .study-grid.two,
  .phrase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .study-layout,
  .practice-split,
  .speaking-layout,
  .speaking-detail-grid,
  .speaking-main-layout,
  .writing-study-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-sidebar,
  .speaking-practice-sidebar,
  .writing-practice-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .home-header,
  .study-hero,
  .study-entry-panel,
  .exam-topbar,
  .exam-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .exam-topbar {
    gap: 8px;
  }

  .top-stat {
    text-align: left;
  }

  .progress-track {
    width: 100%;
  }

  .module-grid,
  .exam-set-grid,
  .home-two-col,
  .result-grid,
  .study-grid.two,
  .phrase-grid,
  .phrase-toolbar,
  .mini-columns,
    .compare-grid,
    .practice-split,
    .speaking-layout,
    .speaking-detail-grid,
    .speaking-main-layout,
    .speaking-current-bar,
    .writing-study-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .speaking-task-pill,
  .writing-item-pill {
    flex-basis: 168px;
  }

  .speaking-hero-card,
  .speaking-image-card,
  .speaking-model-answer-card,
  .speaking-analysis-card,
  .speaking-phrase-summary-card,
  .writing-prompt-card,
  .writing-model-answer-card,
  .writing-template-card,
  .writing-theme-card,
  .writing-phrase-card,
  .writing-analysis-card {
    padding: 14px;
  }

  .speaking-image {
    max-width: 100%;
  }

  .speaking-recorder .recorder-tools,
  .speaking-recorder .recorder-timers {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-row.four,
  .metric-row.five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-nav {
    max-height: 150px;
  }

  .exam-bottombar {
    align-items: stretch;
    flex-direction: column;
  }

  .bar-group {
    width: 100%;
  }

  .bar-group button {
    flex: 1 1 auto;
  }

  .audio-player {
    grid-template-columns: minmax(0, 1fr);
  }
}
