@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-color: #2a2a2a;
    color: #ffffff;
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    overflow-x: auto;
}

.header-bar {
    background: linear-gradient(to bottom, #4a4a4a, #2a2a2a);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #666;
}

.game-title {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 18px;
    color: #ffff00;
    text-shadow: 2px 2px 0px #aa8800;
    letter-spacing: 2px;
}

.mode-toggle {
    display: flex;
    gap: 5px;
}

.mode-btn {
    background: linear-gradient(to bottom, #666, #444);
    border: 2px outset #888;
    color: #fff;
    padding: 8px 16px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
}

.mode-btn:hover {
    background: linear-gradient(to bottom, #777, #555);
}

.mode-btn.active {
    background: linear-gradient(to bottom, #ffaa00, #cc8800);
    border: 2px inset #888;
    color: #000;
}

.level-info {
    display: flex;
    gap: 20px;
    font-weight: 700;
}

.main-container {
    display: flex;
    padding: 20px;
    gap: 20px;
    min-height: calc(100vh - 80px);
}

#gameCanvas {
    border: 3px solid #666;
    border-style: inset;
    background-color: #000;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.tile-palette {
    background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
    border: 2px inset #666;
    padding: 15px;
    width: 150px;
    height: fit-content;
}

.tile-palette h3 {
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    color: #ffff00;
}

.palette-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tile-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.1s;
}

.tile-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #888;
}

.tile-option.active {
    background-color: rgba(255, 170, 0, 0.3);
    border-color: #ffaa00;
}

.tile-option canvas {
    border: 1px solid #666;
    image-rendering: pixelated;
}

.tile-option span {
    font-size: 10px;
    font-weight: 700;
}

.control-panel {
    background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
    border: 2px inset #666;
    padding: 15px;
    width: 200px;
    height: fit-content;
}

.control-section h3 {
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    color: #ffff00;
}

.control-btn {
    background: linear-gradient(to bottom, #666, #444);
    border: 2px outset #888;
    color: #fff;
    padding: 8px 12px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 10px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 5px;
    transition: all 0.1s;
}

.control-btn:hover {
    background: linear-gradient(to bottom, #777, #555);
}

.control-btn:active {
    border: 2px inset #888;
}

.control-select {
    background: #333;
    border: 2px inset #666;
    color: #fff;
    padding: 5px;
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.brush-size {
    margin: 10px 0;
}

.brush-size label {
    display: block;
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 10px;
}

.game-stats {
    margin-top: 15px;
    font-size: 10px;
    font-weight: 700;
}

.game-stats div {
    margin-bottom: 5px;
    padding: 3px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid #666;
}

.level-browser {
    background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
    border: 2px inset #666;
    padding: 20px;
    margin: 20px;
}

.level-browser h3 {
    text-align: center;
    color: #ffff00;
    margin-bottom: 15px;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.import-export {
    border-top: 1px solid #666;
    padding-top: 15px;
}

.import-export textarea {
    width: 100%;
    height: 80px;
    background: #333;
    border: 2px inset #666;
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    padding: 5px;
    margin-bottom: 10px;
    resize: vertical;
}

.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tile-palette,
    .control-panel {
        width: 100%;
        max-width: 640px;
    }
    
    .palette-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .header-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 768px) {
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 640px;
    }
    
    .level-info {
        flex-direction: column;
        gap: 5px;
        align-items: center;
    }
    
    .game-title {
        font-size: 14px;
    }
}