/* Root Variables */
:root {
    --phosphor-green: #00ff41;
    --phosphor-dim: #00cc33;
    --phosphor-dark: #008822;
    --amber: #ffb000;
    --amber-dim: #cc8800;
    --crt-black: #0a0a0a;
    --crt-dark: #0f0f0f;
    --error-red: #ff0040;
    --cyan-glow: #00ffff;
    --screen-tint: rgba(0, 255, 65, 0.05);
    --scanline-opacity: 0.15;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base */
body {
    font-family: 'IBM Plex Mono', 'Share Tech Mono', monospace;
    background: #000;
    color: var(--phosphor-green);
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    cursor: default;
}

/* CRT Container */
.crt-container {
    position: relative;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    max-height: 900px;
    background: var(--crt-dark);
    border-radius: 20px;
    box-shadow: 
        0 0 100px rgba(0, 255, 65, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* CRT Screen */
.crt-screen {
    position: relative;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    margin: 20px;
    background: var(--crt-black);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 
        inset 0 0 40px rgba(0, 0, 0, 0.9),
        inset 0 0 20px rgba(0, 255, 65, 0.1);
    animation: turnOn 0.5s ease-out;
}

/* CRT Effects */
.crt-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--screen-tint);
    pointer-events: none;
    z-index: 1;
}

/* Scanlines */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 0, 0, var(--scanline-opacity)) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 100;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Flicker */
.flicker {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 99;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.90626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.83891; }
    30% { opacity: 0.65583; }
    35% { opacity: 0.67807; }
    40% { opacity: 0.26559; }
    45% { opacity: 0.84693; }
    50% { opacity: 0.96019; }
    55% { opacity: 0.08594; }
    60% { opacity: 0.20313; }
    65% { opacity: 0.71988; }
    70% { opacity: 0.53455; }
    75% { opacity: 0.37288; }
    80% { opacity: 0.71428; }
    85% { opacity: 0.70419; }
    90% { opacity: 0.7003; }
    95% { opacity: 0.36108; }
    100% { opacity: 0.24387; }
}

/* Terminal Header */
.terminal-header {
    padding: 20px;
    border-bottom: 2px solid var(--phosphor-dark);
    background: linear-gradient(to bottom, rgba(0, 255, 65, 0.05), transparent);
    position: relative;
    z-index: 10;
}

.ascii-logo {
    color: var(--phosphor-green);
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    text-shadow: 
        0 0 10px var(--phosphor-green),
        0 0 20px var(--phosphor-dark);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    0% { text-shadow: 0 0 10px var(--phosphor-green), 0 0 20px var(--phosphor-dark); }
    100% { text-shadow: 0 0 15px var(--phosphor-green), 0 0 30px var(--phosphor-green); }
}

.system-info {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--phosphor-dim);
}

/* Terminal Window */
.terminal-window {
    padding: 20px;
    height: calc(100% - 200px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-dark) var(--crt-black);
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
    background: var(--crt-black);
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--phosphor-dark);
    border-radius: 4px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor-dim);
}

