.exam-page {
  --exam-sidebar-width: 272px;
}

.exam-main {
  min-width: 0;
}

.exam-answer-text .textbook-source-point {
  padding-left: 1.4em;
  text-indent: -1.4em;
}

.exam-answer-text .textbook-source-marker {
  white-space: nowrap;
}

.trends-table caption {
  text-align: left;
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 0.82rem;
}

.matrix-cell.cell-locked {
  color: var(--text-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.exam-sidebar {
  position: relative;
  z-index: 210;
  width: var(--exam-sidebar-width);
  height: 100%;
  flex: 0 0 var(--exam-sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: var(--panel-bg);
  transition: margin-left 0.24s ease;
}

.exam-sidebar.collapsed {
  margin-left: calc(-1 * var(--exam-sidebar-width));
}

.exam-sidebar-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.exam-sidebar-header strong,
.exam-sidebar-header span {
  display: block;
}

.exam-sidebar-header strong {
  font-size: 0.96rem;
}

.exam-sidebar-header span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.exam-sidebar-header button {
  width: 40px;
  height: 40px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.exam-sidebar-header button:hover,
.exam-sidebar-header button:focus-visible {
  background: var(--primary-light);
  color: var(--primary-color);
}

.exam-sidebar-header svg {
  width: 18px;
  height: 18px;
}

.exam-sidebar-content {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px 24px;
}

.exam-filter-group {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.exam-filter-group:last-child {
  border-bottom: 0;
}

.exam-filter-group h3 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.exam-sidebar-options {
  display: grid;
  gap: 4px;
}

.exam-sidebar-options button {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-sidebar-options button[data-vip-badge="locked"]::after {
  content: "👑🔒";
  font-size: 0.8rem;
  letter-spacing: -1px;
  margin-left: 6px;
  opacity: 0.88;
}

.exam-sidebar-options button[data-vip-badge="unlocked"]::after {
  content: "👑";
  font-size: 0.8rem;
  margin-left: 6px;
  filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.45));
}

.exam-sidebar-options button[data-year-badge="locked"]::after {
  content: "🔒";
  font-size: 0.78rem;
  margin-left: 6px;
  opacity: 0.82;
}

.exam-sidebar-options button.is-vip-locked {
  color: var(--text-muted);
}

.exam-sidebar-options button.is-vip-locked:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

.exam-sidebar-options button:hover,
.exam-sidebar-options button:focus-visible {
  background: var(--bg-color);
}

.exam-sidebar-options button[aria-pressed="true"] {
  border-color: var(--border-color);
  background: var(--primary-light);
  color: var(--primary-color);
}

.exam-sidebar-overlay {
  display: none;
}

.exam-page-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.exam-page-heading span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.exam-scroll {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.exam-results {
  width: min(940px, calc(100% - 40px));
  margin-inline: auto;
  padding: 30px 0 72px;
}

.exam-results-heading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border-color);
}

.exam-title-block,
#exam-result-title,
#exam-result-kicker,
#exam-result-count {
  display: none !important;
}

.exam-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.exam-view-mode-switch {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #eef5ec;
}

.exam-view-mode-switch .mode-button {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
}

.exam-view-mode-switch .mode-button.active,
.exam-view-mode-switch .mode-button.is-active {
  background: var(--panel-bg);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.exam-export-pdf-btn {
  gap: 5px;
  min-width: 64px;
}

.exam-export-pdf-btn span {
  font-weight: 800;
  letter-spacing: 0;
}

/* 导出试卷与答案设置弹窗 (Export Modal) */
.exam-export-modal {
  max-width: 520px;
}

.exam-export-option-card {
  user-select: none;
}

.exam-export-option-card:hover {
  border-color: var(--primary-color) !important;
}

.exam-export-option-card.is-active {
  border-color: var(--primary-color) !important;
  background: color-mix(in srgb, var(--primary-color) 8%, var(--card-bg, #fff)) !important;
  box-shadow: 0 0 0 1px var(--primary-color);
}

body.dark-theme .exam-export-option-card {
  background: #1c261e !important;
  border-color: #2e3e31 !important;
}

body.dark-theme .exam-export-option-card.is-active {
  background: #253928 !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 1px var(--primary-color);
}

body.dark-theme .exam-export-target-info {
  background: #1d2a1f !important;
  border-color: #2e4431 !important;
}

body.dark-theme .exam-view-mode-switch {
  background: #202a1f;
}

.exam-scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 13px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #eef5ec;
  color: var(--text-color);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
}

.exam-scope-btn span {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  letter-spacing: normal;
}

.exam-scope-btn i,
.exam-scope-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  color: inherit;
}

.exam-scope-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.exam-scope-btn.active,
.exam-scope-btn.is-active {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.25);
}

.exam-scope-btn.active span,
.exam-scope-btn.is-active span {
  color: #ffffff !important;
}

.exam-scope-btn.active i,
.exam-scope-btn.active svg,
.exam-scope-btn.is-active i,
.exam-scope-btn.is-active svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.exam-scope-btn.active:hover,
.exam-scope-btn.is-active:hover {
  background: var(--primary-color) !important;
  color: #ffffff !important;
  opacity: 0.95;
}

body.dark-theme .exam-scope-btn {
  background: #202a1f;
  color: var(--text-muted);
  border-color: var(--border-color);
}

body.dark-theme .exam-scope-btn:hover {
  color: var(--primary-light, #81c784);
  border-color: var(--primary-light, #81c784);
}

body.dark-theme .exam-scope-btn.active,
body.dark-theme .exam-scope-btn.is-active {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #ffffff !important;
}

body.dark-theme .exam-scope-btn.active span,
body.dark-theme .exam-scope-btn.is-active span {
  color: #ffffff !important;
}

body.dark-theme .exam-scope-btn.active i,
body.dark-theme .exam-scope-btn.active svg,
body.dark-theme .exam-scope-btn.is-active i,
body.dark-theme .exam-scope-btn.is-active svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.exam-part-header {
  margin: 32px 0 16px;
  padding: 12px 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.08) 0%, rgba(46, 125, 50, 0.02) 100%);
  border-left: 4px solid var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exam-part-header:first-child {
  margin-top: 10px;
}

.exam-part-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exam-part-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.exam-part-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-color);
}

.exam-part-score {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--panel-bg);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

body.dark-theme .exam-part-header {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.12) 0%, rgba(76, 175, 80, 0.04) 100%);
}

