/* ============================================
   Color Variables
   ============================================ */
:root {
    /* Neon Accents */
    --neon-cyan: #00f5ff;
    --neon-purple: #b829ff;
    --neon-pink: #ff006e;
    --electric-blue: #0066ff;
    
    /* Minimalism Base */
    --deep-space: #0a0a0f;
    --dark-charcoal: #1a1a24;
    --subtle-gray: #2a2a3e;
    --light-frost: #f5f5f7;
    
    /* Functional Colors */
    --success-glow: #00ff88;
    --error-glow: #ff3366;
    --warning-glow: #ffaa00;
    
    /* Text */
    --text-primary: #f5f5f7;
    --text-secondary: #a0a0b0;
    --text-tertiary: #6a6a7a;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', sans-serif;
    background: linear-gradient(135deg, var(--deep-space) 0%, #0d0d15 50%, #1a1a2e 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Subtle animated background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 245, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(184, 41, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Better text selection */
::selection {
    background-color: var(--neon-cyan);
    color: var(--deep-space);
    text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}

::-moz-selection {
    background-color: var(--neon-cyan);
    color: var(--deep-space);
    text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}

/* Focus & Accessibility */
*:focus-visible {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
}

button:focus-visible,
.nav-button:focus-visible,
.run-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.5), 0 0 20px rgba(0, 245, 255, 0.3);
}

/* Remove focus outline from CodeMirror */
.CodeMirror,
.CodeMirror *,
.CodeMirror-focused {
    outline: none !important;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* ============================================
   LAYOUT - App Container & Main Structure
   ============================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ============================================
   NAVIGATION - Top Bar & Dropdown
   ============================================ */
.top-bar {
    background: rgba(26, 26, 36, 0.98);
    /* backdrop-filter removed to prevent flickering in SCORM */
    color: var(--text-primary);
    will-change: transform;
    transform: translateZ(0);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 245, 255, 0.2);
    min-height: 50px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 245, 255, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

/* Lessons Dropdown */
.lessons-dropdown {
    position: relative;
    margin-left: 8px;
}

.lessons-dropdown-btn {
    background: rgba(42, 42, 62, 0.9);
    /* backdrop-filter removed */
    color: var(--text-primary);
    border: 1px solid rgba(0, 245, 255, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lessons-dropdown-btn:hover {
    background: rgba(42, 42, 62, 0.9);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.lessons-dropdown-btn .material-symbols-outlined {
    font-size: 18px;
}

.lessons-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgb(26, 26, 36);
    /* Fully opaque to prevent text bleed-through */
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 245, 255, 0.2);
    min-width: 320px;
    max-height: 600px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    scroll-behavior: smooth;
}

.lessons-dropdown-menu.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Module Headers in Dropdown */
.dropdown-module-header {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.15) 0%, rgba(184, 41, 255, 0.15) 100%), rgb(26, 26, 36);
    /* Layered: gradient overlay on solid background to prevent bleed-through */
    border: 1px solid rgba(0, 245, 255, 0.3);
    color: var(--neon-cyan);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 245, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.6);
}

.dropdown-module-header:first-child {
    margin-top: 0;
}

.dropdown-module-icon {
    font-size: 18px;
    font-weight: 400;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.dropdown-module-title {
    flex: 1;
}

.dropdown-lesson-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 245, 255, 0.1);
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    color: var(--text-secondary);
    background: rgb(26, 26, 36);
    /* Solid background to prevent text bleed-through */
}

.dropdown-lesson-item::before {
    content: '';
    position: absolute;
    left: 14px;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--neon-cyan), transparent);
    opacity: 0.3;
}

.dropdown-lesson-item:hover:not(.locked) {
    background: rgba(0, 245, 255, 0.08);
    padding-left: 28px;
    box-shadow: inset 3px 0 0 var(--neon-cyan);
}

.dropdown-lesson-item.active {
    background: rgba(0, 245, 255, 0.12);
    border-left: 3px solid var(--neon-cyan);
    padding-left: 21px;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.15);
}

.dropdown-lesson-item.completed {
    background: rgba(0, 255, 136, 0.08);
}

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

.dropdown-lesson-item.locked:hover {
    background-color: transparent;
    padding-left: 24px;
}

.dropdown-lesson-number {
    font-weight: 700;
    color: var(--text-tertiary);
    font-size: 11px;
    min-width: 30px;
}

