/* Texture editor-only stylesheet. */
/* === tools/texture.blade.php === */
:where(body.view-tools-texture) *,:where(body.view-tools-texture) *::before,:where(body.view-tools-texture) *::after{box-sizing:border-box;margin:0;padding:0;}
body.view-tools-texture{
  --bg:#1a1815;--panel:#222018;--border:#706a5f;--input:#2c2920;--input-border:#827b6e;
  --text:#dedad0;--muted:#aaa294;--dim:#9c9486;--accent:#c8b460;--pro:#c89040;--r:5px;--sw:300px;
}
body.view-tools-texture{background:var(--bg);color:var(--text);font-family:'Segoe UI',system-ui,sans-serif;font-size:13px;display:flex;flex-direction:column;height:100vh;overflow:hidden;}

/* TOP BAR */
body.view-tools-texture .app-bar{height:40px;background:rgba(15,14,12,.95);border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 14px;gap:16px;flex-shrink:0;z-index:30;}
body.view-tools-texture .app-bar-logo{font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent);text-decoration:none;}
body.view-tools-texture .app-bar-back{font-size:12px;color:var(--muted);text-decoration:none;display:flex;align-items:center;gap:4px;}
body.view-tools-texture .app-bar-back:hover{color:var(--text);}
body.view-tools-texture .app-bar-title{font-size:12px;font-weight:600;color:var(--text);}
body.view-tools-texture .app-bar-right{margin-left:auto;display:flex;gap:8px;}
body.view-tools-texture .app-bar-btn{padding:4px 10px;border-radius:4px;border:1px solid var(--border);background:var(--input);color:var(--text);font-size:12px;cursor:pointer;transition:border-color .15s,color .15s;text-decoration:none;display:inline-flex;align-items:center;}
body.view-tools-texture .app-bar-btn:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .app-bar-btn.primary{background:var(--accent);color:#1a1815;border-color:var(--accent);}
body.view-tools-texture .app-bar-btn.primary:hover{opacity:.88;}

/* EDITOR BODY */
body.view-tools-texture .editor-body{display:flex;flex:1;overflow:hidden;}

/* SIDEBAR */
body.view-tools-texture #sb{width:var(--sw);background:var(--panel);border-right:1px solid var(--border);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;}
body.view-tools-texture #sb::-webkit-scrollbar{width:4px;}
body.view-tools-texture #sb::-webkit-scrollbar-thumb{background:var(--border);}

body.view-tools-texture .editor-mode-tabs{position:sticky;top:0;z-index:12;display:grid;grid-template-columns:repeat(3,1fr);gap:5px;padding:7px 5px;background:var(--panel);border-bottom:1px solid var(--border);}
body.view-tools-texture .editor-mode-tab{height:34px;border:1px solid var(--input-border);border-radius:var(--r);background:var(--input);color:var(--muted);font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;cursor:pointer;}
body.view-tools-texture .editor-mode-tab:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .editor-mode-tab.on{background:var(--accent);border-color:var(--accent);color:#1a1815;}
body.view-tools-texture .editor-mode-tab:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
body.view-tools-texture .surface-map-tabs{position:sticky;top:49px;z-index:11;display:grid;grid-template-columns:repeat(2,1fr);gap:5px;padding:7px 5px;background:var(--panel);border-bottom:1px solid var(--border);}
body.view-tools-texture .surface-map-tabs[hidden]{display:none;}
body.view-tools-texture .surface-map-tab{min-height:31px;padding:4px 6px;border:1px solid var(--input-border);border-radius:var(--r);background:var(--input);color:var(--muted);font-size:12px;font-weight:700;cursor:pointer;}
body.view-tools-texture .surface-map-tab:last-child:nth-child(odd){grid-column:1/-1;}
body.view-tools-texture .surface-map-tab:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .surface-map-tab.on{border-color:var(--accent);color:var(--accent);background:rgba(200,180,96,.08);}
body.view-tools-texture .surface-map-tab:focus-visible{outline:2px solid var(--accent);outline-offset:1px;}

body.view-tools-texture .sb-inner{display:flex;flex-direction:column;flex:1;padding:0 5px;}

body.view-tools-texture .control-section{border-bottom:1px solid var(--border);}
body.view-tools-texture .sec-head{display:flex;align-items:center;justify-content:space-between;width:100%;padding:9px 14px;cursor:pointer;border:0;background:transparent;color:inherit;text-align:left;user-select:none;}
body.view-tools-texture .sec-head:hover{background:rgba(200,180,96,.06);}
body.view-tools-texture .sec-head:focus-visible{outline:1px solid var(--accent);outline-offset:-2px;}
body.view-tools-texture .sec-name{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--accent);}
body.view-tools-texture .sec-toggle{font-size:12px;color:var(--muted);transition:transform .15s ease;}
body.view-tools-texture .control-section.collapsed .sec-toggle{transform:rotate(-90deg);}
body.view-tools-texture .sec-body{padding:10px 14px 8px;}
body.view-tools-texture .sec-body.hidden{display:none;}

body.view-tools-texture .field-lbl{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:4px;margin-top:6px;}
body.view-tools-texture .material-appearance-controls{border-top:1px solid var(--border);padding-top:10px;margin-top:2px;}
body.view-tools-texture .material-slot-toolbar{display:flex;align-items:center;gap:5px;margin-bottom:9px;}
body.view-tools-texture .material-slot-list{display:flex;gap:5px;min-width:0;flex:1;}
body.view-tools-texture .material-slot-button{min-width:34px;height:30px;padding:0 8px;border:1px solid var(--input-border);border-radius:var(--r);background:var(--input);color:var(--muted);font-size:12px;font-weight:800;cursor:pointer;}
body.view-tools-texture .material-slot-button:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .material-slot-button.on{background:var(--accent);border-color:var(--accent);color:#1a1815;}
body.view-tools-texture .material-placement{margin:10px 0 2px;padding-top:9px;border-top:1px solid var(--border);}
body.view-tools-texture .material-assignment-fields{display:grid;gap:7px;margin-top:8px;}
body.view-tools-texture .material-assignment-fields[hidden]{display:none;}
body.view-tools-texture .material-style-row{display:grid;grid-template-columns:72px 1fr;gap:6px;align-items:center;}
body.view-tools-texture .material-style-row span{font-size:12px;color:var(--muted);}
body.view-tools-texture .material-manual-help{font-size:12px;line-height:1.45;color:var(--muted);}
body.view-tools-texture #cv.manual-material-paint{cursor:copy;}
body.view-tools-texture #material-manual-status{min-height:16px;color:var(--accent);}
body.view-tools-texture .sel-row{display:flex;gap:6px;align-items:center;margin-bottom:8px;}
body.view-tools-texture .sel-btn{flex:1;min-width:0;height:36px;min-height:36px!important;display:flex;align-items:center;justify-content:space-between;gap:6px;overflow:hidden;padding:4px 9px;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);cursor:pointer;font-size:14px;font-weight:500;color:var(--text);transition:border-color .15s;}
body.view-tools-texture .sel-btn:hover{border-color:var(--accent);}
body.view-tools-texture .sel-btn>span:first-child{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;}
body.view-tools-texture .sel-thumb{width:20px;height:20px;border-radius:50%;overflow:hidden;flex-shrink:0;background:var(--input-border);}
body.view-tools-texture .sel-thumb canvas{width:100%;height:100%;display:block;}
body.view-tools-texture .sel-thumb.selected-pattern-thumb{width:26px;height:26px;border:1px solid var(--accent);background:#f0eeea;}
body.view-tools-texture .sel-thumb.selected-material-thumb{width:26px;height:26px;border:1px solid var(--accent);}
body.view-tools-texture .icon-btn{width:36px;height:36px;min-height:36px!important;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);cursor:pointer;display:grid;place-items:center;font-size:12px;flex-shrink:0;color:var(--muted);transition:border-color .15s,color .15s;}
body.view-tools-texture .icon-btn:hover{border-color:var(--accent);color:var(--accent);}

body.view-tools-texture .g2{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:8px;}
body.view-tools-texture .g3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:8px;}
body.view-tools-texture .field-group{display:flex;flex-direction:column;gap:2px;}
body.view-tools-texture .field-group label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);}
body.view-tools-texture .field-group input,body.view-tools-texture .field-group select{background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);padding:5px 7px;font-size:12px;color:var(--text);outline:none;width:100%;}
body.view-tools-texture .field-group input:focus,body.view-tools-texture .field-group select:focus{border-color:var(--accent);}
body.view-tools-texture .field-group select option{background:var(--panel);}
body.view-tools-texture .mm-label{position:relative;}
body.view-tools-texture .mm-label input{padding-right:22px;}
body.view-tools-texture .mm-unit{position:absolute;right:8px;bottom:18px;transform:translateY(50%);font-size:12px;color:var(--muted);pointer-events:none;}

