:root{--primary-color: #6366f1;--primary-hover: #4f46e5;--secondary-color: #8b5cf6;--background: #0f172a;--surface: #1e293b;--surface-light: #334155;--text-primary: #f1f5f9;--text-secondary: #cbd5e1;--border: #475569;--success: #10b981;--danger: #ef4444;--warning: #f59e0b}*{margin:0;padding:0;box-sizing:border-box}body{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:var(--background);color:var(--text-primary)}.app{min-height:100vh;display:flex;flex-direction:column}.app-header{background:linear-gradient(135deg,var(--primary-color),var(--secondary-color));padding:1.5rem 2rem;box-shadow:0 4px 6px #0000004d}.app-header h1{font-size:1.75rem;font-weight:700;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.2)}.app-content{display:flex;flex:1;gap:1.5rem;padding:1.5rem;overflow:hidden}.sidebar{background:var(--surface);border-radius:12px;padding:1.5rem;box-shadow:0 4px 6px #0003;display:flex;flex-direction:column;gap:1.5rem;width:280px;overflow-y:auto}.main-content{flex:1;display:flex;flex-direction:column;gap:1.5rem;overflow-y:auto}.controls{background:var(--surface);border-radius:12px;padding:1.5rem;box-shadow:0 4px 6px #0003;display:flex;gap:2rem;align-items:center;flex-wrap:wrap}.editor-container{background:var(--surface);border-radius:12px;padding:1.5rem;box-shadow:0 4px 6px #0003;display:flex;justify-content:center;align-items:center}.grid-size-selector{display:flex;align-items:center;gap:1rem}.grid-size-selector label{font-weight:600;color:var(--text-secondary)}.size-buttons{display:flex;gap:.5rem}.size-button{padding:.5rem 1rem;border:2px solid var(--border);background:var(--surface-light);color:var(--text-primary);border-radius:8px;cursor:pointer;font-weight:600;transition:all .2s}.size-button:hover{background:var(--primary-color);border-color:var(--primary-color);transform:translateY(-2px)}.size-button.active{background:var(--primary-color);border-color:var(--primary-color);box-shadow:0 0 0 3px #6366f133}.tool-palette h3{font-size:1.125rem;margin-bottom:1rem;color:var(--text-primary)}.tool-buttons{display:grid;grid-template-columns:repeat(2,1fr);gap:.75rem;margin-bottom:1.5rem}.tool-button{padding:1rem;border:2px solid var(--border);background:var(--surface-light);color:var(--text-primary);border-radius:8px;cursor:pointer;transition:all .2s;display:flex;flex-direction:column;align-items:center;gap:.5rem}.tool-button:hover{background:var(--primary-color);border-color:var(--primary-color);transform:translateY(-2px)}.tool-button.active{background:var(--primary-color);border-color:var(--primary-color);box-shadow:0 0 0 3px #6366f133}.tool-icon{font-size:1.5rem}.tool-label{font-size:.875rem;font-weight:600}.tool-options{display:flex;flex-direction:column;gap:1rem}.option-group{display:flex;flex-direction:column;gap:.5rem}.option-group label{font-size:.875rem;font-weight:600;color:var(--text-secondary)}.option-group input[type=color]{width:100%;height:40px;border:2px solid var(--border);border-radius:8px;cursor:pointer;background:var(--surface-light)}.option-group input[type=range]{width:100%}.option-group span{font-size:.875rem;color:var(--text-secondary)}.layer-panel h3{font-size:1.125rem;color:var(--text-primary)}.layer-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.add-layer-button{width:32px;height:32px;border:none;background:var(--primary-color);color:#fff;border-radius:6px;cursor:pointer;font-size:1.25rem;transition:all .2s}.add-layer-button:hover{background:var(--primary-hover);transform:scale(1.1)}.layer-list{display:flex;flex-direction:column;gap:.5rem}.layer-item{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:var(--surface-light);border:2px solid transparent;border-radius:8px;cursor:pointer;transition:all .2s}.layer-item:hover{background:var(--border)}.layer-item.active{border-color:var(--primary-color);background:#6366f11a}.visibility-button{background:none;border:none;cursor:pointer;font-size:1.25rem;padding:0;transition:transform .2s}.visibility-button:hover{transform:scale(1.2)}.layer-name{flex:1;font-size:.875rem;font-weight:500;color:var(--text-primary)}.layer-controls{display:flex;gap:.25rem}.move-button,.delete-button{background:none;border:none;cursor:pointer;font-size:.875rem;padding:.25rem;transition:transform .2s}.move-button:hover:not(:disabled),.delete-button:hover:not(:disabled){transform:scale(1.2)}.move-button:disabled{opacity:.3;cursor:not-allowed}.replication-toggle{display:flex;align-items:center}.toggle-label{display:flex;align-items:center;gap:1rem;font-weight:600;color:var(--text-secondary);cursor:pointer}.toggle-switch{position:relative;width:60px;height:30px}.toggle-switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:var(--border);transition:.3s;border-radius:30px}.slider:before{position:absolute;content:"";height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;transition:.3s;border-radius:50%}.toggle-switch input:checked+.slider{background-color:var(--success)}.toggle-switch input:checked+.slider:before{transform:translate(30px)}.toggle-status{font-weight:700;min-width:40px}.editor-controls{display:flex;gap:.5rem;margin-bottom:1rem}.undo-btn,.redo-btn{padding:.5rem 1rem;border:2px solid var(--border);background:var(--surface-light);color:var(--text-primary);border-radius:8px;cursor:pointer;font-weight:600;transition:all .2s}.undo-btn:hover:not(:disabled),.redo-btn:hover:not(:disabled){background:var(--primary-color);border-color:var(--primary-color);transform:translateY(-2px)}.undo-btn:disabled,.redo-btn:disabled{opacity:.3;cursor:not-allowed}.zoom-control{display:flex;align-items:center;gap:.75rem}.zoom-control label{font-weight:600;color:var(--text-secondary);font-size:.875rem}.zoom-control select{padding:.5rem;border:2px solid var(--border);background:var(--surface-light);color:var(--text-primary);border-radius:8px;cursor:pointer;font-weight:600;transition:all .2s}.zoom-control select:hover{border-color:var(--primary-color)}.zoom-control select:disabled{opacity:.5;cursor:not-allowed}.auto-fit-label{display:flex;align-items:center;gap:.5rem;font-weight:600;color:var(--text-secondary);cursor:pointer;font-size:.875rem}.auto-fit-label input[type=checkbox]{width:18px;height:18px;cursor:pointer}.editor-header,.preview-header{display:flex;gap:1.5rem;align-items:center;margin-bottom:1rem;flex-wrap:wrap}.main-content{flex:1;display:flex;gap:1.5rem;overflow:hidden;min-width:0;height:100%}.editor-section,.preview-section{background:var(--surface);border-radius:12px;padding:1rem;box-shadow:0 4px 6px #0003;display:flex;flex-direction:column;height:100%;overflow:hidden;max-width:100%;flex:1;min-width:0}.pattern-editor{position:relative;display:flex;flex-direction:column;flex:1;min-height:0;gap:1rem}.editor-controls{display:flex;gap:.5rem;flex-shrink:0}.canvas-scroll-area{flex:1;overflow:auto;display:flex;justify-content:center;align-items:center;background:var(--surface-light);border-radius:8px;border:1px solid var(--border);padding:2rem}.canvas-container{display:block;box-shadow:0 4px 12px #00000080}.pattern-editor canvas{border:none;border-radius:0;cursor:crosshair}.bezier-hint{position:absolute;top:-40px;left:50%;transform:translate(-50%);background:var(--primary-color);color:#fff;padding:.5rem 1rem;border-radius:6px;font-size:.875rem;font-weight:600;box-shadow:0 2px 8px #0000004d}.tiled-preview{background:var(--surface);border-radius:12px;padding:1.5rem;box-shadow:0 4px 6px #0003}.tiled-preview h3{font-size:1.25rem;margin-bottom:1rem;color:var(--text-primary)}.preview-container{display:flex;flex-direction:column;align-items:flex-start;gap:1rem;overflow:auto;max-height:800px}.preview-canvas-wrapper{display:inline-block}.preview-container canvas{border:3px solid var(--border);border-radius:8px;box-shadow:0 4px 12px #0000004d}.preview-hint{font-size:.875rem;color:var(--text-secondary);font-style:italic}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--surface)}::-webkit-scrollbar-thumb{background:var(--border);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--primary-color)}@media (max-width: 768px){.app-content{flex-direction:column}.sidebar{width:100%}}