#exam-result-kicker,
#exam-result-count {
  display: none !important;
}

.exam-title-block span {
  color: var(--primary-color);
  font-size: 0.72rem;
  font-weight: 800;
}

.exam-results-heading h1 {
  margin: 0;
  font-size: clamp(1.42rem, 3.2vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.exam-paper-cover {
  margin-top: 18px;
  padding: 34px 42px 18px;
  border: 1px solid #9d9d96;
  border-bottom: 0;
  background: #fff;
  color: #171713;
  font-family: "SimSun", "Songti SC", serif;
  text-align: center;
  box-shadow: 0 3px 12px rgba(32, 38, 29, 0.08);
}

.exam-paper-cover-meta {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
  color: #4d684c;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 800;
}

.exam-paper-cover h2 {
  margin: 0 0 12px;
  font-size: 1.32rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.exam-paper-cover strong {
  display: block;
  font-size: 1.08rem;
}

.exam-paper-cover p {
  margin: 10px 0 0;
  font-size: 0.78rem;
}

.exam-paper-mode #exam-question-groups,
.exam-answer-mode #exam-question-groups {
  padding: 0 42px 40px;
  border: 1px solid #9d9d96;
  border-top: 0;
  background: #fff;
  color: #171713;
  font-family: "SimSun", "Songti SC", serif;
  box-shadow: 0 3px 12px rgba(32, 38, 29, 0.08);
}

.exam-paper-mode .exam-paper-section:first-child,
.exam-answer-mode .exam-paper-section:first-child {
  padding-top: 0;
}

.exam-paper-mode .exam-paper-section > header,
.exam-answer-mode .exam-paper-section > header {
  padding-top: 12px;
  border-top: 2px solid #20201c;
  border-bottom: 1px solid #20201c;
}

.exam-paper-mode .exam-section-heading,
.exam-paper-mode .exam-question-text,
.exam-paper-mode .exam-options,
.exam-paper-mode .exam-question-index,
.exam-answer-mode .exam-section-heading,
.exam-answer-mode .exam-question-text,
.exam-answer-mode .exam-options,
.exam-answer-mode .exam-question-index {
  color: #171713;
}

.exam-paper-mode .exam-question-item {
  border-bottom: 0;
}

.exam-answer-mode .exam-question-item {
  border-bottom: 1px dashed rgba(32, 32, 28, 0.22);
}

.exam-answer-mode .exam-question-item:last-child {
  border-bottom: 0;
}

.exam-paper-mode .exam-question-index,
.exam-answer-mode .exam-question-index {
  font-size: 0.94rem;
}

.exam-paper-mode .exam-question-text,
.exam-paper-mode .exam-options li,
.exam-answer-mode .exam-question-text,
.exam-answer-mode .exam-options li {
  font-size: 0.94rem;
  line-height: 1.85;
}

.exam-paper-mode .exam-prescription-table,
.exam-answer-mode .exam-prescription-table {
  color: #171713;
  font-size: 0.92rem;
}

.exam-paper-mode .exam-prescription-table th,
.exam-paper-mode .exam-prescription-table td,
.exam-answer-mode .exam-prescription-table th,
.exam-answer-mode .exam-prescription-table td {
  border-color: #555;
}

.exam-paper-mode .exam-prescription-table th,
.exam-answer-mode .exam-prescription-table th {
  background: #f2f2ed;
}

.exam-paper-mode .exam-options,
.exam-answer-mode .exam-options {
  margin-top: 8px;
  padding-left: 0;
  list-style: none;
}

.exam-paper-mode .exam-answer-block,
.exam-paper-mode .exam-question-chapter {
  display: none !important;
}

.exam-answer-mode .exam-answer-block {
  margin-left: 2rem;
  margin-top: 10px;
}

.exam-answer-mode .exam-answer-details {
  border-top: 1px dashed rgba(32, 32, 28, 0.22);
}

.exam-answer-mode .exam-answer-details summary {
  color: #1b5e20;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-sans, system-ui, sans-serif);
}

.exam-answer-mode .exam-answer-text {
  color: #171713;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 0.94rem;
  line-height: 1.85;
}

.exam-answer-mode .exam-question-chapter {
  margin-top: 8px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.7rem;
  background: #f7f9f6;
  border-color: #d1d9cf;
  color: #4a5d48;
}

body.dark-theme .exam-paper-cover,
body.dark-theme.exam-paper-mode #exam-question-groups,
body.dark-theme.exam-answer-mode #exam-question-groups {
  border-color: #858980;
  background: #f4f4ef;
  color: #171713;
}

.exam-paper-section {
  padding-top: 30px;
}

.exam-paper-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 10px;
  border-bottom: 2px solid var(--text-main);
}

