/* ================================================================
   AI Computer Science Plus — Master Stylesheet
   Premium AI-Native CS Education Platform

   Table of Contents:
   ------------------
   1.  CSS Custom Properties (Design Tokens)
   2.  Reset / Normalize
   3.  Base Styles (html, body, links, media)
   4.  Typography System
   5.  Layout Utilities
   6.  Navigation Bar
   7.  Sidebar (Collapsible Lesson/Skill Tree)
   8.  Glassmorphism Card System
   9.  Button System
   10. Form Elements
   11. Badge & Achievement System
   12. Progress Bars & XP Bars
   13. Modal / Dialog System
   14. Code Blocks & Syntax Theme
   15. Tab System
   16. Tooltip System
   17. Alert / Notification System
   18. Table Styling
   19. Skill Tree Nodes
   20. AI Tutor Panel
   21. Course Player Layout
   22. Lab Environment Layout
   23. Leaderboard
   24. Dashboard Grid & Stat Cards
   25. Circuit Board Texture Overlay
   26. Hero Section
   27. Pricing Cards
   28. Footer
   29. Loading / Shimmer States
   30. Scrollbar Customization
   31. Selection Highlighting
   32. Responsive Breakpoints
   33. Print Styles
   34. High Contrast Mode
   35. WCAG Focus-Visible Styles
   36. Display, Color & Overflow Utilities
   ================================================================ */


/* ================================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ================================================================ */
:root {
  /* --- Color System --- */
  --bg-deep:          #020812;
  --bg-panel:         #0D1117;
  --bg-card:          #111827;
  --bg-card-hover:    #161E2E;
  --bg-code:          #0A0E1A;
  --bg-input:         #1A2233;
  --bg-overlay:       rgba(2, 8, 18, 0.75);

  --accent-blue:      #00B4FF;
  --accent-blue-rgb:  0, 180, 255;
  --accent-purple:    #7c3aed;          /* AICS Neon Purple — primary brand */
  --accent-purple-rgb:124, 58, 237;     /* AICS Neon Purple RGB */
  --accent-violet:    #a855f7;          /* AICS Neon Violet — secondary brand */
  --accent-violet-rgb:168, 85, 247;
  --neon-purple-glow: rgba(124, 58, 237, 0.4);    /* Particle + glow effects */
  --neon-violet-glow: rgba(168, 85, 247, 0.35);   /* Hover glow */
  --neon-purple-legacy: #9B59FF;        /* Pre-2026-05-14 baseline (kept for rollback) */
  --accent-green:     #00FF88;
  --accent-green-rgb: 0, 255, 136;
  --accent-amber:     #FFB347;
  --accent-amber-rgb: 255, 179, 71;
  --accent-red:       #FF4B6E;
  --accent-red-rgb:   255, 75, 110;
  --accent-cyan:      #00E5FF;

  --text-primary:     #FFFFFF;
  --text-secondary:   #A0ADB8;
  --text-muted:       #5A6A7A;
  --text-disabled:    #3A4654;

  --border-glow:      rgba(0, 180, 255, 0.3);
  --border-purple:    rgba(124, 58, 237, 0.35);    /* AICS Neon Purple border */
  --border-violet:    rgba(168, 85, 247, 0.30);    /* AICS Neon Violet border */
  --border-green:     rgba(0, 255, 136, 0.3);
  --glass-bg:         rgba(13, 17, 23, 0.85);
  --glass-border:     rgba(255, 255, 255, 0.08);

  --shadow-blue:      0 0 30px rgba(0, 180, 255, 0.15);
  --shadow-purple:    0 0 30px rgba(124, 58, 237, 0.22);     /* AICS Neon Purple glow */
  --shadow-violet:    0 0 32px rgba(168, 85, 247, 0.20);
  --shadow-green:     0 0 30px rgba(0, 255, 136, 0.15);
  --shadow-ambient:   0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-elevated:  0 16px 48px rgba(0, 0, 0, 0.6);

  /* --- Spacing Scale (4px grid) --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* --- Typography Scale --- */
  --text-xs:    11px;
  --text-sm:    13px;
  --text-base:  15px;
  --text-md:    17px;
  --text-lg:    20px;
  --text-xl:    26px;
  --text-2xl:   32px;
  --text-3xl:   40px;
  --text-4xl:   56px;

  --leading-tight:    1.2;
  --leading-normal:   1.6;
  --leading-relaxed:  1.8;

  /* --- Border Radius Tokens --- */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-fast: 0.15s ease;
  --transition-med:  0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Fonts --- */
  --font-ui:      'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-code:    'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-display: 'Orbitron', 'Exo 2', var(--font-ui);

  /* --- Layout Dimensions --- */
  --sidebar-w:   280px;
  --topbar-h:    56px;
  --tutor-w:     380px;
  --container-w: 1200px;

  /* --- Z-Index Scale --- */
  --z-base:     1;
  --z-sidebar:  900;
  --z-topbar:   1000;
  --z-dropdown: 1100;
  --z-modal:    2000;
  --z-toast:    9999;
}


/* ================================================================
   2. RESET / NORMALIZE
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  line-height: 1.15;
}

body, h1, h2, h3, h4, h5, h6, p, ol, ul, figure, blockquote, dl, dd {
  margin: 0;
}

ol, ul {
  list-style: none;
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

[hidden] {
  display: none !important;
}

/* Remove default button/input appearance on iOS */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}


/* ================================================================
   3. BASE STYLES
   ================================================================ */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-deep);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-cyan);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code, pre, kbd, samp {
  font-family: var(--font-code);
}

hr {
  border: none;
  height: 1px;
  background: var(--glass-border);
  margin: var(--space-8) 0;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ================================================================
   4. TYPOGRAPHY SYSTEM
   ================================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: clamp(28px, 4vw, var(--text-4xl)); }
h2 { font-size: clamp(22px, 3vw, var(--text-3xl)); }
h3 { font-size: clamp(18px, 2.5vw, var(--text-xl)); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

/* Inline code */
code {
  font-family: var(--font-code);
  font-size: 0.875em;
  background: rgba(0, 180, 255, 0.08);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(0, 180, 255, 0.12);
}

/* Preformatted blocks (see also Section 14 for .code-block) */
pre {
  font-family: var(--font-code);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  background: var(--bg-code);
  color: var(--text-primary);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--accent-purple);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  background: rgba(155, 89, 255, 0.05);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--text-muted);
}

