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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

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

/* Profile Header */
.profile-header {
  background: white;
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 25px;
}

.profile-avatar {
  font-size: 80px;
  color: #667eea;
}

.profile-info h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 10px;
}

.points-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  color: #666;
  font-weight: 600;
}

.points-display i {
  color: #f39c12;
  font-size: 1.5rem;
}

/* Level Section */
.level-section {
  margin-bottom: 30px;
}

.level-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  padding: 1.5rem;
  color: white;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.level-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.level-number {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  backdrop-filter: blur(10px);
}

.level-title {
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.level-stats {
  text-align: right;
}

.total-xp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.xp-label {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.xp-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.xp-progress {
  margin-top: 1rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.current-progress {
  font-weight: 500;
}

.next-level {
  opacity: 0.8;
}

.progress-bar {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
  backdrop-filter: blur(5px);
}

.progress-fill {
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s ease;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.4);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
}

.stats-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.stats-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: #333;
  font-size: 1.4rem;
}

/* ELO Ratings - Updated to show only 2 variants */
.elo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Changed from 4 to 2 columns */
  gap: 15px;
}

.elo-item {
  text-align: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  transition: background-color 0.3s ease;
}

.elo-item:hover {
  background: #e9ecef;
}

.elo-variant {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.elo-rating {
  font-size: 1.8rem;
  font-weight: bold;
  color: #667eea;
}

/* Game Statistics */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  transition: background-color 0.3s ease;
}

.stat-item:hover {
  background: #e9ecef;
}

.stat-item.wins {
  background: #d4edda;
}

.stat-item.wins:hover {
  background: #c3e6cb;
}

.stat-item.losses {
  background: #f8d7da;
}

.stat-item.losses:hover {
  background: #f1b0b7;
}

.stat-item.draws {
  background: #fff3cd;
}

.stat-item.draws:hover {
  background: #ffeaa7;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-top: 5px;
}

/* Win Rate Bar */
.win-rate-container {
  margin-top: 20px;
}

.win-rate-label {
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

.win-rate-bar {
  position: relative;
  height: 25px;
  background: #e9ecef;
  border-radius: 12px;
  overflow: hidden;
}

.win-rate-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  border-radius: 12px;
  transition: width 0.8s ease;
  width: 0%;
}

.win-rate-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  color: #333;
  font-size: 0.9rem;
}

/* Activity Section */
.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

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

.activity-info {
  flex: 1;
}

.activity-action {
  font-weight: 600;
  color: #333;
}

.activity-details {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

.activity-amount {
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.activity-amount.positive {
  color: #28a745;
  background: #d4edda;
}

.activity-amount.negative {
  color: #dc3545;
  background: #f8d7da;
}

.activity-date {
  font-size: 0.8rem;
  color: #999;
  text-align: right;
}

.view-all-btn {
  width: 100%;
  padding: 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 15px;
  transition: background-color 0.3s ease;
}

.view-all-btn:hover {
  background: #5a6fd8;
}

/* XP Activity Styles */
.xp-activity-item {
  border-left: 3px solid #667eea;
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
}

.xp-activity-item .activity-amount {
  color: #667eea;
  font-weight: 600;
}

.xp-activity-item .activity-amount.positive {
  color: #4facfe;
  background: rgba(79, 172, 254, 0.2);
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
}

.achievement {
  text-align: center;
  padding: 15px;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.achievement.unlocked {
  background: #d4edda;
  color: #155724;
}

.achievement.locked {
  background: #f8f9fa;
  color: #999;
  opacity: 0.6;
}

.achievement:hover {
  transform: scale(1.05);
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.achievement-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.achievement-desc {
  font-size: 0.7rem;
  margin-top: 4px;
}

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

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: 25px;
  max-height: 60vh;
  overflow-y: auto;
}

.activity-filters {
  margin-bottom: 20px;
}

.activity-filters select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  background: white;
}

/* Loading States */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-spinner {
  text-align: center;
  color: #667eea;
}

.loading-spinner i {
  font-size: 3rem;
  margin-bottom: 15px;
}

.loading-spinner p {
  font-size: 1.1rem;
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
    padding: 20px;
  }

  .profile-info h1 {
    font-size: 2rem;
  }

  .level-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .level-stats {
    text-align: center;
  }

  .total-xp {
    align-items: center;
  }

  .progress-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .elo-grid {
    grid-template-columns: 1fr; /* Single column on mobile for 2 variants */
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
}

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

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
  }

  .modal,
  .loading-overlay {
    display: none !important;
  }

  .stats-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
