<?php
// CFS Transistor University
// Standalone masterclasses from Elementary School to PhD and Distinguished Transistor Fellows.
declare(strict_types=1);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Transistor University | CFS Masterclasses (Elementary to PhD)</title>
    <meta name="description" content="CFS Transistor University: comprehensive masterclasses & interactive simulation laboratories from elementary school to PhD and distinguished industry fellows. Active 3-terminal switching, 1947 point-contact to BJT, CMOS dynamic power CV²f, small-signal models gm/ro, RF cutoff fT, 3D Tri-Gate FinFET width quantization, Gate-All-Around nanosheets, monolithic CFETs, and 75-year roadmap scaling.">
    <link rel="canonical" href="https://www.chipfoundryservices.com/transistor.php">
    <meta property="og:type" content="website">
    <meta property="og:site_name" content="ChipFoundryServices">
    <meta property="og:title" content="Transistor University | CFS Masterclasses">
    <meta property="og:description" content="From 3-terminal active switches and 1947 point-contact germanium crystals to 3D FinFETs, GAA nanosheets, and monolithic CFETs: the complete 7-level masterclass in transistor engineering.">
    <meta property="og:url" content="https://www.chipfoundryservices.com/transistor.php">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js" crossorigin="anonymous" onload="if(typeof renderMath==='function')renderMath();"></script>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            background: #070c12;
            color: #f1f5f9;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            line-height: 1.55;
            -webkit-font-smoothing: antialiased;
        }
        a { color: #10a37f; text-decoration: none; transition: color 0.15s; }
        a:hover { color: #34d399; text-decoration: underline; }

        /* Top Header */
        .header {
            position: sticky; top: 0; z-index: 1000;
            background: rgba(11, 17, 24, 0.94);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid #1e293b;
            padding: 12px 24px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .header-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.15rem; color: #fff; }
        .header-brand svg { stroke: #10a37f; }
        .header-nav { display: flex; align-items: center; gap: 14px; font-size: 0.85rem; flex-wrap: wrap; }
        .header-nav a { color: #cbd5e1; font-weight: 500; }
        .header-nav a:hover { color: #10a37f; text-decoration: none; }
        .header-nav .univ-badge {
            background: rgba(16, 163, 127, 0.2);
            color: #34d399;
            border: 1px solid rgba(16, 163, 127, 0.4);
            padding: 2px 8px;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* Hero */
        .hero {
            background: radial-gradient(circle at 50% 20%, rgba(16, 163, 127, 0.15) 0%, rgba(7, 12, 18, 0) 70%);
            padding: 60px 24px 40px;
            text-align: center;
            border-bottom: 1px solid #1e293b;
        }
        .hero-badge {
            display: inline-flex; align-items: center; gap: 6px;
            background: rgba(16, 163, 127, 0.15);
            border: 1px solid rgba(16, 163, 127, 0.4);
            color: #34d399;
            padding: 5px 14px;
            border-radius: 9999px;
            font-size: 0.82rem;
            font-weight: 700;
            margin-bottom: 20px;
            letter-spacing: 0.6px;
            text-transform: uppercase;
        }
        .hero h1 {
            font-size: 2.8rem;
            font-weight: 850;
            color: #ffffff;
            margin-bottom: 16px;
            line-height: 1.15;
            letter-spacing: -0.8px;
        }
        .hero h1 span {
            background: linear-gradient(135deg, #10a37f, #34d399, #6ee7b7);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .hero p {
            max-width: 840px;
            margin: 0 auto 24px;
            font-size: 1.1rem;
            color: #94a3b8;
            line-height: 1.6;
        }

        /* Hero Stats */
        .hero-stats {
            display: flex;
            justify-content: center;
            gap: 32px;
            flex-wrap: wrap;
            margin-top: 24px;
        }
        .stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .stat-val {
            font-size: 1.5rem;
            font-weight: 800;
            color: #ffffff;
        }
        .stat-val span { color: #10a37f; }
        .stat-lbl {
            font-size: 0.78rem;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* Level Bar */
        .level-bar-wrap {
            background: #0b1118;
            border-bottom: 1px solid #1e293b;
            position: sticky; top: 61px; z-index: 900;
        }
        .level-bar {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            padding: 8px 16px;
            gap: 8px;
        }
        .level-btn {
            background: #131d2a;
            color: #94a3b8;
            border: 1px solid #1e293b;
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 0.82rem;
            font-weight: 600;
            white-space: nowrap;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .level-btn:hover {
            color: #f1f5f9;
            border-color: #334155;
            background: #1e293b;
        }
        .level-btn.active {
            background: rgba(16, 163, 127, 0.15);
            border-color: #10a37f;
            color: #34d399;
            box-shadow: 0 0 12px rgba(16, 163, 127, 0.2);
        }
        .level-btn .badge {
            background: rgba(0, 0, 0, 0.3);
            padding: 1px 6px;
            border-radius: 4px;
            font-size: 0.72rem;
        }
        @media (max-width: 768px) {
            .level-bar {
                gap: 6px;
                padding: 8px 10px;
            }
            .level-btn {
                padding: 6px 10px;
                font-size: 0.76rem;
            }
        }
        @media (max-width: 520px) {
            .level-bar {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 6px;
            }
            .level-btn:last-child {
                grid-column: span 2;
            }
            .level-btn {
                justify-content: center;
            }
        }

        /* Main Container */
        .main-wrap {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 20px 80px;
        }

        .level-container { display: none; }
        .level-container.active { display: block; animation: fadeIn 0.3s ease; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

        /* Level Header */
        .level-header {
            margin-bottom: 32px;
            padding-bottom: 24px;
            border-bottom: 1px solid #1e293b;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            flex-wrap: wrap;
            gap: 16px;
        }
        .level-meta-badge {
            font-size: 0.8rem;
            font-weight: 700;
            color: #10a37f;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 6px;
        }
        .level-title {
            font-size: 2rem;
            font-weight: 800;
            color: #fff;
            line-height: 1.25;
            margin-bottom: 8px;
        }
        .level-subtitle {
            font-size: 1.05rem;
            color: #94a3b8;
            max-width: 800px;
            line-height: 1.5;
        }

        /* Modules Grid */
        .modules-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
            gap: 24px;
            margin-bottom: 40px;
        }
        .module-card {
            background: #0d1520;
            border: 1px solid #1e293b;
            border-radius: 12px;
            padding: 24px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            transition: all 0.25s ease;
        }
        .module-card:hover {
            border-color: #334155;
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        }
        .module-num {
            font-size: 0.75rem;
            font-weight: 800;
            color: #10a37f;
            letter-spacing: 1px;
            text-transform: uppercase;
            margin-bottom: 8px;
        }
        .module-card h3 {
            font-size: 1.25rem;
            color: #fff;
            margin-bottom: 12px;
            line-height: 1.35;
        }
        .module-card p {
            font-size: 0.92rem;
            color: #94a3b8;
            margin-bottom: 12px;
            line-height: 1.55;
        }
        .module-card ul, .module-card ol {
            margin-left: 20px;
            margin-bottom: 14px;
            font-size: 0.88rem;
            color: #cbd5e1;
        }
        .module-card li { margin-bottom: 6px; }

        /* Formula Box */
        .formula-box {
            background: #111a28;
            border-left: 3px solid #10a37f;
            padding: 12px 14px;
            margin: 14px 0;
            border-radius: 0 8px 8px 0;
            font-size: 0.9rem;
            overflow-x: auto;
        }

        /* Interactive Lab */
        .interactive-lab, .lab-card {
            background: #0b131e;
            border: 1px solid #1e293b;
            border-radius: 14px;
            padding: 28px;
            margin-bottom: 40px;
        }
        .lab-tag {
            font-size: 0.78rem;
            font-weight: 800;
            color: #10a37f;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 6px;
        }
        .lab-title {
            font-size: 1.3rem;
            font-weight: 800;
            color: #fff;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .lab-title span { color: #10a37f; }
        .lab-desc {
            font-size: 0.95rem;
            color: #94a3b8;
            margin-bottom: 20px;
            line-height: 1.55;
        }
        .lab-controls {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 18px;
            margin: 20px 0;
        }
        .control-group label, .lab-input-group label {
            display: block;
            font-size: 0.82rem;
            font-weight: 600;
            color: #cbd5e1;
            margin-bottom: 6px;
        }
        .control-group input[type="range"], .lab-input-group input[type="range"] {
            width: 100%;
            accent-color: #10a37f;
            cursor: pointer;
        }
        .control-group select, .lab-input-group select {
            width: 100%;
            background: #131d2a;
            border: 1px solid #1e293b;
            color: #f1f5f9;
            padding: 8px 10px;
            border-radius: 6px;
            font-size: 0.85rem;
        }
        .lab-display, .lab-results {
            background: #070c12;
            border: 1px solid #1e293b;
            border-radius: 10px;
            padding: 20px;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 16px;
            margin-top: 20px;
        }
        .lab-metric, .lab-res-item {
            display: flex;
            flex-direction: column;
        }
        .metric-label, .lab-res-label {
            font-size: 0.75rem;
            text-transform: uppercase;
            color: #64748b;
            letter-spacing: 0.5px;
            margin-bottom: 4px;
        }
        .metric-val, .lab-res-val {
            font-size: 1.35rem;
            font-weight: 800;
            color: #10a37f;
        }

        /* Quiz */
        .quiz-section {
            background: #0d1520;
            border: 1px solid #1e293b;
            border-radius: 14px;
            padding: 30px;
            margin-bottom: 40px;
        }
        .quiz-header { margin-bottom: 24px; }
        .quiz-tag {
            font-size: 0.78rem;
            font-weight: 800;
            color: #10a37f;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 4px;
        }
        .quiz-title { font-size: 1.4rem; font-weight: 800; color: #fff; }
        .quiz-q-wrap {
            margin-bottom: 24px;
            padding-bottom: 20px;
            border-bottom: 1px solid #162232;
        }
        .quiz-q-wrap:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
        .quiz-q-text {
            font-size: 1rem;
            font-weight: 600;
            color: #f1f5f9;
            margin-bottom: 14px;
        }
        .quiz-options {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
        }
        .quiz-option {
            background: #111a28;
            border: 1px solid #1e293b;
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 0.9rem;
            color: #cbd5e1;
            text-align: left;
            cursor: pointer;
            transition: all 0.2s;
        }
        .quiz-option:hover {
            border-color: #334155;
            background: #162232;
            color: #fff;
        }
        .quiz-option.correct {
            border-color: #10a37f;
            background: rgba(16, 163, 127, 0.15);
            color: #34d399;
            font-weight: 600;
        }
        .quiz-option.incorrect {
            border-color: #ef4444;
            background: rgba(239, 68, 68, 0.15);
            color: #f87171;
        }
        .quiz-exp, .quiz-explanation {
            margin-top: 10px;
            font-size: 0.85rem;
            color: #34d399;
            background: rgba(16, 163, 127, 0.1);
            border-left: 3px solid #10a37f;
            padding: 8px 12px;
            border-radius: 0 6px 6px 0;
            display: none;
        }
        .quiz-exp.wrong, .quiz-explanation.wrong {
            color: #f87171;
            background: rgba(239, 68, 68, 0.1);
            border-left: 3px solid #ef4444;
        }
        .quiz-exp.correct, .quiz-explanation.correct {
            color: #34d399;
            background: rgba(16, 163, 127, 0.1);
            border-left: 3px solid #10a37f;
        }

        /* Certificate Card */
        .cert-card {
            background: linear-gradient(135deg, rgba(16, 163, 127, 0.1) 0%, rgba(13, 21, 32, 0.8) 100%);
            border: 1px solid rgba(16, 163, 127, 0.35);
            border-radius: 12px;
            padding: 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 16px;
            margin-top: 30px;
        }
        .cert-info h4 { font-size: 1.15rem; color: #fff; margin-bottom: 4px; }
        .cert-info p { font-size: 0.85rem; color: #94a3b8; }
        .cert-btn {
            background: #10a37f;
            color: #fff;
            border: none;
            padding: 10px 22px;
            border-radius: 8px;
            font-size: 0.88rem;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s;
        }
        .cert-btn:hover { background: #0e8c6d; }

        /* Fellow Medal */
        .fellow-medal-box {
            background: linear-gradient(135deg, #1c1917 0%, #0d1520 100%);
            border: 2px solid #f59e0b;
            border-radius: 16px;
            padding: 36px;
            text-align: center;
            margin-top: 40px;
            box-shadow: 0 0 30px rgba(245, 158, 11, 0.15);
        }
        .medal-icon { margin-bottom: 16px; }
        .medal-title {
            font-size: 1.8rem;
            font-weight: 850;
            color: #fbbf24;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
        }
        .medal-desc {
            max-width: 680px;
            margin: 0 auto 20px;
            font-size: 0.95rem;
            color: #d1d5db;
            line-height: 1.6;
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            z-index: 2000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .modal.active { display: flex; }
        .modal-content {
            background: #0d1520;
            border: 1px solid #1e293b;
            border-radius: 16px;
            max-width: 600px;
            width: 100%;
            padding: 32px;
            position: relative;
            text-align: center;
        }
        .modal-close {
            position: absolute; top: 16px; right: 16px;
            background: none; border: none; font-size: 1.5rem; color: #94a3b8; cursor: pointer;
        }

        /* Footer */
        .footer {
            background: #04080d;
            border-top: 1px solid #1e293b;
            padding: 40px 24px;
            color: #64748b;
            font-size: 0.82rem;
        }
        .footer a { color: #94a3b8; }
        .footer a:hover { color: #10a37f; }

        @media (max-width: 768px) {
            .hero h1 { font-size: 2.1rem; }
            .level-title { font-size: 1.5rem; }
            .modules-grid { grid-template-columns: 1fr; }
        }
    </style>
</head>
<body>

<!-- Header -->
<header class="header">
    <div class="header-brand">
        <a href="/" style="display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none;">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <rect x="2" y="2" width="20" height="20" rx="4"></rect>
                <path d="M6 18h12M6 14h12M6 10h12M6 6h12"></path>
            </svg>
            <span>ChipFoundryServices</span>
        </a>
    </div>
    <nav class="header-nav">
        <a href="/materials.php">Materials Univ</a>
        <a href="/devices.php">Devices Univ</a>
        <a href="/transistordevices.php">Transistor Devices Univ</a>
        <a href="/transistor.php" style="color: #10a37f; font-weight: 700;">Transistor Univ <span class="univ-badge">Active</span></a>
        <a href="/transistor-sim.php">GAA/FinFET Sim</a>
        <a href="/ai.php">AI Univ</a>
    </nav>
</header>

<!-- Hero Section -->
<section class="hero">
    <div class="hero-badge">
        <span>&#9889;</span> Transistor Engineering Masterclasses &bull; Levels 1 &ndash; 7
    </div>
    <h1>Transistor <span>University</span></h1>
    <p>
        The 75-Year Architecture of Active Amplification &amp; Nanoscale Logic Switching: from Bardeen, Brattain, and Shockley's 1947 point-contact crystal to CMOS inverters, 3D Tri-Gate FinFETs, GAA nanosheets, monolithic CFETs, and 2D monolayer channel physics.
    </p>
    <div class="hero-stats">
        <div class="stat-item">
            <div class="stat-val">7 <span>Levels</span></div>
            <div class="stat-lbl">Elementary to Fellow</div>
        </div>
        <div class="stat-item">
            <div class="stat-val">21 <span>Modules</span></div>
            <div class="stat-lbl">Rigorous Curriculum</div>
        </div>
        <div class="stat-item">
            <div class="stat-val">7 <span>Sim Labs</span></div>
            <div class="stat-lbl">Real-Time Engines</div>
        </div>
        <div class="stat-item">
            <div class="stat-val">7 <span>Diplomas</span></div>
            <div class="stat-lbl">Industry Fellow Laureate</div>
        </div>
    </div>
</section>

<!-- Level Switcher Bar -->
<div class="level-bar-wrap">
    <div class="level-bar">
        <button class="level-btn active" onclick="switchLevel(1)" title="Level 1: Elementary • 3-Terminal Switch"><span class="badge">L1</span> Elementary</button>
        <button class="level-btn" onclick="switchLevel(2)" title="Level 2: Middle School • Point-Contact to BJT"><span class="badge">L2</span> Middle School</button>
        <button class="level-btn" onclick="switchLevel(3)" title="Level 3: High School • CMOS &amp; Dynamic Power"><span class="badge">L3</span> High School</button>
        <button class="level-btn" onclick="switchLevel(4)" title="Level 4: College BS • Small-Signal &amp; fT"><span class="badge">L4</span> College BS</button>
        <button class="level-btn" onclick="switchLevel(5)" title="Level 5: Master's MS • 3D Tri-Gate FinFET"><span class="badge">L5</span> Master's MS</button>
        <button class="level-btn" onclick="switchLevel(6)" title="Level 6: PhD • GAA Nanosheet to CFET"><span class="badge">L6</span> PhD / Post-Doc</button>
        <button class="level-btn" onclick="switchLevel(7)" title="Level 7: Industry Fellow • 75-Yr Roadmap"><span class="badge">L7</span> Industry Fellow</button>
    </div>
</div>

<main class="main-wrap">

<!-- LEVEL 1: ELEMENTARY SCHOOL -->
<div class="level-container active" id="level-1">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 1 &bull; Ages 6–10</div>
            <div class="level-title">The Magical 3-Terminal Switch That Runs the World</div>
            <div class="level-subtitle">Discover how three simple metal pins &mdash; Gate, Source, and Drain &mdash; replaced glowing vacuum bulbs and launched the computer revolution.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 1.1</div>
                <h3>The Miracle of Three Terminals &mdash; In, Out, and the Magic Control Knob</h3>
                <p>Every normal wire in your home has two ends: electricity goes in one side and comes out the other. But a <strong>Transistor</strong> is special because it has <strong>three terminals</strong>! Two terminals let electricity flow across the main highway, while the third terminal acts as a magic control switch.</p>
                <p>Because the control terminal needs almost no power to flip the switch, a whisper-quiet signal from an antenna or sensor can turn a giant electrical current on and off. This is called <strong>amplification</strong> &mdash; taking a tiny signal and making it loud and clear!</p>
                <ul>
                    <li><strong>Emitter / Source:</strong> Where the electrical charge enters the highway.</li>
                    <li><strong>Collector / Drain:</strong> Where the electrical charge exits.</li>
                    <li><strong>Base / Gate:</strong> The control button that decides whether traffic gets through.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Active Amplification: } \text{Output Signal} = \text{Gain} \times \text{Input Control Signal}$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 1.2</div>
                <h3>From Giant Glass Vacuum Bulbs to Microscopic Silicon Flecks</h3>
                <p>Before transistors were invented, old radios and the very first computers (like ENIAC in 1945) used <strong>vacuum tubes</strong>. These were glowing glass lightbulbs the size of your fist! They got boiling hot, consumed huge amounts of electricity, and burned out every few hours like old holiday lights.</p>
                <p>A room-sized computer back then only had about 18,000 vacuum tubes. Today, a single tiny chip the size of your fingernail contains more than <strong>50,000,000,000 transistors</strong>! Silicon crystals don't burn out, don't have glass bulbs to shatter, and run on tiny battery voltages.</p>
                <ul>
                    <li><strong>ENIAC (1945):</strong> 18,000 glass tubes &bull; 30 tons &bull; 150,000 watts of power.</li>
                    <li><strong>Modern Smartphone (2026):</strong> 20 billion transistors &bull; 180 grams &bull; 4 watts of power.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Miniaturization Factor: } > 10^9\times \text{ (over 1 billion} \times \text{ more computing power per gram)}$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 1.3</div>
                <h3>How Billions of Transistors Team Up to Think, Calculate, and Play Games</h3>
                <p>How does a simple on/off switch let you play 3D games, stream video, or talk to an AI? When you connect two transistors together, you can make an <strong>AND gate</strong> (current only flows if Switch A AND Switch B are both on) or an <strong>OR gate</strong> (current flows if Switch A OR Switch B is on).</p>
                <p>By wiring millions of these logic gates together, chips can add numbers in binary (1s and 0s). Add billions more, and they can display colorful pixels on your screen, compress movie files, and recognize faces in photographs!</p>
                <ul>
                    <li><strong>Binary 1:</strong> Transistor switch turned ON (Voltage high).</li>
                    <li><strong>Binary 0:</strong> Transistor switch turned OFF (Voltage zero).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$Digital Logic: Billions of 1s and 0s executed in parallel create modern digital software.$$
            </div>
        </div>
    </div>

    <!-- Lab 1: Elementary -->
    <div class="lab-card">
        <div class="lab-tag">&#9881;&#65039; Interactive Laboratory 1</div>
        <div class="lab-title">3-Terminal On/Off Gate Switch &amp; Lightbulb Controller</div>
        <div class="lab-desc">Flip the gate switch voltage ($V_{GS}$) and observe how the transistor amplifies the signal to light up a glowing LED lamp.</div>
        
        <div class="lab-controls">
            <div class="lab-input-group">
                <label>Control Switch Voltage ($V_{GS}$ Gate): <span id="elemGateVal">0.75 V</span></label>
                <input type="range" id="elemGate" min="0.0" max="1.2" step="0.05" value="0.75" oninput="updateElemLab()">
            </div>
            <div class="lab-input-group">
                <label>Power Rail Supply ($V_{DD}$ Drain): <span id="elemDrainVal">1.0 V</span></label>
                <input type="range" id="elemDrain" min="0.2" max="1.5" step="0.1" value="1.0" oninput="updateElemLab()">
            </div>
            <div class="lab-input-group">
                <label>Transistor Sizing Factor: <span id="elemWidthVal">5x Drive</span></label>
                <input type="range" id="elemWidth" min="1" max="10" step="1" value="5" oninput="updateElemLab()">
            </div>
        </div>

        <div class="lab-results">
            <div class="lab-res-item">
                <div class="lab-res-label">Switch Conduction State</div>
                <div class="lab-res-val" id="elemState" style="color: #34d399;">Conducting Current &#9889;</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Lightbulb Brightness</div>
                <div class="lab-res-val" id="elemBright" style="color: #fbbf24;">85% Lumens &#128161;</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Amplification Factor</div>
                <div class="lab-res-val" id="elemGain">1,250x Gain</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Logic Bit</div>
                <div class="lab-res-val" id="elemBit" style="color: #38bdf8;">Bit "1" (HIGH)</div>
            </div>
        </div>
    </div>

    <!-- Quiz 1 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 1 Assessment</div>
            <div class="quiz-title">Knowledge Check: 3-Terminal Transistor Fundamentals</div>
        </div>

        <div class="quiz-q-wrap" id="q-elem1">
            <div class="quiz-q-text">1. Why does a transistor have three terminals instead of two like a regular wire?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('elem1', 0)">A) Two terminals carry the main electrical highway, while the third terminal acts as the control switch knob.</button>
                <button class="quiz-option" onclick="checkQuiz('elem1', 1)">B) One terminal is a spare in case the other two break off.</button>
                <button class="quiz-option" onclick="checkQuiz('elem1', 2)">C) The third terminal is used to plug into a wall garden hose.</button>
                <button class="quiz-option" onclick="checkQuiz('elem1', 3)">D) To allow three different colored wires to make a rainbow.</button>
            </div>
            <div class="quiz-explanation" id="exp-elem1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-elem2">
            <div class="quiz-q-text">2. What major device did silicon transistors replace in the 1950s?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('elem2', 0)">A) Hot, fragile, glass vacuum tubes that burned out like lightbulbs.</button>
                <button class="quiz-option" onclick="checkQuiz('elem2', 1)">B) Wooden abacuses and paper notebooks.</button>
                <button class="quiz-option" onclick="checkQuiz('elem2', 2)">C) Steam locomotive engines.</button>
                <button class="quiz-option" onclick="checkQuiz('elem2', 3)">D) Candle wax lanterns.</button>
            </div>
            <div class="quiz-explanation" id="exp-elem2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-elem3">
            <div class="quiz-q-text">3. How do computers do math using transistors?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('elem3', 0)">A) They whisper numbers through tiny microphones.</button>
                <button class="quiz-option" onclick="checkQuiz('elem3', 1)">B) By combining millions of on/off switches into logic gates that calculate in binary 1s and 0s.</button>
                <button class="quiz-option" onclick="checkQuiz('elem3', 2)">C) By melting solder wires onto paper cards.</button>
                <button class="quiz-option" onclick="checkQuiz('elem3', 3)">D) By spinning magnetic compasses inside the keyboard.</button>
            </div>
            <div class="quiz-explanation" id="exp-elem3"></div>
        </div>
    </div>

    <!-- Certificate 1 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 1 Completed: Junior Transistor Architecture Apprentice</h4>
            <p>Earned for mastering 3-terminal active device mechanics, vacuum tube evolution, and binary logic switching.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(1)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(2)">Advance to Level 2: Middle School &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 2: MIDDLE SCHOOL -->
<div class="level-container" id="level-2">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 2 &bull; Ages 11–13</div>
            <div class="level-title">The Birth of Solid-State: Point-Contact to BJT</div>
            <div class="level-subtitle">Explore the 1947 Bell Labs breakthrough, germanium point-contacts, bipolar junction sandwich physics, and current gain ($\beta$).</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 2.1</div>
                <h3>The 1947 Bell Labs Breakthrough &mdash; Bardeen, Brattain, and Shockley</h3>
                <p>In December 1947 at Bell Telephone Laboratories in Murray Hill, New Jersey, physicists <strong>John Bardeen</strong> and <strong>Walter Brattain</strong> built the world's first solid-state amplifier: the <strong>Point-Contact Transistor</strong>.</p>
                <p>They pressed two closely spaced gold-foil wedge contacts onto a crystal slab of germanium. When they injected a tiny current through one point, the electrical current emerging from the second point was magnified nearly a hundred-fold! This experiment earned Bardeen, Brattain, and William Shockley the 1956 Nobel Prize in Physics.</p>
                <ul>
                    <li><strong>Dec 23, 1947:</strong> The historic laboratory demonstration of solid-state speech amplification.</li>
                    <li><strong>Germanium ($Ge$):</strong> Used initially because high-purity silicon was too difficult to refine in the 1940s.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$Point-Contact Invention: Proved for the first time that semiconductor crystals can amplify active signals!$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 2.2</div>
                <h3>The Bipolar Junction Transistor (BJT) &mdash; Current-Controlled Amplification</h3>
                <p>While point contacts were fragile, William Shockley invented the much more rugged <strong>Bipolar Junction Transistor (BJT)</strong> in 1948. A BJT is an atomic three-layer sandwich: either <strong>NPN</strong> (n-type, p-type, n-type) or <strong>PNP</strong>.</p>
                <p>In an NPN transistor, the center p-type layer is called the <strong>Base</strong>, and it is made ultra-thin. When a tiny base current $I_B$ is pushed in, it forward-biases the base-emitter junction, flooding the base with electrons. Because the base is so thin, over 99% of these electrons get sucked right across into the <strong>Collector</strong>!</p>
                <ul>
                    <li><strong>Current Gain ($\beta$ or $h_{FE}$):</strong> The collector current is a magnified replica of the base current, $I_C = \beta I_B$ (typically $\beta = 100\text{ to } 300$).</li>
                    <li><strong>Bipolar Transport:</strong> Operates using <em>both</em> electrons and holes simultaneously.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{BJT Current Relation: } I_C = \beta I_B \quad\text{and}\quad I_E = I_C + I_B = (\beta + 1) I_B$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 2.3</div>
                <h3>Common-Emitter Amplifier Circuits &amp; Signal Voltage Gain</h3>
                <p>By placing a load resistor $R_C$ on the collector terminal, the magnified collector current $I_C$ produces a large voltage swing across the output resistor: $V_{\text{out}} = V_{CC} - I_C R_C$. This forms the foundational <strong>Common-Emitter (CE)</strong> audio and radio amplifier stage.</p>
                <p>A microphone signal of just $5\text{ millivolts}$ into the base can create an output signal of $500\text{ millivolts}$ &mdash; a $100\times$ voltage boost ($40\text{ dB}$)! This enabled the pocket transistor radios of the 1950s and the Apollo moon mission telemetry computers.</p>
                <ul>
                    <li><strong>Small-Signal Voltage Gain:</strong> $A_v = -g_m R_C = -\frac{I_C}{V_T} R_C$.</li>
                    <li><strong>Phase Inversion:</strong> When input goes UP, output voltage swings DOWN ($180^\circ$ phase shift).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Voltage Gain: } A_v = -\frac{I_C R_C}{V_T} \approx -38.9 \cdot I_C R_C \quad (\text{at } 300\text{ K})$$
            </div>
        </div>
    </div>

    <!-- Lab 2: Middle School -->
    <div class="lab-card">
        <div class="lab-tag">&#9881;&#65039; Interactive Laboratory 2</div>
        <div class="lab-title">BJT Current Gain ($\beta$) &amp; Common-Emitter Amplifier Sizer</div>
        <div class="lab-desc">Adjust the base input current ($I_B$) and collector load resistor ($R_C$) to calculate collector current amplification and stage voltage gain.</div>
        
        <div class="lab-controls">
            <div class="lab-input-group">
                <label>Input Base Current ($I_B$ in &mu;A): <span id="midIbVal">15 &mu;A</span></label>
                <input type="range" id="midIb" min="1" max="50" step="1" value="15" oninput="updateMidLab()">
            </div>
            <div class="lab-input-group">
                <label>Transistor Current Gain ($\beta = h_{FE}$): <span id="midBetaVal">150</span></label>
                <input type="range" id="midBeta" min="50" max="300" step="10" value="150" oninput="updateMidLab()">
            </div>
            <div class="lab-input-group">
                <label>Collector Load Resistor ($R_C$ in k&Omega;): <span id="midRcVal">2.2 k&Omega;</span></label>
                <input type="range" id="midRc" min="0.5" max="10.0" step="0.5" value="2.2" oninput="updateMidLab()">
            </div>
        </div>

        <div class="lab-results">
            <div class="lab-res-item">
                <div class="lab-res-label">Collector Current ($I_C$)</div>
                <div class="lab-res-val" id="midIc">2.25 mA</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Output Voltage Drop</div>
                <div class="lab-res-val" id="midVdrop">4.95 V</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Transconductance ($g_m$)</div>
                <div class="lab-res-val" id="midGm" style="color: #38bdf8;">86.9 mS</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Small-Signal Gain ($A_v$)</div>
                <div class="lab-res-val" id="midGain" style="color: #34d399;">-191x (45.6 dB)</div>
            </div>
        </div>
    </div>

    <!-- Quiz 2 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 2 Assessment</div>
            <div class="quiz-title">Knowledge Check: Bipolar Junction Transistors</div>
        </div>

        <div class="quiz-q-wrap" id="q-mid1">
            <div class="quiz-q-text">1. Who invented the first working point-contact transistor at Bell Labs in December 1947?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mid1', 0)">A) John Bardeen and Walter Brattain (under William Shockley's semiconductor research group).</button>
                <button class="quiz-option" onclick="checkQuiz('mid1', 1)">B) Thomas Edison and Nikola Tesla.</button>
                <button class="quiz-option" onclick="checkQuiz('mid1', 2)">C) Albert Einstein and Isaac Newton.</button>
                <button class="quiz-option" onclick="checkQuiz('mid1', 3)">D) Alan Turing and Steve Jobs.</button>
            </div>
            <div class="quiz-explanation" id="exp-mid1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-mid2">
            <div class="quiz-q-text">2. In an NPN bipolar transistor, why must the middle Base layer be fabricated ultra-thin?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mid2', 0)">A) To save manufacturing money on silicon raw materials.</button>
                <button class="quiz-option" onclick="checkQuiz('mid2', 1)">B) So injected minority electrons can diffuse straight through to the collector without recombining in the base.</button>
                <button class="quiz-option" onclick="checkQuiz('mid2', 2)">C) To make the transistor flexible like rubber.</button>
                <button class="quiz-option" onclick="checkQuiz('mid2', 3)">D) Because thicker bases reflect magnetic fields.</button>
            </div>
            <div class="quiz-explanation" id="exp-mid2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-mid3">
            <div class="quiz-q-text">3. What does the parameter $\beta$ (current gain) represent in a BJT?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mid3', 0)">A) The weight of the transistor chip packaging.</button>
                <button class="quiz-option" onclick="checkQuiz('mid3', 1)">B) The ratio of collector output current to base input current ($I_C / I_B$).</button>
                <button class="quiz-option" onclick="checkQuiz('mid3', 2)">C) The temperature at which the silicon crystal turns into liquid.</button>
                <button class="quiz-option" onclick="checkQuiz('mid3', 3)">D) The number of transistors soldered on the circuit board.</button>
            </div>
            <div class="quiz-explanation" id="exp-mid3"></div>
        </div>
    </div>

    <!-- Certificate 2 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 2 Completed: Certified Bipolar &amp; Active Device Specialist</h4>
            <p>Earned for demonstrated mastery of the solid-state revolution, BJT terminal physics, and current amplification circuits.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(2)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(3)">Advance to Level 3: High School &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 3: HIGH SCHOOL -->
