/* ===== CSS VARIABLES ===== */
:root {
  /* Colors */
  --primary: #7c3aed;
  --primary-rgb: 124, 58, 237;
  --primary-light: #a78bfa;
  --secondary: #3b82f6;
  --accent: #06b6d4;
  --dark-bg: #0a0a1a;
  --dark-surface: #1a1a3e;
  --dark-card: #252550;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* ===== GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Offset anchor-link scroll targets so they clear the fixed navbar */
  scroll-padding-top: 72px;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ===== ACCESSIBILITY FOCUS STATES ===== */
:focus-visible,
.focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.3) !important;
  border-radius: 4px;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-bg, #0a0a0a);
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader {
  text-align: center;
}

.big-box {
  transition: transform 0.3s ease-in-out;
}

.big-box:hover {
  transform: scale(1.05);
}

#profile .big-box:hover {
  transform: none;
}


.infinity-loader {
  font-size: 6rem;
  font-weight: 900;
  background: var(
    --gradient-1,
    linear-gradient(135deg, #667eea 0%, #764ba2 100%)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 2s infinite;
}

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

.loading-bar {
  width: 300px;
  height: 6px;
  background: var(--dark-card, #1a1a1a);
  border-radius: 3px;
  margin: 20px auto;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  background: var(
    --gradient-1,
    linear-gradient(135deg, #667eea 0%, #764ba2 100%)
  );
  width: 0%;
  animation: loadProgress 2s ease-in-out forwards;
}

@keyframes loadProgress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

.loading-text {
  color: var(--text-secondary, #888);
  font-size: 0.9rem;
  margin-top: 10px;
  animation: textPulse 1.5s ease-in-out infinite;
}

@keyframes textPulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loading-screen {
    transition: none;
  }

  .infinity-loader {
    animation: none;
  }

  .loading-progress {
    animation: none;
    width: 100%;
  }

  .big-box {
    transition: none;
  }

  .big-box:hover {
    transform: none;
  }

  .loading-text {
    animation: none;
  }
}

@media (max-width: 768px) {
  .infinity-loader {
    font-size: 4rem;
  }

  .loading-bar {
    width: 200px;
  }
}

@media (max-width: 480px) {
  .infinity-loader {
    font-size: 3rem;
  }

  .loading-bar {
    width: 150px;
  }
}

/* ===== SCROLL TO TOP ===== */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-1);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: var(--glass-shadow);
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: all;
}

.scroll-top-btn:hover {
  transform: translateY(-5px);
}

/* Did You Know? Facts Section */
.facts-card {
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.08),
    rgba(59, 130, 246, 0.08)
  );
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  transition: all 0.3s ease;
}

.facts-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.1);
}

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

.facts-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.facts-icon {
  font-size: 1.5rem;
}

.facts-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.facts-btn {
  padding: 0.4rem 1.2rem;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.facts-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.facts-content {
  padding: 0.5rem 0;
}

.fact-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
  min-height: 3.2rem;
}

.facts-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
  border-top: 1px solid rgba(124, 58, 237, 0.1);
  padding-top: 0.75rem;
}

.facts-counter {
  background: rgba(124, 58, 237, 0.1);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.7rem;
  color: #7c3aed;
}

/* Dark Mode Support */
.dark .facts-card {
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.15),
    rgba(59, 130, 246, 0.1)
  );
  border-color: rgba(124, 58, 237, 0.25);
}

.dark .facts-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.dark .facts-counter {
  background: rgba(124, 58, 237, 0.2);
  color: #8b5cf6;
}

/* Responsive */
@media (max-width: 600px) {
  .facts-card {
    padding: 1rem 1.25rem;
  }

  .facts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .facts-btn {
    align-self: flex-start;
    font-size: 0.7rem;
    padding: 0.3rem 1rem;
  }

  .fact-text {
    font-size: 0.95rem;
  }

  .facts-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
}

/* ===== AUTHENTICATION ===== */
.auth-page {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(
      circle at top left,
      rgba(6, 182, 212, 0.18),
      transparent 34rem
    ),
    radial-gradient(
      circle at bottom right,
      rgba(124, 58, 237, 0.2),
      transparent 32rem
    ),
    var(--dark-bg);
}

.auth-panel {
  width: min(100%, 420px);
  padding: 1.5rem;
  border-radius: 8px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1rem;
}

body[data-page="login"],
body[data-page="signup"] {
  overflow: hidden;
}

body[data-page="signup"] .auth-panel {
  padding: 1rem;
}

body[data-page="signup"] .auth-brand {
  margin-bottom: 0.5rem;
}

body[data-page="signup"] .auth-brand p {
  display: none;
}

body[data-page="signup"] .auth-mark {
  width: 36px;
  height: 36px;
  margin-bottom: 0.4rem;
  font-size: 1.5rem;
}

body[data-page="signup"] .auth-brand h1 {
  margin-bottom: 0;
}

body[data-page="signup"] .auth-form {
  gap: 0.5rem;
}

body[data-page="signup"] .form-group {
  gap: 0.2rem;
}

body[data-page="signup"] .form-group input {
  min-height: 36px;
  padding: 0.35rem 0.7rem;
}

body[data-page="signup"] .auth-submit {
  min-height: 36px;
}

body[data-page="signup"] .password-meter {
  height: 4px;
}

body[data-page="signup"] .auth-divider {
  margin: 0.4rem 0;
  gap: 0.5rem;
}

body[data-page="signup"] .google-btn {
  padding: 0.5rem 1.5rem;
}

body[data-page="signup"] .auth-switch {
  margin-top: 0.4rem;
}

.auth-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--gradient-1);
  color: white;
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  font-weight: 900;
}

.auth-brand h1 {
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.auth-brand p,
.auth-switch,
.form-group small {
  color: var(--text-secondary);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.form-group {
  display: grid;
  gap: 0.45rem;
}

.form-group label {
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  font: inherit;
  padding: 0.5rem 0.8rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
}

.auth-submit {
  width: 100%;
  justify-content: center;
  min-height: 42px;
}

.auth-submit[data-loading="true"] {
  opacity: 0.75;
  cursor: wait;
}

.auth-message {
  min-height: 1.4rem;
  font-size: 0.94rem;
}

.auth-message.error {
  color: #fca5a5;
}

.auth-message.success {
  color: #86efac;
}

.auth-message.info {
  color: var(--text-secondary);
}

.auth-switch {
  margin-top: 0.75rem;
  text-align: center;
}

.auth-switch a {
  color: var(--primary-light);
  font-weight: 600;
}

.password-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.password-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: #ef4444;
  transition:
    width 0.2s ease,
    background 0.2s ease;
}

.password-meter[data-score="1"] span {
  width: 20%;
}

.password-meter[data-score="2"] span {
  width: 40%;
  background: #f97316;
}

.password-meter[data-score="3"] span {
  width: 60%;
  background: #facc15;
}

.password-meter[data-score="4"] span {
  width: 80%;
  background: #22c55e;
}

.password-meter[data-score="5"] span {
  width: 100%;
  background: var(--gradient-4);
}

/* ===== NAVIGATION BAR ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* ===== NAVBAR SEARCH ===== */
.nav-search {
  position: relative;
  width: auto;
  max-width: 320px;
  min-width: 180px;
  z-index: 10005;
  flex: 0 1 auto;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.nav-search-input {
  width: 100%;
  padding: 0.5rem 2.25rem 0.5rem 2.25rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nav-search-input:focus {
  background: rgba(10, 10, 26, 0.95);
  border-color: #22d3ee;
  box-shadow:
    0 0 16px rgba(34, 211, 238, 0.25),
    var(--glass-shadow);
}

html.light-mode .nav-search-input:focus {
  background: #ffffff;
  border-color: #22d3ee;
  box-shadow:
    0 0 16px rgba(34, 211, 238, 0.15),
    var(--glass-shadow);
}

.nav-search-input:focus + .search-icon {
  color: #22d3ee;
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

html.light-mode .clear-search-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Search Dropdown Suggestions */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    var(--glass-shadow);
  max-height: 380px;
  overflow-y: auto;
  z-index: 10010;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

html.light-mode .search-dropdown {
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.1),
    var(--glass-shadow);
}

.search-dropdown::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.search-dropdown::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 10px;
}

.search-dropdown-section {
  padding: 8px 0;
}

.search-dropdown-section + .search-dropdown-section {
  border-top: 1px solid var(--glass-border);
}

.search-section-title {
  padding: 6px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 600;
}

.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  outline: none;
}

.suggestion-item:hover,
.suggestion-item:focus,
.suggestion-item.selected {
  background: rgba(255, 255, 255, 0.08);
  padding-left: 20px;
}

html.light-mode .suggestion-item:hover,
html.light-mode .suggestion-item:focus,
html.light-mode .suggestion-item.selected {
  background: rgba(0, 0, 0, 0.04);
  padding-left: 20px;
}

.suggestion-item.selected {
  border-left: 3px solid #22d3ee;
  padding-left: 17px;
}

.suggestion-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.suggestion-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-path {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.suggestion-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestion-arrow {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-left: 12px;
  opacity: 0;
  transition: all 0.2s ease;
}

.suggestion-item:hover .suggestion-arrow,
.suggestion-item:focus .suggestion-arrow,
.suggestion-item.selected .suggestion-arrow {
  opacity: 1;
  transform: translateX(3px);
}

.search-no-results,
.search-recent-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.search-no-results i,
.search-recent-empty i {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.search-highlight {
  background: rgba(34, 211, 238, 0.25);
  color: #f8fafc;
  border-radius: 2px;
  padding: 0 2px;
}

html.light-mode .search-highlight {
  background: rgba(34, 211, 238, 0.15);
  color: #0f172a;
}

/* Recent Search item with remove option */
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.recent-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  color: var(--text-primary);
  text-decoration: none;
  padding: 10px 16px;
  font-size: 0.875rem;
  cursor: pointer;
}

.recent-link i {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.recent-item:hover,
.recent-item.selected {
  background: rgba(255, 255, 255, 0.08);
}

html.light-mode .recent-item:hover,
html.light-mode .recent-item.selected {
  background: rgba(0, 0, 0, 0.04);
}

.remove-recent-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px 16px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.remove-recent-btn:hover {
  color: #ef4444;
}

/* Responsive Search Positioning */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 1200px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .nav-search-mobile {
    padding: 1rem 0;
    width: 100%;
  }

  .nav-search-mobile .nav-search {
    max-width: none;
  }
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: fit-content;
  text-decoration: none;
}

.logo-text {
  font-size: 1.6rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.logo-title {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  background: linear-gradient(90deg, #e2e8f0, #f8fafc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  position: relative;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.nav-link:hover {
  color: #f8fafc;
  background: rgba(34, 211, 238, 0.08);
}

.nav-link:hover::after {
  width: 60%;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.dropdown-toggle:hover {
  color: #f8fafc;
  background: rgba(34, 211, 238, 0.1);
}

.dropdown-toggle[aria-expanded="true"] {
  color: #f8fafc;
  background: rgba(34, 211, 238, 0.1);
}

.dropdown-toggle[aria-expanded="true"] .dropdown-icon {
  transform: rotate(180deg);
}

.dropdown-icon {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.has-dropdown {
  position: relative;
}

.has-dropdown::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 8px;
  background: transparent;
  z-index: 99;
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  max-width: 280px;
  background: rgba(15, 15, 40, 0.95);
  border: 1px solid rgba(34, 211, 238, 0.1);
  border-radius: 14px;
  padding: 0.5rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(34, 211, 238, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: none;
  max-height: 65vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 238, 0.2) transparent;
}

.dropdown-menu::-webkit-scrollbar {
  display: none;
}

/* ===== LEARN & INTERVIEW DROPDOWN — SCROLLABLE (Issue #1078) ===== */
/* Desktop: show a thin scrollbar so users know the long lists are scrollable  */
.nav-learn-dropdown .dropdown-menu,
.nav-interview-dropdown .dropdown-menu {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.nav-learn-dropdown .dropdown-menu::-webkit-scrollbar,
.nav-interview-dropdown .dropdown-menu::-webkit-scrollbar {
  display: block;
  width: 4px;
}

.nav-learn-dropdown .dropdown-menu::-webkit-scrollbar-track,
.nav-interview-dropdown .dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.nav-learn-dropdown .dropdown-menu::-webkit-scrollbar-thumb,
.nav-interview-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 2px;
}

.dropdown-menu-end {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--text-primary);
  background: var(--primary);
  outline: none;
}

.dropdown-item.nav-auth-link {
  border: none;
  background: none;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dropdown-item.nav-auth-link:not(:last-child) {
  margin-bottom: 7.5px;
}

.dropdown-item.nav-auth-link:hover {
  background: var(--primary);
  color: var(--text-primary);
}

.dropdown-item i {
  font-size: 0.875rem;
  width: 16px;
  text-align: center;
  color: var(--accent);
}

.dropdown-item:hover i {
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 0.5rem 0;
}

/* ─── Navbar highlight for landing page links ─── */
.nav-highlight-item {
  color: var(--accent-color, #f59e0b) !important;
  font-weight: 600 !important;
}

.nav-auth-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.nav-auth-link:hover {
  background: var(--primary);
  color: var(--text-primary);
  border-color: var(--primary);
}

.nav-auth-guest {
  border-color: rgba(108, 92, 231, 0.4);
  background: rgba(108, 92, 231, 0.1);
}

.nav-auth-guest:hover {
  border-color: #6c5ce7;
  background: #6c5ce7;
  color: var(--text-primary);
}

.nav-cta {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--glass-border);
}

.nav-cta-btn {
  padding: 0.05rem 0.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  box-shadow: 0 2px 8px rgba(34, 211, 238, 0.3);
}

.nav-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.5);
}

.nav-cta-btn i {
  font-size: 14px;
}

.auth-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--glass-border);
}

.nav-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}

.nav-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  min-width: fit-content;
}

.dark-mode-btn,
.menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dark-mode-btn:hover,
.menu-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

.menu-toggle {
  display: none;
}

/* Hide on mobile */
.desktop-only {
  display: flex;
  align-items: center;
}

