:root {
    --neon: #00ffcc;
    --bg: #050505;
    --stripe-glow: rgba(0, 255, 204, 0.15); 
    --glass: rgba(0, 255, 204, 0.03);
    --border: rgba(0, 255, 204, 0.15);
    --font: 'Courier New', Courier, monospace;
    --glow-soft: rgba(0, 255, 204, 0.3);
    --glow-sharp: rgba(0, 255, 204, 0.6);
}

body, html { 
    margin: 0; padding: 0; background: var(--bg); color: var(--neon); 
    font-family: var(--font); overflow-x: hidden;
}

/* --- PHYSICAL CRT LAYERS --- */

#grid-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: 
        repeating-linear-gradient(90deg, 
            rgba(0, 255, 204, 0.05), 
            rgba(0, 255, 204, 0.05) 1px, 
            transparent 1px, 
            transparent 4px),
        repeating-linear-gradient(0deg, 
            transparent, 
            transparent 2px, 
            var(--neon) 2px, 
            var(--neon) 3px);
    background-size: 100% 100%, 100% 4px;
    mask-image: repeating-linear-gradient(
        90deg,
        black 0px,
        black 20px,
        transparent 20px,
        transparent 25px
    );
    opacity: 0.15;
    filter: blur(0.4px) contrast(1.2);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(
        circle at center, 
        transparent 40%, 
        rgba(0, 0, 0, 0.4) 70%, 
        rgba(0, 0, 0, 0.9) 100%
    );
    pointer-events: none;
    z-index: 1001;
}

#scanlines {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    ), 
    linear-gradient(
        90deg, 
        rgba(255, 0, 0, 0.03), 
        rgba(0, 255, 0, 0.01), 
        rgba(0, 0, 255, 0.03)
    );
    background-size: 100% 3px, 3px 100%;
}

@keyframes crtFlicker {
    0% { opacity: 0.96; }
    5% { opacity: 0.88; }
    10% { opacity: 0.96; }
    100% { opacity: 1; }
}

#master-container { 
    position: relative; 
    z-index: 2; 
    animation: crtFlicker 0.15s infinite;
    filter: url(#noiseDisplacement) brightness(1.1) contrast(1.1) sepia(0.2) drop-shadow(0 0 10px rgba(0, 255, 204, 0.15));
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* --- NAVIGATION --- */

#top-nav {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    background: rgba(5, 5, 5, 0.9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; z-index: 1000; box-sizing: border-box;
    box-shadow: inset 0 0 15px rgba(0, 255, 204, 0.05), 0 0 20px rgba(0, 255, 204, 0.05);
}

.logo { 
    font-weight: bold; letter-spacing: 5px; font-size: 1.1rem; color: #fff; cursor: pointer;
    text-shadow: 0 0 5px var(--glow-sharp), 0 0 15px var(--glow-soft);
}

.nav-links { display: flex; gap: 30px; }
.nav-link {
    text-decoration: none; color: var(--neon); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 2px; cursor: pointer; opacity: 0.6;
    transition: opacity 0.3s ease, text-shadow 0.3s ease;
}
.nav-link:hover, .nav-link.active { 
    opacity: 1; 
    text-shadow: 0 0 8px var(--neon), 0 0 15px var(--glow-soft); 
}

/* --- LAYOUT & CARDS --- */

section {
    min-height: 100vh; width: 100%; padding: 70px 0 0 0;
    box-sizing: border-box; display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
    position: relative;
}

.section-content { max-width: 800px; width: 90%; z-index: 10; }

.grid-container {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 20px; margin-top: 40px; justify-content: center; width: 100%;
}

.lab-card {
    background: var(--glass); border: 1px solid var(--border);
    padding: 25px; border-radius: 4px; cursor: pointer; text-align: left;
    box-shadow: inset 0 0 15px rgba(0, 255, 204, 0.05), 0 0 10px var(--glow-soft);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    backface-visibility: hidden;
}
.lab-card:hover { 
    border-color: var(--neon); 
    background: rgba(0, 255, 204, 0.08); 
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--neon), 0 0 40px var(--glow-soft);
}

