/* ===== 出卷考试 ===== */

/* ---- 设置面板 ---- */
.setup-box {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 24px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 12px 32px rgba(120, 90, 150, .13);
}

.setup-group { margin-bottom: 28px; }

.setup-group h3 {
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 14px;
  color: var(--ink);
}

/* ---- 自定义题量 ---- */
.custom-count {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #fff6ec;
  border: 2px dashed #ffd9b8;
}

.custom-count.show { display: flex; animation: fadeSlide .25s ease; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-step {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: #fff;
  color: var(--orange);
  font-size: 24px;
  font-weight: 900;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(120, 90, 150, .13);
  transition: .15s;
  user-select: none;
}

.count-step:hover { background: var(--orange); color: #fff; }
.count-step:active { transform: scale(.9); }

#customCount {
  width: 92px;
  height: 46px;
  padding: 0 8px;
  border: 3px solid #ffe0c2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: .2s;
  -moz-appearance: textfield;
  appearance: textfield;
}

#customCount::-webkit-outer-spin-button,
#customCount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#customCount:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 138, 61, .15); }

.custom-unit { font-size: 16px; font-weight: 800; color: var(--gray); }

.count-tip {
  margin-top: 10px;
  font-size: 13px;
  color: var(--gray);
  text-align: center;
  min-height: 18px;
}

.count-tip.warn { color: #e0821f; font-weight: 700; }

/* 题型选择 */
.type-list { display: flex; flex-direction: column; gap: 10px; }

.type-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #f0ecf5;
  background: #fdfcff;
  cursor: pointer;
  transition: .2s;
}

.type-item:hover { border-color: #ffd9b8; background: #fffaf4; }

.type-item:has(input:checked) { border-color: var(--orange); background: #fff6ec; }

.type-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}

.type-info { display: flex; flex-direction: column; gap: 2px; }

.type-name { font-size: 15px; font-weight: 800; }

.type-desc { font-size: 13px; color: var(--gray); }

.start-exam-btn { width: 100%; padding: 16px; font-size: 18px; }

/* ---- 答题面板 ---- */
.exam-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.exam-progress-text { font-size: 15px; font-weight: 700; color: var(--gray); white-space: nowrap; }
.exam-progress-text strong { color: var(--orange); font-size: 19px; }

.progress-track {
  flex: 1;
  min-width: 120px;
  height: 12px;
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(120, 90, 150, .10);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb347, var(--orange));
  transition: width .35s ease;
}

.quit-btn { padding: 8px 18px; font-size: 14px; }

/* 题目区 */
.question-box {
  background: #fff;
  border-radius: 22px;
  padding: clamp(28px, 6vw, 46px) clamp(16px, 4vw, 32px);
  text-align: center;
  box-shadow: 0 12px 30px rgba(120, 90, 150, .13);
  margin-bottom: 20px;
}

.q-type-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: #f2eeff;
  color: var(--purple);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.q-emoji { font-size: clamp(44px, 9vw, 64px); line-height: 1.1; margin-bottom: 8px; }

.q-main {
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink);
  margin-bottom: 6px;
  word-break: break-word;
}

.q-main.zh { color: var(--blue); }

.q-sub { font-size: 14px; color: var(--gray); }

/* 听音题的大喇叭 */
.listen-btn {
  width: 92px;
  height: 92px;
  margin: 6px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb347, var(--orange));
  font-size: 40px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 138, 61, .40);
  transition: .2s;
}

.listen-btn:hover { transform: scale(1.06); }
.listen-btn:active { transform: scale(.95); }

.listen-btn.playing { animation: listenPulse .8s infinite; }

@keyframes listenPulse {
  0%, 100% { box-shadow: 0 10px 26px rgba(255, 138, 61, .40), 0 0 0 0 rgba(255, 138, 61, .5); }
  50% { box-shadow: 0 10px 26px rgba(255, 138, 61, .40), 0 0 0 16px rgba(255, 138, 61, 0); }
}

/* 选项 */
.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.option {
  padding: 16px 20px;
  border: 3px solid #fff;
  border-radius: 16px;
  background: #fff;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(120, 90, 150, .11);
  transition: .18s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option:hover:not(:disabled) { transform: translateY(-3px); border-color: #ffd9b8; }

.option-key {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f4f1f9;
  color: var(--gray);
  font-size: 14px;
  font-weight: 900;
}

.option.correct {
  background: #e8fbf1;
  border-color: var(--green);
  color: #1f8a55;
}

.option.correct .option-key { background: var(--green); color: #fff; }

.option.wrong {
  background: #fff0f0;
  border-color: #ff8f8f;
  color: #c94b4b;
  animation: wiggle .35s;
}

.option.wrong .option-key { background: #ff8f8f; color: #fff; }

@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.option:disabled { cursor: default; }

/* 下一题 */
.next-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.feedback { font-size: 16px; font-weight: 800; }
.feedback.ok { color: var(--green); }
.feedback.no { color: #e05c5c; }

/* ---- 成绩面板 ---- */
.result-card {
  background: #fff;
  border-radius: 26px;
  padding: clamp(28px, 6vw, 46px);
  text-align: center;
  box-shadow: 0 16px 40px rgba(120, 90, 150, .15);
}

.result-emoji { font-size: 64px; line-height: 1; margin-bottom: 10px; }

.result-card h2 { font-size: 26px; font-weight: 900; margin-bottom: 14px; }

.result-score {
  font-size: 52px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1.1;
}

.score-divider { color: #d9d3e2; margin: 0 6px; }

.result-rate { font-size: 16px; color: var(--gray); margin-top: 6px; }

.result-hint {
  margin-top: 14px;
  font-size: 15px;
  color: var(--ink);
  background: #fff8ee;
  border-radius: 14px;
  padding: 14px 18px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* 错题回顾 */
.wrong-box {
  margin-top: 26px;
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(120, 90, 150, .12);
}

.wrong-box h3 { font-size: 18px; font-weight: 900; margin-bottom: 16px; }

.wrong-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #fff7f7;
  margin-bottom: 10px;
}

.wrong-item:last-child { margin-bottom: 0; }

.wrong-emoji { font-size: 30px; flex-shrink: 0; }

.wrong-info { flex: 1; min-width: 0; }

.wrong-word { font-size: 16px; font-weight: 900; }

.wrong-word span { color: var(--gray); font-weight: 600; font-size: 14px; margin-left: 8px; }

.wrong-detail { font-size: 13px; color: #d05a5a; margin-top: 2px; }

.wrong-speak {
  border: none;
  background: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
}

.wrong-speak:hover { background: #ffe0c2; }

/* 拼写题输入框 */
.spell-box {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.spell-input {
  flex: 1;
  min-width: 180px;
  padding: 15px 20px;
  border: 3px solid #ffe0c2;
  border-radius: 16px;
  background: #fff;
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 2px;
  color: var(--ink);
  outline: none;
  transition: .2s;
}

.spell-input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 138, 61, .15); }

.spell-input.ok { border-color: var(--green); background: #e8fbf1; color: #1f8a55; }

.spell-input.no { border-color: #ff8f8f; background: #fff0f0; color: #c94b4b; }

.spell-box .btn { flex-shrink: 0; }

@media (max-width: 640px) {
  .spell-box { flex-direction: column; }
  .spell-box .btn { width: 100%; }
}

@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .option { padding: 14px 16px; font-size: 16px; }
  .next-wrap { flex-direction: column-reverse; align-items: stretch; }
  .next-wrap .btn { width: 100%; }
  .feedback { text-align: center; }
  .result-actions .btn { flex: 1; }
}
