:root {
  --primary-color: #07C160;
  --primary-dark: #06AD56;
  --primary-light: #E8F5E9;
  --danger-color: #FA5151;
  --danger-light: #FFEBEE;
  --info-color: #1989FA;
  --info-light: #E3F2FD;
  --bg-color: #F7F8FA;
  --card-bg: #FFFFFF;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border-color: #E8E8E8;
  --correct-color: #07C160;
  --correct-bg: #E8F5E9;
  --wrong-color: #FA5151;
  --wrong-bg: #FFEBEE;
  --law-highlight-bg: #E6F7FF;
  --law-highlight-text: #1890FF;
  --hover-bg: #F2F3F5;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 首页统计卡片 */
.stats-card {
  margin-bottom: 16px;
}

.subject-switcher {
  display: flex;
  background: var(--hover-bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}

.subject-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  background: transparent;
}

.subject-tab.active {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* 进度条 */
.progress-section {
  margin-top: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), #52c41a);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-detail {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* 模式网格 */
.modes-section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-left: 4px;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mode-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}

.mode-item:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.mode-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.mode-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.mode-desc {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

/* 考试记录 */
.exam-section {
  margin-bottom: 16px;
}

.exam-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.exam-info {
  display: flex;
  flex-direction: column;
}

.exam-subject {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.exam-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.exam-score {
  font-size: 18px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 16px;
}

.exam-score.pass {
  color: var(--primary-color);
  background: var(--primary-light);
}

.exam-score.fail {
  color: var(--danger-color);
  background: var(--danger-light);
}

/* 底部提示 */
.footer-tip {
  text-align: center;
  padding: 20px 0;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 顶部栏 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  font-size: 20px;
  color: var(--text-secondary);
  padding: 4px;
  cursor: pointer;
  background: none;
  border: none;
}

.progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.exam-timer {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: monospace;
}

.exam-timer.warning {
  color: var(--danger-color);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.favorite-btn {
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  background: none;
  border: none;
}

.favorite-btn.active {
  color: #FFC300;
}

/* 顶部进度条 */
.progress-bar-top {
  height: 3px;
  background: var(--border-color);
}

.progress-fill-top {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

/* 题目内容 */
.question-container {
  padding: 16px;
  min-height: calc(100vh - 120px);
}

.question-header {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.question-type-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.question-type-tag.single {
  background: var(--primary-light);
  color: var(--primary-color);
}

.question-type-tag.judge {
  background: var(--info-light);
  color: var(--info-color);
}

.question-type-tag.multi {
  background: var(--danger-light);
  color: var(--danger-color);
}

.difficulty-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.difficulty-tag.easy {
  background: #E8F5E9;
  color: #4CAF50;
}

.difficulty-tag.medium {
  background: #FFF3E0;
  color: #FF9800;
}

.difficulty-tag.hard {
  background: #FFEBEE;
  color: #F44336;
}

.chapter-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--hover-bg);
  color: var(--text-tertiary);
}

.question-text {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 20px;
}

/* 选项 */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.option-item:active {
  background: var(--hover-bg);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hover-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.5;
}

.option-status {
  font-size: 18px;
  margin-left: 8px;
}

/* 答题后状态 */
.option-item.correct {
  border-color: var(--correct-color);
  background: var(--correct-bg);
}

.option-item.correct .option-letter {
  background: var(--correct-color);
  color: #fff;
}

.option-item.wrong {
  border-color: var(--wrong-color);
  background: var(--wrong-bg);
}

.option-item.wrong .option-letter {
  background: var(--wrong-color);
  color: #fff;
}

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

/* 解析区域 */
.analysis-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.analysis-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.analysis-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 干扰项分析 */
.distractor-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.distractor-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger-color);
  margin-bottom: 8px;
}

.distractor-item {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--danger-color);
}

/* 法条区域 */
.law-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.law-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--law-highlight-text);
  margin-bottom: 10px;
}

.law-item {
  background: var(--law-highlight-bg);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
}

.law-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--law-highlight-text);
  margin-bottom: 6px;
}

.law-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.law-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--law-highlight-text);
  font-size: 16px;
}

/* 标签 */
.tags-section {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.tag-item {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--hover-bg);
  color: var(--text-tertiary);
}

/* 底部工具栏 */
.bottom-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 16px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
}

.bottom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 20px;
  cursor: pointer;
  background: none;
  border: none;
}

.bottom-btn-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-btn-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.submit-btn {
  background: var(--primary-color);
  border-radius: 20px;
}

.submit-btn .bottom-btn-text {
  color: #fff;
}

/* 页面切换动画 */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  max-width: 300px;
  width: 90%;
  text-align: center;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  white-space: pre-line;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.modal-btn.cancel {
  background: var(--hover-bg);
  color: var(--text-secondary);
}

.modal-btn.confirm {
  background: var(--primary-color);
  color: #fff;
}
