:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --accent: #e74c3c;
  --bg: #f5f6fa;
  --card-bg: #fff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #dcdde1;
  --success: #27ae60;
  --warning: #f39c12;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: 1.5rem;
}

.header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.header nav a, .header nav button {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.header nav a:hover, .header nav button:hover {
  background: rgba(255,255,255,0.3);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card h2 {
  margin-bottom: 1rem;
  color: var(--primary);
}

/* 登录页 */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.login-box {
  background: white;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #c0c0c0;
}

.btn-danger {
  background: var(--accent);
  color: white;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.switch-link {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-light);
}

.switch-link a {
  color: var(--primary-light);
  text-decoration: none;
}

.error-msg {
  color: var(--accent);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* 赛程表格 */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

tr:hover {
  background: #f8f9fa;
}

.stage-header {
  background: #eef2f7;
  font-weight: 600;
  color: var(--primary);
}

.score-input {
  width: 50px;
  text-align: center;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
}

.score-display {
  font-weight: bold;
  font-size: 1.1rem;
}

/* 预测卡片 */
.prediction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

.prediction-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary-light);
}

.prediction-card.completed {
  border-left-color: var(--success);
}

.prediction-card .match-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.prediction-card .teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.prediction-card .team {
  text-align: center;
  flex: 1;
}

.prediction-card .team-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.prediction-card .vs {
  font-size: 1.2rem;
  color: var(--text-light);
  padding: 0 0.5rem;
}

.prediction-card .score-inputs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  align-items: center;
}

.prediction-card .actual-score {
  color: var(--success);
  font-weight: bold;
  font-size: 1.2rem;
}

/* 排行榜 */
.leaderboard-table {
  max-width: 700px;
  margin: 0 auto;
}

.leaderboard-table .rank {
  width: 50px;
  text-align: center;
}

.leaderboard-table .rank-1 { color: gold; font-size: 1.2rem; }
.leaderboard-table .rank-2 { color: silver; font-size: 1.1rem; }
.leaderboard-table .rank-3 { color: #cd7f32; font-size: 1.1rem; }

.points-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: bold;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar select, .filter-bar input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.filter-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* 用户选择下拉 */
.user-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tab 切换 */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* 管理面板 */
.admin-section {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

.import-area {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
}

.import-area textarea {
  width: 100%;
  min-height: 200px;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}

/* 移动端底部导航 */
.mobile-nav {
  display: none;
}

/* 响应式 */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }
  .header nav a[data-page],
  .header nav #user-info {
    display: none;
  }
  .container {
    padding: 1rem;
    padding-bottom: 5rem;
  }
  .prediction-grid {
    grid-template-columns: 1fr;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    padding: 0.5rem 0;
    padding-bottom: env(safe-area-inset-bottom, 0.5rem);
  }
  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    padding: 0.4rem 0;
    transition: color 0.2s;
  }
  .mobile-nav-item.active {
    color: var(--primary);
  }
  .mobile-nav-icon {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
  }
  .mobile-nav-label {
    font-size: 0.7rem;
  }
}

/* Toast 通知 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--accent); }
.toast.info { background: var(--primary-light); }

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