:root{color-scheme:light;--bg:#f5f3ec;--ink:#35372f;--muted:#85877c;--line:#dedfd4;--accent:#657453;--accent-light:#edf0e7;--serif:"Noto Serif SC","Songti SC","SimSun",serif}
*{box-sizing:border-box}body{margin:0;color:var(--ink);background:var(--bg);font:13px/1.6 "Microsoft YaHei",system-ui,sans-serif}button,input,select,textarea{font:inherit;color:inherit}button,select,input,textarea{border:1px solid var(--line);border-radius:5px;background:#fffdf8}button{padding:8px 12px;cursor:pointer;white-space:nowrap}button:hover{background:var(--accent-light);border-color:#a4af96}button:disabled{opacity:.35;cursor:default}button.primary{background:var(--ink);border-color:var(--ink);color:#faf9f1}button.primary:hover{background:#515b46}button.danger{color:#99583f}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,svg g:focus-visible{outline:2px solid var(--accent);outline-offset:3px}input,select{min-width:0;padding:8px 9px}input[type=number]{font-variant-numeric:tabular-nums;width:100%}input[type=checkbox]{accent-color:var(--accent);padding:0}input[type=range]{accent-color:var(--accent);width:100%;padding:0;margin:7px 0 0}textarea{display:block;width:100%;padding:12px;resize:vertical;line-height:1.85;font-family:var(--serif);font-size:15px}select{width:100%}input[type=color]{width:42px;height:32px;padding:3px;cursor:pointer}h1,h2,p{margin:0}h1{font:26px/1.4 var(--serif);letter-spacing:.09em}h2{font-size:13px;font-weight:600}small{font-size:11px}.app-header{height:78px;padding:0 28px;display:flex;align-items:center;gap:35px;background:#faf9f4;border-bottom:1px solid var(--line)}.brand{text-decoration:none;color:inherit;display:flex;align-items:center;gap:12px;font-family:var(--serif);font-size:23px;letter-spacing:.15em;white-space:nowrap}.brand-mark{width:37px;height:42px;background:#46513d;color:#f5f0df;text-align:center;line-height:42px;font-size:28px;letter-spacing:0}.brand small{display:block;color:var(--muted);font:10px/1.5 system-ui;letter-spacing:.12em}.document-name{flex:1;min-width:100px;display:flex;flex-direction:column;align-items:flex-start}.document-name input{border-color:transparent;background:transparent;padding:0;width:min(260px,100%);font-size:14px}.document-name input:hover{border-color:var(--line)}#save-state{font-size:10px;color:var(--muted)}.header-actions{display:flex;gap:8px;align-items:center}.header-actions #undo,.header-actions #redo{border:0;background:transparent;font-size:23px;padding:0 7px}.separator{height:20px;border-left:1px solid var(--line);margin:0 5px}.workspace{height:calc(100dvh - 78px);display:grid;grid-template-columns:minmax(0,1fr) 370px}.preview{display:flex;flex-direction:column;min-width:0;background:#d9d9d0}.preview-toolbar{height:54px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 24px;border-bottom:1px solid #c9cbc0;font-size:11px}.toolbar-label{display:flex;align-items:center;gap:8px}.dot{width:5px;height:5px;background:var(--accent);border-radius:50%}.view-tools{display:flex;align-items:center;gap:14px}.view-tools label{display:flex;align-items:center;gap:4px;white-space:nowrap}.view-tools button,.view-tools select{background:transparent;font-size:11px;padding:4px 7px;border-color:#c1c5b7;width:auto}.stage-shell{flex:1;min-height:0;overflow:auto;display:grid;place-items:center;padding:30px;background-image:radial-gradient(#b1b5a540 .6px,transparent .6px);background-size:7px 7px}.stage{position:relative;flex-shrink:0;box-shadow:0 2px 5px #353b2820,0 16px 40px #353b2825;line-height:0}#art{width:100%;height:100%;display:block}#overlay{position:absolute;inset:0;width:100%;height:100%;overflow:visible;touch-action:none}#overlay g{cursor:move;outline:none}#overlay .handle{cursor:nwse-resize}#overlay .region-frame{stroke:#667856;stroke-width:1;stroke-dasharray:5 4;fill:transparent;vector-effect:non-scaling-stroke}#overlay .selected .region-frame{stroke:#53693e;stroke-width:1.5;stroke-dasharray:none}#overlay .badge{fill:#faf9f0;stroke:#667856;vector-effect:non-scaling-stroke}#overlay text{font-family:system-ui;fill:#435632;pointer-events:none;text-anchor:middle;dominant-baseline:central}#overlay .handle{fill:#faf9f0;stroke:#435632;vector-effect:non-scaling-stroke}.preview-footer{padding:13px 24px;display:flex;justify-content:space-between;color:#717768;font-size:10px;gap:12px}.flow-report{padding:11px 24px;background:#eef0e7;border-top:1px solid #d3d8c9;min-height:45px;font-size:12px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.flow-report.warning{background:#f2e9d9;color:#84592f}.flow-report button{font-size:11px;padding:3px 8px;background:transparent;border-color:#c5b292}.inspector{border-left:1px solid #c6c9bd;display:flex;flex-direction:column;min-height:0;background:#faf9f4}.tabs{height:54px;display:flex;flex-shrink:0;border-bottom:1px solid var(--line);padding:0 16px;gap:3px}.tabs button{flex:1;border:0;border-radius:0;background:transparent;color:var(--muted);padding:0 6px;position:relative}.tabs button[aria-selected=true]{color:var(--ink);font-weight:600}.tabs button[aria-selected=true]:after{content:"";height:2px;position:absolute;bottom:0;left:10px;right:10px;background:var(--accent)}.panel-scroll{padding:26px 24px 32px;overflow-y:auto;flex:1}.section-heading{margin-bottom:28px}.eyebrow{font-size:9px;letter-spacing:.18em;color:var(--accent);display:block;margin-bottom:12px}.section-heading p{font-size:11px;color:var(--muted);margin-top:10px}.field{display:block;margin:16px 0 9px;font-size:12px}.field>input,.field>select,.field>textarea{display:block;width:100%;margin-top:7px}.field .inline{margin-top:7px}.hint{font-size:11px;color:var(--muted);line-height:1.8;margin:8px 0 14px}.two-columns{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.wide{width:100%;margin-top:7px}.divider{height:1px;background:var(--line);margin:25px 0}.color-field{display:flex;align-items:center;justify-content:space-between;font-size:12px;margin:17px 0}.color-field span{display:flex;align-items:center;gap:8px}.color-field output{font:11px monospace;color:var(--muted)}.swatches{display:flex;gap:9px;flex-wrap:wrap;margin:20px 0}.swatches button{width:30px;height:30px;border:3px solid #fffdf7;padding:0;box-shadow:0 0 0 1px #d5d5c7;border-radius:50%}.swatches button:hover{box-shadow:0 0 0 2px #71845b}.info-card{background:#efeee5;padding:18px;margin-top:32px;border-left:2px solid #a3ab92}.info-card b{font:15px var(--serif)}.info-card p{font-size:11px;color:#848576;line-height:1.9;margin-top:9px}.help{font-size:11px;color:var(--muted);margin-top:24px}.help summary{cursor:pointer}.help p{margin-top:10px}.inline{display:flex;gap:8px;align-items:center}.inline>*{min-width:0;flex:1}.inline button{flex:0 0 auto}.section-row{display:flex;align-items:center;justify-content:space-between;margin:24px 0 12px}.section-row button{font-size:11px;padding:4px 8px}.region-list{display:flex;flex-direction:column;gap:7px;margin-top:14px}.region-row{display:flex;align-items:center;border:1px solid var(--line);border-radius:5px;padding:8px;gap:8px}.region-row.active{background:var(--accent-light);border-color:#a3b293}.region-row .select-region{border:0;padding:0;background:transparent;display:flex;gap:10px;align-items:center;flex:1;text-align:left;min-width:0}.region-row .chip{width:22px;height:30px;border:1px solid #0002;flex-shrink:0}.region-row .label{overflow:hidden;text-overflow:ellipsis}.region-row small{display:block;color:var(--muted);font-size:10px}.region-row .move{padding:0 5px;border:0;background:transparent;color:var(--muted)}.geometry .field{margin-top:8px}.count{float:right;color:var(--muted);font-size:10px}.group-heading{display:flex;justify-content:space-between;align-items:center;margin:20px 0 12px}.scope{display:flex;align-items:center;gap:8px;margin-bottom:10px}.scope select{font-size:11px;flex:1;padding:5px 6px}.scope label{font-size:10px;display:flex;align-items:center;white-space:nowrap}.param{margin:19px 0}.param-label{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:12px}.param-label input{width:76px;padding:3px 6px;text-align:right;font-size:11px;background:transparent;border-color:#e4e5da}.param.disabled{opacity:.48}.status{padding:11px 24px;border-top:1px solid var(--line);font-size:11px;color:var(--muted);min-height:43px}.status.error{color:#975236;background:#f6e9df}.scope-note{font-size:10px;color:var(--accent)}[hidden]{display:none!important}
@media(min-width:1550px){.workspace{grid-template-columns:minmax(0,1fr) 410px}.panel-scroll{padding:30px 32px}}
@media(max-width:1000px){.app-header{padding:0 16px;gap:18px}.document-name{display:none}.header-actions{margin-left:auto}.workspace{grid-template-columns:minmax(0,1fr) 330px}.panel-scroll{padding:22px 18px}.preview-toolbar{padding:0 12px}.view-tools{gap:7px}.toolbar-label{display:none}.stage-shell{padding:20px}.preview-footer{padding:10px 12px;flex-wrap:wrap}}
@media(max-width:720px){.app-header{height:68px;padding:0 12px}.brand{font-size:20px;gap:7px}.brand-mark{width:30px;height:35px;line-height:35px;font-size:23px}.brand small{display:none}.header-actions{gap:5px}.header-actions button{font-size:11px;padding:7px}.separator,#undo,#redo{display:none}.workspace{height:auto;display:flex;flex-direction:column}.preview{height:65dvh;min-height:420px}.inspector{min-height:450px;border-left:0}.panel-scroll{overflow:visible}.tabs{position:sticky;top:0;background:#faf9f4;z-index:3}.flow-report{font-size:11px;padding:8px 14px}.status{position:sticky;bottom:0;background:#faf9f4}.preview-footer span:last-child{display:none}}
@media(prefers-reduced-motion:no-preference){button{transition:background .12s,border-color .12s}}


/* Field comparisons and independent axis guides. */
.diagnostic-toolbar{display:flex;align-items:center;gap:14px;padding:9px 24px;border-bottom:1px solid #c5cbbb;background:#e9ece1;flex-wrap:wrap;flex-shrink:0;font-size:11px}
.diagnostic-toolbar label{display:flex;align-items:center;gap:7px}
.diagnostic-toolbar select{width:auto;padding:4px 6px;font-size:11px}
.field-legend{display:flex;align-items:center;gap:7px;color:#68735e;font-size:10px}
.field-legend i{width:55px;height:8px;background:linear-gradient(90deg,#2d6e93,#e9e7dc,#b54d27);border-radius:2px}
.axis-legend{padding:6px 24px;color:#296d76;background:#edf3ed;font-size:10px;flex-shrink:0}
.field-inspector{border-block:1px solid var(--line);padding-bottom:6px;margin-top:22px}
.field-inspector .section-row{margin-top:16px}
.field-thumbnails{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
.field-card{padding:5px 2px 3px;background:#efeee5;min-width:0}
.field-card canvas{display:block;width:100%;height:auto;aspect-ratio:144/176}
.field-card span{font-size:10px}
.field-card[aria-pressed=true]{border-color:#697d51;background:#e1e8d5;box-shadow:0 0 0 1px #697d51}
.inspect-link{font-size:10px;padding:2px 0;margin-top:5px;color:#607447;border:0;background:transparent}
.param>.hint{display:block;margin:4px 0 0;font-size:10px}
@media(max-width:1000px){.view-tools{flex-wrap:wrap}.preview-toolbar{min-height:54px;height:auto;padding-block:8px}.diagnostic-toolbar{padding:8px 12px;gap:8px}.diagnostic-toolbar select{max-width:145px}}

.preview{min-height:0;overflow:hidden}

/* View navigation never changes document geometry. */
.stage-shell{position:relative;display:block;overflow:hidden;touch-action:none;cursor:grab;user-select:none}
.stage{position:absolute;left:50%;top:50%}
.stage-shell.pan-mode #overlay g,.stage-shell.pan-ready #overlay g{cursor:grab}
.stage-shell.panning,.stage-shell.panning #overlay g{cursor:grabbing}
#text-overlay{position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none}
#text-overlay text{text-anchor:middle;dominant-baseline:central;font-family:"Microsoft YaHei","Noto Sans CJK SC",sans-serif}
.text-tools input[type=number]{width:68px;padding:3px 5px}
.text-tools input[type=range]{width:80px;margin:0}
.text-tools input[type=color]{height:26px;width:34px}
.preview-toolbar{height:auto;min-height:54px;padding-block:8px;gap:8px}
.view-tools{flex-wrap:wrap;gap:10px}
.text-tools{gap:10px}

.grid-dialog{width:min(860px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--line);border-radius:10px;color:var(--ink);background:#faf9f4;box-shadow:0 24px 90px #20271f40}
.grid-dialog::backdrop{background:#20271f66}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;border-bottom:1px solid var(--line);gap:20px}
.dialog-heading h2{font:24px var(--serif)}.dialog-heading p{font-size:11px;color:var(--muted);margin-top:5px}
.dialog-heading button{border:0;background:transparent;font-size:18px}
.grid-dialog-body{display:grid;grid-template-columns:1fr 1fr;gap:28px;padding:22px 24px}
.grid-dialog h3{font-size:12px;margin:0 0 8px;font-weight:600}
.grid-settings .field{margin:6px 0 10px}.grid-settings .field>input,.grid-settings .field>select{margin-top:4px}
.grid-settings .color-field{margin:10px 0}.grid-settings .hint{margin:0 0 12px}
.clear-grid{display:flex;align-items:center;gap:6px;margin-top:16px;font-size:12px}
.grid-preview-panel{min-width:0}.grid-preview-shell{height:365px;padding:16px;background:#deded4;border-radius:5px}
#grid-preview{width:100%;height:100%;display:block;overflow:hidden}
.dialog-footer{padding:16px 24px;border-top:1px solid var(--line);display:flex;align-items:center;gap:20px;justify-content:space-between}
#grid-message{font-size:11px;color:var(--accent);flex:1}#grid-message.error{color:#975236}
@media(max-width:650px){.grid-dialog-body{grid-template-columns:1fr;gap:18px;padding:16px}.grid-preview-shell{height:240px}.dialog-heading,.dialog-footer{padding:16px}.dialog-footer{align-items:stretch;flex-direction:column;gap:12px}.dialog-footer .inline{justify-content:flex-end}}

.preview-tools{display:flex;align-items:center;gap:8px;border:1px solid #b6beaa;border-radius:5px;padding:4px 7px}.preview-tools input{accent-color:var(--accent)}#ruler-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3}.stage-shell.ruler-mode{cursor:crosshair}#export-resolution{width:auto;font-size:11px;max-width:105px}#ruler-info{font-variant-numeric:tabular-nums} @media(max-width:650px){.header-actions{flex-wrap:wrap;justify-content:flex-end;gap:4px}.app-header{height:auto;min-height:78px;padding-block:8px}.preview-tools{flex-wrap:wrap}}

/* Compact, mutually exclusive icon tools; native radios retain keyboard navigation. */
.view-tools .preview-tools{gap:3px;padding:3px;background:#eef0e7}
.view-tools .tool-button{position:relative;display:block;width:32px;height:32px;cursor:pointer}
.tool-button input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;z-index:1}
.tool-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border:1px solid transparent;border-radius:3px;color:#606758;transition:background .12s,color .12s}
.tool-icon svg{width:21px;height:21px;display:block}
.tool-button:hover .tool-icon{background:#dfe5d4;color:#33442c}
.tool-button input:checked+.tool-icon{background:#4c5e40;color:#fffdf4;border-color:#3e5033;box-shadow:inset 0 1px 2px #26321e20}
.tool-button input:focus-visible+.tool-icon{outline:2px solid #506b39;outline-offset:2px}
.tool-button::after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);padding:4px 8px;border-radius:4px;background:#33392f;color:#fffdf5;font-size:11px;line-height:1.6;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;z-index:10}
.tool-button:hover::after,.tool-button:has(input:focus-visible)::after{opacity:1;visibility:visible;transition:opacity .12s .2s}

.preview-tools:hover .tool-button:not(:hover)::after{opacity:0;visibility:hidden;transition:none}

#editor-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2}#editor-overlay line,#editor-overlay rect{stroke-width:1;vector-effect:non-scaling-stroke}

/* Contextual paper cursors: draw, add to selection, remove from selection. */
#stage-shell[data-paper-cursor="create"],#stage-shell[data-paper-cursor="create"] #overlay g,#stage-shell[data-paper-cursor="create"] #overlay .handle{cursor:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22white%22%20stroke-width%3D%224%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%202v20M2%2012h20%22%2F%3E%3Crect%20x%3D%2219%22%20y%3D%2219%22%20width%3D%2210%22%20height%3D%2210%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M24%2021v6m-3-3h6%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22%23273321%22%20stroke-width%3D%221.6%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%202v20M2%2012h20%22%2F%3E%3Crect%20x%3D%2219%22%20y%3D%2219%22%20width%3D%2210%22%20height%3D%2210%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M24%2021v6m-3-3h6%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 12 12,crosshair}
#stage-shell[data-paper-cursor="add"],#stage-shell[data-paper-cursor="add"] #overlay g,#stage-shell[data-paper-cursor="add"] #overlay .handle{cursor:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22white%22%20stroke-width%3D%224%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%202v21l5-6%205%2010%204-2-5-10h8z%22%2F%3E%3Cpath%20d%3D%22M25%205v10m-5-5h10%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22%23273321%22%20stroke-width%3D%221.6%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%202v21l5-6%205%2010%204-2-5-10h8z%22%2F%3E%3Cpath%20d%3D%22M25%205v10m-5-5h10%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 4 2,default}
#stage-shell[data-paper-cursor="remove"],#stage-shell[data-paper-cursor="remove"] #overlay g,#stage-shell[data-paper-cursor="remove"] #overlay .handle{cursor:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22white%22%20stroke-width%3D%224%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%202v21l5-6%205%2010%204-2-5-10h8z%22%2F%3E%3Cpath%20d%3D%22M20%2010h10%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22white%22%20stroke%3D%22%23273321%22%20stroke-width%3D%221.6%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%202v21l5-6%205%2010%204-2-5-10h8z%22%2F%3E%3Cpath%20d%3D%22M20%2010h10%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 4 2,default}

#stage-shell[data-guide-cursor="x"]{cursor:ew-resize}#stage-shell[data-guide-cursor="y"]{cursor:ns-resize}

#ink-color-hex{width:86px;font:11px monospace;padding:5px}.ink-swatches{gap:6px;margin:12px 0 20px}.ink-swatches button{width:auto;height:auto;border:1px solid var(--line);border-radius:4px;padding:5px 7px;box-shadow:none;font-size:10px;display:flex;gap:5px;align-items:center}.ink-swatches button::before{content:"";width:12px;height:12px;border-radius:50%;background:var(--swatch)}.ink-swatches button[aria-pressed=true]{outline:2px solid var(--accent);outline-offset:1px}

.text-choices{border:1px solid var(--border,#ccc);padding:10px;margin:12px 0}.text-choices div{display:flex;flex-wrap:wrap;gap:8px 14px}.text-choices label{display:inline-flex;gap:5px;align-items:center}.text-choices small{flex-basis:100%}.text-module{margin:12px 0}.text-module-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.text-module textarea{width:100%;box-sizing:border-box}.text-module-heading button{font-size:12px}#add-paragraph{margin-bottom:16px}

.text-module-heading label{display:inline-flex;align-items:center;gap:8px}.text-module-heading .count{float:none}.text-choices{border-color:var(--line)}

@media(max-width:720px){.app-header{height:auto;min-height:68px;flex-wrap:wrap;padding-block:10px;row-gap:6px}.header-actions{flex:1 1 100%;justify-content:flex-start;flex-wrap:wrap}.header-actions #undo,.header-actions #redo{display:inline-block}}
