.pretest-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 12px;
}

.pretest-global-notice {
  margin: 0 0 8px;
  padding: 10px 14px;
  border-left: 3px solid var(--warning, #b8864b);
  border-radius: 0 10px 10px 0;
  background: var(--warning-soft, #f5ebe0);
  color: var(--warning, #b8864b);
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 500;
}

.left-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.collapse-btn {
  border: none;
  border-radius: 6px;
  background: var(--bg);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--sub-text);
  transition: background 0.18s;
}
.collapse-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.legend-line {
  font-size: 0.8rem;
  color: #56657a;
  margin-bottom: 8px;
  line-height: 1.5;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 4px 0 8px;
  vertical-align: middle;
}

.dot-0 { background: #b6b6b0; }
.dot-1 { background: #d64f4f; }
.dot1 { background: #3a8f4d; }

.distance-pick-hint {
  font-size: 0.72rem;
  color: #6a7585;
  line-height: 1.45;
  margin: 0 0 8px;
}

.volume-recommend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.volume-recommend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.84rem;
}

.volume-recommend-dist {
  font-weight: 600;
  color: var(--text);
}

.volume-recommend-pct {
  color: var(--primary-muted);
  white-space: nowrap;
}

.distance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.distance-btn-wrap {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  background: var(--bg);
  padding: 4px 6px;
}

.distance-btn {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 8px 4px;
  cursor: pointer;
  color: #4d4d48;
  font-size: 0.86rem;
  text-align: center;
}

.distance-btn-wrap:has(.distance-btn.active) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.distance-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.distance-btn.done::after {
  content: " 已完成";
  color: #3a8f4d;
  font-size: 0.74rem;
}

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

.pretest-op-panel {
  margin-top: 4px;
}

.pretest-op-section-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-muted);
}

.pretest-learn-tip,
.pretest-screen-note {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.pretest-screen-note {
  color: #8a8478;
}

.pretest-ling-learn-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: space-between;
  align-items: stretch;
  margin: 4px 0 8px;
}

.pretest-ling-learn-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 8px;
  border-radius: 12px;
  background: var(--bg);
}

.pretest-ling-learn-letter {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary-strong, var(--primary));
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.pretest-ling-learn-cell .learn-speaker-btn {
  width: 100%;
  max-width: 88px;
  padding: 8px 4px 6px;
}

.pretest-ling-learn-cell .learn-speaker-icon {
  width: 32px;
  height: 32px;
}

.pretest-ling-learn-cell .learn-speaker-icon::after {
  left: 9px;
  top: 9px;
}

.pretest-ling-learn-cell .learn-speaker-text {
  font-size: 0.72rem;
}

.pretest-ling-learn-play.is-playing {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pretest-learn-progress {
  margin: 4px 0 10px;
  font-size: 0.82rem;
}

.pretest-learn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.pretest-match-tip {
  margin: 0 0 12px;
}

.pretest-match-wrap {
  position: relative;
  margin: 8px 0 10px;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--bg);
}

.pretest-match-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.pretest-match-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: stretch;
}

.pretest-match-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pretest-match-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 52px;
}

.pretest-match-node:hover {
  border-color: var(--primary-soft);
}

.pretest-match-node.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.pretest-match-node.is-linked {
  border-color: #7a9e8a;
}

.pretest-match-node.is-correct {
  border-color: #3a8f4d;
  background: #eef7f0;
}

.pretest-match-node.is-wrong {
  border-color: #d64f4f;
  background: #fdf0f0;
}

.pretest-match-audio-label {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: #4a4a44;
}

.pretest-match-letter-label {
  flex: 1;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-strong, var(--primary));
  text-transform: lowercase;
  text-align: center;
}

.pretest-match-node .learn-speaker-btn {
  flex-shrink: 0;
  width: auto;
  min-width: 72px;
  padding: 6px 8px 5px;
}

.pretest-match-progress {
  margin: 0 0 10px;
  font-size: 0.84rem;
}

.pretest-screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.pretest-match-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.pretest-match-line.is-correct {
  stroke: #3a8f4d;
}

.pretest-match-line.is-wrong {
  stroke: #d64f4f;
}

@media (max-width: 720px) {
  .pretest-ling-learn-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .pretest-ling-learn-cell {
    flex: 1 1 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
  }

  .pretest-match-board {
    gap: 24px;
  }
}

.pretest-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pretest-modal-overlay.is-open {
  display: flex;
}

.pretest-modal-dialog {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  text-align: center;
}

.pretest-modal-dialog.pretest-modal-warn {
  box-shadow: 0 4px 24px rgba(180, 60, 60, 0.12), 0 1px 4px rgba(0,0,0,0.06);
}

.pretest-modal-dialog.pretest-modal-success {
  box-shadow: 0 4px 24px rgba(46, 130, 70, 0.10), 0 1px 4px rgba(0,0,0,0.06);
}

.pretest-modal-title {
  font-size: 1.1rem;
  margin: 0 0 12px;
  color: #2a2a26;
}