/* Lists */
.list, article ul, article ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.list li, article ul li, article ol li {
  padding: var(--space-1) 0;
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

article ul {
  list-style: disc;
}

article ol {
  list-style: decimal;
}

/* Display font utility */
.display-font {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mono label utility */
.label {
  font-family: var(--font-code);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.label-accent  { color: var(--accent-blue); }
.label-purple  { color: var(--accent-purple); }
.label-green   { color: var(--accent-green); }

/* Keyboard shortcut display */
kbd {
  font-family: var(--font-code);
  font-size: var(--text-xs);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  color: var(--text-secondary);
}

/* Small / caption text */
small, .text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-muted {
  color: var(--text-muted);
}

mark {
  background: rgba(0, 180, 255, 0.2);
  color: var(--text-primary);
  padding: 1px 4px;
  border-radius: 2px;
}


/* ================================================================
   5. LAYOUT UTILITIES
   ================================================================ */
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-8);
}

/* Flex utilities */
.flex           { display: flex; }
.inline-flex    { display: inline-flex; }
.flex-col       { display: flex; flex-direction: column; }
.flex-row       { display: flex; flex-direction: row; }
.flex-wrap      { flex-wrap: wrap; }
.flex-center    { display: flex; align-items: center; justify-content: center; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-start     { display: flex; align-items: flex-start; }
.flex-end       { display: flex; align-items: center; justify-content: flex-end; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.flex-1         { flex: 1; }
.flex-shrink-0  { flex-shrink: 0; }

/* Grid utilities */
.grid   { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto-fill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* Gap utilities */
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-5  { gap: var(--space-5); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-sm { gap: var(--space-2); }
.gap-md { gap: var(--space-4); }
.gap-lg { gap: var(--space-6); }

/* Padding utilities */
.p-0  { padding: 0; }
.p-1  { padding: var(--space-1); }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.px-8 { padding-left: var(--space-8); padding-right: var(--space-8); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* Margin utilities */
.m-0  { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-sm { margin-top: var(--space-3); }
.mt-md { margin-top: var(--space-6); }
.mt-lg { margin-top: var(--space-12); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-sm { margin-bottom: var(--space-3); }
.mb-md { margin-bottom: var(--space-6); }
.mb-lg { margin-bottom: var(--space-12); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Visibility */
.hidden      { display: none !important; }
.visible     { visibility: visible; }
.invisible   { visibility: hidden; }

/* Section spacing */
.section {
  padding: var(--space-20) 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-kicker {
  font-family: var(--font-code);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-purple);
  margin-bottom: var(--space-3);
}

.section-header h2 { margin-bottom: var(--space-4); }

.section-header p {
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}


/* ================================================================
   6. NAVIGATION BAR
   Fixed top bar with glass morphism, logo, nav links, XP bar,
   streak counter, grade badge, and user menu.
   ================================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(2, 8, 18, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: var(--z-topbar);
}

/* Logo area */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-decoration: none;
}

.topbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
}

/* Center navigation */
.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.topbar-nav {
  display: flex;
  gap: var(--space-1);
  list-style: none;
}

.topbar-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar-nav a:hover,
.topbar-nav a.active {
  background: rgba(0, 180, 255, 0.1);
  color: var(--accent-blue);
}

/* Right section: XP, streak, grade, user */
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* XP bar (mini, in topbar) */
.xp-bar-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-green);
}

.xp-bar-track {
  width: 80px;
  height: 6px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
  border-radius: 3px;
  transition: width var(--transition-slow);
}

/* Streak counter */
.streak-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-amber);
}

.streak-badge .streak-icon {
  font-size: 14px;
}

/* Grade badge */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-code);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(0, 180, 255, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(0, 180, 255, 0.2);
}

.grade-badge.grade-a { background: rgba(0, 255, 136, 0.12); color: var(--accent-green); border-color: rgba(0, 255, 136, 0.2); }
.grade-badge.grade-b { background: rgba(0, 180, 255, 0.12); color: var(--accent-blue); border-color: rgba(0, 180, 255, 0.2); }
.grade-badge.grade-c { background: rgba(255, 179, 71, 0.12); color: var(--accent-amber); border-color: rgba(255, 179, 71, 0.2); }

/* User menu avatar */
.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: white;
  transition: border-color var(--transition-fast);
}

.avatar-btn:hover {
  border-color: var(--accent-blue);
}

/* User dropdown menu */
.user-menu {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: var(--space-6);
  width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  padding: var(--space-2) 0;
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

.user-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-menu-item:hover {
  background: rgba(0, 180, 255, 0.06);
  color: var(--text-primary);
}

.user-menu-divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--space-2) 0;
}


/* ================================================================
   7. SIDEBAR — Collapsible Lesson / Skill Tree Navigation
   ================================================================ */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-panel);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-med), width var(--transition-med);
  padding: var(--space-4) 0;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

/* Sidebar toggle button */
.sidebar-toggle {
  position: absolute;
  top: var(--space-4);
  right: calc(-1 * var(--space-10));
  width: 32px;
  height: 32px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.sidebar-toggle:hover {
  color: var(--accent-blue);
}

/* Sidebar sections */
.sidebar-section {
  padding: var(--space-2) var(--space-4);
}

.sidebar-section-title {
  font-family: var(--font-code);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3) 0 var(--space-2);
}

/* Sidebar items (lessons, nodes) */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-item:hover {
  background: rgba(0, 180, 255, 0.06);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(0, 180, 255, 0.1);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.sidebar-item.completed .item-status {
  color: var(--accent-green);
}

.sidebar-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebar-item .item-icon  { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-item .item-label { flex: 1; }
.sidebar-item .item-status { font-size: var(--text-xs); }

/* Glow border on sidebar (decorative left edge) */
.sidebar-glow {
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--accent-blue),
    var(--accent-purple),
    transparent
  );
  opacity: 0.3;
}

