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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 头部 */
.site-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px 0;
  text-align: center;
}

.site-header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

.site-header .subtitle {
  font-size: 14px;
  opacity: 0.9;
}

/* 标签页 */
.tabs {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tabs .container {
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #667eea;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 600;
}

.tab-content {
  display: none;
  padding: 24px 0;
}

.tab-content.active {
  display: block;
}

/* 搜索框 */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: #667eea;
}

.search-box button {
  padding: 12px 28px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-box button:hover {
  background: #5568d3;
}

/* 筛选器 */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters select {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  min-width: 140px;
}

/* 结果卡片 */
.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.student-card {
  background: white;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.student-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.student-info h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.student-info .meta {
  color: #888;
  font-size: 13px;
}

.student-info .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 8px;
  font-weight: 500;
}

.tag-wuli { background: #e3f2fd; color: #1976d2; }
.tag-lishi { background: #fce4ec; color: #c2185b; }

.student-scores {
  text-align: right;
  display: flex;
  gap: 20px;
  align-items: center;
}

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

.score-item .num {
  font-size: 22px;
  font-weight: bold;
  color: #667eea;
}

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

.rank-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: #fff3e0;
  color: #f57c00;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.pagination button.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 榜单列表 */
.rank-list {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.rank-item {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
  gap: 12px;
}

.rank-item:hover {
  background: #f9f9ff;
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-num {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

.rank-1 { color: #ff6b35; }
.rank-2 { color: #ff9f43; }
.rank-3 { color: #ffd93d; }

.rank-name {
  font-size: 16px;
  font-weight: 500;
}

.rank-meta {
  color: #888;
  font-size: 13px;
}

.rank-total {
  font-size: 20px;
  font-weight: bold;
  color: #667eea;
}

.sub-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.sub-tab-btn {
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.sub-tab-btn.active {
  border-color: #667eea;
  color: #667eea;
  background: #f5f6ff;
}

/* 班级按钮 */
.class-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.class-btn {
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.class-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.close-btn {
  position: absolute;
  right: 16px;
  top: 12px;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  z-index: 10;
}

.close-btn:hover {
  color: #333;
}

#detailContent {
  padding: 24px;
}

.detail-header {
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.detail-header h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.detail-header .info {
  color: #666;
  font-size: 14px;
}

.detail-scores {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.score-card {
  background: #f8f9ff;
  border-radius: 10px;
  padding: 14px;
}

.score-card .subject {
  font-size: 14px;
  color: #666;
  margin-bottom: 6px;
}

.score-card .score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.score-card .score {
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
}

.score-card .scaled {
  font-size: 18px;
  font-weight: bold;
  color: #f57c00;
}

.score-card .rank-info {
  font-size: 12px;
  color: #888;
}

.score-card.full-width {
  grid-column: span 2;
  background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
}

.score-card.full-width .score {
  font-size: 32px;
}

.grade-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

.grade-a { background: #e8f5e9; color: #2e7d32; }
.grade-b { background: #e3f2fd; color: #1565c0; }
.grade-c { background: #fff3e0; color: #e65100; }
.grade-d { background: #fce4ec; color: #c62828; }

.detail-ranks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.rank-card {
  text-align: center;
  background: #fff8e1;
  border-radius: 10px;
  padding: 14px;
}

.rank-card .rank-num {
  font-size: 28px;
  font-weight: bold;
  color: #f57c00;
}

.rank-card .rank-label {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* 加载中 */
.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* 底部 */
.site-footer {
  background: #fff;
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
  color: #888;
  font-size: 13px;
  border-top: 1px solid #eee;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .site-header h1 { font-size: 22px; }
  .student-card { flex-direction: column; align-items: flex-start; }
  .student-scores { width: 100%; justify-content: space-between; }
  .detail-scores { grid-template-columns: 1fr; }
  .score-card.full-width { grid-column: span 1; }
  .detail-ranks { grid-template-columns: 1fr; }
  .rank-item { grid-template-columns: 40px 1fr auto; }
  .rank-item .rank-meta { display: none; }
}
