/* 成绩历史弹窗样式 */
.history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  overflow: hidden;
}

.history-modal.show .history-modal-content {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.history-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.history-modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: all 0.3s ease;
  opacity: 0;
  z-index: 10001;
  margin: auto;
}

.history-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.history-modal-title {
  margin: 0;
  font-size: 1.5em;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 0.9em;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.clear-history-btn {
  background: rgba(220, 53, 69, 0.8);
  border-color: rgba(220, 53, 69, 0.9);
}

.clear-history-btn:hover {
  background: rgba(220, 53, 69, 1);
  border-color: rgba(220, 53, 69, 1);
}

.history-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.history-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.history-modal-body {
  padding: 25px;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

/* 统计概览样式 */
.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-item {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  backdrop-filter: blur(15px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: white;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.12) 100%);
  border-color: rgba(0, 212, 255, 0.4);
}

.stat-number {
  font-size: 2.2em;
  font-weight: bold;
  color: #00D4FF;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.stat-label {
  color: #FFFFFF;
  font-size: 0.9em;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 表格容器样式 */
.history-table-container {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecef;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.table-header h4 {
  margin: 0;
  color: #495057;
  font-size: 1.2em;
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 10px;
}

.action-button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #6c757d;
  color: white;
}

.action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-button.danger {
  background: #dc3545;
}

.action-button.danger:hover {
  background: #c82333;
}

/* 表格样式 */
.history-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.9em;
}

.history-table th {
  background: #f8f9fa;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}

.history-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e9ecef;
  color: #495057;
}

.history-table tbody tr:hover {
  background: #f8f9fa;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.score-cell {
  font-weight: 600;
  color: #667eea;
}

.delete-record {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.delete-record:hover {
  background: #f8d7da;
  color: #721c24;
}

.no-data {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 40px 20px;
}

/* 分页样式 */
.history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  background: white;
  color: #495057;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  min-width: 40px;
  font-size: 0.9em;
}

.page-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

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

.page-btn.prev,
.page-btn.next {
  min-width: 80px;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  font-size: 0.9em;
  color: #6c757d;
}

.page-jump input {
  width: 50px;
  padding: 6px 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  text-align: center;
  font-size: 0.9em;
}

.page-jump input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.jump-btn {
  padding: 6px 12px;
  border: 1px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.jump-btn:hover {
  background: #667eea;
  color: white;
}

/* 游戏内历史记录组件样式 */
.game-inline-history {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 15px;
  margin: 15px 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-header h4 {
  margin: 0;
  color: white;
  font-size: 1.1em;
  font-weight: 600;
}

.history-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.3s ease;
}

.history-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.history-content {
  animation: fadeIn 0.3s ease;
}

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

.game-inline-history .history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 15px;
}

.game-inline-history .stat-item {
  text-align: center;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-inline-history .stat-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-color: rgba(0, 212, 255, 0.4);
}

.game-inline-history .stat-number {
  font-size: 1.8em;
  font-weight: bold;
  color: #00D4FF;
  margin-bottom: 5px;
  text-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.game-inline-history .stat-label {
  color: #FFFFFF;
  font-size: 0.8em;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.history-actions {
  text-align: center;
}

.view-full-history-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.view-full-history-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .history-modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .history-modal-header {
    padding: 15px 20px;
  }
  
  .history-modal-title {
    font-size: 1.3em;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  .header-action-btn {
    padding: 6px 12px;
    font-size: 0.8em;
  }
  
  .history-modal-close {
    width: 36px;
    height: 36px;
    font-size: 1.8em;
  }
  
  .history-stats {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .history-modal-body {
    padding: 20px;
  }
  
  .table-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  /* 确保清空记录按钮在移动端可见 */
  .table-actions {
    display: flex !important;
    gap: 10px;
    width: 100%;
    justify-content: flex-start;
  }
  
  .action-button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .history-table th,
  .history-table td {
    padding: 8px 12px;
    font-size: 0.85em;
  }
  
  .history-pagination {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .page-jump {
    margin-left: 0;
    justify-content: center;
  }
  
  .page-btn {
    padding: 6px 10px;
    font-size: 0.85em;
  }
  
  .page-btn.prev,
  .page-btn.next {
    min-width: 70px;
  }

  .game-inline-history .history-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .game-inline-history {
    padding: 12px;
    margin: 10px 0;
  }
  
  .history-header h4 {
    font-size: 1em;
  }
  
  .history-toggle-btn {
    padding: 6px 10px;
    font-size: 0.9em;
  }
}

/* 确保清空记录按钮在所有情况下都可见 */
#clear-history {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 10 !important;
}

.table-actions {
  display: flex !important;
  gap: 10px;
  align-items: center;
}