/* Sidebar progress indicator */
.sidebar-progress {
  padding: var(--space-4);
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
}

.sidebar-progress-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: space-between;
}


/* ================================================================
   8. GLASSMORPHISM CARD SYSTEM
   ================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-med);
}

.card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-blue);
}

/* Glass variant: frosted glass effect */
.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all var(--transition-med);
}

.card-glass:hover {
  border-color: var(--border-glow);
}

/* Glow variant: neon glow border */
.card-glow {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-blue);
  transition: all var(--transition-med);
  position: relative;
  overflow: hidden;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-med);
}

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

.card-glow:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 40px rgba(0, 180, 255, 0.2), 0 0 40px rgba(155, 89, 255, 0.1);
}

/* Purple glow variant */
.card-glow-purple {
  border-color: var(--border-purple);
  box-shadow: var(--shadow-purple);
}

.card-glow-purple::before {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
}

/* Glass helpers */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-blue {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-blue);
}

.glass-purple {
  border-color: var(--border-purple);
  box-shadow: var(--shadow-purple);
}

/* Card sub-components */
.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.card-icon-blue   { background: rgba(0, 180, 255, 0.15);  color: var(--accent-blue); }
.card-icon-purple { background: rgba(155, 89, 255, 0.15); color: var(--accent-purple); }
.card-icon-green  { background: rgba(0, 255, 136, 0.15);  color: var(--accent-green); }
.card-icon-amber  { background: rgba(255, 179, 71, 0.15); color: var(--accent-amber); }

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* No-hover variant for static cards */
.card-static:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--glass-border);
}


/* ================================================================
   9. BUTTON SYSTEM
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-med);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

/* Primary: electric blue */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #0088CC);
  color: white;
  box-shadow: 0 4px 20px rgba(var(--accent-blue-rgb), 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(var(--accent-blue-rgb), 0.4);
}

/* Secondary: neon purple */
.btn-secondary {
  background: linear-gradient(135deg, var(--accent-purple), #7B2FFF);
  color: white;
  box-shadow: 0 4px 20px rgba(var(--accent-purple-rgb), 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(var(--accent-purple-rgb), 0.4);
}

/* Success: matrix green */
.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #00CC6A);
  color: var(--bg-deep);
  font-weight: 700;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(var(--accent-green-rgb), 0.3);
}

/* Outline: border only */
.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border: 1.5px solid var(--border-glow);
}

.btn-outline:hover {
  background: rgba(var(--accent-blue-rgb), 0.1);
  border-color: var(--accent-blue);
}

/* Ghost: minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Danger: red */
.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #CC2244);
  color: white;
  box-shadow: 0 4px 20px rgba(var(--accent-red-rgb), 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(var(--accent-red-rgb), 0.4);
}

/* Sizes */
.btn-sm {
  padding: 8px 18px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-md {
  padding: 12px 28px;
  font-size: 14px;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

/* Icon-only button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 48px;
  height: 48px;
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Ripple effect on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:active::after {
  opacity: 1;
}

/* Button group */
.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}


/* ================================================================
   10. FORM ELEMENTS
   Dark themed with glow focus states.
   ================================================================ */
.input-group {
  position: relative;
  margin-bottom: var(--space-5);
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Text inputs, textareas, selects */
.input,
.textarea,
.select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  transition: all var(--transition-fast);
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(var(--accent-blue-rgb), 0.15);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

/* Error state */
.input.error,
.textarea.error,
.select.error {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(var(--accent-red-rgb), 0.15);
}

.input-error-message {
  font-size: var(--text-xs);
  color: var(--accent-red);
  margin-top: var(--space-1);
}

/* Success state */
.input.valid {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(var(--accent-green-rgb), 0.15);
}

/* Textarea */
.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-normal);
}

/* Select */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0ADB8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Checkbox (custom dark) */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.checkbox-wrapper input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.checkbox-wrapper input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-wrapper input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(var(--accent-blue-rgb), 0.3);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: rgba(var(--accent-blue-rgb), 0.2);
  border-color: var(--accent-blue);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateY(-50%) translateX(20px);
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(var(--accent-blue-rgb), 0.5);
}

.toggle input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(var(--accent-blue-rgb), 0.3);
}

/* Radio button */
.radio-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.radio-wrapper input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--glass-border);
  border-radius: 50%;
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.radio-wrapper input[type="radio"]:checked {
  border-color: var(--accent-blue);
}

.radio-wrapper input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
}

/* Input with icon */
.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-left: 40px;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}


/* ================================================================
   11. BADGE & ACHIEVEMENT SYSTEM
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-code);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-blue   { background: rgba(var(--accent-blue-rgb), 0.12);  color: var(--accent-blue);   border: 1px solid rgba(var(--accent-blue-rgb), 0.2); }
.badge-purple { background: rgba(var(--accent-purple-rgb), 0.12);color: var(--accent-purple); border: 1px solid rgba(var(--accent-purple-rgb), 0.2); }
.badge-green  { background: rgba(var(--accent-green-rgb), 0.12); color: var(--accent-green);  border: 1px solid rgba(var(--accent-green-rgb), 0.2); }
.badge-amber  { background: rgba(var(--accent-amber-rgb), 0.12); color: var(--accent-amber);  border: 1px solid rgba(var(--accent-amber-rgb), 0.2); }
.badge-red    { background: rgba(var(--accent-red-rgb), 0.12);   color: var(--accent-red);    border: 1px solid rgba(var(--accent-red-rgb), 0.2); }

/* Achievement icon badge (circular) */
.achievement-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--glass-border);
}

.achievement-badge.earned {
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(var(--accent-blue-rgb), 0.3);
}

.achievement-badge.earned.legendary {
  border-color: var(--accent-amber);
  box-shadow: 0 0 16px rgba(var(--accent-amber-rgb), 0.4);
}

/* Spinning glow ring */
.achievement-badge .badge-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-blue), var(--accent-purple), var(--accent-green), var(--accent-blue));
  opacity: 0.3;
  filter: blur(6px);
  animation: badge-spin 3s linear infinite;
}

@keyframes badge-spin {
  to { transform: rotate(360deg); }
}

