:root{color-scheme:light;font:12px/1.35 Tahoma,Arial,sans-serif;--panel:#ece9d8;--blue:#0759df}*{box-sizing:border-box}body{margin:0;padding:16px 22px 12px;background:linear-gradient(#352e3ed9,#2c2736ef),url(assets/wallpaper.jpg) center/cover fixed;color:#111;min-height:100vh}button,input{font:inherit}button{color:#111;cursor:pointer}button:disabled{color:#888;cursor:default}button:focus-visible,input:focus-visible,canvas:focus-visible{outline:2px dotted #111;outline-offset:2px}button{border:1px solid #777;border-radius:2px;background:linear-gradient(#fffef9,#e2dfce);box-shadow:inset 1px 1px #fff;padding:4px 11px;min-height:26px}button:active:not(:disabled){box-shadow:inset 1px 1px #777;background:#d9d5c5}.demo-heading{max-width:1120px;margin:0 auto 10px;display:flex;justify-content:space-between;gap:15px;color:#ddd1e3;font-size:12px}.demo-heading a{color:#e8e0ee;text-decoration:none}.demo-heading a:hover{text-decoration:underline}.paint-window{max-width:1120px;margin:auto;border:3px solid #0960e8;border-radius:8px 8px 0 0;background:var(--panel);box-shadow:0 12px 40px #120a1c88;position:relative}.titlebar{min-height:31px;padding:3px 3px 4px 6px;display:flex;justify-content:space-between;align-items:center;background:linear-gradient(#9dbdff 0,#0760ed 12%,#0055df 70%,#043bb2 100%);color:#fff;border-radius:4px 4px 0 0}.titlebar>div:first-child{display:flex;align-items:center;gap:5px}.titlebar svg{width:21px;height:21px}h1{font:bold 14px Tahoma,Arial;margin:0;text-shadow:1px 1px #113773}.window-controls{display:flex;gap:3px}.window-controls button{padding:0;width:24px;height:24px;min-height:24px;border-color:white;border-radius:3px;color:#fff;font:bold 17px Arial;background:linear-gradient(135deg,#8cb8fd,#135ed1);box-shadow:inset 1px 1px #bfd5ff}.window-controls .close{background:linear-gradient(135deg,#ecb39d,#da3c1b);box-shadow:inset 1px 1px #ffd5c1}.menubar{height:27px;display:flex;align-items:stretch;border-bottom:1px solid #a5a392;padding-left:3px;position:relative;z-index:5}.menu-root{position:relative}.menu-trigger{height:26px;min-height:0;min-width:36px;padding:2px 8px;border:1px solid transparent;border-radius:0;background:transparent;box-shadow:none}.menu-trigger:hover,.menu-trigger[aria-expanded=true]{background:#316ac5;border-color:#316ac5;color:white}.menu{position:absolute;top:100%;left:0;min-width:245px;padding:3px;background:#f7f6ed;box-shadow:3px 3px 0 #0005;border:1px solid #777;z-index:30}.menu-root:last-child .menu,.menu-root:nth-last-child(2) .menu{left:auto;right:0}.menu[hidden]{display:none}.menu button{display:flex;gap:24px;justify-content:space-between;width:100%;white-space:nowrap;text-align:left;padding:5px 12px;border:0;border-radius:0;box-shadow:none;background:none;min-height:27px}.menu button:hover:not(:disabled),.menu button:focus-visible{background:#316ac5;color:#fff;outline:none}.menu kbd{font:11px Tahoma;color:inherit}.menu hr{margin:3px 5px;border:0;border-top:1px solid #aaa}.work-area{display:flex;min-height:280px;height:min(58vh,570px);padding:3px;gap:3px}.toolbox{width:61px;flex:0 0 61px;padding:2px}.tool-grid{display:grid;grid-template-columns:27px 27px;gap:1px}.tool{width:27px;height:29px;min-height:29px;padding:3px;border-radius:0;border-color:transparent;background:transparent;box-shadow:none}.tool:hover{border-color:#888;background:#f8f8ee}.tool.active{border-color:#777;background:repeating-conic-gradient(#fff 0% 25%,#e4e4dc 0% 50%) 50%/4px 4px;box-shadow:inset 1px 1px #777}.tool svg{display:block;width:20px;height:20px}.brush-preview{margin:10px 0 7px;border:1px solid #9b9a8d;box-shadow:inset 1px 1px white;background:#f4f2e7;padding:4px 2px;text-align:center;min-height:65px}.brush-preview img{width:43px;height:46px;object-fit:contain;display:block;margin:auto}.brush-preview span{font-size:10px}.quick-sizes{display:grid;grid-template-columns:1fr 1fr;border:1px solid #aaa;padding:2px;gap:1px}.quick-sizes button{height:25px;min-height:25px;padding:0;display:flex;justify-content:center;align-items:center;border:1px solid transparent;background:transparent;box-shadow:none}.quick-sizes button:hover{border-color:#316ac5}.quick-sizes i{display:block;border-radius:50%;background:#222}.canvas-viewport{flex:1;min-width:0;overflow:auto;background:#808080;border:1px inset #aaa;overscroll-behavior:contain;padding:4px;scrollbar-color:#e5e1d1 #b4b1a8;scrollbar-width:auto}.canvas-sheet{width:1000px;height:640px;position:relative;flex-shrink:0;box-shadow:1px 1px 0 #555;background:#fff}.canvas-sheet.transparent{background:repeating-conic-gradient(#fff 0% 25%,#ddd 0% 50%) 50%/16px 16px}canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair;outline:none}.options-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:5px 7px;border-top:1px solid #f9f9f4;border-bottom:1px solid #a9a793;font-size:11px}.face-name{display:flex;align-items:center;gap:3px;padding-right:7px;border-right:1px solid #b9b6a4}.face-name img{width:27px;height:29px;object-fit:contain}.options-row label{display:flex;align-items:center;gap:4px}.options-row output{min-width:29px;font-variant-numeric:tabular-nums}.options-row input[type=range]{width:90px;height:22px;accent-color:#315eaa;margin:0}.quick-actions{margin-left:auto;display:flex;gap:4px}.quick-actions button{padding:3px 9px}.palette-row{display:flex;align-items:center;gap:8px;padding:6px;border-top:1px solid #fff;min-width:0}.palette-scroll{overflow-x:auto;max-width:100%;padding:1px}.palette{display:grid;grid-template-rows:repeat(2,18px);grid-auto-flow:column;gap:1px}.palette button{min-height:18px;height:18px;width:18px;padding:0;border:2px inset #ddd;border-radius:0;background:var(--swatch);box-shadow:none}.palette button[aria-pressed=true]{outline:1px dotted #111;outline-offset:1px}.palette button:focus-visible{outline:2px solid #0759df}#current-color{width:40px;height:38px;min-width:40px;padding:0;position:relative;background:repeating-conic-gradient(#fff 0% 25%,#ddd 0% 50%) 50%/4px 4px;border:1px inset #bbb;border-radius:0;box-shadow:none}#foreground-chip,#background-chip{position:absolute;width:21px;height:21px;border:2px inset #aaa;top:3px;left:3px;background:#000;z-index:1}#background-chip{left:15px;top:14px;background:#fff;z-index:0}.background-button{margin-left:auto;white-space:nowrap;font-size:11px}.statusbar{height:23px;display:flex;align-items:center;gap:8px;padding:2px 5px;border-top:1px solid #aaa;box-shadow:inset 0 1px #fff;font-size:11px}.statusbar>span:first-child{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.statusbar>span+span,.statusbar>button{border-left:1px solid #aaa;padding-left:9px;white-space:nowrap}.statusbar>button{border:0;border-left:1px solid #aaa;box-shadow:none;background:none;min-height:17px;padding:0 6px 0 9px;border-radius:0}#color-input{position:fixed;left:-100px;width:1px;height:1px}.demo-note{margin:10px auto 0;max-width:1120px;color:#ddd1e3;font-size:11px}dialog{padding:0;width:min(440px,calc(100vw - 24px));border:3px solid #0759df;border-radius:7px 7px 0 0;background:#ece9d8;color:#111;box-shadow:0 10px 40px #0006;font:13px/1.55 Tahoma,Arial}dialog::backdrop{background:#16122755}.dialog-title{background:linear-gradient(#7faaff,#045be8 20%,#0345c0);display:flex;justify-content:space-between;align-items:center;color:#fff;padding:4px 5px 5px 9px}.dialog-title h2{font:bold 13px Tahoma;margin:0}.dialog-title button{color:white;font:bold 17px Arial;min-height:23px;height:23px;width:23px;padding:0;background:linear-gradient(135deg,#eebba4,#db431f);border-color:white}.dialog-title button:focus-visible{outline-color:white}#dialog-body{padding:20px 22px 5px}#dialog-body p{margin:0 0 14px}#dialog-body ul{padding-left:20px;margin:0 0 15px}#dialog-actions{display:flex;justify-content:flex-end;gap:8px;padding:8px 20px 17px}#dialog-actions button{min-width:76px}.titlebar button:focus-visible{outline-color:#fff}#window-content[hidden]{display:none}.paint-window[hidden]{display:none}@media(max-width:760px){body{padding:12px}.options-row{gap:6px}.options-row input[type=range]{width:70px}.quick-actions{margin-left:0}.background-button{padding:4px 6px;font-size:10px}.work-area{height:54vh}}@media(max-width:560px){body{padding:8px 5px;background-attachment:scroll}.demo-heading{font-size:10px;margin:0 3px 8px;align-items:start;gap:20px}.demo-heading span{max-width:165px;text-align:right}.titlebar{min-height:44px}.titlebar h1{font-size:12px}.window-controls button{width:38px;height:38px;min-height:38px}.window-controls{gap:2px}.menubar{height:44px;z-index:10}.menu-root{flex:1}.menu-trigger{height:44px;min-height:44px;min-width:0;width:100%;padding:3px 4px;font-size:12px}.menu{min-width:220px}.menu button{min-height:44px;font-size:12px}.menu-root:nth-child(n+4) .menu{left:auto;right:0}.work-area{height:43vh;min-height:285px;gap:2px;padding:2px}.toolbox{width:92px;flex-basis:92px;padding:1px}.tool-grid{grid-template-columns:44px 44px;gap:1px}.tool{width:44px;height:44px;min-height:44px;padding:10px}.tool svg{width:23px;height:23px}.brush-preview{margin:6px 2px;padding:2px;min-height:60px}.brush-preview img{width:42px;height:42px}.quick-sizes{margin:0 1px;grid-template-columns:44px 44px;border:0;padding:0;gap:0}.quick-sizes button{height:44px;min-height:44px}.options-row{padding:4px;gap:0 8px}.face-name{display:none}.options-row label{width:calc(50% - 4px);min-height:44px;font-size:11px}.options-row label:last-of-type{width:100%}.options-row input[type=range]{flex:1;width:55px;min-width:0;height:36px}.options-row output{min-width:30px}.quick-actions{width:100%;justify-content:space-between;gap:4px}.quick-actions button{min-height:44px;flex:1;padding:3px 5px;font-size:12px}.palette-row{gap:5px;padding:4px}.palette{grid-template-rows:repeat(2,44px);gap:2px}.palette button{width:44px;height:44px;min-height:44px}.palette-scroll{flex:1}.background-button{min-height:44px;width:64px;white-space:normal;line-height:1.25}.statusbar{font-size:10px;height:27px}.statusbar>span+span{display:none}.statusbar>button{min-height:25px}.demo-note{font-size:10px;padding:0 4px;line-height:1.5}#dialog-actions button{min-height:44px}.dialog-title button{min-height:36px;width:36px;height:36px}#current-color{min-width:44px;width:44px;height:44px}#background-chip{left:17px;top:17px}#foreground-chip{top:5px;left:5px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}

.faces-row{display:flex;align-items:center;gap:7px;padding:5px 7px;border-top:1px solid #fff;border-bottom:1px solid #aaa;min-height:42px}.faces-row>span{font-size:11px}.faces-row>button{margin-left:auto;white-space:nowrap}.faces-row input[hidden]{display:none}#face-library{display:flex;gap:4px;overflow-x:auto;min-width:0}#face-library button{display:flex;align-items:center;gap:5px;white-space:nowrap;max-width:150px;padding:3px 8px}#face-library button[aria-pressed=true]{border-color:#235cb9;background:#d9e7ff;box-shadow:inset 1px 1px #7299d2}#face-library img{width:28px;height:30px;object-fit:contain}#face-library span{overflow:hidden;text-overflow:ellipsis}#import-dialog{width:min(760px,calc(100vw - 20px));max-height:calc(100dvh - 24px);overflow:auto}.import-body{padding:13px 16px 6px}.import-body>p{margin:0 0 10px}#import-progress{display:block;width:100%;height:14px;margin:4px 0 10px}#import-progress[hidden]{display:none}.import-stage{height:min(390px,50dvh);max-height:390px;min-height:160px;overflow:auto;border:1px inset #aaa;background:repeating-conic-gradient(#fff 0% 25%,#d4d4d4 0% 50%) 50%/16px 16px;overscroll-behavior:contain}#import-canvas{touch-action:none;display:block;margin:0 auto;width:100%;height:auto;max-width:none;cursor:crosshair}.edge-tools{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding-top:10px}.edge-tools[hidden],#outline-tools[hidden]{display:none}.edge-tools>button[aria-pressed=true]{border-color:#225cb5;background:#d7e7ff;box-shadow:inset 1px 1px #7b9ecc}.edge-tools label{display:flex;align-items:center;gap:4px;margin-left:3px}.edge-tools input[type=range]{width:100px;accent-color:#245ebc}.edge-tools select{height:28px;background:#fff;border:1px solid #777;font:inherit}.edge-tools output{min-width:22px}#outline-tools{padding-top:12px}#outline-tools p{margin:0 0 8px}#face-choices{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}#face-choices:empty{display:none}#import-note{font-size:11px;color:#4a4a43;margin-top:12px}.import-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:6px;padding:7px 16px 15px}.import-actions button{min-width:70px}#import-use{border-color:#2e64b6;box-shadow:inset 0 0 0 1px #9db5d8}#import-status{min-height:20px}#import-dialog .dialog-title{position:sticky;top:0;z-index:2}
@media(max-width:560px){.faces-row{padding:4px;gap:4px}.faces-row>span{display:none}.faces-row>button,#face-library button{min-height:44px}.faces-row>button{padding:4px 7px}#face-library{flex:1}#face-library button{max-width:125px;padding:3px 6px}.import-body{padding:10px}.import-stage{height:min(310px,38dvh);max-height:310px;min-height:160px}.edge-tools>button,.edge-tools label,.edge-tools select,#outline-tools button,#face-choices button,.import-actions button{min-height:44px}.edge-tools label{margin:0}.edge-tools input[type=range]{height:36px}.import-actions{padding:6px 10px 12px;justify-content:stretch}.import-actions button{flex:1;min-width:42%}#import-note{font-size:11px;line-height:1.4}#import-dialog{max-height:calc(100dvh - 12px)}.import-actions #import-use{order:-1}.import-actions #import-cancel{order:0}}

/* Real canvas handle, named imports and viewport-sized XP window. */
.canvas-viewport{padding:12px}
.resize-dot{position:absolute;left:100%;top:100%;transform:translate(-50%,-50%);width:20px;height:20px;min-width:20px;min-height:20px;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;cursor:nwse-resize;touch-action:none;z-index:2}
.resize-dot::after{content:"";position:absolute;left:7px;top:7px;width:7px;height:7px;border:1px solid #444;background:#eee;box-shadow:inset 1px 1px #fff;pointer-events:none}
.resize-dot:active:not(:disabled){background:transparent;box-shadow:none}
.resize-dot:hover::after,.resize-dot:focus-visible::after{background:#d9e7ff;border-color:#0759df}
.import-name-label{display:flex;align-items:center;gap:9px;margin:0 0 12px}
#import-name{flex:1;min-width:0;max-width:360px;padding:6px 8px;border:2px inset #ddd;border-radius:0;background:white;color:#111;font:inherit;line-height:1.3}
body.paint-maximized{overflow:hidden}
.paint-window.maximized:not([hidden]){position:fixed;inset:0;z-index:50;width:100vw;height:100vh;height:100dvh;max-width:none;margin:0;border-radius:0;display:flex;flex-direction:column;box-shadow:none;overflow:hidden}
.paint-window.maximized>.titlebar{flex-shrink:0;border-radius:0}
.paint-window.maximized #window-content:not([hidden]){display:flex;flex:1;flex-direction:column;min-height:0;overflow:auto;overscroll-behavior:contain}
.paint-window.maximized #window-content>.menubar,.paint-window.maximized #window-content>.palette-row,.paint-window.maximized #window-content>.statusbar{flex-shrink:0}
.paint-window.maximized .work-area{flex:1 0 280px;height:auto;min-height:280px}
.paint-window.maximized.is-minimized{bottom:auto;height:auto}
@media(max-width:560px){
  .paint-window.maximized .work-area{flex-basis:285px;min-height:285px}
  .import-name-label{align-items:start;flex-direction:column;gap:3px}
  #import-name{width:100%;max-width:none;min-height:44px;font-size:16px}
  .resize-dot{width:24px;height:24px;min-width:24px;min-height:24px}
  .resize-dot::after{left:9px;top:9px}
}

.canvas-resize-preview{position:absolute;left:0;top:0;border:1px dashed #0759df;box-shadow:0 0 0 1px #fff8;pointer-events:none;z-index:1}

/* Direct zoom controls live with the background and colour palette. */
.zoom-controls{display:flex;align-items:center;gap:3px}
.zoom-controls button{min-width:30px;padding:0 7px;line-height:1;font-size:18px}
.zoom-controls .zoom-fit{min-width:42px;margin-left:4px;font-size:12px}
#zoom-status{min-width:42px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums}
.tool:disabled svg{opacity:.35}
.tool:disabled:hover{border-color:transparent;background:transparent}
.menu button[aria-pressed=true]{background:#d9e7ff;box-shadow:inset 2px 0 #235cb9}
.menu button[aria-pressed=true]:hover,.menu button[aria-pressed=true]:focus-visible{background:#316ac5}
@media(max-width:560px){
  .zoom-controls{gap:4px}
  .zoom-controls button{min-width:44px;min-height:44px;font-size:21px}
  .zoom-controls .zoom-fit{min-width:50px;font-size:13px}
  #zoom-status{min-width:44px;font-size:12px}
}

.titlebar .app-icon{display:block;width:16px;height:16px;object-fit:contain;flex:none}

/* Face import: explicit selection, a shared viewport, and a separate edge editor. */
#import-dialog{width:min(800px,calc(100vw - 20px));box-sizing:border-box}
#import-dialog [hidden]{display:none!important}
.import-selection-tools,.import-view-tools,.edge-tools-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.import-selection-tools{margin-bottom:8px}
.import-view-tools{padding:6px 0 8px;border-top:1px solid #aca899}
.import-view-tools label,.edge-tools-row label{display:flex;align-items:center;gap:4px;font-size:12px;margin:0}
.import-view-tools select,.edge-tools select{font:inherit;background:#fff;border:1px solid #777;height:28px;max-width:110px}
#import-dialog button{font:inherit}
#import-dialog button[aria-pressed=true]{border-color:#225cb5;background:#d7e7ff;box-shadow:inset 1px 1px #7b9ecc}
#import-dialog button:focus-visible{outline:2px dotted #111;outline-offset:1px}
.import-stage{background:repeating-conic-gradient(#fff 0% 25%,#d4d4d4 0% 50%) 50%/16px 16px}
.import-stage[data-background=white]{background:#fff}
.import-stage[data-background=dark]{background:#292929}
#import-canvas{margin:0 auto;flex:none}
#face-choices{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0}
#face-choices button{display:flex;align-items:center;gap:6px;min-width:102px;padding:3px 7px 3px 3px;min-height:64px;background:#ece9d8;text-align:left}
#face-choices canvas{width:56px;height:56px;background:#fff;border:1px inset #aaa;flex:none}
#face-choices button[aria-pressed=true]{outline:2px solid #1d62b0;outline-offset:0}
.edge-tools{display:flex;flex-direction:column;align-items:stretch;gap:8px;padding-top:10px}
.edge-tools-row{min-width:0}
.edge-tools-row input[type=checkbox]{margin:0;width:16px;height:16px;accent-color:#245ebc}
.edge-tools-row input[type=range]{width:104px;max-width:100%;margin:0}
#outline-tools{display:flex;flex-wrap:wrap;gap:6px;padding-top:10px}
#import-note{margin:10px 0 0;font-size:11px}
.import-actions{border-top:1px solid #aca899;padding-top:10px}
#import-use,#import-cut,#import-find-region{border-color:#2e64b6;box-shadow:inset 0 0 0 1px #9db5d8}
@media(max-width:520px){
 #import-dialog{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);padding:0}
 .import-body{padding:9px}
 #import-status{font-size:12px;line-height:1.3;min-height:0}
 .import-name-label{flex-direction:row;align-items:center;gap:6px;margin-bottom:9px;white-space:nowrap;font-size:12px}
 #import-name{min-height:36px;padding:5px;font-size:16px;width:0;flex:1}
 .import-selection-tools,.import-view-tools,.edge-tools-row{gap:5px}
 .import-selection-tools button,.import-view-tools button,.import-view-tools select,.edge-tools button,.edge-tools select,#outline-tools button{min-height:40px;padding:5px 7px;font-size:12px}
 .import-stage{height:min(260px,35dvh);min-height:145px}
 .edge-tools-row label{font-size:12px;min-height:32px}
 .edge-tools-row input[type=range]{width:90px}
 .edge-tools-row input[type=checkbox]{width:18px;height:18px}
 #face-choices{gap:6px;flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding:3px 2px 5px}
 #face-choices button{min-width:95px;flex-shrink:0;font-size:12px;min-height:54px}
 #face-choices canvas{width:44px;height:44px}
 .import-actions{padding:8px;justify-content:flex-end;gap:5px}
 .import-actions button{min-width:0;flex:1;min-height:42px;padding:5px;font-size:12px}
 .import-actions #import-use{order:0}
}

/* Keep the import actions within reach while its photo/tools scroll. */
#import-dialog{overflow:hidden}
#import-dialog[open]{display:flex;flex-direction:column}
#import-dialog>.dialog-title,#import-dialog>.import-actions{flex:0 0 auto}
#import-dialog>.import-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}

@media(min-width:521px){#import-dialog .import-stage{height:min(390px,max(160px,calc(100dvh - 450px)))}}


/* The site supplies the title bar; this iframe contains the paint workspace. */
html.paint-embedded,html.paint-embedded body{width:100%;height:100%;min-height:0;margin:0;padding:0;overflow:hidden;background:var(--panel)}
.paint-embedded .demo-heading,.paint-embedded .demo-note,.paint-embedded #paint-window>.titlebar{display:none}
.paint-embedded #paint-window{display:flex;flex-direction:column;position:relative;width:100%;height:100%;max-width:none;max-height:none;margin:0;border:0;border-radius:0;box-shadow:none;overflow:hidden}
.paint-embedded #window-content{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain}
.paint-embedded #window-content>.menubar,.paint-embedded #window-content>.palette-row,.paint-embedded #window-content>.statusbar,.paint-embedded #pin-controls{flex:0 0 auto}
.paint-embedded #window-content>.work-area{flex:1 0 180px;height:auto;min-height:180px;min-width:0}
.paint-embedded .toolbox{overflow-y:auto;overscroll-behavior:contain}
.paint-embedded dialog{max-height:calc(100dvh - 12px)}
@media(max-width:560px){
 .paint-embedded #window-content>.work-area{flex-basis:180px;min-height:180px}
 .paint-embedded .options-row label{min-height:36px}
 .paint-embedded .options-row input[type=range]{height:32px}
 .paint-embedded .palette{grid-template-rows:repeat(2,30px)}
 .paint-embedded .palette button{height:30px;min-height:30px;width:36px}
}


/* Paint controls share one scrolling toolbox; the canvas keeps the remaining space. */
.work-area{height:min(70vh,690px);min-width:0}
.toolbox{
  width:188px;flex:0 0 188px;min-height:0;padding:5px;
  overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
  scrollbar-width:thin;border-right:1px solid #aca899;
}
.toolbox [hidden]{display:none!important}
.toolbox .tool-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:2px}
.toolbox .tool{width:100%;height:32px;min-height:32px;padding:5px}
.toolbox .tool svg{width:22px;height:22px}
.toolbox .quick-sizes{
  grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;
  margin:6px 0 6px;padding:2px;border:1px solid #b1ae9f;
}
.toolbox .quick-sizes button{height:28px;min-height:28px}
.toolbox .faces-row{
  display:flex;flex-direction:column;align-items:stretch;gap:5px;
  padding:6px 0;border-top:1px solid #fff;border-bottom:1px solid #b1ae9f;
}
.toolbox .faces-row>span{display:none}
.toolbox .faces-row #choose-face{
  width:100%;min-width:0;max-width:none;min-height:52px;
  margin:0;padding:4px 6px;gap:6px;
}
.toolbox #face-choice-preview{width:34px;height:40px}
.toolbox .face-choice-copy{flex:1;gap:3px}
.toolbox #face-choice-name{white-space:normal;overflow-wrap:anywhere;line-height:1.2}
.toolbox .face-choice-arrow{padding-left:0}
.toolbox .faces-row #upload-face{width:100%;min-height:30px;margin:0;padding:4px 6px;font-size:11px}
.toolbox .options-row{
  display:flex;flex-direction:column;align-items:stretch;gap:6px;
  padding:8px 0 2px;border-bottom:0;flex-wrap:nowrap;
}
.toolbox #effect-button{width:100%;min-height:30px;margin:0;padding:4px 6px;text-align:left;white-space:normal;line-height:1.25}
.toolbox .options-row label{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 5px;
  width:100%;min-height:0;align-items:center;padding:0 2px;
}
.toolbox .options-row label>span{grid-column:1;grid-row:1}
.toolbox .options-row output{grid-column:2;grid-row:1;min-width:0;text-align:right}
.toolbox .options-row input[type=range]{grid-column:1/-1;grid-row:2;width:100%;height:28px;min-width:0;margin:0}
.toolbox .quick-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;width:100%;margin:2px 0 0;padding-top:8px;border-top:1px solid #b1ae9f}
.toolbox .quick-actions button{min-width:0;min-height:30px;padding:4px 5px}
.palette-row{flex-wrap:wrap;column-gap:8px;row-gap:5px}
.palette-row .palette-scroll{flex:0 1 auto;min-width:80px}
/* Fixed tracks keep the Paint swatches packed together instead of spreading across the bar. */
.palette-row .palette{
  --swatch-size:18px;width:max-content;grid-auto-columns:var(--swatch-size);
  grid-template-rows:repeat(2,var(--swatch-size));justify-content:start;gap:1px;
}
.palette-row .palette button{
  width:var(--swatch-size);height:var(--swatch-size);min-width:var(--swatch-size);
  min-height:var(--swatch-size);margin:0;padding:0;
}
.palette-row .background-button{margin-left:auto;flex:0 0 auto}
.palette-row .zoom-controls{flex:0 0 auto;margin-left:0;padding-left:7px;border-left:1px solid #b1ae9f}
.paint-window.maximized #window-content:not([hidden]),
.paint-embedded #window-content{overflow:hidden}
.paint-window.maximized #window-content>.work-area,
.paint-embedded #window-content>.work-area{flex:1 1 auto;min-height:0;height:auto;overflow:hidden}

@media(max-width:560px){
  .work-area{height:62vh;min-height:280px}
  .toolbox{width:136px;flex-basis:136px;padding:4px}
  .toolbox .tool-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:2px}
  .toolbox .tool{height:44px;min-height:44px;padding:10px}
  .toolbox .tool svg{width:23px;height:23px}
  .toolbox .quick-sizes{grid-template-columns:repeat(2,minmax(0,1fr));margin:5px 0;padding:0;gap:2px;border:0}
  .toolbox .quick-sizes button{height:44px;min-height:44px}
  .toolbox .faces-row{gap:5px;padding:7px 0}
  .toolbox .faces-row #choose-face{min-height:54px;padding:4px;gap:4px}
  .toolbox #face-choice-preview{width:28px;height:34px}
  .toolbox .face-choice-action,.toolbox #face-choice-name{font-size:10px}
  .toolbox .faces-row #upload-face,.toolbox #effect-button{min-height:44px;font-size:11px}
  .toolbox .options-row{gap:5px;padding-top:7px}
  .toolbox .options-row label{min-height:0;padding:0 1px;font-size:11px}
  .toolbox .options-row input[type=range]{height:44px}
  .toolbox .quick-actions{gap:4px}
  .toolbox .quick-actions button{min-height:44px;padding:4px 2px;font-size:11px}
  .palette-row{column-gap:5px;row-gap:5px;padding:5px}
  .palette-row .palette-scroll{flex:1 1 calc(100% - 52px);min-width:0}
  .palette-row .palette{--swatch-size:28px;gap:2px}
  .palette-row .background-button{width:84px;min-height:44px;margin-left:0;padding:4px 6px;font-size:11px}
  .palette-row .zoom-controls{gap:3px;margin-left:auto;padding-left:5px}
  .palette-row .zoom-controls button{min-width:44px;min-height:44px;padding:0 7px}
  .palette-row .zoom-controls .zoom-fit{min-width:44px;margin-left:0;padding:0 5px}
  .palette-row #zoom-status{min-width:34px;font-size:11px}
}
@media(pointer:coarse) and (min-width:561px){
  .toolbox .tool-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .toolbox .tool,.toolbox .quick-sizes button,.toolbox .quick-actions button,
  .toolbox .faces-row #upload-face,.toolbox #effect-button{min-height:44px;height:auto}
  .toolbox .quick-sizes{grid-template-columns:repeat(2,minmax(0,1fr))}
  .toolbox .options-row input[type=range]{height:44px}
  .palette-row .zoom-controls button,.palette-row .background-button{min-height:44px;min-width:44px}
  .palette-row .palette{--swatch-size:28px;gap:2px}
}
