/* ===== 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);

  /* ===== VISUALIZER PANEL THEME ===== */
  --panel-bg: #1e293b;
  --panel-border: #334155;
  --panel-bg-dark: #0f172a;
  --panel-text: #cbd5e1;
  --panel-text-muted: #64748b;
  --panel-card-bg: #0b1121;
}

/* ===== 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;
}

/* ===== PAGE FADE-IN (Smooth Page Transitions) =====
   Subtle, brief opacity fade-in on every page load for a polished
   navigation feel.

   Why pure CSS (@keyframes) and not a JS-triggered transition:
   - It runs automatically on page load, so there is zero JavaScript
     involved and no way for it to delay or block page interactivity.
   - There is no initial `opacity: 0` default that could leave the page
     invisible if a script fails.

   Why <main> instead of <body>/<html>:
   - An element with opacity < 1 establishes a containing block for its
     position:fixed descendants. Animating <body> would therefore make
     the fixed navbar, scroll-to-top button, and modals jump during the
     fade. <main> is the content wrapper on essentially every page and
     contains no fixed-position chrome, so it is safe to animate.

   Accessibility:
   - Gated behind `prefers-reduced-motion: no-preference`, so users who
     opt out of motion see the page instantly, with no animation at all.
   - Pages without a <main> element (e.g. 404/offline fallbacks) simply
     get no fade — a graceful degradation, never a hidden page. */
@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  main {
    /* `backwards` applies the opacity:0 from-frame during the pre-start
       period too, so there is never a flash of fully-visible content. */
    animation: pageFadeIn 0.4s ease-out backwards;
  }
}

/* ===== 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;
}

/* ===== BIG BOX (general card hover effect, used across app) ===== */
.big-box {
  transition: transform 0.3s ease-in-out;
}

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

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

/* ===== LOADING TEXT (used by quiz editor modal and other loaders) ===== */
.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-text {
    animation: none;
  }
}

/* ===== BOOKMARK COLLECTIONS ===== */
.bookmark-collection-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  backdrop-filter: blur(10px);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.bookmark-collection-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
}

.bookmark-collection-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.bookmark-collection-icon {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.bookmark-collection-actions button {
  background: transparent;
  border: 0;
  color: var(--text-primary);
  cursor: pointer;
  margin-left: 0.25rem;
}

.bookmark-collection-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.bookmark-collection-picker {
  margin-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 0.75rem;
}

.bookmark-collection-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.6rem;
}

.bookmark-collection-choice-item {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.bookmark-add-collection-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  background: var(--gradient-3);
  color: white;
  cursor: pointer;
}

/* ===== FOOTER VISIBILITY — hide floating UI when footer is in view ===== */
body[data-footer-visible] #shortcutsToggle,
body[data-footer-visible] #pwa-storage-usage {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

#shortcutsToggle,
#pwa-storage-usage {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* ===== SCROLL TO TOP ===== */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.25s ease,
    color 0.25s ease,
    background 0.25s ease;
  z-index: 1000;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.scroll-top-btn:active {
  transform: scale(0.92);
  transition-duration: 0.12s;
}

/* Did You Know? Facts Section */
.facts-card {
  max-width: 1200px;
  margin: 1.5rem auto;
  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;
}

.facts-card:hover {
  transform: translateY(-4px);
}

.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, #c4b5fd, #a78bfa);
  color: #1a202c;
  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(167, 139, 250, 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;
  transition: opacity 0.3s ease;
}

.facts-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--glass-border);
  padding-top: 0.75rem;
}

.facts-label {
  opacity: 0.7;
}

.facts-counter {
  background: rgba(196, 181, 253, 0.15);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.7rem;
  color: #a78bfa;
}

/* Dark Mode Support */
.dark .facts-card {
  background: var(--glass-bg);
}

.dark .facts-btn {
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: #c4b5fd;
}

.dark .facts-btn:hover {
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.2);
}

.dark .facts-counter {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

/* 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;
  }

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

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

/* ===== AUTHENTICATION ===== */
.auth-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  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-split {
  display: flex;
  width: 100%;
  height: 100vh;
}

.auth-split-left {
  flex: 0 0 calc(50% + 60px);
  max-width: calc(50% + 60px);
  width: calc(50% + 60px);
  margin-right: -60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 3.5rem 2rem 2rem;
  position: relative;
  z-index: 3;
  overflow: hidden;
  background: linear-gradient(
    100deg,
    rgba(10, 10, 26, 0.97) 0%,
    rgba(10, 10, 26, 0.9) 40%,
    rgba(18, 16, 38, 0.55) 70%,
    transparent 100%
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  isolation: isolate;
}

/* ══ DRAMATIC HOVER ANIMATION REMOVED (Replaced by DitheringShader) ══ */
.auth-split-left:hover {
  transform: scale(1.02);
  box-shadow:
    0 0 40px rgba(124, 58, 237, 0.2),
    0 0 80px rgba(124, 58, 237, 0.1);
}

/* ══ RIGHT PANEL — blends into left via gradient overlap ══ */
.auth-split-right {
  flex: 0 0 50%;
  max-width: 50%;
  width: 50%;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: #060612;
}

.auth-split-right::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(
      90deg,
      rgba(6, 6, 18, 0.85) 0%,
      rgba(6, 6, 18, 0.3) 10%,
      transparent 20%,
      transparent 80%,
      rgba(6, 6, 18, 0.25) 100%
    ),
    linear-gradient(
      0deg,
      rgba(6, 6, 18, 0.35) 0%,
      transparent 25%,
      transparent 75%,
      rgba(6, 6, 18, 0.35) 100%
    );
  z-index: 1;
  pointer-events: none;
}

.auth-split-right .auth-visual-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  background: rgba(15, 15, 25, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 10;
}

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

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

body[data-page='signup'] .auth-panel {
  max-width: 520px;
}

body[data-page='signup'] .auth-form {
  grid-template-columns: 1fr 1fr;
}

body[data-page='signup'] .auth-form .form-group:nth-child(-n + 2) {
  grid-column: span 1;
}

body[data-page='signup'] .auth-form .form-group:nth-child(n + 3),
body[data-page='signup'] .auth-form .auth-message,
body[data-page='signup'] .auth-form .auth-submit {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  body[data-page='signup'] .auth-form {
    grid-template-columns: 1fr;
  }
}

/* ===== RESPONSIVE: collapse right panel on mobile ===== */
@media (max-width: 900px) {
  .auth-split-right {
    display: none;
  }

  .auth-split-left {
    flex: 1;
    max-width: none;
    padding: 1.5rem;
  }

  .auth-split-left::after,
  .auth-split-left::before {
    display: none;
  }

  .auth-page {
    padding: 1rem;
  }

  .auth-panel {
    max-width: 420px;
  }
}

/* ===== AUTH BUTTON STYLES ===== */

.guest-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border-radius: 16px;
  background: transparent;
  border: 2px solid #c084fc;
  color: #c084fc;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.3s ease;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
}

.guest-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(192, 132, 252, 0.08);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.guest-btn:hover {
  background: rgba(192, 132, 252, 0.12);
  border-color: #c084fc;
  transform: translateY(-2px);
  box-shadow: none;
}

.guest-btn:hover::before {
  opacity: 1;
}

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

.guest-btn i {
  font-size: 1.1rem;
}

.guest-btn[data-loading='true'],
.guest-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.guest-btn .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: #c084fc;
  border-radius: 50%;
  animation: guestBtnSpin 0.6s linear infinite;
  display: inline-block;
}

@keyframes guestBtnSpin {
  to {
    transform: rotate(360deg);
  }
}

.google-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  min-height: 48px;
  margin-top: 0.75rem;
}

.google-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.google-btn-icon {
  flex-shrink: 0;
}

.google-btn[data-loading='true'],
.google-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.google-btn .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: guestBtnSpin 0.6s linear infinite;
  display: inline-block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.auth-divider span {
  white-space: nowrap;
  opacity: 0.7;
}

.auth-password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-field input {
  padding-right: 3rem !important;
}

.auth-password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  z-index: 2;
}

.auth-password-toggle:hover {
  color: var(--text-primary);
}

.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);
  font-size: 0.78rem;
}

.form-group small {
  margin-top: 0.15rem;
  opacity: 0.7;
}

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

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

.form-group label {
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(167, 139, 250, 0.8);
  transition:
    color 0.3s ease,
    text-shadow 0.3s ease;
}

.form-group:focus-within label {
  color: rgba(167, 139, 250, 1);
  text-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.form-group input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(124, 58, 237, 0.04) 100%);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
  position: relative;
}

.form-group input::placeholder {
  color: rgba(161, 161, 170, 0.4);
}

.form-group input:hover {
  border-color: rgba(124, 58, 237, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(124, 58, 237, 0.06) 100%);
}

.form-group input:focus {
  border-color: rgba(124, 58, 237, 0.6);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(124, 58, 237, 0.08) 100%);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.15),
    0 0 20px rgba(124, 58, 237, 0.1),
    inset 0 0 15px rgba(124, 58, 237, 0.03);
}

.form-group input:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.15),
    0 0 20px rgba(124, 58, 237, 0.1),
    inset 0 0 15px rgba(124, 58, 237, 0.03) !important;
}

/* Remove: border-image conflicts with border-radius, replaced by the box-shadow glow above */

button.auth-submit {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  border-radius: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #c084fc;
  color: #1e1b4b;
  border: none;
  box-shadow: none;
}