/* Mobile nav overlay */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Navigation */
@media (max-width: 1200px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 100vw);
    height: 100vh;
    background: var(--dark-bg);
    border-left: 1px solid var(--glass-border);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 5rem 1.5rem 2rem;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 9995;
    overflow-y: auto;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4);
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--glass-border);
  }

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

  .nav-link,
  .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 1rem;
    font-size: 1rem;
  }

  .nav-link::after {
    display: none;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: var(--dark-card);
    border-radius: 8px;
    margin: 0.5rem 0 0.5rem 0.5rem;
    padding: 0.25rem 0;
    max-width: none;
    max-height: 0;
    overflow: hidden;
    transition:
      max-height 0.3s ease,
      padding 0.3s ease;
    pointer-events: auto;
  }

  .has-dropdown.open .dropdown-menu {
    max-height: 500px;
    padding: 0.5rem 0;
  }

  /* Mobile: Learn and Interview have 100+ items — make them independently scrollable */
  .nav-learn-dropdown.open .dropdown-menu,
  .nav-interview-dropdown.open .dropdown-menu {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
  }

  .nav-learn-dropdown.open .dropdown-menu::-webkit-scrollbar,
  .nav-interview-dropdown.open .dropdown-menu::-webkit-scrollbar {
    width: 4px;
  }

  .nav-learn-dropdown.open .dropdown-menu::-webkit-scrollbar-thumb,
  .nav-interview-dropdown.open .dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
  }

  .dropdown-item {
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
  }

  .desktop-only {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-profile-dropdown .dropdown-menu-end {
    left: 0.5rem;
    right: 0;
  }
}

@media (max-width: 640px) {
  .navbar {
    padding: 0.75rem 1rem;
  }

  .logo-title {
    font-size: 1rem;
  }

  .logo-text {
    font-size: 1.4rem;
  }

  .nav-links {
    width: min(320px, 85vw);
    max-width: 320px;
    padding: 4.5rem 1rem 2rem;
  }

  .nav-link,
  .dropdown-toggle {
    padding: 0.875rem 0.75rem;
    font-size: 0.9375rem;
  }

  .dropdown-item {
    padding: 0.75rem 1.25rem;
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-links {
    gap: 0.25rem;
  }

  .nav-link,
  .dropdown-toggle {
    padding: 0.5rem 0.625rem;
    font-size: 0.85rem;
  }

  /* Practice modal: reduce max-width and padding on tablets */
  .quiz-modal-content {
    max-width: 95%;
    height: 85vh;
  }

  .quiz-problem-panel {
    padding: 1.25rem;
  }

  .code-textarea {
    font-size: 13px;
    left: 35px;
    width: calc(100% - 35px);
  }

  .line-numbers {
    width: 35px;
  }
}

/* Active state for current page */
.nav-link.active,
.dropdown-toggle.active {
  color: #22d3ee;
}

.nav-link.active::after,
.dropdown-toggle.active::after {
  width: 80%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

/* Dropdown arrow rotation on mobile */
.has-dropdown.open .dropdown-icon {
  transform: rotate(180deg);
}

/* Focus visible for accessibility */
.nav-link:focus-visible,
.dropdown-toggle:focus-visible,
.dropdown-item:focus-visible,
.nav-cta-btn:focus-visible,
.dark-mode-btn:focus-visible,
.menu-toggle:focus-visible,
.favorite-btn:focus-visible,
.notes-btn:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dropdown-menu,
  .nav-links,
  .dropdown-toggle .dropdown-icon,
  .nav-link::after {
    transition: none;
  }
}

/* ===== HERO SECTION ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem 2rem;
  position: relative;
  overflow: hidden;
  scroll-margin-top: 72px;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Starfield effect */
.stars,
.stars2,
.stars3 {
  position: absolute;
  width: 100%;
  height: 100%;
  background: transparent;
}

.stars {
  background-image:
    radial-gradient(2px 2px at 20px 30px, white, transparent),
    radial-gradient(
      2px 2px at 40px 70px,
      rgba(255, 255, 255, 0.8),
      transparent
    ),
    radial-gradient(2px 2px at 50px 160px, white, transparent),
    radial-gradient(2px 2px at 90px 40px, white, transparent),
    radial-gradient(
      2px 2px at 130px 80px,
      rgba(255, 255, 255, 0.8),
      transparent
    ),
    radial-gradient(2px 2px at 160px 120px, white, transparent);
  background-size: 200px 200px;
  animation: stars 120s linear infinite;
}

.stars2 {
  background-image:
    radial-gradient(
      1px 1px at 150px 150px,
      rgba(255, 255, 255, 0.6),
      transparent
    ),
    radial-gradient(1px 1px at 100px 50px, white, transparent),
    radial-gradient(
      1px 1px at 50px 200px,
      rgba(255, 255, 255, 0.6),
      transparent
    );
  background-size: 300px 300px;
  animation: stars 80s linear infinite reverse;
}

.stars3 {
  background-image:
    radial-gradient(
      3px 3px at 300px 400px,
      rgba(167, 139, 250, 0.8),
      transparent
    ),
    radial-gradient(2px 2px at 200px 600px, #3b82f6, transparent);
  background-size: 500px 500px;
  animation: stars 100s linear infinite;
}

@keyframes stars {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-1000px);
  }
}

.hero-content {
  max-width: 100%;
  text-align: center;
}

.hero-title {
  margin-bottom: 2rem;
}

.title-line {
  display: block;
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.main-title {
  font-family: "Orbitron", sans-serif;
  font-size: 4rem;
  font-weight: 900;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
  margin-bottom: 1rem;
}

.subtitle {
  display: block;
  font-size: 1.8rem;
  color: var(--accent);
  font-weight: 300;
}

.typing-container {
  height: 40px;
  margin: 2rem 0;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.typing-text {
  color: var(--primary-light);
  font-weight: 600;
}

.typing-cursor {
  animation: blink 1s infinite;
  color: var(--accent);
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin: 2rem 0;
}

.btn {
  padding: 1rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

.hero-stats {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
  justify-content: space-around;
  margin-top: 3rem;
  gap: 2rem;
}

.stat-box {
  text-align: center;
  padding: 2.5rem;
  background: var(--glass-bg);
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  min-width: 0;
  flex: 1;
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  40% {
    transform: translateX(-50%) translateY(-10px);
  }

  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* ===== DSA FLASHCARDS REVISION ===== */
.flashcards-section {
  background: linear-gradient(
    180deg,
    var(--dark-bg) 0%,
    var(--dark-surface) 100%
  );
}

.flashcards-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.flashcards-shell {
  max-width: 900px;
  margin: 0 auto;
}

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

.flashcards-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.flashcards-progress {
  color: var(--text-secondary);
  font-weight: 700;
}

.flashcards-total {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.flashcards-stage {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
}

.flashcards-nav {
  display: flex;
  gap: 0.75rem;
}

.flashcard {
  perspective: 1200px;
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flashcard-inner {
  width: 100%;
  max-width: 760px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.flashcard.is-revealed .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 10, 26, 0.35);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.flashcard-front {
  transform: rotateY(0deg);
}

.flashcard-back {
  transform: rotateY(180deg);
}

.flashcard-face {
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.06);
}

#flashcardQuestion {
  color: var(--text-primary);
  font-weight: 650;
  font-size: 1.15rem;
  line-height: 1.6;
}

#flashcardAnswer {
  color: var(--text-secondary);
  font-weight: 550;
  font-size: 1.05rem;
  line-height: 1.6;
}

.flashcards-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.flashcards-small.muted {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== DSA FLASHCARDS: accessibility/UX ===== */
.pagination-btn {
  border-radius: 14px;
}

@media (max-width: 768px) {
  .flashcards-header {
    justify-content: center;
  }

  .flashcards-nav {
    width: 100%;
    justify-content: center;
  }

  .flashcard-face {
    padding: 1rem;
  }
}

/* ===== SECTIONS ===== */
.section {
  padding: 6rem 2rem;
  position: relative;
  /* Ensure anchor jumps land below the fixed navbar */
  scroll-margin-top: 72px;
}

/* Universal safety-net: any section/div with an id used as an anchor target */
section[id] {
  scroll-margin-top: 72px;
  /* Contain stacking contexts (backdrop-filter on cards) so they can't
     overflow onto the fixed navbar */
  isolation: isolate;
}

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

.section-title {
  font-family: "Orbitron", sans-serif;
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-icon {
  font-size: 2.5rem;
  background: none;
  -webkit-text-fill-color: initial;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

/* ===== TOPICS GRID ===== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.topic-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.topic-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-1);
}

.topic-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--glass-shadow);
  border-color: var(--primary-light);
}

.topic-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.topic-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.topic-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.topic-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Topic Mastery Progress */
.topic-mastery {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--glass-border);
}

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

.mastery-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.mastery-stats {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.mastery-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.mastery-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient-1);
  transition: width 0.6s ease;
}

.mastery-percentage {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
}

/* Color the fill based on progress level */
.mastery-fill[style*="width: 10"],
.mastery-fill[style*="width: 2"],
.mastery-fill[style*="width: 3"],
.mastery-fill[style*="width: 4"] {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.mastery-fill[style*="width: 5"],
.mastery-fill[style*="width: 6"],
.mastery-fill[style*="width: 7"] {
  background: linear-gradient(90deg, #f97316, #eab308);
}

.mastery-fill[style*="width: 8"],
.mastery-fill[style*="width: 9"],
.mastery-fill[style*="width: 100"] {
  background: linear-gradient(90deg, #22c55e, #06b6d4);
}

.difficulty-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.difficulty-badge .difficulty-icon {
  margin-right: 0.35rem;
  font-size: 0.95rem;
  display: inline-block;
  vertical-align: -0.05em;
}

.easy {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.medium {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.hard {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ===== PRACTICE SECTION ===== */
.practice-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 400px;
}

.search-bar i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-bar input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  padding-right: 3rem;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* ===== CLEAR SEARCH BUTTON ===== */

.clear-search-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);

  width: 28px;
  height: 28px;

  border: none;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);

  cursor: pointer;

  display: none;

  align-items: center;
  justify-content: center;

  font-size: 1rem;
  font-weight: bold;

  transition: all 0.3s ease;
}

.clear-search-btn:hover {
  background: rgba(255, 77, 109, 0.2);
  color: #ff4d6d;
  transform: translateY(-50%) scale(1.1);
}

.clear-search-btn.visible {
  display: flex;
}

.search-bar {
  position: relative;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Problem Counter CSS */
.problem-counter-container {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
  font-weight: 500;
}

.problem-counter-container span {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.problems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.problem-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

/* ===== RECENTLY VIEWED PROBLEMS ===== */

.recent-problem {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  transition: all 0.3s ease;
  overflow-wrap: anywhere;
}

.recent-problem:hover {
  transform: translateX(5px);
}

.recent-problem:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.recommendation-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  margin: 0.5rem 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.recommendation-item:hover,
.recommendation-item:focus-visible {
  border-color: var(--accent);
  background: rgba(0, 210, 255, 0.08);
  transform: translateX(4px);
}

.recommendation-item span,
.recommendation-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.recommendation-item small {
  color: var(--text-secondary);
  text-transform: capitalize;
}

.problem-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--glass-shadow);
  border-color: var(--accent);
}

/* ===== FAVORITE BUTTON ===== */

.favorite-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.3s ease;

  margin-left: auto;
  margin-right: 0.7rem;

  backdrop-filter: blur(10px);
}

.favorite-btn:hover {
  transform: scale(1.12);
  color: #ff4d6d;
  border-color: #ff4d6d;
  box-shadow: 0 0 15px rgba(255, 77, 109, 0.35);
}

.favorite-btn.active {
  background: rgba(255, 77, 109, 0.15);
  color: #ff4d6d;
  border-color: #ff4d6d;
}

.notes-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-left: 0.5rem;
  backdrop-filter: blur(10px);
}

.notes-btn:hover {
  transform: scale(1.12);
  color: #fbbf24;
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.35);
}

.notes-btn.active {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: #fbbf24;
}

.notes-btn i {
  pointer-events: none;
}

.favorite-btn i {
  pointer-events: none;
}

/* Favorites filter special style */

.filter-btn[data-filter="favorites"] {
  color: #ff4d6d;
}

.filter-btn[data-filter="favorites"].active {
  background: #ff4d6d;
  color: white;
  border-color: #ff4d6d;
}

.problem-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.6rem;
}

.problem-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.problem-id {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.problem-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.problem-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  background: var(--dark-card);
  color: var(--accent);
}

.problem-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.problem-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.solve-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  background: var(--gradient-3);
  border: none;
  color: var(--dark-bg);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.solve-btn:hover {
  transform: scale(1.05);
}

/* ===== ROADMAP SECTION ===== */
.roadmap-container {
  position: relative;
  padding: 2rem 0;
}

.roadmap-progress {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--dark-card);
  transform: translateY(-50%);
  z-index: 0;
}

#roadmapProgress {
  height: 100%;
  background: var(--gradient-4);
  width: 0%;
  transition: width 1.5s ease;
  border-radius: 3px;
}

.roadmap-stages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.stage {
  text-align: center;
  padding: 2rem;
  background: var(--glass-bg);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.stage.active {
  background: var(--gradient-1);
  transform: scale(1.05);
}

.stage-marker {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--dark-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 3px solid var(--accent);
}

.stage.active .stage-marker {
  background: var(--dark-bg);
  border-color: var(--text-primary);
}

.stage h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.stage ul {
  list-style: none;
  text-align: left;
}

.stage ul li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.5rem;
}

