/* UI Components Styling */

/* Game Container */
.game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Popup Overlay - Main Container */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.popup-overlay.show {
  visibility: visible;
  opacity: 1;
}

/* Popup Content Inside Overlay */
.popup-content {
  position: relative;
  background: rgba(44, 62, 80, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  min-width: 300px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  border: 2px solid var(--primary-color);
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.popup-overlay.show .popup-content {
  transform: scale(1);
}

/* Legacy popup styles for backward compatibility */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(44, 62, 80, 0.7);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  z-index: 10000;
  min-width: 300px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  border: 2px solid var(--primary-color);
}

/* User Dashboard Popup Styling */
.popup.user-dashboard-popup {
  max-width: 933px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.popup:has(.user-dashboard) {
  max-width: 933px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.user-dashboard {
  width: 100%;
  min-height: 240px;
  padding: 15px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
}

.dashboard-header .profile-info {
  flex: 1;
  text-align: left;
}

.dashboard-header .profile-avatar {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-color), #d84315);
  border-radius: 50%;
  margin-right: 15px;
  position: relative;
}

/* Dashboard Buttons */
.profile-settings-btn,
.wallet-connect-btn {
  padding: 8px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s ease;
  margin-left: 8px;
}

.profile-settings-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.wallet-connect-btn {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

.profile-settings-btn:hover,
.wallet-connect-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* User Dashboard Button Group */
.user-dashboard-popup .button-group {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
  padding-top: 10px;
}

.user-dashboard-popup .button-group .btn {
  min-width: 100px;
  padding: 10px 20px;
  font-size: 14px;
}

.popup h2 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.popup p {
  color: var(--light-color);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

/* Popup Header, Body and Buttons */
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--primary-color);
}

.popup-header h3 {
  color: var(--white);
  font-size: 1.5rem;
  margin: 0;
}

.popup-close {
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.popup-close:hover {
  opacity: 1;
  color: var(--primary-color);
  transform: scale(1.2);
}

.popup-body {
  color: var(--light-color);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Button Styles */
.btn {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  margin: 0.25rem;
  min-width: 120px;
}

.btn:hover {
  background: #ff5722;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 107, 53, 0.3);
}

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

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

.btn-secondary:hover {
  background: #357abd;
}

.btn-success {
  background: var(--success-color);
}

.btn-success:hover {
  background: #219a52;
}

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

.btn-danger:hover {
  background: #c0392b;
}

/* Button Groups */
.button-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Core Label (dòng 1) */
.core-label {
  position: fixed;
  top: 1rem;
  left: 1rem;
  color: var(--white);
  font-size: 1rem;
  font-weight: bold;
  background: rgba(44, 62, 80, 0.9);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--primary-color);
  z-index: 100;
  min-width: 150px;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Best Core Label (dòng 2) */
.best-core-label {
  position: fixed;
  top: 4rem; /* 1rem + 40px (chiều cao core-label) + 1rem margin */
  left: 1rem;
  color: var(--white);
  font-size: 1rem;
  font-weight: bold;
  background: rgba(44, 62, 80, 0.9);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--primary-color);
  z-index: 100;
  min-width: 150px;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.core-label label,
.best-core-label label {
  color: var(--primary-color);
  font-size: 0.9rem;
}

.core-label span,
.best-core-label span {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: bold;
  min-width: 40px;
  text-align: right;
}

/* User Info - Chiều cao = Core + Best Core (80px + 1rem margin) */
.user-info {
  position: fixed;
  top: 1rem;
  right: 1rem;
  color: var(--white);
  background: rgba(44, 62, 80, 0.9);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--primary-color);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: calc(80px + 1rem); /* Tổng chiều cao 2 label + margin */
  min-width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-info:hover {
  background: rgba(44, 62, 80, 1);
  border-color: var(--accent-color);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 107, 53, 0.1);
}

.user-avatar canvas {
  border-radius: 50%;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.username {
  font-size: 1rem;
  font-weight: bold;
  color: var(--white);
}

.user-level {
  font-size: 0.9rem;
  color: var(--primary-color);
}

.user-level span {
  color: var(--white);
  font-weight: bold;
}

/* Game Info */
.game-info {
  position: fixed;
  top: 6rem;           /* Đẩy xuống dưới user info */
  right: 2rem;
  color: var(--white);
  text-align: right;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  z-index: 100;
}

/* Difficulty Info */
.difficulty-info {
  position: fixed;
  top: 8rem;           /* Đẩy xuống dưới score display */
  left: 2rem;
  color: var(--white);
  text-align: left;
  font-size: 0.85rem;
  background: rgba(44, 62, 80, 0.9);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--primary-color);
  z-index: 100;
  min-width: 120px;
}

.difficulty-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  border-bottom: 1px solid var(--primary-color);
  padding-bottom: 0.25rem;
}

.difficulty-info > div:not(.difficulty-title) {
  margin: 0.25rem 0;
  opacity: 0.9;
}

/* Instructions */
.instructions {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  text-align: center;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  z-index: 100;
}

/* Countdown Display */
.countdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  font-weight: bold;
  color: var(--accent-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 200;
  animation: pulse 1s ease-in-out;
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Loading Spinner */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animation Status Display */
.animation-status {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(0, 0, 0, 0.7);
  color: var(--white);
  padding: 1rem;
  border-radius: var(--border-radius);
  font-size: 0.8rem;
  font-family: var(--font-family-mono);
  z-index: 100;
  min-width: 200px;
}

.animation-status h4 {
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

.animation-status .status-item {
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
}

.animation-status .status-value {
  color: var(--success-color);
  font-weight: bold;
}

/* Game Title */
.game-title {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--primary-color);
  font-size: 4rem;
  font-weight: bold;
  text-align: center;
  z-index: 1000; /* Lower than popup overlay */
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  background: linear-gradient(45deg, #ff6b35, #ff8c42, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% { 
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(255, 107, 53, 0.3);
  }
  100% { 
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8),
                 0 0 30px rgba(255, 107, 53, 0.6);
  }
}

/* Video Ad Button */
.video-ad-button {
  position: fixed;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 200;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
  transition: all 0.3s ease;
  text-align: center;
  min-width: 300px;
}

.video-ad-button:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
  background: linear-gradient(135deg, #5CBF60, #4CAF50);
}

.video-ad-button:active {
  transform: translateX(-50%) scale(0.98);
}

/* Main Content Container */
.main-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.game-title-main {
  color: var(--primary-color);
  font-size: 4rem;
  font-weight: bold;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  background: linear-gradient(45deg, #ff6b35, #ff8c42, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleGlow 2s ease-in-out infinite alternate;
  margin-bottom: 1rem;
}

.fox-display {
  font-size: 6rem;
  animation: foxBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes foxBounce {
  0%, 100% { 
    transform: translateY(0) scale(1); 
  }
  50% { 
    transform: translateY(-20px) scale(1.1); 
  }
}

.game-instructions {
  color: var(--white);
  font-size: 1.2rem;
  font-weight: 500;
  background: rgba(44, 62, 80, 0.8);
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  line-height: 1.4;
}

/* Help Button */
.help-button {
  position: fixed;
  top: 1rem;
  right: calc(1rem + 220px); /* Cách User Info 1rem */
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 100;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
  transition: all 0.3s ease;
}

.help-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
  background: linear-gradient(135deg, #4aa3df, #3498db);
}

.help-button:active {
  transform: scale(0.95);
}

/* Game Over Buttons */
.game-over-button {
  position: fixed;
  padding: 15px 30px;
  font-size: 20px;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 150;
  font-family: 'Arial', sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  width: 400px;
  min-width: 400px;
  text-align: center;
}

#gameOverReplayButton {
  left: 50%;
  top: 70%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#gameOverReplayButton:hover {
  transform: translateX(-50%) scale(1.05);
  background: linear-gradient(135deg, #2ecc71, #58d68d);
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* Back To Home Button */
.back-to-begin-button {
  position: fixed;
  padding: 15px 30px;
  font-size: 20px;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 150;
  font-family: 'Arial', sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  width: 400px;
  min-width: 400px;
  text-align: center;
}

#backToBeginButton {
  left: 50%;
  top: 80%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #3498db, #2980b9);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#backToBeginButton:hover {
  transform: translateX(-50%) scale(1.05);
  background: linear-gradient(135deg, #2980b9, #1f5f8b);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

#backToBeginButton:active {
  transform: translateX(-50%) scale(0.95);
}

.game-over-button:active {
  transform: translateX(-50%) scale(0.95);
}

/* Video Ad Popup Styles */
.video-popup.popup {
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999 !important; /* Lower than main popup overlay */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  transform: none !important;
  min-width: auto !important;
  max-width: none !important;
}

.video-popup.popup.show {
  opacity: 1;
  visibility: visible;
}

.popup-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1;
}

.video-popup-content {
  position: relative; /* Changed from absolute to relative */
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 3px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  max-width: 500px;
  width: 90%;
  max-height: 90vh; /* Added max-height to prevent overflow */
  z-index: 10; /* Relative z-index within popup */
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.video-popup.popup.show .video-popup-content {
  transform: scale(1);
}

/* Ensure perfect centering on all devices */
@media (max-height: 600px) {
  .video-popup-content {
    max-height: 95vh;
    max-width: 95vw;
  }
  
  .video-container {
    padding: 20px;
    min-height: 250px;
  }
  
  .video-display {
    height: 200px;
  }
}

@media (max-width: 480px) {
  .video-popup-content {
    width: 95%;
    max-width: none;
  }
  
  .video-container {
    padding: 15px;
  }
}

.video-container {
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.video-display {
  width: 100%;
  height: 250px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.video-display.completed {
  background: linear-gradient(135deg, #064e3b, #059669);
  border-color: rgba(34, 197, 94, 0.5);
}

.video-overlay {
  text-align: center;
  color: white;
  z-index: 2;
}

.video-icon {
  font-size: 60px;
  margin-bottom: 15px;
  animation: float 2s ease-in-out infinite;
}

.video-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  opacity: 0.9;
}

.video-timer {
  font-size: 36px;
  font-weight: bold;
  color: #ff6b35;
  text-shadow: 0 2px 10px rgba(255, 107, 53, 0.5);
  transition: all 0.3s ease;
}

.video-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.video-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff6b35, #f39c12);
  width: 0%;
  transition: width 1s ease;
  box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

.continue-button {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 12px;
  cursor: not-allowed;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  opacity: 0.6;
}

.continue-button.enabled {
  background: linear-gradient(135deg, #059669, #10b981);
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.continue-button.enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.6);
}

.continue-button.pulse {
  animation: buttonPulse 1.5s infinite;
}

.btn-icon {
  font-size: 20px;
}

.btn-text {
  font-weight: 600;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes buttonPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

#continue-btn:enabled {
  background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
  color: white;
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

#continue-btn:enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
}

#continue-btn:disabled {
  background: #7f8c8d !important;
  color: #bdc3c7;
  cursor: not-allowed;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Top Left Buttons */
.top-left-buttons {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 100;
  max-width: 100vw; /* Allow full width for horizontal layout */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* Top Right Buttons */
.top-right-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.top-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  backdrop-filter: blur(10px);
  border: 2px solid #ffffff;
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  
  /* Fixed width to accommodate 4 buttons with "10000" score */
  min-width: 85px;
  max-width: 85px;
  width: 85px;
  height: 36px;
  
  /* Text layout */
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  
  /* Handle text overflow */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Score display spans */
.top-btn span:first-child {
  color: #ffffff;
  margin-right: 4px;
  flex-shrink: 0;
  font-size: 10px;
}

.top-btn span:last-child {
  color: #ffd700;
  font-weight: bold;
  text-align: right;
  min-width: 30px;
  max-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
}

/* Special styling for Leader Board button */
#topPlayerBtn {
  justify-content: center;
  text-align: center;
  color: #ffd700;
  background: linear-gradient(135deg, #ff6b35 0%, #d84315 100%);
}

.top-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  border-color: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  color: #ffd700;
}

#topPlayerBtn:hover {
  background: linear-gradient(135deg, #d84315 0%, #ff6b35 100%);
  transform: translateY(-2px) scale(1.02);
}

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

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .top-left-buttons {
    max-width: 95vw;
    gap: 4px;
  }
  
  .top-btn {
    font-size: 11px;
    padding: 6px 8px;
    min-width: 75px;
    max-width: 75px;
    width: 75px;
    height: 32px;
  }
  
  .top-btn span:first-child {
    font-size: 9px;
    margin-right: 3px;
  }
  
  .top-btn span:last-child {
    min-width: 25px;
    max-width: 32px;
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  .top-left-buttons {
    max-width: 100vw;
    gap: 3px;
    flex-wrap: nowrap; /* Keep all 4 buttons on same row */
  }
  
  .top-btn {
    font-size: 10px;
    padding: 5px 6px;
    min-width: 65px;
    max-width: 65px;
    width: 65px;
    height: 28px;
  }
  
  .top-btn span:first-child {
    font-size: 8px;
    margin-right: 2px;
  }
  
  .top-btn span:last-child {
    min-width: 22px;
    max-width: 28px;
    font-size: 8px;
  }
  
  /* Remove the old stacking rules since we want all 4 buttons on one row */
}

/* Pause Button */
.pause-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  border: 3px solid #ffffff;
  border-radius: 12px;
  color: #ffffff;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
  z-index: 100;
}

.pause-button:hover {
  background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%);
  border-color: #ffd700;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
  color: #ffd700;
}

.pause-button:active {
  transform: translateY(-1px) scale(1.02);
}

/* Custom Scrollbar for Leaderboard */
.popup div[style*="overflow-y: auto"] {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.popup div[style*="overflow-y: auto"]::-webkit-scrollbar {
  width: 6px;
}

.popup div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.popup div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.popup div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Authentication Styles */
.auth-content {
  text-align: left;
}

.auth-form {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #fff;
  font-weight: 500;
}

.auth-input {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.15);
}

.auth-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.auth-error {
  color: #e74c3c;
  font-size: 14px;
  text-align: center;
  margin: 10px 0;
  padding: 8px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 5px;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.social-login {
  margin: 20px 0;
}

.social-title {
  text-align: center;
  margin: 20px 0 10px 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.social-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.social-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.facebook-btn {
  background: #4267B2;
}

.facebook-btn:hover {
  background: #365899;
}

.google-btn {
  background: #db4437;
}

.google-btn:hover {
  background: #c23321;
}

.twitter-btn {
  background: #1da1f2;
}

.twitter-btn:hover {
  background: #0d8bd9;
}

.auth-switch {
  text-align: center;
  margin-top: 15px;
  color: rgba(255, 255, 255, 0.7);
}

.auth-switch a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* User Dashboard Styles */
.user-dashboard {
  text-align: left;
}

.profile-section {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-right: 15px;
  position: relative;
  overflow: hidden;
}

.profile-info .username {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 18px;
}

.profile-info .email {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 2px;
}

.stats-section {
  background: rgba(255, 107, 53, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
}

.stats-section h4 {
  margin: 0 0 15px 0;
  color: var(--primary-color);
}

.achievements-section {
  background: rgba(52, 152, 219, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
}

.section-title {
  font-weight: bold;
  color: #3498db;
  margin-bottom: 10px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 5px;
}

/* Button Styles for Authentication */
.btn-danger {
  background: #e74c3c !important;
  border-color: #e74c3c !important;
}

.btn-danger:hover {
  background: #c0392b !important;
  border-color: #c0392b !important;
}

.profile-settings {
  text-align: left;
}

.profile-settings .form-group {
  margin-bottom: 15px;
}

.profile-settings label {
  display: block;
  margin-bottom: 5px;
  color: #fff;
  font-weight: 500;
}