.prescription-page {
  --prescription-amber: #9a6114;
  --prescription-amber-soft: #fff4dc;
  --prescription-blue: #27627a;
  --prescription-blue-soft: #e7f3f7;
  --prescription-ink-soft: #eef1eb;
}

.prescription-page .app-container {
  background: var(--bg-color);
}

.prescription-sidebar {
  width: 320px;
  background: var(--panel-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-right: 1px solid var(--border-color);
  box-shadow: none;
}

.prescription-sidebar::after {
  display: none;
}

@media (min-width: 769px) {
  .prescription-sidebar.collapsed {
    margin-left: -320px;
  }
}

.prescription-sidebar-header {
  padding: 14px 16px;
}

.prescription-sidebar-header .logo-text h1 {
  letter-spacing: 0;
}

.prescription-directory {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 16px;
}

.prescription-page .study-navigation {
  padding: 10px 16px 12px;
}

.prescription-filter-panel {
  margin: 10px 12px 6px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-color);
}

.prescription-filter-panel > summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.prescription-filter-panel > summary small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 500;
}

.prescription-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px 8px;
  padding: 4px 10px 10px;
  border-top: 1px solid var(--border-color);
}

.prescription-filter label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.prescription-filter select {
  width: 100%;
  min-height: 32px;
  padding: 4px 24px 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--panel-bg);
  color: var(--text-main);
  font: inherit;
  font-size: 0.7rem;
}

.prescription-filter button {
  grid-column: 2;
  justify-self: end;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--panel-bg);
  color: var(--text-muted);
  font-size: 0.68rem;
  cursor: pointer;
}

.directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px 7px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.directory-count {
  font-size: 0.7rem;
  font-weight: 500;
}

.directory-group {
  border-top: 1px solid var(--border-color);
}

.directory-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 7px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
}

.directory-group-summary small,
.directory-subgroup h3 small {
  font-size: 0.66rem;
  font-weight: 600;
}

.directory-group-content {
  padding-bottom: 5px;
}

.directory-subgroup {
  margin-bottom: 4px;
}

.directory-subgroup h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin: 0;
  padding: 5px 7px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.prescription-directory-item {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.prescription-directory-item:hover,
.prescription-directory-item.is-active {
  border-color: var(--border-color);
  background: var(--primary-light);
}

.directory-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.prescription-directory-item strong,
.prescription-directory-item small,
.prescription-directory-item em {
  display: block;
  letter-spacing: 0;
}

.directory-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.prescription-directory-item strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prescription-directory-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prescription-directory-item em {
  flex: 0 0 auto;
  padding: 1px 4px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-style: normal;
  line-height: 1.2;
}

.directory-empty {
  padding: 18px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.prescription-sidebar-note {
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-color);
  background: var(--prescription-ink-soft);
}

.prescription-sidebar-note strong,
.prescription-sidebar-note span {
  display: block;
}

.prescription-sidebar-note strong {
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.prescription-sidebar-note span {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

body.dark-theme .prescription-sidebar-note {
  background: #202a1f;
}

.prescription-main {
  min-width: 0;
}

.prescription-top-bar .view-switch-btn {
  margin-right: 0;
}

.prescription-scroll {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.prescription-lesson {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 10px 32px 36px;
}

.lesson-intro {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--text-main);
}

.lesson-kicker {
  margin-bottom: 2px;
  color: var(--primary-color);
  font-size: 0.74rem;
  font-weight: 800;
}

.lesson-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lesson-title-left {
  min-width: 0;
  flex: 1 1 auto;
}

.lesson-title-left h1 {
  margin: 0 0 2px;
  font-size: 1.65rem;
  line-height: 1.25;
}

.lesson-title-left p {
  margin: 0;
  max-width: 680px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.lesson-title-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 480px;
}

.method-card-compact {
  padding: 4px 10px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  background: var(--bg-color);
  text-align: right;
}

.method-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 2px;
}

.method-tag {
  color: var(--primary-color);
  font-size: 0.72rem;
  font-weight: 800;
}

.method-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.method-meta-line {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.method-audit {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-color);
}

/* 处方双页展示布局 (Prescription Dual Column Layout) */
.prescription-scroll.dual-column .prescription-lesson {
  width: min(1520px, calc(100% - 40px));
  max-width: 100%;
}

.prescription-scroll.dual-column #learn-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

.lesson-title-row h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.lesson-title-row p {
  max-width: 680px;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.7;
}

.lesson-status {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 260px;
}

.evidence-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.evidence-textbook {
  background: var(--primary-light);
  color: var(--primary-color);
}

.evidence-supplement {
  background: var(--prescription-amber-soft);
  border-color: #e4c07d;
  color: var(--prescription-amber);
}

.evidence-authority {
  background: var(--prescription-blue-soft);
  border-color: #9bc6d5;
  color: var(--prescription-blue);
}

body.dark-theme .evidence-supplement {
  background: #392a13;
  border-color: #6f5325;
  color: #f2c36b;
}

body.dark-theme .evidence-authority {
  background: #132c35;
  border-color: #285769;
  color: #91d0e4;
}

.study-mode-switch {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  margin-top: 24px;
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--prescription-ink-soft);
}

.mode-button {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--panel-bg);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

body.dark-theme .study-mode-switch {
  background: #202a1f;
}

.lesson-section {
  padding: 34px 0;
  border-bottom: 1px solid var(--border-color);
}

.method-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-color);
}

