.custom-pattern-editor{width:min(1260px,calc(100vw - 32px));max-height:94dvh;padding:22px;background:#171815}
.editor-workspace{grid-template-columns:minmax(0,1fr) 240px;gap:20px}.editor-stage-column{min-width:0}
.editor-canvas-toolbar{display:flex;align-items:center;justify-content:space-between;color:#d2c19d;font-size:12px;margin-bottom:8px;gap:8px}.editor-canvas-toolbar>div{display:flex;align-items:center;gap:5px}.editor-canvas-toolbar button{width:38px;height:36px;border:1px solid #786b5155;border-radius:4px;color:#ead6b1;background:#23251f;font-size:20px}.editor-canvas-toolbar output{font-size:11px;min-width:40px;text-align:center}.editor-canvas-toolbar button:disabled{opacity:.35}
.custom-pattern-canvas{background:#f6f3eb;border:1px solid #a18d6555}.custom-pattern-canvas svg{aspect-ratio:900/420}
#editor-element-list{display:flex;gap:6px;overflow-x:auto;padding:9px 0;scrollbar-width:thin;min-height:44px}#editor-element-list button{flex-shrink:0;padding:6px 10px;background:#22241f;border:1px solid #776b4e66;color:#bdb9a9;border-radius:4px;font-size:11px}#editor-element-list button[aria-pressed=true]{color:#f0d7a6;border-color:#d4ad68;background:#3c3424}
.catalog-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}.catalog-heading h3{font:500 20px/1.4 var(--sans);color:#e8d9bd}.catalog-heading>span{font-size:9px;letter-spacing:1.3px;color:#b8a47f}.ornament-catalog{padding-top:16px;border-top:1px solid #b99c6540}
.catalog-search-label>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}#catalog-search{width:100%;height:44px;padding:10px 13px;background:#10110e;color:#e9e2d4;border:1px solid #87755366;border-radius:5px;font:400 14px var(--sans)}#catalog-search:focus{outline:2px solid #b79860;outline-offset:2px}
#catalog-categories{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 9px}#catalog-categories button{border:1px solid #7b71574d;border-radius:30px;padding:9px 12px;color:#c1beaf;background:#20221c;font:400 11px/1.3 var(--sans)}#catalog-categories button[aria-pressed=true]{background:#d3b277;border-color:#d3b277;color:#191a15}
#catalog-count{font-size:11px;color:#9d9788;margin:8px 0 12px}.catalog-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;max-height:350px;overflow:auto;overscroll-behavior:contain;padding:0 5px 5px 0;scrollbar-color:#9b8153 #24261f;scrollbar-width:thin}.catalog-card{display:flex;flex-direction:column;text-align:left;min-width:0;border:1px solid #8f795747;background:#24261f;border-radius:7px;padding:7px;color:#e3d5ba;transition:border-color .16s}.catalog-card:hover,.catalog-card:focus-visible{border-color:#d6b575;outline:none}.catalog-card:disabled{opacity:.4;cursor:not-allowed}.catalog-photo{width:100%;aspect-ratio:1.125;position:relative;background:#fff;border-radius:4px;overflow:hidden}.catalog-photo img{display:block;object-fit:contain;width:100%;height:100%}.catalog-add{position:absolute;right:5px;bottom:5px;border-radius:50%;height:26px;width:26px;display:grid;place-items:center;color:#fff;background:#443e30;font:400 20px/1 Arial}.catalog-card strong{font:600 14px var(--sans);margin:8px 2px 4px}.catalog-kind{font-size:10px;margin:0 2px 6px;color:#bdb8a8;line-height:1.4}.catalog-card small{font-size:10px;color:#a19780;margin:auto 2px 3px;line-height:1.4}.catalog-empty{grid-column:1/-1;font-size:13px;color:#c9bea6;padding:20px 0}
#catalog-more{width:100%;min-height:42px;border:1px solid #8e78524d;border-radius:4px;margin-top:10px;background:#282920;color:#dcc49b;font-size:12px}#catalog-more[hidden]{display:none}.catalog-credit{font-size:10px;color:#939080;margin-top:12px;line-height:1.6}.catalog-credit a{color:#cbb385;text-underline-offset:3px}
.editor-properties{position:sticky;top:0}#selected-element-name{font-size:12px;line-height:1.5}#selected-part-details img{display:block;width:100%;height:115px;object-fit:contain;background:#fff;border-radius:4px;margin:10px 0}#selected-part-details p{font-size:11px;color:#bfb6a1;margin:6px 0}#selected-part-details a{font-size:11px;color:#cdb584;text-underline-offset:3px}#element-controls button{min-height:42px}#element-controls input[type=range]{min-height:32px}.editor-footer{margin-top:15px}.custom-pattern-editor>p:last-of-type{font-size:10px;color:#a69c87}.custom-pattern-editor .editor-help{margin-bottom:12px}
@media(max-width:1000px){.catalog-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.editor-workspace{grid-template-columns:minmax(0,1fr) 210px}}
@media(max-width:820px){.catalog-grid{grid-template-columns:repeat(3,minmax(0,1fr));max-height:none;overflow:visible}.catalog-heading h3{font-size:17px}.catalog-heading>span{font-size:8px}.catalog-card{padding:5px}.catalog-card strong{font-size:12px}.catalog-card small,.catalog-kind{font-size:9px}#catalog-categories{flex-wrap:nowrap;overflow-x:auto;padding-bottom:5px}#catalog-categories button{white-space:nowrap;min-height:44px}.editor-canvas-toolbar button{min-height:44px;width:44px}.editor-canvas-toolbar{font-size:11px;margin-bottom:4px}#editor-element-list button{min-height:40px}.editor-properties{position:static}#catalog-search{font-size:16px}.catalog-credit{font-size:10px}}
@media(min-width:1100px){
  #ornament-editor[open]{display:flex;flex-direction:column;height:min(880px,94dvh);overflow:hidden;padding:20px}
  #ornament-editor>.pattern-dialog-heading{flex:none;margin-bottom:12px}#ornament-editor>.editor-help{flex:none;margin-bottom:13px;font-size:12px}
  #ornament-editor .editor-workspace{flex:1;min-height:0;display:grid;grid-template-columns:285px minmax(0,1fr) 220px;grid-template-rows:44px minmax(0,1fr) 44px;gap:0 16px;align-items:stretch}
  #ornament-editor .editor-stage-column{display:contents}
  #ornament-editor .editor-canvas-toolbar{grid-column:2;grid-row:1;margin:0}
  #ornament-editor #custom-pattern-canvas{grid-column:2;grid-row:2;display:grid;place-items:center;min-height:0}
  #ornament-editor #custom-pattern-canvas svg{width:100%;height:100%;max-height:100%}
  #ornament-editor #editor-element-list{grid-column:2;grid-row:3;margin:0;padding:6px 0;min-width:0}
  #ornament-editor #editor-empty{display:none}
  #ornament-editor #ornament-catalog-panel{grid-column:1;grid-row:1/4;min-height:0;display:flex;flex-direction:column;border:0;padding:0}
  #ornament-editor .catalog-heading{display:block;margin-bottom:10px}.catalog-heading h3{font-size:18px}#ornament-editor .catalog-heading>span{display:block;margin-top:4px}
  #ornament-editor #catalog-search{height:40px;font-size:12px}#ornament-editor #catalog-categories{max-height:104px;overflow:auto;flex-shrink:0;gap:5px;margin:9px 0 0}#ornament-editor #catalog-categories button{padding:7px 9px;font-size:10px}
  #ornament-editor #catalog-count{margin:8px 0;font-size:10px}#ornament-editor #catalog-grid{grid-template-columns:repeat(2,minmax(0,1fr));flex:1;min-height:0;max-height:none;gap:8px;align-content:start;overflow:auto}
  #ornament-editor .catalog-card strong{font-size:12px}#ornament-editor #catalog-more{min-height:34px;margin-top:8px}#ornament-editor .catalog-credit{font-size:9px;margin:8px 0 0}
  #ornament-editor .editor-properties{grid-column:3;grid-row:1/4;position:static;min-height:0;overflow:auto;padding:13px}#ornament-editor .editor-properties h3{font-size:18px}#ornament-editor #selected-part-details img{height:90px}
  #ornament-editor .editor-footer{flex:none;margin-top:14px;padding-top:12px}#ornament-editor>p:not(.editor-help){font-size:10px;margin:10px 0 0}
}
@media print{.custom-pattern-editor{display:none!important}}

/* Edge alignment uses the rotated part bounds; the position sliders stay free. */
#ornament-editor .element-alignment{grid-column:1/-1;margin:14px 0 4px}
#ornament-editor .element-alignment>p{font-size:12px;line-height:1.5;margin:0 0 8px;color:#cdb584}
#ornament-editor #element-alignment{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
#ornament-editor #element-alignment button{min-height:44px;padding:6px 3px;margin:0;font-size:11px;line-height:1.3;white-space:normal}
#ornament-editor .element-alignment .alignment-help{font-size:11px;line-height:1.5;color:#a69c87;margin:9px 0 0}