button.auth-submit:hover {
  background: #a78bfa;
  transform: translateY(-2px);
  box-shadow: none;
}

button.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: 1.25rem;
  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);
}

/* ===== AUTH GATE MODAL ===== */
#authGateModal {
  z-index: 11000;
}

.auth-gate-modal-content,
#authGateModal .auth-gate-modal-content {
  position: relative;
  max-width: 400px;
  width: 90%;
  margin: auto;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid rgba(247, 192, 201, 0.2);
  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;
}

#authGateModal .auth-gate-modal-content .modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

@keyframes authGateSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Brand icon ring */
.auth-gate-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.auth-gate-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(102, 126, 234, 0.18),
    0 0 0 16px rgba(118, 75, 162, 0.08);
  animation: authGateBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.auth-gate-infinity {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  animation: authGatePulse 2s ease-in-out 1s infinite;
}

.auth-gate-icon-ring::before,
.auth-gate-icon-ring::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
  animation: authGateSparkle 0.8s ease-out 0.3s forwards;
}

.auth-gate-icon-ring::before {
  top: -4px;
  right: -6px;
  background: #a78bfa;
}

.auth-gate-icon-ring::after {
  bottom: -4px;
  left: -6px;
  background: #f0d87a;
  animation-delay: 0.5s;
}

@keyframes authGateBounce {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
  }
  50% {
    transform: scale(1.12) rotate(3deg);
  }
  70% {
    transform: scale(0.94) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes authGateSparkle {
  0% {
    opacity: 0;
    transform: scale(0) translateY(0);
  }
  40% {
    opacity: 1;
    transform: scale(1.2) translateY(-6px);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-14px);
  }
}

@keyframes authGatePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.08);
  }
}

.auth-gate-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0d87a;
  margin-bottom: 0.3rem;
}

.auth-gate-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* Perks list */
.auth-gate-perks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
  padding: 0.6rem 0.85rem;
  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;
}

/* Perk icon badges */
.perk-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.perk-badge--progress {
  background: rgba(242, 181, 196, 0.18);
  color: #f2b5c4;
}

.perk-badge--xp {
  background: rgba(240, 216, 122, 0.18);
  color: #f0d87a;
}

.perk-badge--leaderboard {
  background: rgba(181, 211, 232, 0.18);
  color: #b5d3e8;
}

.perk-badge i {
  width: auto;
  color: inherit;
  font-size: inherit;
}

/* Action buttons */
.auth-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.auth-gate-actions__main {
  display: flex;
  gap: 0.5rem;
}

.auth-gate-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
}

.auth-gate-btn--outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
}

.auth-gate-btn--outline:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
}

.auth-gate-btn--primary {
  background: #f0d87a;
  color: #1a1a3e;
}

.auth-gate-btn--primary:hover {
  background: #e8c85a;
}

.auth-gate-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.82rem;
  padding: 0.45rem;
  flex: 0 1 auto;
}

.auth-gate-btn--ghost:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* 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 protected 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;
}

/* Login-only mode (no signup/guest options) */
.auth-gate--login-mode .auth-gate-perks,
.auth-gate--login-mode #authGateSignupBtn,
.auth-gate--login-mode #authGateGuestBtn {
  display: none;
}

.auth-gate--login-mode .auth-gate-actions__main {
  flex-direction: column;
}

/* ===== SIGN OUT CONFIRMATION MODAL ===== */
/* Follows design language of Auth Gate modal (icon ring, gold title, card styling) */

#signOutModal {
  z-index: 11000;
}

.signout-modal-content,
#signOutModal .signout-modal-content {
  position: relative;
  max-width: 400px;
  width: 90%;
  margin: auto;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid rgba(247, 192, 201, 0.2);
  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;
}

#signOutModal .signout-modal-content .modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

#signOutModal .signout-modal-content .modal-close:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15) !important;
  border-radius: 4px;
}

/* Icon ring — soft pastel peach-gold for sign-out action */
.signout-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.signout-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(253, 230, 138, 0.18),
    0 0 0 16px rgba(252, 211, 77, 0.08);
  animation: authGateBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.signout-icon-ring i {
  font-size: 1.3rem;
  color: #fff;
  line-height: 1;
}

.signout-icon-ring::before,
.signout-icon-ring::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
  animation: authGateSparkle 0.8s ease-out 0.3s forwards;
}

.signout-icon-ring::before {
  top: -4px;
  right: -6px;
  background: #a78bfa;
}

.signout-icon-ring::after {
  bottom: -4px;
  left: -6px;
  background: #f0d87a;
  animation-delay: 0.5s;
}

/* Title & subtitle */
.signout-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0d87a;
  margin-bottom: 0.3rem;
}

.signout-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* Info box — reassures user their data is safe */
.signout-info-box {
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  text-align: center;
}

.signout-info-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.signout-info-text i {
  color: #4ade80;
  margin-right: 0.3rem;
}

/* Action buttons */
.signout-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.signout-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
}

.signout-btn--cancel {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.signout-btn--cancel:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.signout-btn--danger {
  background: #fca5a5;
  color: #1e1e1e;
  border-color: #fca5a5;
}

.signout-btn--danger:hover {
  background: #f87171;
  border-color: #f87171;
}

.signout-btn--danger:disabled,
.signout-btn--danger.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.signout-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: guestBtnSpin 0.6s linear infinite;
}

/* Dismiss */
.signout-dismiss {
  margin: 0;
}

.signout-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;
}

.signout-dismiss-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .signout-actions {
    flex-direction: column;
  }
}

/* ===== DELETE ACCOUNT MODAL ===== */

#deleteAccountModal {
  z-index: 11000;
}

.delete-account-modal-content,
#deleteAccountModal .delete-account-modal-content {
  position: relative;
  max-width: 420px;
  width: 90%;
  margin: auto;
  padding: 2rem 1.5rem 1.5rem;
  background: #1e1e1e;
  border: 1px solid rgba(247, 192, 201, 0.2);
  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;
}

#deleteAccountModal .delete-account-modal-content .modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.delete-account-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.delete-account-icon-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(239, 68, 68, 0.18),
    0 0 0 16px rgba(220, 38, 38, 0.08);
  animation: authGateBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.delete-account-icon-ring i {
  font-size: 1.4rem;
  color: #fff;
  line-height: 1;
}

.delete-account-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.5rem;
}

.delete-account-message {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.delete-account-message strong {
  color: #f87171;
}

.delete-account-form {
  margin-bottom: 1.25rem;
  text-align: left;
}

.delete-account-form .password-field {
  margin-bottom: 0;
}

.delete-account-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-align: left;
}

.delete-account-form .password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.delete-account-form .password-input-wrapper input {
  width: 100%;
  padding: 0.7rem 2.8rem 0.7rem 1rem;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.delete-account-form .password-input-wrapper input:focus {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.delete-account-form .password-input-wrapper input:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15) !important;
}

.delete-account-form .password-input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.delete-account-form .password-toggle {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.delete-account-form .password-toggle:hover {
  color: var(--text-primary);
}

.delete-account-form .field-error {
  display: block;
  color: #f87171;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  min-height: 1em;
}

.delete-account-actions {
  display: flex;
  gap: 0.5rem;
}

.delete-account-btn {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
}

.delete-account-btn--cancel {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.delete-account-btn--cancel:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.delete-account-btn--danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.delete-account-btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.delete-account-btn--danger:disabled,
.delete-account-btn--danger.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== CHANGE PASSWORD MODAL ===== */

/* ── Overlay ── */
#changePasswordModal {
  z-index: 10500;
}

/* ── Content card ── */
#changePasswordModal .cpw-modal-content {
  position: relative;
  max-width: 380px;
  width: 90%;
  margin: auto;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid rgba(247, 192, 201, 0.18);
  border-radius: 24px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: cpwSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

.cpw-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  line-height: 1;
  z-index: 2;
}

.cpw-modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

@keyframes cpwSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Icon ring ── */
.cpw-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.cpw-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(102, 126, 234, 0.18),
    0 0 0 16px rgba(118, 75, 162, 0.08);
  animation: cpwBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.cpw-shield {
  font-size: 1.3rem;
  color: #fff;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

.cpw-icon-ring::before,
.cpw-icon-ring::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
  animation: cpwSparkle 0.8s ease-out 0.3s forwards;
}

.cpw-icon-ring::before {
  top: -4px;
  right: -6px;
  background: #a78bfa;
}

.cpw-icon-ring::after {
  bottom: -4px;
  left: -6px;
  background: #f0d87a;
  animation-delay: 0.5s;
}

@keyframes cpwBounce {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
  }
  50% {
    transform: scale(1.12) rotate(3deg);
  }
  70% {
    transform: scale(0.94) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes cpwSparkle {
  0% {
    opacity: 0;
    transform: scale(0) translateY(0);
  }
  40% {
    opacity: 1;
    transform: scale(1.2) translateY(-6px);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-14px);
  }
}

/* ── Title & subtitle ── */
.cpw-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0d87a;
  margin-bottom: 0.3rem;
}

.cpw-subtitle {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* ── Guest notice ── */
.cpw-guest-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  font-size: 0.82rem;
  color: #fca5a5;
  text-align: left;
}

/* hidden attribute must win against display:flex above */
.cpw-guest-notice[hidden],
#cpwGuestNotice[hidden] {
  display: none !important;
}

.cpw-guest-notice i {
  font-size: 1rem;
  flex-shrink: 0;
}