.exam-paper-section > header span {
  display: none;
}

.exam-section-heading {
  margin: 0;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.5;
}

.exam-question-item {
  display: grid;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px dashed var(--border-color);
}

.exam-question-line {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 10px;
}

.exam-question-index {
  color: var(--primary-color);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.75;
}

.exam-question-content {
  min-width: 0;
}

.exam-question-heading {
  display: block;
}

.exam-question-text {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.75;
  white-space: pre-line;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
}

.exam-prescription-question {
  white-space: normal;
}

.exam-prescription-question p {
  margin: 0 0 8px;
}

.exam-prescription-stem {
  font-weight: 700;
}

.exam-prescription-label {
  margin: 12px 0 6px !important;
  font-weight: 850;
}

.exam-prescription-formula-text {
  font-weight: 650;
  line-height: 1.8;
}

.exam-prescription-table {
  width: 100%;
  margin: 8px 0 12px;
  border-collapse: collapse;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.55;
}

.exam-prescription-table th,
.exam-prescription-table td {
  padding: 8px 10px;
  border: 1px solid rgba(32, 32, 28, 0.58);
  text-align: left;
  vertical-align: top;
}

.exam-prescription-table th {
  background: rgba(47, 103, 46, 0.08);
  font-weight: 850;
}

.exam-prescription-table th:first-child,
.exam-prescription-table td:first-child {
  width: 56%;
}

.exam-prescription-prompts {
  margin: 4px 0 0 1.45rem;
  padding-left: 1rem;
  font-weight: 600;
  line-height: 1.9;
}

/* 答案中的三列教材处方：为用量保留空间，避免手机上数值与单位被挤开。 */
.exam-answer-text .exam-answer-formula-table {
  table-layout: fixed;
}

.exam-answer-text .exam-answer-formula-table th:first-child,
.exam-answer-text .exam-answer-formula-table td:first-child {
  width: 40%;
}

.exam-answer-text .exam-answer-formula-table th:nth-child(2),
.exam-answer-text .exam-answer-formula-table td:nth-child(2) {
  width: 24%;
}

.exam-prescription-prompts li {
  margin-bottom: 4px;
  padding-left: 3px;
}

.exam-question-chapter {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 7px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.exam-question-chapter svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.exam-options {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-main);
  font-size: 0.86rem;
  line-height: 1.7;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 14px;
}

.exam-options li {
  padding: 5px 9px;
  border: 1px solid rgba(47, 103, 46, 0.1);
  border-radius: 8px;
  background: rgba(47, 103, 46, 0.035);
}

.exam-options li + li {
  margin-top: 0;
}

.exam-options-missing {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.65;
}

.exam-paper-mode .exam-options-missing,
.exam-answer-mode .exam-options-missing {
  color: #666;
  font-size: 0.82rem;
  font-weight: 400;
}

.matching-question .exam-question-line {
  grid-template-columns: 2rem minmax(0, 1fr);
}

.exam-matching-board {
  display: grid;
  gap: 14px;
}

.exam-matching-group {
  padding: 12px;
  border: 1px solid rgba(47, 103, 46, 0.14);
  border-radius: 8px;
  background: rgba(47, 103, 46, 0.035);
}

.exam-matching-group header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.exam-matching-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(47, 103, 46, 0.12);
  color: var(--primary-color);
  font-size: 0.72rem;
  font-weight: 800;
}

.exam-matching-title {
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.5;
}

.exam-matching-columns {
  display: grid;
  grid-template-columns: minmax(150px, 0.82fr) minmax(260px, 1.18fr);
  gap: 12px;
  align-items: start;
}