.stage ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ===== ROADMAP TABS & TIMELINE ===== */
.roadmap-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.roadmap-tab {
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.roadmap-tab.active,
.roadmap-tab:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

.roadmap-content {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.roadmap-content.active {
  display: block;
  opacity: 1;
}

.roadmap-timeline {
  position: relative;
  padding-left: 3.5rem;
  margin: 2rem 0;
}

.roadmap-timeline::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 0;
}

.roadmap-step {
  position: relative;
  margin-bottom: 2.5rem;
}

.step-marker-dot {
  position: absolute;
  left: -3.5rem;
  top: 0.5rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--dark-surface);
  border: 3px solid var(--glass-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 1;
  transition: all 0.3s ease;
}

.roadmap-step.completed .step-marker-dot {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.roadmap-step.active .step-marker-dot {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

.roadmap-step.locked .step-marker-dot {
  opacity: 0.6;
}

.roadmap-step-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.roadmap-step.locked .roadmap-step-card {
  opacity: 0.6;
  pointer-events: none;
}

.roadmap-step.active .roadmap-step-card {
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 5px 20px rgba(124, 58, 237, 0.15);
}

.roadmap-step.completed .roadmap-step-card {
  border-color: rgba(34, 197, 94, 0.4);
}

.step-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.step-number {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
}

.step-status-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.step-status-tag.locked-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.step-status-tag.active-tag {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary);
}

.step-status-tag.completed-tag {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.step-title {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.step-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.step-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-progress {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  max-width: 250px;
}

.step-progress-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.step-progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--dark-card);
  border-radius: 3px;
  overflow: hidden;
}

.step-progress-bar-fill {
  height: 100%;
  background: var(--gradient-4);
  width: 0%;
  transition: width 0.6s ease;
  border-radius: 3px;
}

.roadmap-step.completed .step-progress-bar-fill {
  background: linear-gradient(90deg, #22c55e, #10b981);
}

/* ===== ROADMAP DETAIL MODAL ===== */
.roadmap-modal-content {
  max-width: 750px;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
}

.step-badge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: white;
  background: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-right: 0.8rem;
}

.roadmap-step-theory h4,
.roadmap-step-complexity h4,
.roadmap-step-quiz h4,
.roadmap-step-problems h4 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.theory-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.theory-text p {
  margin-bottom: 0.8rem;
}

.theory-text strong {
  color: var(--text-primary);
}

.complexity-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.complexity-table th,
.complexity-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.complexity-table th {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.complexity-table td {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.roadmap-problems-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

.roadmap-problem-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  margin-bottom: 0.8rem;
  transition: all 0.3s ease;
}

.roadmap-problem-item:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.roadmap-problem-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.roadmap-problem-title {
  font-weight: 600;
  color: var(--text-primary);
}

.roadmap-problem-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.roadmap-problem-status {
  font-size: 0.85rem;
  font-weight: 600;
}

.roadmap-problem-status.completed {
  color: #22c55e;
}

.roadmap-problem-status.pending {
  color: var(--text-secondary);
}

/* Roadmap Quiz Styles */
.quiz-question-container {
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1.2rem;
}

.quiz-question-text {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.quiz-options-list {
  list-style: none;
  padding: 0;
}

.quiz-option-item {
  padding: 0.6rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.quiz-option-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.quiz-option-item.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
}

.quiz-option-item.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: white;
}

.quiz-option-item.incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: white;
}

.quiz-feedback {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.quiz-feedback.correct {
  color: #22c55e;
}

.quiz-feedback.incorrect {
  color: #ef4444;
}

.quiz-instruction-text,
.problems-instruction-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-style: italic;
}

#roadmapStepSubmitQuizBtn {
  margin-bottom: 1.5rem;
}

/* ===== OVERALL STAGES ===== */
.overall-roadmap {
  max-width: 900px;
  margin: auto;
}

.overall-stage {
  background: var(--card-bg);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.overall-stage:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.25);
}

.stage-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.topic-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.topic-list span {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.2);
}

.road-arrow {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  font-size: 2rem;
  color: #8b5cf6;
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.7);
}

.road-arrow i {
  transition: transform 0.3s ease;
}

.road-arrow:hover i {
  transform: translateY(4px);
}

/* ===== INTERVIEW SECTION ===== */
.interview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.interview-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.interview-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(124, 58, 237, 0.1) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.interview-card:hover::before {
  opacity: 1;
}

.card-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.interview-card h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  position: relative;
}

.interview-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  position: relative;
}

.card-btn {
  padding: 0.8rem 2rem;
  border-radius: 50px;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.card-btn:hover {
  background: var(--accent);
  color: var(--dark-bg);
}

/* ===== DASHBOARD SECTION ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.dashboard-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px);
  box-shadow: 0 15px 30px rgba(124, 58, 237, 0.25);
}

.dashboard-card h3 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  position: relative;
  transition: color 0.3s ease;
}

.dashboard-card:hover h3 {
  color: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.stat-item {
  padding: 1rem;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-item {
  border-radius: 14px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.05);
}

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

.stat-value {
  transition: transform 0.3s ease;
}

.stat-item:hover .stat-value {
  transform: scale(1.15);
}

.activity-list,
.leaderboard-list {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item,
.leaderboard-item {
  padding: 1rem;
  margin-bottom: 0.8rem;
  background: var(--dark-card);
  border: 1px solid transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.leaderboard-item.current-user {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.leader-rank {
  min-width: 3rem;
  font-weight: 700;
  color: var(--accent);
}

.leader-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  line-height: 1;
}

.leader-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.leader-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: minmax(2.2rem, auto) 2rem minmax(0, 1fr) auto;
  min-width: 0;
}

.leader-xp {
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
}

.activity-item .activity-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-item {
  justify-content: space-between;
}

.activity-icon {
  color: var(--accent);
}

.activity-feed {
  display: grid;
  gap: 0.6rem;
}

.activity-feed-item {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.activity-feed-icon {
  line-height: 1;
  text-align: center;
}

.activity-feed-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-feed-time {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.activity-empty {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: 120px;
  color: var(--text-secondary);
  text-align: center;
}

.activity-feed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.badges-container,
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 1rem;
  align-items: start;
}

.badge {
  width: clamp(56px, 100%, 70px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gradient-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
  justify-self: center;
}

.badge:hover {
  transform: scale(1.1);
}

.badge.locked {
  background: var(--dark-card);
  opacity: 0.5;
}

.badge-tooltip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark-card);
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: normal;
  text-align: center;
  width: max-content;
  max-width: min(220px, 70vw);
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.badge:hover .badge-tooltip,
.badge:focus .badge-tooltip {
  opacity: 1;
}

.empty-state {
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== ACTIVITY HEATMAP ===== */
.heatmap-card {
  grid-column: 1 / -1;
}

.heatmap-card .heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.heatmap-card .legend-swatches {
  display: flex;
  gap: 4px;
}

.heatmap-card .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
}

.heatmap-card .legend-swatch[data-level="0"] {
  background: rgba(255, 255, 255, 0.05);
}

.heatmap-card .legend-swatch[data-level="1"] {
  background: rgba(124, 58, 237, 0.35);
}

.heatmap-card .legend-swatch[data-level="2"] {
  background: rgba(124, 58, 237, 0.6);
}

.heatmap-card .legend-swatch[data-level="3"] {
  background: rgba(124, 58, 237, 0.8);
}

.heatmap-card .legend-swatch[data-level="4"] {
  background: rgba(124, 58, 237, 1);
}

.heatmap-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: auto;
  padding: 0.5rem 0;
  position: relative;
}

.heatmap-months-row {
  display: grid;
  grid-template-columns: 30px repeat(52, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 2px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 1;
  min-height: 14px;
}

.heatmap-month-label {
  grid-row: 1;
  white-space: nowrap;
  overflow: visible;
}

.heatmap-grid {
  display: flex;
  gap: 3px;
  width: 100%;
  overflow: hidden;
  min-width: 750px;
}

.heatmap-container {
  overflow-x: auto;
}

.heatmap-weekday-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 6px;
  min-width: 26px;
  flex-shrink: 0;
}

.heatmap-weekday-label {
  flex: 1;
  min-width: 26px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  overflow: visible;
  white-space: nowrap;
}

.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
}

.heatmap-day {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.heatmap-day:hover {
  border-color: var(--accent);
  filter: brightness(1.3);
}

.heatmap-day[data-level="0"] {
  background: rgba(255, 255, 255, 0.05);
}

.heatmap-day[data-level="1"] {
  background: rgba(124, 58, 237, 0.35);
}

.heatmap-day[data-level="2"] {
  background: rgba(124, 58, 237, 0.6);
}

.heatmap-day[data-level="3"] {
  background: rgba(124, 58, 237, 0.8);
}

.heatmap-day[data-level="4"] {
  background: rgba(124, 58, 237, 1);
}

.heatmap-day[data-future="true"] {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.heatmap-day[data-future="true"]:hover {
  border-color: transparent;
  transform: none;
  box-shadow: none;
}

.heatmap-tooltip {
  position: fixed;
  background: var(--dark-card);
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 99999;
  white-space: nowrap;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  left: 0;
  top: 0;
}

.heatmap-tooltip.visible {
  opacity: 1;
}

.heatmap-tooltip strong {
  color: var(--accent);
  display: block;
  margin-bottom: 0.2rem;
}

/* ===== GAMIFICATION SECTION ===== */
.gamification-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.xp-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.xp-bar-container {
  position: relative;
  height: 30px;
  background: var(--dark-card);
  border-radius: 15px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.xp-bar {
  height: 100%;
  background: var(--gradient-4);
  width: 0%;
  transition: width 1s ease;
  border-radius: 15px;
}

.xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.level-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: var(--gradient-2);
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
}

.badges-showcase {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.badge-lg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.badge-lg:hover {
  transform: scale(1.1) rotate(10deg);
}

#dailyChallengeCard {
  min-height: 250px;
  position: relative;
  overflow: hidden;
}

#dailyChallengeCard p {
  margin-bottom: 1rem;
}

#dailyChallengeCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.8s ease;
}

#dailyChallengeCard:hover::before {
  transform: translateX(100%);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.profile-info h3 {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.profile-level {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.profile-join {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.profile-stats {
  display: grid;
  /* Automatically wraps columns if they shrink below 110px */
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.8rem;
  /* Slightly reduced gap for better fit */
  margin-bottom: 1.5rem;
}

.profile-stat {
  text-align: center;
  padding: 0.8rem;
  /* Slightly reduced padding to prevent text squishing */
  background: var(--dark-card);
  border-radius: 12px;
}

.profile-stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-bar-container {
  padding: 0.5rem;
  background: var(--dark-card);
  border-radius: 10px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--dark-surface);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-4);
  border-radius: 5px;
  transition: width 1s ease;
  width: 0%;
}

/* ===== CHATBOT WIDGET ===== */
.chatbot-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
}

.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-1);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
  position: relative;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background: var(--dark-surface);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chatbot-window.hidden {
  display: none;
}

.chatbot-header {
  background: var(--gradient-1);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header h4 {
  font-size: 1.1rem;
}

.chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
}

.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 80%;
  padding: 0.8rem;
  border-radius: 15px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.bot {
  align-self: flex-start;
  background: var(--dark-card);
  color: var(--text-primary);
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
}

.chatbot-input {
  padding: 1rem;
  background: var(--dark-card);
  display: flex;
  gap: 0.5rem;
}

.chatbot-input input {
  flex: 1;
  padding: 0.8rem 1rem;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--text-primary);
}

.chatbot-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.chatbot-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chatbot-input button:hover {
  background: var(--primary-light);
}

.quick-questions {
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--dark-card);
}

.quick-q {
  padding: 0.4rem 0.8rem;
  border-radius: 15px;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-q:hover {
  background: var(--primary);
  color: white;
}

/* ===== IMPROVED ALGO ASSISTANT ===== */

.assistant-response h4 {
  color: var(--accent);
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.assistant-response p {
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.assistant-response pre {
  background: #111827;
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  border-left: 3px solid var(--primary);
}

.assistant-response code {
  color: #22c55e;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
}

.message.loading {
  opacity: 0.8;
  animation: pulse-message 1s infinite;
}

@keyframes pulse-message {
  0% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.5;
  }
}

.chatbot-messages {
  scroll-behavior: smooth;
}

.message.bot {
  line-height: 1.6;
}

.message.bot pre {
  margin-top: 0.8rem;
}

.message.bot::-webkit-scrollbar {
  height: 6px;
}

.message.bot::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

/* ===== MODAL ===== */
body.modal-open {
  overflow: hidden !important;
  padding-right: var(--scrollbar-width, 0px) !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  overscroll-behavior: contain;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--dark-surface);
  border-radius: 20px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 2rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--dark-surface);
  z-index: 10;
}

.modal-header h3 {
  font-size: 1.8rem;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

#notesEditor {
  width: 100%;
  min-height: 200px;
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 1rem;
  color: var(--text-primary);
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  resize: vertical;
  line-height: 1.6;
}

#notesEditor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

/* ===== NOTES MODAL ===== */

.notes-modal-content {
  max-width: 900px;
}

.modal-body label {
  display: block;

  margin-bottom: 1rem;

  font-size: 1rem;
  font-weight: 600;

  color: var(--text-primary);
}

.notes-textarea {
  width: 100%;

  min-height: 220px;

  padding: 1rem 1.2rem;

  border-radius: 14px;

  border: 1px solid var(--glass-border);

  background: rgba(255, 255, 255, 0.05);

  color: var(--text-primary);

  font-size: 1rem;

  font-family: "Poppins", sans-serif;

  line-height: 1.7;

  resize: vertical;

  outline: none;

  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

.notes-textarea:focus {
  border-color: var(--primary);

  background: rgba(255, 255, 255, 0.08);

  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
}

.notes-textarea::placeholder {
  color: var(--text-secondary);

  line-height: 1.6;
}

.topic-theory,
.topic-problems,
.topic-difficulty {
  margin-bottom: 2rem;
}

.topic-theory h4,
.topic-problems h4,
.topic-difficulty h4 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.topic-theory p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.topic-problems ul {
  list-style: none;
}

.topic-problems li {
  padding: 0.8rem;
  margin-bottom: 0.5rem;
  background: var(--dark-card);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.topic-problems li:hover {
  background: var(--primary);
  transform: translateX(5px);
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--glass-border);
  text-align: right;
  position: sticky;
  bottom: 0;
  background: var(--dark-surface);
}

/* ===== QUIZ EDITOR MODAL ===== */
/* ===== QUIZ LOADING SCREEN ===== */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  width: 100%;
}

.quiz-loading h3 {
  font-family: Orbitron, sans-serif;
  font-size: 1.6rem;
  margin-top: 1rem;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#loadingTopicName {
  font-family: "Fira Code", monospace;
  color: var(--accent);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  letter-spacing: 1px;
}

#quizEditorModal {
  z-index: 10001;
}

#quizEditorModal.active {
  display: flex;
}

.modal.quiz-modal.active {
  display: flex;
}

.quiz-modal-content {
  max-width: 1300px;
  width: 95%;
  height: 85vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#quizEditorModal ::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.quiz-modal-header {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  background: var(--dark-surface);
}