<div class="level-container" id="level-3">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 3 &bull; Ages 14–18</div>
            <div class="level-title">The Field-Effect Transistor (FET) &amp; CMOS Revolution</div>
            <div class="level-subtitle">Explore why Field-Effect Transistors (MOSFETs) defeated BJTs in computing, how complementary NMOS+PMOS eliminated static power, and dynamic switching energy.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 3.1</div>
                <h3>Voltage Control vs Current Control &mdash; The High Input Impedance Advantage</h3>
                <p>Although BJTs are fantastic analog amplifiers, they have a fatal flaw for massive computing: the Base terminal requires constant steady DC current ($I_B = I_C / \beta$) to stay turned ON. If you tried to pack 1 billion BJTs onto a single chip, the required base currents would consume thousands of watts and melt the chip in seconds!</p>
                <p>The <strong>Metal-Oxide-Semiconductor Field-Effect Transistor (MOSFET)</strong> solved this completely. Its Gate terminal is isolated by a glass dielectric oxide layer ($\text{SiO}_2$ or $\text{HfO}_2$). Applying a gate voltage sets up an electrostatic field without drawing any continuous DC input current ($I_G \approx 0$).</p>
                <ul>
                    <li><strong>BJT:</strong> Current-controlled ($I_C = \beta I_B$) &bull; Constant static base power required.</li>
                    <li><strong>MOSFET:</strong> Voltage-controlled ($I_D \propto (V_{GS}-V_{th})^2$) &bull; Zero static gate power ($R_{\text{in}} > 10^{14}\,\Omega$).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Static Gate Power: } P_{\text{gate,static}} = V_G \cdot I_G \approx 0\text{ Watts}$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 3.2</div>
                <h3>The Complementary MOS (CMOS) Breakthrough &mdash; Paired NMOS and PMOS</h3>
                <p>In 1963, Chih-Tang Sah and Frank Wanlass at Fairchild Semiconductor invented <strong>CMOS (Complementary Metal-Oxide-Semiconductor)</strong>. Instead of using only NMOS transistors with pull-up resistors (which waste electricity whenever the output is LOW), CMOS pairs an <strong>NMOS</strong> transistor with a complementary <strong>PMOS</strong> transistor.</p>
                <p>In a CMOS digital inverter, when input is HIGH, the NMOS turns ON and the PMOS turns OFF, pulling output to Ground. When input is LOW, the PMOS turns ON and NMOS turns OFF, pulling output to $V_{DD}$. At steady state, one transistor is <em>always OFF</em>, cutting DC static power dissipation to virtually zero!</p>
                <ul>
                    <li><strong>NMOS (Pull-Down):</strong> Conducts when Gate is HIGH ($V_{GS} > V_{thn}$).</li>
                    <li><strong>PMOS (Pull-Up):</strong> Conducts when Gate is LOW ($V_{SG} > |V_{thp}|$).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{CMOS Inverter: } I_{\text{static}} = 0 \quad (\text{Zero static current path between } V_{DD} \text{ and Ground})$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 3.3</div>
                <h3>Digital Switching Energy &amp; Dynamic Power: $P = \alpha C_L V_{dd}^2 f$</h3>
                <p>Because CMOS consumes almost zero static power, where does computer heat come from? Power is dissipated during <strong>switching transitions</strong>! Every time a transistor switches from 0 to 1, it charges the parasitic load capacitance $C_L$ of the interconnect wire and next logic gates.</p>
                <p>Energy stored on the capacitor is $E = \frac{1}{2} C_L V_{dd}^2$, and an equal amount is dissipated as heat in the charging transistor channel. Multiplying by clock frequency $f$ and activity factor $\alpha$ yields the famous <strong>Dynamic Power Law</strong> that governs all modern microprocessors:</p>
                <ul>
                    <li><strong>Voltage Quadratic Dependence:</strong> Cutting supply voltage from $1.2\text{ V}$ to $0.7\text{ V}$ slashes dynamic power by nearly $3\times$!</li>
                    <li><strong>Activity Factor ($\alpha$):</strong> Typically $0.1$ to $0.2$ (only 10–20% of logic nodes switch per clock cycle).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Dynamic Power Equation: } P_{\text{dyn}} = \alpha \cdot C_L \cdot V_{dd}^2 \cdot f$$
            </div>
        </div>
    </div>

    <!-- Lab 3: High School -->
    <div class="lab-card">
        <div class="lab-tag">&#9881;&#65039; Interactive Laboratory 3</div>
        <div class="lab-title">CMOS Inverter Dynamic Power &amp; Energy-Per-Switch Calculator</div>
        <div class="lab-desc">Configure the clock frequency ($f$), supply voltage ($V_{dd}$), and load capacitance ($C_L$) to calculate energy dissipated per cycle and total chip power.</div>
        
        <div class="lab-controls">
            <div class="lab-input-group">
                <label>Clock Frequency ($f$ in GHz): <span id="highFreqVal">3.5 GHz</span></label>
                <input type="range" id="highFreq" min="0.5" max="6.0" step="0.1" value="3.5" oninput="updateHighLab()">
            </div>
            <div class="lab-input-group">
                <label>Supply Voltage ($V_{dd}$ in Volts): <span id="highVddVal">0.85 V</span></label>
                <input type="range" id="highVdd" min="0.5" max="1.3" step="0.05" value="0.85" oninput="updateHighLab()">
            </div>
            <div class="lab-input-group">
                <label>Total Active Gates ($N$ in Billions): <span id="highGatesVal">10 Billion</span></label>
                <input type="range" id="highGates" min="1" max="50" step="1" value="10" oninput="updateHighLab()">
            </div>
        </div>

        <div class="lab-results">
            <div class="lab-res-item">
                <div class="lab-res-label">Energy per Switch ($E_{\text{switch}}$)</div>
                <div class="lab-res-val" id="highEswitch">1.44 fJ</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Dynamic Power Density</div>
                <div class="lab-res-val" id="highPtot">50.6 Watts</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Power Reduction vs 1.2V</div>
                <div class="lab-res-val" id="highSaved" style="color: #38bdf8;">-49.8% Power Saved</div>
            </div>
            <div class="lab-res-item">
                <div class="lab-res-label">Thermal Envelope</div>
                <div class="lab-res-val" id="highThermal" style="color: #34d399;">Standard Air Cooling &#9989;</div>
            </div>
        </div>
    </div>

    <!-- Quiz 3 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 3 Assessment</div>
            <div class="quiz-title">Knowledge Check: CMOS &amp; Dynamic Power</div>
        </div>

        <div class="quiz-q-wrap" id="q-high1">
            <div class="quiz-q-text">1. Why did MOSFETs replace BJTs as the primary building block for dense digital microprocessors?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('high1', 0)">A) MOSFET gates are insulated by an oxide dielectric, drawing almost zero steady DC input current, which allows billions of devices on a single die without melting.</button>
                <button class="quiz-option" onclick="checkQuiz('high1', 1)">B) BJTs can only operate under liquid nitrogen cooling.</button>
                <button class="quiz-option" onclick="checkQuiz('high1', 2)">C) MOSFETs are made of plastic rather than silicon.</button>
                <button class="quiz-option" onclick="checkQuiz('high1', 3)">D) BJTs cannot switch faster than 100 times per minute.</button>
            </div>
            <div class="quiz-explanation" id="exp-high1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-high2">
            <div class="quiz-q-text">2. What is the key operational advantage of a CMOS logic gate pairing NMOS and PMOS transistors?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('high2', 0)">A) It doubles the physical size of the circuit board.</button>
                <button class="quiz-option" onclick="checkQuiz('high2', 1)">B) In steady state, one transistor is always OFF, eliminating static short-circuit current between power and ground.</button>
                <button class="quiz-option" onclick="checkQuiz('high2', 2)">C) It generates electricity that recharges the power grid.</button>
                <button class="quiz-option" onclick="checkQuiz('high2', 3)">D) It eliminates the need for software coding.</button>
            </div>
            <div class="quiz-explanation" id="exp-high2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-high3">
            <div class="quiz-q-text">3. According to the dynamic power equation $P = \alpha C_L V_{dd}^2 f$, what happens if you lower the core supply voltage $V_{dd}$ by 50%?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('high3', 0)">A) Power increases by 400%.</button>
                <button class="quiz-option" onclick="checkQuiz('high3', 1)">B) Power drops by 75% (scales with $V_{dd}^2$).</button>
                <button class="quiz-option" onclick="checkQuiz('high3', 2)">C) Power drops by exactly 50%.</button>
                <button class="quiz-option" onclick="checkQuiz('high3', 3)">D) Power is unaffected because only clock frequency matters.</button>
            </div>
            <div class="quiz-explanation" id="exp-high3"></div>
        </div>
    </div>

    <!-- Certificate 3 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 3 Completed: Advanced CMOS Switching &amp; Logic Specialist</h4>
            <p>Earned for rigorous mastery of voltage-controlled gate impedance, complementary CMOS inverter topology, and $C V^2 f$ dynamic power scaling.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(3)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(4)">Advance to Level 4: College BS &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 4: COLLEGE (UNDERGRADUATE BS) -->