.pretest-modal-body {
  font-size: 1rem;
  line-height: 1.65;
  color: #454540;
  margin: 0 0 18px;
  text-align: left;
  white-space: pre-line;
}

.pretest-modal-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pretest-modal-btn-hidden {
  display: none !important;
}

.pretest-modal-ok,
.pretest-modal-next {
  min-width: 120px;
}

.pretest-modal-footer-wrong {
  margin-top: 4px;
}

.pretest-modal-footer-wrong .pretest-skip-warn {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #c0392b;
  font-weight: 600;
  text-align: left;
}

.pretest-modal-footer-inline {
  justify-content: center;
}

.pretest-modal-footer-reveal {
  margin-top: 8px;
}

.pretest-feedback-block {
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0 12px;
  background: var(--ops-bg);
}

.pretest-feedback-head {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: #3a3a36;
}

.pretest-distance-summary {
  font-size: 0.86rem;
  color: #4a4a44;
  line-height: 1.55;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.status-list {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.status-item {
  border-radius: 10px;
  background: var(--bg);
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* badge 样式统一由 main.css 提供，此处不覆盖 */

.history {
  display: grid;
  gap: 6px;
}

.pretest-archive-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 12px;
}

.pretest-archive-item {
  border: none;
  border-radius: 12px;
  background: var(--ops-bg);
  padding: 8px 10px;
}

.pretest-archive-item.selected {
  background: var(--primary-soft);
}

.pretest-archive-row {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  color: #4a5566;
  line-height: 1.45;
  cursor: pointer;
  padding: 2px 0;
  white-space: normal;
}

.pretest-archive-row:hover {
  color: #2a2a26;
}

.pretest-archive-detail {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.pretest-archive-item.selected .pretest-archive-detail {
  display: block;
}

.pretest-archive-detail-card {
  margin: 0;
  border: none;
}

.pretest-last-result-card {
  border-radius: 12px;
  background: var(--ops-bg);
  padding: 10px;
  margin: 4px 0 12px;
}

.pretest-last-result-empty {
  font-size: 0.82rem;
  color: #6d695f;
  line-height: 1.5;
}

.pretest-last-result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pretest-last-result-date {
  font-size: 0.78rem;
  color: #6a7585;
}

.pretest-pass-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.76rem;
  line-height: 1.4;
  background: #e9f4ee;
  color: #2d6e40;
}
.pretest-pass-chip::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3a8f4d;
  flex-shrink: 0;
}

.pretest-last-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pretest-last-result-stat {
  border: none;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  background: var(--panel);
}

.pretest-last-result-toggle {
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.pretest-last-result-toggle:not(.unstable):hover {
  background: var(--primary-soft);
}

.pretest-last-result-toggle:not(.unstable).active {
  background: var(--primary-soft);
}

.pretest-last-result-toggle.unstable {
  background: var(--panel);
}

.pretest-last-result-toggle.unstable:hover {
  background: #faf0f0;
}

.pretest-last-result-toggle.unstable.active {
  background: #faf0f0;
}

.pretest-last-result-stat .label {
  display: block;
  font-size: 0.72rem;
  color: #6a7585;
  margin-bottom: 4px;
}

.pretest-last-result-stat .value {
  display: block;
  font-size: 0.95rem;
  color: #2a3548;
  font-weight: 600;
}

.pretest-last-result-details {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.pretest-last-result-detail {
  display: none;
  border-radius: 8px;
  background: var(--panel);
  padding: 7px 8px;
  font-size: 0.8rem;
  color: #38465a;
  line-height: 1.45;
}

.pretest-last-result-detail.show {
  display: block;
}

.history-item {
  border-radius: 10px;
  background: var(--ops-bg);
  padding: 6px 8px;
  font-size: 0.78rem;
  color: #4a5566;
  line-height: 1.4;
}

.progress-wrap {
  border-radius: 10px;
  padding: 8px;
  margin: 10px 0;
  background: var(--bg);
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--ops-bg-muted);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--primary);
}

.question-card {
  border-radius: 12px;
  background: var(--primary-surface);
  border: 1px solid var(--panel-tint-border);
  padding: 12px;
}

.audio-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.pretest-session-hidden {
  display: none;
}

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

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--bg);
  transition: background 0.18s;
}
.btn:hover {
  background: var(--primary-soft);
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-hover);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.opt-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 42px;
  cursor: pointer;
  background: var(--ops-bg-muted);
  color: var(--sub-text);
  font-size: 1rem;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.opt-btn.enabled {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft);
}

.opt-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.actions-row .btn {
  min-width: 120px;
}

.tip {
  font-size: 0.86rem;
  color: var(--sub-text);
  line-height: 1.6;
  margin-top: 8px;
}

.left-collapsed .left-body {
  display: none;
}

@media (max-width: 1024px) {
  .pretest-page {
    grid-template-columns: 1fr;
  }
  .options-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}