.dropdown-lesson-item.completed .dropdown-lesson-number {
    color: var(--success-glow);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.dropdown-lesson-item.active .dropdown-lesson-number {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 245, 255, 0.6);
}

.dropdown-lesson-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.dropdown-lesson-check {
    width: 16px;
    height: 16px;
    color: var(--success-glow);
    font-size: 16px;
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.6));
}

.dropdown-lesson-lock {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    font-size: 16px;
}

.course-title {
    font-weight: 600;
    font-size: 16px;
}

.top-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.python-version {
    font-weight: 500;
    font-size: 14px;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.top-right {
    font-weight: 500;
    font-size: 14px;
}

/* ============================================
   MAIN CONTENT AREA & PANELS
   ============================================ */
.main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 160px);
    overflow: hidden;
    margin-top: 50px;
}

/* Resizer */
.resizer {
    width: 4px;
    background: rgba(0, 245, 255, 0.2);
    cursor: col-resize;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.resizer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--neon-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.resizer:hover {
    background: rgba(0, 245, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.5);
}

.resizer:hover::before {
    opacity: 1;
}

/* ============================================
   LEFT PANEL - Lesson Content
   ============================================ */
.left-panel {
    flex: 0 0 35%;
    background: linear-gradient(135deg, rgba(18, 18, 28, 0.98) 0%, rgba(26, 26, 36, 0.98) 100%);
    /* backdrop-filter removed for scroll performance */
    padding: 30px;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 245, 255, 0.2);
    padding-bottom: 120px;
    scroll-padding-top: 0;
    scroll-behavior: auto;
    margin-top:10px;
    box-shadow: inset -1px 0 0 rgba(0, 245, 255, 0.1);
    position: relative;
    z-index: 1;
    /* GPU acceleration for smooth scrolling */
    will-change: scroll-position;
    transform: translateZ(0);
}

/* Custom scrollbar */
.left-panel::-webkit-scrollbar {
    width: 8px;
}

.left-panel::-webkit-scrollbar-track {
    background: rgba(42, 42, 62, 0.2);
}

.left-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    border-radius: 10px;
    box-shadow: 0 0 6px rgba(0, 245, 255, 0.5);
}

.left-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--electric-blue) 0%, var(--neon-cyan) 100%);
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.8);
}

.lesson-content {
    position: relative;
}

.lesson-content h1 {
    color: var(--text-primary);
    font-size: 28px;
    margin-bottom: 10px;
    margin-top: 0;
    padding-top: 0;
    font-weight: 700;
}

.lesson-content h2 {
    background: linear-gradient(90deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
    filter: drop-shadow(0 0 8px rgba(0, 245, 255, 0.4));
}

.lesson-content h3 {
    color: var(--neon-cyan);
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
}

.lesson-text {
    line-height: 1.7;
    color: var(--text-secondary);
}

.lesson-text p {
    margin-bottom: 16px;
}

.lesson-text strong {
    color: var(--neon-cyan);
    font-weight: 600;
}

.lesson-text code {
    background-color: rgba(0, 245, 255, 0.1);
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--neon-cyan);
}

.lesson-text ol,
.lesson-text ul {
    margin: 15px 0 15px 25px;
    padding-left: 20px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.lesson-text ol li,
.lesson-text ul li {
    margin-bottom: 8px;
    padding-left: 8px;
}

.lesson-list {
    margin: 15px 0 15px 25px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.lesson-list li {
    margin-bottom: 8px;
}

/* Challenge Section */
.challenge-section {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.08) 0%, rgba(184, 41, 255, 0.06) 100%);
    border: 1px solid rgba(0, 245, 255, 0.3);
    padding: 20px;
    margin: 25px 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 245, 255, 0.15), inset 0 1px 0 rgba(0, 245, 255, 0.1);
    position: relative;
}

.challenge-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0.3;
    pointer-events: none;
}

.challenge-section h3 {
    color: var(--neon-cyan);
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
}

.challenge-section > p {
    white-space: pre-wrap;
    line-height: 1.7;
    color: var(--text-secondary);
}

.code-example {
    background-color: #2d2d2d;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    overflow-x: auto;
}

.code-example pre {
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    background: none;
}

.code-example code {
    color: #f8f8f2;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: none;
    padding: 0;
    border: none;
    box-shadow: none;
    text-shadow: none;
}

