@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(180deg, #001100 0%, #000000 100%);
    border-bottom: 2px solid #00ff00;
}

.title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff0080;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    color: #00aa00;
    text-shadow: 0 0 5px #00aa00;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    min-height: 0;
}

.left-panel, .right-panel {
    width: 250px;
    background: #001100;
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 15px;
    overflow-y: auto;
}

.center-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.monitor-frame {
    background: #111;
    border: 20px solid #333;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 0, 0.1),
        0 0 30px rgba(0, 255, 0, 0.2);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.monitor-green {
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 0, 0.2),
        0 0 30px rgba(0, 255, 0, 0.3);
}

.monitor-amber {
    box-shadow: 
        inset 0 0 20px rgba(255, 191, 0, 0.2),
        0 0 30px rgba(255, 191, 0, 0.3);
}

.monitor-white {
    box-shadow: 
        inset 0 0 20px rgba(255, 255, 255, 0.1),
        0 0 30px rgba(255, 255, 255, 0.2);
}

#canvas {
    border: 1px solid #00ff00;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background: #000;
    max-width: 100%;
    max-height: 100%;
}

.scanlines {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.03) 2px,
        rgba(0, 255, 0, 0.03) 4px
    );
    pointer-events: none;
    border-radius: 2px;
}

.control-section {
    margin-bottom: 25px;
    border: 1px solid #004400;
    border-radius: 3px;
    padding: 15px;
    background: #000800;
}

.control-section h3 {
    color: #00ff00;
    font-size: 1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #004400;
    padding-bottom: 5px;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border: 2px solid #444;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

.color-swatch:hover {
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.color-swatch.active {
    border-color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

.tool-buttons, .pattern-buttons, .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn, .pattern-btn, .action-buttons button {
    padding: 8px 12px;
    background: #002200;
    border: 1px solid #004400;
    color: #00aa00;
    cursor: pointer;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tool-btn:hover, .pattern-btn:hover, .action-buttons button:hover {
    background: #004400;
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.tool-btn.active {
    background: #00ff00;
    color: #000;
    border-color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.display-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.display-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #00aa00;
    font-size: 0.9rem;
}

.display-controls select {
    background: #002200;
    border: 1px solid #004400;
    color: #00aa00;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.display-controls input[type="checkbox"] {
    accent-color: #00ff00;
}

.memory-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-line {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #00aa00;
    background: #000500;
    padding: 6px 8px;
    border: 1px solid #002200;
    border-radius: 2px;
}

.bottom-toolbar {
    background: #001100;
    border-top: 1px solid #004400;
    padding: 10px 20px;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #00aa00;
}

.status-bar span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer {
    text-align: center;
    padding: 15px;
    background: #000;
    border-top: 1px solid #004400;
    color: #006600;
    font-size: 0.8rem;
}

.footer a {
    color: #00aa00;
    text-decoration: none;
}

.footer a:hover {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .left-panel, .right-panel {
        width: 100%;
        display: flex;
        gap: 15px;
        overflow-x: auto;
    }
    
    .control-section {
        min-width: 200px;
        flex-shrink: 0;
    }
    
    .title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .left-panel, .right-panel {
        flex-direction: column;
    }
    
    .control-section {
        min-width: auto;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .monitor-frame {
        border-width: 10px;
        padding: 10px;
    }
}

/* Fullscreen mode */
:fullscreen .container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

:fullscreen .main-content {
    flex-direction: row;
    width: 100%;
    height: 100vh;
}

:fullscreen .center-panel {
    flex: 1;
}

/* Animation effects */
@keyframes phosphor-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

.monitor-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 255, 0, 0.05) 70%);
    pointer-events: none;
    animation: phosphor-glow 2s ease-in-out infinite;
    border-radius: inherit;
}

/* CRT curvature effect */
.monitor-frame {
    transform: perspective(1000px) rotateX(1deg);
}

#canvas {
    border-radius: 2px;
}

/* Retro button styling */
.tool-btn, .pattern-btn, .action-buttons button {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.tool-btn::before, .pattern-btn::before, .action-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.2), transparent);
    transition: left 0.5s;
}

.tool-btn:hover::before, .pattern-btn:hover::before, .action-buttons button:hover::before {
    left: 100%;
}