.exam-matching-options,
.exam-matching-prompts {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-matching-options li,
.exam-matching-prompts li {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.55;
}

.exam-matching-options li {
  padding: 6px 8px;
  border-radius: 7px;
  background: #ffffff;
}

.exam-matching-prompts li {
  padding: 5px 0;
}

.exam-matching-option-key,
.exam-matching-prompt-number {
  min-width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 850;
  line-height: 1;
}

.exam-matching-option-key {
  background: #ecf7ef;
  color: var(--primary-color);
}

.exam-matching-prompt-number {
  background: #fff1e8;
  color: #f05a28;
}

.exam-answer-block {
  margin-left: 2rem;
}

.exam-answer-details {
  border-top: 1px dashed var(--border-color);
}

.exam-answer-details summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.exam-answer-details summary::-webkit-details-marker {
  display: none;
}

.exam-answer-details summary svg,
.exam-answer-missing svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.exam-answer-text {
  padding: 12px 0 4px;
  font-size: 0.92rem;
  line-height: 1.82;
  color: var(--text-main);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.exam-answer-text p {
  margin: 0 0 9px;
}

.exam-answer-text h3,
.exam-answer-text h4 {
  margin: 14px 0 8px;
  color: var(--text-main);
  font-weight: 850;
  line-height: 1.35;
}

.exam-answer-text h3 {
  font-size: 1rem;
}

.exam-answer-text h4 {
  font-size: 0.92rem;
}

.deeptutor-evidence-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 10px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.78rem;
  line-height: 1.4;
  border: 1px solid var(--border-color);
}

.deeptutor-evidence-status-full {
  color: #166534;
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.deeptutor-evidence-status-partial {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.deeptutor-evidence-status-no-support,
.answer-support-warning {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.deeptutor-missing-evidence {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--bg-color);
  border: 1px dashed var(--border-color);
}

.deeptutor-missing-evidence summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 750;
}

.answer-support-warning {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid #fecaca;
}

.exam-answer-text ul,
.exam-answer-text ol {
  padding-left: 22px;
  margin: 8px 0;
}

.exam-answer-text li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.exam-answer-text strong {
  font-weight: 800;
}

.exam-answer-text .answer-structure-label {
  display: inline-block;
  font-weight: 800;
  color: var(--primary-color);
  margin-right: 4px;
}

.exam-answer-text .answer-line {
  display: block;
}

.exam-answer-text .answer-point {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.exam-answer-text .answer-subpoint {
  margin-left: 18px;
}

.exam-answer-text .answer-point-marker {
  min-width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  border-radius: 7px;
  background: #fff1e8;
  color: #f05a28;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
  padding-inline: 3px;
}

.exam-answer-text .answer-subexample {
  margin: 6px 0 8px 12px;
  padding: 6px 12px;
  background: var(--bg-color);
  border-left: 3px solid var(--primary-color);
  border-radius: 4px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.exam-answer-text .answer-section-header {
  margin: 16px 0 8px;
  font-size: 0.98rem;
  font-weight: 850;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-answer-text .answer-section-header .answer-section-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary-color) 12%, transparent);
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 800;
}

.exam-answer-text .answer-section-header .section-title-text {
  color: var(--text-main);
}

.exam-answer-text .answer-subheading-line {
  margin: 6px 0 7px;
}

.exam-answer-text .answer-point-marker.marker-sub {
  min-width: 1.3rem;
  height: 1.3rem;
  font-size: 0.74rem;
  background: color-mix(in srgb, var(--primary-color) 8%, var(--bg-color));
  color: var(--primary-color);
}

.exam-mcq-answer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 10px 14px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--primary-color) 5%, var(--card-bg, #fff));
  border: 1px solid color-mix(in srgb, var(--primary-color) 20%, var(--border-color));
}

.answer-mcq-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.answer-mcq-badge .badge-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.answer-mcq-badge .badge-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.96rem;
  font-weight: 850;
  letter-spacing: 0.5px;
}

.answer-mcq-exp {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-main);
}

.exam-answer-missing {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.exam-provenance {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
}

.exam-provenance p {
  display: flex;
  gap: 7px;
  margin: 0;
  line-height: 1.5;
}

.exam-provenance strong {
  color: var(--text-main);
}

.exam-provenance span {
  overflow-wrap: anywhere;
}

.exam-empty {
  padding: 72px 20px;
  color: var(--text-muted);
  text-align: center;
}

.exam-empty svg {
  width: 34px;
  height: 34px;
}

.exam-empty h2 {
  margin: 12px 0 6px;
  color: var(--text-main);
  font-size: 1rem;
}

.exam-empty p {
  margin: 0;
  font-size: 0.78rem;
}

@page {
  size: A4;
  margin: 15mm 13mm;
}

@media print {
  html,
  body,
  .app-container,
  .exam-main {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.exam-printing-paper {
    background: #fff !important;
  }

  body.exam-printing-paper .exam-sidebar,
  body.exam-printing-paper .exam-sidebar-overlay,
  body.exam-printing-paper .sidebar-toggle-trigger,
  body.exam-printing-paper .top-bar,
  body.exam-printing-paper .exam-results-heading,
  body.exam-printing-paper #pwa-status,
  body.exam-printing-paper .exam-empty,
  body.exam-printing-paper .exam-answer-block,
  body.exam-printing-paper .exam-question-chapter,
  body.exam-printing-paper .discussion-widget,
  body.exam-printing-paper .feedback-widget,
  body.exam-printing-paper .install-card,
  body.exam-printing-paper .global-settings-panel,
  body.exam-printing-paper .pwa-install-panel {
    display: none !important;
  }

  body.exam-printing-paper .app-shell,
  body.exam-printing-paper .main-panel,
  body.exam-printing-paper .exam-scroll,
  body.exam-printing-paper .exam-results {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.exam-printing-paper .exam-paper-cover,
  body.exam-printing-paper #exam-question-groups {
    border: 0 !important;
    box-shadow: none !important;
  }

  body.exam-printing-paper .exam-paper-cover {
    display: block !important;
    margin: 0 0 8mm !important;
    padding: 0 0 6mm !important;
  }

  body.exam-printing-paper #exam-question-groups {
    padding: 0 !important;
  }

  body.exam-printing-paper .exam-paper-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  body.exam-printing-paper .exam-paper-section > header {
    padding-top: 6mm !important;
  }

  body.exam-printing-paper .exam-question-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

@media (max-width: 768px) {
  .exam-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 310px);
    max-width: 100%;
    margin-left: 0;
    padding-top: env(safe-area-inset-top);
    box-shadow: var(--shadow-lg);
    transform: translateX(0);
    transition: transform 0.24s ease;
  }

  .exam-sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-100%);
  }

  .exam-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 30, 20, 0.32);
  }

  .exam-sidebar-overlay.open {
    display: block;
  }

  .exam-sidebar-header {
    min-height: 64px;
  }

  .exam-scroll {
    flex: 1;
    min-height: 0;
    height: auto;
  }

  .exam-page-heading span {
    display: none;
  }

  .exam-results {
    width: calc(100% - 18px);
    padding: 14px 12px 24px;
  }

  .exam-results-heading {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .exam-results-heading > div:first-child {
    min-width: 0;
  }

  #toggle-layout-btn {
    display: none !important;
  }

  .exam-heading-actions {
    display: flex;
  }

  .exam-results-heading h1 {
    margin: 0;
    font-size: clamp(1.22rem, 5.4vw, 1.48rem);
    line-height: 1.18;
    letter-spacing: 0;
  }

  .exam-paper-section {
    padding-top: 18px;
  }

  .exam-section-heading {
    font-size: 0.92rem;
  }

  .exam-question-line {
    grid-template-columns: 1.9rem minmax(0, 1fr);
    gap: 8px;
  }

  .exam-question-text {
    font-size: 0.93rem;
    line-height: 1.7;
  }

  .exam-question-chapter {
    max-width: 100%;
  }

  .exam-options {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .exam-matching-group {
    padding: 10px;
  }

  .exam-matching-columns {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .exam-matching-options,
  .exam-matching-prompts {
    gap: 5px;
  }

  .exam-matching-options li,
  .exam-matching-prompts li {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .exam-answer-block {
    margin-left: 1.9rem;
  }

  .exam-answer-text .answer-subpoint {
    margin-left: 10px;
  }
}

/* 铺满全屏的双栏试卷网格布局 (Dual-Column Standard Test Paper Layout) */
.exam-section-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exam-scroll.dual-column #exam-question-groups {
  display: flex !important;
  flex-direction: column !important;
  gap: 36px !important;
}

.exam-scroll.dual-column .exam-results {
  width: min(1480px, calc(100% - 48px)) !important;
  max-width: 100% !important;
}

.exam-scroll.dual-column .exam-section-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 24px 32px !important;
  align-items: start !important;
}

