/* ===========================================
   CYBERDELICS 101 - Core Styles
   Dark theme foundation for all lessons
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600&display=swap');

@font-face {
    font-family: 'Cloudsters';
    src: url('../assets/fonts/Cloudsters-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF;
}

@font-face {
    font-family: 'Oxanium';
    src: url('../assets/fonts/Oxanium-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Colors */
    --color-bg: #0a0a0f;
    --color-surface: #12121a;
    --color-surface-elevated: #1a1a24;
    --color-border: #2a2a3a;

    --color-text-primary: #e8e8f0;
    --color-text-secondary: #9090a0;
    --color-text-muted: #606070;

    --color-accent: #7b5cff;
    --color-accent-hover: #9177ff;
    --color-accent-glow: rgba(123, 92, 255, 0.3);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --line-height: 1.6;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Layout */
    --container-max-width: 100%;
    /* Expanded from 720px */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --header-height: 50px;
    /* Skinny Header */
    --logo-size: 120px;
    /* Restoration of original size */
    --footer-height: 80px;
    /* Footer Restored */

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ---------- App Shell Layout ---------- */

.cyberdeck-top-section {
    position: relative;
    z-index: 300;
    display: flex;
    flex: 0 0 var(--header-height);
    /* Reduced from 120px */
    width: 100%;
    align-items: center;
    height: var(--header-height);
    /* 50px */
    min-height: var(--header-height);
    /* Prevent collapse */
    background: transparent;
    /* Let header bg handle it */
}

.cd-top-logo-container {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--logo-size);
    height: var(--logo-size);
    /* 120px - Overlays content */
    background: var(--color-surface-elevated);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    /* Add bottom border for visual completeness */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    z-index: 500;
    /* Above header and body */
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.5);
    /* Shadow for depth */
}

.cd-top-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Updated Top Bar */
.cyberdeck-header {
    flex: 1;
    height: var(--header-height);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 100;
    border-bottom: 1px solid var(--color-border);
}

/* Footer Restored */
.cyberdeck-footer {
    /* display: none !important; */
}

/* ========== Italic Text Styling ========== */
em,
i {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1em;
}

/* ---------- Responsive Header Text ---------- */
@media (max-width: 800px) {

    .cd-back-text,
    .cd-fs-label {
        display: none;
    }

    .cd-fs-label {
        margin-right: 0;
        /* Clean up spacing for button */
    }
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: var(--line-height);
    font-weight: 700;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout Root ---------- */
#lesson-root {
    position: relative;
    width: 100%;
    height: 100vh;
    /* Ensure it fills viewport or parent iframe */
    overflow: hidden;
    /* Prevent scroll */
    box-shadow: inset 0 0 0 4px rgba(123, 92, 255, 0.2);
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h1 {
    font-size: var(--font-size-2xl);
}

h2 {
    font-size: var(--font-size-xl);
}

h3 {
    font-size: var(--font-size-lg);
}

p {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

strong {
    color: var(--color-text-primary);
    font-weight: 600;
}




/* ---------- Cyberdeck Core Layout (Safe) ---------- */


/* ---------- Lesson Container ---------- */
.lesson-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--space-xl);
    min-height: 100vh;
}

/* ---------- Lesson Header ---------- */
.lesson-header {
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.lesson-header h1 {
    margin-bottom: var(--space-sm);
}

.lesson-subtitle {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--color-surface);
    border-radius: 2px;
    margin-top: var(--space-md);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
    border-radius: 2px;
    width: 0%;
    transition: width var(--transition-normal);
}

.progress-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-accent);
    color: white;
    box-shadow: 0 0 20px var(--color-accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 24px var(--color-accent-glow);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--color-surface-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-border);
}

/* ---------- Cards / Sections ---------- */
.content-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

/* ---------- Lists ---------- */
ul,
ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
}

li {
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
}

li strong {
    color: var(--color-accent);
}

/* ---------- Utility Classes ---------- */
.text-center {
    text-align: center;
}

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

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

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mt-xl {
    margin-top: var(--space-xl);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}

