:root {
    --term-green: #0f0;
    --term-blue: #0bc;
    --term-pink: #ff0096;
    --monitor-bg: #222;
    --monitor-bezel: #111;
    --screen-bg: #050505;
}

body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    background-image: 
        linear-gradient(45deg, #1a1a1a 25%, transparent 25%, transparent 75%, #1a1a1a 75%, #1a1a1a),
        linear-gradient(45deg, #1a1a1a 25%, transparent 25%, transparent 75%, #1a1a1a 75%, #1a1a1a);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    perspective: 1000px; /* Enable 3D perspective */
}

.scene {
    width: 1000px;
    height: 750px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

.monitor {
    position: relative;
    width: 800px;
    height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-style: preserve-3d;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Monitor Case (The big box) */
.monitor-case {
    width: 100%;
    height: 100%;
    min-height: 600px; /* Fixed minimum height */
    max-height: 600px; /* Fixed maximum height */
    background: #2b2b2b;
    border-radius: 30px 30px 10px 10px;
    position: relative;
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.1),
        inset 2px 0 5px rgba(255,255,255,0.05),
        inset -2px 0 5px rgba(0,0,0,0.5),
        0 0 0 2px #1a1a1a, /* Outline */
        10px 10px 30px rgba(0,0,0,0.5); /* Drop shadow */
    padding: 30px;
    box-sizing: border-box;
    z-index: 2;
    transform: rotateX(2deg); /* Slight tilt up */
    background: linear-gradient(to bottom, #333, #222);
}

/* Back of the monitor (simulated depth) */
.monitor-case::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: -20px;
    background: #1a1a1a;
    z-index: -1;
    border-radius: 20px;
    transform: translateZ(-50px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

/* Monitor Bezel (The frame around the screen) */
.monitor-bezel {
    width: 100%;
    height: 100%;
    max-height: 540px; /* Fixed height for bezel */
    background: #000;
    border-radius: 4px; /* Inner corners sharp or slightly rounded */
    padding: 15px; /* Thickness of the black border around screen */
    box-sizing: border-box;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.1),
        inset -1px -1px 2px rgba(255,255,255,0.05);
    border-radius: 20px;
}

/* The Screen Glass */
.crt-screen {
    width: 100%;
    height: 100%;
    max-height: 510px; /* Fixed screen height */
    background-color: var(--screen-bg);
    position: relative;
    border-radius: 16px; /* Curvature of the tube */
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.8); /* Vignette inside screen */
    border: 1px solid #333;
}

/* Content Container with Scroll */
.crt-content {
    width: 100%;
    height: 100%;
    max-height: 510px; /* Match screen height */
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 20px;
    box-sizing: border-box;
    scrollbar-width: none;
    position: absolute; /* Changed to absolute */
    top: 0;
    left: 0;
    z-index: 2;
    word-wrap: break-word; /* Wrap long words */
}

.crt-content::-webkit-scrollbar {
    display: none;
}

#console {
    color: #eee;
    font-size: 16px;
    line-height: 1.5;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.4);
}

#snake-game {
    font-size: 11px;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
}

#snake-score, #snake-controls {
    margin-top: 8px;
    font-size: 13px;
}

/* Monitor Neck/Stand */
.monitor-neck {
    width: 180px;
    height: 70px;
    background: #222;
    margin-top: -10px; /* Hide connection */
    z-index: 1;
    position: relative;
    transform: translateZ(-20px);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    background: linear-gradient(to right, #1a1a1a, #333, #1a1a1a);
}

/* Monitor Base */
.monitor-base {
    width: 300px;
    height: 45px;
    background: #2b2b2b;
    border-radius: 4px 4px 10px 10px;
    transform: translateZ(-10px);
    box-shadow: 
        0 5px 10px rgba(0,0,0,0.5),
        inset 0 1px 2px rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
    background: linear-gradient(to bottom, #333, #222);
}

/* Screen Overlay Effects */
.scanlines {
    position: absolute;
    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.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
    animation: scroll 10s linear infinite;
}

.crt-screen::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: 10;
    pointer-events: none;
    animation: flicker 0.15s infinite;
    border-radius: 16px;
}

/* Glass Reflection */
.crt-screen::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 40%);
    z-index: 15;
    pointer-events: none;
    border-radius: 16px;
}

/* Text Colors */
a {
    color: var(--term-blue);
    text-decoration: none;
    text-shadow: 0 0 5px var(--term-blue);
}
a:hover {
    color: #fff;
    text-shadow: 0 0 8px #fff;
}
#a { color: var(--term-green); text-shadow: 0 0 5px var(--term-green); }
#c { color: var(--term-blue); text-shadow: 0 0 5px var(--term-blue); }
#b { color: var(--term-pink); text-shadow: 0 0 5px var(--term-pink); }
#k { animation: change 1s; font-weight: bold; }
#op { color: #888888; }

@keyframes change {
    0%  { color: var(--term-green); text-shadow: 0 0 10px var(--term-green); }
    99% { color: #eee; text-shadow: none; }
}

@keyframes flicker {
    0% { opacity: 0.02; }
    5% { opacity: 0.05; }
    10% { opacity: 0.01; }
    15% { opacity: 0.04; }
    20% { opacity: 0.02; }
    25% { opacity: 0.05; }
    30% { opacity: 0.01; }
    35% { opacity: 0.03; }
    40% { opacity: 0.02; }
    45% { opacity: 0.04; }
    50% { opacity: 0.03; }
    55% { opacity: 0.01; }
    60% { opacity: 0.04; }
    65% { opacity: 0.02; }
    70% { opacity: 0.03; }
    75% { opacity: 0.01; }
    80% { opacity: 0.04; }
    85% { opacity: 0.02; }
    90% { opacity: 0.03; }
    95% { opacity: 0.01; }
    100% { opacity: 0.04; }
}

@keyframes scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}
