:root {
    /* Color Variables */
    --bg-color: #111;
    --text-color: #0ff;
    --accent: #4caf50;
    --error: #e74c3c;
    --highlight: #9c27b0;
    --neutral: #2d91943c;
    --correct: #4caf50;
    --wrong: #e74c3c;
    --border-radius: 10px;
    --transition: all 0.3s ease;
  }
  
  /* Theme Variations */
  body.light {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --accent: #4caf50;
    --error: #c0392b;
    --highlight: #3f51b5;
    --neutral: #fff;
  }
  
  /* Base Styles */
  /* body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto Mono', monospace, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
  } */

  /* Layout */
  .container {
    max-width: 800px;
    margin: 1.5rem auto;
    padding: 2rem;
    background-color: var(--neutral);
    border-radius: var(--border-radius);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
  }
  
  /* Typography */
  h1, h2, h3 {
    color: var(--text-color);
    margin-top: 0;
  }
  
  h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
  }
  
  h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }
  
  h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
  }
  
  /* Theme Toggle */
  #themeToggle {
    cursor: pointer;
    margin-bottom: 1.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    background-color: var(--highlight);
    color: white;
    border-radius: var(--border-radius);
    display: inline-block;
    transition: var(--transition);
  }
  
  #themeToggle:hover {
    opacity: 0.9;
  }
  
  /* Timer Section */
  .timer-section {
    margin: 1.5rem 0;
  }
  
  #timerDisplay {
    font-size: 2.5rem;
    font-family: monospace;
    margin: 0.5rem 0;
    color: var(--text-color);
  }
  
  #progressContainer {
    width: 100%;
    height: 10px;
    background-color: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
  }
  
  #progressBar {
    width: 0%;
    height: 100%;
    background-color: var(--accent);
    transition: width 0.5s linear;
  }
  
  /* Controls Section */
  .controls-section {
    margin: 1.5rem 0;
  }
  
  .settings-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  /* Buttons */
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
  }
  
  .btn-primary {
    background-color: var(--accent);
    color: white;
  }
  
  .btn-secondary {
    background-color: var(--highlight);
    color: white;
  }
  
  .btn-tertiary {
    background-color: var(--neutral);
    color: var(--text-color);
    border: 1px solid var(--text-color);
  }
  
  .btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .btn-danger {
    background-color: var(--error);
    color: white;
  }
  
  .btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
  }
  
  .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  
  /* Select Elements */
  select {
    padding: 0.75rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--accent);
    color: white;
    cursor: pointer;
    transition: var(--transition);
  }
  
  select:hover {
    opacity: 0.9;
  }
  
  /* Typing Section */
  .typing-section {
    margin: 2rem 0;
  }
  
  .typing-section .section-title {
    margin-right: 0;
  }
  
  .secondary-timer {
    font-size: 1.5rem;
    color: var(--text-color);
  }
  
  .word-flow {
    font-size: 1.8rem;
    margin: 1rem 0;
    color: var(--highlight);
    min-height: 3.5rem;
    line-height: 1.6;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
  }
  
  .word-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 2px solid var(--text-color);
    border-radius: var(--border-radius);
    background-color: var(--neutral);
    color: var(--text-color);
    text-align: center;
    margin: 1rem 0;
    transition: var(--transition);
  }
  
  .word-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
  }
  
  /* Stats */
  .stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin-top: 1rem;
    gap: 1rem;
  }
  
  .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
  }
  
  .stat-label {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
  }
  
  .stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-color);
  }
  
  /* Chart Section */
  .chart-section {
    margin: 2rem 0;
  }
  
  #performanceChart {
    width: 100%;
    max-height: 300px;
    background-color: var(--neutral);
    border-radius: var(--border-radius);
    padding: 1rem;
  }
  
  /* Leaderboard Section */
  .leaderboard-section {
    margin: 2rem 0;
  }
  
  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
  }
  
  .leaderboard-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
  }
  
  .leaderboard-filter {
    padding: 0.5rem;
  }
  
  .leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
  }
  
  .leaderboard-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--neutral);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
  }
  
  .leaderboard-list li:last-child {
    border-bottom: none;
  }
  
  .rank {
    font-weight: bold;
    color: var(--text-color);
    min-width: 30px;
  }
  
  .details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .name {
    font-weight: bold;
  }
  
  .score {
    color: var(--accent);
  }
  
  .date {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-left: auto;
  }
  

  
  /* .badge-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  } */
  
  /* .badge-list li {
    background-color: var(--highlight);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
  } */
  
  /* .badge-list li:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  } */
  
  .badge-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  
  /* Modal */
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .modal[aria-hidden="false"] {
    opacity: 1;
    pointer-events: all;
  }
  
  .modal-content {
    background-color: var(--neutral);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  }
  
  .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
  }
  
  /* Utility Classes */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }
  
  /* Typing Section */
  .word-display {
    font-size: 2.5rem;
    min-height: 3.5rem;
    margin: 1rem 0;
    color: var(--highlight);
    text-align: center;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
  }
  
  /* Disabled Button Styles */
  button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
  }
  
  button:disabled::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neutral);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border: 1px solid var(--text-color);
  }
  
  button:disabled:hover::after {
    opacity: 1;
  }
  
  .tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neutral);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border: 1px solid var(--text-color);
    z-index: 100;
  }
  
  #uploadWordsBtn {
    position: relative;
  }
  
  #uploadWordsBtn:hover .tooltip {
    opacity: 1;
  }
  
  /* Responsive Design */
  @media (max-width: 768px) {
    .container {
      padding: 1.5rem;
    }
    
    h1 {
      font-size: 2rem;
    }
    
    .stats-container {
      grid-template-columns: repeat(2, 1fr);
    }
    
    /* .badge-list {
      grid-template-columns: 1fr;
    }
     */
    .section-header {
      flex-direction: column;
      align-items: flex-start;
    }
    
    .leaderboard-controls {
      width: 100%;
      justify-content: space-between;
    }
  }
  
  @media (max-width: 480px) {
    body {
      padding: 10px;
    }
    
    .container {
      padding: 1rem;
    }
    
    .word-flow {
      font-size: 1.4rem;
    }
    
    .word-input {
      font-size: 1.1rem;
    }
    
    .stats-container {
      grid-template-columns: 1fr;
    }
    
    .settings-group {
      flex-direction: column;
    }
    
    .btn {
      width: 100%;
    }
    
    select {
      width: 100%;
    }
  }

  /* Achievement Notifications */
  .achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-color);
    border: 2px solid var(--accent);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.5s ease-out, fadeOut 0.5s ease-in 2.5s;
    z-index: 1000;
  }

  .achievement-icon {
    font-size: 2rem;
    padding: 10px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
  }

  .achievement-icon.bronze { background: #cd7f32; }
  .achievement-icon.silver { background: #c0c0c0; }
  .achievement-icon.gold { background: #ffd700; }
  .achievement-icon.platinum { background: #e5e4e2; }

  .achievement-content h3 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
  }

  .achievement-content p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: var(--text-color);
  }

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

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

  /* User Stats Display */
  .user-stats {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
  }

  .user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }

  .stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
  }

  .stat-card h4 {
    margin: 0;
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
  }

  .stat-card .value {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
  }

  .stat-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  /* Achievements Display */
  .achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }

  .achievement-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    opacity: 0.5;
    transition: opacity 0.3s ease;
  }

  .achievement-card.unlocked {
    opacity: 1;
  }

  .achievement-card .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .achievement-card .title {
    font-size: 0.9rem;
    font-weight: bold;
    margin: 0;
  }

  .achievement-card .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
  }

  /* Mode Select */
  .mode-select {
    padding: 0.75rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--highlight);
    color: white;
    cursor: pointer;
    transition: var(--transition);
  }

  .mode-select:hover {
    opacity: 0.9;
  }

  /* Mode-specific styles */
  .mode-info {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    display: none;
  }

  .mode-info.active {
    display: block;
  }

  .mode-info h3 {
    color: var(--accent);
    margin-top: 0;
  }

  .mode-info p {
    margin: 0.5rem 0;
    color: var(--text-color);
  }

  /* Time Attack specific */
  .time-attack .word-flow {
    color: var(--highlight);
    transition: color 0.3s ease;
  }

  .time-attack.active .word-flow {
    animation: pulse 1s infinite;
  }

  @keyframes pulse {
    0% { color: var(--highlight); }
    50% { color: var(--accent); }
    100% { color: var(--highlight); }
  }

  /* Endurance specific */
  .endurance .word-flow {
    color: var(--accent);
  }

  .endurance .streak-counter {
    font-size: 1.2rem;
    color: var(--accent);
    text-align: center;
    margin: 1rem 0;
  }

  .endurance .streak-counter.high {
    color: var(--highlight);
    animation: glow 1s infinite;
  }

  @keyframes glow {
    0% { text-shadow: 0 0 5px var(--highlight); }
    50% { text-shadow: 0 0 20px var(--highlight); }
    100% { text-shadow: 0 0 5px var(--highlight); }
  }

  /* Game Results in Modal */
  .game-results {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-color);
  }

  .game-results p {
    margin: 0.5rem 0;
  }

  .game-results span {
    font-weight: bold;
    color: var(--accent);
  }

  /* Style for the Close button in the modal */
  #closeGameEndModal {
    /* You can add specific styles for this button if needed */
  }

  /* Flexible container for SEO text */
  .flexible-seo-text {
    display: flex; /* Use flexbox */
    justify-content: center; /* Center the content horizontally */
    align-items: center; /* Center the content vertically */
    margin-top: 2rem; /* Add some space above it */
    /* Add other styles as needed, e.g., padding, background */
  }

  .flexible-seo-text p {
    text-align: center; /* Center the text */
    max-width: 800px; /* Optional: Limit the width of the paragraph */
    /* Add other text styles as needed */
  }