/* =============================================================================
 * chapter-challenge.css — 「本章单词闯关」（4 选 1）
 * 与单词本闯关同一套设计：粉紫渐变、圆角、卡片式大按钮。
 * ========================================================================== */

/* ---------- 入口卡片（作为 #passage 的后继兄弟） ---------- */
.cc-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 8px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f6ecff 0%, #fde9f5 100%);
  border: 1px solid #ecd9f2;
  box-shadow: 0 6px 20px rgba(168, 85, 247, .12);
}
.cc-entry-main { flex: 1 1 220px; min-width: 0; }
.cc-entry-title {
  font-size: 18px;
  font-weight: 800;
  color: #7b1fa2;
  line-height: 1.4;
}
.cc-entry-desc {
  margin-top: 4px;
  font-size: 14px;
  color: #7a6b86;
  line-height: 1.5;
}
.cc-entry-btn {
  flex: 0 0 auto;
  cursor: pointer;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #c084fc, #f0abfc);
  box-shadow: 0 6px 16px rgba(168, 85, 247, .35);
  transition: transform .15s, box-shadow .15s;
}
.cc-entry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(168, 85, 247, .45);
}
.cc-entry-btn:active { transform: translateY(0); }

/* ---------- 全屏遮罩 ---------- */
.cc-hidden { display: none !important; }

.cc-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99999;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(135deg, rgba(192, 132, 252, .95), rgba(240, 171, 252, .95));
}