.hint-box {
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.3);
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 8px;
    color: var(--text-secondary);
}

.hint-box strong {
    color: var(--warning-glow);
}

/* ============================================
   MIDDLE PANEL - Code Editor
   ============================================ */
.middle-panel {
    flex: 0 0 35%;
    min-width: 0;
    background: var(--dark-charcoal);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 245, 255, 0.2);
    box-shadow: inset -1px 0 0 rgba(0, 245, 255, 0.1);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.code-editor-container {
    flex: 1;
    padding: 0;
    min-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow: hidden;
    max-width: 100%;
}

#python-editor {
    display: none;
}

/* CodeMirror Editor Styles */
.CodeMirror {
    flex: 1 !important;
    height: auto !important;
    min-height: 300px !important;
    font-family: 'Fira Code', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background-color: var(--dark-charcoal) !important;
    border: none !important;
    margin-bottom: 0 !important;
}

.CodeMirror-scroll {
    margin: 0 !important;
    padding: 15px 15px 15px 4px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    min-height: 300px !important;
}

.CodeMirror-lines {
    padding: 4px 0 !important;
}

.CodeMirror pre {
    padding: 0 !important;
}

.CodeMirror-sizer {
    min-height: 300px !important;
    padding-bottom: 60px !important;
}

.CodeMirror-cursor {
    border-left: 2px solid var(--neon-cyan) !important;
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.6) !important;
}

.CodeMirror-gutters {
    border-right: 1px solid rgba(0, 245, 255, 0.2) !important;
    background-color: var(--dark-charcoal) !important;
}

.CodeMirror-linenumber {
    color: var(--text-tertiary) !important;
    padding: 0 8px !important;
}

/* Error Line Highlighting */
/* When addLineClass(line, 'background', 'error-line') is used */
.CodeMirror-linebackground.error-line {
    background-color: rgba(239, 68, 68, 0.25) !important;
    border-left: 4px solid #ef4444 !important;
    margin-left: -4px !important;
    animation: error-pulse 0.8s ease-in-out;
}

/* When addLineClass(line, 'gutter', 'error-line-gutter') is used */
.error-line-gutter {
    background-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
    font-weight: bold !important;
}

/* Add warning icon to gutter */
.error-line-gutter::before {
    content: "⚠️";
    position: absolute;
    left: 2px;
    font-size: 14px;
}

@keyframes error-pulse {
    0%, 100% {
        background-color: rgba(239, 68, 68, 0.25);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.45);
    }
}

/* Live Syntax Checking - Lint Styles */
.CodeMirror-lint-marker-error {
    background-image: none !important;
    width: 16px !important;
    height: 16px !important;
    background-color: rgba(239, 68, 68, 0.8) !important;
    border-radius: 50%;
    position: relative;
    cursor: help;
}

.CodeMirror-lint-marker-error::before {
    content: "!";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.CodeMirror-lint-message-error {
    background-color: rgba(239, 68, 68, 0.95) !important;
    color: white !important;
    border: 1px solid #ef4444 !important;
    border-radius: 4px;
    padding: 6px 10px !important;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.CodeMirror-lint-tooltip {
    background-color: rgba(239, 68, 68, 0.95) !important;
    border: 1px solid #ef4444 !important;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 10000 !important;
}

.editor-controls {
    padding: 15px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(26, 26, 36, 1);
    /* backdrop-filter removed */
    will-change: transform;
    transform: translateZ(0);
    border-top: 1px solid rgba(0, 245, 255, 0.3);
    z-index: 1000; /* above bottom bar (z-index: 99) */
    position: sticky;
    bottom: 60px; /* offset above the fixed bottom bar */
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.8), 0 -2px 10px rgba(0, 245, 255, 0.2);
}

.run-button {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--electric-blue) 100%);
    color: var(--deep-space);
    border: 1px solid rgba(0, 245, 255, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.4), 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.run-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.run-button:hover::before {
    left: 100%;
}

