:root{--bg:#ecf0fa;--surface:#fafdff;--stage:#e8edf7;--ink:#18223f;--muted:#7d8bb0;--line:#e2e8f5;--brand:#6354ff;--tint:#eef0ff;--shadow:0 8px 22px #2433540a}html[data-theme=dark]{--bg:#101827;--surface:#1b263a;--stage:#141e30;--ink:#f0f3ff;--muted:#9caaca;--line:#303e58;--brand:#8b7aff;--tint:#2b3556}
header{height:72px;background:linear-gradient(110deg,#172234,#1c283c);color:#fff;border:0;padding:0 24px;gap:25px}header .brand{color:#fff;letter-spacing:-.5px;font-size:22px}.brand img{width:39px;height:39px}.brand small{color:#a0acc3;letter-spacing:.2em}.editor-mode{display:flex;gap:10px;align-items:center;padding:12px 16px;background:#ffffff0c;border:1px solid #ffffff08;border-radius:12px;font-size:12px;font-weight:600}.editor-mode svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7}.top-actions{gap:8px}header button,header summary{background:#ffffff08;color:#f4f6ff;border:1px solid #ffffff06;min-height:43px;border-radius:12px;font-size:12px;font-weight:500}header button:hover,header summary:hover{background:#ffffff16}header .file-actions{background:#202d43;border-color:#334158}header .file-actions button{color:#fff}header #export-open{background:linear-gradient(110deg,#9035fa,#159ff0);border:0;padding:12px 20px}.top-actions #undo,.top-actions #redo{padding:8px 12px}#reset-canvas{font-size:11px}
main{height:calc(100dvh - 105px);grid-template-columns:76px 258px minmax(0,1fr) 300px;grid-template-rows:44px minmax(0,1fr);gap:14px;padding:14px 12px 8px}#tools,html[data-theme=light] #tools{background:linear-gradient(160deg,#18253a,#28364e);border:0;box-shadow:none;border-radius:15px;padding:9px 6px;gap:6px}#tools button,html[data-theme=light] #tools button{color:#f2f5fc;min-height:65px;font-size:10px;gap:6px}#tools button:hover,html[data-theme=light] #tools button:hover{background:#ffffff0c}#tools button.active,html[data-theme=light] #tools button.active,html[data-theme=dark] #tools button.active{background:linear-gradient(135deg,#7143ff,#3d70fc);color:#fff;box-shadow:0 5px 15px #141c3826}#tools svg{width:23px;height:23px}
#quick-sidebar,#sidebar{border:0;border-radius:17px;background:var(--surface);padding:20px 18px}#quick-sidebar .side-title{display:none}#panel h2{font-size:19px;letter-spacing:-.5px}#panel p{font-size:11px;margin-top:5px}#panel h3{font-size:15px;font-weight:600;margin:20px 0 12px}.quick-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.quick-grid button{align-items:center;justify-content:center;text-align:center;font-size:10px;min-height:83px;padding:8px 4px;gap:8px;border-radius:13px;border-color:var(--line);background:linear-gradient(140deg,var(--surface),var(--bg))}.quick-grid button b{display:none}.quick-symbol{width:36px;height:36px;border-radius:11px}.quick-grid .quick-symbol svg{width:24px;height:24px}.quick-list{gap:8px}.quick-list button{min-height:39px;font-size:11px;border:0;border-radius:10px;background:var(--bg)}.quick-list .quick-symbol{background:var(--tint);width:27px;height:27px;color:var(--brand)}
#top-tools{gap:8px;padding-bottom:2px;align-items:stretch}#top-tools button{flex:0 0 auto;min-width:78px;min-height:40px;padding:8px 12px;border:0;background:var(--surface);box-shadow:var(--shadow);font-size:11px;font-weight:500;border-radius:12px}#top-tools button:hover,#top-tools button.active{background:var(--brand);color:#fff}#top-tools svg{width:18px;height:18px}
#workspace{background:repeating-conic-gradient(var(--bg) 0% 25%,var(--stage) 0% 50%) 50% / 18px 18px;border:0;border-radius:17px;overflow:hidden}.workspace-heading{height:41px;padding:10px 16px;align-items:center}#doc-size{padding:5px 10px;border-radius:9px;background:var(--line);color:var(--ink);font-size:10px}#stage{padding:40px 22px 18px}#stage .canvas-container{box-shadow:0 10px 30px #1c2e4e19;border-radius:0}.zoom-bar{order:2;align-self:center;margin:5px 0 10px;height:38px;padding:3px 8px;border-radius:13px;background:#253149;color:#fff;box-shadow:0 7px 15px #18233c24;gap:7px}.zoom-bar button{color:#fff;background:transparent;border:0;font-size:11px;min-height:28px}.zoom-bar span{color:#fff}#photo-strip{order:3;flex-shrink:0;background:var(--surface);border-radius:15px;padding:12px;gap:10px;min-height:78px}#photo-strip button{height:55px;max-width:none;min-width:44px;border-radius:9px;flex:1}.strip-add{border-style:dashed;border-color:var(--muted)}.strip-add span{font-size:10px}footer{height:33px;border:0;background:var(--bg);font-size:9px;padding:0 18px}
#sidebar{padding:20px 18px;scrollbar-width:thin}#sidebar .side-title{margin-bottom:17px}#sidebar .side-title h2{font-size:17px;letter-spacing:-.5px}#image-summary{display:flex;align-items:flex-start;gap:12px;margin:10px 0 22px}#image-summary>img{width:66px;height:59px;object-fit:cover;border-radius:9px;box-shadow:0 5px 10px #17244116}#image-summary>div{min-width:0;flex:1}#image-summary strong{display:block;font-size:12px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#image-summary small{display:block;font-size:10px;color:var(--muted);margin:5px 0}#replace-selected{font-size:10px;min-height:26px;padding:4px 9px;border:0;float:right;background:var(--bg)}.properties-tabs{border:0;padding:3px;background:var(--bg);gap:0;margin:14px 0 20px}.properties-tabs button{font-size:11px;min-width:0;padding:6px;min-height:32px;background:transparent!important;color:var(--ink)!important;box-shadow:none!important}.properties-tabs button.chosen{color:var(--brand)!important;background:var(--surface)!important;box-shadow:0 3px 8px #293c6010!important}#live-adjust details{background:none;border:0;border-bottom:1px solid var(--line);padding:0 0 13px;margin:0 0 15px}#live-adjust summary{font-size:11px;color:var(--muted)}.adjust-slider{font-size:11px;padding:7px 0;margin:10px 0!important}.adjust-slider input{width:68%;margin-left:25%;margin-top:14px;height:5px}.adjust-slider output{border-radius:8px;min-width:34px;background:var(--surface);box-shadow:0 2px 7px #192d5010;font-size:11px;color:var(--ink)}#live-adjust>.button-grid{margin:12px 0}.quick-presets{border-top:1px solid var(--line);padding-top:6px;margin-top:20px}.quick-presets h3{font-size:15px;margin:12px 0}.quick-presets .look-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.quick-presets .look-grid img{height:45px}.quick-presets button{border:0;background:transparent;font-size:9px}.quick-presets button span{padding:6px 0}.quick-presets img{border-radius:8px}#reset-canvas-settings{position:sticky;bottom:-12px;z-index:2;width:100%;margin-top:20px;min-height:42px;border:1px solid var(--line);box-shadow:0 4px 18px #26375a08;font-size:12px}#sidebar:not([data-tab=layers]) .layers-section{display:none}#right-creative .quick-grid{grid-template-columns:1fr 1fr}#right-creative .filter-grid{grid-template-columns:1fr 1fr}
#object-toolbar{position:absolute;display:flex;gap:2px;align-items:center;padding:5px 6px;border-radius:12px;background:linear-gradient(130deg,#1b293e,#2d3b52);box-shadow:0 7px 18px #16243e33;z-index:15;max-width:calc(100% - 16px);overflow-x:auto;scrollbar-width:none}#object-toolbar button{flex-shrink:0;width:31px;min-height:31px;padding:5px;border:0;background:transparent;color:#eaf1ff;border-radius:7px}#object-toolbar button:hover{background:#ffffff1a}#object-toolbar .danger{color:#ff365b}#object-toolbar svg{width:18px;height:18px}#object-toolbar .vertical-flip svg{transform:rotate(90deg)}#label-background-controls{padding:8px 12px;border-radius:12px;background:var(--bg);margin:15px 0}#label-background-controls label{margin:8px 0}
@media(max-width:1450px){main{grid-template-columns:66px 224px minmax(0,1fr) 278px;gap:10px;padding:12px 10px 8px}header{gap:15px;padding:0 15px}.editor-mode{padding:10px;font-size:11px}.top-actions{gap:5px}header .brand{font-size:18px}.top-actions button{padding:8px 10px}#quick-sidebar,#sidebar{padding:17px 14px}.quick-grid{gap:6px}.quick-grid button{font-size:9px;min-height:77px}.quick-symbol{width:31px;height:31px}}
@media(max-width:1150px){.editor-mode{display:none}main{grid-template-columns:62px 200px minmax(0,1fr) 250px;gap:8px}#quick-sidebar,#sidebar{padding:14px 11px}#object-toolbar button{width:28px}.top-actions button{font-size:11px}}
@media(min-width:761px) and (max-width:1000px){main{grid-template-columns:62px 205px minmax(0,1fr)}#sidebar{display:none;position:fixed;right:12px;top:83px;bottom:40px;width:285px;z-index:26;box-shadow:0 8px 40px #10213a44}.properties-open #sidebar{display:block}#close-properties{display:inline-flex}#top-tools button{flex-direction:row;font-size:10px}header .brand{font-size:17px}#reset-canvas span{display:none}}
@media(max-width:760px){header{height:62px;padding:0 8px;gap:6px}header .brand{font-size:14px!important;gap:5px}.brand img{width:28px;height:28px}.brand small{font-size:6px}.top-actions{gap:3px}header button,header summary{min-height:34px;border-radius:9px;padding:6px;font-size:10px}#projects-open:before{content:none}#projects-open span,#reset-canvas span,#export-open span{display:none}#projects-open,#reset-canvas,#export-open,#theme{min-width:30px;padding:6px!important}#projects-open svg,#reset-canvas svg,#export-open svg{width:16px;height:16px}#undo,#redo{min-width:27px!important;padding:5px!important}#undo svg,#redo svg{width:16px;height:16px}#save-current-header{display:none}header #file-menu summary{min-width:33px;padding:6px}main{height:calc(100dvh - 95px);grid-template-columns:minmax(0,1fr);grid-template-rows:38px minmax(0,1fr) 62px;padding:6px;gap:6px}#top-tools{grid-column:1;grid-row:1;gap:5px}#top-tools button{padding:5px 9px;min-width:70px;min-height:34px;font-size:10px}#workspace{grid-column:1;grid-row:2}#tools{grid-column:1;grid-row:3;flex-direction:row;border-radius:12px;gap:2px;padding:4px}#tools button,html[data-theme=light] #tools button{min-height:52px;min-width:54px;font-size:9px;gap:4px}#tools svg{width:19px;height:19px}#quick-sidebar,#sidebar{display:none;position:fixed;top:auto;left:6px;right:6px;bottom:103px;height:39dvh;max-height:39dvh;width:auto;z-index:25;padding:14px;border:1px solid var(--line);box-shadow:0 -8px 26px #11233b17}#quick-sidebar .side-title{display:flex;margin-bottom:10px}.panel-open #quick-sidebar,.properties-open #sidebar{display:block}.panel-open #workspace,.properties-open #workspace{padding-bottom:calc(39dvh + 6px)}.workspace-heading{height:30px;padding:4px 10px}#stage{padding:35px 12px 6px}#photo-strip{min-height:47px;padding:5px 7px;gap:5px;border-radius:10px}#photo-strip button{height:36px;min-width:28px}.zoom-bar{height:29px;margin:4px auto 6px;padding:1px 6px}.zoom-bar button{min-height:25px;font-size:9px}.zoom-bar span{font-size:9px}.strip-add span{display:none}#object-toolbar{padding:3px;gap:0;border-radius:9px}#object-toolbar button{width:28px;min-height:28px;padding:5px}#object-toolbar svg{width:16px;height:16px}#image-summary{margin:5px 0 10px}#image-summary>img{width:45px;height:40px}.properties-tabs{margin:10px 0}footer{height:33px;padding:0 10px}.quick-grid button{font-size:10px;min-height:70px}#sidebar .side-title{margin-bottom:9px}#reset-canvas-settings{bottom:-8px}#top-tools{scrollbar-width:none}}
@media(max-width:390px){header .brand span{max-width:83px;font-size:11px}.brand img{width:24px;height:24px}.top-actions{gap:2px}header{padding:0 6px}#theme,#projects-open,#reset-canvas,#export-open{min-width:27px}.top-actions #redo{display:none}}
/* Keep the main adjustment tools and presets together within the panel. */
#live-adjust>.look-select{display:none}#live-adjust>details:first-of-type>summary{display:none}#live-adjust>details:first-of-type{padding-bottom:8px}.adjust-slider{padding:5px 0;margin:8px 0!important}.adjust-slider input{margin-top:11px}#image-summary{margin-bottom:16px}#live-adjust>.button-grid button{min-height:34px}#sidebar{padding-bottom:20px}.quick-presets{margin-top:14px}#reset-canvas-settings{position:static;margin-top:14px}#top-tools button{white-space:nowrap}.quick-list button b{top:50%;transform:translateY(-50%)}
/* Compact header and ready-made Studio library. */
header{height:58px}header .brand{font-size:18px}.brand img{width:32px;height:32px}.editor-mode{padding:8px 12px}header button,header summary{min-height:35px;padding:7px 10px;border-radius:9px}header #export-open{padding:8px 16px}main{height:calc(100dvh - 91px)}.studio-tabs{display:flex;gap:5px;background:var(--bg);border-radius:10px;padding:4px;margin:16px 0}.studio-tabs button{flex:1;min-width:0;padding:8px 4px;font-size:11px;min-height:34px;border:0;background:none}.studio-tabs [aria-selected=true]{background:var(--brand);color:white}#studio-template-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.studio-template{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:5px;padding:6px;min-width:0;text-align:left}.studio-template img{width:100%;height:120px;object-fit:contain;background:var(--bg);border-radius:7px}.studio-template strong{font-size:10px;line-height:1.3}.studio-template small{font-size:8px;color:var(--muted)}.frame-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}.frame-style-grid button{display:flex;flex-direction:column;gap:6px;padding:9px;min-width:0}.frame-style-grid strong{font-size:10px}.frame-style-grid small{font-size:9px;color:var(--muted)}.frame-preview{display:block;width:100%;height:66px;background:linear-gradient(135deg,#c8dce5,#c7c7ed);border:5px solid #b99860;box-sizing:border-box}.frame-rounded{border-radius:14px}.frame-double,.frame-classic,.frame-art2{border-style:double;border-width:7px}.frame-corners{border-style:dashed}.frame-gallery,.frame-museum{border:10px solid #f9f6ee;box-shadow:0 1px 5px #8885}.frame-polaroid{border:7px solid white;border-bottom-width:18px}.frame-accent{border-left-width:1px;border-right-width:1px}.frame-shadow{box-shadow:4px 5px 5px #3336}.frame-ornate,.frame-art1{border-style:ridge;border-width:9px}.frame-inset{border-style:groove;border-width:9px}.frame-pine{border-color:#bf925a}.frame-oak{border-color:#906333}.frame-ebony{border-color:#252127}.frame-rainbow{border-color:#7857fa #26b8d2 #f3bc58 #f069a5}.frame-grunge1{border-style:dashed}.frame-grunge2{border-style:dotted}
@media(min-width:761px) and (max-width:1000px){#sidebar{top:69px}}
@media(max-width:760px){header{height:54px}header .brand{font-size:14px!important}.brand img{width:26px;height:26px}main{height:calc(100dvh - 87px)}#studio-template-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.studio-template img{height:100px}.frame-style-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.frame-preview{height:55px}}

/* Revision 8: themed File menu and compact copyright footer. */
header #file-menu .file-actions{width:260px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 90px);overflow-y:auto;padding:10px;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:0 16px 40px #0f172a2e;display:flex;flex-direction:column;gap:5px}
header #file-menu:not([open]) .file-actions{display:none}
header #file-menu .file-actions button{width:100%;min-height:42px;padding:11px 13px;justify-content:flex-start;text-align:left;white-space:normal;background:transparent;color:var(--ink);border:1px solid transparent;border-radius:10px;font-size:13px;font-weight:500;transition:background 150ms ease,border-color 150ms ease}
header #file-menu .file-actions button:hover{background:var(--tint);border-color:var(--line)}
header #file-menu .file-actions button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
header #file-menu .file-actions #save-project{margin-top:9px;justify-content:center;gap:9px;background:linear-gradient(135deg,#6d48ed,#356df3);color:#fff;border-color:transparent;font-weight:600;box-shadow:0 4px 12px #534ce238}
header #file-menu .file-actions #save-project:hover{background:linear-gradient(135deg,#603bdc,#285de0)}
#save-project .save-menu-icon{width:18px;height:18px;flex-shrink:0}
footer.site-footer{gap:10px}
.site-copyright{flex-shrink:0;color:var(--muted)}
footer.site-footer #status{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}
footer.site-footer #save-project-bottom{flex-shrink:0;background:var(--tint);color:var(--ink);border:1px solid var(--line);border-radius:8px;font-weight:600}
footer.site-footer #save-project-bottom:hover{border-color:var(--brand)}
@media(max-width:760px){footer.site-footer #status{display:none}footer.site-footer{gap:5px;padding:0 8px}.site-copyright{font-size:8px}footer.site-footer #save-project-bottom{font-size:8px}}
@media(prefers-reduced-motion:reduce){header #file-menu .file-actions button{transition:none}}
/* Revision 9: large shared canvas preview, including mobile Meme and Studio. */
.workspace-heading{gap:8px}.workspace-heading #doc-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.canvas-view-tabs{display:flex;gap:3px;margin-left:auto;flex-shrink:0;padding:2px;background:var(--tint);border-radius:9px}
.canvas-view-tabs button{min-height:25px;padding:3px 9px;font-size:11px;border:0;background:transparent;color:var(--ink);border-radius:7px}
.canvas-view-tabs button.active{background:var(--surface)}
.canvas-view-tabs #canvas-preview-open{background:var(--brand);color:white}
#canvas-preview-dialog{position:fixed;inset:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;padding:0;border:0;border-radius:0;background:var(--stage);color:var(--ink);overflow:hidden}
#canvas-preview-dialog[open]{display:flex;flex-direction:column}
#canvas-preview-dialog::backdrop{background:#101827dd}
.preview-heading,.preview-controls{display:flex;align-items:center;gap:10px;flex-shrink:0;padding:10px 14px;background:var(--surface);border-bottom:1px solid var(--line)}
.preview-heading{padding-top:max(10px,env(safe-area-inset-top))}.preview-heading strong{flex:1}.preview-heading button{font-size:12px}
.preview-controls{justify-content:center;border-bottom:0;border-top:1px solid var(--line);padding-bottom:max(10px,env(safe-area-inset-bottom))}
.preview-controls button{min-width:42px}.preview-controls output{min-width:45px;text-align:center;font-variant-numeric:tabular-nums}.preview-controls span{font-size:11px;color:var(--muted)}
#canvas-preview-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y pinch-zoom}
#canvas-preview-content{display:flex;min-width:100%;min-height:100%;width:max-content;padding:12px;box-sizing:border-box}
#canvas-preview-content canvas{display:block;flex-shrink:0;margin:auto;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 0/16px 16px;box-shadow:0 6px 24px #0002}
@media(max-width:760px){.workspace-heading{height:36px!important;padding:3px 7px}.workspace-heading #doc-size{display:none}.canvas-view-tabs button{font-size:10px;min-height:26px;padding:3px 8px}.preview-controls{gap:6px}.preview-controls span{display:none}.preview-heading{padding-left:10px;padding-right:10px}.preview-heading strong{font-size:14px}}
/* Revision 10: mobile tools occupy a compact grid row, not canvas padding. */
@media(max-width:760px){
 body.panel-open main,body.properties-open main{grid-template-rows:38px minmax(0,1fr) clamp(150px,26dvh,220px) 62px}
 body.panel-open #tools,body.properties-open #tools{grid-row:4}
 body.panel-open #workspace,body.properties-open #workspace{padding-bottom:0}
 body.panel-open #quick-sidebar,body.properties-open #sidebar{position:relative;inset:auto;grid-column:1;grid-row:3;width:auto;height:auto;max-height:none;min-height:0;margin:0;padding:8px 12px;overflow:auto;border-radius:12px;box-shadow:none}
 body.properties-open #quick-sidebar{display:none}
 body.panel-open #photo-strip,body.properties-open #photo-strip{display:none}
 body.panel-open #stage,body.properties-open #stage{padding:8px}
 #quick-sidebar .side-title,#sidebar>.side-title{position:sticky;top:-8px;z-index:3;background:var(--surface);padding:5px 0;margin:0 0 7px}
 #quick-sidebar .side-title h1,#sidebar>.side-title h2{font-size:13px}
 #close-sidebar,#close-properties{min-height:30px;padding:3px 9px;font-size:12px}
 .mobile-panel-toggle{display:inline-flex;min-height:30px;padding:3px 9px;margin-left:auto;font-size:11px}
 body.mobile-tools-small.panel-open main,body.mobile-tools-small.properties-open main{grid-template-rows:38px minmax(0,1fr) 98px 62px}
 body.panel-open #panel textarea,body.properties-open #sidebar textarea{min-height:52px}
}
.mobile-panel-toggle{display:none}
@media(max-width:760px){.mobile-panel-toggle{display:inline-flex}}
@media(max-width:760px) and (max-height:560px){body.panel-open main,body.properties-open main{grid-template-rows:30px minmax(0,1fr) 110px 50px}body.panel-open #tools button,body.properties-open #tools button{min-height:42px}}
@media(max-width:760px){#quick-sidebar .side-title .mobile-panel-toggle,#sidebar .side-title .mobile-panel-toggle{width:auto;flex:0 0 auto;white-space:nowrap;padding:3px 9px;font-size:11px}#quick-sidebar .side-title h1,#sidebar>.side-title h2{margin-right:auto}#close-sidebar,#close-properties{flex-shrink:0}}
/* Revision 11: constrain mobile layout and avoid focus-triggered input zoom. */
@media(max-width:760px){
 html,body{width:100%;max-width:100%;height:var(--mobile-visible-height,100dvh);min-height:0;overflow:hidden}
 body>main{height:calc(var(--mobile-visible-height,100dvh) - 87px);min-height:0;min-width:0;max-width:100%;overflow:hidden}
 main>*{min-width:0;max-width:100%}
 #workspace,#stage,#quick-sidebar,#sidebar,#panel{min-width:0;min-height:0}
 #quick-sidebar,#sidebar{overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
 #panel .fields,#sidebar .fields{grid-template-columns:repeat(2,minmax(0,1fr))}
 #panel label,#sidebar label,#panel .fields>*,#sidebar .fields>*{min-width:0;max-width:100%}
 input,select,textarea,#panel input,#panel select,#panel textarea,#sidebar input,#sidebar select,#sidebar textarea{font-size:16px!important;min-width:0;max-width:100%;box-sizing:border-box}
 textarea{resize:none}
 .canvas-container{flex-shrink:0}
 body.mobile-keyboard-open main{grid-template-rows:30px minmax(0,1fr) 42px}
 body.mobile-keyboard-open.panel-open main,body.mobile-keyboard-open.properties-open main{grid-template-rows:30px minmax(0,1fr) min(130px,30%) 42px}
 body.mobile-keyboard-open #tools button{min-height:36px;padding:2px 5px}
 body.mobile-keyboard-open #tools svg{width:16px;height:16px}
 body.mobile-keyboard-open #tools{padding:2px}
 body.mobile-keyboard-open #workspace .zoom-bar{display:none}
 body.mobile-keyboard-open #quick-sidebar .side-title,body.mobile-keyboard-open #sidebar>.side-title{position:static}
}
/* Revision 12: predictable sticker tiles and grouped mobile creation tools. */
#sticker-catalog{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:80px;gap:8px;align-content:start;max-height:none;overflow:visible}
#sticker-catalog>button{display:flex;align-items:center;justify-content:center;width:100%;height:80px;min-height:0;min-width:0;aspect-ratio:auto;padding:8px;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--tint)}
#sticker-catalog>button:hover{border-color:var(--brand);background:var(--surface)}
#sticker-catalog img{display:block;width:100%;height:100%;max-width:100%;max-height:64px;object-fit:contain;pointer-events:none}
#mobile-create-dock{display:none}
#mobile-tool-picker{width:min(560px,calc(100vw - 16px));max-width:calc(100vw - 16px);height:min(650px,85dvh);max-height:85dvh;padding:0;border:1px solid var(--line);border-radius:20px;background:var(--surface);color:var(--ink);overflow:hidden}
#mobile-tool-picker[open]{display:flex;flex-direction:column}#mobile-tool-picker::backdrop{background:#10182788}
.mobile-picker-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line)}.mobile-picker-heading h2{font-size:17px;margin:0}.mobile-picker-heading button{min-width:42px}
#mobile-picker-body{padding:0 14px 18px;overflow:auto;min-height:0}.mobile-picker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.mobile-picker-grid button{min-width:0;min-height:76px;padding:10px 4px;flex-direction:column;font-size:12px;background:var(--tint)}.mobile-picker-grid svg,#mobile-create-dock svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}#mobile-picker-body h3{font-size:12px;color:var(--muted);margin:16px 0 8px}
@media(max-width:760px){
 #tools{display:none!important}
 #mobile-create-dock{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-column:1;grid-row:3;gap:3px;padding:4px;background:var(--surface);border:1px solid var(--line);border-radius:13px;min-height:0}
 body.panel-open #mobile-create-dock,body.properties-open #mobile-create-dock{grid-row:4}
 #mobile-create-dock button{min-width:0;min-height:0;padding:4px;flex-direction:column;gap:3px;font-size:10px;border:0;background:transparent;color:var(--ink)}
 #mobile-create-dock [data-mobile-action=add]{background:var(--brand);color:white;border-radius:10px}
 body.mobile-keyboard-open #mobile-create-dock button{font-size:9px;padding:2px}body.mobile-keyboard-open #mobile-create-dock svg{width:16px;height:16px}
 #panel:has(#sticker-catalog)>h2,#panel:has(#sticker-catalog)>p{display:none}
 #sticker-catalog{grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:68px;gap:7px}
 #sticker-catalog>button{height:68px;padding:7px}#sticker-catalog img{max-height:54px}
 #panel:has(#sticker-catalog)>label{margin:0 0 8px}
 #panel:has(#sticker-catalog) #sticker-upload{width:100%;margin-top:10px}
}
/* Revision 13: anchor to Safari's visual viewport while its keyboard pans. */
.mobile-keyboard-done{display:none}
@media(max-width:760px){
 html{height:100%;overflow:hidden}
 body{position:fixed;left:0;right:0;top:var(--mobile-visible-top,0px);margin:0;height:var(--mobile-visible-height,100dvh);overflow:hidden}
 body.mobile-keyboard-open>header{height:44px;min-height:44px}
 body.mobile-keyboard-open>footer,body.mobile-keyboard-open #top-tools,body.mobile-keyboard-open #mobile-create-dock{display:none!important}
 body.mobile-keyboard-open>main{height:calc(var(--mobile-visible-height,100dvh) - 44px);grid-template-rows:0 minmax(0,1fr) 0;gap:4px;padding:4px 6px}
 body.mobile-keyboard-open.panel-open>main,body.mobile-keyboard-open.properties-open>main{grid-template-rows:0 minmax(0,1fr) clamp(105px,34%,170px) 0}
 body.mobile-keyboard-open #quick-sidebar .side-title,body.mobile-keyboard-open #sidebar>.side-title{position:sticky;top:-8px;padding:3px 0;z-index:5}
 body.mobile-keyboard-open .mobile-panel-toggle,body.mobile-keyboard-open #close-sidebar,body.mobile-keyboard-open #close-properties{display:none}
 body.mobile-keyboard-open .side-title .mobile-keyboard-done{display:inline-flex;width:auto;min-height:28px;white-space:nowrap;font-size:11px;padding:3px 9px;background:var(--brand);color:white;margin-left:auto}
 body.mobile-keyboard-open #panel textarea{height:64px;min-height:64px}
 body.mobile-keyboard-open #stage{padding:4px}
}