<div class="level-container" id="level-4">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 4 &bull; College BS Electrical Engineering</div>
            <div class="level-title">Small-Signal Modeling, High-Frequency Dynamics & The Cutoff Limit $f_T$</div>
            <div class="level-subtitle">Transition from digital switching to analog small-signal linearization: transconductance $g_m$, output conductance $g_{ds}$, early voltage $V_A$, and gigahertz gain-bandwidth products.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 4.1</div>
                <h3>Small-Signal Linearization & Transconductance ($g_m$)</h3>
                <p>When an active transistor is biased at a quiescent operating point ($Q$-point: $V_{GS0}, V_{DS0}, I_{D0}$), small input perturbations $\Delta v_{gs}(t)$ produce proportional small-signal drain currents $i_d(t) \approx g_m v_{gs}$. The primary metric of transistor amplification efficiency is the <strong>transconductance</strong> $g_m$:</p>
                <div class="formula-box">
                $$g_m = \left. \frac{\partial I_D}{\partial V_{GS}} \right|_{V_{DS0}} = \mu C_{ox} \frac{W}{L} (V_{GS} - V_{th}) = \sqrt{2 \mu C_{ox} \frac{W}{L} I_D} = \frac{2 I_D}{V_{GS} - V_{th}}$$
            </div>
                <p>In short-channel and nanometer transistors subject to severe velocity saturation, $I_D \propto (V_{GS} - V_{th})$ rather than quadratic, causing $g_m$ to saturate at a constant value independent of overdrive:</p>
                <div class="formula-box">
                $$g_{m,\text{sat}} = W C_{ox} v_{\text{sat}}$$
            </div>
                <p>To maximize $g_m$ without burning excessive DC current, analog designers evaluate the <strong>transconductance efficiency</strong> $g_m / I_D$, which reaches its theoretical maximum in subthreshold / weak inversion ($\approx q / (m k_B T) \sim 25\text{--}35\text{ V}^{-1}$).</p>
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 4.2</div>
                <h3>Output Resistance, Channel-Length Modulation & Early Voltage ($V_A$)</h3>
                <p>In an ideal long-channel saturation region, the pinch-off point absorbs all increases in $V_{DS}$, yielding zero output conductance ($r_o = \infty$). In physical transistors, increasing $V_{DS}$ expands the drain depletion region toward the source, shortening the electrical channel length ($L_{\text{eff}} = L - \Delta L$). This is <strong>Channel-Length Modulation (CLM)</strong>:</p>
                <div class="formula-box">
                $$I_D = \frac{1}{2} \mu_n C_{ox} \frac{W}{L} (V_{GS} - V_{th})^2 (1 + \lambda V_{DS})$$
            </div>
                <p>The small-signal output resistance $r_o$ and output conductance $g_{ds}$ are directly related to the Early Voltage $V_A = 1/\lambda$:</p>
                <div class="formula-box">
                $$r_o = \frac{1}{g_{ds}} = \left( \left. \frac{\partial I_D}{\partial V_{DS}} \right|_{V_{GS0}} \right)^{-1} = \frac{V_A + V_{DS}}{I_D} \approx \frac{V_A}{I_D}$$
            </div>
                <p>The product of transconductance and output resistance defines the <strong>intrinsic voltage gain</strong> of an isolated single transistor stage: $A_{v0} = g_m r_o$. In advanced FinFET and GAA nodes, short-channel effects degrade $r_o$, requiring cascode configurations or multi-stage topologies to recover high open-loop gain.</p>
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 4.3</div>
                <h3>High-Frequency Cutoff $f_T$, $f_{\max}$ & The Gain-Bandwidth Limit</h3>
                <p>At radio frequency (RF) and microwave frequencies, internal parasitic capacitances ($C_{gs}, C_{gd}, C_{db}, C_{sb}$) divert small-signal current. The <strong>unity-current-gain cutoff frequency</strong> $f_T$ represents the frequency at which the transistor's short-circuit current gain drops to unity ($0\text{ dB}$):</p>
                <div class="formula-box">
                $$f_T = \frac{g_m}{2\pi (C_{gs} + C_{gd})} \approx \frac{3 \mu (V_{GS} - V_{th})}{4 \pi L^2} \quad \xrightarrow{\text{velocity sat.}} \quad f_T \approx \frac{v_{\text{sat}}}{2 \pi L}$$
            </div>
                <p>For power amplification, the <strong>maximum oscillation frequency</strong> $f_{\max}$ (where unilateral power gain $U = 1$) accounts for parasitic gate resistance $R_g$ and drain-bulk conductance:</p>
                <div class="formula-box">
                $$f_{\max} \approx \sqrt{\frac{f_T}{8 \pi R_g C_{gd}}}$$
            </div>
                <p>Scaling gate length $L_g$ down from $1\ \mu\text{m}$ to $14\text{nm}$ drove $f_T$ from $<10\text{ GHz}$ up to over $350\text{ GHz}$, enabling integrated mmWave 5G/6G transceivers and automotive radar directly on bulk CMOS.</p>
            </div>
        </div>
    </div>

    <!-- Interactive Lab 4 -->
    <div class="interactive-lab">
        <div class="lab-title">
            <span>&#9881;</span> Interactive Lab: Small-Signal AC Gain & Bandwidth Analyzer ($f_T, g_m, r_o, A_v$)
        </div>
        <p style="color:var(--text-secondary);font-size:0.95rem;margin-bottom:1.5rem;">
            Configure transistor DC bias current, Early voltage $V_A$, overdrive voltage $(V_{GS}-V_{th})$, and parasitic gate capacitance to calculate transconductance $g_m$, output resistance $r_o$, intrinsic voltage gain $A_v$, and the unity-gain cutoff frequency $f_T$.
        </p>
        <div class="lab-controls">
            <div class="control-group">
                <label>Drain Current $I_D$ ($\mu\text{A}$): <span id="colIdVal">250</span> &mu;A</label>
                <input type="range" id="colId" min="10" max="2000" step="10" value="250" oninput="updateColLab()">
            </div>
            <div class="control-group">
                <label>Overdrive Voltage $(V_{GS}-V_{th})$: <span id="colVodVal">0.18</span> V</label>
                <input type="range" id="colVod" min="0.05" max="0.50" step="0.01" value="0.18" oninput="updateColLab()">
            </div>
            <div class="control-group">
                <label>Early Voltage $V_A$ (V): <span id="colVaVal">12.0</span> V</label>
                <input type="range" id="colVa" min="1.0" max="50.0" step="0.5" value="12.0" oninput="updateColLab()">
            </div>
            <div class="control-group">
                <label>Total Gate Capacitance $C_{gg}$ (fF): <span id="colCggVal">15.0</span> fF</label>
                <input type="range" id="colCgg" min="1.0" max="100.0" step="1.0" value="15.0" oninput="updateColLab()">
            </div>
        </div>
        <div class="lab-display">
            <div class="lab-metric">
                <div class="metric-label">Transconductance $g_m$</div>
                <div class="metric-val" id="colGmOut">2.78 mS</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Output Resistance $r_o$</div>
                <div class="metric-val" id="colRoOut">48.0 k&Omega;</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Intrinsic Gain $A_{v0} = g_m r_o$</div>
                <div class="metric-val" id="colAvOut">133.3 (42.5 dB)</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Cutoff Frequency $f_T$</div>
                <div class="metric-val" id="colFtOut">29.5 GHz</div>
            </div>
        </div>
    </div>

    <!-- Assessment Quiz 4 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 4 Assessment</div>
            <div class="quiz-title">Knowledge Check: Small-Signal Dynamics &amp; RF Cutoff</div>
        </div>

        <div class="quiz-q-wrap" id="q-col1">
            <div class="quiz-q-text">1. In a velocity-saturated nanometer MOSFET, how does transconductance $g_m$ scale with overdrive $(V_{GS}-V_{th})$ compared to a classic long-channel device?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('col1', 0)">A) It grows quadratically with $(V_{GS}-V_{th})^2$.</button>
                <button class="quiz-option" onclick="checkQuiz('col1', 1)">B) It saturates and becomes nearly constant ($g_m \approx W C_{ox} v_{\text{sat}}$), rather than growing linearly with overdrive.</button>
                <button class="quiz-option" onclick="checkQuiz('col1', 2)">C) It drops to zero immediately above threshold voltage.</button>
                <button class="quiz-option" onclick="checkQuiz('col1', 3)">D) It oscillates inversely with channel length modulation.</button>
            </div>
            <div class="quiz-exp" id="exp-col1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-col2">
            <div class="quiz-q-text">2. What is the physical origin of Channel-Length Modulation (Early effect) in a MOSFET operating in saturation?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('col2', 0)">A) Thermal expansion of copper interconnect metal lines.</button>
                <button class="quiz-option" onclick="checkQuiz('col2', 1)">B) Increasing $V_{DS}$ expands the drain-body depletion region, shortening the effective channel $L_{\text{eff}} = L - \Delta L$.</button>
                <button class="quiz-option" onclick="checkQuiz('col2', 2)">C) Dielectric breakdown of the gate oxide insulating layer.</button>
                <button class="quiz-option" onclick="checkQuiz('col2', 3)">D) Quantum tunneling through the source p-n junction barrier.</button>
            </div>
            <div class="quiz-exp" id="exp-col2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-col3">
            <div class="quiz-q-text">3. If a designer scales the channel length $L$ by $2\times$ smaller ($L \to L/2$) in a drift-dominated regime without velocity saturation, how does the unity-gain cutoff frequency $f_T$ scale?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('col3', 0)">A) Increases by $4\times$ ($f_T \propto 1/L^2$).</button>
                <button class="quiz-option" onclick="checkQuiz('col3', 1)">B) Increases by $2\times$ linearly.</button>
                <button class="quiz-option" onclick="checkQuiz('col3', 2)">C) Decreases by $4\times$ due to Miller capacitance.</button>
                <button class="quiz-option" onclick="checkQuiz('col3', 3)">D) Remains completely invariant.</button>
            </div>
            <div class="quiz-exp" id="exp-col3"></div>
        </div>
    </div>

    <!-- Certificate 4 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 4 Completed: Bachelor of Science in Transistor Engineering</h4>
            <p>Earned for rigorous mastery of small-signal linearization, transconductance efficiency $g_m/I_D$, Early voltage $V_A$, and gigahertz gain-bandwidth products.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(4)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(5)">Advance to Level 5: Master's MS &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 5: MASTER'S (GRADUATE MS) -->
