/* Import JetBrains Mono */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Inter:wght@400;500;600;700&display=swap');

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #0a0f1a;
    color: #f1f5f9;
    font-size: 14px;
    overflow-x: hidden;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 16px;
    background: #0a0f1a;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 200;
}
.logo-link { display: flex; align-items: center; }
.nav-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    image-rendering: auto;
    -webkit-user-drag: none;
    display: block;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}
.breadcrumb { margin-left: 16px; color: #94a3b8; font-size: 13px; }
.progress-container {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.progress-bar {
    width: 120px;
    height: 4px;
    background: #1e293b;
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, #00d4aa, #6366f1);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.progress-text { color: #00d4aa; font-size: 12px; font-weight: 500; }

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #111827;
    border-bottom: 1px solid #1e293b;
}
.toolbar select {
    background: #1a2332;
    color: #f1f5f9;
    border: 1px solid #1e293b;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
}
.toolbar button {
    background: #1a2332;
    color: #f1f5f9;
    border: 1px solid #1e293b;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.toolbar button:hover { border-color: #00d4aa; color: #00d4aa; }
.section-indicator { color: #94a3b8; font-size: 12px; margin-left: auto; }

/* Main Container */
.main-container {
    display: flex;
    padding: 16px;
    min-height: calc(100vh - 100px);
}
.left-panel {
    flex: 1;
    max-width: 760px;
    margin: 0 auto;
    transition: margin-right 0.3s ease, max-width 0.3s ease;
}
.left-panel.shifted {
    margin-right: 46%;
    max-width: none;
}

/* Section Heading */
.section-heading {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: #f1f5f9;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid;
    border-image: linear-gradient(180deg, #e94560, #533483) 1;
}

/* Diagram Card */
.diagram-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    animation: diagramSlideIn 0.5s ease-out both;
}
@keyframes diagramSlideIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Reveal Controls */
.reveal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.reveal-btn {
    background: #1a2332;
    color: #00d4aa;
    border: 1px solid #1e293b;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.reveal-btn:hover { border-color: #00d4aa; }
.reveal-counter { color: #94a3b8; font-size: 12px; }

/* Description */
#description { line-height: 1.7; margin-bottom: 16px; }
#description h4 { color: #00d4aa; font-size: 15px; margin: 16px 0 8px; }
#description ul { padding-left: 20px; margin: 8px 0; }
#description li {
    opacity: 0;
    transform: translateX(-15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    margin: 8px 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.7;
}
#description li.revealed { opacity: 1; transform: translateX(0); }
#description code {
    background: #1a2332;
    color: #00d4aa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}
#description strong { color: #f1f5f9; }
#description p { margin: 8px 0; color: #cbd5e1; }
#description em { color: #ef4444; font-style: italic; }

/* Syntax Accordion */
.syntax-accordion { margin-top: 16px; }
.syntax-accordion details {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
}
.syntax-accordion summary {
    padding: 10px 14px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 13px;
}
.syntax-accordion summary:hover { color: #00d4aa; }
#syntax {
    margin: 0;
    padding: 12px 14px;
    background: #0a0f1a;
    color: #00d4aa;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    border-top: 1px solid #1e293b;
}

/* Right Panel */
.right-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 46%;
    height: 100vh;
    background: #111827;
    border-left: 1px solid #1e293b;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.right-panel.open { transform: translateX(0); }

/* Panel Toggle */
.panel-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
    background: linear-gradient(180deg, #00d4aa, #6366f1);
    color: #0a0f1a;
    border: none;
    padding: 14px 6px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 1px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.4);
    transition: right 0.3s ease;
}
.panel-toggle:hover { filter: brightness(1.1); }
.panel-toggle.shifted { right: 46%; }

/* ===== RIGHT PANEL REDESIGN ===== */

/* IDE Header */
.ide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 36px;
    background: #0a0f1a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}
.ide-tabs { display: flex; align-items: center; }
.ide-tab {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #e2e8f0;
    padding: 6px 12px;
    background: #111827;
    border-top: 2px solid #6366f1;
    border-radius: 0;
}
.ide-actions { display: flex; gap: 4px; }
.ide-run-btn {
    background: #22c55e;
    color: #0a0f1a;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.ide-run-btn:hover { background: #16a34a; }
.ide-action-btn {
    background: none;
    border: 1px solid #1e293b;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.ide-action-btn:hover { border-color: #6366f1; color: #6366f1; }

/* Example Selector */
.example-selector {
    padding: 8px 12px;
    background: #0d1117;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
    overflow-x: auto;
}
#exampleTabs { display: flex; flex-wrap: wrap; gap: 6px; }
.example-btn {
    background: #1a2332;
    color: #94a3b8;
    border: 1px solid #1e293b;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.example-btn.active-tab { background: #6366f1; color: white; border-color: #6366f1; }
.example-btn:hover:not(.active-tab) { border-color: #475569; color: #e2e8f0; }
.example-btn.level-beginner { border-color: #22c55e; color: #22c55e; }
.example-btn.level-beginner.active-tab { background: #22c55e; color: #0a0f1a; border-color: #22c55e; }
.example-btn.level-intermediate { border-color: #f59e0b; color: #f59e0b; }
.example-btn.level-intermediate.active-tab { background: #f59e0b; color: #0a0f1a; border-color: #f59e0b; }

/* Editor Area */
.editor-area {
    min-height: 100px;
    height: 250px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Resize Handles */
.resize-handle {
    height: 5px;
    background: #1e293b;
    cursor: row-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
}
.resize-handle:hover,
.resize-handle.active {
    background: #6366f1;
}
.resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 3px;
    border-top: 1px solid #475569;
    border-bottom: 1px solid #475569;
}
.resize-handle:hover::after,
.resize-handle.active::after {
    border-color: #fff;
}

/* Editor Action Buttons */
.editor-actions {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #0a0f1a;
    border-top: 1px solid #1e293b;
    border-bottom: 1px solid #1e293b;
}
.ide-run-btn {
    background: #22c55e !important;
    color: #0a0f1a !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}
.ide-run-btn:hover { background: #16a34a !important; }
.ide-action-btn {
    background: #1a2332 !important;
    border: 1px solid #1e293b !important;
    color: #94a3b8 !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.ide-action-btn:hover { border-color: #6366f1 !important; color: #6366f1 !important; }
.CodeMirror {
    height: 100% !important;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 0;
    border: none;
    background: #0d1117;
}
.CodeMirror-gutters { background: #0d1117; border-right: 1px solid #1e293b; }
.CodeMirror-linenumber { color: #475569; }
.CodeMirror-selected { background: rgba(99,102,241,0.3) !important; }
.CodeMirror-focused .CodeMirror-selected { background: rgba(99,102,241,0.4) !important; }

/* Terminal Section */
.terminal-section {
    flex-shrink: 0;
    min-height: 60px;
    height: 150px;
    border-top: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
}
.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: #0a0f1a;
    border-bottom: 1px solid #1e293b;
}
.terminal-title {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.terminal-badge {
    font-size: 9px;
    color: #94a3b8;
    background: #1e293b;
    padding: 1px 6px;
    border-radius: 3px;
}
.terminal-output {
    background: #0d1117;
    color: #e2e8f0;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    min-height: 40px;
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    margin: 0;
    line-height: 1.5;
}
.terminal-prompt { color: #22c55e; }

/* ===== PowerShell Native Blue Terminal ===== */
.terminal-section.ps-terminal .terminal-header {
    background: #012456;
    border-bottom: 1px solid #1b3a6b;
}
.terminal-section.ps-terminal .terminal-title {
    color: #cccccc;
}
.terminal-section.ps-terminal .terminal-badge {
    background: #1b3a6b;
    color: #f2f2f2;
}
.terminal-section.ps-terminal .terminal-output {
    background: #012456;
    color: #f2f2f2;
    font-family: 'Cascadia Code', 'Consolas', 'Lucida Console', monospace;
    font-size: 13px;
    line-height: 1.4;
}
.terminal-section.ps-terminal .terminal-prompt {
    color: #ffff00;
}

/* ===== AI LAB MENTOR ===== */
.ai-mentor-section {
    border-top: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    min-height: 44px;
    flex: 1;
    overflow: hidden;
}
.ai-mentor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #0a0f1a, #111827);
    border-bottom: 1px solid #1e293b;
    cursor: pointer;
    user-select: none;
}
.ai-mentor-header:hover {
    background: linear-gradient(135deg, #111827, #1a2332);
}
.ai-mentor-collapse-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: transform 0.2s;
}
.ai-mentor-collapse-btn:hover {
    color: #00d4aa;
}
.ai-mentor-section.collapsed .ai-mentor-collapse-btn {
    transform: rotate(-90deg);
}
.ai-mentor-body {
    display: flex;
    flex-direction: column;
}
.ai-mentor-section.collapsed .ai-mentor-body {
    display: none;
}
.ai-mentor-section.collapsed {
    min-height: auto;
}
.ai-mentor-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1, #00d4aa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 0 12px rgba(99,102,241,0.3);
}
.ai-mentor-info { display: flex; flex-direction: column; }
.ai-mentor-name { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.ai-mentor-status { font-size: 10px; color: #22c55e; }

.ai-mentor-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 14px;
    background: #0d1117;
    border-bottom: 1px solid #1e293b;
}
.ai-mentor-suggestions button {
    background: #1a2332;
    color: #94a3b8;
    border: 1px solid #1e293b;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.ai-mentor-suggestions button:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.ai-mentor-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    background: #0d1117;
    max-height: 300px;
}

.ai-mentor-input {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: #111827;
    border-top: 1px solid #1e293b;
}
.ai-mentor-input input {
    flex: 1;
    background: #1a2332;
    color: #f1f5f9;
    border: 1px solid #1e293b;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.ai-mentor-input input:focus { border-color: #6366f1; box-shadow: 0 0 8px rgba(99,102,241,0.2); }
.ai-mentor-input input::placeholder { color: #475569; }
.ai-mentor-send {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ai-mentor-send:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }

.ai-mentor-footer {
    padding: 3px 14px;
    font-size: 9px;
    color: #374151;
    background: #0a0f1a;
    text-align: center;
}

/* Improved message bubbles */
.ai-msg {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    animation: msgFadeIn 0.3s ease;
}
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.ai-msg.assistant .ai-msg-avatar { background: linear-gradient(135deg, #6366f1, #00d4aa); }
.ai-msg.user .ai-msg-avatar { background: #475569; }
.ai-msg-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
}
.ai-msg.assistant .ai-msg-bubble {
    background: #1a2332;
    color: #e2e8f0;
    border: 1px solid #1e293b;
    border-top-left-radius: 4px;
}
.ai-msg.user .ai-msg-bubble {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border-top-right-radius: 4px;
}

/* Code blocks in messages */
.ai-msg-bubble pre {
    background: #0a0f1a;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 6px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #00d4aa;
    line-height: 1.5;
}
.ai-msg-bubble code {
    background: #0a0f1a;
    color: #00d4aa;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}
.ai-msg-bubble strong { color: #f1f5f9; }
.ai-msg-bubble em { color: #f59e0b; }
.ai-msg-bubble br { display: block; margin: 4px 0; }

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

/* IDE Status Bar */
.ide-statusbar {
    display: flex;
    gap: 14px;
    padding: 2px 12px;
    background: #6366f1;
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    flex-shrink: 0;
}
.statusbar-right { margin-left: auto; }

/* Toast */
.toast-container { position: fixed; top: 60px; right: 20px; z-index: 9999; }
.toast {
    background: #00d4aa;
    color: #0a0f1a;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    animation: toastIn 0.3s ease, toastOut 0.3s 2.5s forwards;
    box-shadow: 0 4px 12px rgba(0,212,170,0.3);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* Fullscreen mode (kept for toggleDescription compatibility) */
.fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    overflow: auto;
    background: #0a0f1a;
    padding: 20px;
}

/* Pulse animation on panel toggle */
@keyframes pulse-glow {
    0%, 100% { box-shadow: -2px 0 12px rgba(0,0,0,0.4); }
    50% { box-shadow: -2px 0 20px rgba(0,212,170,0.6), 0 0 30px rgba(99,102,241,0.3); }
}

.panel-toggle.has-code {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* AI Typing Dots */
.typing-dots span {
    display: inline-block;
    animation: typing-bounce 1.4s infinite;
    font-size: 16px;
    color: #00d4aa;
    margin: 0 2px;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Hands-on Lab */
.hands-on-lab {
    background: linear-gradient(135deg, #0f172a, #1a2332);
    border: 1px solid #6366f1;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
}
.lab-title-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.lab-icon { font-size: 18px; }
.lab-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #6366f1;
    text-transform: uppercase;
}
.lab-task {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-line;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #0a0f1a;
    border-radius: 8px;
    border: 1px solid #1e293b;
    font-family: 'Inter', sans-serif;
}
.lab-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.lab-check-btn {
    background: #22c55e !important;
    color: #0a0f1a !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}
.lab-check-btn:hover { background: #16a34a !important; }
.lab-hint-btn {
    background: #1a2332 !important;
    color: #f59e0b !important;
    border: 1px solid #f59e0b !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.lab-hint-btn:hover { background: #f59e0b !important; color: #0a0f1a !important; }
.lab-solution-btn {
    background: #1a2332 !important;
    color: #94a3b8 !important;
    border: 1px solid #1e293b !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.lab-solution-btn:hover { border-color: #94a3b8 !important; }

.lab-feedback {
    background: #0a0f1a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
    white-space: pre-line;
    animation: fadeSlideIn 0.3s ease;
}
.lab-feedback.pass { border-color: #22c55e; }
.lab-feedback.needs-work { border-color: #f59e0b; }

/* ===== COURSE SIDEBAR ===== */
.course-sidebar {
    position: sticky;
    top: 44px;
    width: 260px;
    min-width: 260px;
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    background: #0d1117;
    border-right: 1px solid #1e293b;
    border-radius: 0;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    z-index: 50;
}
.course-sidebar.collapsed {
    margin-left: -260px;
    opacity: 0;
    pointer-events: none;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #111827;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 10;
}
.sidebar-title {
    color: #00d4aa;
    font-weight: 600;
    font-size: 13px;
}
.sidebar-toggle-btn {
    background: none;
    color: #00d4aa;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.sidebar-toggle-btn:hover {
    background: #6366f1;
    color: white;
}
.sidebar-open-btn {
    display: none;
    position: fixed;
    left: 8px;
    top: 100px;
    z-index: 201;
    background: #111827;
    border: 1px solid #1e293b;
    color: #00d4aa;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.sidebar-open-btn:hover {
    background: #6366f1;
    color: white;
}
.sidebar-nav {
    padding: 6px 0;
}
.sidebar-module {
    border-bottom: 1px solid #1a2744;
}
.sidebar-module:last-child {
    border-bottom: none;
}
.sidebar-module-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s;
    user-select: none;
}
.sidebar-module-header:hover {
    background: #1a2332;
}
.sidebar-module-header.active {
    color: #00d4aa;
    background: #111827;
}
.sidebar-module-toggle {
    font-size: 9px;
    color: #00d4aa;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sidebar-module.expanded .sidebar-module-toggle {
    transform: rotate(90deg);
}
.sidebar-module-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-sections {
    display: none;
    padding: 0 0 6px 0;
}
.sidebar-module.expanded .sidebar-sections {
    display: block;
}
.sidebar-section-item {
    padding: 5px 12px 5px 26px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 11px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-section-item:hover {
    background: #1a2332;
    color: #f1f5f9;
}
.sidebar-section-item.active {
    color: #00d4aa;
    background: #111827;
    border-left: 3px solid #00d4aa;
    padding-left: 23px;
}
.sidebar-section-item.completed::before {
    content: '\2713 ';
    color: #22c55e;
}
.sidebar-module-header.locked {
    color: #475569;
}
.sidebar-module-header.locked .sidebar-module-toggle {
    color: #475569;
}
.sidebar-section-item.locked {
    color: #374151;
    cursor: not-allowed;
}
.sidebar-section-item.locked:hover {
    background: transparent;
    color: #475569;
}
.course-sidebar::-webkit-scrollbar {
    width: 5px;
}
.course-sidebar::-webkit-scrollbar-track {
    background: #0d1117;
}
.course-sidebar::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}
.course-sidebar::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
}
.sidebar-backdrop.active {
    display: block;
}

/* ===== PS Bridge Indicator & Banner ===== */
.bridge-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    font-size: 10px;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    cursor: default;
    user-select: none;
    transition: all 0.3s ease;
}
.bridge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.bridge-dot.offline { background: #475569; }
.bridge-dot.online  { background: #22c55e; animation: bridgePulse 2s ease-in-out infinite; }
@keyframes bridgePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
.bridge-indicator.is-online  { color: #22c55e; background: rgba(34,197,94,0.1); }
.bridge-indicator.is-offline { color: #64748b; }
.bridge-banner {
    background: linear-gradient(135deg, #1e1b4b, #1e293b);
    border-bottom: 1px solid #6366f1;
    padding: 10px 16px;
}
.bridge-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}
.bridge-banner-icon { font-size: 18px; flex-shrink: 0; }
.bridge-banner-text {
    flex: 1;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.4;
}
.bridge-banner-text strong { color: #c7d2fe; }
.bridge-banner-text code {
    background: #0d1117;
    color: #00d4aa;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}
.bridge-cmd {
    display: block;
    margin-top: 6px;
    background: #0d1117 !important;
    color: #22c55e !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-family: 'Consolas', 'JetBrains Mono', monospace;
    border: 1px solid #1e293b;
    cursor: text;
    user-select: all;
}
.bridge-banner-btn {
    flex-shrink: 0;
    background: #6366f1;
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.bridge-banner-btn:hover { background: #4f46e5; color: white; }
.bridge-banner-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
}
.bridge-banner-close:hover { color: #e2e8f0; }
.bridge-details {
    margin-top: 8px;
    border-top: 1px solid rgba(99,102,241,0.2);
    padding-top: 8px;
}
.bridge-details summary {
    cursor: pointer;
    font-size: 11px;
    color: #94a3b8;
    padding: 4px 0;
    user-select: none;
}
.bridge-details summary:hover { color: #c7d2fe; }
.bridge-details-body {
    padding: 10px 0 4px 0;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.6;
}
.bridge-details-body p { margin: 8px 0; }
.bridge-details-body strong { color: #e2e8f0; }
.bridge-details-body ul { margin: 4px 0 8px 16px; padding: 0; }
.bridge-details-body li { margin: 3px 0; }
.bridge-details-body code {
    background: #0d1117;
    color: #00d4aa;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
}
.terminal-output .ps-success { color: #6ee7b7; }
.terminal-output .ps-error   { color: #fca5a5; }
.terminal-output .ps-elapsed { color: #475569; font-size: 10px; }

/* Mobile */
@media(max-width:768px) {
    .course-sidebar { display: none; position: fixed; top: 0; left: 0; width: 280px; height: 100vh; z-index: 1000; border-radius: 0; max-height: 100vh; }
    .course-sidebar.mobile-open { display: block; }
    .sidebar-open-btn { display: block !important; }
    .right-panel { width: 90%; }
    .panel-toggle.shifted { right: 90%; }
    .left-panel.shifted { margin-right: 0; }
    .left-panel { max-width: none; padding: 12px; }
    .top-bar { padding: 0 8px; }
    .toolbar { flex-wrap: wrap; }
    .progress-container { display: none; }
}

/* Lab Objective Card */
.lab-objective-card {
    background: linear-gradient(135deg, #111827 0%, #1a2332 100%);
    border: 1px solid #1e293b;
    border-left: 4px solid #00d4aa;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    position: relative;
    animation: fadeSlideIn 0.4s ease-out;
}

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

.lab-obj-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.lab-obj-icon {
    font-size: 18px;
}

.lab-obj-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00d4aa;
    text-transform: uppercase;
}

.lab-obj-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.lab-obj-close:hover {
    color: #f1f5f9;
    background: #1e293b;
}

.lab-obj-text {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.lab-obj-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.lab-obj-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.lab-obj-badge.time {
    background: #1e293b;
    color: #94a3b8;
}

.lab-obj-badge.difficulty {
    background: #1e293b;
    color: #22c55e;
}

.lab-obj-badge.difficulty.intermediate {
    color: #f59e0b;
}

.lab-obj-badge.difficulty.advanced {
    color: #ef4444;
}

.lab-obj-details {
    display: flex;
    gap: 20px;
}

.lab-obj-label {
    font-size: 11px;
    color: #64748b;
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.lab-obj-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.lab-obj-tags span {
    background: #0a0f1a;
    color: #94a3b8;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid #1e293b;
}


/* ===== GAMIFICATION ===== */

/* XP Bar in top nav */
.gamification-bar {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.xp-level {
    color: #6366f1;
    font-size: 11px;
    font-weight: 700;
    background: #1a2332;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #6366f1;
}
.xp-bar-container {
    width: 80px;
    height: 5px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}
.xp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #00d4aa);
    border-radius: 3px;
    transition: width 0.6s ease;
}
.xp-text {
    color: #94a3b8;
    font-size: 10px;
    min-width: 40px;
}
.streak-display {
    font-size: 12px;
    color: #f59e0b;
}
.badge-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}
.badge-btn:hover {
    transform: scale(1.2);
}

/* Badge unlock popup */
.badge-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    animation: badgeSlideUp 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.badge-popup-content {
    background: linear-gradient(135deg, #1a2332, #111827);
    border: 2px solid #f59e0b;
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(245,158,11,0.25), 0 0 60px rgba(245,158,11,0.1);
}
.badge-popup-icon {
    font-size: 32px;
    animation: badgeBounce 0.6s ease 0.3s;
}
.badge-popup-info { display: flex; flex-direction: column; gap: 2px; }
.badge-popup-label { font-size: 9px; color: #f59e0b; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.badge-popup-title { font-size: 14px; color: #f1f5f9; font-weight: 600; }
.badge-popup-xp { font-size: 11px; color: #00d4aa; }

@keyframes badgeSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* XP float */
.xp-float {
    position: fixed;
    top: 50px;
    right: 100px;
    color: #00d4aa;
    font-size: 14px;
    font-weight: 700;
    z-index: 10000;
    pointer-events: none;
    animation: xpFloatUp 1.2s ease forwards;
}
@keyframes xpFloatUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}

/* Level up banner */
.levelup-banner {
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #6366f1, #00d4aa);
    color: #0a0f1a;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 700;
    z-index: 9999;
    animation: levelBannerIn 0.4s ease, levelBannerOut 0.4s 3s forwards;
}
@keyframes levelBannerIn { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes levelBannerOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-100%); } }

/* Badge gallery */
.badge-gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.badge-gallery {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.badge-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.badge-gallery-header h3 { color: #f1f5f9; font-size: 18px; margin: 0; }
.badge-gallery-stats { color: #94a3b8; font-size: 12px; }

.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.badge-item {
    text-align: center;
    padding: 14px 8px;
    border-radius: 10px;
    background: #1a2332;
    border: 1px solid #1e293b;
    transition: transform 0.2s, border-color 0.2s;
}
.badge-item:not(.locked):hover {
    transform: translateY(-2px);
    border-color: #f59e0b;
}
.badge-item.locked {
    opacity: 0.25;
    filter: grayscale(1);
}
.badge-item .badge-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.badge-item .badge-name { font-size: 10px; color: #94a3b8; line-height: 1.3; }
.badge-item.earned .badge-name { color: #f59e0b; }

.badge-gallery-close {
    margin-top: 16px;
    width: 100%;
    background: #1a2332;
    color: #94a3b8;
    border: 1px solid #1e293b;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.badge-gallery-close:hover { border-color: #6366f1; color: #6366f1; }

/* ===== CHALLENGE MODE ===== */
.challenge-mode-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #0a0f1a !important;
    border: none !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 12px !important;
}
.challenge-mode-btn:hover { filter: brightness(1.1); }

.challenge-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.challenge-panel {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}
.challenge-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.challenge-panel-header h3 { color: #f1f5f9; font-size: 18px; margin: 0; }
.challenge-progress { color: #94a3b8; font-size: 12px; margin-left: auto; }
.challenge-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}
.challenge-close:hover { color: #f1f5f9; }

/* Challenge List (picker) */
.challenge-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.challenge-item {
    background: #1a2332;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.challenge-item:hover { border-color: #6366f1; transform: translateY(-2px); }
.challenge-item.completed { border-color: #22c55e; }
.challenge-item-number { font-size: 10px; color: #64748b; }
.challenge-item-title { font-size: 13px; color: #f1f5f9; font-weight: 500; margin: 4px 0; }
.challenge-item-status { font-size: 11px; }
.challenge-item-status.done { color: #22c55e; }
.challenge-item-status.pending { color: #94a3b8; }

/* Active Challenge */
.challenge-active { }
.challenge-back-btn {
    background: none !important;
    border: none !important;
    color: #6366f1 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    margin-bottom: 12px !important;
    padding: 0 !important;
}
.challenge-card {
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 18px;
}
.challenge-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.challenge-number {
    background: #6366f1;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}
.challenge-card-title { font-size: 15px; font-weight: 600; color: #f1f5f9; }
.challenge-task {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-line;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #111827;
    border-radius: 8px;
    border: 1px solid #1e293b;
}
.challenge-instruction {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 12px;
    font-style: italic;
}
.challenge-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.challenge-submit {
    background: #22c55e !important;
    color: #0a0f1a !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.challenge-hint-btn {
    background: #1a2332 !important;
    color: #f59e0b !important;
    border: 1px solid #f59e0b !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.challenge-solution-btn {
    background: #1a2332 !important;
    color: #94a3b8 !important;
    border: 1px solid #1e293b !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}
.challenge-feedback {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
    white-space: pre-line;
}
.challenge-feedback.pass { border-color: #22c55e; }
.challenge-feedback.fail { border-color: #f59e0b; }

@media(max-width:768px) {
    .challenge-list { grid-template-columns: 1fr; }
    .challenge-panel { width: 95%; padding: 16px; }
}


/* Challenge Editor */
.challenge-editor-wrapper {
    margin-bottom: 12px;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
}
.challenge-editor-textarea {
    width: 100%;
    min-height: 150px;
    background: #0d1117;
    color: #e2e8f0;
    border: none;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}
.challenge-editor-textarea:focus {
    box-shadow: inset 0 0 0 1px #6366f1;
}
.challenge-output {
    margin-bottom: 12px;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
}
.challenge-output-header {
    padding: 4px 12px;
    background: #0a0f1a;
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #1e293b;
}
.challenge-output-text {
    background: #0d1117;
    color: #22c55e;
    padding: 10px 12px;
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* User Name */
.user-name {
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 500;
    background: #1a2332;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #1e293b;
    cursor: pointer;
}
.user-name:hover { border-color: #6366f1; }


/* ========================================================================== */
/* AUTH SCREEN                                                                */
/* ========================================================================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at top, #0f1729 0%, #050810 70%);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: authFade 0.3s ease;
}
@keyframes authFade { from { opacity: 0; } to { opacity: 1; } }

.auth-card {
    background: linear-gradient(160deg, #111827 0%, #0a0f1a 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    padding: 36px 32px 24px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px rgba(99,102,241,0.08);
    text-align: center;
}

.auth-logo {
    height: 80px;
    width: auto;
    max-width: 100%;
    margin: 0 auto 18px;
    display: block;
    object-fit: contain;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.auth-title {
    color: #f1f5f9;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    font-family: 'Inter', sans-serif;
}

.auth-subtitle {
    color: #94a3b8;
    font-size: 13px;
    margin: 0 0 22px;
    line-height: 1.5;
}

.auth-google-btn {
    width: 100%;
    background: #fff;
    color: #1f2937;
    border: none;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.1s, box-shadow 0.2s;
}
.auth-google-btn:hover {
    box-shadow: 0 4px 14px rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.google-icon {
    width: 22px; height: 22px;
    background: linear-gradient(135deg, #4285F4 0%, #34A853 35%, #FBBC05 70%, #EA4335 100%);
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 18px 0 14px;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(148,163,184,0.15);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-divider span    { background: transparent; padding: 0 8px; }

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: #0a0f1a;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,0.1);
}
.auth-tab {
    flex: 1;
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-tab.active {
    background: #1a2332;
    color: #00d4aa;
}

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
    background: #0a0f1a;
    border: 1px solid rgba(148,163,184,0.15);
    color: #f1f5f9;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.auth-form input:focus { border-color: #00d4aa; }
.auth-form input::placeholder { color: #64748b; }

.auth-submit-btn {
    background: linear-gradient(135deg, #00d4aa, #6366f1);
    color: #fff;
    border: none;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: transform 0.1s, box-shadow 0.2s;
}
.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,212,170,0.25);
}

.auth-error {
    color: #f87171;
    font-size: 12px;
    min-height: 16px;
    margin-top: 4px;
    text-align: left;
}

.auth-guest {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(148,163,184,0.1);
    font-size: 12px;
    color: #64748b;
}
.auth-guest a {
    color: #00d4aa;
    text-decoration: none;
    font-weight: 500;
}
.auth-guest a:hover { text-decoration: underline; }
.auth-guest-note { margin-left: 6px; font-style: italic; }

/* ========================================================================== */
/* LEADERBOARD MODAL                                                          */
/* ========================================================================== */
.leaderboard-btn,
.signout-btn {
    background: rgba(99,102,241,0.15);
    color: #c7d2fe;
    border: 1px solid rgba(99,102,241,0.25);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s;
}
.leaderboard-btn:hover { background: rgba(99,102,241,0.3); }
.signout-btn { padding: 4px 10px; font-weight: 600; }
.signout-btn:hover { background: rgba(248,113,113,0.2); border-color: rgba(248,113,113,0.4); color: #fca5a5; }

.leaderboard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,8,16,0.85);
    backdrop-filter: blur(6px);
    z-index: 4500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: authFade 0.2s ease;
}

.leaderboard-card {
    background: linear-gradient(160deg, #111827 0%, #0a0f1a 100%);
    border: 1px solid rgba(0,212,170,0.25);
    border-radius: 14px;
    width: min(640px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.leaderboard-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(148,163,184,0.08);
    position: relative;
}
.leaderboard-header h3 {
    margin: 0 0 4px;
    color: #f1f5f9;
    font-size: 18px;
}
.leaderboard-subtitle {
    color: #94a3b8;
    font-size: 12px;
}
.leaderboard-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.leaderboard-close:hover { background: rgba(148,163,184,0.1); color: #f1f5f9; }

.leaderboard-list {
    overflow-y: auto;
    padding: 4px 22px 14px;
    flex: 1;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 48px 1fr 70px 80px 70px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148,163,184,0.06);
    font-size: 13px;
    color: #cbd5e1;
    transition: background 0.15s;
}
.leaderboard-row:hover { background: rgba(99,102,241,0.05); }
.leaderboard-head {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    border-bottom: 1px solid rgba(148,163,184,0.15);
    position: sticky; top: 0;
    background: #0a0f1a;
}
.leaderboard-row.me {
    background: linear-gradient(90deg, rgba(0,212,170,0.12), rgba(99,102,241,0.08));
    border: 1px solid rgba(0,212,170,0.3);
    border-radius: 8px;
    margin: 4px 0;
}
.leaderboard-row.me .lb-name { color: #00d4aa; font-weight: 600; }
.lb-rank { font-size: 16px; font-weight: 700; }
.lb-xp   { color: #00d4aa; font-weight: 600; }
.lb-level { color: #6366f1; }
.lb-badges { color: #f59e0b; }
.lb-name em { color: #94a3b8; font-style: normal; font-size: 11px; margin-left: 4px; }

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    color: #64748b;
    padding: 40px 20px;
    font-size: 13px;
}

.leaderboard-footer {
    padding: 10px 22px 14px;
    border-top: 1px solid rgba(148,163,184,0.08);
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}


/* Challenge editor locked state */
.challenge-editor-textarea.locked {
    background: linear-gradient(135deg, #0d1424 0%, #0a1020 100%);
    color: #94a3b8;
    cursor: not-allowed;
    border-color: rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.1) inset;
}
.challenge-editor-textarea.locked::after { content: '🔒'; }

.challenge-feedback.locked {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.challenge-submit:disabled,
.challenge-hint-btn:disabled,
.challenge-solution-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}


/* Challenge picker — "Attended" (gave up + viewed solution) state */
.challenge-item.attended {
    border-color: rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(15,23,42,0.6));
    opacity: 0.85;
}
.challenge-item-status.attended {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    display: inline-block;
}


/* Fullscreen toggle in toolbar */
.fullscreen-btn {
    background: rgba(0, 212, 170, 0.12);
    color: #6ee7d3;
    border: 1px solid rgba(0, 212, 170, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s, transform 0.1s;
}
.fullscreen-btn:hover { background: rgba(0, 212, 170, 0.22); transform: translateY(-1px); }


/* ============================================================ */
/* SESSION PERSISTENCE — save-status pill + resume banner       */
/* ============================================================ */

.save-status {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    margin-left: 6px;
    transition: background 0.2s, color 0.2s;
    min-width: 0;
    white-space: nowrap;
}
.save-status:empty { display: none; }
.save-status.saving  { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.save-status.saved   { background: rgba(0, 212, 170, 0.15);  color: #6ee7d3; }
.save-status.synced  { background: rgba(0, 212, 170, 0.15);  color: #6ee7d3; }
.save-status.local   { background: rgba(245, 158, 11, 0.12); color: #fcd34d; }
.save-status.error   { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.save-status.restored {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
    animation: restoredPulse 2s ease-out 1;
}
@keyframes restoredPulse {
    0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.resume-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(99,102,241,0.12), rgba(0,212,170,0.08));
    border-bottom: 1px solid rgba(99,102,241,0.25);
    padding: 10px 18px;
    color: #f1f5f9;
    font-size: 13px;
    animation: resumeSlideIn 0.35s ease;
}
@keyframes resumeSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.resume-icon {
    font-size: 18px;
    color: #00d4aa;
}
.resume-text { flex: 1; }
.resume-actions { display: flex; gap: 6px; }
.resume-yes,
.resume-no {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    color: #cbd5e1;
    transition: background 0.2s;
}
.resume-yes {
    background: linear-gradient(135deg, #00d4aa, #6366f1);
    color: #fff;
    border-color: transparent;
}
.resume-yes:hover { transform: translateY(-1px); }
.resume-no:hover { background: rgba(148, 163, 184, 0.15); }


/* ============================================================ */
/* BOOT SPLASH — shown while we check the auth state           */
/* ============================================================ */
.boot-splash {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: radial-gradient(ellipse at top, #0f1729 0%, #050810 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    animation: bootFade 0.2s ease;
}
@keyframes bootFade { from { opacity: 0; } to { opacity: 1; } }

.boot-logo {
    height: 96px;
    width: auto;
    max-width: 80vw;
    object-fit: contain;
    display: block;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    opacity: 0.95;
}
.boot-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 212, 170, 0.2);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: bootSpin 0.8s linear infinite;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }
.boot-text {
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Inter', system-ui, sans-serif;
}


/* "Reset my progress" button in the gamification bar */
.reset-btn {
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.28);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s;
}
.reset-btn:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.45);
}


/* ============================================================ */
/* ENTITLEMENT LOCK — shown for paid modules without entitlement */
/* ============================================================ */
.locked-card {
    background: linear-gradient(160deg, #111827 0%, #0a0f1a 100%);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 14px;
    padding: 36px 32px;
    text-align: center;
    margin: 24px auto;
    max-width: 640px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 80px rgba(99,102,241,0.06);
}
.locked-card-icon { font-size: 56px; margin-bottom: 12px; filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.5)); }
.locked-card-title { font-size: 19px; font-weight: 700; color: #f1f5f9; margin-bottom: 12px; line-height: 1.4; font-family: 'Inter', sans-serif; }
.locked-card-text { font-size: 14px; color: #cbd5e1; line-height: 1.7; margin: 0 0 24px; }
.locked-card-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.locked-card-cta { background: linear-gradient(135deg, #00d4aa, #6366f1); color: #fff; padding: 12px 24px; border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none; transition: transform 0.15s, box-shadow 0.2s; box-shadow: 0 4px 16px rgba(0, 212, 170, 0.25); }
.locked-card-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 212, 170, 0.35); }
.locked-card-secondary { background: rgba(148, 163, 184, 0.1); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.2); padding: 11px 18px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.locked-card-secondary:hover { background: rgba(148, 163, 184, 0.18); }
.locked-card-tip { font-size: 12px; color: #94a3b8; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(148, 163, 184, 0.1); line-height: 1.6; }
.locked-card-tip a { color: #00d4aa; text-decoration: none; font-weight: 500; }
.locked-card-tip a:hover { text-decoration: underline; }
.locked-card-tip code { background: #0a0f1a; color: #00d4aa; padding: 1px 6px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
