Skip to content
TheChatArchiveThe Chat Archive
GLMGLM-5 / Pony Alpha· unknownHugging Face Frontier Reasoning Traces

Build a comprehensive curriculum map visualizer: prereq graphs, bottleneck alerts, and…

  1. User

    Build a comprehensive curriculum map visualizer: prereq graphs, bottleneck alerts, and progression simulations.

  2. GLM Assistant

    The user wants a comprehensive curriculum map visualizer with:

    1. Prerequisite graphs - showing course dependencies
    2. Bottleneck alerts - identifying courses that many students get stuck on
    3. Progression simulations - simulating student progress through the curriculum

    This is a complex educational tool. Let me design something visually striking and functional.

    Design Direction:

    • Technical/academic aesthetic - clean but with depth
    • Dark theme with accent colors for different course categories
    • Interactive graph visualization
    • Multiple panels for different views

    Features to implement:

    1. Interactive prerequisite graph with nodes and edges
    2. Course details panel
    3. Bottleneck analysis with visual indicators
    4. Progression simulator - step through semesters
    5. Search/filter functionality

    Technical approach:

    • Canvas for the graph visualization (better performance)
    • CSS for UI panels
    • JavaScript for interactivity and simulation logic

    Let me create a cohesive design:

    • Font: Space Grotesk (technical/modern) + JetBrains Mono for data
    • Colors: Dark base with cyan/teal accent, warning colors for bottlenecks
    • Layout: Split view with main graph, side panels for details/simulation

    Let me build this comprehensive tool.

    Curriculum Map Visualizer

    A powerful tool for visualizing course prerequisites, identifying bottleneck courses, and simulating student progression through academic programs.

    Design Approach

    • Technical/Academic Aesthetic: Dark theme with cyan accents
    • Interactive Graph: Drag nodes, click for details, zoom/pan
    • Three Analysis Modes: Prerequisites, Bottlenecks, Simulation
    • Real-time Simulation: Watch virtual students progress through the curriculum
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Curriculum Map Visualizer</title>
      <script src="https://cdn.tailwindcss.com"></script>
      <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
      <style>
        :root {
          --bg: #0a0f14;
          --bg-secondary: #111920;
          --bg-tertiary: #1a242d;
          --fg: #e8eef4;
          --fg-muted: #7a8a9a;
          --accent: #00d4aa;
          --accent-dim: rgba(0, 212, 170, 0.15);
          --warning: #ff6b4a;
          --warning-dim: rgba(255, 107, 74, 0.15);
          --info: #4a9eff;
          --info-dim: rgba(74, 158, 255, 0.15);
          --success: #4aff91;
          --card: #141c24;
          --border: #2a3642;
          --glow: rgba(0, 212, 170, 0.4);
        }
    
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
    
        body {
          font-family: 'Space Grotesk', sans-serif;
          background: var(--bg);
          color: var(--fg);
          min-height: 100vh;
          overflow-x: hidden;
        }
    
        .mono {
          font-family: 'JetBrains Mono', monospace;
        }
    
        /* Background pattern */
        .bg-pattern {
          position: fixed;
          inset: 0;
          background-image: 
            radial-gradient(circle at 20% 30%, rgba(0, 212, 170, 0.05) 0%, transparent 40%),
            radial-gradient(circle at 80% 70%, rgba(74, 158, 255, 0.05) 0%, transparent 40%),
            linear-gradient(var(--bg) 1px, transparent 1px),
            linear-gradient(90deg, var(--bg) 1px, transparent 1px);
          background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
          background-position: 0 0, 0 0, -1px -1px, -1px -1px;
          opacity: 0.5;
          pointer-events: none;
          z-index: 0;
        }
    
        .bg-pattern::before {
          content: '';
          position: absolute;
          inset: 0;
          background: 
            linear-gradient(180deg, transparent 0%, var(--bg) 100%);
        }
    
        /* Canvas styles */
        #graphCanvas {
          cursor: grab;
        }
    
        #graphCanvas:active {
          cursor: grabbing;
        }
    
        /* Custom scrollbar */
        ::-webkit-scrollbar {
          width: 6px;
          height: 6px;
        }
    
        ::-webkit-scrollbar-track {
          background: var(--bg-secondary);
        }
    
        ::-webkit-scrollbar-thumb {
          background: var(--border);
          border-radius: 3px;
        }
    
        ::-webkit-scrollbar-thumb:hover {
          background: var(--fg-muted);
        }
    
        /* Animations */
        @keyframes fadeIn {
          from { opacity: 0; transform: translateY(10px); }
          to { opacity: 1; transform: translateY(0); }
        }
    
        @keyframes pulse {
          0%, 100% { opacity: 1; }
          50% { opacity: 0.5; }
        }
    
        @keyframes slideIn {
          from { opacity: 0; transform: translateX(20px); }
          to { opacity: 1; transform: translateX(0); }
        }
    
        .animate-fade-in {
          animation: fadeIn 0.4s ease-out forwards;
        }
    
        .animate-slide-in {
          animation: slideIn 0.3s ease-out forwards;
        }
    
        .animate-pulse {
          animation: pulse 2s ease-in-out infinite;
        }
    
        /* Tab styles */
        .tab-btn {
          position: relative;
          padding: 0.75rem 1.25rem;
          color: var(--fg-muted);
          font-weight: 500;
          transition: color 0.2s;
          border-bottom: 2px solid transparent;
        }
    
        .tab-btn:hover {
          color: var(--fg);
        }
    
        .tab-btn.active {
          color: var(--accent);
          border-bottom-color: var(--accent);
        }
    
        /* Course node tooltip */
        .tooltip {
          position: absolute;
          background: var(--card);
          border: 1px solid var(--border);
          border-radius: 8px;
          padding: 12px 16px;
          pointer-events: none;
          z-index: 100;
          box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
          max-width: 280px;
        }
    
        /* Progress bar */
        .progress-bar {
          height: 8px;
          background: var(--bg-tertiary);
          border-radius: 4px;
          overflow: hidden;
        }
    
        .progress-fill {
          height: 100%;
          border-radius: 4px;
          transition: width 0.5s ease-out;
        }
    
        /* Bottleneck indicator */
        .bottleneck-high {
          background: var(--warning-dim);
          border-left: 3px solid var(--warning);
        }
    
        .bottleneck-medium {
          background: rgba(255, 187, 74, 0.15);
          border-left: 3px solid #ffbb4a;
        }
    
        /* Responsive */
        @media (max-width: 1024px) {
          .sidebar {
            position: fixed;
            right: -100%;
            top: 0;
            height: 100vh;
            z-index: 50;
            transition: right 0.3s ease;
          }
    
          .sidebar.open {
            right: 0;
          }
        }
    
        /* Reduced motion */
        @media (prefers-reduced-motion: reduce) {
          *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
          }
        }
      </style>
    </head>
    <body>
      <div class="bg-pattern"></div>
      
      <div class="relative z-10 min-h-screen flex flex-col">
        <!-- Header -->
        <header class="border-b border-[--border] bg-[--bg-secondary]/80 backdrop-blur-sm sticky top-0 z-40">
          <div class="max-w-[1800px] mx-auto px-4 sm:px-6 py-4 flex items-center justify-between">
            <div class="flex items-center gap-4">
              <div class="w-10 h-10 rounded-lg bg-[--accent-dim] flex items-center justify-center">
                <svg class="w-6 h-6 text-[--accent]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
                </svg>
              </div>
              <div>
                <h1 class="text-lg sm:text-xl font-semibold tracking-tight">Curriculum Map</h1>
                <p class="text-xs text-[--fg-muted] hidden sm:block">Prerequisite Analysis & Progression Simulator</p>
              </div>
            </div>
    
            <div class="flex items-center gap-3">
              <!-- Program Selector -->
              <select id="programSelect" class="bg-[--bg-tertiary] border border-[--border] rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-[--accent]">
                <option value="cs">Computer Science B.S.</option>
                <option value="math">Mathematics B.S.</option>
                <option value="physics">Physics B.S.</option>
              </select>
    
              <!-- Mobile menu toggle -->
              <button id="sidebarToggle" class="lg:hidden p-2 rounded-lg bg-[--bg-tertiary] border border-[--border]">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7"/>
                </svg>
              </button>
            </div>
          </div>
    
          <!-- Tabs -->
          <div class="max-w-[1800px] mx-auto px-4 sm:px-6 flex gap-1 overflow-x-auto">
            <button class="tab-btn active" data-tab="graph">
              <span class="flex items-center gap-2">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
                </svg>
                Prerequisites
              </span>
            </button>
            <button class="tab-btn" data-tab="bottlenecks">
              <span class="flex items-center gap-2">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
                </svg>
                Bottlenecks
              </span>
            </button>
            <button class="tab-btn" data-tab="simulation">
              <span class="flex items-center gap-2">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/>
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
                </svg>
                Simulation
              </span>
            </button>
          </div>
        </header>
    
        <!-- Main Content -->
        <main class="flex-1 flex">
          <!-- Graph Area -->
          <div class="flex-1 relative">
            <!-- Canvas Container -->
            <div id="canvasContainer" class="w-full h-full min-h-[600px] relative">
              <canvas id="graphCanvas"></canvas>
              
              <!-- Graph Controls -->
              <div class="absolute bottom-4 left-4 flex flex-col gap-2">
                <button id="zoomIn" class="w-10 h-10 rounded-lg bg-[--card] border border-[--border] flex items-center justify-center hover:border-[--accent] transition-colors" aria-label="Zoom in">
                  <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
                  </svg>
                </button>
                <button id="zoomOut" class="w-10 h-10 rounded-lg bg-[--card] border border-[--border] flex items-center justify-center hover:border-[--accent] transition-colors" aria-label="Zoom out">
                  <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4"/>
                  </svg>
                </button>
                <button id="resetView" class="w-10 h-10 rounded-lg bg-[--card] border border-[--border] flex items-center justify-center hover:border-[--accent] transition-colors" aria-label="Reset view">
                  <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/>
                  </svg>
                </button>
              </div>
    
              <!-- Legend -->
              <div class="absolute top-4 left-4 bg-[--card]/90 backdrop-blur-sm border border-[--border] rounded-lg p-3 text-xs">
                <p class="text-[--fg-muted] mb-2 font-medium">Course Levels</p>
                <div class="flex flex-col gap-1.5">
                  <div class="flex items-center gap-2">
                    <span class="w-3 h-3 rounded-full bg-[#00d4aa]"></span>
                    <span>100-Level (Freshman)</span>
                  </div>
                  <div class="flex items-center gap-2">
                    <span class="w-3 h-3 rounded-full bg-[#4a9eff]"></span>
                    <span>200-Level (Sophomore)</span>
                  </div>
                  <div class="flex items-center gap-2">
                    <span class="w-3 h-3 rounded-full bg-[#a855f7]"></span>
                    <span>300-Level (Junior)</span>
                  </div>
                  <div class="flex items-center gap-2">
                    <span class="w-3 h-3 rounded-full bg-[#ff6b4a]"></span>
                    <span>400-Level (Senior)</span>
                  </div>
                </div>
              </div>
    
              <!-- Stats Overlay -->
              <div id="statsOverlay" class="absolute top-4 right-4 bg-[--card]/90 backdrop-blur-sm border border-[--border] rounded-lg p-4 text-sm hidden lg:block">
                <div class="grid grid-cols-2 gap-4">
                  <div>
                    <p class="text-[--fg-muted] text-xs">Total Courses</p>
                    <p id="totalCourses" class="text-xl font-semibold mono text-[--accent]">--</p>
                  </div>
                  <div>
                    <p class="text-[--fg-muted] text-xs">Prerequisites</p>
                    <p id="totalPrereqs" class="text-xl font-semibold mono text-[--info]">--</p>
                  </div>
                  <div>
                    <p class="text-[--fg-muted] text-xs">Avg. Path Length</p>
                    <p id="avgPathLength" class="text-xl font-semibold mono">--</p>
                  </div>
                  <div>
                    <p class="text-[--fg-muted] text-xs">Critical Path</p>
                    <p id="criticalPath" class="text-xl font-semibold mono text-[--warning]">--</p>
                  </div>
                </div>
              </div>
            </div>
    
            <!-- Bottlenecks Panel -->
            <div id="bottlenecksPanel" class="absolute inset-0 bg-[--bg] overflow-auto hidden">
              <div class="p-4 sm:p-6 max-w-4xl mx-auto">
                <h2 class="text-2xl font-semibold mb-2">Curriculum Bottlenecks</h2>
                <p class="text-[--fg-muted] mb-6">Courses with high failure rates or that block significant progression paths</p>
                
                <div id="bottlenecksList" class="space-y-3">
                  <!-- Dynamically populated -->
                </div>
              </div>
            </div>
    
            <!-- Simulation Panel -->
            <div id="simulationPanel" class="absolute inset-0 bg-[--bg] overflow-auto hidden">
              <div class="p-4 sm:p-6 max-w-5xl mx-auto">
                <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6">
                  <div>
                    <h2 class="text-2xl font-semibold mb-1">Progression Simulation</h2>
                    <p class="text-[--fg-muted]">Simulate student progress through the curriculum</p>
                  </div>
                  <div class="flex items-center gap-3">
                    <button id="startSim" class="px-4 py-2 bg-[--accent] text-[--bg] rounded-lg font-medium hover:opacity-90 transition-opacity flex items-center gap-2">
                      <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/>
                      </svg>
                      Start Simulation
                    </button>
                    <button id="resetSim" class="px-4 py-2 bg-[--bg-tertiary] border border-[--border] rounded-lg font-medium hover:border-[--accent] transition-colors">
                      Reset
                    </button>
                  </div>
                </div>
    
                <!-- Simulation Controls -->
                <div class="grid grid-cols-1 sm:grid-cols-3 gap-4 mb-6">
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4">
                    <label class="text-xs text-[--fg-muted] block mb-2">Students per Cohort</label>
                    <input type="range" id="cohortSize" min="10" max="200" value="100" class="w-full">
                    <div class="flex justify-between text-xs mt-1">
                      <span class="text-[--fg-muted]">10</span>
                      <span id="cohortValue" class="text-[--accent] mono">100</span>
                      <span class="text-[--fg-muted]">200</span>
                    </div>
                  </div>
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4">
                    <label class="text-xs text-[--fg-muted] block mb-2">Pass Rate Modifier</label>
                    <input type="range" id="passRateMod" min="0.7" max="1.0" step="0.05" value="0.85" class="w-full">
                    <div class="flex justify-between text-xs mt-1">
                      <span class="text-[--fg-muted]">70%</span>
                      <span id="passRateValue" class="text-[--accent] mono">85%</span>
                      <span class="text-[--fg-muted]">100%</span>
                    </div>
                  </div>
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4">
                    <label class="text-xs text-[--fg-muted] block mb-2">Simulation Speed</label>
                    <input type="range" id="simSpeed" min="100" max="1000" step="100" value="500" class="w-full">
                    <div class="flex justify-between text-xs mt-1">
                      <span class="text-[--fg-muted]">Fast</span>
                      <span id="speedValue" class="text-[--accent] mono">500ms</span>
                      <span class="text-[--fg-muted]">Slow</span>
                    </div>
                  </div>
                </div>
    
                <!-- Semester Progress -->
                <div class="bg-[--card] border border-[--border] rounded-lg p-4 mb-6">
                  <div class="flex items-center justify-between mb-3">
                    <h3 class="font-medium">Semester Progress</h3>
                    <span id="currentSemester" class="mono text-[--accent]">Semester 0</span>
                  </div>
                  <div class="progress-bar mb-2">
                    <div id="semesterProgress" class="progress-fill bg-[--accent]" style="width: 0%"></div>
                  </div>
                  <div class="flex justify-between text-xs text-[--fg-muted]">
                    <span>Freshman</span>
                    <span>Sophomore</span>
                    <span>Junior</span>
                    <span>Senior</span>
                    <span>Graduate</span>
                  </div>
                </div>
    
                <!-- Statistics Grid -->
                <div class="grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6">
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4 text-center">
                    <p class="text-2xl font-bold mono text-[--accent]" id="activeStudents">0</p>
                    <p class="text-xs text-[--fg-muted]">Active Students</p>
                  </div>
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4 text-center">
                    <p class="text-2xl font-bold mono text-[--success]" id="graduatedStudents">0</p>
                    <p class="text-xs text-[--fg-muted]">Graduated</p>
                  </div>
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4 text-center">
                    <p class="text-2xl font-bold mono text-[--warning]" id="droppedStudents">0</p>
                    <p class="text-xs text-[--fg-muted]">Dropped</p>
                  </div>
                  <div class="bg-[--card] border border-[--border] rounded-lg p-4 text-center">
                    <p class="text-2xl font-bold mono text-[--info]" id="avgCredits">0</p>
                    <p class="text-xs text-[--fg-muted]">Avg Credits</p>
                  </div>
                </div>
    
                <!-- Course Enrollment Chart -->
                <div class="bg-[--card] border border-[--border] rounded-lg p-4">
                  <h3 class="font-medium mb-4">Course Enrollment Distribution</h3>
                  <div id="enrollmentChart" class="h-64 flex items-end gap-1 overflow-x-auto pb-2">
                    <!-- Dynamically populated -->
                  </div>
                </div>
              </div>
            </div>
          </div>
    
          <!-- Sidebar -->
          <aside id="sidebar" class="sidebar w-80 lg:w-96 bg-[--bg-secondary] border-l border-[--border] flex flex-col">
            <!-- Search -->
            <div class="p-4 border-b border-[--border]">
              <div class="relative">
                <svg class="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-[--fg-muted]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
                </svg>
                <input type="text" id="courseSearch" placeholder="Search courses..." class="w-full pl-10 pr-4 py-2.5 bg-[--bg-tertiary] border border-[--border] rounded-lg text-sm focus:outline-none focus:border-[--accent]">
              </div>
            </div>
    
            <!-- Course Details -->
            <div id="courseDetails" class="p-4 border-b border-[--border] hidden animate-slide-in">
              <div class="flex items-start justify-between mb-3">
                <div>
                  <h3 id="courseCode" class="font-semibold text-lg"></h3>
                  <p id="courseName" class="text-sm text-[--fg-muted]"></p>
                </div>
                <span id="courseLevel" class="px-2 py-1 rounded text-xs font-medium"></span>
              </div>
              
              <div class="space-y-3">
                <div>
                  <p class="text-xs text-[--fg-muted] mb-1">Credits</p>
                  <p id="courseCredits" class="mono font-medium"></p>
                </div>
                <div>
                  <p class="text-xs text-[--fg-muted] mb-1">Prerequisites</p>
                  <div id="coursePrereqs" class="flex flex-wrap gap-1"></div>
                </div>
                <div>
                  <p class="text-xs text-[--fg-muted] mb-1">Unlocks</p>
                  <div id="courseUnlocks" class="flex flex-wrap gap-1"></div>
                </div>
                <div class="pt-2 border-t border-[--border]">
                  <div class="flex justify-between text-sm mb-2">
                    <span class="text-[--fg-muted]">Pass Rate</span>
                    <span id="coursePassRate" class="mono font-medium"></span>
                  </div>
                  <div class="progress-bar">
                    <div id="passRateBar" class="progress-fill bg-[--accent]" style="width: 0%"></div>
                  </div>
                </div>
                <div>
                  <p class="text-xs text-[--fg-muted] mb-1">Description</p>
                  <p id="courseDesc" class="text-sm leading-relaxed"></p>
                </div>
              </div>
            </div>
    
            <!-- Course List -->
            <div class="flex-1 overflow-auto">
              <div class="p-4">
                <h4 class="text-sm font-medium text-[--fg-muted] mb-3">All Courses</h4>
                <div id="courseList" class="space-y-2">
                  <!-- Dynamically populated -->
                </div>
              </div>
            </div>
          </aside>
        </main>
      </div>
    
      <!-- Tooltip -->
      <div id="tooltip" class="tooltip hidden"></div>
    
      <script>
        // ==================== DATA ====================
        const curriculumData = {
          cs: {
            name: "Computer Science B.S.",
            courses: [
              { id: "cs101", code: "CS 101", name: "Introduction to Programming", level: 100, credits: 4, prereqs: [], passRate: 0.92, desc: "Fundamental concepts of programming using Python. Variables, control structures, functions, and basic data structures." },
              { id: "cs102", code: "CS 102", name: "Object-Oriented Programming", level: 100, credits: 4, prereqs: ["cs101"], passRate: 0.85, desc: "Object-oriented programming principles using Java. Classes, inheritance, polymorphism, and interfaces." },
              { id: "cs201", code: "CS 201", name: "Data Structures", level: 200, credits: 4, prereqs: ["cs102"], passRate: 0.72, desc: "Advanced data structures including trees, graphs, hash tables, and heaps. Algorithm analysis and Big-O notation." },
              { id: "cs202", code: "CS 202", name: "Computer Architecture", level: 200, credits: 3, prereqs: ["cs102"], passRate: 0.78, desc: "Computer organization, CPU design, memory hierarchy, and assembly language programming." },
              { id: "cs203", code: "CS 203", name: "Discrete Mathematics", level: 200, credits: 3, prereqs: ["math101"], passRate: 0.68, desc: "Mathematical foundations for computer science. Logic, sets, relations, combinatorics, and graph theory." },
              { id: "cs301", code: "CS 301", name: "Algorithms", level: 300, credits: 4, prereqs: ["cs201", "cs203"], passRate: 0.65, desc: "Design and analysis of algorithms. Divide and conquer, dynamic programming, greedy algorithms, and NP-completeness." },
              { id: "cs302", code: "CS 302", name: "Operating Systems", level: 300, credits: 4, prereqs: ["cs201", "cs202"], passRate: 0.62, desc: "Process management, memory allocation, file systems, and concurrency. Hands-on kernel development." },
              { id: "cs303", code: "CS 303", name: "Database Systems", level: 300, credits: 3, prereqs: ["cs201"], passRate: 0.82, desc: "Relational database design, SQL, normalization, transactions, and database administration." },
              { id: "cs304", code: "CS 304", name: "Computer Networks", level: 300, credits: 3, prereqs: ["cs202"], passRate: 0.75, desc: "Network protocols, TCP/IP stack, routing algorithms, and network security fundamentals." },
              { id: "cs401", code: "CS 401", name: "Software Engineering", level: 400, credits: 4, prereqs: ["cs301"], passRate: 0.88, desc: "Software development methodologies, testing strategies, version control, and project management." },
              { id: "cs402", code: "CS 402", name: "Machine Learning", level: 400, credits: 4, prereqs: ["cs301", "math201"], passRate: 0.58, desc: "Supervised and unsupervised learning, neural networks, and practical ML applications." },
              { id: "cs403", code: "CS 403", name: "Computer Security", level: 400, credits: 3, prereqs: ["cs302", "cs304"], passRate: 0.70, desc: "Cryptography, authentication, secure coding practices, and vulnerability assessment." },
              { id: "cs404", code: "CS 404", name: "Capstone Project", level: 400, credits: 6, prereqs: ["cs401"], passRate: 0.95, desc: "Senior design project. Team-based software development from conception to deployment." },
              { id: "math101", code: "MATH 151", name: "Calculus I", level: 100, credits: 4, prereqs: [], passRate: 0.75, desc: "Limits, derivatives, integrals, and their applications. Foundation for advanced mathematics." },
              { id: "math102", code: "MATH 152", name: "Calculus II", level: 100, credits: 4, prereqs: ["math101"], passRate: 0.70, desc: "Integration techniques, series, and sequences. Applications in physics and engineering." },
              { id: "math201", code: "MATH 261", name: "Linear Algebra", level: 200, credits: 3, prereqs: ["math102"], passRate: 0.72, desc: "Vector spaces, matrices, eigenvalues, and linear transformations. Essential for ML and graphics." },
              { id: "math202", code: "MATH 311", name: "Probability & Statistics", level: 300, credits: 3, prereqs: ["math102"], passRate: 0.74, desc: "Probability theory, random variables, statistical inference, and hypothesis testing." }
            ]
          },
          math: {
            name: "Mathematics B.S.",
            courses: [
              { id: "math101", code: "MATH 151", name: "Calculus I", level: 100, credits: 4, prereqs: [], passRate: 0.75, desc: "Limits, derivatives, integrals, and their applications." },
              { id: "math102", code: "MATH 152", name: "Calculus II", level: 100, credits: 4, prereqs: ["math101"], passRate: 0.70, desc: "Integration techniques, series, and sequences." },
              { id: "math201", code: "MATH 251", name: "Calculus III", level: 200, credits: 4, prereqs: ["math102"], passRate: 0.68, desc: "Multivariable calculus, partial derivatives, and multiple integrals." },
              { id: "math202", code: "MATH 261", name: "Linear Algebra", level: 200, credits: 3, prereqs: ["math102"], passRate: 0.72, desc: "Vector spaces, matrices, eigenvalues, and linear transformations." },
              { id: "math203", code: "MATH 271", name: "Differential Equations", level: 200, credits: 3, prereqs: ["math102"], passRate: 0.65, desc: "Ordinary differential equations and their applications." },
              { id: "math301", code: "MATH 311", name: "Probability & Statistics", level: 300, credits: 3, prereqs: ["math201"], passRate: 0.74, desc: "Probability theory and statistical inference." },
              { id: "math302", code: "MATH 351", name: "Real Analysis", level: 300, credits: 4, prereqs: ["math201"], passRate: 0.55, desc: "Rigorous treatment of limits, continuity, and integration." },
              { id: "math303", code: "MATH 361", name: "Abstract Algebra", level: 300, credits: 4, prereqs: ["math202"], passRate: 0.58, desc: "Groups, rings, fields, and algebraic structures." },
              { id: "math401", code: "MATH 451", name: "Complex Analysis", level: 400, credits: 4, prereqs: ["math302"], passRate: 0.62, desc: "Functions of complex variables, contour integration." },
              { id: "math402", code: "MATH 461", name: "Topology", level: 400, credits: 4, prereqs: ["math302"], passRate: 0.60, desc: "Topological spaces, continuity, and compactness." },
              { id: "math403", code: "MATH 471", name: "Numerical Analysis", level: 400, credits: 3, prereqs: ["math203", "math202"], passRate: 0.72, desc: "Numerical methods for solving mathematical problems." },
              { id: "math404", code: "MATH 490", name: "Senior Thesis", level: 400, credits: 6, prereqs: ["math302", "math303"], passRate: 0.92, desc: "Independent research project under faculty supervision." }
            ]
          },
          physics: {
            name: "Physics B.S.",
            courses: [
              { id: "phys101", code: "PHYS 201", name: "Physics I: Mechanics", level: 100, credits: 4, prereqs: [], passRate: 0.78, desc: "Classical mechanics, Newton's laws, and conservation principles." },
              { id: "phys102", code: "PHYS 202", name: "Physics II: E&M", level: 100, credits: 4, prereqs: ["phys101", "math101"], passRate: 0.72, desc: "Electricity, magnetism, and Maxwell's equations." },
              { id: "phys201", code: "PHYS 301", name: "Modern Physics", level: 200, credits: 4, prereqs: ["phys102", "math102"], passRate: 0.68, desc: "Special relativity, quantum mechanics introduction." },
              { id: "phys202", code: "PHYS 302", name: "Classical Mechanics", level: 200, credits: 4, prereqs: ["phys101", "math201"], passRate: 0.65, desc: "Lagrangian and Hamiltonian mechanics." },
              { id: "phys203", code: "PHYS 303", name: "Electrodynamics", level: 200, credits: 4, prereqs: ["phys102", "math201"], passRate: 0.62, desc: "Advanced electromagnetic theory." },
              { id: "phys301", code: "PHYS 401", name: "Quantum Mechanics", level: 300, credits: 4, prereqs: ["phys201", "math202"], passRate: 0.55, desc: "Wave mechanics, Schrödinger equation, and applications." },
              { id: "phys302", code: "PHYS 402", name: "Statistical Mechanics", level: 300, credits: 4, prereqs: ["phys201", "math301"], passRate: 0.58, desc: "Thermodynamics and statistical physics." },
              { id: "phys303", code: "PHYS 403", name: "Optics", level: 300, credits: 3, prereqs: ["phys203"], passRate: 0.72, desc: "Wave optics, lasers, and optical systems." },
              { id: "phys401", code: "PHYS 451", name: "Solid State Physics", level: 400, credits: 4, prereqs: ["phys301"], passRate: 0.60, desc: "Crystal structures, band theory, and semiconductors." },
              { id: "phys402", code: "PHYS 452", name: "Particle Physics", level: 400, credits: 4, prereqs: ["phys301"], passRate: 0.58, desc: "Fundamental particles and forces." },
              { id: "phys403", code: "PHYS 490", name: "Research Project", level: 400, credits: 6, prereqs: ["phys301", "phys302"], passRate: 0.90, desc: "Independent physics research." },
              { id: "math101", code: "MATH 151", name: "Calculus I", level: 100, credits: 4, prereqs: [], passRate: 0.75, desc: "Limits, derivatives, and integrals." },
              { id: "math102", code: "MATH 152", name: "Calculus II", level: 100, credits: 4, prereqs: ["math101"], passRate: 0.70, desc: "Integration techniques and series." },
              { id: "math201", code: "MATH 251", name: "Calculus III", level: 200, credits: 4, prereqs: ["math102"], passRate: 0.68, desc: "Multivariable calculus." },
              { id: "math202", code: "MATH 261", name: "Linear Algebra", level: 200, credits: 3, prereqs: ["math102"], passRate: 0.72, desc: "Vector spaces and matrices." },
              { id: "math203", code: "MATH 271", name: "Differential Equations", level: 200, credits: 3, prereqs: ["math102"], passRate: 0.65, desc: "Differential equations." }
            ]
          }
        };
    
        // ==================== STATE ====================
        let currentProgram = 'cs';
        let courses = [];
        let selectedCourse = null;
        let activeTab = 'graph';
        
        // Graph state
        let canvas = null;
        let ctx = null;
        let nodes = [];
        let edges = [];
        let camera = { x: 0, y: 0, zoom: 1 };
        let isDragging = false;
        let dragStart = { x: 0, y: 0 };
        let hoveredNode = null;
        let draggedNode = null;
    
        // Simulation state
        let simulation = {
          running: false,
          semester: 0,
          students: [],
          graduated: 0,
          dropped: 0,
          interval: null
        };
    
        // ==================== INITIALIZATION ====================
        function init() {
          canvas = document.getElementById('graphCanvas');
          ctx = canvas.getContext('2d');
          
          loadProgram(currentProgram);
          setupEventListeners();
          resizeCanvas();
          renderCourseList();
          updateStats();
          
          window.addEventListener('resize', resizeCanvas);
        }
    
        function loadProgram(programId) {
          const data = curriculumData[programId];
          if (!data) return;
          
          courses = data.courses.map(c => ({...c}));
          currentProgram = programId;
          
          buildGraph();
          calculateLayout();
          renderCourseList();
          updateStats();
          updateBottlenecks();
          
          // Reset view
          camera = { x: 0, y: 0, zoom: 1 };
          selectedCourse = null;
          document.getElementById('courseDetails').classList.add('hidden');
        }
    
        function resizeCanvas() {
          const container = document.getElementById('canvasContainer');
          const rect = container.getBoundingClientRect();
          
          canvas.width = rect.width * window.devicePixelRatio;
          canvas.height = rect.height * window.devicePixelRatio;
          canvas.style.width = rect.width + 'px';
          canvas.style.height = rect.height + 'px';
          
          ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
          
          if (nodes.length > 0) {
            draw();
          }
        }
    
        // ==================== GRAPH BUILDING ====================
        function buildGraph() {
          nodes = courses.map(course => ({
            id: course.id,
            x: 0,
            y: 0,
            radius: 24,
            course: course,
            vx: 0,
            vy: 0
          }));
          
          edges = [];
          courses.forEach(course => {
            course.prereqs.forEach(prereqId => {
              edges.push({
                source: prereqId,
                target: course.id
              });
            });
          });
        }
    
        function calculateLayout() {
          // Group courses by level
          const levels = { 100: [], 200: [], 300: [], 400: [] };
          nodes.forEach(node => {
            levels[node.course.level].push(node);
          });
          
          const canvasWidth = canvas.width / window.devicePixelRatio;
          const canvasHeight = canvas.height / window.devicePixelRatio;
          const centerX = canvasWidth / 2;
          const startY = 100;
          const levelGap = 140;
          
          Object.keys(levels).forEach((level, levelIndex) => {
            const levelNodes = levels[level];
            const rowWidth = levelNodes.length * 100;
            const startX = centerX - rowWidth / 2;
            
            levelNodes.forEach((node, nodeIndex) => {
              node.x = startX + nodeIndex * 100 + 50 + (Math.random() - 0.5) * 20;
              node.y = startY + levelIndex * levelGap;
            });
          });
          
          // Apply force-directed adjustments
          applyForces();
        }
    
        function applyForces() {
          const iterations = 50;
          
          for (let i = 0; i < iterations; i++) {
            // Repulsion between nodes
            nodes.forEach(node1 => {
              nodes.forEach(node2 => {
                if (node1 === node2) return;
                
                const dx = node2.x - node1.x;
                const dy = node2.y - node1.y;
                const dist = Math.sqrt(dx * dx + dy * dy) || 1;
                const minDist = 80;
                
                if (dist < minDist) {
                  const force = (minDist - dist) / dist * 0.5;
                  node1.x -= dx * force;
                  node1.y -= dy * force;
                }
              });
            });
            
            // Attraction along edges
            edges.forEach(edge => {
              const source = nodes.find(n => n.id === edge.source);
              const target = nodes.find(n => n.id === edge.target);
              if (!source || !target) return;
              
              const dx = target.x - source.x;
              const dy = target.y - source.y;
              const dist = Math.sqrt(dx * dx + dy * dy) || 1;
              const idealDist = 120;
              
              const force = (dist - idealDist) * 0.02;
              source.x += dx / dist * force;
              source.y += dy / dist * force;
              target.x -= dx / dist * force;
              target.y -= dy / dist * force;
            });
          }
        }
    
        // ==================== DRAWING ====================
        function draw() {
          const width = canvas.width / window.devicePixelRatio;
          const height = canvas.height / window.devicePixelRatio;
          
          // Clear canvas
          ctx.clearRect(0, 0, width, height);
          
          ctx.save();
          ctx.translate(camera.x + width / 2, camera.y + height / 2);
          ctx.scale(camera.zoom, camera.zoom);
          ctx.translate(-width / 2, -height / 2);
          
          // Draw edges
          edges.forEach(edge => {
            const source = nodes.find(n => n.id === edge.source);
            const target = nodes.find(n => n.id === edge.target);
            if (!source || !target) return;
            
            const isHighlighted = selectedCourse && 
              (selectedCourse.id === source.id || selectedCourse.id === target.id);
            
            ctx.beginPath();
            ctx.moveTo(source.x, source.y);
            
            // Curved edge
            const midX = (source.x + target.x) / 2;
            const midY = (source.y + target.y) / 2 - 20;
            ctx.quadraticCurveTo(midX, midY, target.x, target.y);
            
            ctx.strokeStyle = isHighlighted ? 'rgba(0, 212, 170, 0.8)' : 'rgba(122, 138, 154, 0.3)';
            ctx.lineWidth = isHighlighted ? 2 : 1;
            ctx.stroke();
            
            // Arrow
            if (isHighlighted) {
              const angle = Math.atan2(target.y - midY, target.x - midX);
              const arrowSize = 8;
              ctx.beginPath();
              ctx.moveTo(target.x - target.radius * Math.cos(angle), target.y - target.radius * Math.sin(angle));
              ctx.lineTo(
                target.x - (target.radius + arrowSize) * Math.cos(angle) - arrowSize * Math.cos(angle + Math.PI / 2),
                target.y - (target.radius + arrowSize) * Math.sin(angle) - arrowSize * Math.sin(angle + Math.PI / 2)
              );
              ctx.lineTo(
                target.x - (target.radius + arrowSize) * Math.cos(angle) - arrowSize * Math.cos(angle - Math.PI / 2),
                target.y - (target.radius + arrowSize) * Math.sin(angle) - arrowSize * Math.sin(angle - Math.PI / 2)
              );
              ctx.closePath();
              ctx.fillStyle = 'rgba(0, 212, 170, 0.8)';
              ctx.fill();
            }
          });
          
          // Draw nodes
          nodes.forEach(node => {
            const isSelected = selectedCourse && selectedCourse.id === node.id;
            const isHovered = hoveredNode && hoveredNode.id === node.id;
            const isRelated = selectedCourse && (
              selectedCourse.prereqs.includes(node.id) ||
              node.course.prereqs.includes(selectedCourse.id)
            );
            
            const radius = node.radius * (isHovered ? 1.15 : 1);
            const safeRadius = Math.max(1, radius);
            
            // Glow for selected/hovered
            if (isSelected || isHovered) {
              const gradient = ctx.createRadialGradient(node.x, node.y, safeRadius * 0.5, node.x, node.y, safeRadius * 2);
              gradient.addColorStop(0, getLevelColor(node.course.level, 0.3));
              gradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
              ctx.beginPath();
              ctx.arc(node.x, node.y, safeRadius * 2, 0, Math.PI * 2);
              ctx.fillStyle = gradient;
              ctx.fill();
            }
            
            // Node circle
            ctx.beginPath();
            ctx.arc(node.x, node.y, safeRadius, 0, Math.PI * 2);
            
            if (isSelected) {
              ctx.fillStyle = getLevelColor(node.course.level, 1);
            } else if (isRelated) {
              ctx.fillStyle = getLevelColor(node.course.level, 0.7);
            } else if (selectedCourse) {
              ctx.fillStyle = 'rgba(42, 54, 66, 0.5)';
            } else {
              ctx.fillStyle = getLevelColor(node.course.level, 0.8);
            }
            
            ctx.fill();
            
            // Border
            ctx.strokeStyle = isSelected ? '#ffffff' : (isRelated ? getLevelColor(node.course.level, 1) : 'rgba(122, 138, 154, 0.5)');
            ctx.lineWidth = isSelected ? 3 : 2;
            ctx.stroke();
            
            // Course code label
            ctx.fillStyle = isSelected || isRelated ? '#ffffff' : 'rgba(232, 238, 244, 0.9)';
            ctx.font = '600 11px "JetBrains Mono", monospace';
            ctx.textAlign = 'center';
            ctx.textBaseline = 'middle';
            
            const code = node.course.code.split(' ')[1];
            ctx.fillText(code, node.x, node.y);
          });
          
          ctx.restore();
        }
    
        function getLevelColor(level, alpha) {
          const colors = {
            100: `rgba(0, 212, 170, ${alpha})`,
            200: `rgba(74, 158, 255, ${alpha})`,
            300: `rgba(168, 85, 247, ${alpha})`,
            400: `rgba(255, 107, 74, ${alpha})`
          };
          return colors[level] || `rgba(122, 138, 154, ${alpha})`;
        }
    
        // ==================== EVENT HANDLERS ====================
        function setupEventListeners() {
          // Canvas interactions
          canvas.addEventListener('mousedown', handleMouseDown);
          canvas.addEventListener('mousemove', handleMouseMove);
          canvas.addEventListener('mouseup', handleMouseUp);
          canvas.addEventListener('wheel', handleWheel, { passive: false });
          canvas.addEventListener('click', handleClick);
          
          // Touch support
          canvas.addEventListener('touchstart', handleTouchStart, { passive: false });
          canvas.addEventListener('touchmove', handleTouchMove, { passive: false });
          canvas.addEventListener('touchend', handleTouchEnd);
          
          // Controls
          document.getElementById('zoomIn').addEventListener('click', () => {
            camera.zoom = Math.min(3, camera.zoom * 1.2);
            draw();
          });
          
          document.getElementById('zoomOut').addEventListener('click', () => {
            camera.zoom = Math.max(0.3, camera.zoom / 1.2);
            draw();
          });
          
          document.getElementById('resetView').addEventListener('click', () => {
            camera = { x: 0, y: 0, zoom: 1 };
            draw();
          });
          
          // Program selector
          document.getElementById('programSelect').addEventListener('change', (e) => {
            loadProgram(e.target.value);
            draw();
          });
          
          // Tabs
          document.querySelectorAll('.tab-btn').forEach(btn => {
            btn.addEventListener('click', () => switchTab(btn.dataset.tab));
          });
          
          // Search
          document.getElementById('courseSearch').addEventListener('input', (e) => {
            filterCourses(e.target.value);
          });
          
          // Simulation controls
          document.getElementById('startSim').addEventListener('click', toggleSimulation);
          document.getElementById('resetSim').addEventListener('click', resetSimulation);
          document.getElementById('cohortSize').addEventListener('input', (e) => {
            document.getElementById('cohortValue').textContent = e.target.value;
          });
          document.getElementById('passRateMod').addEventListener('input', (e) => {
            document.getElementById('passRateValue').textContent = Math.round(e.target.value * 100) + '%';
          });
          document.getElementById('simSpeed').addEventListener('input', (e) => {
            document.getElementById('speedValue').textContent = e.target.value + 'ms';
          });
          
          // Sidebar toggle
          document.getElementById('sidebarToggle').addEventListener('click', () => {
            document.getElementById('sidebar').classList.toggle('open');
          });
        }
    
        function handleMouseDown(e) {
          isDragging = true;
          dragStart = { x: e.clientX, y: e.clientY };
          
          const node = getNodeAt(e.clientX, e.clientY);
          if (node) {
            draggedNode = node;
          }
        }
    
        function handleMouseMove(e) {
          const rect = canvas.getBoundingClientRect();
          const mouseX = e.clientX - rect.left;
          const mouseY = e.clientY - rect.top;
          
          if (isDragging && draggedNode) {
            const dx = (e.clientX - dragStart.x) / camera.zoom;
            const dy = (e.clientY - dragStart.y) / camera.zoom;
            draggedNode.x += dx;
            draggedNode.y += dy;
            dragStart = { x: e.clientX, y: e.clientY };
            draw();
          } else if (isDragging) {
            camera.x += (e.clientX - dragStart.x);
            camera.y += (e.clientY - dragStart.y);
            dragStart = { x: e.clientX, y: e.clientY };
            draw();
          } else {
            const node = getNodeAt(e.clientX, e.clientY);
            if (node !== hoveredNode) {
              hoveredNode = node;
              canvas.style.cursor = node ? 'pointer' : 'grab';
              
              if (node) {
                showTooltip(e.clientX, e.clientY, node.course);
              } else {
                hideTooltip();
              }
              
              draw();
            }
          }
        }
    
        function handleMouseUp() {
          isDragging = false;
          draggedNode = null;
        }
    
        function handleWheel(e) {
          e.preventDefault();
          const delta = e.deltaY > 0 ? 0.9 : 1.1;
          camera.zoom = Math.max(0.3, Math.min(3, camera.zoom * delta));
          draw();
        }
    
        function handleClick(e) {
          const node = getNodeAt(e.clientX, e.clientY);
          if (node) {
            selectCourse(node.course);
          }
        }
    
        function handleTouchStart(e) {
          if (e.touches.length === 1) {
            isDragging = true;
            dragStart = { x: e.touches[0].clientX, y: e.touches[0].clientY };
          }
        }
    
        function handleTouchMove(e) {
          if (e.touches.length === 1 && isDragging) {
            camera.x += (e.touches[0].clientX - dragStart.x);
            camera.y += (e.touches[0].clientY - dragStart.y);
            dragStart = { x: e.touches[0].clientX, y: e.touches[0].clientY };
            draw();
          }
        }
    
        function handleTouchEnd() {
          isDragging = false;
        }
    
        function getNodeAt(clientX, clientY) {
          const rect = canvas.getBoundingClientRect();
          const x = (clientX - rect.left - camera.x - rect.width / 2) / camera.zoom + rect.width / 2;
          const y = (clientY - rect.top - camera.y - rect.height / 2) / camera.zoom + rect.height / 2;
          
          for (let i = nodes.length - 1; i >= 0; i--) {
            const node = nodes[i];
            const dx = x - node.x;
            const dy = y - node.y;
            if (dx * dx + dy * dy < node.radius * node.radius) {
              return node;
            }
          }
          return null;
        }
    
        // ==================== UI FUNCTIONS ====================
        function switchTab(tab) {
          activeTab = tab;
          
          document.querySelectorAll('.tab-btn').forEach(btn => {
            btn.classList.toggle('active', btn.dataset.tab === tab);
          });
          
          document.getElementById('graphCanvas').style.display = tab === 'graph' ? 'block' : 'none';
          document.getElementById('bottlenecksPanel').classList.toggle('hidden', tab !== 'bottlenecks');
          document.getElementById('simulationPanel').classList.toggle('hidden', tab !== 'simulation');
          document.getElementById('statsOverlay').classList.toggle('hidden', tab !== 'graph');
          
          if (tab === 'graph') {
            resizeCanvas();
            draw();
          } else if (tab === 'simulation') {
            initSimulationChart();
          }
        }
    
        function selectCourse(course) {
          selectedCourse = course;
          
          const details = document.getElementById('courseDetails');
          details.classList.remove('hidden');
          
          document.getElementById('courseCode').textContent = course.code;
          document.getElementById('courseName').textContent = course.name;
          document.getElementById('courseCredits').textContent = course.credits + ' credits';
          document.getElementById('coursePassRate').textContent = Math.round(course.passRate * 100) + '%';
          document.getElementById('passRateBar').style.width = (course.passRate * 100) + '%';
          document.getElementById('courseDesc').textContent = course.desc;
          
          const levelBadge = document.getElementById('courseLevel');
          levelBadge.textContent = course.level + '-Level';
          levelBadge.style.backgroundColor = getLevelColor(course.level, 0.2);
          levelBadge.style.color = getLevelColor(course.level, 1);
          
          // Prereqs
          const prereqsContainer = document.getElementById('coursePrereqs');
          if (course.prereqs.length === 0) {
            prereqsContainer.innerHTML = '<span class="text-sm text-[--fg-muted]">None</span>';
          } else {
            prereqsContainer.innerHTML = course.prereqs.map(id => {
              const prereq = courses.find(c => c.id === id);
              return `<button class="px-2 py-1 bg-[--bg-tertiary] border border-[--border] rounded text-xs mono hover:border-[--accent] transition-colors" onclick="selectCourseById('${id}')">${prereq ? prereq.code : id}</button>`;
            }).join('');
          }
          
          // Unlocks
          const unlocks = courses.filter(c => c.prereqs.includes(course.id));
          const unlocksContainer = document.getElementById('courseUnlocks');
          if (unlocks.length === 0) {
            unlocksContainer.innerHTML = '<span class="text-sm text-[--fg-muted]">None</span>';
          } else {
            unlocksContainer.innerHTML = unlocks.map(c => 
              `<button class="px-2 py-1 bg-[--bg-tertiary] border border-[--border] rounded text-xs mono hover:border-[--accent] transition-colors" onclick="selectCourseById('${c.id}')">${c.code}</button>`
            ).join('');
          }
          
          // Highlight in list
          document.querySelectorAll('#courseList button').forEach(btn => {
            btn.classList.toggle('border-[--accent]', btn.dataset.id === course.id);
          });
          
          draw();
        }
    
        function selectCourseById(id) {
          const course = courses.find(c => c.id === id);
          if (course) selectCourse(course);
        }
    
        function renderCourseList(filter = '') {
          const container = document.getElementById('courseList');
          const filtered = courses.filter(c => 
            c.name.toLowerCase().includes(filter.toLowerCase()) ||
            c.code.toLowerCase().includes(filter.toLowerCase())
          );
          
          container.innerHTML = filtered.map(course => `
            <button 
              data-id="${course.id}"
              class="w-full text-left p-3 rounded-lg bg-[--bg-tertiary] border border-[--border] hover:border-[--accent] transition-colors ${selectedCourse?.id === course.id ? 'border-[--accent]' : ''}"
              onclick="selectCourseById('${course.id}')"
            >
              <div class="flex items-center justify-between mb-1">
                <span class="mono text-sm font-medium">${course.code}</span>
                <span class="text-xs px-2 py-0.5 rounded" style="background: ${getLevelColor(course.level, 0.2)}; color: ${getLevelColor(course.level, 1)}">${course.level}00</span>
              </div>
              <p class="text-sm text-[--fg-muted] truncate">${course.name}</p>
            </button>
          `).join('');
        }
    
        function filterCourses(query) {
          renderCourseList(query);
        }
    
        function showTooltip(x, y, course) {
          const tooltip = document.getElementById('tooltip');
          tooltip.innerHTML = `
            <p class="mono font-semibold text-sm">${course.code}</p>
            <p class="text-[--fg-muted] text-xs mb-2">${course.name}</p>
            <div class="flex items-center gap-3 text-xs">
              <span><span class="text-[--fg-muted]">Credits:</span> ${course.credits}</span>
              <span><span class="text-[--fg-muted]">Pass Rate:</span> <span class="text-[--accent]">${Math.round(course.passRate * 100)}%</span></span>
            </div>
          `;
          tooltip.style.left = (x + 15) + 'px';
          tooltip.style.top = (y + 15) + 'px';
          tooltip.classList.remove('hidden');
        }
    
        function hideTooltip() {
          document.getElementById('tooltip').classList.add('hidden');
        }
    
        function updateStats() {
          document.getElementById('totalCourses').textContent = courses.length;
          document.getElementById('totalPrereqs').textContent = edges.length;
          
          // Calculate average path length
          const pathLengths = [];
          const maxLevel = Math.max(...courses.map(c => c.level));
          const seniorCourses = courses.filter(c => c.level === maxLevel);
          
          seniorCourses.forEach(course => {
            const pathLen = calculatePathLength(course);
            pathLengths.push(pathLen);
          });
          
          const avgPath = pathLengths.length > 0 ? (pathLengths.reduce((a, b) => a + b, 0) / pathLengths.length).toFixed(1) : 0;
          document.getElementById('avgPathLength').textContent = avgPath;
          document.getElementById('criticalPath').textContent = Math.max(...pathLengths, 0);
        }
    
        function calculatePathLength(course, visited = new Set()) {
          if (visited.has(course.id)) return 0;
          visited.add(course.id);
          
          if (course.prereqs.length === 0) return 1;
          
          let maxLength = 0;
          course.prereqs.forEach(prereqId => {
            const prereq = courses.find(c => c.id === prereqId);
            if (prereq) {
              const length = calculatePathLength(prereq, visited);
              maxLength = Math.max(maxLength, length);
            }
          });
          
          return maxLength + 1;
        }
    
        // ==================== BOTTLENECKS ====================
        function updateBottlenecks() {
          const bottlenecks = courses.map(course => {
            // Calculate bottleneck score based on:
            // 1. Low pass rate
            // 2. Number of courses that depend on it
            // 3. Position in prerequisite chain
            
            const dependents = courses.filter(c => c.prereqs.includes(course.id)).length;
            const failRate = 1 - course.passRate;
            const bottleneckScore = (failRate * 100) * (1 + dependents * 0.5);
            
            return {
              ...course,
              dependents,
              bottleneckScore
            };
          }).sort((a, b) => b.bottleneckScore - a.bottleneckScore);
          
          const container = document.getElementById('bottlenecksList');
          container.innerHTML = bottlenecks.map((course, index) => {
            const severity = course.bottleneckScore > 30 ? 'high' : course.bottleneckScore > 15 ? 'medium' : '';
            
            return `
              <div class="bg-[--card] border border-[--border] rounded-lg p-4 ${severity === 'high' ? 'bottleneck-high' : severity === 'medium' ? 'bottleneck-medium' : ''} animate-fade-in" style="animation-delay: ${index * 50}ms">
                <div class="flex items-start justify-between mb-3">
                  <div>
                    <span class="mono font-semibold">${course.code}</span>
                    <p class="text-sm text-[--fg-muted]">${course.name}</p>
                  </div>
                  <span class="text-2xl font-bold mono ${severity === 'high' ? 'text-[--warning]' : severity === 'medium' ? 'text-[#ffbb4a]' : 'text-[--fg-muted]'}">${Math.round(course.bottleneckScore)}</span>
                </div>
                <div class="grid grid-cols-3 gap-4 text-sm">
                  <div>
                    <p class="text-xs text-[--fg-muted]">Pass Rate</p>
                    <p class="mono font-medium">${Math.round(course.passRate * 100)}%</p>
                  </div>
                  <div>
                    <p class="text-xs text-[--fg-muted]">Blocking</p>
                    <p class="mono font-medium">${course.dependents} courses</p>
                  </div>
                  <div>
                    <p class="text-xs text-[--fg-muted]">Level</p>
                    <p class="mono font-medium">${course.level}</p>
                  </div>
                </div>
              </div>
            `;
          }).join('');
        }
    
        // ==================== SIMULATION ====================
        function toggleSimulation() {
          if (simulation.running) {
            pauseSimulation();
          } else {
            startSimulation();
          }
        }
    
        function startSimulation() {
          simulation.running = true;
          document.getElementById('startSim').innerHTML = `
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 9v6m4-6v6m7-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
            </svg>
            Pause
          `;
          
          if (simulation.semester === 0) {
            initStudents();
          }
          
          const speed = parseInt(document.getElementById('simSpeed').value);
          simulation.interval = setInterval(runSemester, speed);
        }
    
        function pauseSimulation() {
          simulation.running = false;
          document.getElementById('startSim').innerHTML = `
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/>
            </svg>
            Resume
          `;
          
          clearInterval(simulation.interval);
        }
    
        function resetSimulation() {
          pauseSimulation();
          simulation.semester = 0;
          simulation.students = [];
          simulation.graduated = 0;
          simulation.dropped = 0;
          
          document.getElementById('startSim').innerHTML = `
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/>
            </svg>
            Start Simulation
          `;
          
          updateSimulationUI();
          initSimulationChart();
        }
    
        function initStudents() {
          const cohortSize = parseInt(document.getElementById('cohortSize').value);
          const passRateMod = parseFloat(document.getElementById('passRateMod').value);
          
          simulation.students = [];
          for (let i = 0; i < cohortSize; i++) {
            simulation.students.push({
              id: i,
              completed: [],
              failed: [],
              credits: 0,
              active: true,
              ability: 0.7 + Math.random() * 0.3 * passRateMod
            });
          }
        }
    
        function runSemester() {
          simulation.semester++;
          const passRateMod = parseFloat(document.getElementById('passRateMod').value);
          
          simulation.students.forEach(student => {
            if (!student.active) return;
            
            // Find eligible courses
            const eligible = courses.filter(course => {
              if (student.completed.includes(course.id)) return false;
              if (student.failed.filter(f => f === course.id).length >= 2) return false; // Max 2 failures
              return course.prereqs.every(prereq => student.completed.includes(prereq));
            });
            
            // Take up to 4 courses
            const toTake = eligible.slice(0, 4);
            
            toTake.forEach(course => {
              const adjustedPassRate = course.passRate * passRateMod * student.ability;
              const passed = Math.random() < adjustedPassRate;
              
              if (passed) {
                student.completed.push(course.id);
                student.credits += course.credits;
                student.failed = student.failed.filter(f => f !== course.id);
              } else {
                student.failed.push(course.id);
              }
            });
            
            // Check for graduation or drop
            const requiredCourses = courses.filter(c => c.level >= 300);
            const completedRequired = requiredCourses.filter(c => student.completed.includes(c.id)).length;
            
            if (student.credits >= 120 && completedRequired >= requiredCourses.length * 0.8) {
              student.active = false;
              simulation.graduated++;
            } else if (simulation.semester > 12 || student.failed.filter(f => courses.find(c => c.id === f)?.level >= 300).length >= 4) {
              student.active = false;
              simulation.dropped++;
            }
          });
          
          updateSimulationUI();
          
          // Auto-stop if all students finished
          if (simulation.students.filter(s => s.active).length === 0) {
            pauseSimulation();
          }
        }
    
        function updateSimulationUI() {
          document.getElementById('currentSemester').textContent = `Semester ${simulation.semester}`;
          document.getElementById('semesterProgress').style.width = Math.min(100, (simulation.semester / 8) * 100) + '%';
          
          const active = simulation.students.filter(s => s.active).length;
          document.getElementById('activeStudents').textContent = active;
          document.getElementById('graduatedStudents').textContent = simulation.graduated;
          document.getElementById('droppedStudents').textContent = simulation.dropped;
          
          const avgCredits = simulation.students.length > 0 
            ? Math.round(simulation.students.reduce((sum, s) => sum + s.credits, 0) / simulation.students.length)
            : 0;
          document.getElementById('avgCredits').textContent = avgCredits;
          
          updateEnrollmentChart();
        }
    
        function initSimulationChart() {
          const container = document.getElementById('enrollmentChart');
          container.innerHTML = courses.map(course => `
            <div class="flex-1 min-w-[30px] flex flex-col items-center" data-course="${course.id}">
              <div class="w-full bg-[--bg-tertiary] rounded-t relative" style="height: 0%">
                <div class="absolute bottom-0 w-full bg-[--accent] rounded-t transition-all duration-300" style="height: 0%"></div>
              </div>
              <p class="text-xs mono mt-2 text-[--fg-muted] truncate w-full text-center">${course.code.split(' ')[1]}</p>
            </div>
          `).join('');
        }
    
        function updateEnrollmentChart() {
          const activeStudents = simulation.students.filter(s => s.active);
          
          courses.forEach(course => {
            const enrolled = activeStudents.filter(s => s.completed.includes(course.id)).length;
            const maxEnrolled = Math.max(1, simulation.students.length);
            const percentage = (enrolled / maxEnrolled) * 100;
            
            const bar = document.querySelector(`[data-course="${course.id}"] > div`);
            const fill = bar?.querySelector('div');
            
            if (bar && fill) {
              bar.style.height = '180px';
              fill.style.height = percentage + '%';
            }
          });
        }
    
        // Initialize on load
        document.addEventListener('DOMContentLoaded', init);
      </script>
    </body>
    </html>
    

    Key Features

    1. Prerequisite Graph

    • Interactive node-based visualization
    • Drag nodes to rearrange
    • Click to view course details
    • Color-coded by course level
    • Zoom and pan controls

    2. Bottleneck Analysis

    • Identifies high-risk courses based on:
      • Low pass rates
      • Number of dependent courses
      • Position in prerequisite chains
    • Visual severity indicators

    3. Progression Simulation

    • Configurable cohort size (10-200 students)
    • Adjustable pass rate modifier
    • Real-time semester progression
    • Statistics tracking (graduated, dropped, active)
    • Course enrollment distribution chart

    4. Interactions

    • Search/filter courses
    • Click courses for detailed info
    • See prerequisite relationships
    • Track unlocked courses
    • Responsive design for all devices

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.