.cpw-guest-notice a {
  color: #f0d87a;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cpw-guest-notice a:hover {
  color: #fde68a;
}

/* ── Message ── */
.cpw-message {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  text-align: left;
  line-height: 1.4;
}

.cpw-message:not([hidden]) {
  display: block;
}

.cpw-message.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.12);
}

.cpw-message.success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.12);
}

.cpw-message.info {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.12);
}

/* ── Form ── */
.cpw-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ── Field ── */
.cpw-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cpw-field label {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(167, 139, 250, 0.8);
  transition:
    color 0.3s ease,
    text-shadow 0.3s ease;
}

.cpw-field:focus-within label {
  color: rgba(167, 139, 250, 1);
  text-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

/* ── Input wrapper ── */
.cpw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cpw-input-wrap .cpw-input {
  width: 100%;
  padding-right: 2.8rem !important;
}

/* ── Input ── */
.cpw-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(124, 58, 237, 0.04) 100%);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

.cpw-input::placeholder {
  color: rgba(161, 161, 170, 0.35);
}

.cpw-input:hover {
  border-color: rgba(124, 58, 237, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(124, 58, 237, 0.06) 100%);
}

.cpw-input:focus {
  border-color: rgba(124, 58, 237, 0.6);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(124, 58, 237, 0.08) 100%);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.15),
    0 0 20px rgba(124, 58, 237, 0.1),
    inset 0 0 15px rgba(124, 58, 237, 0.03);
}

.cpw-input.input-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.cpw-input.input-error:focus {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.15),
    0 0 20px rgba(239, 68, 68, 0.1);
}

/* ── Toggle visibility ── */
.cpw-toggle {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.3rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  z-index: 2;
}

.cpw-toggle:hover {
  color: var(--text-primary);
}

/* ── Strength bar ── */
.cpw-strength-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 0.25rem;
}

.cpw-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #ef4444;
  transition:
    width 0.25s ease,
    background 0.25s ease;
}

.cpw-strength-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

/* ── Rules checklist ── */
.cpw-rules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.3rem;
  padding: 0;
}

.cpw-rule {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: rgba(161, 161, 170, 0.7);
  transition: color 0.25s ease;
}

.cpw-rule-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  font-size: 0.55rem;
}

.cpw-rule-icon i {
  transition: all 0.25s ease;
}

.cpw-rule.valid {
  color: #4ade80;
}

.cpw-rule.valid .cpw-rule-icon i {
  color: #22c55e;
}

.cpw-rule.invalid {
  color: #fca5a5;
}

.cpw-rule.invalid .cpw-rule-icon i {
  color: #ef4444;
}

/* ── Field error ── */
.cpw-field-error {
  font-size: 0.75rem;
  color: #fca5a5;
  min-height: 1rem;
  margin-top: 0.1rem;
}

/* ── Footer ── */
.cpw-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  justify-content: stretch;
}

.cpw-footer .cpw-btn {
  flex: 1;
}

/* ── Buttons ── */
.cpw-btn {
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
  min-height: 40px;
  position: relative;
  overflow: hidden;
}

.cpw-btn--outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
}

.cpw-btn--outline:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

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

.cpw-btn--primary {
  background: #f0d87a;
  color: #1a1a3e;
  border-color: transparent;
}

.cpw-btn--primary:hover {
  background: #e8c85a;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(240, 216, 122, 0.25);
}

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

.cpw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Button loading spinner ── */
.cpw-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: #1a1a3e;
  border-radius: 50%;
  animation: cpwSpin 0.6s linear infinite;
}

.cpw-btn--outline .cpw-btn-spinner {
  border-top-color: rgba(255, 255, 255, 0.75);
}

@keyframes cpwSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ── When form body is hidden (guest notice shown) ── */
.cpw-form[hidden] {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #changePasswordModal .cpw-modal-content {
    padding: 1.25rem 1rem 1rem;
  }

  .cpw-footer {
    flex-direction: column;
  }
}

/* ===== SKIP TO MAIN CONTENT (WCAG 2.4.1 Bypass Blocks) ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10001;
  padding: 0.75rem 1.25rem;
  background: var(--primary, #7c3aed);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ===== NAVIGATION BAR ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 0 1.5rem;
  height: 64px;
  background: rgba(7, 7, 19, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  box-shadow:
    0 1px 0 rgba(148, 163, 184, 0.04),
    0 4px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auto-hide navbar on scroll down, reveal on scroll up */
.navbar.navbar-hidden {
  transform: translateY(-100%);
}

/* When shown, no offset (default state — also prevents flash on load) */
.navbar:not(.navbar-hidden) {
  transform: translateY(0);
}

/* ===== NAVBAR SEARCH ===== */
.nav-search.desktop-only {
  position: relative;
  width: 38px;
  height: 38px;
  min-width: 38px;
  max-width: 38px;
  flex: 0 0 38px;
  z-index: 10005;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-search.desktop-only.expanded {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  flex: 0 0 38px;
  margin-right: -242px;
  overflow: visible;
  border-radius: 12px;
  cursor: default;
  z-index: 10006;
}

.nav-search.desktop-only.expanded:focus-within {
  border-color: #94a3b8;
  box-shadow:
    0 0 0 3px rgba(148, 163, 184, 0.12),
    0 0 20px rgba(148, 163, 184, 0.06);
}

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

.search-input-wrapper .search-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #6b7280;
  font-size: 0.85rem;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.nav-search.desktop-only.expanded .search-input-wrapper .search-icon {
  left: 12px;
  transform: translateY(-50%);
}

.nav-search-input {
  width: 0;
  padding: 0;
  font-size: 0.8rem;
  font-family: inherit;
  color: #e4e4f0;
  background: transparent;
  border: none;
  outline: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease 0.08s;
}

.nav-search.desktop-only.expanded .nav-search-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 2.4rem;
  opacity: 1;
  pointer-events: auto;
}

.nav-search-input::placeholder {
  color: #6b7280;
  font-size: 0.8rem;
}

/* Remove the redundant cyan focus-visible outline on search input —
   the container already shows :focus-within indigo styling */
.nav-search-input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ===== 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;
}

@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;
  }
}

.nav-search.desktop-only.expanded:focus-within .search-icon {
  color: #94a3b8;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1;
}

.nav-search.desktop-only.expanded .clear-search-btn {
  display: flex;
}

.clear-search-btn:hover {
  color: #e4e4f0;
  background: rgba(255, 255, 255, 0.08);
}

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

/* Search Dropdown Suggestions */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin-top: 4px;
  background: rgba(12, 12, 30, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 14px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(148, 163, 184, 0.03);
  max-height: 380px;
  overflow-y: auto;
  z-index: 10010;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.15) transparent;
}

html.light-mode .search-dropdown {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

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

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

.search-dropdown::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.15);
  border-radius: 10px;
}

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

.search-dropdown-section + .search-dropdown-section {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.search-section-title {
  padding: 6px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b7280;
  font-weight: 600;
}

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

.suggestion-item:hover,
.suggestion-item:focus,
.suggestion-item.selected {
  background: rgba(148, 163, 184, 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(148, 163, 184, 0.08);
  padding-left: 20px;
}

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

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

.suggestion-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #e4e4f0;
}

.suggestion-path {
  font-size: 0.7rem;
  color: #6b7280;
}

.suggestion-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestion-arrow {
  color: #6b7280;
  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: #6b7280;
  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: #6b7280;
}

.search-highlight {
  background: rgba(148, 163, 184, 0.2);
  color: #f8fafc;
  border-radius: 2px;
  padding: 0 2px;
}

html.light-mode .search-highlight {
  background: rgba(148, 163, 184, 0.15);
  color: #1e293b;
}

/* 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: #e4e4f0;
  text-decoration: none;
  padding: 10px 16px;
  font-size: 0.875rem;
  cursor: pointer;
}

.recent-link i {
  color: #6b7280;
  font-size: 0.8rem;
}

.recent-item:hover,
.recent-item.selected {
  background: rgba(148, 163, 184, 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: #6b7280;
  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;
  }
}

/* ===== NAVBAR LOGO ===== */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: fit-content;
  text-decoration: none;
  position: relative;
}

.logo-symbol {
  font-size: 1.8rem;
  line-height: 1;
  background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 50%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(148, 163, 184, 0.2));
  animation: logoGlow 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes logoGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 6px rgba(148, 163, 184, 0.1));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(148, 163, 184, 0.25));
  }
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-line-top {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #e4e4f0, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-line-bottom {
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #94a3b8;
  opacity: 0.6;
}

/* ===== NAV LINKS ===== */
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
  flex: 1;
  justify-content: center;
  margin-left: -1rem;
  flex-wrap: nowrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  text-decoration: none;
  color: #9ca3af;
  font-weight: 500;
  font-size: 0.85rem;
  transition:
    color 0.25s ease,
    background 0.35s ease;
  position: relative;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
  overflow: visible;
}

/* ===== DROPDOWN TOGGLE ===== */
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: #9ca3af;
  font: inherit;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  transition:
    color 0.25s ease,
    background 0.35s ease;
  white-space: nowrap;
}

.dropdown-toggle:hover {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.08);
}

.nav-link:hover {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.08);
}

.dropdown-toggle[aria-expanded='true'] {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.12);
}

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

.dropdown-icon {
  font-size: 0.55rem;
  transition: transform 0.2s ease;
  color: #6b7280;
}

.has-dropdown {
  position: relative;
}

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

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