body.view-tools-texture .dim-row{font-size:12px;color:var(--muted);letter-spacing:.04em;margin-top:-4px;margin-bottom:2px;}

body.view-tools-texture .adj-row{display:flex;align-items:center;gap:6px;margin-bottom:8px;}
body.view-tools-texture .adj-field{flex:1;height:36px;min-height:36px!important;display:flex;align-items:center;justify-content:space-between;padding:4px 9px;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);cursor:pointer;font-size:14px;color:var(--muted);}
body.view-tools-texture .adj-field:hover{border-color:var(--accent);}

body.view-tools-texture .tint-row{display:flex;align-items:center;gap:6px;margin-bottom:4px;}
body.view-tools-texture .tint-field{flex:1;height:36px;min-height:36px!important;display:flex;align-items:center;gap:7px;padding:4px 9px;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);}
body.view-tools-texture .tint-swatch{width:16px;height:16px;border-radius:3px;border:1px solid var(--border);cursor:pointer;flex-shrink:0;}
body.view-tools-texture .tint-val{font-size:14px;font-family:monospace;color:var(--text);}
body.view-tools-texture .native-colour-picker{opacity:0;position:fixed;width:1px;height:1px;pointer-events:none;left:12px;top:52px;}

body.view-tools-texture .edge-row{display:flex;gap:6px;margin-bottom:8px;align-items:flex-end;}
body.view-tools-texture .edge-main{flex:1;}
body.view-tools-texture .edge-btns{display:flex;gap:4px;}