/* Terminal Links */
.terminal-link {
    color: var(--cyan-glow);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.terminal-link:hover {
    color: #ffffff;
    text-decoration-style: solid;
    text-shadow: 
        0 0 10px var(--cyan-glow),
        0 0 20px var(--cyan-glow);
    background: rgba(0, 255, 255, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.terminal-link:active {
    color: var(--phosphor-green);
    text-shadow: 0 0 5px var(--phosphor-green);
}

/* Terminal Input */
.terminal-input-line {
    font-size: 14px;
    display: inline-block;
    width: 100%;
}

.prompt {
    color: var(--phosphor-green);
    white-space: nowrap;
    display: inline;
}

.prompt .user {
    color: var(--cyan-glow);
}

.prompt .host {
    color: var(--amber);
}

.prompt .path {
    color: var(--phosphor-dim);
}

.terminal-input-display {
    color: var(--phosphor-green);
    font-family: inherit;
    font-size: inherit;
    display: inline;
}

.terminal-input-hidden {
    position: absolute;
    left: -9999px;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.cursor {
    color: var(--phosphor-green);
    animation: blink 1s infinite;
    display: inline;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Header Logo */
.header-logo {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 20;
    cursor: pointer;
}

.logo-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--phosphor-dark);
    box-shadow: 
        0 0 10px rgba(0, 255, 65, 0.3),
        inset 0 0 5px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.logo-image:hover {
    border-color: var(--phosphor-green);
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.6),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* Side Panels */
.side-panels {
    position: absolute;
    right: 20px;
    top: 60px;
    width: 250px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-dark) transparent;
}

.side-panels::-webkit-scrollbar {
    width: 6px;
}

.side-panels::-webkit-scrollbar-track {
    background: transparent;
}

.side-panels::-webkit-scrollbar-thumb {
    background: var(--phosphor-dark);
    border-radius: 3px;
}

.side-panels::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor-dim);
}

.panel {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--phosphor-dark);
    border-radius: 5px;
    overflow: hidden;
}

.panel-header {
    background: var(--phosphor-dark);
    color: var(--crt-black);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.panel-content {
    padding: 10px;
    font-size: 12px;
}

/* Status Items */
.status-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.status-item .label {
    width: 40px;
    color: var(--phosphor-dim);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--crt-dark);
    border: 1px solid var(--phosphor-dark);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--phosphor-green);
    transition: width 0.3s ease;
}

.cpu-usage {
    width: 42%;
}

.mem-usage {
    width: 68%;
}

.status-item .value {
    width: 60px;
    text-align: right;
}

/* Quick Links */
.quick-link {
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--phosphor-dim);
}

.quick-link:hover {
    background: var(--phosphor-dark);
    color: var(--phosphor-green);
    padding-left: 10px;
}

/* Activity Log */
.activity-monitor .panel-content {
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--phosphor-dark) transparent;
}

.activity-monitor .panel-content::-webkit-scrollbar {
    width: 6px;
}

.activity-monitor .panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.activity-monitor .panel-content::-webkit-scrollbar-thumb {
    background: var(--phosphor-dark);
    border-radius: 3px;
}

.activity-monitor .panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor-dim);
}

.log-entry {
    margin-bottom: 5px;
    color: var(--phosphor-dim);
    font-size: 11px;
    white-space: nowrap;
}

.timestamp {
    color: var(--amber-dim);
}

/* Vision Panel */
.vision-panel {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--phosphor-dark);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.1);
}

.vision-image-container {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 8px;
}

.vision-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: 
        sepia(100%) 
        hue-rotate(90deg) 
        saturate(0.8) 
        brightness(0.7) 
        contrast(1.2);
    transition: all 0.3s ease;
}

.vision-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(0, 255, 65, 0.1) 50%,
        transparent 70%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vision-image-container:hover .vision-overlay {
    opacity: 1;
}

.vision-image-container:hover .vision-image {
    filter: 
        sepia(100%) 
        hue-rotate(90deg) 
        saturate(1.2) 
        brightness(0.9) 
        contrast(1.4);
    transform: scale(1.05);
}

.vision-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--phosphor-green);
    text-shadow: 0 0 10px var(--phosphor-green);
    letter-spacing: 0.1em;
}

.vision-description {
    font-size: 9px;
    color: var(--phosphor-dim);
    text-align: center;
    line-height: 1.2;
}

/* Terminal Image Display */
.terminal-image-display {
    margin: 20px 0;
    padding: 15px;
    border: 2px solid var(--phosphor-dark);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.15),
        inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.terminal-image-display .image-header {
    color: var(--phosphor-green);
    font-size: 12px;
    text-align: center;
    margin-bottom: 15px;
    font-family: monospace;
}