.method-strip-main > span,
.method-related > span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.method-strip-main strong {
  display: block;
  font-size: 0.94rem;
  line-height: 1.45;
}

.method-strip-main p,
.method-strip-main small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.method-audit {
  align-self: start;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--primary-color);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.method-audit-suspect {
  color: #8a5a13;
  border-color: #d8b66e;
}

.method-audit-error {
  color: #9b3d36;
  border-color: #d9a29d;
}

.method-related {
  grid-column: 1 / -1;
}

.method-related > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.method-related button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--panel-bg);
  color: var(--primary-color);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.method-related button:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-number {
  color: var(--primary-color);
  font-size: 0.72rem;
  font-weight: 800;
}

.section-heading h2 {
  font-size: 1.2rem;
  letter-spacing: 0;
}

.section-source {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: right;
}

.formula-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.formula-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  background: var(--panel-bg);
  font-size: 0.88rem;
}

.formula-table th,
.formula-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  line-height: 1.45;
}

.formula-table th {
  background: var(--prescription-ink-soft);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.formula-table tr:last-child td {
  border-bottom: 0;
}

.formula-table td:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body.dark-theme .formula-table th {
  background: #202a1f;
}

.process-flow {
  display: grid;
  gap: 0;
  list-style: none;
}

.process-flow li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 0 0 22px;
  position: relative;
}

.process-flow li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 40px;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.process-flow li > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--primary-color);
  border-radius: 50%;
  color: var(--primary-color);
  background: var(--panel-bg);
  font-size: 0.78rem;
  font-weight: 800;
  z-index: 1;
}

.process-flow strong {
  display: block;
  margin: 2px 0 5px;
  font-size: 0.92rem;
}

.process-flow p {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.reasoning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 22px;
}

.reasoning-item {
  padding: 18px 0;
  border-top: 2px solid var(--primary-color);
}

.reasoning-label {
  display: block;
  margin-bottom: 10px;
  color: var(--primary-color);
  font-size: 0.7rem;
  font-weight: 800;
}

.reasoning-item h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  letter-spacing: 0;
}

.reasoning-item p {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.analysis-workbench {
  display: grid;
  gap: 22px;
}

.analysis-workbench[hidden] {
  display: none;
}

.analysis-hero {
  padding: 24px 26px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-light), var(--panel-bg));
}

.analysis-hero span {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--primary-color);
  font-size: 0.72rem;
  font-weight: 800;
}

.analysis-hero h2 {
  margin-bottom: 8px;
  font-size: 1.32rem;
  letter-spacing: 0;
}

.analysis-hero p {
  max-width: 760px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.analysis-section {
  padding-top: 26px;
}

.analysis-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analysis-card {
  padding: 15px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
}

.analysis-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.analysis-card p,
.analysis-process p,
.analysis-exam-tips li,
.analysis-source-note {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.68;
}

.analysis-process {
  display: grid;
  gap: 10px;
  list-style: none;
}

.analysis-process li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-color);
}

.analysis-process li:last-child {
  border-bottom: 0;
}

.analysis-process li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.78rem;
  font-weight: 800;
}

.analysis-process strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.analysis-exam-tips {
  display: grid;
  gap: 10px;
  padding-left: 20px;
}

.analysis-source-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--prescription-amber);
  border-radius: 6px;
  background: var(--prescription-amber-soft);
}

