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

:root {
  --primary: #003d7a;          /* 观安蓝 */
  --primary-light: #0056b3;
  --accent: #d4a017;           /* 金色（活动主题） */
  --accent-light: #f4c430;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a2332;
  --text-light: #5a6478;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e1e7ef;
  --shadow: 0 4px 20px rgba(0, 61, 122, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 61, 122, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部品牌栏 ===== */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 18px 32px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header .logo {
  width: 42px;
  height: 42px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--primary);
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-header .title-zh {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.app-header .title-en {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.app-header .event-tag {
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.3);
}

.app-header .lang-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.app-header .lang-toggle:hover { background: rgba(255,255,255,0.25); }

/* ===== 容器 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page {
  display: none;
}

.page.active { display: block; animation: fadeIn 0.4s ease-out; }

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

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-en {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* ===== 登录页 ===== */
.login-card {
  max-width: 520px;
  margin: 60px auto;
  padding: 48px 40px;
  text-align: center;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.login-card .welcome-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 6px;
}

.login-card h2 {
  font-size: 16px;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s;
  background: white;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 61, 122, 0.1);
}

.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-block { width: 100%; justify-content: center; }

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: var(--primary);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.event-info {
  background: linear-gradient(135deg, #f0f7ff 0%, #fff8e1 100%);
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 28px;
  text-align: left;
}

.event-info .info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

.event-info .info-row:last-child { margin-bottom: 0; }
.event-info .info-label { font-weight: 600; min-width: 80px; }

/* ===== 答题页 ===== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 12px;
}

.quiz-header .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.quiz-header .user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.quiz-progress {
  flex: 1;
  min-width: 200px;
  margin: 0 20px;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transition: width 0.4s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  text-align: center;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 16px;
  background: #f0f7ff;
  border-radius: 8px;
}

.quiz-timer.warning { color: var(--warning); background: #fff8e1; }
.quiz-timer.danger { color: var(--danger); background: #fee2e2; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-light);
}

.q-num {
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}

.q-type {
  background: #f0f7ff;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 12px;
}

.q-points {
  background: #fff8e1;
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}

.q-category {
  background: #f0fdf4;
  color: var(--success);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 12px;
}

.question-text-zh {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.6;
}

.question-text-en {
  font-size: 14px;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 20px;
  line-height: 1.5;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

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

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

.option-item .opt-key {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
}

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

.option-item .opt-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.5;
}

.option-item .opt-text-en {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
  font-style: italic;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ===== 结果页 ===== */
.result-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 48px 32px;
  border-radius: 20px;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.result-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(212, 160, 23, 0.3) 0%, transparent 70%);
  border-radius: 50%;
}

.result-hero .score-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.result-hero .score-value {
  font-size: 72px;
  font-weight: 900;
  margin: 8px 0;
  text-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.result-hero .score-rank {
  display: inline-block;
  background: rgba(212, 160, 23, 0.95);
  color: var(--primary);
  padding: 8px 24px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
  margin-top: 12px;
}

/* ===== 排行榜 ===== */
.leaderboard {
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #f8fafc;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}

.lb-item:hover { transform: translateX(4px); }

.lb-item.rank-1 {
  background: linear-gradient(135deg, #fff8e1 0%, #fef3c7 100%);
  border-color: var(--accent);
}

.lb-item.rank-2 {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
}

.lb-item.rank-3 {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border-color: #fb923c;
}

.lb-rank {
  font-size: 28px;
  font-weight: 900;
  min-width: 50px;
  text-align: center;
}

.lb-item.rank-1 .lb-rank { color: var(--accent); }
.lb-item.rank-2 .lb-rank { color: #94a3b8; }
.lb-item.rank-3 .lb-rank { color: #fb923c; }

.lb-medal {
  font-size: 24px;
}

.lb-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.lb-info { flex: 1; }
.lb-name { font-weight: 600; font-size: 16px; color: var(--text); }
.lb-detail { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.lb-score {
  text-align: right;
  min-width: 100px;
}

.lb-score-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.lb-score-time {
  font-size: 11px;
  color: var(--text-light);
}

/* ===== 管理员后台 ===== */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin: 6px 0 4px;
}

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-light);
}

.stat-card.accent { border-left-color: var(--accent); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }

.admin-table {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #f8fafc;
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.admin-table tr:hover { background: #f8fafc; }

.admin-table .rank-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.admin-table .rank-badge.gold { background: var(--accent); color: white; }
.admin-table .rank-badge.silver { background: #94a3b8; color: white; }
.admin-table .rank-badge.bronze { background: #fb923c; color: white; }
.admin-table .rank-badge.normal { background: #e2e8f0; color: var(--text-light); }

.admin-table .status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.admin-table .status-dot.completed { background: var(--success); }
.admin-table .status-dot.in-progress { background: var(--warning); }
.admin-table .status-dot.not-started { background: #cbd5e1; }

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h3 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 16px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-light); }
.detail-row .value { font-weight: 600; color: var(--text); }

.q-review {
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.q-review.correct { background: #f0fdf4; border-left: 3px solid var(--success); }
.q-review.wrong { background: #fef2f2; border-left: 3px solid var(--danger); }

.q-review-q { font-weight: 600; margin-bottom: 4px; }
.q-review-a { font-size: 12px; color: var(--text-light); }

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .login-card { padding: 32px 24px; }
  .question-card { padding: 20px; }
  .quiz-header { padding: 12px 16px; }
  .quiz-progress { order: 3; flex: 1 0 100%; margin: 0; }
  .question-text-zh { font-size: 16px; }
  .result-hero .score-value { font-size: 56px; }
  .admin-table { overflow-x: auto; }
  .admin-table table { min-width: 600px; }
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.hidden { display: none !important; }

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  font-size: 14px;
  animation: slideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
