:root {
  --primary: #7C6FE0;
  --primary-light: #A89BF5;
  --primary-bg: #F5F3FF;
  --secondary: #6BCFBF;
  --correct: #6BCF7F;
  --correct-bg: #D5F5DB;
  --wrong: #FF8A8A;
  --wrong-bg: #FFDEDE;
  --yellow: #FFD93D;
  --text: #4A3F70;
  --text-soft: #8A7FA8;
  --shadow: 0 12px 32px rgba(90, 70, 150, 0.18);
  --shadow-soft: 0 6px 20px rgba(90, 70, 150, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Fredoka', 'ZCOOL KuaiLe', -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #E8E4FF 0%, #E4F0FF 50%, #F0E8FF 100%);
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 40px;
  -webkit-tap-highlight-color: transparent;
}

body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(24px);
}
body::before {
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(168,155,245,0.5), transparent 70%);
  top: -120px; left: -120px;
  animation: float1 16s ease-in-out infinite;
}
body::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(107,207,191,0.45), transparent 70%);
  bottom: -160px; right: -160px;
  animation: float2 20s ease-in-out infinite;
}
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,40px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-40px,-30px); } }

.quiz-container {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 28px;
  padding: 22px 24px 28px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 620px;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.quiz-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease;
}
.back-btn:hover { transform: translateX(-3px); }
.back-btn:active { transform: scale(0.92); }

.quiz-header h1 {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(135deg, #7C6FE0, #6BCFBF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-badge {
  background: white;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  box-shadow: var(--shadow-soft);
  min-width: 58px;
  text-align: center;
}

.progress-bar {
  height: 10px;
  background: rgba(124, 111, 224, 0.15);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7C6FE0, #6BCFBF);
  border-radius: 10px;
  width: 0;
  transition: width 0.45s ease;
}

/* ---------- 开始页 ---------- */
.menu-card {
  background: white;
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: pop 0.45s cubic-bezier(.34,1.56,.64,1);
}
.menu-emoji {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 14px;
  display: inline-block;
  animation: bounce 2.2s ease-in-out infinite;
}
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.menu-card h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}
.menu-card p {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.menu-card p b { color: var(--primary); }

.start-btn, .next-btn {
  background: linear-gradient(135deg, #7C6FE0, #A89BF5);
  color: white;
  border: none;
  padding: 13px 38px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(124, 111, 224, 0.4);
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.start-btn:hover, .next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(124, 111, 224, 0.5);
}
.start-btn:active, .next-btn:active { transform: translateY(0); }

/* ---------- 题目卡片 ---------- */
.question-card {
  background: white;
  border-radius: 22px;
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-soft);
  animation: slideIn 0.35s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.q-label {
  display: inline-block;
  background: linear-gradient(135deg, #7C6FE0, #A89BF5);
  color: white;
  padding: 5px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.q-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 20px;
}
.options { display: grid; gap: 10px; }
.option {
  background: var(--primary-bg);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
  width: 100%;
}
.option:hover:not(.disabled) {
  background: #E9E4FF;
  transform: translateX(3px);
}
.option:active:not(.disabled) { transform: scale(0.98); }
.option .letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.option .text { flex: 1; }
.option.disabled { cursor: default; }
.option.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  animation: correctPulse 0.5s ease;
}
.option.correct .letter { background: var(--correct); color: white; }
.option.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  animation: wrongShake 0.45s ease;
}
.option.wrong .letter { background: var(--wrong); color: white; }
.option.dimmed { opacity: 0.5; }
@keyframes correctPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.explain {
  margin-top: 16px;
  padding: 14px 16px;
  background: #FFF9E6;
  border-left: 4px solid var(--yellow);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  animation: slideIn 0.35s ease;
}
.explain b { color: var(--primary); font-weight: 700; }
.explain.correct { background: #E8FAEC; border-left-color: var(--correct); }
.explain.wrong { background: #FFEDED; border-left-color: var(--wrong); }

.next-btn-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  animation: pop 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ---------- 结果页 ---------- */
.result-card {
  background: white;
  border-radius: 24px;
  padding: 34px 26px 28px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: pop 0.55s cubic-bezier(.34,1.56,.64,1);
}
.result-emoji {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 6px;
  display: inline-block;
  animation: bounce 2s ease-in-out infinite;
}
.result-score {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.1;
  margin: 8px 0 4px;
  background: linear-gradient(135deg, #7C6FE0, #6BCFBF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result-score .total {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-soft);
  -webkit-text-fill-color: var(--text-soft);
}
.result-msg {
  font-size: 18px;
  color: var(--primary);
  font-weight: 700;
  margin: 12px 0 4px;
}
.result-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 22px;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.result-actions button, .result-actions a {
  background: linear-gradient(135deg, #7C6FE0, #A89BF5);
  color: white;
  border: none;
  padding: 11px 26px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  box-shadow: 0 5px 14px rgba(124, 111, 224, 0.4);
  transition: transform 0.15s ease;
}
.result-actions button:hover, .result-actions a:hover { transform: translateY(-2px); }
.result-actions .secondary {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.review-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 10px;
  text-align: left;
  padding-left: 4px;
}
.review-list {
  text-align: left;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px;
}
.review-list::-webkit-scrollbar { width: 6px; }
.review-list::-webkit-scrollbar-thumb { background: rgba(124,111,224,0.3); border-radius: 4px; }
.review-item {
  background: var(--primary-bg);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.review-item.ok { background: #EAF9EF; }
.review-item.no { background: #FFEDED; }
.review-item .mark { font-size: 16px; flex-shrink: 0; }
.review-item .n { font-weight: 700; color: var(--primary); flex-shrink: 0; min-width: 44px; }
.review-item.ok .n { color: var(--correct); }
.review-item.no .n { color: var(--wrong); }
.review-item .q {
  flex: 1;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .quiz-container { padding: 16px 18px 22px; border-radius: 22px; }
  .quiz-header h1 { font-size: 16px; }
  .back-btn { width: 36px; height: 36px; font-size: 20px; }
  .progress-badge { font-size: 12px; padding: 6px 10px; min-width: 52px; }
  .q-text { font-size: 16px; }
  .option { font-size: 14px; padding: 12px 14px; }
  .menu-card, .result-card { padding: 28px 20px; }
  .menu-card h2 { font-size: 21px; }
  .result-score { font-size: 48px; }
  .result-emoji { font-size: 60px; }
}