.run-button:hover {
    background: linear-gradient(135deg, var(--electric-blue) 0%, var(--neon-cyan) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.6), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.run-button:active {
    transform: translateY(0);
}

.control-btn {
    background: rgba(42, 42, 62, 0.9);
    /* backdrop-filter removed */
    color: var(--text-primary);
    border: 1px solid rgba(184, 41, 255, 0.3);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    background: rgba(42, 42, 62, 0.9);
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(184, 41, 255, 0.4);
    transform: translateY(-2px);
}

/* ============================================
   RIGHT PANEL - Output Console
   ============================================ */
.right-panel {
    flex: 1;
    min-width: 200px;
    background: var(--deep-space);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.results-container {
    flex: 1;
    padding: 20px;
    padding-bottom: 180px;
    overflow-y: auto;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    position: relative;
    scroll-padding-bottom: 160px;
    line-height: 1.6;
    /* GPU acceleration for smooth scrolling */
    will-change: scroll-position;
    transform: translateZ(0);
}

/* Fallback spacer to guarantee scroll room even if editor resizes */
.code-editor-container::after {
    content: '';
    display: block;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    flex: 0 0 20px !important;
    flex-shrink: 0 !important;
}

.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: rgba(26, 26, 36, 0.4);
}

.results-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    border-radius: 10px;
    box-shadow: 0 0 6px rgba(0, 245, 255, 0.5);
}

.results-container::-webkit-scrollbar-thumb:hover {
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.8);
}

#results-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

#results-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
}

.placeholder-text {
    color: #888;
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.success-message {
    color: var(--success-glow);
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.success-icon {
    font-size: 20px;
}

.error-message {
    color: var(--error-glow);
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.3);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.2);
}

.output-line {
    margin-bottom: 4px;
}

/* ============================================
   BOTTOM BAR - Navigation & Progress
   ============================================ */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 36, 0.98);
    /* backdrop-filter removed to prevent flickering */
    will-change: transform;
    transform: translateZ(0);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 245, 255, 0.2);
    z-index: 99;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 245, 255, 0.3);
}

