/* ============================================================
   自测页专属样式
   主题色：琥珀金（body.page-quiz 提供 --pg-*）
   ============================================================ */

/* ===== 分段控件（题型切换） ===== */
.seg {
  display: flex;
  gap: 5px;
  padding: 5px;
  background: var(--pg-soft);
  border: 1px solid var(--pg-soft2);
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
  min-height: 42px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.seg button:hover { color: var(--text-primary); }
.seg button.on {
  background: #FFFFFF;
  color: var(--pg-ink);
  box-shadow: 0 3px 10px rgba(93, 76, 130, 0.14);
}

/* ===== 选项组：行距拉开 + 虚线分隔，避免「方向」和「题量」的选框糊成一片 =====
   原来三行 set-row 之间只有 12px，跟行内换行的 10px 几乎一样，
   换行之后根本看不出「方向」这一行到哪儿结束。这里把行间距抬到 18px
   再加一条虚线分隔，行内换行间距（8px）明显更小，层级一眼可辨。 */
.opt-block > * + * {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--pg-soft2);
}
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 0;
  min-height: 38px;
}
.set-row .set-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 62px;
  flex-shrink: 0;
}
.set-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn {
  padding: 8px 17px;
  min-height: 38px;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-pill);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.16s;
}
.chipbtn:hover { border-color: var(--pg-accent); color: var(--text-primary); }
.chipbtn.on {
  background: var(--pg-grad);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--pg-shadow);
}

/* ===== 开始按钮区 ===== */
.start-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.start-bar .tip {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}
.btn.start {
  width: 100%;
  min-height: 54px;
  font-size: 17px;
  border-radius: 20px;
}

