dialog:has([data-background-removal]){width:calc(100vw - 48px);max-width:1140px;max-height:calc(100dvh - 48px);overflow:auto}
dialog:has([data-background-removal]) .modal-head h2{font-size:22px}
.background-workspace .form-hint{font-size:12px;line-height:1.7;margin:10px 0;color:var(--muted)}
.background-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.background-toolbar label.button{position:relative;cursor:pointer;overflow:hidden}
.background-toolbar label.button:has(input:disabled){opacity:.5;cursor:default}
.background-toolbar input[type=file]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:inherit}
.background-history{display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12px}
.background-history select{max-width:260px;border:1px solid var(--line);border-radius:6px;padding:9px;color:var(--ink);background:white}
.background-layout{display:grid;grid-template-columns:170px minmax(0,1fr);gap:20px;margin:18px 0}
.background-files{border:1px solid var(--line);border-radius:8px;padding:8px;max-height:520px;overflow:auto}
.background-file{border:1px solid transparent;border-radius:7px;margin-bottom:8px;padding:5px}
.background-file.selected{border-color:var(--blue);background:#eef4ff}
.background-file>button:first-child{width:100%;border:0;background:transparent;display:flex;align-items:center;flex-direction:column;gap:6px;padding:2px;cursor:pointer;color:var(--ink)}
.background-file img{width:100%;height:78px;object-fit:contain;background:#f5f7fb;border-radius:4px}
.background-file span{font-size:12px;max-width:100%;overflow-wrap:anywhere}
.background-file small{font-size:11px;color:var(--muted)}
.background-file .text-link{font-size:12px;color:var(--blue)}
.background-editor{min-width:0}
.background-canvases{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
.background-canvases figure{margin:0;min-width:0}
.background-canvases figcaption{font-size:13px;font-weight:500;margin-bottom:9px;color:var(--ink)}
.background-picture{height:min(38dvh,340px);min-height:200px;display:flex;align-items:center;justify-content:center;position:relative;overflow:hidden;border:1px solid var(--line);border-radius:8px;background-color:#fff;background-image:linear-gradient(45deg,#e5e9ef 25%,transparent 25%),linear-gradient(-45deg,#e5e9ef 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e5e9ef 75%),linear-gradient(-45deg,transparent 75%,#e5e9ef 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0}
.background-picture>img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.background-picture>span:not(.background-point){font-size:13px;background:#ffffffdf;padding:12px;color:var(--muted)}
.background-pickable{cursor:crosshair}
.background-point{position:absolute;transform:translate(-50%,-50%);width:20px;height:20px;border:2px solid white;border-radius:50%;background:var(--blue);color:white;font-size:10px;text-align:center;line-height:16px;box-shadow:0 0 0 1px #1d407c;pointer-events:none}
.background-settings{margin-top:18px}
.background-settings label{display:flex;gap:10px;align-items:center;font-size:13px}
.background-settings output{min-width:28px;color:var(--blue)}
.background-settings input[type=range]{flex:1;accent-color:var(--blue)}
.background-settings .actions,.background-footer .actions{display:flex;gap:8px;flex-wrap:wrap}
.background-colours{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0;font-size:12px}
.background-colours span{display:flex;align-items:center;gap:6px}
.background-colours i{width:18px;height:18px;border:1px solid #cbd3df;border-radius:4px}
.background-notice{padding:12px 16px;border:1px solid #f4d9a7;background:#fff8e9;border-radius:8px;color:#8d6427;font-size:13px;line-height:1.7}
.background-notice p{margin:4px 0 0}
.background-risk{font-size:13px;line-height:1.7;padding:10px 12px;border-radius:6px;background:#fff0eb;color:#b54b3d}
.background-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:18px}
.background-footer .form-hint{max-width:480px}
@media(max-width:720px){dialog:has([data-background-removal]){width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:18px}.background-layout{grid-template-columns:1fr;gap:14px}.background-files{display:flex;gap:8px;max-height:160px;overflow:auto}.background-file{min-width:100px;width:100px;margin:0}.background-file img{height:56px}.background-files>.form-hint{white-space:nowrap}.background-picture{height:220px;min-height:140px}.background-footer{align-items:flex-start;flex-direction:column}.background-history{margin-left:0}.background-canvases{gap:10px}.background-toolbar .button,.background-settings .button,.background-footer .button{font-size:12px;padding:9px 10px}}