/* ---------- Responsive ---------- */
@media (max-width: 689px) {
    :root {
        --font-size-base: 15px;
        --font-size-2xl: 24px;
        /* Smaller H1 */
        --font-size-xl: 20px;
        /* Smaller H2 */
        --space-xl: 20px;
        --space-2xl: 32px;
    }

    .lesson-container {
        padding: var(--space-md);
        /* Tighter padding */
    }

    /* Adjust header for mobile */
    .cyberdeck-header {
        padding: 0 var(--space-sm);
    }

    .cd-header-left,
    .cd-header-right {
        min-width: 80px;
        /* Allow more space for center */
    }

    .cd-back-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* ---------- Media Injection System ---------- */
.media-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.media-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content sits above background */
.media-background+.section-content,
.media-background+.scenario-narrative,
.media-background+.sim-viewport {
    position: relative;
    z-index: 1;
}

.media-inline {
    width: 100%;
    margin-bottom: var(--space-md);
    border: 1px solid var(--color-border);
}

.sim-media-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sim-media-video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}


.threejs-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Neural Background Canvas */
.neural-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
    /* Subtle effect */
}

/* ---------- Cyberdeck UI Shell ---------- */

/* Shell Grid Layout */
/* Shell Grid Layout */
.cyberdeck-shell {
    display: flex;
    flex-direction: column;
    /* height: 100%; width: 100%; replaced by inset */
    position: absolute;
    inset: 0;
    /* Force fill parent */
    background: transparent;
    overflow: hidden;
    /* ensure hidden matches parent */
}

.cyberdeck-body {
    display: flex;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
    position: relative;
    min-height: 0;
    /* Allow shrinking */
}

.cyberdeck-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: var(--space-lg);
    scrollbar-gutter: stable;
    /* Reserve space for scrollbar */
    overscroll-behavior: none;
    /* Prevent parent scroll */
    /* Transparent background to let canvas show through */
    background: transparent;
    height: auto;
    /* Allow flex to control height */
    min-height: 0;
    /* Allow shrinking past content */
    z-index: 1;
    /* Content above canvas */
}

.module-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    /* Allow growth */
    height: auto;
    overflow: visible;
    /* Let parent handle scroll */
}

/* Top Bar */
.cyberdeck-header {
    height: var(--header-height);
    flex-shrink: 0;
    /* Prevent collapsing */
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    /* For absolute centering if needed */
}

/* Left Section (Back Button) */
.cd-header-left {
    display: flex;
    align-items: center;
    min-width: 120px;
    /* Ensure balance with right side */
    z-index: 2;
    /* Above absolute center */
}

.cd-back-btn {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    padding: 4px 12px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.cd-back-btn:hover {
    background: var(--color-accent);
    color: #000;
    box-shadow: 0 0 10px var(--color-accent);
}

/* Center Section (Title & Progress) */
.cd-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    width: 60%;
    max-width: 600px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Right Section (Fullscreen & Status) */
.cd-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 120px;
    /* Balance with left */
    z-index: 2;
}

/* Bottom Bar & Visualizer */
.cyberdeck-footer {
    height: var(--footer-height);
    flex-shrink: 0;
    /* Prevent collapsing */
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    margin-top: auto;
    /* Ensure it stays at bottom if content is short */
}

/* Removed .cd-header-left .cd-header-image blocks as they were replaced */

/* .cd-header-center was here, replaced above */



.cd-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.cd-progress-fill {
    height: 100%;
    background: var(--color-accent);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--color-accent);
}

.cd-fs-label {
    font-family: 'Rajdhani', monospace;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--color-text-muted);
    margin-right: 15px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.cd-header-right:hover .cd-fs-label {
    color: var(--color-accent);
}

/* Full Screen Button */
.cd-fullscreen-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 6px 12px;
    margin-right: 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.cd-fullscreen-btn:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: 0 0 10px rgba(123, 92, 255, 0.2);
}

/* Subtle Glow for Recommended Fullscreen */
/* Subtle Glow for Recommended Fullscreen */
.fs-recommended-glow .cd-fullscreen-btn {
    text-shadow: 0 0 5px rgba(123, 92, 255, 0.8);
    border-color: rgba(123, 92, 255, 0.8);
    color: var(--color-accent);
    animation: intensePulse 1.5s infinite alternate;
    background: rgba(123, 92, 255, 0.1);
}

