:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --accent-color: #4af626; /* Classic phosphor green */
    --dim-color: #555;
    --font-stack: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-stack);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT Effects */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.2)
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    animation: scroll 10s linear infinite;
}

#flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    opacity: 0;
    z-index: 200;
    pointer-events: none;
    transition: opacity 0.2s ease-in;
}

.flash-active {
    opacity: 1 !important;
}

@keyframes scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

/* Flicker effect */
body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 90;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.02; }
    50% { opacity: 0.05; }
    100% { opacity: 0.02; }
}

/* Layout */
#loading-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 800px;
}

/* 3D Scene */
#scene-3d {
    width: 100%;
    max-width: 600px;
    height: 300px;
    perspective: 1000px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

#terminal-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate-sway 10s ease-in-out infinite alternate;
}

.code-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 0, 0.3);
    border: 1px solid var(--accent-color);
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(74, 246, 38, 0.2);
    /* 3D Transform */
    transform: rotateX(10deg) rotateY(-10deg) translateZ(0);
    backface-visibility: hidden;
}

/* Blinking Cursor for Code */
.code-layer::after {
    content: '▋';
    display: inline-block;
    color: var(--accent-color);
    animation: blink-cursor 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 5px;
}

/* Pseudo-elements for depth/stacking effect */
.code-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(5,5,5,0.8) 90%);
    pointer-events: none;
    z-index: 2;
}

@keyframes rotate-sway {
    0% { transform: rotateY(-15deg) rotateX(10deg); }
    100% { transform: rotateY(15deg) rotateX(-5deg); }
}

/* Syntax Highlighting Classes for generated code */
.code-keyword { color: #ff79c6; font-weight: bold; } /* Pink */
.code-function { color: #8be9fd; } /* Cyan */
.code-string { color: #f1fa8c; } /* Yellow */
.code-comment { color: #6272a4; font-style: italic; } /* Gray-ish */
.code-operator { color: #ffb86c; } /* Orange */

/* Removed old ASCII styles */
/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 500px;
    height: 24px;
    border: 2px solid var(--dim-color);
    margin: 15px 0;
    padding: 3px;
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--text-color);
    box-shadow: 0 0 8px var(--text-color);
    transition: width 0.1s linear;
    animation: bar-pulse 2s infinite;
}

@keyframes bar-pulse {
    0% { background-color: var(--text-color); box-shadow: 0 0 8px var(--text-color); }
    50% { background-color: #fff; box-shadow: 0 0 15px #fff, 0 0 5px var(--accent-color); }
    100% { background-color: var(--text-color); box-shadow: 0 0 8px var(--text-color); }
}

.loading-text {
    font-size: 1.1rem;
    margin-top: 10px;
    color: var(--text-color);
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

#loading-percentage {
    color: var(--accent-color);
    font-weight: bold;
}

/* System Log */
#system-log {
    width: 100%;
    max-width: 600px;
    height: 120px;
    overflow: hidden;
    font-size: 0.85rem;
    color: var(--dim-color);
    margin-bottom: 20px;
    border-top: 1px dashed #333;
    border-bottom: 1px dashed #333;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    font-family: 'Courier New', Courier, monospace;
    opacity: 0.8;
    background: rgba(0,0,0,0.3);
}

#system-log::after {
    content: "▋";
    display: inline-block;
    vertical-align: bottom;
    animation: blink-cursor 1s step-end infinite;
    margin-left: 5px;
    color: var(--accent-color);
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.log-entry {
    margin: 2px 0;
}

.log-prefix { color: var(--dim-color); margin-right: 8px; }
.log-msg { color: #bbb; }
.log-success { color: var(--accent-color); }
.log-warn { color: #ffb000; }
.log-error { color: #ff3333; }

/* Responsive */
@media (max-width: 600px) {
    #ascii-container {
        font-size: 8px;
        line-height: 8px; /* Match font-size for seamless blocks */
        min-height: 150px;
    }
    .loading-text {
        font-size: 0.9rem;
    }
}
