* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0a0a0a;
    color: #eee;
    height: 100vh;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    flex-direction: row; /* Horizontal por defecto */
}

.panel {
    width: 280px;
    background: #1a1a1a;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 20;
    flex-shrink: 0;
}

.actions-panel {
    border-right: none;
    border-left: 1px solid #333;
}

.viewport {
    flex: 1;
    background: #111;
    position: relative;
    min-height: 200px;
}

#canvas-container {
    width: 100%;
    height: 100%;
    outline: none;
}

/* MEDIA QUERY PARA MÓVILES */
@media (max-width: 900px) {
    body { overflow-y: auto; }
    
    .app-shell {
        flex-direction: column;
        height: auto;
    }

    .panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    .viewport {
        height: 60vh;
        flex: none;
    }

    .grid-palette {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

/* El resto de tus clases (grid-palette, swatch, btn, etc.) se mantienen igual */
.grid-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.swatch {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
}

.swatch.active { border-color: #fff; }

.btn {
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    width: 100%;
}

.btn-solve { background: #2b66d5; color: white; margin-top: 20px; height: 50px; }
.btn-reset { background: #333; color: #ccc; }

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #222;
    padding: 4px;
    border-radius: 6px;
    margin: 10px 0;
}

.mode-toggle button {
    background: transparent;
    border: none;
    color: #666;
    padding: 8px;
    cursor: pointer;
}

.mode-toggle button.active {
    background: #444;
    color: #f9d71c;
}