*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden}body{height:100dvh;display:flex;flex-direction:column;background:#f6f0e5;color:#173f30;font:14px/1.4 system-ui,-apple-system,'PingFang SC','Microsoft YaHei',sans-serif}button,input{font:inherit}button{min-height:36px;padding:5px 10px;border:1px solid #d5d9cd;border-radius:9px;background:#fffdf7;color:#204b38;cursor:pointer;touch-action:manipulation}button:disabled{opacity:.35}button:focus-visible,input:focus-visible{outline:2px solid #cf9e30;outline-offset:1px}[hidden]{display:none!important}.primary,.active{background:#124b38;color:#fff9e9;border-color:#124b38}header{display:flex;align-items:center;gap:7px;min-height:44px;padding:3px 8px;flex:none}header .brand,header h1,header p{display:none}header .home-link{font-size:0;text-decoration:none;color:#124b38;margin-right:auto}header .home-link:after{content:'‹ 返回';font-size:15px}header button{font-size:13px}main{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;position:relative}.workspace{flex:1;min-height:0;padding:0 3px}.viewport{height:100%;position:relative;overflow:hidden;touch-action:none;overscroll-behavior:none}.paper-wrap{position:absolute;left:50%;top:50%;width:var(--paper-width,300px);transform:translate(-50%,-50%);background:white;box-shadow:0 3px 14px #604f2720}#board{display:block;width:100%;height:auto;touch-action:none;user-select:none;-webkit-user-select:none}.canvas-note,body>footer{display:none}.controls{flex:none;position:relative;padding:5px 5px max(5px,env(safe-area-inset-bottom));background:#fffdf7;border-top:1px solid #ded8c9}.tabs{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}.tabs button{font-size:14px;min-height:42px;padding:4px 0}.tool-sheet{position:absolute;bottom:100%;left:0;right:0;padding:5px 9px 8px;background:#fffdf7;border:1px solid #ded8c9;border-radius:12px 12px 0 0;box-shadow:0 -3px 12px #173f3017;max-height:min(220px,38dvh);display:flex;flex-direction:column}.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:6px;flex:none;height:30px;color:#627264;font-size:11px}.sheet-head button{min-height:28px;padding:2px 10px;font-size:12px}#sheetContent{overflow:auto;overscroll-behavior:contain;min-height:0}.panel{padding-top:3px}.colors{display:flex;gap:7px;align-items:center;margin:3px 0 7px;flex-wrap:wrap}.swatch{width:30px;min-height:30px;border:3px solid white;border-radius:50%;padding:0;background:var(--c);box-shadow:0 0 0 1px #d9d9d0}.swatch.active{box-shadow:0 0 0 2px #ac935d}.row{display:flex;gap:6px;align-items:center}.row>input{flex:1;min-width:0}.seg{display:flex;gap:4px}.seg button{min-height:32px;padding:3px 12px}.more-color{margin-left:auto;font-size:12px;display:flex;align-items:center;gap:5px}.more-color input{width:30px;height:30px;border:0;padding:0;background:none}#paintPanel.text-color .row>span,#paintPanel.text-color .seg{display:none}#paintPanel.text-color{display:flex;align-items:center;gap:6px}#paintPanel.text-color .colors{margin:3px 0}#paintPanel.text-color .more-color{font-size:0}input:not([type]),input[type=text]{width:100%;padding:6px 8px;border:1px solid #d5d9cd;border-radius:7px;font-size:16px;color:#243c2d;background:white}#textPanel>label{display:none}#objectPanel{display:grid;grid-template-columns:1fr 1fr;gap:4px 10px}#objectPanel>.row:first-child{display:none}#editTextRow{grid-column:1/-1;display:flex;gap:5px}#editTextRow input{height:32px}.slider{display:flex;align-items:center;gap:5px;font-size:12px;margin:0;min-width:0}.slider input{width:0;flex:1;min-height:32px;accent-color:#15563c}#objectPanel>.row:last-child{grid-column:1/-1;gap:5px}#objectPanel button{font-size:12px;min-height:30px;padding:3px 8px}.asset-categories{display:flex;gap:5px;overflow:auto;margin-bottom:5px;flex:none}.asset-categories button{white-space:nowrap;min-height:30px;padding:3px 8px;font-size:12px}.stickers{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}.sticker{min-height:64px;padding:3px;font-size:11px;background:#f4f0e6}.sticker img{display:block;width:38px;height:38px;object-fit:contain;margin:auto}.small{font-size:11px;color:#788173;margin:3px 0}.history{display:flex;gap:5px;flex-wrap:wrap;overflow:auto;padding:4px 0}.history span{flex-basis:100%;font-size:11px;color:#788173}dialog{border:0;border-radius:16px;padding:14px;width:min(450px,calc(100% - 20px));max-height:90dvh;overflow:auto;color:#204b38;background:#fffdf7}dialog::backdrop{background:#112c22aa}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.dialog-head h2{font-size:17px;margin:0}dialog img{display:block;width:min(260px,100%);margin:10px auto}dialog p{font-size:13px}.full{width:100%;margin-bottom:7px}#download{background:#fffdf7;color:#204b38}@media(min-width:760px){.controls{width:min(760px,100%);align-self:center}.tool-sheet{max-height:260px}.stickers{grid-template-columns:repeat(8,1fr)}}

/* V3.9.8: compact font choices; direct history actions. */
.font-choices{display:flex;gap:5px;overflow-x:auto;padding:3px 0;overscroll-behavior:contain}.font-choices button{flex:none;white-space:nowrap;font-size:12px;min-height:32px;padding:3px 8px}#fontStatus:empty{display:none}.history{display:none!important}header #clearTop{color:#79523b}#fontPanel{padding-top:2px}
/* Keep font, color, size and rotation visible together on a phone. */
.tool-sheet .sheet-head{height:26px}.font-choices{padding:0}.font-choices button{min-height:30px}#paintPanel.text-color .colors{margin:2px 0}#objectPanel{gap:2px 8px}#editTextRow input{height:30px}#objectPanel button{min-height:28px}
#paintPanel.text-color .colors{gap:4px}#paintPanel.text-color .swatch{width:26px;min-height:26px}#paintPanel.text-color .more-color input{width:26px;height:26px}

/* V3.9.8.1: editor follows the keyboard's visible viewport, not document scrolling. */
#editorApp{position:fixed;top:0;left:0;width:100%;height:100dvh;display:flex;flex-direction:column;overflow:hidden;background:#f6f0e5;transform-origin:top left}#editorApp>footer{display:none}#editorApp .tool-sheet{max-height:min(220px,calc(var(--editor-height,100dvh) * .58))}#newText,#editText{font-size:16px!important}#sheetContent{overflow-anchor:none;scroll-behavior:auto}

/* Photo upload uses the previous clear button position without enlarging the toolbar. */
header #uploadPhoto{background:#175b40;border-color:#175b40;color:#fff;font-weight:650;white-space:nowrap}header #preview{white-space:nowrap}.photo-tools{grid-column:1/-1;gap:6px}#objectPanel>.row{flex-wrap:wrap}#objectPanel>.photo-tools button{min-height:32px}#photoFile[hidden]{display:none!important}

/* V4.0.8: distinct restart/undo/restore and one-line object actions. */
header #uploadPhoto{background:#efbb51;border-color:#d9a23d;color:#214637}header #restartTop{font-size:13px;padding:5px 10px;white-space:nowrap}.tabs{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.tabs button{font-size:13px}#objectPanel .object-actions{grid-column:1/-1;display:grid;grid-template-columns:1.3fr 1.3fr .8fr .8fr;gap:4px;flex-wrap:nowrap}#objectPanel .object-actions button{min-width:0;white-space:nowrap;font-size:11px;padding:3px 4px;min-height:30px}@media(max-width:350px){.tabs{gap:3px}.tabs button{font-size:12px}}

.brush-choices{gap:8px;margin-bottom:6px}.brush-choices .seg{display:flex;gap:5px}.brush-choices button{min-height:30px;padding:3px 12px}.brush-choices[hidden]{display:none!important}

/* LANJI compact layer actions: seven controls in one row on mobile. */
#objectPanel .compact-layer-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;flex-wrap:nowrap}
#objectPanel .compact-layer-actions button{min-width:0;width:100%;white-space:nowrap;font-size:clamp(10px,2.7vw,12px);padding:4px 0;min-height:32px;border-radius:7px}
#objectPanel .photo-tools{display:none!important}

#fontPanel .ln-delete-text{margin:6px 0 2px;padding:5px 12px;min-height:32px;border-color:#e3c2b9;color:#a33a2c;background:#fff7f4;font-weight:600}