/* ===== DROPDOWN MENU ===== */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 220px;
  background: rgba(12, 12, 30, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(148, 163, 184, 0.03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.15) transparent;
}

.dropdown-menu-end {
  left: auto;
  right: 0;
  transform: translateY(-6px);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.1);
  outline: none;
}

.dropdown-item.nav-auth-link {
  border: none;
  background: none;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.dropdown-item.nav-auth-link:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #e4e4f0;
}

/* Auth state visibility — driven by classes set by auth.js on <html> */
html.auth-verified [data-guest-only] {
  display: none !important;
}
html.auth-unverified [data-auth-required] {
  display: none !important;
}

.dropdown-item i {
  font-size: 0.85rem;
  width: 18px;
  text-align: center;
  color: #94a3b8;
  flex-shrink: 0;
}

.dropdown-item:hover i {
  color: #cbd5e1;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0.4rem 0;
}

/* ===== MEGA MENU ===== */
.mega-menu {
  min-width: auto !important;
  max-width: calc(100vw - 3rem) !important;
  width: 780px;
  padding: 0.75rem !important;
}

.has-dropdown:hover .mega-menu,
.has-dropdown:focus-within .mega-menu {
  left: 0;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  overflow: hidden;
}

.mega-menu-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mega-menu-back {
  display: none;
}

.mega-menu-heading {
  padding: 0.5rem 0.85rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  opacity: 0.6;
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mega-menu-heading i {
  font-size: 0.7rem;
  width: auto;
  color: inherit;
}

.mega-menu-subheading {
  padding: 0.3rem 0.85rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  opacity: 0.5;
  pointer-events: none;
}

.admin-badge {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  font-weight: 600;
  margin-left: auto;
}

/* ===== NAVBAR HIGHLIGHT ===== */
.nav-highlight-item {
  color: var(--accent-color, #f59e0b) !important;
  font-weight: 600 !important;
}

/* ===== SETTINGS DROPDOWN ===== */
.settings-dropdown-menu {
  min-width: 260px !important;
}

/* Settings dropdown: click-only — remove hover bridge, prevent CSS hover activation */
.nav-settings-dropdown.has-dropdown::before {
  display: none;
}

.nav-settings-dropdown.has-dropdown:hover .settings-dropdown-menu,
.nav-settings-dropdown.has-dropdown:focus-within .settings-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-settings-dropdown.has-dropdown.open .settings-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Fix positioning: don't stretch settings parent to full navbar height */
.nav-toolbar .nav-item.nav-settings-dropdown {
  height: auto;
}

/* Remove the 12px hover-bridge gap since settings is click-only */
.nav-settings-dropdown .settings-dropdown-menu {
  top: calc(100% + 4px);
}

.settings-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.settings-toggle:hover {
  border-color: rgba(148, 163, 184, 0.25);
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.06);
}

.settings-toggle i {
  transition: transform 0.3s ease;
}

.settings-toggle:hover i {
  transform: rotate(90deg);
}

.settings-profile-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.4rem;
}

.settings-profile-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-avatar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.settings-avatar-fallback {
  font-size: 2.5rem;
  color: #6b7280;
}

.settings-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.settings-avatar-wrapper img[style*='display: none'] + .settings-avatar-fallback {
  display: inline-block;
}

.settings-avatar-wrapper img:not([style*='display: none']) + .settings-avatar-fallback {
  display: none !important;
}

.settings-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #e4e4f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-user-email {
  font-size: 0.7rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Dropdown group label */
.dropdown-group-label {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  opacity: 0.6;
  pointer-events: none;
  white-space: nowrap;
}

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

/* ===== NAV TOOLBAR ===== */
.nav-toolbar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
  min-width: fit-content;
  height: 100%;
}

.nav-toolbar .nav-item {
  display: flex;
  align-items: center;
  height: 100%;
}

/* ===== MENU TOGGLE (Hamburger) ===== */
.menu-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e4e4f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.menu-toggle:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.25);
}

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

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

/* Mobile dropdown fade-in animation (reliable with display:none→block) */
@keyframes mobileDropdownFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== MOBILE NAVIGATION ===== */
@media (max-width: 1200px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: min(340px, 85vw);
    height: 100vh;
    height: 100dvh;
    background: rgba(7, 7, 19, 0.98);
    border-left: 1px solid rgba(148, 163, 184, 0.08);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 4.5rem 1rem 1.5rem;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9995;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

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

  .nav-item {
    width: 100%;
  }

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

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

  .dropdown-menu {
    position: static;
    opacity: 0;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin: 0.25rem 0 0.25rem 0.5rem;
    padding: 0.25rem 0;
    max-width: none;
    display: none;
    pointer-events: auto;
  }

  .has-dropdown.open .dropdown-menu {
    display: block;
    animation: mobileDropdownFadeIn 0.2s ease forwards;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0.5rem 0.5rem;
  }

  .has-dropdown {
    scroll-margin-top: 1rem;
  }

  .mega-menu {
    width: 100% !important;
  }

  .mega-menu-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .mega-menu-col {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
  }

  .mega-menu-col:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .mega-menu-heading {
    padding: 0.5rem 0.75rem 0.3rem;
    font-size: 0.65rem;
    letter-spacing: 0.03em;
  }

  .mega-menu-subheading {
    padding: 0.25rem 0.75rem;
  }

  /* Mobile back button inside mega-menu */
  .mega-menu-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 8px;
    color: #c4b5fd;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mega-menu-back:hover,
  .mega-menu-back:active {
    background: rgba(255, 255, 255, 0.08);
    color: #a78bfa;
  }

  .mega-menu-back i {
    font-size: 0.75rem;
  }

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

  .dropdown-toggle .dropdown-icon {
    transition: transform 0.25s ease;
    font-size: 0.7rem;
  }

  /* Mobile: Let parent nav panel handle scrolling (prevents nested scroll conflicts) */
  .nav-learn-dropdown.open .dropdown-menu {
    max-height: none;
    overflow: visible;
  }

  .dropdown-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
  }

  .desktop-only {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-settings-dropdown:not(.open) .settings-dropdown-menu {
    display: none;
  }

  .nav-settings-dropdown.open .settings-dropdown-menu {
    display: block;
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
  }

  .settings-dropdown-menu {
    position: fixed !important;
    top: calc(56px + 0.5rem) !important;
    left: auto !important;
    right: 1rem !important;
    width: calc(100% - 2rem) !important;
    max-width: 360px !important;
    min-width: auto !important;
    max-height: calc(100dvh - 56px - 1rem);
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    z-index: 10001 !important;
    transform: none !important;
    background: rgba(12, 12, 30, 0.98);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow:
      0 25px 60px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(148, 163, 184, 0.03);
    border-radius: 14px;
  }

  /* When signed in, give the panel more room for extra items */
  html.auth-verified .settings-dropdown-menu {
    max-width: 380px !important;
  }

  /* Reduce font sizes inside the fixed settings panel on mobile/tablet */
  .settings-dropdown-menu .dropdown-item {
    font-size: 0.8rem;
  }
  .settings-dropdown-menu .dropdown-item i {
    font-size: 0.78rem;
    width: 16px;
  }
  .settings-dropdown-menu .settings-profile-header {
    padding: 0.7rem;
  }
  .settings-dropdown-menu .settings-avatar-wrapper {
    width: 34px;
    height: 34px;
  }
  .settings-dropdown-menu .settings-avatar-fallback {
    font-size: 2rem;
  }
  .settings-dropdown-menu .settings-user-name {
    font-size: 0.82rem;
  }
  .settings-dropdown-menu .settings-user-email {
    font-size: 0.65rem;
  }

  .dropdown-group-label {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.7rem;
  }

  .nav-settings-dropdown {
    position: static;
  }
}

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

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

  .logo-line-top {
    font-size: 0.85rem;
  }

  .logo-line-bottom {
    display: none;
  }

  .nav-links {
    width: 100vw;
    width: 100dvw;
    max-width: none;
    padding: 3.75rem 0.6rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .nav-link,
  .dropdown-toggle {
    padding: 0.7rem 0.6rem;
    font-size: 0.88rem;
  }

  .dropdown-item {
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
  }

  .settings-dropdown-menu {
    top: calc(56px + 0.35rem) !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    max-width: none !important;
    min-width: auto !important;
    max-height: calc(100dvh - 56px - 0.7rem);
    width: auto !important;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
  /* When signed in on phone, give more room */
  html.auth-verified .settings-dropdown-menu {
    max-width: none !important;
  }

  /* Compact fonts for phone-sized settings panel */
  .settings-dropdown-menu .dropdown-item {
    font-size: 0.76rem;
    padding: 0.4rem 0.6rem;
  }
  .settings-dropdown-menu .dropdown-item i {
    font-size: 0.7rem;
    width: 14px;
  }
  .settings-dropdown-menu .settings-profile-header {
    padding: 0.5rem 0.6rem;
  }
  .settings-dropdown-menu .settings-avatar-wrapper {
    width: 28px;
    height: 28px;
  }
  .settings-dropdown-menu .settings-avatar-fallback {
    font-size: 1.5rem;
  }
  .settings-dropdown-menu .settings-user-name {
    font-size: 0.75rem;
  }
  .settings-dropdown-menu .settings-user-email {
    font-size: 0.6rem;
  }

  .mega-menu-heading {
    font-size: 0.6rem;
    padding: 0.4rem 0.65rem 0.25rem;
  }

  .has-dropdown.open .dropdown-menu {
    max-height: none;
  }

  .nav-learn-dropdown.open .dropdown-menu {
    max-height: none;
  }

  .menu-toggle {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
}

/* Active state for current page */
.nav-link.active,
.dropdown-toggle.active {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.12);
}

.nav-link.active:hover,
.dropdown-toggle.active:hover {
  background: rgba(148, 163, 184, 0.16);
}

/* 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,
.menu-toggle:focus-visible,
.settings-toggle:focus-visible,
.favorite-btn:focus-visible,
.notes-btn:focus-visible,
.nav-toolbar .nav-item:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
  border-radius: 8px;
}

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

  .logo-symbol {
    animation: none;
  }
}

/* ===== BREADCRUMB BAR ===== */
.breadcrumb-bar {
  display: none;
}

.breadcrumb-bar:not(:empty) {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  padding: 2px 2rem;
  gap: 0.25rem;
  flex-wrap: wrap;
  background: rgba(7, 7, 19, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(148, 163, 184, 0.06);
  font-size: 0.75rem;
  line-height: 1.2;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.breadcrumb-bar.breadcrumb-visible {
  transform: translateY(0);
}

.breadcrumb-link {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
  opacity: 0.6;
}

.breadcrumb-link:hover {
  color: var(--accent);
  text-decoration: underline;
  opacity: 1;
}

.breadcrumb-active {
  color: var(--text-secondary);
  font-weight: 500;
  opacity: 0.6;
}

.breadcrumb-separator {
  color: var(--text-secondary);
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  opacity: 0.5;
}

/* ===== 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;
}

/* ===== TOAST NOTIFICATION ===== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #E8E4F2;
  z-index: 10000;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transition:
    opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.toast-notification.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.toast-notification .toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.toast-notification .toast-message {
  flex: 1;
}

.toast-notification .toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 0.75rem;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.toast-notification .toast-close:hover {
  opacity: 1;
}

.toast-info {
  background: rgba(237, 200, 210, 0.12);
  border-color: rgba(237, 200, 210, 0.18);
  box-shadow: 0 8px 24px rgba(237, 200, 210, 0.12);
}

.toast-info .toast-icon {
  background: rgba(237, 200, 210, 0.18);
  color: #EDC8D2;
}

.toast-success {
  background: rgba(200, 216, 192, 0.12);
  border-color: rgba(200, 216, 192, 0.18);
  color: #C8D8C0;
  box-shadow: 0 8px 24px rgba(200, 216, 192, 0.12);
}

.toast-success .toast-icon {
  background: rgba(200, 216, 192, 0.18);
  color: #C8D8C0;
}

.toast-error {
  background: rgba(237, 200, 210, 0.14);
  border-color: rgba(237, 200, 210, 0.22);
  color: #EDC8D2;
  box-shadow: 0 8px 24px rgba(237, 200, 210, 0.12);
}

.toast-error .toast-icon {
  background: rgba(237, 200, 210, 0.2);
  color: #EDC8D2;
}

.toast-warning {
  background: rgba(232, 212, 160, 0.12);
  border-color: rgba(232, 212, 160, 0.18);
  color: #E8D4A0;
  box-shadow: 0 8px 24px rgba(232, 212, 160, 0.12);
}

.toast-warning .toast-icon {
  background: rgba(232, 212, 160, 0.18);
  color: #E8D4A0;
}

/* Toast container positioning */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

#toast-container .toast-notification {
  position: relative;
  bottom: auto;
  right: auto;
}

.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);
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 2px solid #ef4444;
}

