     :root {
      --bg: #ffffff;
      --card: #011e3f;
      --card-secondary: #0c3869;
      --radius: 12px;
      --text: #e6e8ff;
      --text-secondary: #c7c9e6;
      --muted: #8c8fc9;
      --accent: linear-gradient(135deg, #9f7cff, #6b4eff);
      --accent-solid: #9f7cff;
      --border: rgba(255, 255, 255, 0.08);
      --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
      --shadow-lg: 0 8px 40px rgba(159, 124, 255, 0.15);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', system-ui, sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      font-size: 14px;
    }

    .container {
      max-width: 1440px;
      margin: 0 auto;
      padding: 0 24px;
    }

   /* Header */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-left: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  background: rgba(159, 124, 255, 0.1);
  border: 1px solid var(--accent-solid);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Side Navigation */
.nav {
  position: fixed;
  left: 0;
  top: 73px; /* Below header */
  bottom: 0;
  width: 260px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  overflow-y: auto;
  z-index: 999;
  box-shadow: var(--shadow);
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 16px;
}

.nav-tab {
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  transform: translateX(4px);
}

.nav-tab.active {
  background: var(--accent);
  border: none;
  color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(4px);
}

/* Add icons to nav tabs */
.nav-tab::before {
  content: "•";
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.5;
}

.nav-tab.active::before {
  opacity: 1;
}

   /* Main Content */
.main {
  margin-left: 90px; /* Space for sidebar nav */
  margin-top: 73px; /* Space for fixed header */
  padding: 32px 0;
  transition: margin-left 0.3s ease;
}
    .grid {
      display: grid;
      grid-template-columns: 1fr 380px;
      gap: 32px;
      margin-bottom: 32px;
    }

    @media (max-width: 1024px) {
      .grid {
        grid-template-columns: 1fr;
        gap: 24px;
      }
    }

    /* Cards */
    .card {
      background: var(--card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .card-header {
      padding: 24px 24px 0;
      border-bottom: 1px solid var(--border);
      margin-bottom: 24px;
    }

    .card-title {
      margin: 0 0 8px;
      font-size: 1.25rem;
      font-weight: 600;
    }

    .card-subtitle {
      color: var(--muted);
      font-size: 0.875rem;
      margin: 0;
    }

    .card-content {
      padding: 24px;
    }

    .card-no-header .card-content {
      padding: 24px;
    }

    /* Typing Interface */
    .typing-card {
      position: relative;
    }

    .typing-controls {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 24px;
      margin-bottom: 24px;
      flex-wrap: wrap;
    }

    .control-group {
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
    }

    .difficulty-tabs {
      display: flex;
      background: var(--card-secondary);
      border-radius: 8px;
      padding: 4px;
      border: 1px solid var(--border);
    }

    .difficulty-tab {
      padding: 10px 16px;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s ease;
      font-weight: 500;
      font-size: 0.875rem;
    }

    .difficulty-tab.active {
      background: var(--accent);
      color: #fff;
      box-shadow: 0 2px 8px rgba(159, 124, 255, 0.3);
    }

    .select-group {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .select-label {
      font-size: 0.75rem;
      color: var(--muted);
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    select, input {
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--card-secondary);
      color: var(--text);
      font-size: 0.975rem;
      outline: none;
      transition: border-color 0.2s ease;
    }

    select:focus, input:focus {
      border-color: var(--accent-solid);
    }

    /* Stats */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .stat-card {
      background: var(--card-secondary);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 16px;
      text-align: center;
    }

    .stat-label {
      font-size: 0.75rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 8px;
    }

    .stat-value {
      font-size: 1.5rem;
      font-weight: 700;
      color: var(--text);
    }

    /* Passage Display */
    .passage-container {
      background: var(--card-secondary);
      border: 2px solid var(--border);
      border-radius: 12px;
      padding: 15px;
      margin-bottom: 24px;
      max-height: 120px;
      position: relative;
    }

    #passage-display {
      line-height: 1.3;
      font-size: 33px;
      font-weight: 500;
      letter-spacing: 0.3px;
      max-height: 90px;
      overflow: hidden;
      position: relative;
    }

    .row {
      display: inline-block;
      width: 100%;
      transition: transform 0.4s ease, opacity 0.4s ease;
    }

    .row.fade-out {
      transform: translateY(-50%);
      opacity: 0;
    }

    #passage-display .active-word {
  background: rgba(159, 124, 255, 0.466);
  border-radius: 4px;
  padding: 0 6px;           
  box-shadow: inset 0 0 0 0.5px rgba(159, 124, 255, 0.582);
  line-height: 1;            
  display: inline-block;     
}

    

    #passage-display .correct {
      color: #51cf66;
    
    }

    #passage-display .incorrect {
      color: #ff6b6b;
   
    }

    /* Typing Input */
    .typing-input {
      width: 100%;
      max-height: 50px;
      resize: none;
      background: var(--card-secondary);
      border: 2px solid var(--border);
      border-radius: 12px;
      padding: 10px;
      font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
      font-size: 16px;
      color: var(--text);
      overflow: hidden;
      outline: none;
      line-height: 1.6;
      transition: border-color 0.2s ease;
    }

    .typing-input:focus {
      border-color: var(--accent-solid);
      box-shadow: 0 0 0 3px rgba(159, 124, 255, 0.1);
    }

    .typing-input:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    /* Buttons */
    .btn {
      padding: 12px 24px;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      font-size: 0.875rem;
      background: var(--accent);
      color: #fff;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(159, 124, 255, 0.3);
    }

    .btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 16px rgba(159, 124, 255, 0.4);
    }

    .btn:active {
      transform: translateY(0);
    }

    .btn-secondary {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-secondary);
      box-shadow: none;
    }

    .btn-secondary:hover {
      background: rgba(255, 255, 255, 0.05);
      border-color: var(--accent-solid);
    }

    .btn-small {
      padding: 8px 16px;
      font-size: 0.8rem;
    }

    /* Sidebar */
    .sidebar {
      position: sticky;
      top: 140px;
      height: fit-content;
    }

    .sidebar-section {
      margin-bottom: 24px;
    }

    .sidebar-section:last-child {
      margin-bottom: 0;
    }

    /* Tables */
    .table-container {
      background: var(--card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      overflow: hidden;
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.875rem;
    }

    .data-table th {
      background: var(--card-secondary);
      padding: 16px 12px;
      text-align: left;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-size: 0.75rem;
      border-bottom: 1px solid var(--border);
    }

    .data-table td {
      padding: 12px;
      border-bottom: 1px solid var(--border);
    }

    .data-table tr:last-child td {
      border-bottom: none;
    }

    .data-table tr:hover {
      background: rgba(255, 255, 255, 0.02);
    }

    /* Auth Form */
    .auth-form {
      max-width: 400px;
      margin: 0 auto;
    }

    .form-tabs {
      display: flex;
      background: var(--card-secondary);
      border-radius: 8px;
      padding: 4px;
      margin-bottom: 24px;
    }

    .form-tab {
      flex: 1;
      padding: 12px;
      text-align: center;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s ease;
      font-weight: 500;
    }

    .form-tab.active {
      background: var(--accent);
      color: #fff;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-label {
      display: block;
      margin-bottom: 6px;
      font-size: 0.875rem;
      font-weight: 500;
      color: var(--text-secondary);
    }

    .form-input {
      width: 100%;
      padding: 12px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--card-secondary);
      color: var(--text);
      font-size: 1rem;
    }

    /* Utility Classes */
    .hidden { display: none; }
    .text-center { text-align: center; }
    .text-muted { color: var(--muted); }
    .text-small { font-size: 0.875rem; }
    .text-xs { font-size: 0.75rem; }
    .font-mono { font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace; }
    .correct { color: #51cf66; }
    .incorrect { color: #ff6b6b; }

    .flex { display: flex; }
    .flex-between { justify-content: space-between; }
    .flex-center { align-items: center; }
    .flex-wrap { flex-wrap: wrap; }
    .gap-4 { gap: 16px; }
    .gap-2 { gap: 8px; }

    .mb-0 { margin-bottom: 0; }
    .mb-2 { margin-bottom: 8px; }
    .mb-4 { margin-bottom: 16px; }
    .mb-6 { margin-bottom: 24px; }

    .mt-2 { margin-top: 8px; }
    .mt-4 { margin-top: 16px; }
   
  /* Auth Card - Only show when explicitly requested */
#auth-card {
  max-width: 500px;
  margin: 64px auto;
}

.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-modal-overlay.show {
  display: flex !important;
  opacity: 1 !important;
}

.auth-modal-overlay #auth-card {
  margin: 0;
  max-width: 500px;
  width: 100%;
  animation: slideIn 0.3s ease;
  position: relative;
}
@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal close button styling */
.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

    /* Status indicators */
    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 12px;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 500;
    }

    .status-success {
      background: rgba(81, 207, 102, 0.15);
      color: #51cf66;
    }

    .status-warning {
      background: rgba(255, 193, 7, 0.15);
      color: #ffc107;
    }

    .status-error {
      background: rgba(255, 107, 107, 0.15);
      color: #ff6b6b;
    }

    /* Loading states */
    .loading {
      opacity: 0.6;
      pointer-events: none;
    }

    /* Loader spinner */
    .loader {
      width: 40px;
      height: 40px;
      border: 4px solid var(--border);
      border-top: 4px solid var(--accent-solid);
      border-radius: 50%;
      animation: spin 1s linear infinite;
      display: block;
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    .loader-small {
      width: 20px;
      height: 20px;
      border-width: 2px;
    }

    /* Responsive Design */
@media (max-width: 1024px) {
  .nav {
    width: 220px;
  }
  
  .main {
    margin-left: 220px;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 768px) {
  /* Mobile: Hide sidebar nav, show toggle button */
  .nav {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .nav.mobile-open {
    transform: translateX(0);
  }
  
  .main {
    margin-left: 0;
  }
  
  .container {
    padding: 0 16px;
  }

  .header-content {
    gap: 12px;
  }

  .typing-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .control-group {
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #passage-display {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 1.25rem;
  }
  
  .logo-subtitle {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .passage-container {
    padding: 20px;
  }
  
  .user-info {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

/* Mobile nav toggle button (optional - add to header) */
.nav-toggle {
  display: none;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: all 0.3s ease;
}
/* Hide WPM and Accuracy during test */
    #stat-wpm, #stat-acc {
      display: none !important;
    }
    
    .stat-card:has(#stat-wpm),
    .stat-card:has(#stat-acc) {
      display: none !important;
    }
    /* Modal close button styling */
.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}
