﻿/* ===== 游戏化主题样式 ===== */
:root {
  --primary: #4A90D9;
  --primary-light: #6BB5FF;
  --secondary: #FF9F43;
  --success: #2ED573;
  --danger: #FF4757;
  --warning: #FFA502;
  --purple: #A55EEA;
  --pink: #FF6B9D;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  overflow-x: hidden;
  color: #333;
}

/* ===== 登录页 ===== */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: slideUp 0.6s ease;
}

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

.login-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 30px;
}

.avatar-select {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.avatar-option {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  background: #f0f0f0;
}

.avatar-option:hover { transform: scale(1.1); }
.avatar-option.selected {
  border-color: var(--primary);
  background: #E8F4FD;
  transform: scale(1.15);
}

.input-group {
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: border-color 0.3s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  width: 100%;
  box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 217, 0.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--warning));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 159, 67, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #7BED9F);
  color: white;
  box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #FF6B81);
  color: white;
}

.btn-sm { padding: 10px 20px; font-size: 14px; }

/* ===== 页面容器 ===== */
.page-container {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: 100px;
}

/* ===== 顶部导航 ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  margin-bottom: 20px;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.2);
  padding: 8px 14px;
  border-radius: 20px;
  color: white;
  font-size: 14px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.card:hover { transform: translateY(-2px); }

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-text {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* ===== 年级选择 ===== */
.grade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grade-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
}

.grade-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.grade-card.selected {
  border-color: var(--primary);
  background: #E8F4FD;
}

.grade-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.grade-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.grade-desc {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* ===== 测试页 ===== */
.timer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.timer-display {
  font-size: 20px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.timer-display.warning { animation: pulse 1s infinite; }

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

.progress-text {
  font-size: 14px;
  color: #666;
}

.question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.question-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.question-num {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.question-type {
  font-size: 12px;
  color: #888;
  background: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
}

.question-content {
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 20px;
  font-weight: 500;
}

/* ===== 选项样式 ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  padding: 14px 18px;
  border: 2px solid #e8e8e8;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.option-item.selected {
  border-color: var(--primary);
  background: #E8F4FD;
  font-weight: 600;
}

.option-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

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

.answer-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 18px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
}

.answer-input:focus { border-color: var(--primary); }

/* ===== 判断题 ===== */
.true-false-btns {
  display: flex;
  gap: 16px;
}

.tf-btn {
  flex: 1;
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  font-size: 24px;
  font-weight: 700;
  transition: all 0.3s ease;
  text-align: center;
}

.tf-btn:hover { transform: scale(1.02); }
.tf-btn.selected {
  border-color: var(--primary);
  background: #E8F4FD;
}

.tf-btn.true.selected { border-color: var(--success); background: #E8FFF3; }
.tf-btn.false.selected { border-color: var(--danger); background: #FFF0F0; }

/* ===== 结果页 ===== */
.result-score {
  text-align: center;
  padding: 30px 0;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  color: white;
  position: relative;
}

.score-circle.excellent { background: linear-gradient(135deg, var(--success), #7BED9F); }
.score-circle.good { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.score-circle.pass { background: linear-gradient(135deg, var(--warning), #FFCC00); }
.score-circle.fail { background: linear-gradient(135deg, var(--danger), #FF6B81); }

.score-label {
  font-size: 16px;
  color: #666;
  margin-bottom: 4px;
}

.score-detail {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
}

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

.score-stat-num {
  font-size: 28px;
  font-weight: 700;
}

.score-stat-label {
  font-size: 12px;
  color: #888;
}

/* ===== 错题分析 ===== */
.analysis-section {
  margin-bottom: 20px;
}

.analysis-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kp-bar {
  margin-bottom: 10px;
}

.kp-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.kp-bar-track {
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.kp-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  color: white;
  font-weight: 600;
}

.kp-bar-fill.high { background: linear-gradient(90deg, var(--danger), #FF6B81); }
.kp-bar-fill.medium { background: linear-gradient(90deg, var(--warning), #FFCC00); }
.kp-bar-fill.low { background: linear-gradient(90deg, var(--success), #7BED9F); }

/* ===== 错题列表 ===== */
.wrong-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--danger);
}

.wrong-q {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

-wrong-a {
  font-size: 13px;
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.wrong-my { color: var(--danger); }
.wrong-correct { color: var(--success); }

.cause-select {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cause-tag {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  border: 1.5px solid #ddd;
  background: white;
  transition: all 0.2s;
}

.cause-tag:hover { border-color: var(--primary); }
.cause-tag.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  z-index: 200;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  color: #999;
  transition: color 0.3s;
}

.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 22px; }

/* ===== 动画 ===== */
.bounce-in {
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.feedback-correct {
  color: var(--success);
  font-weight: 700;
  animation: bounceIn 0.4s ease;
}

.feedback-wrong {
  color: var(--danger);
  font-weight: 700;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ===== 徽章 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-gold { background: #FFF8E1; color: #F57F17; }
.badge-silver { background: #F5F5F5; color: #616161; }
.badge-bronze { background: #FFF3E0; color: #E65100; }

/* ===== 响应式 ===== */
@media (max-width: 360px) {
  .grade-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .question-content { font-size: 16px; }
}

/* ===== 浮动装饰 ===== */
.floating-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.shape {
  position: absolute;
  opacity: 0.1;
  font-size: 40px;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* ===== 加载动画 ===== */
.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 连击动画 ===== */
.combo-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: 0 4px 20px rgba(255, 159, 67, 0.5);
  pointer-events: none;
  z-index: 300;
  animation: comboAnim 0.8s ease forwards;
}

@keyframes comboAnim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}