/* ===== 答题区 ===== */
.quiz-stage { margin-bottom: 18px; }
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.quiz-step {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.quiz-step b { color: var(--pg-ink); font-size: 16px; }
.quiz-score {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.quiz-score .ok { color: #2E9E4F; }
.quiz-score .no { color: var(--danger); }

.quiz-track {
  height: 7px;
  border-radius: 999px;
  background: var(--pg-soft2);
  overflow: hidden;
  margin-bottom: 18px;
}
.quiz-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--pg-grad);
  transition: width 0.3s ease;
}

.quiz-prompt {
  text-align: center;
  padding: 22px 16px;
  background: var(--bg-field);
  border: 1px dashed var(--pg-soft2);
  border-radius: 22px;
  margin-bottom: 16px;
}
.quiz-prompt .ask {
  font-size: 32px;
  font-weight: 700;
  color: var(--word-ink);
  line-height: 1.3;
  word-break: break-word;
}
.quiz-prompt .ask.cn { font-size: 26px; color: var(--text-primary); }
.quiz-prompt .ph {
  font-family: 'Times New Roman', serif;
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.quiz-prompt .hintline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.quiz-prompt .speak-btn {
  margin-top: 12px;
  padding: 9px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--pg-grad);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 5px 14px var(--pg-shadow);
  transition: 0.18s;
}
.quiz-prompt .speak-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* 选项 */
.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 560px) { .quiz-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1.5px solid var(--border-soft);
  border-radius: 16px;
  background: #FFFFFF;
  color: var(--text-primary);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: 0.16s;
  min-height: 54px;
}
.opt .idx {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pg-soft);
  color: var(--pg-ink);
  font-size: 12.5px;
  font-weight: 700;
}
.opt .txt { flex: 1; min-width: 0; word-break: break-word; }
.opt:hover:not(:disabled) { border-color: var(--pg-accent); background: var(--pg-soft); transform: translateY(-1px); }
.opt:disabled { cursor: default; }
.opt.correct {
  background: #EAFBF0;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 1px var(--accent-green);
}
.opt.correct .idx { background: var(--accent-green); color: #FFFFFF; }
.opt.wrong {
  background: #FFF0EC;
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.opt.wrong .idx { background: var(--danger); color: #FFFFFF; }
.opt.dim { opacity: 0.5; }

/* 拼写输入 */
.quiz-input {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.quiz-input input {
  flex: 1 1 200px;
  min-width: 0;
  border-radius: 16px;
  padding: 13px 18px;
  font-size: 18px;
  letter-spacing: 0.5px;
}
.quiz-input .btn { flex-shrink: 0; border-radius: 16px; padding: 0 26px; min-height: 50px; }

/* 反馈条 */
.quiz-fb {
  min-height: 0;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.7;
  padding: 0;
  overflow: hidden;
  transition: 0.2s;
}
.quiz-fb.show { padding: 12px 18px; margin-bottom: 14px; }
.quiz-fb.ok { background: #EAFBF0; border: 1px solid #A8E6BE; color: #1D7A3C; }
.quiz-fb.no { background: #FFF0EC; border: 1px solid #FFC4B6; color: #B73C22; }
.quiz-fb b { font-size: 16px; }
.quiz-fb .ans { font-weight: 700; }

/* 翻卡 */
.flip-wrap { perspective: 1200px; margin-bottom: 14px; }
.flip-card {
  position: relative;
  width: 100%;
  height: 230px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.flip-card.flipped { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border-radius: 24px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(93, 76, 130, 0.14);
  text-align: center;
}
.flip-front { background: var(--pg-grad); color: #FFFFFF; }
.flip-front .big { font-size: 38px; font-weight: 700; word-break: break-word; }
.flip-front .small { font-size: 14px; opacity: 0.9; }
.flip-back {
  background: #FFFFFF;
  border: 2px solid var(--border-soft);
  color: var(--text-primary);
  transform: rotateY(180deg);
}
.flip-back .big { font-size: 28px; font-weight: 700; }
.flip-back .small { font-size: 18px; color: var(--text-secondary); }
.flip-tip {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ===== 结果页 ===== */
.score-hero {
  text-align: center;
  padding: 26px 20px;
  border-radius: 24px;
  background: var(--pg-grad);
  color: #FFFFFF;
  box-shadow: 0 10px 28px var(--pg-shadow);
  margin-bottom: 16px;
}
.score-hero .big { font-size: 44px; font-weight: 700; line-height: 1.2; }
.score-hero .big small { font-size: 20px; font-weight: 500; opacity: 0.9; }
.score-hero .desc { font-size: 15px; opacity: 0.95; margin-top: 8px; }

.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 15px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--bg-field);
  font-size: 14.5px;
}
.review-item.ok { background: #F4FDF7; border-color: #C6EDD5; }
.review-item.no { background: #FFF7F5; border-color: #FFD5CB; }
.review-item .mark { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
.review-item .body { flex: 1; min-width: 0; }
.review-item .w { font-weight: 700; color: var(--text-primary); }
.review-item .m { color: var(--text-secondary); font-size: 13.5px; }
.review-item .typed { font-size: 13px; margin-top: 2px; }
.review-item .typed.bad { color: var(--danger); }
.review-item .typed.good { color: #2E9E4F; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.result-actions .btn { flex: 1 1 130px; }

/* 宽屏：答题与结果别铺满 1560，收窄到读得舒服的宽度 */
@media (min-width: 1180px) {
  #runView, #resultView { max-width: 1000px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 640px) {
  .seg button { font-size: 13.5px; padding: 9px 6px; }
  .set-row { gap: 8px 12px; }
  .set-row .set-label { min-width: 52px; font-size: 12.5px; }
  .chipbtn { padding: 7px 14px; font-size: 13px; min-height: 36px; }
  .opt-block > * + * { margin-top: 16px; padding-top: 16px; }
}
@media (max-width: 480px) {
  .quiz-prompt { padding: 16px 12px; }
  .quiz-prompt .ask { font-size: 26px; }
  .quiz-prompt .ask.cn { font-size: 21px; }
  .opt { padding: 12px 14px; font-size: 15px; min-height: 50px; }
  .flip-card { height: 190px; }
  .flip-front .big { font-size: 30px; }
  .flip-back .big { font-size: 23px; }
  .set-row .set-label { min-width: 46px; }
}