<div class="level-container" id="level-5">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 5 &bull; Master of Science VLSI Device Architecture</div>
            <div class="level-title">3D Tri-Gate FinFETs, Width Quantization & Sub-20nm Electrostatics</div>
            <div class="level-subtitle">How non-planar 3D fin geometry broke through the 20nm planar scaling wall, introduced discrete fin width quantization, and reshaped modern ASIC standard cell libraries.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 5.1</div>
                <h3>The 20nm Planar Scaling Wall & The Tri-Gate Revolution</h3>
                <p>By the 20nm node (circa 2011), conventional planar MOSFETs hit a fundamental physical barrier: reducing channel length below $25\text{nm}$ allowed drain electric field lines to penetrate deep through the substrate beneath the gate. This caused uncontrollable <strong>Drain-Induced Barrier Lowering (DIBL)</strong>, subthreshold leakage in excess of $100\text{ nA}/\mu\text{m}$, and catastrophic punch-through.</p>
                <p>The breakthrough solution was the <strong>Tri-Gate FinFET</strong> (commercialized by Intel at 22nm Ivy Bridge):</p>
                <ul>
                    <li>The silicon channel is raised vertically into a thin 3D "fin" of height $H_{\text{fin}}$ and thickness $W_{\text{fin}}$.</li>
                    <li>The gate dielectric and metal electrode wrap around <strong>three sides</strong> of the fin (top, left wall, right wall).</li>
                    <li>Because the silicon body is fully depleted and sandwiched between gate walls, the gate maintains complete electrostatic control over the potential throughout the entire fin bulk.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Natural Electrostatic Length: } \lambda_E = \sqrt{\frac{\varepsilon_{\text{si}}}{2 \varepsilon_{ox}} t_{ox} W_{\text{fin}}} \ll L_g$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 5.2</div>
                <h3>Width Quantization & Standard Cell Fin Depopulation</h3>
                <p>In planar CMOS, layout designers enjoyed continuous freedom to size transistor width ($W = 120\text{nm}, 240\text{nm}, 500\text{nm}$). In a FinFET, the effective conduction width per fin is strictly determined by its 3D perimeter:</p>
                <div class="formula-box">
                $$W_{\text{eff, 1-fin}} = 2 \times H_{\text{fin}} + W_{\text{fin}}$$
            </div>
                <p>For a transistor with $N$ parallel fins, the total width is discrete (quantized):</p>
                <div class="formula-box">
                $$W_{\text{eff}} = N_{\text{fins}} \times (2 H_{\text{fin}} + W_{\text{fin}}), \quad N_{\text{fins}} \in \{1, 2, 3, \dots\}$$
            </div>
                <p>To scale standard cell heights across technological nodes (e.g., from 9-track to 7.5-track and 6-track cells), foundries performed <strong>fin depopulation</strong> &mdash; reducing the number of fins per cell from 3 fins to 2 fins, and finally down to a single fin per device ($N=1$). To maintain high drive current $I_{on}$, process engineers drove fin aspect ratios higher, increasing fin height from $30\text{nm}$ up to $>60\text{nm}$.</p>
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 5.3</div>
                <h3>Fin Parasitics, Corner Conduction & Strain Engineering</h3>
                <p>While FinFETs dramatically reduced subthreshold leakage, their 3D geometry introduced new physical design challenges:</p>
                <ul>
                    <li><strong>Corner Conduction:</strong> The electric field concentrates at the top corners of the fin, inducing early threshold turn-on unless corners are rounded via hydrogen annealing.</li>
                    <li><strong>3D Parasitic Capacitances:</strong> Close proximity of adjacent vertical fins increases gate-to-source fringe capacitance ($C_{\text{fringe}}$) and fin-to-fin sidewall capacitance.</li>
                    <li><strong>S/D Stress Engineering:</strong> Epitaxial embedded $\text{Si}_{1-x}\text{Ge}_x$ in pMOS sources/drains induces uniaxial compressive stress (boosting hole mobility up to $3\times$), while $\text{Si:C}$ or embedded $\text{Si:P}$ induces tensile stress in nMOS channels to boost electron velocity.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Delay Metric: } \tau \approx \frac{C_{\text{gate}} + C_{\text{fringe}} + C_{\text{wire}}}{I_{\text{eff}}} V_{DD}$$
            </div>
        </div>
    </div>

    <!-- Interactive Lab 5 -->
    <div class="interactive-lab">
        <div class="lab-title">
            <span>&#9881;</span> Interactive Lab: 3D FinFET $W_{\text{eff}}$, Drive Current & Parasitic Delay Calculator
        </div>
        <p style="color:var(--text-secondary);font-size:0.95rem;margin-bottom:1.5rem;">
            Adjust fin height, fin width, number of parallel fins, and drive current density to calculate the quantized effective electrical width $W_{\text{eff}}$, total drive current $I_{on}$, and resulting standard cell gate delay.
        </p>
        <div class="lab-controls">
            <div class="control-group">
                <label>Fin Height $H_{\text{fin}}$ (nm): <span id="masHfinVal">50</span> nm</label>
                <input type="range" id="masHfin" min="25" max="80" step="1" value="50" oninput="updateMasLab()">
            </div>
            <div class="control-group">
                <label>Fin Width $W_{\text{fin}}$ (nm): <span id="masWfinVal">7</span> nm</label>
                <input type="range" id="masWfin" min="4" max="15" step="1" value="7" oninput="updateMasLab()">
            </div>
            <div class="control-group">
                <label>Number of Fins $N_{\text{fins}}$: <span id="masNfinsVal">2</span> fins</label>
                <input type="range" id="masNfins" min="1" max="4" step="1" value="2" oninput="updateMasLab()">
            </div>
            <div class="control-group">
                <label>Drive Current Density $J_{on}$ ($\mu\text{A}/\mu\text{m}$): <span id="masJonVal">1200</span> &mu;A/&mu;m</label>
                <input type="range" id="masJon" min="600" max="1800" step="50" value="1200" oninput="updateMasLab()">
            </div>
        </div>
        <div class="lab-display">
            <div class="lab-metric">
                <div class="metric-label">Width Per Fin $W_{\text{1-fin}}$</div>
                <div class="metric-val" id="masW1Out">107.0 nm</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Total Quantized $W_{\text{eff}}$</div>
                <div class="metric-val" id="masWeffOut">214.0 nm</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Total On-State Current $I_{on}$</div>
                <div class="metric-val" id="masIonOut">256.8 &mu;A</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Intrinsic RC Gate Delay</div>
                <div class="metric-val" id="masDelayOut">0.82 ps</div>
            </div>
        </div>
    </div>

    <!-- Assessment Quiz 5 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 5 Assessment</div>
            <div class="quiz-title">Knowledge Check: 3D FinFET Architecture &amp; Quantization</div>
        </div>

        <div class="quiz-q-wrap" id="q-mas1">
            <div class="quiz-q-text">1. For a tri-gate FinFET with fin height $H_{\text{fin}} = 55\text{nm}$ and fin thickness $W_{\text{fin}} = 8\text{nm}$, what is the effective electrical channel width $W_{\text{eff}}$ for a 2-fin device?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mas1', 0)">A) $118\text{ nm}$</button>
                <button class="quiz-option" onclick="checkQuiz('mas1', 1)">B) $236\text{ nm}$ ($2 \times [2(55) + 8]$)</button>
                <button class="quiz-option" onclick="checkQuiz('mas1', 2)">C) $440\text{ nm}$</button>
                <button class="quiz-option" onclick="checkQuiz('mas1', 3)">D) $63\text{ nm}$</button>
            </div>
            <div class="quiz-exp" id="exp-mas1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-mas2">
            <div class="quiz-q-text">2. Why did foundry standard cell libraries move from 3 fins per transistor (9T cell) to 1 fin per transistor (5T/6T cell) during FinFET scaling?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mas2', 0)">A) To depopulate fins so cell track height could shrink, while increasing fin height $H_{\text{fin}}$ to sustain drive current.</button>
                <button class="quiz-option" onclick="checkQuiz('mas2', 1)">B) Because multi-fin devices violate Kirchhoff's Current Law.</button>
                <button class="quiz-option" onclick="checkQuiz('mas2', 2)">C) Because gate leakage is zero in 1-fin devices.</button>
                <button class="quiz-option" onclick="checkQuiz('mas2', 3)">D) To eliminate the need for source and drain contacts.</button>
            </div>
            <div class="quiz-exp" id="exp-mas2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-mas3">
            <div class="quiz-q-text">3. What material is epitaxially grown in the Source/Drain pockets of advanced pMOS FinFETs to boost hole mobility?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('mas3', 0)">A) Polycrystalline diamond.</button>
                <button class="quiz-option" onclick="checkQuiz('mas3', 1)">B) Silicon-Germanium ($\text{Si}_{1-x}\text{Ge}_x$) to induce compressive uniaxial strain in the silicon channel.</button>
                <button class="quiz-option" onclick="checkQuiz('mas3', 2)">C) Pure aluminum metal.</button>
                <button class="quiz-option" onclick="checkQuiz('mas3', 3)">D) Hafnium oxide ceramic.</button>
            </div>
            <div class="quiz-exp" id="exp-mas3"></div>
        </div>
    </div>

    <!-- Certificate 5 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 5 Completed: Master of Science in Transistor Engineering</h4>
            <p>Conferred for demonstrated mastery of 3D Tri-Gate FinFET physics, width quantization $W_{\text{eff}}$, fin depopulation, and S/D epitaxial strain engineering.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(5)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(6)">Advance to Level 6: PhD / Post-Doc &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 6: DOCTORATE (PHD) -->