@media (max-width: 900px) {
  .exam-scroll.dual-column .exam-section-grid {
    grid-template-columns: 1fr !important;
  }
}

/* v238: unified tablet/sidebar density and calmer exam layout. */
.exam-page {
  --exam-sidebar-width: var(--study-sidebar-width, 292px);
}

.exam-results {
  padding-top: 16px;
}

@media (min-width: 769px) and (max-width: 1180px) {
  .exam-page {
    --exam-sidebar-width: var(--study-sidebar-tablet-width, 246px);
  }

  .exam-sidebar {
    width: var(--exam-sidebar-width) !important;
    flex-basis: var(--exam-sidebar-width) !important;
  }

  .exam-sidebar.collapsed {
    margin-left: calc(-1 * var(--exam-sidebar-width)) !important;
  }

  .exam-sidebar .exam-sidebar-content {
    padding: 8px 10px 18px !important;
    gap: 10px !important;
  }

  .exam-filter-group {
    padding: 10px 0;
  }

  .exam-sidebar-options button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .exam-results,
  .exam-scroll.dual-column .exam-results {
    width: min(980px, calc(100% - 28px)) !important;
    padding: 14px 0 46px !important;
  }

  .exam-results-heading {
    padding-bottom: 10px;
  }

  .exam-results-heading h1 {
    font-size: clamp(1.24rem, 2.6vw, 1.62rem);
  }

  .exam-paper-section {
    padding-top: 18px;
  }

  .exam-section-grid,
  .exam-scroll.dual-column .exam-section-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .exam-scroll.dual-column #exam-question-groups {
    gap: 22px !important;
  }

  .exam-question-item {
    gap: 9px;
    padding: 14px 0;
  }

  .exam-question-text {
    font-size: 0.92rem;
    line-height: 1.68;
  }

  .exam-options {
    gap: 5px;
    margin-top: 8px;
  }
}

@media (max-width: 768px) {
  .exam-results {
    width: calc(100% - 10px) !important;
    padding: 8px 5px 22px !important;
  }

  .exam-results-heading {
    padding-bottom: 8px;
    flex-wrap: wrap;
  }

  .exam-heading-actions,
  .exam-view-mode-switch {
    width: 100%;
  }

  .exam-view-mode-switch .mode-button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 8px;
  }

  .exam-paper-cover {
    margin-top: 12px;
    padding: 24px 18px 14px;
  }

  .exam-paper-cover-meta {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 20px;
  }

  .exam-paper-mode #exam-question-groups,
  .exam-answer-mode #exam-question-groups {
    padding: 0 18px 28px;
  }

  .exam-paper-section {
    padding-top: 14px;
  }

  .exam-section-grid {
    gap: 8px;
  }

  .exam-question-item {
    padding: 12px 0;
  }
}


/* ==========================================================================
   Exam Trends & Chapter Distribution Heatmap (历年真题规律与章节分布)
   ========================================================================== */

.exam-trends-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 8px 10px;
  min-height: 38px;
  border-radius: 6px;
  border: none !important;
  background: transparent !important;
  color: #eab308;
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
  transition: opacity 0.18s ease, filter 0.18s ease;
  box-shadow: none !important;
  text-align: left;
}

.exam-trends-nav-btn:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f59e0b;
  filter: brightness(1.12);
  transform: none;
}

.exam-trends-nav-btn.active,
.exam-trends-nav-btn.is-active,
.exam-trends-nav-btn[aria-pressed="true"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f59e0b;
  filter: brightness(1.15);
}

.exam-trends-nav-btn svg {
  display: none;
}