h1 { font-size: 2.5rem; letter-spacing: -1px; color: #fff; margin: 0; text-shadow: 0 0 10px var(--glow-sharp), 0 0 25px var(--glow-soft); }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 4px; opacity: 0.6; text-shadow: 0 0 5px var(--glow-soft); }
p { line-height: 1.8; opacity: 0.7; margin: 20px auto; text-shadow: 0 0 5px rgba(0, 255, 204, 0.2); }

/* --- BUTTONS --- */

.btn-primary, .btn-outline, .btn-load, .btn-danger, .btn-stabilize {
    text-decoration: none; font-weight: bold; font-size: 0.8rem; 
    letter-spacing: 2px; cursor: pointer; font-family: var(--font);
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, filter 0.3s ease;
    backface-visibility: hidden;
    transform: translateZ(0);
    padding: 12px 30px;
}

.btn-primary { 
    background: var(--neon); color: #000; border: none;
    box-shadow: 0 0 15px var(--neon), 0 0 30px var(--glow-soft);
}
.btn-primary:hover { 
    filter: brightness(1.2); 
    box-shadow: 0 0 25px var(--neon), 0 0 50px var(--glow-soft); 
}

.btn-outline {
    background: transparent; border: 1px solid var(--neon); color: var(--neon);
    box-shadow: 0 0 10px var(--glow-soft);
}
.btn-outline:hover { 
    background: rgba(0, 255, 204, 0.1); 
    box-shadow: 0 0 20px var(--neon), 0 0 40px var(--glow-soft);
}

.btn-danger {
    background: rgba(255, 51, 51, 0.15) !important;
    border: 1px solid #ff3333 !important;
    color: #ff3333 !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.2);
    text-shadow: 0 0 5px rgba(255, 51, 51, 0.5) !important;
}
.btn-danger:hover {
    background: rgba(255, 51, 51, 0.4) !important;
    color: #fff !important;
    border-color: #ff6666 !important;
    box-shadow: 0 0 20px #ff3333, 0 0 40px rgba(255, 51, 51, 0.4) !important;
}

.btn-load {
    background: rgba(0, 255, 204, 0.2) !important;
    border: 1px solid var(--neon) !important;
    color: var(--neon) !important;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}
.btn-load:hover {
    background: rgba(0, 255, 204, 0.4) !important;
    color: #fff !important;
    box-shadow: 0 0 15px var(--neon), 0 0 30px var(--glow-soft) !important;
}

.btn-stabilize {
    background: rgba(255, 51, 255, 0.2) !important;
    border: 1px solid #ff33ff !important;
    color: #ff33ff !important;
    box-shadow: 0 0 10px rgba(255, 51, 255, 0.1);
}

.btn-stabilize:hover {
    background: rgba(255, 51, 255, 0.5) !important;
    color: #fff !important;
    border-color: #ff66ff !important;
    box-shadow: 0 0 20px #ff33ff, 0 0 40px rgba(255, 51, 255, 0.4) !important;
}

/* --- ELEMENTS --- */

.reticle-frame {
    position: absolute; width: 450px; height: 450px;
    pointer-events: none; z-index: 1; opacity: 0.3;
}
.bracket { position: absolute; width: 20px; height: 20px; border: 1px solid var(--neon); }
.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.br { bottom: 0; right: 0; border-left: none; border-top: none; }

textarea {
    width: 100%; height: 150px; background: #000; color: var(--neon); 
    border: 1px solid var(--border); padding: 15px; font-family: monospace;
    margin-top: 20px; outline: none; resize: none;
    box-shadow: inset 0 0 10px rgba(0, 255, 204, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
textarea:focus { border-color: var(--neon); box-shadow: 0 0 15px var(--glow-soft); }

#viewport { width: 100%; height: 100vh; border: none; display: none; position: fixed; inset: 0; z-index: 5; }