<div class="level-container" id="level-6">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 6 &bull; PhD in Solid-State Device Physics</div>
            <div class="level-title">Gate-All-Around (GAA) Nanosheets, MBCFETs, Forksheets & Monolithic 3D CFETs</div>
            <div class="level-subtitle">Pushing Moore's Law into atomic dimensions: horizontally stacked silicon nanosheets, self-aligned inner spacers, forksheet dielectric walls, and 3D vertically integrated Complementary FETs.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 6.1</div>
                <h3>Gate-All-Around Nanosheets & Multi-Bridge Channel FETs (MBCFET)</h3>
                <p>At gate lengths below $18\text{nm}$ (the 3nm/2nm transition), even 3-sided FinFET electrostatics degrade due to fin bending and sub-fin leakage through the bulk silicon bulb. The industry converged on <strong>Gate-All-Around (GAA) Nanosheets</strong> (Samsung MBCFET, Intel RibbonFET, TSMC N2):</p>
                <ul>
                    <li>Alternating superlattices of $\text{Si}$ and $\text{Si}_{1-x}\text{Ge}_x$ layers are grown epitaxially on a bulk silicon substrate.</li>
                    <li>After fin patterning, a highly selective chemical or gas-phase etch removes the sacrificial $\text{SiGe}$ layers, leaving 3 to 4 suspended, horizontally oriented silicon nanosheet channels.</li>
                    <li>Atomic Layer Deposition (ALD) coats each nanosheet on <strong>all four sides</strong> with high-k dielectric and work-function metal, delivering complete $360^\circ$ electrostatic wraparound.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Per-Sheet Width: } W_{\text{eff, sheet}} = 2 \times (W_{\text{sheet}} + T_{\text{sheet}}) \approx 2 W_{\text{sheet}}$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 6.2</div>
                <h3>Inner Spacer Engineering & Bottom Dielectric Isolation (BDI)</h3>
                <p>Fabricating nanosheet transistors requires atomic-scale precision inside the gate trench:</p>
                <ul>
                    <li><strong>Inner Spacer Module:</strong> Following the sacrificial SiGe cavity etch, low-k dielectric spacers ($\text{SiBCN}$ or $\text{SiOCN}$) are formed between the nanosheet channels at the edges of the source/drain. These inner spacers define the gate length and shield the gate metal from capacitive coupling to the epitaxial S/D contacts ($C_{gd}, C_{gs}$).</li>
                    <li><strong>Bottom Dielectric Isolation (BDI):</strong> An oxide barrier layer grown directly underneath the bottom nanosheet completely eliminates parasitic punch-through and sub-fin substrate leakage current.</li>
                    <li><strong>Continuous Width Tuning:</strong> Unlike FinFETs which are width-quantized by discrete integer fins, nanosheets allow variable sheet widths ($W_{\text{sheet}} \in [15\text{nm}, 55\text{nm}]$) within the same layout, restoring analog design flexibility.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Total Drive Capacity: } I_{D,\text{total}} = \sum_{k=1}^{N_{\text{sheets}}} W_{\text{eff}, k} \cdot J_{\text{sheet}}$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 6.3</div>
                <h3>Forksheets & The Monolithic 3D Complementary FET (CFET)</h3>
                <p>Standard cell area scaling is heavily constrained by the required separation gap between nMOS and pMOS transistors (N-to-P space, typically $20\text{--}30\text{nm}$). Two revolutionary architectures collapse this boundary:</p>
                <ul>
                    <li><strong>Forksheet Transistor:</strong> A dielectric wall ($\text{Si}_3\text{N}_4$ or $\text{SiO}_2$) is introduced between the nFET and pFET nanosheets before gate deposition. The gate is shaped like a fork, reducing N-to-P spacing to $<15\text{nm}$ and shrinking cell area by $20\%$.</li>
                    <li><strong>Monolithic 3D Complementary FET (CFET):</strong> Instead of placing nFET and pFET side-by-side, the CFET stacks the nMOS nanosheets <strong>directly on top</strong> of the pMOS nanosheets (or vice versa) in a single vertical pillar. This achieves an unprecedented $50\%$ cell footprint reduction, compressing standard cells down to 4-track or 3-track heights and extending CMOS scaling through the 1nm / A10 node.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{CFET Footprint Advantage: } \text{Area}_{\text{CFET}} \approx 0.50 \times \text{Area}_{\text{GAA Lateral}}$$
            </div>
        </div>
    </div>

    <!-- Interactive Lab 6 -->
    <div class="interactive-lab">
        <div class="lab-title">
            <span>&#9881;</span> Interactive Lab: Nanosheet vs Forksheet vs CFET 3D Density & Drive Current Simulator
        </div>
        <p style="color:var(--text-secondary);font-size:0.95rem;margin-bottom:1.5rem;">
            Configure nanosheet width, sheet count, vertical sheet separation, and compare the effective channel width, silicon real-estate footprint, and drive current density across FinFET, GAA Nanosheet, Forksheet, and 3D CFET.
        </p>
        <div class="lab-controls">
            <div class="control-group">
                <label>Nanosheet Width $W_{\text{sheet}}$ (nm): <span id="phdWsheetVal">35</span> nm</label>
                <input type="range" id="phdWsheet" min="15" max="60" step="1" value="35" oninput="updatePhdLab()">
            </div>
            <div class="control-group">
                <label>Sheet Thickness $T_{\text{sheet}}$ (nm): <span id="phdTsheetVal">5.0</span> nm</label>
                <input type="range" id="phdTsheet" min="3.0" max="8.0" step="0.5" value="5.0" oninput="updatePhdLab()">
            </div>
            <div class="control-group">
                <label>Number of Vertical Sheets: <span id="phdNsheetsVal">3</span> sheets</label>
                <input type="range" id="phdNsheets" min="2" max="5" step="1" value="3" oninput="updatePhdLab()">
            </div>
            <div class="control-group">
                <label>Cell Architecture: <span id="phdArchVal">GAA Nanosheet</span></label>
                <select id="phdArch" onchange="updatePhdLab()" style="width:100%;padding:0.5rem;background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-primary);border-radius:6px;">
                    <option value="finfet">3D FinFET (2 Fins)</option>
                    <option value="gaa" selected>GAA Nanosheet (Lateral n/p)</option>
                    <option value="forksheet">Forksheet (Dielectric Wall)</option>
                    <option value="cfet">Monolithic 3D CFET (Stacked)</option>
                </select>
            </div>
        </div>
        <div class="lab-display">
            <div class="lab-metric">
                <div class="metric-label">Single Device $W_{\text{eff}}$</div>
                <div class="metric-val" id="phdWeffOut">240.0 nm</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Relative Inverter Cell Area</div>
                <div class="metric-val" id="phdAreaOut">1.00 &times; (Baseline)</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Effective Current Density</div>
                <div class="metric-val" id="phdJout">1.45 mA/&mu;m-cell</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Subthreshold Swing SS</div>
                <div class="metric-val" id="phdSsOut">63.5 mV/dec</div>
            </div>
        </div>
    </div>

    <!-- Assessment Quiz 6 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 6 Assessment</div>
            <div class="quiz-title">Knowledge Check: Advanced Gate-All-Around &amp; CFET Integration</div>
        </div>

        <div class="quiz-q-wrap" id="q-phd1">
            <div class="quiz-q-text">1. During the fabrication of GAA nanosheet transistors, which sacrificial layer in the superlattice stack is selectively etched away to release the nanosheets?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('phd1', 0)">A) Silicon Dioxide ($\text{SiO}_2$) thermal oxide.</button>
                <button class="quiz-option" onclick="checkQuiz('phd1', 1)">B) Epitaxial Silicon-Germanium ($\text{Si}_{1-x}\text{Ge}_x$) layers.</button>
                <button class="quiz-option" onclick="checkQuiz('phd1', 2)">C) Tungsten silicide contact liners.</button>
                <button class="quiz-option" onclick="checkQuiz('phd1', 3)">D) Pure Germanium bulk substrate.</button>
            </div>
            <div class="quiz-exp" id="exp-phd1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-phd2">
            <div class="quiz-q-text">2. What is the primary purpose of the "Inner Spacer" formed at the edges of the nanosheet gate cavity?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('phd2', 0)">A) To physically isolate the gate electrode from the source/drain epi and minimize parasitic gate-to-contact capacitance.</button>
                <button class="quiz-option" onclick="checkQuiz('phd2', 1)">B) To conduct excess heat directly away into the copper heat spreader.</button>
                <button class="quiz-option" onclick="checkQuiz('phd2', 2)">C) To dope the channel with phosphorus atoms.</button>
                <button class="quiz-option" onclick="checkQuiz('phd2', 3)">D) To convert nMOS into pMOS dynamically at runtime.</button>
            </div>
            <div class="quiz-exp" id="exp-phd2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-phd3">
            <div class="quiz-q-text">3. By stacking the nMOS nanosheets vertically on top of the pMOS nanosheets in a monolithic 3D CFET architecture, what fundamental layout scaling limit is eliminated?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('phd3', 0)">A) Quantum tunneling through the gate dielectric.</button>
                <button class="quiz-option" onclick="checkQuiz('phd3', 1)">B) Lateral N-to-P spacing, reducing standard cell inverter footprint by up to 50%.</button>
                <button class="quiz-option" onclick="checkQuiz('phd3', 2)">C) The speed of light constraint in interconnects.</button>
                <button class="quiz-option" onclick="checkQuiz('phd3', 3)">D) Thermal noise ($4 k_B T R$) in resistors.</button>
            </div>
            <div class="quiz-exp" id="exp-phd3"></div>
        </div>
    </div>

    <!-- Certificate 6 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 6 Completed: Doctor of Philosophy in Transistor Physics</h4>
            <p>Conferred for groundbreaking contributions to Gate-All-Around (GAA) nanosheets, inner spacer fabrication, forksheets, and 3D monolithic CFET integration.</p>
        </div>
        <div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
            <button class="cert-btn" onclick="generateCert(6)">View Credential &#127891;</button>
            <button class="cert-btn" style="background:#10a37f; color:#fff;" onclick="switchLevel(7)">Advance to Level 7: Industry Fellow &rarr;</button>
        </div>
    </div>
