/* ================================================================
   quiz.css — 公共变量 + 答题页样式
   路径：/static/css/quiz.css
   ================================================================ */

/* ===== CSS Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1677ff;
  --primary-light: #e8f0fe;
  --success: #52c41a;
  --success-light: #f6ffed;
  --danger: #ff4d4f;
  --danger-light: #fff2f0;
  --warning: #faad14;
  --warning-light: #fffbe6;
  --text: #1a1a2e;
  --text-sub: #666;
  --text-tip: #999;
  --border: #e8e8e8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --transition: .25s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.9);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 9999;
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== Loading ===== */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
  background: var(--bg);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-tip { color: var(--text-sub); font-size: 14px; }

/* ===== 答题页头部 ===== */
.quiz-header {
  background: var(--card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.btn-back {
  width: 36px; height: 36px;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text);
}
.quiz-progress-wrap { flex: 1; }
.quiz-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 5px;
}
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #42a5f5);
  border-radius: 3px;
  transition: width .4s ease;
}

/* ===== 答题主体 ===== */
.quiz-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.q-type-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
}
.q-type-tag.judge { background: #fff7e6; color: #d46b08; }
.q-type-tag.fill  { background: #f0f5ff; color: #2f54eb; }
.q-num { font-size: 12px; color: var(--text-tip); margin-left: auto; }
.question-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 500;
}
/* fill-hint 保留兼容旧代码，实际已不在前台显示 */
.fill-hint {
  font-size: 13px;
  color: var(--text-tip);
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}
/* 填空题题目中的空白占位符 */
.fill-blank {
  display: inline-block;
  min-width: 60px;
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 2px;
  margin: 0 4px;
  vertical-align: bottom;
  line-height: 1.4;
}

/* ===== 选项列表 ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.option-item:active { transform: scale(.98); }
.option-item.selected { border-color: var(--primary); background: var(--primary-light); }
.option-item.correct  { border-color: var(--success); background: var(--success-light); }
.option-item.wrong    { border-color: var(--danger);  background: var(--danger-light); }
.option-item.disabled { cursor: default; pointer-events: none; }
.option-label {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  transition: all var(--transition);
}
.option-item.selected .option-label { background: var(--primary); color: #fff; }
.option-item.correct  .option-label { background: var(--success); color: #fff; }
.option-item.wrong    .option-label { background: var(--danger);  color: #fff; }
.option-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  padding-top: 2px;
}
.option-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

/* ===== 底部操作栏 ===== */
.quiz-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  background: var(--card);
  box-shadow: 0 -1px 0 var(--border);
  flex-shrink: 0;
}
.btn-check {
  width: 100%;
  padding: 15px 0;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: .04em;
}
.btn-check:disabled { background: #e0e0e0; color: #aaa; cursor: default; }
.btn-check.ready {
  background: linear-gradient(90deg, #1677ff, #42a5f5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22,119,255,.35);
}
.btn-check.ready:active { transform: scale(.98); opacity: .9; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-next {
  padding: 15px 0;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: .04em;
}
.btn-next.primary {
  background: linear-gradient(90deg, #1677ff, #42a5f5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22,119,255,.35);
}
.btn-next.outline {
  background: #fff;
  color: var(--text-sub);
  border: 1.5px solid var(--border);
}
.btn-next:active { transform: scale(.98); opacity: .9; }

/* ===== 解析面板 ===== */
.analysis-panel {
  margin-top: 14px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: slideIn .3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.analysis-header {
  padding: 12px 16px;
  background: #fff7e6;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #ffe58f;
}
.analysis-header .icon { font-size: 18px; }
.analysis-header span { font-size: 14px; font-weight: 700; color: #d46b08; }
.analysis-header .correct-ans {
  margin-left: auto;
  font-size: 13px;
  color: var(--success);
  font-weight: 700;
}
.analysis-body { padding: 14px 16px; }
.analysis-body p { font-size: 14px; line-height: 1.8; color: var(--text-sub); }

/* ===== 彩纸 ===== */
.confetti {
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden; z-index: 999;
}
.confetti-piece {
  position: absolute;
  width: 8px; height: 12px;
  border-radius: 2px;
  animation: fall 2s ease-in forwards;
}
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== 通用按钮 ===== */
.btn-lg {
  padding: 15px 0;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  letter-spacing: .04em;
  width: 100%;
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn-lg.primary {
  background: linear-gradient(90deg, #1677ff, #42a5f5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22,119,255,.35);
}
.btn-lg.outline {
  background: #fff;
  color: var(--text-sub);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.btn-lg.success {
  background: linear-gradient(90deg, #07c160, #52c41a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(7,193,96,.3);
}
.btn-lg:active { transform: scale(.98); opacity: .9; }