/* Achievement card */
.achievement-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-med);
}

.achievement-card.locked {
  opacity: 0.4;
  filter: grayscale(0.8);
}

.achievement-card:not(.locked):hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-blue);
}

/* Tag system */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-code);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-weight: 500;
}

.tag-blue   { background: rgba(var(--accent-blue-rgb), 0.12);   color: var(--accent-blue);   border: 1px solid rgba(var(--accent-blue-rgb), 0.2); }
.tag-purple { background: rgba(var(--accent-purple-rgb), 0.12); color: var(--accent-purple); border: 1px solid rgba(var(--accent-purple-rgb), 0.2); }
.tag-green  { background: rgba(var(--accent-green-rgb), 0.12);  color: var(--accent-green);  border: 1px solid rgba(var(--accent-green-rgb), 0.2); }
.tag-amber  { background: rgba(var(--accent-amber-rgb), 0.12);  color: var(--accent-amber);  border: 1px solid rgba(var(--accent-amber-rgb), 0.2); }
.tag-red    { background: rgba(var(--accent-red-rgb), 0.12);    color: var(--accent-red);    border: 1px solid rgba(var(--accent-red-rgb), 0.2); }

/* Grade band colors */
.band-early   { --band-color: #00CED1; }
.band-primary { --band-color: #32CD32; }
.band-middle  { --band-color: #4169E1; }
.band-high    { --band-color: #9B59FF; }

.band-badge {
  font-family: var(--font-code);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px;
  color: var(--band-color, var(--accent-blue));
}


/* ================================================================
   12. PROGRESS BARS & XP BARS
   ================================================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  transition: width var(--transition-slow);
  position: relative;
}

/* Green variant */
.progress-fill.green {
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}

/* Purple variant */
.progress-fill.purple {
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
}

/* Amber variant */
.progress-fill.amber {
  background: linear-gradient(90deg, var(--accent-amber), #FF8C00);
}

/* Animated shimmer on progress fill */
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  animation: progress-shimmer 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Large progress bar (for XP display) */
.progress-bar-lg {
  height: 12px;
  border-radius: 6px;
}

/* Progress bar with label */
.progress-labeled {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.progress-label .progress-value {
  color: var(--accent-blue);
  font-weight: 600;
}

/* XP bar (full-width page-level) */
.xp-progress {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.xp-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.xp-level {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent-blue);
}

.xp-amount {
  font-family: var(--font-code);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.xp-amount span {
  color: var(--accent-green);
  font-weight: 600;
}


/* ================================================================
   13. MODAL / DIALOG SYSTEM
   ================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 60px rgba(var(--accent-blue-rgb), 0.1), var(--shadow-elevated);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-med);
}

.modal-backdrop.open .modal-panel {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border: none;
  font-size: 18px;
}

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

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6) var(--space-6);
  border-top: 1px solid var(--glass-border);
}

/* Modal sizes */
.modal-sm .modal-panel { max-width: 400px; }
.modal-lg .modal-panel { max-width: 720px; }
.modal-xl .modal-panel { max-width: 960px; }
.modal-full .modal-panel { max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); }


/* ================================================================
   14. CODE BLOCKS & SYNTAX THEME
   ================================================================ */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  font-family: var(--font-code);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  overflow-x: auto;
  position: relative;
}

/* Code block header (filename + copy button) */
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
}

.code-block-filename {
  font-family: var(--font-code);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.code-block-copy {
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--glass-border);
  background: transparent;
  transition: all var(--transition-fast);
}

.code-block-copy:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* Line numbers */
.code-block .line-num {
  color: var(--text-muted);
  user-select: none;
  margin-right: var(--space-4);
  display: inline-block;
  width: 24px;
  text-align: right;
}

/* Highlighted line */
.code-block .line-highlight {
  background: rgba(var(--accent-blue-rgb), 0.08);
  display: block;
  margin: 0 calc(-1 * var(--space-5));
  padding: 0 var(--space-5);
  border-left: 2px solid var(--accent-blue);
}

/* Syntax highlighting tokens */
.code-kw  { color: #C792EA; }  /* Keywords */
.code-fn  { color: #82AAFF; }  /* Functions */
.code-str { color: #C3E88D; }  /* Strings */
.code-num { color: #F78C6C; }  /* Numbers */
.code-cm  { color: #546E7A; font-style: italic; }  /* Comments */
.code-op  { color: #89DDFF; }  /* Operators */
.code-var { color: #EEFFFF; }  /* Variables */
.code-cls { color: #FFCB6B; }  /* Classes / Types */
.code-tag { color: #F07178; }  /* Tags (HTML) */
.code-atr { color: #C792EA; }  /* Attributes */
.code-val { color: #C3E88D; }  /* Attribute values */
.code-reg { color: #89DDFF; }  /* Regex */
.code-del { color: var(--accent-red); background: rgba(var(--accent-red-rgb), 0.1); }
.code-ins { color: var(--accent-green); background: rgba(var(--accent-green-rgb), 0.1); }


/* ================================================================
   15. TAB SYSTEM
   ================================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(var(--accent-blue-rgb), 0.2);
}

/* Purple active variant */
.tab.active-purple.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
  box-shadow: 0 2px 8px rgba(var(--accent-purple-rgb), 0.2);
}

.tab-content {
  padding: var(--space-6) 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Pill tabs variant */
.tabs-pills {
  display: flex;
  gap: var(--space-2);
  background: var(--bg-card);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border-bottom: none;
}

.tabs-pills .tab {
  border-bottom: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
}

.tabs-pills .tab.active {
  background: rgba(var(--accent-blue-rgb), 0.15);
  color: var(--accent-blue);
  box-shadow: none;
}


/* ================================================================
   16. TOOLTIP SYSTEM
   ================================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: var(--z-dropdown);
}

/* Tooltip text */
[data-tooltip]::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: var(--shadow-ambient);
}

/* Tooltip arrow */
[data-tooltip]::after {
  content: '';
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 4px solid transparent;
  border-top-color: var(--bg-panel);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Bottom tooltip */
[data-tooltip-pos="bottom"]::before {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 4px);
  border-top-color: transparent;
  border-bottom-color: var(--bg-panel);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="bottom"]:hover::before,
[data-tooltip-pos="bottom"]:hover::after {
  transform: translateX(-50%) translateY(0);
}


/* ================================================================
   17. ALERT / NOTIFICATION SYSTEM
   ================================================================ */

/* Toast container (fixed position) */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + var(--space-4));
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--shadow-elevated);
  animation: toast-in 0.4s ease forwards;
  pointer-events: all;
}

.toast-success { border-left: 3px solid var(--accent-green); }
.toast-info    { border-left: 3px solid var(--accent-blue); }
.toast-warning { border-left: 3px solid var(--accent-amber); }
.toast-error   { border-left: 3px solid var(--accent-red); }

.toast-icon    { font-size: 18px; flex-shrink: 0; }
.toast-message { font-size: var(--text-sm); flex: 1; color: var(--text-secondary); }
.toast-close   { cursor: pointer; color: var(--text-muted); font-size: 16px; flex-shrink: 0; }
.toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* Inline alert banners */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  border: 1px solid;
  margin-bottom: var(--space-4);
}

.alert-success {
  background: rgba(var(--accent-green-rgb), 0.06);
  border-color: rgba(var(--accent-green-rgb), 0.2);
  color: var(--accent-green);
}

.alert-info {
  background: rgba(var(--accent-blue-rgb), 0.06);
  border-color: rgba(var(--accent-blue-rgb), 0.2);
  color: var(--accent-blue);
}

.alert-warning {
  background: rgba(var(--accent-amber-rgb), 0.06);
  border-color: rgba(var(--accent-amber-rgb), 0.2);
  color: var(--accent-amber);
}

.alert-error {
  background: rgba(var(--accent-red-rgb), 0.06);
  border-color: rgba(var(--accent-red-rgb), 0.2);
  color: var(--accent-red);
}

.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.alert-dismiss {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
}

.alert-dismiss:hover {
  opacity: 1;
}


/* ================================================================
   18. TABLE STYLING
   ================================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table thead {
  border-bottom: 1px solid var(--glass-border);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(var(--accent-blue-rgb), 0.04);
}

/* Striped variant */
.data-table-striped tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

/* Table wrapper for horizontal scroll */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.table-wrapper .data-table th:first-child,
.table-wrapper .data-table td:first-child {
  padding-left: var(--space-6);
}

.table-wrapper .data-table th:last-child,
.table-wrapper .data-table td:last-child {
  padding-right: var(--space-6);
}

/* Sortable column header */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text-secondary);
}

.data-table th.sorted-asc::after {
  content: ' \2191';
  color: var(--accent-blue);
}

.data-table th.sorted-desc::after {
  content: ' \2193';
  color: var(--accent-blue);
}


/* ================================================================
   19. SKILL TREE NODES
   ================================================================ */
.skill-tree {
  position: relative;
  padding: var(--space-8);
}

.skill-node {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all var(--transition-med);
}

.skill-node:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(var(--accent-blue-rgb), 0.25);
  transform: scale(1.08);
}

/* Unlocked and completed states */
.skill-node.unlocked {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(var(--accent-blue-rgb), 0.15);
}

.skill-node.completed {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px rgba(var(--accent-green-rgb), 0.2);
  background: rgba(var(--accent-green-rgb), 0.08);
}

.skill-node.locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.skill-node.locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--glass-border);
}

/* Mastered: golden ring */
.skill-node.mastered {
  border-color: var(--accent-amber);
  box-shadow: 0 0 20px rgba(var(--accent-amber-rgb), 0.3);
}

.skill-node.mastered::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent-amber);
  opacity: 0.4;
  animation: skill-pulse 2s ease-in-out infinite;
}

@keyframes skill-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 0.2; transform: scale(1.1); }
}

/* Connector lines between nodes */
.skill-connector {
  position: absolute;
  height: 2px;
  background: var(--glass-border);
  transform-origin: left center;
}

.skill-connector.active {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  box-shadow: 0 0 8px rgba(var(--accent-blue-rgb), 0.3);
}

/* Skill node label */
.skill-node-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}


/* ================================================================
   20. AI TUTOR PANEL (Right sidebar, floating)
   ================================================================ */
.ai-tutor-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: var(--tutor-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-panel);
  border-left: 1px solid var(--border-glow);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-med);
  box-shadow: -4px 0 24px rgba(var(--accent-blue-rgb), 0.05);
}

