.container {
  max-width: 2000px;
  margin: 0 auto;
  background: var(--bg-container);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.1);
  min-height: calc(100vh - 48px); /* 至少充满屏幕高度，减去一些边距 */
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--bg-header);
  padding: 15px 30px; /* 减小内边距以缩小高度 */
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px; /* 减小间距 */
  position: relative; /* 为绝对定位按钮提供上下文 */
}

.header h1 {
  font-size: 24px; /* 减小字体大小 */
  font-weight: 700;
  margin-bottom: 0; /* 移除底部边距 */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px; /* 减小间距 */
  flex-wrap: wrap;
}

/* 最左上角按钮样式 */
.top-left-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 100; /* 确保在最上层 */
}

.top-left-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

/* Puter.js 登录状态 - 放在页面最右上角 */
.puter-login-status {
  position: absolute;
  top: 10px;
  right: 20px;
  background: rgba(15, 23, 42, 0.8);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  border: 1px solid rgba(148, 163, 184, 0.3);
  backdrop-filter: blur(4px);
}

.puter-login-status span {
  color: #cbd5e1;
}

.puter-login-status button {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  cursor: pointer;
  transition: all 0.2s ease;
}

.puter-login-status button:hover {
  background: rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

.puter-login-status #puterLogoutBtn {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.puter-login-status #puterLogoutBtn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* 移除不再使用的.header-buttons样式，按钮已移到.table-buttons */

/* 表格区域按钮容器 - 放在table-section内部，table-wrapper外面 */
.table-section {
  flex: 1;
  min-width: 0;
  background: var(--bg-panel-light);
  border-radius: 20px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative; /* 为绝对定位按钮提供上下文 */
}

.table-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: absolute;
  top: 15px;
  right: 20px;
  z-index: 100; /* 提高z-index确保在表格上方 */
}

.table-buttons button {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9); /* 提高背景透明度 */
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3), /* 基础阴影 */
    0 0 8px rgba(255, 255, 255, 0.1); /* 微微发光效果 */
}

.table-buttons button:hover {
  background: rgba(51, 65, 85, 0.8);
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(255, 255, 255, 0.15); /* 悬停时发光更强 */
}

.table-buttons .import-btn {
  background: rgba(16, 185, 129, 0.25); /* 提高透明度 */
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(16, 185, 129, 0.3); /* 绿色发光效果 */
}

.table-buttons .import-btn:hover {
  background: rgba(16, 185, 129, 0.35);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(16, 185, 129, 0.4); /* 悬停时绿色发光更强 */
}

.table-buttons .export-btn {
  background: rgba(14, 165, 233, 0.25); /* 提高透明度 */
  color: #0ea5e9;
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(14, 165, 233, 0.3); /* 蓝色发光效果 */
}

.table-buttons .export-btn:hover {
  background: rgba(14, 165, 233, 0.35);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(14, 165, 233, 0.4); /* 悬停时蓝色发光更强 */
}

/* 导入比分按钮在表格区域的样式 */
.table-buttons .import-score-btn {
  background: rgba(16, 185, 129, 0.25); /* 绿色背景，提高透明度 */
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(16, 185, 129, 0.3); /* 绿色发光效果 */
}

.table-buttons .import-score-btn:hover {
  background: rgba(16, 185, 129, 0.35);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(16, 185, 129, 0.4); /* 悬停时绿色发光更强 */
}

/* 历史文件按钮在表格区域的样式 */
.table-buttons .history-btn {
  background: rgba(245, 158, 11, 0.25); /* 橙色背景，提高透明度 */
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(245, 158, 11, 0.3); /* 橙色发光效果 */
}

.table-buttons .history-btn:hover {
  background: rgba(245, 158, 11, 0.35);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(245, 158, 11, 0.4); /* 悬停时橙色发光更强 */
}

.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 24px 30px;
  flex: 1; /* 填充剩余空间 */
}

.storage-notice {
  padding: 10px 20px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  font-weight: 500;
}

/* 确保表格容器有足够的顶部内边距，避免内容被按钮遮挡 */
.table-wrapper {
  overflow-x: auto;
  flex: 1;
  padding-top: 50px; /* 增加顶部内边距，为按钮留出空间 */
}

/* 左侧主表格需要最小宽度以确保所有列可见 */
#matchTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 800px;
}

/* 右侧统计表格不需要最小宽度，使用自适应宽度 */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  min-width: 0; /* 重置最小宽度 */
}

thead {
  background: rgba(15, 23, 42, 0.95);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 14px 10px;
  text-align: left;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #334155;
  white-space: nowrap;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  vertical-align: middle;
}

tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background: rgba(51, 65, 85, 0.4);
  transform: translateX(4px);
}

tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.3);
}

th:first-child,
td:first-child {
  text-align: center;
  width: 80px;
}

.stats-section {
  width: 300px; /* 增大右侧区域整体宽度 */
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  align-self: start;
  max-height: calc(100vh - 160px);
}

.stats-panel {
  padding: 16px 14px 20px;
}

.legend {
  display: flex;
  gap: 20px;
  padding: 14px 30px;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  flex-wrap: wrap;
  font-size: 11.5px;
  color: #94a3b8;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 1150px) {
  .stats-section {
    width: 280px; /* 响应式宽度调整为280px */
    overflow-x: hidden;
  }
  .stats-grid {
    gap: 10px;
  }
}

@media (max-width: 950px) {
  .dashboard {
    flex-direction: column;
  }
  .stats-section {
    width: 100%;
    max-height: 420px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 550px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  th, td {
    padding: 8px 6px;
    font-size: 11px;
  }
  .prediction, .risk-badge, .confidence-badge {
    font-size: 10px;
    padding: 3px 6px;
  }
}