</div>

<!-- LEVEL 7: INDUSTRY FELLOW -->
<div class="level-container" id="level-7">
    <div class="level-header">
        <div>
            <div class="level-meta-badge">Academic Level 7 &bull; Distinguished Industry Fellow</div>
            <div class="level-title">The 75-Year Transistor Odyssey, 2D Monolayers & The Teratransistor Era</div>
            <div class="level-subtitle">From Bardeen, Brattain, and Shockley's 1947 point-contact germanium crystal to 2D TMD monolayers ($MoS_2, WS_2$), carbon nanotube channels, and trillion-transistor monolithic packaging.</div>
        </div>
    </div>

    <div class="modules-grid">
        <div class="module-card">
            <div>
                <div class="module-num">Module 7.1</div>
                <h3>The 75-Year Transistor Odyssey & Paradigm Shifts</h3>
                <p>No single invention in human history has scaled across more orders of magnitude than the transistor. Over 75 years, the transistor evolved through seven historic architectural paradigms:</p>
                <ol>
                    <li><strong>1947 &ndash; Point-Contact & Bipolar Junction Transistor (BJT):</strong> Germanium wedges at Bell Labs &rarr; silicon planar bipolar (Fairchild).</li>
                    <li><strong>1960 &ndash; Planar MOSFET:</strong> Kahng and Atalla invent the metal-oxide-semiconductor field-effect transistor, establishing the self-aligned silicon gate.</li>
                    <li><strong>1980s &ndash; Dennard Scaling & CMOS Dominance:</strong> Constant field scaling ($V/k, L/k$) enabled clock speed to soar with zero static power.</li>
                    <li><strong>2003 &ndash; Strain Engineering & High-k Metal Gate (HKMG):</strong> $90\text{nm}$ SiGe strain + $45\text{nm}$ $\text{HfO}_2$ dielectric saved gate leakage.</li>
                    <li><strong>2011 &ndash; 3D Tri-Gate FinFET:</strong> $22\text{nm}$ Ivy Bridge broke planar leakage through vertical channel conduction.</li>
                    <li><strong>2024 &ndash; GAA Nanosheet / RibbonFET:</strong> $2\text{nm}$ node delivers $360^\circ$ gate wrap and backside power delivery network (BSPDN).</li>
                    <li><strong>2030+ &ndash; 3D CFET & 2D Monolayers:</strong> Monolithic n-over-p vertical stacking and atomically thin 2D transition metal dichalcogenides.</li>
                </ol>
            </div>
            <div class="formula-box">
                $$\textbf{Cumulative Scaling: } L_g: 10\,\mu\text{m} \longrightarrow 12\,\text{nm} \; (>800\times) \quad \bullet \quad \text{Density: } 10^3 \longrightarrow 10^{11}\,\text{cm}^{-2} \; (>10^8\times)$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 7.2</div>
                <h3>Beyond-Silicon 2D TMD Channels ($MoS_2, WS_2$) & CNT-FETs</h3>
                <p>When silicon channels scale below $3\text{nm}$ physical thickness, quantum confinement forces the bandgap to swell, surface roughness scattering collapses carrier mobility ($\mu < 50\text{ cm}^2/\text{V}\cdot\text{s}$), and dangling bonds induce unpassivated interface traps. <strong>Two-Dimensional Transition Metal Dichalcogenides (2D TMDs)</strong> solve this limit:</p>
                <ul>
                    <li><strong>Atomic Monolayer Thickness:</strong> Monolayer $\text{MoS}_2$ ($0.65\text{nm}$ thickness) has no out-of-plane dangling bonds, terminating in pristine van der Waals surfaces.</li>
                    <li><strong>Immunity to Short-Channel Effects:</strong> Because the body thickness $T_{\text{body}} < 0.7\text{nm}$, the natural screening length $\lambda = \sqrt{(\varepsilon_{ch}/\varepsilon_{ox}) t_{ox} T_{\text{body}}}$ reaches sub-$1\text{nm}$, permitting gate lengths down to $1\text{nm}$ without punch-through.</li>
                    <li><strong>Carbon Nanotube FETs (CNFETs):</strong> Quasi-1D ballistic transport in single-walled carbon nanotubes delivers linear carrier velocities exceeding $3 \times 10^7\text{ cm/s}$ with near-ideal subthreshold swing ($60\text{ mV/dec}$).</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{2D Screening Metric: } \lambda_{\text{2D}} = \sqrt{\frac{\varepsilon_{\text{2D}}}{\varepsilon_{ox}} t_{ox} T_{\text{2D}}} \approx 0.8\text{ nm} \ll L_g$$
            </div>
        </div>

        <div class="module-card">
            <div>
                <div class="module-num">Module 7.3</div>
                <h3>Transistor Economics, Backside Power & The Teratransistor Era</h3>
                <p>Leading-edge scaling is now governed by multi-dimensional optimization across device, interconnect, and economics:</p>
                <ul>
                    <li><strong>Backside Power Delivery Network (BSPDN):</strong> Separates power delivery ($V_{DD}, V_{SS}$) to the back of the silicon wafer via Through-Silicon Vias (TSVs), leaving the front metal stack solely for signal routing. This eliminates $30\%$ IR drop and boosts maximum operating frequency by $10\text{--}15\%$.</li>
                    <li><strong>Cost per Transistor Economics:</strong> While wafer fabrication costs have exceeded \$20,000 per 300mm wafer at the 2nm node, the sheer integration density ($>250\text{ million transistors/mm}^2$) continues to drive down the cost-per-function for high-performance AI accelerators.</li>
                    <li><strong>The Teratransistor Goal:</strong> Through 3D monolithic CFET logic combined with advanced 2.5D/3D chiplet packaging (TSMC CoWoS, Intel EMIB/Foveros), single AI computing engines now exceed <strong>1 Trillion Transistors</strong> in a single package.</li>
                </ul>
            </div>
            <div class="formula-box">
                $$\textbf{Teratransistor Metric: } \text{System Density} = \sum_{\text{chiplets}} A_i \cdot \rho_i + \text{3D Stacked HBM} \ge 1.0 \times 10^{12}\ \text{Transistors}$$
            </div>
        </div>
    </div>

    <!-- Interactive Lab 7 -->
    <div class="interactive-lab">
        <div class="lab-title">
            <span>&#9881;</span> Interactive Lab: 75-Year Transistor Roadmap & Economic Scaling Model
        </div>
        <p style="color:var(--text-secondary);font-size:0.95rem;margin-bottom:1.5rem;">
            Navigate across 75 years of transistor nodes (from 1971 10&mu;m planar to 2026 2nm GAA / CFET) to analyze density, cost per million transistors, gate switching energy, and system transistor count.
        </p>
        <div class="lab-controls">
            <div class="control-group">
                <label>Historic Technology Era / Node: <span id="proEraVal">2nm GAA / BSPDN (2024)</span></label>
                <select id="proEra" onchange="updateProLab()" style="width:100%;padding:0.5rem;background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-primary);border-radius:6px;">
                    <option value="1971">1971 &bull; 10 &mu;m (Intel 4004 Planar)</option>
                    <option value="1985">1985 &bull; 1.0 &mu;m (Intel 386 CMOS)</option>
                    <option value="2003">2003 &bull; 90 nm (Strained Si / HKMG)</option>
                    <option value="2012">2012 &bull; 22 nm (3D Tri-Gate FinFET)</option>
                    <option value="2020">2020 &bull; 5 nm (FinFET Scaling Apex)</option>
                    <option value="2024" selected>2024 &bull; 2 nm (GAA Nanosheet / BSPDN)</option>
                    <option value="2030">2030 &bull; A10 / CFET (Monolithic 3D)</option>
                </select>
            </div>
            <div class="control-group">
                <label>Die Area Footprint ($A_{\text{die}}$): <span id="proDieVal">600</span> mm&sup2;</label>
                <input type="range" id="proDie" min="50" max="850" step="25" value="600" oninput="updateProLab()">
            </div>
            <div class="control-group">
                <label>Wafer Cost ($): $<span id="proWaferVal">22000</span></label>
                <input type="range" id="proWafer" min="2000" max="35000" step="1000" value="22000" oninput="updateProLab()">
            </div>
            <div class="control-group">
                <label>Supply Voltage $V_{DD}$ (V): <span id="proVddVal">0.70</span> V</label>
                <input type="range" id="proVdd" min="0.50" max="1.30" step="0.05" value="0.70" oninput="updateProLab()">
            </div>
        </div>
        <div class="lab-display">
            <div class="lab-metric">
                <div class="metric-label">Transistors On Die</div>
                <div class="metric-val" id="proTransOut">156.0 Billion</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Transistor Density</div>
                <div class="metric-val" id="proDensityOut">260 MTr/mm&sup2;</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Cost Per Million Transistors</div>
                <div class="metric-val" id="proCostOut">$0.00014</div>
            </div>
            <div class="lab-metric">
                <div class="metric-label">Dynamic Energy Per Switch</div>
                <div class="metric-val" id="proEnergyOut">0.024 fJ</div>
            </div>
        </div>
    </div>

    <!-- Assessment Quiz 7 -->
    <div class="quiz-section">
        <div class="quiz-header">
            <div class="quiz-tag">&#127891; Level 7 Assessment</div>
            <div class="quiz-title">Knowledge Check: 75-Year Roadmap &amp; 2D Monolayer Integration</div>
        </div>

        <div class="quiz-q-wrap" id="q-pro1">
            <div class="quiz-q-text">1. Why do 2D Transition Metal Dichalcogenide monolayers like $\text{MoS}_2$ provide superior electrostatic gate control at sub-2nm channel lengths compared to sub-2nm silicon?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('pro1', 0)">A) Because $\text{MoS}_2$ has an atomically pristine body ($T_{\text{body}} \approx 0.65\text{nm}$) with zero surface dangling bonds, suppressing surface roughness scattering and DIBL.</button>
                <button class="quiz-option" onclick="checkQuiz('pro1', 1)">B) Because $\text{MoS}_2$ conducts electricity through superconductors at room temperature.</button>
                <button class="quiz-option" onclick="checkQuiz('pro1', 2)">C) Because silicon is completely non-conductive when shaped as a thin sheet.</button>
                <button class="quiz-option" onclick="checkQuiz('pro1', 3)">D) Because 2D materials do not require any gate oxide.</button>
            </div>
            <div class="quiz-exp" id="exp-pro1"></div>
        </div>

        <div class="quiz-q-wrap" id="q-pro2">
            <div class="quiz-q-text">2. What major architectural advantage does a Backside Power Delivery Network (BSPDN) provide in advanced 2nm logic processes?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('pro2', 0)">A) It moves thick power/ground rails to the bottom of the wafer, decoupling power delivery from signal routing and eliminating up to 30% IR drop.</button>
                <button class="quiz-option" onclick="checkQuiz('pro2', 1)">B) It eliminates the need for work-function metals in the gate stack.</button>
                <button class="quiz-option" onclick="checkQuiz('pro2', 2)">C) It replaces all copper wires with radio waves.</button>
                <button class="quiz-option" onclick="checkQuiz('pro2', 3)">D) It eliminates heat generation entirely.</button>
            </div>
            <div class="quiz-exp" id="exp-pro2"></div>
        </div>

        <div class="quiz-q-wrap" id="q-pro3">
            <div class="quiz-q-text">3. Over the 75-year span from the 1947 point-contact germanium transistor to modern 2nm nanosheets, approximately how much has transistor density per unit area increased?</div>
            <div class="quiz-options">
                <button class="quiz-option" onclick="checkQuiz('pro3', 0)">A) Approximately $100\times$.</button>
                <button class="quiz-option" onclick="checkQuiz('pro3', 1)">B) Approximately $10,000\times$.</button>
                <button class="quiz-option" onclick="checkQuiz('pro3', 2)">C) More than $100,000,000\times$ (over 8 orders of magnitude, reaching over 250 million transistors per square millimeter).</button>
                <button class="quiz-option" onclick="checkQuiz('pro3', 3)">D) Exactly $2\times$.</button>
            </div>
            <div class="quiz-exp" id="exp-pro3"></div>
        </div>
    </div>

    <!-- Certificate 7 -->
    <div class="cert-card">
        <div class="cert-info">
            <h4>Level 7 Completed: Distinguished Transistor Technology Fellow</h4>
            <p>Conferred for lifetime mastery of 75 years of transistor architectural scaling, 2D transition metal dichalcogenides ($MoS_2$), BSPDN power routing, and teratransistor packaging.</p>
        </div>
        <button class="cert-btn" onclick="generateCert(7)">View Credential &#127891;</button>
    </div>

    <!-- FELLOW MEDAL BOX -->
    <div class="fellow-medal-box">
        <div class="medal-icon">
            <svg viewBox="0 0 100 100" width="90" height="90">
                <circle cx="50" cy="50" r="46" fill="none" stroke="#f59e0b" stroke-width="4" stroke-dasharray="6,3"/>
                <circle cx="50" cy="50" r="38" fill="rgba(245, 158, 11, 0.15)" stroke="#fbbf24" stroke-width="3"/>
                <path d="M50 18 L58 35 L76 37 L62 50 L66 68 L50 59 L34 68 L38 50 L24 37 L42 35 Z" fill="#f59e0b" stroke="#d97706" stroke-width="1.5"/>
                <circle cx="50" cy="50" r="8" fill="#10a37f"/>
            </svg>
        </div>
        <div class="medal-title">CFS Distinguished Transistor Fellow Laureate</div>
        <div class="medal-desc">
            Awarded to extraordinary engineers who have mastered all 7 levels of Transistor University &mdash; from fundamental 3-terminal amplification and 1947 point-contact origins to sub-20nm FinFET width quantization, 3D Gate-All-Around nanosheets, monolithic CFETs, and 2D monolayer channel physics.
        </div>
        <div style="font-size:0.85rem;color:#f59e0b;font-weight:700;letter-spacing:1px;text-transform:uppercase;">
            Verified by Chip Foundry Services Academic & Industrial Council
        </div>
    </div>