.ai-tutor-panel.collapsed {
  transform: translateX(var(--tutor-w));
}

/* Tutor header */
.ai-tutor-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--glass-border);
}

.ai-tutor-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ai-tutor-status {
  font-size: var(--text-xs);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Chat area */
.ai-tutor-chat {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ai-tutor-message {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.ai-tutor-message.bot {
  background: rgba(var(--accent-blue-rgb), 0.08);
  border: 1px solid rgba(var(--accent-blue-rgb), 0.12);
  align-self: flex-start;
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-xs);
}

.ai-tutor-message.user {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  align-self: flex-end;
  color: var(--text-secondary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-xs) var(--radius-md);
}

/* Tutor input area */
.ai-tutor-input {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid var(--glass-border);
}

.ai-tutor-input .input {
  flex: 1;
}

/* Tutor toggle button (visible when collapsed) */
.ai-tutor-toggle {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(var(--accent-blue-rgb), 0.4);
  transition: all var(--transition-med);
  z-index: var(--z-sidebar);
  border: none;
}

.ai-tutor-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(var(--accent-blue-rgb), 0.5);
}


/* ================================================================
   21. COURSE PLAYER LAYOUT
   Full-screen with sidebar, content area, bottom progress bar.
   ================================================================ */
.player-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr auto;
  height: 100vh;
  overflow: hidden;
}

.player-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
}

.player-sidebar {
  grid-column: 1;
  grid-row: 2 / -1;
  background: var(--bg-panel);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
}

.player-content {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  padding: var(--space-8);
  background: var(--bg-deep);
}

.player-content-fullscreen {
  grid-column: 1 / -1;
}

/* Video container */
.player-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.player-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Bottom progress bar (course-level) */
.player-progress {
  grid-column: 1 / -1;
  grid-row: 3;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.player-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
  transition: width var(--transition-slow);
}

