/* ===== 基础样式 ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --success: #34c759;
  --error: #ff3b30;
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --border: #d1d1d6;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
}

.page {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ===== 首页样式 ===== */
.home-header {
  text-align: center;
  padding: 2rem 0;
}

.home-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.home-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.home-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== 按钮样式 ===== */
.btn {
  display: block;
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e8e8ed;
}

.badge {
  background: var(--error);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* ===== 答题页面样式 ===== */
.practice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.progress-info {
  font-size: 1rem;
  font-weight: 600;
}

.correct-rate-display {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.correct-rate-display span {
  color: var(--success);
  font-weight: 600;
}

.question-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.question-num {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.question-content {
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ===== 选项样式 ===== */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.option-item {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.option-item:hover {
  border-color: var(--primary);
}

.option-item.selected {
  border-color: var(--primary);
  background: #e8f4fd;
}

.option-item.correct {
  border-color: var(--success);
  background: rgba(52, 199, 89, 0.1);
}

.option-item.wrong {
  border-color: var(--error);
  background: rgba(255, 59, 48, 0.1);
}

.option-letter {
  width: 2rem;
  height: 2rem;
  background: var(--bg-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: white;
}

.option-item.correct .option-letter {
  background: var(--success);
  color: white;
}

.option-item.wrong .option-letter {
  background: var(--error);
  color: white;
}

.option-text {
  flex: 1;
  font-size: 1rem;
}

/* ===== 反馈样式 ===== */
.feedback-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.feedback-container.correct-feedback {
  border-left: 4px solid var(--success);
}

.feedback-container.wrong-feedback {
  border-left: 4px solid var(--error);
}

.feedback-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.feedback-message {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feedback-container.correct-feedback .feedback-message {
  color: var(--success);
}

.feedback-container.wrong-feedback .feedback-message {
  color: var(--error);
}

.feedback-explanation {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.action-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===== 错题页面样式 ===== */
.wrong-header {
  text-align: center;
  padding: 1.5rem 0;
}

.wrong-header h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.wrong-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.wrong-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wrong-item:hover {
  background: #e8e8ed;
}

.wrong-item-content {
  flex: 1;
}

.wrong-item-num {
  font-size: 0.85rem;
  color: var(--error);
  font-weight: 600;
}

.wrong-item-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.wrong-item-arrow {
  color: var(--text-secondary);
  font-size: 1.25rem;
}

/* ===== 完成页面样式 ===== */
.complete-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-top: 2rem;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.complete-card h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.complete-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

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

.complete-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.complete-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.complete-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===== 响应式适配 ===== */
@media (max-width: 380px) {
  .home-header h1 {
    font-size: 1.25rem;
  }

  .question-content {
    font-size: 1rem;
  }

  .option-text {
    font-size: 0.9rem;
  }
}
