#sam-lab{width:min(1240px,96vw);height:min(900px,94dvh);max-height:94dvh;max-width:96vw;box-sizing:border-box;padding:18px 22px;overflow:hidden;border:2px solid #9272a6;background:#fffdf5;color:var(--ink,#594b62);box-shadow:6px 6px 0 #b9a5c8;font:inherit;display:flex;flex-direction:column;gap:10px}
#sam-lab:not([open]){display:none}
#sam-lab::backdrop{background:#24192b99}
#sam-lab [hidden]{display:none!important}
#sam-lab .sam-header{display:flex;align-items:center;justify-content:space-between;flex:none}
#sam-lab h2{font:inherit;font-size:23px;margin:0}
#sam-lab button{font:inherit;color:inherit;min-height:44px;border:1px solid #b9a5c8;background:#fffdf8;padding:8px 16px;cursor:pointer}
#sam-lab button:hover:not(:disabled){background:#eee5f5}
#sam-lab button:disabled{opacity:.38;cursor:default}
#sam-lab button[aria-pressed=true]{background:#e3d3ee;border-color:#806092;box-shadow:inset 0 0 0 1px #806092}
#sam-lab .sam-prepare{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
#sam-download{font-size:12px;color:#756a7f}
#sam-start,#sam-lab #sam-apply{background:#70556f;color:#fffdf5;border-color:#70556f}
#sam-lab #sam-start:hover:not(:disabled),#sam-lab #sam-apply:hover:not(:disabled){background:#574156}
#sam-lab .sam-workbar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex:none}
#sam-lab .sam-modes,#sam-lab .sam-switch,#sam-lab .sam-actions{display:flex;align-items:center;gap:7px}
#sam-lab .sam-icon{position:relative;display:grid;place-items:center;width:44px;height:44px;min-width:44px;padding:9px}
#sam-lab .sam-icon svg{width:24px;height:24px;display:block}
#sam-lab .sam-icon::after{content:attr(data-tip);position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);background:#332b3c;color:#fffdf5;padding:5px 8px;white-space:nowrap;font-size:12px;line-height:1.4;pointer-events:none;opacity:0;z-index:5}
#sam-lab .sam-icon:hover::after,#sam-lab .sam-icon:focus-visible::after{opacity:1}
#sam-lab .sam-header .sam-icon::after{left:auto;right:0;transform:none}
#sam-lab .sam-divider{height:25px;width:1px;background:#d8cfe0;margin:0 3px}
#sam-lab .sam-switch{gap:0}
#sam-lab .sam-switch button{font-size:13px;padding:8px 13px}
#sam-lab .sam-stage{flex:1;min-height:120px;position:relative;background:#e7e3e9;border:1px solid #b9a5c8;background-image:repeating-conic-gradient(#e8e4eb 0% 25%,#d3cdd9 0% 50%);background-size:20px 20px;overflow:hidden}
#sam-lab canvas{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
#sam-input{cursor:crosshair;touch-action:none}
#sam-input:focus-visible{outline:3px solid #8466b6;outline-offset:-3px}
#sam-lab .sam-status-row{display:flex;align-items:start;gap:12px;justify-content:space-between;flex:none;font-size:13px;min-height:22px}
#sam-status{overflow-wrap:anywhere}
#sam-count{white-space:nowrap;color:#756a7f}
#sam-lab .sam-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;margin:0;padding:4px 0 0;border:0;font-size:13px}
#sam-lab details{position:relative}
#sam-lab summary{cursor:pointer;color:#756a7f;padding:8px 0}
#sam-lab .sam-help{position:absolute;bottom:100%;left:0;width:min(340px,75vw);padding:15px;background:#fffdf5;border:1px solid #b9a5c8;box-shadow:3px 3px 0 #d8cfe0;line-height:1.8;z-index:6}
@media(max-width:600px){#sam-lab{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;padding:12px;gap:9px;border-width:0;box-shadow:none}#sam-lab h2{font-size:20px}#sam-lab .sam-workbar{flex-wrap:wrap;gap:8px}#sam-lab .sam-modes{gap:4px}#sam-lab .sam-divider{margin:0 2px}#sam-lab .sam-switch{margin-left:auto}#sam-lab .sam-status-row{font-size:12px}#sam-lab .sam-footer{gap:8px}#sam-lab .sam-actions{gap:6px}#sam-lab .sam-actions button{padding:8px 12px}}

#sam-lab .sam-prepare{min-height:26px}#sam-status{font-size:13px}#sam-count{font-size:12px;margin-left:auto}#sam-lab .sam-workbar{gap:8px}#sam-lab .sam-prepare:has(#sam-start:not([hidden])) #sam-status:empty{display:none}

#sam-lab .sam-modes{flex-wrap:wrap}@media(max-width:600px){#sam-lab .sam-modes{flex:1 1 100%}}

#sam-cleanup-panel{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:13px}#sam-cleanup-panel label{display:flex;align-items:center;gap:8px}#sam-cleanup-panel select{font:inherit;min-height:44px;background:#fffdf5;color:inherit;border:1px solid #b9a5c8;padding:6px}#sam-cleanup-count{flex:1;min-width:120px}

@media(max-width:600px){#sam-lab .sam-modes{display:grid;grid-template-columns:repeat(4,44px);flex:0 0 auto;gap:5px}#sam-lab .sam-divider{display:none}#sam-lab .sam-workbar{align-items:center}#sam-lab .sam-switch{margin-left:auto}#sam-count:empty{display:none}}