/* Lesson info area */
.player-lesson-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
}

.player-lesson-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.player-lesson-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-4);
}


/* ================================================================
   22. LAB ENVIRONMENT LAYOUT
   Full-screen with toolbar, canvas area, output panel.
   ================================================================ */
.lab-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 48px 1fr 200px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-deep);
}

/* Lab toolbar across the top */
.lab-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--glass-border);
}

.lab-toolbar-title {
  font-size: var(--text-sm);
  font-weight: 600;
  flex: 1;
}

.lab-toolbar-actions {
  display: flex;
  gap: var(--space-2);
}

/* Editor / canvas area */
.lab-editor {
  grid-column: 1;
  grid-row: 2;
  overflow: auto;
  background: var(--bg-code);
  border-right: 1px solid var(--glass-border);
}

/* Preview / canvas area */
.lab-canvas {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  background: var(--bg-deep);
  position: relative;
}

/* Output panel at bottom */
.lab-output {
  grid-column: 1 / -1;
  grid-row: 3;
  background: var(--bg-code);
  border-top: 1px solid var(--glass-border);
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-code);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.lab-output-line {
  padding: 2px 0;
  display: flex;
  gap: var(--space-3);
}

.lab-output-line.error { color: var(--accent-red); }
.lab-output-line.success { color: var(--accent-green); }
.lab-output-line.info { color: var(--accent-blue); }

.lab-output-timestamp {
  color: var(--text-muted);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

/* Lab status bar */
.lab-status {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--glass-border);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Full-width editor (no split) */
.lab-layout-single {
  grid-template-columns: 1fr;
}

.lab-layout-single .lab-editor {
  grid-column: 1 / -1;
  border-right: none;
}


/* ================================================================
   23. LEADERBOARD
   ================================================================ */
.leaderboard {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--glass-border);
}

.leaderboard-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition-fast);
}

.leaderboard-row:hover {
  background: rgba(var(--accent-blue-rgb), 0.04);
}

/* Top 3 podium highlights */
.leaderboard-row.rank-1 {
  background: rgba(255, 215, 0, 0.05);
  border-left: 3px solid #FFD700;
}

.leaderboard-row.rank-2 {
  background: rgba(192, 192, 192, 0.04);
  border-left: 3px solid #C0C0C0;
}

.leaderboard-row.rank-3 {
  background: rgba(205, 127, 50, 0.04);
  border-left: 3px solid #CD7F32;
}

/* Current user highlight */
.leaderboard-row.current-user {
  background: rgba(var(--accent-blue-rgb), 0.08);
  border-left: 3px solid var(--accent-blue);
}

.leaderboard-rank {
  width: 32px;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-rank.gold   { color: #FFD700; }
.leaderboard-rank.silver { color: #C0C0C0; }
.leaderboard-rank.bronze { color: #CD7F32; }

.leaderboard-user {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.leaderboard-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.leaderboard-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.leaderboard-score {
  font-family: var(--font-code);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-green);
}


/* ================================================================
   24. DASHBOARD GRID & STAT CARDS
   ================================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

/* Stat card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition-med);
}

.stat-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-blue);
  transform: translateY(-2px);
}

.stat-card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.stat-card-change {
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.stat-card-change.positive { color: var(--accent-green); }
.stat-card-change.negative { color: var(--accent-red); }

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: var(--space-2);
}

/* Dashboard section */
.dashboard-section {
  margin-bottom: var(--space-8);
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.dashboard-section-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

/* Two-column dashboard layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-6);
}

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}


/* ================================================================
   25. CIRCUIT BOARD TEXTURE OVERLAY
   Decorative background pattern suggesting technology.
   ================================================================ */
.circuit-overlay {
  position: relative;
}

.circuit-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(var(--accent-blue-rgb), 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(var(--accent-purple-rgb), 0.03) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* Grid pattern variant */
.circuit-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--accent-blue-rgb), 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-blue-rgb), 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Dot pattern variant */
.circuit-dots::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(var(--accent-blue-rgb), 0.08) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

/* Body-level ambient glow (applied by default) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(var(--accent-blue-rgb), 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(var(--accent-purple-rgb), 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}


/* ================================================================
   26. HERO SECTION (Landing Page)
   ================================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(var(--accent-blue-rgb), 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(var(--accent-purple-rgb), 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 90%, rgba(var(--accent-green-rgb), 0.04) 0%, transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-10);
  text-align: center;
}

.hero-kicker {
  font-family: var(--font-code);
  font-size: var(--text-xs);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.hero-kicker::before,
.hero-kicker::after {
  content: '';
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-blue));
}

.hero-kicker::after {
  background: linear-gradient(90deg, var(--accent-blue), transparent);
}

.hero h1 {
  margin-bottom: var(--space-6);
  font-weight: 800;
}

.hero-sub {
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto var(--space-10);
  line-height: var(--leading-relaxed);
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  margin-top: var(--space-16);
  flex-wrap: wrap;
}

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

.hero-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--accent-blue);
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: var(--space-1);
}


/* ================================================================
   27. PRICING CARDS
   ================================================================ */
.pricing-card {
  background: var(--bg-card);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  transition: all var(--transition-med);
  position: relative;
}

.pricing-card.featured {
  border-color: var(--accent-blue);
  box-shadow: 0 0 60px rgba(var(--accent-blue-rgb), 0.15);
  transform: scale(1.03);
}

.pricing-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  font-family: var(--font-code);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  border-radius: var(--radius-full);
}

.pricing-tier {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  margin: var(--space-5) 0;
}

.pricing-price span {
  font-size: var(--text-md);
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin: var(--space-8) 0;
}

.pricing-features li {
  padding: var(--space-2) 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pricing-features li::before {
  content: '\2713';
  color: var(--accent-green);
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.pricing-features li.disabled {
  color: var(--text-muted);
  text-decoration: line-through;
}

.pricing-features li.disabled::before {
  content: '\2715';
  color: var(--text-muted);
}


/* ================================================================
   28. FOOTER
   ================================================================ */
.footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--glass-border);
  padding: var(--space-12) var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-8);
  max-width: var(--container-w);
  margin: 0 auto;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.footer-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 300px;
  line-height: var(--leading-normal);
}

.footer-heading {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-w);
  margin-left: auto;
  margin-right: auto;
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer-socials {
  display: flex;
  gap: var(--space-4);
}

.footer-socials a {
  color: var(--text-muted);
  font-size: 18px;
  transition: color var(--transition-fast);
}

.footer-socials a:hover {
  color: var(--accent-blue);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
}


/* ================================================================
   29. LOADING / SHIMMER STATES
   ================================================================ */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

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

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-4);
  z-index: var(--z-modal);
}