.btn-danger:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.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;
}

.flashcard-inner {
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: max-height 0.4s ease;
  max-height: 500px;
  transform-style: preserve-3d;
}

.flashcard.is-revealed .flashcard-inner {
  max-height: 2000px;
}

.flashcard-face {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 10, 26, 0.35);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.06);
}

.flashcard-front {
  backface-visibility: hidden;
  transition: opacity 0.3s ease;
}

.flashcard.is-revealed .flashcard-front {
  display: none;
}

.flashcard-back {
  display: none;
  overflow-y: auto;
}

.flashcard.is-revealed .flashcard-back {
  display: flex;
}

#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;
}

.flashcard-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flashcard-option {
  padding: 0.9rem 1.25rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.5;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.flashcard-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.flashcard-option.correct {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
  font-weight: 600;
  cursor: default;
  transform: none;
}

.flashcard-option.incorrect {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
  font-weight: 600;
  cursor: default;
  transform: none;
}

.flashcard-explanation {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.flashcards-actions {
  display: flex;
  justify-content: flex-end;
  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;
}

#flashcardsRevealBtn {
  background: #d8b4fe;
  color: #3b0764;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition:
    background 0.25s ease,
    transform 0.2s ease;
}

#flashcardsRevealBtn:hover {
  background: #c084fc;
  transform: translateY(-2px);
}

/* ===== DSA FLASHCARDS: accessibility/UX ===== */
.pagination-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.6rem 1.25rem;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.flashcards-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.sound-toggle-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.sound-toggle-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}

.sound-toggle-btn.muted {
  opacity: 0.5;
}

@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);
}

.offline-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b;
  color: #1e293b;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

/* ===== 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:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  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;
}

@keyframes favPulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.45);
  }
  70% {
    transform: scale(0.85);
  }
  100% {
    transform: scale(1.12);
  }
}

.favorite-btn.pulse {
  animation: favPulse 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  color: #ff4d6d !important;
  border-color: #ff4d6d !important;
  box-shadow: 0 0 20px rgba(255, 77, 109, 0.5) !important;
}

.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);
}

.stage-progress-container {
  margin-top: 1.5rem;
  text-align: left;
}

.stage-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.stage-progress-header span:first-child {
  color: var(--text-secondary);
}

.stage.active .stage-progress-header span:first-child {
  color: rgba(255, 255, 255, 0.8);
}

.stage-progress-percent {
  font-weight: bold;
  color: var(--accent);
}

.stage.active .stage-progress-percent {
  color: #fff;
}

.stage-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.stage-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease-in-out;
}

.stage.active .stage-progress-fill {
  background: #fff;
}

/* ===== 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);
}

/* ===== REVISION SCHEDULER CARD ===== */
.revision-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
  gap: 1rem;
  flex-wrap: wrap;
}

