/* XP System Enhancement */
.xp-container {
  position: fixed;
  top: 2rem;
  left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 100;
}

.xp-card {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  min-width: 200px;
}

.level-display {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.xp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.xp-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.5s ease;
  position: relative;
}

.xp-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: xp-shine 2s infinite;
}

@keyframes xp-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  opacity: 0.8;
}

.streak-container {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.5rem;
}

#streak-flame {
  font-size: 1.2rem;
  transition: all 0.3s ease;
  animation: flicker 2s infinite alternate;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1deg); }
  50% { transform: scale(1.1) rotate(1deg); }
  100% { transform: scale(1) rotate(-1deg); }
}

#streak-number {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.streak-label {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Enhanced flame effects for different streak levels */
.streak-flame-cold {
  filter: grayscale(100%);
  opacity: 0.3;
}

.streak-flame-warm {
  filter: none;
  opacity: 1;
}

.streak-flame-hot {
  filter: hue-rotate(20deg) saturate(1.5);
  opacity: 1;
}

.streak-flame-blazing {
  filter: hue-rotate(60deg) saturate(2);
  opacity: 1;
  text-shadow: 0 0 10px #ff6600;
}

.streak-flame-legendary {
  filter: hue-rotate(120deg) saturate(3);
  opacity: 1;
  text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00;
  animation: legendary-pulse 1s infinite alternate;
}

@keyframes legendary-pulse {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.2) rotate(2deg); }
}

/* Modern Control Panel */
.control-panel {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
}

.control-btn {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--border-radius);
  color: var(--light);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.control-btn:hover {
  background: rgba(0, 217, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 217, 255, 0.3);
}

.control-btn:active {
  transform: translateY(0);
}

/* Online Status Button */
.control-btn.online {
  background: linear-gradient(135deg, var(--success), #059669) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Leaderboard Styles */
.leaderboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.leaderboard-item.current-user {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.2);
}

.rank {
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 3rem;
  text-align: center;
}

.user-info {
  flex: 1;
}

.username {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--light);
  margin-bottom: 0.25rem;
}

.user-stats {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.user-streak {
  font-size: 0.8rem;
  opacity: 0.7;
}

.user-score {
  text-align: right;
  min-width: 4rem;
}

.user-score .level {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.user-score .xp {
  font-size: 0.9rem;
  opacity: 0.8;
}

.leaderboard-stats {
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-stats h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  text-align: center;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.stats-row:last-child {
  margin-bottom: 0;
}

/* Enhanced Achievements */
.achievements-panel {
  position: fixed;
  top: 2rem;
  right: 2rem;
  max-width: 350px;
  z-index: 200;
}

.achievement-toast {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--light);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transform: translateX(100%);
  animation: slideIn 0.5s ease forwards;
  position: relative;
  overflow: hidden;
}

.achievement-toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

/* Modal Enhancement */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  padding: 3rem;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.modal-title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.modal-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
}

/* Settings Sections */
.settings-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.settings-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}

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

.setting-item label {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex: 1;
}

.setting-item input[type="checkbox"] {
  margin-right: 0.5rem;
  transform: scale(1.2);
}

.setting-item input[type="range"] {
  margin: 0 0.5rem;
  flex: 1;
  max-width: 100px;
}

.setting-item input[type="number"] {
  margin: 0 0.5rem;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  width: 80px;
}

/* Achievements Grid */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.achievement-card {
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.achievement-card.unlocked {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

.achievement-card.locked {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
  opacity: 0.5;
}

/* Theme Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Close Button */
.close-btn {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  border: none;
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  margin: 0 auto;
}

.close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .control-panel {
    bottom: 1rem;
    flex-wrap: wrap;
    max-width: 90vw;
  }
  
  .xp-container {
    top: 1rem;
    left: 1rem;
  }
  
  .achievements-panel {
    top: 1rem;
    right: 1rem;
    max-width: 250px;
  }
  
  .modal-content {
    padding: 2rem;
    margin: 1rem;
  }
  
  .settings-container {
    grid-template-columns: 1fr;
  }
  
  .theme-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  
  .leaderboard-item {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  
  .rank {
    order: -1;
  }
  
  .user-score {
    text-align: center;
  }
  
  .control-panel {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .control-btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

/* ...existing code... */