</div>

</main>

<!-- Certificate Modal -->
<div class="modal" id="certModal">
    <div class="modal-content">
        <button class="modal-close" onclick="closeCertModal()">&times;</button>
        <div style="border: 2px solid #10a37f; border-radius: 12px; padding: 28px; background: #070c12;">
            <div style="font-size: 0.8rem; color: #10a37f; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px;">CHIP FOUNDRY SERVICES &bull; CERTIFIED CREDENTIAL</div>
            <h2 id="certTitle" style="color: #fff; font-size: 1.6rem; font-weight: 800; margin-bottom: 6px;">Certificate of Mastery</h2>
            <div id="certSubtitle" style="color: #34d399; font-weight: 600; font-size: 0.95rem; margin-bottom: 16px;">Transistor Architecture &amp; Circuit Systems</div>
            <p id="certDesc" style="color: #94a3b8; font-size: 0.9rem; line-height: 1.5; margin-bottom: 20px;">For demonstrated academic mastery across solid-state amplification, 3D FinFET geometry, Gate-All-Around nanosheets, and 75-year roadmap scaling.</p>
            <div style="display: flex; justify-content: space-around; border-top: 1px solid #1e293b; padding-top: 16px; margin-top: 16px;">
                <div>
                    <div style="font-size: 0.72rem; color: #64748b; text-transform: uppercase;">Credential ID</div>
                    <div id="certHash" style="font-size: 0.82rem; color: #cbd5e1; font-family: monospace;">CFS-TR-VERIFIED</div>
                </div>
                <div>
                    <div style="font-size: 0.72rem; color: #64748b; text-transform: uppercase;">Issue Date</div>
                    <div id="certDate" style="font-size: 0.82rem; color: #cbd5e1;">September 2026</div>
                </div>
            </div>
        </div>
        <button class="cert-btn" style="margin-top: 20px;" onclick="window.print()">Print / Save PDF &#128438;&#65039;</button>
    </div>
</div>

<!-- Footer -->
<footer class="footer">
    <div style="max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; text-align: left; margin-bottom: 24px;">
        <div>
            <h4 style="color: #fff; margin-bottom: 10px;">Silicon Architecture &amp; Materials</h4>
            <div style="display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem;">
                <a href="/materials.php">Materials University</a>
                <a href="/devices.php">Devices University</a>
                <a href="/chipdesign.php">Chip Design University</a>
                <a href="/wafermanufacturing.php">Wafer Manufacturing University</a>
                <a href="/sandstosilicon.php">From Sands to Silicon University</a>
            </div>
        </div>
        <div>
            <h4 style="color: #fff; margin-bottom: 10px;">Transistor &amp; Physical Scaling</h4>
            <div style="display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem;">
                <a href="/transistordevices.php">Transistor Devices University</a>
                <a href="/transistor.php" style="color: #10a37f; font-weight: 700;">Transistor University</a>
                <a href="/transistor-sim.php">GAA/FinFET Transistor Simulator</a>
                <a href="/infrastructure.php">Infrastructure University</a>
            </div>
        </div>
        <div>
            <h4 style="color: #fff; margin-bottom: 10px;">AI &amp; Autonomous Systems</h4>
            <div style="display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem;">
                <a href="/ai.php">Artificial Intelligence University</a>
                <a href="/llm.php">Large Language Models University</a>
                <a href="/applications.php">LLM Applications University</a>
                <a href="/agentplatform.php">Agent Platform University</a>
            </div>
        </div>
        <div>
            <h4 style="color: #fff; margin-bottom: 10px;">ChipFoundryServices</h4>
            <p style="font-size: 0.85rem; max-width: 300px; line-height: 1.5;">Advanced semiconductor education, transistor device physics engines, and full-stack autonomous EDA intelligence.</p>
        </div>
    </div>
    <p style="text-align: center;">&copy; 2026 ChipFoundryServices.com &bull; The Global Benchmark in Transistor Science &amp; VLSI Engineering.</p>
</footer>

<script>
function renderMath() {
    if (typeof renderMathInElement === 'function') {
        renderMathInElement(document.body, {
            delimiters: [
                {left: '$$', right: '$$', display: true},
                {left: '$', right: '$', display: false}
            ],
            throwOnError: false
        });
    }
    if (typeof katex === 'object' && typeof katex.render === 'function') {
        document.querySelectorAll('.formula-box').forEach(function(el) {
            if (!el.querySelector('.katex')) {
                var raw = el.innerText.trim();
                if (raw.startsWith('$$') && raw.endsWith('$$')) {
                    raw = raw.slice(2, -2).trim();
                } else if (raw.startsWith('$') && raw.endsWith('$')) {
                    raw = raw.slice(1, -1).trim();
                }
                if (raw) {
                    try {
                        katex.render(raw, el, { displayMode: true, throwOnError: false });
                    } catch(e) {
                        console.warn("KaTeX render fallback error:", e);
                    }
                }
            }
        });
    }
}

// Level Switching
function switchLevel(lvl) {
    document.querySelectorAll('.level-container').forEach(function(el) {
        el.classList.remove('active');
    });
    document.querySelectorAll('.level-btn').forEach(function(el) {
        el.classList.remove('active');
    });
    var target = document.getElementById('level-' + lvl);
    if (target) target.classList.add('active');
    var btns = document.querySelectorAll('.level-btn');
    if (btns[lvl - 1]) {
        btns[lvl - 1].classList.add('active');
        if (btns[lvl - 1].scrollIntoView) {
            btns[lvl - 1].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
        }
    }
    if (history.replaceState) {
        history.replaceState(null, null, '#level-' + lvl);
    }
    window.scrollTo({ top: 120, behavior: 'smooth' });
    setTimeout(renderMath, 50);
}

// Lab 1: Elementary
function updateElemLab() {
    var vgs = parseFloat(document.getElementById('elemGate').value);
    var vds = parseFloat(document.getElementById('elemDrain').value);
    var w = parseInt(document.getElementById('elemWidth').value, 10);
    
    document.getElementById('elemGateVal').innerText = vgs.toFixed(2) + " V";
    document.getElementById('elemDrainVal').innerText = vds.toFixed(2) + " V";
    document.getElementById('elemWidthVal').innerText = w + "x";
    
    var vth = 0.40;
    var state = "OFF (Gate Closed) \uD83D\uDD12";
    var bright = 0;
    var gain = "0x";
    var bit = "0 (Standby)";
    
    if (vgs > vth) {
        var od = vgs - vth;
        bright = Math.min(100, Math.round(od * vds * 90 * (w / 2.0)));
        state = "ON (Current Flowing) \uD83D\uDCA1";
        gain = (1 + (bright / 8)).toFixed(1) + "x Gain";
        bit = "1 (Active)";
    }
    
    document.getElementById('elemState').innerText = state;
    document.getElementById('elemBright').innerText = bright + "%";
    document.getElementById('elemGain').innerText = gain;
    document.getElementById('elemBit').innerText = bit;
}

// Lab 2: Middle School
function updateMidLab() {
    var ib = parseFloat(document.getElementById('midIb').value);
    var beta = parseFloat(document.getElementById('midBeta').value);
    var rc = parseFloat(document.getElementById('midRc').value);
    
    document.getElementById('midIbVal').innerText = ib.toFixed(1) + " \u03BCA";
    document.getElementById('midBetaVal').innerText = beta.toFixed(0);
    document.getElementById('midRcVal').innerText = rc.toFixed(1) + " k\u03A9";
    
    var icMa = (ib * beta) / 1000.0;
    var vdrop = Math.min(12.0, icMa * rc);
    var gmMs = (icMa / 0.026); // gm = Ic / Vt at 300K
    var gain = (gmMs * rc).toFixed(1);
    
    document.getElementById('midIc').innerText = icMa.toFixed(2) + " mA";
    document.getElementById('midVdrop').innerText = vdrop.toFixed(2) + " V";
    document.getElementById('midGm').innerText = gmMs.toFixed(1) + " mS";
    document.getElementById('midGain').innerText = gain + "x (" + (20 * Math.log10(parseFloat(gain))).toFixed(1) + " dB)";
}

// Lab 3: High School
function updateHighLab() {
    var freq = parseFloat(document.getElementById('highFreq').value);
    var vdd = parseFloat(document.getElementById('highVdd').value);
    var gates = parseFloat(document.getElementById('highGates').value);
    
    document.getElementById('highFreqVal').innerText = freq.toFixed(1) + " GHz";
    document.getElementById('highVddVal').innerText = vdd.toFixed(2) + " V";
    document.getElementById('highGatesVal').innerText = gates.toFixed(0) + " M";
    
    var cGateFf = 2.0; // 2 fF per gate
    var cTotal = (gates * 1e6) * (cGateFf * 1e-15);
    var alpha = 0.15; // 15% activity factor
    var pDynW = alpha * cTotal * Math.pow(vdd, 2) * (freq * 1e9);
    var eSwitchFj = (0.5 * cGateFf * Math.pow(vdd, 2)).toFixed(3);
    var savedVsOld = Math.max(0, ((1 - Math.pow(vdd / 1.8, 2)) * 100)).toFixed(0);
    var thermalFlux = (pDynW / 0.85).toFixed(1); // 0.85 cm2 die
    
    document.getElementById('highEswitch').innerText = eSwitchFj + " fJ";
    document.getElementById('highPtot').innerText = pDynW.toFixed(1) + " W";
    document.getElementById('highSaved').innerText = savedVsOld + "%";
    document.getElementById('highThermal').innerText = thermalFlux + " W/cm\u00B2";
}

// Lab 4: College
function updateColLab() {
    var idUa = parseFloat(document.getElementById('colId').value);
    var vod = parseFloat(document.getElementById('colVod').value);
    var va = parseFloat(document.getElementById('colVa').value);
    var cggFf = parseFloat(document.getElementById('colCgg').value);
    
    document.getElementById('colIdVal').innerText = idUa.toFixed(0) + " \u03BCA";
    document.getElementById('colVodVal').innerText = vod.toFixed(2) + " V";
    document.getElementById('colVaVal').innerText = va.toFixed(1) + " V";
    document.getElementById('colCggVal').innerText = cggFf.toFixed(0) + " fF";
    
    var idMa = idUa / 1000.0;
    var gmMs = (2.0 * idMa) / vod;
    var roKohm = va / idMa;
    var av0 = gmMs * roKohm;
    var av0Db = (20 * Math.log10(av0)).toFixed(1);
    var ftGhz = (gmMs * 1e-3) / (2 * Math.PI * (cggFf * 1e-15)) / 1e9;
    
    document.getElementById('colGmOut').innerText = gmMs.toFixed(2) + " mS";
    document.getElementById('colRoOut').innerText = roKohm.toFixed(1) + " k\u03A9";
    document.getElementById('colAvOut').innerText = av0.toFixed(1) + " (" + av0Db + " dB)";
    document.getElementById('colFtOut').innerText = ftGhz.toFixed(1) + " GHz";
}