.trends-btn-label {
  font-weight: 850;
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.trends-fire-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.exam-trends-nav-btn:hover .trends-fire-icon {
  transform: scale(1.18);
}

body.dark-theme .exam-trends-nav-btn {
  border: none !important;
  background: transparent !important;
  color: #facc15;
}

body.dark-theme .exam-trends-nav-btn:hover {
  border: none !important;
  background: transparent !important;
  color: #fde047;
}

body.dark-theme .exam-trends-nav-btn.active,
body.dark-theme .exam-trends-nav-btn.is-active,
body.dark-theme .exam-trends-nav-btn[aria-pressed="true"] {
  border: none !important;
  background: transparent !important;
  color: #fef08a;
}

/* ==========================================================================
   历年真题规律与章节分布（横纵图 · 全屏满宽极简设计）
   ========================================================================== */

/* Full-Screen Override when in Trends Mode */
body.is-trends-mode .exam-scroll {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

body.is-trends-mode .exam-results,
body.is-trends-mode .exam-scroll.dual-column .exam-results {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 10px 16px 12px !important;
  box-sizing: border-box !important;
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

body.is-trends-mode .exam-results-heading,
body.is-trends-mode #exam-question-groups,
body.is-trends-mode #exam-paper-cover {
  display: none !important;
}

/* Trends Container */
.exam-trends-container {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeInTrends 0.2s ease-out;
}

@keyframes fadeInTrends {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Minimal Top Controls Bar */
.trends-top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.trends-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.trends-controls-primary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trends-controls-secondary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.trends-pill-group {
  display: inline-flex;
  align-items: center;
  background: var(--hover-bg, rgba(0, 0, 0, 0.04));
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}

.trends-pill-btn {
  border: none;
  background: transparent;
  padding: 4px 11px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.trends-pill-btn:hover {
  color: var(--text-main);
}

.trends-pill-btn.active,
.trends-pill-btn.is-active {
  background: var(--card-bg, #fff);
  color: var(--primary-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.trends-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
  margin: 0 2px;
}

.trends-control-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-left: auto;
}

.trends-legend-simple {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.t-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.t-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}
.dot-none { background: #e2e8f0; }
.dot-1 { background: #93c5fd; }
.dot-2 { background: #f59e0b; }
.dot-3 { background: #ef4444; }

.trends-search-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--hover-bg, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 4px 10px;
  width: 160px;
  transition: width 0.2s ease, border-color 0.2s ease;
}

.trends-search-mini:focus-within {
  width: 210px;
  border-color: var(--primary-color);
  background: var(--card-bg, #fff);
}

.trends-search-mini input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.76rem;
  color: var(--text-main);
  width: 100%;
}

.trends-search-mini input::placeholder {
  color: var(--text-muted);
}

.trends-search-clear {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0 2px;
}

/* ==========================================================================
   横纵图主画布 (Matrix Grid / Chart)
   ========================================================================== */
.trends-matrix-card {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.trends-matrix-wrapper {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.trends-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}

.trends-table th,
.trends-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid color-mix(in srgb, var(--border-color) 45%, transparent);
  text-align: center;
  vertical-align: middle;
}

.trends-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card-bg, #fff);
  font-weight: 750;
  color: var(--text-muted);
  padding: 10px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Sticky Chapter Column */
.trends-table th.th-chapter,
.trends-table td.td-chapter {
  position: sticky;
  left: 0;
  text-align: left;
  width: 220px;
  min-width: 180px;
  max-width: 280px;
  background: var(--card-bg, #fff);
  z-index: 5;
  padding-left: 14px;
  padding-right: 10px;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.02);
}

.trends-table th.th-chapter {
  z-index: 20;
}

/* Frequency bar column */
.trends-table th.th-freq,
.trends-table td.td-freq {
  width: 130px;
  min-width: 110px;
  max-width: 150px;
  text-align: left;
  padding: 6px 10px;
}

.freq-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.freq-bar-track {
  flex: 1;
  height: 6px;
  background: var(--hover-bg, rgba(0, 0, 0, 0.06));
  border-radius: 999px;
  overflow: hidden;
}

.freq-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #ef4444);
  transition: width 0.3s ease;
}

.freq-badge {
  font-size: 0.72rem;
  font-weight: 800;
  min-width: 22px;
  text-align: right;
  color: var(--text-main);
}

/* Year Columns */
.trends-table th.th-year {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
  min-width: 44px;
}

.trends-table th.th-year:hover {
  background: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg, #fff));
  color: var(--primary-color);
}

.trends-table th.th-year.is-col-active {
  background: var(--primary-color);
  color: #fff;
}

.yr-short {
  display: none;
}

.yr-full {
  display: inline;
}

.ch-freq-pill-mobile {
  display: none;
}

/* Row Hover and Active Highlight */
.trends-row {
  transition: background 0.12s ease;
}

.trends-row:hover td {
  background: color-mix(in srgb, var(--primary-color) 4%, transparent);
}

.trends-row:hover td.td-chapter {
  background: color-mix(in srgb, var(--primary-color) 6%, var(--card-bg, #fff));
}

.trends-row.is-row-active td {
  background: color-mix(in srgb, var(--primary-color) 8%, transparent) !important;
}

.trends-row.is-row-active td.td-chapter {
  background: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg, #fff)) !important;
  color: var(--primary-color);
}

/* Chapter Cell Content */
.ch-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.ch-imp-pill {
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 800;
  flex-shrink: 0;
}

.ch-imp-pill.imp-3 { background: #fee2e2; color: #dc2626; }
.ch-imp-pill.imp-2 { background: #fef3c7; color: #d97706; }
.ch-imp-pill.imp-1 { background: #e0f2fe; color: #0284c7; }
.ch-imp-pill.imp-0 { background: #f3f4f6; color: #9ca3af; }

.ch-title-text {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Minimalist Cell Badge */
.matrix-cell {
  cursor: default;
  padding: 4px;
  position: relative;
  user-select: none;
}

.cell-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cell-zero-dot {
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.78rem;
}

.matrix-cell.cell-has-q {
  cursor: pointer;
}

.matrix-cell.cell-has-q:hover .cell-pill {
  transform: scale(1.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.matrix-cell.is-cell-active .cell-pill {
  transform: scale(1.22);
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  z-index: 6;
}

.cell-count-1 {
  background: #dbeafe;
  color: #1d4ed8;
}

.cell-count-2 {
  background: #fef3c7;
  color: #b45309;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.cell-count-3plus {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fca5a5;
}

/* Special Comprehensive / Unmapped Row */
.trends-row-comprehensive td {
  background: color-mix(in srgb, #8b5cf6 6%, var(--card-bg, #fff));
  border-top: 2px dashed color-mix(in srgb, #8b5cf6 40%, var(--border-color));
}

.trends-row-comprehensive .ch-title-text {
  color: #7c3aed;
}

.trends-row-comprehensive:hover td.td-chapter {
  background: color-mix(in srgb, #8b5cf6 12%, var(--card-bg, #fff));
}

.trends-bottom-spacer-row td {
  height: 12px;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

/* ==========================================================================
   真题穿透返回看板按钮 (Header & Floating Pill)
   ========================================================================== */
.header-return-trends-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.header-return-trends-btn[hidden] {
  display: none !important;
}

.header-return-trends-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: #d97706;
  transform: translateX(-1px);
}

.header-return-trends-btn svg {
  width: 14px;
  height: 14px;
}

.return-to-trends-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 18px rgba(217, 119, 6, 0.38), 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

.return-to-trends-float-btn[hidden] {
  display: none !important;
}

.return-to-trends-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(217, 119, 6, 0.48);
  filter: brightness(1.06);
}

.return-to-trends-float-btn:active {
  transform: translateY(0) scale(0.97);
}

.return-to-trends-float-btn svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   居中浮现式考题穿透弹窗 (Centered Modal / Floating Popup)
   ========================================================================== */
.trends-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000050;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.trends-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.trends-drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -46%) scale(0.95);
  width: min(860px, calc(100vw - 48px));
  max-height: min(84dvh, calc(100vh - 56px));
  background: var(--card-bg, #fff);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px color-mix(in srgb, var(--border-color) 70%, transparent);
  border: 1px solid var(--border-color);
  z-index: 10000060;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.trends-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

body.trends-modal-open {
  overflow: hidden !important;
}

.trends-drawer-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: color-mix(in srgb, var(--primary-color) 5%, var(--card-bg, #fff));
  flex-shrink: 0;
}

.trends-drawer-title-wrap {
  flex: 1;
  min-width: 0;
}

.trends-drawer-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trends-drawer-sub {
  margin: 3px 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trends-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.trends-drawer-count {
  font-size: 0.72rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
}

.trends-drawer-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg, #fff);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.trends-drawer-close svg {
  width: 12px;
  height: 12px;
}

.trends-drawer-close:hover {
  background: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg, #fff));
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.trends-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* Modal Bottom Sticky Exit Button */
.trends-drawer-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--primary-color) 3%, var(--card-bg, #fff));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trends-drawer-bottom-close-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary-color) 30%, var(--border-color));
  background: color-mix(in srgb, var(--primary-color) 10%, var(--card-bg, #fff));
  color: var(--primary-color);
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.18s ease;
}

.trends-drawer-bottom-close-btn:hover {
  background: color-mix(in srgb, var(--primary-color) 18%, var(--card-bg, #fff));
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.trends-drawer-bottom-close-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Question Item in Drawer */
.trend-question-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--card-bg, #fff);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.trend-question-card:hover {
  border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-color));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.tq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.tq-year-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-color);
  color: #fff;
}

.tq-type-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-muted);
}

.tq-score {
  font-size: 0.72rem;
  font-weight: 750;
  color: #ea580c;
  margin-left: auto;
}

.tq-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text-main);
  line-height: 1.48;
}

.tq-citation {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.tq-answer-box {
  background: color-mix(in srgb, var(--primary-color) 4%, var(--card-bg, #fff));
  border: 1px solid color-mix(in srgb, var(--primary-color) 15%, var(--border-color));
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
}

.tq-answer-label {
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
  cursor: pointer;
  padding: 6px 0;
  display: list-item;
  list-style-position: inside;
}

.tq-answer-label:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
  border-radius: 3px;
}

.tq-answer-box .tq-hide-answer,
.tq-answer-box[open] .tq-show-answer {
  display: none;
}

.tq-answer-box[open] .tq-hide-answer {
  display: inline;
}

.tq-answer-body {
  padding-top: 14px;
  font-size: 0.95rem;
  line-height: 1.8;
}

.tq-title {
  white-space: pre-line;
  font-size: 1rem;
}

.tq-options {
  font-size: 0.85rem;
  margin: 0;
}

.exam-answer-text .answer-point-body {
  min-width: 0;
  flex: 1;
}

.exam-answer-text .answer-section-marker {
  flex-shrink: 0;
  white-space: nowrap;
}

.exam-answer-text table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: inherit;
}

.exam-answer-text th,
.exam-answer-text td {
  border: 1px solid var(--border-color);
  padding: 7px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.exam-review-note {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.trends-review-scope {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.6;
  margin: 0 0 12px;
}

.exam-answer-text .answer-section-title {
  font-weight: 800;
  margin-top: 16px;
  color: var(--primary-color);
}

.exam-answer-text > .answer-hierarchy > :first-child {
  margin-top: 0;
}

.exam-answer-text .textbook-subpoint-list {
  list-style: none;
  padding-left: 16px;
}

.exam-answer-text .textbook-subpoint-list > li {
  position: relative;
}

.tq-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.tq-jump-btn {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--primary-color);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.16s ease;
}

.tq-jump-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.inspector-placeholder {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.inspector-placeholder p {
  margin: 0;
  font-size: 0.8rem;
  max-width: 280px;
  line-height: 1.5;
}

/* ==========================================================================
   Trends Responsive Styles for Mobile & Tablet (移动端与平板响应式适配)
   ========================================================================== */

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  body.is-trends-mode .exam-results,
  body.is-trends-mode .exam-scroll.dual-column .exam-results {
    padding: 10px 12px 10px !important;
  }

  .trends-table th.th-chapter,
  .trends-table td.td-chapter {
    width: 160px;
    min-width: 150px;
    max-width: 180px;
    padding-left: 10px;
    padding-right: 8px;
  }

  .trends-table th.th-freq,
  .trends-table td.td-freq {
    width: 95px;
    min-width: 85px;
    max-width: 105px;
    padding: 6px 8px;
  }

  .trends-drawer {
    width: min(520px, calc(100vw - 32px));
  }
}

/* Mobile Phone (<= 768px) */
@media (max-width: 768px) {
  body.is-trends-mode .exam-results,
  body.is-trends-mode .exam-scroll.dual-column .exam-results {
    padding: 6px 6px 8px !important;
  }

  .trends-top-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }

  .trends-controls-primary {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 6px;
  }

  .trends-controls-primary .trends-pill-group {
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .trends-controls-primary .trends-pill-btn {
    flex: 1;
    text-align: center;
    padding: 5px 6px;
    font-size: 0.72rem;
  }

  .trends-controls-secondary {
    width: 100%;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .trends-controls-secondary .trends-pill-group {
    flex-shrink: 0;
  }

  .trends-controls-secondary .trends-pill-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  /* Hide legend dots on mobile to keep search bar roomy */
  .trends-legend-simple {
    display: none;
  }

  .trends-search-mini {
    flex: 1;
    min-width: 0;
    width: auto !important;
    padding: 4px 8px;
  }

  .trends-search-mini input {
    font-size: 0.72rem;
  }

  /* Matrix Table Optimizations for Touch & Narrow Screens */
  .trends-matrix-card {
    border-radius: 8px;
  }

  .trends-matrix-wrapper {
    max-height: none;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .trends-bottom-spacer-row td {
    height: 12px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  .trends-table {
    font-size: 0.72rem;
  }

  /* Sticky Chapter Column compressed to ~116px on mobile */
  .trends-table th.th-chapter,
  .trends-table td.td-chapter {
    width: 116px;
    min-width: 108px;
    max-width: 122px;
    padding: 7px 6px;
    padding-left: 8px;
    padding-right: 6px;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
  }

  .ch-title-wrap {
    gap: 3px;
  }

  .ch-imp-pill {
    font-size: 0.58rem;
    padding: 1px 3px;
  }

  .ch-title-text {
    font-size: 0.71rem;
    font-weight: 700;
  }

  /* Mobile Frequency Badge embedded in chapter title cell */
  .ch-freq-pill-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg, #fff));
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    color: var(--primary-color);
    font-size: 0.64rem;
    font-weight: 800;
    margin-left: auto;
    flex-shrink: 0;
  }

  /* Hide separate 130px frequency column on phone screens */
  .trends-table th.th-freq,
  .trends-table td.td-freq {
    display: none !important;
  }

  /* Compact Year Header ('24, '23) & narrow 36px column */
  .yr-full {
    display: none;
  }

  .yr-short {
    display: inline;
    font-size: 0.72rem;
    font-weight: 800;
  }

  .trends-table th.th-year {
    min-width: 36px;
    width: 36px;
    padding: 8px 1px;
    font-size: 0.72rem;
  }

  .trends-table td.matrix-cell {
    padding: 4px 1px;
  }

  .cell-pill {
    width: 22px;
    height: 20px;
    font-size: 0.68rem;
    border-radius: 4px;
  }

  .cell-zero-dot {
    font-size: 0.68rem;
  }

  /* Centered Modal Card on mobile (浮现在屏幕正中间，四周留出半透明可点击背景) */
  .trends-drawer {
    width: calc(100vw - 28px) !important;
    max-width: 440px !important;
    max-height: min(80dvh, calc(100vh - 60px)) !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
  }

  .trends-drawer-header {
    padding: 11px 14px;
  }

  .trends-drawer-title {
    font-size: 0.88rem;
  }

  .trends-drawer-close {
    padding: 4px 9px;
    font-size: 0.74rem;
  }

  .trends-drawer-body {
    padding: 12px 14px 16px;
    gap: 10px;
  }

  .trends-drawer-footer {
    padding: 9px 14px;
  }

  .trends-drawer-bottom-close-btn {
    padding: 8px 14px;
    font-size: 0.80rem;
  }

  .trend-question-card {
    padding: 12px 14px;
    gap: 8px;
  }

  /* 移动端返回规律悬浮胶囊 */
  .return-to-trends-float-btn {
    bottom: calc(18px + env(safe-area-inset-bottom, 12px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 10px 20px;
    font-size: 0.84rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
    white-space: nowrap;
  }

  .return-to-trends-float-btn:hover {
    transform: translateX(-50%) translateY(-1px);
  }

  .return-to-trends-float-btn:active {
    transform: translateX(-50%) scale(0.96);
  }
}