@keyframes intensePulse {
    0% {
        box-shadow: 0 0 4px rgba(123, 92, 255, 0.4);
        border-color: rgba(123, 92, 255, 0.4);
    }

    100% {
        box-shadow: 0 0 15px rgba(123, 92, 255, 0.8), 0 0 5px rgba(123, 92, 255, 0.4) inset;
        border-color: var(--color-accent);
    }
}

/* Sidebars */
.cyberdeck-sidebar {
    display: none !important;
    /* TEMPORARY: User requested removal */
    width: 260px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 90;
}

.cd-sidebar-right {
    border-right: none;
    border-left: 1px solid var(--color-border);
}

.cyberdeck-sidebar.collapsed {
    width: 40px;
}

.cd-sidebar-header {
    height: 40px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
}

.cd-sidebar-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.cyberdeck-sidebar.collapsed .cd-sidebar-title {
    display: none;
}

.cd-toggle-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 10px;
    padding: 4px;
}

.cd-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    opacity: 1;
    transition: opacity 0.2s;
}

.cyberdeck-sidebar.collapsed .cd-sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.cd-empty-state {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-style: italic;
    margin-top: var(--space-xl);
}

.cd-profile-summary {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.cd-archetype-label {
    color: var(--color-accent);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

/* ---------- Responsive Sidebar & Shell (Mobile/Tablet) ---------- */
@media (max-width: 1000px) {
    :root {
        /* Reduce Header/Footer Sizes */
        --logo-size: 60px;
        --header-height: 50px;
        /* Keep unchanged or slightly smaller */
        --footer-height: 50px;
        /* Reduce from 80px */
    }

    /* Top Section follows header height, logo overlays */
    .cyberdeck-top-section {
        flex-basis: var(--header-height);
        height: var(--header-height);
        min-height: var(--header-height);
    }

    /* Sidebars: Overlay Mode */
    .cyberdeck-sidebar {
        position: absolute;
        height: 100%;
        z-index: 500;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }

    .cd-sidebar-left {
        left: 0;
    }

    .cd-sidebar-right {
        right: 0;
    }

    /* When NOT collapsed, they take full width or large partial width on mobile? 
       Let's keep them 260px but overlaying. */

    /* Ensure content doesn't think sidebars take space */
    .cyberdeck-body {
        position: relative;
    }
}

.cd-stat-row {
    display: flex;
    justify-content: space-between;
    font-family: monospace;
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Bottom Bar & Visualizer */
.cyberdeck-footer {
    height: var(--footer-height);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.cd-wave-container {
    width: 100%;
    max-width: 1600px;
    /* Expanded for new layout */
    height: 100%;
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 20px;
}

/* Visualizer Area (Left/Center) */
.cd-visualizer-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    gap: 10px;
    /* Contains slider + canvas */
}

#wave-canvas {
    flex: 1;
    height: 100%;
    background: #050508;
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.cd-slider-container {
    height: 100%;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.cd-slider-group {
    display: flex;
    gap: 1px;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

/* Right Image Container */
.cd-footer-image {
    width: 120px;
    /* Fixed width */
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Transparent background if image is present */
.cd-header-image:has(img),
.cd-footer-image:has(img) {
    background: transparent !important;
    border: none !important;
}

.cd-footer-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 
 * Robust Vertical Sliders via Rotation 
 * Standard appearance-vertical often fails across browsers.
 * Rotation is reliable but requires careful sizing.
 */
.wave-slider {
    appearance: none;
    -webkit-appearance: none;
    /* Critical for Chrome/Edge */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    width: 40px !important;
    /* Force small visual height */
    height: 4px !important;
    outline: none;
    transform: rotate(-90deg);
    margin: 0 -40px;
    /* Tighter spacing */
    cursor: pointer;
}

.wave-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: grab;
    transition: background 0.2s;
}

.wave-selector-btn {
    width: 24px;
    height: 80%;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    background: #333;
    color: #888;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-family: inherit;
}

/* Artifacts & Audio Player Styles Eliminated */

/* Toast Notifications */
.cd-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--color-accent);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    font-size: var(--font-size-base);
    box-shadow: 0 4px 20px rgba(123, 92, 255, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.cd-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Artifact Leftovers Removed */

/* Audio Player Styles Removed */

/* Artifact Counter */
.cd-artifact-counter {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent);
    margin-left: auto;
    margin-right: auto;
}

/* Toast Notifications */
.cd-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--color-accent);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    font-size: var(--font-size-base);
    box-shadow: 0 4px 20px rgba(123, 92, 255, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.cd-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mini Controls Removed */

/* =========================================
   TUTORIAL OVERLAY
   ========================================= */
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    /* High z-index */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.tutorial-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    /* Let clicks pass through to underlying elements */
}

/* Spotlight: massive box-shadow trick */
.tutorial-spotlight {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    z-index: 9001;
}

.tutorial-spotlight.rect {
    border-radius: 4px;
}

.tutorial-card {
    position: absolute;
    width: 300px;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid #00D9FF;
    border-radius: 8px;
    padding: 20px;
    color: white;
    z-index: 9002;
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.2);
    transition: all 0.5s ease;
    pointer-events: auto;
    font-family: 'Inter', sans-serif;
}

.tutorial-card h3 {
    margin: 0 0 10px 0;
    color: #00D9FF;
    font-size: 1.2rem;
    font-family: 'Space Mono', monospace;
}

.tutorial-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #ddd;
    margin-bottom: 20px;
}

.tutorial-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-tutorial {
    background: transparent;
    border: 1px solid #00D9FF;
    color: #00D9FF;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    font-family: 'Space Mono', monospace;
}

.btn-tutorial:hover {
    background: rgba(0, 217, 255, 0.2);
}

.btn-tutorial.primary {
    background: #00D9FF;
    color: #000;
}

/* Opening Screen Overlay */
.opening-screen {
    position: absolute;
    inset: 0;
    background: transparent;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.8s ease;
}

/* Subtle grid texture overlay on the opening screen */
.opening-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(130, 90, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(130, 90, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Glowing orb blobs behind the cover content */
.cover-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.cover-orb-1 {
    width: 65vw; height: 65vw;
    background: radial-gradient(ellipse at center, rgba(89, 0, 200, 0.35) 0%, rgba(89, 0, 200, 0.06) 55%, transparent 75%);
    top: -28%; left: -25%;
    animation: cover-orb-1 11s ease-in-out infinite alternate;
}
.cover-orb-2 {
    width: 55vw; height: 55vw;
    background: radial-gradient(ellipse at center, rgba(0, 150, 255, 0.22) 0%, rgba(0, 150, 255, 0.04) 55%, transparent 75%);
    bottom: -25%; right: -20%;
    animation: cover-orb-2 15s ease-in-out infinite alternate;
}
@keyframes cover-orb-1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 8vh) scale(1.18); }
}
@keyframes cover-orb-2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-8vw, -10vh) scale(1.12); }
}

