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

body {
    background-color: #0f0f0f;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
}

#mobile-blocker {
    display: none;
    position: fixed;
    inset: 0;
    background: #121212;
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

@media (max-width: 768px) {
    #mobile-blocker { display: flex; }
    .app-container { display: none; }
}

.app-container { display: flex; width: 100%; height: 100%; }

.toolbar {
    width: 260px;
    background-color: #1a1a1a;
    border-right: 1px solid #333;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    flex-shrink: 0;
}

h2 { color: #00ffcc; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }

.control-group { display: flex; flex-direction: column; gap: 0.3rem; }
label { font-size: 0.65rem; color: #888; text-transform: uppercase; font-weight: bold; }

input, select { background: #2d2d2d; border: 1px solid #444; color: white; padding: 5px; border-radius: 4px; font-size: 0.8rem; }
input[type="color"] { width: 100%; height: 30px; cursor: pointer; border: none; padding: 0; }
input[type="range"] { cursor: pointer; }

.button-group { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }

button {
    background: #333;
    color: white;
    border: 1px solid #444;
    padding: 7px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.2s;
}

button:hover { background: #444; border-color: #666; }
button.active { background: #00ffcc; color: #121212; border-color: #00ffcc; font-weight: bold; }
button.primary { background: #00ffcc; color: #121212; font-weight: bold; padding: 10px; margin-top: 5px; }

hr { border: 0; border-top: 1px solid #333; margin: 5px 0; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; cursor: pointer; margin-top: 2px; }

/* Canvas Area */
.canvas-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: #121212;
}

#viewport { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

#canvas-container {
    position: relative;
    width: 600px;
    height: 600px;
    background-image: 
        linear-gradient(45deg, #1d1d1d 25%, transparent 25%), 
        linear-gradient(-45deg, #1d1d1d 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #1d1d1d 75%), 
        linear-gradient(-45deg, transparent 75%, #1d1d1d 75%);
    background-size: 20px 20px;
    background-color: #161616;
}

canvas { position: absolute; top: 0; left: 0; image-rendering: pixelated; }
#grid-canvas { z-index: 2; pointer-events: auto; cursor: crosshair; }
#pixel-canvas { z-index: 1; }

.instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #00ffcc;
    pointer-events: none;
    border: 1px solid #333;
}