.revision-card-header h3 {
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.revision-streak-pill {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.revision-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.revision-stat {
  background: var(--dark-card);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.revision-stat:hover {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
}

.revision-stat span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--gradient-3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.3rem;
}

.revision-stat small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.revision-task-list {
  margin-bottom: 1.25rem;
}

.revision-task-item {
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid var(--glass-border);
}

.revision-task-item:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
  transform: translateX(4px);
}

.revision-task-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.revision-task-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.revision-task-topline strong {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.revision-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 12px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.revision-pill.high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

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

.revision-pill.low {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.revision-task-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.revision-task-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
  gap: 1rem;
}

.revision-task-footer span {
  flex: 1;
  min-width: 0;
}

/* ===== 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%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  position: relative;
  cursor: pointer;
  justify-self: center;
  transition: transform 0.25s ease;
}

.badge::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.badge:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.badge.locked i {
  opacity: 0.25;
  filter: grayscale(1);
}

.badge.locked::after {
  border-color: rgba(255, 255, 255, 0.06);
}

.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,
.badge-lg:hover .badge-tooltip,
.badge-lg:focus .badge-tooltip {
  opacity: 1;
}

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

/* ===== XP REWARD STORE MODAL ===== */
.xp-store-modal {
  z-index: 11000;
}

.xp-store-content {
  position: relative;
  max-width: 580px;
  width: 92%;
  margin: auto;
  background: linear-gradient(160deg, rgba(18, 18, 40, 0.97) 0%, rgba(26, 26, 60, 0.97) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-height: min(85vh, 700px);
  display: flex;
  flex-direction: column;
  animation: xpStoreSlideIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes xpStoreSlideIn {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.xp-store-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.xp-store-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.xp-store-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 1.25rem;
  color: #e4e4f0;
  margin: 0;
}

.xp-store-icon {
  font-size: 1.3rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.xp-store-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.xp-store-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e4e4f0;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Balance display with soft shimmer */
.xp-store-balance {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.1);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}

.xp-store-balance::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(251, 191, 36, 0.08) 40%,
    rgba(248, 113, 113, 0.06) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: xpShimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes xpShimmer {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xp-store-balance::after {
    animation: none;
    display: none;
  }
  .xp-store-content {
    animation: none;
  }
}

.xp-balance-label {
  font-size: 0.8rem;
  font-weight: 400;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.xp-balance-amount {
  font-family: 'Fira Code', monospace;
  font-size: 1.5rem;
  font-weight: 500;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  transition: transform 0.15s ease;
}

.xp-balance-unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: #6b7280;
}

/* Store body — scrollable item grid */
.xp-store-body {
  padding: 1rem 1.5rem 0.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.xp-store-body::-webkit-scrollbar {
  width: 4px;
}
.xp-store-body::-webkit-scrollbar-track {
  background: transparent;
}
.xp-store-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* Toast notification inside store */
.xp-store-toast {
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-8px) scaleY(0.9);
  transform-origin: top center;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    margin 0.25s ease,
    padding 0.25s ease;
  pointer-events: none;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  max-height: 0;
  overflow: hidden;
}

.xp-store-toast.show {
  opacity: 1;
  transform: translateY(0) scaleY(1);
  margin-bottom: 0.25rem;
  padding: 0.6rem 1rem;
  max-height: none;
  overflow: visible;
}

.xp-store-toast.success {
  background: rgba(134, 239, 172, 0.1);
  border: 1px solid rgba(134, 239, 172, 0.2);
  color: #86efac;
}

.xp-store-toast.error {
  background: rgba(252, 165, 165, 0.1);
  border: 1px solid rgba(252, 165, 165, 0.2);
  color: #fca5a5;
}

/* Individual store item card */
.xp-store-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  transition: all 0.25s ease;
  position: relative;
}

.xp-store-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.xp-item-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.xp-store-item:hover .xp-item-icon-wrap {
  transform: scale(1.08);
}

.xp-item-icon {
  line-height: 1;
}

.xp-item-info {
  flex: 1;
  min-width: 0;
}

.xp-item-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: #e4e4f0;
  margin: 0 0 0.2rem;
}

.xp-item-desc {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  font-size: 0.78rem;
  color: #9ca3af;
  line-height: 1.4;
  margin: 0 0 0.4rem;
}

.xp-item-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.3rem;
}

.tag-consumable {
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
}

.tag-cosmetic {
  background: rgba(249, 168, 212, 0.1);
  color: #f9a8d4;
}

.tag-booster {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.tag-limited {
  background: rgba(103, 232, 249, 0.1);
  color: #67e8f9;
}

.xp-item-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.xp-item-price {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.xp-price-amount {
  font-family: 'Fira Code', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: #e4e4f0;
}

.xp-price-unit {
  font-size: 0.7rem;
  font-weight: 400;
  color: #6b7280;
}

.xp-store-buy-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(6, 182, 212, 0.2);
  background: rgba(6, 182, 212, 0.08);
  color: #22d3ee;
  font-family: 'Poppins', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 68px;
  text-align: center;
}

.xp-store-buy-btn:hover:not(:disabled) {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
}

.xp-store-buy-btn:active:not(:disabled) {
  transform: translateY(0);
}

.xp-store-buy-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.xp-store-buy-btn.owned {
  border-color: rgba(134, 239, 172, 0.2);
  background: rgba(134, 239, 172, 0.08);
  color: #86efac;
}

.xp-store-buy-btn .btn-owned-text {
  font-size: 0.7rem;
}

.xp-item-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Individual item icon color themes */
.xp-item-icon-wrap--blue {
  background: rgba(186, 230, 253, 0.15);
}
.xp-item-icon-wrap--blue .xp-item-icon {
  color: #38bdf8;
}

.xp-item-icon-wrap--amber {
  background: rgba(253, 230, 138, 0.15);
}
.xp-item-icon-wrap--amber .xp-item-icon {
  color: #fbbf24;
}

.xp-item-icon-wrap--rose {
  background: rgba(254, 205, 211, 0.15);
}
.xp-item-icon-wrap--rose .xp-item-icon {
  color: #fb7185;
}

.xp-item-icon-wrap--mint {
  background: rgba(167, 243, 208, 0.15);
}
.xp-item-icon-wrap--mint .xp-item-icon {
  color: #34d399;
}

.xp-item-icon-wrap--lavender {
  background: rgba(221, 214, 254, 0.15);
}
.xp-item-icon-wrap--lavender .xp-item-icon {
  color: #a78bfa;
}

/* Just purchased animation */
.xp-store-buy-btn.just-purchased {
  animation: xpBtnPop 0.5s ease;
}

@keyframes xpBtnPop {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.15);
  }
  60% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.xp-store-footer {
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.xp-store-footer-text {
  margin: 0;
  font-size: 0.7rem;
  color: #6b7280;
  text-align: center;
  font-weight: 300;
}

@media (max-width: 600px) {
  .xp-store-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 20px;
  }
  .xp-store-header {
    padding: 1.1rem 1rem 0.8rem;
  }
  .xp-store-body {
    padding: 0.75rem 1rem 0.25rem;
  }
  .xp-store-item {
    flex-wrap: wrap;
    gap: 0.65rem;
  }
  .xp-item-action {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
  }
  .xp-balance-amount {
    font-size: 1.25rem;
  }
}

/* Purchase confirmation overlay */
.xp-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.xp-confirm-overlay.active {
  display: flex;
  opacity: 1;
}

.xp-confirm-card {
  background: linear-gradient(160deg, rgba(22, 22, 50, 0.98), rgba(30, 30, 65, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 2rem 2rem 1.5rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: xpConfirmIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes xpConfirmIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xp-confirm-card {
    animation: none;
  }
}

.xp-confirm-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.3rem;
  color: #fbbf24;
}

.xp-confirm-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 1.1rem;
  color: #e4e4f0;
  margin: 0 0 0.35rem;
}

.xp-confirm-item {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0 0 1rem;
}

.xp-confirm-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
  font-family: 'Poppins', sans-serif;
}
.xp-confirm-price-label {
  font-size: 0.8rem;
  color: #6b7280;
}
.xp-confirm-price-value {
  font-family: 'Fira Code', monospace;
  font-size: 1.3rem;
  font-weight: 500;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.xp-confirm-price-unit {
  font-size: 0.75rem;
  color: #6b7280;
}

.xp-confirm-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
}

.xp-confirm-btn {
  padding: 0.5rem 1.4rem;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.xp-confirm-btn--cancel {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
}
.xp-confirm-btn--cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e4e4f0;
}

.xp-confirm-btn--buy {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.25);
  color: #22d3ee;
}
.xp-confirm-btn--buy:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

/* ===== 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;
}

.xp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.xp-card-header h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.xp-next-level {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.level-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.level-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

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

.xp-stat-item {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.xp-stat-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.xp-stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

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

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

.badges-header h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.badges-earned-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.badges-preview-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  background: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.2s;
}

.badges-preview-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

#badgesPreviewModal {
  z-index: 20000;
}

.badges-preview-content {
  position: relative;
  max-width: 520px;
  width: 92%;
  margin: auto;
  background: linear-gradient(160deg, rgba(18, 18, 40, 0.98) 0%, rgba(26, 26, 60, 0.98) 100%);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.badges-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.badges-preview-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
}

.badges-preview-header .modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

.badges-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1.25rem;
  justify-items: center;
}

.badges-preview-grid .badge-lg {
  cursor: default;
}

.badges-preview-grid .badge-lg:hover {
  animation: none;
}

.badges-preview-grid .badge-lg.badge-hover-spin {
  animation: previewSpin 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-pulse {
  animation: previewPulse 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-float {
  animation: previewFloat 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-bounce {
  animation: previewBounce 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-glow {
  animation: previewGlow 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-wobble {
  animation: previewWobble 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-shake {
  animation: previewShake 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-flash {
  animation: previewFlash 2s ease-in-out infinite;
}
.badges-preview-grid .badge-lg.badge-hover-grow {
  animation: previewGrow 2s ease-in-out infinite;
}

@keyframes previewSpin {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  50% {
    transform: scale(1.08) rotate(15deg);
  }
}
@keyframes previewPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}
@keyframes previewFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@keyframes previewBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-2px);
  }
}
@keyframes previewGlow {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.06);
    filter: brightness(1.3);
  }
}
@keyframes previewWobble {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
  75% {
    transform: rotate(-3deg);
  }
}
@keyframes previewShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
@keyframes previewFlash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes previewGrow {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  50% {
    transform: scale(1.12) rotate(5deg);
  }
}

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

.streak-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.streak-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.streak-number {
  font-size: 4rem;
  font-weight: 900;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

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

.streak-week {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.streak-week .streak-day {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.streak-week .streak-day.completed {
  background: var(--gradient-4);
  color: white;
}

.streak-week .streak-day.missed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.streak-best {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

.activity-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.review-queue-card {
  text-align: center;
}

.badge-lg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  position: relative;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.badge-lg::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.badge-lg:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.badge-lg.locked i {
  opacity: 0.25;
  filter: grayscale(1);
}

.badge-lg.locked::after {
  border-color: rgba(255, 255, 255, 0.06);
}

/* ── Badge hover animations ──────────────────────────── */
.badge-hover-spin:hover,
.badge-lg.badge-hover-spin:hover {
  transform: scale(1.08) rotate(15deg);
}

.badge-hover-pulse:hover,
.badge-lg.badge-hover-pulse:hover {
  animation: badgePulse 0.4s ease;
}

.badge-hover-float:hover,
.badge-lg.badge-hover-float:hover {
  transform: scale(1.08) translateY(-5px);
}

.badge-hover-bounce:hover,
.badge-lg.badge-hover-bounce:hover {
  animation: badgeBounce 0.5s ease;
}

.badge-hover-glow:hover,
.badge-lg.badge-hover-glow:hover {
  transform: scale(1.08);
  filter: brightness(1.25);
}

.badge-hover-wobble:hover,
.badge-lg.badge-hover-wobble:hover {
  animation: badgeWobble 0.4s ease;
}

.badge-hover-shake:hover,
.badge-lg.badge-hover-shake:hover {
  animation: badgeShake 0.4s ease;
}

.badge-hover-flash:hover,
.badge-lg.badge-hover-flash:hover {
  animation: badgeFlash 0.3s ease;
}