.cc-panel {
  position: relative;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  box-sizing: border-box;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(91, 33, 182, .35);
  padding: 18px 22px;
  height: calc(100vh - 20px);
  height: calc(100dvh - 20px);
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cc-panel-inner {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cc-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  line-height: 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: #9a8aa6;
  background: #f6ecff;
  transition: background .15s, color .15s;
}
.cc-close:hover { background: #ecd9f2; color: #7b1fa2; }

/* ---------- 头部 ---------- */
.cc-head { text-align: center; margin: 2px 0 8px; }
.cc-head-title { font-size: 20px; font-weight: 800; color: #7b1fa2; }
.cc-head-sub { margin-top: 4px; font-size: 13px; color: #9a8aa6; }

/* ---------- 配置区 ---------- */
.cc-section { margin: 18px 0; }
.cc-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #7b1fa2;
  margin-bottom: 10px;
}
.cc-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cc-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cc-chip {
  padding: 12px 8px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid #ecd9f2;
  background: #fff;
  color: #6b5a78;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  transition: transform .15s, border-color .15s, background .15s, color .15s;
}
.cc-chip:hover { border-color: #c084fc; transform: translateY(-1px); }
.cc-chip.is-active {
  border-color: #c084fc;
  background: linear-gradient(135deg, #f6ecff, #fde9f5);
  color: #7b1fa2;
  font-weight: 800;
}

/* ---------- 通用按钮 ---------- */
.cc-actions { display: flex; gap: 12px; margin-top: 20px; }
.cc-primary,
.cc-secondary {
  flex: 1 1 auto;
  cursor: pointer;
  border: none;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.cc-primary {
  color: #fff;
  background: linear-gradient(135deg, #c084fc, #f0abfc);
  box-shadow: 0 6px 16px rgba(168, 85, 247, .35);
}
.cc-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(168, 85, 247, .45); }
.cc-secondary {
  color: #7b1fa2;
  background: #f6ecff;
  border: 2px solid #ecd9f2;
}
.cc-secondary:hover { background: #ecd9f2; }

/* ---------- 答题页 ---------- */
.cc-quiz-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-right: 52px;   /* 给右上角关闭按钮留位，杜绝重叠 */
  font-size: 13px;
  color: #9a8aa6;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.cc-score { font-weight: 700; color: #43a047; }
.cc-score-no { color: #e53935; }

.cc-prompt { text-align: center; margin: 12px 0 24px; flex: 0 0 auto; }
.cc-prompt-label { font-size: 14px; color: #9a8aa6; margin-bottom: 12px; }
.cc-prompt-main {
  font-size: 30px;
  font-weight: 800;
  color: #3a2b45;
  line-height: 1.3;
  word-break: break-word;
}
.cc-prompt-en { font-size: 38px; color: #7b1fa2; }

.cc-play {
  cursor: pointer;
  border: none;
  padding: 16px 26px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #c084fc, #f0abfc);
  box-shadow: 0 6px 16px rgba(168, 85, 247, .35);
  transition: transform .15s, box-shadow .15s;
}
.cc-play:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(168, 85, 247, .45); }
/* 播放按钮下方的小字备注（网络原因可能延迟），弱化处理，不抢题干视觉 */
.cc-play-hint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #a99bb3;
}

/* ---------- 选项（4 选 1） ---------- */
#cc-opts {
  flex: 1 1 auto;
  max-height: 280px;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 14px;
}
.cc-opt {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  box-sizing: border-box;
  padding: 14px 18px;
  margin-bottom: 0;
  border-radius: 14px;
  background: #fff;
  border: 2px solid #ecd9f2;
  box-shadow: 0 2px 8px rgba(168, 85, 247, .08);
  font-size: 18px;
  color: #3a2b45;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  word-break: break-word;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.cc-opt .cc-opt-idx {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #c084fc, #f0abfc);
}
.cc-opt .cc-opt-text { flex: 1 1 auto; }
.cc-opt:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #c084fc;
  box-shadow: 0 6px 16px rgba(168, 85, 247, .18);
}
.cc-opt.correct { background: #eafaef; border-color: #7bc67e; }
.cc-opt.correct .cc-opt-idx { background: linear-gradient(135deg, #5fbf6a, #8fd69a); }
.cc-opt.wrong { background: #ffeef4; border-color: #f08aa8; }
.cc-opt.wrong .cc-opt-idx { background: linear-gradient(135deg, #ef6f92, #f5a3b8); }
.cc-opt:disabled { cursor: default; opacity: 1; }

/* ---------- 反馈区（复习卡容器，不参与伸缩） ---------- */
.cc-feedback { flex: 0 0 auto; }

/* ---------- 复习卡（选对选错都显示） ---------- */
.cc-review {
  text-align: left;
  margin-top: 4px;
  padding: 14px 16px;
  background: #faf3fd;
  border: 1px solid #ecd9f2;
  border-radius: 14px;
}
.cc-review-result { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.cc-review-result.ok { color: #43a047; }
.cc-review-result.no { color: #e53935; }
.cc-review-answer {
  font-size: 15px;
  font-weight: 600;
  color: #7b1fa2;
  margin-bottom: 10px;
}
.cc-review-word {
  font-weight: 700;
  color: #7b1fa2;
  font-size: 17px;
  line-height: 1.4;
}
.cc-review-phon {
  margin-left: 8px;
  color: #1565c0;
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
}
.cc-review-cn {
  margin-top: 4px;
  color: #3a2b45;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 结算页 ---------- */
.cc-result { text-align: center; padding: 8px 0 4px; }
.cc-result-emoji { font-size: 46px; line-height: 1.2; }
.cc-result-score {
  margin-top: 6px;
  font-size: 34px;
  font-weight: 800;
  color: #7b1fa2;
}
.cc-result-pct { margin-top: 4px; font-size: 15px; color: #7a6b86; }
.cc-result-comment { margin-top: 12px; font-size: 14px; color: #7a6b86; line-height: 1.6; }

/* ---------- 空态 ---------- */
.cc-empty {
  text-align: center;
  padding: 24px 8px;
  color: #7a6b86;
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 600px) {
  .cc-entry {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 16px;
  }
  .cc-entry-btn { width: 100%; }
  .cc-overlay { padding: 6px; }
  .cc-panel {
    padding: 14px 12px;
    border-radius: 16px;
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }
  .cc-opt { min-height: 74px; font-size: 17px; padding: 14px 14px; }
  #cc-opts { gap: 10px; }
  .cc-opt .cc-opt-idx { width: 30px; height: 30px; font-size: 15px; margin-right: 10px; }
  .cc-prompt-main { font-size: 26px; }
  .cc-prompt-en { font-size: 32px; }
  #cc-opts { max-height: none; }
  .cc-counts { grid-template-columns: repeat(2, 1fr); }
  .cc-result-score { font-size: 30px; }
}

/* ---------- 平板适配：收紧选项高度，避免比例失调 ---------- */
@media (min-width: 601px) and (max-width: 1180px) {
  #cc-opts { max-height: 260px; }
  .cc-opt { font-size: 17px; }
}