/* Cover central content */
.cover-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    position: relative;
    z-index: 2;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 780px;
}

.cover-eyebrow {
    font-family: 'Poppins', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: rgba(0, 217, 255, 0.55);
    margin: 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(0, 217, 255, 0.15);
    width: 100%;
}

.cover-title {
    font-family: 'Cloudsters', sans-serif;
    font-size: clamp(2.8rem, 8vw, 6rem);
    font-weight: normal;
    color: #fff;
    margin: 0;
    line-height: 1.1;
    -webkit-font-smoothing: antialiased;
    filter:
        drop-shadow(0 0 28px rgba(130, 90, 255, 0.65))
        drop-shadow(0 0 55px rgba(130, 90, 255, 0.3))
        drop-shadow(0 0 12px rgba(0, 217, 255, 0.35));
    animation: cover-title-pulse 4s ease-in-out infinite alternate;
}
@keyframes cover-title-pulse {
    0%   { filter: drop-shadow(0 0 22px rgba(130,90,255,0.5)) drop-shadow(0 0 40px rgba(130,90,255,0.22)); }
    100% { filter: drop-shadow(0 0 38px rgba(130,90,255,0.75)) drop-shadow(0 0 70px rgba(130,90,255,0.4)) drop-shadow(0 0 16px rgba(0,217,255,0.45)); }
}