.badge-hover-grow:hover,
.badge-lg.badge-hover-grow:hover {
  transform: scale(1.12) rotate(5deg);
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1.08);
  }
}
@keyframes badgeBounce {
  0% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
  60% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(-3px);
  }
}
@keyframes badgeWobble {
  0% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
  75% {
    transform: rotate(-3deg);
  }
  100% {
    transform: rotate(0);
  }
}
@keyframes badgeShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
@keyframes badgeFlash {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

#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 {
  position: relative;
  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-bio {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.4rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.recent-activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-light);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.recent-activity-item:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.recent-activity-item:last-child {
  margin-bottom: 0;
}

.recent-activity-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-activity-xp {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.recent-activity-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.skill-mastery-item {
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

.skill-mastery-item:last-child {
  margin-bottom: 0;
}
.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);
}

/* ===== DEACTIVATE ACCOUNT MODAL ===== */
.deactivate-modal-content {
  position: relative;
  max-width: 400px;
  width: 90%;
  margin: auto;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid rgba(247, 192, 201, 0.2);
  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: deactivateSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  display: block;
  overflow: visible;
}

.deactivate-modal-content .modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

@keyframes deactivateSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Icon ring */
.deactivate-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.deactivate-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 8px rgba(102, 126, 234, 0.18),
    0 0 0 16px rgba(118, 75, 162, 0.08);
  animation: deactivateBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.deactivate-icon-symbol {
  font-size: 1.3rem;
  color: #fff;
  line-height: 1;
  animation: deactivatePulse 2.5s ease-in-out 1s infinite;
}

.deactivate-icon-ring::before,
.deactivate-icon-ring::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
  animation: deactivateSparkle 0.8s ease-out 0.3s forwards;
}

.deactivate-icon-ring::before {
  top: -4px;
  right: -6px;
  background: #a78bfa;
}

.deactivate-icon-ring::after {
  bottom: -4px;
  left: -6px;
  background: #f0d87a;
  animation-delay: 0.5s;
}

@keyframes deactivateBounce {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
  }
  50% {
    transform: scale(1.12) rotate(3deg);
  }
  70% {
    transform: scale(0.94) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes deactivateSparkle {
  0% {
    opacity: 0;
    transform: scale(0) translateY(0);
  }
  40% {
    opacity: 1;
    transform: scale(1.2) translateY(-6px);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-14px);
  }
}

@keyframes deactivatePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(1.12);
  }
}

.deactivate-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0d87a;
  margin-bottom: 0.3rem;
}

.deactivate-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* Info box */
.deactivate-info-box {
  margin-bottom: 1rem;
  text-align: left;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
}

.deactivate-info-text {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0;
}

/* Action buttons */
.deactivate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.deactivate-actions__main {
  display: flex;
  gap: 0.5rem;
}

.deactivate-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
}

.deactivate-btn--outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
}

.deactivate-btn--outline:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
}

.deactivate-btn--danger {
  background: #ef4444;
  color: #fff;
}

.deactivate-btn--danger:hover {
  background: #dc2626;
}

/* Dismiss */
.deactivate-dismiss {
  margin: 0;
}

.deactivate-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;
}

.deactivate-dismiss-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.deactivate-btn--danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #6b7280;
}

/* ===== 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);
}

.code-editor .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 ===== */
.footer {
  position: relative;
  background: rgba(7, 7, 19, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem 2rem 1rem;
  margin-top: 4rem;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  overflow: hidden;
  box-shadow:
    0 -1px 0 rgba(148, 163, 184, 0.04),
    0 -4px 30px rgba(0, 0, 0, 0.2);
}

/* Subtle node-pattern background — signature element grounded in DSA */
.footer-bg-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(196, 181, 253, 0.4) 1px, transparent 1px),
    radial-gradient(circle at 85% 30%, rgba(186, 230, 253, 0.4) 1px, transparent 1px),
    radial-gradient(circle at 45% 70%, rgba(167, 243, 208, 0.4) 1px, transparent 1px),
    radial-gradient(circle at 70% 85%, rgba(196, 181, 253, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 30% 50%, rgba(186, 230, 253, 0.3) 1px, transparent 1px);
  background-size:
    120px 120px,
    100px 100px,
    140px 140px,
    90px 90px,
    110px 110px;
  background-position:
    0 0,
    80px 60px,
    30px 120px,
    180px 40px,
    60px 90px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

/* Brand column */
.footer-brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}

.footer-logo-symbol {
  font-size: 2rem;
  line-height: 1;
  background: linear-gradient(135deg, #a5b4fc 0%, #c4b5fd 50%, #bae6fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(148, 163, 184, 0.15));
  animation: footerLogoGlow 3s ease-in-out infinite;
}

@keyframes footerLogoGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 6px rgba(148, 163, 184, 0.1));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(196, 181, 253, 0.2));
  }
}

.footer-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.footer-logo-top {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #e4e4f0, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-logo-bottom {
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #94a3b8;
  opacity: 0.6;
}

.footer-tagline {
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
}

/* Social links */
.social-links {
  display: flex;
  gap: 0.5rem;
}

.social-links a {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.social-links a:hover {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.25);
  transform: translateY(-2px);
}

/* Column headings */
.footer-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  opacity: 0.7;
  margin-bottom: 0.6rem;
  pointer-events: none;
}

.footer-heading i {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Link lists */
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.footer-links li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-left: -0.5rem;
}

.footer-links li a i {
  font-size: 0.7rem;
  width: 16px;
  text-align: center;
  color: #6b7280;
  transition: color 0.25s ease;
  flex-shrink: 0;
}

.footer-links li a:hover {
  color: #e4e4f0;
  background: rgba(148, 163, 184, 0.08);
}

.footer-links li a:hover i {
  color: #c4b5fd;
}

/* Newsletter */
.footer-newsletter {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-newsletter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
}

.footer-newsletter-label i {
  font-size: 0.7rem;
}

.newsletter-input-wrap {
  display: flex;
  gap: 0.35rem;
}

.newsletter-form input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #e4e4f0;
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.25s ease;
}

.newsletter-form input::placeholder {
  color: #6b7280;
}

.newsletter-form input:focus {
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.1);
  outline: none !important;
}

.newsletter-form input:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.1) !important;
}

.newsletter-form button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(196, 181, 253, 0.15), rgba(186, 230, 253, 0.15));
  border: 1px solid rgba(196, 181, 253, 0.15);
  color: #c4b5fd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.newsletter-form button:hover {
  background: linear-gradient(135deg, rgba(196, 181, 253, 0.25), rgba(186, 230, 253, 0.25));
  color: #e4e4f0;
  border-color: rgba(196, 181, 253, 0.3);
}

/* Footer bottom */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
}

.footer-copyright {
  color: #6b7280;
  font-size: 0.78rem;
}

.footer-heart {
  color: #fda4af;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-link-dot {
  color: #4a4a6a;
  font-size: 0.6rem;
}

.footer-bottom-links a {
  color: #6b7280;
  text-decoration: none;
  font-size: 0.78rem;
  transition: color 0.25s ease;
  padding: 0.2rem 0.25rem;
  border-radius: 4px;
}

.footer-bottom-links a:hover {
  color: #c4b5fd;
}

/* Newsletter validation reuse (keeping for compatibility) */
.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);
}

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

/* ===== 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:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}

.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;
}

.lang-edit-label input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-radius: 4px;
  background: var(--dark-card);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.lang-edit-label input[type='checkbox']:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.lang-edit-label input[type='checkbox']:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.lang-edit-label input[type='checkbox']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-edit-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  user-select: none;
}
.lang-edit-label:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--dark-card) 90%, var(--primary) 10%);
}
.lang-edit-label:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--dark-card) 80%, var(--primary) 20%);
  color: var(--text-primary);
}

.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 ====== */

/* ===== 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: left;
  }

  .social-links {
    justify-content: flex-start;
  }

  .newsletter-input-wrap {
    max-width: 280px;
  }

  .footer-newsletter {
    text-align: left;
  }

  .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-line-bottom {
    display: none;
  }

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

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

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer-bottom-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .footer {
    padding: 1.5rem 1.25rem 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-links li a {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }

  .footer-bottom-links {
    gap: 0.35rem;
  }

  .footer-bottom-links a {
    font-size: 0.72rem;
  }
}

/* ===== 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);

  /* ===== VISUALIZER PANEL THEME ===== */
  --panel-bg: #f8fafc;
  --panel-border: #cbd5e1;
  --panel-bg-dark: #e2e8f0;
  --panel-text: #334155;
  --panel-text-muted: #64748b;
  --panel-card-bg: #ffffff;
}

/* ADD THIS BELOW — fixes navbar hardcoded backgrounds */
html.light-mode .navbar {
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow:
    0 1px 0 rgba(148, 163, 184, 0.04),
    0 4px 30px rgba(0, 0, 0, 0.05);
}

html.light-mode .nav-links {
  background: transparent;
}

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(148, 163, 184, 0.08);
}

html.light-mode .nav-link::after {
  background: #94a3b8;
}

html.light-mode .dropdown-menu,
html.light-mode .search-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

html.light-mode .dropdown-item {
  color: #4a5568;
}

html.light-mode .dropdown-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #475569;
}

html.light-mode .menu-toggle,
html.light-mode .settings-toggle {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a202c;
}

html.light-mode .settings-toggle:hover,
html.light-mode .menu-toggle:hover {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.06);
  color: #475569;
}