.progress-indicator {
    color: var(--neon-cyan);
    font-weight: 600;
    font-size: 16px;
    padding: 8px 16px;
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.navigation-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-button {
    background: linear-gradient(135deg, var(--warning-glow) 0%, #ffcc00 100%);
    color: var(--deep-space);
    border: 1px solid rgba(255, 170, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.3);
}

.back-button:hover {
    background: linear-gradient(135deg, #ffcc00 0%, var(--warning-glow) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 170, 0, 0.5), 0 4px 15px rgba(0, 0, 0, 0.3);
}

.next-button {
    background-color: #666;
    color: white;
}

.next-button:disabled {
    background-color: #444;
    cursor: not-allowed;
    opacity: 0.5;
}

.next-button.next-ready {
    background: linear-gradient(135deg, var(--success-glow) 0%, #00cc6a 100%);
    border: 1px solid rgba(0, 255, 136, 0.5);
    animation: pulse 2s infinite;
}

.next-button.next-ready:hover {
    background: linear-gradient(135deg, #00cc6a 0%, var(--success-glow) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6), 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7), 0 0 20px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(0, 255, 136, 0), 0 0 30px rgba(0, 255, 136, 0.5); }
}

.clear-button {
    background-color: #e74c3c;
    color: white;
}

.clear-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* ============================================
   CHECKPOINT SYSTEM
   ============================================ */
.checkpoint-section {
    background: rgba(42, 42, 62, 0.85);
    /* backdrop-filter removed to prevent flickering */
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 16px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 10px 40px rgba(0, 245, 255, 0.2), 0 0 0 1px rgba(0, 245, 255, 0.1) inset;
    position: relative;
}

.checkpoint-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0.5;
    pointer-events: none;
}

.checkpoint-header {
    text-align: center;
    margin-bottom: 25px;
}

.checkpoint-header h3 {
    color: var(--neon-cyan);
    margin-bottom: 8px;
    font-size: 20px;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
}

.checkpoint-header p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.checkpoint-progress {
    display: inline-block;
    background: rgba(0, 245, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.checkpoint-question {
    background: rgba(245, 245, 247, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(0, 245, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.checkpoint-question-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.checkpoint-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checkpoint-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(42, 42, 62, 0.3);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkpoint-option:hover {
    background: rgba(42, 42, 62, 0.6);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
}

.checkpoint-option input[type="radio"] {
    margin-right: 12px;
    cursor: pointer;
}

.checkpoint-option span {
    flex: 1;
    color: var(--text-primary);
    font-size: 15px;
}

.checkpoint-submit-btn {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--electric-blue) 100%);
    color: var(--deep-space);
    border: 1px solid rgba(0, 245, 255, 0.5);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.3);
}

.checkpoint-submit-btn:hover {
    background: linear-gradient(135deg, var(--electric-blue) 0%, var(--neon-cyan) 100%);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.5);
    transform: translateY(-2px);
}

.checkpoint-submit-btn:active {
    transform: scale(0.98);
}

.checkpoint-feedback {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: none;
}

.checkpoint-feedback-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.checkpoint-feedback-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.checkpoint-feedback-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.checkpoint-next-btn {
    background: linear-gradient(135deg, var(--success-glow) 0%, #00cc6a 100%);
    color: var(--deep-space);
    border: 1px solid rgba(0, 255, 136, 0.5);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.checkpoint-next-btn:hover {
    background: linear-gradient(135deg, #00cc6a 0%, var(--success-glow) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}

.checkpoint-complete {
    text-align: center;
    padding: 30px;
}

.checkpoint-complete-icon {
    margin-bottom: 20px;
}

.completion-modal-btn {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--electric-blue) 100%);
    color: var(--deep-space);
    border: 1px solid rgba(0, 245, 255, 0.5);
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 0 25px rgba(0, 245, 255, 0.4);
    display: inline-block;
    text-align: center;
    text-decoration: none;
    line-height: normal;
}

.completion-modal-btn:hover {
    background: linear-gradient(135deg, var(--electric-blue) 0%, var(--neon-cyan) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 35px rgba(0, 245, 255, 0.6);
}

.checkpoint-review-section {
    margin: 20px 0;
}

.checkpoint-review-banner {
    background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkpoint-review-icon {
    color: #10b981;
    font-size: 24px;
}

.checkpoint-review-text {
    flex: 1;
    color: #065f46;
    font-weight: 600;
}

.checkpoint-review-btn {
    background: white;
    color: #10b981;
    border: 1px solid #10b981;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.checkpoint-review-btn:hover {
    background: #10b981;
    color: white;
}

/* ============================================
   COMPLETION MODAL
   ============================================ */
.completion-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-modal {
    background: rgba(26, 26, 36, 0.98);
    /* backdrop-filter removed */
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 245, 255, 0.2) inset;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.completion-icon {
    font-size: 80px;
    text-align: center;
    margin-bottom: 20px;
}

.completion-modal h2 {
    color: var(--neon-cyan);
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.6);
}

.completion-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 25px 0;
}

.completion-stat {
    text-align: center;
    padding: 15px 25px;
    background: rgba(42, 42, 62, 0.4);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.1);
}

.completion-stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 245, 255, 0.6);
}

.completion-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.completion-modal-btn {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--electric-blue) 100%);
    color: var(--deep-space);
    border: 1px solid rgba(0, 245, 255, 0.5);
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.completion-modal-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.completion-modal-btn:hover::before {
    left: 100%;
}

.completion-modal-btn:hover {
    background: linear-gradient(135deg, var(--electric-blue) 0%, var(--neon-cyan) 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(0, 245, 255, 0.6);
}

/* ============================================
   LOADING & NOTIFICATIONS
   ============================================ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(42, 42, 62, 0.3);
    border-top: 3px solid var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(26, 26, 36, 0.95);
    /* backdrop-filter removed */
    border: 1px solid var(--neon-cyan);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 245, 255, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-error {
    background: #ef4444;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */
@media (max-width: 768px) {
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
    }
    
    .app-container {
        height: auto !important;
        min-height: 100vh !important;
    }
    
    .main-content {
        flex-direction: column !important;
        height: auto !important;
        min-height: calc(100vh - 100px) !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
        display: block !important;
    }
    
    .resizer {
        display: none !important;
    }
    
    .left-panel, .middle-panel, .right-panel {
        width: 100% !important;
        height: auto !important;
        min-height: 300px !important;
        max-height: none !important;
        flex: none !important;
        border-right: none !important;
        border-bottom: 2px solid #e0e0e0 !important;
    }
    
    .CodeMirror {
        height: 300px !important;
        min-height: 300px !important;
    }
    
    .top-bar {
        flex-wrap: wrap;
        padding: 8px 12px;
        min-height: 40px;
        z-index: 50;
    }
    
    .bottom-bar {
        padding: 8px 12px;
        min-height: 50px;
    }
    
    .top-center {
        display: none;
    }
    
    .nav-button {
        font-size: 12px;
        padding: 6px 12px;
    }
}
