        :root {
            --bg-color: #050005; /* Deep void purple-black */
            --text-main: #b8b8b8;
            --text-header: #9900ff; /* Curseborne Purple */
            --link-color: #00ff00;
            --link-visited: #008f00;
            --border-style: 2px solid #333;
            --glitch-color: #ff0055; /* Glitch Pink */

            /* Scrollbar vars - Hidden by default */
            --sb-thumb: transparent;
            --sb-track: transparent;
            --sb-border: transparent;
            --sb-thumb-hover: transparent;
        }

        /* Enable transition for CSS vars if supported */
        @property --sb-thumb { syntax: '<color>'; inherits: true; initial-value: transparent; }
        @property --sb-track { syntax: '<color>'; inherits: true; initial-value: transparent; }
        @property --sb-border { syntax: '<color>'; inherits: true; initial-value: transparent; }
        @property --sb-thumb-hover { syntax: '<color>'; inherits: true; initial-value: transparent; }

        /* Firefox Scrollbar Support (Hidden by default) */
        html {
            scrollbar-width: thin;
            scrollbar-color: transparent transparent;
        }

        /* Visible state applied to HTML to override Firefox default */
        html.scroll-visible {
            --sb-thumb: #00ff00;
            --sb-track: #050005;
            --sb-border: #00ff00;
            --sb-thumb-hover: #9900ff;
            transition: --sb-thumb 2s, --sb-track 2s, --sb-border 2s, --sb-thumb-hover 2s;

            /* Firefox visible state */
            scrollbar-color: #00ff00 #050005;
        }

        /* Custom Scrollbar Global */
        ::-webkit-scrollbar {
            width: 12px;
        }
        ::-webkit-scrollbar-track {
            background: var(--sb-track);
            border-left: 1px solid var(--sb-border);
        }
        ::-webkit-scrollbar-thumb {
            background: var(--sb-thumb);
            border: 2px solid var(--sb-track);
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--sb-thumb-hover);
        }

        * {
            box-sizing: border-box;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            font-family: 'Courier New', Courier, monospace;
            margin: 0;
            padding: 0;
            overflow-x: hidden;
            line-height: 1.4;
            background-image: 
                linear-gradient(rgba(10, 0, 10, 0) 50%, rgba(0, 0, 0, 0.4) 50%),
                linear-gradient(90deg, rgba(255, 0, 255, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
            background-size: 100% 3px, 3px 100%;
        }

        /* Scanline effect */
        body::after {
            content: " ";
            display: block;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(18, 16, 16, 0.1);
            opacity: 0;
            z-index: 2;
            pointer-events: none;
            animation: scanline 8s linear infinite;
        }

        @keyframes scanline {
            0% { transform: translateY(-100%); }
            100% { transform: translateY(100%); }
        }

        a {
            color: var(--link-color);
            text-decoration: underline;
            cursor: help;
        }

        a:visited {
            color: var(--link-visited);
        }

        a:hover {
            background-color: var(--link-color);
            color: black;
            text-decoration: none;
        }

        /* Container */
        .container {
            max-width: 850px;
            margin: 0 auto;
            padding: 20px;
            border-left: 2px solid #220022;
            border-right: 2px solid #220022;
            min-height: 100vh;
            display: none; /* Hidden by default for splash */
            flex-direction: column;
            box-shadow: 0 0 50px rgba(100, 0, 100, 0.1);
        }

        /* Splash Screen */
        #splash {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: black;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            text-align: center;
            padding: 20px;
        }

        .warning-box {
            border: 4px double #9900ff;
            padding: 2rem;
            max-width: 600px;
            background: #0a000a;
            box-shadow: 0 0 20px #440044;
        }

        .enter-btn {
            background: black;
            color: #9900ff;
            border: 2px solid #9900ff;
            padding: 10px 20px;
            font-family: 'Courier New', monospace;
            font-weight: bold;
            font-size: 1.2rem;
            cursor: pointer;
            margin-top: 20px;
            text-transform: uppercase;
            box-shadow: 4px 4px 0px #330033;
            transition: all 0.2s;
        }

        .enter-btn:hover {
            background: #9900ff;
            color: white;
            box-shadow: 2px 2px 0px #ffffff;
            transform: translate(2px, 2px);
        }

        /* Header */
        header {
            text-align: center;
            margin-bottom: 40px;
            border-bottom: 2px groove #550055;
            padding-bottom: 20px;
        }

        h1 {
            color: var(--text-header);
            font-size: 3rem;
            text-transform: uppercase;
            text-shadow: 3px 3px 0px #330033;
            margin: 0;
            letter-spacing: -3px;
        }

        .sub-header {
            font-size: 0.9rem; 
            color: #777; 
            letter-spacing: 2px;
        }

        .marquee-container {
            background: #220022;
            color: #ff00ff;
            padding: 5px;
            overflow: hidden;
            white-space: nowrap;
            border: 2px inset #550055;
            margin-bottom: 20px;
            font-weight: bold;
            font-family: "Lucida Console", Monaco, monospace;
        }

        .marquee-content {
            display: inline-block;
            animation: scroll-left 20s linear infinite;
        }

        /* Navigation */
        nav {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 30px;
            background: #0f000f;
            padding: 15px;
            border: 1px solid #440044;
        }

        .nav-btn {
            background: black;
            border: 1px solid var(--text-header);
            color: var(--text-header);
            padding: 8px 18px;
            font-family: 'Courier New', monospace;
            cursor: pointer;
            font-size: 1rem;
            text-transform: uppercase;
        }

        .nav-btn.active, .nav-btn:hover {
            background: var(--text-header);
            color: black;
            box-shadow: 0 0 15px var(--text-header);
            text-shadow: none;
        }

        /* Main Content Areas */
        .content-section {
            display: none;
            animation: flicker 0.3s ease-in;
        }

        .content-section.active {
            display: block;
        }

        h2 {
            color: #000;
            background: #00ff00;
            display: inline-block;
            padding: 4px 12px;
            font-size: 1.4rem;
            margin-top: 30px;
            box-shadow: 4px 4px 0 #9900ff;
            transform: skew(-5deg);
        }
        
        /* NEW: Specific class to reset H2 styles for Overlays */
        .overlay-header {
            background: transparent !important;
            color: inherit;
            display: block;
            box-shadow: none !important;
            transform: none !important;
            border-bottom: 2px solid currentColor;
            padding: 0;
            margin-bottom: 20px;
            margin-top: 0;
            text-shadow: 0 0 10px currentColor; /* Nice neon glow instead of background */
        }

        h3 {
            color: #ff00ff;
            border-bottom: 1px dashed #ff00ff;
            display: inline-block;
        }

        p {
            margin-bottom: 15px;
        }

        ul {
            list-style-type: square;
            color: #ddd;
        }
        
        li { margin-bottom: 8px; }

        /* Character Cards (Tables because 90s) */
        .char-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 4px;
            border: 2px solid #333;
            margin-bottom: 25px;
            background: #080808;
        }

        .char-table td, .char-table th {
            border: 1px solid #222;
            padding: 12px;
            vertical-align: top;
        }

        .char-img-placeholder {
            width: 120px;
            height: 120px;
            background: #111;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #555;
            font-size: 0.7rem;
            border: 1px dotted #666;
            text-align: center;
        }

        /* NEW: Folder & File Styling */
        details.folder-structure {
            margin-bottom: 20px;
            background: #080008;
            border: 1px dashed #550055;
        }

        details.folder-structure summary {
            padding: 10px;
            background: #220022;
            color: #00ff00;
            cursor: pointer;
            list-style: none; /* Hide default triangle */
            font-weight: bold;
            border-bottom: 1px solid #550055;
        }
        
        /* Custom folder icon logic */
        details.folder-structure summary::before {
            content: "[ + ] 📁 ";
            color: #fff;
        }

        details.folder-structure[open] summary::before {
            content: "[ - ] 📂 ";
            color: #ffff00;
        }

        .folder-content {
            padding: 15px;
            border-top: 1px solid #333;
        }

        /* Topic Box Styling for Lineages (Clickable) */
        .topic-box {
            border: 1px solid #9900ff;
            padding: 15px;
            background: #0a000a;
            margin-bottom: 15px;
            box-shadow: 2px 2px 0px #220022;
            transition: all 0.2s;
            position: relative;
            margin-left: 20px; /* Indent to look like it's inside the folder */
            border-left: 4px solid #9900ff;
            cursor: pointer; /* Change cursor to pointer */
        }

        .topic-box:hover {
            border-color: #00ff00;
            transform: translate(-2px, -2px);
            box-shadow: 4px 4px 0px #005500;
            background: #0f000f;
        }

        .topic-box h3 {
            margin-top: 0;
            border-bottom: none;
            background-color: transparent;
            color: #fff;
            padding: 0;
            font-size: 1rem;
            letter-spacing: 1px;
            margin-bottom: 5px;
        }
        
        .topic-box::after {
            content: " [CLICK TO ACCESS]";
            font-size: 0.7rem;
            color: #555;
            position: absolute;
            top: 15px;
            right: 15px;
        }

        .topic-box:hover::after {
            color: #00ff00;
        }

        /* OVERLAY / MODAL STYLES */
        #overlay-container {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.92);
            z-index: 10000;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .modal-content {
            background: #000;
            border: 2px solid #9900ff;
            width: 100%;
            max-width: 700px;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            padding: 20px;
            box-shadow: 0 0 30px #440044;
            animation: modalOpen 0.3s ease-out;
        }

        .modal-wide {
            max-width: 95vw;
            height: 95vh;
            padding: 0;
            display: flex;
            flex-direction: column;
        }

        .modal-wide #overlay-content-wrapper {
            flex-grow: 1;
            height: 100%;
            width: 100%;
            overflow: hidden; /* Ensure it contains the iframe properly */
        }

        #creator-frame {
            width: 100%;
            height: 100%;
            border: none;
            display: block;
        }

        .ad-banner {
            background: #000;
            border: 4px dashed #ff00ff;
            color: #ff00ff;
            padding: 30px;
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            margin: 40px 0;
            cursor: pointer;
            text-transform: uppercase;
            letter-spacing: 4px;
            animation: pulse-border 2s infinite, flicker 3s infinite;
            position: relative;
            overflow: hidden;
        }
        
        .ad-banner:hover {
            background: #220022;
            color: #fff;
            border-style: solid;
            text-shadow: 0 0 10px #fff;
        }

        .ad-banner::before {
            content: "CLICK_ME";
            position: absolute;
            top: 5px;
            left: 5px;
            font-size: 0.6rem;
            color: #555;
        }

        @keyframes pulse-border {
            0% { border-color: #ff00ff; box-shadow: 0 0 5px #ff00ff; }
            50% { border-color: #00ffff; box-shadow: 0 0 20px #00ffff; }
            100% { border-color: #ff00ff; box-shadow: 0 0 5px #ff00ff; }
        }

        @keyframes modalOpen {
            from { transform: scale(0.9); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }

        .close-btn {
            position: absolute;
            top: 10px;
            right: 15px;
            background: #330000;
            color: red;
            border: 1px solid red;
            padding: 5px 10px;
            cursor: pointer;
            font-weight: bold;
        }
        
        .close-btn:hover {
            background: red;
            color: black;
        }

        .modal-image-box {
            width: 100%;
            height: 200px;
            background: #111;
            border: 1px dashed #555;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 20px;
            color: #444;
            font-size: 0.9rem;
        }
        
        .family-file {
            border: 1px solid #333;
            padding: 10px;
            margin-bottom: 10px;
            background: #050505;
        }
        
        .family-file h4 {
            margin: 0 0 5px 0;
            color: #00ff00;
        }

        /* Foundry Link */
        .foundry-link {
            display: block;
            text-align: center;
            margin: 40px 0;
            padding: 30px;
            border: 3px double var(--link-color);
            background: #001100;
            color: var(--link-color);
            text-decoration: none;
            font-weight: bold;
            font-size: 1.4rem;
            letter-spacing: 2px;
        }

        .foundry-link:hover {
            background: #002200;
            box-shadow: 0 0 20px var(--link-color);
            animation: shake 0.4s infinite;
        }

        /* Footer */
        footer {
            margin-top: 50px;
            text-align: center;
            font-size: 0.8rem;
            border-top: 2px groove #550055;
            padding-top: 20px;
            color: #666;
        }

        .construction-bar {
            width: 100%;
            height: 15px;
            background: repeating-linear-gradient(
                -45deg,
                #9900ff,
                #9900ff 10px,
                #000000 10px,
                #000000 20px
            );
            margin: 20px 0;
            border: 1px solid #fff;
        }

        /* Utilities */
        .blink { animation: blinker 1.5s step-end infinite; }
        .fast-blink { animation: blinker 0.2s step-end infinite; color: red; }
        
        .red-text { color: #ff3333; }
        .purple-text { color: #d500f9; font-weight: bold; }
        .green-text { color: #00e676; }
        
        /* Animations */
        @keyframes scroll-left {
            0% { transform: translateX(100%); }
            100% { transform: translateX(-100%); }
        }

        @keyframes blinker {
            50% { opacity: 0; }
        }

        @keyframes flicker {
            0% { opacity: 0.1; transform: translateX(5px); }
            30% { opacity: 1; transform: translateX(0); }
            60% { opacity: 0.4; }
            100% { opacity: 1; }
        }

        @keyframes shake {
            0% { transform: translate(1px, 1px) rotate(0deg); }
            20% { transform: translate(-3px, 0px) rotate(1deg); }
            40% { transform: translate(1px, -1px) rotate(1deg); }
            60% { transform: translate(-3px, 1px) rotate(0deg); }
            80% { transform: translate(-1px, -1px) rotate(1deg); }
            100% { transform: translate(1px, -2px) rotate(-1deg); }
        }

        /* Lore specific styling */
        .redaction {
            background: #000;
            color: #000;
            cursor: help;
        }
        .redaction:hover {
            color: #fff;
            background: #333;
        }

        @media (max-width: 600px) {
            h1 { font-size: 2rem; }
            .nav-btn { width: 100%; text-align: left; }
            .char-table td { display: block; width: 100%; }
        }

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10001; /* Higher than everything else */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', monospace;
    flex-direction: column;
}

.terminal-loader {
    width: 80%;
    max-width: 600px;
}

.terminal-header {
    color: #00ff00;
    margin-bottom: 20px;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 0 5px #00ff00;
}

.loading-text {
    color: #b8b8b8;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    border: 2px solid #9900ff;
    padding: 2px;
    box-shadow: 0 0 15px #440044;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #9900ff;
    transition: width 0.1s linear;
}

.percentage {
    text-align: right;
    margin-top: 10px;
    color: #9900ff;
    font-weight: bold;
    height: 1.5rem; /* Reserve space for glitch size */
    line-height: 1.5rem;
}

/* Red text for the 666 glitch */
.percentage.glitch-red {
    color: red;
    text-shadow: 2px 2px 0 #300, -2px -2px 0 #000;
    font-size: 1.2rem;
}

/* Utilities for overlay visibility */
.overlay-view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.overlay-view.active {
    display: block;
}

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

/* Audio Controls */
#audio-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Courier New', monospace;
    pointer-events: auto;
}

#track-info {
    color: #00ff00;
    font-size: 0.8rem;
    margin-bottom: 5px;
    text-shadow: 0 0 5px #00ff00;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 5px;
    border: 1px solid #005500;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mute-btn {
    background: black;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 #005500;
    transition: all 0.2s;
}

#mute-btn:hover {
    background: #002200;
    box-shadow: 1px 1px 0 #00ff00;
    transform: translate(1px, 1px);
}

/* Moth Overlay Styles (Deprecated container, kept for legacy if needed, but unused now) */
#moth-overlay {
    display: none;
}

#moth-svg {
    width: 85vw; /* Initial large size */
    max-width: 800px;
    height: auto;
    flex-shrink: 0;
    fill: #fff;
    color: #fff; /* For strokes */
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.3));
    transition: fill 0.2s;
    pointer-events: none; /* Important so it doesn't block loading screen text */
}

/* Flapping Animation */
.moth-flap .moth-wing {
    animation: flap-wings 0.15s infinite alternate ease-in-out;
}

@keyframes flap-wings {
    0% { transform: scaleX(1) rotate(0deg); }
    100% { transform: scaleX(0.7) rotate(5deg); } /* ScaleX simulates the wing folding/flapping in 2D */
}

/* Cursor State (Applied to the moth element when it becomes cursor) */
.moth-cursor-mode {
    position: fixed;
    width: 50px !important; /* Force small size */
    height: auto;
    margin-top: -15px !important; /* Slightly higher so tip touches click point */
    margin-left: -25px !important; /* Center horizontally */
    z-index: 12000;
    pointer-events: none; /* Let clicks pass through */
    transition: none; /* Instant tracking */
    filter: drop-shadow(0 0 5px rgba(153, 0, 255, 0.5));
}

.moth-purple .moth-body path,
.moth-purple .moth-wing path {
    fill: #9900ff !important;
    stroke: #9900ff !important;
    filter: drop-shadow(0 0 5px #9900ff);
    transition: fill 0.2s, stroke 0.2s;
}

/* Hide default cursor globally when moth takes over */
body.custom-cursor-active,
body.custom-cursor-active * {
    cursor: none !important;
}