html.light-mode .logo-line-top {
  background: linear-gradient(90deg, #1e293b, #334155);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light-mode .logo-line-bottom {
  color: #94a3b8;
}

html.light-mode .nav-search.desktop-only {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light-mode .nav-search.desktop-only.expanded:focus-within {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}

html.light-mode .nav-search-input {
  color: #1e293b;
}

html.light-mode .nav-search-input::placeholder {
  color: #94a3b8;
}

html.light-mode .mega-menu-heading {
  color: #64748b;
}

html.light-mode .mega-menu-subheading {
  color: #94a3b8;
}

html.light-mode .dropdown-item i {
  color: #64748b;
}

html.light-mode .dropdown-item:hover i {
  color: #475569;
}

html.light-mode .settings-profile-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light-mode .settings-user-name {
  color: #1e293b;
}

html.light-mode .dropdown-divider {
  background: rgba(0, 0, 0, 0.08);
}

html.light-mode .admin-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

html.light-mode .breadcrumb-bar:not(:empty) {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

/* ===== XP STORE ITEM PREVIEWS ===== */
.xp-item-preview {
  margin: 0.5rem 0 0.35rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.xp-preview-caption {
  display: block;
  font-size: 0.6rem;
  color: #6b7280;
  margin-top: 0.3rem;
  text-align: center;
  font-weight: 400;
}

/* Streak Freeze Preview */
.xp-preview-streak {
  display: flex;
  gap: 3px;
  justify-content: center;
}
.xp-preview-day {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: #38bdf8;
}
.xp-preview-day--protected {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  font-size: 0.5rem;
}

/* Hint Token Preview */
.xp-preview-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.xp-preview-hint-bubble {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}
.xp-preview-hint-icon {
  font-size: 0.7rem;
  color: #fbbf24;
  flex-shrink: 0;
}
.xp-preview-hint-text {
  font-size: 0.6rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xp-preview-hint-levels {
  display: flex;
  gap: 4px;
}
.xp-preview-lvl {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s;
}
.xp-preview-lvl.active {
  background: #fbbf24;
}

/* Avatar Pack Preview */
.xp-preview-avatars {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.xp-preview-avatars-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

/* XP Booster Preview */
.xp-preview-booster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.xp-preview-booster-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  line-height: 1;
}
.xp-preview-booster-badge b {
  font-size: 1.1rem;
}
.xp-preview-booster-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  max-width: 60px;
}
.xp-preview-booster-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #34d399);
  border-radius: 3px;
}
.xp-preview-booster-problems {
  display: flex;
  gap: 3px;
}
.xp-preview-prob {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.45rem;
  color: #6b7280;
}
.xp-preview-prob.active {
  background: #34d399;
  border-color: #34d399;
  color: white;
}

/* Exclusive Badge Preview */
.xp-preview-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.xp-preview-badge-shape {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border: 2px solid rgba(167, 139, 250, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  position: relative;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}
.xp-preview-badge-level {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 0.5rem;
  color: #fbbf24;
}
.xp-preview-badge-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: #a78bfa;
  letter-spacing: 0.05em;
}
.xp-preview-badge-stars {
  display: flex;
  gap: 1px;
  font-size: 0.45rem;
  color: #fbbf24;
}

/* ===== INVENTORY DISPLAY ===== */
.inventory-card {
  grid-column: span 1;
}
.inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.inventory-empty {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
}
.inv-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all 0.2s ease;
}
.inv-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.inv-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.inv-icon--blue {
  background: rgba(186, 230, 253, 0.15);
  color: #38bdf8;
}
.inv-icon--amber {
  background: rgba(253, 230, 138, 0.15);
  color: #fbbf24;
}
.inv-icon--mint {
  background: rgba(167, 243, 208, 0.15);
  color: #34d399;
}
.inv-icon--rose {
  background: rgba(254, 205, 211, 0.15);
  color: #fb7185;
}
.inv-icon--lavender {
  background: rgba(221, 214, 254, 0.15);
  color: #a78bfa;
}
.inv-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  gap: 0.5rem;
}
.inv-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: #e4e4f0;
  white-space: nowrap;
}
.inv-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  white-space: nowrap;
  font-family: 'Fira Code', monospace;
}
.inv-count.inv-owned {
  color: #86efac;
  font-size: 0.7rem;
}
.inv-active {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  background: #34d399;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.25rem;
  letter-spacing: 0.04em;
  animation: invPulse 2s ease-in-out infinite;
}
@keyframes invPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Avatar Borders */
.avatar-border-rainbow {
  background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6) !important;
  background-size: 200% 100% !important;
  animation: rainbowBorder 3s linear infinite;
  -webkit-background-clip: padding-box !important;
  background-clip: padding-box !important;
}

@keyframes rainbowBorder {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.avatar-inner {
  transition:
    border 0.3s ease,
    background 0.3s ease;
}

/* Avatar customization modal styles */
.avatar-customization-section h4,
.avatar-theme-section h4 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.border-option,
.theme-option {
  transition: all 0.2s ease;
  user-select: none;
}

.border-option:hover,
.theme-option:hover {
  border-color: var(--primary) !important;
  background: color-mix(in srgb, var(--dark-card) 90%, var(--primary) 10%);
}

.border-option:has(input:checked),
.theme-option:has(input:checked) {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--dark-card) 80%, var(--accent) 20%);
  color: var(--text-primary);
}

.border-option input[type='radio'],
.theme-option input[type='radio'] {
  accent-color: var(--accent);
}

/* ===== THEME TOGGLE: View Transition API — Outward Ripple ===== */
html {
  view-transition-name: root;
}

/* Keep the old snapshot fully visible while the new one peels in */
::view-transition-old(root) {
  animation: theme-ripple-fade-in 800ms both !important;
  mix-blend-mode: normal !important;
}

@keyframes theme-ripple-fade-in {
  from {
    opacity: 1;
  }
  to {
    opacity: 1;
  }
}

/* New snapshot ripples outward from the click point */
::view-transition-new(root) {
  animation: theme-ripple 800ms cubic-bezier(0.16, 1, 0.3, 1) both !important;
  mix-blend-mode: normal !important;
}

@keyframes theme-ripple {
  from {
    clip-path: circle(0 at var(--ripple-x, 50%) var(--ripple-y, 50%));
  }
  to {
    clip-path: circle(var(--ripple-max-r, 141.4%) at var(--ripple-x, 50%) var(--ripple-y, 50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.01ms !important;
  }
}

/* ── Resume-Tailored Roadmap & Recommendation Badges ────────────────── */
.recommendation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.35);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.recommendation-badge i {
  font-size: 0.75rem;
}

.recommended-step {
  border: 1px solid rgba(236, 72, 153, 0.45) !important;
  background: linear-gradient(
    145deg,
    rgba(236, 72, 153, 0.05),
    rgba(139, 92, 246, 0.05)
  ) !important;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.12) !important;
}

.tailored-roadmap-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(19, 19, 25, 0.85);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-left: 4px solid #ec4899;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
}

.tailored-roadmap-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tailored-roadmap-banner .banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  font-weight: 600;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.tailored-roadmap-banner .banner-info {
  font-size: 0.88rem;
  color: var(--text-primary, #e2e2e8);
}

.tailored-cta-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.topic-chip {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  margin-right: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Global Responsive Layout Fixes --- */
@media (max-width: 768px) {
  body {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .container, .wrapper {
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
  }
  .modal-content, .quiz-modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    margin: 2vh auto !important;
  }
  .btn-group, .controls, .toolbar {
    flex-wrap: wrap !important;
  }
  .visualizer-container, .canvas-wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 1.75rem !important;
  }
  .title-icon {
    font-size: 1.75rem !important;
  }
}

/* --- Async UI States --- */
.async-ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--card-bg, rgba(15, 23, 42, 0.8));
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: inherit;
  text-align: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-in-out;
}

.async-ui-container {
  position: relative;
  min-height: 150px; /* Ensure space for overlays */
}

.async-ui-spinner {
  font-size: 2rem;
  color: var(--primary, #7c3aed);
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

.async-ui-message {
  font-size: 1rem;
  color: var(--text-primary, #ffffff);
  margin-bottom: 1rem;
  font-family: var(--ui-font, 'Outfit', sans-serif);
}

.async-ui-error-icon {
  font-size: 2rem;
  color: var(--error-color, #ef4444);
  margin-bottom: 1rem;
}

.async-ui-empty-icon {
  font-size: 2rem;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 1rem;
}

.async-ui-retry-btn {
  background: var(--primary, #7c3aed);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.async-ui-retry-btn:hover {
  background: var(--primary-hover, #6d28d9);
}

/* --- Standardized Buttons --- */
.btn-simulator {
  padding: 0.5rem 1rem;
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.375rem; /* rounded-md */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

.btn-simulator-primary {
  background-color: #2563eb; /* bg-blue-600 */
}

.btn-simulator-primary:hover {
  background-color: #1d4ed8; /* bg-blue-700 */
}

.btn-simulator-danger {
  background-color: #ef4444; /* bg-red-500 */
}

.btn-simulator-danger:hover {
  background-color: #dc2626; /* bg-red-600 */
}

/* --- Standardized Panels and Cards --- */
.visualizer-panel {
  background-color: #ffffff; /* bg-white */
  border-radius: 0.75rem; /* rounded-xl */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
  border: 1px solid #f3f4f6; /* border-gray-100 */
  padding: 1.5rem; /* p-6 */
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.dark-mode .visualizer-panel {
  background-color: #1f2937; /* dark:bg-gray-800 */
  border-color: #374151; /* dark:border-gray-700 */
  color: #f3f4f6;
}

.visualizer-panel-interactive {
  transition: all 0.3s;
}

.visualizer-panel-interactive:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); /* hover:shadow-xl */
  transform: translateY(-0.25rem); /* hover:-translate-y-1 */
}