// Lab 5: Master's
function updateMasLab() {
    var hfin = parseFloat(document.getElementById('masHfin').value);
    var wfin = parseFloat(document.getElementById('masWfin').value);
    var nfins = parseInt(document.getElementById('masNfins').value, 10);
    var jon = parseFloat(document.getElementById('masJon').value);
    
    document.getElementById('masHfinVal').innerText = hfin.toFixed(0) + " nm";
    document.getElementById('masWfinVal').innerText = wfin.toFixed(0) + " nm";
    document.getElementById('masNfinsVal').innerText = nfins.toFixed(0) + " fins";
    document.getElementById('masJonVal').innerText = jon.toFixed(0) + " \u03BCA/\u03BCm";
    
    var w1 = 2.0 * hfin + wfin;
    var weffTot = nfins * w1;
    var ionUa = (weffTot / 1000.0) * jon;
    var cTotFf = nfins * (0.15 + (0.008 * hfin));
    var delayPs = (cTotFf * 0.75 / (ionUa / 1000.0)).toFixed(2);
    
    document.getElementById('masW1Out').innerText = w1.toFixed(1) + " nm";
    document.getElementById('masWeffOut').innerText = weffTot.toFixed(1) + " nm";
    document.getElementById('masIonOut').innerText = ionUa.toFixed(1) + " \u03BCA";
    document.getElementById('masDelayOut').innerText = delayPs + " ps";
}

// Lab 6: PhD
function updatePhdLab() {
    var wsheet = parseFloat(document.getElementById('phdWsheet').value);
    var tsheet = parseFloat(document.getElementById('phdTsheet').value);
    var nsheets = parseInt(document.getElementById('phdNsheets').value, 10);
    var arch = document.getElementById('phdArch').value;
    
    document.getElementById('phdWsheetVal').innerText = wsheet.toFixed(0) + " nm";
    document.getElementById('phdTsheetVal').innerText = tsheet.toFixed(1) + " nm";
    document.getElementById('phdNsheetsVal').innerText = nsheets.toFixed(0) + " sheets";
    
    var archNames = {
        'finfet': '3D FinFET (2 Fins)',
        'gaa': 'GAA Nanosheet (Lateral n/p)',
        'forksheet': 'Forksheet (Dielectric Wall)',
        'cfet': 'Monolithic 3D CFET (Stacked)'
    };
    document.getElementById('phdArchVal').innerText = archNames[arch] || 'GAA Nanosheet';
    
    var weff = 0;
    var relArea = 1.0;
    var ssMv = 64.0;
    var jDens = 1.45;
    
    if (arch === 'finfet') {
        weff = 2 * (2 * 55 + 7); // 2 fins ~ 234nm
        relArea = 1.25;
        ssMv = 69.5;
        jDens = 1.15;
    } else if (arch === 'gaa') {
        weff = nsheets * 2 * (wsheet + tsheet);
        relArea = 1.00;
        ssMv = 63.5;
        jDens = (weff / 165.0).toFixed(2);
    } else if (arch === 'forksheet') {
        weff = nsheets * 2 * (wsheet + tsheet);
        relArea = 0.80;
        ssMv = 64.5;
        jDens = ((weff / 165.0) * 1.25).toFixed(2);
    } else if (arch === 'cfet') {
        weff = nsheets * 2 * (wsheet + tsheet);
        relArea = 0.50;
        ssMv = 62.8;
        jDens = ((weff / 165.0) * 2.0).toFixed(2);
    }
    
    document.getElementById('phdWeffOut').innerText = weff.toFixed(1) + " nm";
    document.getElementById('phdAreaOut').innerText = relArea.toFixed(2) + " \u00D7";
    document.getElementById('phdJout').innerText = jDens + " mA/\u03BCm-cell";
    document.getElementById('phdSsOut').innerText = ssMv.toFixed(1) + " mV/dec";
}

// Lab 7: Industry Fellow
function updateProLab() {
    var era = document.getElementById('proEra').value;
    var die = parseFloat(document.getElementById('proDie').value);
    var wafer = parseFloat(document.getElementById('proWafer').value);
    var vdd = parseFloat(document.getElementById('proVdd').value);
    
    var eraNames = {
        '1971': '10 \u03BCm (1971 Planar)',
        '1985': '1.0 \u03BCm (1985 CMOS)',
        '2003': '90 nm (2003 Strained Si)',
        '2012': '22 nm (2012 FinFET)',
        '2020': '5 nm (2020 FinFET Apex)',
        '2024': '2 nm (2024 GAA / BSPDN)',
        '2030': 'A10 (2030 3D CFET)'
    };
    document.getElementById('proEraVal').innerText = eraNames[era] || '2 nm GAA';
    document.getElementById('proDieVal').innerText = die.toFixed(0) + " mm\u00B2";
    document.getElementById('proWaferVal').innerText = wafer.toFixed(0);
    document.getElementById('proVddVal').innerText = vdd.toFixed(2) + " V";
    
    var densities = {
        '1971': 0.00025, // 250 transistors / mm2
        '1985': 0.0028,
        '2003': 1.2,
        '2012': 15.0,
        '2020': 135.0,
        '2024': 260.0,
        '2030': 520.0
    };
    
    var d = densities[era] || 260.0;
    var totalTr = d * 1e6 * die;
    var diesPerWafer = Math.floor((Math.PI * Math.pow(150, 2)) / die * 0.85); // 300mm wafer
    var costPerDie = wafer / Math.max(1, diesPerWafer);
    var costPerMillion = (costPerDie / (totalTr / 1e6)).toFixed(5);
    var energySwitch = (0.5 * (d > 50 ? 0.8 : 3.5) * Math.pow(vdd, 2) * 0.05).toFixed(3);
    
    var trDisplay = "";
    if (totalTr >= 1e9) {
        trDisplay = (totalTr / 1e9).toFixed(1) + " Billion";
    } else if (totalTr >= 1e6) {
        trDisplay = (totalTr / 1e6).toFixed(1) + " Million";
    } else {
        trDisplay = Math.round(totalTr).toLocaleString();
    }
    
    document.getElementById('proTransOut').innerText = trDisplay;
    document.getElementById('proDensityOut').innerText = d >= 1.0 ? (d.toFixed(0) + " MTr/mm\u00B2") : ((d * 1000).toFixed(0) + " Tr/mm\u00B2");
    document.getElementById('proCostOut').innerText = "$" + costPerMillion;
    document.getElementById('proEnergyOut').innerText = energySwitch + " fJ";
}

// Assessment Quiz Answers
var quizAnswers = {
    elem1: { correct: 0, exp: "Correct! Two terminals conduct the main flow of electrical charge while the third terminal serves as the active control knob to turn current on, off, or amplify." },
    elem2: { correct: 0, exp: "Correct! Solid-state silicon transistors replaced bulky, fragile, power-hungry vacuum tubes, making modern portable supercomputers possible." },
    elem3: { correct: 1, exp: "Correct! By combining millions of transistors operating as binary switches into logic gates (AND, OR, NOT), computers calculate mathematical operations in 1s and 0s." },
    
    mid1: { correct: 0, exp: "Correct! John Bardeen and Walter Brattain (under William Shockley's semiconductor research group) built the first working point-contact transistor at Bell Labs in December 1947." },
    mid2: { correct: 1, exp: "Correct! The base is fabricated ultra-thin so injected minority electrons can diffuse straight through to the collector without recombining in the base." },
    mid3: { correct: 1, exp: "Correct! In a BJT, current gain beta (beta = I_C / I_B) represents the ratio of collector output current to base input current, typically ranging between 50 and 300." },
    
    high1: { correct: 0, exp: "Correct! MOSFET gates are insulated by an oxide dielectric, drawing almost zero steady DC input current, which allows billions of devices on a single die without thermal meltdown." },
    high2: { correct: 1, exp: "Correct! In complementary CMOS, one transistor is always OFF in steady state, eliminating direct DC short-circuit current between power and ground." },
    high3: { correct: 1, exp: "Correct! Because dynamic power scales quadratically with voltage (V_dd^2), dropping V_dd by 50% reduces dynamic power by 75% (0.5^2 = 0.25)." },
    
    col1: { correct: 1, exp: "Correct! Under strong velocity saturation, drift velocity caps at v_sat ~ 10^7 cm/s, causing transconductance to saturate at g_m approx W * Cox * v_sat independent of overdrive." },
    col2: { correct: 1, exp: "Correct! Higher V_DS widens the drain depletion region into the channel, reducing effective channel length L_eff = L - delta_L and causing drain current to rise with V_DS." },
    col3: { correct: 0, exp: "Correct! In the classic drift regime without velocity saturation, g_m scales as 1/L and C_gs scales as L, yielding f_T proportional to 1/L^2 (a 4-fold boost for 2x channel shrink)." },
    
    mas1: { correct: 1, exp: "Correct! Effective width for one fin is 2*H_fin + W_fin = 2(55) + 8 = 118 nm. For 2 parallel fins, W_eff = 2 * 118 = 236 nm." },
    mas2: { correct: 0, exp: "Correct! Fin depopulation allowed standard cell track height to decrease from 9T to 6T/5T, while process engineers grew fins taller to preserve drive current per cell." },
    mas3: { correct: 1, exp: "Correct! Epitaxial SiGe in pMOS source/drain pockets induces compressive uniaxial strain in the channel, breaking valence band degeneracy and boosting hole mobility up to 3x." },
    
    phd1: { correct: 1, exp: "Correct! Sacrificial epitaxial SiGe layers in alternating Si/SiGe superlattices are selectively etched away to leave free-standing silicon nanosheets for 360-degree gate encirclement." },
    phd2: { correct: 0, exp: "Correct! Inner dielectric spacers formed at the nanosheet edges physically isolate the gate electrode from the source/drain epi, drastically reducing parasitic gate capacitances." },
    phd3: { correct: 1, exp: "Correct! By vertically stacking nMOS nanosheets directly above pMOS in a monolithic 3D CFET, the lateral N-to-P spacing is eliminated, reducing cell area by up to 50%." },
    
    pro1: { correct: 0, exp: "Correct! Monolayer MoS2 has an atomically pristine 0.65 nm body thickness with zero surface dangling bonds, suppressing surface roughness scattering and DIBL at sub-2nm gate lengths." },
    pro2: { correct: 0, exp: "Correct! Backside Power Delivery (BSPDN) routes thick power rails on the reverse side of the wafer, eliminating up to 30% IR drop and freeing the front metallization purely for signal routing." },
    pro3: { correct: 2, exp: "Correct! Transistor integration density increased from discrete units in 1947 to over 250 million transistors per square millimeter at the 2nm node - an expansion of over 100,000,000x." }
};

function checkQuiz(qid, optIdx) {
    var a = quizAnswers[qid];
    if (!a) return;
    var container = document.getElementById('q-' + qid);
    if (!container) return;
    var btns = container.querySelectorAll('.quiz-option');
    btns.forEach(function(b, idx) {
        b.classList.remove('correct', 'incorrect');
        if (idx === a.correct) b.classList.add('correct');
        else if (idx === optIdx) b.classList.add('incorrect');
    });
    var exp = document.getElementById('exp-' + qid);
    if (exp) {
        var isRight = (optIdx === a.correct);
        exp.classList.remove('correct', 'wrong');
        if (isRight) {
            exp.classList.add('correct');
            exp.innerText = a.exp;
        } else {
            exp.classList.add('wrong');
            exp.innerText = a.exp.replace(/^Correct!\s*/i, 'Wrong! ');
        }
        exp.style.display = 'block';
    }
}

// Certificate Generation
var certData = {
    1: { title: "Junior Transistor Architecture Apprentice", sub: "Elementary School Certificate", desc: "For mastering 3-terminal active switch mechanics, vacuum tube evolution, and binary logic control." },
    2: { title: "Certified Bipolar & Active Device Specialist", sub: "Middle School Diploma", desc: "For demonstrated mastery of the 1947 solid-state revolution, BJT current gain, and discrete transistor circuits." },
    3: { title: "Advanced CMOS Switching & Logic Specialist", sub: "High School Diploma", desc: "For rigorous mastery of complementary CMOS inverter topology, noise margins, and dynamic CV\u00B2f power scaling." },
    4: { title: "Bachelor of Science in Transistor Engineering", sub: "Undergraduate Degree", desc: "For undergraduate mastery of small-signal linearization, Early voltage, high-frequency cutoff f_T, and microwave gain limits." },
    5: { title: "Master of Science in Transistor Engineering", sub: "Graduate Degree", desc: "For graduate mastery of 3D Tri-Gate FinFET physics, width quantization W_eff, fin depopulation, and S/D strain engineering." },
    6: { title: "Doctor of Philosophy in Transistor Physics", sub: "Doctoral Degree", desc: "For doctoral mastery of Gate-All-Around (GAA) nanosheets, inner spacer fabrication, forksheets, and monolithic 3D CFET integration." },
    7: { title: "Distinguished Transistor Technology Fellow", sub: "Fellowship Laureate", desc: "For lifetime achievement across 75 years of transistor evolution, 2D TMD monolayers (MoS2), BSPDN routing, and teratransistor packaging." }
};

function generateCert(lvl) {
    var d = certData[lvl];
    if (!d) return;
    document.getElementById('certTitle').innerText = d.title;
    document.getElementById('certSubtitle').innerText = d.sub;
    document.getElementById('certDesc').innerText = d.desc;
    
    var chars = '0123456789ABCDEF';
    var hash = 'CFS-TR-' + lvl + '-';
    for (var i = 0; i < 8; i++) hash += chars[Math.floor(Math.random() * 16)];
    document.getElementById('certHash').innerText = hash;
    
    var date = new Date().toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
    document.getElementById('certDate').innerText = date;
    
    document.getElementById('certModal').classList.add('active');
}

function closeCertModal() {
    document.getElementById('certModal').classList.remove('active');
}

// Initial setup on load
document.addEventListener('DOMContentLoaded', function() {
        renderMath();
    var mathRetries = 0;
    var mathInterval = setInterval(function() {
        mathRetries++;
        if (typeof katex !== 'undefined' || mathRetries > 10) {
            renderMath();
            clearInterval(mathInterval);
        }
    }, 150);
    updateElemLab();
    updateMidLab();
    updateHighLab();
    updateColLab();
    updateMasLab();
    updatePhdLab();
    updateProLab();
    
    // Check hash for initial level
    var hash = window.location.hash;
    if (hash && hash.startsWith('#level-')) {
        var lvl = parseInt(hash.replace('#level-', ''), 10);
        if (lvl >= 1 && lvl <= 7) {
            switchLevel(lvl);
        }
    }
});
</script>
</body>
</html>