.quality-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.quality-list {
  padding-left: 20px;
}

.quality-list li {
  margin-bottom: 12px;
  padding-left: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.quality-list strong {
  color: var(--text-main);
}

.authority-note {
  padding: 18px;
  border-left: 4px solid var(--prescription-blue);
  background: var(--prescription-blue-soft);
}

.authority-note span {
  display: block;
  margin-bottom: 8px;
  color: var(--prescription-blue);
  font-size: 0.7rem;
  font-weight: 800;
}

.authority-note p {
  color: #234651;
  font-size: 0.82rem;
  line-height: 1.7;
}

body.dark-theme .authority-note {
  background: #132c35;
}

body.dark-theme .authority-note p {
  color: #c6e2eb;
}

.transfer-list {
  border-top: 1px solid var(--border-color);
}

.transfer-list details {
  border-bottom: 1px solid var(--border-color);
}

.transfer-list summary {
  min-height: 54px;
  padding: 16px 34px 16px 4px;
  position: relative;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
}

.transfer-list summary::after {
  content: "+";
  position: absolute;
  right: 8px;
  top: 14px;
  color: var(--primary-color);
  font-size: 1.2rem;
}

.transfer-list details[open] summary::after {
  content: "−";
}

.transfer-list p {
  padding: 0 34px 18px 4px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.source-section {
  border-bottom: 0;
}

.source-issues {
  margin: 14px 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
}

.source-issues summary {
  padding: 12px 2px;
  color: #8a5a13;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.source-issues ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.source-issues li {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.6;
}

.source-list {
  display: grid;
  gap: 12px;
  list-style: none;
}

.source-list li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
}

.source-kind {
  display: inline-flex;
  justify-content: center;
  padding: 5px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
}

.source-kind-primary {
  background: var(--primary-light);
  color: var(--primary-color);
}

.source-kind-file {
  background: var(--prescription-amber-soft);
  color: var(--prescription-amber);
}

.source-kind-web {
  background: var(--prescription-blue-soft);
  color: var(--prescription-blue);
}

.source-list strong,
.source-list a {
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 700;
}

.source-list a {
  text-decoration-color: var(--prescription-blue);
  text-underline-offset: 3px;
}

.source-list p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.source-boundary {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--prescription-amber);
  background: var(--prescription-amber-soft);
  color: #6d4814;
  font-size: 0.78rem;
  line-height: 1.65;
}

body.dark-theme .source-kind-file,
body.dark-theme .source-boundary {
  background: #392a13;
  color: #f2c36b;
}

body.dark-theme .source-kind-web {
  background: #132c35;
  color: #91d0e4;
}