.loading-text {
  font-family: var(--font-code);
  font-size: var(--text-sm);
  color: var(--text-muted);
  animation: loading-blink 1.2s ease-in-out infinite;
}

@keyframes loading-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Skeleton placeholders */
.skeleton {
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton-heading {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  width: 100%;
}

/* Pulse dot (AI active indicator) */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent-green);
  opacity: 0;
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.5); }
}


/* ================================================================
   30. SCROLLBAR CUSTOMIZATION
   Dark themed thin scrollbar.
   ================================================================ */
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-panel);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-corner {
  background: var(--bg-panel);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) var(--bg-panel);
}

/* Thin scrollbar variant */
.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

/* Hidden scrollbar (still scrollable) */
.scrollbar-hidden::-webkit-scrollbar {
  display: none;
}

.scrollbar-hidden {
  scrollbar-width: none;
}


/* ================================================================
   31. SELECTION HIGHLIGHTING
   ================================================================ */
::selection {
  background: rgba(var(--accent-blue-rgb), 0.3);
  color: white;
}

::-moz-selection {
  background: rgba(var(--accent-blue-rgb), 0.3);
  color: white;
}


/* ================================================================
   32. RESPONSIVE BREAKPOINTS
   Mobile (< 768px), Tablet (768-1024px), Desktop (> 1024px)
   ================================================================ */

/* --- Tablet: 768px - 1024px --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  .main-content.with-tutor {
    margin-right: 0;
  }

  .ai-tutor-panel {
    width: 100%;
    max-width: 400px;
    transform: translateX(100%);
  }

  .ai-tutor-panel.open {
    transform: translateX(0);
  }

  .player-layout {
    grid-template-columns: 1fr;
  }

  .player-sidebar {
    position: fixed;
    width: var(--sidebar-w);
    z-index: var(--z-sidebar);
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform var(--transition-med);
  }

  .player-sidebar.open {
    transform: translateX(0);
  }

  .lab-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 48px 1fr 1fr 200px;
  }

  .lab-editor {
    grid-column: 1;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }

  .lab-canvas {
    grid-column: 1;
  }

  .hide-tablet { display: none !important; }
}

/* --- Mobile: < 768px --- */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --tutor-w: 100%;
    --space-8: 24px;
    --space-10: 32px;
    --space-12: 40px;
    --space-16: 48px;
    --space-20: 60px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .container,
  .container-narrow,
  .container-wide {
    padding: 0 var(--space-4);
  }

  /* Sidebar */
  .sidebar {
    transform: translateX(-280px);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content */
  .main-content {
    margin-left: 0;
    padding: var(--space-5);
  }

  /* Topbar */
  .topbar-nav { display: none; }
  .topbar-center { display: none; }

  .topbar {
    padding: 0 var(--space-4);
  }

  /* Hero */
  .hero-content {
    padding: 0 var(--space-5);
  }

  .hero-stats {
    gap: var(--space-6);
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  /* Dashboard */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  /* Player */
  .player-layout {
    grid-template-columns: 1fr;
  }

  .player-content {
    padding: var(--space-4);
  }

  /* Lab */
  .lab-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 48px 300px 300px 200px;
  }

  /* Pricing */
  .pricing-card.featured {
    transform: none;
  }

  /* Modal */
  .modal-panel {
    max-width: 100%;
    max-height: 100vh;
    border-radius: var(--radius-lg);
    margin: var(--space-4);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
  }

  /* Tables: horizontal scroll */
  .table-wrapper {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .hide-mobile { display: none !important; }
}

/* --- Large desktop: > 1440px --- */
@media (min-width: 1440px) {
  .container-wide {
    max-width: 1600px;
  }
}

/* Responsive visibility helpers */
.show-mobile  { display: none !important; }
.show-tablet  { display: none !important; }

@media (max-width: 768px) {
  .show-mobile { display: block !important; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .show-tablet { display: block !important; }
}


/* ================================================================
   33. PRINT STYLES
   ================================================================ */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    background: white !important;
  }

  body::before { display: none; }

  .topbar,
  .sidebar,
  .ai-tutor-panel,
  .ai-tutor-toggle,
  .toast-container,
  .modal-backdrop,
  .btn,
  .footer,
  .player-progress {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  a {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: '';
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  h2, h3 {
    page-break-after: avoid;
  }

  pre, blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  .code-block {
    border: 1px solid #ccc;
    padding: 8px;
  }

  table {
    border-collapse: collapse;
  }

  table td, table th {
    border: 1px solid #ccc;
    padding: 4px 8px;
  }

  @page {
    margin: 2cm;
  }
}


/* ================================================================
   34. HIGH CONTRAST MODE
   Toggled via .high-contrast class on <html> or <body>.
   ================================================================ */
.high-contrast {
  --bg-deep:       #000000;
  --bg-panel:      #0A0A0A;
  --bg-card:       #111111;
  --bg-code:       #000000;
  --bg-input:      #1A1A1A;

  --accent-blue:   #33CCFF;
  --accent-purple: #BB88FF;
  --accent-green:  #33FF99;
  --accent-amber:  #FFCC66;
  --accent-red:    #FF6688;

  --text-primary:  #FFFFFF;
  --text-secondary:#D0D0D0;
  --text-muted:    #808080;

  --glass-border:  rgba(255, 255, 255, 0.15);
  --border-glow:   rgba(51, 204, 255, 0.5);
}

.high-contrast .card,
.high-contrast .glass,
.high-contrast .card-glass {
  border-width: 2px;
}

.high-contrast .btn {
  font-weight: 700;
}

.high-contrast a {
  text-decoration: underline;
  text-underline-offset: 2px;
}


/* ================================================================
   35. WCAG FOCUS-VISIBLE STYLES
   Custom focus indicators for keyboard navigation.
   ================================================================ */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Specific focus styles for interactive elements */
.btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(var(--accent-blue-rgb), 0.2);
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(var(--accent-blue-rgb), 0.2);
}

.tab:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -2px;
}

