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

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

body {
    background: #0a0a0a;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: auto;
}

.console-container {
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
    position: relative;
}

/* Scanline effect */
.console-container::before {
    content: '';
    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;
    z-index: 1000;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #222222;
    border-bottom: 2px solid #444444;
    position: relative;
    z-index: 1001;
}

.title-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.title-section h1 {
    font-size: 18px;
    font-weight: 700;
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.status-indicators {
    display: flex;
    gap: 16px;
}

.indicator {
    background: #333333;
    padding: 4px 8px;
    border: 1px solid #555555;
    font-size: 10px;
    color: #cccccc;
}

.view-controls {
    display: flex;
    gap: 8px;
}

/* View containers */
.view-container {
    display: none;
    min-height: calc(100vh - 140px);
}

.view-container.active {
    display: block;
}

/* Game View Layout */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    align-items: center;
}

.canvas-section {
    background: #222222;
    border: 2px solid #444444;
    border-radius: 0;
}

.canvas-header {
    background: #333333;
    padding: 8px 12px;
    border-bottom: 1px solid #555555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #00ff00;
}

.game-controls {
    display: flex;
    gap: 8px;
}

.canvas-container {
    position: relative;
    padding: 16px;
    display: flex;
    justify-content: center;
}

#main-canvas {
    width: 512px;
    height: 512px;
    image-rendering: pixelated;
    border: 2px solid #666666;
    background: #000000;
}

.grid-overlay {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 512px;
    height: 512px;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 16px 16px;
    pointer-events: none;
    display: none;
}

.prompt-section {
    background: #222222;
    border: 2px solid #444444;
    width: 100%;
    max-width: 600px;
}

.section-header {
    background: #333333;
    padding: 8px 12px;
    border-bottom: 1px solid #555555;
    font-size: 11px;
    font-weight: 700;
    color: #00ff00;
    text-align: center;
}

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

#ai-prompt {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #555555;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    resize: vertical;
    min-height: 120px;
    outline: none;
}

.generate-btn {
    font-size: 14px !important;
    padding: 12px 24px !important;
    background: #00aa00 !important;
    border-color: #00ff00 !important;
    color: #000000 !important;
    align-self: center;
}

.generate-btn:hover {
    background: #00dd00 !important;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.5) !important;
}

/* Developer View Layout */
.dev-layout {
    display: flex;
    gap: 16px;
    padding: 16px;
    height: calc(100vh - 140px);
}

.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #222222;
    border: 2px solid #444444;
}

.section-header {
    background: #333333;
    padding: 8px 12px;
    border-bottom: 1px solid #555555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #00ff00;
}

#code-editor {
    flex: 1;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    resize: none;
    outline: none;
}

.ai-prompt-section {
    padding: 8px;
    background: #2a2a2a;
    border-top: 1px solid #555555;
    display: flex;
    gap: 8px;
}

#ai-prompt-dev {
    flex: 1;
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #555555;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.palette-section, .sprite-section, .tilemap-section, .sound-section {
    background: #222222;
    border: 2px solid #444444;
    border-radius: 0;
}

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

.color-swatch {
    width: 32px;
    height: 32px;
    border: 2px solid #666666;
    cursor: pointer;
    image-rendering: pixelated;
}

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

.current-color {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2a2a2a;
    border-top: 1px solid #555555;
    font-size: 10px;
    color: #cccccc;
}

.color-preview {
    width: 24px;
    height: 24px;
    border: 2px solid #666666;
    image-rendering: pixelated;
}

.sprite-debugger-container {
    display: flex;
    gap: 12px;
    padding: 12px;
}

#sprite-debugger {
    width: 128px;
    height: 128px;
    image-rendering: pixelated;
    border: 2px solid #666666;
    background: #000000;
    cursor: pointer;
}

#sprite-preview {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    border: 2px solid #666666;
    background: #000000;
}

.sprite-controls, .tilemap-controls, .sound-controls {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #2a2a2a;
    border-top: 1px solid #555555;
    align-items: center;
}

.debug-info {
    font-size: 9px;
    color: #888888;
    font-style: italic;
}

#tilemap-viewer {
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
    border: 2px solid #666666;
    background: #000000;
    margin: 12px;
}

.sound-controls {
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.control-row label {
    width: 40px;
    color: #cccccc;
}

.control-row input[type="range"] {
    flex: 1;
    height: 16px;
}

.control-row select {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #555555;
    padding: 2px 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.control-row input[type="checkbox"] {
    margin-right: 8px;
}

/* Settings View Layout */
.settings-layout {
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: #222222;
    border: 2px solid #444444;
    margin-bottom: 24px;
}

.settings-content {
    padding: 16px;
}

.settings-content label {
    display: block;
    margin-bottom: 8px;
    color: #cccccc;
    font-size: 11px;
}

#prompt-template {
    width: 100%;
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #555555;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    resize: vertical;
    margin-bottom: 12px;
}

.project-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.pixel-btn {
    background: #333333;
    color: #ffffff;
    border: 2px solid #555555;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
}

.pixel-btn:hover {
    background: #444444;
    border-color: #777777;
}

.pixel-btn.active {
    background: #00aa00;
    border-color: #00ff00;
    color: #000000;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.console-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    background: #222222;
    border-top: 2px solid #444444;
    position: relative;
    z-index: 1001;
}

.credits {
    font-size: 10px;
    color: #666666;
}

.credits a {
    color: #00ff00;
    text-decoration: none;
}

.credits a:hover {
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

/* Responsive design */
@media (max-width: 1200px) {
    .dev-layout {
        flex-direction: column;
    }
    
    .right-panel {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 16px;
    }
    
    #main-canvas {
        width: 384px;
        height: 384px;
    }
    
    .grid-overlay {
        width: 384px;
        height: 384px;
        background-size: 12px 12px;
    }
}

@media (max-width: 768px) {
    .console-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .title-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .status-indicators {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .game-layout {
        padding: 12px;
    }
    
    #main-canvas {
        width: 256px;
        height: 256px;
    }
    
    .grid-overlay {
        width: 256px;
        height: 256px;
        background-size: 8px 8px;
    }
    
    .right-panel {
        grid-template-columns: 1fr;
    }
    
    .sprite-debugger-container {
        flex-direction: column;
        align-items: center;
    }
    
    .project-controls {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #222222;
}

::-webkit-scrollbar-thumb {
    background: #555555;
    border: 1px solid #333333;
}

::-webkit-scrollbar-thumb:hover {
    background: #666666;
}