.exam-workbench {
  margin-top: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

.exam-source-strip {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.exam-paper {
  padding: 34px 42px 40px;
  border: 1px solid #9d9d96;
  background: #fff;
  color: #171713;
  font-family: "SimSun", "Songti SC", serif;
  box-shadow: 0 3px 12px rgba(32, 38, 29, 0.08);
}

.exam-paper-header {
  padding-bottom: 20px;
  text-align: center;
}

.exam-paper-header h2 {
  margin: 0 0 12px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0;
}

.exam-paper-header strong {
  display: block;
  font-size: 1.1rem;
}

.exam-paper-header p {
  margin-top: 10px;
  font-size: 0.78rem;
}

.exam-section-title {
  padding: 10px 0;
  border-top: 2px solid #20201c;
  border-bottom: 1px solid #20201c;
  font-size: 0.95rem;
  font-weight: 700;
}

.exam-question-block {
  padding-top: 18px;
}

.exam-question-stem {
  font-size: 0.94rem;
  line-height: 1.85;
}

.exam-question-stem > span {
  margin-right: 4px;
  font-weight: 700;
}

.exam-question-stem > strong {
  margin-right: 6px;
}

.exam-block-label {
  margin: 18px 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

.exam-prescription-table-wrap {
  overflow-x: auto;
}

.exam-prescription-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.exam-prescription-table th,
.exam-prescription-table td {
  padding: 7px 10px;
  border: 1px solid #55554f;
  text-align: left;
  line-height: 1.45;
}

.exam-prescription-table th {
  background: #f2f2ee;
  font-weight: 700;
}

.exam-subquestions {
  padding-left: 28px;
  list-style: none;
  counter-reset: exam-question;
}

.exam-subquestions li {
  counter-increment: exam-question;
  margin-bottom: 7px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.exam-subquestions li::before {
  content: "(" counter(exam-question) ") ";
}

body.dark-theme .exam-paper {
  border-color: #858980;
  background: #f4f4ef;
  color: #171713;
}

.exam-answer-area {
  margin-top: 20px;
  padding: 22px 24px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--panel-bg);
}

.exam-answer-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.exam-answer-heading strong {
  font-size: 1.05rem;
}

.exam-answer-heading span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.exam-workbench label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.exam-workbench textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-color);
  color: var(--text-main);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.7;
}

.exam-workbench textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.answer-key {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.answer-key h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.answer-key ol {
  padding-left: 22px;
}

.answer-key li {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.prescription-pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding-top: 28px;
}

.prescription-pager .btn {
  min-width: 0;
  min-height: 46px;
  justify-content: center;
}

.prescription-pager .btn:first-child {
  justify-self: start;
}

.prescription-pager .btn:last-child {
  justify-self: end;
}

.prescription-pager .btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@supports (height: 100dvh) {
  .prescription-scroll {
    flex: 1;
    min-height: 0;
    height: auto;
  }
}

@media (max-width: 900px) {
  .lesson-title-row,
  .analysis-list,
  .quality-layout {
    grid-template-columns: 1fr;
  }

  .lesson-title-row {
    display: grid;
  }

  .lesson-status {
    justify-content: flex-start;
    max-width: none;
  }

  .quality-layout {
    display: grid;
  }
}

@media (max-width: 768px) {
  .prescription-sidebar {
    width: min(88vw, 340px);
  }

  .prescription-scroll {
    flex: 1;
    min-height: 0;
    height: auto;
  }

  .prescription-lesson {
    padding: 22px 16px calc(54px + env(safe-area-inset-bottom));
  }

  .lesson-intro {
    padding-bottom: 22px;
  }

  .lesson-title-row h1 {
    font-size: 1.45rem;
  }

  .lesson-title-row p {
    font-size: 0.86rem;
  }

  .lesson-status {
    gap: 4px;
  }

  .study-mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.86rem;
  }

  .lesson-section {
    padding: 26px 0;
  }

  .method-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .method-audit {
    justify-self: start;
  }

  .method-related {
    grid-column: 1;
  }

  .section-heading {
    align-items: flex-end;
  }

  .section-heading h2 {
    font-size: 1.05rem;
  }

  .section-source {
    max-width: 42%;
  }

  .reasoning-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .formula-table th,
  .formula-table td {
    padding: 11px 12px;
  }

  .source-list li {
    grid-template-columns: 70px 1fr;
    gap: 10px;
  }

  .exam-workbench {
    margin-top: 20px;
  }

  .exam-paper {
    padding: 24px 16px 28px;
  }

  .exam-paper-header h2 {
    font-size: 1.05rem;
    line-height: 1.5;
  }

  .exam-prescription-table {
    min-width: 470px;
  }

  .exam-answer-area {
    padding: 18px 14px;
  }
}

@media (max-width: 430px) {
  .prescription-top-bar .top-bar-right {
    gap: 2px;
  }

  .prescription-top-bar .view-switch-btn,
  .prescription-top-bar .theme-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .prescription-top-bar .current-chapter-info span {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .section-source {
    max-width: none;
    padding-left: 28px;
    text-align: left;
  }

.prescription-pager .btn {
    width: 100%;
    padding-inline: 10px;
    font-size: 0.76rem;
  }
}

/* v240: keep the sidebar width consistent without changing prescription content spacing. */
.prescription-sidebar {
  width: var(--study-sidebar-width, 292px) !important;
  flex-basis: var(--study-sidebar-width, 292px) !important;
}

@media (min-width: 769px) {
  .prescription-sidebar.collapsed {
    margin-left: calc(-1 * var(--study-sidebar-width, 292px)) !important;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .prescription-sidebar {
    width: var(--study-sidebar-tablet-width, 246px) !important;
    flex-basis: var(--study-sidebar-tablet-width, 246px) !important;
  }

  .prescription-sidebar.collapsed {
    margin-left: calc(-1 * var(--study-sidebar-tablet-width, 246px)) !important;
  }
}

@media (max-width: 768px) {
  .prescription-sidebar {
    width: min(86vw, 320px) !important;
    flex-basis: auto !important;
  }
}