.opening-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Responsive Image Overlay Base */
.course-header {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
}

.course-header img.header-bg {
    width: 100%;
    display: block;
    aspect-ratio: 1024 / 512;
    object-fit: cover;
}

.lesson-overlay {
    position: absolute;
    /* Box bounds for holographic overlay */
    top: 14%;
    left: 51.5%;
    width: 45%;
    height: 71%;

    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1vw 2vw;
    color: #fff;
    font-family: 'Space Mono', monospace;
    box-sizing: border-box;
    text-align: center;
}

/* ===================================================
   OPENING SCREEN FONT PAIRING — ACTIVE: Pairing 2
   1 = Orbitron (h) + Inter (body)
   2 = Oxanium (h) + Space Mono (body)  ← ACTIVE
   3 = Sora (h) + Montserrat (body)
   =================================================== */


.lesson-overlay h1 {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 3.5vw, 3rem);
    font-family: 'Cloudsters', sans-serif;
    font-weight: normal;
    font-variant-ligatures: all;
    -webkit-font-feature-settings: "liga" 1, "clig" 1, "dlig" 1, "calt" 1;
    font-feature-settings: "liga" 1, "clig" 1, "dlig" 1, "calt" 1;
    margin: 0;
    color: #fff;
    letter-spacing: 0px;
    line-height: 1.25;
    padding: 0;
    overflow: visible;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    isolation: isolate;
    transform: translateZ(0);
    filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.8)) drop-shadow(0 0 20px rgba(0, 255, 255, 0.3));
    text-shadow: none;
    paint-order: stroke fill;
}



.overlay-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: clamp(8px, 1.5vw, 20px) 0 0 0;
}

.opening-begin-btn {
    padding: clamp(7px, 1vw, 13px) clamp(20px, 3.5vw, 44px);
    border-radius: 100px;
    background: transparent;
    border: 1.5px solid var(--color-accent);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.6rem, 1.1vw, 0.82rem);
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 18px rgba(0, 217, 255, 0.18), inset 0 0 18px rgba(0, 217, 255, 0.04);
}

.opening-begin-btn:hover {
    background: rgba(0, 217, 255, 0.12);
    border-color: var(--color-accent);
    box-shadow: 0 0 28px rgba(0, 217, 255, 0.35), inset 0 0 18px rgba(0, 217, 255, 0.08);
    transform: translateY(-1px);
}

.opening-begin-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 14px rgba(0, 217, 255, 0.2);
}

/* Bottom Sidebar (Overlay) */
.cd-sidebar-bottom {
    width: 100%;
    height: 300px;
    /* Expanded Height */
    left: 0;
    bottom: var(--footer-height, 60px);
    /* Position above footer */
    top: auto;
    border-right: none;
    border-top: 1px solid var(--color-border);
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 95;
    position: absolute;
}

.cd-sidebar-bottom.collapsed {
    width: 100%;
    height: 40px;
    /* Header Height */
}

