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

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-rows: 60px 1fr;
    height: 100vh;
}

.header {
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #64ffda;
}

.domain {
    color: #888;
    font-size: 14px;
}

/* FIXED: Remove duplicate .main-content rules and use this one */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 20px;
    height: calc(100vh - 60px);
}

/* Remove these conflicting rules - they're causing the issue */
/* .editor-panel { order: 2; } */
/* .preview-panel { order: 1; } */

.editor-panel, .preview-panel {
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #444;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #363636;
    padding: 10px 15px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    color: #ccc;
}

.controls, .preview-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.button {
    background: #64ffda;
    color: #1a1a1a;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    font-size: 14px;
}

.button:hover {
    background: #4fd3b0;
}

.button.secondary {
    background: #444;
    color: #fff;
}

.button.secondary:hover {
    background: #555;
}

select {
    background: #444;
    color: white;
    border: 1px solid #555;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
}

.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#preview {
    flex: 1;
    background: #000;
    width: 100%;
    display: block;
}

.output-console {
    background: #1a1a1a;
    border-top: 1px solid #444;
    padding: 10px 15px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #ccc;
    max-height: 100px;
    overflow-y: auto;
}

.output-console .error {
    color: #ff6b6b;
}

.output-console .success {
    color: #64ffda;
}

.output-console .warning {
    color: #ffd93d;
}

.output-console .info {
    color: #64b5f6;
}

.webgpu-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 10px;
}

.webgpu-status.supported {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
}

.webgpu-status.unsupported {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

/* MOBILE LAYOUT - REPLACE ALL YOUR EXISTING MOBILE CSS WITH THIS */
@media (max-width: 768px) {
    .main-content {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    
    .editor-panel {
        flex: 1;
        min-height: 40vh;
        order: 1; /* Editor on top for mobile */
    }
    
    .preview-panel {
        flex: 1;
        min-height: 40vh;
        order: 2; /* Preview on bottom for mobile */
    }
    
    .header {
        padding: 0 10px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .domain {
        font-size: 11px;
    }
    
    .button, select {
        min-height: 36px;
    }
}

/* Desktop layout stays as grid */
@media (min-width: 769px) {
    .main-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    /* For desktop, you can keep preview on left if you want */
    .editor-panel { order: 2; }
    .preview-panel { order: 1; }
}