.terminal-image-display .image-content {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.terminal-image {
    width: 200px;
    height: 120px;
    object-fit: contain;
    border: 1px solid var(--phosphor-dark);
    border-radius: 4px;
    filter: 
        sepia(100%) 
        hue-rotate(90deg) 
        saturate(0.9) 
        brightness(0.8) 
        contrast(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    transition: all 0.3s ease;
}

.terminal-image:hover {
    filter: 
        sepia(100%) 
        hue-rotate(90deg) 
        saturate(1.1) 
        brightness(0.9) 
        contrast(1.3);
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.4);
    transform: scale(1.02);
}

.terminal-image-display .image-info {
    flex: 1;
    color: var(--phosphor-green);
}

.terminal-image-display .image-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--phosphor-green);
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
}

.terminal-image-display .image-description {
    font-size: 14px;
    line-height: 1.4;
    color: var(--phosphor-dim);
}

/* Responsive terminal image */
@media (max-width: 768px) {
    .terminal-image-display .image-content {
        flex-direction: column;
        text-align: center;
    }
    
    .terminal-image {
        width: 100%;
        max-width: 300px;
        height: auto;
        align-self: center;
    }
}

/* Vision Overlay Large */
.vision-overlay-large {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.vision-overlay-large.active {
    opacity: 1;
    transform: scale(1);
}

.vision-modal {
    background: var(--crt-black);
    border: 2px solid var(--phosphor-green);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    box-shadow: 
        0 0 50px rgba(0, 255, 65, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    animation: modalGlow 2s ease-in-out infinite alternate;
}

@keyframes modalGlow {
    0% { box-shadow: 0 0 50px rgba(0, 255, 65, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.8); }
    100% { box-shadow: 0 0 60px rgba(0, 255, 65, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.8); }
}

.vision-modal-header {
    background: var(--phosphor-dark);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--phosphor-green);
}

.vision-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: var(--crt-black);
    letter-spacing: 0.1em;
}

.close-vision {
    background: transparent;
    border: none;
    color: var(--crt-black);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}

.close-vision:hover {
    color: var(--error-red);
    transform: scale(1.2);
}

.vision-modal-content {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.vision-image-large {
    display: flex;
    justify-content: center;
    align-items: center;
}

.enlarged-image {
    width: 100%;
    max-width: 350px;
    height: auto;
    border: 2px solid var(--phosphor-dark);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    transition: all 0.3s ease;
    animation: imageEnlarge 0.5s ease-out;
}

@keyframes imageEnlarge {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.enlarged-image:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.5);
}

.vision-details {
    color: var(--phosphor-green);
}

.vision-details h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--phosphor-green);
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.vision-details p {
    font-size: 14px;
    margin-bottom: 20px;
    color: var(--phosphor-dim);
    line-height: 1.6;
}

.vision-points {
    margin-bottom: 20px;
}

.vision-point {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--phosphor-green);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInPoint 0.5s ease-out forwards;
}

.vision-point:nth-child(1) { animation-delay: 0.1s; }
.vision-point:nth-child(2) { animation-delay: 0.2s; }
.vision-point:nth-child(3) { animation-delay: 0.3s; }
.vision-point:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInPoint {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.vision-description-large {
    font-size: 12px;
    line-height: 1.6;
    color: var(--phosphor-dim);
    background: rgba(0, 255, 65, 0.05);
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid var(--phosphor-dark);
}

/* Responsive Vision Modal */
@media (max-width: 768px) {
    .vision-modal {
        width: 95vw;
        margin: 10px;
    }
    
    .vision-modal-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .vision-title {
        font-size: 10px;
    }
    
    .vision-details h3 {
        font-size: 12px;
    }
}

/* Colors */
.green-text {
    color: var(--phosphor-green);
}

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

.error-text {
    color: var(--error-red);
}

.cyan-text {
    color: var(--cyan-glow);
}

/* Boot Sequence */
.boot-sequence {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--crt-black);
    z-index: 1000;
    padding: 20px;
    font-size: 14px;
    overflow: hidden;
    display: none;
}

