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

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    font-family: 'Orbitron', monospace;
    color: #ffffff;
    min-height: 100vh;
}

.console-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 400px 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    grid-template-areas: 
        "console dev-tools"
        "status status";
}

.console-frame {
    grid-area: console;
    background: linear-gradient(145deg, #f4f1e8, #e0ddd4);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.1),
        0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

.power-led {
    position: absolute;
    top: 15px;
    right: 25px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.power-led.on {
    background: #00ff41;
    box-shadow: 
        inset 0 1px 3px rgba(0,0,0,0.3),
        0 0 15px #00ff41;
}

.main-display-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

#mainDisplay {
    width: 100%;
    height: auto;
    max-width: 340px;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    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: 8px;
}

.console-controls {
    display: flex;
    gap: 20px;
}

.control-section {
    flex: 1;
}

.control-section h3 {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #666;
    letter-spacing: 1px;
}

.dev-tools {
    grid-area: dev-tools;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-panel {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.tool-panel h3 {
    margin: 0 0 15px 0;
    color: #ffb000;
    font-size: 14px;
    letter-spacing: 1px;
}

.prompt-section {
    margin-bottom: 20px;
}

#gamePrompt {
    width: 100%;
    height: 80px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 10px;
}

#gamePrompt::placeholder {
    color: #888;
}

.code-preview {
    margin-top: 15px;
}

.code-preview h4 {
    margin: 0 0 10px 0;
    color: #00ff41;
    font-size: 12px;
}

#codePreview {
    width: 100%;
    height: 200px;
    background: rgba(0,0,0,0.8);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    color: #00ff41;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    margin-bottom: 10px;
}

.sprite-tools {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 15px;
    grid-template-areas:
        "palette editor"
        "info info";
}

.color-palette {
    grid-area: palette;
    display: grid;
    grid-template-columns: repeat(4, 24px);
    gap: 4px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: #ffb000;
    box-shadow: 0 0 8px rgba(255,176,0,0.5);
}

#spriteEditor {
    grid-area: editor;
    background: #222;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: crosshair;
    image-rendering: pixelated;
}

.sprite-info {
    grid-area: info;
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #888;
}

.game-list {
    max-height: 200px;
    overflow-y: auto;
}

.game-item {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-name {
    font-weight: bold;
    color: #fff;
}

.game-date {
    font-size: 11px;
    color: #888;
}

.load-btn {
    background: #0088ff;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    font-family: 'Orbitron', monospace;
}

.load-btn:hover {
    background: #0066cc;
}

.no-games {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

.status-bar {
    grid-area: status;
    background: rgba(0,0,0,0.8);
    border-radius: 8px;
    padding: 10px 20px;
    display: flex;
    justify-content: space-around;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #00ff41;
    border: 1px solid rgba(0,255,65,0.3);
}

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

.retro-btn {
    background: linear-gradient(145deg, #4a4a4a, #2a2a2a);
    border: 2px solid #666;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 8px;
    margin-bottom: 8px;
}

.retro-btn:hover {
    background: linear-gradient(145deg, #5a5a5a, #3a3a3a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.retro-btn:active {
    transform: translateY(0);
}

.retro-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.play-btn {
    background: linear-gradient(145deg, #00aa44, #006622);
    border-color: #00cc55;
}

.play-btn:hover {
    background: linear-gradient(145deg, #00cc55, #008833);
}

.stop-btn {
    background: linear-gradient(145deg, #aa4400, #662200);
    border-color: #cc5500;
}

.stop-btn:hover {
    background: linear-gradient(145deg, #cc5500, #883300);
}

.reset-btn {
    background: linear-gradient(145deg, #aa0044, #660022);
    border-color: #cc0055;
}

.reset-btn:hover {
    background: linear-gradient(145deg, #cc0055, #880033);
}

.generate-btn {
    background: linear-gradient(145deg, #ffaa00, #cc8800);
    border-color: #ffbb00;
    color: #000;
}

.generate-btn:hover {
    background: linear-gradient(145deg, #ffcc00, #dd9900);
}

.export-btn {
    background: linear-gradient(145deg, #0088ff, #0066cc);
    border-color: #0099ff;
}

.export-btn:hover {
    background: linear-gradient(145deg, #0099ff, #0077dd);
}

.sound-btn.off {
    background: linear-gradient(145deg, #666, #444);
    border-color: #777;
}

.loading-text {
    color: #ffb000;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
}

.dots {
    animation: blink 1.5s infinite;
}

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

@media (max-width: 768px) {
    .console-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "console"
            "dev-tools"
            "status";
    }
    
    body {
        padding: 10px;
    }
    
    .console-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .sprite-tools {
        grid-template-columns: 1fr;
        grid-template-areas:
            "palette"
            "editor"
            "info";
    }
    
    #spriteEditor {
        width: 100%;
    }
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,176,0,0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,176,0,0.7);
}