* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --bottom-nav-height: 64px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--gray-50);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.6;
}

.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ── 首页 ── */

.header {
  padding: 48px 24px 40px;
  text-align: center;
  color: white;
  background: linear-gradient(135deg, #fb923c, #ec4899, #8b5cf6, #6366f1, #22d3ee, #34d399, #22d3ee, #6366f1, #8b5cf6, #ec4899, #fb923c);
  background-size: 800% 800%;
  animation: gradient-shift 180s ease infinite;
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}

.header h1 { font-size: 28px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.subtitle { font-size: 14px; opacity: 0.8; }

.paper-list {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.random-btn-wrap {
  text-align: center;
  padding: 0 20px 32px;
}
.btn-random {
  background: white;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 14px 32px;
  font-size: 15px; font-weight: 600;
  color: var(--gray-500);
  cursor: pointer; transition: all 0.2s;
  width: 100%;
  max-width: 340px;
}
.btn-random:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.paper-item {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
}

.paper-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0;
  transition: opacity 0.2s;
}

.paper-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.paper-item:hover::before { opacity: 1; }

.paper-number {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  color: var(--primary); background: var(--primary-bg);
  padding: 2px 10px; border-radius: 20px; margin-bottom: 8px;
}

.paper-item h3 { font-size: 15px; color: var(--gray-800); margin-bottom: 6px; }
.paper-item p { font-size: 12px; color: var(--gray-400); }
.loading { text-align: center; padding: 60px 0; color: var(--gray-400); font-size: 16px; }

/* ── 练习页 ── */

.practice-header {
  background: white;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.btn-back {
  background: none;
  color: var(--primary);
  border: 1px solid var(--gray-200);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn-back:hover { background: var(--gray-50); }

.practice-header h2 { font-size: 16px; font-weight: 600; color: var(--gray-800); flex: 1; }

.part-indicator {
  background: var(--primary); color: white;
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}

/* ── 练习主体 ── */

.practice-container {
  display: flex;
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  gap: 20px;
  padding: 20px;
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
  align-items: flex-start;
}

.question-area { flex: 1; min-width: 0; }

/* ── 单题卡片 ── */

.question-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

/* ── 部分提示框 ── */

.part-tip-box {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  padding: 16px 22px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.part-tip-label { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.part-intro-text { font-size: 13px; opacity: 0.75; margin-top: 8px; line-height: 1.7; }

.part-tip-box.tip-muted {
  background: var(--gray-200);
  color: var(--gray-400);
  box-shadow: none;
}
.part-tip-box.tip-muted .part-tip-label { color: var(--gray-400); }
.part-tip-box.tip-muted .part-intro-text { color: var(--gray-400); opacity: 0.6; }

/* ── 分组标签条 ── */

.group-label-bar {
padding: 10px 22px;
font-size: 14px; font-weight: 600;
color: var(--primary); background: var(--primary-bg);
border-radius: var(--radius);
margin-bottom: 12px;
border: 1px solid rgba(79, 70, 229, 0.12);
}

.group-question-card { margin-bottom: 12px; }
.group-question-card:last-of-type { margin-bottom: 0; }

/* ── 题号栏 ── */

.question-number-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px 0;
}

.q-number { font-size: 14px; font-weight: 600; color: var(--primary); }

.q-answered-tag {
  font-size: 11px; color: var(--success); background: var(--success-light);
  padding: 2px 10px; border-radius: 20px; font-weight: 500;
}

/* ── 题目文本 ── */

.q-text { padding: 10px 22px; font-size: 16px; line-height: 1.8; color: var(--gray-700); }

/* ── 题目图片 ── */

.q-images { padding: 10px 22px; display: flex; flex-wrap: wrap; gap: 12px; }
.q-images img { max-width: 100%; max-height: 200px; border-radius: 8px; }

/* ── 选项 ── */

.q-options { padding: 6px 22px 18px; display: flex; flex-direction: column; gap: 10px; }

.q-options.q-options-horizontal {
  flex-direction: row; flex-wrap: wrap; gap: 12px;
}

.q-options.q-options-horizontal .option-item {
  flex: 1 1 auto; min-width: 140px;
  flex-direction: column; text-align: center;
  padding: 14px 12px;
}

.q-options.q-options-horizontal .option-item .option-label { margin-bottom: 8px; }
.q-options.q-options-horizontal .option-item .option-content img { max-height: 100px; max-width: 100%; }

.option-item {
  display: flex; align-items: center;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  gap: 12px;
}

.option-item:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.option-item.selected { border-color: var(--primary); background: var(--primary-bg); }

.option-item .option-label {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-200); color: var(--gray-600);
  border-radius: 50%;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0; transition: all 0.15s;
}

.option-item.selected .option-label { background: var(--primary); color: white; }
.option-item .option-content { flex: 1; font-size: 15px; color: var(--gray-700); }
.option-item .option-content img { max-height: 70px; border-radius: 4px; }

/* ── 音频播放器 ── */

.audio-player-inline {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

.audio-label { font-size: 13px; font-weight: 500; color: var(--gray-500); white-space: nowrap; }
.audio-player-inline audio { flex: 1; height: 36px; min-width: 0; }

/* ── 自动播放状态栏 ── */

.auto-play-bar {
display: none;
align-items: center;
justify-content: space-between;
padding: 10px 22px;
background: var(--warning-light);
border-top: 1px solid rgba(217, 119, 6, 0.15);
}

.auto-play-bar.active {
display: flex;
animation: pulse-bg 2s ease-in-out infinite;
border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes pulse-bg {
  0%, 100% { background: var(--warning-light); }
  50% { background: #fde68a; }
}

.auto-play-status {
  font-size: 13px; font-weight: 500; color: var(--warning);
}

.btn-auto-skip {
  background: var(--warning); color: white;
  border: none; padding: 4px 14px;
  border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 500;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn-auto-skip:hover { background: #b45309; }

/* ── 朗读短文 ── */

.reading-passage {
  padding: 22px;
  font-size: 16px; line-height: 2;
  color: var(--gray-700);
  background: #fffbeb;
  border-left: 4px solid var(--warning);
}

/* ── 文本输入区 ── */

.text-input-area {
  padding: 16px 22px;
  border-top: 1px solid var(--gray-100);
}

.text-input-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.text-input-box {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  resize: vertical;
  transition: border-color 0.15s;
  font-family: inherit;
}

.text-input-box:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.text-input-box-large { min-height: 120px; }

.text-input-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── 情景问答 ── */

.situation-box {
  padding: 18px 22px;
  font-size: 15px; color: var(--gray-700);
  background: var(--primary-bg);
  border-left: 4px solid var(--primary);
}

.situational-q { padding: 16px 22px; }

.situational-q-label {
  font-size: 12px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}

.situational-q-text { font-size: 16px; color: var(--gray-700); margin-bottom: 10px; }

.btn-play-q {
  background: var(--primary); color: white; border: none;
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: background 0.15s;
}
.btn-play-q:hover { background: var(--primary-light); }

/* ── 话题简述 ── */

.topic-title-box { padding: 22px; font-size: 20px; font-weight: 700; color: var(--primary); text-align: center; }
.topic-instruction { padding: 0 22px 18px; font-size: 13px; color: var(--gray-500); text-align: center; }

/* ── 参考答案折叠 ── */

.reference-details { padding: 0 22px 18px; }

.reference-details summary {
  cursor: pointer; color: var(--primary); font-weight: 500; font-size: 14px;
  padding: 8px 0; user-select: none;
}
.reference-details summary:hover { text-decoration: underline; }

.reference-content {
  margin-top: 8px; padding: 14px 16px;
  background: var(--gray-50); border-radius: var(--radius);
  font-size: 14px; line-height: 1.8; color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.reference-content .translation { color: var(--gray-500); font-size: 13px; margin-top: 8px; }

/* ── 底部固定导航栏 ── */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 24px;
}

.btn-nav {
  padding: 10px 28px;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  min-width: 90px;
}

.btn-prev {
  background: var(--gray-100); color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-prev:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-prev:not(:disabled):hover { background: var(--gray-200); }

.btn-next { background: var(--primary); color: white; }
.btn-next:hover { background: #4338ca; }

.question-counter { font-size: 15px; font-weight: 600; color: var(--gray-500); min-width: 60px; text-align: center; }

/* ── 答题卡 ── */

.answer-sheet {
  width: 260px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  position: sticky;
  top: 76px;
  flex-shrink: 0;
}

.answer-sheet h3 {
  font-size: 14px; font-weight: 600; color: var(--gray-700);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer; user-select: none;
}
.answer-toggle { float: right; font-size: 11px; transition: transform 0.3s; }
.answer-sheet.collapsed .answer-toggle { transform: rotate(180deg); }

.answer-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.35s ease;
}
.answer-sheet.collapsed .answer-body {
  max-height: 0;
}

.answer-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.answer-section-label {
  font-size: 11px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 8px 0 2px;
  border-top: 1px solid var(--gray-100);
  margin-top: 4px;
}
.answer-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.answer-sub-label {
  font-size: 10px; font-weight: 500; color: var(--primary);
  padding: 4px 0 0; letter-spacing: 0.3px;
}

.answer-sub-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.answer-sub-header span {
  display: block;
  width: 36px; margin: 0 auto;
  font-size: 10px; font-weight: 500; color: var(--primary);
  text-align: left; letter-spacing: 0.3px;
}

.answer-grid .answer-items-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.answer-item {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100); border-radius: 8px;
  font-size: 12px; font-weight: 500; color: var(--gray-500);
  cursor: pointer; transition: all 0.15s;
  border: 2px solid transparent;
}

.answer-item:hover { background: var(--gray-200); }
.answer-item.current { background: var(--primary); color: white; border-color: var(--primary); }
.answer-item.answered { background: var(--success-light); color: var(--success); border-color: var(--success); }

.btn-answer-tip {
  width: 100%; padding: 10px;
  background: var(--gray-800); color: white;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: background 0.15s;
}
.btn-answer-tip:hover { background: var(--gray-700); }
.btn-answer-tip.disabled {
  background: var(--gray-50); color: var(--gray-300);
  cursor: not-allowed; pointer-events: none;
}

/* ── 模态框 ── */

.modal {
  display: none;
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }

.modal-content {
  background: white; border-radius: var(--radius-lg);
  padding: 28px; max-width: 560px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute; top: 16px; right: 20px;
  font-size: 24px; cursor: pointer; color: var(--gray-400);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: all 0.15s;
}
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }

.modal-content h3 { font-size: 18px; font-weight: 600; color: var(--gray-800); margin-bottom: 20px; padding-right: 40px; }

.answer-content { font-size: 14px; line-height: 1.8; }

.answer-content .answer-item-detail {
  margin-bottom: 12px; padding: 14px 16px;
  background: var(--gray-50); border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.answer-content .answer-label { font-weight: 600; color: var(--primary); margin-bottom: 4px; font-size: 13px; }
.answer-content .answer-text { color: var(--gray-700); }

.answer-content .transcript {
  margin-top: 8px; padding: 10px 14px;
  background: var(--success-light); border-radius: 8px;
  color: #065f46; font-size: 13px; line-height: 1.7;
}

/* ── 反馈页面 ── */

.feedback-page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  width: 100%;
}

.fb-summary {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  text-align: center;
}

.fb-summary-title {
  font-size: 22px; font-weight: 700; margin-bottom: 20px;
}

.fb-summary-stats {
  display: flex; justify-content: center; gap: 40px;
}

.fb-stat-value {
  font-size: 32px; font-weight: 700; margin-bottom: 4px;
}

.fb-stat-label {
  font-size: 13px; opacity: 0.85;
}

.fb-item {
  background: white;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
}

.fb-item.fb-correct { border-left-color: var(--success); }
.fb-item.fb-wrong { border-left-color: var(--danger); }
.fb-item.fb-speaking { border-left-color: var(--primary); }

.fb-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}

.fb-number { font-size: 14px; font-weight: 600; color: var(--gray-700); }

.fb-result {
  font-size: 13px; font-weight: 600;
  padding: 3px 12px; border-radius: 20px;
}

.result-correct { background: var(--success-light); color: var(--success); }
.result-wrong { background: var(--danger-light); color: var(--danger); }
.result-speaking { background: var(--primary-bg); color: var(--primary); }

.fb-question { font-size: 15px; color: var(--gray-700); margin-bottom: 8px; }

.fb-answers {
  display: flex; gap: 20px; font-size: 14px;
  flex-wrap: wrap;
}

.fb-user-answer { color: var(--gray-600); }
.fb-correct-answer { color: var(--success); font-weight: 600; }

.fb-transcript {
  margin-top: 10px; padding: 10px 14px;
  background: var(--success-light); border-radius: 8px;
  color: #065f46; font-size: 13px; line-height: 1.7;
}

.fb-user-text {
  margin-top: 8px; font-size: 14px; color: var(--gray-700);
  padding: 10px 14px; background: var(--gray-50);
  border-radius: 8px; border: 1px solid var(--gray-200);
}

.fb-label { font-weight: 600; color: var(--primary); }

.feedback-actions {
  display: flex; justify-content: center; gap: 16px;
  margin-top: 24px;
}

.btn-feedback {
  padding: 12px 32px;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}

.btn-feedback-primary { background: var(--primary); color: white; }
.btn-feedback-primary:hover { background: #4338ca; }

.btn-feedback-secondary {
  background: var(--gray-100); color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-feedback-secondary:hover { background: var(--gray-200); }

/* ── 响应式 ── */

@media (max-width: 900px) {
  .practice-container { flex-direction: column; }
  .answer-sheet { width: 100%; position: static; order: -1; }
  .answer-grid { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .answer-section-label { width: 100%; }
  .answer-sub-label { width: 100%; }
  .paper-list { gap: 10px; padding: 20px 16px 32px; }
  .fb-summary-stats { gap: 24px; }
}

@media (max-width: 600px) {
  :root { --bottom-nav-height: 56px; }
  .header { padding: 32px 16px 28px; }
  .header h1 { font-size: 22px; }
  .paper-list { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 12px 24px; }
  .practice-header { padding: 0 12px; gap: 8px; }
  .practice-container { padding: 12px; gap: 12px; padding-bottom: calc(var(--bottom-nav-height) + 16px); }

  .q-options.q-options-horizontal .option-item { min-width: 100px; }

  .bottom-nav {
    gap: 12px; padding: 0 12px;
  }
  .btn-nav { padding: 8px 18px; font-size: 14px; min-width: 72px; }

  .audio-player-inline {
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 12px 16px;
  }
  .audio-player-inline audio {
    width: 100%; height: 40px;
  }
  .audio-label { font-size: 12px; }

  .auto-play-bar { padding: 8px 16px; }

  .text-input-area { padding: 12px 16px; }
  .text-input-box { min-height: 60px; font-size: 14px; padding: 10px 12px; }
  .text-input-box-large { min-height: 80px; }
  .text-input-hint { font-size: 11px; }

  .fb-summary-stats { gap: 16px; }
  .fb-stat-value { font-size: 24px; }

.fb-answers { flex-direction: column; gap: 4px; }
}