.quiz-problem-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.quiz-topic-badge {
  background: var(--primary);
  color: var(--dark-bg);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.quiz-difficulty {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.quiz-modal-header h3 {
  font-size: 1.1rem;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.quiz-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
  margin-left: auto;
  line-height: 1;
}

.quiz-modal-close:hover {
  color: var(--text-primary);
}

.quiz-modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
}

.quiz-layout {
  display: flex;
  height: 100%;
  overflow-x: hidden;
}

.quiz-problem-panel {
  flex: 0.24;
  padding: 1.25rem;
  border-right: 1px solid var(--glass-border);
  background: var(--dark-bg);
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

.quiz-editor-panel {
  flex: 0.76;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.problem-description h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.problem-description p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.problem-examples h5 {
  font-size: 0.85rem;
  margin: 0.75rem 0 0.35rem;
  color: var(--text-primary);
}

.problem-examples {
  margin-bottom: 0;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 0.85rem;
  line-height: 1.5;
}

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.5rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 0.8rem;
}

.language-select {
  background: var(--dark-card);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

.language-select:focus {
  outline: none;
  border-color: var(--accent);
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: var(--dark-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.editor-btn:hover {
  background: var(--primary);
  color: var(--dark-bg);
  border-color: var(--primary);
}

.code-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--dark-bg);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 0 0 10px 10px;
}

.editor-container {
  flex: 1;
  display: flex;
  position: relative;
  background: var(--dark-bg);
  min-height: 0;
}

.code-editor {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: var(--dark-bg);
  overflow: hidden;
}

.code-textarea {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 45px;
  right: 0;
  width: calc(100% - 45px);
  height: 100%;
  padding: 1rem 1.5rem;
  margin: 0;
  background: transparent;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--text-primary);
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: var(--editor-font-size, 14px);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  word-spacing: normal;
  border: none;
  outline: none;
  resize: none;
  tab-size: 4;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre !important;
  overflow-wrap: normal !important;
  z-index: 2;
  box-sizing: border-box;
  max-width: 100%;
}

.code-textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
  -webkit-text-fill-color: var(--text-secondary);
}

.line-numbers {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 45px;
  background: var(--dark-surface);
  border-right: 1px solid var(--glass-border);
  padding: 1rem 0.5rem;
  text-align: right;
  color: var(--text-secondary);
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: var(--editor-font-size, 14px);
  line-height: 1.6;
  user-select: none;
  pointer-events: none;
  overflow: hidden !important;
  z-index: 3;
  white-space: pre !important;
  overflow-wrap: normal !important;
  box-sizing: border-box;
}

.editor-shortcuts {
  padding: 0.5rem 1.5rem;
  background: var(--dark-surface);
  border-top: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: flex;
  gap: 1.5rem;
}

.editor-shortcuts kbd {
  background: var(--dark-card);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  font-size: 0.75rem;
}

.quiz-modal-footer {
  padding: 0;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.quiz-output-container {
  background: var(--dark-surface);
}

.output-header {
  padding: 0.8rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.output-header:hover {
  background: rgba(0, 0, 0, 0.3);
}

.clear-output-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.clear-output-btn:hover {
  color: #ef4444;
}

.output-content {
  padding: 1rem 1.5rem;
  font-family: "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text-secondary);
}

.output-placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
  font-style: italic;
}

.output-success {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  white-space: pre-wrap;
}

.output-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  white-space: pre-wrap;
}

.output-running {
  color: var(--accent);
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.test-cases-section {
  margin-top: 1rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 0.75rem;
}

.test-cases-heading {
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.test-cases-container {
  overflow-x: hidden;
}

.quiz-problem-panel .test-cases-container {
  padding: 0;
}

.test-case {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.3rem;
  background: var(--dark-card);
  border-radius: 6px;
  transition: all 0.2s ease;
  word-break: break-word;
  overflow-wrap: break-word;
}

.test-case:last-child {
  margin-bottom: 0;
}

.test-case:hover {
  transform: translateX(3px);
}

.test-case.passed {
  background: rgba(34, 197, 94, 0.1);
}

.test-case.failed {
  background: rgba(239, 68, 68, 0.1);
}

.quiz-actions {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--dark-surface);
}

.quiz-actions .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.problem-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer {
  background: var(--dark-surface);
  padding: 2.5rem 2rem 1.5rem;
  margin-top: 4rem;
  border-top: 1px solid var(--glass-border);
}

.footer-content {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-section h3 {
  font-family: "Orbitron", sans-serif;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-section h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.footer-section p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-links a:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.35rem;
}

.footer-section ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: var(--primary-light);
}

.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.newsletter-form input {
  flex: 1;
  padding: 0.8rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--text-primary);
}

.newsletter-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.newsletter-form button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-3);
  border: none;
  color: var(--dark-bg);
  cursor: pointer;
  transition: all 0.3s ease;
}

.newsletter-form button:hover {
  transform: scale(1.1);
}

/* ===== NEWSLETTER FORM VALIDATION ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.newsletter-error {
  display: block;
  width: 100%;
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 6px;
  min-height: 1.2em;
}

.newsletter-form input.input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.newsletter-form input.input-success {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.footer-bottom-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.footer-bottom-links a {
  color: var(--primary-light);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.3s ease;
}

.footer-bottom-links a:hover {
  color: var(--accent);
}

/* ===== QUIZ SECTION ===== */
.quiz-section {
  background: linear-gradient(
    180deg,
    var(--dark-bg) 0%,
    var(--dark-surface) 100%
  );
  padding: 6rem 2rem;
  position: relative;
  scroll-margin-top: 72px;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto !important;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.start-quiz-btn {
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

/* .quiz-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-4);
} */

.quiz-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-4);
}

.quiz-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--glass-shadow);
  border-color: var(--accent);
}

.quiz-card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.quiz-card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.quiz-card-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.6;
  pointer-events: none;

  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.quiz-card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.quiz-count {
  color: var(--text-secondary);
}

.quiz-progress-bar {
  height: 8px;
  background: var(--dark-card);
  border-radius: 4px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gradient-4);
  width: 0%;
  transition: width 1s ease;
  border-radius: 4px;
}

.quiz-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.quiz-stats strong {
  color: var(--accent);
}

.start-quiz-btn {
  width: 100%;
  justify-content: center;
}

/* ===== QUIZ MODAL ===== */
.modal.quiz-modal {
  z-index: 3000;
}

.modal.quiz-modal.active {
  display: flex;
}

.quiz-modal-content {
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  width: 100%;
  max-width: 1300px;
  height: 85vh;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quiz-modal-header {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  background: var(--dark-surface);
}

.quiz-modal-header h3 {
  font-size: 1.1rem;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.quiz-modal-body {
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.quiz-problem-panel {
  flex: 0.35;
  min-width: 0;
  padding: 1.25rem;
  background: var(--dark-bg);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

.quiz-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.quiz-progress-bar-container {
  height: 8px;
  background: var(--dark-card);
  border-radius: 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--gradient-1);
  width: 10%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.quiz-timer-box,
.quiz-best-time-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);

  padding: 0.7rem 1rem;
  border-radius: 14px;

  display: flex;
  align-items: center;
  gap: 0.7rem;

  min-width: 150px;

  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.quiz-timer-box i,
.quiz-best-time-box i {
  color: var(--accent);
  font-size: 1rem;
}

.quiz-timer-content,
.quiz-best-time-content {
  display: flex;
  flex-direction: column;
}

.quiz-timer-label,
.quiz-best-time-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.quiz-timer,
.quiz-best-time {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: "Orbitron", sans-serif;
}

.quiz-counter {
  color: var(--text-secondary);
  font-size: 0.9rem;

  padding: 0.7rem 1rem;

  background: var(--glass-bg);

  border-radius: 14px;

  border: 1px solid var(--glass-border);

  backdrop-filter: blur(10px);

  font-weight: 600;
}

.quiz-timer-box,
.quiz-best-time-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);

  padding: 0.7rem 1rem;
  border-radius: 14px;

  display: flex;
  align-items: center;
  gap: 0.7rem;

  min-width: 150px;

  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.quiz-timer-box i,
.quiz-best-time-box i {
  color: var(--accent);
  font-size: 1rem;
}

.quiz-timer-content,
.quiz-best-time-content {
  display: flex;
  flex-direction: column;
}

.timer-label,
.quiz-timer-label,
.quiz-best-time-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.timer-value,
.quiz-timer,
.quiz-best-time {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: Orbitron, sans-serif;
}

.quiz-counter {
  color: var(--text-secondary);
  font-size: 0.9rem;

  padding: 0.7rem 1rem;

  background: var(--glass-bg);

  border-radius: 14px;

  border: 1px solid var(--glass-border);

  backdrop-filter: blur(10px);

  font-weight: 600;
}

.quiz-question {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 2rem;
  line-height: 1.6;
  clear: both;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
  transform: translateX(5px);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.2);
}

.quiz-option.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
}

.quiz-option.incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.option-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary-light);
  flex-shrink: 0;
}

.quiz-option.correct .option-letter {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

.quiz-option.incorrect .option-letter {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.option-text {
  color: var(--text-primary);
  line-height: 1.5;
}

/* Quiz Info Panel */
.quiz-info-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 20px;
  margin: 1.5rem;
}

.quiz-info-panel h4 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.quiz-info-panel ul {
  list-style: none;
  margin-bottom: 1.5rem;
}

.quiz-info-panel ul li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  position: relative;
  padding-left: 1.5rem;
}

.quiz-info-panel ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.quiz-xp-display {
  background: var(--gradient-4);
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  color: var(--dark-bg);
  font-size: 1rem;
}

.quiz-xp-display i {
  margin-right: 0.5rem;
}

/* Quiz Result */
.quiz-result {
  text-align: center;
  padding: 2rem;
  width: 100%;
  color: white;
}

.quiz-result h3,
.quiz-result p,
.quiz-result span {
  color: white;
}

.quiz-result.hidden {
  display: none;
}

.quiz-result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.quiz-result-icon {
  font-size: 4rem;
  animation: bounce 1s ease;
}

.quiz-result h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.quiz-score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.score-number {
  font-size: 3rem;
  font-weight: bold;
  color: #00d4ff;
}

.xp-gained {
  color: var(--accent);
  font-weight: 600;
  font-size: 1.1rem;
}

.quiz-time-result {
  color: var(--text-primary);
  font-size: 1rem;
  padding: 0.8rem 1.2rem;

  border-radius: 12px;

  background: rgba(255, 255, 255, 0.05);

  border: 1px solid var(--glass-border);

  backdrop-filter: blur(10px);
}

.quiz-time-result strong {
  color: var(--accent);
  font-family: "Orbitron", sans-serif;
}

.quiz-review-container {
  max-height: calc(90vh - 140px);
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}

.quiz-review {
  display: flex;
  flex-direction: column;
}

/* Ensure the review list always expands and can scroll */
.quiz-review-items {
  flex: 1;
  min-height: 0;
}

/* Each item should not be positioned/hidden by layout */
.review-item {
  position: relative;
  z-index: 1;
}