/* Interactive Simulation - Expanded Layout */
/* User asked where to edit size: HERE. */
.interactive-simulation-container {
    width: 100%;
    height: 100%;
    /* Ensure it fills parent */
    min-height: 500px;
    /* Force a minimum height if parent is small */
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.sim-viewport {
    flex: 1;
    /* Grow to fill space */
    width: 100%;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.sim-controls {
    /* Style controls container if needed */
    padding: 10px;
}

/* Continue Button - Explicit Selector */
button.btn-continue,
.module-interactive-simulation .btn-continue {
    margin-top: 1rem;
    align-self: flex-end;
    background: transparent;
    border: 1px solid var(--color-accent) !important;
    color: var(--color-accent) !important;
    padding: 10px 24px;
    font-family: 'Space Mono', monospace;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.2);
    display: none;
    /* Hidden by default, JS toggles it */
}

button.btn-continue:hover,
.module-interactive-simulation .btn-continue:hover {
    background: var(--color-accent) !important;
    color: #000 !important;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.6);
}

/* Interactive Simulation - Scoped Fix */
.interactive-simulation-container {
    /* Ensure it takes available space without forcing overflow */
    flex: 1;
    height: 100%;
    /* Force full height of parent */
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Continue Button - Scoped to Sim */
.module-interactive-simulation .btn-continue {
    margin-top: 1rem;
    align-self: flex-end;
    background: rgba(0, 217, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 217, 255, 0.4);
    color: var(--color-accent);
    padding: 12px 36px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.1);
    position: relative;
}

/* Flash/Pulse Highlight on Completion */
.interaction-complete+.sim-footer .btn-continue,
.interaction-complete .btn-continue {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 25px rgba(0, 217, 255, 0.4);
    animation: btn-glow-pulse 2s infinite;
}

@keyframes btn-glow-pulse {
    0% {
        box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 35px rgba(0, 217, 255, 0.7);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
        transform: scale(1);
    }
}

.module-interactive-simulation .btn-continue {
    /* Ensure it remains visible if lesson runner set it, but flex for icons */
    display: flex;
    align-items: center;
    gap: 12px;
}

.module-interactive-simulation .btn-continue:hover {
    background: rgba(0, 217, 255, 0.15);
    color: #fff;
    border-color: var(--color-accent);
    box-shadow: 0 0 25px rgba(0, 217, 255, 0.4), inset 0 0 15px rgba(0, 217, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
}

.module-interactive-simulation .btn-continue span {
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

.module-interactive-simulation .btn-continue:hover span {
    transform: translateX(4px);
}

/* Bottom Sidebar, Artifact Nodes, & Timeline Markers Removed */

.video-container {
    width: 400px;
    /* Reduced from 600px per request */
    max-width: 100%;
    margin: 0 auto;
    background: #000;
    line-height: 0;
    border: 1px solid var(--color-border);
    /* Add a subtle frame */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ---------- Global Custom Scrollbar ---------- */
/* Applies to all scrollable containers including .cyberdeck-main */
::-webkit-scrollbar {
    width: 14px;
    background: var(--color-bg);
}

::-webkit-scrollbar-track {
    background: #1a1a24;
    border-left: 1px solid var(--color-border);
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border: 3px solid #1a1a24;
    border-radius: 7px;
    box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-hover);
    border-color: #1a1a24;
    box-shadow: 0 0 10px var(--color-accent);
}

/* ---------- Intro Module Interface Highlights ---------- */
.interface-highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.highlight-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.highlight-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--color-accent);
}

.highlight-item strong {
    color: var(--color-accent);
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 1.1em;
}

/* ========== Module & Section Titles ========== */
.module-title {
    font-size: clamp(2rem, 3vw, 3rem);
    font-family: 'Cloudsters', var(--font-family);
    font-weight: normal;
    color: var(--color-accent);
    text-align: center;
    margin: 0 0 var(--space-xl) 0;
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--color-border);
    letter-spacing: 0px;
    line-height: 1.4;
    text-shadow: 0 0 20px var(--color-accent-glow);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-accent);
    text-align: center;
    margin: var(--space-xl) auto var(--space-lg) auto;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== Progressive Disclosure Content Styling ========== */
.section-content {
    line-height: 1.8;
    color: var(--color-text-secondary);
    margin: var(--space-lg) 0;
}

.section-content p {
    margin-bottom: var(--space-lg);
}

.section-content p:last-child {
    margin-bottom: 0;
}

.section-content strong {
    color: var(--color-accent);
    font-weight: 600;
}

.section-content em {
    color: var(--color-text-primary);
    font-style: italic;
}

/* ========== Scenario-Based Narrative Styling ========== */
.scenario-narrative {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--space-xl);
    margin: var(--space-lg) 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    line-height: 1.8;
    color: var(--color-text-secondary);
    transition: all var(--transition-normal);
}

.scenario-narrative::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-accent), transparent);
    border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg);
}