.boot-sequence.active {
    display: block;
}

.boot-line {
    margin-bottom: 5px;
    opacity: 0;
    animation: bootFadeIn 0.1s forwards;
}

@keyframes bootFadeIn {
    to { opacity: 1; }
}

/* Matrix Rain */
.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0.3;
    display: none;
}

.matrix-rain.active {
    display: block;
}

/* Hidden Images */
.hidden-images {
    display: none;
}

/* CRT Frame */
.crt-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.frame-corner {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid #333;
}

.frame-corner.top-left {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 10px;
}

.frame-corner.top-right {
    top: 10px;
    right: 10px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 10px;
}

.frame-corner.bottom-left {
    bottom: 10px;
    left: 10px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 10px;
}

.frame-corner.bottom-right {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 10px;
}

/* Power Button */
.power-button {
    position: absolute;
    bottom: 15px;
    right: 50%;
    transform: translateX(50%);
    width: 30px;
    height: 30px;
    background: #222;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
}

.power-led {
    width: 10px;
    height: 10px;
    background: var(--phosphor-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--phosphor-green);
    animation: ledPulse 2s infinite;
}

@keyframes ledPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Turn On Animation */
@keyframes turnOn {
    0% {
        transform: scale(1, 0.01) translateY(0);
        filter: brightness(30);
    }
    35% {
        transform: scale(1, 0.01) translateY(0);
        filter: brightness(30);
    }
    70% {
        transform: scale(1.05, 1) translateY(0);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(1, 1) translateY(0);
        filter: brightness(1);
    }
}

/* Typing Effect */
.typing {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 0.5s steps(40, end);
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* Glitch Effect */
.glitch {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0%, 100% {
        text-shadow: 
            -2px 0 var(--error-red),
            2px 0 var(--cyan-glow);
    }
    25% {
        text-shadow: 
            2px 0 var(--error-red),
            -2px 0 var(--cyan-glow);
    }
    50% {
        text-shadow: 
            -2px 0 var(--cyan-glow),
            2px 0 var(--error-red);
    }
}

/* Responsive */
@media (max-width: 1400px) {
    .side-panels {
        width: 220px;
        gap: 10px;
        top: 55px;
        max-height: calc(100vh - 90px);
    }
    
    .vision-image-container {
        height: 80px;
    }
    
    .activity-monitor .panel-content {
        max-height: 80px;
    }
}

@media (max-width: 1200px) {
    .side-panels {
        display: none;
    }
    
    .terminal-window {
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    .ascii-logo {
        font-size: 6px;
    }
    
    .terminal-output,
    .terminal-input-line {
        font-size: 12px;
    }
    
    .crt-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .crt-screen {
        margin: 10px;
        width: calc(100% - 20px);
        height: calc(100% - 20px);
    }
    
    .header-logo {
        top: 10px;
        left: 10px;
    }
    
    .logo-image {
        width: 40px;
        height: 40px;
    }
    
    .terminal-header {
        padding: 15px;
    }
}

@media (max-height: 800px) {
    .side-panels {
        top: 50px;
        max-height: calc(100vh - 80px);
        gap: 8px;
    }
    
    .vision-image-container {
        height: 60px;
    }
    
    .activity-monitor .panel-content {
        max-height: 60px;
    }
    
    .panel-content {
        padding: 6px;
        font-size: 11px;
    }
}

@media (max-height: 700px) {
    .side-panels {
        top: 45px;
        max-height: calc(100vh - 70px);
        gap: 6px;
    }
    
    .vision-image-container {
        height: 50px;
    }
    
    .activity-monitor .panel-content {
        max-height: 50px;
    }
    
    .panel-content {
        padding: 5px;
        font-size: 10px;
    }
}