.review-item {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.review-question {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.review-answer,
.review-correct,
.review-explanation {
  margin: 8px 0;
  line-height: 1.6;
}

/* Profile Edit Modal */
.profile-edit-modal {
  max-width: 500px;
}

.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.avatar-selector h4,
.name-editor label {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent);
  display: block;
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.avatar-option {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 3px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-option:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.avatar-option.selected {
  border-color: var(--accent);
  background: var(--gradient-1);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.name-editor input {
  width: 100%;
  padding: 1rem;
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.name-editor input:focus {
  outline: none;
  border-color: var(--accent);
}

.name-editor input::placeholder {
  color: var(--text-secondary);
}

/* Profile edit button */
.profile-edit-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-edit-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.profile-card {
  position: relative;
}

.profile-card:hover .profile-avatar {
  transform: scale(1.1) rotate(8deg);
}

/* ====== FOOTER QUESTIONS ====== */
.footer-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-question {
  padding: 0.6rem 1rem;
  border-radius: 15px;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.footer-question:hover {
  background: var(--primary);
  color: white;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .filter-btn {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .main-title {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1.3rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .hero-stats {
    flex-direction: row;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: visible;
  }

  .stat-box {
    flex: 1;
    min-width: 0;
    padding: 0.75rem;
  }

  .roadmap-stages {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .progress-bar {
    display: none;
  }

  .practice-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar {
    max-width: 100%;
  }

  .problems-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    text-align: center;
  }

  .chatbot-window {
    width: 300px;
    height: 450px;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }

  .newsletter-form {
    justify-content: center;
  }

  .quiz-grid {
    grid-template-columns: 1fr;
  }

  .quiz-layout {
    flex-direction: column;
  }

  .quiz-editor-panel {
    order: -1;
  }

  .avatar-options {
    grid-template-columns: repeat(4, 1fr);
  }

  .profile-edit-modal .modal-content {
    width: 95%;
    margin: 1rem;
  }

  .quiz-top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-timer-box,
  .quiz-best-time-box {
    width: 100%;
    min-width: 0;
  }

  .quiz-counter {
    width: 100%;
    text-align: center;
  }

  .hero {
    min-height: 80vh;
  }

  .gamification-grid {
    grid-template-columns: 1fr;
  }

  .problem-card,
  .xp-card,
  .badges-showcase {
    width: 100%;
    min-width: 0;
  }

  .problem-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 4rem 1rem;
    scroll-margin-top: 64px;
  }

  section[id] {
    scroll-margin-top: 64px;
  }

  .navbar {
    padding: 1rem;
  }

  .logo-title {
    display: none;
  }

  .section-title {
    font-size: 2rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }
}

/* ===== DARK/LIGHT MODE ===== */
html.light-mode {
  --dark-bg: #ffffff;
  --dark-surface: #f8fafc;
  --dark-card: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* ADD THIS BELOW — fixes navbar hardcoded backgrounds */
html.light-mode .navbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html.light-mode .nav-links {
  background: #ffffff;
}

html.light-mode .nav-link,
html.light-mode .dropdown-toggle {
  color: #4a5568;
}

html.light-mode .nav-link:hover,
html.light-mode .dropdown-toggle:hover {
  color: #1a202c;
  background: rgba(0, 0, 0, 0.05);
}

html.light-mode .dropdown-menu {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}

html.light-mode .dropdown-item {
  color: #4a5568;
}

html.light-mode .dropdown-item:hover {
  background: var(--primary);
  color: white;
}

html.light-mode .dark-mode-btn,
html.light-mode .menu-toggle {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a202c;
}

html.light-mode .nav-auth-link {
  color: #4a5568;
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.03);
}

html.light-mode .nav-auth-link:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

html.light-mode .logo-text {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light-mode .logo-title {
  background: linear-gradient(90deg, #0f172a, #334155);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light-mode .dropdown-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(34, 211, 238, 0.2);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(34, 211, 238, 0.05);
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-bg, #0a0a1a);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--dark-card, #252550);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary, #7c3aed);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--dark-card, #252550) var(--dark-bg, #0a0a1a);
}

/* ===== GLASSMORPHISM ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 0.8rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.output-info {
  color: var(--accent);
  padding: 1rem;
  border-left: 3px solid var(--accent);
  margin: 0.5rem 1rem;
}

.output-warning {
  color: #fbbf24;
  padding: 1rem;
  border-left: 3px solid #fbbf24;
  margin: 0.5rem 1rem;
}

.output-legend {
  display: flex;
  gap: 2rem;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.output-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.output-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.syntax-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 45px;
  right: 0;
  width: calc(100% - 45px);
  height: 100%;
  padding: 1rem 1.5rem;
  margin: 0;
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: var(--editor-font-size, 14px);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  word-spacing: normal;
  white-space: pre;
  pointer-events: none;
  overflow: hidden;
  color: var(--text-primary);
  z-index: 1;
  box-sizing: border-box;
  background: transparent;
}

.output-panel {
  background: var(--dark-surface);
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.output-panel.collapsed {
  flex: 0 0 auto;
}

.output-panel.collapsed .output-content {
  display: none;
}

.syntax-highlight .token.keyword {
  color: #c792ea;
}

.syntax-highlight .token.string {
  color: #c3e88d;
}

.syntax-highlight .token.preprocessor {
  color: #a27dea;
}

.syntax-highlight .token.number {
  color: #f78c6c;
}

.syntax-highlight .token.comment {
  color: #546e7a;
}

.syntax-highlight .token.operator {
  color: #89ddff;
}

.syntax-highlight .token.function {
  color: #82aaff;
}

.syntax-highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.current-line-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.6em;
  pointer-events: none;
  z-index: 0;
  background: rgba(124, 58, 237, 0.18);
  border-left: 3px solid rgba(124, 58, 237, 0.6);
  transition: top 0.08s ease;
}

.syntax-highlight .token.keyword-decl {
  color: #f97316;
}

.syntax-highlight .token.keyword-type {
  color: #38bdf8;
}

.syntax-highlight .token.keyword-literal {
  color: #4ade80;
}

/* Editor line highlight */
.code-textarea:focus ~ .syntax-highlight {
  display: block;
}

/* Code completion dropdown */
.code-completion {
  position: absolute;
  bottom: 200px;
  left: 100px;
  width: 300px;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  box-shadow: var(--glass-shadow);
  display: none;
  z-index: 10;
}

.code-completion.active {
  display: block;
}

.completion-item {
  padding: 0.8rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: background 0.2s ease;
}

.completion-item:hover,
.completion-item.selected {
  background: rgba(124, 58, 237, 0.2);
}

.completion-type {
  font-size: 0.75rem;
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  background: var(--glass-bg);
  border-radius: 4px;
}

.completion-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Editor minimap */
.editor-minimap {
  width: 80px;
  background: var(--dark-surface);
  border-left: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}

.minimap-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  font-size: 2px;
  line-height: 2px;
  color: var(--text-secondary);
  opacity: 0.6;
  white-space: pre;
  padding: 0.5rem;
}

/* Editor tabs */
.editor-tabs {
  display: flex;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 1rem;
}

.editor-tab {
  padding: 0.8rem 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-tab.active {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.1);
}

.editor-tab:hover {
  color: var(--text-primary);
}

.tab-close {
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.editor-tab:hover .tab-close {
  opacity: 1;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  position: relative;
  z-index: 5;
}

.status-left,
.status-right {
  display: flex;
  gap: 1.5rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.9;
}

/* Matching brackets highlight */
.matching-bracket {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 2px;
}

/* Code folding */
.fold-region {
  color: var(--text-secondary);
  cursor: pointer;
}

.fold-region:hover {
  color: var(--accent);
}

/* Terminal/Console output styling */
.console-output {
  padding: 1rem;
  font-family: "Fira Code", monospace;
}

.console-line {
  margin: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.console-error {
  color: #ef4444;
}

.console-warning {
  color: #fbbf24;
}

.console-success {
  color: #22c55e;
}

.console-info {
  color: var(--accent);
}

.console-timestamp {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Test case results */
.test-case {
  padding: 1rem;
  margin: 0.5rem 0;
  background: var(--dark-card);
  border-radius: 8px;
}

.test-case.passed {
  background: rgba(34, 197, 94, 0.08);
}

.test-case.failed {
  background: rgba(239, 68, 68, 0.08);
}

.test-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.test-result {
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.test-case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.test-case-name {
  font-weight: 600;
  font-size: 0.78rem;
}

.test-case-result {
  font-family: "Fira Code", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.test-case-result.passed {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
}

.test-case-result.failed {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.test-case-result.pending {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.test-case-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-word;
  overflow-wrap: break-word;
}

.test-case-details > div {
  margin-top: 0.1rem;
}

.test-case-details code {
  font-family: "Fira Code", monospace;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  word-break: break-all;
  overflow-wrap: break-word;
}

.test-case-actual {
  color: #f59e0b;
}

.test-case.passed {
  background: rgba(34, 197, 94, 0.12);
}

.test-case.failed {
  background: rgba(239, 68, 68, 0.12);
}

/* Code editor shortcuts panel */
.shortcuts-panel {
  position: absolute;
  bottom: 200px;
  right: 20px;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 1rem;
  width: 250px;
  display: none;
  box-shadow: var(--glass-shadow);
  z-index: 20;
}

.shortcuts-panel.active {
  display: block;
}

.shortcuts-title {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--accent);
}

.shortcuts-list {
  list-style: none;
}

.shortcuts-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.shortcut-key {
  background: var(--dark-card);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  color: var(--text-primary);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(124, 58, 237, 0.5);
  }

  50% {
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.8);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

/* ===== TOPIC OF THE DAY ===== */
.totd-section {
  padding: 2rem 0;
  scroll-margin-top: 72px;
}

.totd-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  margin: 2px;
  border-radius: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.totd-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-1);
}

.totd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gradient-1);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
}

.totd-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.totd-icon {
  font-size: 3.5rem;
  flex-shrink: 0;
}

.totd-info {
  flex: 1;
}

.totd-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.totd-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.totd-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.totd-problems {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
}

.totd-btn {
  width: fit-content;
}

.totd-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-1);
}

.totd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gradient-1);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
}

.totd-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.totd-icon {
  font-size: 3.5rem;
  flex-shrink: 0;
}

.totd-info {
  flex: 1;
}

.totd-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

.recommendation-card {
  margin-top: 15px;
  padding: 15px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.recommendation-card h4 {
  margin-bottom: 8px;
}

.back-to-top {
  position: fixed;
  bottom: 105px;
  right: 40px;

  width: 40px;
  height: 40px;

  border: none;
  border-radius: 50%;

  background: #7c3aed;
  color: white;

  font-size: 18px;

  cursor: pointer;

  display: none;

  z-index: 1000;

  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);

  transition: all 0.3s ease;
}

.back-to-top:hover {
  transform: translateY(-4px);

  background: #8b5cf6;
}

.back-to-top.show {
  display: flex;

  align-items: center;

  justify-content: center;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

.hidden {
  display: none;
}

.quiz-loader {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #ddd;
  border-top: 5px solid #6c63ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.quiz-problem-panel {
  display: block !important;
}

.quiz-card * {
  pointer-events: auto;
}

.section-title {
  pointer-events: none !important;
}

.quiz-grid,
.quiz-card,
.start-quiz-btn {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.quiz-card * {
  position: relative;
}

@media (max-width: 768px) {
  .totd-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .totd-icon {
    font-size: 2.5rem;
  }

  .totd-title {
    font-size: 1.4rem;
  }

  .totd-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .heatmap-grid {
    min-width: 0;
    width: 100%;
  }

  .dashboard-card {
    padding: 1.5rem;
  }

  .hero {
    min-height: 80vh;
  }

  .problems-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== GAME MODAL ===== */
.game-modal .game-modal-content {
  max-width: 700px;
  width: 95%;
  background: var(--dark-surface);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.game-modal-header {
  padding: 1.5rem 2rem;
  background: var(--dark-card);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-modal-header h3 {
  font-size: 1.5rem;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-modal-body {
  padding: 2rem;
  max-height: 80vh;
  overflow-y: auto;
}

.game-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.game-type-card {
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.game-type-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-type-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.game-type-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.game-type-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.game-xp-reward {
  background: var(--gradient-4);
  color: var(--dark-bg);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/*AUTH GATE MODAL*/
#authGateModal {
  z-index: 11000;
}

.auth-gate-modal-content {
  position: relative;
  max-width: 420px;
  width: 90%;
  margin: auto;
  padding: 2.5rem 2rem 2rem;
  background: linear-gradient(
    145deg,
    rgba(26, 26, 62, 0.98) 0%,
    rgba(37, 37, 80, 0.98) 100%
  );
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 24px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: authGateSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes authGateSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Facts Section */
.facts-card {
  background: rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

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

.facts-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.facts-btn {
  padding: 0.3rem 1rem;
  background: #7c3aed;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.2s;
}

.facts-btn:hover {
  transform: scale(1.05);
}

.facts-content {
  text-align: left;
}

#factText {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

#factDate {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Lock icon ring */
.auth-gate-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-gate-lock-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(124, 58, 237, 0.15),
    0 0 0 16px rgba(124, 58, 237, 0.07);
  animation: authLockPulse 2.4s ease-in-out infinite;
}

@keyframes authLockPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 8px rgba(124, 58, 237, 0.15),
      0 0 0 16px rgba(124, 58, 237, 0.07);
  }

  50% {
    box-shadow:
      0 0 0 10px rgba(124, 58, 237, 0.22),
      0 0 0 22px rgba(124, 58, 237, 0.1);
  }
}

.auth-gate-title {
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.auth-gate-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* Perks list */
.auth-gate-perks {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  text-align: left;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
}

.auth-gate-perk {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.auth-gate-perk i {
  width: 18px;
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Action buttons */
.auth-gate-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.auth-gate-btn {
  flex: 1;
  min-width: 130px;
  max-width: 180px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.auth-gate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

/* Dismiss */
.auth-gate-dismiss {
  margin: 0;
}

.auth-gate-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: color 0.2s ease;
  font-family: inherit;
}

.auth-gate-dismiss-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Shake animation for already-locked elements */
@keyframes authGateShake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.auth-gate-shake {
  animation: authGateShake 0.4s ease;
}

.game-stats-bar {
  display: flex;
  justify-content: space-around;
  background: var(--dark-card);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.game-stat {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.game-stat span {
  color: var(--accent);
}

.game-question-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  padding: 1rem;
  background: var(--dark-card);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.game-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.game-option {
  padding: 1rem;
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: center;
}

.game-option:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
}

.game-option.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.game-option.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.game-explanation {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(108, 99, 255, 0.1);
  border-radius: 12px;
  border-left: 4px solid var(--primary);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.game-results-content {
  text-align: center;
  padding: 2rem;
}

.game-results-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.game-results-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin: 2rem 0;
}

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-3);
  background-clip: text;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.game-results-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Badge locked state for gamification */
.badge-lg.locked {
  opacity: 0.4;
  filter: grayscale(100%);
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

.quiz-loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
  text-align: center;
}

.quiz-loader {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  animation: quizSpin 1s linear infinite;
}

@keyframes quizSpin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* ===== Perl Premium Editor ===== */

/* ===== PERL PLAYGROUND MODERN UI FIX ===== */

.perl-section {
  padding: 40px 20px;
  display: flex;
  justify-content: center;
}

.perl-wrapper {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
}

/* LEFT CARD */
.perl-editor-card {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* TOP BAR */
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: "Poppins", sans-serif;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #00ff88;
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 10px #00ff88;
}

.lang-tag {
  background: #7c3aed;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* TEXTAREA (IMPORTANT FIX) */
#perlEditor {
  width: 100%;
  height: 320px;
  background: #0b1220;
  color: #00ff9d;
  border: none;
  outline: none;
  padding: 16px;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* BUTTONS */
.perl-buttons {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #0f172a;
}

.perl-buttons button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.run-btn {
  background: #00ff88;
  color: #000;
}

.reset-btn {
  background: #ff5c5c;
  color: #fff;
}

.sample-btn {
  background: #60a5fa;
  color: #fff;
}

.perl-buttons button:hover {
  transform: scale(1.05);
}

/* OUTPUT CARD */
.perl-output-card {
  flex: 1;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* OUTPUT HEADER */
.perl-output-card .output-header {
  display: flex;
  justify-content: space-between;
  color: #fff;
  margin-bottom: 10px;
  font-family: "Poppins", sans-serif;
}

.live-indicator {
  color: #00ff88;
}

/* OUTPUT TEXT */
#perlOutput {
  color: #00ff9d;
  font-family: "Fira Code", monospace;
  white-space: pre-wrap;
}

.editor-box {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-lg:hover .badge-tooltip,
.badge-lg:focus .badge-tooltip {
  opacity: 1;
}

/* ===== Coding Personality Engine Styles ===== */
.personality-card {
  position: relative;
  background: radial-gradient(
    circle at top right,
    rgba(168, 85, 247, 0.08),
    transparent 60%
  ) !important;
}

.personality-profile-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.personality-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.personality-badge-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #c084fc;
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  flex-shrink: 0;
}

.personality-type-group h4 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.adaptation-badge {
  font-size: 0.72rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-top: 4px;
}

.personality-description {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Style Progress Bars */
.style-progress-bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.style-bar-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.style-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.style-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.style-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#barBrute {
  background: #ef4444;
}

#barOpt {
  background: #a855f7;
}

#barSlow {
  background: #3b82f6;
}

#barGreedy {
  background: #10b981;
}

.personality-actions {
  display: flex;
  margin-top: 0.5rem;
}

.btn-mini {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  width: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Personality Quiz Modal */
.personality-quiz-modal-content {
  max-width: 550px !important;
}

.quiz-question-container {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1rem 0;
}

.quiz-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

.quiz-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
  margin: 0;
}

.quiz-answer-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-answer-option {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.9);
}

.quiz-answer-option:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--primary);
  transform: translateX(5px);
  color: #fff;
}

.quiz-answer-option.selected {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.quiz-answer-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #c084fc;
  flex-shrink: 0;
}

.quiz-answer-option.selected .quiz-answer-letter {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.quiz-answer-text {
  font-size: 0.88rem;
  line-height: 1.4;
}

/* Recommended Badges in Problems grid */
.rec-personality-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 8px;
  box-shadow: 0 0 5px rgba(168, 85, 247, 0.2);
}

/* ===== Mistake DNA Tracker Styles ===== */
.mistake-dna-card {
  position: relative;
  background: radial-gradient(
    circle at top right,
    rgba(249, 115, 22, 0.08),
    transparent 60%
  ) !important;
}

.mistake-dna-content {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1rem;
}

.mistake-dna-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mistake-dna-title-group h4 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.mistake-dna-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

/* Helix Visualizer */
.dna-helix-visualizer {
  width: 100px;
  height: 40px;
  flex-shrink: 0;
  opacity: 0.85;
}

.dna-node-dot {
  animation: dnaPulse 2s infinite ease-in-out;
}

@keyframes dnaPulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.4));
  }

  50% {
    transform: scale(1.25);
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.8));
  }
}

/* Mistake Map Progress Bars */
.mistake-map-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mistake-bar-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mistake-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.mistake-bar-label .category-name {
  color: rgba(255, 255, 255, 0.9);
}

.mistake-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.mistake-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

#barOffByOne {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

#barRecursion {
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
}

#barWrongLogic {
  background: linear-gradient(90deg, #ec4899, #ef4444);
}

/* Socratic Recommendation Box */
.socratic-recommendation-box {
  background: rgba(249, 115, 22, 0.04);
  border: 1px dashed rgba(249, 115, 22, 0.2);
  border-left: 3px solid #f97316;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.2rem;
  transition: all 0.3s ease;
}

.socratic-recommendation-box:hover {
  background: rgba(249, 115, 22, 0.07);
  border-color: rgba(249, 115, 22, 0.35);
  transform: translateY(-2px);
}

.socratic-rec-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fb923c;
  letter-spacing: 0.5px;
}

.socratic-rec-text {
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

/* Recent Mistakes Logs */
.recent-mistakes-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.recent-mistakes-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-mistake-log-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
}

.recent-mistake-log-item:last-child {
  border-bottom: none;
}

.recent-mistake-desc {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
}

.recent-mistake-source {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

.recent-mistake-time-badge {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ==========================================
   SPACED REPETITION SCHEDULER THEME
   ========================================== */

.revision-scheduler-card {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  font-family: inherit;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.revision-scheduler-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.rev-card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.rev-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rev-title {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rev-stage {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}

.rev-badge {
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dynamic State Colors */
.rev-new {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.rev-waiting {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.rev-due {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: schedulerPulseGlow 2s infinite alternate;
}

.rev-history-text {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
}

@keyframes schedulerPulseGlow {
  from {
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.2);
  }

  to {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  }
}

/* Badge locked state for gamification */
.badge-lg.locked {
  opacity: 0.4;
  filter: grayscale(100%);
}

.badge-lg:hover .badge-tooltip,
.badge-lg:focus .badge-tooltip {
  opacity: 1;
}

/* ===== MEMORY GAME ===== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.memory-card {
  height: 80px;
  perspective: 1000px;
  cursor: pointer;
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-back {
  background: rgba(34, 197, 94, 0.3);
  border-color: #22c55e;
}

.memory-card-front,
.memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
  border: 2px solid var(--glass-border);
}

.memory-card-front {
  background: var(--primary);
  color: var(--dark-bg);
  font-size: 1.5rem;
}

.memory-card-back {
  background: var(--dark-card);
  color: var(--text-primary);
  transform: rotateY(180deg);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* ===== CODE COMPLETION GAME ===== */
.code-snippet {
  background: var(--dark-bg);
  border-radius: 12px;
  padding: 1.5rem;
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
  border-left: 4px solid var(--accent);
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
}

.code-blank {
  background: var(--primary);
  color: var(--dark-bg);
  padding: 0.2rem 0.8rem;
  border-radius: 6px;
  font-weight: 700;
  display: inline-block;
}

.code-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== GAME LEVEL INFO ===== */
.game-level-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  padding: 0.8rem;
  background: var(--dark-card);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.game-level-info span {
  font-weight: 600;
}

/* ===== LEVEL SELECTION ===== */
.level-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.level-selection-card {
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.level-selection-card.unlocked:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.level-selection-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

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

.level-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.level-card-topic {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.level-card-xp {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.level-card-status {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.level-card-status.unlocked-status {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.level-card-status.locked-status {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.level-card-status.current-status {
  background: rgba(108, 99, 255, 0.3);
  color: var(--primary);
}

.game-question-area {
  margin-bottom: 1.5rem;
}

.code-game-area {
  margin-bottom: 1.5rem;
}
/* ===== IMPROVED GAMIFICATION ===== */
.xp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.xp-next-level {
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.level-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 1rem;
}

.xp-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

.xp-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.xp-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

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

.badges-earned-count {
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.badge-lg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  background: var(--dark-card);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: auto;
  height: auto;
}

.badge-lg:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}

.badge-lg.earned {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.badge-lg.locked {
  opacity: 0.4;
  filter: grayscale(100%);
  cursor: not-allowed;
}

.badge-icon {
  font-size: 2rem;
}

.badge-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.badge-criteria {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Streak Card */
.streak-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.streak-display {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1rem 0;
}

.streak-number {
  font-size: 4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.streak-label {
  font-size: 1rem;
  color: var(--text-secondary);
}

.streak-week {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.streak-day {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  gap: 0.2rem;
}

.streak-day.active {
  background: rgba(245, 158, 11, 0.3);
  border: 1px solid #f59e0b;
  color: #f59e0b;
}

.streak-day.inactive {
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.streak-best {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.streak-best span {
  color: #f59e0b;
  font-weight: 700;
}

/* Activity Card */
.activity-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.activity-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  background: var(--dark-card);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.activity-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.activity-xp {
  font-size: 0.85rem;
  color: #22c55e;
  font-weight: 600;
}

.activity-empty {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* ── Base: editor-header (language select + action buttons) ── */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.problem-details {
  flex-shrink: 0;
}

/* ── Tablet: 768px and below ── */
@media (max-width: 768px) {
  /* Full-screen modal on mobile */
  .quiz-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }

  /* Tighter header padding */
  .quiz-modal-header {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  /* Smaller problem title */
  .quiz-modal-header h3 {
    font-size: 1.1rem;
    margin: 0.25rem 0 0 0;
    width: 100%;
  }

  /* Smaller badges */
  .quiz-topic-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  .quiz-difficulty {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
  }

  /* Body takes remaining viewport */
  .quiz-modal-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Stack panels vertically; editor on TOP, problem description scrolls below */
  .quiz-layout {
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Editor panel: fixed height so code area is usable */
  .quiz-editor-panel {
    order: -1;
    flex: none;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Code editor container fills available height */
  .code-editor-container {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
  }

  /* Code editor itself: fixed comfortable height on mobile */
  .code-editor {
    height: 220px !important;
    min-height: 180px;
    max-height: 280px;
  }

  /* Editor header — row layout, compact */
  .editor-header {
    flex-wrap: nowrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .language-select {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    flex-shrink: 0;
  }

  /* Action buttons */
  .editor-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
  }

  .editor-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* Shortcuts bar */
  .editor-shortcuts {
    padding: 0.4rem 0.75rem;
    gap: 0.75rem;
    font-size: 0.72rem;
    flex-wrap: wrap;
  }

  .editor-shortcuts kbd {
    font-size: 0.68rem;
    padding: 0.15rem 0.35rem;
  }

  .editor-tabs {
    padding: 0 0.5rem;
  }

  .editor-tab {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }

  .output-panel {
    flex-shrink: 0;
  }

  .output-header {
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
  }

  .output-content {
    max-height: 120px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  .quiz-problem-panel .test-cases-container,
  .test-cases-container {
    padding: 0.75rem;
    margin-top: 0.75rem;
  }

  .test-case {
    padding: 0.6rem;
    font-size: 0.82rem;
    margin-bottom: 0.4rem;
  }

  .quiz-problem-panel {
    flex: none;
    padding: 1.25rem 1rem;
    border-right: none;
    border-top: 2px solid var(--glass-border);
    max-height: none;
    overflow-y: visible;
  }

  .problem-description h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .problem-description p {
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 1rem;
  }

  .problem-examples {
    padding: 0.75rem;
    font-size: 0.85rem;
  }

  .problem-examples h5 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .quiz-modal-footer {
    flex-shrink: 0;
  }

  .quiz-actions {
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
  }

  .quiz-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    justify-content: center;
    white-space: nowrap;
  }
}

/* ── Small phones: 480px and below ── */
@media (max-width: 480px) {
  .quiz-modal-header {
    padding: 0.6rem 0.75rem;
  }

  .quiz-modal-header h3 {
    font-size: 0.95rem;
  }

  .quiz-topic-badge,
  .quiz-difficulty {
    font-size: 0.68rem;
    padding: 0.2rem 0.5rem;
  }

  .editor-btn span,
  .editor-btn .btn-text {
    display: none;
  }

  .editor-btn {
    padding: 0.4rem 0.55rem;
  }

  .shortcut-label {
    display: none;
  }

  .editor-shortcuts {
    font-size: 0.68rem;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
  }

  .code-editor {
    height: 190px !important;
    min-height: 160px;
  }

  .output-content {
    max-height: 100px;
    font-size: 0.75rem;
  }

  .quiz-problem-panel {
    padding: 1rem 0.75rem;
  }

  .quiz-actions {
    padding: 0.4rem 0.6rem;
    gap: 0.3rem;
    flex-wrap: wrap;
  }

  .quiz-actions .btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-close,
  .quiz-modal-close {
    font-size: 1.8rem;
    padding: 0.25rem 0.5rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Landscape phones: short viewport ── */
@media (max-height: 600px) and (max-width: 900px) {
  .quiz-modal-content {
    max-height: 100dvh;
    height: 100dvh;
  }

  .quiz-modal-header {
    padding: 0.5rem 1rem;
  }

  .quiz-modal-header h3 {
    display: none;
  }

  .code-editor {
    height: 160px !important;
    min-height: 140px;
  }

  .output-content {
    max-height: 80px;
  }

  .quiz-problem-panel {
    padding: 0.75rem 1rem;
  }

  .quiz-actions {
    padding: 0.35rem 0.75rem;
  }
}

/* ── Upstream: Account, Pagination, Auth, Password Modal, Report Issue ── */
.account-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
}

.btn-danger:hover {
  opacity: 0.9;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding: 1rem 0;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--ui-border);
  border-radius: 0.75rem;
  background: var(--ui-surface);
  color: var(--ui-heading);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(110, 231, 216, 0.08);
  border-color: rgba(110, 231, 216, 0.3);
  transform: translateY(-1px);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--ui-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .pagination-controls {
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .pagination-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
}

html.auth-unverified #dashboard,
html.auth-unverified #gamification,
html.auth-unverified [data-auth-required],
html.auth-loading #dashboard,
html.auth-loading #gamification,
html.auth-loading [data-auth-required],
html.auth-loading .auth-nav-item {
  display: none !important;
}

html.auth-verified [data-guest-only] {
  display: none !important;
}

/* ==========================
   Change Password Modal

#changePasswordModal .modal-content {
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#changePasswordModal .modal-header {
  padding: 1.5rem 2rem;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#changePasswordModal .modal-header h3 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  padding-right: 40px;
}

#changePasswordModal .modal-body {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

#changePasswordModal .profile-edit-form {
  gap: 1.2rem;
}

.password-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.password-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.password-input-wrapper {
  position: relative;
}

.password-input-wrapper input {
  width: 100%;
  padding: 0.9rem 3rem 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.password-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.12);
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
}

.password-toggle:hover {
  color: var(--accent);
}

.password-strength {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 12px 0;
}

.strength-bar {
  height: 100%;
  width: 0%;
  background: #ef4444;
  border-radius: inherit;
  transition: width 0.3s ease;
}

.strength-bar[data-score="1"] {
  width: 20%;
  background: #ef4444;
}

.strength-bar[data-score="2"] {
  width: 40%;
  background: #f97316;
}

.strength-bar[data-score="3"] {
  width: 60%;
  background: #eab308;
}

.strength-bar[data-score="4"] {
  width: 80%;
  background: #22c55e;
}

.strength-bar[data-score="5"] {
  width: 100%;
  background: #16a34a;
}

.strength-text {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.password-rules {
  margin-top: 0.5rem;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.password-rules li {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.password-rules li.valid {
  color: #22c55e;
}

.password-rules li.valid::before {
  content: "✓ ";
}

.field-error {
  color: #ef4444;
  font-size: 0.8rem;
  min-height: 18px;
}

.password-message {
  display: none;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.password-message.success {
  display: block;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.password-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

#changePasswordModal .modal-footer {
  flex-shrink: 0;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  gap: 1rem;
}

#savePasswordBtn {
  min-width: 170px;
}

#cancelPasswordChange {
  min-width: 120px;
}

#changePasswordClose {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

#changePasswordModal .modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: bold;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#changePasswordModal .modal-close:hover,
#changePasswordClose:hover {
  background: rgba(139, 92, 246, 0.3);
  transform: rotate(90deg);
}

@media (max-width: 768px) {
  #changePasswordModal .modal-content {
    max-width: 95%;
  }

  #changePasswordModal .modal-footer {
    flex-direction: column;
  }

  #changePasswordModal .modal-footer .btn {
    width: 100%;
  }
}

.auth-password-field {
  position: relative;
  width: 100%;
}

.auth-password-field input {
  width: 100%;
  padding-right: 2.75rem;
  box-sizing: border-box;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--text-secondary, #888);
}

.auth-password-toggle i {
  line-height: 1;
}

.auth-password-toggle:hover {
  color: var(--primary, #7c3aed);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid var(--primary, #7c3aed);
  outline-offset: 2px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  color: #888;
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .auth-divider::before,
[data-theme="light"] .auth-divider::after {
  background: rgba(0, 0, 0, 0.1);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #6c5ce7;
}

.google-btn:focus-visible {
  outline: 2px solid #6c5ce7;
  outline-offset: 2px;
}

.google-btn[data-loading="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.google-btn-icon {
  flex-shrink: 0;
}

.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.guest-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #6c5ce7;
}

.guest-btn:focus-visible {
  outline: 2px solid #6c5ce7;
  outline-offset: 2px;
}

.guest-btn[data-loading="true"] {
  opacity: 0.7;
  pointer-events: none;
}

[data-theme="light"] .guest-btn {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.03);
  color: #1a1a2e;
}

[data-theme="light"] .guest-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: #6c5ce7;
}

[data-theme="light"] .google-btn {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.03);
  color: #1a1a2e;
}

[data-theme="light"] .google-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: #6c5ce7;
}

[data-theme="light"] .auth-divider {
  color: #666;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

img.lazy-image,
.lazy-bg {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

img.lazy-loaded,
.lazy-bg.lazy-loaded {
  opacity: 1;
}

img {
  content-visibility: auto;
}

/* =========================================
   Report an Issue Component
   ========================================= */
.report-issue-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-family: var(--font-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(138, 43, 226, 0.4);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
}

.report-issue-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px rgba(138, 43, 226, 0.6);
  background: var(--primary-hover);
}

.report-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 10, 14, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.report-modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.report-modal-overlay.hidden .report-modal {
  transform: translateY(20px) scale(0.95);
}

.report-modal {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(0) scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
}

.report-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-color);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--text-color);
}

.report-modal-body {
  padding: 24px;
}

.report-context-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.report-context-info span {
  color: var(--text-color);
}

.report-modal-body .form-group {
  margin-bottom: 16px;
}

.report-modal-body label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-color);
}

.report-modal-body select,
.report-modal-body textarea {
  width: 100%;
  background: rgba(10, 10, 14, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.report-modal-body select:focus,
.report-modal-body textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.report-modal-body .form-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .report-issue-btn {
    bottom: 15px;
    left: 15px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* ===== LIGHT MODE - ABOUT US CONTENT FIX ===== */
html.light-mode .about-stat,
html.light-mode .about-card,
html.light-mode .goal-card,
html.light-mode .tech-card,
html.light-mode .team-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

html.light-mode .about-stat h3,
html.light-mode .goal-card h3,
html.light-mode .tech-card h3,
html.light-mode .team-card h3 {
  color: #7c3aed;
}

html.light-mode .about-stat p,
html.light-mode .about-card p,
html.light-mode .goal-card p,
html.light-mode .tech-card p,
html.light-mode .team-card p {
  color: #2d3748;
}

html.light-mode .goal-card i,
html.light-mode .tech-card i,
html.light-mode .team-card i {
  color: #7c3aed;
}

/* ===== LIGHT MODE - SECTION BACKGROUND FIX ===== */
html.light-mode .section,
html.light-mode .hero {
  background: #f8fafc;
}

html.light-mode .section-subtitle {
  color: #4a5568;
}

/* ===== LIGHT MODE - SOCIAL LINKS FIX ===== */
html.light-mode .social-links a {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1a202c;
}

html.light-mode .social-links a:hover {
  background: #7c3aed;
  color: #ffffff;
}

/* ===== LIGHT MODE - REPORT ISSUE BUTTON FIX ===== */
html.light-mode .report-issue-btn {
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

html.light-mode .report-issue-btn:hover {
  background: #6d28d9;
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.6);
}

/* Code Languages Badges */
.code-block {
  position: relative;
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1e1e2e;
}

.code-block pre {
  padding: 1rem;
  margin: 0;
  overflow-x: auto;
  color: #e4e4e4;
}

.language-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  padding: 2px 12px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #333;
  color: #fff;
}

.language-badge.javascript {
  background: #f7df1e;
  color: #000;
}

.language-badge.python {
  background: #3776ab;
  color: #fff;
}

.language-badge.java {
  background: #007396;
  color: #fff;
}

.language-badge.cpp {
  background: #00599c;
  color: #fff;
}

.language-badge.html {
  background: #e34f26;
  color: #fff;
}

.language-badge.css {
  background: #264de4;
  color: #fff;
}

.language-badge.sql {
  background: #4479a1;
  color: #fff;
}

.language-badge.php {
  background: #777bb4;
  color: #fff;
}

.language-badge.ruby {
  background: #cc342d;
  color: #fff;
}

.language-badge.go {
  background: #00add8;
  color: #000;
}

.language-badge.rust {
  background: #dea584;
  color: #000;
}

.language-badge.swift {
  background: #fa7343;
  color: #fff;
}

.language-badge.kotlin {
  background: #7f52ff;
  color: #fff;
}

.language-badge.kotlin {
  background: #7f52ff;
  color: #fff;
}

.language-badge.kotlin {
  background: #7f52ff;
  color: #fff;
}

.language-badge.kotlin {
  background: #7f52ff;
  color: #fff;
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  overflow-x: auto;
  white-space: nowrap;
}

.breadcrumbs .breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumbs .breadcrumb-link:hover {
  color: var(--text-primary);
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.breadcrumbs .breadcrumb-separator {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin: 0 0.2rem;
}

.breadcrumbs .breadcrumb-active {
  color: var(--primary-color);
  font-weight: 600;
}

/* ========================================================= */
/* Global Error Boundary and Toast Notification Styles       */
/* ========================================================= */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--dark-card, #252550);
  border-left: 4px solid var(--primary, #7c3aed);
  color: var(--text-primary, #ffffff);
  box-shadow: var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, 0.37));
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    opacity 0.3s ease;
  min-width: 250px;
  max-width: 400px;
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-color: #22c55e;
}

.toast-success .toast-icon {
  color: #22c55e;
}

.toast-error {
  border-color: #ef4444;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning {
  border-color: #f59e0b;
}

.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info {
  border-color: #3b82f6;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-message {
  flex-grow: 1;
  font-size: 0.95rem;
  font-family: var(--font-primary, "Poppins", sans-serif);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-secondary, #a1a1aa);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text-primary, #ffffff);
}

/* Error Boundary Fallback Overlay */
.error-boundary-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.error-boundary-modal {
  max-width: 500px;
  width: 100%;
  text-align: center;
  padding: 40px;
  background: var(--dark-surface, #1a1a3e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: #fff;
}

.error-boundary-modal .error-icon {
  font-size: 4rem;
  color: #ef4444;
  margin-bottom: 20px;
}

.error-boundary-modal h2 {
  font-family: "Orbitron", sans-serif;
  margin-bottom: 15px;
  font-size: 1.8rem;
}

.error-boundary-modal p {
  color: var(--text-secondary, #a1a1aa);
  margin-bottom: 25px;
}

.error-details-toggle {
  cursor: pointer;
  color: var(--primary-light, #a78bfa);
  font-size: 0.9rem;
  margin-bottom: 15px;
  user-select: none;
}

.error-details {
  display: none;
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #ffb3b3;
  overflow-x: auto;
  max-height: 200px;
  margin-bottom: 25px;
}

.error-details.show {
  display: block;
}

.error-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.localized-error-fallback {
  padding: 20px;
  border: 1px dashed #ef4444;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.05);
  display: flex;
  align-items: center;
  gap: 15px;
  color: #ef4444;
}

.localized-error-fallback .btn-link {
  background: transparent;
  border: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  font-weight: bold;
}

/* Search Highlights */
mark.search-highlight {
  background-color: #ffd700;
  color: #111;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Offline Banner */
.offline-banner {
  background-color: #f59e0b;
  color: #111827;
  text-align: center;
  padding: 10px;
  position: sticky;
  top: 0;
  z-index: 9999;
  font-weight: 500;
  transition: all 0.3s ease;
}

.offline-banner.hidden {
  display: none;
}

/* ==========================================================================
   ALGORITHM STEP DEBUGGER STYLES
   ========================================================================== */

.debugger-panel {
  margin-top: 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

.debugger-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
}

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

.debugger-header h3 {
  font-family: "Orbitron", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-counter {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.debugger-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.btn-control-mini {
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.debugger-slider-group {
  margin-bottom: 1.25rem;
}

.debugger-explanation {
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  margin-top: 1rem;
}

.debugger-explanation h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.debugger-explanation-text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.pseudo-code-container {
  margin-top: 1rem;
  background: rgba(10, 10, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  overflow-x: auto;
}

.pseudo-code-line {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  white-space: pre;
}

.pseudo-code-line.active {
  background: rgba(167, 139, 250, 0.2);
  color: #facc15;
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.5rem - 3px);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.1);
}

/* For toggle switches */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.88rem;
}

/* Quiz Tab Buttons */
.quiz-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.quiz-tab-btn:hover {
  color: var(--text-primary);
}

.quiz-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
/* ===== ACTIVITY FEED STYLES ===== */

.activity-feed-card {
    position: relative;
}

.card-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header-with-actions h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.1rem;
}

.btn-clear-activity {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-clear-activity:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.activity-feed::-webkit-scrollbar {
    width: 4px;
}

.activity-feed::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 2px;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Activity Item */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    animation: activitySlideIn 0.3s ease;
}

.activity-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

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

/* Activity Icon */
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.activity-icon.solved {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.activity-icon.quiz {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.activity-icon.badge {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.activity-icon.streak {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.activity-icon.level {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.activity-icon.xp {
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
}

.activity-icon.practice {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

/* Activity Content */
.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-content .activity-message {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    line-height: 1.4;
}

.activity-content .activity-message strong {
    color: var(--primary);
}

.activity-content .activity-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Activity Empty State */
.activity-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.activity-empty i {
    font-size: 32px;
    color: var(--border-color);
    display: block;
    margin-bottom: 12px;
}

.activity-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Activity Feed Footer */
.activity-feed-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-view-all {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.btn-view-all:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Activity Animations */
@keyframes activitySlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* New activity badge */
.activity-item.new {
    border-left: 3px solid var(--primary);
}

/* Dark Theme */
.dark .activity-item {
    background: #0f172a;
    border-color: #334155;
}

.dark .activity-item:hover {
    border-color: #7c3aed;
}

.dark .activity-empty i {
    color: #334155;
}

.dark .activity-feed-footer {
    border-color: #334155;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .activity-item {
        padding: 8px 10px;
        gap: 10px;
    }
    
    .activity-icon {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    
    .activity-content .activity-message {
        font-size: 0.85rem;
    }
    
    .activity-time {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .activity-item {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .activity-time {
        width: 100%;
        margin-left: 42px;

/* ===== PROBLEM STATS ===== */

.problem-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 16px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.problem-count-display {
  display: flex;
  align-items: center;
  gap: 6px;
}

.problem-count-display strong {
  color: var(--text-primary);
  font-size: 1.1rem;
}

.total-count-display {
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}

.empty-state i {
  font-size: 48px;
  color: #94a3b8;
  margin-bottom: 16px;
  display: block;
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.empty-state.hidden {
  display: none;
}

/* Dark Theme */
.dark .problem-count-display strong {
  color: #f1f5f9;
}

.dark .empty-state i {
  color: #475569;
}

/* Responsive */
@media (max-width: 768px) {
  .problem-stats {
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 8px;
  }

  .empty-state {
    padding: 40px 16px;
  }

  .empty-state i {
    font-size: 36px;

    /* ===== BACK TO TOP BUTTON ===== */

    .back-to-top {
      position: fixed;
      bottom: 30px;
      right: 30px;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: linear-gradient(135deg, #7c3aed, #6d28d9);
      color: white;
      border: none;
      cursor: pointer;
      opacity: 0;
      visibility: hidden;
      transform: scale(0.8);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
      z-index: 999;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      touch-action: manipulation;
    }

    .back-to-top.visible {
      opacity: 1;
      visibility: visible;
      transform: scale(1);
    }

    .back-to-top:hover {
      transform: translateY(-4px) scale(1.05);
      box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
    }

    .back-to-top:active {
      transform: scale(0.95);
    }

    .back-to-top:focus-visible {
      outline: 2px solid #7c3aed;
      outline-offset: 2px;
    }

    /* Back to top with progress ring */
    .back-to-top .progress-ring {
      position: absolute;
      top: -2px;
      left: -2px;
      width: calc(100% + 4px);
      height: calc(100% + 4px);
      border-radius: 50%;
    }

    .back-to-top .progress-ring circle {
      fill: none;
      stroke: rgba(255, 255, 255, 0.3);
      stroke-width: 2;
      stroke-linecap: round;
      transition: stroke-dashoffset 0.3s ease;
    }

    .back-to-top .progress-ring .progress-ring-fill {
      stroke: rgba(255, 255, 255, 0.6);
    }

    .back-to-top i {
      position: relative;
      z-index: 1;
      transition: transform 0.3s ease;
    }

    .back-to-top:hover i {
      transform: translateY(-2px);
    }

    /* Dark Theme */
    .dark .back-to-top {
      box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    }

    .dark .back-to-top:hover {
      box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
    }

    /* Mobile Responsive */
    @media (max-width: 768px) {
      .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 18px;
      }
    }

    @media (max-width: 480px) {
      .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 16px;
        box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
      }
    }

    /* Reduced Motion */
    @media (prefers-reduced-motion: reduce) {
      .back-to-top {
        transition: none;
      }

      .back-to-top.visible {
        transition: none;
      }

      .back-to-top:hover {
        transform: none;
      }
    }

    /* Tooltip on hover */
    .back-to-top::after {
      content: "Back to Top";
      position: absolute;
      right: calc(100% + 12px);
      top: 50%;
      transform: translateY(-50%);
      background: var(--bg-secondary);
      color: var(--text-primary);
      padding: 4px 12px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      border: 1px solid var(--border-color);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .back-to-top:hover::after,
    .back-to-top:focus-visible::after {
      opacity: 1;
      visibility: visible;
    }

    /* Dark theme tooltip */
    .dark .back-to-top::after {
      background: #1e293b;
      border-color: #334155;
      color: #f1f5f9;
    }

    /* Mobile - hide tooltip on touch devices */
    @media (hover: none) {
      .back-to-top::after {
        display: none;
      }
    }
  }
}

/* ===== QUIZ TIMER STYLES ===== */

.quiz-timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.quiz-timer-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-timer-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.quiz-timer-label i {
  margin-right: 6px;
  color: var(--primary);
}

.quiz-timer-display {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 4px 16px;
  border-radius: 8px;
  background: var(--bg-primary);
  min-width: 80px;
  text-align: center;
  transition: all 0.3s ease;
  font-variant-numeric: tabular-nums;
}

/* Timer States */
.quiz-timer-display.time-warning {
  color: #eab308;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.quiz-timer-display.time-critical {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: timerPulse 0.5s ease-in-out infinite;
}

.quiz-timer-display.times-up {
  color: #ef4444;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  animation: timerPulse 0.5s ease-in-out 3;
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
}

/* ===== MOBILE RESPONSIVE - FIX FOR ISSUE #1383 ===== */

/* Tablets and smaller */
@media (max-width: 768px) {
  .quiz-timer-container {
    padding: 10px 16px;
    gap: 10px;
  }

  .quiz-timer-label {
    font-size: 0.85rem;
  }

  .quiz-timer-display {
    font-size: 1.1rem;
    padding: 4px 14px;
    min-width: 70px;
  }
}

/* Mobile phones - MAIN FIX */
@media (max-width: 480px) {
  .quiz-timer-container {
    padding: 12px 14px;
    gap: 8px;
    border-radius: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .quiz-timer-wrapper {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .quiz-timer-label {
    font-size: 0.8rem;
    font-weight: 500;
  }

  .quiz-timer-label i {
    font-size: 0.9rem;
  }

  /* LARGER TIMER TEXT ON MOBILE - Main fix */
  .quiz-timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    color: #ffffff;
    min-width: 80px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
  }

  /* High contrast with colored borders */
  .quiz-timer-display.time-warning {
    color: #facc15;
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(250, 204, 21, 0.5);
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
  }

  .quiz-timer-display.time-critical {
    color: #f87171;
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(239, 68, 68, 0.6);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    animation: timerPulseMobile 0.5s ease-in-out infinite;
  }

  .quiz-timer-display.times-up {
    color: #ff6b6b;
    background: rgba(0, 0, 0, 0.85);
    border-color: #ef4444;
    text-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
    animation: timerPulseMobile 0.5s ease-in-out 3;
  }

  @keyframes timerPulseMobile {
    0%,
    100% {
      transform: scale(1);
      opacity: 1;
    }
    50% {
      transform: scale(1.08);
      opacity: 0.8;
      box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
    }
  }
}

/* Small phones (iPhone SE, etc.) */
@media (max-width: 380px) {
  .quiz-timer-display {
    font-size: 1.3rem;
    padding: 6px 12px;
    min-width: 70px;
  }

  .quiz-timer-container {
    padding: 10px 12px;
  }

  .quiz-timer-label {
    font-size: 0.7rem;
  }
}

/* Dark Theme */
.dark .quiz-timer-container {
  background: #1e293b;
  border-color: #334155;
}

.dark .quiz-timer-display {
  background: #0f172a;
  color: #f1f5f9;
}

.dark .quiz-timer-display.time-warning {
  background: rgba(0, 0, 0, 0.8);
  color: #facc15;
  border-color: rgba(234, 179, 8, 0.4);
}

.dark .quiz-timer-display.time-critical {
  background: rgba(0, 0, 0, 0.85);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
}

.dark .quiz-timer-display.times-up {
  background: rgba(0, 0, 0, 0.9);
  color: #ff6b6b;
  border-color: #ef4444;
}

/* Light Theme - Ensure contrast */
.light-mode .quiz-timer-display {
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  border-color: rgba(0, 0, 0, 0.1);
}

.light-mode .quiz-timer-display.time-warning {
  background: rgba(255, 255, 255, 0.95);
  color: #ca8a04;
  border-color: rgba(234, 179, 8, 0.4);
}

.light-mode .quiz-timer-display.time-critical {
  background: rgba(255, 255, 255, 0.95);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.5);
}

.light-mode .quiz-timer-display.times-up {
  background: rgba(255, 255, 255, 0.95);
  color: #dc2626;
  border-color: #ef4444;
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .quiz-timer-display.time-critical {
    animation: none;
  }

  .quiz-timer-display.times-up {
    animation: none;
  }

  @keyframes timerPulseMobile {
    0%,
    100% {
      transform: scale(1);
      opacity: 1;
    }
    50% {
      transform: scale(1);
      opacity: 1;
    }
  }
}

/* Print styles */
@media print {
  .quiz-timer-container {
    border: 1px solid #ccc;
    background: white;
  }

  .quiz-timer-display {
    background: #f5f5f5;
    color: #333;
  }

  /* ===== CLICKABLE TAGS ===== */

  .tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
    cursor: pointer;
    user-select: none;
    position: relative;
  }

  .tag:hover {
    /* ===== KEYBOARD SHORTCUTS ===== */

    /* Shortcuts Toggle Button */
    .shortcuts-toggle-btn {
      position: fixed;
      bottom: 30px;
      left: 30px;
      z-index: 998;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      color: var(--text-primary);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
      font-family: "Poppins", sans-serif;
    }

    .shortcuts-toggle-btn:hover {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
      transform: translateY(-2px);

      box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    }

    .tag:active {
      transform: scale(0.95);
    }

    .tag:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }

    /* Tag with click indicator */
    .tag::after {
      content: " 🔍";
      opacity: 0;
      transition: opacity 0.2s ease;
      font-size: 0.6rem;
    }

    .tag:hover::after {
      opacity: 1;
    }

    /* Tag variants */
    .tag.easy {
      background: rgba(34, 197, 94, 0.1);
      color: #22c55e;
      border-color: rgba(34, 197, 94, 0.2);
    }

    .tag.easy:hover {
      background: #22c55e;
      color: white;
      border-color: #22c55e;
      box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    }

    .tag.medium {
      background: rgba(234, 179, 8, 0.1);
      color: #eab308;
      border-color: rgba(234, 179, 8, 0.2);
    }

    .tag.medium:hover {
      background: #eab308;
      color: white;
      border-color: #eab308;
      box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
    }

    .tag.hard {
      background: rgba(239, 68, 68, 0.1);
      color: #ef4444;
      border-color: rgba(239, 68, 68, 0.2);
    }

    .tag.hard:hover {
      background: #ef4444;
      color: white;
      border-color: #ef4444;
      box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }

    /* Dark Theme */
    .dark .tag {
      background: #1e293b;
      border-color: #334155;
      color: #94a3b8;
    }

    .dark .tag:hover {
      background: #7c3aed;
      color: white;
      border-color: #7c3aed;
    }

    .dark .tag.easy {
      background: rgba(34, 197, 94, 0.15);
      color: #4ade80;
      border-color: rgba(34, 197, 94, 0.2);
    }

    .dark .tag.easy:hover {
      background: #22c55e;
      color: white;
      border-color: #22c55e;
    }

    .dark .tag.medium {
      background: rgba(234, 179, 8, 0.15);
      color: #facc15;
      border-color: rgba(234, 179, 8, 0.2);
    }

    .dark .tag.medium:hover {
      background: #eab308;
      color: white;
      border-color: #eab308;
    }

    .dark .tag.hard {
      background: rgba(239, 68, 68, 0.15);
      color: #f87171;
      border-color: rgba(239, 68, 68, 0.2);
    }

    .dark .tag.hard:hover {
      background: #ef4444;
      color: white;
      border-color: #ef4444;
    }

    /* Tag tooltip */
    .tag .tag-tooltip {
      position: absolute;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%);
      background: var(--bg-secondary);
      color: var(--text-primary);
      padding: 4px 10px;
      border-radius: 4px;
      font-size: 0.65rem;
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      border: 1px solid var(--border-color);
      pointer-events: none;
    }

    .tag:hover .tag-tooltip {
      opacity: 1;
      visibility: visible;
    }

    /* Mobile - larger touch target */
    @media (max-width: 768px) {
      .tag {
        padding: 6px 14px;
        font-size: 0.8rem;
        min-height: 32px;
      }

      .tag::after {
        content: "";
      }
    }

    /* Reduced motion */
    @media (prefers-reduced-motion: reduce) {
      .tag {
        transition: none;
      }

      .tag:hover {
        transform: none;
      }

      .tag:active {
        transform: none;
      }
      box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
    }

    .shortcuts-toggle-btn i {
      font-size: 1rem;
    }

    .shortcuts-toggle-btn .shortcut-hint {
      font-size: 0.7rem;
      opacity: 0.6;
      font-weight: 400;
    }

    /* Shortcuts Modal */
    .shortcuts-modal .modal-content {
      max-width: 700px;
      max-height: calc(100vh - 120px);
      overflow-y: auto;
      margin-top: 70px;
    }

    .shortcuts-modal-content {
      padding: 0 !important;
    }

    .shortcuts-modal .modal-header {
      padding: 20px 24px 16px;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .shortcuts-modal .modal-header h3 {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .shortcuts-modal .modal-header h3 i {
      color: var(--primary);
    }

    .shortcuts-modal .modal-body {
      padding: 20px 24px 16px;
    }

    .shortcuts-intro {
      color: var(--text-secondary);
      font-size: 0.95rem;
      margin-bottom: 20px;
    }

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

    .shortcuts-section {
      background: var(--bg-primary);
      border-radius: 12px;
      padding: 16px;
      border: 1px solid var(--border-color);
    }

    .shortcuts-section h4 {
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text-primary);
      margin: 0 0 12px 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .shortcuts-section h4 i {
      color: var(--primary);
    }

    .shortcuts-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
    }

    .shortcuts-table tr {
      border-bottom: 1px solid var(--border-color);
    }

    .shortcuts-table tr:last-child {
      border-bottom: none;
    }

    .shortcuts-table td {
      padding: 6px 0;
      color: var(--text-secondary);
    }

    .shortcuts-table td:first-child {
      color: var(--text-primary);
      font-weight: 500;
      min-width: 120px;
    }

    .shortcuts-table kbd {
      display: inline-block;
      padding: 2px 8px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 4px;
      font-size: 0.75rem;
      font-weight: 600;
      font-family: "Fira Code", monospace;
      color: var(--text-primary);
    }

    .shortcuts-footer {
      margin-top: 20px;
      padding-top: 16px;
      border-top: 1px solid var(--border-color);
      text-align: center;
    }

    .shortcuts-tip {
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    .shortcuts-tip i {
      color: #fbbf24;
      margin-right: 6px;
    }

    .shortcuts-tip kbd {
      display: inline-block;
      padding: 1px 6px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 3px;
      font-size: 0.7rem;
      font-family: "Fira Code", monospace;
      font-weight: 600;
    }

    .shortcuts-modal .modal-footer {
      padding: 12px 24px 20px;
      border-top: 1px solid var(--border-color);
      display: flex;
      justify-content: flex-end;
    }

    .shortcuts-modal .modal-footer kbd {
      display: inline-block;
      padding: 1px 6px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 3px;
      font-size: 0.7rem;
      font-family: "Fira Code", monospace;
      font-weight: 600;
    }

    /* Dark Theme */
    .dark .shortcuts-toggle-btn {
      background: #1e293b;
      border-color: #334155;
      color: #f1f5f9;
    }

    .dark .shortcuts-toggle-btn:hover {
      background: #7c3aed;
      border-color: #7c3aed;
    }

    .dark .shortcuts-section {
      background: #0f172a;
      border-color: #334155;
    }

    .dark .shortcuts-table tr {
      border-color: #334155;
    }

    .dark .shortcuts-table kbd {
      background: #1e293b;
      border-color: #334155;
      color: #f1f5f9;
    }

    /* Mobile Responsive */
    @media (max-width: 768px) {
      .shortcuts-toggle-btn {
        bottom: 20px;
        left: 20px;
        padding: 8px 14px;
        font-size: 0.8rem;
        border-radius: 10px;
      }

      .shortcuts-toggle-btn span:not(.shortcut-hint) {
        display: none;
      }

      .shortcuts-toggle-btn .shortcut-hint {
        font-size: 0.9rem;
        opacity: 1;
      }

      .shortcuts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
      }

      .shortcuts-modal .modal-content {
        max-width: 95%;
        margin: 20px;
      }

      .shortcuts-table td {
        font-size: 0.8rem;
        padding: 4px 0;
      }

      .shortcuts-table td:first-child {
        min-width: 80px;
      }
    }

    @media (max-width: 480px) {
      .shortcuts-toggle-btn {
        bottom: 16px;
        left: 16px;
        padding: 6px 12px;
        font-size: 0.75rem;
        border-radius: 8px;
      }

      .shortcuts-modal .modal-content {
        max-width: 98%;
        margin: 10px;
      }

      .shortcuts-modal .modal-header {
        padding: 14px 16px 12px;
      }

      .shortcuts-modal .modal-body {
        padding: 14px 16px 12px;
      }

      .shortcuts-section {
        padding: 12px;
      }

      .shortcuts-table td {
        font-size: 0.75rem;
        padding: 3px 0;
      }

      .shortcuts-table td:first-child {
        min-width: 60px;
      }

      .shortcuts-table kbd {
        font-size: 0.65rem;
        padding: 1px 5px;
      }
    }

    /* Reduced Motion */
    @media (prefers-reduced-motion: reduce) {
      .shortcuts-toggle-btn {
        transition: none;
      }

      .shortcuts-toggle-btn:hover {
        transform: none;
      }
    }

    /* Dark theme modal overrides */
    .dark .shortcuts-modal .modal-content {
      background: #1e293b;
    }

    .dark .shortcuts-modal .modal-header {
      border-color: #334155;
    }

    .dark .shortcuts-modal .modal-footer {
      border-color: #334155;
    }

    /* Mobile - hide tooltip on touch devices */
    @media (hover: none) {
      .back-to-top::after {
        display: none;
      }
    }
    .dark .shortcuts-tip kbd {
      background: #0f172a;
      border-color: #334155;
      color: #f1f5f9;
    }
    /* Modal Open State */
    body.modal-open {
      overflow: hidden;
    }
  }
}

.contributors-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 24px;
  padding: 16px 20px;
  background: #1f2937;
  border-radius: 12px;
  align-items: center;
  justify-content: space-between;
}

.light-mode .contributors-controls {
  background: #f3f4f6;
}

.search-section {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 250px;
}

.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid #374151;
  border-radius: 8px;
  font-size: 14px;
  background: #111827;
  color: #f3f4f6;
  transition: border-color 0.3s;
}

.light-mode .search-input {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.search-input:focus {
  border-color: #667eea;
  outline: none;
}

.clear-btn {
  padding: 10px 18px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: #dc2626;
}

.filter-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-section label {
  color: #9ca3af;
  font-size: 14px;
}

.light-mode .filter-section label {
  color: #6b7280;
}

.filter-select {
  padding: 10px 16px;
  border: 2px solid #374151;
  border-radius: 8px;
  font-size: 14px;
  background: #111827;
  color: #f3f4f6;
  cursor: pointer;
}

.light-mode .filter-select {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.filter-select:focus {
  border-color: #667eea;
  outline: none;
}

.contributor-card.hidden {
  display: none;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-size: 16px;
  grid-column: 1 / -1;
}