.sidebar-item:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -2px;
}

.card:focus-visible,
.card-glass:focus-visible,
.card-glow:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Skip navigation link (WCAG requirement) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--accent-blue);
  color: white;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 10000;
  transition: top var(--transition-fast);
}

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

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .progress-fill::after {
    animation: none;
  }
}


/* ================================================================
   36. DISPLAY, COLOR & OVERFLOW UTILITIES
   ================================================================ */

/* Display */
.block        { display: block; }
.inline-block { display: inline-block; }
.inline       { display: inline; }

/* Overflow */
.overflow-hidden  { overflow: hidden; }
.overflow-auto    { overflow: auto; }
.overflow-x-auto  { overflow-x: auto; }
.overflow-y-auto  { overflow-y: auto; }
.truncate         { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text colors */
.text-white     { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-blue      { color: var(--accent-blue); }
.text-purple    { color: var(--accent-purple); }
.text-green     { color: var(--accent-green); }
.text-amber     { color: var(--accent-amber); }
.text-red       { color: var(--accent-red); }

/* Background colors */
.bg-deep    { background: var(--bg-deep); }
.bg-panel   { background: var(--bg-panel); }
.bg-card    { background: var(--bg-card); }
.bg-code    { background: var(--bg-code); }

/* Width / Height */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.w-auto  { width: auto; }
.h-auto  { height: auto; }
.min-h-screen { min-height: 100vh; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; top: 0; }
.inset-0  { inset: 0; }

/* Border */
.border      { border: 1px solid var(--glass-border); }
.border-none { border: none; }
.rounded-sm  { border-radius: var(--radius-sm); }
.rounded-md  { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-xl  { border-radius: var(--radius-xl); }
.rounded-full{ border-radius: var(--radius-full); }

/* Opacity */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Pointer events */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* User select */
.select-none { user-select: none; }
.select-all  { user-select: all; }

/* Whitespace */
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre    { white-space: pre; }

/* Z-index helpers */
.z-0    { z-index: 0; }
.z-10   { z-index: 10; }
.z-20   { z-index: 20; }
.z-50   { z-index: 50; }
.z-auto { z-index: auto; }

/* Font weight */
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold{ font-weight: 800; }

/* Line height */
.leading-tight   { line-height: var(--leading-tight); }
.leading-normal  { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* Letter spacing */
.tracking-tight { letter-spacing: -0.02em; }
.tracking-normal{ letter-spacing: 0; }
.tracking-wide  { letter-spacing: 0.05em; }

/* Transform helpers */
.translate-y-0  { transform: translateY(0); }
.scale-100      { transform: scale(1); }
.transition-all { transition: all var(--transition-med); }
.transition-fast{ transition: all var(--transition-fast); }

/* Aspect ratio */
.aspect-video  { aspect-ratio: 16 / 9; }
.aspect-square { aspect-ratio: 1 / 1; }

/* ─────────────────────────────────────────────────────────────────────
   Wave 3 (2026-05-14) — AICS Neon Purple theme
   Adds a `body.theme-neon-purple` opt-in class for the standalone SPA.
   The base CSS variables above (--accent-purple, --shadow-purple, etc.)
   were already updated to #7c3aed — this section adds the canvas
   particle styling + a few neon-purple accents on landing/dashboard.
───────────────────────────────────────────────────────────────────── */

body.theme-neon-purple {
  background:
    radial-gradient(circle at 20% 10%, rgba(124, 58, 237, 0.12), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.10), transparent 60%),
    var(--bg-deep);
}

#aicsp-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body.theme-neon-purple .hero h1,
body.theme-neon-purple .landing-hero h1 {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-violet));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  text-shadow: 0 0 30px rgba(124, 58, 237, 0.25);
}

body.theme-neon-purple .btn-primary,
body.theme-neon-purple .cta-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-violet));
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.32);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

body.theme-neon-purple .btn-primary:hover,
body.theme-neon-purple .cta-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(124, 58, 237, 0.45);
}

body.theme-neon-purple a:hover {
  color: var(--accent-violet);
  text-shadow: 0 0 12px var(--neon-violet-glow);
}

/* Honour prefers-reduced-motion — canvas-side checks the same and stops
   animation; CSS-side disables transitions + glow on bumpers. */
@media (prefers-reduced-motion: reduce) {
  body.theme-neon-purple .btn-primary,
  body.theme-neon-purple .cta-primary {
    transition: none;
  }
  body.theme-neon-purple a:hover {
    text-shadow: none;
  }
  #aicsp-particles { display: none; }
}

/* ── Concept Teaching Core Concept: rendered Markdown tables ──────────────
   Comparison/mapping tables emitted by course-runtime.js renderCoreConcept().
   Responsive (horizontal scroll on small screens rather than clipping),
   accessible (semantic thead/th scope, sufficient contrast). */
.lesson-core-concept .table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: var(--space-5, 1rem) 0;
  -webkit-overflow-scrolling: touch;
}
.lesson-core-concept table.lesson-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm, 0.9rem);
  line-height: var(--leading-relaxed, 1.6);
}
.lesson-core-concept table.lesson-table th,
.lesson-core-concept table.lesson-table td {
  border: 1px solid var(--glass-border, #d0d7de);
  padding: var(--space-3, 0.5rem) var(--space-4, 0.75rem);
  text-align: left;
  vertical-align: top;
}
.lesson-core-concept table.lesson-table thead th {
  background: var(--surface-2, #f1f5f9);
  color: var(--text-primary, #111);
  font-weight: 600;
}
.lesson-core-concept table.lesson-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 45%, transparent);
}
.lesson-core-concept table.lesson-table code {
  white-space: nowrap;
}