body.view-tools-texture .slider-row{margin-bottom:6px;}
body.view-tools-texture .slider-row label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;}
body.view-tools-texture .slider-row label button,body.view-tools-texture .adj-slider label button{border:0;background:transparent;color:var(--muted);font-size:12px;cursor:pointer;text-transform:none;letter-spacing:0;}
body.view-tools-texture .slider-row label button:hover,body.view-tools-texture .adj-slider label button:hover{color:var(--accent);}
body.view-tools-texture .jtype-wrap{display:flex;flex-wrap:wrap;gap:5px;padding:4px 14px 10px;}
body.view-tools-texture .jtype-btn{width:24px;height:24px;border-radius:50%;border:2px solid transparent;cursor:pointer;padding:0;transition:border-color .12s,transform .1s;}
body.view-tools-texture .jtype-btn:hover{transform:scale(1.15);}
body.view-tools-texture .jtype-btn.on{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent);}
body.view-tools-texture .check-row{display:flex;align-items:center;gap:7px;margin:7px 0;font-size:12px;color:var(--text);cursor:pointer;}
body.view-tools-texture .check-row input{accent-color:var(--accent);}
body.view-tools-texture .lock-grid{display:grid;grid-template-columns:1fr 36px 1fr;gap:6px;align-items:end;margin-bottom:8px;}
body.view-tools-texture .map-shortcuts{display:grid;grid-template-columns:1fr 1fr;gap:6px;}
body.view-tools-texture .map-shortcut{padding:7px 6px;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);color:var(--muted);font-size:12px;cursor:pointer;text-align:left;}
body.view-tools-texture .map-shortcut:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .save-btn{width:100%;padding:10px;background:var(--accent);color:#1a1815;border:none;border-radius:var(--r);font-size:12px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;cursor:pointer;transition:opacity .15s;}
body.view-tools-texture .save-btn:hover{opacity:.85;}
body.view-tools-texture .sb-footer{padding:6px 14px 10px;font-size:12px;color:var(--dim);text-align:center;}
body.view-tools-texture .hatch-guidance{padding:10px;border:1px solid var(--border);border-radius:var(--r);background:rgba(15,14,12,.3);color:var(--muted);font-size:12px;line-height:1.55;}
body.view-tools-texture .hatch-guidance strong{color:var(--text);}
body.view-tools-texture .hatch-compatibility{margin-top:8px;color:var(--muted);font-size:12px;line-height:1.5;}
body.view-tools-texture .hatch-compatibility.ok{color:#9fd0a9;}

/* CANVAS AREA */
body.view-tools-texture #main{flex:1;position:relative;overflow:hidden;background:var(--bg);}
body.view-tools-texture #cv{position:absolute;top:0;left:0;cursor:crosshair;display:block;}

body.view-tools-texture .topbar{position:absolute;top:0;left:0;right:0;padding:8px 14px;display:flex;align-items:center;gap:8px;background:rgba(26,24,21,.92);backdrop-filter:blur(10px);border-bottom:1px solid var(--border);z-index:10;}
body.view-tools-texture .topbar-lbl{font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);}
body.view-tools-texture .topbar-login{color:var(--accent);font-size:12px;font-weight:700;text-decoration:none;white-space:nowrap;}
body.view-tools-texture .topbar-login:hover{text-decoration:underline;}
body.view-tools-texture .top-btn{height:36px;min-height:36px!important;padding:4px 10px;border-radius:var(--r);border:1px solid var(--input-border);background:var(--input);color:var(--text);font-size:12px;cursor:pointer;transition:border-color .15s,color .15s;display:inline-flex;align-items:center;justify-content:center;}
body.view-tools-texture #texture-save-trigger,body.view-tools-texture #texture-download-trigger{width:80px;flex:0 0 80px;}
body.view-tools-texture .top-btn:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .top-btn:disabled{cursor:not-allowed;opacity:.72;}
body.view-tools-texture .top-btn[aria-busy="true"]:disabled{cursor:progress;}
body.view-tools-texture .top-btn.on{background:var(--accent);color:#1a1815;border-color:var(--accent);}
body.view-tools-texture .top-btn.save-success{background:#17231b;border-color:rgba(118,185,135,.72);color:#bde3c6;}
body.view-tools-texture .top-btn.save-success:hover{border-color:#76b987;color:#d5f0dc;}
body.view-tools-texture .top-btn.primary{background:var(--accent);color:#1a1815;border-color:var(--accent);font-weight:700;}
body.view-tools-texture .top-btn.primary:hover{color:#1a1815;opacity:.86;}
body.view-tools-texture .top-btn.primary.save-success{background:#17231b;border-color:rgba(118,185,135,.72);color:#bde3c6;}
body.view-tools-texture .top-btn.primary.save-success:hover{border-color:#76b987;color:#d5f0dc;opacity:1;}
body.view-tools-texture .settings-top-btn{font-size:17px;line-height:1;padding:4px 9px;}
body.view-tools-texture .topbar-separator{color:var(--border);font-size:15px;line-height:1;user-select:none;}
body.view-tools-texture .topbar-format{height:36px!important;min-height:36px!important;max-width:190px;padding:3px 26px 3px 8px;border:1px solid var(--input-border);border-radius:var(--r);background:var(--input);color:var(--text);font:inherit;font-size:12px;cursor:pointer;}
body.view-tools-texture .topbar-format:focus{border-color:var(--accent);outline:none;}
body.view-tools-texture .topbar-format option{background:var(--panel);}

/* OVERLAYS */
body.view-tools-texture .overlay{position:fixed;top:50px;right:0;bottom:0;width:calc(100% - var(--sw));background:var(--panel);z-index:30;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .22s ease;}
body.view-tools-texture .overlay.open{transform:translateX(0);}
body.view-tools-texture .ov-head{padding:14px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px;flex-shrink:0;}
body.view-tools-texture .ov-title{font-size:15px;font-weight:600;flex:1;color:var(--text);}
body.view-tools-texture .ov-cat{padding:5px 10px;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);font-size:12px;color:var(--text);outline:none;cursor:pointer;}
body.view-tools-texture .ov-cat option{background:var(--panel);}
body.view-tools-texture .ov-search{background-color:var(--input);border:1px solid var(--input-border);border-radius:var(--r);font-size:12px;color:var(--text);outline:none;width:150px;}
body.view-tools-texture .ov-search-wrap{position:relative;}
body.view-tools-texture .ov-close{width:26px;height:26px;background:none;border:1px solid var(--input-border);border-radius:50%;cursor:pointer;font-size:14px;display:grid;place-items:center;color:var(--muted);}
body.view-tools-texture .ov-close:hover{background:var(--input);color:var(--text);}
body.view-tools-texture .ov-body{flex:1;overflow-y:auto;padding:14px 18px;}
body.view-tools-texture .ov-body::-webkit-scrollbar{width:4px;}
body.view-tools-texture .ov-body::-webkit-scrollbar-thumb{background:var(--input-border);border-radius:2px;}
body.view-tools-texture .cat-head{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--accent);margin:14px 0 8px;display:flex;align-items:center;gap:6px;cursor:pointer;}
body.view-tools-texture .cat-head::before{content:'▼';font-size:12px;}
body.view-tools-texture .cat-head.shut::before{content:'▶';}
body.view-tools-texture .thumb-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:14px 10px;margin-bottom:6px;}
body.view-tools-texture .thumb-grid[hidden]{display:none!important;}
body.view-tools-texture .thumb-item{display:flex;flex-direction:column;align-items:center;gap:5px;padding:4px;border-radius:8px;cursor:pointer;}
body.view-tools-texture .thumb-item,body.view-tools-texture .mat-opt,body.view-tools-texture .cat-head{width:100%;border:0;background:transparent;color:inherit;font:inherit;}
body.view-tools-texture .thumb-circle{position:relative;width:100%;aspect-ratio:1;border-radius:50%;overflow:hidden;border:2px solid transparent;transition:border-color .15s,box-shadow .15s;background:var(--input);}
body.view-tools-texture .thumb-circle canvas,body.view-tools-texture .thumb-circle img{width:100%;height:100%;display:block;object-fit:contain;}
body.view-tools-texture .thumb-circle.missing{display:grid;place-items:center;padding:10px;border-color:var(--input-border);}
body.view-tools-texture .thumb-circle.missing::before{content:'Preview unavailable';font-size:12px;line-height:1.15;color:var(--muted);text-align:center;}
body.view-tools-texture .thumb-circle:hover{border-color:var(--muted);}
body.view-tools-texture .thumb-circle.on{border-color:var(--accent);border-width:4px;box-shadow:0 0 0 2px #15130f,0 0 0 4px var(--accent);}
body.view-tools-texture .thumb-circle.on::after,body.view-tools-texture .mat-opt-circle.on::after{content:'✓';position:absolute;top:7px;right:7px;z-index:2;width:24px;height:24px;border:2px solid #f4f1e9;border-radius:50%;display:grid;place-items:center;background:var(--accent);box-shadow:0 2px 7px rgba(0,0,0,.65);color:#15130f;font-size:15px;font-weight:900;line-height:1;}
body.view-tools-texture .thumb-item[aria-pressed="true"] .thumb-label,body.view-tools-texture .mat-opt[aria-pressed="true"] .mat-opt-lbl{color:var(--accent);font-weight:700;}
body.view-tools-texture .thumb-label{font-size:12px;color:var(--muted);text-align:center;line-height:1.2;}
body.view-tools-texture .mat-special{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:14px 10px;margin-bottom:14px;padding-bottom:14px;border-bottom:1px solid var(--border);}
body.view-tools-texture .mat-opt{display:flex;flex-direction:column;align-items:center;gap:5px;cursor:pointer;}
body.view-tools-texture .mat-opt-circle{position:relative;width:100%;aspect-ratio:1;border-radius:50%;background:var(--input);border:1.5px solid var(--input-border);display:grid;place-items:center;font-size:20px;color:var(--muted);transition:border-color .15s,box-shadow .15s;}
body.view-tools-texture .mat-opt-circle:hover{border-color:var(--muted);}
body.view-tools-texture .mat-opt-circle.on{border:4px solid var(--accent);box-shadow:0 0 0 2px #15130f,0 0 0 4px var(--accent);}
body.view-tools-texture .mat-opt-lbl{font-size:12px;color:var(--muted);text-align:center;}
body.view-tools-texture .mat-cat-head{min-height:28px;cursor:default;flex-wrap:wrap;gap:7px;}
body.view-tools-texture .mat-cat-head::before{display:none;}
body.view-tools-texture .mat-cat-toggle{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:0;border:0;background:transparent;color:var(--accent);font-family:inherit;font-size:12px;font-weight:700;line-height:1.2;letter-spacing:.1em;text-transform:uppercase;cursor:pointer;}
body.view-tools-texture .mat-cat-toggle::before{content:'▼';font-size:12px;}
body.view-tools-texture .mat-cat-head.shut .mat-cat-toggle::before{content:'▶';}
body.view-tools-texture .mat-cat-count{color:var(--muted);font-weight:600;}
body.view-tools-texture .mat-cat-actions{display:inline-flex;align-items:center;gap:5px;min-height:24px;}
body.view-tools-texture .mat-cat-load{min-height:24px;padding:2px 7px;border:1px solid var(--input-border);border-radius:4px;background:var(--input);color:var(--muted);font-family:inherit;font-size:12px;font-weight:600;line-height:1.2;letter-spacing:0;text-transform:none;cursor:pointer;}
body.view-tools-texture .mat-cat-load:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .mat-cat-load:disabled{cursor:wait;opacity:.5;}
body.view-tools-texture .mat-cat-spinner{display:none;width:14px;height:14px;border:2px solid var(--input-border);border-top-color:var(--accent);border-radius:50%;animation:mat-cat-spin .65s linear infinite;}
body.view-tools-texture .mat-cat-head.loading .mat-cat-spinner{display:inline-block;}
@keyframes mat-cat-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){body.view-tools-texture .mat-cat-spinner{animation-duration:1.5s}}

/* POPUPS */
body.view-tools-texture #adj-popup,body.view-tools-texture #joint-adj-popup{position:fixed;background:var(--panel);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,.5);padding:14px;z-index:50;display:none;width:240px;}
body.view-tools-texture #adj-popup.show,body.view-tools-texture #joint-adj-popup.show{display:block;}
body.view-tools-texture .popup-head{display:flex;align-items:center;margin-bottom:10px;}
body.view-tools-texture .popup-title{font-size:12px;font-weight:600;flex:1;color:var(--text);}
body.view-tools-texture .popup-close{background:none;border:none;cursor:pointer;font-size:16px;color:var(--muted);line-height:1;}
body.view-tools-texture .popup-close:hover{color:var(--accent);}
body.view-tools-texture .popup-field{margin-bottom:8px;}
body.view-tools-texture .popup-field label{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);display:block;margin-bottom:4px;}
body.view-tools-texture .popup-field select,body.view-tools-texture .popup-field input{width:100%;background:var(--input);border:1px solid var(--input-border);border-radius:var(--r);padding:5px 8px;font-size:12px;color:var(--text);outline:none;}
body.view-tools-texture .popup-field select option{background:var(--panel);}
body.view-tools-texture .adj-slider{margin-bottom:8px;}
body.view-tools-texture .adj-slider label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);display:flex;justify-content:space-between;margin-bottom:4px;}
body.view-tools-texture .adj-slider label span{color:var(--text);font-weight:400;}

/* 3D PREVIEW */
body.view-tools-texture #preview3d{position:absolute;top:50px;left:0;right:0;bottom:0;display:none;flex-direction:column;z-index:5;background:#131210;overflow:hidden;}
body.view-tools-texture #preview3d>canvas{display:block;}
body.view-tools-texture #surf-bar{display:flex;align-items:center;gap:5px;padding:6px 12px;border-bottom:1px solid var(--border);background:rgba(26,24,21,.96);backdrop-filter:blur(8px);flex-shrink:0;}
body.view-tools-texture .surf-lbl{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);margin-right:3px;}
body.view-tools-texture .surf-btn{padding:4px 10px;border-radius:var(--r);border:1px solid var(--input-border);background:var(--input);color:var(--muted);font-size:12px;cursor:pointer;transition:border-color .15s,color .15s,background .15s;}
body.view-tools-texture .surf-btn:hover{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .surf-btn.on{background:var(--accent);color:#1a1815;border-color:var(--accent);}
body.view-tools-texture .surf-depth{display:flex;align-items:center;gap:7px;margin-left:10px;color:var(--muted);font-size:12px;}
body.view-tools-texture .surf-depth input{width:86px;accent-color:var(--accent);}
/* Bump / Hatch panels */
body.view-tools-texture #panel-bump,body.view-tools-texture #panel-hatch,body.view-tools-texture #panel-displacement,body.view-tools-texture #panel-normal,body.view-tools-texture #panel-roughness,body.view-tools-texture #panel-metalness{display:none;flex-direction:column;flex:1;padding:0 5px;}
body.view-tools-texture .dialog-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.52);z-index:90;display:none;align-items:center;justify-content:center;padding:20px;}
body.view-tools-texture .dialog-backdrop.open{display:flex;}
body.view-tools-texture .dialog{width:min(430px,100%);max-height:calc(100vh - 40px);overflow:auto;background:var(--panel);border:1px solid var(--border);border-radius:9px;box-shadow:0 18px 55px rgba(0,0,0,.55);}
body.view-tools-texture .dialog-head{display:flex;align-items:center;padding:13px 15px;border-bottom:1px solid var(--border);}
body.view-tools-texture .dialog-title{font-size:14px;font-weight:600;flex:1;}
body.view-tools-texture .dialog-body{padding:14px 15px;}
body.view-tools-texture .settings-group{padding:0 0 12px;margin-bottom:12px;border-bottom:1px solid var(--border);}
body.view-tools-texture .settings-group:last-child{border-bottom:0;margin-bottom:0;}
body.view-tools-texture .settings-group h3{font-size:12px;margin-bottom:8px;color:var(--accent);}
body.view-tools-texture .radio-row{display:flex;align-items:center;gap:7px;margin:6px 0;font-size:12px;}
body.view-tools-texture .finish-thumb{width:44px;height:44px;object-fit:cover;background:var(--input);}
body.view-tools-texture .finish-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;}
body.view-tools-texture .finish-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px;border:1px solid var(--input-border);border-radius:var(--r);background:transparent;cursor:pointer;color:var(--muted);font:inherit;font-size:12px;text-align:left;}
body.view-tools-texture .finish-item:hover,body.view-tools-texture .finish-item.on{border-color:var(--accent);color:var(--accent);}
body.view-tools-texture .render-status{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);min-width:72px;text-align:right;transition:color .15s ease;flex:1;}
body.view-tools-texture .render-status.busy{color:var(--accent);}
body.view-tools-texture .render-status.error{color:#d7786d;}
body.view-tools-texture .render-loading{position:absolute;inset:40px 0 0;z-index:9;display:none;align-items:center;justify-content:center;pointer-events:none;}
body.view-tools-texture .render-loading.show{display:flex;}
body.view-tools-texture .render-spinner{width:46px;height:46px;border:4px solid rgba(34,32,24,.58);border-top-color:var(--accent);border-right-color:var(--accent);border-radius:50%;background:rgba(15,14,12,.22);box-shadow:0 0 0 8px rgba(15,14,12,.12);animation:render-spin .7s linear infinite;}
@keyframes render-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){body.view-tools-texture .render-spinner{animation-duration:1.6s}}
@media(max-width:720px){body.view-tools-texture{height:auto;min-height:100vh;min-height:100dvh;overflow:auto}
  body.view-tools-texture #editor-wrap{display:block;overflow:visible}
  body.view-tools-texture .editor-body{display:flex;flex-direction:column;overflow:visible;min-height:calc(100dvh - 52px)}
  body.view-tools-texture #main{order:1;flex:none;width:100%;height:58vh;min-height:420px}
  body.view-tools-texture #sb{order:2;width:100%;max-height:none;border-right:0;border-top:1px solid var(--border);overflow:visible}
  body.view-tools-texture .topbar{gap:6px;overflow-x:auto;overscroll-behavior-inline:contain;padding:6px 8px}
  body.view-tools-texture .topbar-lbl{display:none}
  body.view-tools-texture .top-btn{height:44px;min-height:44px!important;white-space:nowrap;padding:8px 11px}
  body.view-tools-texture .render-status{min-width:62px;text-align:left}
  body.view-tools-texture .overlay{top:52px;left:0;right:0;bottom:0;width:100%}
  body.view-tools-texture .ov-head{flex-wrap:wrap;padding:12px}
  body.view-tools-texture .ov-title{flex:1 1 calc(100% - 48px)}
  body.view-tools-texture .ov-cat,body.view-tools-texture .ov-search-wrap{flex:1 1 150px}
  body.view-tools-texture .ov-search{width:100%}
  body.view-tools-texture .ov-body{padding:12px}
  body.view-tools-texture #adj-popup,body.view-tools-texture #joint-adj-popup{position:fixed!important;left:12px!important;right:12px!important;top:auto!important;bottom:12px!important;width:auto;max-height:calc(100dvh - 88px);overflow:auto}
  body.view-tools-texture .dialog-backdrop{padding:12px}
  body.view-tools-texture .topbar-format{height:44px;min-height:44px!important;max-width:175px}}