.scenario-narrative:hover {
    border-color: var(--color-accent);
    box-shadow: 0 6px 16px rgba(123, 92, 255, 0.15);
}

.scenario-narrative h3 {
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-lg);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scenario-narrative p {
    margin-bottom: var(--space-md);
}

.scenario-narrative p:last-child {
    margin-bottom: 0;
}

.scenario-narrative strong {
    color: var(--color-accent);
    font-weight: 600;
}

.scenario-narrative em {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: var(--font-size-sm);
}

/* ========== Opening Screen Title Styling (Now handled by .lesson-overlay h1) ========== */
/* .opening-screen h1 merged into .lesson-overlay block */

@keyframes titlePulse {

    0%,
    100% {
        text-shadow: 0 0 8px rgba(0, 255, 255, 0.8), 0 0 20px rgba(0, 255, 255, 0.4);
    }

    50% {
        text-shadow: 0 0 12px rgba(0, 255, 255, 1), 0 0 30px rgba(0, 255, 255, 0.6), 0 0 50px rgba(0, 255, 255, 0.2);
    }
}

/* ========== Lesson Complete Screen ========== */
.lesson-complete-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 80vh;
    text-align: center;
    animation: fadeIn var(--transition-slow) ease-out;
    padding: var(--space-xl);
}

.completed-icon {
    font-size: 5rem;
    color: var(--color-accent);
    margin-bottom: var(--space-md);
    text-shadow: 0 0 25px var(--color-accent-glow);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.lesson-complete-title {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: var(--space-md);
    color: #fff;
    font-family: 'Cloudsters', var(--font-family);
    line-height: 1.4;
    text-shadow: 0 0 15px rgba(0, 217, 255, 0.8), 0 0 30px rgba(0, 217, 255, 0.3);
    letter-spacing: 0px;
}

.lesson-complete-subtitle {
    font-size: var(--font-size-xl);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2xl);
    max-width: 600px;
    line-height: 1.6;
}

.lesson-complete-subtitle strong {
    color: #fff;
    display: block;
    margin-top: var(--space-md);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-family: 'Cloudsters', var(--font-family);
    font-weight: normal;
    letter-spacing: px;
    line-height: 1.4;
}

.lesson-complete-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

.btn-return {
    padding: 16px 36px;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: #fff;
    background: transparent;
    border: 2px solid var(--color-accent);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    box-shadow: 0 0 20px var(--color-accent-glow), inset 0 0 10px rgba(123, 92, 255, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-return span {
    font-size: 1.3em;
    transform: rotate(-90deg);
    /* Make the arrow point nicely if it's U+2B8C */
    transition: transform 0.3s ease;
}

.btn-return:hover {
    background: rgba(123, 92, 255, 0.15);
    box-shadow: 0 0 30px rgba(123, 92, 255, 0.5), inset 0 0 15px rgba(123, 92, 255, 0.4);
    transform: translateY(-2px);
    border-color: #9177ff;
}

.btn-return:hover span {
    transform: rotate(-90deg) translateY(3px);
    /* Arrow hover effect */
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---------- Lesson complete — "Coming Next" section ---------- */
.lesson-complete-next {
    margin-top: 2rem;
    padding: 1.25rem 2rem;
    background: rgba(130, 90, 255, 0.08);
    border: 1px solid rgba(130, 90, 255, 0.22);
    border-radius: 16px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    animation: fadeIn 0.5s 0.4s ease-out both;
}

.lesson-complete-next-label {
    font-family: 'Poppins', sans-serif;
    font-size: 0.63rem;
    font-weight: 600;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    color: rgba(0, 217, 255, 0.55);
    margin: 0 0 0.5rem;
}

.lesson-complete-next-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(225, 220, 248, 0.92);
    margin: 0 0 0.35rem;
    line-height: 1.4;
}

.lesson-complete-next-desc {
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    color: rgba(170, 165, 205, 0.65);
    margin: 0;
    line-height: 1.5;
}

.lesson-complete-return-hint {
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    color: rgba(160, 155, 200, 0.6);
    margin-top: 1.5rem;
    letter-spacing: 0.3px;
}